gsarti commited on
Commit
1d4ebdb
·
1 Parent(s): 9d2014f

Fix multispace and event management

Browse files
README.md CHANGED
@@ -6,7 +6,7 @@ tags:
6
  - textbox
7
  - editing
8
  - color
9
- title: gradio_highlightedtextbox v0.0.7
10
  colorFrom: indigo
11
  colorTo: green
12
  sdk: docker
 
6
  - textbox
7
  - editing
8
  - color
9
+ title: gradio_highlightedtextbox v0.0.8
10
  colorFrom: indigo
11
  colorTo: green
12
  sdk: docker
app.py CHANGED
@@ -191,6 +191,18 @@ def convert_highlighted_text_to_tagged_text(
191
  )
192
 
193
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  initial_text = "It is not something to be ashamed of: it is no different from the <d>personal fears</d> and <tm>dislikes</tm> of other things that <t>manny peopl</t> have."
195
 
196
  with gr.Blocks(
@@ -232,60 +244,64 @@ with gr.Blocks(
232
  show_label=True,
233
  info="Insert one or more tags to mark the end of a highlighted section.",
234
  )
235
- gr.Markdown("### Example tagged to highlight:")
 
 
 
 
 
 
 
 
 
 
236
  with gr.Row():
237
- tagged_t2h = gr.Textbox(
238
  initial_text,
239
  interactive=True,
240
- label="Tagged Input",
241
  show_label=True,
242
  info="Tagged text using the format above to mark spans that will be highlighted.",
243
  )
244
- high_t2h = HighlightedTextbox(
245
  convert_tagged_text_to_highlighted_text(
246
- tagged_t2h.value, tag_id.value, tag_open.value, tag_close.value
247
- ),
248
- interactive=False,
249
- label="Highlighted Output",
250
- info="Highlighted textbox intialized from the tagged input.",
251
- show_legend=True,
252
- show_label=True,
253
- legend_label="Legend:",
254
- show_legend_label=True,
255
- )
256
- gr.Markdown("### Example highlight to tagged:")
257
- with gr.Row():
258
- high_h2t = HighlightedTextbox(
259
- convert_tagged_text_to_highlighted_text(
260
- initial_text, tag_id.value, tag_open.value, tag_close.value
261
  ),
262
  interactive=True,
263
- label="Highlighted Input",
264
- info="Highlighted textbox using the format above to mark spans that will be highlighted.",
265
  show_legend=True,
266
  show_label=True,
267
  legend_label="Legend:",
268
  show_legend_label=True,
269
  )
270
- tagged_h2t = gr.Textbox(
271
- initial_text,
272
- interactive=False,
273
- label="Tagged Output",
274
- info="Tagged text intialized from the highlighted textbox.",
275
- show_label=True,
276
- )
277
 
278
  # Functions
279
 
280
- tagged_t2h.input(
281
  fn=convert_tagged_text_to_highlighted_text,
282
- inputs=[tagged_t2h, tag_id, tag_open, tag_close],
283
- outputs=high_t2h,
284
  )
285
- high_h2t.input(
286
  fn=convert_highlighted_text_to_tagged_text,
287
- inputs=[high_h2t, tag_id, tag_open, tag_close],
288
- outputs=tagged_h2t,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  )
290
  with gr.Tab("Docs"):
291
  gr.Markdown(
 
191
  )
192
 
193
 
194
+ def show_info(
195
+ highlighted_text: dict[str, str | list[tuple[str, str | None]]],
196
+ tag_id: str | list[str],
197
+ tag_open: str | list[str],
198
+ tag_close: str | list[str],
199
+ msg: str,
200
+ ) -> None:
201
+ gr.Info(
202
+ f"{msg}: {HighlightedTextbox.tuples_to_tagged_text(highlighted_text['data'], tag_id, tag_open, tag_close)}"
203
+ )
204
+
205
+
206
  initial_text = "It is not something to be ashamed of: it is no different from the <d>personal fears</d> and <tm>dislikes</tm> of other things that <t>manny peopl</t> have."
207
 
208
  with gr.Blocks(
 
244
  show_label=True,
245
  info="Insert one or more tags to mark the end of a highlighted section.",
246
  )
247
+ gr.Markdown(
248
+ """
249
+ ### Example:
250
+
251
+ The following text is tagged using the parameters above to mark spans that will be highlighted.
252
+
253
+ Both the tagged text and the highlighted text are editable, so you can see how the changes in one affect the other.
254
+
255
+ Highlights will disappear if the highlighted text is edited. Modals will appear upon focus, change, and blur events on the highlighted text.
256
+ """
257
+ )
258
  with gr.Row():
259
+ tagged = gr.Textbox(
260
  initial_text,
261
  interactive=True,
262
+ label="Tagged text",
263
  show_label=True,
264
  info="Tagged text using the format above to mark spans that will be highlighted.",
265
  )
266
+ high = HighlightedTextbox(
267
  convert_tagged_text_to_highlighted_text(
268
+ tagged.value, tag_id.value, tag_open.value, tag_close.value
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  ),
270
  interactive=True,
271
+ label="Highlighted text",
272
+ info="Textbox containing editable text with custom highlights.",
273
  show_legend=True,
274
  show_label=True,
275
  legend_label="Legend:",
276
  show_legend_label=True,
277
  )
 
 
 
 
 
 
 
278
 
279
  # Functions
280
 
281
+ tagged.input(
282
  fn=convert_tagged_text_to_highlighted_text,
283
+ inputs=[tagged, tag_id, tag_open, tag_close],
284
+ outputs=high,
285
  )
286
+ high.input(
287
  fn=convert_highlighted_text_to_tagged_text,
288
+ inputs=[high, tag_id, tag_open, tag_close],
289
+ outputs=tagged,
290
+ )
291
+ high.focus(
292
+ fn=show_info,
293
+ inputs=[high, tag_id, tag_open, tag_close, gr.State("Focus")],
294
+ outputs=None,
295
+ )
296
+ high.change(
297
+ fn=show_info,
298
+ inputs=[high, tag_id, tag_open, tag_close, gr.State("Change")],
299
+ outputs=None,
300
+ )
301
+ high.blur(
302
+ fn=show_info,
303
+ inputs=[high, tag_id, tag_open, tag_close, gr.State("Blur")],
304
+ outputs=None,
305
  )
306
  with gr.Tab("Docs"):
307
  gr.Markdown(
src/README.md CHANGED
@@ -39,6 +39,18 @@ def convert_highlighted_text_to_tagged_text(
39
  )
40
 
41
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  initial_text = "It is not something to be ashamed of: it is no different from the <d>personal fears</d> and <tm>dislikes</tm> of other things that <t>manny peopl</t> have."
43
 
44
  with gr.Blocks() as demo:
@@ -71,60 +83,64 @@ with gr.Blocks() as demo:
71
  show_label=True,
72
  info="Insert one or more tags to mark the end of a highlighted section.",
73
  )
74
- gr.Markdown("### Example tagged to highlight:")
 
 
 
 
 
 
 
 
 
 
75
  with gr.Row():
76
- tagged_t2h = gr.Textbox(
77
  initial_text,
78
  interactive=True,
79
- label="Tagged Input",
80
  show_label=True,
81
  info="Tagged text using the format above to mark spans that will be highlighted.",
82
  )
83
- high_t2h = HighlightedTextbox(
84
  convert_tagged_text_to_highlighted_text(
85
- tagged_t2h.value, tag_id.value, tag_open.value, tag_close.value
86
- ),
87
- interactive=False,
88
- label="Highlighted Output",
89
- info="Highlighted textbox intialized from the tagged input.",
90
- show_legend=True,
91
- show_label=True,
92
- legend_label="Legend:",
93
- show_legend_label=True,
94
- )
95
- gr.Markdown("### Example highlight to tagged:")
96
- with gr.Row():
97
- high_h2t = HighlightedTextbox(
98
- convert_tagged_text_to_highlighted_text(
99
- initial_text, tag_id.value, tag_open.value, tag_close.value
100
  ),
101
  interactive=True,
102
- label="Highlighted Input",
103
- info="Highlighted textbox using the format above to mark spans that will be highlighted.",
104
  show_legend=True,
105
  show_label=True,
106
  legend_label="Legend:",
107
  show_legend_label=True,
108
  )
109
- tagged_h2t = gr.Textbox(
110
- initial_text,
111
- interactive=False,
112
- label="Tagged Output",
113
- info="Tagged text intialized from the highlighted textbox.",
114
- show_label=True,
115
- )
116
 
117
  # Functions
118
 
119
- tagged_t2h.input(
120
  fn=convert_tagged_text_to_highlighted_text,
121
- inputs=[tagged_t2h, tag_id, tag_open, tag_close],
122
- outputs=high_t2h,
123
  )
124
- high_h2t.input(
125
  fn=convert_highlighted_text_to_tagged_text,
126
- inputs=[high_h2t, tag_id, tag_open, tag_close],
127
- outputs=tagged_h2t,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  )
129
 
130
  if __name__ == "__main__":
@@ -151,7 +167,7 @@ if __name__ == "__main__":
151
  <td align="left" style="width: 25%;">
152
 
153
  ```python
154
- str | Callable | None
155
  ```
156
 
157
  </td>
@@ -456,7 +472,7 @@ The impact on the users predict function varies depending on whether the compone
456
 
457
  The code snippet below is accurate in cases where the component is used as both an input and an output.
458
 
459
- - **As input:** Should return, list of (word, category) tuples, or a dictionary of two keys: "text", and "highlights", which itself is.
460
 
461
  ```python
462
  def predict(
 
39
  )
40
 
41
 
42
+ def show_info(
43
+ highlighted_text: dict[str, str | list[tuple[str, str | None]]],
44
+ tag_id: str | list[str],
45
+ tag_open: str | list[str],
46
+ tag_close: str | list[str],
47
+ msg: str,
48
+ ) -> None:
49
+ gr.Info(
50
+ f"{msg}: {HighlightedTextbox.tuples_to_tagged_text(highlighted_text['data'], tag_id, tag_open, tag_close)}"
51
+ )
52
+
53
+
54
  initial_text = "It is not something to be ashamed of: it is no different from the <d>personal fears</d> and <tm>dislikes</tm> of other things that <t>manny peopl</t> have."
55
 
56
  with gr.Blocks() as demo:
 
83
  show_label=True,
84
  info="Insert one or more tags to mark the end of a highlighted section.",
85
  )
86
+ gr.Markdown(
87
+ """
88
+ ### Example:
89
+
90
+ The following text is tagged using the parameters above to mark spans that will be highlighted.
91
+
92
+ Both the tagged text and the highlighted text are editable, so you can see how the changes in one affect the other.
93
+
94
+ Highlights will disappear if the highlighted text is edited. Modals will appear upon focus, change, and blur events on the highlighted text.
95
+ """
96
+ )
97
  with gr.Row():
98
+ tagged = gr.Textbox(
99
  initial_text,
100
  interactive=True,
101
+ label="Tagged text",
102
  show_label=True,
103
  info="Tagged text using the format above to mark spans that will be highlighted.",
104
  )
105
+ high = HighlightedTextbox(
106
  convert_tagged_text_to_highlighted_text(
107
+ tagged.value, tag_id.value, tag_open.value, tag_close.value
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  ),
109
  interactive=True,
110
+ label="Highlighted text",
111
+ info="Textbox containing editable text with custom highlights.",
112
  show_legend=True,
113
  show_label=True,
114
  legend_label="Legend:",
115
  show_legend_label=True,
116
  )
 
 
 
 
 
 
 
117
 
118
  # Functions
119
 
120
+ tagged.input(
121
  fn=convert_tagged_text_to_highlighted_text,
122
+ inputs=[tagged, tag_id, tag_open, tag_close],
123
+ outputs=high,
124
  )
125
+ high.input(
126
  fn=convert_highlighted_text_to_tagged_text,
127
+ inputs=[high, tag_id, tag_open, tag_close],
128
+ outputs=tagged,
129
+ )
130
+ high.focus(
131
+ fn=show_info,
132
+ inputs=[high, tag_id, tag_open, tag_close, gr.State("Focus")],
133
+ outputs=None,
134
+ )
135
+ high.change(
136
+ fn=show_info,
137
+ inputs=[high, tag_id, tag_open, tag_close, gr.State("Change")],
138
+ outputs=None,
139
+ )
140
+ high.blur(
141
+ fn=show_info,
142
+ inputs=[high, tag_id, tag_open, tag_close, gr.State("Blur")],
143
+ outputs=None,
144
  )
145
 
146
  if __name__ == "__main__":
 
167
  <td align="left" style="width: 25%;">
168
 
169
  ```python
170
+ list[tuple[str, str | None]] | Callable | None
171
  ```
172
 
173
  </td>
 
472
 
473
  The code snippet below is accurate in cases where the component is used as both an input and an output.
474
 
475
+ - **As input:** Should return, list of (word, category) tuples, or a dictionary of two keys: "id", and "data", which is a list of (word, category) tuples.
476
 
477
  ```python
478
  def predict(
src/backend/gradio_highlightedtextbox/highlightedtextbox.py CHANGED
@@ -38,7 +38,7 @@ class HighlightedTextbox(FormComponent):
38
 
39
  def __init__(
40
  self,
41
- value: str | Callable | None = "",
42
  *,
43
  color_map: dict[str, str] | None = None,
44
  show_legend: bool = False,
@@ -123,37 +123,14 @@ class HighlightedTextbox(FormComponent):
123
  ) -> list[tuple[str, str | None]] | None:
124
  """
125
  Parameters:
126
- y: List of (word, category) tuples, or a dictionary of two keys: "text", and "highlights", which itself is
127
- a list of dictionaries, each of which have the keys: "highlight_type", "start", and "end"
128
  Returns:
129
  List of (word, category) tuples
130
  """
131
  if y is None:
132
  return None
133
  if isinstance(y, dict):
134
- try:
135
- text = y["text"]
136
- highlights = y["highlights"]
137
- except KeyError as ke:
138
- raise ValueError(
139
- "Expected a dictionary with keys 'text' and 'highlights' "
140
- "for the value of the HighlightedText component."
141
- ) from ke
142
- if len(highlights) == 0:
143
- y = [(text, None)]
144
- else:
145
- list_format = []
146
- index = 0
147
- entities = sorted(highlights, key=lambda x: x["start"])
148
- for entity in entities:
149
- list_format.append((text[index : entity["start"]], None))
150
- highlight_type = entity.get("highlight_type")
151
- list_format.append(
152
- (text[entity["start"] : entity["end"]], highlight_type)
153
- )
154
- index = entity["end"]
155
- list_format.append((text[index:], None))
156
- y = list_format
157
  if self.combine_adjacent:
158
  output = []
159
  running_text, running_category = None, None
@@ -180,49 +157,6 @@ class HighlightedTextbox(FormComponent):
180
  def example_inputs(self) -> Any:
181
  return [("Hello", None), ("world", "highlight")]
182
 
183
- @classmethod
184
- def tagged_text_to_tuples_single_tag(
185
- cls, text: str, tag_id: str, tag_open: str = "<h>", tag_close: str = "</h>"
186
- ) -> list[tuple[str, str | None]]:
187
- """Parse a text containing tags into a list of tuples in the format accepted by HighlightedTextbox.
188
-
189
- E.g. Hello <h>world</h>! -> [("Hello", None), ("world", <TAG_ID>), ("!", None)]
190
-
191
- Args:
192
- text (`str`):
193
- Text containing tags that needs to be parsed.
194
- tag_id (`str`):
195
- Label to use for the second element of the tuple.
196
- tag_open (`str`, *optional*, defaults to "<h>"):
197
- Tag used to mark the beginning of a highlighted section.
198
- tag_close (`str`, *optional*, defaults to "</h>"):
199
- Tag used to mark the end of a highlighted section.
200
-
201
- Raises:
202
- `ValueError`: Number of open tags does not match number of closed tags.
203
-
204
- Returns:
205
- `list[tuple[str, str | None]]`: List of tuples in the format accepted by HighlightedTextbox.
206
- """
207
- # Check that the text is well-formed (i.e. no nested or empty tags)
208
- num_tags_open = text.count(tag_open)
209
- num_tags_close = text.count(tag_close)
210
- if num_tags_open == 0 or num_tags_close == 0:
211
- return [(text, None)]
212
- else:
213
- out = []
214
- last_end = 0
215
- for _ in range(min(num_tags_open, num_tags_close)):
216
- start = text.index(tag_open, last_end)
217
- end = text.index(tag_close, start)
218
- if start > last_end:
219
- out.append((text[last_end:start].strip(), None))
220
- out.append((text[start + len(tag_open) : end].strip(), tag_id))
221
- last_end = end + len(tag_close)
222
- if last_end < len(text):
223
- out.append((text[last_end:].strip(), None))
224
- return out
225
-
226
  @classmethod
227
  def tagged_text_to_tuples(
228
  cls,
@@ -288,7 +222,7 @@ class HighlightedTextbox(FormComponent):
288
  for match in tag_regex.finditer(text):
289
  # Add the text before the tag to the output
290
  if match.start() > last_end:
291
- out.append((text[last_end : match.start()].strip(), None))
292
  # Add the tag to the output
293
  tag_text = match.group(0)
294
  for tag, tag_id in tag_dict.items():
@@ -298,7 +232,7 @@ class HighlightedTextbox(FormComponent):
298
  last_end = match.end()
299
  # Add the text after the last tag to the output
300
  if last_end < len(text):
301
- out.append((text[last_end:].strip(), None))
302
  return out
303
 
304
  @staticmethod
@@ -341,14 +275,9 @@ class HighlightedTextbox(FormComponent):
341
  ]
342
  out = ""
343
  for text, tag_id in tuples:
344
- space_or_not = (
345
- " "
346
- if text not in [".", "!", "?", ",", ":", ")", "]", ";", "}", """'"""]
347
- else ""
348
- )
349
  if tag_id is not None:
350
  tag_id_idx = tag_ids.index(tag_id)
351
- out += f"{space_or_not}{tags_open[tag_id_idx]}{text.strip()}{tags_close[tag_id_idx]}"
352
  else:
353
- out += f"{space_or_not}{text.strip()} "
354
- return re.sub(" +", " ", out.strip())
 
38
 
39
  def __init__(
40
  self,
41
+ value: list[tuple[str, str | None]] | Callable | None = "",
42
  *,
43
  color_map: dict[str, str] | None = None,
44
  show_legend: bool = False,
 
123
  ) -> list[tuple[str, str | None]] | None:
124
  """
125
  Parameters:
126
+ y: List of (word, category) tuples, or a dictionary of two keys: "id", and "data", which is a list of (word, category) tuples.
 
127
  Returns:
128
  List of (word, category) tuples
129
  """
130
  if y is None:
131
  return None
132
  if isinstance(y, dict):
133
+ y = y["data"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  if self.combine_adjacent:
135
  output = []
136
  running_text, running_category = None, None
 
157
  def example_inputs(self) -> Any:
158
  return [("Hello", None), ("world", "highlight")]
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  @classmethod
161
  def tagged_text_to_tuples(
162
  cls,
 
222
  for match in tag_regex.finditer(text):
223
  # Add the text before the tag to the output
224
  if match.start() > last_end:
225
+ out.append((text[last_end : match.start()], None))
226
  # Add the tag to the output
227
  tag_text = match.group(0)
228
  for tag, tag_id in tag_dict.items():
 
232
  last_end = match.end()
233
  # Add the text after the last tag to the output
234
  if last_end < len(text):
235
+ out.append((text[last_end:], None))
236
  return out
237
 
238
  @staticmethod
 
275
  ]
276
  out = ""
277
  for text, tag_id in tuples:
 
 
 
 
 
278
  if tag_id is not None:
279
  tag_id_idx = tag_ids.index(tag_id)
280
+ out += f"{tags_open[tag_id_idx]}{text}{tags_close[tag_id_idx]}"
281
  else:
282
+ out += text
283
+ return out
src/backend/gradio_highlightedtextbox/highlightedtextbox.pyi CHANGED
@@ -39,7 +39,7 @@ class HighlightedTextbox(FormComponent):
39
 
40
  def __init__(
41
  self,
42
- value: str | Callable | None = "",
43
  *,
44
  color_map: dict[str, str] | None = None,
45
  show_legend: bool = False,
@@ -124,37 +124,14 @@ class HighlightedTextbox(FormComponent):
124
  ) -> list[tuple[str, str | None]] | None:
125
  """
126
  Parameters:
127
- y: List of (word, category) tuples, or a dictionary of two keys: "text", and "highlights", which itself is
128
- a list of dictionaries, each of which have the keys: "highlight_type", "start", and "end"
129
  Returns:
130
  List of (word, category) tuples
131
  """
132
  if y is None:
133
  return None
134
  if isinstance(y, dict):
135
- try:
136
- text = y["text"]
137
- highlights = y["highlights"]
138
- except KeyError as ke:
139
- raise ValueError(
140
- "Expected a dictionary with keys 'text' and 'highlights' "
141
- "for the value of the HighlightedText component."
142
- ) from ke
143
- if len(highlights) == 0:
144
- y = [(text, None)]
145
- else:
146
- list_format = []
147
- index = 0
148
- entities = sorted(highlights, key=lambda x: x["start"])
149
- for entity in entities:
150
- list_format.append((text[index : entity["start"]], None))
151
- highlight_type = entity.get("highlight_type")
152
- list_format.append(
153
- (text[entity["start"] : entity["end"]], highlight_type)
154
- )
155
- index = entity["end"]
156
- list_format.append((text[index:], None))
157
- y = list_format
158
  if self.combine_adjacent:
159
  output = []
160
  running_text, running_category = None, None
@@ -181,49 +158,6 @@ class HighlightedTextbox(FormComponent):
181
  def example_inputs(self) -> Any:
182
  return [("Hello", None), ("world", "highlight")]
183
 
184
- @classmethod
185
- def tagged_text_to_tuples_single_tag(
186
- cls, text: str, tag_id: str, tag_open: str = "<h>", tag_close: str = "</h>"
187
- ) -> list[tuple[str, str | None]]:
188
- """Parse a text containing tags into a list of tuples in the format accepted by HighlightedTextbox.
189
-
190
- E.g. Hello <h>world</h>! -> [("Hello", None), ("world", <TAG_ID>), ("!", None)]
191
-
192
- Args:
193
- text (`str`):
194
- Text containing tags that needs to be parsed.
195
- tag_id (`str`):
196
- Label to use for the second element of the tuple.
197
- tag_open (`str`, *optional*, defaults to "<h>"):
198
- Tag used to mark the beginning of a highlighted section.
199
- tag_close (`str`, *optional*, defaults to "</h>"):
200
- Tag used to mark the end of a highlighted section.
201
-
202
- Raises:
203
- `ValueError`: Number of open tags does not match number of closed tags.
204
-
205
- Returns:
206
- `list[tuple[str, str | None]]`: List of tuples in the format accepted by HighlightedTextbox.
207
- """
208
- # Check that the text is well-formed (i.e. no nested or empty tags)
209
- num_tags_open = text.count(tag_open)
210
- num_tags_close = text.count(tag_close)
211
- if num_tags_open == 0 or num_tags_close == 0:
212
- return [(text, None)]
213
- else:
214
- out = []
215
- last_end = 0
216
- for _ in range(min(num_tags_open, num_tags_close)):
217
- start = text.index(tag_open, last_end)
218
- end = text.index(tag_close, start)
219
- if start > last_end:
220
- out.append((text[last_end:start].strip(), None))
221
- out.append((text[start + len(tag_open) : end].strip(), tag_id))
222
- last_end = end + len(tag_close)
223
- if last_end < len(text):
224
- out.append((text[last_end:].strip(), None))
225
- return out
226
-
227
  @classmethod
228
  def tagged_text_to_tuples(
229
  cls,
@@ -289,7 +223,7 @@ class HighlightedTextbox(FormComponent):
289
  for match in tag_regex.finditer(text):
290
  # Add the text before the tag to the output
291
  if match.start() > last_end:
292
- out.append((text[last_end : match.start()].strip(), None))
293
  # Add the tag to the output
294
  tag_text = match.group(0)
295
  for tag, tag_id in tag_dict.items():
@@ -299,7 +233,7 @@ class HighlightedTextbox(FormComponent):
299
  last_end = match.end()
300
  # Add the text after the last tag to the output
301
  if last_end < len(text):
302
- out.append((text[last_end:].strip(), None))
303
  return out
304
 
305
  @staticmethod
@@ -342,17 +276,12 @@ class HighlightedTextbox(FormComponent):
342
  ]
343
  out = ""
344
  for text, tag_id in tuples:
345
- space_or_not = (
346
- " "
347
- if text not in [".", "!", "?", ",", ":", ")", "]", ";", "}", """'"""]
348
- else ""
349
- )
350
  if tag_id is not None:
351
  tag_id_idx = tag_ids.index(tag_id)
352
- out += f"{space_or_not}{tags_open[tag_id_idx]}{text.strip()}{tags_close[tag_id_idx]}"
353
  else:
354
- out += f"{space_or_not}{text.strip()} "
355
- return re.sub(" +", " ", out.strip())
356
 
357
 
358
  def change(self,
 
39
 
40
  def __init__(
41
  self,
42
+ value: list[tuple[str, str | None]] | Callable | None = "",
43
  *,
44
  color_map: dict[str, str] | None = None,
45
  show_legend: bool = False,
 
124
  ) -> list[tuple[str, str | None]] | None:
125
  """
126
  Parameters:
127
+ y: List of (word, category) tuples, or a dictionary of two keys: "id", and "data", which is a list of (word, category) tuples.
 
128
  Returns:
129
  List of (word, category) tuples
130
  """
131
  if y is None:
132
  return None
133
  if isinstance(y, dict):
134
+ y = y["data"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  if self.combine_adjacent:
136
  output = []
137
  running_text, running_category = None, None
 
158
  def example_inputs(self) -> Any:
159
  return [("Hello", None), ("world", "highlight")]
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  @classmethod
162
  def tagged_text_to_tuples(
163
  cls,
 
223
  for match in tag_regex.finditer(text):
224
  # Add the text before the tag to the output
225
  if match.start() > last_end:
226
+ out.append((text[last_end : match.start()], None))
227
  # Add the tag to the output
228
  tag_text = match.group(0)
229
  for tag, tag_id in tag_dict.items():
 
233
  last_end = match.end()
234
  # Add the text after the last tag to the output
235
  if last_end < len(text):
236
+ out.append((text[last_end:], None))
237
  return out
238
 
239
  @staticmethod
 
276
  ]
277
  out = ""
278
  for text, tag_id in tuples:
 
 
 
 
 
279
  if tag_id is not None:
280
  tag_id_idx = tag_ids.index(tag_id)
281
+ out += f"{tags_open[tag_id_idx]}{text}{tags_close[tag_id_idx]}"
282
  else:
283
+ out += text
284
+ return out
285
 
286
 
287
  def change(self,
src/backend/gradio_highlightedtextbox/templates/component/index.js CHANGED
@@ -1,45 +1,45 @@
1
  const {
2
- SvelteComponent: nl,
3
- append: se,
4
  attr: U,
5
- create_slot: il,
6
- destroy_each: sl,
7
- detach: oe,
8
- element: ce,
9
- empty: ol,
10
- ensure_array_like: et,
11
- get_all_dirty_from_scope: fl,
12
- get_slot_changes: al,
13
  init: _l,
14
- insert: fe,
15
- safe_not_equal: rl,
16
- set_data: Ue,
17
  space: He,
18
- text: Xe,
19
  toggle_class: V,
20
- transition_in: ul,
21
- transition_out: cl,
22
- update_slot_base: dl
23
  } = window.__gradio__svelte__internal;
24
- function tt(l, e, t) {
25
  const n = l.slice();
26
  return n[8] = e[t][0], n[9] = e[t][1], n[11] = t, n;
27
  }
28
- function lt(l) {
29
- let e, t, n, i, s, o, r = et(Object.entries(
30
  /*_color_map*/
31
  l[4]
32
- )), _ = [];
33
  for (let f = 0; f < r.length; f += 1)
34
- _[f] = nt(tt(l, r, f));
35
  return {
36
  c() {
37
- e = ce("span"), e.textContent = "·", t = He(), n = ce("div"), i = ce("span"), s = Xe(
38
  /*legend_label*/
39
  l[3]
40
  ), o = He();
41
- for (let f = 0; f < _.length; f += 1)
42
- _[f].c();
43
  U(e, "class", "legend-separator svelte-vm3q5z"), V(e, "hide", !/*show_legend*/
44
  l[1] || !/*show_label*/
45
  l[0]), V(
@@ -56,66 +56,66 @@ function lt(l) {
56
  ), U(n, "class", "category-legend svelte-vm3q5z"), U(n, "data-testid", "highlighted-text:category-legend"), V(n, "hide", !/*show_legend*/
57
  l[1]);
58
  },
59
- m(f, a) {
60
- fe(f, e, a), fe(f, t, a), fe(f, n, a), se(n, i), se(i, s), se(n, o);
61
- for (let u = 0; u < _.length; u += 1)
62
- _[u] && _[u].m(n, null);
63
  },
64
- p(f, a) {
65
- if (a & /*show_legend, show_label*/
66
  3 && V(e, "hide", !/*show_legend*/
67
  f[1] || !/*show_label*/
68
- f[0]), a & /*info*/
69
  32 && V(
70
  e,
71
  "has-info",
72
  /*info*/
73
  f[5] != null
74
- ), a & /*legend_label*/
75
- 8 && Ue(
76
  s,
77
  /*legend_label*/
78
  f[3]
79
- ), a & /*show_legend_label*/
80
  4 && V(i, "hide", !/*show_legend_label*/
81
- f[2]), a & /*info*/
82
  32 && V(
83
  i,
84
  "has-info",
85
  /*info*/
86
  f[5] != null
87
- ), a & /*Object, _color_map, info*/
88
  48) {
89
- r = et(Object.entries(
90
  /*_color_map*/
91
  f[4]
92
  ));
93
  let u;
94
  for (u = 0; u < r.length; u += 1) {
95
- const c = tt(f, r, u);
96
- _[u] ? _[u].p(c, a) : (_[u] = nt(c), _[u].c(), _[u].m(n, null));
97
  }
98
- for (; u < _.length; u += 1)
99
- _[u].d(1);
100
- _.length = r.length;
101
  }
102
- a & /*show_legend*/
103
  2 && V(n, "hide", !/*show_legend*/
104
  f[1]);
105
  },
106
  d(f) {
107
- f && (oe(e), oe(t), oe(n)), sl(_, f);
108
  }
109
  };
110
  }
111
- function nt(l) {
112
  let e, t = (
113
  /*category*/
114
  l[8] + ""
115
  ), n, i, s;
116
  return {
117
  c() {
118
- e = ce("div"), n = Xe(t), i = He(), U(e, "class", "category-label svelte-vm3q5z"), U(e, "style", s = "background-color:" + /*color*/
119
  l[9].secondary), V(
120
  e,
121
  "has-info",
@@ -124,12 +124,12 @@ function nt(l) {
124
  );
125
  },
126
  m(o, r) {
127
- fe(o, e, r), se(e, n), se(e, i);
128
  },
129
  p(o, r) {
130
  r & /*_color_map*/
131
  16 && t !== (t = /*category*/
132
- o[8] + "") && Ue(n, t), r & /*_color_map*/
133
  16 && s !== (s = "background-color:" + /*color*/
134
  o[9].secondary) && U(e, "style", s), r & /*info*/
135
  32 && V(
@@ -140,57 +140,57 @@ function nt(l) {
140
  );
141
  },
142
  d(o) {
143
- o && oe(e);
144
  }
145
  };
146
  }
147
- function it(l) {
148
  let e, t;
149
  return {
150
  c() {
151
- e = ce("div"), t = Xe(
152
  /*info*/
153
  l[5]
154
  ), U(e, "class", "title-with-highlights-info svelte-vm3q5z");
155
  },
156
  m(n, i) {
157
- fe(n, e, i), se(e, t);
158
  },
159
  p(n, i) {
160
  i & /*info*/
161
- 32 && Ue(
162
  t,
163
  /*info*/
164
  n[5]
165
  );
166
  },
167
  d(n) {
168
- n && oe(e);
169
  }
170
  };
171
  }
172
- function ml(l) {
173
  let e, t, n, i = Object.keys(
174
  /*_color_map*/
175
  l[4]
176
  ).length !== 0, s, o, r;
177
- const _ = (
178
  /*#slots*/
179
  l[7].default
180
- ), f = il(
181
- _,
182
  l,
183
  /*$$scope*/
184
  l[6],
185
  null
186
  );
187
- let a = i && lt(l), u = (
188
  /*info*/
189
- l[5] && it(l)
190
  );
191
  return {
192
  c() {
193
- e = ce("div"), t = ce("span"), f && f.c(), n = He(), a && a.c(), s = He(), u && u.c(), o = ol(), U(t, "data-testid", "block-info"), U(t, "class", "svelte-vm3q5z"), V(t, "sr-only", !/*show_label*/
194
  l[0]), V(t, "hide", !/*show_label*/
195
  l[0]), V(
196
  t,
@@ -200,23 +200,23 @@ function ml(l) {
200
  ), U(e, "class", "title-container svelte-vm3q5z");
201
  },
202
  m(c, m) {
203
- fe(c, e, m), se(e, t), f && f.m(t, null), se(e, n), a && a.m(e, null), fe(c, s, m), u && u.m(c, m), fe(c, o, m), r = !0;
204
  },
205
  p(c, [m]) {
206
  f && f.p && (!r || m & /*$$scope*/
207
- 64) && dl(
208
  f,
209
- _,
210
  c,
211
  /*$$scope*/
212
  c[6],
213
- r ? al(
214
- _,
215
  /*$$scope*/
216
  c[6],
217
  m,
218
  null
219
- ) : fl(
220
  /*$$scope*/
221
  c[6]
222
  ),
@@ -235,38 +235,38 @@ function ml(l) {
235
  16 && (i = Object.keys(
236
  /*_color_map*/
237
  c[4]
238
- ).length !== 0), i ? a ? a.p(c, m) : (a = lt(c), a.c(), a.m(e, null)) : a && (a.d(1), a = null), /*info*/
239
- c[5] ? u ? u.p(c, m) : (u = it(c), u.c(), u.m(o.parentNode, o)) : u && (u.d(1), u = null);
240
  },
241
  i(c) {
242
- r || (ul(f, c), r = !0);
243
  },
244
  o(c) {
245
- cl(f, c), r = !1;
246
  },
247
  d(c) {
248
- c && (oe(e), oe(s), oe(o)), f && f.d(c), a && a.d(), u && u.d(c);
249
  }
250
  };
251
  }
252
- function hl(l, e, t) {
253
- let { $$slots: n = {}, $$scope: i } = e, { show_label: s = !0 } = e, { show_legend: o = !0 } = e, { show_legend_label: r = !0 } = e, { legend_label: _ = "Highlights:" } = e, { _color_map: f = {} } = e, { info: a = void 0 } = e;
254
  return l.$$set = (u) => {
255
- "show_label" in u && t(0, s = u.show_label), "show_legend" in u && t(1, o = u.show_legend), "show_legend_label" in u && t(2, r = u.show_legend_label), "legend_label" in u && t(3, _ = u.legend_label), "_color_map" in u && t(4, f = u._color_map), "info" in u && t(5, a = u.info), "$$scope" in u && t(6, i = u.$$scope);
256
  }, [
257
  s,
258
  o,
259
  r,
260
- _,
261
- f,
262
  a,
 
 
263
  i,
264
  n
265
  ];
266
  }
267
- class bl extends nl {
268
  constructor(e) {
269
- super(), _l(this, e, hl, ml, rl, {
270
  show_label: 0,
271
  show_legend: 1,
272
  show_legend_label: 2,
@@ -277,97 +277,97 @@ class bl extends nl {
277
  }
278
  }
279
  const {
280
- SvelteComponent: gl,
281
- append: wl,
282
- attr: te,
283
- detach: kl,
284
- init: vl,
285
- insert: pl,
286
- noop: Ze,
287
- safe_not_equal: yl,
288
- svg_element: st
289
  } = window.__gradio__svelte__internal;
290
- function Cl(l) {
291
  let e, t;
292
  return {
293
  c() {
294
- e = st("svg"), t = st("polyline"), te(t, "points", "20 6 9 17 4 12"), te(e, "xmlns", "http://www.w3.org/2000/svg"), te(e, "viewBox", "2 0 20 20"), te(e, "fill", "none"), te(e, "stroke", "currentColor"), te(e, "stroke-width", "3"), te(e, "stroke-linecap", "round"), te(e, "stroke-linejoin", "round");
295
  },
296
  m(n, i) {
297
- pl(n, e, i), wl(e, t);
298
  },
299
- p: Ze,
300
- i: Ze,
301
- o: Ze,
302
  d(n) {
303
- n && kl(e);
304
  }
305
  };
306
  }
307
- class ql extends gl {
308
  constructor(e) {
309
- super(), vl(this, e, null, Cl, yl, {});
310
  }
311
  }
312
  const {
313
- SvelteComponent: Tl,
314
- append: ot,
315
- attr: re,
316
- detach: Ll,
317
- init: Sl,
318
- insert: Fl,
319
- noop: Oe,
320
- safe_not_equal: Hl,
321
- svg_element: Re
322
  } = window.__gradio__svelte__internal;
323
- function Ml(l) {
324
  let e, t, n;
325
  return {
326
  c() {
327
- e = Re("svg"), t = Re("path"), n = Re("path"), re(t, "fill", "currentColor"), re(t, "d", "M28 10v18H10V10h18m0-2H10a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2Z"), re(n, "fill", "currentColor"), re(n, "d", "M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z"), re(e, "xmlns", "http://www.w3.org/2000/svg"), re(e, "viewBox", "0 0 33 33"), re(e, "color", "currentColor");
328
  },
329
  m(i, s) {
330
- Fl(i, e, s), ot(e, t), ot(e, n);
331
  },
332
- p: Oe,
333
- i: Oe,
334
- o: Oe,
335
  d(i) {
336
- i && Ll(e);
337
  }
338
  };
339
  }
340
- class jl extends Tl {
341
  constructor(e) {
342
- super(), Sl(this, e, null, Ml, Hl, {});
343
  }
344
  }
345
- function Ae() {
346
  }
347
- const Nl = (l) => l;
348
- function Vl(l, e) {
349
  return l != l ? e == e : l !== e || l && typeof l == "object" || typeof l == "function";
350
  }
351
- const Dt = typeof window < "u";
352
- let ft = Dt ? () => window.performance.now() : () => Date.now(), It = Dt ? (l) => requestAnimationFrame(l) : Ae;
353
- const qe = /* @__PURE__ */ new Set();
354
- function Wt(l) {
355
- qe.forEach((e) => {
356
- e.c(l) || (qe.delete(e), e.f());
357
- }), qe.size !== 0 && It(Wt);
358
  }
359
- function zl(l) {
360
  let e;
361
- return qe.size === 0 && It(Wt), {
362
  promise: new Promise((t) => {
363
- qe.add(e = { c: l, f: t });
364
  }),
365
  abort() {
366
- qe.delete(e);
367
  }
368
  };
369
  }
370
- function Al(l, { delay: e = 0, duration: t = 400, easing: n = Nl } = {}) {
371
  const i = +getComputedStyle(l).opacity;
372
  return {
373
  delay: e,
@@ -377,15 +377,15 @@ function Al(l, { delay: e = 0, duration: t = 400, easing: n = Nl } = {}) {
377
  };
378
  }
379
  const ve = [];
380
- function Bl(l, e = Ae) {
381
  let t;
382
  const n = /* @__PURE__ */ new Set();
383
  function i(r) {
384
- if (Vl(l, r) && (l = r, t)) {
385
- const _ = !ve.length;
386
  for (const f of n)
387
  f[1](), ve.push(f, l);
388
- if (_) {
389
  for (let f = 0; f < ve.length; f += 2)
390
  ve[f][0](ve[f + 1]);
391
  ve.length = 0;
@@ -395,9 +395,9 @@ function Bl(l, e = Ae) {
395
  function s(r) {
396
  i(r(l));
397
  }
398
- function o(r, _ = Ae) {
399
- const f = [r, _];
400
- return n.add(f), n.size === 1 && (t = e(i, s) || Ae), r(l), () => {
401
  n.delete(f), n.size === 0 && t && (t(), t = null);
402
  };
403
  }
@@ -406,31 +406,31 @@ function Bl(l, e = Ae) {
406
  function at(l) {
407
  return Object.prototype.toString.call(l) === "[object Date]";
408
  }
409
- function Ie(l, e, t, n) {
410
  if (typeof t == "number" || at(t)) {
411
- const i = n - t, s = (t - e) / (l.dt || 1 / 60), o = l.opts.stiffness * i, r = l.opts.damping * s, _ = (o - r) * l.inv_mass, f = (s + _) * l.dt;
412
  return Math.abs(f) < l.opts.precision && Math.abs(i) < l.opts.precision ? n : (l.settled = !1, at(t) ? new Date(t.getTime() + f) : t + f);
413
  } else {
414
  if (Array.isArray(t))
415
  return t.map(
416
- (i, s) => Ie(l, e[s], t[s], n[s])
417
  );
418
  if (typeof t == "object") {
419
  const i = {};
420
  for (const s in t)
421
- i[s] = Ie(l, e[s], t[s], n[s]);
422
  return i;
423
  } else
424
  throw new Error(`Cannot spring ${typeof t} values`);
425
  }
426
  }
427
- function _t(l, e = {}) {
428
  const t = Bl(l), { stiffness: n = 0.15, damping: i = 0.8, precision: s = 0.01 } = e;
429
- let o, r, _, f = l, a = l, u = 1, c = 0, m = !1;
430
  function y(T, L = {}) {
431
- a = T;
432
- const C = _ = {};
433
- return l == null || L.hard || S.stiffness >= 1 && S.damping >= 1 ? (m = !0, o = ft(), f = T, t.set(l = a), Promise.resolve()) : (L.soft && (c = 1 / ((L.soft === !0 ? 0.5 : +L.soft) * 60), u = 0), r || (o = ft(), m = !1, r = zl((d) => {
434
  if (m)
435
  return m = !1, r = null, !1;
436
  u = Math.min(u + c, 1);
@@ -439,17 +439,17 @@ function _t(l, e = {}) {
439
  opts: S,
440
  settled: !0,
441
  dt: (d - o) * 60 / 1e3
442
- }, H = Ie(p, f, l, a);
443
  return o = d, f = l, t.set(l = H), p.settled && (r = null), !p.settled;
444
  })), new Promise((d) => {
445
  r.promise.then(() => {
446
- C === _ && d();
447
  });
448
  }));
449
  }
450
  const S = {
451
  set: y,
452
- update: (T, L) => y(T(a, l), L),
453
  subscribe: t.subscribe,
454
  stiffness: n,
455
  damping: i,
@@ -457,7 +457,7 @@ function _t(l, e = {}) {
457
  };
458
  return S;
459
  }
460
- const rt = [
461
  "red",
462
  "green",
463
  "blue",
@@ -479,7 +479,7 @@ const rt = [
479
  { color: "cyan", primary: 600, secondary: 100 },
480
  { color: "lime", primary: 500, secondary: 100 },
481
  { color: "pink", primary: 600, secondary: 100 }
482
- ], ut = {
483
  inherit: "inherit",
484
  current: "currentColor",
485
  transparent: "transparent",
@@ -771,17 +771,17 @@ const rt = [
771
  900: "#881337",
772
  950: "#4c0519"
773
  }
774
- }, ct = El.reduce(
775
  (l, { color: e, primary: t, secondary: n }) => ({
776
  ...l,
777
  [e]: {
778
- primary: ut[e][t],
779
- secondary: ut[e][n]
780
  }
781
  }),
782
  {}
783
- ), Pl = (l) => rt[l % rt.length];
784
- function dt(l, e, t) {
785
  if (!t) {
786
  var n = document.createElement("canvas");
787
  t = n.getContext("2d");
@@ -794,9 +794,9 @@ function Zl(l, e, t) {
794
  var n = {};
795
  for (const i in l) {
796
  const s = l[i].trim();
797
- s in ct ? n[i] = ct[s] : n[i] = {
798
- primary: e ? dt(l[i], 1, t) : l[i],
799
- secondary: e ? dt(l[i], 0.5, t) : l[i]
800
  };
801
  }
802
  return n;
@@ -815,7 +815,7 @@ function Rl(l) {
815
  }
816
  return -1;
817
  }
818
- function Dl(l, e) {
819
  var t = document.createTreeWalker(l, NodeFilter.SHOW_TEXT), n = t.nextNode();
820
  if (!n || !n.textContent)
821
  return null;
@@ -828,262 +828,262 @@ function Dl(l, e) {
828
  return { node: n, offset: s };
829
  }
830
  const {
831
- SvelteComponent: Il,
832
- add_render_callback: Ye,
833
- append: mt,
834
  attr: B,
835
- binding_callbacks: ht,
836
- bubble: pe,
837
- check_outros: Ut,
838
- create_component: Ge,
839
- create_in_transition: Wl,
840
- destroy_component: Je,
841
- detach: me,
842
  element: Me,
843
- empty: Ul,
844
- group_outros: Xt,
845
- init: Xl,
846
- insert: he,
847
- listen: G,
848
- mount_component: Ke,
849
- noop: Yt,
850
- run_all: Yl,
851
- safe_not_equal: Gl,
852
- set_data: Jl,
853
- space: bt,
854
- text: Kl,
855
- toggle_class: gt,
856
- transition_in: ne,
857
- transition_out: de
858
- } = window.__gradio__svelte__internal, { beforeUpdate: Ql, afterUpdate: xl, createEventDispatcher: $l } = window.__gradio__svelte__internal;
859
- function en(l) {
860
  let e;
861
  return {
862
  c() {
863
- e = Kl(
864
  /*label*/
865
  l[0]
866
  );
867
  },
868
  m(t, n) {
869
- he(t, e, n);
870
  },
871
  p(t, n) {
872
  n[0] & /*label*/
873
- 1 && Jl(
874
  e,
875
  /*label*/
876
  t[0]
877
  );
878
  },
879
  d(t) {
880
- t && me(e);
881
  }
882
  };
883
  }
884
- function wt(l) {
885
  let e, t, n, i;
886
- const s = [ln, tn], o = [];
887
- function r(_, f) {
888
  return (
889
  /*copied*/
890
- _[13] ? 0 : 1
891
  );
892
  }
893
  return e = r(l), t = o[e] = s[e](l), {
894
  c() {
895
- t.c(), n = Ul();
896
  },
897
- m(_, f) {
898
- o[e].m(_, f), he(_, n, f), i = !0;
899
  },
900
- p(_, f) {
901
- let a = e;
902
- e = r(_), e === a ? o[e].p(_, f) : (Xt(), de(o[a], 1, 1, () => {
903
- o[a] = null;
904
- }), Ut(), t = o[e], t ? t.p(_, f) : (t = o[e] = s[e](_), t.c()), ne(t, 1), t.m(n.parentNode, n));
905
  },
906
- i(_) {
907
- i || (ne(t), i = !0);
908
  },
909
- o(_) {
910
- de(t), i = !1;
911
  },
912
- d(_) {
913
- _ && me(n), o[e].d(_);
914
  }
915
  };
916
  }
917
- function tn(l) {
918
  let e, t, n, i, s;
919
- return t = new jl({}), {
920
  c() {
921
- e = Me("button"), Ge(t.$$.fragment), B(e, "aria-label", "Copy"), B(e, "aria-roledescription", "Copy text"), B(e, "class", "svelte-14ssfqr");
922
  },
923
  m(o, r) {
924
- he(o, e, r), Ke(t, e, null), n = !0, i || (s = G(
925
  e,
926
  "click",
927
  /*handle_copy*/
928
- l[14]
929
  ), i = !0);
930
  },
931
- p: Yt,
932
  i(o) {
933
- n || (ne(t.$$.fragment, o), n = !0);
934
  },
935
  o(o) {
936
- de(t.$$.fragment, o), n = !1;
937
  },
938
  d(o) {
939
- o && me(e), Je(t), i = !1, s();
940
  }
941
  };
942
  }
943
- function ln(l) {
944
  let e, t, n, i;
945
- return t = new ql({}), {
946
  c() {
947
- e = Me("button"), Ge(t.$$.fragment), B(e, "aria-label", "Copied"), B(e, "aria-roledescription", "Text copied"), B(e, "class", "svelte-14ssfqr");
948
  },
949
  m(s, o) {
950
- he(s, e, o), Ke(t, e, null), i = !0;
951
  },
952
- p: Yt,
953
  i(s) {
954
- i || (ne(t.$$.fragment, s), s && (n || Ye(() => {
955
- n = Wl(e, Al, { duration: 300 }), n.start();
956
  })), i = !0);
957
  },
958
  o(s) {
959
- de(t.$$.fragment, s), i = !1;
960
  },
961
  d(s) {
962
- s && me(e), Je(t);
963
  }
964
  };
965
  }
966
- function nn(l) {
967
  let e, t, n;
968
  return {
969
  c() {
970
- e = Me("div"), B(e, "class", "textfield svelte-14ssfqr"), B(e, "data-testid", "highlighted-textbox"), B(e, "contenteditable", "true"), /*el_text*/
971
- (l[11] === void 0 || /*marked_el_text*/
972
- l[9] === void 0) && Ye(() => (
973
  /*div_input_handler_1*/
974
- l[28].call(e)
975
  ));
976
  },
977
  m(i, s) {
978
- he(i, e, s), l[27](e), /*el_text*/
979
- l[11] !== void 0 && (e.textContent = /*el_text*/
980
- l[11]), /*marked_el_text*/
981
- l[9] !== void 0 && (e.innerHTML = /*marked_el_text*/
982
- l[9]), t || (n = [
983
- G(
984
  e,
985
  "input",
986
  /*div_input_handler_1*/
987
- l[28]
988
  ),
989
- G(
990
  e,
991
  "blur",
992
  /*blur_handler*/
993
  l[19]
994
  ),
995
- G(
996
  e,
997
  "keypress",
998
  /*keypress_handler*/
999
  l[20]
1000
  ),
1001
- G(
1002
  e,
1003
  "select",
1004
  /*select_handler*/
1005
  l[21]
1006
  ),
1007
- G(
1008
  e,
1009
  "scroll",
1010
  /*scroll_handler*/
1011
  l[22]
1012
  ),
1013
- G(
1014
  e,
1015
  "input",
1016
- /*input_handler*/
1017
- l[23]
1018
  ),
1019
- G(
1020
  e,
1021
  "focus",
1022
  /*focus_handler*/
1023
- l[24]
1024
  ),
1025
- G(
1026
  e,
1027
  "change",
1028
- /*checkAndRemoveHighlight*/
1029
- l[15]
1030
  )
1031
  ], t = !0);
1032
  },
1033
  p(i, s) {
1034
  s[0] & /*el_text*/
1035
- 2048 && /*el_text*/
1036
- i[11] !== e.textContent && (e.textContent = /*el_text*/
1037
- i[11]), s[0] & /*marked_el_text*/
1038
- 512 && /*marked_el_text*/
1039
- i[9] !== e.innerHTML && (e.innerHTML = /*marked_el_text*/
1040
- i[9]);
1041
  },
1042
  d(i) {
1043
- i && me(e), l[27](null), t = !1, Yl(n);
1044
  }
1045
  };
1046
  }
1047
- function sn(l) {
1048
  let e, t, n;
1049
  return {
1050
  c() {
1051
- e = Me("div"), B(e, "class", "textfield svelte-14ssfqr"), B(e, "data-testid", "highlighted-textbox"), B(e, "contenteditable", "false"), /*el_text*/
1052
- (l[11] === void 0 || /*marked_el_text*/
1053
- l[9] === void 0) && Ye(() => (
1054
  /*div_input_handler*/
1055
- l[26].call(e)
1056
  ));
1057
  },
1058
  m(i, s) {
1059
- he(i, e, s), l[25](e), /*el_text*/
1060
- l[11] !== void 0 && (e.textContent = /*el_text*/
1061
- l[11]), /*marked_el_text*/
1062
- l[9] !== void 0 && (e.innerHTML = /*marked_el_text*/
1063
- l[9]), t || (n = G(
1064
  e,
1065
  "input",
1066
  /*div_input_handler*/
1067
- l[26]
1068
  ), t = !0);
1069
  },
1070
  p(i, s) {
1071
  s[0] & /*el_text*/
1072
- 2048 && /*el_text*/
1073
- i[11] !== e.textContent && (e.textContent = /*el_text*/
1074
- i[11]), s[0] & /*marked_el_text*/
1075
- 512 && /*marked_el_text*/
1076
- i[9] !== e.innerHTML && (e.innerHTML = /*marked_el_text*/
1077
- i[9]);
1078
  },
1079
  d(i) {
1080
- i && me(e), l[25](null), t = !1, n();
1081
  }
1082
  };
1083
  }
1084
- function on(l) {
1085
  let e, t, n, i, s;
1086
- t = new bl({
1087
  props: {
1088
  show_label: (
1089
  /*show_label*/
@@ -1109,86 +1109,76 @@ function on(l) {
1109
  /*info*/
1110
  l[2]
1111
  ),
1112
- $$slots: { default: [en] },
1113
  $$scope: { ctx: l }
1114
  }
1115
  });
1116
  let o = (
1117
  /*show_copy_button*/
1118
- l[7] && wt(l)
1119
  );
1120
- function r(a, u) {
1121
  return (
1122
  /*disabled*/
1123
- a[8] ? sn : nn
1124
  );
1125
  }
1126
- let _ = r(l), f = _(l);
1127
  return {
1128
  c() {
1129
- e = Me("label"), Ge(t.$$.fragment), n = bt(), o && o.c(), i = bt(), f.c(), B(e, "class", "svelte-14ssfqr"), gt(
1130
  e,
1131
  "container",
1132
  /*container*/
1133
  l[6]
1134
  );
1135
  },
1136
- m(a, u) {
1137
- he(a, e, u), Ke(t, e, null), mt(e, n), o && o.m(e, null), mt(e, i), f.m(e, null), s = !0;
1138
  },
1139
- p(a, u) {
1140
  const c = {};
1141
  u[0] & /*show_label*/
1142
  8 && (c.show_label = /*show_label*/
1143
- a[3]), u[0] & /*show_legend*/
1144
  16 && (c.show_legend = /*show_legend*/
1145
- a[4]), u[0] & /*show_legend_label*/
1146
  32 && (c.show_legend_label = /*show_legend_label*/
1147
- a[5]), u[0] & /*legend_label*/
1148
  2 && (c.legend_label = /*legend_label*/
1149
- a[1]), u[0] & /*_color_map*/
1150
  4096 && (c._color_map = /*_color_map*/
1151
- a[12]), u[0] & /*info*/
1152
  4 && (c.info = /*info*/
1153
- a[2]), u[0] & /*label*/
1154
  1 | u[1] & /*$$scope*/
1155
- 512 && (c.$$scope = { dirty: u, ctx: a }), t.$set(c), /*show_copy_button*/
1156
- a[7] ? o ? (o.p(a, u), u[0] & /*show_copy_button*/
1157
- 128 && ne(o, 1)) : (o = wt(a), o.c(), ne(o, 1), o.m(e, i)) : o && (Xt(), de(o, 1, 1, () => {
1158
  o = null;
1159
- }), Ut()), _ === (_ = r(a)) && f ? f.p(a, u) : (f.d(1), f = _(a), f && (f.c(), f.m(e, null))), (!s || u[0] & /*container*/
1160
- 64) && gt(
1161
  e,
1162
  "container",
1163
  /*container*/
1164
- a[6]
1165
  );
1166
  },
1167
- i(a) {
1168
- s || (ne(t.$$.fragment, a), ne(o), s = !0);
1169
  },
1170
- o(a) {
1171
- de(t.$$.fragment, a), de(o), s = !1;
1172
  },
1173
- d(a) {
1174
- a && me(e), Je(t), o && o.d(), f.d();
1175
  }
1176
  };
1177
  }
1178
- function fn(l) {
1179
- let e, t = l[0], n = 1;
1180
- for (; n < l.length; ) {
1181
- const i = l[n], s = l[n + 1];
1182
- if (n += 2, (i === "optionalAccess" || i === "optionalCall") && t == null)
1183
- return;
1184
- i === "access" || i === "optionalAccess" ? (e = t, t = s(t)) : (i === "call" || i === "optionalCall") && (t = s((...o) => t.call(e, ...o)), e = void 0);
1185
- }
1186
- return t;
1187
- }
1188
- function an(l, e, t) {
1189
  const n = typeof document < "u";
1190
- let { value: i = [] } = e, { value_is_output: s = !1 } = e, { label: o } = e, { legend_label: r } = e, { info: _ = void 0 } = e, { show_label: f = !0 } = e, { show_legend: a = !1 } = e, { show_legend_label: u = !1 } = e, { container: c = !0 } = e, { color_map: m = {} } = e, { show_copy_button: y = !1 } = e, { disabled: S } = e, T, L = "", C = "", d, p = !m || Object.keys(m).length === 0 ? {} : m, H = {}, b = !1, R;
1191
- function Q() {
1192
  for (let h in p)
1193
  i.map(([N, j]) => j).includes(h) || delete p[h];
1194
  if (i.length > 0) {
@@ -1201,38 +1191,46 @@ function an(l, e, t) {
1201
  t(12, H = Zl(p, n, d));
1202
  }
1203
  function E(h) {
1204
- i.length > 0 && h && (t(11, L = i.map(([N, j]) => N).join(" ")), t(9, C = i.map(([N, j]) => j !== null ? `<mark class="hl ${j}" style="background-color:${H[j].secondary}">${N}</mark>` : N).join(" ") + " "));
1205
  }
1206
- const P = $l();
1207
- Ql(() => {
1208
  T && T.offsetHeight + T.scrollTop > T.scrollHeight - 100;
1209
  });
1210
  function X() {
1211
- P("change", C), s || P("input"), z();
1212
  }
1213
- xl(() => {
1214
- Q(), E(s), t(17, s = !1);
1215
  });
1216
- function be() {
1217
- let h = [], N = "", j = null, ee = !1, ke = "";
1218
- for (let ae = 0; ae < C.length; ae++) {
1219
- let _e = C[ae];
1220
- _e === "<" ? (ee = !0, N && h.push([N, j]), N = "", j = null) : _e === ">" ? (ee = !1, ke.startsWith("mark") && (j = fn([
1221
- ke,
1222
- "access",
1223
- (Y) => Y.match,
1224
- "call",
1225
- (Y) => Y(/class="hl ([^"]+)"/),
1226
- "optionalAccess",
1227
- (Y) => Y[1]
1228
- ]) || null), ke = "") : ee ? ke += _e : N += _e;
 
 
 
 
 
 
 
 
1229
  }
1230
  N && h.push([N, j]), t(16, i = h);
1231
  }
1232
  async function D() {
1233
- "clipboard" in navigator && (await navigator.clipboard.writeText(L), x());
1234
  }
1235
- function x() {
1236
  t(13, b = !0), R && clearTimeout(R), R = setTimeout(
1237
  () => {
1238
  t(13, b = !1);
@@ -1240,101 +1238,93 @@ function an(l, e, t) {
1240
  1e3
1241
  );
1242
  }
1243
- function z() {
1244
  const h = window.getSelection(), N = h.anchorOffset;
1245
  if (h.rangeCount > 0) {
1246
  var j = h.getRangeAt(0).commonAncestorContainer.parentElement;
1247
  if (j && j.tagName.toLowerCase() === "mark") {
1248
- const tl = j.textContent;
1249
- var ee = j.parentElement, ke = document.createTextNode(tl);
1250
- ee.replaceChild(ke, j), t(9, C = ee.innerHTML);
1251
- var ae = document.createRange(), _e = window.getSelection();
1252
- const ll = N + Rl(ee);
1253
- var Y = Dl(ee, ll);
1254
- ae.setStart(Y.node, Y.offset), ae.setEnd(Y.node, Y.offset), _e.removeAllRanges(), _e.addRange(ae);
1255
  }
1256
  }
1257
- be(), P("change", C);
1258
  }
1259
- function ge(h) {
1260
- pe.call(this, l, h);
1261
  }
1262
  function g(h) {
1263
- pe.call(this, l, h);
1264
  }
1265
  function je(h) {
1266
- pe.call(this, l, h);
1267
  }
1268
  function Ne(h) {
1269
- pe.call(this, l, h);
1270
  }
1271
- function we(h) {
1272
- pe.call(this, l, h);
1273
- }
1274
- function Ee(h) {
1275
- pe.call(this, l, h);
1276
  }
1277
- function Pe(h) {
1278
- ht[h ? "unshift" : "push"](() => {
1279
- T = h, t(10, T);
1280
  });
1281
  }
1282
- function w() {
1283
- L = this.textContent, C = this.innerHTML, t(11, L), t(9, C);
1284
  }
1285
- function $t(h) {
1286
- ht[h ? "unshift" : "push"](() => {
1287
- T = h, t(10, T);
1288
  });
1289
  }
1290
  function el() {
1291
- L = this.textContent, C = this.innerHTML, t(11, L), t(9, C);
1292
  }
1293
  return l.$$set = (h) => {
1294
- "value" in h && t(16, i = h.value), "value_is_output" in h && t(17, s = h.value_is_output), "label" in h && t(0, o = h.label), "legend_label" in h && t(1, r = h.legend_label), "info" in h && t(2, _ = h.info), "show_label" in h && t(3, f = h.show_label), "show_legend" in h && t(4, a = h.show_legend), "show_legend_label" in h && t(5, u = h.show_legend_label), "container" in h && t(6, c = h.container), "color_map" in h && t(18, m = h.color_map), "show_copy_button" in h && t(7, y = h.show_copy_button), "disabled" in h && t(8, S = h.disabled);
1295
- }, l.$$.update = () => {
1296
- l.$$.dirty[0] & /*marked_el_text*/
1297
- 512 && X();
1298
- }, Q(), E(!0), [
1299
  o,
1300
  r,
1301
- _,
1302
- f,
1303
  a,
 
 
1304
  u,
1305
  c,
1306
  y,
1307
  S,
1308
- C,
1309
  T,
1310
  L,
 
1311
  H,
1312
  b,
 
1313
  D,
1314
- z,
1315
  i,
1316
  s,
1317
  m,
1318
- ge,
1319
  g,
1320
  je,
1321
  Ne,
1322
- we,
1323
- Ee,
1324
- Pe,
1325
  w,
1326
- $t,
1327
  el
1328
  ];
1329
  }
1330
- class _n extends Il {
1331
  constructor(e) {
1332
- super(), Xl(
1333
  this,
1334
  e,
1335
- an,
1336
  on,
1337
- Gl,
 
1338
  {
1339
  value: 16,
1340
  value_is_output: 17,
@@ -1355,30 +1345,30 @@ class _n extends Il {
1355
  }
1356
  }
1357
  const {
1358
- SvelteComponent: rn,
1359
- assign: un,
1360
- create_slot: cn,
1361
- detach: dn,
1362
- element: mn,
1363
- get_all_dirty_from_scope: hn,
1364
- get_slot_changes: bn,
1365
- get_spread_update: gn,
1366
- init: wn,
1367
- insert: kn,
1368
- safe_not_equal: vn,
1369
- set_dynamic_element_data: kt,
1370
- set_style: A,
1371
- toggle_class: le,
1372
- transition_in: Gt,
1373
- transition_out: Jt,
1374
- update_slot_base: pn
1375
  } = window.__gradio__svelte__internal;
1376
- function yn(l) {
1377
  let e, t, n;
1378
  const i = (
1379
  /*#slots*/
1380
  l[18].default
1381
- ), s = cn(
1382
  i,
1383
  l,
1384
  /*$$scope*/
@@ -1399,34 +1389,34 @@ function yn(l) {
1399
  l[3].join(" ") + " svelte-1t38q2d"
1400
  }
1401
  ], r = {};
1402
- for (let _ = 0; _ < o.length; _ += 1)
1403
- r = un(r, o[_]);
1404
  return {
1405
  c() {
1406
- e = mn(
1407
  /*tag*/
1408
  l[14]
1409
- ), s && s.c(), kt(
1410
  /*tag*/
1411
  l[14]
1412
- )(e, r), le(
1413
  e,
1414
  "hidden",
1415
  /*visible*/
1416
  l[10] === !1
1417
- ), le(
1418
  e,
1419
  "padded",
1420
  /*padding*/
1421
  l[6]
1422
- ), le(
1423
  e,
1424
  "border_focus",
1425
  /*border_mode*/
1426
  l[5] === "focus"
1427
- ), le(e, "hide-container", !/*explicit_call*/
1428
  l[8] && !/*container*/
1429
- l[9]), A(
1430
  e,
1431
  "height",
1432
  /*get_dimension*/
@@ -1434,7 +1424,7 @@ function yn(l) {
1434
  /*height*/
1435
  l[0]
1436
  )
1437
- ), A(e, "width", typeof /*width*/
1438
  l[1] == "number" ? `calc(min(${/*width*/
1439
  l[1]}px, 100%))` : (
1440
  /*get_dimension*/
@@ -1442,135 +1432,135 @@ function yn(l) {
1442
  /*width*/
1443
  l[1]
1444
  )
1445
- )), A(
1446
  e,
1447
  "border-style",
1448
  /*variant*/
1449
  l[4]
1450
- ), A(
1451
  e,
1452
  "overflow",
1453
  /*allow_overflow*/
1454
  l[11] ? "visible" : "hidden"
1455
- ), A(
1456
  e,
1457
  "flex-grow",
1458
  /*scale*/
1459
  l[12]
1460
- ), A(e, "min-width", `calc(min(${/*min_width*/
1461
- l[13]}px, 100%))`), A(e, "border-width", "var(--block-border-width)");
1462
  },
1463
- m(_, f) {
1464
- kn(_, e, f), s && s.m(e, null), n = !0;
1465
  },
1466
- p(_, f) {
1467
  s && s.p && (!n || f & /*$$scope*/
1468
- 131072) && pn(
1469
  s,
1470
  i,
1471
- _,
1472
  /*$$scope*/
1473
- _[17],
1474
- n ? bn(
1475
  i,
1476
  /*$$scope*/
1477
- _[17],
1478
  f,
1479
  null
1480
- ) : hn(
1481
  /*$$scope*/
1482
- _[17]
1483
  ),
1484
  null
1485
- ), kt(
1486
  /*tag*/
1487
- _[14]
1488
- )(e, r = gn(o, [
1489
  (!n || f & /*test_id*/
1490
  128) && { "data-testid": (
1491
  /*test_id*/
1492
- _[7]
1493
  ) },
1494
  (!n || f & /*elem_id*/
1495
  4) && { id: (
1496
  /*elem_id*/
1497
- _[2]
1498
  ) },
1499
  (!n || f & /*elem_classes*/
1500
  8 && t !== (t = "block " + /*elem_classes*/
1501
- _[3].join(" ") + " svelte-1t38q2d")) && { class: t }
1502
- ])), le(
1503
  e,
1504
  "hidden",
1505
  /*visible*/
1506
- _[10] === !1
1507
- ), le(
1508
  e,
1509
  "padded",
1510
  /*padding*/
1511
- _[6]
1512
- ), le(
1513
  e,
1514
  "border_focus",
1515
  /*border_mode*/
1516
- _[5] === "focus"
1517
- ), le(e, "hide-container", !/*explicit_call*/
1518
- _[8] && !/*container*/
1519
- _[9]), f & /*height*/
1520
- 1 && A(
1521
  e,
1522
  "height",
1523
  /*get_dimension*/
1524
- _[15](
1525
  /*height*/
1526
- _[0]
1527
  )
1528
  ), f & /*width*/
1529
- 2 && A(e, "width", typeof /*width*/
1530
- _[1] == "number" ? `calc(min(${/*width*/
1531
- _[1]}px, 100%))` : (
1532
  /*get_dimension*/
1533
- _[15](
1534
  /*width*/
1535
- _[1]
1536
  )
1537
  )), f & /*variant*/
1538
- 16 && A(
1539
  e,
1540
  "border-style",
1541
  /*variant*/
1542
- _[4]
1543
  ), f & /*allow_overflow*/
1544
- 2048 && A(
1545
  e,
1546
  "overflow",
1547
  /*allow_overflow*/
1548
- _[11] ? "visible" : "hidden"
1549
  ), f & /*scale*/
1550
- 4096 && A(
1551
  e,
1552
  "flex-grow",
1553
  /*scale*/
1554
- _[12]
1555
  ), f & /*min_width*/
1556
- 8192 && A(e, "min-width", `calc(min(${/*min_width*/
1557
- _[13]}px, 100%))`);
1558
  },
1559
- i(_) {
1560
- n || (Gt(s, _), n = !0);
1561
  },
1562
- o(_) {
1563
- Jt(s, _), n = !1;
1564
  },
1565
- d(_) {
1566
- _ && dn(e), s && s.d(_);
1567
  }
1568
  };
1569
  }
1570
- function Cn(l) {
1571
  let e, t = (
1572
  /*tag*/
1573
- l[14] && yn(l)
1574
  );
1575
  return {
1576
  c() {
@@ -1584,18 +1574,18 @@ function Cn(l) {
1584
  n[14] && t.p(n, i);
1585
  },
1586
  i(n) {
1587
- e || (Gt(t, n), e = !0);
1588
  },
1589
  o(n) {
1590
- Jt(t, n), e = !1;
1591
  },
1592
  d(n) {
1593
  t && t.d(n);
1594
  }
1595
  };
1596
  }
1597
- function qn(l, e, t) {
1598
- let { $$slots: n = {}, $$scope: i } = e, { height: s = void 0 } = e, { width: o = void 0 } = e, { elem_id: r = "" } = e, { elem_classes: _ = [] } = e, { variant: f = "solid" } = e, { border_mode: a = "base" } = e, { padding: u = !0 } = e, { type: c = "normal" } = e, { test_id: m = void 0 } = e, { explicit_call: y = !1 } = e, { container: S = !0 } = e, { visible: T = !0 } = e, { allow_overflow: L = !0 } = e, { scale: C = null } = e, { min_width: d = 0 } = e, p = c === "fieldset" ? "fieldset" : "div";
1599
  const H = (b) => {
1600
  if (b !== void 0) {
1601
  if (typeof b == "number")
@@ -1605,14 +1595,14 @@ function qn(l, e, t) {
1605
  }
1606
  };
1607
  return l.$$set = (b) => {
1608
- "height" in b && t(0, s = b.height), "width" in b && t(1, o = b.width), "elem_id" in b && t(2, r = b.elem_id), "elem_classes" in b && t(3, _ = b.elem_classes), "variant" in b && t(4, f = b.variant), "border_mode" in b && t(5, a = b.border_mode), "padding" in b && t(6, u = b.padding), "type" in b && t(16, c = b.type), "test_id" in b && t(7, m = b.test_id), "explicit_call" in b && t(8, y = b.explicit_call), "container" in b && t(9, S = b.container), "visible" in b && t(10, T = b.visible), "allow_overflow" in b && t(11, L = b.allow_overflow), "scale" in b && t(12, C = b.scale), "min_width" in b && t(13, d = b.min_width), "$$scope" in b && t(17, i = b.$$scope);
1609
  }, [
1610
  s,
1611
  o,
1612
  r,
1613
- _,
1614
- f,
1615
  a,
 
 
1616
  u,
1617
  m,
1618
  y,
@@ -1628,9 +1618,9 @@ function qn(l, e, t) {
1628
  n
1629
  ];
1630
  }
1631
- class Tn extends rn {
1632
  constructor(e) {
1633
- super(), wn(this, e, qn, Cn, vn, {
1634
  height: 0,
1635
  width: 1,
1636
  elem_id: 2,
@@ -1649,7 +1639,7 @@ class Tn extends rn {
1649
  });
1650
  }
1651
  }
1652
- function ye(l) {
1653
  let e = ["", "k", "M", "G", "T", "P", "E", "Z"], t = 0;
1654
  for (; l > 1e3 && t < e.length - 1; )
1655
  l /= 1e3, t++;
@@ -1657,29 +1647,29 @@ function ye(l) {
1657
  return (Number.isInteger(l) ? l : l.toFixed(1)) + n;
1658
  }
1659
  const {
1660
- SvelteComponent: Ln,
1661
  append: I,
1662
  attr: q,
1663
- component_subscribe: vt,
1664
- detach: Sn,
1665
- element: Fn,
1666
- init: Hn,
1667
- insert: Mn,
1668
- noop: pt,
1669
- safe_not_equal: jn,
1670
- set_style: Ve,
1671
  svg_element: W,
1672
- toggle_class: yt
1673
- } = window.__gradio__svelte__internal, { onMount: Nn } = window.__gradio__svelte__internal;
1674
- function Vn(l) {
1675
- let e, t, n, i, s, o, r, _, f, a, u, c;
1676
  return {
1677
  c() {
1678
- e = Fn("div"), t = W("svg"), n = W("g"), i = W("path"), s = W("path"), o = W("path"), r = W("path"), _ = W("g"), f = W("path"), a = W("path"), u = W("path"), c = W("path"), q(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), q(i, "fill", "#FF7C00"), q(i, "fill-opacity", "0.4"), q(i, "class", "svelte-43sxxs"), q(s, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), q(s, "fill", "#FF7C00"), q(s, "class", "svelte-43sxxs"), q(o, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), q(o, "fill", "#FF7C00"), q(o, "fill-opacity", "0.4"), q(o, "class", "svelte-43sxxs"), q(r, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), q(r, "fill", "#FF7C00"), q(r, "class", "svelte-43sxxs"), Ve(n, "transform", "translate(" + /*$top*/
1679
  l[1][0] + "px, " + /*$top*/
1680
- l[1][1] + "px)"), q(f, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), q(f, "fill", "#FF7C00"), q(f, "fill-opacity", "0.4"), q(f, "class", "svelte-43sxxs"), q(a, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), q(a, "fill", "#FF7C00"), q(a, "class", "svelte-43sxxs"), q(u, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), q(u, "fill", "#FF7C00"), q(u, "fill-opacity", "0.4"), q(u, "class", "svelte-43sxxs"), q(c, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), q(c, "fill", "#FF7C00"), q(c, "class", "svelte-43sxxs"), Ve(_, "transform", "translate(" + /*$bottom*/
1681
  l[2][0] + "px, " + /*$bottom*/
1682
- l[2][1] + "px)"), q(t, "viewBox", "-1200 -1200 3000 3000"), q(t, "fill", "none"), q(t, "xmlns", "http://www.w3.org/2000/svg"), q(t, "class", "svelte-43sxxs"), q(e, "class", "svelte-43sxxs"), yt(
1683
  e,
1684
  "margin",
1685
  /*margin*/
@@ -1687,95 +1677,95 @@ function Vn(l) {
1687
  );
1688
  },
1689
  m(m, y) {
1690
- Mn(m, e, y), I(e, t), I(t, n), I(n, i), I(n, s), I(n, o), I(n, r), I(t, _), I(_, f), I(_, a), I(_, u), I(_, c);
1691
  },
1692
  p(m, [y]) {
1693
  y & /*$top*/
1694
- 2 && Ve(n, "transform", "translate(" + /*$top*/
1695
  m[1][0] + "px, " + /*$top*/
1696
  m[1][1] + "px)"), y & /*$bottom*/
1697
- 4 && Ve(_, "transform", "translate(" + /*$bottom*/
1698
  m[2][0] + "px, " + /*$bottom*/
1699
  m[2][1] + "px)"), y & /*margin*/
1700
- 1 && yt(
1701
  e,
1702
  "margin",
1703
  /*margin*/
1704
  m[0]
1705
  );
1706
  },
1707
- i: pt,
1708
- o: pt,
1709
  d(m) {
1710
- m && Sn(e);
1711
  }
1712
  };
1713
  }
1714
- function zn(l, e, t) {
1715
  let n, i, { margin: s = !0 } = e;
1716
- const o = _t([0, 0]);
1717
- vt(l, o, (c) => t(1, n = c));
1718
- const r = _t([0, 0]);
1719
- vt(l, r, (c) => t(2, i = c));
1720
- let _;
1721
  async function f() {
1722
  await Promise.all([o.set([125, 140]), r.set([-125, -140])]), await Promise.all([o.set([-125, 140]), r.set([125, -140])]), await Promise.all([o.set([-125, 0]), r.set([125, -0])]), await Promise.all([o.set([125, 0]), r.set([-125, 0])]);
1723
  }
1724
- async function a() {
1725
- await f(), _ || a();
1726
  }
1727
  async function u() {
1728
- await Promise.all([o.set([125, 0]), r.set([-125, 0])]), a();
1729
  }
1730
- return Nn(() => (u(), () => _ = !0)), l.$$set = (c) => {
1731
  "margin" in c && t(0, s = c.margin);
1732
  }, [s, n, i, o, r];
1733
  }
1734
- class An extends Ln {
1735
  constructor(e) {
1736
- super(), Hn(this, e, zn, Vn, jn, { margin: 0 });
1737
  }
1738
  }
1739
  const {
1740
- SvelteComponent: Bn,
1741
- append: ue,
1742
- attr: J,
1743
- binding_callbacks: Ct,
1744
- check_outros: Kt,
1745
- create_component: En,
1746
- create_slot: Pn,
1747
- destroy_component: Zn,
1748
- destroy_each: Qt,
1749
  detach: k,
1750
  element: $,
1751
- empty: Se,
1752
- ensure_array_like: Be,
1753
- get_all_dirty_from_scope: On,
1754
- get_slot_changes: Rn,
1755
- group_outros: xt,
1756
- init: Dn,
1757
  insert: v,
1758
- mount_component: In,
1759
- noop: We,
1760
- safe_not_equal: Wn,
1761
  set_data: O,
1762
- set_style: ie,
1763
- space: K,
1764
  text: F,
1765
  toggle_class: Z,
1766
- transition_in: Te,
1767
- transition_out: Le,
1768
- update_slot_base: Un
1769
- } = window.__gradio__svelte__internal, { tick: Xn } = window.__gradio__svelte__internal, { onDestroy: Yn } = window.__gradio__svelte__internal, Gn = (l) => ({}), qt = (l) => ({});
1770
- function Tt(l, e, t) {
1771
  const n = l.slice();
1772
  return n[38] = e[t], n[40] = t, n;
1773
  }
1774
- function Lt(l, e, t) {
1775
  const n = l.slice();
1776
  return n[38] = e[t], n;
1777
  }
1778
- function Jn(l) {
1779
  let e, t = (
1780
  /*i18n*/
1781
  l[1]("common.error") + ""
@@ -1783,85 +1773,85 @@ function Jn(l) {
1783
  const o = (
1784
  /*#slots*/
1785
  l[29].error
1786
- ), r = Pn(
1787
  o,
1788
  l,
1789
  /*$$scope*/
1790
  l[28],
1791
- qt
1792
  );
1793
  return {
1794
  c() {
1795
- e = $("span"), n = F(t), i = K(), r && r.c(), J(e, "class", "error svelte-1txqlrd");
1796
  },
1797
- m(_, f) {
1798
- v(_, e, f), ue(e, n), v(_, i, f), r && r.m(_, f), s = !0;
1799
  },
1800
- p(_, f) {
1801
  (!s || f[0] & /*i18n*/
1802
  2) && t !== (t = /*i18n*/
1803
- _[1]("common.error") + "") && O(n, t), r && r.p && (!s || f[0] & /*$$scope*/
1804
- 268435456) && Un(
1805
  r,
1806
  o,
1807
- _,
1808
  /*$$scope*/
1809
- _[28],
1810
- s ? Rn(
1811
  o,
1812
  /*$$scope*/
1813
- _[28],
1814
  f,
1815
- Gn
1816
- ) : On(
1817
  /*$$scope*/
1818
- _[28]
1819
  ),
1820
- qt
1821
  );
1822
  },
1823
- i(_) {
1824
- s || (Te(r, _), s = !0);
1825
  },
1826
- o(_) {
1827
- Le(r, _), s = !1;
1828
  },
1829
- d(_) {
1830
- _ && (k(e), k(i)), r && r.d(_);
1831
  }
1832
  };
1833
  }
1834
- function Kn(l) {
1835
- let e, t, n, i, s, o, r, _, f, a = (
1836
  /*variant*/
1837
  l[8] === "default" && /*show_eta_bar*/
1838
  l[18] && /*show_progress*/
1839
- l[6] === "full" && St(l)
1840
  );
1841
  function u(d, p) {
1842
  if (
1843
  /*progress*/
1844
  d[7]
1845
  )
1846
- return $n;
1847
  if (
1848
  /*queue_position*/
1849
  d[2] !== null && /*queue_size*/
1850
  d[3] !== void 0 && /*queue_position*/
1851
  d[2] >= 0
1852
  )
1853
- return xn;
1854
  if (
1855
  /*queue_position*/
1856
  d[2] === 0
1857
  )
1858
- return Qn;
1859
  }
1860
  let c = u(l), m = c && c(l), y = (
1861
  /*timer*/
1862
- l[5] && Mt(l)
1863
  );
1864
- const S = [ni, li], T = [];
1865
  function L(d, p) {
1866
  return (
1867
  /*last_progress_level*/
@@ -1873,10 +1863,10 @@ function Kn(l) {
1873
  }
1874
  ~(s = L(l)) && (o = T[s] = S[s](l));
1875
  let C = !/*timer*/
1876
- l[5] && Et(l);
1877
  return {
1878
  c() {
1879
- a && a.c(), e = K(), t = $("div"), m && m.c(), n = K(), y && y.c(), i = K(), o && o.c(), r = K(), C && C.c(), _ = Se(), J(t, "class", "progress-text svelte-1txqlrd"), Z(
1880
  t,
1881
  "meta-text-center",
1882
  /*variant*/
@@ -1889,14 +1879,14 @@ function Kn(l) {
1889
  );
1890
  },
1891
  m(d, p) {
1892
- a && a.m(d, p), v(d, e, p), v(d, t, p), m && m.m(t, null), ue(t, n), y && y.m(t, null), v(d, i, p), ~s && T[s].m(d, p), v(d, r, p), C && C.m(d, p), v(d, _, p), f = !0;
1893
  },
1894
  p(d, p) {
1895
  /*variant*/
1896
  d[8] === "default" && /*show_eta_bar*/
1897
  d[18] && /*show_progress*/
1898
- d[6] === "full" ? a ? a.p(d, p) : (a = St(d), a.c(), a.m(e.parentNode, e)) : a && (a.d(1), a = null), c === (c = u(d)) && m ? m.p(d, p) : (m && m.d(1), m = c && c(d), m && (m.c(), m.m(t, n))), /*timer*/
1899
- d[5] ? y ? y.p(d, p) : (y = Mt(d), y.c(), y.m(t, null)) : y && (y.d(1), y = null), (!f || p[0] & /*variant*/
1900
  256) && Z(
1901
  t,
1902
  "meta-text-center",
@@ -1910,28 +1900,28 @@ function Kn(l) {
1910
  d[8] === "default"
1911
  );
1912
  let H = s;
1913
- s = L(d), s === H ? ~s && T[s].p(d, p) : (o && (xt(), Le(T[H], 1, 1, () => {
1914
  T[H] = null;
1915
- }), Kt()), ~s ? (o = T[s], o ? o.p(d, p) : (o = T[s] = S[s](d), o.c()), Te(o, 1), o.m(r.parentNode, r)) : o = null), /*timer*/
1916
- d[5] ? C && (C.d(1), C = null) : C ? C.p(d, p) : (C = Et(d), C.c(), C.m(_.parentNode, _));
1917
  },
1918
  i(d) {
1919
- f || (Te(o), f = !0);
1920
  },
1921
  o(d) {
1922
- Le(o), f = !1;
1923
  },
1924
  d(d) {
1925
- d && (k(e), k(t), k(i), k(r), k(_)), a && a.d(d), m && m.d(), y && y.d(), ~s && T[s].d(d), C && C.d(d);
1926
  }
1927
  };
1928
  }
1929
- function St(l) {
1930
  let e, t = `translateX(${/*eta_level*/
1931
  (l[17] || 0) * 100 - 100}%)`;
1932
  return {
1933
  c() {
1934
- e = $("div"), J(e, "class", "eta-bar svelte-1txqlrd"), ie(e, "transform", t);
1935
  },
1936
  m(n, i) {
1937
  v(n, e, i);
@@ -1939,14 +1929,14 @@ function St(l) {
1939
  p(n, i) {
1940
  i[0] & /*eta_level*/
1941
  131072 && t !== (t = `translateX(${/*eta_level*/
1942
- (n[17] || 0) * 100 - 100}%)`) && ie(e, "transform", t);
1943
  },
1944
  d(n) {
1945
  n && k(e);
1946
  }
1947
  };
1948
  }
1949
- function Qn(l) {
1950
  let e;
1951
  return {
1952
  c() {
@@ -1955,13 +1945,13 @@ function Qn(l) {
1955
  m(t, n) {
1956
  v(t, e, n);
1957
  },
1958
- p: We,
1959
  d(t) {
1960
  t && k(e);
1961
  }
1962
  };
1963
  }
1964
- function xn(l) {
1965
  let e, t = (
1966
  /*queue_position*/
1967
  l[2] + 1 + ""
@@ -1973,13 +1963,13 @@ function xn(l) {
1973
  l[3]
1974
  ), o = F(" |");
1975
  },
1976
- m(r, _) {
1977
- v(r, e, _), v(r, n, _), v(r, i, _), v(r, s, _), v(r, o, _);
1978
  },
1979
- p(r, _) {
1980
- _[0] & /*queue_position*/
1981
  4 && t !== (t = /*queue_position*/
1982
- r[2] + 1 + "") && O(n, t), _[0] & /*queue_size*/
1983
  8 && O(
1984
  s,
1985
  /*queue_size*/
@@ -1991,18 +1981,18 @@ function xn(l) {
1991
  }
1992
  };
1993
  }
1994
- function $n(l) {
1995
- let e, t = Be(
1996
  /*progress*/
1997
  l[7]
1998
  ), n = [];
1999
  for (let i = 0; i < t.length; i += 1)
2000
- n[i] = Ht(Lt(l, t, i));
2001
  return {
2002
  c() {
2003
  for (let i = 0; i < n.length; i += 1)
2004
  n[i].c();
2005
- e = Se();
2006
  },
2007
  m(i, s) {
2008
  for (let o = 0; o < n.length; o += 1)
@@ -2012,14 +2002,14 @@ function $n(l) {
2012
  p(i, s) {
2013
  if (s[0] & /*progress*/
2014
  128) {
2015
- t = Be(
2016
  /*progress*/
2017
  i[7]
2018
  );
2019
  let o;
2020
  for (o = 0; o < t.length; o += 1) {
2021
- const r = Lt(i, t, o);
2022
- n[o] ? n[o].p(r, s) : (n[o] = Ht(r), n[o].c(), n[o].m(e.parentNode, e));
2023
  }
2024
  for (; o < n.length; o += 1)
2025
  n[o].d(1);
@@ -2027,41 +2017,41 @@ function $n(l) {
2027
  }
2028
  },
2029
  d(i) {
2030
- i && k(e), Qt(n, i);
2031
  }
2032
  };
2033
  }
2034
- function Ft(l) {
2035
  let e, t = (
2036
  /*p*/
2037
  l[38].unit + ""
2038
  ), n, i, s = " ", o;
2039
- function r(a, u) {
2040
  return (
2041
  /*p*/
2042
- a[38].length != null ? ti : ei
2043
  );
2044
  }
2045
- let _ = r(l), f = _(l);
2046
  return {
2047
  c() {
2048
- f.c(), e = K(), n = F(t), i = F(" | "), o = F(s);
2049
  },
2050
- m(a, u) {
2051
- f.m(a, u), v(a, e, u), v(a, n, u), v(a, i, u), v(a, o, u);
2052
  },
2053
- p(a, u) {
2054
- _ === (_ = r(a)) && f ? f.p(a, u) : (f.d(1), f = _(a), f && (f.c(), f.m(e.parentNode, e))), u[0] & /*progress*/
2055
  128 && t !== (t = /*p*/
2056
- a[38].unit + "") && O(n, t);
2057
  },
2058
- d(a) {
2059
- a && (k(e), k(n), k(i), k(o)), f.d(a);
2060
  }
2061
  };
2062
  }
2063
- function ei(l) {
2064
- let e = ye(
2065
  /*p*/
2066
  l[38].index || 0
2067
  ) + "", t;
@@ -2074,7 +2064,7 @@ function ei(l) {
2074
  },
2075
  p(n, i) {
2076
  i[0] & /*progress*/
2077
- 128 && e !== (e = ye(
2078
  /*p*/
2079
  n[38].index || 0
2080
  ) + "") && O(t, e);
@@ -2084,11 +2074,11 @@ function ei(l) {
2084
  }
2085
  };
2086
  }
2087
- function ti(l) {
2088
- let e = ye(
2089
  /*p*/
2090
  l[38].index || 0
2091
- ) + "", t, n, i = ye(
2092
  /*p*/
2093
  l[38].length
2094
  ) + "", s;
@@ -2101,11 +2091,11 @@ function ti(l) {
2101
  },
2102
  p(o, r) {
2103
  r[0] & /*progress*/
2104
- 128 && e !== (e = ye(
2105
  /*p*/
2106
  o[38].index || 0
2107
  ) + "") && O(t, e), r[0] & /*progress*/
2108
- 128 && i !== (i = ye(
2109
  /*p*/
2110
  o[38].length
2111
  ) + "") && O(s, i);
@@ -2115,28 +2105,28 @@ function ti(l) {
2115
  }
2116
  };
2117
  }
2118
- function Ht(l) {
2119
  let e, t = (
2120
  /*p*/
2121
- l[38].index != null && Ft(l)
2122
  );
2123
  return {
2124
  c() {
2125
- t && t.c(), e = Se();
2126
  },
2127
  m(n, i) {
2128
  t && t.m(n, i), v(n, e, i);
2129
  },
2130
  p(n, i) {
2131
  /*p*/
2132
- n[38].index != null ? t ? t.p(n, i) : (t = Ft(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
2133
  },
2134
  d(n) {
2135
  n && k(e), t && t.d(n);
2136
  }
2137
  };
2138
  }
2139
- function Mt(l) {
2140
  let e, t = (
2141
  /*eta*/
2142
  l[0] ? `/${/*formatted_eta*/
@@ -2168,19 +2158,19 @@ function Mt(l) {
2168
  }
2169
  };
2170
  }
2171
- function li(l) {
2172
  let e, t;
2173
- return e = new An({
2174
  props: { margin: (
2175
  /*variant*/
2176
  l[8] === "default"
2177
  ) }
2178
  }), {
2179
  c() {
2180
- En(e.$$.fragment);
2181
  },
2182
  m(n, i) {
2183
- In(e, n, i), t = !0;
2184
  },
2185
  p(n, i) {
2186
  const s = {};
@@ -2189,54 +2179,54 @@ function li(l) {
2189
  n[8] === "default"), e.$set(s);
2190
  },
2191
  i(n) {
2192
- t || (Te(e.$$.fragment, n), t = !0);
2193
  },
2194
  o(n) {
2195
- Le(e.$$.fragment, n), t = !1;
2196
  },
2197
  d(n) {
2198
- Zn(e, n);
2199
  }
2200
  };
2201
  }
2202
- function ni(l) {
2203
  let e, t, n, i, s, o = `${/*last_progress_level*/
2204
  l[15] * 100}%`, r = (
2205
  /*progress*/
2206
- l[7] != null && jt(l)
2207
  );
2208
  return {
2209
  c() {
2210
- e = $("div"), t = $("div"), r && r.c(), n = K(), i = $("div"), s = $("div"), J(t, "class", "progress-level-inner svelte-1txqlrd"), J(s, "class", "progress-bar svelte-1txqlrd"), ie(s, "width", o), J(i, "class", "progress-bar-wrap svelte-1txqlrd"), J(e, "class", "progress-level svelte-1txqlrd");
2211
  },
2212
- m(_, f) {
2213
- v(_, e, f), ue(e, t), r && r.m(t, null), ue(e, n), ue(e, i), ue(i, s), l[30](s);
2214
  },
2215
- p(_, f) {
2216
  /*progress*/
2217
- _[7] != null ? r ? r.p(_, f) : (r = jt(_), r.c(), r.m(t, null)) : r && (r.d(1), r = null), f[0] & /*last_progress_level*/
2218
  32768 && o !== (o = `${/*last_progress_level*/
2219
- _[15] * 100}%`) && ie(s, "width", o);
2220
  },
2221
- i: We,
2222
- o: We,
2223
- d(_) {
2224
- _ && k(e), r && r.d(), l[30](null);
2225
  }
2226
  };
2227
  }
2228
- function jt(l) {
2229
- let e, t = Be(
2230
  /*progress*/
2231
  l[7]
2232
  ), n = [];
2233
  for (let i = 0; i < t.length; i += 1)
2234
- n[i] = Bt(Tt(l, t, i));
2235
  return {
2236
  c() {
2237
  for (let i = 0; i < n.length; i += 1)
2238
  n[i].c();
2239
- e = Se();
2240
  },
2241
  m(i, s) {
2242
  for (let o = 0; o < n.length; o += 1)
@@ -2246,14 +2236,14 @@ function jt(l) {
2246
  p(i, s) {
2247
  if (s[0] & /*progress_level, progress*/
2248
  16512) {
2249
- t = Be(
2250
  /*progress*/
2251
  i[7]
2252
  );
2253
  let o;
2254
  for (o = 0; o < t.length; o += 1) {
2255
- const r = Tt(i, t, o);
2256
- n[o] ? n[o].p(r, s) : (n[o] = Bt(r), n[o].c(), n[o].m(e.parentNode, e));
2257
  }
2258
  for (; o < n.length; o += 1)
2259
  n[o].d(1);
@@ -2261,17 +2251,17 @@ function jt(l) {
2261
  }
2262
  },
2263
  d(i) {
2264
- i && k(e), Qt(n, i);
2265
  }
2266
  };
2267
  }
2268
- function Nt(l) {
2269
  let e, t, n, i, s = (
2270
  /*i*/
2271
- l[40] !== 0 && ii()
2272
  ), o = (
2273
  /*p*/
2274
- l[38].desc != null && Vt(l)
2275
  ), r = (
2276
  /*p*/
2277
  l[38].desc != null && /*progress_level*/
@@ -2279,35 +2269,35 @@ function Nt(l) {
2279
  l[14][
2280
  /*i*/
2281
  l[40]
2282
- ] != null && zt()
2283
- ), _ = (
2284
  /*progress_level*/
2285
- l[14] != null && At(l)
2286
  );
2287
  return {
2288
  c() {
2289
- s && s.c(), e = K(), o && o.c(), t = K(), r && r.c(), n = K(), _ && _.c(), i = Se();
2290
  },
2291
- m(f, a) {
2292
- s && s.m(f, a), v(f, e, a), o && o.m(f, a), v(f, t, a), r && r.m(f, a), v(f, n, a), _ && _.m(f, a), v(f, i, a);
2293
  },
2294
- p(f, a) {
2295
  /*p*/
2296
- f[38].desc != null ? o ? o.p(f, a) : (o = Vt(f), o.c(), o.m(t.parentNode, t)) : o && (o.d(1), o = null), /*p*/
2297
  f[38].desc != null && /*progress_level*/
2298
  f[14] && /*progress_level*/
2299
  f[14][
2300
  /*i*/
2301
  f[40]
2302
- ] != null ? r || (r = zt(), r.c(), r.m(n.parentNode, n)) : r && (r.d(1), r = null), /*progress_level*/
2303
- f[14] != null ? _ ? _.p(f, a) : (_ = At(f), _.c(), _.m(i.parentNode, i)) : _ && (_.d(1), _ = null);
2304
  },
2305
  d(f) {
2306
- f && (k(e), k(t), k(n), k(i)), s && s.d(f), o && o.d(f), r && r.d(f), _ && _.d(f);
2307
  }
2308
  };
2309
  }
2310
- function ii(l) {
2311
  let e;
2312
  return {
2313
  c() {
@@ -2321,7 +2311,7 @@ function ii(l) {
2321
  }
2322
  };
2323
  }
2324
- function Vt(l) {
2325
  let e = (
2326
  /*p*/
2327
  l[38].desc + ""
@@ -2343,7 +2333,7 @@ function Vt(l) {
2343
  }
2344
  };
2345
  }
2346
- function zt(l) {
2347
  let e;
2348
  return {
2349
  c() {
@@ -2357,7 +2347,7 @@ function zt(l) {
2357
  }
2358
  };
2359
  }
2360
- function At(l) {
2361
  let e = (100 * /*progress_level*/
2362
  (l[14][
2363
  /*i*/
@@ -2383,7 +2373,7 @@ function At(l) {
2383
  }
2384
  };
2385
  }
2386
- function Bt(l) {
2387
  let e, t = (
2388
  /*p*/
2389
  (l[38].desc != null || /*progress_level*/
@@ -2391,11 +2381,11 @@ function Bt(l) {
2391
  l[14][
2392
  /*i*/
2393
  l[40]
2394
- ] != null) && Nt(l)
2395
  );
2396
  return {
2397
  c() {
2398
- t && t.c(), e = Se();
2399
  },
2400
  m(n, i) {
2401
  t && t.m(n, i), v(n, e, i);
@@ -2407,24 +2397,24 @@ function Bt(l) {
2407
  n[14][
2408
  /*i*/
2409
  n[40]
2410
- ] != null ? t ? t.p(n, i) : (t = Nt(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
2411
  },
2412
  d(n) {
2413
  n && k(e), t && t.d(n);
2414
  }
2415
  };
2416
  }
2417
- function Et(l) {
2418
  let e, t;
2419
  return {
2420
  c() {
2421
  e = $("p"), t = F(
2422
  /*loading_text*/
2423
  l[9]
2424
- ), J(e, "class", "loading svelte-1txqlrd");
2425
  },
2426
  m(n, i) {
2427
- v(n, e, i), ue(e, t);
2428
  },
2429
  p(n, i) {
2430
  i[0] & /*loading_text*/
@@ -2439,10 +2429,10 @@ function Et(l) {
2439
  }
2440
  };
2441
  }
2442
- function si(l) {
2443
  let e, t, n, i, s;
2444
- const o = [Kn, Jn], r = [];
2445
- function _(f, a) {
2446
  return (
2447
  /*status*/
2448
  f[4] === "pending" ? 0 : (
@@ -2451,9 +2441,9 @@ function si(l) {
2451
  )
2452
  );
2453
  }
2454
- return ~(t = _(l)) && (n = r[t] = o[t](l)), {
2455
  c() {
2456
- e = $("div"), n && n.c(), J(e, "class", i = "wrap " + /*variant*/
2457
  l[8] + " " + /*show_progress*/
2458
  l[6] + " svelte-1txqlrd"), Z(e, "hide", !/*status*/
2459
  l[4] || /*status*/
@@ -2477,33 +2467,33 @@ function si(l) {
2477
  "border",
2478
  /*border*/
2479
  l[12]
2480
- ), ie(
2481
  e,
2482
  "position",
2483
  /*absolute*/
2484
  l[10] ? "absolute" : "static"
2485
- ), ie(
2486
  e,
2487
  "padding",
2488
  /*absolute*/
2489
  l[10] ? "0" : "var(--size-8) 0"
2490
  );
2491
  },
2492
- m(f, a) {
2493
- v(f, e, a), ~t && r[t].m(e, null), l[31](e), s = !0;
2494
  },
2495
- p(f, a) {
2496
  let u = t;
2497
- t = _(f), t === u ? ~t && r[t].p(f, a) : (n && (xt(), Le(r[u], 1, 1, () => {
2498
  r[u] = null;
2499
- }), Kt()), ~t ? (n = r[t], n ? n.p(f, a) : (n = r[t] = o[t](f), n.c()), Te(n, 1), n.m(e, null)) : n = null), (!s || a[0] & /*variant, show_progress*/
2500
  320 && i !== (i = "wrap " + /*variant*/
2501
  f[8] + " " + /*show_progress*/
2502
- f[6] + " svelte-1txqlrd")) && J(e, "class", i), (!s || a[0] & /*variant, show_progress, status, show_progress*/
2503
  336) && Z(e, "hide", !/*status*/
2504
  f[4] || /*status*/
2505
  f[4] === "complete" || /*show_progress*/
2506
- f[6] === "hidden"), (!s || a[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
2507
  2384) && Z(
2508
  e,
2509
  "translucent",
@@ -2513,26 +2503,26 @@ function si(l) {
2513
  f[4] === "error") || /*translucent*/
2514
  f[11] || /*show_progress*/
2515
  f[6] === "minimal"
2516
- ), (!s || a[0] & /*variant, show_progress, status*/
2517
  336) && Z(
2518
  e,
2519
  "generating",
2520
  /*status*/
2521
  f[4] === "generating"
2522
- ), (!s || a[0] & /*variant, show_progress, border*/
2523
  4416) && Z(
2524
  e,
2525
  "border",
2526
  /*border*/
2527
  f[12]
2528
- ), a[0] & /*absolute*/
2529
- 1024 && ie(
2530
  e,
2531
  "position",
2532
  /*absolute*/
2533
  f[10] ? "absolute" : "static"
2534
- ), a[0] & /*absolute*/
2535
- 1024 && ie(
2536
  e,
2537
  "padding",
2538
  /*absolute*/
@@ -2540,83 +2530,83 @@ function si(l) {
2540
  );
2541
  },
2542
  i(f) {
2543
- s || (Te(n), s = !0);
2544
  },
2545
  o(f) {
2546
- Le(n), s = !1;
2547
  },
2548
  d(f) {
2549
  f && k(e), ~t && r[t].d(), l[31](null);
2550
  }
2551
  };
2552
  }
2553
- let ze = [], De = !1;
2554
- async function oi(l, e = !0) {
2555
  if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && e !== !0)) {
2556
- if (ze.push(l), !De)
2557
- De = !0;
2558
  else
2559
  return;
2560
- await Xn(), requestAnimationFrame(() => {
2561
  let t = [0, 0];
2562
- for (let n = 0; n < ze.length; n++) {
2563
- const s = ze[n].getBoundingClientRect();
2564
  (n === 0 || s.top + window.scrollY <= t[0]) && (t[0] = s.top + window.scrollY, t[1] = n);
2565
  }
2566
- window.scrollTo({ top: t[0] - 20, behavior: "smooth" }), De = !1, ze = [];
2567
  });
2568
  }
2569
  }
2570
- function fi(l, e, t) {
2571
- let n, { $$slots: i = {}, $$scope: s } = e, { i18n: o } = e, { eta: r = null } = e, { queue_position: _ } = e, { queue_size: f } = e, { status: a } = e, { scroll_to_output: u = !1 } = e, { timer: c = !0 } = e, { show_progress: m = "full" } = e, { message: y = null } = e, { progress: S = null } = e, { variant: T = "default" } = e, { loading_text: L = "Loading..." } = e, { absolute: C = !0 } = e, { translucent: d = !1 } = e, { border: p = !1 } = e, { autoscroll: H } = e, b, R = !1, Q = 0, E = 0, P = null, X = null, be = 0, D = null, x, z = null, ge = !0;
2572
  const g = () => {
2573
- t(0, r = t(26, P = t(19, we = null))), t(24, Q = performance.now()), t(25, E = 0), R = !0, je();
2574
  };
2575
  function je() {
2576
  requestAnimationFrame(() => {
2577
- t(25, E = (performance.now() - Q) / 1e3), R && je();
2578
  });
2579
  }
2580
  function Ne() {
2581
- t(25, E = 0), t(0, r = t(26, P = t(19, we = null))), R && (R = !1);
2582
  }
2583
- Yn(() => {
2584
  R && Ne();
2585
  });
2586
- let we = null;
2587
- function Ee(w) {
2588
- Ct[w ? "unshift" : "push"](() => {
2589
- z = w, t(16, z), t(7, S), t(14, D), t(15, x);
2590
  });
2591
  }
2592
- function Pe(w) {
2593
- Ct[w ? "unshift" : "push"](() => {
2594
  b = w, t(13, b);
2595
  });
2596
  }
2597
  return l.$$set = (w) => {
2598
- "i18n" in w && t(1, o = w.i18n), "eta" in w && t(0, r = w.eta), "queue_position" in w && t(2, _ = w.queue_position), "queue_size" in w && t(3, f = w.queue_size), "status" in w && t(4, a = w.status), "scroll_to_output" in w && t(21, u = w.scroll_to_output), "timer" in w && t(5, c = w.timer), "show_progress" in w && t(6, m = w.show_progress), "message" in w && t(22, y = w.message), "progress" in w && t(7, S = w.progress), "variant" in w && t(8, T = w.variant), "loading_text" in w && t(9, L = w.loading_text), "absolute" in w && t(10, C = w.absolute), "translucent" in w && t(11, d = w.translucent), "border" in w && t(12, p = w.border), "autoscroll" in w && t(23, H = w.autoscroll), "$$scope" in w && t(28, s = w.$$scope);
2599
  }, l.$$.update = () => {
2600
  l.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
2601
- 218103809 && (r === null && t(0, r = P), r != null && P !== r && (t(27, X = (performance.now() - Q) / 1e3 + r), t(19, we = X.toFixed(1)), t(26, P = r))), l.$$.dirty[0] & /*eta_from_start, timer_diff*/
2602
- 167772160 && t(17, be = X === null || X <= 0 || !E ? null : Math.min(E / X, 1)), l.$$.dirty[0] & /*progress*/
2603
- 128 && S != null && t(18, ge = !1), l.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
2604
  114816 && (S != null ? t(14, D = S.map((w) => {
2605
  if (w.index != null && w.length != null)
2606
  return w.index / w.length;
2607
  if (w.progress != null)
2608
  return w.progress;
2609
- })) : t(14, D = null), D ? (t(15, x = D[D.length - 1]), z && (x === 0 ? t(16, z.style.transition = "0", z) : t(16, z.style.transition = "150ms", z))) : t(15, x = void 0)), l.$$.dirty[0] & /*status*/
2610
- 16 && (a === "pending" ? g() : Ne()), l.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
2611
- 10493968 && b && u && (a === "pending" || a === "complete") && oi(b, H), l.$$.dirty[0] & /*status, message*/
2612
  4194320, l.$$.dirty[0] & /*timer_diff*/
2613
  33554432 && t(20, n = E.toFixed(1));
2614
  }, [
2615
  r,
2616
  o,
2617
- _,
2618
- f,
2619
  a,
 
 
2620
  c,
2621
  m,
2622
  S,
@@ -2627,33 +2617,33 @@ function fi(l, e, t) {
2627
  p,
2628
  b,
2629
  D,
2630
- x,
2631
- z,
 
2632
  be,
2633
  ge,
2634
- we,
2635
  n,
2636
  u,
2637
  y,
2638
  H,
2639
- Q,
2640
  E,
2641
- P,
2642
  X,
2643
  s,
2644
  i,
2645
- Ee,
2646
- Pe
2647
  ];
2648
  }
2649
- class ai extends Bn {
2650
  constructor(e) {
2651
- super(), Dn(
2652
  this,
2653
  e,
2654
- fi,
2655
  si,
2656
- Wn,
 
2657
  {
2658
  i18n: 1,
2659
  eta: 0,
@@ -2678,28 +2668,28 @@ class ai extends Bn {
2678
  }
2679
  }
2680
  const {
2681
- SvelteComponent: _i,
2682
- add_flush_callback: Pt,
2683
- assign: ri,
2684
- bind: Zt,
2685
- binding_callbacks: Ot,
2686
- check_outros: ui,
2687
- create_component: Qe,
2688
- destroy_component: xe,
2689
- detach: ci,
2690
  flush: M,
2691
- get_spread_object: di,
2692
- get_spread_update: mi,
2693
- group_outros: hi,
2694
- init: bi,
2695
- insert: gi,
2696
- mount_component: $e,
2697
- safe_not_equal: wi,
2698
- space: ki,
2699
- transition_in: Ce,
2700
  transition_out: Fe
2701
  } = window.__gradio__svelte__internal;
2702
- function Rt(l) {
2703
  let e, t;
2704
  const n = [
2705
  { autoscroll: (
@@ -2715,17 +2705,17 @@ function Rt(l) {
2715
  ];
2716
  let i = {};
2717
  for (let s = 0; s < n.length; s += 1)
2718
- i = ri(i, n[s]);
2719
- return e = new ai({ props: i }), {
2720
  c() {
2721
- Qe(e.$$.fragment);
2722
  },
2723
  m(s, o) {
2724
- $e(e, s, o), t = !0;
2725
  },
2726
  p(s, o) {
2727
  const r = o & /*gradio, loading_status*/
2728
- 131080 ? mi(n, [
2729
  o & /*gradio*/
2730
  8 && { autoscroll: (
2731
  /*gradio*/
@@ -2737,7 +2727,7 @@ function Rt(l) {
2737
  s[3].i18n
2738
  ) },
2739
  o & /*loading_status*/
2740
- 131072 && di(
2741
  /*loading_status*/
2742
  s[17]
2743
  )
@@ -2745,26 +2735,26 @@ function Rt(l) {
2745
  e.$set(r);
2746
  },
2747
  i(s) {
2748
- t || (Ce(e.$$.fragment, s), t = !0);
2749
  },
2750
  o(s) {
2751
  Fe(e.$$.fragment, s), t = !1;
2752
  },
2753
  d(s) {
2754
- xe(e, s);
2755
  }
2756
  };
2757
  }
2758
- function vi(l) {
2759
  let e, t, n, i, s, o = (
2760
  /*loading_status*/
2761
- l[17] && Rt(l)
2762
  );
2763
- function r(a) {
2764
- l[22](a);
2765
  }
2766
- function _(a) {
2767
- l[23](a);
2768
  }
2769
  let f = {
2770
  label: (
@@ -2811,7 +2801,7 @@ function vi(l) {
2811
  l[0] !== void 0 && (f.value = /*value*/
2812
  l[0]), /*value_is_output*/
2813
  l[2] !== void 0 && (f.value_is_output = /*value_is_output*/
2814
- l[2]), t = new _n({ props: f }), Ot.push(() => Zt(t, "value", r)), Ot.push(() => Zt(t, "value_is_output", _)), t.$on(
2815
  "change",
2816
  /*change_handler*/
2817
  l[24]
@@ -2837,59 +2827,59 @@ function vi(l) {
2837
  l[29]
2838
  ), {
2839
  c() {
2840
- o && o.c(), e = ki(), Qe(t.$$.fragment);
2841
  },
2842
- m(a, u) {
2843
- o && o.m(a, u), gi(a, e, u), $e(t, a, u), s = !0;
2844
  },
2845
- p(a, u) {
2846
  /*loading_status*/
2847
- a[17] ? o ? (o.p(a, u), u & /*loading_status*/
2848
- 131072 && Ce(o, 1)) : (o = Rt(a), o.c(), Ce(o, 1), o.m(e.parentNode, e)) : o && (hi(), Fe(o, 1, 1, () => {
2849
  o = null;
2850
- }), ui());
2851
  const c = {};
2852
  u & /*label*/
2853
  16 && (c.label = /*label*/
2854
- a[4]), u & /*info*/
2855
  64 && (c.info = /*info*/
2856
- a[6]), u & /*show_label*/
2857
  1024 && (c.show_label = /*show_label*/
2858
- a[10]), u & /*show_legend*/
2859
  2048 && (c.show_legend = /*show_legend*/
2860
- a[11]), u & /*show_legend_label*/
2861
  4096 && (c.show_legend_label = /*show_legend_label*/
2862
- a[12]), u & /*legend_label*/
2863
  32 && (c.legend_label = /*legend_label*/
2864
- a[5]), u & /*color_map*/
2865
  2 && (c.color_map = /*color_map*/
2866
- a[1]), u & /*show_copy_button*/
2867
  65536 && (c.show_copy_button = /*show_copy_button*/
2868
- a[16]), u & /*container*/
2869
  8192 && (c.container = /*container*/
2870
- a[13]), u & /*interactive*/
2871
  262144 && (c.disabled = !/*interactive*/
2872
- a[18]), !n && u & /*value*/
2873
  1 && (n = !0, c.value = /*value*/
2874
- a[0], Pt(() => n = !1)), !i && u & /*value_is_output*/
2875
  4 && (i = !0, c.value_is_output = /*value_is_output*/
2876
- a[2], Pt(() => i = !1)), t.$set(c);
2877
  },
2878
- i(a) {
2879
- s || (Ce(o), Ce(t.$$.fragment, a), s = !0);
2880
  },
2881
- o(a) {
2882
- Fe(o), Fe(t.$$.fragment, a), s = !1;
2883
  },
2884
- d(a) {
2885
- a && ci(e), o && o.d(a), xe(t, a);
2886
  }
2887
  }
2888
  );
2889
  }
2890
- function pi(l) {
2891
  let e, t;
2892
- return e = new Tn({
2893
  props: {
2894
  visible: (
2895
  /*visible*/
@@ -2916,15 +2906,15 @@ function pi(l) {
2916
  /*container*/
2917
  l[13]
2918
  ),
2919
- $$slots: { default: [vi] },
2920
  $$scope: { ctx: l }
2921
  }
2922
  }), {
2923
  c() {
2924
- Qe(e.$$.fragment);
2925
  },
2926
  m(n, i) {
2927
- $e(e, n, i), t = !0;
2928
  },
2929
  p(n, [i]) {
2930
  const s = {};
@@ -2944,34 +2934,34 @@ function pi(l) {
2944
  1074216063 && (s.$$scope = { dirty: i, ctx: n }), e.$set(s);
2945
  },
2946
  i(n) {
2947
- t || (Ce(e.$$.fragment, n), t = !0);
2948
  },
2949
  o(n) {
2950
  Fe(e.$$.fragment, n), t = !1;
2951
  },
2952
  d(n) {
2953
- xe(e, n);
2954
  }
2955
  };
2956
  }
2957
- function yi(l, e, t) {
2958
- let { gradio: n } = e, { label: i = "Highlighted Textbox" } = e, { legend_label: s = "Highlights:" } = e, { info: o = void 0 } = e, { elem_id: r = "" } = e, { elem_classes: _ = [] } = e, { visible: f = !0 } = e, { value: a } = e, { show_label: u } = e, { show_legend: c } = e, { show_legend_label: m } = e, { color_map: y = {} } = e, { container: S = !0 } = e, { scale: T = null } = e, { min_width: L = void 0 } = e, { show_copy_button: C = !1 } = e, { loading_status: d = void 0 } = e, { value_is_output: p = !1 } = e, { combine_adjacent: H = !1 } = e, { interactive: b = !0 } = e;
2959
- const R = !1, Q = !0;
2960
  function E(g) {
2961
- a = g, t(0, a), t(19, H);
2962
  }
2963
- function P(g) {
2964
  p = g, t(2, p);
2965
  }
2966
- const X = () => n.dispatch("change"), be = () => n.dispatch("input"), D = () => n.dispatch("submit"), x = () => n.dispatch("blur"), z = (g) => n.dispatch("select", g.detail), ge = () => n.dispatch("focus");
2967
  return l.$$set = (g) => {
2968
- "gradio" in g && t(3, n = g.gradio), "label" in g && t(4, i = g.label), "legend_label" in g && t(5, s = g.legend_label), "info" in g && t(6, o = g.info), "elem_id" in g && t(7, r = g.elem_id), "elem_classes" in g && t(8, _ = g.elem_classes), "visible" in g && t(9, f = g.visible), "value" in g && t(0, a = g.value), "show_label" in g && t(10, u = g.show_label), "show_legend" in g && t(11, c = g.show_legend), "show_legend_label" in g && t(12, m = g.show_legend_label), "color_map" in g && t(1, y = g.color_map), "container" in g && t(13, S = g.container), "scale" in g && t(14, T = g.scale), "min_width" in g && t(15, L = g.min_width), "show_copy_button" in g && t(16, C = g.show_copy_button), "loading_status" in g && t(17, d = g.loading_status), "value_is_output" in g && t(2, p = g.value_is_output), "combine_adjacent" in g && t(19, H = g.combine_adjacent), "interactive" in g && t(18, b = g.interactive);
2969
  }, l.$$.update = () => {
2970
  l.$$.dirty & /*color_map*/
2971
  2 && !y && Object.keys(y).length && t(1, y), l.$$.dirty & /*value, combine_adjacent*/
2972
- 524289 && a && H && t(0, a = Ol(a, "equal"));
2973
  }, [
2974
- a,
2975
  y,
2976
  p,
2977
  n,
@@ -2979,7 +2969,7 @@ function yi(l, e, t) {
2979
  s,
2980
  o,
2981
  r,
2982
- _,
2983
  f,
2984
  u,
2985
  c,
@@ -2992,20 +2982,20 @@ function yi(l, e, t) {
2992
  b,
2993
  H,
2994
  R,
2995
- Q,
2996
  E,
2997
- P,
2998
  X,
2999
- be,
3000
  D,
3001
- x,
3002
- z,
3003
- ge
3004
  ];
3005
  }
3006
- class Ci extends _i {
3007
  constructor(e) {
3008
- super(), bi(this, e, yi, pi, wi, {
3009
  gradio: 3,
3010
  label: 4,
3011
  legend_label: 5,
@@ -3158,5 +3148,5 @@ class Ci extends _i {
3158
  }
3159
  }
3160
  export {
3161
- Ci as default
3162
  };
 
1
  const {
2
+ SvelteComponent: ll,
3
+ append: oe,
4
  attr: U,
5
+ create_slot: nl,
6
+ destroy_each: il,
7
+ detach: fe,
8
+ element: ue,
9
+ empty: sl,
10
+ ensure_array_like: tt,
11
+ get_all_dirty_from_scope: ol,
12
+ get_slot_changes: fl,
13
  init: _l,
14
+ insert: _e,
15
+ safe_not_equal: al,
16
+ set_data: Xe,
17
  space: He,
18
+ text: Ye,
19
  toggle_class: V,
20
+ transition_in: rl,
21
+ transition_out: ul,
22
+ update_slot_base: cl
23
  } = window.__gradio__svelte__internal;
24
+ function lt(l, e, t) {
25
  const n = l.slice();
26
  return n[8] = e[t][0], n[9] = e[t][1], n[11] = t, n;
27
  }
28
+ function nt(l) {
29
+ let e, t, n, i, s, o, r = tt(Object.entries(
30
  /*_color_map*/
31
  l[4]
32
+ )), a = [];
33
  for (let f = 0; f < r.length; f += 1)
34
+ a[f] = it(lt(l, r, f));
35
  return {
36
  c() {
37
+ e = ue("span"), e.textContent = "·", t = He(), n = ue("div"), i = ue("span"), s = Ye(
38
  /*legend_label*/
39
  l[3]
40
  ), o = He();
41
+ for (let f = 0; f < a.length; f += 1)
42
+ a[f].c();
43
  U(e, "class", "legend-separator svelte-vm3q5z"), V(e, "hide", !/*show_legend*/
44
  l[1] || !/*show_label*/
45
  l[0]), V(
 
56
  ), U(n, "class", "category-legend svelte-vm3q5z"), U(n, "data-testid", "highlighted-text:category-legend"), V(n, "hide", !/*show_legend*/
57
  l[1]);
58
  },
59
+ m(f, _) {
60
+ _e(f, e, _), _e(f, t, _), _e(f, n, _), oe(n, i), oe(i, s), oe(n, o);
61
+ for (let u = 0; u < a.length; u += 1)
62
+ a[u] && a[u].m(n, null);
63
  },
64
+ p(f, _) {
65
+ if (_ & /*show_legend, show_label*/
66
  3 && V(e, "hide", !/*show_legend*/
67
  f[1] || !/*show_label*/
68
+ f[0]), _ & /*info*/
69
  32 && V(
70
  e,
71
  "has-info",
72
  /*info*/
73
  f[5] != null
74
+ ), _ & /*legend_label*/
75
+ 8 && Xe(
76
  s,
77
  /*legend_label*/
78
  f[3]
79
+ ), _ & /*show_legend_label*/
80
  4 && V(i, "hide", !/*show_legend_label*/
81
+ f[2]), _ & /*info*/
82
  32 && V(
83
  i,
84
  "has-info",
85
  /*info*/
86
  f[5] != null
87
+ ), _ & /*Object, _color_map, info*/
88
  48) {
89
+ r = tt(Object.entries(
90
  /*_color_map*/
91
  f[4]
92
  ));
93
  let u;
94
  for (u = 0; u < r.length; u += 1) {
95
+ const c = lt(f, r, u);
96
+ a[u] ? a[u].p(c, _) : (a[u] = it(c), a[u].c(), a[u].m(n, null));
97
  }
98
+ for (; u < a.length; u += 1)
99
+ a[u].d(1);
100
+ a.length = r.length;
101
  }
102
+ _ & /*show_legend*/
103
  2 && V(n, "hide", !/*show_legend*/
104
  f[1]);
105
  },
106
  d(f) {
107
+ f && (fe(e), fe(t), fe(n)), il(a, f);
108
  }
109
  };
110
  }
111
+ function it(l) {
112
  let e, t = (
113
  /*category*/
114
  l[8] + ""
115
  ), n, i, s;
116
  return {
117
  c() {
118
+ e = ue("div"), n = Ye(t), i = He(), U(e, "class", "category-label svelte-vm3q5z"), U(e, "style", s = "background-color:" + /*color*/
119
  l[9].secondary), V(
120
  e,
121
  "has-info",
 
124
  );
125
  },
126
  m(o, r) {
127
+ _e(o, e, r), oe(e, n), oe(e, i);
128
  },
129
  p(o, r) {
130
  r & /*_color_map*/
131
  16 && t !== (t = /*category*/
132
+ o[8] + "") && Xe(n, t), r & /*_color_map*/
133
  16 && s !== (s = "background-color:" + /*color*/
134
  o[9].secondary) && U(e, "style", s), r & /*info*/
135
  32 && V(
 
140
  );
141
  },
142
  d(o) {
143
+ o && fe(e);
144
  }
145
  };
146
  }
147
+ function st(l) {
148
  let e, t;
149
  return {
150
  c() {
151
+ e = ue("div"), t = Ye(
152
  /*info*/
153
  l[5]
154
  ), U(e, "class", "title-with-highlights-info svelte-vm3q5z");
155
  },
156
  m(n, i) {
157
+ _e(n, e, i), oe(e, t);
158
  },
159
  p(n, i) {
160
  i & /*info*/
161
+ 32 && Xe(
162
  t,
163
  /*info*/
164
  n[5]
165
  );
166
  },
167
  d(n) {
168
+ n && fe(e);
169
  }
170
  };
171
  }
172
+ function dl(l) {
173
  let e, t, n, i = Object.keys(
174
  /*_color_map*/
175
  l[4]
176
  ).length !== 0, s, o, r;
177
+ const a = (
178
  /*#slots*/
179
  l[7].default
180
+ ), f = nl(
181
+ a,
182
  l,
183
  /*$$scope*/
184
  l[6],
185
  null
186
  );
187
+ let _ = i && nt(l), u = (
188
  /*info*/
189
+ l[5] && st(l)
190
  );
191
  return {
192
  c() {
193
+ e = ue("div"), t = ue("span"), f && f.c(), n = He(), _ && _.c(), s = He(), u && u.c(), o = sl(), U(t, "data-testid", "block-info"), U(t, "class", "svelte-vm3q5z"), V(t, "sr-only", !/*show_label*/
194
  l[0]), V(t, "hide", !/*show_label*/
195
  l[0]), V(
196
  t,
 
200
  ), U(e, "class", "title-container svelte-vm3q5z");
201
  },
202
  m(c, m) {
203
+ _e(c, e, m), oe(e, t), f && f.m(t, null), oe(e, n), _ && _.m(e, null), _e(c, s, m), u && u.m(c, m), _e(c, o, m), r = !0;
204
  },
205
  p(c, [m]) {
206
  f && f.p && (!r || m & /*$$scope*/
207
+ 64) && cl(
208
  f,
209
+ a,
210
  c,
211
  /*$$scope*/
212
  c[6],
213
+ r ? fl(
214
+ a,
215
  /*$$scope*/
216
  c[6],
217
  m,
218
  null
219
+ ) : ol(
220
  /*$$scope*/
221
  c[6]
222
  ),
 
235
  16 && (i = Object.keys(
236
  /*_color_map*/
237
  c[4]
238
+ ).length !== 0), i ? _ ? _.p(c, m) : (_ = nt(c), _.c(), _.m(e, null)) : _ && (_.d(1), _ = null), /*info*/
239
+ c[5] ? u ? u.p(c, m) : (u = st(c), u.c(), u.m(o.parentNode, o)) : u && (u.d(1), u = null);
240
  },
241
  i(c) {
242
+ r || (rl(f, c), r = !0);
243
  },
244
  o(c) {
245
+ ul(f, c), r = !1;
246
  },
247
  d(c) {
248
+ c && (fe(e), fe(s), fe(o)), f && f.d(c), _ && _.d(), u && u.d(c);
249
  }
250
  };
251
  }
252
+ function ml(l, e, t) {
253
+ let { $$slots: n = {}, $$scope: i } = e, { show_label: s = !0 } = e, { show_legend: o = !0 } = e, { show_legend_label: r = !0 } = e, { legend_label: a = "Highlights:" } = e, { _color_map: f = {} } = e, { info: _ = void 0 } = e;
254
  return l.$$set = (u) => {
255
+ "show_label" in u && t(0, s = u.show_label), "show_legend" in u && t(1, o = u.show_legend), "show_legend_label" in u && t(2, r = u.show_legend_label), "legend_label" in u && t(3, a = u.legend_label), "_color_map" in u && t(4, f = u._color_map), "info" in u && t(5, _ = u.info), "$$scope" in u && t(6, i = u.$$scope);
256
  }, [
257
  s,
258
  o,
259
  r,
 
 
260
  a,
261
+ f,
262
+ _,
263
  i,
264
  n
265
  ];
266
  }
267
+ class hl extends ll {
268
  constructor(e) {
269
+ super(), _l(this, e, ml, dl, al, {
270
  show_label: 0,
271
  show_legend: 1,
272
  show_legend_label: 2,
 
277
  }
278
  }
279
  const {
280
+ SvelteComponent: bl,
281
+ append: gl,
282
+ attr: le,
283
+ detach: wl,
284
+ init: kl,
285
+ insert: vl,
286
+ noop: Re,
287
+ safe_not_equal: pl,
288
+ svg_element: ot
289
  } = window.__gradio__svelte__internal;
290
+ function yl(l) {
291
  let e, t;
292
  return {
293
  c() {
294
+ e = ot("svg"), t = ot("polyline"), le(t, "points", "20 6 9 17 4 12"), le(e, "xmlns", "http://www.w3.org/2000/svg"), le(e, "viewBox", "2 0 20 20"), le(e, "fill", "none"), le(e, "stroke", "currentColor"), le(e, "stroke-width", "3"), le(e, "stroke-linecap", "round"), le(e, "stroke-linejoin", "round");
295
  },
296
  m(n, i) {
297
+ vl(n, e, i), gl(e, t);
298
  },
299
+ p: Re,
300
+ i: Re,
301
+ o: Re,
302
  d(n) {
303
+ n && wl(e);
304
  }
305
  };
306
  }
307
+ class Cl extends bl {
308
  constructor(e) {
309
+ super(), kl(this, e, null, yl, pl, {});
310
  }
311
  }
312
  const {
313
+ SvelteComponent: ql,
314
+ append: ft,
315
+ attr: ae,
316
+ detach: Tl,
317
+ init: Ll,
318
+ insert: Sl,
319
+ noop: Ae,
320
+ safe_not_equal: Fl,
321
+ svg_element: De
322
  } = window.__gradio__svelte__internal;
323
+ function Hl(l) {
324
  let e, t, n;
325
  return {
326
  c() {
327
+ e = De("svg"), t = De("path"), n = De("path"), ae(t, "fill", "currentColor"), ae(t, "d", "M28 10v18H10V10h18m0-2H10a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2Z"), ae(n, "fill", "currentColor"), ae(n, "d", "M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z"), ae(e, "xmlns", "http://www.w3.org/2000/svg"), ae(e, "viewBox", "0 0 33 33"), ae(e, "color", "currentColor");
328
  },
329
  m(i, s) {
330
+ Sl(i, e, s), ft(e, t), ft(e, n);
331
  },
332
+ p: Ae,
333
+ i: Ae,
334
+ o: Ae,
335
  d(i) {
336
+ i && Tl(e);
337
  }
338
  };
339
  }
340
+ class Ml extends ql {
341
  constructor(e) {
342
+ super(), Ll(this, e, null, Hl, Fl, {});
343
  }
344
  }
345
+ function Ee() {
346
  }
347
+ const jl = (l) => l;
348
+ function Nl(l, e) {
349
  return l != l ? e == e : l !== e || l && typeof l == "object" || typeof l == "function";
350
  }
351
+ const It = typeof window < "u";
352
+ let _t = It ? () => window.performance.now() : () => Date.now(), Wt = It ? (l) => requestAnimationFrame(l) : Ee;
353
+ const Ce = /* @__PURE__ */ new Set();
354
+ function Ut(l) {
355
+ Ce.forEach((e) => {
356
+ e.c(l) || (Ce.delete(e), e.f());
357
+ }), Ce.size !== 0 && Wt(Ut);
358
  }
359
+ function Vl(l) {
360
  let e;
361
+ return Ce.size === 0 && Wt(Ut), {
362
  promise: new Promise((t) => {
363
+ Ce.add(e = { c: l, f: t });
364
  }),
365
  abort() {
366
+ Ce.delete(e);
367
  }
368
  };
369
  }
370
+ function zl(l, { delay: e = 0, duration: t = 400, easing: n = jl } = {}) {
371
  const i = +getComputedStyle(l).opacity;
372
  return {
373
  delay: e,
 
377
  };
378
  }
379
  const ve = [];
380
+ function Bl(l, e = Ee) {
381
  let t;
382
  const n = /* @__PURE__ */ new Set();
383
  function i(r) {
384
+ if (Nl(l, r) && (l = r, t)) {
385
+ const a = !ve.length;
386
  for (const f of n)
387
  f[1](), ve.push(f, l);
388
+ if (a) {
389
  for (let f = 0; f < ve.length; f += 2)
390
  ve[f][0](ve[f + 1]);
391
  ve.length = 0;
 
395
  function s(r) {
396
  i(r(l));
397
  }
398
+ function o(r, a = Ee) {
399
+ const f = [r, a];
400
+ return n.add(f), n.size === 1 && (t = e(i, s) || Ee), r(l), () => {
401
  n.delete(f), n.size === 0 && t && (t(), t = null);
402
  };
403
  }
 
406
  function at(l) {
407
  return Object.prototype.toString.call(l) === "[object Date]";
408
  }
409
+ function We(l, e, t, n) {
410
  if (typeof t == "number" || at(t)) {
411
+ const i = n - t, s = (t - e) / (l.dt || 1 / 60), o = l.opts.stiffness * i, r = l.opts.damping * s, a = (o - r) * l.inv_mass, f = (s + a) * l.dt;
412
  return Math.abs(f) < l.opts.precision && Math.abs(i) < l.opts.precision ? n : (l.settled = !1, at(t) ? new Date(t.getTime() + f) : t + f);
413
  } else {
414
  if (Array.isArray(t))
415
  return t.map(
416
+ (i, s) => We(l, e[s], t[s], n[s])
417
  );
418
  if (typeof t == "object") {
419
  const i = {};
420
  for (const s in t)
421
+ i[s] = We(l, e[s], t[s], n[s]);
422
  return i;
423
  } else
424
  throw new Error(`Cannot spring ${typeof t} values`);
425
  }
426
  }
427
+ function rt(l, e = {}) {
428
  const t = Bl(l), { stiffness: n = 0.15, damping: i = 0.8, precision: s = 0.01 } = e;
429
+ let o, r, a, f = l, _ = l, u = 1, c = 0, m = !1;
430
  function y(T, L = {}) {
431
+ _ = T;
432
+ const C = a = {};
433
+ return l == null || L.hard || S.stiffness >= 1 && S.damping >= 1 ? (m = !0, o = _t(), f = T, t.set(l = _), Promise.resolve()) : (L.soft && (c = 1 / ((L.soft === !0 ? 0.5 : +L.soft) * 60), u = 0), r || (o = _t(), m = !1, r = Vl((d) => {
434
  if (m)
435
  return m = !1, r = null, !1;
436
  u = Math.min(u + c, 1);
 
439
  opts: S,
440
  settled: !0,
441
  dt: (d - o) * 60 / 1e3
442
+ }, H = We(p, f, l, _);
443
  return o = d, f = l, t.set(l = H), p.settled && (r = null), !p.settled;
444
  })), new Promise((d) => {
445
  r.promise.then(() => {
446
+ C === a && d();
447
  });
448
  }));
449
  }
450
  const S = {
451
  set: y,
452
+ update: (T, L) => y(T(_, l), L),
453
  subscribe: t.subscribe,
454
  stiffness: n,
455
  damping: i,
 
457
  };
458
  return S;
459
  }
460
+ const ut = [
461
  "red",
462
  "green",
463
  "blue",
 
479
  { color: "cyan", primary: 600, secondary: 100 },
480
  { color: "lime", primary: 500, secondary: 100 },
481
  { color: "pink", primary: 600, secondary: 100 }
482
+ ], ct = {
483
  inherit: "inherit",
484
  current: "currentColor",
485
  transparent: "transparent",
 
771
  900: "#881337",
772
  950: "#4c0519"
773
  }
774
+ }, dt = El.reduce(
775
  (l, { color: e, primary: t, secondary: n }) => ({
776
  ...l,
777
  [e]: {
778
+ primary: ct[e][t],
779
+ secondary: ct[e][n]
780
  }
781
  }),
782
  {}
783
+ ), Pl = (l) => ut[l % ut.length];
784
+ function mt(l, e, t) {
785
  if (!t) {
786
  var n = document.createElement("canvas");
787
  t = n.getContext("2d");
 
794
  var n = {};
795
  for (const i in l) {
796
  const s = l[i].trim();
797
+ s in dt ? n[i] = dt[s] : n[i] = {
798
+ primary: e ? mt(l[i], 1, t) : l[i],
799
+ secondary: e ? mt(l[i], 0.5, t) : l[i]
800
  };
801
  }
802
  return n;
 
815
  }
816
  return -1;
817
  }
818
+ function Al(l, e) {
819
  var t = document.createTreeWalker(l, NodeFilter.SHOW_TEXT), n = t.nextNode();
820
  if (!n || !n.textContent)
821
  return null;
 
828
  return { node: n, offset: s };
829
  }
830
  const {
831
+ SvelteComponent: Dl,
832
+ add_render_callback: Ge,
833
+ append: ht,
834
  attr: B,
835
+ binding_callbacks: bt,
836
+ bubble: Se,
837
+ check_outros: Xt,
838
+ create_component: Je,
839
+ create_in_transition: Il,
840
+ destroy_component: Ke,
841
+ detach: de,
842
  element: Me,
843
+ empty: Wl,
844
+ group_outros: Yt,
845
+ init: Ul,
846
+ insert: me,
847
+ listen: Y,
848
+ mount_component: Qe,
849
+ noop: Gt,
850
+ run_all: Xl,
851
+ safe_not_equal: Yl,
852
+ set_data: Gl,
853
+ space: gt,
854
+ text: Jl,
855
+ toggle_class: wt,
856
+ transition_in: ie,
857
+ transition_out: ce
858
+ } = window.__gradio__svelte__internal, { beforeUpdate: Kl, afterUpdate: Ql, createEventDispatcher: xl } = window.__gradio__svelte__internal;
859
+ function $l(l) {
860
  let e;
861
  return {
862
  c() {
863
+ e = Jl(
864
  /*label*/
865
  l[0]
866
  );
867
  },
868
  m(t, n) {
869
+ me(t, e, n);
870
  },
871
  p(t, n) {
872
  n[0] & /*label*/
873
+ 1 && Gl(
874
  e,
875
  /*label*/
876
  t[0]
877
  );
878
  },
879
  d(t) {
880
+ t && de(e);
881
  }
882
  };
883
  }
884
+ function kt(l) {
885
  let e, t, n, i;
886
+ const s = [tn, en], o = [];
887
+ function r(a, f) {
888
  return (
889
  /*copied*/
890
+ a[13] ? 0 : 1
891
  );
892
  }
893
  return e = r(l), t = o[e] = s[e](l), {
894
  c() {
895
+ t.c(), n = Wl();
896
  },
897
+ m(a, f) {
898
+ o[e].m(a, f), me(a, n, f), i = !0;
899
  },
900
+ p(a, f) {
901
+ let _ = e;
902
+ e = r(a), e === _ ? o[e].p(a, f) : (Yt(), ce(o[_], 1, 1, () => {
903
+ o[_] = null;
904
+ }), Xt(), t = o[e], t ? t.p(a, f) : (t = o[e] = s[e](a), t.c()), ie(t, 1), t.m(n.parentNode, n));
905
  },
906
+ i(a) {
907
+ i || (ie(t), i = !0);
908
  },
909
+ o(a) {
910
+ ce(t), i = !1;
911
  },
912
+ d(a) {
913
+ a && de(n), o[e].d(a);
914
  }
915
  };
916
  }
917
+ function en(l) {
918
  let e, t, n, i, s;
919
+ return t = new Ml({}), {
920
  c() {
921
+ e = Me("button"), Je(t.$$.fragment), B(e, "aria-label", "Copy"), B(e, "aria-roledescription", "Copy text"), B(e, "class", "svelte-40uavx");
922
  },
923
  m(o, r) {
924
+ me(o, e, r), Qe(t, e, null), n = !0, i || (s = Y(
925
  e,
926
  "click",
927
  /*handle_copy*/
928
+ l[15]
929
  ), i = !0);
930
  },
931
+ p: Gt,
932
  i(o) {
933
+ n || (ie(t.$$.fragment, o), n = !0);
934
  },
935
  o(o) {
936
+ ce(t.$$.fragment, o), n = !1;
937
  },
938
  d(o) {
939
+ o && de(e), Ke(t), i = !1, s();
940
  }
941
  };
942
  }
943
+ function tn(l) {
944
  let e, t, n, i;
945
+ return t = new Cl({}), {
946
  c() {
947
+ e = Me("button"), Je(t.$$.fragment), B(e, "aria-label", "Copied"), B(e, "aria-roledescription", "Text copied"), B(e, "class", "svelte-40uavx");
948
  },
949
  m(s, o) {
950
+ me(s, e, o), Qe(t, e, null), i = !0;
951
  },
952
+ p: Gt,
953
  i(s) {
954
+ i || (ie(t.$$.fragment, s), s && (n || Ge(() => {
955
+ n = Il(e, zl, { duration: 300 }), n.start();
956
  })), i = !0);
957
  },
958
  o(s) {
959
+ ce(t.$$.fragment, s), i = !1;
960
  },
961
  d(s) {
962
+ s && de(e), Ke(t);
963
  }
964
  };
965
  }
966
+ function ln(l) {
967
  let e, t, n;
968
  return {
969
  c() {
970
+ e = Me("div"), B(e, "class", "textfield svelte-40uavx"), B(e, "data-testid", "highlighted-textbox"), B(e, "contenteditable", "true"), /*el_text*/
971
+ (l[10] === void 0 || /*marked_el_text*/
972
+ l[11] === void 0) && Ge(() => (
973
  /*div_input_handler_1*/
974
+ l[27].call(e)
975
  ));
976
  },
977
  m(i, s) {
978
+ me(i, e, s), l[26](e), /*el_text*/
979
+ l[10] !== void 0 && (e.textContent = /*el_text*/
980
+ l[10]), /*marked_el_text*/
981
+ l[11] !== void 0 && (e.innerHTML = /*marked_el_text*/
982
+ l[11]), t || (n = [
983
+ Y(
984
  e,
985
  "input",
986
  /*div_input_handler_1*/
987
+ l[27]
988
  ),
989
+ Y(
990
  e,
991
  "blur",
992
  /*blur_handler*/
993
  l[19]
994
  ),
995
+ Y(
996
  e,
997
  "keypress",
998
  /*keypress_handler*/
999
  l[20]
1000
  ),
1001
+ Y(
1002
  e,
1003
  "select",
1004
  /*select_handler*/
1005
  l[21]
1006
  ),
1007
+ Y(
1008
  e,
1009
  "scroll",
1010
  /*scroll_handler*/
1011
  l[22]
1012
  ),
1013
+ Y(
1014
  e,
1015
  "input",
1016
+ /*handle_change*/
1017
+ l[14]
1018
  ),
1019
+ Y(
1020
  e,
1021
  "focus",
1022
  /*focus_handler*/
1023
+ l[23]
1024
  ),
1025
+ Y(
1026
  e,
1027
  "change",
1028
+ /*handle_change*/
1029
+ l[14]
1030
  )
1031
  ], t = !0);
1032
  },
1033
  p(i, s) {
1034
  s[0] & /*el_text*/
1035
+ 1024 && /*el_text*/
1036
+ i[10] !== e.textContent && (e.textContent = /*el_text*/
1037
+ i[10]), s[0] & /*marked_el_text*/
1038
+ 2048 && /*marked_el_text*/
1039
+ i[11] !== e.innerHTML && (e.innerHTML = /*marked_el_text*/
1040
+ i[11]);
1041
  },
1042
  d(i) {
1043
+ i && de(e), l[26](null), t = !1, Xl(n);
1044
  }
1045
  };
1046
  }
1047
+ function nn(l) {
1048
  let e, t, n;
1049
  return {
1050
  c() {
1051
+ e = Me("div"), B(e, "class", "textfield svelte-40uavx"), B(e, "data-testid", "highlighted-textbox"), B(e, "contenteditable", "false"), /*el_text*/
1052
+ (l[10] === void 0 || /*marked_el_text*/
1053
+ l[11] === void 0) && Ge(() => (
1054
  /*div_input_handler*/
1055
+ l[25].call(e)
1056
  ));
1057
  },
1058
  m(i, s) {
1059
+ me(i, e, s), l[24](e), /*el_text*/
1060
+ l[10] !== void 0 && (e.textContent = /*el_text*/
1061
+ l[10]), /*marked_el_text*/
1062
+ l[11] !== void 0 && (e.innerHTML = /*marked_el_text*/
1063
+ l[11]), t || (n = Y(
1064
  e,
1065
  "input",
1066
  /*div_input_handler*/
1067
+ l[25]
1068
  ), t = !0);
1069
  },
1070
  p(i, s) {
1071
  s[0] & /*el_text*/
1072
+ 1024 && /*el_text*/
1073
+ i[10] !== e.textContent && (e.textContent = /*el_text*/
1074
+ i[10]), s[0] & /*marked_el_text*/
1075
+ 2048 && /*marked_el_text*/
1076
+ i[11] !== e.innerHTML && (e.innerHTML = /*marked_el_text*/
1077
+ i[11]);
1078
  },
1079
  d(i) {
1080
+ i && de(e), l[24](null), t = !1, n();
1081
  }
1082
  };
1083
  }
1084
+ function sn(l) {
1085
  let e, t, n, i, s;
1086
+ t = new hl({
1087
  props: {
1088
  show_label: (
1089
  /*show_label*/
 
1109
  /*info*/
1110
  l[2]
1111
  ),
1112
+ $$slots: { default: [$l] },
1113
  $$scope: { ctx: l }
1114
  }
1115
  });
1116
  let o = (
1117
  /*show_copy_button*/
1118
+ l[7] && kt(l)
1119
  );
1120
+ function r(_, u) {
1121
  return (
1122
  /*disabled*/
1123
+ _[8] ? nn : ln
1124
  );
1125
  }
1126
+ let a = r(l), f = a(l);
1127
  return {
1128
  c() {
1129
+ e = Me("label"), Je(t.$$.fragment), n = gt(), o && o.c(), i = gt(), f.c(), B(e, "class", "svelte-40uavx"), wt(
1130
  e,
1131
  "container",
1132
  /*container*/
1133
  l[6]
1134
  );
1135
  },
1136
+ m(_, u) {
1137
+ me(_, e, u), Qe(t, e, null), ht(e, n), o && o.m(e, null), ht(e, i), f.m(e, null), s = !0;
1138
  },
1139
+ p(_, u) {
1140
  const c = {};
1141
  u[0] & /*show_label*/
1142
  8 && (c.show_label = /*show_label*/
1143
+ _[3]), u[0] & /*show_legend*/
1144
  16 && (c.show_legend = /*show_legend*/
1145
+ _[4]), u[0] & /*show_legend_label*/
1146
  32 && (c.show_legend_label = /*show_legend_label*/
1147
+ _[5]), u[0] & /*legend_label*/
1148
  2 && (c.legend_label = /*legend_label*/
1149
+ _[1]), u[0] & /*_color_map*/
1150
  4096 && (c._color_map = /*_color_map*/
1151
+ _[12]), u[0] & /*info*/
1152
  4 && (c.info = /*info*/
1153
+ _[2]), u[0] & /*label*/
1154
  1 | u[1] & /*$$scope*/
1155
+ 256 && (c.$$scope = { dirty: u, ctx: _ }), t.$set(c), /*show_copy_button*/
1156
+ _[7] ? o ? (o.p(_, u), u[0] & /*show_copy_button*/
1157
+ 128 && ie(o, 1)) : (o = kt(_), o.c(), ie(o, 1), o.m(e, i)) : o && (Yt(), ce(o, 1, 1, () => {
1158
  o = null;
1159
+ }), Xt()), a === (a = r(_)) && f ? f.p(_, u) : (f.d(1), f = a(_), f && (f.c(), f.m(e, null))), (!s || u[0] & /*container*/
1160
+ 64) && wt(
1161
  e,
1162
  "container",
1163
  /*container*/
1164
+ _[6]
1165
  );
1166
  },
1167
+ i(_) {
1168
+ s || (ie(t.$$.fragment, _), ie(o), s = !0);
1169
  },
1170
+ o(_) {
1171
+ ce(t.$$.fragment, _), ce(o), s = !1;
1172
  },
1173
+ d(_) {
1174
+ _ && de(e), Ke(t), o && o.d(), f.d();
1175
  }
1176
  };
1177
  }
1178
+ function on(l, e, t) {
 
 
 
 
 
 
 
 
 
 
1179
  const n = typeof document < "u";
1180
+ let { value: i = [] } = e, { value_is_output: s = !1 } = e, { label: o } = e, { legend_label: r } = e, { info: a = void 0 } = e, { show_label: f = !0 } = e, { show_legend: _ = !1 } = e, { show_legend_label: u = !1 } = e, { container: c = !0 } = e, { color_map: m = {} } = e, { show_copy_button: y = !1 } = e, { disabled: S } = e, T, L = "", C = "", d, p = !m || Object.keys(m).length === 0 ? {} : m, H = {}, b = !1, R;
1181
+ function K() {
1182
  for (let h in p)
1183
  i.map(([N, j]) => j).includes(h) || delete p[h];
1184
  if (i.length > 0) {
 
1191
  t(12, H = Zl(p, n, d));
1192
  }
1193
  function E(h) {
1194
+ i.length > 0 && h && (t(10, L = i.map(([N, j]) => N).join("")), t(11, C = i.map(([N, j]) => j !== null ? `<mark class="hl ${j}" style="background-color:${H[j].secondary}">${N}</mark>` : N).join("")));
1195
  }
1196
+ const A = xl();
1197
+ Kl(() => {
1198
  T && T.offsetHeight + T.scrollTop > T.scrollHeight - 100;
1199
  });
1200
  function X() {
1201
+ P(), he(), A("change", i), s || A("input", i);
1202
  }
1203
+ Ql(() => {
1204
+ K(), E(s), t(17, s = !1);
1205
  });
1206
+ function he() {
1207
+ let h = [], N = "", j = null, ee = !1, we = "", ke = C.replace(/&nbsp;|&amp;|&lt;|&gt;/g, function(te) {
1208
+ return {
1209
+ "&nbsp;": " ",
1210
+ "&amp;": "&",
1211
+ "&lt;": "<",
1212
+ "&gt;": ">"
1213
+ }[te];
1214
+ });
1215
+ for (let te = 0; te < ke.length; te++) {
1216
+ let x = ke[te];
1217
+ if (x === "<")
1218
+ ee = !0, N && h.push([N, j]), N = "", j = null;
1219
+ else if (x === ">") {
1220
+ if (ee = !1, we.slice(0, 4) === "mark") {
1221
+ let Ve = /class="hl ([^"]+)"/.exec(we);
1222
+ j = Ve ? Ve[1] : null;
1223
+ }
1224
+ we = "";
1225
+ } else
1226
+ ee ? we += x : N += x;
1227
  }
1228
  N && h.push([N, j]), t(16, i = h);
1229
  }
1230
  async function D() {
1231
+ "clipboard" in navigator && (await navigator.clipboard.writeText(L), Q());
1232
  }
1233
+ function Q() {
1234
  t(13, b = !0), R && clearTimeout(R), R = setTimeout(
1235
  () => {
1236
  t(13, b = !1);
 
1238
  1e3
1239
  );
1240
  }
1241
+ function P() {
1242
  const h = window.getSelection(), N = h.anchorOffset;
1243
  if (h.rangeCount > 0) {
1244
  var j = h.getRangeAt(0).commonAncestorContainer.parentElement;
1245
  if (j && j.tagName.toLowerCase() === "mark") {
1246
+ const Ve = j.textContent;
1247
+ var ee = j.parentElement, we = document.createTextNode(Ve);
1248
+ ee.replaceChild(we, j), t(11, C = ee.innerHTML);
1249
+ var ke = document.createRange(), te = window.getSelection();
1250
+ const tl = N + Rl(ee);
1251
+ var x = Al(ee, tl);
1252
+ ke.setStart(x.node, x.offset), ke.setEnd(x.node, x.offset), te.removeAllRanges(), te.addRange(ke);
1253
  }
1254
  }
 
1255
  }
1256
+ function be(h) {
1257
+ Se.call(this, l, h);
1258
  }
1259
  function g(h) {
1260
+ Se.call(this, l, h);
1261
  }
1262
  function je(h) {
1263
+ Se.call(this, l, h);
1264
  }
1265
  function Ne(h) {
1266
+ Se.call(this, l, h);
1267
  }
1268
+ function ge(h) {
1269
+ Se.call(this, l, h);
 
 
 
1270
  }
1271
+ function Ze(h) {
1272
+ bt[h ? "unshift" : "push"](() => {
1273
+ T = h, t(9, T);
1274
  });
1275
  }
1276
+ function Oe() {
1277
+ L = this.textContent, C = this.innerHTML, t(10, L), t(11, C);
1278
  }
1279
+ function w(h) {
1280
+ bt[h ? "unshift" : "push"](() => {
1281
+ T = h, t(9, T);
1282
  });
1283
  }
1284
  function el() {
1285
+ L = this.textContent, C = this.innerHTML, t(10, L), t(11, C);
1286
  }
1287
  return l.$$set = (h) => {
1288
+ "value" in h && t(16, i = h.value), "value_is_output" in h && t(17, s = h.value_is_output), "label" in h && t(0, o = h.label), "legend_label" in h && t(1, r = h.legend_label), "info" in h && t(2, a = h.info), "show_label" in h && t(3, f = h.show_label), "show_legend" in h && t(4, _ = h.show_legend), "show_legend_label" in h && t(5, u = h.show_legend_label), "container" in h && t(6, c = h.container), "color_map" in h && t(18, m = h.color_map), "show_copy_button" in h && t(7, y = h.show_copy_button), "disabled" in h && t(8, S = h.disabled);
1289
+ }, K(), E(!0), [
 
 
 
1290
  o,
1291
  r,
 
 
1292
  a,
1293
+ f,
1294
+ _,
1295
  u,
1296
  c,
1297
  y,
1298
  S,
 
1299
  T,
1300
  L,
1301
+ C,
1302
  H,
1303
  b,
1304
+ X,
1305
  D,
 
1306
  i,
1307
  s,
1308
  m,
1309
+ be,
1310
  g,
1311
  je,
1312
  Ne,
1313
+ ge,
1314
+ Ze,
1315
+ Oe,
1316
  w,
 
1317
  el
1318
  ];
1319
  }
1320
+ class fn extends Dl {
1321
  constructor(e) {
1322
+ super(), Ul(
1323
  this,
1324
  e,
 
1325
  on,
1326
+ sn,
1327
+ Yl,
1328
  {
1329
  value: 16,
1330
  value_is_output: 17,
 
1345
  }
1346
  }
1347
  const {
1348
+ SvelteComponent: _n,
1349
+ assign: an,
1350
+ create_slot: rn,
1351
+ detach: un,
1352
+ element: cn,
1353
+ get_all_dirty_from_scope: dn,
1354
+ get_slot_changes: mn,
1355
+ get_spread_update: hn,
1356
+ init: bn,
1357
+ insert: gn,
1358
+ safe_not_equal: wn,
1359
+ set_dynamic_element_data: vt,
1360
+ set_style: z,
1361
+ toggle_class: ne,
1362
+ transition_in: Jt,
1363
+ transition_out: Kt,
1364
+ update_slot_base: kn
1365
  } = window.__gradio__svelte__internal;
1366
+ function vn(l) {
1367
  let e, t, n;
1368
  const i = (
1369
  /*#slots*/
1370
  l[18].default
1371
+ ), s = rn(
1372
  i,
1373
  l,
1374
  /*$$scope*/
 
1389
  l[3].join(" ") + " svelte-1t38q2d"
1390
  }
1391
  ], r = {};
1392
+ for (let a = 0; a < o.length; a += 1)
1393
+ r = an(r, o[a]);
1394
  return {
1395
  c() {
1396
+ e = cn(
1397
  /*tag*/
1398
  l[14]
1399
+ ), s && s.c(), vt(
1400
  /*tag*/
1401
  l[14]
1402
+ )(e, r), ne(
1403
  e,
1404
  "hidden",
1405
  /*visible*/
1406
  l[10] === !1
1407
+ ), ne(
1408
  e,
1409
  "padded",
1410
  /*padding*/
1411
  l[6]
1412
+ ), ne(
1413
  e,
1414
  "border_focus",
1415
  /*border_mode*/
1416
  l[5] === "focus"
1417
+ ), ne(e, "hide-container", !/*explicit_call*/
1418
  l[8] && !/*container*/
1419
+ l[9]), z(
1420
  e,
1421
  "height",
1422
  /*get_dimension*/
 
1424
  /*height*/
1425
  l[0]
1426
  )
1427
+ ), z(e, "width", typeof /*width*/
1428
  l[1] == "number" ? `calc(min(${/*width*/
1429
  l[1]}px, 100%))` : (
1430
  /*get_dimension*/
 
1432
  /*width*/
1433
  l[1]
1434
  )
1435
+ )), z(
1436
  e,
1437
  "border-style",
1438
  /*variant*/
1439
  l[4]
1440
+ ), z(
1441
  e,
1442
  "overflow",
1443
  /*allow_overflow*/
1444
  l[11] ? "visible" : "hidden"
1445
+ ), z(
1446
  e,
1447
  "flex-grow",
1448
  /*scale*/
1449
  l[12]
1450
+ ), z(e, "min-width", `calc(min(${/*min_width*/
1451
+ l[13]}px, 100%))`), z(e, "border-width", "var(--block-border-width)");
1452
  },
1453
+ m(a, f) {
1454
+ gn(a, e, f), s && s.m(e, null), n = !0;
1455
  },
1456
+ p(a, f) {
1457
  s && s.p && (!n || f & /*$$scope*/
1458
+ 131072) && kn(
1459
  s,
1460
  i,
1461
+ a,
1462
  /*$$scope*/
1463
+ a[17],
1464
+ n ? mn(
1465
  i,
1466
  /*$$scope*/
1467
+ a[17],
1468
  f,
1469
  null
1470
+ ) : dn(
1471
  /*$$scope*/
1472
+ a[17]
1473
  ),
1474
  null
1475
+ ), vt(
1476
  /*tag*/
1477
+ a[14]
1478
+ )(e, r = hn(o, [
1479
  (!n || f & /*test_id*/
1480
  128) && { "data-testid": (
1481
  /*test_id*/
1482
+ a[7]
1483
  ) },
1484
  (!n || f & /*elem_id*/
1485
  4) && { id: (
1486
  /*elem_id*/
1487
+ a[2]
1488
  ) },
1489
  (!n || f & /*elem_classes*/
1490
  8 && t !== (t = "block " + /*elem_classes*/
1491
+ a[3].join(" ") + " svelte-1t38q2d")) && { class: t }
1492
+ ])), ne(
1493
  e,
1494
  "hidden",
1495
  /*visible*/
1496
+ a[10] === !1
1497
+ ), ne(
1498
  e,
1499
  "padded",
1500
  /*padding*/
1501
+ a[6]
1502
+ ), ne(
1503
  e,
1504
  "border_focus",
1505
  /*border_mode*/
1506
+ a[5] === "focus"
1507
+ ), ne(e, "hide-container", !/*explicit_call*/
1508
+ a[8] && !/*container*/
1509
+ a[9]), f & /*height*/
1510
+ 1 && z(
1511
  e,
1512
  "height",
1513
  /*get_dimension*/
1514
+ a[15](
1515
  /*height*/
1516
+ a[0]
1517
  )
1518
  ), f & /*width*/
1519
+ 2 && z(e, "width", typeof /*width*/
1520
+ a[1] == "number" ? `calc(min(${/*width*/
1521
+ a[1]}px, 100%))` : (
1522
  /*get_dimension*/
1523
+ a[15](
1524
  /*width*/
1525
+ a[1]
1526
  )
1527
  )), f & /*variant*/
1528
+ 16 && z(
1529
  e,
1530
  "border-style",
1531
  /*variant*/
1532
+ a[4]
1533
  ), f & /*allow_overflow*/
1534
+ 2048 && z(
1535
  e,
1536
  "overflow",
1537
  /*allow_overflow*/
1538
+ a[11] ? "visible" : "hidden"
1539
  ), f & /*scale*/
1540
+ 4096 && z(
1541
  e,
1542
  "flex-grow",
1543
  /*scale*/
1544
+ a[12]
1545
  ), f & /*min_width*/
1546
+ 8192 && z(e, "min-width", `calc(min(${/*min_width*/
1547
+ a[13]}px, 100%))`);
1548
  },
1549
+ i(a) {
1550
+ n || (Jt(s, a), n = !0);
1551
  },
1552
+ o(a) {
1553
+ Kt(s, a), n = !1;
1554
  },
1555
+ d(a) {
1556
+ a && un(e), s && s.d(a);
1557
  }
1558
  };
1559
  }
1560
+ function pn(l) {
1561
  let e, t = (
1562
  /*tag*/
1563
+ l[14] && vn(l)
1564
  );
1565
  return {
1566
  c() {
 
1574
  n[14] && t.p(n, i);
1575
  },
1576
  i(n) {
1577
+ e || (Jt(t, n), e = !0);
1578
  },
1579
  o(n) {
1580
+ Kt(t, n), e = !1;
1581
  },
1582
  d(n) {
1583
  t && t.d(n);
1584
  }
1585
  };
1586
  }
1587
+ function yn(l, e, t) {
1588
+ let { $$slots: n = {}, $$scope: i } = e, { height: s = void 0 } = e, { width: o = void 0 } = e, { elem_id: r = "" } = e, { elem_classes: a = [] } = e, { variant: f = "solid" } = e, { border_mode: _ = "base" } = e, { padding: u = !0 } = e, { type: c = "normal" } = e, { test_id: m = void 0 } = e, { explicit_call: y = !1 } = e, { container: S = !0 } = e, { visible: T = !0 } = e, { allow_overflow: L = !0 } = e, { scale: C = null } = e, { min_width: d = 0 } = e, p = c === "fieldset" ? "fieldset" : "div";
1589
  const H = (b) => {
1590
  if (b !== void 0) {
1591
  if (typeof b == "number")
 
1595
  }
1596
  };
1597
  return l.$$set = (b) => {
1598
+ "height" in b && t(0, s = b.height), "width" in b && t(1, o = b.width), "elem_id" in b && t(2, r = b.elem_id), "elem_classes" in b && t(3, a = b.elem_classes), "variant" in b && t(4, f = b.variant), "border_mode" in b && t(5, _ = b.border_mode), "padding" in b && t(6, u = b.padding), "type" in b && t(16, c = b.type), "test_id" in b && t(7, m = b.test_id), "explicit_call" in b && t(8, y = b.explicit_call), "container" in b && t(9, S = b.container), "visible" in b && t(10, T = b.visible), "allow_overflow" in b && t(11, L = b.allow_overflow), "scale" in b && t(12, C = b.scale), "min_width" in b && t(13, d = b.min_width), "$$scope" in b && t(17, i = b.$$scope);
1599
  }, [
1600
  s,
1601
  o,
1602
  r,
 
 
1603
  a,
1604
+ f,
1605
+ _,
1606
  u,
1607
  m,
1608
  y,
 
1618
  n
1619
  ];
1620
  }
1621
+ class Cn extends _n {
1622
  constructor(e) {
1623
+ super(), bn(this, e, yn, pn, wn, {
1624
  height: 0,
1625
  width: 1,
1626
  elem_id: 2,
 
1639
  });
1640
  }
1641
  }
1642
+ function pe(l) {
1643
  let e = ["", "k", "M", "G", "T", "P", "E", "Z"], t = 0;
1644
  for (; l > 1e3 && t < e.length - 1; )
1645
  l /= 1e3, t++;
 
1647
  return (Number.isInteger(l) ? l : l.toFixed(1)) + n;
1648
  }
1649
  const {
1650
+ SvelteComponent: qn,
1651
  append: I,
1652
  attr: q,
1653
+ component_subscribe: pt,
1654
+ detach: Tn,
1655
+ element: Ln,
1656
+ init: Sn,
1657
+ insert: Fn,
1658
+ noop: yt,
1659
+ safe_not_equal: Hn,
1660
+ set_style: ze,
1661
  svg_element: W,
1662
+ toggle_class: Ct
1663
+ } = window.__gradio__svelte__internal, { onMount: Mn } = window.__gradio__svelte__internal;
1664
+ function jn(l) {
1665
+ let e, t, n, i, s, o, r, a, f, _, u, c;
1666
  return {
1667
  c() {
1668
+ e = Ln("div"), t = W("svg"), n = W("g"), i = W("path"), s = W("path"), o = W("path"), r = W("path"), a = W("g"), f = W("path"), _ = W("path"), u = W("path"), c = W("path"), q(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), q(i, "fill", "#FF7C00"), q(i, "fill-opacity", "0.4"), q(i, "class", "svelte-43sxxs"), q(s, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), q(s, "fill", "#FF7C00"), q(s, "class", "svelte-43sxxs"), q(o, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), q(o, "fill", "#FF7C00"), q(o, "fill-opacity", "0.4"), q(o, "class", "svelte-43sxxs"), q(r, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), q(r, "fill", "#FF7C00"), q(r, "class", "svelte-43sxxs"), ze(n, "transform", "translate(" + /*$top*/
1669
  l[1][0] + "px, " + /*$top*/
1670
+ l[1][1] + "px)"), q(f, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), q(f, "fill", "#FF7C00"), q(f, "fill-opacity", "0.4"), q(f, "class", "svelte-43sxxs"), q(_, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), q(_, "fill", "#FF7C00"), q(_, "class", "svelte-43sxxs"), q(u, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), q(u, "fill", "#FF7C00"), q(u, "fill-opacity", "0.4"), q(u, "class", "svelte-43sxxs"), q(c, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), q(c, "fill", "#FF7C00"), q(c, "class", "svelte-43sxxs"), ze(a, "transform", "translate(" + /*$bottom*/
1671
  l[2][0] + "px, " + /*$bottom*/
1672
+ l[2][1] + "px)"), q(t, "viewBox", "-1200 -1200 3000 3000"), q(t, "fill", "none"), q(t, "xmlns", "http://www.w3.org/2000/svg"), q(t, "class", "svelte-43sxxs"), q(e, "class", "svelte-43sxxs"), Ct(
1673
  e,
1674
  "margin",
1675
  /*margin*/
 
1677
  );
1678
  },
1679
  m(m, y) {
1680
+ Fn(m, e, y), I(e, t), I(t, n), I(n, i), I(n, s), I(n, o), I(n, r), I(t, a), I(a, f), I(a, _), I(a, u), I(a, c);
1681
  },
1682
  p(m, [y]) {
1683
  y & /*$top*/
1684
+ 2 && ze(n, "transform", "translate(" + /*$top*/
1685
  m[1][0] + "px, " + /*$top*/
1686
  m[1][1] + "px)"), y & /*$bottom*/
1687
+ 4 && ze(a, "transform", "translate(" + /*$bottom*/
1688
  m[2][0] + "px, " + /*$bottom*/
1689
  m[2][1] + "px)"), y & /*margin*/
1690
+ 1 && Ct(
1691
  e,
1692
  "margin",
1693
  /*margin*/
1694
  m[0]
1695
  );
1696
  },
1697
+ i: yt,
1698
+ o: yt,
1699
  d(m) {
1700
+ m && Tn(e);
1701
  }
1702
  };
1703
  }
1704
+ function Nn(l, e, t) {
1705
  let n, i, { margin: s = !0 } = e;
1706
+ const o = rt([0, 0]);
1707
+ pt(l, o, (c) => t(1, n = c));
1708
+ const r = rt([0, 0]);
1709
+ pt(l, r, (c) => t(2, i = c));
1710
+ let a;
1711
  async function f() {
1712
  await Promise.all([o.set([125, 140]), r.set([-125, -140])]), await Promise.all([o.set([-125, 140]), r.set([125, -140])]), await Promise.all([o.set([-125, 0]), r.set([125, -0])]), await Promise.all([o.set([125, 0]), r.set([-125, 0])]);
1713
  }
1714
+ async function _() {
1715
+ await f(), a || _();
1716
  }
1717
  async function u() {
1718
+ await Promise.all([o.set([125, 0]), r.set([-125, 0])]), _();
1719
  }
1720
+ return Mn(() => (u(), () => a = !0)), l.$$set = (c) => {
1721
  "margin" in c && t(0, s = c.margin);
1722
  }, [s, n, i, o, r];
1723
  }
1724
+ class Vn extends qn {
1725
  constructor(e) {
1726
+ super(), Sn(this, e, Nn, jn, Hn, { margin: 0 });
1727
  }
1728
  }
1729
  const {
1730
+ SvelteComponent: zn,
1731
+ append: re,
1732
+ attr: G,
1733
+ binding_callbacks: qt,
1734
+ check_outros: Qt,
1735
+ create_component: Bn,
1736
+ create_slot: En,
1737
+ destroy_component: Pn,
1738
+ destroy_each: xt,
1739
  detach: k,
1740
  element: $,
1741
+ empty: Le,
1742
+ ensure_array_like: Pe,
1743
+ get_all_dirty_from_scope: Zn,
1744
+ get_slot_changes: On,
1745
+ group_outros: $t,
1746
+ init: Rn,
1747
  insert: v,
1748
+ mount_component: An,
1749
+ noop: Ue,
1750
+ safe_not_equal: Dn,
1751
  set_data: O,
1752
+ set_style: se,
1753
+ space: J,
1754
  text: F,
1755
  toggle_class: Z,
1756
+ transition_in: qe,
1757
+ transition_out: Te,
1758
+ update_slot_base: In
1759
+ } = window.__gradio__svelte__internal, { tick: Wn } = window.__gradio__svelte__internal, { onDestroy: Un } = window.__gradio__svelte__internal, Xn = (l) => ({}), Tt = (l) => ({});
1760
+ function Lt(l, e, t) {
1761
  const n = l.slice();
1762
  return n[38] = e[t], n[40] = t, n;
1763
  }
1764
+ function St(l, e, t) {
1765
  const n = l.slice();
1766
  return n[38] = e[t], n;
1767
  }
1768
+ function Yn(l) {
1769
  let e, t = (
1770
  /*i18n*/
1771
  l[1]("common.error") + ""
 
1773
  const o = (
1774
  /*#slots*/
1775
  l[29].error
1776
+ ), r = En(
1777
  o,
1778
  l,
1779
  /*$$scope*/
1780
  l[28],
1781
+ Tt
1782
  );
1783
  return {
1784
  c() {
1785
+ e = $("span"), n = F(t), i = J(), r && r.c(), G(e, "class", "error svelte-1txqlrd");
1786
  },
1787
+ m(a, f) {
1788
+ v(a, e, f), re(e, n), v(a, i, f), r && r.m(a, f), s = !0;
1789
  },
1790
+ p(a, f) {
1791
  (!s || f[0] & /*i18n*/
1792
  2) && t !== (t = /*i18n*/
1793
+ a[1]("common.error") + "") && O(n, t), r && r.p && (!s || f[0] & /*$$scope*/
1794
+ 268435456) && In(
1795
  r,
1796
  o,
1797
+ a,
1798
  /*$$scope*/
1799
+ a[28],
1800
+ s ? On(
1801
  o,
1802
  /*$$scope*/
1803
+ a[28],
1804
  f,
1805
+ Xn
1806
+ ) : Zn(
1807
  /*$$scope*/
1808
+ a[28]
1809
  ),
1810
+ Tt
1811
  );
1812
  },
1813
+ i(a) {
1814
+ s || (qe(r, a), s = !0);
1815
  },
1816
+ o(a) {
1817
+ Te(r, a), s = !1;
1818
  },
1819
+ d(a) {
1820
+ a && (k(e), k(i)), r && r.d(a);
1821
  }
1822
  };
1823
  }
1824
+ function Gn(l) {
1825
+ let e, t, n, i, s, o, r, a, f, _ = (
1826
  /*variant*/
1827
  l[8] === "default" && /*show_eta_bar*/
1828
  l[18] && /*show_progress*/
1829
+ l[6] === "full" && Ft(l)
1830
  );
1831
  function u(d, p) {
1832
  if (
1833
  /*progress*/
1834
  d[7]
1835
  )
1836
+ return Qn;
1837
  if (
1838
  /*queue_position*/
1839
  d[2] !== null && /*queue_size*/
1840
  d[3] !== void 0 && /*queue_position*/
1841
  d[2] >= 0
1842
  )
1843
+ return Kn;
1844
  if (
1845
  /*queue_position*/
1846
  d[2] === 0
1847
  )
1848
+ return Jn;
1849
  }
1850
  let c = u(l), m = c && c(l), y = (
1851
  /*timer*/
1852
+ l[5] && jt(l)
1853
  );
1854
+ const S = [ti, ei], T = [];
1855
  function L(d, p) {
1856
  return (
1857
  /*last_progress_level*/
 
1863
  }
1864
  ~(s = L(l)) && (o = T[s] = S[s](l));
1865
  let C = !/*timer*/
1866
+ l[5] && Zt(l);
1867
  return {
1868
  c() {
1869
+ _ && _.c(), e = J(), t = $("div"), m && m.c(), n = J(), y && y.c(), i = J(), o && o.c(), r = J(), C && C.c(), a = Le(), G(t, "class", "progress-text svelte-1txqlrd"), Z(
1870
  t,
1871
  "meta-text-center",
1872
  /*variant*/
 
1879
  );
1880
  },
1881
  m(d, p) {
1882
+ _ && _.m(d, p), v(d, e, p), v(d, t, p), m && m.m(t, null), re(t, n), y && y.m(t, null), v(d, i, p), ~s && T[s].m(d, p), v(d, r, p), C && C.m(d, p), v(d, a, p), f = !0;
1883
  },
1884
  p(d, p) {
1885
  /*variant*/
1886
  d[8] === "default" && /*show_eta_bar*/
1887
  d[18] && /*show_progress*/
1888
+ d[6] === "full" ? _ ? _.p(d, p) : (_ = Ft(d), _.c(), _.m(e.parentNode, e)) : _ && (_.d(1), _ = null), c === (c = u(d)) && m ? m.p(d, p) : (m && m.d(1), m = c && c(d), m && (m.c(), m.m(t, n))), /*timer*/
1889
+ d[5] ? y ? y.p(d, p) : (y = jt(d), y.c(), y.m(t, null)) : y && (y.d(1), y = null), (!f || p[0] & /*variant*/
1890
  256) && Z(
1891
  t,
1892
  "meta-text-center",
 
1900
  d[8] === "default"
1901
  );
1902
  let H = s;
1903
+ s = L(d), s === H ? ~s && T[s].p(d, p) : (o && ($t(), Te(T[H], 1, 1, () => {
1904
  T[H] = null;
1905
+ }), Qt()), ~s ? (o = T[s], o ? o.p(d, p) : (o = T[s] = S[s](d), o.c()), qe(o, 1), o.m(r.parentNode, r)) : o = null), /*timer*/
1906
+ d[5] ? C && (C.d(1), C = null) : C ? C.p(d, p) : (C = Zt(d), C.c(), C.m(a.parentNode, a));
1907
  },
1908
  i(d) {
1909
+ f || (qe(o), f = !0);
1910
  },
1911
  o(d) {
1912
+ Te(o), f = !1;
1913
  },
1914
  d(d) {
1915
+ d && (k(e), k(t), k(i), k(r), k(a)), _ && _.d(d), m && m.d(), y && y.d(), ~s && T[s].d(d), C && C.d(d);
1916
  }
1917
  };
1918
  }
1919
+ function Ft(l) {
1920
  let e, t = `translateX(${/*eta_level*/
1921
  (l[17] || 0) * 100 - 100}%)`;
1922
  return {
1923
  c() {
1924
+ e = $("div"), G(e, "class", "eta-bar svelte-1txqlrd"), se(e, "transform", t);
1925
  },
1926
  m(n, i) {
1927
  v(n, e, i);
 
1929
  p(n, i) {
1930
  i[0] & /*eta_level*/
1931
  131072 && t !== (t = `translateX(${/*eta_level*/
1932
+ (n[17] || 0) * 100 - 100}%)`) && se(e, "transform", t);
1933
  },
1934
  d(n) {
1935
  n && k(e);
1936
  }
1937
  };
1938
  }
1939
+ function Jn(l) {
1940
  let e;
1941
  return {
1942
  c() {
 
1945
  m(t, n) {
1946
  v(t, e, n);
1947
  },
1948
+ p: Ue,
1949
  d(t) {
1950
  t && k(e);
1951
  }
1952
  };
1953
  }
1954
+ function Kn(l) {
1955
  let e, t = (
1956
  /*queue_position*/
1957
  l[2] + 1 + ""
 
1963
  l[3]
1964
  ), o = F(" |");
1965
  },
1966
+ m(r, a) {
1967
+ v(r, e, a), v(r, n, a), v(r, i, a), v(r, s, a), v(r, o, a);
1968
  },
1969
+ p(r, a) {
1970
+ a[0] & /*queue_position*/
1971
  4 && t !== (t = /*queue_position*/
1972
+ r[2] + 1 + "") && O(n, t), a[0] & /*queue_size*/
1973
  8 && O(
1974
  s,
1975
  /*queue_size*/
 
1981
  }
1982
  };
1983
  }
1984
+ function Qn(l) {
1985
+ let e, t = Pe(
1986
  /*progress*/
1987
  l[7]
1988
  ), n = [];
1989
  for (let i = 0; i < t.length; i += 1)
1990
+ n[i] = Mt(St(l, t, i));
1991
  return {
1992
  c() {
1993
  for (let i = 0; i < n.length; i += 1)
1994
  n[i].c();
1995
+ e = Le();
1996
  },
1997
  m(i, s) {
1998
  for (let o = 0; o < n.length; o += 1)
 
2002
  p(i, s) {
2003
  if (s[0] & /*progress*/
2004
  128) {
2005
+ t = Pe(
2006
  /*progress*/
2007
  i[7]
2008
  );
2009
  let o;
2010
  for (o = 0; o < t.length; o += 1) {
2011
+ const r = St(i, t, o);
2012
+ n[o] ? n[o].p(r, s) : (n[o] = Mt(r), n[o].c(), n[o].m(e.parentNode, e));
2013
  }
2014
  for (; o < n.length; o += 1)
2015
  n[o].d(1);
 
2017
  }
2018
  },
2019
  d(i) {
2020
+ i && k(e), xt(n, i);
2021
  }
2022
  };
2023
  }
2024
+ function Ht(l) {
2025
  let e, t = (
2026
  /*p*/
2027
  l[38].unit + ""
2028
  ), n, i, s = " ", o;
2029
+ function r(_, u) {
2030
  return (
2031
  /*p*/
2032
+ _[38].length != null ? $n : xn
2033
  );
2034
  }
2035
+ let a = r(l), f = a(l);
2036
  return {
2037
  c() {
2038
+ f.c(), e = J(), n = F(t), i = F(" | "), o = F(s);
2039
  },
2040
+ m(_, u) {
2041
+ f.m(_, u), v(_, e, u), v(_, n, u), v(_, i, u), v(_, o, u);
2042
  },
2043
+ p(_, u) {
2044
+ a === (a = r(_)) && f ? f.p(_, u) : (f.d(1), f = a(_), f && (f.c(), f.m(e.parentNode, e))), u[0] & /*progress*/
2045
  128 && t !== (t = /*p*/
2046
+ _[38].unit + "") && O(n, t);
2047
  },
2048
+ d(_) {
2049
+ _ && (k(e), k(n), k(i), k(o)), f.d(_);
2050
  }
2051
  };
2052
  }
2053
+ function xn(l) {
2054
+ let e = pe(
2055
  /*p*/
2056
  l[38].index || 0
2057
  ) + "", t;
 
2064
  },
2065
  p(n, i) {
2066
  i[0] & /*progress*/
2067
+ 128 && e !== (e = pe(
2068
  /*p*/
2069
  n[38].index || 0
2070
  ) + "") && O(t, e);
 
2074
  }
2075
  };
2076
  }
2077
+ function $n(l) {
2078
+ let e = pe(
2079
  /*p*/
2080
  l[38].index || 0
2081
+ ) + "", t, n, i = pe(
2082
  /*p*/
2083
  l[38].length
2084
  ) + "", s;
 
2091
  },
2092
  p(o, r) {
2093
  r[0] & /*progress*/
2094
+ 128 && e !== (e = pe(
2095
  /*p*/
2096
  o[38].index || 0
2097
  ) + "") && O(t, e), r[0] & /*progress*/
2098
+ 128 && i !== (i = pe(
2099
  /*p*/
2100
  o[38].length
2101
  ) + "") && O(s, i);
 
2105
  }
2106
  };
2107
  }
2108
+ function Mt(l) {
2109
  let e, t = (
2110
  /*p*/
2111
+ l[38].index != null && Ht(l)
2112
  );
2113
  return {
2114
  c() {
2115
+ t && t.c(), e = Le();
2116
  },
2117
  m(n, i) {
2118
  t && t.m(n, i), v(n, e, i);
2119
  },
2120
  p(n, i) {
2121
  /*p*/
2122
+ n[38].index != null ? t ? t.p(n, i) : (t = Ht(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
2123
  },
2124
  d(n) {
2125
  n && k(e), t && t.d(n);
2126
  }
2127
  };
2128
  }
2129
+ function jt(l) {
2130
  let e, t = (
2131
  /*eta*/
2132
  l[0] ? `/${/*formatted_eta*/
 
2158
  }
2159
  };
2160
  }
2161
+ function ei(l) {
2162
  let e, t;
2163
+ return e = new Vn({
2164
  props: { margin: (
2165
  /*variant*/
2166
  l[8] === "default"
2167
  ) }
2168
  }), {
2169
  c() {
2170
+ Bn(e.$$.fragment);
2171
  },
2172
  m(n, i) {
2173
+ An(e, n, i), t = !0;
2174
  },
2175
  p(n, i) {
2176
  const s = {};
 
2179
  n[8] === "default"), e.$set(s);
2180
  },
2181
  i(n) {
2182
+ t || (qe(e.$$.fragment, n), t = !0);
2183
  },
2184
  o(n) {
2185
+ Te(e.$$.fragment, n), t = !1;
2186
  },
2187
  d(n) {
2188
+ Pn(e, n);
2189
  }
2190
  };
2191
  }
2192
+ function ti(l) {
2193
  let e, t, n, i, s, o = `${/*last_progress_level*/
2194
  l[15] * 100}%`, r = (
2195
  /*progress*/
2196
+ l[7] != null && Nt(l)
2197
  );
2198
  return {
2199
  c() {
2200
+ e = $("div"), t = $("div"), r && r.c(), n = J(), i = $("div"), s = $("div"), G(t, "class", "progress-level-inner svelte-1txqlrd"), G(s, "class", "progress-bar svelte-1txqlrd"), se(s, "width", o), G(i, "class", "progress-bar-wrap svelte-1txqlrd"), G(e, "class", "progress-level svelte-1txqlrd");
2201
  },
2202
+ m(a, f) {
2203
+ v(a, e, f), re(e, t), r && r.m(t, null), re(e, n), re(e, i), re(i, s), l[30](s);
2204
  },
2205
+ p(a, f) {
2206
  /*progress*/
2207
+ a[7] != null ? r ? r.p(a, f) : (r = Nt(a), r.c(), r.m(t, null)) : r && (r.d(1), r = null), f[0] & /*last_progress_level*/
2208
  32768 && o !== (o = `${/*last_progress_level*/
2209
+ a[15] * 100}%`) && se(s, "width", o);
2210
  },
2211
+ i: Ue,
2212
+ o: Ue,
2213
+ d(a) {
2214
+ a && k(e), r && r.d(), l[30](null);
2215
  }
2216
  };
2217
  }
2218
+ function Nt(l) {
2219
+ let e, t = Pe(
2220
  /*progress*/
2221
  l[7]
2222
  ), n = [];
2223
  for (let i = 0; i < t.length; i += 1)
2224
+ n[i] = Pt(Lt(l, t, i));
2225
  return {
2226
  c() {
2227
  for (let i = 0; i < n.length; i += 1)
2228
  n[i].c();
2229
+ e = Le();
2230
  },
2231
  m(i, s) {
2232
  for (let o = 0; o < n.length; o += 1)
 
2236
  p(i, s) {
2237
  if (s[0] & /*progress_level, progress*/
2238
  16512) {
2239
+ t = Pe(
2240
  /*progress*/
2241
  i[7]
2242
  );
2243
  let o;
2244
  for (o = 0; o < t.length; o += 1) {
2245
+ const r = Lt(i, t, o);
2246
+ n[o] ? n[o].p(r, s) : (n[o] = Pt(r), n[o].c(), n[o].m(e.parentNode, e));
2247
  }
2248
  for (; o < n.length; o += 1)
2249
  n[o].d(1);
 
2251
  }
2252
  },
2253
  d(i) {
2254
+ i && k(e), xt(n, i);
2255
  }
2256
  };
2257
  }
2258
+ function Vt(l) {
2259
  let e, t, n, i, s = (
2260
  /*i*/
2261
+ l[40] !== 0 && li()
2262
  ), o = (
2263
  /*p*/
2264
+ l[38].desc != null && zt(l)
2265
  ), r = (
2266
  /*p*/
2267
  l[38].desc != null && /*progress_level*/
 
2269
  l[14][
2270
  /*i*/
2271
  l[40]
2272
+ ] != null && Bt()
2273
+ ), a = (
2274
  /*progress_level*/
2275
+ l[14] != null && Et(l)
2276
  );
2277
  return {
2278
  c() {
2279
+ s && s.c(), e = J(), o && o.c(), t = J(), r && r.c(), n = J(), a && a.c(), i = Le();
2280
  },
2281
+ m(f, _) {
2282
+ s && s.m(f, _), v(f, e, _), o && o.m(f, _), v(f, t, _), r && r.m(f, _), v(f, n, _), a && a.m(f, _), v(f, i, _);
2283
  },
2284
+ p(f, _) {
2285
  /*p*/
2286
+ f[38].desc != null ? o ? o.p(f, _) : (o = zt(f), o.c(), o.m(t.parentNode, t)) : o && (o.d(1), o = null), /*p*/
2287
  f[38].desc != null && /*progress_level*/
2288
  f[14] && /*progress_level*/
2289
  f[14][
2290
  /*i*/
2291
  f[40]
2292
+ ] != null ? r || (r = Bt(), r.c(), r.m(n.parentNode, n)) : r && (r.d(1), r = null), /*progress_level*/
2293
+ f[14] != null ? a ? a.p(f, _) : (a = Et(f), a.c(), a.m(i.parentNode, i)) : a && (a.d(1), a = null);
2294
  },
2295
  d(f) {
2296
+ f && (k(e), k(t), k(n), k(i)), s && s.d(f), o && o.d(f), r && r.d(f), a && a.d(f);
2297
  }
2298
  };
2299
  }
2300
+ function li(l) {
2301
  let e;
2302
  return {
2303
  c() {
 
2311
  }
2312
  };
2313
  }
2314
+ function zt(l) {
2315
  let e = (
2316
  /*p*/
2317
  l[38].desc + ""
 
2333
  }
2334
  };
2335
  }
2336
+ function Bt(l) {
2337
  let e;
2338
  return {
2339
  c() {
 
2347
  }
2348
  };
2349
  }
2350
+ function Et(l) {
2351
  let e = (100 * /*progress_level*/
2352
  (l[14][
2353
  /*i*/
 
2373
  }
2374
  };
2375
  }
2376
+ function Pt(l) {
2377
  let e, t = (
2378
  /*p*/
2379
  (l[38].desc != null || /*progress_level*/
 
2381
  l[14][
2382
  /*i*/
2383
  l[40]
2384
+ ] != null) && Vt(l)
2385
  );
2386
  return {
2387
  c() {
2388
+ t && t.c(), e = Le();
2389
  },
2390
  m(n, i) {
2391
  t && t.m(n, i), v(n, e, i);
 
2397
  n[14][
2398
  /*i*/
2399
  n[40]
2400
+ ] != null ? t ? t.p(n, i) : (t = Vt(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
2401
  },
2402
  d(n) {
2403
  n && k(e), t && t.d(n);
2404
  }
2405
  };
2406
  }
2407
+ function Zt(l) {
2408
  let e, t;
2409
  return {
2410
  c() {
2411
  e = $("p"), t = F(
2412
  /*loading_text*/
2413
  l[9]
2414
+ ), G(e, "class", "loading svelte-1txqlrd");
2415
  },
2416
  m(n, i) {
2417
+ v(n, e, i), re(e, t);
2418
  },
2419
  p(n, i) {
2420
  i[0] & /*loading_text*/
 
2429
  }
2430
  };
2431
  }
2432
+ function ni(l) {
2433
  let e, t, n, i, s;
2434
+ const o = [Gn, Yn], r = [];
2435
+ function a(f, _) {
2436
  return (
2437
  /*status*/
2438
  f[4] === "pending" ? 0 : (
 
2441
  )
2442
  );
2443
  }
2444
+ return ~(t = a(l)) && (n = r[t] = o[t](l)), {
2445
  c() {
2446
+ e = $("div"), n && n.c(), G(e, "class", i = "wrap " + /*variant*/
2447
  l[8] + " " + /*show_progress*/
2448
  l[6] + " svelte-1txqlrd"), Z(e, "hide", !/*status*/
2449
  l[4] || /*status*/
 
2467
  "border",
2468
  /*border*/
2469
  l[12]
2470
+ ), se(
2471
  e,
2472
  "position",
2473
  /*absolute*/
2474
  l[10] ? "absolute" : "static"
2475
+ ), se(
2476
  e,
2477
  "padding",
2478
  /*absolute*/
2479
  l[10] ? "0" : "var(--size-8) 0"
2480
  );
2481
  },
2482
+ m(f, _) {
2483
+ v(f, e, _), ~t && r[t].m(e, null), l[31](e), s = !0;
2484
  },
2485
+ p(f, _) {
2486
  let u = t;
2487
+ t = a(f), t === u ? ~t && r[t].p(f, _) : (n && ($t(), Te(r[u], 1, 1, () => {
2488
  r[u] = null;
2489
+ }), Qt()), ~t ? (n = r[t], n ? n.p(f, _) : (n = r[t] = o[t](f), n.c()), qe(n, 1), n.m(e, null)) : n = null), (!s || _[0] & /*variant, show_progress*/
2490
  320 && i !== (i = "wrap " + /*variant*/
2491
  f[8] + " " + /*show_progress*/
2492
+ f[6] + " svelte-1txqlrd")) && G(e, "class", i), (!s || _[0] & /*variant, show_progress, status, show_progress*/
2493
  336) && Z(e, "hide", !/*status*/
2494
  f[4] || /*status*/
2495
  f[4] === "complete" || /*show_progress*/
2496
+ f[6] === "hidden"), (!s || _[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
2497
  2384) && Z(
2498
  e,
2499
  "translucent",
 
2503
  f[4] === "error") || /*translucent*/
2504
  f[11] || /*show_progress*/
2505
  f[6] === "minimal"
2506
+ ), (!s || _[0] & /*variant, show_progress, status*/
2507
  336) && Z(
2508
  e,
2509
  "generating",
2510
  /*status*/
2511
  f[4] === "generating"
2512
+ ), (!s || _[0] & /*variant, show_progress, border*/
2513
  4416) && Z(
2514
  e,
2515
  "border",
2516
  /*border*/
2517
  f[12]
2518
+ ), _[0] & /*absolute*/
2519
+ 1024 && se(
2520
  e,
2521
  "position",
2522
  /*absolute*/
2523
  f[10] ? "absolute" : "static"
2524
+ ), _[0] & /*absolute*/
2525
+ 1024 && se(
2526
  e,
2527
  "padding",
2528
  /*absolute*/
 
2530
  );
2531
  },
2532
  i(f) {
2533
+ s || (qe(n), s = !0);
2534
  },
2535
  o(f) {
2536
+ Te(n), s = !1;
2537
  },
2538
  d(f) {
2539
  f && k(e), ~t && r[t].d(), l[31](null);
2540
  }
2541
  };
2542
  }
2543
+ let Be = [], Ie = !1;
2544
+ async function ii(l, e = !0) {
2545
  if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && e !== !0)) {
2546
+ if (Be.push(l), !Ie)
2547
+ Ie = !0;
2548
  else
2549
  return;
2550
+ await Wn(), requestAnimationFrame(() => {
2551
  let t = [0, 0];
2552
+ for (let n = 0; n < Be.length; n++) {
2553
+ const s = Be[n].getBoundingClientRect();
2554
  (n === 0 || s.top + window.scrollY <= t[0]) && (t[0] = s.top + window.scrollY, t[1] = n);
2555
  }
2556
+ window.scrollTo({ top: t[0] - 20, behavior: "smooth" }), Ie = !1, Be = [];
2557
  });
2558
  }
2559
  }
2560
+ function si(l, e, t) {
2561
+ let n, { $$slots: i = {}, $$scope: s } = e, { i18n: o } = e, { eta: r = null } = e, { queue_position: a } = e, { queue_size: f } = e, { status: _ } = e, { scroll_to_output: u = !1 } = e, { timer: c = !0 } = e, { show_progress: m = "full" } = e, { message: y = null } = e, { progress: S = null } = e, { variant: T = "default" } = e, { loading_text: L = "Loading..." } = e, { absolute: C = !0 } = e, { translucent: d = !1 } = e, { border: p = !1 } = e, { autoscroll: H } = e, b, R = !1, K = 0, E = 0, A = null, X = null, he = 0, D = null, Q, P = null, be = !0;
2562
  const g = () => {
2563
+ t(0, r = t(26, A = t(19, ge = null))), t(24, K = performance.now()), t(25, E = 0), R = !0, je();
2564
  };
2565
  function je() {
2566
  requestAnimationFrame(() => {
2567
+ t(25, E = (performance.now() - K) / 1e3), R && je();
2568
  });
2569
  }
2570
  function Ne() {
2571
+ t(25, E = 0), t(0, r = t(26, A = t(19, ge = null))), R && (R = !1);
2572
  }
2573
+ Un(() => {
2574
  R && Ne();
2575
  });
2576
+ let ge = null;
2577
+ function Ze(w) {
2578
+ qt[w ? "unshift" : "push"](() => {
2579
+ P = w, t(16, P), t(7, S), t(14, D), t(15, Q);
2580
  });
2581
  }
2582
+ function Oe(w) {
2583
+ qt[w ? "unshift" : "push"](() => {
2584
  b = w, t(13, b);
2585
  });
2586
  }
2587
  return l.$$set = (w) => {
2588
+ "i18n" in w && t(1, o = w.i18n), "eta" in w && t(0, r = w.eta), "queue_position" in w && t(2, a = w.queue_position), "queue_size" in w && t(3, f = w.queue_size), "status" in w && t(4, _ = w.status), "scroll_to_output" in w && t(21, u = w.scroll_to_output), "timer" in w && t(5, c = w.timer), "show_progress" in w && t(6, m = w.show_progress), "message" in w && t(22, y = w.message), "progress" in w && t(7, S = w.progress), "variant" in w && t(8, T = w.variant), "loading_text" in w && t(9, L = w.loading_text), "absolute" in w && t(10, C = w.absolute), "translucent" in w && t(11, d = w.translucent), "border" in w && t(12, p = w.border), "autoscroll" in w && t(23, H = w.autoscroll), "$$scope" in w && t(28, s = w.$$scope);
2589
  }, l.$$.update = () => {
2590
  l.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
2591
+ 218103809 && (r === null && t(0, r = A), r != null && A !== r && (t(27, X = (performance.now() - K) / 1e3 + r), t(19, ge = X.toFixed(1)), t(26, A = r))), l.$$.dirty[0] & /*eta_from_start, timer_diff*/
2592
+ 167772160 && t(17, he = X === null || X <= 0 || !E ? null : Math.min(E / X, 1)), l.$$.dirty[0] & /*progress*/
2593
+ 128 && S != null && t(18, be = !1), l.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
2594
  114816 && (S != null ? t(14, D = S.map((w) => {
2595
  if (w.index != null && w.length != null)
2596
  return w.index / w.length;
2597
  if (w.progress != null)
2598
  return w.progress;
2599
+ })) : t(14, D = null), D ? (t(15, Q = D[D.length - 1]), P && (Q === 0 ? t(16, P.style.transition = "0", P) : t(16, P.style.transition = "150ms", P))) : t(15, Q = void 0)), l.$$.dirty[0] & /*status*/
2600
+ 16 && (_ === "pending" ? g() : Ne()), l.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
2601
+ 10493968 && b && u && (_ === "pending" || _ === "complete") && ii(b, H), l.$$.dirty[0] & /*status, message*/
2602
  4194320, l.$$.dirty[0] & /*timer_diff*/
2603
  33554432 && t(20, n = E.toFixed(1));
2604
  }, [
2605
  r,
2606
  o,
 
 
2607
  a,
2608
+ f,
2609
+ _,
2610
  c,
2611
  m,
2612
  S,
 
2617
  p,
2618
  b,
2619
  D,
2620
+ Q,
2621
+ P,
2622
+ he,
2623
  be,
2624
  ge,
 
2625
  n,
2626
  u,
2627
  y,
2628
  H,
2629
+ K,
2630
  E,
2631
+ A,
2632
  X,
2633
  s,
2634
  i,
2635
+ Ze,
2636
+ Oe
2637
  ];
2638
  }
2639
+ class oi extends zn {
2640
  constructor(e) {
2641
+ super(), Rn(
2642
  this,
2643
  e,
 
2644
  si,
2645
+ ni,
2646
+ Dn,
2647
  {
2648
  i18n: 1,
2649
  eta: 0,
 
2668
  }
2669
  }
2670
  const {
2671
+ SvelteComponent: fi,
2672
+ add_flush_callback: Ot,
2673
+ assign: _i,
2674
+ bind: Rt,
2675
+ binding_callbacks: At,
2676
+ check_outros: ai,
2677
+ create_component: xe,
2678
+ destroy_component: $e,
2679
+ detach: ri,
2680
  flush: M,
2681
+ get_spread_object: ui,
2682
+ get_spread_update: ci,
2683
+ group_outros: di,
2684
+ init: mi,
2685
+ insert: hi,
2686
+ mount_component: et,
2687
+ safe_not_equal: bi,
2688
+ space: gi,
2689
+ transition_in: ye,
2690
  transition_out: Fe
2691
  } = window.__gradio__svelte__internal;
2692
+ function Dt(l) {
2693
  let e, t;
2694
  const n = [
2695
  { autoscroll: (
 
2705
  ];
2706
  let i = {};
2707
  for (let s = 0; s < n.length; s += 1)
2708
+ i = _i(i, n[s]);
2709
+ return e = new oi({ props: i }), {
2710
  c() {
2711
+ xe(e.$$.fragment);
2712
  },
2713
  m(s, o) {
2714
+ et(e, s, o), t = !0;
2715
  },
2716
  p(s, o) {
2717
  const r = o & /*gradio, loading_status*/
2718
+ 131080 ? ci(n, [
2719
  o & /*gradio*/
2720
  8 && { autoscroll: (
2721
  /*gradio*/
 
2727
  s[3].i18n
2728
  ) },
2729
  o & /*loading_status*/
2730
+ 131072 && ui(
2731
  /*loading_status*/
2732
  s[17]
2733
  )
 
2735
  e.$set(r);
2736
  },
2737
  i(s) {
2738
+ t || (ye(e.$$.fragment, s), t = !0);
2739
  },
2740
  o(s) {
2741
  Fe(e.$$.fragment, s), t = !1;
2742
  },
2743
  d(s) {
2744
+ $e(e, s);
2745
  }
2746
  };
2747
  }
2748
+ function wi(l) {
2749
  let e, t, n, i, s, o = (
2750
  /*loading_status*/
2751
+ l[17] && Dt(l)
2752
  );
2753
+ function r(_) {
2754
+ l[22](_);
2755
  }
2756
+ function a(_) {
2757
+ l[23](_);
2758
  }
2759
  let f = {
2760
  label: (
 
2801
  l[0] !== void 0 && (f.value = /*value*/
2802
  l[0]), /*value_is_output*/
2803
  l[2] !== void 0 && (f.value_is_output = /*value_is_output*/
2804
+ l[2]), t = new fn({ props: f }), At.push(() => Rt(t, "value", r)), At.push(() => Rt(t, "value_is_output", a)), t.$on(
2805
  "change",
2806
  /*change_handler*/
2807
  l[24]
 
2827
  l[29]
2828
  ), {
2829
  c() {
2830
+ o && o.c(), e = gi(), xe(t.$$.fragment);
2831
  },
2832
+ m(_, u) {
2833
+ o && o.m(_, u), hi(_, e, u), et(t, _, u), s = !0;
2834
  },
2835
+ p(_, u) {
2836
  /*loading_status*/
2837
+ _[17] ? o ? (o.p(_, u), u & /*loading_status*/
2838
+ 131072 && ye(o, 1)) : (o = Dt(_), o.c(), ye(o, 1), o.m(e.parentNode, e)) : o && (di(), Fe(o, 1, 1, () => {
2839
  o = null;
2840
+ }), ai());
2841
  const c = {};
2842
  u & /*label*/
2843
  16 && (c.label = /*label*/
2844
+ _[4]), u & /*info*/
2845
  64 && (c.info = /*info*/
2846
+ _[6]), u & /*show_label*/
2847
  1024 && (c.show_label = /*show_label*/
2848
+ _[10]), u & /*show_legend*/
2849
  2048 && (c.show_legend = /*show_legend*/
2850
+ _[11]), u & /*show_legend_label*/
2851
  4096 && (c.show_legend_label = /*show_legend_label*/
2852
+ _[12]), u & /*legend_label*/
2853
  32 && (c.legend_label = /*legend_label*/
2854
+ _[5]), u & /*color_map*/
2855
  2 && (c.color_map = /*color_map*/
2856
+ _[1]), u & /*show_copy_button*/
2857
  65536 && (c.show_copy_button = /*show_copy_button*/
2858
+ _[16]), u & /*container*/
2859
  8192 && (c.container = /*container*/
2860
+ _[13]), u & /*interactive*/
2861
  262144 && (c.disabled = !/*interactive*/
2862
+ _[18]), !n && u & /*value*/
2863
  1 && (n = !0, c.value = /*value*/
2864
+ _[0], Ot(() => n = !1)), !i && u & /*value_is_output*/
2865
  4 && (i = !0, c.value_is_output = /*value_is_output*/
2866
+ _[2], Ot(() => i = !1)), t.$set(c);
2867
  },
2868
+ i(_) {
2869
+ s || (ye(o), ye(t.$$.fragment, _), s = !0);
2870
  },
2871
+ o(_) {
2872
+ Fe(o), Fe(t.$$.fragment, _), s = !1;
2873
  },
2874
+ d(_) {
2875
+ _ && ri(e), o && o.d(_), $e(t, _);
2876
  }
2877
  }
2878
  );
2879
  }
2880
+ function ki(l) {
2881
  let e, t;
2882
+ return e = new Cn({
2883
  props: {
2884
  visible: (
2885
  /*visible*/
 
2906
  /*container*/
2907
  l[13]
2908
  ),
2909
+ $$slots: { default: [wi] },
2910
  $$scope: { ctx: l }
2911
  }
2912
  }), {
2913
  c() {
2914
+ xe(e.$$.fragment);
2915
  },
2916
  m(n, i) {
2917
+ et(e, n, i), t = !0;
2918
  },
2919
  p(n, [i]) {
2920
  const s = {};
 
2934
  1074216063 && (s.$$scope = { dirty: i, ctx: n }), e.$set(s);
2935
  },
2936
  i(n) {
2937
+ t || (ye(e.$$.fragment, n), t = !0);
2938
  },
2939
  o(n) {
2940
  Fe(e.$$.fragment, n), t = !1;
2941
  },
2942
  d(n) {
2943
+ $e(e, n);
2944
  }
2945
  };
2946
  }
2947
+ function vi(l, e, t) {
2948
+ let { gradio: n } = e, { label: i = "Highlighted Textbox" } = e, { legend_label: s = "Highlights:" } = e, { info: o = void 0 } = e, { elem_id: r = "" } = e, { elem_classes: a = [] } = e, { visible: f = !0 } = e, { value: _ } = e, { show_label: u } = e, { show_legend: c } = e, { show_legend_label: m } = e, { color_map: y = {} } = e, { container: S = !0 } = e, { scale: T = null } = e, { min_width: L = void 0 } = e, { show_copy_button: C = !1 } = e, { loading_status: d = void 0 } = e, { value_is_output: p = !1 } = e, { combine_adjacent: H = !1 } = e, { interactive: b = !0 } = e;
2949
+ const R = !1, K = !0;
2950
  function E(g) {
2951
+ _ = g, t(0, _), t(19, H);
2952
  }
2953
+ function A(g) {
2954
  p = g, t(2, p);
2955
  }
2956
+ const X = () => n.dispatch("change"), he = () => n.dispatch("input"), D = () => n.dispatch("submit"), Q = () => n.dispatch("blur"), P = (g) => n.dispatch("select", g.detail), be = () => n.dispatch("focus");
2957
  return l.$$set = (g) => {
2958
+ "gradio" in g && t(3, n = g.gradio), "label" in g && t(4, i = g.label), "legend_label" in g && t(5, s = g.legend_label), "info" in g && t(6, o = g.info), "elem_id" in g && t(7, r = g.elem_id), "elem_classes" in g && t(8, a = g.elem_classes), "visible" in g && t(9, f = g.visible), "value" in g && t(0, _ = g.value), "show_label" in g && t(10, u = g.show_label), "show_legend" in g && t(11, c = g.show_legend), "show_legend_label" in g && t(12, m = g.show_legend_label), "color_map" in g && t(1, y = g.color_map), "container" in g && t(13, S = g.container), "scale" in g && t(14, T = g.scale), "min_width" in g && t(15, L = g.min_width), "show_copy_button" in g && t(16, C = g.show_copy_button), "loading_status" in g && t(17, d = g.loading_status), "value_is_output" in g && t(2, p = g.value_is_output), "combine_adjacent" in g && t(19, H = g.combine_adjacent), "interactive" in g && t(18, b = g.interactive);
2959
  }, l.$$.update = () => {
2960
  l.$$.dirty & /*color_map*/
2961
  2 && !y && Object.keys(y).length && t(1, y), l.$$.dirty & /*value, combine_adjacent*/
2962
+ 524289 && _ && H && t(0, _ = Ol(_, "equal"));
2963
  }, [
2964
+ _,
2965
  y,
2966
  p,
2967
  n,
 
2969
  s,
2970
  o,
2971
  r,
2972
+ a,
2973
  f,
2974
  u,
2975
  c,
 
2982
  b,
2983
  H,
2984
  R,
2985
+ K,
2986
  E,
2987
+ A,
2988
  X,
2989
+ he,
2990
  D,
2991
+ Q,
2992
+ P,
2993
+ be
2994
  ];
2995
  }
2996
+ class pi extends fi {
2997
  constructor(e) {
2998
+ super(), mi(this, e, vi, ki, bi, {
2999
  gradio: 3,
3000
  label: 4,
3001
  legend_label: 5,
 
3148
  }
3149
  }
3150
  export {
3151
+ pi as default
3152
  };
src/backend/gradio_highlightedtextbox/templates/component/style.css CHANGED
@@ -1 +1 @@
1
- span.has-info.svelte-vm3q5z{margin-bottom:var(--spacing-xs)}span.svelte-vm3q5z:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-vm3q5z{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-vm3q5z{display:none!important}.category-legend.svelte-vm3q5z{display:flex;flex-wrap:wrap;gap:var(--spacing-sm);color:#000}.category-label.svelte-vm3q5z{border-radius:var(--radius-xs);padding-right:var(--size-2);padding-left:var(--size-2);font-weight:var(--weight-semibold)}.category-label.has-info.svelte-vm3q5z{margin-bottom:var(--spacing-xs)}.category-label.svelte-vm3q5z:not(.has-info){margin-bottom:var(--spacing-lg)}.title-container.svelte-vm3q5z{display:flex}.legend-separator.svelte-vm3q5z{margin:0 var(--spacing-md) 0 var(--spacing-md)}.title-with-highlights-info.svelte-vm3q5z{margin-bottom:var(--spacing-xs);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)}.dropdown-arrow.svelte-145leq6{fill:currentColor}label.svelte-14ssfqr{display:block;width:100%}button.svelte-14ssfqr{display:flex;position:absolute;top:var(--block-label-margin);right:var(--block-label-margin);align-items:center;box-shadow:var(--shadow-drop);border:1px solid var(--color-border-primary);border-top:none;border-right:none;border-radius:var(--block-label-right-radius);background:var(--block-label-background-fill);padding:5px;width:22px;height:22px;overflow:hidden;color:var(--block-label-color);font:var(--font-sans);font-size:var(--button-small-text-size)}.container.svelte-14ssfqr{display:flex;flex-direction:column;gap:var(--spacing-sm)}.textfield.svelte-14ssfqr{box-sizing:border-box;outline:none!important;box-shadow:var(--input-shadow);padding:var(--input-padding);border-radius:var(--radius-md);background:var(--input-background-fill);background-color:transparent;font-weight:var(--input-text-weight);font-size:var(--input-text-size);width:100%;line-height:var(--line-sm);word-break:break-word;border:var(--input-border-width) solid var(--input-border-color);cursor:text}.textfield.svelte-14ssfqr:focus{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus)}mark{border-radius:3px}.block.svelte-1t38q2d{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-1t38q2d{border-color:var(--color-accent)}.padded.svelte-1t38q2d{padding:var(--block-padding)}.hidden.svelte-1t38q2d{display:none}.hide-container.svelte-1t38q2d{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-lpi64a{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-lpi64a{opacity:.5;box-shadow:none}button[disabled].svelte-lpi64a:hover{cursor:not-allowed}.padded.svelte-lpi64a{padding:2px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color)}button.svelte-lpi64a:hover,button.highlight.svelte-lpi64a{cursor:pointer;color:var(--color-accent)}.padded.svelte-lpi64a:hover{border:2px solid var(--button-secondary-border-color-hover);padding:1px;color:var(--block-label-text-color)}span.svelte-lpi64a{padding:0 1px;font-size:10px}div.svelte-lpi64a{padding:2px;display:flex;align-items:flex-end}.small.svelte-lpi64a{width:14px;height:14px}.large.svelte-lpi64a{width:22px;height:22px}.pending.svelte-lpi64a{animation:svelte-lpi64a-flash .5s infinite}@keyframes svelte-lpi64a-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-lpi64a{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}.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-ipfyu7{border-top:1px solid transparent;display:flex;max-height:100%;justify-content:center;gap:var(--spacing-sm);height:auto;align-items:flex-end;padding-bottom:var(--spacing-xl);color:var(--block-label-text-color);flex-shrink:0;width:95%}.show_border.svelte-ipfyu7{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-1txqlrd.svelte-1txqlrd{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;pointer-events:none}.wrap.center.svelte-1txqlrd.svelte-1txqlrd{top:0;right:0;left:0}.wrap.default.svelte-1txqlrd.svelte-1txqlrd{top:0;right:0;bottom:0;left:0}.hide.svelte-1txqlrd.svelte-1txqlrd{opacity:0;pointer-events:none}.generating.svelte-1txqlrd.svelte-1txqlrd{animation:svelte-1txqlrd-pulse 2s cubic-bezier(.4,0,.6,1) infinite;border:2px solid var(--color-accent);background:transparent}.translucent.svelte-1txqlrd.svelte-1txqlrd{background:none}@keyframes svelte-1txqlrd-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-1txqlrd.svelte-1txqlrd{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-1txqlrd.svelte-1txqlrd{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-1txqlrd.svelte-1txqlrd{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-1txqlrd.svelte-1txqlrd{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-1txqlrd.svelte-1txqlrd{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-1txqlrd.svelte-1txqlrd{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-1txqlrd.svelte-1txqlrd{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-1txqlrd.svelte-1txqlrd{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-1txqlrd.svelte-1txqlrd{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-1txqlrd .progress-text.svelte-1txqlrd{background:var(--block-background-fill)}.border.svelte-1txqlrd.svelte-1txqlrd{border:1px solid var(--border-color-primary)}.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))}}
 
1
+ span.has-info.svelte-vm3q5z{margin-bottom:var(--spacing-xs)}span.svelte-vm3q5z:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-vm3q5z{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-vm3q5z{display:none!important}.category-legend.svelte-vm3q5z{display:flex;flex-wrap:wrap;gap:var(--spacing-sm);color:#000}.category-label.svelte-vm3q5z{border-radius:var(--radius-xs);padding-right:var(--size-2);padding-left:var(--size-2);font-weight:var(--weight-semibold)}.category-label.has-info.svelte-vm3q5z{margin-bottom:var(--spacing-xs)}.category-label.svelte-vm3q5z:not(.has-info){margin-bottom:var(--spacing-lg)}.title-container.svelte-vm3q5z{display:flex}.legend-separator.svelte-vm3q5z{margin:0 var(--spacing-md) 0 var(--spacing-md)}.title-with-highlights-info.svelte-vm3q5z{margin-bottom:var(--spacing-xs);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)}.dropdown-arrow.svelte-145leq6{fill:currentColor}label.svelte-40uavx{display:block;width:100%}button.svelte-40uavx{display:flex;position:absolute;top:var(--block-label-margin);right:var(--block-label-margin);align-items:center;box-shadow:var(--shadow-drop);border:1px solid var(--color-border-primary);border-top:none;border-right:none;border-radius:var(--block-label-right-radius);background:var(--block-label-background-fill);padding:5px;width:22px;height:22px;overflow:hidden;color:var(--block-label-color);font:var(--font-sans);font-size:var(--button-small-text-size)}.container.svelte-40uavx{display:flex;flex-direction:column;gap:var(--spacing-sm)}.textfield.svelte-40uavx{box-sizing:border-box;outline:none!important;box-shadow:var(--input-shadow);padding:var(--input-padding);border-radius:var(--radius-md);background:var(--input-background-fill);background-color:transparent;font-weight:var(--input-text-weight);font-size:var(--input-text-size);width:100%;line-height:var(--line-sm);word-break:break-word;border:var(--input-border-width) solid var(--input-border-color);cursor:text;white-space:break-spaces}.textfield.svelte-40uavx:focus{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus)}mark{border-radius:3px}.block.svelte-1t38q2d{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-1t38q2d{border-color:var(--color-accent)}.padded.svelte-1t38q2d{padding:var(--block-padding)}.hidden.svelte-1t38q2d{display:none}.hide-container.svelte-1t38q2d{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-lpi64a{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-lpi64a{opacity:.5;box-shadow:none}button[disabled].svelte-lpi64a:hover{cursor:not-allowed}.padded.svelte-lpi64a{padding:2px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color)}button.svelte-lpi64a:hover,button.highlight.svelte-lpi64a{cursor:pointer;color:var(--color-accent)}.padded.svelte-lpi64a:hover{border:2px solid var(--button-secondary-border-color-hover);padding:1px;color:var(--block-label-text-color)}span.svelte-lpi64a{padding:0 1px;font-size:10px}div.svelte-lpi64a{padding:2px;display:flex;align-items:flex-end}.small.svelte-lpi64a{width:14px;height:14px}.large.svelte-lpi64a{width:22px;height:22px}.pending.svelte-lpi64a{animation:svelte-lpi64a-flash .5s infinite}@keyframes svelte-lpi64a-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-lpi64a{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}.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-ipfyu7{border-top:1px solid transparent;display:flex;max-height:100%;justify-content:center;gap:var(--spacing-sm);height:auto;align-items:flex-end;padding-bottom:var(--spacing-xl);color:var(--block-label-text-color);flex-shrink:0;width:95%}.show_border.svelte-ipfyu7{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-1txqlrd.svelte-1txqlrd{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;pointer-events:none}.wrap.center.svelte-1txqlrd.svelte-1txqlrd{top:0;right:0;left:0}.wrap.default.svelte-1txqlrd.svelte-1txqlrd{top:0;right:0;bottom:0;left:0}.hide.svelte-1txqlrd.svelte-1txqlrd{opacity:0;pointer-events:none}.generating.svelte-1txqlrd.svelte-1txqlrd{animation:svelte-1txqlrd-pulse 2s cubic-bezier(.4,0,.6,1) infinite;border:2px solid var(--color-accent);background:transparent}.translucent.svelte-1txqlrd.svelte-1txqlrd{background:none}@keyframes svelte-1txqlrd-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-1txqlrd.svelte-1txqlrd{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-1txqlrd.svelte-1txqlrd{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-1txqlrd.svelte-1txqlrd{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-1txqlrd.svelte-1txqlrd{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-1txqlrd.svelte-1txqlrd{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-1txqlrd.svelte-1txqlrd{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-1txqlrd.svelte-1txqlrd{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-1txqlrd.svelte-1txqlrd{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-1txqlrd.svelte-1txqlrd{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-1txqlrd .progress-text.svelte-1txqlrd{background:var(--block-background-fill)}.border.svelte-1txqlrd.svelte-1txqlrd{border:1px solid var(--border-color-primary)}.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))}}
src/demo/app.py CHANGED
@@ -24,6 +24,18 @@ def convert_highlighted_text_to_tagged_text(
24
  )
25
 
26
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  initial_text = "It is not something to be ashamed of: it is no different from the <d>personal fears</d> and <tm>dislikes</tm> of other things that <t>manny peopl</t> have."
28
 
29
  with gr.Blocks() as demo:
@@ -56,60 +68,64 @@ with gr.Blocks() as demo:
56
  show_label=True,
57
  info="Insert one or more tags to mark the end of a highlighted section.",
58
  )
59
- gr.Markdown("### Example tagged to highlight:")
 
 
 
 
 
 
 
 
 
 
60
  with gr.Row():
61
- tagged_t2h = gr.Textbox(
62
  initial_text,
63
  interactive=True,
64
- label="Tagged Input",
65
  show_label=True,
66
  info="Tagged text using the format above to mark spans that will be highlighted.",
67
  )
68
- high_t2h = HighlightedTextbox(
69
  convert_tagged_text_to_highlighted_text(
70
- tagged_t2h.value, tag_id.value, tag_open.value, tag_close.value
71
- ),
72
- interactive=False,
73
- label="Highlighted Output",
74
- info="Highlighted textbox intialized from the tagged input.",
75
- show_legend=True,
76
- show_label=True,
77
- legend_label="Legend:",
78
- show_legend_label=True,
79
- )
80
- gr.Markdown("### Example highlight to tagged:")
81
- with gr.Row():
82
- high_h2t = HighlightedTextbox(
83
- convert_tagged_text_to_highlighted_text(
84
- initial_text, tag_id.value, tag_open.value, tag_close.value
85
  ),
86
  interactive=True,
87
- label="Highlighted Input",
88
- info="Highlighted textbox using the format above to mark spans that will be highlighted.",
89
  show_legend=True,
90
  show_label=True,
91
  legend_label="Legend:",
92
  show_legend_label=True,
93
  )
94
- tagged_h2t = gr.Textbox(
95
- initial_text,
96
- interactive=False,
97
- label="Tagged Output",
98
- info="Tagged text intialized from the highlighted textbox.",
99
- show_label=True,
100
- )
101
 
102
  # Functions
103
 
104
- tagged_t2h.input(
105
  fn=convert_tagged_text_to_highlighted_text,
106
- inputs=[tagged_t2h, tag_id, tag_open, tag_close],
107
- outputs=high_t2h,
108
  )
109
- high_h2t.input(
110
  fn=convert_highlighted_text_to_tagged_text,
111
- inputs=[high_h2t, tag_id, tag_open, tag_close],
112
- outputs=tagged_h2t,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  )
114
 
115
  if __name__ == "__main__":
 
24
  )
25
 
26
 
27
+ def show_info(
28
+ highlighted_text: dict[str, str | list[tuple[str, str | None]]],
29
+ tag_id: str | list[str],
30
+ tag_open: str | list[str],
31
+ tag_close: str | list[str],
32
+ msg: str,
33
+ ) -> None:
34
+ gr.Info(
35
+ f"{msg}: {HighlightedTextbox.tuples_to_tagged_text(highlighted_text['data'], tag_id, tag_open, tag_close)}"
36
+ )
37
+
38
+
39
  initial_text = "It is not something to be ashamed of: it is no different from the <d>personal fears</d> and <tm>dislikes</tm> of other things that <t>manny peopl</t> have."
40
 
41
  with gr.Blocks() as demo:
 
68
  show_label=True,
69
  info="Insert one or more tags to mark the end of a highlighted section.",
70
  )
71
+ gr.Markdown(
72
+ """
73
+ ### Example:
74
+
75
+ The following text is tagged using the parameters above to mark spans that will be highlighted.
76
+
77
+ Both the tagged text and the highlighted text are editable, so you can see how the changes in one affect the other.
78
+
79
+ Highlights will disappear if the highlighted text is edited. Modals will appear upon focus, change, and blur events on the highlighted text.
80
+ """
81
+ )
82
  with gr.Row():
83
+ tagged = gr.Textbox(
84
  initial_text,
85
  interactive=True,
86
+ label="Tagged text",
87
  show_label=True,
88
  info="Tagged text using the format above to mark spans that will be highlighted.",
89
  )
90
+ high = HighlightedTextbox(
91
  convert_tagged_text_to_highlighted_text(
92
+ tagged.value, tag_id.value, tag_open.value, tag_close.value
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  ),
94
  interactive=True,
95
+ label="Highlighted text",
96
+ info="Textbox containing editable text with custom highlights.",
97
  show_legend=True,
98
  show_label=True,
99
  legend_label="Legend:",
100
  show_legend_label=True,
101
  )
 
 
 
 
 
 
 
102
 
103
  # Functions
104
 
105
+ tagged.input(
106
  fn=convert_tagged_text_to_highlighted_text,
107
+ inputs=[tagged, tag_id, tag_open, tag_close],
108
+ outputs=high,
109
  )
110
+ high.input(
111
  fn=convert_highlighted_text_to_tagged_text,
112
+ inputs=[high, tag_id, tag_open, tag_close],
113
+ outputs=tagged,
114
+ )
115
+ high.focus(
116
+ fn=show_info,
117
+ inputs=[high, tag_id, tag_open, tag_close, gr.State("Focus")],
118
+ outputs=None,
119
+ )
120
+ high.change(
121
+ fn=show_info,
122
+ inputs=[high, tag_id, tag_open, tag_close, gr.State("Change")],
123
+ outputs=None,
124
+ )
125
+ high.blur(
126
+ fn=show_info,
127
+ inputs=[high, tag_id, tag_open, tag_close, gr.State("Blur")],
128
+ outputs=None,
129
  )
130
 
131
  if __name__ == "__main__":
src/demo/space.py CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
3
  from app import demo as app
4
  import os
5
 
6
- _docs = {'HighlightedTextbox': {'description': 'Creates a textarea for user to enter string input or display string output where some\nelements are highlighted.\n (1) "text" whose value is the complete text, and\n (2) "highlights", which is a list of dictionaries, each of which have the keys:\n "highlight_type" (consisting of the highlight label),\n "start" (the character index where the label starts), and\n "end" (the character index where the label ends).\n Highlights should not overlap.', 'members': {'__init__': {'value': {'type': 'str | Callable | None', 'default': '""', 'description': 'default text to provide in textbox. If callable, the function will be called whenever the app loads to set the initial value of the component.'}, 'color_map': {'type': 'dict[str, str] | None', 'default': 'None', 'description': 'dictionary mapping labels to colors.'}, 'show_legend': {'type': 'bool', 'default': 'False', 'description': 'if True, will display legend.'}, 'show_legend_label': {'type': 'bool', 'default': 'False', 'description': 'if True, will display legend label.'}, 'legend_label': {'type': 'str', 'default': '""', 'description': 'label to display above legend.'}, 'combine_adjacent': {'type': 'bool', 'default': 'False', 'description': 'if True, will combine adjacent spans with the same label.'}, 'adjacent_separator': {'type': 'str', 'default': '""', 'description': 'separator to use when combining adjacent spans.'}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'component name in interface.'}, 'info': {'type': 'str | None', 'default': 'None', 'description': None}, 'every': {'type': 'float | None', 'default': 'None', 'description': "If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute."}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.'}, 'min_width': {'type': 'int', 'default': '160', 'description': '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.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'autofocus': {'type': 'bool', 'default': 'False', 'description': None}, 'autoscroll': {'type': 'bool', 'default': 'True', 'description': 'If True, will automatically scroll to the bottom of the textbox when the value changes, unless the user scrolls up. If False, will not scroll to the bottom of the textbox when the value changes.'}, 'interactive': {'type': 'bool', 'default': 'True', 'description': 'if True, will be rendered as an editable textbox; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': '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.'}, 'render': {'type': 'bool', 'default': 'True', 'description': '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.'}, 'show_copy_button': {'type': 'bool', 'default': 'False', 'description': 'If True, includes a copy button to copy the text in the textbox. Only applies if show_label is True.'}}, 'postprocess': {'y': {'type': 'list[tuple[str, str | None]] | dict | None', 'description': 'List of (word, category) tuples, or a dictionary of two keys: "text", and "highlights", which itself is'}, 'value': {'type': 'list[tuple[str, str | None]] | dict | None', 'description': 'List of (word, category) tuples, or a dictionary of two keys: "text", and "highlights", which itself is'}}, 'preprocess': {'return': {'type': 'dict', 'description': None}, 'value': None}}, 'events': {'change': {'type': None, 'default': None, 'description': 'Triggered when the value of the HighlightedTextbox 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.'}, 'input': {'type': None, 'default': None, 'description': 'This listener is triggered when the user changes the value of the HighlightedTextbox.'}, 'select': {'type': None, 'default': None, 'description': 'Event listener for when the user selects or deselects the HighlightedTextbox. Uses event data gradio.SelectData to carry `value` referring to the label of the HighlightedTextbox, and `selected` to refer to state of the HighlightedTextbox. See EventData documentation on how to use this event data'}, 'submit': {'type': None, 'default': None, 'description': 'This listener is triggered when the user presses the Enter key while the HighlightedTextbox is focused.'}, 'focus': {'type': None, 'default': None, 'description': 'This listener is triggered when the HighlightedTextbox is focused.'}, 'blur': {'type': None, 'default': None, 'description': 'This listener is triggered when the HighlightedTextbox is unfocused/blurred.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'HighlightedTextbox': []}}}
7
 
8
  abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
 
@@ -64,6 +64,18 @@ def convert_highlighted_text_to_tagged_text(
64
  )
65
 
66
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  initial_text = "It is not something to be ashamed of: it is no different from the <d>personal fears</d> and <tm>dislikes</tm> of other things that <t>manny peopl</t> have."
68
 
69
  with gr.Blocks() as demo:
@@ -96,60 +108,64 @@ with gr.Blocks() as demo:
96
  show_label=True,
97
  info="Insert one or more tags to mark the end of a highlighted section.",
98
  )
99
- gr.Markdown("### Example tagged to highlight:")
 
 
 
 
 
 
 
 
 
 
100
  with gr.Row():
101
- tagged_t2h = gr.Textbox(
102
  initial_text,
103
  interactive=True,
104
- label="Tagged Input",
105
  show_label=True,
106
  info="Tagged text using the format above to mark spans that will be highlighted.",
107
  )
108
- high_t2h = HighlightedTextbox(
109
  convert_tagged_text_to_highlighted_text(
110
- tagged_t2h.value, tag_id.value, tag_open.value, tag_close.value
111
- ),
112
- interactive=False,
113
- label="Highlighted Output",
114
- info="Highlighted textbox intialized from the tagged input.",
115
- show_legend=True,
116
- show_label=True,
117
- legend_label="Legend:",
118
- show_legend_label=True,
119
- )
120
- gr.Markdown("### Example highlight to tagged:")
121
- with gr.Row():
122
- high_h2t = HighlightedTextbox(
123
- convert_tagged_text_to_highlighted_text(
124
- initial_text, tag_id.value, tag_open.value, tag_close.value
125
  ),
126
  interactive=True,
127
- label="Highlighted Input",
128
- info="Highlighted textbox using the format above to mark spans that will be highlighted.",
129
  show_legend=True,
130
  show_label=True,
131
  legend_label="Legend:",
132
  show_legend_label=True,
133
  )
134
- tagged_h2t = gr.Textbox(
135
- initial_text,
136
- interactive=False,
137
- label="Tagged Output",
138
- info="Tagged text intialized from the highlighted textbox.",
139
- show_label=True,
140
- )
141
 
142
  # Functions
143
 
144
- tagged_t2h.input(
145
  fn=convert_tagged_text_to_highlighted_text,
146
- inputs=[tagged_t2h, tag_id, tag_open, tag_close],
147
- outputs=high_t2h,
148
  )
149
- high_h2t.input(
150
  fn=convert_highlighted_text_to_tagged_text,
151
- inputs=[high_h2t, tag_id, tag_open, tag_close],
152
- outputs=tagged_h2t,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  )
154
 
155
  if __name__ == "__main__":
@@ -185,7 +201,7 @@ The impact on the users predict function varies depending on whether the compone
185
 
186
  The code snippet below is accurate in cases where the component is used as both an input and an output.
187
 
188
- - **As output:** Should return, list of (word, category) tuples, or a dictionary of two keys: "text", and "highlights", which itself is.
189
 
190
  ```python
191
  def predict(
 
3
  from app import demo as app
4
  import os
5
 
6
+ _docs = {'HighlightedTextbox': {'description': 'Creates a textarea for user to enter string input or display string output where some\nelements are highlighted.\n (1) "text" whose value is the complete text, and\n (2) "highlights", which is a list of dictionaries, each of which have the keys:\n "highlight_type" (consisting of the highlight label),\n "start" (the character index where the label starts), and\n "end" (the character index where the label ends).\n Highlights should not overlap.', 'members': {'__init__': {'value': {'type': 'list[tuple[str, str | None]] | Callable | None', 'default': '""', 'description': 'default text to provide in textbox. If callable, the function will be called whenever the app loads to set the initial value of the component.'}, 'color_map': {'type': 'dict[str, str] | None', 'default': 'None', 'description': 'dictionary mapping labels to colors.'}, 'show_legend': {'type': 'bool', 'default': 'False', 'description': 'if True, will display legend.'}, 'show_legend_label': {'type': 'bool', 'default': 'False', 'description': 'if True, will display legend label.'}, 'legend_label': {'type': 'str', 'default': '""', 'description': 'label to display above legend.'}, 'combine_adjacent': {'type': 'bool', 'default': 'False', 'description': 'if True, will combine adjacent spans with the same label.'}, 'adjacent_separator': {'type': 'str', 'default': '""', 'description': 'separator to use when combining adjacent spans.'}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'component name in interface.'}, 'info': {'type': 'str | None', 'default': 'None', 'description': None}, 'every': {'type': 'float | None', 'default': 'None', 'description': "If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute."}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.'}, 'min_width': {'type': 'int', 'default': '160', 'description': '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.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'autofocus': {'type': 'bool', 'default': 'False', 'description': None}, 'autoscroll': {'type': 'bool', 'default': 'True', 'description': 'If True, will automatically scroll to the bottom of the textbox when the value changes, unless the user scrolls up. If False, will not scroll to the bottom of the textbox when the value changes.'}, 'interactive': {'type': 'bool', 'default': 'True', 'description': 'if True, will be rendered as an editable textbox; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': '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.'}, 'render': {'type': 'bool', 'default': 'True', 'description': '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.'}, 'show_copy_button': {'type': 'bool', 'default': 'False', 'description': 'If True, includes a copy button to copy the text in the textbox. Only applies if show_label is True.'}}, 'postprocess': {'y': {'type': 'list[tuple[str, str | None]] | dict | None', 'description': 'List of (word, category) tuples, or a dictionary of two keys: "id", and "data", which is a list of (word, category) tuples.'}, 'value': {'type': 'list[tuple[str, str | None]] | dict | None', 'description': 'List of (word, category) tuples, or a dictionary of two keys: "id", and "data", which is a list of (word, category) tuples.'}}, 'preprocess': {'return': {'type': 'dict', 'description': None}, 'value': None}}, 'events': {'change': {'type': None, 'default': None, 'description': 'Triggered when the value of the HighlightedTextbox 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.'}, 'input': {'type': None, 'default': None, 'description': 'This listener is triggered when the user changes the value of the HighlightedTextbox.'}, 'select': {'type': None, 'default': None, 'description': 'Event listener for when the user selects or deselects the HighlightedTextbox. Uses event data gradio.SelectData to carry `value` referring to the label of the HighlightedTextbox, and `selected` to refer to state of the HighlightedTextbox. See EventData documentation on how to use this event data'}, 'submit': {'type': None, 'default': None, 'description': 'This listener is triggered when the user presses the Enter key while the HighlightedTextbox is focused.'}, 'focus': {'type': None, 'default': None, 'description': 'This listener is triggered when the HighlightedTextbox is focused.'}, 'blur': {'type': None, 'default': None, 'description': 'This listener is triggered when the HighlightedTextbox is unfocused/blurred.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'HighlightedTextbox': []}}}
7
 
8
  abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
 
 
64
  )
65
 
66
 
67
+ def show_info(
68
+ highlighted_text: dict[str, str | list[tuple[str, str | None]]],
69
+ tag_id: str | list[str],
70
+ tag_open: str | list[str],
71
+ tag_close: str | list[str],
72
+ msg: str,
73
+ ) -> None:
74
+ gr.Info(
75
+ f"{msg}: {HighlightedTextbox.tuples_to_tagged_text(highlighted_text['data'], tag_id, tag_open, tag_close)}"
76
+ )
77
+
78
+
79
  initial_text = "It is not something to be ashamed of: it is no different from the <d>personal fears</d> and <tm>dislikes</tm> of other things that <t>manny peopl</t> have."
80
 
81
  with gr.Blocks() as demo:
 
108
  show_label=True,
109
  info="Insert one or more tags to mark the end of a highlighted section.",
110
  )
111
+ gr.Markdown(
112
+ """
113
+ ### Example:
114
+
115
+ The following text is tagged using the parameters above to mark spans that will be highlighted.
116
+
117
+ Both the tagged text and the highlighted text are editable, so you can see how the changes in one affect the other.
118
+
119
+ Highlights will disappear if the highlighted text is edited. Modals will appear upon focus, change, and blur events on the highlighted text.
120
+ """
121
+ )
122
  with gr.Row():
123
+ tagged = gr.Textbox(
124
  initial_text,
125
  interactive=True,
126
+ label="Tagged text",
127
  show_label=True,
128
  info="Tagged text using the format above to mark spans that will be highlighted.",
129
  )
130
+ high = HighlightedTextbox(
131
  convert_tagged_text_to_highlighted_text(
132
+ tagged.value, tag_id.value, tag_open.value, tag_close.value
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  ),
134
  interactive=True,
135
+ label="Highlighted text",
136
+ info="Textbox containing editable text with custom highlights.",
137
  show_legend=True,
138
  show_label=True,
139
  legend_label="Legend:",
140
  show_legend_label=True,
141
  )
 
 
 
 
 
 
 
142
 
143
  # Functions
144
 
145
+ tagged.input(
146
  fn=convert_tagged_text_to_highlighted_text,
147
+ inputs=[tagged, tag_id, tag_open, tag_close],
148
+ outputs=high,
149
  )
150
+ high.input(
151
  fn=convert_highlighted_text_to_tagged_text,
152
+ inputs=[high, tag_id, tag_open, tag_close],
153
+ outputs=tagged,
154
+ )
155
+ high.focus(
156
+ fn=show_info,
157
+ inputs=[high, tag_id, tag_open, tag_close, gr.State("Focus")],
158
+ outputs=None,
159
+ )
160
+ high.change(
161
+ fn=show_info,
162
+ inputs=[high, tag_id, tag_open, tag_close, gr.State("Change")],
163
+ outputs=None,
164
+ )
165
+ high.blur(
166
+ fn=show_info,
167
+ inputs=[high, tag_id, tag_open, tag_close, gr.State("Blur")],
168
+ outputs=None,
169
  )
170
 
171
  if __name__ == "__main__":
 
201
 
202
  The code snippet below is accurate in cases where the component is used as both an input and an output.
203
 
204
+ - **As output:** Should return, list of (word, category) tuples, or a dictionary of two keys: "id", and "data", which is a list of (word, category) tuples.
205
 
206
  ```python
207
  def predict(
src/frontend/HighlightedTextbox.svelte CHANGED
@@ -55,14 +55,14 @@
55
 
56
  function set_text_from_value(as_output: boolean): void {
57
  if (value.length > 0 && as_output) {
58
- el_text = value.map(([text, _]) => text).join(" ");
59
  marked_el_text = value.map(([text, category]) => {
60
  if (category !== null) {
61
  return `<mark class="hl ${category}" style="background-color:${_color_map[category].secondary}">${text}</mark>`;
62
  } else {
63
  return text;
64
  }
65
- }).join(" ") + " ";
66
  }
67
  }
68
 
@@ -70,8 +70,8 @@
70
  $: set_text_from_value(true);
71
 
72
  const dispatch = createEventDispatcher<{
73
- change: string;
74
- input: string;
75
  submit: undefined;
76
  blur: undefined;
77
  select: SelectData;
@@ -83,18 +83,18 @@
83
  });
84
 
85
  function handle_change(): void {
86
- dispatch("change", marked_el_text);
 
 
87
  if (!value_is_output) {
88
- dispatch("input");
89
  }
90
- checkAndRemoveHighlight();
91
  }
92
  afterUpdate(() => {
93
  set_color_map();
94
  set_text_from_value(value_is_output);
95
  value_is_output = false;
96
  });
97
- $: marked_el_text, handle_change();
98
 
99
  function set_value_from_marked_span(): void {
100
  let new_value: [string, string | null][] = [];
@@ -102,8 +102,12 @@
102
  let category = null;
103
  let in_tag = false;
104
  let tag = "";
105
- for (let i = 0; i < marked_el_text.length; i++) {
106
- let char = marked_el_text[i];
 
 
 
 
107
  if (char === "<") {
108
  in_tag = true;
109
  if (text) {
@@ -113,8 +117,9 @@
113
  category = null;
114
  } else if (char === ">") {
115
  in_tag = false;
116
- if (tag.startsWith("mark")) {
117
- category = tag.match(/class="hl ([^"]+)"/)?.[1] || null;
 
118
  }
119
  tag = "";
120
  } else if (in_tag) {
@@ -168,8 +173,6 @@
168
  newSelection.addRange(range);
169
  }
170
  }
171
- set_value_from_marked_span();
172
- dispatch("change", marked_el_text);
173
  }
174
  </script>
175
 
@@ -214,9 +217,9 @@
214
  on:keypress
215
  on:select
216
  on:scroll
217
- on:input
218
  on:focus
219
- on:change={checkAndRemoveHighlight}
220
  />
221
  {/if}
222
  </label>
@@ -268,6 +271,7 @@
268
  word-break: break-word;
269
  border: var(--input-border-width) solid var(--input-border-color);
270
  cursor: text;
 
271
  }
272
 
273
  .textfield:focus {
 
55
 
56
  function set_text_from_value(as_output: boolean): void {
57
  if (value.length > 0 && as_output) {
58
+ el_text = value.map(([text, _]) => text).join("");
59
  marked_el_text = value.map(([text, category]) => {
60
  if (category !== null) {
61
  return `<mark class="hl ${category}" style="background-color:${_color_map[category].secondary}">${text}</mark>`;
62
  } else {
63
  return text;
64
  }
65
+ }).join("");
66
  }
67
  }
68
 
 
70
  $: set_text_from_value(true);
71
 
72
  const dispatch = createEventDispatcher<{
73
+ change: [string, string | null][];
74
+ input: [string, string | null][];
75
  submit: undefined;
76
  blur: undefined;
77
  select: SelectData;
 
83
  });
84
 
85
  function handle_change(): void {
86
+ checkAndRemoveHighlight();
87
+ set_value_from_marked_span();
88
+ dispatch("change", value);
89
  if (!value_is_output) {
90
+ dispatch("input", value);
91
  }
 
92
  }
93
  afterUpdate(() => {
94
  set_color_map();
95
  set_text_from_value(value_is_output);
96
  value_is_output = false;
97
  });
 
98
 
99
  function set_value_from_marked_span(): void {
100
  let new_value: [string, string | null][] = [];
 
102
  let category = null;
103
  let in_tag = false;
104
  let tag = "";
105
+ // Replace &nbsp;, &amp;, &lt;, &gt; with their corresponding characters
106
+ let clean_marked_text = marked_el_text.replace(/&nbsp;|&amp;|&lt;|&gt;/g, function(m) {
107
+ return {"&nbsp;":" ", "&amp;":"&", "&lt;":"<", "&gt;":">"}[m];
108
+ });
109
+ for (let i = 0; i < clean_marked_text.length; i++) {
110
+ let char = clean_marked_text[i];
111
  if (char === "<") {
112
  in_tag = true;
113
  if (text) {
 
117
  category = null;
118
  } else if (char === ">") {
119
  in_tag = false;
120
+ if (tag.slice(0, 4) === "mark") {
121
+ let match = /class="hl ([^"]+)"/.exec(tag);
122
+ category = match ? match[1] : null;
123
  }
124
  tag = "";
125
  } else if (in_tag) {
 
173
  newSelection.addRange(range);
174
  }
175
  }
 
 
176
  }
177
  </script>
178
 
 
217
  on:keypress
218
  on:select
219
  on:scroll
220
+ on:input={handle_change}
221
  on:focus
222
+ on:change={handle_change}
223
  />
224
  {/if}
225
  </label>
 
271
  word-break: break-word;
272
  border: var(--input-border-width) solid var(--input-border-color);
273
  cursor: text;
274
+ white-space: break-spaces;
275
  }
276
 
277
  .textfield:focus {
src/pyproject.toml CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
8
 
9
  [project]
10
  name = "gradio_highlightedtextbox"
11
- version = "0.0.7"
12
  description = "Editable Gradio textarea supporting highlighting"
13
  readme = "README.md"
14
  license = "mit"
@@ -39,7 +39,7 @@ dev = ["build", "twine"]
39
  space = "https://huggingface.co/spaces/gsarti/gradio_highlightedtextbox"
40
 
41
  [tool.hatch.build]
42
- artifacts = ["/backend/gradio_highlightedtextbox/templates", "*.pyi", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "Users/gsarti/Documents/projects/highlightedtextbox/backend/gradio_highlightedtextbox/templates", "Users/gsarti/Documents/projects/highlightedtextbox/backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates"]
43
 
44
  [tool.hatch.build.targets.wheel]
45
  packages = ["/backend/gradio_highlightedtextbox"]
 
8
 
9
  [project]
10
  name = "gradio_highlightedtextbox"
11
+ version = "0.0.8"
12
  description = "Editable Gradio textarea supporting highlighting"
13
  readme = "README.md"
14
  license = "mit"
 
39
  space = "https://huggingface.co/spaces/gsarti/gradio_highlightedtextbox"
40
 
41
  [tool.hatch.build]
42
+ artifacts = ["/backend/gradio_highlightedtextbox/templates", "*.pyi", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "Users/gsarti/Documents/projects/highlightedtextbox/backend/gradio_highlightedtextbox/templates", "Users/gsarti/Documents/projects/highlightedtextbox/backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates"]
43
 
44
  [tool.hatch.build.targets.wheel]
45
  packages = ["/backend/gradio_highlightedtextbox"]