luo-image-annotator 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var ae = Object.defineProperty;
|
|
2
|
-
var le = (
|
|
3
|
-
var T = (
|
|
2
|
+
var le = (x, t, n) => t in x ? ae(x, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : x[t] = n;
|
|
3
|
+
var T = (x, t, n) => le(x, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { defineComponent as ct, ref as M, watchEffect as ce, openBlock as v, createElementBlock as m, normalizeClass as X, computed as V, onMounted as yt, nextTick as at, watch as K, createElementVNode as h, toDisplayString as z, Fragment as N, renderList as J, normalizeStyle as U, createCommentVNode as B, createVNode as R, withModifiers as It, createBlock as vt, withDirectives as ft, vModelText as mt, createTextVNode as lt } from "vue";
|
|
5
|
-
const pt = (
|
|
5
|
+
const pt = (x, t) => Math.sqrt(Math.pow(x.x - t.x, 2) + Math.pow(x.y - t.y, 2)), re = (x, t) => {
|
|
6
6
|
let n = !1;
|
|
7
7
|
for (let e = 0, a = t.length - 1; e < t.length; a = e++) {
|
|
8
8
|
const o = t[e].x, c = t[e].y, g = t[a].x, u = t[a].y;
|
|
9
|
-
c >
|
|
9
|
+
c > x.y != u > x.y && x.x < (g - o) * (x.y - c) / (u - c) + o && (n = !n);
|
|
10
10
|
}
|
|
11
11
|
return n;
|
|
12
|
-
}, At = (
|
|
13
|
-
const e = n * (Math.PI / 180), a = Math.cos(e), o = Math.sin(e), c =
|
|
12
|
+
}, At = (x, t, n) => {
|
|
13
|
+
const e = n * (Math.PI / 180), a = Math.cos(e), o = Math.sin(e), c = x.x - t.x, g = x.y - t.y;
|
|
14
14
|
return {
|
|
15
15
|
x: t.x + (c * a - g * o),
|
|
16
16
|
y: t.y + (c * o + g * a)
|
|
@@ -372,8 +372,8 @@ class he {
|
|
|
372
372
|
let k = Math.atan2(r, u) * 180 / Math.PI;
|
|
373
373
|
k += 90, o.angle = k;
|
|
374
374
|
} else {
|
|
375
|
-
const c = o.angle * Math.PI / 180, g = Math.cos(-c), u = Math.sin(-c), r = a.x - o.x, k = a.y - o.y,
|
|
376
|
-
(e === 0 || e === 3) && (o.width / 2, o.width = Math.abs(
|
|
375
|
+
const c = o.angle * Math.PI / 180, g = Math.cos(-c), u = Math.sin(-c), r = a.x - o.x, k = a.y - o.y, w = r * g - k * u, D = r * u + k * g;
|
|
376
|
+
(e === 0 || e === 3) && (o.width / 2, o.width = Math.abs(w) * 2), (e === 1 || e === 2) && (o.width = Math.abs(w) * 2), (e === 0 || e === 1) && (o.height = Math.abs(D) * 2), (e === 2 || e === 3) && (o.height = Math.abs(D) * 2);
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
}
|
|
@@ -429,7 +429,7 @@ class he {
|
|
|
429
429
|
return t.coordinates.points;
|
|
430
430
|
if (t.type === "rotatedRect") {
|
|
431
431
|
const n = t.coordinates, e = { x: n.x, y: n.y }, a = n.width / 2, o = n.height / 2, c = { x: n.x - a, y: n.y - o }, g = { x: n.x + a, y: n.y - o }, u = { x: n.x + a, y: n.y + o }, r = { x: n.x - a, y: n.y + o }, k = { x: n.x, y: n.y - o - 20 / this.scale };
|
|
432
|
-
return [c, g, u, r, k].map((
|
|
432
|
+
return [c, g, u, r, k].map((w) => At(w, e, n.angle));
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
return [];
|
|
@@ -448,7 +448,11 @@ class he {
|
|
|
448
448
|
o ? (this.canvas.style.cursor = "move", this.hoverAnnotation = o) : (this.canvas.style.cursor = "default", this.hoverAnnotation = null);
|
|
449
449
|
}
|
|
450
450
|
render() {
|
|
451
|
-
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.img.complete
|
|
451
|
+
if (this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), !this.img.complete || this.img.width === 0) {
|
|
452
|
+
this.ctx.save(), this.ctx.fillStyle = "#999", this.ctx.font = "14px sans-serif", this.ctx.textAlign = "center", this.ctx.textBaseline = "middle", this.ctx.fillText("Loading image...", this.canvas.width / 2, this.canvas.height / 2), this.ctx.restore();
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
this.ctx.drawImage(this.img, this.offset.x, this.offset.y, this.img.width * this.scale, this.img.height * this.scale), this.annotations.forEach((t) => {
|
|
452
456
|
t !== this.activeAnnotation && this.drawItem(t, !1);
|
|
453
457
|
}), this.activeAnnotation && this.drawItem(this.activeAnnotation, !0), this.renderCategories();
|
|
454
458
|
}
|
|
@@ -462,8 +466,8 @@ class he {
|
|
|
462
466
|
const a = e.label || "未命名分类", o = this.ctx.measureText(a).width + n * 2, c = 28, g = this.activeAnnotation === e, u = this.hoverAnnotation === e;
|
|
463
467
|
let r = { x: 20, y: 20 };
|
|
464
468
|
e.coordinates && typeof e.coordinates.x == "number" && typeof e.coordinates.y == "number" && (r = this.toScreenCoords(e.coordinates.x, e.coordinates.y));
|
|
465
|
-
const k = r.x - o / 2,
|
|
466
|
-
this.ctx.fillStyle = g ? D : this.hexToRgba(D, 0.85), u && !g && (this.ctx.fillStyle = D), g ? (this.ctx.strokeStyle = "#ffffff", this.ctx.lineWidth = 2) : (this.ctx.strokeStyle = "transparent", this.ctx.lineWidth = 0), this.ctx.beginPath(), this.ctx.roundRect(k,
|
|
469
|
+
const k = r.x - o / 2, w = r.y - c / 2, D = ((_ = e.style) == null ? void 0 : _.strokeColor) || "#2196F3";
|
|
470
|
+
this.ctx.fillStyle = g ? D : this.hexToRgba(D, 0.85), u && !g && (this.ctx.fillStyle = D), g ? (this.ctx.strokeStyle = "#ffffff", this.ctx.lineWidth = 2) : (this.ctx.strokeStyle = "transparent", this.ctx.lineWidth = 0), this.ctx.beginPath(), this.ctx.roundRect(k, w, o, c, 6), this.ctx.fill(), g && (this.ctx.stroke(), this.ctx.save(), this.ctx.strokeStyle = D, this.ctx.lineWidth = 2, this.ctx.strokeRect(k - 3, w - 3, o + 6, c + 6), this.ctx.restore()), this.ctx.fillStyle = "#ffffff", this.ctx.fillText(a, r.x, r.y);
|
|
467
471
|
}), this.ctx.restore();
|
|
468
472
|
}
|
|
469
473
|
getHitCategory(t, n) {
|
|
@@ -474,9 +478,9 @@ class he {
|
|
|
474
478
|
let c = null;
|
|
475
479
|
for (let g = e.length - 1; g >= 0; g--) {
|
|
476
480
|
const u = e[g], r = u.label || "未命名分类", k = this.ctx.measureText(r).width + a * 2;
|
|
477
|
-
let
|
|
478
|
-
u.coordinates && typeof u.coordinates.x == "number" && typeof u.coordinates.y == "number" && (
|
|
479
|
-
const D =
|
|
481
|
+
let w = { x: 20, y: 20 };
|
|
482
|
+
u.coordinates && typeof u.coordinates.x == "number" && typeof u.coordinates.y == "number" && (w = this.toScreenCoords(u.coordinates.x, u.coordinates.y));
|
|
483
|
+
const D = w.x - k / 2, _ = w.y - o / 2;
|
|
480
484
|
if (t >= D && t <= D + k && n >= _ && n <= _ + o) {
|
|
481
485
|
c = u;
|
|
482
486
|
break;
|
|
@@ -491,8 +495,8 @@ class he {
|
|
|
491
495
|
this.ctx.save();
|
|
492
496
|
const e = ((o = t.style) == null ? void 0 : o.strokeColor) || "#FF4081", a = n ? "#00E5FF" : e;
|
|
493
497
|
if (this.ctx.strokeStyle = a, this.ctx.lineWidth = 2, t.type === "rectangle") {
|
|
494
|
-
const c = t.coordinates, g = this.toScreenCoords(c.x1, c.y1), u = this.toScreenCoords(c.x2, c.y2), r = Math.min(g.x, u.x), k = Math.min(g.y, u.y),
|
|
495
|
-
this.ctx.strokeRect(r, k,
|
|
498
|
+
const c = t.coordinates, g = this.toScreenCoords(c.x1, c.y1), u = this.toScreenCoords(c.x2, c.y2), r = Math.min(g.x, u.x), k = Math.min(g.y, u.y), w = Math.abs(g.x - u.x), D = Math.abs(g.y - u.y);
|
|
499
|
+
this.ctx.strokeRect(r, k, w, D), n && this.drawHandles(this.getAnnotationHandles(t));
|
|
496
500
|
} else if (t.type === "polygon") {
|
|
497
501
|
const c = t.coordinates;
|
|
498
502
|
if (c.points.length === 0) {
|
|
@@ -537,24 +541,24 @@ class he {
|
|
|
537
541
|
});
|
|
538
542
|
}
|
|
539
543
|
}
|
|
540
|
-
const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032114659" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21132" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 391.68c-66.56 0-120.32 54.187-120.32 120.32 0 66.56 53.76 120.32 120.32 120.32 66.133 0 120.32-53.76 120.32-120.32A120.747 120.747 0 0 0 512 391.68z" p-id="21133" fill="#515151"></path><path d="M512 113.493c-219.733 0-398.507 178.774-398.507 398.507S292.267 910.507 512 910.507 910.507 731.733 910.507 512 731.733 113.493 512 113.493z m0 720.214c-177.493 0-321.707-144.214-321.707-321.707S334.507 190.293 512 190.293 833.707 334.507 833.707 512 689.493 833.707 512 833.707z" p-id="21134" fill="#515151"></path></svg>', ge = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M15.7 4.3c.4.4.4 1 0 1.4L9.4 12l6.3 6.3c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-7-7c-.4-.4-.4-1 0-1.4l7-7c.4-.4 1-.4 1.4 0z"/></svg>', ue = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032015085" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16560" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M911.872 972.629333l-2.645333-1.621333-209.92-208.554667-91.306667 193.194667-147.029333-494.933333 486.4 179.968-177.834667 68.266666 201.472 200.362667a9.898667 9.898667 0 0 1 2.133333 4.608 10.069333 10.069333 0 0 1-1.024 4.778667l-2.389333 3.157333-47.786667 47.530667a9.813333 9.813333 0 0 1-4.522666 2.901333 12.544 12.544 0 0 1-2.56 0z m-657.066667-12.970666L0.256 501.248l97.109333-175.445333 64.256-115.456L254.805333 42.581333h510.208l259.328 466.858667h-100.608L714.325333 132.778667H305.322667l-204.8 368.384 204.8 368.725333H418.133333v90.026667z" fill="#515151" p-id="16561"></path></svg>', ve = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032973956" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6763" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M613.6 960H97.2c-17.7 0-32-14.3-32-32V98.5c0-17.7 14.3-32 32-32h829.5c17.7 0 32 14.3 32 32v518.2c0 17.7-14.3 32-32 32s-32-14.3-32-32V130.5H129.2V896h484.4c17.7 0 32 14.3 32 32s-14.3 32-32 32z" fill="#515151" p-id="6764"></path><path d="M711.3 694.9l120.3 46.9-100.7 80.7z" fill="#515151" p-id="6765"></path><path d="M707.6 882.1L671.3 645l223.6 87.1-187.3 150z m43.7-137.3l2.8 18 14.2-11.4-17-6.6z" fill="#515151" p-id="6766"></path><path d="M927 957.9c-8.2 0-16.4-3.1-22.6-9.4L723.2 767.2c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l181.2 181.2c12.5 12.5 12.5 32.8 0 45.3-6.3 6.3-14.5 9.5-22.7 9.5z" fill="#515151" p-id="6767"></path></svg>', fe = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M19 6h-4V5c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v1H5c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1zM10 5h4v1h-4V5z"/><path fill="currentColor" d="M6 9v10c0 1.7 1.3 3 3 3h6c1.7 0 3-1.3 3-3V9H6zm4 9c0 .6-.4 1-1 1s-1-.4-1-1v-5c0-.6.4-1 1-1s1 .4 1 1v5zm4 0c0 .6-.4 1-1 1s-1-.4-1-1v-5c0-.6.4-1 1-1s1 .4 1 1v5z"/></svg>', me = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M19 15v4c0 1.1-.9 2-2 2H7c-1.1 0-2-.9-2-2v-4c0-.6.4-1 1-1s1 .4 1 1v4h10v-4c0-.6.4-1 1-1s1 .4 1 1zm-7.7 1.3c.2.2.4.3.7.3s.5-.1.7-.3l4.6-4.6c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0l-2.9 2.9V3c0-.6-.4-1-1-1s-1 .4-1 1v8.3l-2.9-2.9c-.4-.4-1-.4-1.4 0-.4.4-.4 1 0 1.4l4.6 4.6z"/></svg>', pe = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M3 17.2v4.3c0 .3.2.5.5.5h4.3c.1 0 .3-.1.4-.2l11.1-11.1-5.1-5.1L3.1 16.8c-.1.1-.1.3-.1.4zm18.8-10.9c.4-.4.4-1 0-1.4l-3.7-3.7c-.4-.4-1-.4-1.4 0l-2.3 2.3 5.1 5.1 2.3-2.3z"/></svg>', ye = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M18.7 4.3c.4.4.4 1 0 1.4L12.4 12l6.3 6.3c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-7-7c-.4-.4-.4-1 0-1.4l7-7c.4-.4 1-.4 1.4 0z"/><path fill="currentColor" d="M10.7 4.3c.4.4.4 1 0 1.4L4.4 12l6.3 6.3c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-7-7c-.4-.4-.4-1 0-1.4l7-7c.4-.4 1-.4 1.4 0z"/></svg>', we = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032412624" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3527" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M870.2976 144.0256l51.2 51.2-122.88 122.88a514.304 514.304 0 0 1 170.7264 193.8688C885.0432 679.04 711.8848 793.6 512 793.6c-56.832 0-111.488-9.2672-162.56-26.3424L197.4016 919.296l-51.2-51.2L870.2976 144.0256z m-127.1552 229.5296l-76.6208 76.6208a166.4 166.4 0 0 1-216.32 216.3712l-38.6048 38.5792c29.5168 6.9632 60.032 10.9312 91.1872 11.5712L512 716.8c150.6816 0 287.488-77.2096 366.464-200.3456l2.816-4.48-2.816-4.48a435.8144 435.8144 0 0 0-135.3216-133.9392zM512 230.4c49.664 0 97.664 7.0656 143.0528 20.2496l-63.8208 63.7696a436.4032 436.4032 0 0 0-70.016-7.1168L512 307.2a434.8928 434.8928 0 0 0-366.464 200.3456l-2.816 4.48 2.816 4.48a435.84 435.84 0 0 0 119.8848 123.776l-55.0912 55.04a514.2528 514.2528 0 0 1-155.648-183.296C138.9312 344.96 312.0896 230.4 512 230.4z m89.5488 284.8l-86.3744 86.2976 1.7408-0.0256a89.6 89.6 0 0 0 84.6336-86.272zM512 345.6a166.656 166.656 0 0 1 42.5728 5.504l-79.0272 79.0272a89.9328 89.9328 0 0 0-45.4144 45.4144l-79.0272 79.0272A166.4 166.4 0 0 1 512 345.6z" p-id="3528" fill="#515151"></path></svg>', xe = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M5.3 19.7c-.4-.4-.4-1 0-1.4l6.3-6.3-6.3-6.3c-.4-.4-.4-1 0-1.4.4-.4 1-.4 1.4 0l7 7c.4.4.4 1 0 1.4l-7 7c-.4.4-1 .4-1.4 0z"/><path fill="currentColor" d="M13.3 19.7c-.4-.4-.4-1 0-1.4l6.3-6.3-6.3-6.3c-.4-.4-.4-1 0-1.4.4-.4 1-.4 1.4 0l7 7c.4.4.4 1 0 1.4l-7 7c-.4.4-1 .4-1.4 0z"/></svg>', be = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775031871732" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12257" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M174.63 78.98c0.03-12.61 16.41-19.91 25.81-11.5l328.72 293.98 318.27 284.63c10.51 9.4 0.4 26.75-14.25 24.46L435.7 608.43c-6.23-0.97-12.72 1.92-16.16 7.2L199.96 952.72c-8.09 12.42-27.76 8.34-27.72-5.76l1.17-426.97 1.22-441.01z" fill="#515151" p-id="12258"></path></svg>', Ce = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032210611" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="23146" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M543.487882 0.00128a161.919393 161.919393 0 0 0-114.55957 47.359822L47.553742 428.991671a162.111392 162.111392 0 0 0 0 229.119141l318.270806 318.398806a161.983393 161.983393 0 0 0 229.119141 0l381.630569-381.694569A162.111392 162.111392 0 0 0 1023.99808 480.255479V161.920673A161.919393 161.919393 0 0 0 861.886688 0.00128H543.487882z m0 90.55966l318.462806 0.064a71.295733 71.295733 0 0 1 71.487732 71.295733v318.270806c0 18.943929-7.615971 37.119861-21.055921 50.559811l-381.56657 381.758568a71.423732 71.423732 0 0 1-101.055621 0L111.489502 594.111052a71.487732 71.487732 0 0 1 0-101.119621l381.566569-381.566569c13.37595-13.37595 31.551882-20.863922 50.431811-20.863922z m112.447578 124.159535a153.023426 153.023426 0 1 0 0 306.046852 153.023426 153.023426 0 0 0 0-306.046852z m57.727784 129.151515a62.463766 62.463766 0 1 1-115.455567 47.807821 62.463766 62.463766 0 0 1 115.455567-47.807821z" p-id="23147" fill="#515151"></path></svg>', _e = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775096284335" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4580" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M308.377435 102.251961C318.982967 47.176334 372.449479 0 448.66303 0c39.496466 0 68.314257 20.040799 85.063685 46.07921 11.995223 18.577967 17.919693 39.935315 20.040799 60.341823 13.384913-4.388496 27.35496-6.582744 41.398147-6.655886 38.911333 0 68.021691 19.455666 85.72196 44.616378 16.822569 23.990446 23.551596 53.100804 23.551596 79.724347v29.988058c0.146283 98.960589 0.292566 197.921178 0.658274 296.954909-0.073142 13.165489 1.097124 26.47726 3.510797 39.569608 8.484426-7.533585 16.237436-15.213453 24.795004-23.69788l13.165488-13.019205c13.970046-13.604338 30.353765-28.598367 49.809432-41.178723 42.056422-27.208676 93.694394-39.642749 162.813209-22.600755 27.574384 6.802169 44.982086 25.380136 54.344211 44.543236 8.776992 18.285401 11.117524 38.545625 10.386108 56.392176-1.38969 33.864562-14.920887 75.26271-43.738679 101.447404l-1.755398 1.755398c-37.375359 36.424518-75.335851 72.263904-113.881477 107.518157-31.450889 28.964075-63.486912 57.050451-96.327491 84.478552-29.037217 24.063587-58.293858 46.51806-80.967755 58.952132A491.511574 491.511574 0 0 1 421.527495 1023.982446a45.567219 45.567219 0 0 1-46.810626-44.25067c0-24.795004 20.699074-44.835803 46.225493-44.762661a395.403507 395.403507 0 0 0 215.036314-64.072045 49.955715 49.955715 0 0 1 4.022788-2.340531c13.458055-7.167877 37.009651-24.502437 67.363417-49.590007 31.597173-26.47726 62.609212-53.612795 92.889836-81.552888a5027.973235 5027.973235 0 0 0 111.687228-105.470192l1.755399-1.755398 0.585133-0.511991 1.682257-1.535974a42.056422 42.056422 0 0 0 9.362125-15.140312c3.291372-8.118718 5.119912-16.749427 5.631903-25.453278a46.07921 46.07921 0 0 0-1.023982-12.580356c-39.715891-8.557568-62.536071-0.658274-81.479746 11.556374a234.126272 234.126272 0 0 0-35.473678 29.841774l-10.386108 10.239824c-9.800975 9.654692-20.845357 20.699074-31.96288 30.500049l-0.146283 0.146283c-19.016817 16.603144-42.787838 31.597173-70.435364 32.182306a74.897002 74.897002 0 0 1-65.096027-35.54682 141.602144 141.602144 0 0 1-18.870534-51.930538 302.074822 302.074822 0 0 1-4.169071-50.613989c-0.365708-99.033731-0.511991-198.213745-0.511992-297.247476v-29.988058c0-13.311772-3.65708-24.136729-7.826151-30.13434a13.896905 13.896905 0 0 0-4.388496-4.388496 7.679868 7.679868 0 0 0-4.022789-0.804558 46.956909 46.956909 0 0 0-28.232658 10.532391 30.719473 30.719473 0 0 0-12.214648 24.721862v232.736582a45.567219 45.567219 0 0 1-46.591201 44.543236 45.567219 45.567219 0 0 1-46.51806-44.616378V124.340726c0-14.628321-3.364514-25.745844-7.094736-31.45089a10.093541 10.093541 0 0 0-2.925664-3.364514 1.901682 1.901682 0 0 0-0.511991-0.292566 9.435267 9.435267 0 0 0-2.340531-0.146283c-38.618767 0-49.443724 23.697879-49.078016 33.791421v1.682256l-0.292567 77.822666v3.876505l-1.023982 253.508797a45.567219 45.567219 0 0 1-46.810626 44.323812 45.567219 45.567219 0 0 1-46.298635-44.68952l1.023983-250.656274a32.036022 32.036022 0 0 0-7.75301-15.140312c-1.82854-1.682257-5.851328-4.827346-17.188277-4.827346a41.178723 41.178723 0 0 0-26.477261 9.069559c-5.558762 4.754204-10.678674 12.580356-10.678674 26.257835v296.589202a45.567219 45.567219 0 0 1-46.518059 44.543236 45.567219 45.567219 0 0 1-46.51806-44.616378v-169.688519a31.158323 31.158323 0 0 0-4.607921-5.705045 11.84894 11.84894 0 0 0-5.193054-3.218231c-1.023982-0.292566-4.681063-1.023982-12.653497 1.462832-17.700268 5.705045-26.111552 14.994029-30.792615 27.208676-5.48562 14.189471-6.582744 35.10797-1.097124 61.438947 42.202705 201.139409 64.949744 301.123981 83.162003 350.34828 16.091153 43.372971 47.615184 81.918596 90.915013 109.566122a43.372971 43.372971 0 0 1 12.872922 61.804654 47.834609 47.834609 0 0 1-64.510894 12.28779c-59.171557-37.741067-103.934218-91.500146-127.046965-153.963075C71.179216 755.406479 46.896203 647.449472 5.571197 449.601435-1.889246 414.127758-3.059512 375.216425 10.471685 340.108455 24.734297 302.806238 54.210364 273.330171 99.265591 258.921276c16.603144-5.558762 34.376554-7.460444 51.784255-5.631904v-29.256641c0-81.18718 67.655983-124.340726 130.265196-124.340726 9.435267 0 18.431684 0.877699 27.062393 2.486815z" p-id="4581" fill="#515151"></path></svg>', ke = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775033156525" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3463" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M694.4 960H195.2C131.7 960 80 908.4 80 845.1V462c0-63.4 51.7-114.9 115.2-114.9h499.2c63.5 0 115.2 51.6 115.2 114.9v383.1c0 63.3-51.7 114.9-115.2 114.9zM195.2 423.7c-21.2 0-38.4 17.2-38.4 38.3v383.1c0 21.1 17.2 38.3 38.4 38.3h499.2c21.2 0 38.4-17.2 38.4-38.3V462c0-21.1-17.2-38.3-38.4-38.3H195.2z" fill="#515151" p-id="3464"></path><path d="M905.6 450.3c-14.8 0-28.9-8.6-35.2-23C788.6 240.8 592.7 213 483.2 213c-21.2 0-38.4-17.2-38.4-38.3s17.2-38.3 38.4-38.3c218.2 0 385 94.9 457.6 260.3 8.5 19.4-0.4 42-19.8 50.5-5 2.1-10.3 3.1-15.4 3.1z" fill="#515151" p-id="3465"></path><path d="M473.6 285.4c-9.8 0-19.7-3.7-27.2-11.2l-72.5-72.4c-15-15-15-39.2 0-54.2l72.5-72.4c15-15 39.3-15 54.3 0s15 39.2 0 54.2l-45.4 45.3 45.4 45.3c15 15 15 39.2 0 54.2-7.4 7.4-17.3 11.2-27.1 11.2z" fill="#515151" p-id="3466"></path></svg>', Ie = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M8.3 19.7c-.4-.4-.4-1 0-1.4l6.3-6.3-6.3-6.3c-.4-.4-.4-1 0-1.4.4-.4 1-.4 1.4 0l7 7c.4.4.4 1 0 1.4l-7 7c-.4.4-1 .4-1.4 0z"/></svg>', Ae = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032400373" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3314" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 230.4c199.8848 0 373.0176 114.5344 457.344 281.5744C885.0432 679.04 711.8848 793.6 512 793.6c-199.8848 0-373.0176-114.5344-457.344-281.5744C138.9568 344.96 312.1152 230.4 512 230.4z m0 76.8a434.8928 434.8928 0 0 0-366.464 200.3456l-2.816 4.48 2.816 4.48a434.944 434.944 0 0 0 357.248 200.192L512 716.8c150.6816 0 287.488-77.2096 366.464-200.3456l2.816-4.48-2.816-4.48a434.944 434.944 0 0 0-357.248-200.192L512 307.2z m0 38.4a166.4 166.4 0 1 1 0 332.8 166.4 166.4 0 0 1 0-332.8z m0 76.8a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2z" p-id="3315" fill="#515151"></path></svg>', Se = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032548251" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4695" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M849.7664 778.1376c1.9968 1.4848 3.84 3.072 5.632 4.864l72.3968 72.3968a51.2 51.2 0 1 1-72.3968 72.3968l-72.3968-72.3968a51.6096 51.6096 0 0 1-4.864-5.632 448 448 0 1 1 71.68-71.68zM460.8 460.8V358.4a51.2 51.2 0 1 1 102.4 0v102.4h102.4a51.2 51.2 0 0 1 0 102.4h-102.4v102.4a51.2 51.2 0 0 1-102.4 0v-102.4H358.4a51.2 51.2 0 0 1 0-102.4h102.4z m38.4 384a345.6 345.6 0 1 0 0-691.2 345.6 345.6 0 0 0 0 691.2z" fill="#515151" p-id="4696"></path></svg>', Me = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032629657" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1933" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M849.7664 778.1376c1.9968 1.4848 3.84 3.072 5.632 4.864l72.3968 72.3968a51.2 51.2 0 1 1-72.3968 72.3968l-72.3968-72.3968a51.6096 51.6096 0 0 1-4.864-5.632 448 448 0 1 1 71.68-71.68zM499.2 844.8a345.6 345.6 0 1 0 0-691.2 345.6 345.6 0 0 0 0 691.2zM358.4 563.2a51.2 51.2 0 0 1 0-102.4h307.2a51.2 51.2 0 0 1 0 102.4H358.4z" fill="#666666" p-id="1934"></path></svg>', Te = ["innerHTML"], De = /* @__PURE__ */ ct({
|
|
544
|
+
const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032114659" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21132" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 391.68c-66.56 0-120.32 54.187-120.32 120.32 0 66.56 53.76 120.32 120.32 120.32 66.133 0 120.32-53.76 120.32-120.32A120.747 120.747 0 0 0 512 391.68z" p-id="21133" fill="#515151"></path><path d="M512 113.493c-219.733 0-398.507 178.774-398.507 398.507S292.267 910.507 512 910.507 910.507 731.733 910.507 512 731.733 113.493 512 113.493z m0 720.214c-177.493 0-321.707-144.214-321.707-321.707S334.507 190.293 512 190.293 833.707 334.507 833.707 512 689.493 833.707 512 833.707z" p-id="21134" fill="#515151"></path></svg>', ge = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M15.7 4.3c.4.4.4 1 0 1.4L9.4 12l6.3 6.3c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-7-7c-.4-.4-.4-1 0-1.4l7-7c.4-.4 1-.4 1.4 0z"/></svg>', ue = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032015085" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16560" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M911.872 972.629333l-2.645333-1.621333-209.92-208.554667-91.306667 193.194667-147.029333-494.933333 486.4 179.968-177.834667 68.266666 201.472 200.362667a9.898667 9.898667 0 0 1 2.133333 4.608 10.069333 10.069333 0 0 1-1.024 4.778667l-2.389333 3.157333-47.786667 47.530667a9.813333 9.813333 0 0 1-4.522666 2.901333 12.544 12.544 0 0 1-2.56 0z m-657.066667-12.970666L0.256 501.248l97.109333-175.445333 64.256-115.456L254.805333 42.581333h510.208l259.328 466.858667h-100.608L714.325333 132.778667H305.322667l-204.8 368.384 204.8 368.725333H418.133333v90.026667z" fill="#515151" p-id="16561"></path></svg>', ve = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032973956" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6763" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M613.6 960H97.2c-17.7 0-32-14.3-32-32V98.5c0-17.7 14.3-32 32-32h829.5c17.7 0 32 14.3 32 32v518.2c0 17.7-14.3 32-32 32s-32-14.3-32-32V130.5H129.2V896h484.4c17.7 0 32 14.3 32 32s-14.3 32-32 32z" fill="#515151" p-id="6764"></path><path d="M711.3 694.9l120.3 46.9-100.7 80.7z" fill="#515151" p-id="6765"></path><path d="M707.6 882.1L671.3 645l223.6 87.1-187.3 150z m43.7-137.3l2.8 18 14.2-11.4-17-6.6z" fill="#515151" p-id="6766"></path><path d="M927 957.9c-8.2 0-16.4-3.1-22.6-9.4L723.2 767.2c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l181.2 181.2c12.5 12.5 12.5 32.8 0 45.3-6.3 6.3-14.5 9.5-22.7 9.5z" fill="#515151" p-id="6767"></path></svg>', fe = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M19 6h-4V5c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v1H5c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1zM10 5h4v1h-4V5z"/><path fill="currentColor" d="M6 9v10c0 1.7 1.3 3 3 3h6c1.7 0 3-1.3 3-3V9H6zm4 9c0 .6-.4 1-1 1s-1-.4-1-1v-5c0-.6.4-1 1-1s1 .4 1 1v5zm4 0c0 .6-.4 1-1 1s-1-.4-1-1v-5c0-.6.4-1 1-1s1 .4 1 1v5z"/></svg>', me = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M19 15v4c0 1.1-.9 2-2 2H7c-1.1 0-2-.9-2-2v-4c0-.6.4-1 1-1s1 .4 1 1v4h10v-4c0-.6.4-1 1-1s1 .4 1 1zm-7.7 1.3c.2.2.4.3.7.3s.5-.1.7-.3l4.6-4.6c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0l-2.9 2.9V3c0-.6-.4-1-1-1s-1 .4-1 1v8.3l-2.9-2.9c-.4-.4-1-.4-1.4 0-.4.4-.4 1 0 1.4l4.6 4.6z"/></svg>', pe = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M3 17.2v4.3c0 .3.2.5.5.5h4.3c.1 0 .3-.1.4-.2l11.1-11.1-5.1-5.1L3.1 16.8c-.1.1-.1.3-.1.4zm18.8-10.9c.4-.4.4-1 0-1.4l-3.7-3.7c-.4-.4-1-.4-1.4 0l-2.3 2.3 5.1 5.1 2.3-2.3z"/></svg>', ye = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M18.7 4.3c.4.4.4 1 0 1.4L12.4 12l6.3 6.3c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-7-7c-.4-.4-.4-1 0-1.4l7-7c.4-.4 1-.4 1.4 0z"/><path fill="currentColor" d="M10.7 4.3c.4.4.4 1 0 1.4L4.4 12l6.3 6.3c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-7-7c-.4-.4-.4-1 0-1.4l7-7c.4-.4 1-.4 1.4 0z"/></svg>', xe = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032412624" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3527" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M870.2976 144.0256l51.2 51.2-122.88 122.88a514.304 514.304 0 0 1 170.7264 193.8688C885.0432 679.04 711.8848 793.6 512 793.6c-56.832 0-111.488-9.2672-162.56-26.3424L197.4016 919.296l-51.2-51.2L870.2976 144.0256z m-127.1552 229.5296l-76.6208 76.6208a166.4 166.4 0 0 1-216.32 216.3712l-38.6048 38.5792c29.5168 6.9632 60.032 10.9312 91.1872 11.5712L512 716.8c150.6816 0 287.488-77.2096 366.464-200.3456l2.816-4.48-2.816-4.48a435.8144 435.8144 0 0 0-135.3216-133.9392zM512 230.4c49.664 0 97.664 7.0656 143.0528 20.2496l-63.8208 63.7696a436.4032 436.4032 0 0 0-70.016-7.1168L512 307.2a434.8928 434.8928 0 0 0-366.464 200.3456l-2.816 4.48 2.816 4.48a435.84 435.84 0 0 0 119.8848 123.776l-55.0912 55.04a514.2528 514.2528 0 0 1-155.648-183.296C138.9312 344.96 312.0896 230.4 512 230.4z m89.5488 284.8l-86.3744 86.2976 1.7408-0.0256a89.6 89.6 0 0 0 84.6336-86.272zM512 345.6a166.656 166.656 0 0 1 42.5728 5.504l-79.0272 79.0272a89.9328 89.9328 0 0 0-45.4144 45.4144l-79.0272 79.0272A166.4 166.4 0 0 1 512 345.6z" p-id="3528" fill="#515151"></path></svg>', we = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M5.3 19.7c-.4-.4-.4-1 0-1.4l6.3-6.3-6.3-6.3c-.4-.4-.4-1 0-1.4.4-.4 1-.4 1.4 0l7 7c.4.4.4 1 0 1.4l-7 7c-.4.4-1 .4-1.4 0z"/><path fill="currentColor" d="M13.3 19.7c-.4-.4-.4-1 0-1.4l6.3-6.3-6.3-6.3c-.4-.4-.4-1 0-1.4.4-.4 1-.4 1.4 0l7 7c.4.4.4 1 0 1.4l-7 7c-.4.4-1 .4-1.4 0z"/></svg>', be = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775031871732" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12257" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M174.63 78.98c0.03-12.61 16.41-19.91 25.81-11.5l328.72 293.98 318.27 284.63c10.51 9.4 0.4 26.75-14.25 24.46L435.7 608.43c-6.23-0.97-12.72 1.92-16.16 7.2L199.96 952.72c-8.09 12.42-27.76 8.34-27.72-5.76l1.17-426.97 1.22-441.01z" fill="#515151" p-id="12258"></path></svg>', Ce = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032210611" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="23146" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M543.487882 0.00128a161.919393 161.919393 0 0 0-114.55957 47.359822L47.553742 428.991671a162.111392 162.111392 0 0 0 0 229.119141l318.270806 318.398806a161.983393 161.983393 0 0 0 229.119141 0l381.630569-381.694569A162.111392 162.111392 0 0 0 1023.99808 480.255479V161.920673A161.919393 161.919393 0 0 0 861.886688 0.00128H543.487882z m0 90.55966l318.462806 0.064a71.295733 71.295733 0 0 1 71.487732 71.295733v318.270806c0 18.943929-7.615971 37.119861-21.055921 50.559811l-381.56657 381.758568a71.423732 71.423732 0 0 1-101.055621 0L111.489502 594.111052a71.487732 71.487732 0 0 1 0-101.119621l381.566569-381.566569c13.37595-13.37595 31.551882-20.863922 50.431811-20.863922z m112.447578 124.159535a153.023426 153.023426 0 1 0 0 306.046852 153.023426 153.023426 0 0 0 0-306.046852z m57.727784 129.151515a62.463766 62.463766 0 1 1-115.455567 47.807821 62.463766 62.463766 0 0 1 115.455567-47.807821z" p-id="23147" fill="#515151"></path></svg>', _e = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775096284335" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4580" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M308.377435 102.251961C318.982967 47.176334 372.449479 0 448.66303 0c39.496466 0 68.314257 20.040799 85.063685 46.07921 11.995223 18.577967 17.919693 39.935315 20.040799 60.341823 13.384913-4.388496 27.35496-6.582744 41.398147-6.655886 38.911333 0 68.021691 19.455666 85.72196 44.616378 16.822569 23.990446 23.551596 53.100804 23.551596 79.724347v29.988058c0.146283 98.960589 0.292566 197.921178 0.658274 296.954909-0.073142 13.165489 1.097124 26.47726 3.510797 39.569608 8.484426-7.533585 16.237436-15.213453 24.795004-23.69788l13.165488-13.019205c13.970046-13.604338 30.353765-28.598367 49.809432-41.178723 42.056422-27.208676 93.694394-39.642749 162.813209-22.600755 27.574384 6.802169 44.982086 25.380136 54.344211 44.543236 8.776992 18.285401 11.117524 38.545625 10.386108 56.392176-1.38969 33.864562-14.920887 75.26271-43.738679 101.447404l-1.755398 1.755398c-37.375359 36.424518-75.335851 72.263904-113.881477 107.518157-31.450889 28.964075-63.486912 57.050451-96.327491 84.478552-29.037217 24.063587-58.293858 46.51806-80.967755 58.952132A491.511574 491.511574 0 0 1 421.527495 1023.982446a45.567219 45.567219 0 0 1-46.810626-44.25067c0-24.795004 20.699074-44.835803 46.225493-44.762661a395.403507 395.403507 0 0 0 215.036314-64.072045 49.955715 49.955715 0 0 1 4.022788-2.340531c13.458055-7.167877 37.009651-24.502437 67.363417-49.590007 31.597173-26.47726 62.609212-53.612795 92.889836-81.552888a5027.973235 5027.973235 0 0 0 111.687228-105.470192l1.755399-1.755398 0.585133-0.511991 1.682257-1.535974a42.056422 42.056422 0 0 0 9.362125-15.140312c3.291372-8.118718 5.119912-16.749427 5.631903-25.453278a46.07921 46.07921 0 0 0-1.023982-12.580356c-39.715891-8.557568-62.536071-0.658274-81.479746 11.556374a234.126272 234.126272 0 0 0-35.473678 29.841774l-10.386108 10.239824c-9.800975 9.654692-20.845357 20.699074-31.96288 30.500049l-0.146283 0.146283c-19.016817 16.603144-42.787838 31.597173-70.435364 32.182306a74.897002 74.897002 0 0 1-65.096027-35.54682 141.602144 141.602144 0 0 1-18.870534-51.930538 302.074822 302.074822 0 0 1-4.169071-50.613989c-0.365708-99.033731-0.511991-198.213745-0.511992-297.247476v-29.988058c0-13.311772-3.65708-24.136729-7.826151-30.13434a13.896905 13.896905 0 0 0-4.388496-4.388496 7.679868 7.679868 0 0 0-4.022789-0.804558 46.956909 46.956909 0 0 0-28.232658 10.532391 30.719473 30.719473 0 0 0-12.214648 24.721862v232.736582a45.567219 45.567219 0 0 1-46.591201 44.543236 45.567219 45.567219 0 0 1-46.51806-44.616378V124.340726c0-14.628321-3.364514-25.745844-7.094736-31.45089a10.093541 10.093541 0 0 0-2.925664-3.364514 1.901682 1.901682 0 0 0-0.511991-0.292566 9.435267 9.435267 0 0 0-2.340531-0.146283c-38.618767 0-49.443724 23.697879-49.078016 33.791421v1.682256l-0.292567 77.822666v3.876505l-1.023982 253.508797a45.567219 45.567219 0 0 1-46.810626 44.323812 45.567219 45.567219 0 0 1-46.298635-44.68952l1.023983-250.656274a32.036022 32.036022 0 0 0-7.75301-15.140312c-1.82854-1.682257-5.851328-4.827346-17.188277-4.827346a41.178723 41.178723 0 0 0-26.477261 9.069559c-5.558762 4.754204-10.678674 12.580356-10.678674 26.257835v296.589202a45.567219 45.567219 0 0 1-46.518059 44.543236 45.567219 45.567219 0 0 1-46.51806-44.616378v-169.688519a31.158323 31.158323 0 0 0-4.607921-5.705045 11.84894 11.84894 0 0 0-5.193054-3.218231c-1.023982-0.292566-4.681063-1.023982-12.653497 1.462832-17.700268 5.705045-26.111552 14.994029-30.792615 27.208676-5.48562 14.189471-6.582744 35.10797-1.097124 61.438947 42.202705 201.139409 64.949744 301.123981 83.162003 350.34828 16.091153 43.372971 47.615184 81.918596 90.915013 109.566122a43.372971 43.372971 0 0 1 12.872922 61.804654 47.834609 47.834609 0 0 1-64.510894 12.28779c-59.171557-37.741067-103.934218-91.500146-127.046965-153.963075C71.179216 755.406479 46.896203 647.449472 5.571197 449.601435-1.889246 414.127758-3.059512 375.216425 10.471685 340.108455 24.734297 302.806238 54.210364 273.330171 99.265591 258.921276c16.603144-5.558762 34.376554-7.460444 51.784255-5.631904v-29.256641c0-81.18718 67.655983-124.340726 130.265196-124.340726 9.435267 0 18.431684 0.877699 27.062393 2.486815z" p-id="4581" fill="#515151"></path></svg>', ke = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775033156525" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3463" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M694.4 960H195.2C131.7 960 80 908.4 80 845.1V462c0-63.4 51.7-114.9 115.2-114.9h499.2c63.5 0 115.2 51.6 115.2 114.9v383.1c0 63.3-51.7 114.9-115.2 114.9zM195.2 423.7c-21.2 0-38.4 17.2-38.4 38.3v383.1c0 21.1 17.2 38.3 38.4 38.3h499.2c21.2 0 38.4-17.2 38.4-38.3V462c0-21.1-17.2-38.3-38.4-38.3H195.2z" fill="#515151" p-id="3464"></path><path d="M905.6 450.3c-14.8 0-28.9-8.6-35.2-23C788.6 240.8 592.7 213 483.2 213c-21.2 0-38.4-17.2-38.4-38.3s17.2-38.3 38.4-38.3c218.2 0 385 94.9 457.6 260.3 8.5 19.4-0.4 42-19.8 50.5-5 2.1-10.3 3.1-15.4 3.1z" fill="#515151" p-id="3465"></path><path d="M473.6 285.4c-9.8 0-19.7-3.7-27.2-11.2l-72.5-72.4c-15-15-15-39.2 0-54.2l72.5-72.4c15-15 39.3-15 54.3 0s15 39.2 0 54.2l-45.4 45.3 45.4 45.3c15 15 15 39.2 0 54.2-7.4 7.4-17.3 11.2-27.1 11.2z" fill="#515151" p-id="3466"></path></svg>', Ie = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M8.3 19.7c-.4-.4-.4-1 0-1.4l6.3-6.3-6.3-6.3c-.4-.4-.4-1 0-1.4.4-.4 1-.4 1.4 0l7 7c.4.4.4 1 0 1.4l-7 7c-.4.4-1 .4-1.4 0z"/></svg>', Ae = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032400373" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3314" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 230.4c199.8848 0 373.0176 114.5344 457.344 281.5744C885.0432 679.04 711.8848 793.6 512 793.6c-199.8848 0-373.0176-114.5344-457.344-281.5744C138.9568 344.96 312.1152 230.4 512 230.4z m0 76.8a434.8928 434.8928 0 0 0-366.464 200.3456l-2.816 4.48 2.816 4.48a434.944 434.944 0 0 0 357.248 200.192L512 716.8c150.6816 0 287.488-77.2096 366.464-200.3456l2.816-4.48-2.816-4.48a434.944 434.944 0 0 0-357.248-200.192L512 307.2z m0 38.4a166.4 166.4 0 1 1 0 332.8 166.4 166.4 0 0 1 0-332.8z m0 76.8a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2z" p-id="3315" fill="#515151"></path></svg>', Se = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032548251" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4695" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M849.7664 778.1376c1.9968 1.4848 3.84 3.072 5.632 4.864l72.3968 72.3968a51.2 51.2 0 1 1-72.3968 72.3968l-72.3968-72.3968a51.6096 51.6096 0 0 1-4.864-5.632 448 448 0 1 1 71.68-71.68zM460.8 460.8V358.4a51.2 51.2 0 1 1 102.4 0v102.4h102.4a51.2 51.2 0 0 1 0 102.4h-102.4v102.4a51.2 51.2 0 0 1-102.4 0v-102.4H358.4a51.2 51.2 0 0 1 0-102.4h102.4z m38.4 384a345.6 345.6 0 1 0 0-691.2 345.6 345.6 0 0 0 0 691.2z" fill="#515151" p-id="4696"></path></svg>', Me = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032629657" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1933" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M849.7664 778.1376c1.9968 1.4848 3.84 3.072 5.632 4.864l72.3968 72.3968a51.2 51.2 0 1 1-72.3968 72.3968l-72.3968-72.3968a51.6096 51.6096 0 0 1-4.864-5.632 448 448 0 1 1 71.68-71.68zM499.2 844.8a345.6 345.6 0 1 0 0-691.2 345.6 345.6 0 0 0 0 691.2zM358.4 563.2a51.2 51.2 0 0 1 0-102.4h307.2a51.2 51.2 0 0 1 0 102.4H358.4z" fill="#666666" p-id="1934"></path></svg>', Te = ["innerHTML"], De = /* @__PURE__ */ ct({
|
|
541
545
|
__name: "SvgIcon",
|
|
542
546
|
props: {
|
|
543
547
|
name: {},
|
|
544
548
|
size: {}
|
|
545
549
|
},
|
|
546
|
-
setup(
|
|
547
|
-
const t =
|
|
550
|
+
setup(x) {
|
|
551
|
+
const t = x, n = M(""), e = /* @__PURE__ */ Object.assign({ "../assets/svg/aim.svg": de, "../assets/svg/back.svg": ge, "../assets/svg/connection.svg": ue, "../assets/svg/crop.svg": ve, "../assets/svg/delete.svg": fe, "../assets/svg/download.svg": me, "../assets/svg/edit.svg": pe, "../assets/svg/first.svg": ye, "../assets/svg/hide.svg": xe, "../assets/svg/last.svg": we, "../assets/svg/pointer.svg": be, "../assets/svg/price-tag.svg": Ce, "../assets/svg/rank.svg": _e, "../assets/svg/refresh-right.svg": ke, "../assets/svg/right.svg": Ie, "../assets/svg/view.svg": Ae, "../assets/svg/zoom-in.svg": Se, "../assets/svg/zoom-out.svg": Me });
|
|
548
552
|
return ce(() => {
|
|
549
553
|
const a = `../assets/svg/${t.name}.svg`, o = e[a];
|
|
550
554
|
o ? n.value = o : (console.warn(`Icon ${t.name} not found at path ${a}`), n.value = "");
|
|
551
555
|
}), (a, o) => (v(), m("i", {
|
|
552
|
-
class: X(["svg-icon", [
|
|
556
|
+
class: X(["svg-icon", [x.size ? `size-${x.size}` : ""]]),
|
|
553
557
|
innerHTML: n.value
|
|
554
558
|
}, null, 10, Te));
|
|
555
559
|
}
|
|
556
|
-
}), rt = (
|
|
557
|
-
const n =
|
|
560
|
+
}), rt = (x, t) => {
|
|
561
|
+
const n = x.__vccOpts || x;
|
|
558
562
|
for (const [e, a] of t)
|
|
559
563
|
n[e] = a;
|
|
560
564
|
return n;
|
|
@@ -596,7 +600,7 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
596
600
|
}, ts = ["disabled"], es = ["disabled"], ss = ["disabled"], is = ["disabled"], ns = {
|
|
597
601
|
key: 1,
|
|
598
602
|
class: "right-sidebar"
|
|
599
|
-
}, os = { class: "label-list" }, as = { class: "label-row" }, ls = ["onUpdate:modelValue", "onChange"], cs = ["title"], rs = ["onClick"], hs = { class: "action-icon more-actions" }, ds = ["onClick"], gs = { class: "modal-content" }, us = { class: "modal-body" }, vs = { class: "form-group" }, fs = { class: "form-group" }, ms = { class: "color-input-wrapper" }, ps = { class: "color-value" }, ys = { class: "modal-actions" },
|
|
603
|
+
}, os = { class: "label-list" }, as = { class: "label-row" }, ls = ["onUpdate:modelValue", "onChange"], cs = ["title"], rs = ["onClick"], hs = { class: "action-icon more-actions" }, ds = ["onClick"], gs = { class: "modal-content" }, us = { class: "modal-body" }, vs = { class: "form-group" }, fs = { class: "form-group" }, ms = { class: "color-input-wrapper" }, ps = { class: "color-value" }, ys = { class: "modal-actions" }, xs = ["disabled"], ws = /* @__PURE__ */ ct({
|
|
600
604
|
__name: "ImageAnnotator",
|
|
601
605
|
props: {
|
|
602
606
|
annotationTypes: { default: () => ["rectangle", "polygon", "point", "rotatedRect", "category"] },
|
|
@@ -613,10 +617,10 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
613
617
|
maxZoom: {}
|
|
614
618
|
},
|
|
615
619
|
emits: ["annotationChange", "batchChange", "labelChange", "ready", "error", "tool:change", "viewport:change", "annotation:add", "annotation:update", "annotation:delete", "annotation:select", "prediction:loaded", "prediction:apply", "prediction:reject"],
|
|
616
|
-
setup(
|
|
617
|
-
const e =
|
|
620
|
+
setup(x, { expose: t, emit: n }) {
|
|
621
|
+
const e = x, a = n, o = M(null), c = M(null), g = M(null), u = M([]), r = M(null), k = M(null), w = M(0), D = M(""), _ = M([]), $ = M(""), q = M(!1), C = M({ name: "", color: "#FF0000" }), S = M("none"), p = M([]), H = M({}), O = V(() => k.value === "select" && !!D.value), G = M(!1), Z = V(() => _.value.find((s) => s.id === $.value)), xt = (s) => {
|
|
618
622
|
s.stopPropagation(), G.value = !G.value;
|
|
619
|
-
},
|
|
623
|
+
}, wt = (s) => {
|
|
620
624
|
tt(s), G.value = !1;
|
|
621
625
|
};
|
|
622
626
|
yt(() => {
|
|
@@ -640,7 +644,7 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
640
644
|
});
|
|
641
645
|
}, ht = (s, i) => {
|
|
642
646
|
u.value[i] = s;
|
|
643
|
-
}, Q = (s =
|
|
647
|
+
}, Q = (s = w.value) => {
|
|
644
648
|
const i = g.value, l = u.value[s];
|
|
645
649
|
if (!i || !l) return;
|
|
646
650
|
const d = i.scrollTop, f = d + i.clientHeight, A = l.offsetTop, P = A + l.offsetHeight;
|
|
@@ -657,7 +661,7 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
657
661
|
});
|
|
658
662
|
}, j = () => {
|
|
659
663
|
var l, d, f, A;
|
|
660
|
-
const s = e.batchImages[
|
|
664
|
+
const s = e.batchImages[w.value], i = (s == null ? void 0 : s.imageUrl) || ((l = e.image) == null ? void 0 : l.url);
|
|
661
665
|
return {
|
|
662
666
|
eventId: `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
|
|
663
667
|
timestamp: Date.now(),
|
|
@@ -720,7 +724,7 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
720
724
|
var i;
|
|
721
725
|
(i = r.value) == null || i.resize();
|
|
722
726
|
}), e.batchImages.length > 0) {
|
|
723
|
-
const i = e.batchImages[
|
|
727
|
+
const i = e.batchImages[w.value];
|
|
724
728
|
r.value.loadImage(i.imageUrl), i.annotations ? r.value.setAnnotations(i.annotations) : r.value.setAnnotations([]);
|
|
725
729
|
} else (s = e.image) != null && s.url && r.value.loadImage(e.image.url);
|
|
726
730
|
}, Y = (s) => {
|
|
@@ -798,22 +802,22 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
798
802
|
E();
|
|
799
803
|
}, { immediate: !0, deep: !0 });
|
|
800
804
|
const Rt = () => {
|
|
801
|
-
|
|
805
|
+
w.value > 0 && (gt(), w.value--, W(), ut());
|
|
802
806
|
}, Ht = () => {
|
|
803
|
-
|
|
807
|
+
w.value < e.batchImages.length - 1 && (gt(), w.value++, W(), ut());
|
|
804
808
|
}, Et = () => {
|
|
805
|
-
|
|
809
|
+
w.value > 0 && ot(0);
|
|
806
810
|
}, Ut = () => {
|
|
807
|
-
|
|
811
|
+
w.value < e.batchImages.length - 1 && ot(e.batchImages.length - 1);
|
|
808
812
|
}, gt = () => {
|
|
809
813
|
if (r.value) {
|
|
810
814
|
const s = r.value.getAnnotations();
|
|
811
|
-
e.batchImages[
|
|
815
|
+
e.batchImages[w.value].annotations = s;
|
|
812
816
|
}
|
|
813
817
|
}, ut = () => {
|
|
814
|
-
const s = e.batchImages[
|
|
818
|
+
const s = e.batchImages[w.value];
|
|
815
819
|
a("batchChange", {
|
|
816
|
-
currentIndex:
|
|
820
|
+
currentIndex: w.value,
|
|
817
821
|
total: e.batchImages.length,
|
|
818
822
|
currentImageUrl: s.imageUrl,
|
|
819
823
|
currentAnnotations: s.annotations || []
|
|
@@ -872,14 +876,14 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
872
876
|
const i = _t();
|
|
873
877
|
return {
|
|
874
878
|
format: s,
|
|
875
|
-
image: ((l = e.batchImages[
|
|
879
|
+
image: ((l = e.batchImages[w.value]) == null ? void 0 : l.imageUrl) || ((d = e.image) == null ? void 0 : d.url) || "",
|
|
876
880
|
annotations: i
|
|
877
881
|
};
|
|
878
882
|
}, ot = (s) => {
|
|
879
|
-
s >= 0 && s < e.batchImages.length && (gt(),
|
|
883
|
+
s >= 0 && s < e.batchImages.length && (gt(), w.value = s, W(), ut());
|
|
880
884
|
}, Gt = (s) => {
|
|
881
885
|
var i;
|
|
882
|
-
return s ===
|
|
886
|
+
return s === w.value && r.value ? r.value.getAnnotations() || [] : ((i = e.batchImages[s]) == null ? void 0 : i.annotations) || [];
|
|
883
887
|
}, Yt = (s) => s.type === "rectangle", Jt = (s) => s.type === "polygon", jt = (s) => s.type === "point", Xt = (s) => s.type === "rotatedRect", qt = (s) => s.type === "category", et = (s) => {
|
|
884
888
|
var l, d;
|
|
885
889
|
const i = (l = _.value.find((f) => f.name === s.label)) == null ? void 0 : l.color;
|
|
@@ -963,7 +967,7 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
963
967
|
getCurrentAnnotation: () => {
|
|
964
968
|
var s, i, l;
|
|
965
969
|
return {
|
|
966
|
-
imageUrl: ((s = e.batchImages[
|
|
970
|
+
imageUrl: ((s = e.batchImages[w.value]) == null ? void 0 : s.imageUrl) || ((i = e.image) == null ? void 0 : i.url) || "",
|
|
967
971
|
annotations: ((l = r.value) == null ? void 0 : l.getAnnotations()) || []
|
|
968
972
|
};
|
|
969
973
|
}
|
|
@@ -982,25 +986,25 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
982
986
|
},
|
|
983
987
|
{ immediate: !0 }
|
|
984
988
|
), K(
|
|
985
|
-
() =>
|
|
989
|
+
() => w.value,
|
|
986
990
|
() => {
|
|
987
991
|
at(() => Q());
|
|
988
992
|
}
|
|
989
993
|
), (s, i) => (v(), m("div", {
|
|
990
|
-
class: X(["annotation-container",
|
|
994
|
+
class: X(["annotation-container", x.theme])
|
|
991
995
|
}, [
|
|
992
|
-
|
|
993
|
-
h("div", ze, "共 " + z(
|
|
996
|
+
x.batchImages && x.batchImages.length > 0 ? (v(), m("div", Pe, [
|
|
997
|
+
h("div", ze, "共 " + z(x.batchImages.length) + " 张", 1),
|
|
994
998
|
h("div", {
|
|
995
999
|
ref_key: "imageListScrollRef",
|
|
996
1000
|
ref: g,
|
|
997
1001
|
class: "image-list-scroll"
|
|
998
1002
|
}, [
|
|
999
|
-
(v(!0), m(N, null, J(
|
|
1003
|
+
(v(!0), m(N, null, J(x.batchImages, (l, d) => (v(), m("button", {
|
|
1000
1004
|
key: `${l.imageUrl}-${d}`,
|
|
1001
1005
|
ref_for: !0,
|
|
1002
1006
|
ref: (f) => ht(f, d),
|
|
1003
|
-
class: X(["image-list-item", { active: d ===
|
|
1007
|
+
class: X(["image-list-item", { active: d === w.value }]),
|
|
1004
1008
|
onClick: (f) => ot(d)
|
|
1005
1009
|
}, [
|
|
1006
1010
|
h("div", Le, [
|
|
@@ -1043,7 +1047,7 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1043
1047
|
], 512)
|
|
1044
1048
|
])) : B("", !0),
|
|
1045
1049
|
h("div", Ve, [
|
|
1046
|
-
|
|
1050
|
+
x.readOnly ? B("", !0) : (v(), m("div", Oe, [
|
|
1047
1051
|
h("div", {
|
|
1048
1052
|
class: X(["tool-btn", { active: k.value === "pan" }]),
|
|
1049
1053
|
onClick: i[0] || (i[0] = (l) => Y("pan")),
|
|
@@ -1107,10 +1111,10 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1107
1111
|
ref_key: "canvasRef",
|
|
1108
1112
|
ref: o
|
|
1109
1113
|
}, null, 512),
|
|
1110
|
-
|
|
1114
|
+
x.readOnly ? B("", !0) : (v(), m("div", Ge, [
|
|
1111
1115
|
h("div", {
|
|
1112
1116
|
class: "selector-trigger",
|
|
1113
|
-
onClick:
|
|
1117
|
+
onClick: xt
|
|
1114
1118
|
}, [
|
|
1115
1119
|
Z.value ? (v(), m("div", Ye, [
|
|
1116
1120
|
h("span", {
|
|
@@ -1130,7 +1134,7 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1130
1134
|
_.value.length === 0 ? (v(), m("div", qe, "请在右侧创建标签")) : (v(!0), m(N, { key: 1 }, J(_.value, (l) => (v(), m("div", {
|
|
1131
1135
|
key: l.id,
|
|
1132
1136
|
class: X(["dropdown-item", { active: $.value === l.id }]),
|
|
1133
|
-
onClick: (d) =>
|
|
1137
|
+
onClick: (d) => wt(l)
|
|
1134
1138
|
}, [
|
|
1135
1139
|
h("span", {
|
|
1136
1140
|
class: "color-dot",
|
|
@@ -1146,11 +1150,11 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1146
1150
|
])) : B("", !0)
|
|
1147
1151
|
]))
|
|
1148
1152
|
], 544),
|
|
1149
|
-
|
|
1153
|
+
x.batchImages && x.batchImages.length > 0 ? (v(), m("div", Qe, [
|
|
1150
1154
|
h("button", {
|
|
1151
1155
|
class: "icon-btn",
|
|
1152
1156
|
onClick: Et,
|
|
1153
|
-
disabled:
|
|
1157
|
+
disabled: w.value <= 0,
|
|
1154
1158
|
title: "第一张"
|
|
1155
1159
|
}, [
|
|
1156
1160
|
R(L, { name: "first" })
|
|
@@ -1158,16 +1162,16 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1158
1162
|
h("button", {
|
|
1159
1163
|
class: "icon-btn",
|
|
1160
1164
|
onClick: Rt,
|
|
1161
|
-
disabled:
|
|
1165
|
+
disabled: w.value <= 0,
|
|
1162
1166
|
title: "上一张"
|
|
1163
1167
|
}, [
|
|
1164
1168
|
R(L, { name: "back" })
|
|
1165
1169
|
], 8, es),
|
|
1166
|
-
h("span", null, z(
|
|
1170
|
+
h("span", null, z(w.value + 1) + " / " + z(x.batchImages.length), 1),
|
|
1167
1171
|
h("button", {
|
|
1168
1172
|
class: "icon-btn",
|
|
1169
1173
|
onClick: Ht,
|
|
1170
|
-
disabled:
|
|
1174
|
+
disabled: w.value >= x.batchImages.length - 1,
|
|
1171
1175
|
title: "下一张"
|
|
1172
1176
|
}, [
|
|
1173
1177
|
R(L, { name: "right" })
|
|
@@ -1175,14 +1179,14 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1175
1179
|
h("button", {
|
|
1176
1180
|
class: "icon-btn",
|
|
1177
1181
|
onClick: Ut,
|
|
1178
|
-
disabled:
|
|
1182
|
+
disabled: w.value >= x.batchImages.length - 1,
|
|
1179
1183
|
title: "最后一张"
|
|
1180
1184
|
}, [
|
|
1181
1185
|
R(L, { name: "last" })
|
|
1182
1186
|
], 8, is)
|
|
1183
1187
|
])) : B("", !0)
|
|
1184
1188
|
]),
|
|
1185
|
-
|
|
1189
|
+
x.readOnly ? B("", !0) : (v(), m("div", ns, [
|
|
1186
1190
|
h("div", { class: "sidebar-header" }, [
|
|
1187
1191
|
i[8] || (i[8] = h("h3", null, "标签", -1)),
|
|
1188
1192
|
h("button", {
|
|
@@ -1292,13 +1296,13 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1292
1296
|
onClick: Pt,
|
|
1293
1297
|
class: "confirm-btn",
|
|
1294
1298
|
disabled: !C.value.name.trim()
|
|
1295
|
-
}, "确认", 8,
|
|
1299
|
+
}, "确认", 8, xs)
|
|
1296
1300
|
])
|
|
1297
1301
|
])
|
|
1298
1302
|
])) : B("", !0)
|
|
1299
1303
|
], 2));
|
|
1300
1304
|
}
|
|
1301
|
-
}), bs = /* @__PURE__ */ rt(
|
|
1305
|
+
}), bs = /* @__PURE__ */ rt(ws, [["__scopeId", "data-v-914fe07d"]]), Cs = {
|
|
1302
1306
|
class: "thumbnail-wrapper",
|
|
1303
1307
|
ref: "wrapper"
|
|
1304
1308
|
}, _s = ["src", "alt"], ks = ["viewBox", "preserveAspectRatio"], Is = ["x", "y", "width", "height", "stroke", "stroke-width"], As = ["points", "stroke", "stroke-width"], Ss = ["transform"], Ms = ["x", "y", "width", "height", "stroke", "stroke-width"], Ts = { key: 3 }, Ds = ["cx", "cy", "r", "fill", "stroke-width"], Ps = ["x", "y", "width", "height", "fill"], zs = ["x", "y", "fill", "font-size", "font-weight", "text-anchor", "dominant-baseline"], $s = {
|
|
@@ -1315,8 +1319,8 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1315
1319
|
strokeWidth: {},
|
|
1316
1320
|
fontSize: {}
|
|
1317
1321
|
},
|
|
1318
|
-
setup(
|
|
1319
|
-
const t =
|
|
1322
|
+
setup(x) {
|
|
1323
|
+
const t = x, n = M(null), e = M(!1), a = M(0), o = M(0), c = () => {
|
|
1320
1324
|
n.value && (a.value = n.value.naturalWidth, o.value = n.value.naturalHeight, e.value = !0);
|
|
1321
1325
|
}, g = V(() => t.fit === "contain" ? "xMidYMid meet" : "xMidYMid slice"), u = V(() => t.strokeWidth ?? 10), r = V(() => t.fontSize ?? 30), k = (C) => {
|
|
1322
1326
|
var S;
|
|
@@ -1326,12 +1330,12 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1326
1330
|
if (p) return p.color;
|
|
1327
1331
|
}
|
|
1328
1332
|
return "#FF0000";
|
|
1329
|
-
},
|
|
1333
|
+
}, w = (C) => {
|
|
1330
1334
|
const S = C.coordinates, p = Math.min(S.x1, S.x2), H = Math.min(S.y1, S.y2), O = Math.abs(S.x1 - S.x2), G = Math.abs(S.y1 - S.y2);
|
|
1331
1335
|
return { x: p, y: H, width: O, height: G };
|
|
1332
1336
|
}, D = (C) => C.coordinates.points.map((p) => `${p.x},${p.y}`).join(" "), _ = (C) => {
|
|
1333
1337
|
if (C.type === "rectangle") {
|
|
1334
|
-
const S =
|
|
1338
|
+
const S = w(C);
|
|
1335
1339
|
return { x: S.x, y: S.y - 5 };
|
|
1336
1340
|
} else if (C.type === "polygon") {
|
|
1337
1341
|
const S = C.coordinates.points;
|
|
@@ -1354,11 +1358,11 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1354
1358
|
h("img", {
|
|
1355
1359
|
ref_key: "img",
|
|
1356
1360
|
ref: n,
|
|
1357
|
-
src:
|
|
1361
|
+
src: x.src,
|
|
1358
1362
|
class: "thumbnail-image",
|
|
1359
|
-
style: U({ objectFit:
|
|
1363
|
+
style: U({ objectFit: x.fit }),
|
|
1360
1364
|
onLoad: c,
|
|
1361
|
-
alt:
|
|
1365
|
+
alt: x.alt
|
|
1362
1366
|
}, null, 44, _s),
|
|
1363
1367
|
e.value ? (v(), m("svg", {
|
|
1364
1368
|
key: 0,
|
|
@@ -1366,15 +1370,15 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1366
1370
|
viewBox: `0 0 ${a.value} ${o.value}`,
|
|
1367
1371
|
preserveAspectRatio: g.value
|
|
1368
1372
|
}, [
|
|
1369
|
-
(v(!0), m(N, null, J(
|
|
1373
|
+
(v(!0), m(N, null, J(x.annotations, (p) => (v(), m(N, {
|
|
1370
1374
|
key: p.id
|
|
1371
1375
|
}, [
|
|
1372
1376
|
p.type === "rectangle" ? (v(), m("rect", {
|
|
1373
1377
|
key: 0,
|
|
1374
|
-
x:
|
|
1375
|
-
y:
|
|
1376
|
-
width:
|
|
1377
|
-
height:
|
|
1378
|
+
x: w(p).x,
|
|
1379
|
+
y: w(p).y,
|
|
1380
|
+
width: w(p).width,
|
|
1381
|
+
height: w(p).height,
|
|
1378
1382
|
stroke: k(p),
|
|
1379
1383
|
"stroke-width": u.value,
|
|
1380
1384
|
fill: "transparent"
|
|
@@ -1453,8 +1457,8 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1453
1457
|
thumbFontSize: {}
|
|
1454
1458
|
},
|
|
1455
1459
|
emits: ["export", "update:images", "imageClick", "update:labels", "pageChange"],
|
|
1456
|
-
setup(
|
|
1457
|
-
const e =
|
|
1460
|
+
setup(x, { expose: t, emit: n }) {
|
|
1461
|
+
const e = x, a = n, o = M("gallery"), c = M([]), g = M([]), u = M(0), r = M(null), k = M(null), w = M(null), D = V(() => {
|
|
1458
1462
|
var y, b;
|
|
1459
1463
|
return ((b = (y = e.actionBar) == null ? void 0 : y.annotateButton) == null ? void 0 : b.show) === !0;
|
|
1460
1464
|
}), _ = V(() => {
|
|
@@ -1503,7 +1507,7 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1503
1507
|
g.value = JSON.parse(JSON.stringify(y || []));
|
|
1504
1508
|
}, { immediate: !0, deep: !0 });
|
|
1505
1509
|
const O = (y) => {
|
|
1506
|
-
u.value = y, o.value = "editor", a("pageChange", { nowPage: "editPage" }),
|
|
1510
|
+
u.value = y, o.value = "editor", a("pageChange", { nowPage: "editPage" }), w.value && (w.value.scrollTop = 0), at(() => {
|
|
1507
1511
|
k.value && (k.value.scrollTop = 0), window.scrollTo(0, 0), requestAnimationFrame(() => {
|
|
1508
1512
|
var b, I;
|
|
1509
1513
|
(I = (b = r.value) == null ? void 0 : b.jumpTo) == null || I.call(b, y);
|
|
@@ -1596,7 +1600,7 @@ const de = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//D
|
|
|
1596
1600
|
h("div", Fs, [
|
|
1597
1601
|
h("div", {
|
|
1598
1602
|
ref_key: "galleryGridRef",
|
|
1599
|
-
ref:
|
|
1603
|
+
ref: w,
|
|
1600
1604
|
class: "gallery-grid"
|
|
1601
1605
|
}, [
|
|
1602
1606
|
(v(!0), m(N, null, J(c.value, (I, F) => (v(), m("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(D,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(D=typeof globalThis<"u"?globalThis:D||self,t(D.VueImageAnnotator={},D.Vue))})(this,(function(D,t){"use strict";var Dn=Object.defineProperty;var Tn=(D,t,H)=>t in D?Dn(D,t,{enumerable:!0,configurable:!0,writable:!0,value:H}):D[t]=H;var B=(D,t,H)=>Tn(D,typeof t!="symbol"?t+"":t,H);const H=(v,e)=>Math.sqrt(Math.pow(v.x-e.x,2)+Math.pow(v.y-e.y,2)),ht=(v,e)=>{let i=!1;for(let n=0,l=e.length-1;n<e.length;l=n++){const a=e[n].x,r=e[n].y,g=e[l].x,m=e[l].y;r>v.y!=m>v.y&&v.x<(g-a)*(v.y-r)/(m-r)+a&&(i=!i)}return i},et=(v,e,i)=>{const n=i*(Math.PI/180),l=Math.cos(n),a=Math.sin(n),r=v.x-e.x,g=v.y-e.y;return{x:e.x+(r*l-g*a),y:e.y+(r*a+g*l)}};class dt{constructor(e){B(this,"canvas");B(this,"ctx");B(this,"img");B(this,"annotations",[]);B(this,"currentTool",null);B(this,"interactionMode","none");B(this,"activeAnnotation",null);B(this,"hoverAnnotation",null);B(this,"isDrawing",!1);B(this,"isDragging",!1);B(this,"isPanning",!1);B(this,"panStartPoint",null);B(this,"dragStartPoint",null);B(this,"dragStartAnnotation",null);B(this,"lastMouseMovePoint",null);B(this,"isHoveringStartPoint",!1);B(this,"currentLabelColor","#FF4081");B(this,"visibleLabels",new Set);B(this,"selectedHandleIndex",-1);B(this,"hoverHandleIndex",-1);B(this,"scale",1);B(this,"offset",{x:0,y:0});B(this,"listeners",{});B(this,"imageUrl","");this.canvas=e;const i=e.getContext("2d");if(!i)throw new Error("Could not get 2d context");this.ctx=i,this.img=new Image,this.img.crossOrigin="Anonymous",this.img.onload=()=>{this.fitImageToCanvas(),this.render()},this.bindEvents()}on(e,i){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(i)}emit(e,i){this.listeners[e]&&this.listeners[e].forEach(n=>n(i))}loadImage(e){this.imageUrl=e,this.img.src=e,this.activeAnnotation=null,this.isDrawing=!1}setAnnotations(e){this.annotations=JSON.parse(JSON.stringify(e)),this.render()}getAnnotations(){return this.annotations}setTool(e){e==="pan"?(this.interactionMode="pan",this.currentTool=null,this.isPanning=!1,this.canvas.style.cursor="grab"):e==="select"?(this.interactionMode="select",this.currentTool=null,this.canvas.style.cursor="default"):e?(this.interactionMode="draw",this.currentTool=e,this.canvas.style.cursor="crosshair"):(this.interactionMode="none",this.currentTool=null,this.canvas.style.cursor="default"),this.activeAnnotation=null,this.isDrawing=!1,this.render()}setLabelStyle(e){this.currentLabelColor=e}setVisibleLabels(e){this.visibleLabels=new Set(e),this.render()}zoom(e){const n=e>0?this.scale*1.1:this.scale/1.1;if(n<.1||n>10)return;const l=this.canvas.width/2,a=this.canvas.height/2,r=this.toImageCoords(l,a);this.scale=n,this.offset.x=l-r.x*this.scale,this.offset.y=a-r.y*this.scale,this.clampViewportOffset(),this.render()}resize(){this.fitImageToCanvas(),this.render()}toImageCoords(e,i){return{x:(e-this.offset.x)/this.scale,y:(i-this.offset.y)/this.scale}}toScreenCoords(e,i){return{x:e*this.scale+this.offset.x,y:i*this.scale+this.offset.y}}fitImageToCanvas(){const e=this.canvas.parentElement;if(e){if(this.canvas.width=e.clientWidth,this.canvas.height=e.clientHeight,this.img.width===0)return;const i=this.canvas.width/this.img.width,n=this.canvas.height/this.img.height;this.scale=Math.min(i,n),this.offset.x=(this.canvas.width-this.img.width*this.scale)/2,this.offset.y=(this.canvas.height-this.img.height*this.scale)/2,this.clampViewportOffset()}}clampViewportOffset(){if(this.img.width===0||this.img.height===0)return;const e=this.img.width*this.scale,i=this.img.height*this.scale,n=100;if(e<=this.canvas.width){const l=-e+n,a=this.canvas.width-n;this.offset.x=Math.min(a,Math.max(l,this.offset.x))}else{const l=this.canvas.width-e-n,a=n;this.offset.x=Math.min(a,Math.max(l,this.offset.x))}if(i<=this.canvas.height){const l=-i+n,a=this.canvas.height-n;this.offset.y=Math.min(a,Math.max(l,this.offset.y))}else{const l=this.canvas.height-i-n,a=n;this.offset.y=Math.min(a,Math.max(l,this.offset.y))}}bindEvents(){this.canvas.addEventListener("mousedown",this.handleMouseDown.bind(this)),this.canvas.addEventListener("mousemove",this.handleMouseMove.bind(this)),this.canvas.addEventListener("mouseup",this.handleMouseUp.bind(this)),this.canvas.addEventListener("mouseleave",this.handleMouseUp.bind(this)),window.addEventListener("keydown",this.handleKeyDown.bind(this))}handleKeyDown(e){this.interactionMode==="select"&&(e.key==="Delete"||e.key==="Backspace")&&this.activeAnnotation&&this.deleteAnnotation(this.activeAnnotation.id)}deleteAnnotation(e){const i=this.annotations.findIndex(n=>n.id===e);if(i>-1){const n=this.annotations[i];this.annotations.splice(i,1),this.activeAnnotation=null,this.emit("annotationChange",{action:"delete",changedItem:n,imageUrl:this.imageUrl}),this.render()}}handleMouseDown(e){const i=this.canvas.getBoundingClientRect(),n=e.clientX-i.left,l=e.clientY-i.top,a=this.toImageCoords(n,l);if(this.interactionMode==="pan"){this.isPanning=!0,this.panStartPoint={x:n,y:l},this.canvas.style.cursor="grabbing";return}if(this.interactionMode==="select"&&this.activeAnnotation){const m=this.getHitHandle(n,l,this.activeAnnotation);if(m!==-100){this.isDragging=!0,this.dragStartPoint=a,this.selectedHandleIndex=m,this.dragStartAnnotation=JSON.parse(JSON.stringify(this.activeAnnotation));return}}const r=this.interactionMode==="select"?this.getHitCategory(n,l):null;if(r){this.activeAnnotation=r,this.isDragging=!1,this.selectedHandleIndex=-1,this.emit("annotationChange",{action:"select",changedItem:r,imageUrl:this.imageUrl}),this.render();return}const g=this.getHitAnnotation(a);if(this.interactionMode==="select"){if(g){if(!(this.visibleLabels.size>0&&!this.visibleLabels.has(g.label))){this.activeAnnotation=g,this.isDragging=!0,this.dragStartPoint=a,this.selectedHandleIndex=-1,this.dragStartAnnotation=JSON.parse(JSON.stringify(g)),this.emit("annotationChange",{action:"select",changedItem:g,imageUrl:this.imageUrl}),this.render();return}}else this.activeAnnotation=null,this.emit("annotationChange",{action:"select",changedItem:void 0,imageUrl:this.imageUrl}),this.render();return}if(this.interactionMode==="draw"){if(this.isDrawing&&this.currentTool==="polygon"&&this.activeAnnotation){const m=this.activeAnnotation.coordinates;if(m.points.length>2&&H(a,m.points[0])<20/this.scale){this.finishDrawing();return}this.startDrawing(a);return}if(this.currentTool){if(this.currentTool==="polygon"&&!this.isDrawing){this.startDrawing(a);return}this.startDrawing(a)}return}this.activeAnnotation=null,this.render()}handleMouseMove(e){const i=this.canvas.getBoundingClientRect(),n=e.clientX-i.left,l=e.clientY-i.top,a=this.toImageCoords(n,l);if(this.isPanning&&this.panStartPoint){const r=n-this.panStartPoint.x,g=l-this.panStartPoint.y;this.offset.x+=r,this.offset.y+=g,this.clampViewportOffset(),this.panStartPoint={x:n,y:l},this.render();return}if(this.lastMouseMovePoint=a,this.isDrawing){if(this.currentTool==="polygon"&&this.activeAnnotation){const r=this.activeAnnotation.coordinates;if(r.points.length>2){const g=r.points[0],m=H(a,g);this.isHoveringStartPoint=m<20/this.scale}else this.isHoveringStartPoint=!1}this.updateDrawing(a)}else this.isDragging&&this.activeAnnotation&&this.dragStartPoint?this.updateDragging(a):this.checkHover(n,l,a);this.render()}handleMouseUp(e){if(this.isPanning){this.isPanning=!1,this.panStartPoint=null,this.canvas.style.cursor="grab";return}if(this.isDrawing){if(this.currentTool==="polygon"){this.render();return}this.finishDrawing()}else this.isDragging&&this.activeAnnotation&&this.emit("annotationChange",{action:"update",changedItem:this.activeAnnotation,imageUrl:this.imageUrl});this.currentTool!=="polygon"&&(this.isDrawing=!1),this.isDragging=!1,this.dragStartPoint=null,this.selectedHandleIndex=-1,this.render()}hexToRgba(e,i){if(!e.startsWith("#"))return e;const n=parseInt(e.slice(1,3),16),l=parseInt(e.slice(3,5),16),a=parseInt(e.slice(5,7),16);return`rgba(${n}, ${l}, ${a}, ${i})`}startDrawing(e){if(!this.currentTool)return;const i=Date.now().toString();if(this.hexToRgba(this.currentLabelColor,.2),this.currentLabelColor,this.currentTool==="rectangle")this.isDrawing=!0,this.dragStartPoint=e,this.activeAnnotation={id:i,type:"rectangle",label:"",coordinates:{x1:e.x,y1:e.y,x2:e.x,y2:e.y},style:{strokeColor:this.currentLabelColor}};else if(this.currentTool==="point"){const n={id:i,type:"point",label:"",coordinates:{points:[e]},style:{strokeColor:this.currentLabelColor}};this.annotations.push(n),this.emit("annotationChange",{action:"add",changedItem:n,imageUrl:this.imageUrl}),this.activeAnnotation=n}else if(this.currentTool==="polygon")this.activeAnnotation&&this.activeAnnotation.type==="polygon"&&this.isDrawing?this.activeAnnotation.coordinates.points.push(e):(this.isDrawing=!0,this.activeAnnotation={id:i,type:"polygon",label:"",coordinates:{points:[e]},style:{strokeColor:this.currentLabelColor}});else if(this.currentTool==="category"){const n={id:i,type:"category",label:"",coordinates:{x:e.x,y:e.y},style:{strokeColor:this.currentLabelColor}};this.annotations.push(n),this.emit("annotationChange",{action:"add",changedItem:n,imageUrl:this.imageUrl}),this.activeAnnotation=n}else this.currentTool==="rotatedRect"&&(this.isDrawing=!0,this.dragStartPoint=e,this.activeAnnotation={id:i,type:"rotatedRect",label:"",coordinates:{x:e.x,y:e.y,width:0,height:0,angle:0},style:{strokeColor:this.currentLabelColor}})}updateDrawing(e){if(this.activeAnnotation)if(this.activeAnnotation.type==="rectangle"&&this.dragStartPoint){const i=this.activeAnnotation.coordinates;i.x2=e.x,i.y2=e.y}else if(this.activeAnnotation.type==="rotatedRect"&&this.dragStartPoint){const i=this.activeAnnotation.coordinates,n=Math.abs(e.x-this.dragStartPoint.x),l=Math.abs(e.y-this.dragStartPoint.y);i.width=n*2,i.height=l*2}else this.activeAnnotation.type}finishDrawing(){if(this.activeAnnotation){if(this.activeAnnotation.type==="rectangle"){const e=this.activeAnnotation.coordinates;if(Math.abs(e.x1-e.x2)<2||Math.abs(e.y1-e.y2)<2){this.activeAnnotation=null,this.isDrawing=!1;return}const i=Math.min(e.x1,e.x2),n=Math.max(e.x1,e.x2),l=Math.min(e.y1,e.y2),a=Math.max(e.y1,e.y2);e.x1=i,e.x2=n,e.y1=l,e.y2=a,this.annotations.push(this.activeAnnotation),this.emit("annotationChange",{action:"add",changedItem:this.activeAnnotation,imageUrl:this.imageUrl})}else if(this.activeAnnotation.type==="polygon"){if(this.activeAnnotation.coordinates.points.length<3){this.activeAnnotation=null,this.isDrawing=!1;return}this.annotations.push(this.activeAnnotation),this.emit("annotationChange",{action:"add",changedItem:this.activeAnnotation,imageUrl:this.imageUrl})}else if(this.activeAnnotation.type==="rotatedRect"){const e=this.activeAnnotation.coordinates;if(e.width<2||e.height<2){this.activeAnnotation=null,this.isDrawing=!1;return}this.annotations.push(this.activeAnnotation),this.emit("annotationChange",{action:"add",changedItem:this.activeAnnotation,imageUrl:this.imageUrl})}this.activeAnnotation.type}this.isDrawing=!1}updateDragging(e){if(!this.activeAnnotation||!this.dragStartPoint||!this.dragStartAnnotation)return;const i=e.x-this.dragStartPoint.x,n=e.y-this.dragStartPoint.y;this.selectedHandleIndex===-1?this.moveAnnotation(this.activeAnnotation,this.dragStartAnnotation,i,n):this.resizeAnnotation(this.activeAnnotation,this.dragStartAnnotation,this.selectedHandleIndex,e)}moveAnnotation(e,i,n,l){if(e.type==="rectangle"){const a=i.coordinates,r=e.coordinates;r.x1=a.x1+n,r.x2=a.x2+n,r.y1=a.y1+l,r.y2=a.y2+l}else if(e.type==="point"){const a=i.coordinates,r=e.coordinates;r.points=a.points.map(g=>({x:g.x+n,y:g.y+l}))}else if(e.type==="rotatedRect"){const a=i.coordinates,r=e.coordinates;r.x=a.x+n,r.y=a.y+l}else if(e.type==="polygon"){const a=i.coordinates,r=e.coordinates;r.points=a.points.map(g=>({x:g.x+n,y:g.y+l}))}else if(e.type==="category"){const a=i.coordinates,r=e.coordinates;a&&r&&(r.x=a.x+n,r.y=a.y+l)}}resizeAnnotation(e,i,n,l){if(e.type==="rectangle"){const a=e.coordinates;n===0&&(a.x1=l.x,a.y1=l.y),n===1&&(a.x2=l.x,a.y1=l.y),n===2&&(a.x2=l.x,a.y2=l.y),n===3&&(a.x1=l.x,a.y2=l.y)}else if(e.type==="polygon"){const a=e.coordinates;n>=0&&n<a.points.length&&(a.points[n]=l)}else if(e.type==="point"){const a=e.coordinates;n>=0&&n<a.points.length&&(a.points[n]=l)}else if(e.type==="rotatedRect"){const a=e.coordinates;if(n===-2){const r=a.x,g=a.y,m=l.x-r,h=l.y-g;let k=Math.atan2(h,m)*180/Math.PI;k+=90,a.angle=k}else{const r=a.angle*Math.PI/180,g=Math.cos(-r),m=Math.sin(-r),h=l.x-a.x,k=l.y-a.y,u=h*g-k*m,S=h*m+k*g;(n===0||n===3)&&(a.width/2,a.width=Math.abs(u)*2),(n===1||n===2)&&(a.width=Math.abs(u)*2),(n===0||n===1)&&(a.height=Math.abs(S)*2),(n===2||n===3)&&(a.height=Math.abs(S)*2)}}}getHitAnnotation(e){for(let i=this.annotations.length-1;i>=0;i--){const n=this.annotations[i];if(this.isPointInAnnotation(e,n))return n}return null}isPointInAnnotation(e,i){if(i.type==="rectangle"){const n=i.coordinates;return e.x>=n.x1&&e.x<=n.x2&&e.y>=n.y1&&e.y<=n.y2}else if(i.type==="polygon"){const n=i.coordinates;return ht(e,n.points)}else if(i.type==="rotatedRect"){const n=i.coordinates,l=et(e,{x:n.x,y:n.y},-n.angle),a=n.width/2,r=n.height/2;return l.x>=n.x-a&&l.x<=n.x+a&&l.y>=n.y-r&&l.y<=n.y+r}else if(i.type==="point")return i.coordinates.points.some(l=>H(e,l)<10/this.scale);return!1}getHitHandle(e,i,n){const l=this.getAnnotationHandles(n),a=6;for(let r=0;r<l.length;r++){const g=l[r],m=this.toScreenCoords(g.x,g.y);if(Math.abs(e-m.x)<a&&Math.abs(i-m.y)<a)return n.type==="rotatedRect"&&r===4?-2:r}return-100}getAnnotationHandles(e){if(e.type==="rectangle"){const i=e.coordinates;return[{x:i.x1,y:i.y1},{x:i.x2,y:i.y1},{x:i.x2,y:i.y2},{x:i.x1,y:i.y2}]}else{if(e.type==="polygon")return e.coordinates.points;if(e.type==="point")return e.coordinates.points;if(e.type==="rotatedRect"){const i=e.coordinates,n={x:i.x,y:i.y},l=i.width/2,a=i.height/2,r={x:i.x-l,y:i.y-a},g={x:i.x+l,y:i.y-a},m={x:i.x+l,y:i.y+a},h={x:i.x-l,y:i.y+a},k={x:i.x,y:i.y-a-20/this.scale};return[r,g,m,h,k].map(u=>et(u,n,i.angle))}}return[]}checkHover(e,i,n){const l=this.getHitCategory(e,i);if(l){this.canvas.style.cursor="pointer",this.hoverAnnotation=l;return}if(this.activeAnnotation&&this.getHitHandle(e,i,this.activeAnnotation)!==-100){this.canvas.style.cursor="pointer";return}const a=this.getHitAnnotation(n);a?(this.canvas.style.cursor="move",this.hoverAnnotation=a):(this.canvas.style.cursor="default",this.hoverAnnotation=null)}render(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.img.complete&&this.img.width>0&&this.ctx.drawImage(this.img,this.offset.x,this.offset.y,this.img.width*this.scale,this.img.height*this.scale),this.annotations.forEach(e=>{e!==this.activeAnnotation&&this.drawItem(e,!1)}),this.activeAnnotation&&this.drawItem(this.activeAnnotation,!0),this.renderCategories()}renderCategories(){const e=this.annotations.filter(n=>n.type==="category");if(e.length===0)return;this.ctx.save(),this.ctx.font="14px sans-serif",this.ctx.textBaseline="middle",this.ctx.textAlign="center";const i=12;e.forEach(n=>{var b;const l=n.label||"未命名分类",a=this.ctx.measureText(l).width+i*2,r=28,g=this.activeAnnotation===n,m=this.hoverAnnotation===n;let h={x:20,y:20};n.coordinates&&typeof n.coordinates.x=="number"&&typeof n.coordinates.y=="number"&&(h=this.toScreenCoords(n.coordinates.x,n.coordinates.y));const k=h.x-a/2,u=h.y-r/2,S=((b=n.style)==null?void 0:b.strokeColor)||"#2196F3";this.ctx.fillStyle=g?S:this.hexToRgba(S,.85),m&&!g&&(this.ctx.fillStyle=S),g?(this.ctx.strokeStyle="#ffffff",this.ctx.lineWidth=2):(this.ctx.strokeStyle="transparent",this.ctx.lineWidth=0),this.ctx.beginPath(),this.ctx.roundRect(k,u,a,r,6),this.ctx.fill(),g&&(this.ctx.stroke(),this.ctx.save(),this.ctx.strokeStyle=S,this.ctx.lineWidth=2,this.ctx.strokeRect(k-3,u-3,a+6,r+6),this.ctx.restore()),this.ctx.fillStyle="#ffffff",this.ctx.fillText(l,h.x,h.y)}),this.ctx.restore()}getHitCategory(e,i){const n=this.annotations.filter(g=>g.type==="category");if(n.length===0)return null;this.ctx.save(),this.ctx.font="14px sans-serif";const l=12,a=28;let r=null;for(let g=n.length-1;g>=0;g--){const m=n[g],h=m.label||"未命名分类",k=this.ctx.measureText(h).width+l*2;let u={x:20,y:20};m.coordinates&&typeof m.coordinates.x=="number"&&typeof m.coordinates.y=="number"&&(u=this.toScreenCoords(m.coordinates.x,m.coordinates.y));const S=u.x-k/2,b=u.y-a/2;if(e>=S&&e<=S+k&&i>=b&&i<=b+a){r=m;break}}return this.ctx.restore(),r}drawItem(e,i){var a;if(this.visibleLabels.size>0&&!this.visibleLabels.has(e.label)&&!i)return;this.ctx.save();const n=((a=e.style)==null?void 0:a.strokeColor)||"#FF4081",l=i?"#00E5FF":n;if(this.ctx.strokeStyle=l,this.ctx.lineWidth=2,e.type==="rectangle"){const r=e.coordinates,g=this.toScreenCoords(r.x1,r.y1),m=this.toScreenCoords(r.x2,r.y2),h=Math.min(g.x,m.x),k=Math.min(g.y,m.y),u=Math.abs(g.x-m.x),S=Math.abs(g.y-m.y);this.ctx.strokeRect(h,k,u,S),i&&this.drawHandles(this.getAnnotationHandles(e))}else if(e.type==="polygon"){const r=e.coordinates;if(r.points.length===0){this.ctx.restore();return}this.ctx.beginPath();const g=this.toScreenCoords(r.points[0].x,r.points[0].y);this.ctx.moveTo(g.x,g.y);for(let m=1;m<r.points.length;m++){const h=this.toScreenCoords(r.points[m].x,r.points[m].y);this.ctx.lineTo(h.x,h.y)}if(!this.isDrawing||e!==this.activeAnnotation)this.ctx.closePath();else if(this.lastMouseMovePoint){let m=this.lastMouseMovePoint;if(this.isHoveringStartPoint&&r.points.length>0){m=r.points[0];const k=this.toScreenCoords(r.points[0].x,r.points[0].y);this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(k.x,k.y,10,0,Math.PI*2),this.ctx.fillStyle="rgba(255, 215, 0, 0.6)",this.ctx.strokeStyle="#FFFFFF",this.ctx.lineWidth=2,this.ctx.fill(),this.ctx.stroke(),this.ctx.restore()}const h=this.toScreenCoords(m.x,m.y);this.ctx.lineTo(h.x,h.y)}this.ctx.stroke(),i&&this.drawHandles(this.getAnnotationHandles(e))}else if(e.type==="rotatedRect"){const r=e.coordinates;this.ctx.translate(this.toScreenCoords(r.x,r.y).x,this.toScreenCoords(r.x,r.y).y),this.ctx.rotate(r.angle*Math.PI/180);const g=r.width*this.scale,m=r.height*this.scale;this.ctx.strokeRect(-g/2,-m/2,g,m),this.ctx.rotate(-r.angle*Math.PI/180),this.ctx.translate(-this.toScreenCoords(r.x,r.y).x,-this.toScreenCoords(r.x,r.y).y),i&&this.drawHandles(this.getAnnotationHandles(e))}else e.type==="point"&&e.coordinates.points.forEach(g=>{const m=this.toScreenCoords(g.x,g.y);this.ctx.beginPath(),this.ctx.arc(m.x,m.y,5,0,Math.PI*2),this.ctx.fillStyle=i?"#00E5FF":n,this.ctx.fill(),this.ctx.stroke()});this.ctx.restore()}drawHandles(e){this.ctx.fillStyle="#FFFFFF",this.ctx.strokeStyle="#000000",this.ctx.lineWidth=1,e.forEach(i=>{const n=this.toScreenCoords(i.x,i.y);this.ctx.fillRect(n.x-4,n.y-4,8,8),this.ctx.strokeRect(n.x-4,n.y-4,8,8)})}}const gt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032114659" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21132" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 391.68c-66.56 0-120.32 54.187-120.32 120.32 0 66.56 53.76 120.32 120.32 120.32 66.133 0 120.32-53.76 120.32-120.32A120.747 120.747 0 0 0 512 391.68z" p-id="21133" fill="#515151"></path><path d="M512 113.493c-219.733 0-398.507 178.774-398.507 398.507S292.267 910.507 512 910.507 910.507 731.733 910.507 512 731.733 113.493 512 113.493z m0 720.214c-177.493 0-321.707-144.214-321.707-321.707S334.507 190.293 512 190.293 833.707 334.507 833.707 512 689.493 833.707 512 833.707z" p-id="21134" fill="#515151"></path></svg>',mt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M15.7 4.3c.4.4.4 1 0 1.4L9.4 12l6.3 6.3c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-7-7c-.4-.4-.4-1 0-1.4l7-7c.4-.4 1-.4 1.4 0z"/></svg>',ft='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032015085" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16560" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M911.872 972.629333l-2.645333-1.621333-209.92-208.554667-91.306667 193.194667-147.029333-494.933333 486.4 179.968-177.834667 68.266666 201.472 200.362667a9.898667 9.898667 0 0 1 2.133333 4.608 10.069333 10.069333 0 0 1-1.024 4.778667l-2.389333 3.157333-47.786667 47.530667a9.813333 9.813333 0 0 1-4.522666 2.901333 12.544 12.544 0 0 1-2.56 0z m-657.066667-12.970666L0.256 501.248l97.109333-175.445333 64.256-115.456L254.805333 42.581333h510.208l259.328 466.858667h-100.608L714.325333 132.778667H305.322667l-204.8 368.384 204.8 368.725333H418.133333v90.026667z" fill="#515151" p-id="16561"></path></svg>',pt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032973956" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6763" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M613.6 960H97.2c-17.7 0-32-14.3-32-32V98.5c0-17.7 14.3-32 32-32h829.5c17.7 0 32 14.3 32 32v518.2c0 17.7-14.3 32-32 32s-32-14.3-32-32V130.5H129.2V896h484.4c17.7 0 32 14.3 32 32s-14.3 32-32 32z" fill="#515151" p-id="6764"></path><path d="M711.3 694.9l120.3 46.9-100.7 80.7z" fill="#515151" p-id="6765"></path><path d="M707.6 882.1L671.3 645l223.6 87.1-187.3 150z m43.7-137.3l2.8 18 14.2-11.4-17-6.6z" fill="#515151" p-id="6766"></path><path d="M927 957.9c-8.2 0-16.4-3.1-22.6-9.4L723.2 767.2c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l181.2 181.2c12.5 12.5 12.5 32.8 0 45.3-6.3 6.3-14.5 9.5-22.7 9.5z" fill="#515151" p-id="6767"></path></svg>',yt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M19 6h-4V5c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v1H5c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1zM10 5h4v1h-4V5z"/><path fill="currentColor" d="M6 9v10c0 1.7 1.3 3 3 3h6c1.7 0 3-1.3 3-3V9H6zm4 9c0 .6-.4 1-1 1s-1-.4-1-1v-5c0-.6.4-1 1-1s1 .4 1 1v5zm4 0c0 .6-.4 1-1 1s-1-.4-1-1v-5c0-.6.4-1 1-1s1 .4 1 1v5z"/></svg>',ut='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M19 15v4c0 1.1-.9 2-2 2H7c-1.1 0-2-.9-2-2v-4c0-.6.4-1 1-1s1 .4 1 1v4h10v-4c0-.6.4-1 1-1s1 .4 1 1zm-7.7 1.3c.2.2.4.3.7.3s.5-.1.7-.3l4.6-4.6c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0l-2.9 2.9V3c0-.6-.4-1-1-1s-1 .4-1 1v8.3l-2.9-2.9c-.4-.4-1-.4-1.4 0-.4.4-.4 1 0 1.4l4.6 4.6z"/></svg>',wt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M3 17.2v4.3c0 .3.2.5.5.5h4.3c.1 0 .3-.1.4-.2l11.1-11.1-5.1-5.1L3.1 16.8c-.1.1-.1.3-.1.4zm18.8-10.9c.4-.4.4-1 0-1.4l-3.7-3.7c-.4-.4-1-.4-1.4 0l-2.3 2.3 5.1 5.1 2.3-2.3z"/></svg>',vt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M18.7 4.3c.4.4.4 1 0 1.4L12.4 12l6.3 6.3c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-7-7c-.4-.4-.4-1 0-1.4l7-7c.4-.4 1-.4 1.4 0z"/><path fill="currentColor" d="M10.7 4.3c.4.4.4 1 0 1.4L4.4 12l6.3 6.3c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-7-7c-.4-.4-.4-1 0-1.4l7-7c.4-.4 1-.4 1.4 0z"/></svg>',xt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032412624" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3527" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M870.2976 144.0256l51.2 51.2-122.88 122.88a514.304 514.304 0 0 1 170.7264 193.8688C885.0432 679.04 711.8848 793.6 512 793.6c-56.832 0-111.488-9.2672-162.56-26.3424L197.4016 919.296l-51.2-51.2L870.2976 144.0256z m-127.1552 229.5296l-76.6208 76.6208a166.4 166.4 0 0 1-216.32 216.3712l-38.6048 38.5792c29.5168 6.9632 60.032 10.9312 91.1872 11.5712L512 716.8c150.6816 0 287.488-77.2096 366.464-200.3456l2.816-4.48-2.816-4.48a435.8144 435.8144 0 0 0-135.3216-133.9392zM512 230.4c49.664 0 97.664 7.0656 143.0528 20.2496l-63.8208 63.7696a436.4032 436.4032 0 0 0-70.016-7.1168L512 307.2a434.8928 434.8928 0 0 0-366.464 200.3456l-2.816 4.48 2.816 4.48a435.84 435.84 0 0 0 119.8848 123.776l-55.0912 55.04a514.2528 514.2528 0 0 1-155.648-183.296C138.9312 344.96 312.0896 230.4 512 230.4z m89.5488 284.8l-86.3744 86.2976 1.7408-0.0256a89.6 89.6 0 0 0 84.6336-86.272zM512 345.6a166.656 166.656 0 0 1 42.5728 5.504l-79.0272 79.0272a89.9328 89.9328 0 0 0-45.4144 45.4144l-79.0272 79.0272A166.4 166.4 0 0 1 512 345.6z" p-id="3528" fill="#515151"></path></svg>',bt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M5.3 19.7c-.4-.4-.4-1 0-1.4l6.3-6.3-6.3-6.3c-.4-.4-.4-1 0-1.4.4-.4 1-.4 1.4 0l7 7c.4.4.4 1 0 1.4l-7 7c-.4.4-1 .4-1.4 0z"/><path fill="currentColor" d="M13.3 19.7c-.4-.4-.4-1 0-1.4l6.3-6.3-6.3-6.3c-.4-.4-.4-1 0-1.4.4-.4 1-.4 1.4 0l7 7c.4.4.4 1 0 1.4l-7 7c-.4.4-1 .4-1.4 0z"/></svg>',kt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775031871732" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12257" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M174.63 78.98c0.03-12.61 16.41-19.91 25.81-11.5l328.72 293.98 318.27 284.63c10.51 9.4 0.4 26.75-14.25 24.46L435.7 608.43c-6.23-0.97-12.72 1.92-16.16 7.2L199.96 952.72c-8.09 12.42-27.76 8.34-27.72-5.76l1.17-426.97 1.22-441.01z" fill="#515151" p-id="12258"></path></svg>',Ct='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032210611" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="23146" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M543.487882 0.00128a161.919393 161.919393 0 0 0-114.55957 47.359822L47.553742 428.991671a162.111392 162.111392 0 0 0 0 229.119141l318.270806 318.398806a161.983393 161.983393 0 0 0 229.119141 0l381.630569-381.694569A162.111392 162.111392 0 0 0 1023.99808 480.255479V161.920673A161.919393 161.919393 0 0 0 861.886688 0.00128H543.487882z m0 90.55966l318.462806 0.064a71.295733 71.295733 0 0 1 71.487732 71.295733v318.270806c0 18.943929-7.615971 37.119861-21.055921 50.559811l-381.56657 381.758568a71.423732 71.423732 0 0 1-101.055621 0L111.489502 594.111052a71.487732 71.487732 0 0 1 0-101.119621l381.566569-381.566569c13.37595-13.37595 31.551882-20.863922 50.431811-20.863922z m112.447578 124.159535a153.023426 153.023426 0 1 0 0 306.046852 153.023426 153.023426 0 0 0 0-306.046852z m57.727784 129.151515a62.463766 62.463766 0 1 1-115.455567 47.807821 62.463766 62.463766 0 0 1 115.455567-47.807821z" p-id="23147" fill="#515151"></path></svg>',_t='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775096284335" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4580" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M308.377435 102.251961C318.982967 47.176334 372.449479 0 448.66303 0c39.496466 0 68.314257 20.040799 85.063685 46.07921 11.995223 18.577967 17.919693 39.935315 20.040799 60.341823 13.384913-4.388496 27.35496-6.582744 41.398147-6.655886 38.911333 0 68.021691 19.455666 85.72196 44.616378 16.822569 23.990446 23.551596 53.100804 23.551596 79.724347v29.988058c0.146283 98.960589 0.292566 197.921178 0.658274 296.954909-0.073142 13.165489 1.097124 26.47726 3.510797 39.569608 8.484426-7.533585 16.237436-15.213453 24.795004-23.69788l13.165488-13.019205c13.970046-13.604338 30.353765-28.598367 49.809432-41.178723 42.056422-27.208676 93.694394-39.642749 162.813209-22.600755 27.574384 6.802169 44.982086 25.380136 54.344211 44.543236 8.776992 18.285401 11.117524 38.545625 10.386108 56.392176-1.38969 33.864562-14.920887 75.26271-43.738679 101.447404l-1.755398 1.755398c-37.375359 36.424518-75.335851 72.263904-113.881477 107.518157-31.450889 28.964075-63.486912 57.050451-96.327491 84.478552-29.037217 24.063587-58.293858 46.51806-80.967755 58.952132A491.511574 491.511574 0 0 1 421.527495 1023.982446a45.567219 45.567219 0 0 1-46.810626-44.25067c0-24.795004 20.699074-44.835803 46.225493-44.762661a395.403507 395.403507 0 0 0 215.036314-64.072045 49.955715 49.955715 0 0 1 4.022788-2.340531c13.458055-7.167877 37.009651-24.502437 67.363417-49.590007 31.597173-26.47726 62.609212-53.612795 92.889836-81.552888a5027.973235 5027.973235 0 0 0 111.687228-105.470192l1.755399-1.755398 0.585133-0.511991 1.682257-1.535974a42.056422 42.056422 0 0 0 9.362125-15.140312c3.291372-8.118718 5.119912-16.749427 5.631903-25.453278a46.07921 46.07921 0 0 0-1.023982-12.580356c-39.715891-8.557568-62.536071-0.658274-81.479746 11.556374a234.126272 234.126272 0 0 0-35.473678 29.841774l-10.386108 10.239824c-9.800975 9.654692-20.845357 20.699074-31.96288 30.500049l-0.146283 0.146283c-19.016817 16.603144-42.787838 31.597173-70.435364 32.182306a74.897002 74.897002 0 0 1-65.096027-35.54682 141.602144 141.602144 0 0 1-18.870534-51.930538 302.074822 302.074822 0 0 1-4.169071-50.613989c-0.365708-99.033731-0.511991-198.213745-0.511992-297.247476v-29.988058c0-13.311772-3.65708-24.136729-7.826151-30.13434a13.896905 13.896905 0 0 0-4.388496-4.388496 7.679868 7.679868 0 0 0-4.022789-0.804558 46.956909 46.956909 0 0 0-28.232658 10.532391 30.719473 30.719473 0 0 0-12.214648 24.721862v232.736582a45.567219 45.567219 0 0 1-46.591201 44.543236 45.567219 45.567219 0 0 1-46.51806-44.616378V124.340726c0-14.628321-3.364514-25.745844-7.094736-31.45089a10.093541 10.093541 0 0 0-2.925664-3.364514 1.901682 1.901682 0 0 0-0.511991-0.292566 9.435267 9.435267 0 0 0-2.340531-0.146283c-38.618767 0-49.443724 23.697879-49.078016 33.791421v1.682256l-0.292567 77.822666v3.876505l-1.023982 253.508797a45.567219 45.567219 0 0 1-46.810626 44.323812 45.567219 45.567219 0 0 1-46.298635-44.68952l1.023983-250.656274a32.036022 32.036022 0 0 0-7.75301-15.140312c-1.82854-1.682257-5.851328-4.827346-17.188277-4.827346a41.178723 41.178723 0 0 0-26.477261 9.069559c-5.558762 4.754204-10.678674 12.580356-10.678674 26.257835v296.589202a45.567219 45.567219 0 0 1-46.518059 44.543236 45.567219 45.567219 0 0 1-46.51806-44.616378v-169.688519a31.158323 31.158323 0 0 0-4.607921-5.705045 11.84894 11.84894 0 0 0-5.193054-3.218231c-1.023982-0.292566-4.681063-1.023982-12.653497 1.462832-17.700268 5.705045-26.111552 14.994029-30.792615 27.208676-5.48562 14.189471-6.582744 35.10797-1.097124 61.438947 42.202705 201.139409 64.949744 301.123981 83.162003 350.34828 16.091153 43.372971 47.615184 81.918596 90.915013 109.566122a43.372971 43.372971 0 0 1 12.872922 61.804654 47.834609 47.834609 0 0 1-64.510894 12.28779c-59.171557-37.741067-103.934218-91.500146-127.046965-153.963075C71.179216 755.406479 46.896203 647.449472 5.571197 449.601435-1.889246 414.127758-3.059512 375.216425 10.471685 340.108455 24.734297 302.806238 54.210364 273.330171 99.265591 258.921276c16.603144-5.558762 34.376554-7.460444 51.784255-5.631904v-29.256641c0-81.18718 67.655983-124.340726 130.265196-124.340726 9.435267 0 18.431684 0.877699 27.062393 2.486815z" p-id="4581" fill="#515151"></path></svg>',Et='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775033156525" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3463" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M694.4 960H195.2C131.7 960 80 908.4 80 845.1V462c0-63.4 51.7-114.9 115.2-114.9h499.2c63.5 0 115.2 51.6 115.2 114.9v383.1c0 63.3-51.7 114.9-115.2 114.9zM195.2 423.7c-21.2 0-38.4 17.2-38.4 38.3v383.1c0 21.1 17.2 38.3 38.4 38.3h499.2c21.2 0 38.4-17.2 38.4-38.3V462c0-21.1-17.2-38.3-38.4-38.3H195.2z" fill="#515151" p-id="3464"></path><path d="M905.6 450.3c-14.8 0-28.9-8.6-35.2-23C788.6 240.8 592.7 213 483.2 213c-21.2 0-38.4-17.2-38.4-38.3s17.2-38.3 38.4-38.3c218.2 0 385 94.9 457.6 260.3 8.5 19.4-0.4 42-19.8 50.5-5 2.1-10.3 3.1-15.4 3.1z" fill="#515151" p-id="3465"></path><path d="M473.6 285.4c-9.8 0-19.7-3.7-27.2-11.2l-72.5-72.4c-15-15-15-39.2 0-54.2l72.5-72.4c15-15 39.3-15 54.3 0s15 39.2 0 54.2l-45.4 45.3 45.4 45.3c15 15 15 39.2 0 54.2-7.4 7.4-17.3 11.2-27.1 11.2z" fill="#515151" p-id="3466"></path></svg>',Bt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M8.3 19.7c-.4-.4-.4-1 0-1.4l6.3-6.3-6.3-6.3c-.4-.4-.4-1 0-1.4.4-.4 1-.4 1.4 0l7 7c.4.4.4 1 0 1.4l-7 7c-.4.4-1 .4-1.4 0z"/></svg>',St='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032400373" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3314" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 230.4c199.8848 0 373.0176 114.5344 457.344 281.5744C885.0432 679.04 711.8848 793.6 512 793.6c-199.8848 0-373.0176-114.5344-457.344-281.5744C138.9568 344.96 312.1152 230.4 512 230.4z m0 76.8a434.8928 434.8928 0 0 0-366.464 200.3456l-2.816 4.48 2.816 4.48a434.944 434.944 0 0 0 357.248 200.192L512 716.8c150.6816 0 287.488-77.2096 366.464-200.3456l2.816-4.48-2.816-4.48a434.944 434.944 0 0 0-357.248-200.192L512 307.2z m0 38.4a166.4 166.4 0 1 1 0 332.8 166.4 166.4 0 0 1 0-332.8z m0 76.8a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2z" p-id="3315" fill="#515151"></path></svg>',It='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032548251" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4695" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M849.7664 778.1376c1.9968 1.4848 3.84 3.072 5.632 4.864l72.3968 72.3968a51.2 51.2 0 1 1-72.3968 72.3968l-72.3968-72.3968a51.6096 51.6096 0 0 1-4.864-5.632 448 448 0 1 1 71.68-71.68zM460.8 460.8V358.4a51.2 51.2 0 1 1 102.4 0v102.4h102.4a51.2 51.2 0 0 1 0 102.4h-102.4v102.4a51.2 51.2 0 0 1-102.4 0v-102.4H358.4a51.2 51.2 0 0 1 0-102.4h102.4z m38.4 384a345.6 345.6 0 1 0 0-691.2 345.6 345.6 0 0 0 0 691.2z" fill="#515151" p-id="4696"></path></svg>',Vt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032629657" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1933" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M849.7664 778.1376c1.9968 1.4848 3.84 3.072 5.632 4.864l72.3968 72.3968a51.2 51.2 0 1 1-72.3968 72.3968l-72.3968-72.3968a51.6096 51.6096 0 0 1-4.864-5.632 448 448 0 1 1 71.68-71.68zM499.2 844.8a345.6 345.6 0 1 0 0-691.2 345.6 345.6 0 0 0 0 691.2zM358.4 563.2a51.2 51.2 0 0 1 0-102.4h307.2a51.2 51.2 0 0 1 0 102.4H358.4z" fill="#666666" p-id="1934"></path></svg>',At=["innerHTML"],Nt=t.defineComponent({__name:"SvgIcon",props:{name:{},size:{}},setup(v){const e=v,i=t.ref(""),n=Object.assign({"../assets/svg/aim.svg":gt,"../assets/svg/back.svg":mt,"../assets/svg/connection.svg":ft,"../assets/svg/crop.svg":pt,"../assets/svg/delete.svg":yt,"../assets/svg/download.svg":ut,"../assets/svg/edit.svg":wt,"../assets/svg/first.svg":vt,"../assets/svg/hide.svg":xt,"../assets/svg/last.svg":bt,"../assets/svg/pointer.svg":kt,"../assets/svg/price-tag.svg":Ct,"../assets/svg/rank.svg":_t,"../assets/svg/refresh-right.svg":Et,"../assets/svg/right.svg":Bt,"../assets/svg/view.svg":St,"../assets/svg/zoom-in.svg":It,"../assets/svg/zoom-out.svg":Vt});return t.watchEffect(()=>{const l=`../assets/svg/${e.name}.svg`,a=n[l];a?i.value=a:(console.warn(`Icon ${e.name} not found at path ${l}`),i.value="")}),(l,a)=>(t.openBlock(),t.createElementBlock("i",{class:t.normalizeClass(["svg-icon",[v.size?`size-${v.size}`:""]]),innerHTML:i.value},null,10,At))}}),J=(v,e)=>{const i=v.__vccOpts||v;for(const[n,l]of e)i[n]=l;return i},V=J(Nt,[["__scopeId","data-v-3928607b"]]),Dt={key:0,class:"image-list-sidebar"},Tt={class:"image-list-header"},Mt=["onClick"],zt={class:"image-list-stage"},Pt=["src","alt"],Lt={key:0,class:"thumb-overlay-layer"},$t={key:1,class:"thumb-overlay-svg",viewBox:"0 0 100 100",preserveAspectRatio:"none"},Rt=["points"],Ht={class:"image-list-text"},Ut={class:"center-sidebar"},Ft={key:0,class:"left-sidebar"},Ot=["onClick","title"],Wt={key:0,class:"divider"},Gt={class:"center-area"},Yt={key:0,class:"floating-label-selector"},Jt={key:0,class:"current-label"},jt={class:"label-name"},Xt={key:1,class:"current-label empty"},qt={key:0,class:"selector-dropdown"},Kt={key:0,class:"dropdown-empty"},Zt=["onClick"],Qt={class:"label-name"},te={key:0,class:"batch-nav"},ee=["disabled"],ne=["disabled"],oe=["disabled"],se=["disabled"],ie={key:1,class:"right-sidebar"},ae={class:"label-list"},le={class:"label-row"},ce=["onUpdate:modelValue","onChange"],re=["title"],he=["onClick"],de={class:"action-icon more-actions"},ge=["onClick"],me={class:"modal-content"},fe={class:"modal-body"},pe={class:"form-group"},ye={class:"form-group"},ue={class:"color-input-wrapper"},we={class:"color-value"},ve={class:"modal-actions"},xe=["disabled"],nt=J(t.defineComponent({__name:"ImageAnnotator",props:{annotationTypes:{default:()=>["rectangle","polygon","point","rotatedRect","category"]},batchImages:{default:()=>[]},labels:{default:()=>[]},defaultActiveType:{},theme:{default:"light"},readOnly:{type:Boolean,default:!1},image:{},predictionCandidates:{},session:{},requestId:{},minZoom:{},maxZoom:{}},emits:["annotationChange","batchChange","labelChange","ready","error","tool:change","viewport:change","annotation:add","annotation:update","annotation:delete","annotation:select","prediction:loaded","prediction:apply","prediction:reject"],setup(v,{expose:e,emit:i}){const n=v,l=i,a=t.ref(null),r=t.ref(null),g=t.ref(null),m=t.ref([]),h=t.ref(null),k=t.ref(null),u=t.ref(0),S=t.ref(""),b=t.ref([]),A=t.ref(""),U=t.ref(!1),x=t.ref({name:"",color:"#FF0000"}),E=t.ref("none"),p=t.ref([]),N=t.ref({}),M=t.computed(()=>k.value==="select"&&!!S.value),L=t.ref(!1),F=t.computed(()=>b.value.find(o=>o.id===A.value)),st=o=>{o.stopPropagation(),L.value=!L.value},it=o=>{W(o),L.value=!1};t.onMounted(()=>{document.addEventListener("click",o=>{o.target.closest(".floating-label-selector")||(L.value=!1)})});const j=o=>{if(!o||N.value[o])return;const s=new Image;s.onload=()=>{const c=s.naturalWidth||1,d=s.naturalHeight||1;N.value={...N.value,[o]:{width:c,height:d}}},s.src=o},X=()=>{n.batchImages.forEach(o=>{j(o.imageUrl)})},K=(o,s)=>{m.value[s]=o},O=(o=u.value)=>{const s=g.value,c=m.value[o];if(!s||!c)return;const d=s.scrollTop,f=d+s.clientHeight,_=c.offsetTop,I=_+c.offsetHeight;if(_<d){s.scrollTo({top:Math.max(_-8,0),behavior:"smooth"});return}I>f&&s.scrollTo({top:I-s.clientHeight+8,behavior:"smooth"})},R=()=>{var c,d,f,_;const o=n.batchImages[u.value],s=(o==null?void 0:o.imageUrl)||((c=n.image)==null?void 0:c.url);return{eventId:`${Date.now()}-${Math.random().toString(36).slice(2,10)}`,timestamp:Date.now(),requestId:n.requestId,taskId:(d=n.session)==null?void 0:d.taskId,imageId:((f=n.image)==null?void 0:f.id)||s,operator:(_=n.session)==null?void 0:_.userId}},y=o=>{var d;const s=o==null?void 0:o.action;if(!s)return;const c={meta:R(),action:s,current:o==null?void 0:o.changedItem,source:(d=o==null?void 0:o.changedItem)!=null&&d.predictionId?"prediction":"manual"};s==="add"&&l("annotation:add",c),s==="update"&&l("annotation:update",c),s==="delete"&&l("annotation:delete",c),s==="select"&&l("annotation:select",c)},w=t.computed(()=>n.annotationTypes),C=o=>({rectangle:"crop",polygon:"connection",point:"aim",rotatedRect:"refresh-right",category:"price-tag"})[o]||o,z=o=>({rectangle:"矩形框",polygon:"多边形",point:"关键点",rotatedRect:"旋转矩形",category:"分类标签"})[o]||o;t.onMounted(()=>{if(X(),a.value){h.value=new dt(a.value),h.value.on("annotationChange",s=>{var c,d;if(s.action==="add"&&s.changedItem){const f=b.value.find(_=>_.id===A.value);f&&(s.changedItem.label=f.name,s.changedItem.labelId=f.id)}s.action==="select"?S.value=((c=s.changedItem)==null?void 0:c.id)||"":s.action==="delete"&&((d=s.changedItem)==null?void 0:d.id)===S.value&&(S.value=""),l("annotationChange",s),y(s)}),P(),T();const o=new ResizeObserver(()=>{var s;(s=h.value)==null||s.resize()});r.value&&o.observe(r.value),n.defaultActiveType&&$(n.defaultActiveType),t.nextTick(()=>O()),l("ready",{meta:R()})}});const T=()=>{if(!h.value)return;const o=b.value.find(c=>c.id===A.value);o&&h.value.setLabelStyle(o.color);const s=b.value.filter(c=>c.visible).map(c=>c.name);h.value.setVisibleLabels(s)},P=()=>{var o;if(h.value)if(S.value="",requestAnimationFrame(()=>{var s;(s=h.value)==null||s.resize()}),n.batchImages.length>0){const s=n.batchImages[u.value];h.value.loadImage(s.imageUrl),s.annotations?h.value.setAnnotations(s.annotations):h.value.setAnnotations([])}else(o=n.image)!=null&&o.url&&h.value.loadImage(n.image.url)},$=o=>{var s,c;if(k.value=o,S.value="",o!=="pan"&&o!=="select"&&b.value.length===0){alert("请先创建标签!");return}o==="pan"||o==="select"?(s=h.value)==null||s.setTool(o):(c=h.value)==null||c.setTool(o),l("tool:change",{meta:R(),tool:o})},Ze=()=>{var o;(o=h.value)!=null&&o.activeAnnotation&&h.value.deleteAnnotation(h.value.activeAnnotation.id)},at=()=>{h.value&&l("viewport:change",{meta:R(),scale:h.value.scale,offset:{...h.value.offset}})},Qe=()=>{var o;(o=h.value)==null||o.zoom(1),at()},tn=()=>{var o;(o=h.value)==null||o.zoom(-1),at()},en=()=>{x.value={name:"",color:"#2196F3"},U.value=!0},Z=()=>{U.value=!1},nn=()=>{if(!x.value.name.trim()){alert("请输入标签名称");return}const s={id:Date.now().toString(),name:x.value.name,color:x.value.color,visible:!0};b.value.push(s),l("labelChange",b.value),T(),b.value.length===1&&W(s),Z()},W=o=>{var s;A.value=o.id,(s=h.value)==null||s.setLabelStyle(o.color)},on=(o,s)=>{if(!o.startsWith("#"))return o;let c=0,d=0,f=0;return o.length===4?(c=parseInt(o[1]+o[1],16),d=parseInt(o[2]+o[2],16),f=parseInt(o[3]+o[3],16)):o.length===7&&(c=parseInt(o.slice(1,3),16),d=parseInt(o.slice(3,5),16),f=parseInt(o.slice(5,7),16)),`rgba(${c}, ${d}, ${f}, ${s})`},sn=o=>{var s;if(o.id===A.value&&((s=h.value)==null||s.setLabelStyle(o.color)),h.value){const c=h.value.getAnnotations();let d=!1;c.forEach(f=>{f.label===o.name&&(f.style||(f.style={}),f.style.strokeColor=o.color,f.style.fillColor=on(o.color,.2),d=!0)}),d&&h.value.render()}l("labelChange",b.value),T()},an=o=>{o.visible=!o.visible,T()},ln=o=>{const s=b.value.findIndex(c=>c.id===o);s>-1&&(b.value.splice(s,1),l("labelChange",b.value),A.value===o&&(A.value=b.value.length>0?b.value[0].id:"",A.value&&W(b.value[0])),T())};t.watch(()=>n.labels,o=>{const s=JSON.parse(JSON.stringify(o||[]));if(b.value=s,b.value.length>0)if(!A.value||!b.value.find(c=>c.id===A.value))W(b.value[0]);else{const c=b.value.find(d=>d.id===A.value);c&&W(c)}else A.value="";T()},{immediate:!0,deep:!0});const cn=()=>{u.value>0&&(Q(),u.value--,P(),tt())},rn=()=>{u.value<n.batchImages.length-1&&(Q(),u.value++,P(),tt())},hn=()=>{u.value>0&&q(0)},dn=()=>{u.value<n.batchImages.length-1&&q(n.batchImages.length-1)},Q=()=>{if(h.value){const o=h.value.getAnnotations();n.batchImages[u.value].annotations=o}},tt=()=>{const o=n.batchImages[u.value];l("batchChange",{currentIndex:u.value,total:n.batchImages.length,currentImageUrl:o.imageUrl,currentAnnotations:o.annotations||[]})},lt=(o=[])=>{var f;if(!h.value)return;if(p.value=JSON.parse(JSON.stringify(o)),p.value.length===0){E.value="none";return}E.value="loaded";const c=(h.value.getAnnotations()||[]).filter(_=>!_.predictionId),d=p.value.map(_=>{const I=JSON.parse(JSON.stringify(_.annotation));return I.id=I.id||`pred-${_.id}`,I.predictionId=_.id,I.modelRunId=_.modelRunId||I.modelRunId,I.confidence=_.confidence??I.confidence,I.reviewStatus=I.reviewStatus||"draft",I});h.value.setAnnotations([...c,...d]),l("prediction:loaded",{meta:R(),modelRunId:(f=p.value[0])==null?void 0:f.modelRunId,candidates:p.value})},gn=(o,s)=>{var f;if(!h.value)return[];E.value="applying";const d=(h.value.getAnnotations()||[]).filter(_=>_.predictionId&&o.includes(_.predictionId));return d.forEach(_=>{_.reviewStatus="accepted"}),E.value="applied",l("prediction:apply",{meta:R(),modelRunId:(f=d[0])==null?void 0:f.modelRunId,candidateIds:o,threshold:s,acceptedAnnotations:d}),h.value.render(),d},mn=(o,s)=>{var f;if(!h.value)return;const c=h.value.getAnnotations()||[],d=c.filter(_=>!(_.predictionId&&o.includes(_.predictionId)));h.value.setAnnotations(d),l("prediction:reject",{meta:R(),modelRunId:(f=c.find(_=>_.predictionId&&o.includes(_.predictionId)))==null?void 0:f.modelRunId,candidateIds:o,reason:s})},fn=(o,s=[])=>{h.value&&(h.value.loadImage(o.url),h.value.setAnnotations(s))},pn=o=>{var s;(s=h.value)==null||s.setAnnotations(o)},ct=()=>{var o;return((o=h.value)==null?void 0:o.getAnnotations())||[]},yn=(o="json")=>{var c,d;const s=ct();return{format:o,image:((c=n.batchImages[u.value])==null?void 0:c.imageUrl)||((d=n.image)==null?void 0:d.url)||"",annotations:s}},q=o=>{o>=0&&o<n.batchImages.length&&(Q(),u.value=o,P(),tt())},un=o=>{var s;return o===u.value&&h.value?h.value.getAnnotations()||[]:((s=n.batchImages[o])==null?void 0:s.annotations)||[]},wn=o=>o.type==="rectangle",vn=o=>o.type==="polygon",xn=o=>o.type==="point",bn=o=>o.type==="rotatedRect",kn=o=>o.type==="category",G=o=>{var c,d;const s=(c=b.value.find(f=>f.name===o.label))==null?void 0:c.color;return((d=o.style)==null?void 0:d.strokeColor)||s||"#409eff"},rt=o=>{const s=o.coordinates;return(s==null?void 0:s.points)||[]},Y=o=>{const s=n.batchImages[o];if(s!=null&&s.width&&(s!=null&&s.height))return{width:s.width,height:s.height};const c=s!=null&&s.imageUrl?N.value[s.imageUrl]:void 0;return c||(s!=null&&s.imageUrl&&j(s.imageUrl),{width:1,height:1})},Cn=o=>{const s=n.batchImages[o];return s!=null&&s.width&&(s!=null&&s.height)?!0:s!=null&&s.imageUrl?!!N.value[s.imageUrl]:!1},_n=(o,s)=>{const c=s.coordinates,d=Y(o),f=G(s),_=Math.min(c.x1,c.x2),I=Math.min(c.y1,c.y2),An=Math.max(c.x1,c.x2),Nn=Math.max(c.y1,c.y2);return{left:`${_/d.width*100}%`,top:`${I/d.height*100}%`,width:`${(An-_)/d.width*100}%`,height:`${(Nn-I)/d.height*100}%`,borderColor:f,backgroundColor:`${f}22`}},En=(o,s)=>{const c=Y(o);return rt(s).map(d=>`${d.x/c.width*100},${d.y/c.height*100}`).join(" ")},Bn=o=>{const s=G(o);return{fill:`${s}33`,stroke:s,strokeWidth:"1.4"}},Sn=(o,s,c)=>{const d=Y(o),f=G(c);return{left:`${s.x/d.width*100}%`,top:`${s.y/d.height*100}%`,backgroundColor:f}},In=(o,s)=>{const c=s.coordinates,d=Y(o),f=G(s),_=Math.abs(c.width),I=Math.abs(c.height);return{left:`${(c.x-_/2)/d.width*100}%`,top:`${(c.y-I/2)/d.height*100}%`,width:`${_/d.width*100}%`,height:`${I/d.height*100}%`,transform:`rotate(${c.angle||0}deg)`,borderColor:f,backgroundColor:`${f}22`}},Vn=(o,s)=>{const c=s.coordinates,d=Y(o),f=G(s);return{left:`${c.x/d.width*100}%`,top:`${c.y/d.height*100}%`,backgroundColor:`${f}d9`}};return e({jumpTo:q,setImage:fn,setAnnotations:pn,getAnnotations:ct,selectTool:$,loadPredictionCandidates:lt,applyPredictions:gn,rejectPredictions:mn,exportAnnotations:yn,getAllAnnotations:()=>{var o,s;return n.batchImages.length>0?n.batchImages:[{imageUrl:((o=n.image)==null?void 0:o.url)||"",annotations:((s=h.value)==null?void 0:s.getAnnotations())||[]}]},getCurrentAnnotation:()=>{var o,s,c;return{imageUrl:((o=n.batchImages[u.value])==null?void 0:o.imageUrl)||((s=n.image)==null?void 0:s.url)||"",annotations:((c=h.value)==null?void 0:c.getAnnotations())||[]}}}),t.watch(()=>{var o;return(o=n.image)==null?void 0:o.url},()=>{var o;n.batchImages.length===0&&((o=n.image)!=null&&o.url)&&P()}),t.watch(()=>n.predictionCandidates,o=>{o&<(o)},{immediate:!0,deep:!0}),t.watch(()=>n.batchImages.map(o=>`${o.imageUrl}:${o.width||""}x${o.height||""}`),()=>{X(),m.value=m.value.slice(0,n.batchImages.length),t.nextTick(()=>O())},{immediate:!0}),t.watch(()=>u.value,()=>{t.nextTick(()=>O())}),(o,s)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["annotation-container",v.theme])},[v.batchImages&&v.batchImages.length>0?(t.openBlock(),t.createElementBlock("div",Dt,[t.createElementVNode("div",Tt,"共 "+t.toDisplayString(v.batchImages.length)+" 张",1),t.createElementVNode("div",{ref_key:"imageListScrollRef",ref:g,class:"image-list-scroll"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(v.batchImages,(c,d)=>(t.openBlock(),t.createElementBlock("button",{key:`${c.imageUrl}-${d}`,ref_for:!0,ref:f=>K(f,d),class:t.normalizeClass(["image-list-item",{active:d===u.value}]),onClick:f=>q(d)},[t.createElementVNode("div",zt,[t.createElementVNode("img",{src:c.imageUrl,alt:`第${d+1}张`,class:"image-list-thumb"},null,8,Pt),Cn(d)?(t.openBlock(),t.createElementBlock("div",Lt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(un(d),f=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:f.id},[wn(f)?(t.openBlock(),t.createElementBlock("div",{key:0,class:"thumb-overlay-rect",style:t.normalizeStyle(_n(d,f))},null,4)):vn(f)?(t.openBlock(),t.createElementBlock("svg",$t,[t.createElementVNode("polygon",{points:En(d,f),style:t.normalizeStyle(Bn(f))},null,12,Rt)])):xn(f)?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:2},t.renderList(rt(f),(_,I)=>(t.openBlock(),t.createElementBlock("div",{key:`${f.id}-${I}`,class:"thumb-overlay-point",style:t.normalizeStyle(Sn(d,_,f))},null,4))),128)):bn(f)?(t.openBlock(),t.createElementBlock("div",{key:3,class:"thumb-overlay-rotated",style:t.normalizeStyle(In(d,f))},null,4)):kn(f)?(t.openBlock(),t.createElementBlock("div",{key:4,class:"thumb-overlay-category",style:t.normalizeStyle(Vn(d,f))},t.toDisplayString(f.label),5)):t.createCommentVNode("",!0)],64))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("span",Ht,"第 "+t.toDisplayString(d+1)+" 张",1)],10,Mt))),128))],512)])):t.createCommentVNode("",!0),t.createElementVNode("div",Ut,[v.readOnly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Ft,[t.createElementVNode("div",{class:t.normalizeClass(["tool-btn",{active:k.value==="pan"}]),onClick:s[0]||(s[0]=c=>$("pan")),title:"拖动"},[t.createVNode(V,{name:"rank"})],2),t.createElementVNode("div",{class:t.normalizeClass(["tool-btn",{active:k.value==="select"}]),onClick:s[1]||(s[1]=c=>$("select")),title:"选择"},[t.createVNode(V,{name:"pointer"})],2),s[5]||(s[5]=t.createElementVNode("div",{class:"divider"},null,-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.value,c=>(t.openBlock(),t.createElementBlock("div",{key:c,class:t.normalizeClass(["tool-btn",{active:k.value===c}]),onClick:d=>$(c),title:z(c)},[t.createVNode(V,{name:C(c)},null,8,["name"])],10,Ot))),128)),s[6]||(s[6]=t.createElementVNode("div",{class:"divider"},null,-1)),t.createElementVNode("div",{class:"tool-btn",onClick:Qe,title:"放大"},[t.createVNode(V,{name:"zoom-in"})]),t.createElementVNode("div",{class:"tool-btn",onClick:tn,title:"缩小"},[t.createVNode(V,{name:"zoom-out"})]),M.value?(t.openBlock(),t.createElementBlock("div",Wt)):t.createCommentVNode("",!0),M.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"tool-btn",onClick:Ze,title:"删除选中"},[t.createVNode(V,{name:"delete"})])):t.createCommentVNode("",!0)]))]),t.createElementVNode("div",Gt,[t.createElementVNode("div",{class:"canvas-wrapper",ref_key:"canvasWrapper",ref:r,onWheel:s[2]||(s[2]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("canvas",{ref_key:"canvasRef",ref:a},null,512),v.readOnly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Yt,[t.createElementVNode("div",{class:"selector-trigger",onClick:st},[F.value?(t.openBlock(),t.createElementBlock("div",Jt,[t.createElementVNode("span",{class:"color-dot",style:t.normalizeStyle({backgroundColor:F.value.color})},null,4),t.createElementVNode("span",jt,t.toDisplayString(F.value.name),1)])):(t.openBlock(),t.createElementBlock("div",Xt,[...s[7]||(s[7]=[t.createElementVNode("span",{class:"label-name"},"请选择标签",-1)])])),t.createVNode(V,{name:"right",class:t.normalizeClass(["arrow-icon",{"is-open":L.value}])},null,8,["class"])]),L.value?(t.openBlock(),t.createElementBlock("div",qt,[b.value.length===0?(t.openBlock(),t.createElementBlock("div",Kt,"请在右侧创建标签")):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(b.value,c=>(t.openBlock(),t.createElementBlock("div",{key:c.id,class:t.normalizeClass(["dropdown-item",{active:A.value===c.id}]),onClick:d=>it(c)},[t.createElementVNode("span",{class:"color-dot",style:t.normalizeStyle({backgroundColor:c.color})},null,4),t.createElementVNode("span",Qt,t.toDisplayString(c.name),1),A.value===c.id?(t.openBlock(),t.createBlock(V,{key:0,name:"aim",class:"check-icon"})):t.createCommentVNode("",!0)],10,Zt))),128))])):t.createCommentVNode("",!0)]))],544),v.batchImages&&v.batchImages.length>0?(t.openBlock(),t.createElementBlock("div",te,[t.createElementVNode("button",{class:"icon-btn",onClick:hn,disabled:u.value<=0,title:"第一张"},[t.createVNode(V,{name:"first"})],8,ee),t.createElementVNode("button",{class:"icon-btn",onClick:cn,disabled:u.value<=0,title:"上一张"},[t.createVNode(V,{name:"back"})],8,ne),t.createElementVNode("span",null,t.toDisplayString(u.value+1)+" / "+t.toDisplayString(v.batchImages.length),1),t.createElementVNode("button",{class:"icon-btn",onClick:rn,disabled:u.value>=v.batchImages.length-1,title:"下一张"},[t.createVNode(V,{name:"right"})],8,oe),t.createElementVNode("button",{class:"icon-btn",onClick:dn,disabled:u.value>=v.batchImages.length-1,title:"最后一张"},[t.createVNode(V,{name:"last"})],8,se)])):t.createCommentVNode("",!0)]),v.readOnly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",ie,[t.createElementVNode("div",{class:"sidebar-header"},[s[8]||(s[8]=t.createElementVNode("h3",null,"标签",-1)),t.createElementVNode("button",{class:"add-btn",onClick:en},"添加标签")]),t.createElementVNode("div",ae,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,c=>(t.openBlock(),t.createElementBlock("div",{key:c.id,class:"label-item",style:t.normalizeStyle({backgroundColor:c.color+"1A",color:c.color})},[t.createElementVNode("div",le,[t.createElementVNode("label",{class:"color-wrapper",style:t.normalizeStyle({backgroundColor:c.color})},[t.withDirectives(t.createElementVNode("input",{type:"color","onUpdate:modelValue":d=>c.color=d,onChange:d=>sn(c),style:{visibility:"hidden",width:"0",height:"0"}},null,40,ce),[[t.vModelText,c.color]])],4),t.createElementVNode("span",{class:"label-name",title:c.name},t.toDisplayString(c.name),9,re),t.createElementVNode("span",{class:"action-icon eye",onClick:d=>an(c)},[c.visible?(t.openBlock(),t.createBlock(V,{key:0,name:"view"})):(t.openBlock(),t.createBlock(V,{key:1,name:"hide"}))],8,he),t.createElementVNode("div",de,[s[9]||(s[9]=t.createElementVNode("span",{class:"dots"},"•••",-1)),t.createElementVNode("span",{class:"delete-btn",onClick:d=>ln(c.id),title:"删除"},[t.createVNode(V,{name:"delete"})],8,ge)])])],4))),128))])])),U.value?(t.openBlock(),t.createElementBlock("div",{key:2,class:"modal-overlay",onClick:t.withModifiers(Z,["self"])},[t.createElementVNode("div",me,[s[12]||(s[12]=t.createElementVNode("div",{class:"modal-header"},[t.createElementVNode("h3",null,"新增标签")],-1)),t.createElementVNode("div",fe,[t.createElementVNode("div",pe,[s[10]||(s[10]=t.createElementVNode("label",null,[t.createTextVNode("标签名称 "),t.createElementVNode("span",{class:"required"},"*")],-1)),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":s[3]||(s[3]=c=>x.value.name=c),placeholder:"请输入标签名称",class:"modal-input",autofocus:""},null,512),[[t.vModelText,x.value.name]])]),t.createElementVNode("div",ye,[s[11]||(s[11]=t.createElementVNode("label",null,"标签颜色",-1)),t.createElementVNode("div",ue,[t.createElementVNode("label",{class:"color-picker-box",style:t.normalizeStyle({backgroundColor:x.value.color})},[t.withDirectives(t.createElementVNode("input",{type:"color","onUpdate:modelValue":s[4]||(s[4]=c=>x.value.color=c),class:"modal-color-picker"},null,512),[[t.vModelText,x.value.color]])],4),t.createElementVNode("span",we,t.toDisplayString(x.value.color),1)])])]),t.createElementVNode("div",ve,[t.createElementVNode("button",{onClick:Z,class:"cancel-btn"},"取消"),t.createElementVNode("button",{onClick:nn,class:"confirm-btn",disabled:!x.value.name.trim()},"确认",8,xe)])])])):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-914fe07d"]]),be={class:"thumbnail-wrapper",ref:"wrapper"},ke=["src","alt"],Ce=["viewBox","preserveAspectRatio"],_e=["x","y","width","height","stroke","stroke-width"],Ee=["points","stroke","stroke-width"],Be=["transform"],Se=["x","y","width","height","stroke","stroke-width"],Ie={key:3},Ve=["cx","cy","r","fill","stroke-width"],Ae=["x","y","width","height","fill"],Ne=["x","y","fill","font-size","font-weight","text-anchor","dominant-baseline"],De={key:1,class:"loading-placeholder"},Te=J(t.defineComponent({__name:"AnnotationThumbnail",props:{src:{},annotations:{},alt:{},labels:{},fit:{},strokeWidth:{},fontSize:{}},setup(v){const e=v,i=t.ref(null),n=t.ref(!1),l=t.ref(0),a=t.ref(0),r=()=>{i.value&&(l.value=i.value.naturalWidth,a.value=i.value.naturalHeight,n.value=!0)},g=t.computed(()=>e.fit==="contain"?"xMidYMid meet":"xMidYMid slice"),m=t.computed(()=>e.strokeWidth??10),h=t.computed(()=>e.fontSize??30),k=x=>{var E;if((E=x.style)!=null&&E.strokeColor)return x.style.strokeColor;if(e.labels){const p=e.labels.find(N=>N.name===x.label);if(p)return p.color}return"#FF0000"},u=x=>{const E=x.coordinates,p=Math.min(E.x1,E.x2),N=Math.min(E.y1,E.y2),M=Math.abs(E.x1-E.x2),L=Math.abs(E.y1-E.y2);return{x:p,y:N,width:M,height:L}},S=x=>x.coordinates.points.map(p=>`${p.x},${p.y}`).join(" "),b=x=>{if(x.type==="rectangle"){const E=u(x);return{x:E.x,y:E.y-5}}else if(x.type==="polygon"){const E=x.coordinates.points;if(E.length>0)return{x:E[0].x,y:E[0].y-5}}else{if(x.type==="rotatedRect")return{x:x.coordinates.x,y:x.coordinates.y-x.coordinates.height/2-5};if(x.type==="point"){const E=x.coordinates.points;if(E.length>0)return{x:E[0].x,y:E[0].y-15}}else if(x.type==="category")return{x:x.coordinates.x,y:x.coordinates.y}}return{x:0,y:0}},A=x=>{const{x:E,y:p,angle:N}=x.coordinates,M=N*180/Math.PI;return`translate(${E}, ${p}) rotate(${M})`},U=x=>({x:x.coordinates.x,y:x.coordinates.y});return(x,E)=>(t.openBlock(),t.createElementBlock("div",be,[t.createElementVNode("img",{ref_key:"img",ref:i,src:v.src,class:"thumbnail-image",style:t.normalizeStyle({objectFit:v.fit}),onLoad:r,alt:v.alt},null,44,ke),n.value?(t.openBlock(),t.createElementBlock("svg",{key:0,class:"annotation-overlay",viewBox:`0 0 ${l.value} ${a.value}`,preserveAspectRatio:g.value},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(v.annotations,p=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:p.id},[p.type==="rectangle"?(t.openBlock(),t.createElementBlock("rect",{key:0,x:u(p).x,y:u(p).y,width:u(p).width,height:u(p).height,stroke:k(p),"stroke-width":m.value,fill:"transparent"},null,8,_e)):p.type==="polygon"?(t.openBlock(),t.createElementBlock("polygon",{key:1,points:S(p),stroke:k(p),"stroke-width":m.value,fill:"transparent"},null,8,Ee)):p.type==="rotatedRect"?(t.openBlock(),t.createElementBlock("g",{key:2,transform:A(p)},[t.createElementVNode("rect",{x:-p.coordinates.width/2,y:-p.coordinates.height/2,width:p.coordinates.width,height:p.coordinates.height,stroke:k(p),"stroke-width":m.value,fill:"transparent"},null,8,Se)],8,Be)):p.type==="point"?(t.openBlock(),t.createElementBlock("g",Ie,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.coordinates.points,(N,M)=>(t.openBlock(),t.createElementBlock("circle",{key:M,cx:N.x,cy:N.y,r:m.value*1.5,fill:k(p),stroke:"white","stroke-width":m.value*.5},null,8,Ve))),128))])):p.type==="category"?(t.openBlock(),t.createElementBlock("rect",{key:4,x:U(p).x-(p.label||"").length*h.value*.6/2-8,y:U(p).y-h.value/2-4,width:(p.label||"").length*h.value*.6+16,height:h.value+8,rx:"6",ry:"6",fill:k(p),"fill-opacity":"0.85"},null,8,Ae)):t.createCommentVNode("",!0),p.label?(t.openBlock(),t.createElementBlock("text",{key:5,x:b(p).x,y:b(p).y,fill:p.type==="category"?"#ffffff":k(p),"font-size":h.value,"font-weight":p.type==="category"?"normal":"bold","text-anchor":p.type==="category"?"middle":"start","dominant-baseline":p.type==="category"?"middle":"auto",class:t.normalizeClass({"anno-label":p.type!=="category"})},t.toDisplayString(p.label),11,Ne)):t.createCommentVNode("",!0)],64))),128))],8,Ce)):(t.openBlock(),t.createElementBlock("div",De,"Loading..."))],512))}}),[["__scopeId","data-v-159a7956"]]),Me={key:0,class:"gallery-view"},ze={class:"gallery-layout"},Pe={class:"gallery-sidebar"},Le={class:"label-stats-table"},$e={class:"label-cover-wrapper"},Re=["src"],He={class:"gallery-content"},Ue=["onClick"],Fe={class:"thumbnail-wrapper"},Oe={class:"img-meta"},We={class:"img-index"},Ge={class:"anno-count"},Ye={key:0,class:"bottom-bar"},Je={key:1,class:"editor-view"},je={class:"editor-header"},Xe={class:"header-left"},qe={class:"editor-title"},Ke={class:"editor-content"},ot=J(t.defineComponent({__name:"BatchAnnotator",props:{images:{},labels:{},actionBar:{},clickToEnterEditor:{type:Boolean},thumbStrokeWidth:{},thumbFontSize:{}},emits:["export","update:images","imageClick","update:labels","pageChange"],setup(v,{expose:e,emit:i}){const n=v,l=i,a=t.ref("gallery"),r=t.ref([]),g=t.ref([]),m=t.ref(0),h=t.ref(null),k=t.ref(null),u=t.ref(null),S=t.computed(()=>{var y,w;return((w=(y=n.actionBar)==null?void 0:y.annotateButton)==null?void 0:w.show)===!0}),b=t.computed(()=>{var y,w;return((w=(y=n.actionBar)==null?void 0:y.exportButton)==null?void 0:w.show)===!0}),A=t.computed(()=>S.value||b.value),U=t.computed(()=>{var y,w;return((w=(y=n.actionBar)==null?void 0:y.annotateButton)==null?void 0:w.text)||"手动标注"}),x=t.computed(()=>{var y,w;return((w=(y=n.actionBar)==null?void 0:y.exportButton)==null?void 0:w.text)||"导出"}),E=t.computed(()=>n.clickToEnterEditor!==!1),p=t.computed(()=>{const y={};g.value.forEach(C=>{y[C.name]={count:0,cover:""}});let w=0;return r.value.forEach(C=>{C.annotations&&C.annotations.forEach(z=>{var P;const T=z.label||(z.labelId?(P=g.value.find($=>$.id===z.labelId))==null?void 0:P.name:null);T&&y[T]&&(y[T].count++,w++,y[T].cover||(y[T].cover=C.imageUrl))})}),g.value.map(C=>{var P,$;const z=((P=y[C.name])==null?void 0:P.count)||0,T=w===0?"0.00%":(z/w*100).toFixed(2)+"%";return{id:C.id,name:C.name,color:C.color,count:z,percentage:T,cover:(($=y[C.name])==null?void 0:$.cover)||""}})}),N=y=>({color:y.color,backgroundColor:y.color+"1A"});t.onMounted(()=>{l("pageChange",{nowPage:"listPage"})}),t.watch(()=>n.images,y=>{r.value=JSON.parse(JSON.stringify(y))},{immediate:!0,deep:!0}),t.watch(()=>n.labels,y=>{g.value=JSON.parse(JSON.stringify(y||[]))},{immediate:!0,deep:!0});const M=y=>{m.value=y,a.value="editor",l("pageChange",{nowPage:"editPage"}),u.value&&(u.value.scrollTop=0),t.nextTick(()=>{k.value&&(k.value.scrollTop=0),window.scrollTo(0,0),requestAnimationFrame(()=>{var w,C;(C=(w=h.value)==null?void 0:w.jumpTo)==null||C.call(w,y)})})},L=(y,w)=>{if(E.value){M(y);return}l("imageClick",{index:y,imageId:w.id,image:w})},F=y=>r.value.findIndex(w=>w.id===y);e({openImageById:y=>{const w=F(y);return w<0?!1:(M(w),!0)},triggerImageClickById:y=>{const w=F(y);if(w<0)return!1;const C=r.value[w];return C?(l("imageClick",{index:w,imageId:C.id,image:C}),!0):!1},getFinalData:()=>({images:JSON.parse(JSON.stringify(r.value)),labels:JSON.parse(JSON.stringify(g.value))})});const j=()=>{if(h.value&&h.value.getCurrentAnnotation){const y=h.value.getCurrentAnnotation();r.value[m.value]&&(r.value[m.value].annotations=y.annotations)}a.value="gallery",l("pageChange",{nowPage:"listPage"})},X=()=>{l("export",r.value)},K=y=>{m.value=y.currentIndex,r.value[y.currentIndex]&&(r.value[y.currentIndex].annotations=y.currentAnnotations)},O=y=>{if(h.value&&h.value.getCurrentAnnotation){const w=h.value.getCurrentAnnotation();r.value[m.value]&&(r.value[m.value].annotations=w.annotations,l("update:images",r.value))}},R=y=>{g.value=JSON.parse(JSON.stringify(y||[])),l("update:labels",g.value)};return(y,w)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"batchRootRef",ref:k,class:"batch-annotator"},[a.value==="gallery"?(t.openBlock(),t.createElementBlock("div",Me,[t.createElementVNode("div",ze,[t.createElementVNode("div",Pe,[t.createElementVNode("table",Le,[w[1]||(w[1]=t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",null,"标签封面"),t.createElementVNode("th",null,"标签名称"),t.createElementVNode("th",null,"标注数"),t.createElementVNode("th",null,"占比")])],-1)),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,C=>(t.openBlock(),t.createElementBlock("tr",{key:C.id,style:t.normalizeStyle(N(C))},[t.createElementVNode("td",null,[t.createElementVNode("div",$e,[C.cover?(t.openBlock(),t.createElementBlock("img",{key:0,src:C.cover,class:"label-cover"},null,8,Re)):(t.openBlock(),t.createElementBlock("div",{key:1,class:"label-cover-empty",style:t.normalizeStyle({backgroundColor:C.color})},null,4))])]),t.createElementVNode("td",null,t.toDisplayString(C.name),1),t.createElementVNode("td",null,t.toDisplayString(C.count),1),t.createElementVNode("td",null,t.toDisplayString(C.percentage),1)],4))),128))])])]),t.createElementVNode("div",He,[t.createElementVNode("div",{ref_key:"galleryGridRef",ref:u,class:"gallery-grid"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(C,z)=>(t.openBlock(),t.createElementBlock("div",{key:z,class:"gallery-item",onClick:T=>L(z,C)},[t.createElementVNode("div",Fe,[t.createVNode(Te,{src:C.imageUrl,annotations:C.annotations||[],labels:g.value,fit:"cover",strokeWidth:n.thumbStrokeWidth,fontSize:n.thumbFontSize},null,8,["src","annotations","labels","strokeWidth","fontSize"])]),t.createElementVNode("div",Oe,[t.createElementVNode("span",We,"#"+t.toDisplayString(z+1),1),t.createElementVNode("span",Ge,t.toDisplayString((C.annotations||[]).length)+" 标注",1)])],8,Ue))),128))],512)])]),A.value?(t.openBlock(),t.createElementBlock("div",Ye,[S.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"action-btn primary",onClick:w[0]||(w[0]=C=>M(0))},[t.createVNode(V,{name:"edit"}),t.createTextVNode(" "+t.toDisplayString(U.value),1)])):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"action-btn success",onClick:X},[t.createVNode(V,{name:"download"}),t.createTextVNode(" "+t.toDisplayString(x.value),1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",Je,[t.createElementVNode("div",je,[t.createElementVNode("div",Xe,[t.createElementVNode("button",{class:"back-btn",onClick:j},[t.createVNode(V,{name:"back",class:"back-icon"}),w[2]||(w[2]=t.createTextVNode()),w[3]||(w[3]=t.createElementVNode("span",{class:"back-text"},"返回",-1))]),t.createElementVNode("span",qe,"正在标注: "+t.toDisplayString(m.value+1)+" / "+t.toDisplayString(r.value.length),1)])]),t.createElementVNode("div",Ke,[t.createVNode(nt,{ref_key:"annotatorRef",ref:h,batchImages:r.value,labels:g.value,annotationTypes:["rectangle","polygon","point","rotatedRect","category"],onBatchChange:K,onAnnotationChange:O,onLabelChange:R},null,8,["batchImages","labels"])])]))],512))}}),[["__scopeId","data-v-5bb1d03b"]]);D.BatchAnnotator=ot,D.ImageAnnotator=nt,D.default=ot,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(D,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(D=typeof globalThis<"u"?globalThis:D||self,t(D.VueImageAnnotator={},D.Vue))})(this,(function(D,t){"use strict";var Dn=Object.defineProperty;var Tn=(D,t,H)=>t in D?Dn(D,t,{enumerable:!0,configurable:!0,writable:!0,value:H}):D[t]=H;var B=(D,t,H)=>Tn(D,typeof t!="symbol"?t+"":t,H);const H=(v,e)=>Math.sqrt(Math.pow(v.x-e.x,2)+Math.pow(v.y-e.y,2)),ht=(v,e)=>{let i=!1;for(let n=0,l=e.length-1;n<e.length;l=n++){const a=e[n].x,r=e[n].y,g=e[l].x,m=e[l].y;r>v.y!=m>v.y&&v.x<(g-a)*(v.y-r)/(m-r)+a&&(i=!i)}return i},et=(v,e,i)=>{const n=i*(Math.PI/180),l=Math.cos(n),a=Math.sin(n),r=v.x-e.x,g=v.y-e.y;return{x:e.x+(r*l-g*a),y:e.y+(r*a+g*l)}};class dt{constructor(e){B(this,"canvas");B(this,"ctx");B(this,"img");B(this,"annotations",[]);B(this,"currentTool",null);B(this,"interactionMode","none");B(this,"activeAnnotation",null);B(this,"hoverAnnotation",null);B(this,"isDrawing",!1);B(this,"isDragging",!1);B(this,"isPanning",!1);B(this,"panStartPoint",null);B(this,"dragStartPoint",null);B(this,"dragStartAnnotation",null);B(this,"lastMouseMovePoint",null);B(this,"isHoveringStartPoint",!1);B(this,"currentLabelColor","#FF4081");B(this,"visibleLabels",new Set);B(this,"selectedHandleIndex",-1);B(this,"hoverHandleIndex",-1);B(this,"scale",1);B(this,"offset",{x:0,y:0});B(this,"listeners",{});B(this,"imageUrl","");this.canvas=e;const i=e.getContext("2d");if(!i)throw new Error("Could not get 2d context");this.ctx=i,this.img=new Image,this.img.crossOrigin="Anonymous",this.img.onload=()=>{this.fitImageToCanvas(),this.render()},this.bindEvents()}on(e,i){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(i)}emit(e,i){this.listeners[e]&&this.listeners[e].forEach(n=>n(i))}loadImage(e){this.imageUrl=e,this.img.src=e,this.activeAnnotation=null,this.isDrawing=!1}setAnnotations(e){this.annotations=JSON.parse(JSON.stringify(e)),this.render()}getAnnotations(){return this.annotations}setTool(e){e==="pan"?(this.interactionMode="pan",this.currentTool=null,this.isPanning=!1,this.canvas.style.cursor="grab"):e==="select"?(this.interactionMode="select",this.currentTool=null,this.canvas.style.cursor="default"):e?(this.interactionMode="draw",this.currentTool=e,this.canvas.style.cursor="crosshair"):(this.interactionMode="none",this.currentTool=null,this.canvas.style.cursor="default"),this.activeAnnotation=null,this.isDrawing=!1,this.render()}setLabelStyle(e){this.currentLabelColor=e}setVisibleLabels(e){this.visibleLabels=new Set(e),this.render()}zoom(e){const n=e>0?this.scale*1.1:this.scale/1.1;if(n<.1||n>10)return;const l=this.canvas.width/2,a=this.canvas.height/2,r=this.toImageCoords(l,a);this.scale=n,this.offset.x=l-r.x*this.scale,this.offset.y=a-r.y*this.scale,this.clampViewportOffset(),this.render()}resize(){this.fitImageToCanvas(),this.render()}toImageCoords(e,i){return{x:(e-this.offset.x)/this.scale,y:(i-this.offset.y)/this.scale}}toScreenCoords(e,i){return{x:e*this.scale+this.offset.x,y:i*this.scale+this.offset.y}}fitImageToCanvas(){const e=this.canvas.parentElement;if(e){if(this.canvas.width=e.clientWidth,this.canvas.height=e.clientHeight,this.img.width===0)return;const i=this.canvas.width/this.img.width,n=this.canvas.height/this.img.height;this.scale=Math.min(i,n),this.offset.x=(this.canvas.width-this.img.width*this.scale)/2,this.offset.y=(this.canvas.height-this.img.height*this.scale)/2,this.clampViewportOffset()}}clampViewportOffset(){if(this.img.width===0||this.img.height===0)return;const e=this.img.width*this.scale,i=this.img.height*this.scale,n=100;if(e<=this.canvas.width){const l=-e+n,a=this.canvas.width-n;this.offset.x=Math.min(a,Math.max(l,this.offset.x))}else{const l=this.canvas.width-e-n,a=n;this.offset.x=Math.min(a,Math.max(l,this.offset.x))}if(i<=this.canvas.height){const l=-i+n,a=this.canvas.height-n;this.offset.y=Math.min(a,Math.max(l,this.offset.y))}else{const l=this.canvas.height-i-n,a=n;this.offset.y=Math.min(a,Math.max(l,this.offset.y))}}bindEvents(){this.canvas.addEventListener("mousedown",this.handleMouseDown.bind(this)),this.canvas.addEventListener("mousemove",this.handleMouseMove.bind(this)),this.canvas.addEventListener("mouseup",this.handleMouseUp.bind(this)),this.canvas.addEventListener("mouseleave",this.handleMouseUp.bind(this)),window.addEventListener("keydown",this.handleKeyDown.bind(this))}handleKeyDown(e){this.interactionMode==="select"&&(e.key==="Delete"||e.key==="Backspace")&&this.activeAnnotation&&this.deleteAnnotation(this.activeAnnotation.id)}deleteAnnotation(e){const i=this.annotations.findIndex(n=>n.id===e);if(i>-1){const n=this.annotations[i];this.annotations.splice(i,1),this.activeAnnotation=null,this.emit("annotationChange",{action:"delete",changedItem:n,imageUrl:this.imageUrl}),this.render()}}handleMouseDown(e){const i=this.canvas.getBoundingClientRect(),n=e.clientX-i.left,l=e.clientY-i.top,a=this.toImageCoords(n,l);if(this.interactionMode==="pan"){this.isPanning=!0,this.panStartPoint={x:n,y:l},this.canvas.style.cursor="grabbing";return}if(this.interactionMode==="select"&&this.activeAnnotation){const m=this.getHitHandle(n,l,this.activeAnnotation);if(m!==-100){this.isDragging=!0,this.dragStartPoint=a,this.selectedHandleIndex=m,this.dragStartAnnotation=JSON.parse(JSON.stringify(this.activeAnnotation));return}}const r=this.interactionMode==="select"?this.getHitCategory(n,l):null;if(r){this.activeAnnotation=r,this.isDragging=!1,this.selectedHandleIndex=-1,this.emit("annotationChange",{action:"select",changedItem:r,imageUrl:this.imageUrl}),this.render();return}const g=this.getHitAnnotation(a);if(this.interactionMode==="select"){if(g){if(!(this.visibleLabels.size>0&&!this.visibleLabels.has(g.label))){this.activeAnnotation=g,this.isDragging=!0,this.dragStartPoint=a,this.selectedHandleIndex=-1,this.dragStartAnnotation=JSON.parse(JSON.stringify(g)),this.emit("annotationChange",{action:"select",changedItem:g,imageUrl:this.imageUrl}),this.render();return}}else this.activeAnnotation=null,this.emit("annotationChange",{action:"select",changedItem:void 0,imageUrl:this.imageUrl}),this.render();return}if(this.interactionMode==="draw"){if(this.isDrawing&&this.currentTool==="polygon"&&this.activeAnnotation){const m=this.activeAnnotation.coordinates;if(m.points.length>2&&H(a,m.points[0])<20/this.scale){this.finishDrawing();return}this.startDrawing(a);return}if(this.currentTool){if(this.currentTool==="polygon"&&!this.isDrawing){this.startDrawing(a);return}this.startDrawing(a)}return}this.activeAnnotation=null,this.render()}handleMouseMove(e){const i=this.canvas.getBoundingClientRect(),n=e.clientX-i.left,l=e.clientY-i.top,a=this.toImageCoords(n,l);if(this.isPanning&&this.panStartPoint){const r=n-this.panStartPoint.x,g=l-this.panStartPoint.y;this.offset.x+=r,this.offset.y+=g,this.clampViewportOffset(),this.panStartPoint={x:n,y:l},this.render();return}if(this.lastMouseMovePoint=a,this.isDrawing){if(this.currentTool==="polygon"&&this.activeAnnotation){const r=this.activeAnnotation.coordinates;if(r.points.length>2){const g=r.points[0],m=H(a,g);this.isHoveringStartPoint=m<20/this.scale}else this.isHoveringStartPoint=!1}this.updateDrawing(a)}else this.isDragging&&this.activeAnnotation&&this.dragStartPoint?this.updateDragging(a):this.checkHover(n,l,a);this.render()}handleMouseUp(e){if(this.isPanning){this.isPanning=!1,this.panStartPoint=null,this.canvas.style.cursor="grab";return}if(this.isDrawing){if(this.currentTool==="polygon"){this.render();return}this.finishDrawing()}else this.isDragging&&this.activeAnnotation&&this.emit("annotationChange",{action:"update",changedItem:this.activeAnnotation,imageUrl:this.imageUrl});this.currentTool!=="polygon"&&(this.isDrawing=!1),this.isDragging=!1,this.dragStartPoint=null,this.selectedHandleIndex=-1,this.render()}hexToRgba(e,i){if(!e.startsWith("#"))return e;const n=parseInt(e.slice(1,3),16),l=parseInt(e.slice(3,5),16),a=parseInt(e.slice(5,7),16);return`rgba(${n}, ${l}, ${a}, ${i})`}startDrawing(e){if(!this.currentTool)return;const i=Date.now().toString();if(this.hexToRgba(this.currentLabelColor,.2),this.currentLabelColor,this.currentTool==="rectangle")this.isDrawing=!0,this.dragStartPoint=e,this.activeAnnotation={id:i,type:"rectangle",label:"",coordinates:{x1:e.x,y1:e.y,x2:e.x,y2:e.y},style:{strokeColor:this.currentLabelColor}};else if(this.currentTool==="point"){const n={id:i,type:"point",label:"",coordinates:{points:[e]},style:{strokeColor:this.currentLabelColor}};this.annotations.push(n),this.emit("annotationChange",{action:"add",changedItem:n,imageUrl:this.imageUrl}),this.activeAnnotation=n}else if(this.currentTool==="polygon")this.activeAnnotation&&this.activeAnnotation.type==="polygon"&&this.isDrawing?this.activeAnnotation.coordinates.points.push(e):(this.isDrawing=!0,this.activeAnnotation={id:i,type:"polygon",label:"",coordinates:{points:[e]},style:{strokeColor:this.currentLabelColor}});else if(this.currentTool==="category"){const n={id:i,type:"category",label:"",coordinates:{x:e.x,y:e.y},style:{strokeColor:this.currentLabelColor}};this.annotations.push(n),this.emit("annotationChange",{action:"add",changedItem:n,imageUrl:this.imageUrl}),this.activeAnnotation=n}else this.currentTool==="rotatedRect"&&(this.isDrawing=!0,this.dragStartPoint=e,this.activeAnnotation={id:i,type:"rotatedRect",label:"",coordinates:{x:e.x,y:e.y,width:0,height:0,angle:0},style:{strokeColor:this.currentLabelColor}})}updateDrawing(e){if(this.activeAnnotation)if(this.activeAnnotation.type==="rectangle"&&this.dragStartPoint){const i=this.activeAnnotation.coordinates;i.x2=e.x,i.y2=e.y}else if(this.activeAnnotation.type==="rotatedRect"&&this.dragStartPoint){const i=this.activeAnnotation.coordinates,n=Math.abs(e.x-this.dragStartPoint.x),l=Math.abs(e.y-this.dragStartPoint.y);i.width=n*2,i.height=l*2}else this.activeAnnotation.type}finishDrawing(){if(this.activeAnnotation){if(this.activeAnnotation.type==="rectangle"){const e=this.activeAnnotation.coordinates;if(Math.abs(e.x1-e.x2)<2||Math.abs(e.y1-e.y2)<2){this.activeAnnotation=null,this.isDrawing=!1;return}const i=Math.min(e.x1,e.x2),n=Math.max(e.x1,e.x2),l=Math.min(e.y1,e.y2),a=Math.max(e.y1,e.y2);e.x1=i,e.x2=n,e.y1=l,e.y2=a,this.annotations.push(this.activeAnnotation),this.emit("annotationChange",{action:"add",changedItem:this.activeAnnotation,imageUrl:this.imageUrl})}else if(this.activeAnnotation.type==="polygon"){if(this.activeAnnotation.coordinates.points.length<3){this.activeAnnotation=null,this.isDrawing=!1;return}this.annotations.push(this.activeAnnotation),this.emit("annotationChange",{action:"add",changedItem:this.activeAnnotation,imageUrl:this.imageUrl})}else if(this.activeAnnotation.type==="rotatedRect"){const e=this.activeAnnotation.coordinates;if(e.width<2||e.height<2){this.activeAnnotation=null,this.isDrawing=!1;return}this.annotations.push(this.activeAnnotation),this.emit("annotationChange",{action:"add",changedItem:this.activeAnnotation,imageUrl:this.imageUrl})}this.activeAnnotation.type}this.isDrawing=!1}updateDragging(e){if(!this.activeAnnotation||!this.dragStartPoint||!this.dragStartAnnotation)return;const i=e.x-this.dragStartPoint.x,n=e.y-this.dragStartPoint.y;this.selectedHandleIndex===-1?this.moveAnnotation(this.activeAnnotation,this.dragStartAnnotation,i,n):this.resizeAnnotation(this.activeAnnotation,this.dragStartAnnotation,this.selectedHandleIndex,e)}moveAnnotation(e,i,n,l){if(e.type==="rectangle"){const a=i.coordinates,r=e.coordinates;r.x1=a.x1+n,r.x2=a.x2+n,r.y1=a.y1+l,r.y2=a.y2+l}else if(e.type==="point"){const a=i.coordinates,r=e.coordinates;r.points=a.points.map(g=>({x:g.x+n,y:g.y+l}))}else if(e.type==="rotatedRect"){const a=i.coordinates,r=e.coordinates;r.x=a.x+n,r.y=a.y+l}else if(e.type==="polygon"){const a=i.coordinates,r=e.coordinates;r.points=a.points.map(g=>({x:g.x+n,y:g.y+l}))}else if(e.type==="category"){const a=i.coordinates,r=e.coordinates;a&&r&&(r.x=a.x+n,r.y=a.y+l)}}resizeAnnotation(e,i,n,l){if(e.type==="rectangle"){const a=e.coordinates;n===0&&(a.x1=l.x,a.y1=l.y),n===1&&(a.x2=l.x,a.y1=l.y),n===2&&(a.x2=l.x,a.y2=l.y),n===3&&(a.x1=l.x,a.y2=l.y)}else if(e.type==="polygon"){const a=e.coordinates;n>=0&&n<a.points.length&&(a.points[n]=l)}else if(e.type==="point"){const a=e.coordinates;n>=0&&n<a.points.length&&(a.points[n]=l)}else if(e.type==="rotatedRect"){const a=e.coordinates;if(n===-2){const r=a.x,g=a.y,m=l.x-r,h=l.y-g;let k=Math.atan2(h,m)*180/Math.PI;k+=90,a.angle=k}else{const r=a.angle*Math.PI/180,g=Math.cos(-r),m=Math.sin(-r),h=l.x-a.x,k=l.y-a.y,u=h*g-k*m,S=h*m+k*g;(n===0||n===3)&&(a.width/2,a.width=Math.abs(u)*2),(n===1||n===2)&&(a.width=Math.abs(u)*2),(n===0||n===1)&&(a.height=Math.abs(S)*2),(n===2||n===3)&&(a.height=Math.abs(S)*2)}}}getHitAnnotation(e){for(let i=this.annotations.length-1;i>=0;i--){const n=this.annotations[i];if(this.isPointInAnnotation(e,n))return n}return null}isPointInAnnotation(e,i){if(i.type==="rectangle"){const n=i.coordinates;return e.x>=n.x1&&e.x<=n.x2&&e.y>=n.y1&&e.y<=n.y2}else if(i.type==="polygon"){const n=i.coordinates;return ht(e,n.points)}else if(i.type==="rotatedRect"){const n=i.coordinates,l=et(e,{x:n.x,y:n.y},-n.angle),a=n.width/2,r=n.height/2;return l.x>=n.x-a&&l.x<=n.x+a&&l.y>=n.y-r&&l.y<=n.y+r}else if(i.type==="point")return i.coordinates.points.some(l=>H(e,l)<10/this.scale);return!1}getHitHandle(e,i,n){const l=this.getAnnotationHandles(n),a=6;for(let r=0;r<l.length;r++){const g=l[r],m=this.toScreenCoords(g.x,g.y);if(Math.abs(e-m.x)<a&&Math.abs(i-m.y)<a)return n.type==="rotatedRect"&&r===4?-2:r}return-100}getAnnotationHandles(e){if(e.type==="rectangle"){const i=e.coordinates;return[{x:i.x1,y:i.y1},{x:i.x2,y:i.y1},{x:i.x2,y:i.y2},{x:i.x1,y:i.y2}]}else{if(e.type==="polygon")return e.coordinates.points;if(e.type==="point")return e.coordinates.points;if(e.type==="rotatedRect"){const i=e.coordinates,n={x:i.x,y:i.y},l=i.width/2,a=i.height/2,r={x:i.x-l,y:i.y-a},g={x:i.x+l,y:i.y-a},m={x:i.x+l,y:i.y+a},h={x:i.x-l,y:i.y+a},k={x:i.x,y:i.y-a-20/this.scale};return[r,g,m,h,k].map(u=>et(u,n,i.angle))}}return[]}checkHover(e,i,n){const l=this.getHitCategory(e,i);if(l){this.canvas.style.cursor="pointer",this.hoverAnnotation=l;return}if(this.activeAnnotation&&this.getHitHandle(e,i,this.activeAnnotation)!==-100){this.canvas.style.cursor="pointer";return}const a=this.getHitAnnotation(n);a?(this.canvas.style.cursor="move",this.hoverAnnotation=a):(this.canvas.style.cursor="default",this.hoverAnnotation=null)}render(){if(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),!this.img.complete||this.img.width===0){this.ctx.save(),this.ctx.fillStyle="#999",this.ctx.font="14px sans-serif",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText("Loading image...",this.canvas.width/2,this.canvas.height/2),this.ctx.restore();return}this.ctx.drawImage(this.img,this.offset.x,this.offset.y,this.img.width*this.scale,this.img.height*this.scale),this.annotations.forEach(e=>{e!==this.activeAnnotation&&this.drawItem(e,!1)}),this.activeAnnotation&&this.drawItem(this.activeAnnotation,!0),this.renderCategories()}renderCategories(){const e=this.annotations.filter(n=>n.type==="category");if(e.length===0)return;this.ctx.save(),this.ctx.font="14px sans-serif",this.ctx.textBaseline="middle",this.ctx.textAlign="center";const i=12;e.forEach(n=>{var b;const l=n.label||"未命名分类",a=this.ctx.measureText(l).width+i*2,r=28,g=this.activeAnnotation===n,m=this.hoverAnnotation===n;let h={x:20,y:20};n.coordinates&&typeof n.coordinates.x=="number"&&typeof n.coordinates.y=="number"&&(h=this.toScreenCoords(n.coordinates.x,n.coordinates.y));const k=h.x-a/2,u=h.y-r/2,S=((b=n.style)==null?void 0:b.strokeColor)||"#2196F3";this.ctx.fillStyle=g?S:this.hexToRgba(S,.85),m&&!g&&(this.ctx.fillStyle=S),g?(this.ctx.strokeStyle="#ffffff",this.ctx.lineWidth=2):(this.ctx.strokeStyle="transparent",this.ctx.lineWidth=0),this.ctx.beginPath(),this.ctx.roundRect(k,u,a,r,6),this.ctx.fill(),g&&(this.ctx.stroke(),this.ctx.save(),this.ctx.strokeStyle=S,this.ctx.lineWidth=2,this.ctx.strokeRect(k-3,u-3,a+6,r+6),this.ctx.restore()),this.ctx.fillStyle="#ffffff",this.ctx.fillText(l,h.x,h.y)}),this.ctx.restore()}getHitCategory(e,i){const n=this.annotations.filter(g=>g.type==="category");if(n.length===0)return null;this.ctx.save(),this.ctx.font="14px sans-serif";const l=12,a=28;let r=null;for(let g=n.length-1;g>=0;g--){const m=n[g],h=m.label||"未命名分类",k=this.ctx.measureText(h).width+l*2;let u={x:20,y:20};m.coordinates&&typeof m.coordinates.x=="number"&&typeof m.coordinates.y=="number"&&(u=this.toScreenCoords(m.coordinates.x,m.coordinates.y));const S=u.x-k/2,b=u.y-a/2;if(e>=S&&e<=S+k&&i>=b&&i<=b+a){r=m;break}}return this.ctx.restore(),r}drawItem(e,i){var a;if(this.visibleLabels.size>0&&!this.visibleLabels.has(e.label)&&!i)return;this.ctx.save();const n=((a=e.style)==null?void 0:a.strokeColor)||"#FF4081",l=i?"#00E5FF":n;if(this.ctx.strokeStyle=l,this.ctx.lineWidth=2,e.type==="rectangle"){const r=e.coordinates,g=this.toScreenCoords(r.x1,r.y1),m=this.toScreenCoords(r.x2,r.y2),h=Math.min(g.x,m.x),k=Math.min(g.y,m.y),u=Math.abs(g.x-m.x),S=Math.abs(g.y-m.y);this.ctx.strokeRect(h,k,u,S),i&&this.drawHandles(this.getAnnotationHandles(e))}else if(e.type==="polygon"){const r=e.coordinates;if(r.points.length===0){this.ctx.restore();return}this.ctx.beginPath();const g=this.toScreenCoords(r.points[0].x,r.points[0].y);this.ctx.moveTo(g.x,g.y);for(let m=1;m<r.points.length;m++){const h=this.toScreenCoords(r.points[m].x,r.points[m].y);this.ctx.lineTo(h.x,h.y)}if(!this.isDrawing||e!==this.activeAnnotation)this.ctx.closePath();else if(this.lastMouseMovePoint){let m=this.lastMouseMovePoint;if(this.isHoveringStartPoint&&r.points.length>0){m=r.points[0];const k=this.toScreenCoords(r.points[0].x,r.points[0].y);this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(k.x,k.y,10,0,Math.PI*2),this.ctx.fillStyle="rgba(255, 215, 0, 0.6)",this.ctx.strokeStyle="#FFFFFF",this.ctx.lineWidth=2,this.ctx.fill(),this.ctx.stroke(),this.ctx.restore()}const h=this.toScreenCoords(m.x,m.y);this.ctx.lineTo(h.x,h.y)}this.ctx.stroke(),i&&this.drawHandles(this.getAnnotationHandles(e))}else if(e.type==="rotatedRect"){const r=e.coordinates;this.ctx.translate(this.toScreenCoords(r.x,r.y).x,this.toScreenCoords(r.x,r.y).y),this.ctx.rotate(r.angle*Math.PI/180);const g=r.width*this.scale,m=r.height*this.scale;this.ctx.strokeRect(-g/2,-m/2,g,m),this.ctx.rotate(-r.angle*Math.PI/180),this.ctx.translate(-this.toScreenCoords(r.x,r.y).x,-this.toScreenCoords(r.x,r.y).y),i&&this.drawHandles(this.getAnnotationHandles(e))}else e.type==="point"&&e.coordinates.points.forEach(g=>{const m=this.toScreenCoords(g.x,g.y);this.ctx.beginPath(),this.ctx.arc(m.x,m.y,5,0,Math.PI*2),this.ctx.fillStyle=i?"#00E5FF":n,this.ctx.fill(),this.ctx.stroke()});this.ctx.restore()}drawHandles(e){this.ctx.fillStyle="#FFFFFF",this.ctx.strokeStyle="#000000",this.ctx.lineWidth=1,e.forEach(i=>{const n=this.toScreenCoords(i.x,i.y);this.ctx.fillRect(n.x-4,n.y-4,8,8),this.ctx.strokeRect(n.x-4,n.y-4,8,8)})}}const gt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032114659" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21132" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 391.68c-66.56 0-120.32 54.187-120.32 120.32 0 66.56 53.76 120.32 120.32 120.32 66.133 0 120.32-53.76 120.32-120.32A120.747 120.747 0 0 0 512 391.68z" p-id="21133" fill="#515151"></path><path d="M512 113.493c-219.733 0-398.507 178.774-398.507 398.507S292.267 910.507 512 910.507 910.507 731.733 910.507 512 731.733 113.493 512 113.493z m0 720.214c-177.493 0-321.707-144.214-321.707-321.707S334.507 190.293 512 190.293 833.707 334.507 833.707 512 689.493 833.707 512 833.707z" p-id="21134" fill="#515151"></path></svg>',mt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M15.7 4.3c.4.4.4 1 0 1.4L9.4 12l6.3 6.3c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-7-7c-.4-.4-.4-1 0-1.4l7-7c.4-.4 1-.4 1.4 0z"/></svg>',ft='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032015085" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16560" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M911.872 972.629333l-2.645333-1.621333-209.92-208.554667-91.306667 193.194667-147.029333-494.933333 486.4 179.968-177.834667 68.266666 201.472 200.362667a9.898667 9.898667 0 0 1 2.133333 4.608 10.069333 10.069333 0 0 1-1.024 4.778667l-2.389333 3.157333-47.786667 47.530667a9.813333 9.813333 0 0 1-4.522666 2.901333 12.544 12.544 0 0 1-2.56 0z m-657.066667-12.970666L0.256 501.248l97.109333-175.445333 64.256-115.456L254.805333 42.581333h510.208l259.328 466.858667h-100.608L714.325333 132.778667H305.322667l-204.8 368.384 204.8 368.725333H418.133333v90.026667z" fill="#515151" p-id="16561"></path></svg>',pt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032973956" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6763" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M613.6 960H97.2c-17.7 0-32-14.3-32-32V98.5c0-17.7 14.3-32 32-32h829.5c17.7 0 32 14.3 32 32v518.2c0 17.7-14.3 32-32 32s-32-14.3-32-32V130.5H129.2V896h484.4c17.7 0 32 14.3 32 32s-14.3 32-32 32z" fill="#515151" p-id="6764"></path><path d="M711.3 694.9l120.3 46.9-100.7 80.7z" fill="#515151" p-id="6765"></path><path d="M707.6 882.1L671.3 645l223.6 87.1-187.3 150z m43.7-137.3l2.8 18 14.2-11.4-17-6.6z" fill="#515151" p-id="6766"></path><path d="M927 957.9c-8.2 0-16.4-3.1-22.6-9.4L723.2 767.2c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l181.2 181.2c12.5 12.5 12.5 32.8 0 45.3-6.3 6.3-14.5 9.5-22.7 9.5z" fill="#515151" p-id="6767"></path></svg>',yt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M19 6h-4V5c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v1H5c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1zM10 5h4v1h-4V5z"/><path fill="currentColor" d="M6 9v10c0 1.7 1.3 3 3 3h6c1.7 0 3-1.3 3-3V9H6zm4 9c0 .6-.4 1-1 1s-1-.4-1-1v-5c0-.6.4-1 1-1s1 .4 1 1v5zm4 0c0 .6-.4 1-1 1s-1-.4-1-1v-5c0-.6.4-1 1-1s1 .4 1 1v5z"/></svg>',ut='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M19 15v4c0 1.1-.9 2-2 2H7c-1.1 0-2-.9-2-2v-4c0-.6.4-1 1-1s1 .4 1 1v4h10v-4c0-.6.4-1 1-1s1 .4 1 1zm-7.7 1.3c.2.2.4.3.7.3s.5-.1.7-.3l4.6-4.6c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0l-2.9 2.9V3c0-.6-.4-1-1-1s-1 .4-1 1v8.3l-2.9-2.9c-.4-.4-1-.4-1.4 0-.4.4-.4 1 0 1.4l4.6 4.6z"/></svg>',xt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M3 17.2v4.3c0 .3.2.5.5.5h4.3c.1 0 .3-.1.4-.2l11.1-11.1-5.1-5.1L3.1 16.8c-.1.1-.1.3-.1.4zm18.8-10.9c.4-.4.4-1 0-1.4l-3.7-3.7c-.4-.4-1-.4-1.4 0l-2.3 2.3 5.1 5.1 2.3-2.3z"/></svg>',vt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M18.7 4.3c.4.4.4 1 0 1.4L12.4 12l6.3 6.3c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-7-7c-.4-.4-.4-1 0-1.4l7-7c.4-.4 1-.4 1.4 0z"/><path fill="currentColor" d="M10.7 4.3c.4.4.4 1 0 1.4L4.4 12l6.3 6.3c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-7-7c-.4-.4-.4-1 0-1.4l7-7c.4-.4 1-.4 1.4 0z"/></svg>',wt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032412624" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3527" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M870.2976 144.0256l51.2 51.2-122.88 122.88a514.304 514.304 0 0 1 170.7264 193.8688C885.0432 679.04 711.8848 793.6 512 793.6c-56.832 0-111.488-9.2672-162.56-26.3424L197.4016 919.296l-51.2-51.2L870.2976 144.0256z m-127.1552 229.5296l-76.6208 76.6208a166.4 166.4 0 0 1-216.32 216.3712l-38.6048 38.5792c29.5168 6.9632 60.032 10.9312 91.1872 11.5712L512 716.8c150.6816 0 287.488-77.2096 366.464-200.3456l2.816-4.48-2.816-4.48a435.8144 435.8144 0 0 0-135.3216-133.9392zM512 230.4c49.664 0 97.664 7.0656 143.0528 20.2496l-63.8208 63.7696a436.4032 436.4032 0 0 0-70.016-7.1168L512 307.2a434.8928 434.8928 0 0 0-366.464 200.3456l-2.816 4.48 2.816 4.48a435.84 435.84 0 0 0 119.8848 123.776l-55.0912 55.04a514.2528 514.2528 0 0 1-155.648-183.296C138.9312 344.96 312.0896 230.4 512 230.4z m89.5488 284.8l-86.3744 86.2976 1.7408-0.0256a89.6 89.6 0 0 0 84.6336-86.272zM512 345.6a166.656 166.656 0 0 1 42.5728 5.504l-79.0272 79.0272a89.9328 89.9328 0 0 0-45.4144 45.4144l-79.0272 79.0272A166.4 166.4 0 0 1 512 345.6z" p-id="3528" fill="#515151"></path></svg>',bt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M5.3 19.7c-.4-.4-.4-1 0-1.4l6.3-6.3-6.3-6.3c-.4-.4-.4-1 0-1.4.4-.4 1-.4 1.4 0l7 7c.4.4.4 1 0 1.4l-7 7c-.4.4-1 .4-1.4 0z"/><path fill="currentColor" d="M13.3 19.7c-.4-.4-.4-1 0-1.4l6.3-6.3-6.3-6.3c-.4-.4-.4-1 0-1.4.4-.4 1-.4 1.4 0l7 7c.4.4.4 1 0 1.4l-7 7c-.4.4-1 .4-1.4 0z"/></svg>',kt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775031871732" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12257" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M174.63 78.98c0.03-12.61 16.41-19.91 25.81-11.5l328.72 293.98 318.27 284.63c10.51 9.4 0.4 26.75-14.25 24.46L435.7 608.43c-6.23-0.97-12.72 1.92-16.16 7.2L199.96 952.72c-8.09 12.42-27.76 8.34-27.72-5.76l1.17-426.97 1.22-441.01z" fill="#515151" p-id="12258"></path></svg>',Ct='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032210611" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="23146" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M543.487882 0.00128a161.919393 161.919393 0 0 0-114.55957 47.359822L47.553742 428.991671a162.111392 162.111392 0 0 0 0 229.119141l318.270806 318.398806a161.983393 161.983393 0 0 0 229.119141 0l381.630569-381.694569A162.111392 162.111392 0 0 0 1023.99808 480.255479V161.920673A161.919393 161.919393 0 0 0 861.886688 0.00128H543.487882z m0 90.55966l318.462806 0.064a71.295733 71.295733 0 0 1 71.487732 71.295733v318.270806c0 18.943929-7.615971 37.119861-21.055921 50.559811l-381.56657 381.758568a71.423732 71.423732 0 0 1-101.055621 0L111.489502 594.111052a71.487732 71.487732 0 0 1 0-101.119621l381.566569-381.566569c13.37595-13.37595 31.551882-20.863922 50.431811-20.863922z m112.447578 124.159535a153.023426 153.023426 0 1 0 0 306.046852 153.023426 153.023426 0 0 0 0-306.046852z m57.727784 129.151515a62.463766 62.463766 0 1 1-115.455567 47.807821 62.463766 62.463766 0 0 1 115.455567-47.807821z" p-id="23147" fill="#515151"></path></svg>',_t='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775096284335" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4580" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M308.377435 102.251961C318.982967 47.176334 372.449479 0 448.66303 0c39.496466 0 68.314257 20.040799 85.063685 46.07921 11.995223 18.577967 17.919693 39.935315 20.040799 60.341823 13.384913-4.388496 27.35496-6.582744 41.398147-6.655886 38.911333 0 68.021691 19.455666 85.72196 44.616378 16.822569 23.990446 23.551596 53.100804 23.551596 79.724347v29.988058c0.146283 98.960589 0.292566 197.921178 0.658274 296.954909-0.073142 13.165489 1.097124 26.47726 3.510797 39.569608 8.484426-7.533585 16.237436-15.213453 24.795004-23.69788l13.165488-13.019205c13.970046-13.604338 30.353765-28.598367 49.809432-41.178723 42.056422-27.208676 93.694394-39.642749 162.813209-22.600755 27.574384 6.802169 44.982086 25.380136 54.344211 44.543236 8.776992 18.285401 11.117524 38.545625 10.386108 56.392176-1.38969 33.864562-14.920887 75.26271-43.738679 101.447404l-1.755398 1.755398c-37.375359 36.424518-75.335851 72.263904-113.881477 107.518157-31.450889 28.964075-63.486912 57.050451-96.327491 84.478552-29.037217 24.063587-58.293858 46.51806-80.967755 58.952132A491.511574 491.511574 0 0 1 421.527495 1023.982446a45.567219 45.567219 0 0 1-46.810626-44.25067c0-24.795004 20.699074-44.835803 46.225493-44.762661a395.403507 395.403507 0 0 0 215.036314-64.072045 49.955715 49.955715 0 0 1 4.022788-2.340531c13.458055-7.167877 37.009651-24.502437 67.363417-49.590007 31.597173-26.47726 62.609212-53.612795 92.889836-81.552888a5027.973235 5027.973235 0 0 0 111.687228-105.470192l1.755399-1.755398 0.585133-0.511991 1.682257-1.535974a42.056422 42.056422 0 0 0 9.362125-15.140312c3.291372-8.118718 5.119912-16.749427 5.631903-25.453278a46.07921 46.07921 0 0 0-1.023982-12.580356c-39.715891-8.557568-62.536071-0.658274-81.479746 11.556374a234.126272 234.126272 0 0 0-35.473678 29.841774l-10.386108 10.239824c-9.800975 9.654692-20.845357 20.699074-31.96288 30.500049l-0.146283 0.146283c-19.016817 16.603144-42.787838 31.597173-70.435364 32.182306a74.897002 74.897002 0 0 1-65.096027-35.54682 141.602144 141.602144 0 0 1-18.870534-51.930538 302.074822 302.074822 0 0 1-4.169071-50.613989c-0.365708-99.033731-0.511991-198.213745-0.511992-297.247476v-29.988058c0-13.311772-3.65708-24.136729-7.826151-30.13434a13.896905 13.896905 0 0 0-4.388496-4.388496 7.679868 7.679868 0 0 0-4.022789-0.804558 46.956909 46.956909 0 0 0-28.232658 10.532391 30.719473 30.719473 0 0 0-12.214648 24.721862v232.736582a45.567219 45.567219 0 0 1-46.591201 44.543236 45.567219 45.567219 0 0 1-46.51806-44.616378V124.340726c0-14.628321-3.364514-25.745844-7.094736-31.45089a10.093541 10.093541 0 0 0-2.925664-3.364514 1.901682 1.901682 0 0 0-0.511991-0.292566 9.435267 9.435267 0 0 0-2.340531-0.146283c-38.618767 0-49.443724 23.697879-49.078016 33.791421v1.682256l-0.292567 77.822666v3.876505l-1.023982 253.508797a45.567219 45.567219 0 0 1-46.810626 44.323812 45.567219 45.567219 0 0 1-46.298635-44.68952l1.023983-250.656274a32.036022 32.036022 0 0 0-7.75301-15.140312c-1.82854-1.682257-5.851328-4.827346-17.188277-4.827346a41.178723 41.178723 0 0 0-26.477261 9.069559c-5.558762 4.754204-10.678674 12.580356-10.678674 26.257835v296.589202a45.567219 45.567219 0 0 1-46.518059 44.543236 45.567219 45.567219 0 0 1-46.51806-44.616378v-169.688519a31.158323 31.158323 0 0 0-4.607921-5.705045 11.84894 11.84894 0 0 0-5.193054-3.218231c-1.023982-0.292566-4.681063-1.023982-12.653497 1.462832-17.700268 5.705045-26.111552 14.994029-30.792615 27.208676-5.48562 14.189471-6.582744 35.10797-1.097124 61.438947 42.202705 201.139409 64.949744 301.123981 83.162003 350.34828 16.091153 43.372971 47.615184 81.918596 90.915013 109.566122a43.372971 43.372971 0 0 1 12.872922 61.804654 47.834609 47.834609 0 0 1-64.510894 12.28779c-59.171557-37.741067-103.934218-91.500146-127.046965-153.963075C71.179216 755.406479 46.896203 647.449472 5.571197 449.601435-1.889246 414.127758-3.059512 375.216425 10.471685 340.108455 24.734297 302.806238 54.210364 273.330171 99.265591 258.921276c16.603144-5.558762 34.376554-7.460444 51.784255-5.631904v-29.256641c0-81.18718 67.655983-124.340726 130.265196-124.340726 9.435267 0 18.431684 0.877699 27.062393 2.486815z" p-id="4581" fill="#515151"></path></svg>',Et='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775033156525" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3463" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M694.4 960H195.2C131.7 960 80 908.4 80 845.1V462c0-63.4 51.7-114.9 115.2-114.9h499.2c63.5 0 115.2 51.6 115.2 114.9v383.1c0 63.3-51.7 114.9-115.2 114.9zM195.2 423.7c-21.2 0-38.4 17.2-38.4 38.3v383.1c0 21.1 17.2 38.3 38.4 38.3h499.2c21.2 0 38.4-17.2 38.4-38.3V462c0-21.1-17.2-38.3-38.4-38.3H195.2z" fill="#515151" p-id="3464"></path><path d="M905.6 450.3c-14.8 0-28.9-8.6-35.2-23C788.6 240.8 592.7 213 483.2 213c-21.2 0-38.4-17.2-38.4-38.3s17.2-38.3 38.4-38.3c218.2 0 385 94.9 457.6 260.3 8.5 19.4-0.4 42-19.8 50.5-5 2.1-10.3 3.1-15.4 3.1z" fill="#515151" p-id="3465"></path><path d="M473.6 285.4c-9.8 0-19.7-3.7-27.2-11.2l-72.5-72.4c-15-15-15-39.2 0-54.2l72.5-72.4c15-15 39.3-15 54.3 0s15 39.2 0 54.2l-45.4 45.3 45.4 45.3c15 15 15 39.2 0 54.2-7.4 7.4-17.3 11.2-27.1 11.2z" fill="#515151" p-id="3466"></path></svg>',Bt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="currentColor" d="M8.3 19.7c-.4-.4-.4-1 0-1.4l6.3-6.3-6.3-6.3c-.4-.4-.4-1 0-1.4.4-.4 1-.4 1.4 0l7 7c.4.4.4 1 0 1.4l-7 7c-.4.4-1 .4-1.4 0z"/></svg>',St='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032400373" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3314" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 230.4c199.8848 0 373.0176 114.5344 457.344 281.5744C885.0432 679.04 711.8848 793.6 512 793.6c-199.8848 0-373.0176-114.5344-457.344-281.5744C138.9568 344.96 312.1152 230.4 512 230.4z m0 76.8a434.8928 434.8928 0 0 0-366.464 200.3456l-2.816 4.48 2.816 4.48a434.944 434.944 0 0 0 357.248 200.192L512 716.8c150.6816 0 287.488-77.2096 366.464-200.3456l2.816-4.48-2.816-4.48a434.944 434.944 0 0 0-357.248-200.192L512 307.2z m0 38.4a166.4 166.4 0 1 1 0 332.8 166.4 166.4 0 0 1 0-332.8z m0 76.8a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2z" p-id="3315" fill="#515151"></path></svg>',It='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032548251" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4695" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M849.7664 778.1376c1.9968 1.4848 3.84 3.072 5.632 4.864l72.3968 72.3968a51.2 51.2 0 1 1-72.3968 72.3968l-72.3968-72.3968a51.6096 51.6096 0 0 1-4.864-5.632 448 448 0 1 1 71.68-71.68zM460.8 460.8V358.4a51.2 51.2 0 1 1 102.4 0v102.4h102.4a51.2 51.2 0 0 1 0 102.4h-102.4v102.4a51.2 51.2 0 0 1-102.4 0v-102.4H358.4a51.2 51.2 0 0 1 0-102.4h102.4z m38.4 384a345.6 345.6 0 1 0 0-691.2 345.6 345.6 0 0 0 0 691.2z" fill="#515151" p-id="4696"></path></svg>',Vt='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1775032629657" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1933" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M849.7664 778.1376c1.9968 1.4848 3.84 3.072 5.632 4.864l72.3968 72.3968a51.2 51.2 0 1 1-72.3968 72.3968l-72.3968-72.3968a51.6096 51.6096 0 0 1-4.864-5.632 448 448 0 1 1 71.68-71.68zM499.2 844.8a345.6 345.6 0 1 0 0-691.2 345.6 345.6 0 0 0 0 691.2zM358.4 563.2a51.2 51.2 0 0 1 0-102.4h307.2a51.2 51.2 0 0 1 0 102.4H358.4z" fill="#666666" p-id="1934"></path></svg>',At=["innerHTML"],Nt=t.defineComponent({__name:"SvgIcon",props:{name:{},size:{}},setup(v){const e=v,i=t.ref(""),n=Object.assign({"../assets/svg/aim.svg":gt,"../assets/svg/back.svg":mt,"../assets/svg/connection.svg":ft,"../assets/svg/crop.svg":pt,"../assets/svg/delete.svg":yt,"../assets/svg/download.svg":ut,"../assets/svg/edit.svg":xt,"../assets/svg/first.svg":vt,"../assets/svg/hide.svg":wt,"../assets/svg/last.svg":bt,"../assets/svg/pointer.svg":kt,"../assets/svg/price-tag.svg":Ct,"../assets/svg/rank.svg":_t,"../assets/svg/refresh-right.svg":Et,"../assets/svg/right.svg":Bt,"../assets/svg/view.svg":St,"../assets/svg/zoom-in.svg":It,"../assets/svg/zoom-out.svg":Vt});return t.watchEffect(()=>{const l=`../assets/svg/${e.name}.svg`,a=n[l];a?i.value=a:(console.warn(`Icon ${e.name} not found at path ${l}`),i.value="")}),(l,a)=>(t.openBlock(),t.createElementBlock("i",{class:t.normalizeClass(["svg-icon",[v.size?`size-${v.size}`:""]]),innerHTML:i.value},null,10,At))}}),J=(v,e)=>{const i=v.__vccOpts||v;for(const[n,l]of e)i[n]=l;return i},V=J(Nt,[["__scopeId","data-v-3928607b"]]),Dt={key:0,class:"image-list-sidebar"},Tt={class:"image-list-header"},Mt=["onClick"],zt={class:"image-list-stage"},Pt=["src","alt"],Lt={key:0,class:"thumb-overlay-layer"},$t={key:1,class:"thumb-overlay-svg",viewBox:"0 0 100 100",preserveAspectRatio:"none"},Rt=["points"],Ht={class:"image-list-text"},Ut={class:"center-sidebar"},Ft={key:0,class:"left-sidebar"},Ot=["onClick","title"],Wt={key:0,class:"divider"},Gt={class:"center-area"},Yt={key:0,class:"floating-label-selector"},Jt={key:0,class:"current-label"},jt={class:"label-name"},Xt={key:1,class:"current-label empty"},qt={key:0,class:"selector-dropdown"},Kt={key:0,class:"dropdown-empty"},Zt=["onClick"],Qt={class:"label-name"},te={key:0,class:"batch-nav"},ee=["disabled"],ne=["disabled"],oe=["disabled"],se=["disabled"],ie={key:1,class:"right-sidebar"},ae={class:"label-list"},le={class:"label-row"},ce=["onUpdate:modelValue","onChange"],re=["title"],he=["onClick"],de={class:"action-icon more-actions"},ge=["onClick"],me={class:"modal-content"},fe={class:"modal-body"},pe={class:"form-group"},ye={class:"form-group"},ue={class:"color-input-wrapper"},xe={class:"color-value"},ve={class:"modal-actions"},we=["disabled"],nt=J(t.defineComponent({__name:"ImageAnnotator",props:{annotationTypes:{default:()=>["rectangle","polygon","point","rotatedRect","category"]},batchImages:{default:()=>[]},labels:{default:()=>[]},defaultActiveType:{},theme:{default:"light"},readOnly:{type:Boolean,default:!1},image:{},predictionCandidates:{},session:{},requestId:{},minZoom:{},maxZoom:{}},emits:["annotationChange","batchChange","labelChange","ready","error","tool:change","viewport:change","annotation:add","annotation:update","annotation:delete","annotation:select","prediction:loaded","prediction:apply","prediction:reject"],setup(v,{expose:e,emit:i}){const n=v,l=i,a=t.ref(null),r=t.ref(null),g=t.ref(null),m=t.ref([]),h=t.ref(null),k=t.ref(null),u=t.ref(0),S=t.ref(""),b=t.ref([]),A=t.ref(""),U=t.ref(!1),w=t.ref({name:"",color:"#FF0000"}),E=t.ref("none"),p=t.ref([]),N=t.ref({}),M=t.computed(()=>k.value==="select"&&!!S.value),L=t.ref(!1),F=t.computed(()=>b.value.find(o=>o.id===A.value)),st=o=>{o.stopPropagation(),L.value=!L.value},it=o=>{W(o),L.value=!1};t.onMounted(()=>{document.addEventListener("click",o=>{o.target.closest(".floating-label-selector")||(L.value=!1)})});const j=o=>{if(!o||N.value[o])return;const s=new Image;s.onload=()=>{const c=s.naturalWidth||1,d=s.naturalHeight||1;N.value={...N.value,[o]:{width:c,height:d}}},s.src=o},X=()=>{n.batchImages.forEach(o=>{j(o.imageUrl)})},K=(o,s)=>{m.value[s]=o},O=(o=u.value)=>{const s=g.value,c=m.value[o];if(!s||!c)return;const d=s.scrollTop,f=d+s.clientHeight,_=c.offsetTop,I=_+c.offsetHeight;if(_<d){s.scrollTo({top:Math.max(_-8,0),behavior:"smooth"});return}I>f&&s.scrollTo({top:I-s.clientHeight+8,behavior:"smooth"})},R=()=>{var c,d,f,_;const o=n.batchImages[u.value],s=(o==null?void 0:o.imageUrl)||((c=n.image)==null?void 0:c.url);return{eventId:`${Date.now()}-${Math.random().toString(36).slice(2,10)}`,timestamp:Date.now(),requestId:n.requestId,taskId:(d=n.session)==null?void 0:d.taskId,imageId:((f=n.image)==null?void 0:f.id)||s,operator:(_=n.session)==null?void 0:_.userId}},y=o=>{var d;const s=o==null?void 0:o.action;if(!s)return;const c={meta:R(),action:s,current:o==null?void 0:o.changedItem,source:(d=o==null?void 0:o.changedItem)!=null&&d.predictionId?"prediction":"manual"};s==="add"&&l("annotation:add",c),s==="update"&&l("annotation:update",c),s==="delete"&&l("annotation:delete",c),s==="select"&&l("annotation:select",c)},x=t.computed(()=>n.annotationTypes),C=o=>({rectangle:"crop",polygon:"connection",point:"aim",rotatedRect:"refresh-right",category:"price-tag"})[o]||o,z=o=>({rectangle:"矩形框",polygon:"多边形",point:"关键点",rotatedRect:"旋转矩形",category:"分类标签"})[o]||o;t.onMounted(()=>{if(X(),a.value){h.value=new dt(a.value),h.value.on("annotationChange",s=>{var c,d;if(s.action==="add"&&s.changedItem){const f=b.value.find(_=>_.id===A.value);f&&(s.changedItem.label=f.name,s.changedItem.labelId=f.id)}s.action==="select"?S.value=((c=s.changedItem)==null?void 0:c.id)||"":s.action==="delete"&&((d=s.changedItem)==null?void 0:d.id)===S.value&&(S.value=""),l("annotationChange",s),y(s)}),P(),T();const o=new ResizeObserver(()=>{var s;(s=h.value)==null||s.resize()});r.value&&o.observe(r.value),n.defaultActiveType&&$(n.defaultActiveType),t.nextTick(()=>O()),l("ready",{meta:R()})}});const T=()=>{if(!h.value)return;const o=b.value.find(c=>c.id===A.value);o&&h.value.setLabelStyle(o.color);const s=b.value.filter(c=>c.visible).map(c=>c.name);h.value.setVisibleLabels(s)},P=()=>{var o;if(h.value)if(S.value="",requestAnimationFrame(()=>{var s;(s=h.value)==null||s.resize()}),n.batchImages.length>0){const s=n.batchImages[u.value];h.value.loadImage(s.imageUrl),s.annotations?h.value.setAnnotations(s.annotations):h.value.setAnnotations([])}else(o=n.image)!=null&&o.url&&h.value.loadImage(n.image.url)},$=o=>{var s,c;if(k.value=o,S.value="",o!=="pan"&&o!=="select"&&b.value.length===0){alert("请先创建标签!");return}o==="pan"||o==="select"?(s=h.value)==null||s.setTool(o):(c=h.value)==null||c.setTool(o),l("tool:change",{meta:R(),tool:o})},Ze=()=>{var o;(o=h.value)!=null&&o.activeAnnotation&&h.value.deleteAnnotation(h.value.activeAnnotation.id)},at=()=>{h.value&&l("viewport:change",{meta:R(),scale:h.value.scale,offset:{...h.value.offset}})},Qe=()=>{var o;(o=h.value)==null||o.zoom(1),at()},tn=()=>{var o;(o=h.value)==null||o.zoom(-1),at()},en=()=>{w.value={name:"",color:"#2196F3"},U.value=!0},Z=()=>{U.value=!1},nn=()=>{if(!w.value.name.trim()){alert("请输入标签名称");return}const s={id:Date.now().toString(),name:w.value.name,color:w.value.color,visible:!0};b.value.push(s),l("labelChange",b.value),T(),b.value.length===1&&W(s),Z()},W=o=>{var s;A.value=o.id,(s=h.value)==null||s.setLabelStyle(o.color)},on=(o,s)=>{if(!o.startsWith("#"))return o;let c=0,d=0,f=0;return o.length===4?(c=parseInt(o[1]+o[1],16),d=parseInt(o[2]+o[2],16),f=parseInt(o[3]+o[3],16)):o.length===7&&(c=parseInt(o.slice(1,3),16),d=parseInt(o.slice(3,5),16),f=parseInt(o.slice(5,7),16)),`rgba(${c}, ${d}, ${f}, ${s})`},sn=o=>{var s;if(o.id===A.value&&((s=h.value)==null||s.setLabelStyle(o.color)),h.value){const c=h.value.getAnnotations();let d=!1;c.forEach(f=>{f.label===o.name&&(f.style||(f.style={}),f.style.strokeColor=o.color,f.style.fillColor=on(o.color,.2),d=!0)}),d&&h.value.render()}l("labelChange",b.value),T()},an=o=>{o.visible=!o.visible,T()},ln=o=>{const s=b.value.findIndex(c=>c.id===o);s>-1&&(b.value.splice(s,1),l("labelChange",b.value),A.value===o&&(A.value=b.value.length>0?b.value[0].id:"",A.value&&W(b.value[0])),T())};t.watch(()=>n.labels,o=>{const s=JSON.parse(JSON.stringify(o||[]));if(b.value=s,b.value.length>0)if(!A.value||!b.value.find(c=>c.id===A.value))W(b.value[0]);else{const c=b.value.find(d=>d.id===A.value);c&&W(c)}else A.value="";T()},{immediate:!0,deep:!0});const cn=()=>{u.value>0&&(Q(),u.value--,P(),tt())},rn=()=>{u.value<n.batchImages.length-1&&(Q(),u.value++,P(),tt())},hn=()=>{u.value>0&&q(0)},dn=()=>{u.value<n.batchImages.length-1&&q(n.batchImages.length-1)},Q=()=>{if(h.value){const o=h.value.getAnnotations();n.batchImages[u.value].annotations=o}},tt=()=>{const o=n.batchImages[u.value];l("batchChange",{currentIndex:u.value,total:n.batchImages.length,currentImageUrl:o.imageUrl,currentAnnotations:o.annotations||[]})},lt=(o=[])=>{var f;if(!h.value)return;if(p.value=JSON.parse(JSON.stringify(o)),p.value.length===0){E.value="none";return}E.value="loaded";const c=(h.value.getAnnotations()||[]).filter(_=>!_.predictionId),d=p.value.map(_=>{const I=JSON.parse(JSON.stringify(_.annotation));return I.id=I.id||`pred-${_.id}`,I.predictionId=_.id,I.modelRunId=_.modelRunId||I.modelRunId,I.confidence=_.confidence??I.confidence,I.reviewStatus=I.reviewStatus||"draft",I});h.value.setAnnotations([...c,...d]),l("prediction:loaded",{meta:R(),modelRunId:(f=p.value[0])==null?void 0:f.modelRunId,candidates:p.value})},gn=(o,s)=>{var f;if(!h.value)return[];E.value="applying";const d=(h.value.getAnnotations()||[]).filter(_=>_.predictionId&&o.includes(_.predictionId));return d.forEach(_=>{_.reviewStatus="accepted"}),E.value="applied",l("prediction:apply",{meta:R(),modelRunId:(f=d[0])==null?void 0:f.modelRunId,candidateIds:o,threshold:s,acceptedAnnotations:d}),h.value.render(),d},mn=(o,s)=>{var f;if(!h.value)return;const c=h.value.getAnnotations()||[],d=c.filter(_=>!(_.predictionId&&o.includes(_.predictionId)));h.value.setAnnotations(d),l("prediction:reject",{meta:R(),modelRunId:(f=c.find(_=>_.predictionId&&o.includes(_.predictionId)))==null?void 0:f.modelRunId,candidateIds:o,reason:s})},fn=(o,s=[])=>{h.value&&(h.value.loadImage(o.url),h.value.setAnnotations(s))},pn=o=>{var s;(s=h.value)==null||s.setAnnotations(o)},ct=()=>{var o;return((o=h.value)==null?void 0:o.getAnnotations())||[]},yn=(o="json")=>{var c,d;const s=ct();return{format:o,image:((c=n.batchImages[u.value])==null?void 0:c.imageUrl)||((d=n.image)==null?void 0:d.url)||"",annotations:s}},q=o=>{o>=0&&o<n.batchImages.length&&(Q(),u.value=o,P(),tt())},un=o=>{var s;return o===u.value&&h.value?h.value.getAnnotations()||[]:((s=n.batchImages[o])==null?void 0:s.annotations)||[]},xn=o=>o.type==="rectangle",vn=o=>o.type==="polygon",wn=o=>o.type==="point",bn=o=>o.type==="rotatedRect",kn=o=>o.type==="category",G=o=>{var c,d;const s=(c=b.value.find(f=>f.name===o.label))==null?void 0:c.color;return((d=o.style)==null?void 0:d.strokeColor)||s||"#409eff"},rt=o=>{const s=o.coordinates;return(s==null?void 0:s.points)||[]},Y=o=>{const s=n.batchImages[o];if(s!=null&&s.width&&(s!=null&&s.height))return{width:s.width,height:s.height};const c=s!=null&&s.imageUrl?N.value[s.imageUrl]:void 0;return c||(s!=null&&s.imageUrl&&j(s.imageUrl),{width:1,height:1})},Cn=o=>{const s=n.batchImages[o];return s!=null&&s.width&&(s!=null&&s.height)?!0:s!=null&&s.imageUrl?!!N.value[s.imageUrl]:!1},_n=(o,s)=>{const c=s.coordinates,d=Y(o),f=G(s),_=Math.min(c.x1,c.x2),I=Math.min(c.y1,c.y2),An=Math.max(c.x1,c.x2),Nn=Math.max(c.y1,c.y2);return{left:`${_/d.width*100}%`,top:`${I/d.height*100}%`,width:`${(An-_)/d.width*100}%`,height:`${(Nn-I)/d.height*100}%`,borderColor:f,backgroundColor:`${f}22`}},En=(o,s)=>{const c=Y(o);return rt(s).map(d=>`${d.x/c.width*100},${d.y/c.height*100}`).join(" ")},Bn=o=>{const s=G(o);return{fill:`${s}33`,stroke:s,strokeWidth:"1.4"}},Sn=(o,s,c)=>{const d=Y(o),f=G(c);return{left:`${s.x/d.width*100}%`,top:`${s.y/d.height*100}%`,backgroundColor:f}},In=(o,s)=>{const c=s.coordinates,d=Y(o),f=G(s),_=Math.abs(c.width),I=Math.abs(c.height);return{left:`${(c.x-_/2)/d.width*100}%`,top:`${(c.y-I/2)/d.height*100}%`,width:`${_/d.width*100}%`,height:`${I/d.height*100}%`,transform:`rotate(${c.angle||0}deg)`,borderColor:f,backgroundColor:`${f}22`}},Vn=(o,s)=>{const c=s.coordinates,d=Y(o),f=G(s);return{left:`${c.x/d.width*100}%`,top:`${c.y/d.height*100}%`,backgroundColor:`${f}d9`}};return e({jumpTo:q,setImage:fn,setAnnotations:pn,getAnnotations:ct,selectTool:$,loadPredictionCandidates:lt,applyPredictions:gn,rejectPredictions:mn,exportAnnotations:yn,getAllAnnotations:()=>{var o,s;return n.batchImages.length>0?n.batchImages:[{imageUrl:((o=n.image)==null?void 0:o.url)||"",annotations:((s=h.value)==null?void 0:s.getAnnotations())||[]}]},getCurrentAnnotation:()=>{var o,s,c;return{imageUrl:((o=n.batchImages[u.value])==null?void 0:o.imageUrl)||((s=n.image)==null?void 0:s.url)||"",annotations:((c=h.value)==null?void 0:c.getAnnotations())||[]}}}),t.watch(()=>{var o;return(o=n.image)==null?void 0:o.url},()=>{var o;n.batchImages.length===0&&((o=n.image)!=null&&o.url)&&P()}),t.watch(()=>n.predictionCandidates,o=>{o&<(o)},{immediate:!0,deep:!0}),t.watch(()=>n.batchImages.map(o=>`${o.imageUrl}:${o.width||""}x${o.height||""}`),()=>{X(),m.value=m.value.slice(0,n.batchImages.length),t.nextTick(()=>O())},{immediate:!0}),t.watch(()=>u.value,()=>{t.nextTick(()=>O())}),(o,s)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["annotation-container",v.theme])},[v.batchImages&&v.batchImages.length>0?(t.openBlock(),t.createElementBlock("div",Dt,[t.createElementVNode("div",Tt,"共 "+t.toDisplayString(v.batchImages.length)+" 张",1),t.createElementVNode("div",{ref_key:"imageListScrollRef",ref:g,class:"image-list-scroll"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(v.batchImages,(c,d)=>(t.openBlock(),t.createElementBlock("button",{key:`${c.imageUrl}-${d}`,ref_for:!0,ref:f=>K(f,d),class:t.normalizeClass(["image-list-item",{active:d===u.value}]),onClick:f=>q(d)},[t.createElementVNode("div",zt,[t.createElementVNode("img",{src:c.imageUrl,alt:`第${d+1}张`,class:"image-list-thumb"},null,8,Pt),Cn(d)?(t.openBlock(),t.createElementBlock("div",Lt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(un(d),f=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:f.id},[xn(f)?(t.openBlock(),t.createElementBlock("div",{key:0,class:"thumb-overlay-rect",style:t.normalizeStyle(_n(d,f))},null,4)):vn(f)?(t.openBlock(),t.createElementBlock("svg",$t,[t.createElementVNode("polygon",{points:En(d,f),style:t.normalizeStyle(Bn(f))},null,12,Rt)])):wn(f)?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:2},t.renderList(rt(f),(_,I)=>(t.openBlock(),t.createElementBlock("div",{key:`${f.id}-${I}`,class:"thumb-overlay-point",style:t.normalizeStyle(Sn(d,_,f))},null,4))),128)):bn(f)?(t.openBlock(),t.createElementBlock("div",{key:3,class:"thumb-overlay-rotated",style:t.normalizeStyle(In(d,f))},null,4)):kn(f)?(t.openBlock(),t.createElementBlock("div",{key:4,class:"thumb-overlay-category",style:t.normalizeStyle(Vn(d,f))},t.toDisplayString(f.label),5)):t.createCommentVNode("",!0)],64))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("span",Ht,"第 "+t.toDisplayString(d+1)+" 张",1)],10,Mt))),128))],512)])):t.createCommentVNode("",!0),t.createElementVNode("div",Ut,[v.readOnly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Ft,[t.createElementVNode("div",{class:t.normalizeClass(["tool-btn",{active:k.value==="pan"}]),onClick:s[0]||(s[0]=c=>$("pan")),title:"拖动"},[t.createVNode(V,{name:"rank"})],2),t.createElementVNode("div",{class:t.normalizeClass(["tool-btn",{active:k.value==="select"}]),onClick:s[1]||(s[1]=c=>$("select")),title:"选择"},[t.createVNode(V,{name:"pointer"})],2),s[5]||(s[5]=t.createElementVNode("div",{class:"divider"},null,-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.value,c=>(t.openBlock(),t.createElementBlock("div",{key:c,class:t.normalizeClass(["tool-btn",{active:k.value===c}]),onClick:d=>$(c),title:z(c)},[t.createVNode(V,{name:C(c)},null,8,["name"])],10,Ot))),128)),s[6]||(s[6]=t.createElementVNode("div",{class:"divider"},null,-1)),t.createElementVNode("div",{class:"tool-btn",onClick:Qe,title:"放大"},[t.createVNode(V,{name:"zoom-in"})]),t.createElementVNode("div",{class:"tool-btn",onClick:tn,title:"缩小"},[t.createVNode(V,{name:"zoom-out"})]),M.value?(t.openBlock(),t.createElementBlock("div",Wt)):t.createCommentVNode("",!0),M.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"tool-btn",onClick:Ze,title:"删除选中"},[t.createVNode(V,{name:"delete"})])):t.createCommentVNode("",!0)]))]),t.createElementVNode("div",Gt,[t.createElementVNode("div",{class:"canvas-wrapper",ref_key:"canvasWrapper",ref:r,onWheel:s[2]||(s[2]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("canvas",{ref_key:"canvasRef",ref:a},null,512),v.readOnly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Yt,[t.createElementVNode("div",{class:"selector-trigger",onClick:st},[F.value?(t.openBlock(),t.createElementBlock("div",Jt,[t.createElementVNode("span",{class:"color-dot",style:t.normalizeStyle({backgroundColor:F.value.color})},null,4),t.createElementVNode("span",jt,t.toDisplayString(F.value.name),1)])):(t.openBlock(),t.createElementBlock("div",Xt,[...s[7]||(s[7]=[t.createElementVNode("span",{class:"label-name"},"请选择标签",-1)])])),t.createVNode(V,{name:"right",class:t.normalizeClass(["arrow-icon",{"is-open":L.value}])},null,8,["class"])]),L.value?(t.openBlock(),t.createElementBlock("div",qt,[b.value.length===0?(t.openBlock(),t.createElementBlock("div",Kt,"请在右侧创建标签")):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(b.value,c=>(t.openBlock(),t.createElementBlock("div",{key:c.id,class:t.normalizeClass(["dropdown-item",{active:A.value===c.id}]),onClick:d=>it(c)},[t.createElementVNode("span",{class:"color-dot",style:t.normalizeStyle({backgroundColor:c.color})},null,4),t.createElementVNode("span",Qt,t.toDisplayString(c.name),1),A.value===c.id?(t.openBlock(),t.createBlock(V,{key:0,name:"aim",class:"check-icon"})):t.createCommentVNode("",!0)],10,Zt))),128))])):t.createCommentVNode("",!0)]))],544),v.batchImages&&v.batchImages.length>0?(t.openBlock(),t.createElementBlock("div",te,[t.createElementVNode("button",{class:"icon-btn",onClick:hn,disabled:u.value<=0,title:"第一张"},[t.createVNode(V,{name:"first"})],8,ee),t.createElementVNode("button",{class:"icon-btn",onClick:cn,disabled:u.value<=0,title:"上一张"},[t.createVNode(V,{name:"back"})],8,ne),t.createElementVNode("span",null,t.toDisplayString(u.value+1)+" / "+t.toDisplayString(v.batchImages.length),1),t.createElementVNode("button",{class:"icon-btn",onClick:rn,disabled:u.value>=v.batchImages.length-1,title:"下一张"},[t.createVNode(V,{name:"right"})],8,oe),t.createElementVNode("button",{class:"icon-btn",onClick:dn,disabled:u.value>=v.batchImages.length-1,title:"最后一张"},[t.createVNode(V,{name:"last"})],8,se)])):t.createCommentVNode("",!0)]),v.readOnly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",ie,[t.createElementVNode("div",{class:"sidebar-header"},[s[8]||(s[8]=t.createElementVNode("h3",null,"标签",-1)),t.createElementVNode("button",{class:"add-btn",onClick:en},"添加标签")]),t.createElementVNode("div",ae,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,c=>(t.openBlock(),t.createElementBlock("div",{key:c.id,class:"label-item",style:t.normalizeStyle({backgroundColor:c.color+"1A",color:c.color})},[t.createElementVNode("div",le,[t.createElementVNode("label",{class:"color-wrapper",style:t.normalizeStyle({backgroundColor:c.color})},[t.withDirectives(t.createElementVNode("input",{type:"color","onUpdate:modelValue":d=>c.color=d,onChange:d=>sn(c),style:{visibility:"hidden",width:"0",height:"0"}},null,40,ce),[[t.vModelText,c.color]])],4),t.createElementVNode("span",{class:"label-name",title:c.name},t.toDisplayString(c.name),9,re),t.createElementVNode("span",{class:"action-icon eye",onClick:d=>an(c)},[c.visible?(t.openBlock(),t.createBlock(V,{key:0,name:"view"})):(t.openBlock(),t.createBlock(V,{key:1,name:"hide"}))],8,he),t.createElementVNode("div",de,[s[9]||(s[9]=t.createElementVNode("span",{class:"dots"},"•••",-1)),t.createElementVNode("span",{class:"delete-btn",onClick:d=>ln(c.id),title:"删除"},[t.createVNode(V,{name:"delete"})],8,ge)])])],4))),128))])])),U.value?(t.openBlock(),t.createElementBlock("div",{key:2,class:"modal-overlay",onClick:t.withModifiers(Z,["self"])},[t.createElementVNode("div",me,[s[12]||(s[12]=t.createElementVNode("div",{class:"modal-header"},[t.createElementVNode("h3",null,"新增标签")],-1)),t.createElementVNode("div",fe,[t.createElementVNode("div",pe,[s[10]||(s[10]=t.createElementVNode("label",null,[t.createTextVNode("标签名称 "),t.createElementVNode("span",{class:"required"},"*")],-1)),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":s[3]||(s[3]=c=>w.value.name=c),placeholder:"请输入标签名称",class:"modal-input",autofocus:""},null,512),[[t.vModelText,w.value.name]])]),t.createElementVNode("div",ye,[s[11]||(s[11]=t.createElementVNode("label",null,"标签颜色",-1)),t.createElementVNode("div",ue,[t.createElementVNode("label",{class:"color-picker-box",style:t.normalizeStyle({backgroundColor:w.value.color})},[t.withDirectives(t.createElementVNode("input",{type:"color","onUpdate:modelValue":s[4]||(s[4]=c=>w.value.color=c),class:"modal-color-picker"},null,512),[[t.vModelText,w.value.color]])],4),t.createElementVNode("span",xe,t.toDisplayString(w.value.color),1)])])]),t.createElementVNode("div",ve,[t.createElementVNode("button",{onClick:Z,class:"cancel-btn"},"取消"),t.createElementVNode("button",{onClick:nn,class:"confirm-btn",disabled:!w.value.name.trim()},"确认",8,we)])])])):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-914fe07d"]]),be={class:"thumbnail-wrapper",ref:"wrapper"},ke=["src","alt"],Ce=["viewBox","preserveAspectRatio"],_e=["x","y","width","height","stroke","stroke-width"],Ee=["points","stroke","stroke-width"],Be=["transform"],Se=["x","y","width","height","stroke","stroke-width"],Ie={key:3},Ve=["cx","cy","r","fill","stroke-width"],Ae=["x","y","width","height","fill"],Ne=["x","y","fill","font-size","font-weight","text-anchor","dominant-baseline"],De={key:1,class:"loading-placeholder"},Te=J(t.defineComponent({__name:"AnnotationThumbnail",props:{src:{},annotations:{},alt:{},labels:{},fit:{},strokeWidth:{},fontSize:{}},setup(v){const e=v,i=t.ref(null),n=t.ref(!1),l=t.ref(0),a=t.ref(0),r=()=>{i.value&&(l.value=i.value.naturalWidth,a.value=i.value.naturalHeight,n.value=!0)},g=t.computed(()=>e.fit==="contain"?"xMidYMid meet":"xMidYMid slice"),m=t.computed(()=>e.strokeWidth??10),h=t.computed(()=>e.fontSize??30),k=w=>{var E;if((E=w.style)!=null&&E.strokeColor)return w.style.strokeColor;if(e.labels){const p=e.labels.find(N=>N.name===w.label);if(p)return p.color}return"#FF0000"},u=w=>{const E=w.coordinates,p=Math.min(E.x1,E.x2),N=Math.min(E.y1,E.y2),M=Math.abs(E.x1-E.x2),L=Math.abs(E.y1-E.y2);return{x:p,y:N,width:M,height:L}},S=w=>w.coordinates.points.map(p=>`${p.x},${p.y}`).join(" "),b=w=>{if(w.type==="rectangle"){const E=u(w);return{x:E.x,y:E.y-5}}else if(w.type==="polygon"){const E=w.coordinates.points;if(E.length>0)return{x:E[0].x,y:E[0].y-5}}else{if(w.type==="rotatedRect")return{x:w.coordinates.x,y:w.coordinates.y-w.coordinates.height/2-5};if(w.type==="point"){const E=w.coordinates.points;if(E.length>0)return{x:E[0].x,y:E[0].y-15}}else if(w.type==="category")return{x:w.coordinates.x,y:w.coordinates.y}}return{x:0,y:0}},A=w=>{const{x:E,y:p,angle:N}=w.coordinates,M=N*180/Math.PI;return`translate(${E}, ${p}) rotate(${M})`},U=w=>({x:w.coordinates.x,y:w.coordinates.y});return(w,E)=>(t.openBlock(),t.createElementBlock("div",be,[t.createElementVNode("img",{ref_key:"img",ref:i,src:v.src,class:"thumbnail-image",style:t.normalizeStyle({objectFit:v.fit}),onLoad:r,alt:v.alt},null,44,ke),n.value?(t.openBlock(),t.createElementBlock("svg",{key:0,class:"annotation-overlay",viewBox:`0 0 ${l.value} ${a.value}`,preserveAspectRatio:g.value},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(v.annotations,p=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:p.id},[p.type==="rectangle"?(t.openBlock(),t.createElementBlock("rect",{key:0,x:u(p).x,y:u(p).y,width:u(p).width,height:u(p).height,stroke:k(p),"stroke-width":m.value,fill:"transparent"},null,8,_e)):p.type==="polygon"?(t.openBlock(),t.createElementBlock("polygon",{key:1,points:S(p),stroke:k(p),"stroke-width":m.value,fill:"transparent"},null,8,Ee)):p.type==="rotatedRect"?(t.openBlock(),t.createElementBlock("g",{key:2,transform:A(p)},[t.createElementVNode("rect",{x:-p.coordinates.width/2,y:-p.coordinates.height/2,width:p.coordinates.width,height:p.coordinates.height,stroke:k(p),"stroke-width":m.value,fill:"transparent"},null,8,Se)],8,Be)):p.type==="point"?(t.openBlock(),t.createElementBlock("g",Ie,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.coordinates.points,(N,M)=>(t.openBlock(),t.createElementBlock("circle",{key:M,cx:N.x,cy:N.y,r:m.value*1.5,fill:k(p),stroke:"white","stroke-width":m.value*.5},null,8,Ve))),128))])):p.type==="category"?(t.openBlock(),t.createElementBlock("rect",{key:4,x:U(p).x-(p.label||"").length*h.value*.6/2-8,y:U(p).y-h.value/2-4,width:(p.label||"").length*h.value*.6+16,height:h.value+8,rx:"6",ry:"6",fill:k(p),"fill-opacity":"0.85"},null,8,Ae)):t.createCommentVNode("",!0),p.label?(t.openBlock(),t.createElementBlock("text",{key:5,x:b(p).x,y:b(p).y,fill:p.type==="category"?"#ffffff":k(p),"font-size":h.value,"font-weight":p.type==="category"?"normal":"bold","text-anchor":p.type==="category"?"middle":"start","dominant-baseline":p.type==="category"?"middle":"auto",class:t.normalizeClass({"anno-label":p.type!=="category"})},t.toDisplayString(p.label),11,Ne)):t.createCommentVNode("",!0)],64))),128))],8,Ce)):(t.openBlock(),t.createElementBlock("div",De,"Loading..."))],512))}}),[["__scopeId","data-v-159a7956"]]),Me={key:0,class:"gallery-view"},ze={class:"gallery-layout"},Pe={class:"gallery-sidebar"},Le={class:"label-stats-table"},$e={class:"label-cover-wrapper"},Re=["src"],He={class:"gallery-content"},Ue=["onClick"],Fe={class:"thumbnail-wrapper"},Oe={class:"img-meta"},We={class:"img-index"},Ge={class:"anno-count"},Ye={key:0,class:"bottom-bar"},Je={key:1,class:"editor-view"},je={class:"editor-header"},Xe={class:"header-left"},qe={class:"editor-title"},Ke={class:"editor-content"},ot=J(t.defineComponent({__name:"BatchAnnotator",props:{images:{},labels:{},actionBar:{},clickToEnterEditor:{type:Boolean},thumbStrokeWidth:{},thumbFontSize:{}},emits:["export","update:images","imageClick","update:labels","pageChange"],setup(v,{expose:e,emit:i}){const n=v,l=i,a=t.ref("gallery"),r=t.ref([]),g=t.ref([]),m=t.ref(0),h=t.ref(null),k=t.ref(null),u=t.ref(null),S=t.computed(()=>{var y,x;return((x=(y=n.actionBar)==null?void 0:y.annotateButton)==null?void 0:x.show)===!0}),b=t.computed(()=>{var y,x;return((x=(y=n.actionBar)==null?void 0:y.exportButton)==null?void 0:x.show)===!0}),A=t.computed(()=>S.value||b.value),U=t.computed(()=>{var y,x;return((x=(y=n.actionBar)==null?void 0:y.annotateButton)==null?void 0:x.text)||"手动标注"}),w=t.computed(()=>{var y,x;return((x=(y=n.actionBar)==null?void 0:y.exportButton)==null?void 0:x.text)||"导出"}),E=t.computed(()=>n.clickToEnterEditor!==!1),p=t.computed(()=>{const y={};g.value.forEach(C=>{y[C.name]={count:0,cover:""}});let x=0;return r.value.forEach(C=>{C.annotations&&C.annotations.forEach(z=>{var P;const T=z.label||(z.labelId?(P=g.value.find($=>$.id===z.labelId))==null?void 0:P.name:null);T&&y[T]&&(y[T].count++,x++,y[T].cover||(y[T].cover=C.imageUrl))})}),g.value.map(C=>{var P,$;const z=((P=y[C.name])==null?void 0:P.count)||0,T=x===0?"0.00%":(z/x*100).toFixed(2)+"%";return{id:C.id,name:C.name,color:C.color,count:z,percentage:T,cover:(($=y[C.name])==null?void 0:$.cover)||""}})}),N=y=>({color:y.color,backgroundColor:y.color+"1A"});t.onMounted(()=>{l("pageChange",{nowPage:"listPage"})}),t.watch(()=>n.images,y=>{r.value=JSON.parse(JSON.stringify(y))},{immediate:!0,deep:!0}),t.watch(()=>n.labels,y=>{g.value=JSON.parse(JSON.stringify(y||[]))},{immediate:!0,deep:!0});const M=y=>{m.value=y,a.value="editor",l("pageChange",{nowPage:"editPage"}),u.value&&(u.value.scrollTop=0),t.nextTick(()=>{k.value&&(k.value.scrollTop=0),window.scrollTo(0,0),requestAnimationFrame(()=>{var x,C;(C=(x=h.value)==null?void 0:x.jumpTo)==null||C.call(x,y)})})},L=(y,x)=>{if(E.value){M(y);return}l("imageClick",{index:y,imageId:x.id,image:x})},F=y=>r.value.findIndex(x=>x.id===y);e({openImageById:y=>{const x=F(y);return x<0?!1:(M(x),!0)},triggerImageClickById:y=>{const x=F(y);if(x<0)return!1;const C=r.value[x];return C?(l("imageClick",{index:x,imageId:C.id,image:C}),!0):!1},getFinalData:()=>({images:JSON.parse(JSON.stringify(r.value)),labels:JSON.parse(JSON.stringify(g.value))})});const j=()=>{if(h.value&&h.value.getCurrentAnnotation){const y=h.value.getCurrentAnnotation();r.value[m.value]&&(r.value[m.value].annotations=y.annotations)}a.value="gallery",l("pageChange",{nowPage:"listPage"})},X=()=>{l("export",r.value)},K=y=>{m.value=y.currentIndex,r.value[y.currentIndex]&&(r.value[y.currentIndex].annotations=y.currentAnnotations)},O=y=>{if(h.value&&h.value.getCurrentAnnotation){const x=h.value.getCurrentAnnotation();r.value[m.value]&&(r.value[m.value].annotations=x.annotations,l("update:images",r.value))}},R=y=>{g.value=JSON.parse(JSON.stringify(y||[])),l("update:labels",g.value)};return(y,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"batchRootRef",ref:k,class:"batch-annotator"},[a.value==="gallery"?(t.openBlock(),t.createElementBlock("div",Me,[t.createElementVNode("div",ze,[t.createElementVNode("div",Pe,[t.createElementVNode("table",Le,[x[1]||(x[1]=t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",null,"标签封面"),t.createElementVNode("th",null,"标签名称"),t.createElementVNode("th",null,"标注数"),t.createElementVNode("th",null,"占比")])],-1)),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,C=>(t.openBlock(),t.createElementBlock("tr",{key:C.id,style:t.normalizeStyle(N(C))},[t.createElementVNode("td",null,[t.createElementVNode("div",$e,[C.cover?(t.openBlock(),t.createElementBlock("img",{key:0,src:C.cover,class:"label-cover"},null,8,Re)):(t.openBlock(),t.createElementBlock("div",{key:1,class:"label-cover-empty",style:t.normalizeStyle({backgroundColor:C.color})},null,4))])]),t.createElementVNode("td",null,t.toDisplayString(C.name),1),t.createElementVNode("td",null,t.toDisplayString(C.count),1),t.createElementVNode("td",null,t.toDisplayString(C.percentage),1)],4))),128))])])]),t.createElementVNode("div",He,[t.createElementVNode("div",{ref_key:"galleryGridRef",ref:u,class:"gallery-grid"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(C,z)=>(t.openBlock(),t.createElementBlock("div",{key:z,class:"gallery-item",onClick:T=>L(z,C)},[t.createElementVNode("div",Fe,[t.createVNode(Te,{src:C.imageUrl,annotations:C.annotations||[],labels:g.value,fit:"cover",strokeWidth:n.thumbStrokeWidth,fontSize:n.thumbFontSize},null,8,["src","annotations","labels","strokeWidth","fontSize"])]),t.createElementVNode("div",Oe,[t.createElementVNode("span",We,"#"+t.toDisplayString(z+1),1),t.createElementVNode("span",Ge,t.toDisplayString((C.annotations||[]).length)+" 标注",1)])],8,Ue))),128))],512)])]),A.value?(t.openBlock(),t.createElementBlock("div",Ye,[S.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"action-btn primary",onClick:x[0]||(x[0]=C=>M(0))},[t.createVNode(V,{name:"edit"}),t.createTextVNode(" "+t.toDisplayString(U.value),1)])):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"action-btn success",onClick:X},[t.createVNode(V,{name:"download"}),t.createTextVNode(" "+t.toDisplayString(w.value),1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",Je,[t.createElementVNode("div",je,[t.createElementVNode("div",Xe,[t.createElementVNode("button",{class:"back-btn",onClick:j},[t.createVNode(V,{name:"back",class:"back-icon"}),x[2]||(x[2]=t.createTextVNode()),x[3]||(x[3]=t.createElementVNode("span",{class:"back-text"},"返回",-1))]),t.createElementVNode("span",qe,"正在标注: "+t.toDisplayString(m.value+1)+" / "+t.toDisplayString(r.value.length),1)])]),t.createElementVNode("div",Ke,[t.createVNode(nt,{ref_key:"annotatorRef",ref:h,batchImages:r.value,labels:g.value,annotationTypes:["rectangle","polygon","point","rotatedRect","category"],onBatchChange:K,onAnnotationChange:O,onLabelChange:R},null,8,["batchImages","labels"])])]))],512))}}),[["__scopeId","data-v-5bb1d03b"]]);D.BatchAnnotator=ot,D.ImageAnnotator=nt,D.default=ot,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|