edgargg commited on
Commit
39b8211
1 Parent(s): 9fdeca9

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,19 +1,3 @@
1
- ---
2
- tags:
3
- - gradio-custom-component
4
- - gradio-template-Image
5
- - bounding box
6
- - annotator
7
- - annotate
8
- - boxes
9
- title: gradio_image_annotation V0.2.2
10
- colorFrom: yellow
11
- colorTo: green
12
- sdk: docker
13
- pinned: false
14
- license: apache-2.0
15
- short_description: A Gradio component for image annotation
16
- ---
17
 
18
  # `gradio_image_annotation`
19
  <a href="https://pypi.org/project/gradio_image_annotation/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_image_annotation"></a>
@@ -55,18 +39,32 @@ example_annotation = {
55
  ]
56
  }
57
 
58
- example_crop = {
59
- "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png",
60
- "boxes": [
61
- {
62
- "xmin": 30,
63
- "ymin": 70,
64
- "xmax": 530,
65
- "ymax": 500,
66
- "color": (100, 200, 255)
67
- }
68
- ]
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
 
72
  def crop(annotations):
@@ -97,7 +95,7 @@ with gr.Blocks() as demo:
97
  with gr.Tab("Crop"):
98
  with gr.Row():
99
  annotator_crop = image_annotator(
100
- example_crop,
101
  image_type="numpy",
102
  disable_edit_boxes=True,
103
  single_box=True,
@@ -106,6 +104,7 @@ with gr.Blocks() as demo:
106
  button_crop = gr.Button("Crop")
107
  button_crop.click(crop, annotator_crop, image_crop)
108
 
 
109
 
110
  if __name__ == "__main__":
111
  demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
  # `gradio_image_annotation`
3
  <a href="https://pypi.org/project/gradio_image_annotation/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_image_annotation"></a>
 
39
  ]
40
  }
41
 
42
+ examples_crop = [
43
+ {
44
+ "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png",
45
+ "boxes": [
46
+ {
47
+ "xmin": 30,
48
+ "ymin": 70,
49
+ "xmax": 530,
50
+ "ymax": 500,
51
+ "color": (100, 200, 255),
52
+ }
53
+ ],
54
+ },
55
+ {
56
+ "image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png",
57
+ "boxes": [
58
+ {
59
+ "xmin": 636,
60
+ "ymin": 575,
61
+ "xmax": 801,
62
+ "ymax": 697,
63
+ "color": (255, 0, 0),
64
+ },
65
+ ],
66
+ },
67
+ ]
68
 
69
 
70
  def crop(annotations):
 
95
  with gr.Tab("Crop"):
96
  with gr.Row():
97
  annotator_crop = image_annotator(
98
+ examples_crop[0],
99
  image_type="numpy",
100
  disable_edit_boxes=True,
101
  single_box=True,
 
104
  button_crop = gr.Button("Crop")
105
  button_crop.click(crop, annotator_crop, image_crop)
106
 
107
+ gr.Examples(examples_crop, annotator_crop)
108
 
109
  if __name__ == "__main__":
110
  demo.launch()
space.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  from app import demo as app
3
  import os
@@ -63,18 +64,32 @@ example_annotation = {
63
  ]
64
  }
65
 
66
- example_crop = {
67
- "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png",
68
- "boxes": [
69
- {
70
- "xmin": 30,
71
- "ymin": 70,
72
- "xmax": 530,
73
- "ymax": 500,
74
- "color": (100, 200, 255)
75
- }
76
- ]
77
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
 
80
  def crop(annotations):
@@ -105,7 +120,7 @@ with gr.Blocks() as demo:
105
  with gr.Tab("Crop"):
106
  with gr.Row():
107
  annotator_crop = image_annotator(
108
- example_crop,
109
  image_type="numpy",
110
  disable_edit_boxes=True,
111
  single_box=True,
@@ -114,6 +129,7 @@ with gr.Blocks() as demo:
114
  button_crop = gr.Button("Crop")
115
  button_crop.click(crop, annotator_crop, image_crop)
116
 
 
117
 
118
  if __name__ == "__main__":
119
  demo.launch()
 
1
+
2
  import gradio as gr
3
  from app import demo as app
4
  import os
 
64
  ]
65
  }
66
 
67
+ examples_crop = [
68
+ {
69
+ "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png",
70
+ "boxes": [
71
+ {
72
+ "xmin": 30,
73
+ "ymin": 70,
74
+ "xmax": 530,
75
+ "ymax": 500,
76
+ "color": (100, 200, 255),
77
+ }
78
+ ],
79
+ },
80
+ {
81
+ "image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png",
82
+ "boxes": [
83
+ {
84
+ "xmin": 636,
85
+ "ymin": 575,
86
+ "xmax": 801,
87
+ "ymax": 697,
88
+ "color": (255, 0, 0),
89
+ },
90
+ ],
91
+ },
92
+ ]
93
 
94
 
95
  def crop(annotations):
 
120
  with gr.Tab("Crop"):
121
  with gr.Row():
122
  annotator_crop = image_annotator(
123
+ examples_crop[0],
124
  image_type="numpy",
125
  disable_edit_boxes=True,
126
  single_box=True,
 
129
  button_crop = gr.Button("Crop")
130
  button_crop.click(crop, annotator_crop, image_crop)
131
 
132
+ gr.Examples(examples_crop, annotator_crop)
133
 
134
  if __name__ == "__main__":
135
  demo.launch()
src/README.md CHANGED
@@ -39,18 +39,32 @@ example_annotation = {
39
  ]
40
  }
41
 
42
- example_crop = {
43
- "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png",
44
- "boxes": [
45
- {
46
- "xmin": 30,
47
- "ymin": 70,
48
- "xmax": 530,
49
- "ymax": 500,
50
- "color": (100, 200, 255)
51
- }
52
- ]
53
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
 
56
  def crop(annotations):
@@ -81,7 +95,7 @@ with gr.Blocks() as demo:
81
  with gr.Tab("Crop"):
82
  with gr.Row():
83
  annotator_crop = image_annotator(
84
- example_crop,
85
  image_type="numpy",
86
  disable_edit_boxes=True,
87
  single_box=True,
@@ -90,6 +104,7 @@ with gr.Blocks() as demo:
90
  button_crop = gr.Button("Crop")
91
  button_crop.click(crop, annotator_crop, image_crop)
92
 
 
93
 
94
  if __name__ == "__main__":
95
  demo.launch()
 
39
  ]
40
  }
41
 
42
+ examples_crop = [
43
+ {
44
+ "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png",
45
+ "boxes": [
46
+ {
47
+ "xmin": 30,
48
+ "ymin": 70,
49
+ "xmax": 530,
50
+ "ymax": 500,
51
+ "color": (100, 200, 255),
52
+ }
53
+ ],
54
+ },
55
+ {
56
+ "image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png",
57
+ "boxes": [
58
+ {
59
+ "xmin": 636,
60
+ "ymin": 575,
61
+ "xmax": 801,
62
+ "ymax": 697,
63
+ "color": (255, 0, 0),
64
+ },
65
+ ],
66
+ },
67
+ ]
68
 
69
 
70
  def crop(annotations):
 
95
  with gr.Tab("Crop"):
96
  with gr.Row():
97
  annotator_crop = image_annotator(
98
+ examples_crop[0],
99
  image_type="numpy",
100
  disable_edit_boxes=True,
101
  single_box=True,
 
104
  button_crop = gr.Button("Crop")
105
  button_crop.click(crop, annotator_crop, image_crop)
106
 
107
+ gr.Examples(examples_crop, annotator_crop)
108
 
109
  if __name__ == "__main__":
110
  demo.launch()
src/backend/gradio_image_annotation/templates/component/index.js CHANGED
The diff for this file is too large to render. See raw diff
 
src/backend/gradio_image_annotation/templates/example/index.js CHANGED
@@ -1,3522 +1,113 @@
1
- const { setContext: go, getContext: Tn } = window.__gradio__svelte__internal, In = "WORKER_PROXY_CONTEXT_KEY";
2
- function On() {
3
- return Tn(In);
4
- }
5
- function Un(n) {
6
- return n.host === window.location.host || n.host === "localhost:7860" || n.host === "127.0.0.1:7860" || // Ref: https://github.com/gradio-app/gradio/blob/v3.32.0/js/app/src/Index.svelte#L194
7
- n.host === "lite.local";
8
- }
9
- function Wn(n, e) {
10
- const t = e.toLowerCase();
11
- for (const [i, s] of Object.entries(n))
12
- if (i.toLowerCase() === t)
13
- return s;
14
- }
15
- function Vn(n) {
16
- if (n == null)
17
- return !1;
18
- const e = new URL(n, window.location.href);
19
- return !(!Un(e) || e.protocol !== "http:" && e.protocol !== "https:");
20
- }
21
- async function jn(n) {
22
- if (n == null || !Vn(n))
23
- return n;
24
- const e = On();
25
- if (e == null)
26
- return n;
27
- const i = new URL(n, window.location.href).pathname;
28
- return e.httpRequest({
29
- method: "GET",
30
- path: i,
31
- headers: {},
32
- query_string: ""
33
- }).then((s) => {
34
- if (s.status !== 200)
35
- throw new Error(`Failed to get file ${i} from the Wasm worker.`);
36
- const o = new Blob([s.body], {
37
- type: Wn(s.headers, "content-type")
38
- });
39
- return URL.createObjectURL(o);
40
- });
41
- }
42
- const {
43
- SvelteComponent: Nn,
44
- append: ee,
45
- attr: p,
46
- detach: Pn,
47
- init: Fn,
48
- insert: Kn,
49
- noop: rt,
50
- safe_not_equal: Gn,
51
- set_style: te,
52
- svg_element: Z
53
- } = window.__gradio__svelte__internal;
54
- function Jn(n) {
55
- let e, t, i, s, o, r, a, l, u;
56
- return {
57
- c() {
58
- e = Z("svg"), t = Z("rect"), i = Z("rect"), s = Z("rect"), o = Z("rect"), r = Z("line"), a = Z("line"), l = Z("line"), u = Z("line"), p(t, "x", "2"), p(t, "y", "2"), p(t, "width", "5"), p(t, "height", "5"), p(t, "rx", "1"), p(t, "ry", "1"), p(t, "stroke-width", "2"), p(t, "fill", "none"), p(i, "x", "17"), p(i, "y", "2"), p(i, "width", "5"), p(i, "height", "5"), p(i, "rx", "1"), p(i, "ry", "1"), p(i, "stroke-width", "2"), p(i, "fill", "none"), p(s, "x", "2"), p(s, "y", "17"), p(s, "width", "5"), p(s, "height", "5"), p(s, "rx", "1"), p(s, "ry", "1"), p(s, "stroke-width", "2"), p(s, "fill", "none"), p(o, "x", "17"), p(o, "y", "17"), p(o, "width", "5"), p(o, "height", "5"), p(o, "rx", "1"), p(o, "ry", "1"), p(o, "stroke-width", "2"), p(o, "fill", "none"), p(r, "x1", "7.5"), p(r, "y1", "4.5"), p(r, "x2", "16"), p(r, "y2", "4.5"), te(r, "stroke-width", "2px"), p(a, "x1", "7.5"), p(a, "y1", "19.5"), p(a, "x2", "16"), p(a, "y2", "19.5"), te(a, "stroke-width", "2px"), p(l, "x1", "4.5"), p(l, "y1", "8"), p(l, "x2", "4.5"), p(l, "y2", "16"), te(l, "stroke-width", "2px"), p(u, "x1", "19.5"), p(u, "y1", "8"), p(u, "x2", "19.5"), p(u, "y2", "16"), te(u, "stroke-width", "2px"), p(e, "width", "100%"), p(e, "height", "100%"), p(e, "viewBox", "0 0 24 24"), p(e, "version", "1.1"), p(e, "xmlns", "http://www.w3.org/2000/svg"), p(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), p(e, "xml:space", "preserve"), p(e, "stroke", "currentColor"), te(e, "fill-rule", "evenodd"), te(e, "clip-rule", "evenodd"), te(e, "stroke-linecap", "round"), te(e, "stroke-linejoin", "round");
59
- },
60
- m(c, f) {
61
- Kn(c, e, f), ee(e, t), ee(e, i), ee(e, s), ee(e, o), ee(e, r), ee(e, a), ee(e, l), ee(e, u);
62
- },
63
- p: rt,
64
- i: rt,
65
- o: rt,
66
- d(c) {
67
- c && Pn(e);
68
- }
69
- };
70
- }
71
- class Zn extends Nn {
72
- constructor(e) {
73
- super(), Fn(this, e, null, Jn, Gn, {});
74
- }
75
- }
76
- const {
77
- SvelteComponent: Qn,
78
- append: $n,
79
- attr: N,
80
- detach: ei,
81
- init: ti,
82
- insert: ni,
83
- noop: ft,
84
- safe_not_equal: ii,
85
- set_style: We,
86
- svg_element: Yt
87
- } = window.__gradio__svelte__internal;
88
- function si(n) {
89
- let e, t;
90
- return {
91
- c() {
92
- e = Yt("svg"), t = Yt("path"), N(t, "d", "M 14.4 2.85 V 11.1 V 3.95 C 14.4 3.0387 15.1388 2.3 16.05 2.3 C 16.9612 2.3 17.7 3.0387 17.7 3.95 V 11.1 V 7.25 C 17.7 6.3387 18.4388 5.6 19.35 5.6 C 20.2612 5.6 21 6.3387 21 7.25 V 16.6 C 21 20.2451 18.0451 23.2 14.4 23.2 H 13.16 C 11.4831 23.2 9.8692 22.5618 8.6459 21.4149 L 3.1915 16.3014 C 2.403 15.5622 2.3829 14.3171 3.1472 13.5528 C 3.8943 12.8057 5.1057 12.8057 5.8528 13.5528 L 7.8 15.5 V 6.15 C 7.8 5.2387 8.5387 4.5 9.45 4.5 C 10.3612 4.5 11.1 5.2387 11.1 6.15 V 11.1 V 2.85 C 11.1 1.9387 11.8388 1.2 12.75 1.2 C 13.6612 1.2 14.4 1.9387 14.4 2.85 Z"), N(t, "fill", "none"), N(t, "stroke-width", "2"), N(e, "width", "100%"), N(e, "height", "100%"), N(e, "viewBox", "0 0 24 24"), N(e, "version", "1.1"), N(e, "xmlns", "http://www.w3.org/2000/svg"), N(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), N(e, "xml:space", "preserve"), N(e, "stroke", "currentColor"), We(e, "fill-rule", "evenodd"), We(e, "clip-rule", "evenodd"), We(e, "stroke-linecap", "round"), We(e, "stroke-linejoin", "round");
93
- },
94
- m(i, s) {
95
- ni(i, e, s), $n(e, t);
96
- },
97
- p: ft,
98
- i: ft,
99
- o: ft,
100
- d(i) {
101
- i && ei(e);
102
- }
103
- };
104
- }
105
- class li extends Qn {
106
- constructor(e) {
107
- super(), ti(this, e, null, si, ii, {});
108
- }
109
- }
110
- const {
111
- SvelteComponent: oi,
112
- append: ai,
113
- attr: P,
114
- detach: ri,
115
- init: fi,
116
- insert: ci,
117
- noop: ct,
118
- safe_not_equal: ui,
119
- set_style: Ve,
120
- svg_element: qt
121
- } = window.__gradio__svelte__internal;
122
- function hi(n) {
123
- let e, t;
124
- return {
125
- c() {
126
- e = qt("svg"), t = qt("path"), P(t, "d", "M10 12L14 16M14 12L10 16M4 6H20M16 6L15.7294 5.18807C15.4671 4.40125 15.3359 4.00784 15.0927 3.71698C14.8779 3.46013 14.6021 3.26132 14.2905 3.13878C13.9376 3 13.523 3 12.6936 3H11.3064C10.477 3 10.0624 3 9.70951 3.13878C9.39792 3.26132 9.12208 3.46013 8.90729 3.71698C8.66405 4.00784 8.53292 4.40125 8.27064 5.18807L8 6M18 6V16.2C18 17.8802 18 18.7202 17.673 19.362C17.3854 19.9265 16.9265 20.3854 16.362 20.673C15.7202 21 14.8802 21 13.2 21H10.8C9.11984 21 8.27976 21 7.63803 20.673C7.07354 20.3854 6.6146 19.9265 6.32698 19.362C6 18.7202 6 17.8802 6 16.2V6"), P(t, "fill", "none"), P(t, "stroke-width", "2"), P(e, "width", "100%"), P(e, "height", "100%"), P(e, "viewBox", "0 0 24 24"), P(e, "version", "1.1"), P(e, "xmlns", "http://www.w3.org/2000/svg"), P(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), P(e, "xml:space", "preserve"), P(e, "stroke", "currentColor"), Ve(e, "fill-rule", "evenodd"), Ve(e, "clip-rule", "evenodd"), Ve(e, "stroke-linecap", "round"), Ve(e, "stroke-linejoin", "round");
127
- },
128
- m(i, s) {
129
- ci(i, e, s), ai(e, t);
130
- },
131
- p: ct,
132
- i: ct,
133
- o: ct,
134
- d(i) {
135
- i && ri(e);
136
- }
137
- };
138
- }
139
- class mi extends oi {
140
- constructor(e) {
141
- super(), fi(this, e, null, hi, ui, {});
142
- }
143
- }
144
- const {
145
- SvelteComponent: _i,
146
- attr: di,
147
- create_slot: bi,
148
- detach: gi,
149
- element: wi,
150
- get_all_dirty_from_scope: yi,
151
- get_slot_changes: vi,
152
- init: ki,
153
- insert: pi,
154
- safe_not_equal: xi,
155
- transition_in: Ci,
156
- transition_out: Si,
157
- update_slot_base: zi
158
- } = window.__gradio__svelte__internal;
159
- function Bi(n) {
160
- let e, t;
161
- const i = (
162
- /*#slots*/
163
- n[1].default
164
- ), s = bi(
165
- i,
166
- n,
167
- /*$$scope*/
168
- n[0],
169
- null
170
- );
171
- return {
172
- c() {
173
- e = wi("div"), s && s.c(), di(e, "class", "svelte-1hnfib2");
174
- },
175
- m(o, r) {
176
- pi(o, e, r), s && s.m(e, null), t = !0;
177
- },
178
- p(o, [r]) {
179
- s && s.p && (!t || r & /*$$scope*/
180
- 1) && zi(
181
- s,
182
- i,
183
- o,
184
- /*$$scope*/
185
- o[0],
186
- t ? vi(
187
- i,
188
- /*$$scope*/
189
- o[0],
190
- r,
191
- null
192
- ) : yi(
193
- /*$$scope*/
194
- o[0]
195
- ),
196
- null
197
- );
198
- },
199
- i(o) {
200
- t || (Ci(s, o), t = !0);
201
- },
202
- o(o) {
203
- Si(s, o), t = !1;
204
- },
205
- d(o) {
206
- o && gi(e), s && s.d(o);
207
- }
208
- };
209
- }
210
- function Ei(n, e, t) {
211
- let { $$slots: i = {}, $$scope: s } = e;
212
- return n.$$set = (o) => {
213
- "$$scope" in o && t(0, s = o.$$scope);
214
- }, [s, i];
215
- }
216
- class Ai extends _i {
217
- constructor(e) {
218
- super(), ki(this, e, Ei, Bi, xi, {});
219
- }
220
- }
221
- const {
222
- SvelteComponent: Mi,
223
- attr: Dt,
224
- check_outros: Ri,
225
- create_component: Hi,
226
- create_slot: Xi,
227
- destroy_component: Yi,
228
- detach: Ke,
229
- element: qi,
230
- empty: Di,
231
- get_all_dirty_from_scope: Li,
232
- get_slot_changes: Ti,
233
- group_outros: Ii,
234
- init: Oi,
235
- insert: Ge,
236
- mount_component: Ui,
237
- safe_not_equal: Wi,
238
- set_data: Vi,
239
- space: ji,
240
- text: Ni,
241
- toggle_class: me,
242
- transition_in: pe,
243
- transition_out: Je,
244
- update_slot_base: Pi
245
- } = window.__gradio__svelte__internal;
246
- function Lt(n) {
247
- let e, t;
248
- return e = new Ai({
249
- props: {
250
- $$slots: { default: [Fi] },
251
- $$scope: { ctx: n }
252
- }
253
- }), {
254
- c() {
255
- Hi(e.$$.fragment);
256
- },
257
- m(i, s) {
258
- Ui(e, i, s), t = !0;
259
- },
260
- p(i, s) {
261
- const o = {};
262
- s & /*$$scope, info*/
263
- 10 && (o.$$scope = { dirty: s, ctx: i }), e.$set(o);
264
- },
265
- i(i) {
266
- t || (pe(e.$$.fragment, i), t = !0);
267
- },
268
- o(i) {
269
- Je(e.$$.fragment, i), t = !1;
270
- },
271
- d(i) {
272
- Yi(e, i);
273
- }
274
- };
275
- }
276
- function Fi(n) {
277
- let e;
278
- return {
279
- c() {
280
- e = Ni(
281
- /*info*/
282
- n[1]
283
- );
284
- },
285
- m(t, i) {
286
- Ge(t, e, i);
287
- },
288
- p(t, i) {
289
- i & /*info*/
290
- 2 && Vi(
291
- e,
292
- /*info*/
293
- t[1]
294
- );
295
- },
296
- d(t) {
297
- t && Ke(e);
298
- }
299
- };
300
- }
301
- function Ki(n) {
302
- let e, t, i, s;
303
- const o = (
304
- /*#slots*/
305
- n[2].default
306
- ), r = Xi(
307
- o,
308
- n,
309
- /*$$scope*/
310
- n[3],
311
- null
312
- );
313
- let a = (
314
- /*info*/
315
- n[1] && Lt(n)
316
- );
317
- return {
318
- c() {
319
- e = qi("span"), r && r.c(), t = ji(), a && a.c(), i = Di(), Dt(e, "data-testid", "block-info"), Dt(e, "class", "svelte-22c38v"), me(e, "sr-only", !/*show_label*/
320
- n[0]), me(e, "hide", !/*show_label*/
321
- n[0]), me(
322
- e,
323
- "has-info",
324
- /*info*/
325
- n[1] != null
326
- );
327
- },
328
- m(l, u) {
329
- Ge(l, e, u), r && r.m(e, null), Ge(l, t, u), a && a.m(l, u), Ge(l, i, u), s = !0;
330
- },
331
- p(l, [u]) {
332
- r && r.p && (!s || u & /*$$scope*/
333
- 8) && Pi(
334
- r,
335
- o,
336
- l,
337
- /*$$scope*/
338
- l[3],
339
- s ? Ti(
340
- o,
341
- /*$$scope*/
342
- l[3],
343
- u,
344
- null
345
- ) : Li(
346
- /*$$scope*/
347
- l[3]
348
- ),
349
- null
350
- ), (!s || u & /*show_label*/
351
- 1) && me(e, "sr-only", !/*show_label*/
352
- l[0]), (!s || u & /*show_label*/
353
- 1) && me(e, "hide", !/*show_label*/
354
- l[0]), (!s || u & /*info*/
355
- 2) && me(
356
- e,
357
- "has-info",
358
- /*info*/
359
- l[1] != null
360
- ), /*info*/
361
- l[1] ? a ? (a.p(l, u), u & /*info*/
362
- 2 && pe(a, 1)) : (a = Lt(l), a.c(), pe(a, 1), a.m(i.parentNode, i)) : a && (Ii(), Je(a, 1, 1, () => {
363
- a = null;
364
- }), Ri());
365
- },
366
- i(l) {
367
- s || (pe(r, l), pe(a), s = !0);
368
- },
369
- o(l) {
370
- Je(r, l), Je(a), s = !1;
371
- },
372
- d(l) {
373
- l && (Ke(e), Ke(t), Ke(i)), r && r.d(l), a && a.d(l);
374
- }
375
- };
376
- }
377
- function Gi(n, e, t) {
378
- let { $$slots: i = {}, $$scope: s } = e, { show_label: o = !0 } = e, { info: r = void 0 } = e;
379
- return n.$$set = (a) => {
380
- "show_label" in a && t(0, o = a.show_label), "info" in a && t(1, r = a.info), "$$scope" in a && t(3, s = a.$$scope);
381
- }, [o, r, i, s];
382
- }
383
- class hn extends Mi {
384
- constructor(e) {
385
- super(), Oi(this, e, Gi, Ki, Wi, { show_label: 0, info: 1 });
386
- }
387
- }
388
- const {
389
- SvelteComponent: Ji,
390
- append: Zi,
391
- attr: _e,
392
- detach: Qi,
393
- init: $i,
394
- insert: es,
395
- noop: ut,
396
- safe_not_equal: ts,
397
- svg_element: Tt
398
- } = window.__gradio__svelte__internal;
399
- function ns(n) {
400
- let e, t;
401
- return {
402
- c() {
403
- e = Tt("svg"), t = Tt("path"), _e(t, "d", "M5 8l4 4 4-4z"), _e(e, "class", "dropdown-arrow svelte-145leq6"), _e(e, "xmlns", "http://www.w3.org/2000/svg"), _e(e, "width", "100%"), _e(e, "height", "100%"), _e(e, "viewBox", "0 0 18 18");
404
- },
405
- m(i, s) {
406
- es(i, e, s), Zi(e, t);
407
- },
408
- p: ut,
409
- i: ut,
410
- o: ut,
411
- d(i) {
412
- i && Qi(e);
413
- }
414
- };
415
- }
416
- class is extends Ji {
417
- constructor(e) {
418
- super(), $i(this, e, null, ns, ts, {});
419
- }
420
- }
421
- const ss = [
422
- { color: "red", primary: 600, secondary: 100 },
423
- { color: "green", primary: 600, secondary: 100 },
424
- { color: "blue", primary: 600, secondary: 100 },
425
- { color: "yellow", primary: 500, secondary: 100 },
426
- { color: "purple", primary: 600, secondary: 100 },
427
- { color: "teal", primary: 600, secondary: 100 },
428
- { color: "orange", primary: 600, secondary: 100 },
429
- { color: "cyan", primary: 600, secondary: 100 },
430
- { color: "lime", primary: 500, secondary: 100 },
431
- { color: "pink", primary: 600, secondary: 100 }
432
- ], It = {
433
- inherit: "inherit",
434
- current: "currentColor",
435
- transparent: "transparent",
436
- black: "#000",
437
- white: "#fff",
438
- slate: {
439
- 50: "#f8fafc",
440
- 100: "#f1f5f9",
441
- 200: "#e2e8f0",
442
- 300: "#cbd5e1",
443
- 400: "#94a3b8",
444
- 500: "#64748b",
445
- 600: "#475569",
446
- 700: "#334155",
447
- 800: "#1e293b",
448
- 900: "#0f172a",
449
- 950: "#020617"
450
- },
451
- gray: {
452
- 50: "#f9fafb",
453
- 100: "#f3f4f6",
454
- 200: "#e5e7eb",
455
- 300: "#d1d5db",
456
- 400: "#9ca3af",
457
- 500: "#6b7280",
458
- 600: "#4b5563",
459
- 700: "#374151",
460
- 800: "#1f2937",
461
- 900: "#111827",
462
- 950: "#030712"
463
- },
464
- zinc: {
465
- 50: "#fafafa",
466
- 100: "#f4f4f5",
467
- 200: "#e4e4e7",
468
- 300: "#d4d4d8",
469
- 400: "#a1a1aa",
470
- 500: "#71717a",
471
- 600: "#52525b",
472
- 700: "#3f3f46",
473
- 800: "#27272a",
474
- 900: "#18181b",
475
- 950: "#09090b"
476
- },
477
- neutral: {
478
- 50: "#fafafa",
479
- 100: "#f5f5f5",
480
- 200: "#e5e5e5",
481
- 300: "#d4d4d4",
482
- 400: "#a3a3a3",
483
- 500: "#737373",
484
- 600: "#525252",
485
- 700: "#404040",
486
- 800: "#262626",
487
- 900: "#171717",
488
- 950: "#0a0a0a"
489
- },
490
- stone: {
491
- 50: "#fafaf9",
492
- 100: "#f5f5f4",
493
- 200: "#e7e5e4",
494
- 300: "#d6d3d1",
495
- 400: "#a8a29e",
496
- 500: "#78716c",
497
- 600: "#57534e",
498
- 700: "#44403c",
499
- 800: "#292524",
500
- 900: "#1c1917",
501
- 950: "#0c0a09"
502
- },
503
- red: {
504
- 50: "#fef2f2",
505
- 100: "#fee2e2",
506
- 200: "#fecaca",
507
- 300: "#fca5a5",
508
- 400: "#f87171",
509
- 500: "#ef4444",
510
- 600: "#dc2626",
511
- 700: "#b91c1c",
512
- 800: "#991b1b",
513
- 900: "#7f1d1d",
514
- 950: "#450a0a"
515
- },
516
- orange: {
517
- 50: "#fff7ed",
518
- 100: "#ffedd5",
519
- 200: "#fed7aa",
520
- 300: "#fdba74",
521
- 400: "#fb923c",
522
- 500: "#f97316",
523
- 600: "#ea580c",
524
- 700: "#c2410c",
525
- 800: "#9a3412",
526
- 900: "#7c2d12",
527
- 950: "#431407"
528
- },
529
- amber: {
530
- 50: "#fffbeb",
531
- 100: "#fef3c7",
532
- 200: "#fde68a",
533
- 300: "#fcd34d",
534
- 400: "#fbbf24",
535
- 500: "#f59e0b",
536
- 600: "#d97706",
537
- 700: "#b45309",
538
- 800: "#92400e",
539
- 900: "#78350f",
540
- 950: "#451a03"
541
- },
542
- yellow: {
543
- 50: "#fefce8",
544
- 100: "#fef9c3",
545
- 200: "#fef08a",
546
- 300: "#fde047",
547
- 400: "#facc15",
548
- 500: "#eab308",
549
- 600: "#ca8a04",
550
- 700: "#a16207",
551
- 800: "#854d0e",
552
- 900: "#713f12",
553
- 950: "#422006"
554
- },
555
- lime: {
556
- 50: "#f7fee7",
557
- 100: "#ecfccb",
558
- 200: "#d9f99d",
559
- 300: "#bef264",
560
- 400: "#a3e635",
561
- 500: "#84cc16",
562
- 600: "#65a30d",
563
- 700: "#4d7c0f",
564
- 800: "#3f6212",
565
- 900: "#365314",
566
- 950: "#1a2e05"
567
- },
568
- green: {
569
- 50: "#f0fdf4",
570
- 100: "#dcfce7",
571
- 200: "#bbf7d0",
572
- 300: "#86efac",
573
- 400: "#4ade80",
574
- 500: "#22c55e",
575
- 600: "#16a34a",
576
- 700: "#15803d",
577
- 800: "#166534",
578
- 900: "#14532d",
579
- 950: "#052e16"
580
- },
581
- emerald: {
582
- 50: "#ecfdf5",
583
- 100: "#d1fae5",
584
- 200: "#a7f3d0",
585
- 300: "#6ee7b7",
586
- 400: "#34d399",
587
- 500: "#10b981",
588
- 600: "#059669",
589
- 700: "#047857",
590
- 800: "#065f46",
591
- 900: "#064e3b",
592
- 950: "#022c22"
593
- },
594
- teal: {
595
- 50: "#f0fdfa",
596
- 100: "#ccfbf1",
597
- 200: "#99f6e4",
598
- 300: "#5eead4",
599
- 400: "#2dd4bf",
600
- 500: "#14b8a6",
601
- 600: "#0d9488",
602
- 700: "#0f766e",
603
- 800: "#115e59",
604
- 900: "#134e4a",
605
- 950: "#042f2e"
606
- },
607
- cyan: {
608
- 50: "#ecfeff",
609
- 100: "#cffafe",
610
- 200: "#a5f3fc",
611
- 300: "#67e8f9",
612
- 400: "#22d3ee",
613
- 500: "#06b6d4",
614
- 600: "#0891b2",
615
- 700: "#0e7490",
616
- 800: "#155e75",
617
- 900: "#164e63",
618
- 950: "#083344"
619
- },
620
- sky: {
621
- 50: "#f0f9ff",
622
- 100: "#e0f2fe",
623
- 200: "#bae6fd",
624
- 300: "#7dd3fc",
625
- 400: "#38bdf8",
626
- 500: "#0ea5e9",
627
- 600: "#0284c7",
628
- 700: "#0369a1",
629
- 800: "#075985",
630
- 900: "#0c4a6e",
631
- 950: "#082f49"
632
- },
633
- blue: {
634
- 50: "#eff6ff",
635
- 100: "#dbeafe",
636
- 200: "#bfdbfe",
637
- 300: "#93c5fd",
638
- 400: "#60a5fa",
639
- 500: "#3b82f6",
640
- 600: "#2563eb",
641
- 700: "#1d4ed8",
642
- 800: "#1e40af",
643
- 900: "#1e3a8a",
644
- 950: "#172554"
645
- },
646
- indigo: {
647
- 50: "#eef2ff",
648
- 100: "#e0e7ff",
649
- 200: "#c7d2fe",
650
- 300: "#a5b4fc",
651
- 400: "#818cf8",
652
- 500: "#6366f1",
653
- 600: "#4f46e5",
654
- 700: "#4338ca",
655
- 800: "#3730a3",
656
- 900: "#312e81",
657
- 950: "#1e1b4b"
658
- },
659
- violet: {
660
- 50: "#f5f3ff",
661
- 100: "#ede9fe",
662
- 200: "#ddd6fe",
663
- 300: "#c4b5fd",
664
- 400: "#a78bfa",
665
- 500: "#8b5cf6",
666
- 600: "#7c3aed",
667
- 700: "#6d28d9",
668
- 800: "#5b21b6",
669
- 900: "#4c1d95",
670
- 950: "#2e1065"
671
- },
672
- purple: {
673
- 50: "#faf5ff",
674
- 100: "#f3e8ff",
675
- 200: "#e9d5ff",
676
- 300: "#d8b4fe",
677
- 400: "#c084fc",
678
- 500: "#a855f7",
679
- 600: "#9333ea",
680
- 700: "#7e22ce",
681
- 800: "#6b21a8",
682
- 900: "#581c87",
683
- 950: "#3b0764"
684
- },
685
- fuchsia: {
686
- 50: "#fdf4ff",
687
- 100: "#fae8ff",
688
- 200: "#f5d0fe",
689
- 300: "#f0abfc",
690
- 400: "#e879f9",
691
- 500: "#d946ef",
692
- 600: "#c026d3",
693
- 700: "#a21caf",
694
- 800: "#86198f",
695
- 900: "#701a75",
696
- 950: "#4a044e"
697
- },
698
- pink: {
699
- 50: "#fdf2f8",
700
- 100: "#fce7f3",
701
- 200: "#fbcfe8",
702
- 300: "#f9a8d4",
703
- 400: "#f472b6",
704
- 500: "#ec4899",
705
- 600: "#db2777",
706
- 700: "#be185d",
707
- 800: "#9d174d",
708
- 900: "#831843",
709
- 950: "#500724"
710
- },
711
- rose: {
712
- 50: "#fff1f2",
713
- 100: "#ffe4e6",
714
- 200: "#fecdd3",
715
- 300: "#fda4af",
716
- 400: "#fb7185",
717
- 500: "#f43f5e",
718
- 600: "#e11d48",
719
- 700: "#be123c",
720
- 800: "#9f1239",
721
- 900: "#881337",
722
- 950: "#4c0519"
723
- }
724
- };
725
- ss.reduce(
726
- (n, { color: e, primary: t, secondary: i }) => ({
727
- ...n,
728
- [e]: {
729
- primary: It[e][t],
730
- secondary: It[e][i]
731
- }
732
- }),
733
- {}
734
- );
735
- const {
736
- SvelteComponent: ls,
737
- append: Ot,
738
- attr: ht,
739
- bubble: Ut,
740
- create_component: os,
741
- destroy_component: as,
742
- detach: mn,
743
- element: Wt,
744
- init: rs,
745
- insert: _n,
746
- listen: mt,
747
- mount_component: fs,
748
- run_all: cs,
749
- safe_not_equal: us,
750
- set_data: hs,
751
- set_input_value: Vt,
752
- space: ms,
753
- text: _s,
754
- transition_in: ds,
755
- transition_out: bs
756
- } = window.__gradio__svelte__internal, { createEventDispatcher: gs, afterUpdate: ws } = window.__gradio__svelte__internal;
757
- function ys(n) {
758
- let e;
759
- return {
760
- c() {
761
- e = _s(
762
- /*label*/
763
- n[1]
764
- );
765
- },
766
- m(t, i) {
767
- _n(t, e, i);
768
- },
769
- p(t, i) {
770
- i & /*label*/
771
- 2 && hs(
772
- e,
773
- /*label*/
774
- t[1]
775
- );
776
- },
777
- d(t) {
778
- t && mn(e);
779
- }
780
- };
781
- }
782
- function vs(n) {
783
- let e, t, i, s, o, r, a;
784
- return t = new hn({
785
- props: {
786
- show_label: (
787
- /*show_label*/
788
- n[4]
789
- ),
790
- info: (
791
- /*info*/
792
- n[2]
793
- ),
794
- $$slots: { default: [ys] },
795
- $$scope: { ctx: n }
796
- }
797
- }), {
798
- c() {
799
- e = Wt("label"), os(t.$$.fragment), i = ms(), s = Wt("input"), ht(s, "type", "color"), s.disabled = /*disabled*/
800
- n[3], ht(s, "class", "svelte-16l8u73"), ht(e, "class", "block");
801
- },
802
- m(l, u) {
803
- _n(l, e, u), fs(t, e, null), Ot(e, i), Ot(e, s), Vt(
804
- s,
805
- /*value*/
806
- n[0]
807
- ), o = !0, r || (a = [
808
- mt(
809
- s,
810
- "input",
811
- /*input_input_handler*/
812
- n[8]
813
- ),
814
- mt(
815
- s,
816
- "focus",
817
- /*focus_handler*/
818
- n[6]
819
- ),
820
- mt(
821
- s,
822
- "blur",
823
- /*blur_handler*/
824
- n[7]
825
- )
826
- ], r = !0);
827
- },
828
- p(l, [u]) {
829
- const c = {};
830
- u & /*show_label*/
831
- 16 && (c.show_label = /*show_label*/
832
- l[4]), u & /*info*/
833
- 4 && (c.info = /*info*/
834
- l[2]), u & /*$$scope, label*/
835
- 2050 && (c.$$scope = { dirty: u, ctx: l }), t.$set(c), (!o || u & /*disabled*/
836
- 8) && (s.disabled = /*disabled*/
837
- l[3]), u & /*value*/
838
- 1 && Vt(
839
- s,
840
- /*value*/
841
- l[0]
842
- );
843
- },
844
- i(l) {
845
- o || (ds(t.$$.fragment, l), o = !0);
846
- },
847
- o(l) {
848
- bs(t.$$.fragment, l), o = !1;
849
- },
850
- d(l) {
851
- l && mn(e), as(t), r = !1, cs(a);
852
- }
853
- };
854
- }
855
- function ks(n, e, t) {
856
- let { value: i = "#000000" } = e, { value_is_output: s = !1 } = e, { label: o } = e, { info: r = void 0 } = e, { disabled: a = !1 } = e, { show_label: l = !0 } = e;
857
- const u = gs();
858
- function c() {
859
- u("change", i), s || u("input");
860
- }
861
- ws(() => {
862
- t(5, s = !1);
863
- });
864
- function f(y) {
865
- Ut.call(this, n, y);
866
- }
867
- function d(y) {
868
- Ut.call(this, n, y);
869
- }
870
- function g() {
871
- i = this.value, t(0, i);
872
- }
873
- return n.$$set = (y) => {
874
- "value" in y && t(0, i = y.value), "value_is_output" in y && t(5, s = y.value_is_output), "label" in y && t(1, o = y.label), "info" in y && t(2, r = y.info), "disabled" in y && t(3, a = y.disabled), "show_label" in y && t(4, l = y.show_label);
875
- }, n.$$.update = () => {
876
- n.$$.dirty & /*value*/
877
- 1 && c();
878
- }, [
879
- i,
880
- o,
881
- r,
882
- a,
883
- l,
884
- s,
885
- f,
886
- d,
887
- g
888
- ];
889
- }
890
- class ps extends ls {
891
- constructor(e) {
892
- super(), rs(this, e, ks, vs, us, {
893
- value: 0,
894
- value_is_output: 5,
895
- label: 1,
896
- info: 2,
897
- disabled: 3,
898
- show_label: 4
899
- });
900
- }
901
- }
902
- function jt(n) {
903
- const e = typeof n == "string" && n.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);
904
- return e ? [parseFloat(e[1]), e[2] || "px"] : [
905
- /** @type {number} */
906
- n,
907
- "px"
908
- ];
909
- }
910
- function xs(n) {
911
- const e = n - 1;
912
- return e * e * e + 1;
913
- }
914
- function Nt(n, { delay: e = 0, duration: t = 400, easing: i = xs, x: s = 0, y: o = 0, opacity: r = 0 } = {}) {
915
- const a = getComputedStyle(n), l = +a.opacity, u = a.transform === "none" ? "" : a.transform, c = l * (1 - r), [f, d] = jt(s), [g, y] = jt(o);
916
- return {
917
- delay: e,
918
- duration: t,
919
- easing: i,
920
- css: (v, w) => `
921
- transform: ${u} translate(${(1 - v) * f}${d}, ${(1 - v) * g}${y});
922
- opacity: ${l - c * w}`
923
- };
924
- }
925
- const {
926
- SvelteComponent: Cs,
927
- append: dn,
928
- attr: R,
929
- bubble: Ss,
930
- check_outros: zs,
931
- create_slot: bn,
932
- detach: De,
933
- element: st,
934
- empty: Bs,
935
- get_all_dirty_from_scope: gn,
936
- get_slot_changes: wn,
937
- group_outros: Es,
938
- init: As,
939
- insert: Le,
940
- listen: Ms,
941
- safe_not_equal: Rs,
942
- set_style: T,
943
- space: yn,
944
- src_url_equal: et,
945
- toggle_class: ye,
946
- transition_in: tt,
947
- transition_out: nt,
948
- update_slot_base: vn
949
- } = window.__gradio__svelte__internal;
950
- function Hs(n) {
951
- let e, t, i, s, o, r, a = (
952
- /*icon*/
953
- n[7] && Pt(n)
954
- );
955
- const l = (
956
- /*#slots*/
957
- n[12].default
958
- ), u = bn(
959
- l,
960
- n,
961
- /*$$scope*/
962
- n[11],
963
- null
964
- );
965
- return {
966
- c() {
967
- e = st("button"), a && a.c(), t = yn(), u && u.c(), R(e, "class", i = /*size*/
968
- n[4] + " " + /*variant*/
969
- n[3] + " " + /*elem_classes*/
970
- n[1].join(" ") + " svelte-8huxfn"), R(
971
- e,
972
- "id",
973
- /*elem_id*/
974
- n[0]
975
- ), e.disabled = /*disabled*/
976
- n[8], ye(e, "hidden", !/*visible*/
977
- n[2]), T(
978
- e,
979
- "flex-grow",
980
- /*scale*/
981
- n[9]
982
- ), T(
983
- e,
984
- "width",
985
- /*scale*/
986
- n[9] === 0 ? "fit-content" : null
987
- ), T(e, "min-width", typeof /*min_width*/
988
- n[10] == "number" ? `calc(min(${/*min_width*/
989
- n[10]}px, 100%))` : null);
990
- },
991
- m(c, f) {
992
- Le(c, e, f), a && a.m(e, null), dn(e, t), u && u.m(e, null), s = !0, o || (r = Ms(
993
- e,
994
- "click",
995
- /*click_handler*/
996
- n[13]
997
- ), o = !0);
998
- },
999
- p(c, f) {
1000
- /*icon*/
1001
- c[7] ? a ? a.p(c, f) : (a = Pt(c), a.c(), a.m(e, t)) : a && (a.d(1), a = null), u && u.p && (!s || f & /*$$scope*/
1002
- 2048) && vn(
1003
- u,
1004
- l,
1005
- c,
1006
- /*$$scope*/
1007
- c[11],
1008
- s ? wn(
1009
- l,
1010
- /*$$scope*/
1011
- c[11],
1012
- f,
1013
- null
1014
- ) : gn(
1015
- /*$$scope*/
1016
- c[11]
1017
- ),
1018
- null
1019
- ), (!s || f & /*size, variant, elem_classes*/
1020
- 26 && i !== (i = /*size*/
1021
- c[4] + " " + /*variant*/
1022
- c[3] + " " + /*elem_classes*/
1023
- c[1].join(" ") + " svelte-8huxfn")) && R(e, "class", i), (!s || f & /*elem_id*/
1024
- 1) && R(
1025
- e,
1026
- "id",
1027
- /*elem_id*/
1028
- c[0]
1029
- ), (!s || f & /*disabled*/
1030
- 256) && (e.disabled = /*disabled*/
1031
- c[8]), (!s || f & /*size, variant, elem_classes, visible*/
1032
- 30) && ye(e, "hidden", !/*visible*/
1033
- c[2]), f & /*scale*/
1034
- 512 && T(
1035
- e,
1036
- "flex-grow",
1037
- /*scale*/
1038
- c[9]
1039
- ), f & /*scale*/
1040
- 512 && T(
1041
- e,
1042
- "width",
1043
- /*scale*/
1044
- c[9] === 0 ? "fit-content" : null
1045
- ), f & /*min_width*/
1046
- 1024 && T(e, "min-width", typeof /*min_width*/
1047
- c[10] == "number" ? `calc(min(${/*min_width*/
1048
- c[10]}px, 100%))` : null);
1049
- },
1050
- i(c) {
1051
- s || (tt(u, c), s = !0);
1052
- },
1053
- o(c) {
1054
- nt(u, c), s = !1;
1055
- },
1056
- d(c) {
1057
- c && De(e), a && a.d(), u && u.d(c), o = !1, r();
1058
- }
1059
- };
1060
- }
1061
- function Xs(n) {
1062
- let e, t, i, s, o = (
1063
- /*icon*/
1064
- n[7] && Ft(n)
1065
- );
1066
- const r = (
1067
- /*#slots*/
1068
- n[12].default
1069
- ), a = bn(
1070
- r,
1071
- n,
1072
- /*$$scope*/
1073
- n[11],
1074
- null
1075
- );
1076
- return {
1077
- c() {
1078
- e = st("a"), o && o.c(), t = yn(), a && a.c(), R(
1079
- e,
1080
- "href",
1081
- /*link*/
1082
- n[6]
1083
- ), R(e, "rel", "noopener noreferrer"), R(
1084
- e,
1085
- "aria-disabled",
1086
- /*disabled*/
1087
- n[8]
1088
- ), R(e, "class", i = /*size*/
1089
- n[4] + " " + /*variant*/
1090
- n[3] + " " + /*elem_classes*/
1091
- n[1].join(" ") + " svelte-8huxfn"), R(
1092
- e,
1093
- "id",
1094
- /*elem_id*/
1095
- n[0]
1096
- ), ye(e, "hidden", !/*visible*/
1097
- n[2]), ye(
1098
- e,
1099
- "disabled",
1100
- /*disabled*/
1101
- n[8]
1102
- ), T(
1103
- e,
1104
- "flex-grow",
1105
- /*scale*/
1106
- n[9]
1107
- ), T(
1108
- e,
1109
- "pointer-events",
1110
- /*disabled*/
1111
- n[8] ? "none" : null
1112
- ), T(
1113
- e,
1114
- "width",
1115
- /*scale*/
1116
- n[9] === 0 ? "fit-content" : null
1117
- ), T(e, "min-width", typeof /*min_width*/
1118
- n[10] == "number" ? `calc(min(${/*min_width*/
1119
- n[10]}px, 100%))` : null);
1120
- },
1121
- m(l, u) {
1122
- Le(l, e, u), o && o.m(e, null), dn(e, t), a && a.m(e, null), s = !0;
1123
- },
1124
- p(l, u) {
1125
- /*icon*/
1126
- l[7] ? o ? o.p(l, u) : (o = Ft(l), o.c(), o.m(e, t)) : o && (o.d(1), o = null), a && a.p && (!s || u & /*$$scope*/
1127
- 2048) && vn(
1128
- a,
1129
- r,
1130
- l,
1131
- /*$$scope*/
1132
- l[11],
1133
- s ? wn(
1134
- r,
1135
- /*$$scope*/
1136
- l[11],
1137
- u,
1138
- null
1139
- ) : gn(
1140
- /*$$scope*/
1141
- l[11]
1142
- ),
1143
- null
1144
- ), (!s || u & /*link*/
1145
- 64) && R(
1146
- e,
1147
- "href",
1148
- /*link*/
1149
- l[6]
1150
- ), (!s || u & /*disabled*/
1151
- 256) && R(
1152
- e,
1153
- "aria-disabled",
1154
- /*disabled*/
1155
- l[8]
1156
- ), (!s || u & /*size, variant, elem_classes*/
1157
- 26 && i !== (i = /*size*/
1158
- l[4] + " " + /*variant*/
1159
- l[3] + " " + /*elem_classes*/
1160
- l[1].join(" ") + " svelte-8huxfn")) && R(e, "class", i), (!s || u & /*elem_id*/
1161
- 1) && R(
1162
- e,
1163
- "id",
1164
- /*elem_id*/
1165
- l[0]
1166
- ), (!s || u & /*size, variant, elem_classes, visible*/
1167
- 30) && ye(e, "hidden", !/*visible*/
1168
- l[2]), (!s || u & /*size, variant, elem_classes, disabled*/
1169
- 282) && ye(
1170
- e,
1171
- "disabled",
1172
- /*disabled*/
1173
- l[8]
1174
- ), u & /*scale*/
1175
- 512 && T(
1176
- e,
1177
- "flex-grow",
1178
- /*scale*/
1179
- l[9]
1180
- ), u & /*disabled*/
1181
- 256 && T(
1182
- e,
1183
- "pointer-events",
1184
- /*disabled*/
1185
- l[8] ? "none" : null
1186
- ), u & /*scale*/
1187
- 512 && T(
1188
- e,
1189
- "width",
1190
- /*scale*/
1191
- l[9] === 0 ? "fit-content" : null
1192
- ), u & /*min_width*/
1193
- 1024 && T(e, "min-width", typeof /*min_width*/
1194
- l[10] == "number" ? `calc(min(${/*min_width*/
1195
- l[10]}px, 100%))` : null);
1196
- },
1197
- i(l) {
1198
- s || (tt(a, l), s = !0);
1199
- },
1200
- o(l) {
1201
- nt(a, l), s = !1;
1202
- },
1203
- d(l) {
1204
- l && De(e), o && o.d(), a && a.d(l);
1205
- }
1206
- };
1207
- }
1208
- function Pt(n) {
1209
- let e, t, i;
1210
- return {
1211
- c() {
1212
- e = st("img"), R(e, "class", "button-icon svelte-8huxfn"), et(e.src, t = /*icon*/
1213
- n[7].url) || R(e, "src", t), R(e, "alt", i = `${/*value*/
1214
- n[5]} icon`);
1215
- },
1216
- m(s, o) {
1217
- Le(s, e, o);
1218
- },
1219
- p(s, o) {
1220
- o & /*icon*/
1221
- 128 && !et(e.src, t = /*icon*/
1222
- s[7].url) && R(e, "src", t), o & /*value*/
1223
- 32 && i !== (i = `${/*value*/
1224
- s[5]} icon`) && R(e, "alt", i);
1225
- },
1226
- d(s) {
1227
- s && De(e);
1228
- }
1229
- };
1230
- }
1231
- function Ft(n) {
1232
- let e, t, i;
1233
- return {
1234
- c() {
1235
- e = st("img"), R(e, "class", "button-icon svelte-8huxfn"), et(e.src, t = /*icon*/
1236
- n[7].url) || R(e, "src", t), R(e, "alt", i = `${/*value*/
1237
- n[5]} icon`);
1238
- },
1239
- m(s, o) {
1240
- Le(s, e, o);
1241
- },
1242
- p(s, o) {
1243
- o & /*icon*/
1244
- 128 && !et(e.src, t = /*icon*/
1245
- s[7].url) && R(e, "src", t), o & /*value*/
1246
- 32 && i !== (i = `${/*value*/
1247
- s[5]} icon`) && R(e, "alt", i);
1248
- },
1249
- d(s) {
1250
- s && De(e);
1251
- }
1252
- };
1253
- }
1254
- function Ys(n) {
1255
- let e, t, i, s;
1256
- const o = [Xs, Hs], r = [];
1257
- function a(l, u) {
1258
- return (
1259
- /*link*/
1260
- l[6] && /*link*/
1261
- l[6].length > 0 ? 0 : 1
1262
- );
1263
- }
1264
- return e = a(n), t = r[e] = o[e](n), {
1265
- c() {
1266
- t.c(), i = Bs();
1267
- },
1268
- m(l, u) {
1269
- r[e].m(l, u), Le(l, i, u), s = !0;
1270
- },
1271
- p(l, [u]) {
1272
- let c = e;
1273
- e = a(l), e === c ? r[e].p(l, u) : (Es(), nt(r[c], 1, 1, () => {
1274
- r[c] = null;
1275
- }), zs(), t = r[e], t ? t.p(l, u) : (t = r[e] = o[e](l), t.c()), tt(t, 1), t.m(i.parentNode, i));
1276
- },
1277
- i(l) {
1278
- s || (tt(t), s = !0);
1279
- },
1280
- o(l) {
1281
- nt(t), s = !1;
1282
- },
1283
- d(l) {
1284
- l && De(i), r[e].d(l);
1285
- }
1286
- };
1287
- }
1288
- function qs(n, e, t) {
1289
- let { $$slots: i = {}, $$scope: s } = e, { elem_id: o = "" } = e, { elem_classes: r = [] } = e, { visible: a = !0 } = e, { variant: l = "secondary" } = e, { size: u = "lg" } = e, { value: c = null } = e, { link: f = null } = e, { icon: d = null } = e, { disabled: g = !1 } = e, { scale: y = null } = e, { min_width: v = void 0 } = e;
1290
- function w(h) {
1291
- Ss.call(this, n, h);
1292
- }
1293
- return n.$$set = (h) => {
1294
- "elem_id" in h && t(0, o = h.elem_id), "elem_classes" in h && t(1, r = h.elem_classes), "visible" in h && t(2, a = h.visible), "variant" in h && t(3, l = h.variant), "size" in h && t(4, u = h.size), "value" in h && t(5, c = h.value), "link" in h && t(6, f = h.link), "icon" in h && t(7, d = h.icon), "disabled" in h && t(8, g = h.disabled), "scale" in h && t(9, y = h.scale), "min_width" in h && t(10, v = h.min_width), "$$scope" in h && t(11, s = h.$$scope);
1295
- }, [
1296
- o,
1297
- r,
1298
- a,
1299
- l,
1300
- u,
1301
- c,
1302
- f,
1303
- d,
1304
- g,
1305
- y,
1306
- v,
1307
- s,
1308
- i,
1309
- w
1310
- ];
1311
- }
1312
- class yt extends Cs {
1313
- constructor(e) {
1314
- super(), As(this, e, qs, Ys, Rs, {
1315
- elem_id: 0,
1316
- elem_classes: 1,
1317
- visible: 2,
1318
- variant: 3,
1319
- size: 4,
1320
- value: 5,
1321
- link: 6,
1322
- icon: 7,
1323
- disabled: 8,
1324
- scale: 9,
1325
- min_width: 10
1326
- });
1327
- }
1328
- }
1329
- const {
1330
- SvelteComponent: Ds,
1331
- add_render_callback: kn,
1332
- append: je,
1333
- attr: O,
1334
- binding_callbacks: Kt,
1335
- check_outros: Ls,
1336
- create_bidirectional_transition: Gt,
1337
- destroy_each: Ts,
1338
- detach: Ae,
1339
- element: it,
1340
- empty: Is,
1341
- ensure_array_like: Jt,
1342
- group_outros: Os,
1343
- init: Us,
1344
- insert: Me,
1345
- listen: vt,
1346
- prevent_default: Ws,
1347
- run_all: Vs,
1348
- safe_not_equal: js,
1349
- set_data: Ns,
1350
- set_style: de,
1351
- space: kt,
1352
- text: Ps,
1353
- toggle_class: F,
1354
- transition_in: _t,
1355
- transition_out: Zt
1356
- } = window.__gradio__svelte__internal, { createEventDispatcher: Fs } = window.__gradio__svelte__internal;
1357
- function Qt(n, e, t) {
1358
- const i = n.slice();
1359
- return i[26] = e[t], i;
1360
- }
1361
- function $t(n) {
1362
- let e, t, i, s, o, r = Jt(
1363
- /*filtered_indices*/
1364
- n[1]
1365
- ), a = [];
1366
- for (let l = 0; l < r.length; l += 1)
1367
- a[l] = en(Qt(n, r, l));
1368
- return {
1369
- c() {
1370
- e = it("ul");
1371
- for (let l = 0; l < a.length; l += 1)
1372
- a[l].c();
1373
- O(e, "class", "options svelte-yuohum"), O(e, "role", "listbox"), de(
1374
- e,
1375
- "bottom",
1376
- /*bottom*/
1377
- n[9]
1378
- ), de(e, "max-height", `calc(${/*max_height*/
1379
- n[10]}px - var(--window-padding))`), de(
1380
- e,
1381
- "width",
1382
- /*input_width*/
1383
- n[8] + "px"
1384
- );
1385
- },
1386
- m(l, u) {
1387
- Me(l, e, u);
1388
- for (let c = 0; c < a.length; c += 1)
1389
- a[c] && a[c].m(e, null);
1390
- n[22](e), i = !0, s || (o = vt(e, "mousedown", Ws(
1391
- /*mousedown_handler*/
1392
- n[21]
1393
- )), s = !0);
1394
- },
1395
- p(l, u) {
1396
- if (u & /*filtered_indices, choices, selected_indices, active_index*/
1397
- 51) {
1398
- r = Jt(
1399
- /*filtered_indices*/
1400
- l[1]
1401
- );
1402
- let c;
1403
- for (c = 0; c < r.length; c += 1) {
1404
- const f = Qt(l, r, c);
1405
- a[c] ? a[c].p(f, u) : (a[c] = en(f), a[c].c(), a[c].m(e, null));
1406
- }
1407
- for (; c < a.length; c += 1)
1408
- a[c].d(1);
1409
- a.length = r.length;
1410
- }
1411
- u & /*bottom*/
1412
- 512 && de(
1413
- e,
1414
- "bottom",
1415
- /*bottom*/
1416
- l[9]
1417
- ), u & /*max_height*/
1418
- 1024 && de(e, "max-height", `calc(${/*max_height*/
1419
- l[10]}px - var(--window-padding))`), u & /*input_width*/
1420
- 256 && de(
1421
- e,
1422
- "width",
1423
- /*input_width*/
1424
- l[8] + "px"
1425
- );
1426
- },
1427
- i(l) {
1428
- i || (l && kn(() => {
1429
- i && (t || (t = Gt(e, Nt, { duration: 200, y: 5 }, !0)), t.run(1));
1430
- }), i = !0);
1431
- },
1432
- o(l) {
1433
- l && (t || (t = Gt(e, Nt, { duration: 200, y: 5 }, !1)), t.run(0)), i = !1;
1434
- },
1435
- d(l) {
1436
- l && Ae(e), Ts(a, l), n[22](null), l && t && t.end(), s = !1, o();
1437
- }
1438
- };
1439
- }
1440
- function en(n) {
1441
- let e, t, i, s = (
1442
- /*choices*/
1443
- n[0][
1444
- /*index*/
1445
- n[26]
1446
- ][0] + ""
1447
- ), o, r, a, l, u;
1448
- return {
1449
- c() {
1450
- e = it("li"), t = it("span"), t.textContent = "✓", i = kt(), o = Ps(s), r = kt(), O(t, "class", "inner-item svelte-yuohum"), F(t, "hide", !/*selected_indices*/
1451
- n[4].includes(
1452
- /*index*/
1453
- n[26]
1454
- )), O(e, "class", "item svelte-yuohum"), O(e, "data-index", a = /*index*/
1455
- n[26]), O(e, "aria-label", l = /*choices*/
1456
- n[0][
1457
- /*index*/
1458
- n[26]
1459
- ][0]), O(e, "data-testid", "dropdown-option"), O(e, "role", "option"), O(e, "aria-selected", u = /*selected_indices*/
1460
- n[4].includes(
1461
- /*index*/
1462
- n[26]
1463
- )), F(
1464
- e,
1465
- "selected",
1466
- /*selected_indices*/
1467
- n[4].includes(
1468
- /*index*/
1469
- n[26]
1470
- )
1471
- ), F(
1472
- e,
1473
- "active",
1474
- /*index*/
1475
- n[26] === /*active_index*/
1476
- n[5]
1477
- ), F(
1478
- e,
1479
- "bg-gray-100",
1480
- /*index*/
1481
- n[26] === /*active_index*/
1482
- n[5]
1483
- ), F(
1484
- e,
1485
- "dark:bg-gray-600",
1486
- /*index*/
1487
- n[26] === /*active_index*/
1488
- n[5]
1489
- );
1490
- },
1491
- m(c, f) {
1492
- Me(c, e, f), je(e, t), je(e, i), je(e, o), je(e, r);
1493
- },
1494
- p(c, f) {
1495
- f & /*selected_indices, filtered_indices*/
1496
- 18 && F(t, "hide", !/*selected_indices*/
1497
- c[4].includes(
1498
- /*index*/
1499
- c[26]
1500
- )), f & /*choices, filtered_indices*/
1501
- 3 && s !== (s = /*choices*/
1502
- c[0][
1503
- /*index*/
1504
- c[26]
1505
- ][0] + "") && Ns(o, s), f & /*filtered_indices*/
1506
- 2 && a !== (a = /*index*/
1507
- c[26]) && O(e, "data-index", a), f & /*choices, filtered_indices*/
1508
- 3 && l !== (l = /*choices*/
1509
- c[0][
1510
- /*index*/
1511
- c[26]
1512
- ][0]) && O(e, "aria-label", l), f & /*selected_indices, filtered_indices*/
1513
- 18 && u !== (u = /*selected_indices*/
1514
- c[4].includes(
1515
- /*index*/
1516
- c[26]
1517
- )) && O(e, "aria-selected", u), f & /*selected_indices, filtered_indices*/
1518
- 18 && F(
1519
- e,
1520
- "selected",
1521
- /*selected_indices*/
1522
- c[4].includes(
1523
- /*index*/
1524
- c[26]
1525
- )
1526
- ), f & /*filtered_indices, active_index*/
1527
- 34 && F(
1528
- e,
1529
- "active",
1530
- /*index*/
1531
- c[26] === /*active_index*/
1532
- c[5]
1533
- ), f & /*filtered_indices, active_index*/
1534
- 34 && F(
1535
- e,
1536
- "bg-gray-100",
1537
- /*index*/
1538
- c[26] === /*active_index*/
1539
- c[5]
1540
- ), f & /*filtered_indices, active_index*/
1541
- 34 && F(
1542
- e,
1543
- "dark:bg-gray-600",
1544
- /*index*/
1545
- c[26] === /*active_index*/
1546
- c[5]
1547
- );
1548
- },
1549
- d(c) {
1550
- c && Ae(e);
1551
- }
1552
- };
1553
- }
1554
- function Ks(n) {
1555
- let e, t, i, s, o;
1556
- kn(
1557
- /*onwindowresize*/
1558
- n[19]
1559
- );
1560
- let r = (
1561
- /*show_options*/
1562
- n[2] && !/*disabled*/
1563
- n[3] && $t(n)
1564
- );
1565
- return {
1566
- c() {
1567
- e = it("div"), t = kt(), r && r.c(), i = Is(), O(e, "class", "reference");
1568
- },
1569
- m(a, l) {
1570
- Me(a, e, l), n[20](e), Me(a, t, l), r && r.m(a, l), Me(a, i, l), s || (o = [
1571
- vt(
1572
- window,
1573
- "scroll",
1574
- /*scroll_listener*/
1575
- n[12]
1576
- ),
1577
- vt(
1578
- window,
1579
- "resize",
1580
- /*onwindowresize*/
1581
- n[19]
1582
- )
1583
- ], s = !0);
1584
- },
1585
- p(a, [l]) {
1586
- /*show_options*/
1587
- a[2] && !/*disabled*/
1588
- a[3] ? r ? (r.p(a, l), l & /*show_options, disabled*/
1589
- 12 && _t(r, 1)) : (r = $t(a), r.c(), _t(r, 1), r.m(i.parentNode, i)) : r && (Os(), Zt(r, 1, 1, () => {
1590
- r = null;
1591
- }), Ls());
1592
- },
1593
- i(a) {
1594
- _t(r);
1595
- },
1596
- o(a) {
1597
- Zt(r);
1598
- },
1599
- d(a) {
1600
- a && (Ae(e), Ae(t), Ae(i)), n[20](null), r && r.d(a), s = !1, Vs(o);
1601
- }
1602
- };
1603
- }
1604
- function Gs(n, e, t) {
1605
- var i, s;
1606
- let { choices: o } = e, { filtered_indices: r } = e, { show_options: a = !1 } = e, { disabled: l = !1 } = e, { selected_indices: u = [] } = e, { active_index: c = null } = e, f, d, g, y, v, w, h, x, m;
1607
- function k() {
1608
- const { top: S, bottom: J } = v.getBoundingClientRect();
1609
- t(16, f = S), t(17, d = m - J);
1610
- }
1611
- let _ = null;
1612
- function A() {
1613
- a && (_ !== null && clearTimeout(_), _ = setTimeout(
1614
- () => {
1615
- k(), _ = null;
1616
- },
1617
- 10
1618
- ));
1619
- }
1620
- const B = Fs();
1621
- function C() {
1622
- t(11, m = window.innerHeight);
1623
- }
1624
- function M(S) {
1625
- Kt[S ? "unshift" : "push"](() => {
1626
- v = S, t(6, v);
1627
- });
1628
- }
1629
- const Y = (S) => B("change", S);
1630
- function j(S) {
1631
- Kt[S ? "unshift" : "push"](() => {
1632
- w = S, t(7, w);
1633
- });
1634
- }
1635
- return n.$$set = (S) => {
1636
- "choices" in S && t(0, o = S.choices), "filtered_indices" in S && t(1, r = S.filtered_indices), "show_options" in S && t(2, a = S.show_options), "disabled" in S && t(3, l = S.disabled), "selected_indices" in S && t(4, u = S.selected_indices), "active_index" in S && t(5, c = S.active_index);
1637
- }, n.$$.update = () => {
1638
- if (n.$$.dirty & /*show_options, refElement, listElement, selected_indices, _a, _b, distance_from_bottom, distance_from_top, input_height*/
1639
- 508116) {
1640
- if (a && v) {
1641
- if (w && u.length > 0) {
1642
- let J = w.querySelectorAll("li");
1643
- for (const Q of Array.from(J))
1644
- if (Q.getAttribute("data-index") === u[0].toString()) {
1645
- t(14, i = w == null ? void 0 : w.scrollTo) === null || i === void 0 || i.call(w, 0, Q.offsetTop);
1646
- break;
1647
- }
1648
- }
1649
- k();
1650
- const S = t(15, s = v.parentElement) === null || s === void 0 ? void 0 : s.getBoundingClientRect();
1651
- t(18, g = (S == null ? void 0 : S.height) || 0), t(8, y = (S == null ? void 0 : S.width) || 0);
1652
- }
1653
- d > f ? (t(10, x = d), t(9, h = null)) : (t(9, h = `${d + g}px`), t(10, x = f - g));
1654
- }
1655
- }, [
1656
- o,
1657
- r,
1658
- a,
1659
- l,
1660
- u,
1661
- c,
1662
- v,
1663
- w,
1664
- y,
1665
- h,
1666
- x,
1667
- m,
1668
- A,
1669
- B,
1670
- i,
1671
- s,
1672
- f,
1673
- d,
1674
- g,
1675
- C,
1676
- M,
1677
- Y,
1678
- j
1679
- ];
1680
- }
1681
- class Js extends Ds {
1682
- constructor(e) {
1683
- super(), Us(this, e, Gs, Ks, js, {
1684
- choices: 0,
1685
- filtered_indices: 1,
1686
- show_options: 2,
1687
- disabled: 3,
1688
- selected_indices: 4,
1689
- active_index: 5
1690
- });
1691
- }
1692
- }
1693
- function Zs(n, e) {
1694
- return (n % e + e) % e;
1695
- }
1696
- function tn(n, e) {
1697
- return n.reduce((t, i, s) => ((!e || i[0].toLowerCase().includes(e.toLowerCase())) && t.push(s), t), []);
1698
- }
1699
- function Qs(n, e, t) {
1700
- n("change", e), t || n("input");
1701
- }
1702
- function $s(n, e, t) {
1703
- if (n.key === "Escape")
1704
- return [!1, e];
1705
- if ((n.key === "ArrowDown" || n.key === "ArrowUp") && t.length >= 0)
1706
- if (e === null)
1707
- e = n.key === "ArrowDown" ? t[0] : t[t.length - 1];
1708
- else {
1709
- const i = t.indexOf(e), s = n.key === "ArrowUp" ? -1 : 1;
1710
- e = t[Zs(i + s, t.length)];
1711
- }
1712
- return [!0, e];
1713
- }
1714
  const {
1715
- SvelteComponent: el,
1716
- append: ae,
1717
- attr: I,
1718
- binding_callbacks: tl,
1719
- check_outros: nl,
1720
- create_component: pt,
1721
- destroy_component: xt,
1722
- detach: zt,
1723
- element: ge,
1724
- group_outros: il,
1725
- init: sl,
1726
- insert: Bt,
1727
- listen: ke,
1728
- mount_component: Ct,
1729
- run_all: ll,
1730
- safe_not_equal: ol,
1731
- set_data: al,
1732
- set_input_value: nn,
1733
- space: dt,
1734
- text: rl,
1735
- toggle_class: be,
1736
- transition_in: we,
1737
- transition_out: xe
1738
- } = window.__gradio__svelte__internal, { onMount: fl } = window.__gradio__svelte__internal, { createEventDispatcher: cl, afterUpdate: ul } = window.__gradio__svelte__internal;
1739
- function hl(n) {
1740
- let e;
1741
  return {
1742
  c() {
1743
- e = rl(
1744
- /*label*/
1745
- n[0]
1746
- );
1747
  },
1748
  m(t, i) {
1749
- Bt(t, e, i);
1750
  },
1751
  p(t, i) {
1752
- i[0] & /*label*/
1753
- 1 && al(
1754
- e,
1755
- /*label*/
1756
- t[0]
1757
- );
1758
- },
1759
- d(t) {
1760
- t && zt(e);
1761
- }
1762
- };
1763
- }
1764
- function sn(n) {
1765
- let e, t, i;
1766
- return t = new is({}), {
1767
- c() {
1768
- e = ge("div"), pt(t.$$.fragment), I(e, "class", "icon-wrap svelte-1m1zvyj");
1769
- },
1770
- m(s, o) {
1771
- Bt(s, e, o), Ct(t, e, null), i = !0;
1772
- },
1773
- i(s) {
1774
- i || (we(t.$$.fragment, s), i = !0);
1775
- },
1776
- o(s) {
1777
- xe(t.$$.fragment, s), i = !1;
1778
- },
1779
- d(s) {
1780
- s && zt(e), xt(t);
1781
- }
1782
- };
1783
- }
1784
- function ml(n) {
1785
- let e, t, i, s, o, r, a, l, u, c, f, d, g, y;
1786
- t = new hn({
1787
- props: {
1788
- show_label: (
1789
- /*show_label*/
1790
- n[4]
1791
- ),
1792
- info: (
1793
- /*info*/
1794
- n[1]
1795
- ),
1796
- $$slots: { default: [hl] },
1797
- $$scope: { ctx: n }
1798
- }
1799
- });
1800
- let v = !/*disabled*/
1801
- n[3] && sn();
1802
- return f = new Js({
1803
- props: {
1804
- show_options: (
1805
- /*show_options*/
1806
- n[12]
1807
- ),
1808
- choices: (
1809
- /*choices*/
1810
- n[2]
1811
- ),
1812
- filtered_indices: (
1813
- /*filtered_indices*/
1814
- n[10]
1815
- ),
1816
- disabled: (
1817
- /*disabled*/
1818
- n[3]
1819
- ),
1820
- selected_indices: (
1821
- /*selected_index*/
1822
- n[11] === null ? [] : [
1823
- /*selected_index*/
1824
- n[11]
1825
- ]
1826
- ),
1827
- active_index: (
1828
- /*active_index*/
1829
- n[14]
1830
- )
1831
- }
1832
- }), f.$on(
1833
- "change",
1834
- /*handle_option_selected*/
1835
- n[16]
1836
- ), {
1837
- c() {
1838
- e = ge("div"), pt(t.$$.fragment), i = dt(), s = ge("div"), o = ge("div"), r = ge("div"), a = ge("input"), u = dt(), v && v.c(), c = dt(), pt(f.$$.fragment), I(a, "role", "listbox"), I(a, "aria-controls", "dropdown-options"), I(
1839
- a,
1840
- "aria-expanded",
1841
- /*show_options*/
1842
- n[12]
1843
- ), I(
1844
- a,
1845
- "aria-label",
1846
- /*label*/
1847
- n[0]
1848
- ), I(a, "class", "border-none svelte-1m1zvyj"), a.disabled = /*disabled*/
1849
- n[3], I(a, "autocomplete", "off"), a.readOnly = l = !/*filterable*/
1850
- n[7], be(a, "subdued", !/*choices_names*/
1851
- n[13].includes(
1852
- /*input_text*/
1853
- n[9]
1854
- ) && !/*allow_custom_value*/
1855
- n[6]), I(r, "class", "secondary-wrap svelte-1m1zvyj"), I(o, "class", "wrap-inner svelte-1m1zvyj"), be(
1856
- o,
1857
- "show_options",
1858
- /*show_options*/
1859
- n[12]
1860
- ), I(s, "class", "wrap svelte-1m1zvyj"), I(e, "class", "svelte-1m1zvyj"), be(
1861
- e,
1862
- "container",
1863
- /*container*/
1864
- n[5]
1865
- );
1866
- },
1867
- m(w, h) {
1868
- Bt(w, e, h), Ct(t, e, null), ae(e, i), ae(e, s), ae(s, o), ae(o, r), ae(r, a), nn(
1869
- a,
1870
- /*input_text*/
1871
- n[9]
1872
- ), n[29](a), ae(r, u), v && v.m(r, null), ae(s, c), Ct(f, s, null), d = !0, g || (y = [
1873
- ke(
1874
- a,
1875
- "input",
1876
- /*input_input_handler*/
1877
- n[28]
1878
- ),
1879
- ke(
1880
- a,
1881
- "keydown",
1882
- /*handle_key_down*/
1883
- n[19]
1884
- ),
1885
- ke(
1886
- a,
1887
- "keyup",
1888
- /*keyup_handler*/
1889
- n[30]
1890
- ),
1891
- ke(
1892
- a,
1893
- "blur",
1894
- /*handle_blur*/
1895
- n[18]
1896
- ),
1897
- ke(
1898
- a,
1899
- "focus",
1900
- /*handle_focus*/
1901
- n[17]
1902
- )
1903
- ], g = !0);
1904
- },
1905
- p(w, h) {
1906
- const x = {};
1907
- h[0] & /*show_label*/
1908
- 16 && (x.show_label = /*show_label*/
1909
- w[4]), h[0] & /*info*/
1910
- 2 && (x.info = /*info*/
1911
- w[1]), h[0] & /*label*/
1912
- 1 | h[1] & /*$$scope*/
1913
- 4 && (x.$$scope = { dirty: h, ctx: w }), t.$set(x), (!d || h[0] & /*show_options*/
1914
- 4096) && I(
1915
- a,
1916
- "aria-expanded",
1917
- /*show_options*/
1918
- w[12]
1919
- ), (!d || h[0] & /*label*/
1920
- 1) && I(
1921
- a,
1922
- "aria-label",
1923
- /*label*/
1924
- w[0]
1925
- ), (!d || h[0] & /*disabled*/
1926
- 8) && (a.disabled = /*disabled*/
1927
- w[3]), (!d || h[0] & /*filterable*/
1928
- 128 && l !== (l = !/*filterable*/
1929
- w[7])) && (a.readOnly = l), h[0] & /*input_text*/
1930
- 512 && a.value !== /*input_text*/
1931
- w[9] && nn(
1932
- a,
1933
- /*input_text*/
1934
- w[9]
1935
- ), (!d || h[0] & /*choices_names, input_text, allow_custom_value*/
1936
- 8768) && be(a, "subdued", !/*choices_names*/
1937
- w[13].includes(
1938
- /*input_text*/
1939
- w[9]
1940
- ) && !/*allow_custom_value*/
1941
- w[6]), /*disabled*/
1942
- w[3] ? v && (il(), xe(v, 1, 1, () => {
1943
- v = null;
1944
- }), nl()) : v ? h[0] & /*disabled*/
1945
- 8 && we(v, 1) : (v = sn(), v.c(), we(v, 1), v.m(r, null)), (!d || h[0] & /*show_options*/
1946
- 4096) && be(
1947
- o,
1948
- "show_options",
1949
- /*show_options*/
1950
- w[12]
1951
- );
1952
- const m = {};
1953
- h[0] & /*show_options*/
1954
- 4096 && (m.show_options = /*show_options*/
1955
- w[12]), h[0] & /*choices*/
1956
- 4 && (m.choices = /*choices*/
1957
- w[2]), h[0] & /*filtered_indices*/
1958
- 1024 && (m.filtered_indices = /*filtered_indices*/
1959
- w[10]), h[0] & /*disabled*/
1960
- 8 && (m.disabled = /*disabled*/
1961
- w[3]), h[0] & /*selected_index*/
1962
- 2048 && (m.selected_indices = /*selected_index*/
1963
- w[11] === null ? [] : [
1964
- /*selected_index*/
1965
- w[11]
1966
- ]), h[0] & /*active_index*/
1967
- 16384 && (m.active_index = /*active_index*/
1968
- w[14]), f.$set(m), (!d || h[0] & /*container*/
1969
- 32) && be(
1970
- e,
1971
- "container",
1972
- /*container*/
1973
- w[5]
1974
- );
1975
- },
1976
- i(w) {
1977
- d || (we(t.$$.fragment, w), we(v), we(f.$$.fragment, w), d = !0);
1978
- },
1979
- o(w) {
1980
- xe(t.$$.fragment, w), xe(v), xe(f.$$.fragment, w), d = !1;
1981
- },
1982
- d(w) {
1983
- w && zt(e), xt(t), n[29](null), v && v.d(), xt(f), g = !1, ll(y);
1984
- }
1985
- };
1986
- }
1987
- function _l(n, e, t) {
1988
- let { label: i } = e, { info: s = void 0 } = e, { value: o = [] } = e, r = [], { value_is_output: a = !1 } = e, { choices: l } = e, u, { disabled: c = !1 } = e, { show_label: f } = e, { container: d = !0 } = e, { allow_custom_value: g = !1 } = e, { filterable: y = !0 } = e, v, w = !1, h, x, m = "", k = "", _ = !1, A = [], B = null, C = null, M;
1989
- const Y = cl();
1990
- o ? (M = l.map((z) => z[1]).indexOf(o), C = M, C === -1 ? (r = o, C = null) : ([m, r] = l[C], k = m), S()) : l.length > 0 && (M = 0, C = 0, [m, o] = l[C], r = o, k = m);
1991
- function j() {
1992
- t(13, h = l.map((z) => z[0])), t(24, x = l.map((z) => z[1]));
1993
- }
1994
- function S() {
1995
- j(), o === void 0 || Array.isArray(o) && o.length === 0 ? (t(9, m = ""), t(11, C = null)) : x.includes(o) ? (t(9, m = h[x.indexOf(o)]), t(11, C = x.indexOf(o))) : g ? (t(9, m = o), t(11, C = null)) : (t(9, m = ""), t(11, C = null)), t(27, M = C);
1996
- }
1997
- function J(z) {
1998
- if (t(11, C = parseInt(z.detail.target.dataset.index)), isNaN(C)) {
1999
- t(11, C = null);
2000
- return;
2001
- }
2002
- t(12, w = !1), t(14, B = null), v.blur();
2003
- }
2004
- function Q(z) {
2005
- t(10, A = l.map((Oe, at) => at)), t(12, w = !0), Y("focus");
2006
- }
2007
- function $() {
2008
- g ? t(20, o = m) : t(9, m = h[x.indexOf(o)]), t(12, w = !1), t(14, B = null), Y("blur");
2009
- }
2010
- function W(z) {
2011
- t(12, [w, B] = $s(z, B, A), w, (t(14, B), t(2, l), t(23, u), t(6, g), t(9, m), t(10, A), t(8, v), t(25, k), t(11, C), t(27, M), t(26, _), t(24, x))), z.key === "Enter" && (B !== null ? (t(11, C = B), t(12, w = !1), v.blur(), t(14, B = null)) : h.includes(m) ? (t(11, C = h.indexOf(m)), t(12, w = !1), t(14, B = null), v.blur()) : g && (t(20, o = m), t(11, C = null), t(12, w = !1), t(14, B = null), v.blur()), Y("enter", o));
2012
- }
2013
- ul(() => {
2014
- t(21, a = !1), t(26, _ = !0);
2015
- }), fl(() => {
2016
- v.focus();
2017
- });
2018
- function oe() {
2019
- m = this.value, t(9, m), t(11, C), t(27, M), t(26, _), t(2, l), t(24, x);
2020
- }
2021
- function lt(z) {
2022
- tl[z ? "unshift" : "push"](() => {
2023
- v = z, t(8, v);
2024
- });
2025
- }
2026
- const ot = (z) => Y("key_up", { key: z.key, input_value: m });
2027
- return n.$$set = (z) => {
2028
- "label" in z && t(0, i = z.label), "info" in z && t(1, s = z.info), "value" in z && t(20, o = z.value), "value_is_output" in z && t(21, a = z.value_is_output), "choices" in z && t(2, l = z.choices), "disabled" in z && t(3, c = z.disabled), "show_label" in z && t(4, f = z.show_label), "container" in z && t(5, d = z.container), "allow_custom_value" in z && t(6, g = z.allow_custom_value), "filterable" in z && t(7, y = z.filterable);
2029
- }, n.$$.update = () => {
2030
- n.$$.dirty[0] & /*selected_index, old_selected_index, initialized, choices, choices_values*/
2031
- 218105860 && C !== M && C !== null && _ && (t(9, [m, o] = l[C], m, (t(20, o), t(11, C), t(27, M), t(26, _), t(2, l), t(24, x))), t(27, M = C), Y("select", {
2032
- index: C,
2033
- value: x[C],
2034
- selected: !0
2035
- })), n.$$.dirty[0] & /*value, old_value, value_is_output*/
2036
- 7340032 && o != r && (S(), Qs(Y, o, a), t(22, r = o)), n.$$.dirty[0] & /*choices*/
2037
- 4 && j(), n.$$.dirty[0] & /*choices, old_choices, allow_custom_value, input_text, filtered_indices, filter_input*/
2038
- 8390468 && l !== u && (g || S(), t(23, u = l), t(10, A = tn(l, m)), !g && A.length > 0 && t(14, B = A[0]), v == document.activeElement && t(12, w = !0)), n.$$.dirty[0] & /*input_text, old_input_text, choices, allow_custom_value, filtered_indices*/
2039
- 33556036 && m !== k && (t(10, A = tn(l, m)), t(25, k = m), !g && A.length > 0 && t(14, B = A[0]));
2040
- }, [
2041
- i,
2042
- s,
2043
- l,
2044
- c,
2045
- f,
2046
- d,
2047
- g,
2048
- y,
2049
- v,
2050
- m,
2051
- A,
2052
- C,
2053
- w,
2054
- h,
2055
- B,
2056
- Y,
2057
- J,
2058
- Q,
2059
- $,
2060
- W,
2061
- o,
2062
- a,
2063
- r,
2064
- u,
2065
- x,
2066
- k,
2067
- _,
2068
- M,
2069
- oe,
2070
- lt,
2071
- ot
2072
- ];
2073
- }
2074
- class dl extends el {
2075
- constructor(e) {
2076
- super(), sl(
2077
- this,
2078
- e,
2079
- _l,
2080
- ml,
2081
- ol,
2082
- {
2083
- label: 0,
2084
- info: 1,
2085
- value: 20,
2086
- value_is_output: 21,
2087
- choices: 2,
2088
- disabled: 3,
2089
- show_label: 4,
2090
- container: 5,
2091
- allow_custom_value: 6,
2092
- filterable: 7
2093
- },
2094
- null,
2095
- [-1, -1]
2096
- );
2097
- }
2098
- }
2099
- const {
2100
- SvelteComponent: bl,
2101
- append: K,
2102
- attr: Ne,
2103
- check_outros: gl,
2104
- create_component: Ce,
2105
- destroy_component: Se,
2106
- detach: Te,
2107
- element: ie,
2108
- group_outros: wl,
2109
- init: yl,
2110
- insert: Ie,
2111
- mount_component: ze,
2112
- safe_not_equal: vl,
2113
- set_style: Be,
2114
- space: Pe,
2115
- text: Et,
2116
- transition_in: se,
2117
- transition_out: fe
2118
- } = window.__gradio__svelte__internal, { createEventDispatcher: kl } = window.__gradio__svelte__internal, { onMount: pl, onDestroy: xl } = window.__gradio__svelte__internal;
2119
- function Cl(n) {
2120
- let e;
2121
- return {
2122
- c() {
2123
- e = Et("Cancel");
2124
- },
2125
- m(t, i) {
2126
- Ie(t, e, i);
2127
- },
2128
- d(t) {
2129
- t && Te(e);
2130
- }
2131
- };
2132
- }
2133
- function ln(n) {
2134
- let e, t, i;
2135
- return t = new yt({
2136
- props: {
2137
- variant: "stop",
2138
- $$slots: { default: [Sl] },
2139
- $$scope: { ctx: n }
2140
- }
2141
- }), t.$on(
2142
- "click",
2143
- /*click_handler_1*/
2144
- n[12]
2145
- ), {
2146
- c() {
2147
- e = ie("div"), Ce(t.$$.fragment), Be(e, "margin-right", "8px");
2148
- },
2149
- m(s, o) {
2150
- Ie(s, e, o), ze(t, e, null), i = !0;
2151
- },
2152
- p(s, o) {
2153
- const r = {};
2154
- o & /*$$scope*/
2155
- 65536 && (r.$$scope = { dirty: o, ctx: s }), t.$set(r);
2156
- },
2157
- i(s) {
2158
- i || (se(t.$$.fragment, s), i = !0);
2159
- },
2160
- o(s) {
2161
- fe(t.$$.fragment, s), i = !1;
2162
- },
2163
- d(s) {
2164
- s && Te(e), Se(t);
2165
- }
2166
- };
2167
- }
2168
- function Sl(n) {
2169
- let e;
2170
- return {
2171
- c() {
2172
- e = Et("Remove");
2173
- },
2174
- m(t, i) {
2175
- Ie(t, e, i);
2176
- },
2177
- d(t) {
2178
- t && Te(e);
2179
- }
2180
- };
2181
- }
2182
- function zl(n) {
2183
- let e;
2184
- return {
2185
- c() {
2186
- e = Et("OK");
2187
- },
2188
- m(t, i) {
2189
- Ie(t, e, i);
2190
  },
2191
  d(t) {
2192
- t && Te(e);
2193
- }
2194
- };
2195
- }
2196
- function Bl(n) {
2197
- let e, t, i, s, o, r, a, l, u, c, f, d, g, y, v, w;
2198
- o = new dl({
2199
- props: {
2200
- value: (
2201
- /*currentLabel*/
2202
- n[0]
2203
- ),
2204
- label: "Label",
2205
- choices: (
2206
- /*choices*/
2207
- n[2]
2208
- ),
2209
- show_label: !1,
2210
- allow_custom_value: !0
2211
- }
2212
- }), o.$on(
2213
- "change",
2214
- /*onDropDownChange*/
2215
- n[5]
2216
- ), o.$on(
2217
- "enter",
2218
- /*onDropDownEnter*/
2219
- n[7]
2220
- ), l = new ps({
2221
- props: {
2222
- value: (
2223
- /*currentColor*/
2224
- n[1]
2225
- ),
2226
- label: "Color",
2227
- show_label: !1
2228
- }
2229
- }), l.$on(
2230
- "change",
2231
- /*onColorChange*/
2232
- n[6]
2233
- ), f = new yt({
2234
- props: {
2235
- $$slots: { default: [Cl] },
2236
- $$scope: { ctx: n }
2237
- }
2238
- }), f.$on(
2239
- "click",
2240
- /*click_handler*/
2241
- n[11]
2242
- );
2243
- let h = (
2244
- /*showRemove*/
2245
- n[3] && ln(n)
2246
- );
2247
- return v = new yt({
2248
- props: {
2249
- variant: "primary",
2250
- $$slots: { default: [zl] },
2251
- $$scope: { ctx: n }
2252
- }
2253
- }), v.$on(
2254
- "click",
2255
- /*click_handler_2*/
2256
- n[13]
2257
- ), {
2258
- c() {
2259
- e = ie("div"), t = ie("div"), i = ie("span"), s = ie("div"), Ce(o.$$.fragment), r = Pe(), a = ie("div"), Ce(l.$$.fragment), u = Pe(), c = ie("div"), Ce(f.$$.fragment), d = Pe(), h && h.c(), g = Pe(), y = ie("div"), Ce(v.$$.fragment), Be(s, "margin-right", "10px"), Be(a, "margin-right", "40px"), Be(a, "margin-bottom", "8px"), Be(c, "margin-right", "8px"), Ne(i, "class", "model-content svelte-hkn2q1"), Ne(t, "class", "modal-container svelte-hkn2q1"), Ne(e, "class", "modal svelte-hkn2q1"), Ne(e, "id", "model-box-edit");
2260
- },
2261
- m(x, m) {
2262
- Ie(x, e, m), K(e, t), K(t, i), K(i, s), ze(o, s, null), K(i, r), K(i, a), ze(l, a, null), K(i, u), K(i, c), ze(f, c, null), K(i, d), h && h.m(i, null), K(i, g), K(i, y), ze(v, y, null), w = !0;
2263
- },
2264
- p(x, [m]) {
2265
- const k = {};
2266
- m & /*currentLabel*/
2267
- 1 && (k.value = /*currentLabel*/
2268
- x[0]), m & /*choices*/
2269
- 4 && (k.choices = /*choices*/
2270
- x[2]), o.$set(k);
2271
- const _ = {};
2272
- m & /*currentColor*/
2273
- 2 && (_.value = /*currentColor*/
2274
- x[1]), l.$set(_);
2275
- const A = {};
2276
- m & /*$$scope*/
2277
- 65536 && (A.$$scope = { dirty: m, ctx: x }), f.$set(A), /*showRemove*/
2278
- x[3] ? h ? (h.p(x, m), m & /*showRemove*/
2279
- 8 && se(h, 1)) : (h = ln(x), h.c(), se(h, 1), h.m(i, g)) : h && (wl(), fe(h, 1, 1, () => {
2280
- h = null;
2281
- }), gl());
2282
- const B = {};
2283
- m & /*$$scope*/
2284
- 65536 && (B.$$scope = { dirty: m, ctx: x }), v.$set(B);
2285
- },
2286
- i(x) {
2287
- w || (se(o.$$.fragment, x), se(l.$$.fragment, x), se(f.$$.fragment, x), se(h), se(v.$$.fragment, x), w = !0);
2288
- },
2289
- o(x) {
2290
- fe(o.$$.fragment, x), fe(l.$$.fragment, x), fe(f.$$.fragment, x), fe(h), fe(v.$$.fragment, x), w = !1;
2291
- },
2292
- d(x) {
2293
- x && Te(e), Se(o), Se(l), Se(f), h && h.d(), Se(v);
2294
- }
2295
- };
2296
- }
2297
- function El(n, e, t) {
2298
- let { label: i = "" } = e, { currentLabel: s = "" } = e, { choices: o = [] } = e, { choicesColors: r = [] } = e, { color: a = "" } = e, { currentColor: l = "" } = e, { showRemove: u = !0 } = e;
2299
- const c = kl();
2300
- function f(m) {
2301
- c("change", {
2302
- label: s,
2303
- color: l,
2304
- ret: m
2305
- // -1: remove, 0: cancel, 1: change
2306
- });
2307
- }
2308
- function d(m) {
2309
- const { detail: k } = m;
2310
- let _ = k;
2311
- Number.isInteger(_) ? (Array.isArray(r) && _ < r.length && t(1, l = r[_]), Array.isArray(o) && _ < o.length && t(0, s = o[_][0])) : t(0, s = _);
2312
- }
2313
- function g(m) {
2314
- const { detail: k } = m;
2315
- t(1, l = k);
2316
- }
2317
- function y(m) {
2318
- d(m), f(1);
2319
- }
2320
- function v(m) {
2321
- switch (m.key) {
2322
- case "Enter":
2323
- f(1);
2324
- break;
2325
- }
2326
- }
2327
- pl(() => {
2328
- document.addEventListener("keydown", v), t(0, s = i), t(1, l = a);
2329
- }), xl(() => {
2330
- document.removeEventListener("keydown", v);
2331
- });
2332
- const w = () => f(0), h = () => f(-1), x = () => f(1);
2333
- return n.$$set = (m) => {
2334
- "label" in m && t(8, i = m.label), "currentLabel" in m && t(0, s = m.currentLabel), "choices" in m && t(2, o = m.choices), "choicesColors" in m && t(9, r = m.choicesColors), "color" in m && t(10, a = m.color), "currentColor" in m && t(1, l = m.currentColor), "showRemove" in m && t(3, u = m.showRemove);
2335
- }, [
2336
- s,
2337
- l,
2338
- o,
2339
- u,
2340
- f,
2341
- d,
2342
- g,
2343
- y,
2344
- i,
2345
- r,
2346
- a,
2347
- w,
2348
- h,
2349
- x
2350
- ];
2351
- }
2352
- class pn extends bl {
2353
- constructor(e) {
2354
- super(), yl(this, e, El, Bl, vl, {
2355
- label: 8,
2356
- currentLabel: 0,
2357
- choices: 2,
2358
- choicesColors: 9,
2359
- color: 10,
2360
- currentColor: 1,
2361
- showRemove: 3
2362
- });
2363
- }
2364
- }
2365
- const X = (n, e, t) => Math.min(Math.max(n, e), t);
2366
- function bt(n, e) {
2367
- if (n.startsWith("rgba"))
2368
- return n.replace(/[\d.]+$/, e.toString());
2369
- const t = n.match(/\d+/g);
2370
- if (!t || t.length !== 3)
2371
- return `rgba(50, 50, 50, ${e})`;
2372
- const [i, s, o] = t;
2373
- return `rgba(${i}, ${s}, ${o}, ${e})`;
2374
- }
2375
- class gt {
2376
- constructor(e, t, i, s, o, r, a, l, u, c, f, d = "rgb(255, 255, 255)", g = 0.5, y = 25, v = 8, w = 2, h = 4, x = 1) {
2377
- this.stopDrag = () => {
2378
- this.isDragging = !1, document.removeEventListener("pointermove", this.handleDrag), document.removeEventListener("pointerup", this.stopDrag);
2379
- }, this.handleDrag = (m) => {
2380
- if (this.isDragging) {
2381
- let k = m.clientX - this.offsetMouseX - this.xmin, _ = m.clientY - this.offsetMouseY - this.ymin;
2382
- const A = this.canvasXmax - this.canvasXmin, B = this.canvasYmax - this.canvasYmin;
2383
- k = X(k, -this.xmin, A - this.xmax), _ = X(_, -this.ymin, B - this.ymax), this.xmin += k, this.ymin += _, this.xmax += k, this.ymax += _, this.updateHandles(), this.renderCallBack();
2384
- }
2385
- }, this.handleCreating = (m) => {
2386
- if (this.isCreating) {
2387
- let [k, _] = this.toBoxCoordinates(m.clientX, m.clientY);
2388
- k -= this.offsetMouseX, _ -= this.offsetMouseY, k > this.xmax ? (this.creatingAnchorX == "xmax" && (this.xmin = this.xmax), this.xmax = k, this.creatingAnchorX = "xmin") : k > this.xmin && k < this.xmax && this.creatingAnchorX == "xmin" ? this.xmax = k : k > this.xmin && k < this.xmax && this.creatingAnchorX == "xmax" ? this.xmin = k : k < this.xmin && (this.creatingAnchorX == "xmin" && (this.xmax = this.xmin), this.xmin = k, this.creatingAnchorX = "xmax"), _ > this.ymax ? (this.creatingAnchorY == "ymax" && (this.ymin = this.ymax), this.ymax = _, this.creatingAnchorY = "ymin") : _ > this.ymin && _ < this.ymax && this.creatingAnchorY == "ymin" ? this.ymax = _ : _ > this.ymin && _ < this.ymax && this.creatingAnchorY == "ymax" ? this.ymin = _ : _ < this.ymin && (this.creatingAnchorY == "ymin" && (this.ymax = this.ymin), this.ymin = _, this.creatingAnchorY = "ymax"), this.updateHandles(), this.renderCallBack();
2389
- }
2390
- }, this.stopCreating = (m) => {
2391
- if (this.isCreating = !1, document.removeEventListener("pointermove", this.handleCreating), document.removeEventListener("pointerup", this.stopCreating), this.getArea() > 0) {
2392
- const k = this.canvasXmax - this.canvasXmin, _ = this.canvasYmax - this.canvasYmin;
2393
- this.xmin = X(this.xmin, 0, k - this.minSize), this.ymin = X(this.ymin, 0, _ - this.minSize), this.xmax = X(this.xmax, this.minSize, k), this.ymax = X(this.ymax, this.minSize, _), this.minSize > 0 && (this.getWidth() < this.minSize && (this.creatingAnchorX == "xmin" ? this.xmax = this.xmin + this.minSize : this.xmin = this.xmax - this.minSize), this.getHeight() < this.minSize && (this.creatingAnchorY == "ymin" ? this.ymax = this.ymin + this.minSize : this.ymin = this.ymax - this.minSize), this.xmax > k ? (this.xmin -= this.xmax - k, this.xmax = k) : this.xmin < 0 && (this.xmax -= this.xmin, this.xmin = 0), this.ymax > _ ? (this.ymin -= this.ymax - _, this.ymax = _) : this.ymin < 0 && (this.ymax -= this.ymin, this.ymin = 0)), this.updateHandles(), this.renderCallBack();
2394
- }
2395
- this.onFinishCreation();
2396
- }, this.handleResize = (m) => {
2397
- if (this.isResizing) {
2398
- const k = m.clientX, _ = m.clientY, A = k - this.resizeHandles[this.resizingHandleIndex].xmin - this.offsetMouseX, B = _ - this.resizeHandles[this.resizingHandleIndex].ymin - this.offsetMouseY, C = this.canvasXmax - this.canvasXmin, M = this.canvasYmax - this.canvasYmin;
2399
- switch (this.resizingHandleIndex) {
2400
- case 0:
2401
- this.xmin += A, this.ymin += B, this.xmin = X(this.xmin, 0, this.xmax - this.minSize), this.ymin = X(this.ymin, 0, this.ymax - this.minSize);
2402
- break;
2403
- case 1:
2404
- this.xmax += A, this.ymin += B, this.xmax = X(this.xmax, this.xmin + this.minSize, C), this.ymin = X(this.ymin, 0, this.ymax - this.minSize);
2405
- break;
2406
- case 2:
2407
- this.xmax += A, this.ymax += B, this.xmax = X(this.xmax, this.xmin + this.minSize, C), this.ymax = X(this.ymax, this.ymin + this.minSize, M);
2408
- break;
2409
- case 3:
2410
- this.xmin += A, this.ymax += B, this.xmin = X(this.xmin, 0, this.xmax - this.minSize), this.ymax = X(this.ymax, this.ymin + this.minSize, M);
2411
- break;
2412
- case 4:
2413
- this.ymin += B, this.ymin = X(this.ymin, 0, this.ymax - this.minSize);
2414
- break;
2415
- case 5:
2416
- this.xmax += A, this.xmax = X(this.xmax, this.xmin + this.minSize, C);
2417
- break;
2418
- case 6:
2419
- this.ymax += B, this.ymax = X(this.ymax, this.ymin + this.minSize, M);
2420
- break;
2421
- case 7:
2422
- this.xmin += A, this.xmin = X(this.xmin, 0, this.xmax - this.minSize);
2423
- break;
2424
- }
2425
- this.updateHandles(), this.renderCallBack();
2426
- }
2427
- }, this.stopResize = () => {
2428
- this.isResizing = !1, document.removeEventListener("pointermove", this.handleResize), document.removeEventListener("pointerup", this.stopResize);
2429
- }, this.renderCallBack = e, this.onFinishCreation = t, this.canvasXmin = i, this.canvasYmin = s, this.canvasXmax = o, this.canvasYmax = r, this.scaleFactor = x, this.label = a, this.isDragging = !1, this.isCreating = !1, this.xmin = l, this.ymin = u, this.xmax = c, this.ymax = f, this.isResizing = !1, this.isSelected = !1, this.offsetMouseX = 0, this.offsetMouseY = 0, this.resizeHandleSize = v, this.thickness = w, this.selectedThickness = h, this.updateHandles(), this.resizingHandleIndex = -1, this.minSize = y, this.color = d, this.alpha = g, this.creatingAnchorX = "xmin", this.creatingAnchorY = "ymin";
2430
- }
2431
- toJSON() {
2432
- return {
2433
- label: this.label,
2434
- xmin: this.xmin,
2435
- ymin: this.ymin,
2436
- xmax: this.xmax,
2437
- ymax: this.ymax,
2438
- color: this.color,
2439
- scaleFactor: this.scaleFactor
2440
- };
2441
- }
2442
- setSelected(e) {
2443
- this.isSelected = e;
2444
- }
2445
- setScaleFactor(e) {
2446
- let t = e / this.scaleFactor;
2447
- this.xmin = Math.round(this.xmin * t), this.ymin = Math.round(this.ymin * t), this.xmax = Math.round(this.xmax * t), this.ymax = Math.round(this.ymax * t), this.updateHandles(), this.scaleFactor = e;
2448
- }
2449
- updateHandles() {
2450
- const e = this.resizeHandleSize / 2, t = this.getWidth(), i = this.getHeight();
2451
- this.resizeHandles = [
2452
- {
2453
- // Top left
2454
- xmin: this.xmin - e,
2455
- ymin: this.ymin - e,
2456
- xmax: this.xmin + e,
2457
- ymax: this.ymin + e
2458
- },
2459
- {
2460
- // Top right
2461
- xmin: this.xmax - e,
2462
- ymin: this.ymin - e,
2463
- xmax: this.xmax + e,
2464
- ymax: this.ymin + e
2465
- },
2466
- {
2467
- // Bottom right
2468
- xmin: this.xmax - e,
2469
- ymin: this.ymax - e,
2470
- xmax: this.xmax + e,
2471
- ymax: this.ymax + e
2472
- },
2473
- {
2474
- // Bottom left
2475
- xmin: this.xmin - e,
2476
- ymin: this.ymax - e,
2477
- xmax: this.xmin + e,
2478
- ymax: this.ymax + e
2479
- },
2480
- {
2481
- // Top center
2482
- xmin: this.xmin + t / 2 - e,
2483
- ymin: this.ymin - e,
2484
- xmax: this.xmin + t / 2 + e,
2485
- ymax: this.ymin + e
2486
- },
2487
- {
2488
- // Right center
2489
- xmin: this.xmax - e,
2490
- ymin: this.ymin + i / 2 - e,
2491
- xmax: this.xmax + e,
2492
- ymax: this.ymin + i / 2 + e
2493
- },
2494
- {
2495
- // Bottom center
2496
- xmin: this.xmin + t / 2 - e,
2497
- ymin: this.ymax - e,
2498
- xmax: this.xmin + t / 2 + e,
2499
- ymax: this.ymax + e
2500
- },
2501
- {
2502
- // Left center
2503
- xmin: this.xmin - e,
2504
- ymin: this.ymin + i / 2 - e,
2505
- xmax: this.xmin + e,
2506
- ymax: this.ymin + i / 2 + e
2507
- }
2508
- ];
2509
- }
2510
- getWidth() {
2511
- return this.xmax - this.xmin;
2512
- }
2513
- getHeight() {
2514
- return this.ymax - this.ymin;
2515
- }
2516
- getArea() {
2517
- return this.getWidth() * this.getHeight();
2518
- }
2519
- toCanvasCoordinates(e, t) {
2520
- return e = e + this.canvasXmin, t = t + this.canvasYmin, [e, t];
2521
- }
2522
- toBoxCoordinates(e, t) {
2523
- return e = e - this.canvasXmin, t = t - this.canvasYmin, [e, t];
2524
- }
2525
- render(e) {
2526
- let t, i;
2527
- if (e.beginPath(), [t, i] = this.toCanvasCoordinates(this.xmin, this.ymin), e.rect(t, i, this.getWidth(), this.getHeight()), e.fillStyle = bt(this.color, this.alpha), e.fill(), this.isSelected ? e.lineWidth = this.selectedThickness : e.lineWidth = this.thickness, e.strokeStyle = bt(this.color, 1), e.stroke(), e.closePath(), this.label !== null && this.label.trim() !== "") {
2528
- this.isSelected ? e.font = "bold 14px Arial" : e.font = "12px Arial";
2529
- const s = e.measureText(this.label).width + 10, o = 20;
2530
- let r = this.xmin, a = this.ymin - o;
2531
- e.fillStyle = "white", [r, a] = this.toCanvasCoordinates(r, a), e.fillRect(r, a, s, o), e.lineWidth = 1, e.strokeStyle = "black", e.strokeRect(r, a, s, o), e.fillStyle = "black", e.fillText(this.label, r + 5, a + 15);
2532
- }
2533
- e.fillStyle = bt(this.color, 1);
2534
- for (const s of this.resizeHandles)
2535
- [t, i] = this.toCanvasCoordinates(s.xmin, s.ymin), e.fillRect(
2536
- t,
2537
- i,
2538
- s.xmax - s.xmin,
2539
- s.ymax - s.ymin
2540
- );
2541
- }
2542
- startDrag(e) {
2543
- this.isDragging = !0, this.offsetMouseX = e.clientX - this.xmin, this.offsetMouseY = e.clientY - this.ymin, document.addEventListener("pointermove", this.handleDrag), document.addEventListener("pointerup", this.stopDrag);
2544
- }
2545
- isPointInsideBox(e, t) {
2546
- return [e, t] = this.toBoxCoordinates(e, t), e >= this.xmin && e <= this.xmax && t >= this.ymin && t <= this.ymax;
2547
- }
2548
- indexOfPointInsideHandle(e, t) {
2549
- [e, t] = this.toBoxCoordinates(e, t);
2550
- for (let i = 0; i < this.resizeHandles.length; i++) {
2551
- const s = this.resizeHandles[i];
2552
- if (e >= s.xmin && e <= s.xmax && t >= s.ymin && t <= s.ymax)
2553
- return this.resizingHandleIndex = i, i;
2554
- }
2555
- return -1;
2556
- }
2557
- startCreating(e, t, i) {
2558
- this.isCreating = !0, this.offsetMouseX = t, this.offsetMouseY = i, document.addEventListener("pointermove", this.handleCreating), document.addEventListener("pointerup", this.stopCreating);
2559
- }
2560
- startResize(e, t) {
2561
- this.resizingHandleIndex = e, this.isResizing = !0, this.offsetMouseX = t.clientX - this.resizeHandles[e].xmin, this.offsetMouseY = t.clientY - this.resizeHandles[e].ymin, document.addEventListener("pointermove", this.handleResize), document.addEventListener("pointerup", this.stopResize);
2562
- }
2563
- }
2564
- const re = [
2565
- "rgb(255, 168, 77)",
2566
- "rgb(92, 172, 238)",
2567
- "rgb(255, 99, 71)",
2568
- "rgb(118, 238, 118)",
2569
- "rgb(255, 145, 164)",
2570
- "rgb(0, 191, 255)",
2571
- "rgb(255, 218, 185)",
2572
- "rgb(255, 69, 0)",
2573
- "rgb(34, 139, 34)",
2574
- "rgb(255, 240, 245)",
2575
- "rgb(255, 193, 37)",
2576
- "rgb(255, 193, 7)",
2577
- "rgb(255, 250, 138)"
2578
- ], {
2579
- SvelteComponent: Al,
2580
- append: Ee,
2581
- attr: G,
2582
- binding_callbacks: Ml,
2583
- bubble: on,
2584
- check_outros: Ze,
2585
- create_component: He,
2586
- destroy_component: Xe,
2587
- detach: ce,
2588
- element: ve,
2589
- empty: Rl,
2590
- group_outros: Qe,
2591
- init: Hl,
2592
- insert: ue,
2593
- listen: le,
2594
- mount_component: Ye,
2595
- noop: Xl,
2596
- run_all: xn,
2597
- safe_not_equal: Yl,
2598
- space: Re,
2599
- toggle_class: Fe,
2600
- transition_in: q,
2601
- transition_out: U
2602
- } = window.__gradio__svelte__internal, { onMount: ql, onDestroy: Dl, createEventDispatcher: Ll } = window.__gradio__svelte__internal;
2603
- function an(n) {
2604
- let e, t, i, s, o, r, a, l, u, c;
2605
- i = new Zn({}), r = new li({});
2606
- let f = (
2607
- /*showRemoveButton*/
2608
- n[1] && rn(n)
2609
- );
2610
- return {
2611
- c() {
2612
- e = ve("span"), t = ve("button"), He(i.$$.fragment), s = Re(), o = ve("button"), He(r.$$.fragment), a = Re(), f && f.c(), G(t, "class", "icon svelte-3rql59"), G(t, "aria-label", "Create box"), Fe(
2613
- t,
2614
- "selected",
2615
- /*mode*/
2616
- n[8] === /*Mode*/
2617
- n[5].creation
2618
- ), G(o, "class", "icon svelte-3rql59"), G(o, "aria-label", "Edit boxes"), Fe(
2619
- o,
2620
- "selected",
2621
- /*mode*/
2622
- n[8] === /*Mode*/
2623
- n[5].drag
2624
- ), G(e, "class", "canvas-control svelte-3rql59");
2625
- },
2626
- m(d, g) {
2627
- ue(d, e, g), Ee(e, t), Ye(i, t, null), Ee(e, s), Ee(e, o), Ye(r, o, null), Ee(e, a), f && f.m(e, null), l = !0, u || (c = [
2628
- le(
2629
- t,
2630
- "click",
2631
- /*click_handler*/
2632
- n[30]
2633
- ),
2634
- le(
2635
- o,
2636
- "click",
2637
- /*click_handler_1*/
2638
- n[31]
2639
- )
2640
- ], u = !0);
2641
- },
2642
- p(d, g) {
2643
- (!l || g[0] & /*mode, Mode*/
2644
- 288) && Fe(
2645
- t,
2646
- "selected",
2647
- /*mode*/
2648
- d[8] === /*Mode*/
2649
- d[5].creation
2650
- ), (!l || g[0] & /*mode, Mode*/
2651
- 288) && Fe(
2652
- o,
2653
- "selected",
2654
- /*mode*/
2655
- d[8] === /*Mode*/
2656
- d[5].drag
2657
- ), /*showRemoveButton*/
2658
- d[1] ? f ? (f.p(d, g), g[0] & /*showRemoveButton*/
2659
- 2 && q(f, 1)) : (f = rn(d), f.c(), q(f, 1), f.m(e, null)) : f && (Qe(), U(f, 1, 1, () => {
2660
- f = null;
2661
- }), Ze());
2662
- },
2663
- i(d) {
2664
- l || (q(i.$$.fragment, d), q(r.$$.fragment, d), q(f), l = !0);
2665
- },
2666
- o(d) {
2667
- U(i.$$.fragment, d), U(r.$$.fragment, d), U(f), l = !1;
2668
- },
2669
- d(d) {
2670
- d && ce(e), Xe(i), Xe(r), f && f.d(), u = !1, xn(c);
2671
- }
2672
- };
2673
- }
2674
- function rn(n) {
2675
- let e, t, i, s, o;
2676
- return t = new mi({}), {
2677
- c() {
2678
- e = ve("button"), He(t.$$.fragment), G(e, "class", "icon svelte-3rql59"), G(e, "aria-label", "Remove boxes");
2679
- },
2680
- m(r, a) {
2681
- ue(r, e, a), Ye(t, e, null), i = !0, s || (o = le(
2682
- e,
2683
- "click",
2684
- /*click_handler_2*/
2685
- n[32]
2686
- ), s = !0);
2687
- },
2688
- p: Xl,
2689
- i(r) {
2690
- i || (q(t.$$.fragment, r), i = !0);
2691
- },
2692
- o(r) {
2693
- U(t.$$.fragment, r), i = !1;
2694
- },
2695
- d(r) {
2696
- r && ce(e), Xe(t), s = !1, o();
2697
- }
2698
- };
2699
- }
2700
- function fn(n) {
2701
- let e, t;
2702
- return e = new pn({
2703
- props: {
2704
- choices: (
2705
- /*choices*/
2706
- n[3]
2707
- ),
2708
- choicesColors: (
2709
- /*choicesColors*/
2710
- n[4]
2711
- ),
2712
- label: (
2713
- /*selectedBox*/
2714
- n[7] >= 0 && /*selectedBox*/
2715
- n[7] < /*value*/
2716
- n[0].boxes.length ? (
2717
- /*value*/
2718
- n[0].boxes[
2719
- /*selectedBox*/
2720
- n[7]
2721
- ].label
2722
- ) : ""
2723
- ),
2724
- color: (
2725
- /*selectedBox*/
2726
- n[7] >= 0 && /*selectedBox*/
2727
- n[7] < /*value*/
2728
- n[0].boxes.length ? qe(
2729
- /*value*/
2730
- n[0].boxes[
2731
- /*selectedBox*/
2732
- n[7]
2733
- ].color
2734
- ) : ""
2735
- )
2736
- }
2737
- }), e.$on(
2738
- "change",
2739
- /*onModalEditChange*/
2740
- n[16]
2741
- ), e.$on(
2742
- "enter{onModalEditChange}",
2743
- /*enter_onModalEditChange_handler*/
2744
- n[33]
2745
- ), {
2746
- c() {
2747
- He(e.$$.fragment);
2748
- },
2749
- m(i, s) {
2750
- Ye(e, i, s), t = !0;
2751
- },
2752
- p(i, s) {
2753
- const o = {};
2754
- s[0] & /*choices*/
2755
- 8 && (o.choices = /*choices*/
2756
- i[3]), s[0] & /*choicesColors*/
2757
- 16 && (o.choicesColors = /*choicesColors*/
2758
- i[4]), s[0] & /*selectedBox, value*/
2759
- 129 && (o.label = /*selectedBox*/
2760
- i[7] >= 0 && /*selectedBox*/
2761
- i[7] < /*value*/
2762
- i[0].boxes.length ? (
2763
- /*value*/
2764
- i[0].boxes[
2765
- /*selectedBox*/
2766
- i[7]
2767
- ].label
2768
- ) : ""), s[0] & /*selectedBox, value*/
2769
- 129 && (o.color = /*selectedBox*/
2770
- i[7] >= 0 && /*selectedBox*/
2771
- i[7] < /*value*/
2772
- i[0].boxes.length ? qe(
2773
- /*value*/
2774
- i[0].boxes[
2775
- /*selectedBox*/
2776
- i[7]
2777
- ].color
2778
- ) : ""), e.$set(o);
2779
- },
2780
- i(i) {
2781
- t || (q(e.$$.fragment, i), t = !0);
2782
- },
2783
- o(i) {
2784
- U(e.$$.fragment, i), t = !1;
2785
- },
2786
- d(i) {
2787
- Xe(e, i);
2788
- }
2789
- };
2790
- }
2791
- function cn(n) {
2792
- let e, t;
2793
- return e = new pn({
2794
- props: {
2795
- choices: (
2796
- /*choices*/
2797
- n[3]
2798
- ),
2799
- showRemove: !1,
2800
- choicesColors: (
2801
- /*choicesColors*/
2802
- n[4]
2803
- ),
2804
- label: (
2805
- /*selectedBox*/
2806
- n[7] >= 0 && /*selectedBox*/
2807
- n[7] < /*value*/
2808
- n[0].boxes.length ? (
2809
- /*value*/
2810
- n[0].boxes[
2811
- /*selectedBox*/
2812
- n[7]
2813
- ].label
2814
- ) : ""
2815
- ),
2816
- color: (
2817
- /*selectedBox*/
2818
- n[7] >= 0 && /*selectedBox*/
2819
- n[7] < /*value*/
2820
- n[0].boxes.length ? qe(
2821
- /*value*/
2822
- n[0].boxes[
2823
- /*selectedBox*/
2824
- n[7]
2825
- ].color
2826
- ) : ""
2827
- )
2828
- }
2829
- }), e.$on(
2830
- "change",
2831
- /*onModalNewChange*/
2832
- n[17]
2833
- ), e.$on(
2834
- "enter{onModalNewChange}",
2835
- /*enter_onModalNewChange_handler*/
2836
- n[34]
2837
- ), {
2838
- c() {
2839
- He(e.$$.fragment);
2840
- },
2841
- m(i, s) {
2842
- Ye(e, i, s), t = !0;
2843
- },
2844
- p(i, s) {
2845
- const o = {};
2846
- s[0] & /*choices*/
2847
- 8 && (o.choices = /*choices*/
2848
- i[3]), s[0] & /*choicesColors*/
2849
- 16 && (o.choicesColors = /*choicesColors*/
2850
- i[4]), s[0] & /*selectedBox, value*/
2851
- 129 && (o.label = /*selectedBox*/
2852
- i[7] >= 0 && /*selectedBox*/
2853
- i[7] < /*value*/
2854
- i[0].boxes.length ? (
2855
- /*value*/
2856
- i[0].boxes[
2857
- /*selectedBox*/
2858
- i[7]
2859
- ].label
2860
- ) : ""), s[0] & /*selectedBox, value*/
2861
- 129 && (o.color = /*selectedBox*/
2862
- i[7] >= 0 && /*selectedBox*/
2863
- i[7] < /*value*/
2864
- i[0].boxes.length ? qe(
2865
- /*value*/
2866
- i[0].boxes[
2867
- /*selectedBox*/
2868
- i[7]
2869
- ].color
2870
- ) : ""), e.$set(o);
2871
- },
2872
- i(i) {
2873
- t || (q(e.$$.fragment, i), t = !0);
2874
- },
2875
- o(i) {
2876
- U(e.$$.fragment, i), t = !1;
2877
- },
2878
- d(i) {
2879
- Xe(e, i);
2880
- }
2881
- };
2882
- }
2883
- function Tl(n) {
2884
- let e, t, i, s, o, r, a, l, u, c = (
2885
- /*interactive*/
2886
- n[2] && an(n)
2887
- ), f = (
2888
- /*editModalVisible*/
2889
- n[9] && fn(n)
2890
- ), d = (
2891
- /*newModalVisible*/
2892
- n[10] && cn(n)
2893
- );
2894
- return {
2895
- c() {
2896
- e = ve("div"), t = ve("canvas"), i = Re(), c && c.c(), s = Re(), f && f.c(), o = Re(), d && d.c(), r = Rl(), G(t, "class", "canvas-annotator svelte-3rql59"), G(e, "class", "canvas-container svelte-3rql59"), G(e, "tabindex", "-1");
2897
- },
2898
- m(g, y) {
2899
- ue(g, e, y), Ee(e, t), n[29](t), ue(g, i, y), c && c.m(g, y), ue(g, s, y), f && f.m(g, y), ue(g, o, y), d && d.m(g, y), ue(g, r, y), a = !0, l || (u = [
2900
- le(
2901
- t,
2902
- "pointerdown",
2903
- /*handlePointerDown*/
2904
- n[11]
2905
- ),
2906
- le(
2907
- t,
2908
- "pointerup",
2909
- /*handlePointerUp*/
2910
- n[12]
2911
- ),
2912
- le(
2913
- t,
2914
- "dblclick",
2915
- /*handleDoubleClick*/
2916
- n[15]
2917
- ),
2918
- le(
2919
- e,
2920
- "focusin",
2921
- /*handleCanvasFocus*/
2922
- n[19]
2923
- ),
2924
- le(
2925
- e,
2926
- "focusout",
2927
- /*handleCanvasBlur*/
2928
- n[20]
2929
- )
2930
- ], l = !0);
2931
- },
2932
- p(g, y) {
2933
- /*interactive*/
2934
- g[2] ? c ? (c.p(g, y), y[0] & /*interactive*/
2935
- 4 && q(c, 1)) : (c = an(g), c.c(), q(c, 1), c.m(s.parentNode, s)) : c && (Qe(), U(c, 1, 1, () => {
2936
- c = null;
2937
- }), Ze()), /*editModalVisible*/
2938
- g[9] ? f ? (f.p(g, y), y[0] & /*editModalVisible*/
2939
- 512 && q(f, 1)) : (f = fn(g), f.c(), q(f, 1), f.m(o.parentNode, o)) : f && (Qe(), U(f, 1, 1, () => {
2940
- f = null;
2941
- }), Ze()), /*newModalVisible*/
2942
- g[10] ? d ? (d.p(g, y), y[0] & /*newModalVisible*/
2943
- 1024 && q(d, 1)) : (d = cn(g), d.c(), q(d, 1), d.m(r.parentNode, r)) : d && (Qe(), U(d, 1, 1, () => {
2944
- d = null;
2945
- }), Ze());
2946
- },
2947
- i(g) {
2948
- a || (q(c), q(f), q(d), a = !0);
2949
- },
2950
- o(g) {
2951
- U(c), U(f), U(d), a = !1;
2952
- },
2953
- d(g) {
2954
- g && (ce(e), ce(i), ce(s), ce(o), ce(r)), n[29](null), c && c.d(g), f && f.d(g), d && d.d(g), l = !1, xn(u);
2955
- }
2956
- };
2957
- }
2958
- function wt(n) {
2959
- var e = parseInt(n.slice(1, 3), 16), t = parseInt(n.slice(3, 5), 16), i = parseInt(n.slice(5, 7), 16);
2960
- return "rgb(" + e + ", " + t + ", " + i + ")";
2961
- }
2962
- function qe(n) {
2963
- const e = n.match(/(\d+(\.\d+)?)/g), t = parseInt(e[0]), i = parseInt(e[1]), s = parseInt(e[2]);
2964
- return "#" + (1 << 24 | t << 16 | i << 8 | s).toString(16).slice(1);
2965
- }
2966
- function Il(n, e, t) {
2967
- var i;
2968
- (function(b) {
2969
- b[b.creation = 0] = "creation", b[b.drag = 1] = "drag";
2970
- })(i || (i = {}));
2971
- let { imageUrl: s = null } = e, { interactive: o } = e, { boxAlpha: r = 0.5 } = e, { boxMinSize: a = 25 } = e, { handleSize: l } = e, { boxThickness: u } = e, { boxSelectedThickness: c } = e, { value: f } = e, { choices: d = [] } = e, { choicesColors: g = [] } = e, { disableEditBoxes: y = !1 } = e, { singleBox: v = !1 } = e, { showRemoveButton: w = null } = e;
2972
- w === null && (w = y);
2973
- let h, x, m = null, k = -1, _ = i.drag;
2974
- f !== null && f.boxes.length == 0 && (_ = i.creation);
2975
- let A = 0, B = 0, C = 0, M = 0, Y = 1, j = 0, S = 0, J = !1, Q = !1;
2976
- const $ = Ll();
2977
- function W() {
2978
- if (x) {
2979
- x.clearRect(0, 0, h.width, h.height), m !== null && x.drawImage(m, A, B, j, S);
2980
- for (const b of f.boxes.slice().reverse())
2981
- b.render(x);
2982
- }
2983
- }
2984
- function oe(b) {
2985
- t(7, k = b), f.boxes.forEach((E) => {
2986
- E.setSelected(!1);
2987
- }), b >= 0 && b < f.boxes.length && f.boxes[b].setSelected(!0), W();
2988
- }
2989
- function lt(b) {
2990
- o && (b.target instanceof Element && b.target.hasPointerCapture(b.pointerId) && b.target.releasePointerCapture(b.pointerId), _ === i.creation ? at(b) : _ === i.drag && ot(b));
2991
- }
2992
- function ot(b) {
2993
- const E = h.getBoundingClientRect(), H = b.clientX - E.left, V = b.clientY - E.top;
2994
- for (const [L, D] of f.boxes.entries()) {
2995
- const Xt = D.indexOfPointInsideHandle(H, V);
2996
- if (Xt >= 0) {
2997
- oe(L), D.startResize(Xt, b);
2998
- return;
2999
- }
3000
- }
3001
- for (const [L, D] of f.boxes.entries())
3002
- if (D.isPointInsideBox(H, V)) {
3003
- oe(L), D.startDrag(b);
3004
- return;
3005
- }
3006
- oe(-1);
3007
- }
3008
- function z(b) {
3009
- $("change");
3010
- }
3011
- function Oe(b) {
3012
- if (o)
3013
- switch (b.key) {
3014
- case "Delete":
3015
- he();
3016
- break;
3017
- }
3018
- }
3019
- function at(b) {
3020
- const E = h.getBoundingClientRect(), H = (b.clientX - E.left - A) / Y, V = (b.clientY - E.top - B) / Y;
3021
- let L;
3022
- g.length > 0 ? L = wt(g[0]) : v ? f.boxes.length > 0 ? L = f.boxes[0].color : L = re[0] : L = re[f.boxes.length % re.length];
3023
- let D = new gt(W, Rt, A, B, C, M, "", H, V, H, V, L, r, a, l, u, c);
3024
- D.startCreating(b, E.left, E.top), v ? t(0, f.boxes = [D], f) : t(0, f.boxes = [D, ...f.boxes], f), oe(0), W(), $("change");
3025
- }
3026
- function At() {
3027
- t(8, _ = i.creation), t(6, h.style.cursor = "crosshair", h);
3028
- }
3029
- function Mt() {
3030
- t(8, _ = i.drag), t(6, h.style.cursor = "default", h);
3031
- }
3032
- function Rt() {
3033
- k >= 0 && k < f.boxes.length && (f.boxes[k].getArea() < 1 ? he() : y || t(10, Q = !0));
3034
- }
3035
- function Cn() {
3036
- k >= 0 && k < f.boxes.length && !y && t(9, J = !0);
3037
- }
3038
- function Sn(b) {
3039
- o && Cn();
3040
- }
3041
- function zn(b) {
3042
- t(9, J = !1);
3043
- const { detail: E } = b;
3044
- let H = E.label, V = E.color, L = E.ret;
3045
- if (k >= 0 && k < f.boxes.length) {
3046
- let D = f.boxes[k];
3047
- L == 1 ? (D.label = H, D.color = wt(V), W(), $("change")) : L == -1 && he();
3048
- }
3049
- }
3050
- function Bn(b) {
3051
- t(10, Q = !1);
3052
- const { detail: E } = b;
3053
- let H = E.label, V = E.color, L = E.ret;
3054
- if (k >= 0 && k < f.boxes.length) {
3055
- let D = f.boxes[k];
3056
- L == 1 ? (D.label = H, D.color = wt(V), W(), $("change")) : he();
3057
- }
3058
- }
3059
- function he() {
3060
- k >= 0 && k < f.boxes.length && (f.boxes.splice(k, 1), oe(-1), $("change"));
3061
- }
3062
- function Ue() {
3063
- if (h) {
3064
- if (Y = 1, t(6, h.width = h.clientWidth, h), m !== null)
3065
- if (m.width > h.width)
3066
- Y = h.width / m.width, j = m.width * Y, S = m.height * Y, A = 0, B = 0, C = j, M = S, t(6, h.height = S, h);
3067
- else {
3068
- j = m.width, S = m.height;
3069
- var b = (h.width - j) / 2;
3070
- A = b, B = 0, C = b + j, M = m.height, t(6, h.height = S, h);
3071
- }
3072
- else
3073
- A = 0, B = 0, C = h.width, M = h.height, t(6, h.height = h.clientHeight, h);
3074
- if (C > 0 && M > 0)
3075
- for (const E of f.boxes)
3076
- E.canvasXmin = A, E.canvasYmin = B, E.canvasXmax = C, E.canvasYmax = M, E.setScaleFactor(Y);
3077
- W(), $("change");
3078
- }
3079
- }
3080
- const En = new ResizeObserver(Ue);
3081
- function An() {
3082
- for (let b = 0; b < f.boxes.length; b++) {
3083
- let E = f.boxes[b];
3084
- if (!(E instanceof gt)) {
3085
- let H = "", V = "";
3086
- E.hasOwnProperty("color") ? (H = E.color, Array.isArray(H) && H.length === 3 && (H = `rgb(${H[0]}, ${H[1]}, ${H[2]})`)) : H = re[b % re.length], E.hasOwnProperty("label") && (V = E.label), E = new gt(W, Rt, A, B, C, M, V, E.xmin, E.ymin, E.xmax, E.ymax, H, r, a, l, u, c), t(0, f.boxes[b] = E, f);
3087
- }
3088
- }
3089
- }
3090
- function Ht() {
3091
- s !== null && (m === null || m.src != s) && (m = new Image(), m.src = s, m.onload = function() {
3092
- Ue(), W();
3093
- });
3094
- }
3095
- ql(() => {
3096
- if (Array.isArray(d) && d.length > 0 && (!Array.isArray(g) || g.length == 0))
3097
- for (let b = 0; b < d.length; b++) {
3098
- let E = re[b % re.length];
3099
- g.push(qe(E));
3100
- }
3101
- x = h.getContext("2d"), En.observe(h), Ht(), Ue(), W();
3102
- });
3103
- function Mn() {
3104
- document.addEventListener("keydown", Oe);
3105
- }
3106
- function Rn() {
3107
- document.removeEventListener("keydown", Oe);
3108
- }
3109
- Dl(() => {
3110
- document.removeEventListener("keydown", Oe);
3111
- });
3112
- function Hn(b) {
3113
- Ml[b ? "unshift" : "push"](() => {
3114
- h = b, t(6, h);
3115
- });
3116
- }
3117
- const Xn = () => At(), Yn = () => Mt(), qn = () => he();
3118
- function Dn(b) {
3119
- on.call(this, n, b);
3120
- }
3121
- function Ln(b) {
3122
- on.call(this, n, b);
3123
- }
3124
- return n.$$set = (b) => {
3125
- "imageUrl" in b && t(21, s = b.imageUrl), "interactive" in b && t(2, o = b.interactive), "boxAlpha" in b && t(22, r = b.boxAlpha), "boxMinSize" in b && t(23, a = b.boxMinSize), "handleSize" in b && t(24, l = b.handleSize), "boxThickness" in b && t(25, u = b.boxThickness), "boxSelectedThickness" in b && t(26, c = b.boxSelectedThickness), "value" in b && t(0, f = b.value), "choices" in b && t(3, d = b.choices), "choicesColors" in b && t(4, g = b.choicesColors), "disableEditBoxes" in b && t(27, y = b.disableEditBoxes), "singleBox" in b && t(28, v = b.singleBox), "showRemoveButton" in b && t(1, w = b.showRemoveButton);
3126
- }, n.$$.update = () => {
3127
- n.$$.dirty[0] & /*value*/
3128
- 1 && (Ht(), An(), Ue(), W());
3129
- }, [
3130
- f,
3131
- w,
3132
- o,
3133
- d,
3134
- g,
3135
- i,
3136
- h,
3137
- k,
3138
- _,
3139
- J,
3140
- Q,
3141
- lt,
3142
- z,
3143
- At,
3144
- Mt,
3145
- Sn,
3146
- zn,
3147
- Bn,
3148
- he,
3149
- Mn,
3150
- Rn,
3151
- s,
3152
- r,
3153
- a,
3154
- l,
3155
- u,
3156
- c,
3157
- y,
3158
- v,
3159
- Hn,
3160
- Xn,
3161
- Yn,
3162
- qn,
3163
- Dn,
3164
- Ln
3165
- ];
3166
- }
3167
- class Ol extends Al {
3168
- constructor(e) {
3169
- super(), Hl(
3170
- this,
3171
- e,
3172
- Il,
3173
- Tl,
3174
- Yl,
3175
- {
3176
- imageUrl: 21,
3177
- interactive: 2,
3178
- boxAlpha: 22,
3179
- boxMinSize: 23,
3180
- handleSize: 24,
3181
- boxThickness: 25,
3182
- boxSelectedThickness: 26,
3183
- value: 0,
3184
- choices: 3,
3185
- choicesColors: 4,
3186
- disableEditBoxes: 27,
3187
- singleBox: 28,
3188
- showRemoveButton: 1
3189
- },
3190
- null,
3191
- [-1, -1]
3192
- );
3193
- }
3194
- }
3195
- const {
3196
- SvelteComponent: Ul,
3197
- add_flush_callback: Wl,
3198
- bind: Vl,
3199
- binding_callbacks: jl,
3200
- create_component: Nl,
3201
- destroy_component: Pl,
3202
- init: Fl,
3203
- mount_component: Kl,
3204
- safe_not_equal: Gl,
3205
- transition_in: Jl,
3206
- transition_out: Zl
3207
- } = window.__gradio__svelte__internal, { createEventDispatcher: Ql } = window.__gradio__svelte__internal;
3208
- function $l(n) {
3209
- let e, t, i;
3210
- function s(r) {
3211
- n[16](r);
3212
- }
3213
- let o = {
3214
- interactive: (
3215
- /*interactive*/
3216
- n[1]
3217
- ),
3218
- boxAlpha: (
3219
- /*boxesAlpha*/
3220
- n[2]
3221
- ),
3222
- choices: (
3223
- /*labelList*/
3224
- n[3]
3225
- ),
3226
- choicesColors: (
3227
- /*labelColors*/
3228
- n[4]
3229
- ),
3230
- boxMinSize: (
3231
- /*boxMinSize*/
3232
- n[5]
3233
- ),
3234
- handleSize: (
3235
- /*handleSize*/
3236
- n[6]
3237
- ),
3238
- boxThickness: (
3239
- /*boxThickness*/
3240
- n[7]
3241
- ),
3242
- boxSelectedThickness: (
3243
- /*boxSelectedThickness*/
3244
- n[8]
3245
- ),
3246
- disableEditBoxes: (
3247
- /*disableEditBoxes*/
3248
- n[9]
3249
- ),
3250
- singleBox: (
3251
- /*singleBox*/
3252
- n[10]
3253
- ),
3254
- showRemoveButton: (
3255
- /*showRemoveButton*/
3256
- n[11]
3257
- ),
3258
- imageUrl: (
3259
- /*resolved_src*/
3260
- n[12]
3261
- )
3262
- };
3263
- return (
3264
- /*value*/
3265
- n[0] !== void 0 && (o.value = /*value*/
3266
- n[0]), e = new Ol({ props: o }), jl.push(() => Vl(e, "value", s)), e.$on(
3267
- "change",
3268
- /*change_handler*/
3269
- n[17]
3270
- ), {
3271
- c() {
3272
- Nl(e.$$.fragment);
3273
- },
3274
- m(r, a) {
3275
- Kl(e, r, a), i = !0;
3276
- },
3277
- p(r, [a]) {
3278
- const l = {};
3279
- a & /*interactive*/
3280
- 2 && (l.interactive = /*interactive*/
3281
- r[1]), a & /*boxesAlpha*/
3282
- 4 && (l.boxAlpha = /*boxesAlpha*/
3283
- r[2]), a & /*labelList*/
3284
- 8 && (l.choices = /*labelList*/
3285
- r[3]), a & /*labelColors*/
3286
- 16 && (l.choicesColors = /*labelColors*/
3287
- r[4]), a & /*boxMinSize*/
3288
- 32 && (l.boxMinSize = /*boxMinSize*/
3289
- r[5]), a & /*handleSize*/
3290
- 64 && (l.handleSize = /*handleSize*/
3291
- r[6]), a & /*boxThickness*/
3292
- 128 && (l.boxThickness = /*boxThickness*/
3293
- r[7]), a & /*boxSelectedThickness*/
3294
- 256 && (l.boxSelectedThickness = /*boxSelectedThickness*/
3295
- r[8]), a & /*disableEditBoxes*/
3296
- 512 && (l.disableEditBoxes = /*disableEditBoxes*/
3297
- r[9]), a & /*singleBox*/
3298
- 1024 && (l.singleBox = /*singleBox*/
3299
- r[10]), a & /*showRemoveButton*/
3300
- 2048 && (l.showRemoveButton = /*showRemoveButton*/
3301
- r[11]), a & /*resolved_src*/
3302
- 4096 && (l.imageUrl = /*resolved_src*/
3303
- r[12]), !t && a & /*value*/
3304
- 1 && (t = !0, l.value = /*value*/
3305
- r[0], Wl(() => t = !1)), e.$set(l);
3306
- },
3307
- i(r) {
3308
- i || (Jl(e.$$.fragment, r), i = !0);
3309
- },
3310
- o(r) {
3311
- Zl(e.$$.fragment, r), i = !1;
3312
- },
3313
- d(r) {
3314
- Pl(e, r);
3315
- }
3316
- }
3317
- );
3318
- }
3319
- function eo(n, e, t) {
3320
- let { src: i = void 0 } = e, { interactive: s } = e, { boxesAlpha: o } = e, { labelList: r } = e, { labelColors: a } = e, { boxMinSize: l } = e, { handleSize: u } = e, { boxThickness: c } = e, { boxSelectedThickness: f } = e, { value: d } = e, { disableEditBoxes: g } = e, { singleBox: y } = e, { showRemoveButton: v } = e, w, h;
3321
- const x = Ql();
3322
- function m(_) {
3323
- d = _, t(0, d);
3324
- }
3325
- const k = () => x("change");
3326
- return n.$$set = (_) => {
3327
- "src" in _ && t(14, i = _.src), "interactive" in _ && t(1, s = _.interactive), "boxesAlpha" in _ && t(2, o = _.boxesAlpha), "labelList" in _ && t(3, r = _.labelList), "labelColors" in _ && t(4, a = _.labelColors), "boxMinSize" in _ && t(5, l = _.boxMinSize), "handleSize" in _ && t(6, u = _.handleSize), "boxThickness" in _ && t(7, c = _.boxThickness), "boxSelectedThickness" in _ && t(8, f = _.boxSelectedThickness), "value" in _ && t(0, d = _.value), "disableEditBoxes" in _ && t(9, g = _.disableEditBoxes), "singleBox" in _ && t(10, y = _.singleBox), "showRemoveButton" in _ && t(11, v = _.showRemoveButton);
3328
- }, n.$$.update = () => {
3329
- if (n.$$.dirty & /*src, latest_src*/
3330
- 49152) {
3331
- t(12, w = i), t(15, h = i);
3332
- const _ = i;
3333
- jn(_).then((A) => {
3334
- h === _ && t(12, w = A);
3335
- });
3336
- }
3337
- }, [
3338
- d,
3339
- s,
3340
- o,
3341
- r,
3342
- a,
3343
- l,
3344
- u,
3345
- c,
3346
- f,
3347
- g,
3348
- y,
3349
- v,
3350
- w,
3351
- x,
3352
- i,
3353
- h,
3354
- m,
3355
- k
3356
- ];
3357
- }
3358
- class to extends Ul {
3359
- constructor(e) {
3360
- super(), Fl(this, e, eo, $l, Gl, {
3361
- src: 14,
3362
- interactive: 1,
3363
- boxesAlpha: 2,
3364
- labelList: 3,
3365
- labelColors: 4,
3366
- boxMinSize: 5,
3367
- handleSize: 6,
3368
- boxThickness: 7,
3369
- boxSelectedThickness: 8,
3370
- value: 0,
3371
- disableEditBoxes: 9,
3372
- singleBox: 10,
3373
- showRemoveButton: 11
3374
- });
3375
- }
3376
- }
3377
- const {
3378
- SvelteComponent: no,
3379
- attr: io,
3380
- check_outros: so,
3381
- create_component: lo,
3382
- destroy_component: oo,
3383
- detach: ao,
3384
- element: ro,
3385
- group_outros: fo,
3386
- init: co,
3387
- insert: uo,
3388
- mount_component: ho,
3389
- safe_not_equal: mo,
3390
- toggle_class: ne,
3391
- transition_in: $e,
3392
- transition_out: St
3393
- } = window.__gradio__svelte__internal;
3394
- function un(n) {
3395
- let e, t;
3396
- return e = new to({
3397
- props: {
3398
- src: (
3399
- /*samples_dir*/
3400
- n[1] + /*value*/
3401
- n[0].path
3402
- ),
3403
- alt: ""
3404
- }
3405
- }), {
3406
- c() {
3407
- lo(e.$$.fragment);
3408
- },
3409
- m(i, s) {
3410
- ho(e, i, s), t = !0;
3411
- },
3412
- p(i, s) {
3413
- const o = {};
3414
- s & /*samples_dir, value*/
3415
- 3 && (o.src = /*samples_dir*/
3416
- i[1] + /*value*/
3417
- i[0].path), e.$set(o);
3418
- },
3419
- i(i) {
3420
- t || ($e(e.$$.fragment, i), t = !0);
3421
- },
3422
- o(i) {
3423
- St(e.$$.fragment, i), t = !1;
3424
- },
3425
- d(i) {
3426
- oo(e, i);
3427
  }
3428
  };
3429
  }
3430
- function _o(n) {
3431
- let e, t, i = (
3432
  /*value*/
3433
- n[0] && un(n)
3434
  );
3435
  return {
3436
  c() {
3437
- e = ro("div"), i && i.c(), io(e, "class", "container svelte-1sgcyba"), ne(
3438
  e,
3439
  "table",
3440
  /*type*/
3441
- n[2] === "table"
3442
- ), ne(
3443
  e,
3444
  "gallery",
3445
  /*type*/
3446
- n[2] === "gallery"
3447
- ), ne(
3448
  e,
3449
  "selected",
3450
  /*selected*/
3451
- n[3]
3452
- ), ne(
3453
  e,
3454
  "border",
3455
  /*value*/
3456
  n[0]
3457
  );
3458
  },
3459
- m(s, o) {
3460
- uo(s, e, o), i && i.m(e, null), t = !0;
3461
  },
3462
- p(s, [o]) {
3463
  /*value*/
3464
- s[0] ? i ? (i.p(s, o), o & /*value*/
3465
- 1 && $e(i, 1)) : (i = un(s), i.c(), $e(i, 1), i.m(e, null)) : i && (fo(), St(i, 1, 1, () => {
3466
- i = null;
3467
- }), so()), (!t || o & /*type*/
3468
- 4) && ne(
3469
  e,
3470
  "table",
3471
  /*type*/
3472
- s[2] === "table"
3473
- ), (!t || o & /*type*/
3474
- 4) && ne(
3475
  e,
3476
  "gallery",
3477
  /*type*/
3478
- s[2] === "gallery"
3479
- ), (!t || o & /*selected*/
3480
- 8) && ne(
3481
  e,
3482
  "selected",
3483
  /*selected*/
3484
- s[3]
3485
- ), (!t || o & /*value*/
3486
- 1) && ne(
3487
  e,
3488
  "border",
3489
  /*value*/
3490
- s[0]
3491
  );
3492
  },
3493
- i(s) {
3494
- t || ($e(i), t = !0);
3495
- },
3496
- o(s) {
3497
- St(i), t = !1;
3498
- },
3499
- d(s) {
3500
- s && ao(e), i && i.d();
3501
  }
3502
  };
3503
  }
3504
- function bo(n, e, t) {
3505
- let { value: i } = e, { samples_dir: s } = e, { type: o } = e, { selected: r = !1 } = e;
3506
- return n.$$set = (a) => {
3507
- "value" in a && t(0, i = a.value), "samples_dir" in a && t(1, s = a.samples_dir), "type" in a && t(2, o = a.type), "selected" in a && t(3, r = a.selected);
3508
- }, [i, s, o, r];
3509
  }
3510
- class wo extends no {
3511
  constructor(e) {
3512
- super(), co(this, e, bo, _o, mo, {
3513
- value: 0,
3514
- samples_dir: 1,
3515
- type: 2,
3516
- selected: 3
3517
- });
3518
  }
3519
  }
3520
  export {
3521
- wo as default
3522
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  const {
2
+ SvelteComponent: m,
3
+ attr: f,
4
+ detach: o,
5
+ element: d,
6
+ init: b,
7
+ insert: g,
8
+ noop: c,
9
+ safe_not_equal: v,
10
+ src_url_equal: u,
11
+ toggle_class: a
12
+ } = window.__gradio__svelte__internal;
13
+ function _(n) {
14
+ let e, l;
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  return {
16
  c() {
17
+ e = d("img"), u(e.src, l = /*value*/
18
+ n[0].url) || f(e, "src", l), f(e, "alt", "");
 
 
19
  },
20
  m(t, i) {
21
+ g(t, e, i);
22
  },
23
  p(t, i) {
24
+ i & /*value*/
25
+ 1 && !u(e.src, l = /*value*/
26
+ t[0].url) && f(e, "src", l);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  },
28
  d(t) {
29
+ t && o(e);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
  };
32
  }
33
+ function y(n) {
34
+ let e, l = (
35
  /*value*/
36
+ n[0] && _(n)
37
  );
38
  return {
39
  c() {
40
+ e = d("div"), l && l.c(), f(e, "class", "container svelte-1sgcyba"), a(
41
  e,
42
  "table",
43
  /*type*/
44
+ n[1] === "table"
45
+ ), a(
46
  e,
47
  "gallery",
48
  /*type*/
49
+ n[1] === "gallery"
50
+ ), a(
51
  e,
52
  "selected",
53
  /*selected*/
54
+ n[2]
55
+ ), a(
56
  e,
57
  "border",
58
  /*value*/
59
  n[0]
60
  );
61
  },
62
+ m(t, i) {
63
+ g(t, e, i), l && l.m(e, null);
64
  },
65
+ p(t, [i]) {
66
  /*value*/
67
+ t[0] ? l ? l.p(t, i) : (l = _(t), l.c(), l.m(e, null)) : l && (l.d(1), l = null), i & /*type*/
68
+ 2 && a(
 
 
 
69
  e,
70
  "table",
71
  /*type*/
72
+ t[1] === "table"
73
+ ), i & /*type*/
74
+ 2 && a(
75
  e,
76
  "gallery",
77
  /*type*/
78
+ t[1] === "gallery"
79
+ ), i & /*selected*/
80
+ 4 && a(
81
  e,
82
  "selected",
83
  /*selected*/
84
+ t[2]
85
+ ), i & /*value*/
86
+ 1 && a(
87
  e,
88
  "border",
89
  /*value*/
90
+ t[0]
91
  );
92
  },
93
+ i: c,
94
+ o: c,
95
+ d(t) {
96
+ t && o(e), l && l.d();
 
 
 
 
97
  }
98
  };
99
  }
100
+ function h(n, e, l) {
101
+ let { value: t } = e, { type: i } = e, { selected: r = !1 } = e;
102
+ return n.$$set = (s) => {
103
+ "value" in s && l(0, t = s.value), "type" in s && l(1, i = s.type), "selected" in s && l(2, r = s.selected);
104
+ }, [t, i, r];
105
  }
106
+ class k extends m {
107
  constructor(e) {
108
+ super(), b(this, e, h, y, v, { value: 0, type: 1, selected: 2 });
 
 
 
 
 
109
  }
110
  }
111
  export {
112
+ k as default
113
  };
src/backend/gradio_image_annotation/templates/example/style.css CHANGED
@@ -1 +1 @@
1
- .block.svelte-nl1om8{position:relative;margin:0;box-shadow:var(--block-shadow);border-width:var(--block-border-width);border-color:var(--block-border-color);border-radius:var(--block-radius);background:var(--block-background-fill);width:100%;line-height:var(--line-sm)}.block.border_focus.svelte-nl1om8{border-color:var(--color-accent)}.block.border_contrast.svelte-nl1om8{border-color:var(--body-text-color)}.padded.svelte-nl1om8{padding:var(--block-padding)}.hidden.svelte-nl1om8{display:none}.hide-container.svelte-nl1om8{margin:0;box-shadow:none;--block-border-width:0;background:transparent;padding:0;overflow:visible}div.svelte-1hnfib2{margin-bottom:var(--spacing-lg);color:var(--block-info-text-color);font-weight:var(--block-info-text-weight);font-size:var(--block-info-text-size);line-height:var(--line-sm)}span.has-info.svelte-22c38v{margin-bottom:var(--spacing-xs)}span.svelte-22c38v:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-22c38v{display:inline-block;position:relative;z-index:var(--layer-4);border:solid var(--block-title-border-width) var(--block-title-border-color);border-radius:var(--block-title-radius);background:var(--block-title-background-fill);padding:var(--block-title-padding);color:var(--block-title-text-color);font-weight:var(--block-title-text-weight);font-size:var(--block-title-text-size);line-height:var(--line-sm)}.hide.svelte-22c38v{margin:0;height:0}label.svelte-9gxdi0{display:inline-flex;align-items:center;z-index:var(--layer-2);box-shadow:var(--block-label-shadow);border:var(--block-label-border-width) solid var(--border-color-primary);border-top:none;border-left:none;border-radius:var(--block-label-radius);background:var(--block-label-background-fill);padding:var(--block-label-padding);pointer-events:none;color:var(--block-label-text-color);font-weight:var(--block-label-text-weight);font-size:var(--block-label-text-size);line-height:var(--line-sm)}.gr-group label.svelte-9gxdi0{border-top-left-radius:0}label.float.svelte-9gxdi0{position:absolute;top:var(--block-label-margin);left:var(--block-label-margin)}label.svelte-9gxdi0:not(.float){position:static;margin-top:var(--block-label-margin);margin-left:var(--block-label-margin)}.hide.svelte-9gxdi0{height:0}span.svelte-9gxdi0{opacity:.8;margin-right:var(--size-2);width:calc(var(--block-label-text-size) - 1px);height:calc(var(--block-label-text-size) - 1px)}.hide-label.svelte-9gxdi0{box-shadow:none;border-width:0;background:transparent;overflow:visible}button.svelte-1lrphxw{display:flex;justify-content:center;align-items:center;gap:1px;z-index:var(--layer-2);border-radius:var(--radius-sm);color:var(--block-label-text-color);border:1px solid transparent}button[disabled].svelte-1lrphxw{opacity:.5;box-shadow:none}button[disabled].svelte-1lrphxw:hover{cursor:not-allowed}.padded.svelte-1lrphxw{padding:2px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color)}button.svelte-1lrphxw:hover,button.highlight.svelte-1lrphxw{cursor:pointer;color:var(--color-accent)}.padded.svelte-1lrphxw:hover{border:2px solid var(--button-secondary-border-color-hover);padding:1px;color:var(--block-label-text-color)}span.svelte-1lrphxw{padding:0 1px;font-size:10px}div.svelte-1lrphxw{padding:2px;display:flex;align-items:flex-end}.small.svelte-1lrphxw{width:14px;height:14px}.medium.svelte-1lrphxw{width:20px;height:20px}.large.svelte-1lrphxw{width:22px;height:22px}.pending.svelte-1lrphxw{animation:svelte-1lrphxw-flash .5s infinite}@keyframes svelte-1lrphxw-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-1lrphxw{background:transparent;border:none;box-shadow:none}.empty.svelte-3w3rth{display:flex;justify-content:center;align-items:center;margin-top:calc(0px - var(--size-6));height:var(--size-full)}.icon.svelte-3w3rth{opacity:.5;height:var(--size-5);color:var(--body-text-color)}.small.svelte-3w3rth{min-height:calc(var(--size-32) - 20px)}.large.svelte-3w3rth{min-height:calc(var(--size-64) - 20px)}.unpadded_box.svelte-3w3rth{margin-top:0}.small_parent.svelte-3w3rth{min-height:100%!important}.dropdown-arrow.svelte-145leq6{fill:currentColor}.wrap.svelte-kzcjhc{display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:var(--size-60);color:var(--block-label-text-color);line-height:var(--line-md);height:100%;padding-top:var(--size-3)}.or.svelte-kzcjhc{color:var(--body-text-color-subdued);display:flex}.icon-wrap.svelte-kzcjhc{width:30px;margin-bottom:var(--spacing-lg)}@media (--screen-md){.wrap.svelte-kzcjhc{font-size:var(--text-lg)}}.hovered.svelte-kzcjhc{color:var(--color-accent)}div.svelte-q32hvf{border-top:1px solid transparent;display:flex;max-height:100%;justify-content:center;align-items:center;gap:var(--spacing-sm);height:auto;align-items:flex-end;color:var(--block-label-text-color);flex-shrink:0}.show_border.svelte-q32hvf{border-top:1px solid var(--block-border-color);margin-top:var(--spacing-xxl);box-shadow:var(--shadow-drop)}.source-selection.svelte-1jp3vgd{display:flex;align-items:center;justify-content:center;border-top:1px solid var(--border-color-primary);width:95%;bottom:0;left:0;right:0;margin-left:auto;margin-right:auto}.icon.svelte-1jp3vgd{width:22px;height:22px;margin:var(--spacing-lg) var(--spacing-xs);padding:var(--spacing-xs);color:var(--neutral-400);border-radius:var(--radius-md)}.selected.svelte-1jp3vgd{color:var(--color-accent)}.icon.svelte-1jp3vgd:hover,.icon.svelte-1jp3vgd:focus{color:var(--color-accent)}input.svelte-16l8u73{display:block;position:relative;background:var(--background-fill-primary);line-height:var(--line-sm)}.wrap.svelte-1yserjw.svelte-1yserjw{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-1yserjw.svelte-1yserjw{top:0;right:0;left:0}.wrap.default.svelte-1yserjw.svelte-1yserjw{top:0;right:0;bottom:0;left:0}.hide.svelte-1yserjw.svelte-1yserjw{opacity:0;pointer-events:none}.generating.svelte-1yserjw.svelte-1yserjw{animation:svelte-1yserjw-pulse 2s cubic-bezier(.4,0,.6,1) infinite;border:2px solid var(--color-accent);background:transparent;z-index:var(--layer-1)}.translucent.svelte-1yserjw.svelte-1yserjw{background:none}@keyframes svelte-1yserjw-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-1yserjw.svelte-1yserjw{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-1yserjw.svelte-1yserjw{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-1yserjw.svelte-1yserjw{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-1yserjw.svelte-1yserjw{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-1yserjw.svelte-1yserjw{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-1yserjw.svelte-1yserjw{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-1yserjw.svelte-1yserjw{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-1yserjw.svelte-1yserjw{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-1yserjw.svelte-1yserjw{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-1yserjw .progress-text.svelte-1yserjw{background:var(--block-background-fill)}.border.svelte-1yserjw.svelte-1yserjw{border:1px solid var(--border-color-primary)}div.svelte-1vvnm05{width:var(--size-10);height:var(--size-10)}.table.svelte-1vvnm05{margin:0 auto}button.svelte-8huxfn,a.svelte-8huxfn{display:inline-flex;justify-content:center;align-items:center;transition:var(--button-transition);box-shadow:var(--button-shadow);padding:var(--size-0-5) var(--size-2);text-align:center}button.svelte-8huxfn:hover,button[disabled].svelte-8huxfn,a.svelte-8huxfn:hover,a.disabled.svelte-8huxfn{box-shadow:var(--button-shadow-hover)}button.svelte-8huxfn:active,a.svelte-8huxfn:active{box-shadow:var(--button-shadow-active)}button[disabled].svelte-8huxfn,a.disabled.svelte-8huxfn{opacity:.5;filter:grayscale(30%);cursor:not-allowed}.hidden.svelte-8huxfn{display:none}.primary.svelte-8huxfn{border:var(--button-border-width) solid var(--button-primary-border-color);background:var(--button-primary-background-fill);color:var(--button-primary-text-color)}.primary.svelte-8huxfn:hover,.primary[disabled].svelte-8huxfn{border-color:var(--button-primary-border-color-hover);background:var(--button-primary-background-fill-hover);color:var(--button-primary-text-color-hover)}.secondary.svelte-8huxfn{border:var(--button-border-width) solid var(--button-secondary-border-color);background:var(--button-secondary-background-fill);color:var(--button-secondary-text-color)}.secondary.svelte-8huxfn:hover,.secondary[disabled].svelte-8huxfn{border-color:var(--button-secondary-border-color-hover);background:var(--button-secondary-background-fill-hover);color:var(--button-secondary-text-color-hover)}.stop.svelte-8huxfn{border:var(--button-border-width) solid var(--button-cancel-border-color);background:var(--button-cancel-background-fill);color:var(--button-cancel-text-color)}.stop.svelte-8huxfn:hover,.stop[disabled].svelte-8huxfn{border-color:var(--button-cancel-border-color-hover);background:var(--button-cancel-background-fill-hover);color:var(--button-cancel-text-color-hover)}.sm.svelte-8huxfn{border-radius:var(--button-small-radius);padding:var(--button-small-padding);font-weight:var(--button-small-text-weight);font-size:var(--button-small-text-size)}.lg.svelte-8huxfn{border-radius:var(--button-large-radius);padding:var(--button-large-padding);font-weight:var(--button-large-text-weight);font-size:var(--button-large-text-size)}.button-icon.svelte-8huxfn{width:var(--text-xl);height:var(--text-xl);margin-right:var(--spacing-xl)}.options.svelte-yuohum{--window-padding:var(--size-8);position:fixed;z-index:var(--layer-top);margin-left:0;box-shadow:var(--shadow-drop-lg);border-radius:var(--container-radius);background:var(--background-fill-primary);min-width:fit-content;max-width:inherit;overflow:auto;color:var(--body-text-color);list-style:none}.item.svelte-yuohum{display:flex;cursor:pointer;padding:var(--size-2)}.item.svelte-yuohum:hover,.active.svelte-yuohum{background:var(--background-fill-secondary)}.inner-item.svelte-yuohum{padding-right:var(--size-1)}.hide.svelte-yuohum{visibility:hidden}.icon-wrap.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{color:var(--body-text-color);margin-right:var(--size-2);width:var(--size-5)}label.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg:not(.container),label.svelte-xtjjyg:not(.container) .wrap.svelte-xtjjyg.svelte-xtjjyg,label.svelte-xtjjyg:not(.container) .wrap-inner.svelte-xtjjyg.svelte-xtjjyg,label.svelte-xtjjyg:not(.container) .secondary-wrap.svelte-xtjjyg.svelte-xtjjyg,label.svelte-xtjjyg:not(.container) .token.svelte-xtjjyg.svelte-xtjjyg,label.svelte-xtjjyg:not(.container) input.svelte-xtjjyg.svelte-xtjjyg{height:100%}.container.svelte-xtjjyg .wrap.svelte-xtjjyg.svelte-xtjjyg{box-shadow:var(--input-shadow);border:var(--input-border-width) solid var(--border-color-primary)}.wrap.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{position:relative;border-radius:var(--input-radius);background:var(--input-background-fill)}.wrap.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg:focus-within{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus)}.wrap-inner.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{display:flex;position:relative;flex-wrap:wrap;align-items:center;gap:var(--checkbox-label-gap);padding:var(--checkbox-label-padding)}.token.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{display:flex;align-items:center;transition:var(--button-transition);cursor:pointer;box-shadow:var(--checkbox-label-shadow);border:var(--checkbox-label-border-width) solid var(--checkbox-label-border-color);border-radius:var(--button-small-radius);background:var(--checkbox-label-background-fill);padding:var(--checkbox-label-padding);color:var(--checkbox-label-text-color);font-weight:var(--checkbox-label-text-weight);font-size:var(--checkbox-label-text-size);line-height:var(--line-md)}.token.svelte-xtjjyg>.svelte-xtjjyg+.svelte-xtjjyg{margin-left:var(--size-2)}.token-remove.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{fill:var(--body-text-color);display:flex;justify-content:center;align-items:center;cursor:pointer;border:var(--checkbox-border-width) solid var(--border-color-primary);border-radius:var(--radius-full);background:var(--background-fill-primary);padding:var(--size-0-5);width:16px;height:16px}.secondary-wrap.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{display:flex;flex:1 1 0%;align-items:center;border:none;min-width:min-content}input.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{margin:var(--spacing-sm);outline:none;border:none;background:inherit;width:var(--size-full);color:var(--body-text-color);font-size:var(--input-text-size)}input.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg:disabled{-webkit-text-fill-color:var(--body-text-color);-webkit-opacity:1;opacity:1;cursor:not-allowed}.remove-all.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{margin-left:var(--size-1);width:20px;height:20px}.subdued.svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{color:var(--body-text-color-subdued)}input[readonly].svelte-xtjjyg.svelte-xtjjyg.svelte-xtjjyg{cursor:pointer}.icon-wrap.svelte-1m1zvyj.svelte-1m1zvyj{color:var(--body-text-color);margin-right:var(--size-2);width:var(--size-5)}.container.svelte-1m1zvyj.svelte-1m1zvyj{height:100%}.container.svelte-1m1zvyj .wrap.svelte-1m1zvyj{box-shadow:var(--input-shadow);border:var(--input-border-width) solid var(--border-color-primary)}.wrap.svelte-1m1zvyj.svelte-1m1zvyj{position:relative;border-radius:var(--input-radius);background:var(--input-background-fill)}.wrap.svelte-1m1zvyj.svelte-1m1zvyj:focus-within{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus)}.wrap-inner.svelte-1m1zvyj.svelte-1m1zvyj{display:flex;position:relative;flex-wrap:wrap;align-items:center;gap:var(--checkbox-label-gap);padding:var(--checkbox-label-padding);height:100%}.secondary-wrap.svelte-1m1zvyj.svelte-1m1zvyj{display:flex;flex:1 1 0%;align-items:center;border:none;min-width:min-content;height:100%}input.svelte-1m1zvyj.svelte-1m1zvyj{margin:var(--spacing-sm);outline:none;border:none;background:inherit;width:var(--size-full);color:var(--body-text-color);font-size:var(--input-text-size);height:100%}input.svelte-1m1zvyj.svelte-1m1zvyj:disabled{-webkit-text-fill-color:var(--body-text-color);-webkit-opacity:1;opacity:1;cursor:not-allowed}.subdued.svelte-1m1zvyj.svelte-1m1zvyj{color:var(--body-text-color-subdued)}input[readonly].svelte-1m1zvyj.svelte-1m1zvyj{cursor:pointer}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-16nch4a.svelte-16nch4a{display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:var(--layer-2);transition:opacity .1s ease-in-out;border-radius:var(--block-radius);background:var(--block-background-fill);padding:0 var(--size-6);max-height:var(--size-screen-h);overflow:hidden}.wrap.center.svelte-16nch4a.svelte-16nch4a{top:0;right:0;left:0}.wrap.default.svelte-16nch4a.svelte-16nch4a{top:0;right:0;bottom:0;left:0}.hide.svelte-16nch4a.svelte-16nch4a{opacity:0;pointer-events:none}.generating.svelte-16nch4a.svelte-16nch4a{animation:svelte-16nch4a-pulseStart 1s cubic-bezier(.4,0,.6,1),svelte-16nch4a-pulse 2s cubic-bezier(.4,0,.6,1) 1s infinite;border:2px solid var(--color-accent);background:transparent;z-index:var(--layer-1);pointer-events:none}.translucent.svelte-16nch4a.svelte-16nch4a{background:none}@keyframes svelte-16nch4a-pulseStart{0%{opacity:0}to{opacity:1}}@keyframes svelte-16nch4a-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-16nch4a.svelte-16nch4a{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-16nch4a.svelte-16nch4a{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-16nch4a.svelte-16nch4a{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-16nch4a.svelte-16nch4a{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-16nch4a.svelte-16nch4a{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-16nch4a.svelte-16nch4a{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-16nch4a.svelte-16nch4a{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-16nch4a.svelte-16nch4a{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-16nch4a.svelte-16nch4a{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-16nch4a .progress-text.svelte-16nch4a{background:var(--block-background-fill)}.border.svelte-16nch4a.svelte-16nch4a{border:1px solid var(--border-color-primary)}.clear-status.svelte-16nch4a.svelte-16nch4a{position:absolute;display:flex;top:var(--size-2);right:var(--size-2);justify-content:flex-end;gap:var(--spacing-sm);z-index:var(--layer-1)}.toast-body.svelte-solcu7{display:flex;position:relative;right:0;left:0;align-items:center;margin:var(--size-6) var(--size-4);margin:auto;border-radius:var(--container-radius);overflow:hidden;pointer-events:auto}.toast-body.error.svelte-solcu7{border:1px solid var(--color-red-700);background:var(--color-red-50)}.dark .toast-body.error.svelte-solcu7{border:1px solid var(--color-red-500);background-color:var(--color-grey-950)}.toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-700);background:var(--color-yellow-50)}.dark .toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-500);background-color:var(--color-grey-950)}.toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-700);background:var(--color-grey-50)}.dark .toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-500);background-color:var(--color-grey-950)}.toast-title.svelte-solcu7{display:flex;align-items:center;font-weight:var(--weight-bold);font-size:var(--text-lg);line-height:var(--line-sm);text-transform:capitalize}.toast-title.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-title.error.svelte-solcu7{color:var(--color-red-50)}.toast-title.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-title.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-title.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-title.info.svelte-solcu7{color:var(--color-grey-50)}.toast-close.svelte-solcu7{margin:0 var(--size-3);border-radius:var(--size-3);padding:0px var(--size-1-5);font-size:var(--size-5);line-height:var(--size-5)}.toast-close.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-close.error.svelte-solcu7{color:var(--color-red-500)}.toast-close.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-close.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-close.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-close.info.svelte-solcu7{color:var(--color-grey-500)}.toast-text.svelte-solcu7{font-size:var(--text-lg)}.toast-text.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-text.error.svelte-solcu7{color:var(--color-red-50)}.toast-text.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-text.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-text.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-text.info.svelte-solcu7{color:var(--color-grey-50)}.toast-details.svelte-solcu7{margin:var(--size-3) var(--size-3) var(--size-3) 0;width:100%}.toast-icon.svelte-solcu7{display:flex;position:absolute;position:relative;flex-shrink:0;justify-content:center;align-items:center;margin:var(--size-2);border-radius:var(--radius-full);padding:var(--size-1);padding-left:calc(var(--size-1) - 1px);width:35px;height:35px}.toast-icon.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-icon.error.svelte-solcu7{color:var(--color-red-500)}.toast-icon.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-icon.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-icon.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-icon.info.svelte-solcu7{color:var(--color-grey-500)}@keyframes svelte-solcu7-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.timer.svelte-solcu7{position:absolute;bottom:0;left:0;transform-origin:0 0;animation:svelte-solcu7-countdown 10s linear forwards;width:100%;height:var(--size-1)}.timer.error.svelte-solcu7{background:var(--color-red-700)}.dark .timer.error.svelte-solcu7{background:var(--color-red-500)}.timer.warning.svelte-solcu7{background:var(--color-yellow-700)}.dark .timer.warning.svelte-solcu7{background:var(--color-yellow-500)}.timer.info.svelte-solcu7{background:var(--color-grey-700)}.dark .timer.info.svelte-solcu7{background:var(--color-grey-500)}.toast-wrap.svelte-gatr8h{display:flex;position:fixed;top:var(--size-4);right:var(--size-4);flex-direction:column;align-items:end;gap:var(--size-2);z-index:var(--layer-top);width:calc(100% - var(--size-8))}@media (--screen-sm){.toast-wrap.svelte-gatr8h{width:calc(var(--size-96) + var(--size-10))}}.gallery.svelte-1gecy8w{padding:var(--size-1) var(--size-2)}.modal.svelte-hkn2q1{position:fixed;left:0;top:0;width:100%;height:100%;z-index:var(--layer-top);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.modal-container.svelte-hkn2q1{border-style:solid;border-width:var(--block-border-width);margin-top:10%;padding:20px;box-shadow:var(--block-shadow);border-color:var(--block-border-color);border-radius:var(--block-radius);background:var(--block-background-fill);position:fixed;left:50%;transform:translate(-50%);width:fit-content}.model-content.svelte-hkn2q1{display:flex;align-items:flex-end}.canvas-annotator.svelte-3rql59{border-color:var(--block-border-color);width:100%;height:100%;display:block;touch-action:none}.canvas-control.svelte-3rql59{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;margin-top:var(--size-2)}.icon.svelte-3rql59{width:22px;height:22px;margin:var(--spacing-lg) var(--spacing-xs);padding:var(--spacing-xs);color:var(--neutral-400);border-radius:var(--radius-md)}.icon.svelte-3rql59:hover,.icon.svelte-3rql59:focus{color:var(--color-accent)}.selected.svelte-3rql59{color:var(--color-accent)}.canvas-container.svelte-3rql59:focus{outline:none}.container.svelte-1sgcyba img{width:100%;height:100%}.container.selected.svelte-1sgcyba{border-color:var(--border-color-accent)}.border.table.svelte-1sgcyba{border:2px solid var(--border-color-primary)}.container.table.svelte-1sgcyba{margin:0 auto;border-radius:var(--radius-lg);overflow:hidden;width:var(--size-20);height:var(--size-20);object-fit:cover}.container.gallery.svelte-1sgcyba{width:var(--size-20);max-width:var(--size-20);object-fit:cover}
 
1
+ .container.svelte-1sgcyba img{width:100%;height:100%}.container.selected.svelte-1sgcyba{border-color:var(--border-color-accent)}.border.table.svelte-1sgcyba{border:2px solid var(--border-color-primary)}.container.table.svelte-1sgcyba{margin:0 auto;border-radius:var(--radius-lg);overflow:hidden;width:var(--size-20);height:var(--size-20);object-fit:cover}.container.gallery.svelte-1sgcyba{width:var(--size-20);max-width:var(--size-20);object-fit:cover}
src/demo/space.py CHANGED
@@ -1,19 +1,3 @@
1
- ---
2
- tags:
3
- - gradio-custom-component
4
- - gradio-template-Image
5
- - bounding box
6
- - annotator
7
- - annotate
8
- - boxes
9
- title: gradio_image_annotation V0.2.2
10
- colorFrom: yellow
11
- colorTo: green
12
- sdk: docker
13
- pinned: false
14
- license: apache-2.0
15
- short_description: A Gradio component for image annotation
16
- ---
17
 
18
  import gradio as gr
19
  from app import demo as app
@@ -80,18 +64,32 @@ example_annotation = {
80
  ]
81
  }
82
 
83
- example_crop = {
84
- "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png",
85
- "boxes": [
86
- {
87
- "xmin": 30,
88
- "ymin": 70,
89
- "xmax": 530,
90
- "ymax": 500,
91
- "color": (100, 200, 255)
92
- }
93
- ]
94
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
96
 
97
  def crop(annotations):
@@ -122,7 +120,7 @@ with gr.Blocks() as demo:
122
  with gr.Tab("Crop"):
123
  with gr.Row():
124
  annotator_crop = image_annotator(
125
- example_crop,
126
  image_type="numpy",
127
  disable_edit_boxes=True,
128
  single_box=True,
@@ -131,6 +129,7 @@ with gr.Blocks() as demo:
131
  button_crop = gr.Button("Crop")
132
  button_crop.click(crop, annotator_crop, image_crop)
133
 
 
134
 
135
  if __name__ == "__main__":
136
  demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
  import gradio as gr
3
  from app import demo as app
 
64
  ]
65
  }
66
 
67
+ examples_crop = [
68
+ {
69
+ "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png",
70
+ "boxes": [
71
+ {
72
+ "xmin": 30,
73
+ "ymin": 70,
74
+ "xmax": 530,
75
+ "ymax": 500,
76
+ "color": (100, 200, 255),
77
+ }
78
+ ],
79
+ },
80
+ {
81
+ "image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png",
82
+ "boxes": [
83
+ {
84
+ "xmin": 636,
85
+ "ymin": 575,
86
+ "xmax": 801,
87
+ "ymax": 697,
88
+ "color": (255, 0, 0),
89
+ },
90
+ ],
91
+ },
92
+ ]
93
 
94
 
95
  def crop(annotations):
 
120
  with gr.Tab("Crop"):
121
  with gr.Row():
122
  annotator_crop = image_annotator(
123
+ examples_crop[0],
124
  image_type="numpy",
125
  disable_edit_boxes=True,
126
  single_box=True,
 
129
  button_crop = gr.Button("Crop")
130
  button_crop.click(crop, annotator_crop, image_crop)
131
 
132
+ gr.Examples(examples_crop, annotator_crop)
133
 
134
  if __name__ == "__main__":
135
  demo.launch()