@frigate-nvr/image-annotator 1.0.12 → 1.0.13
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,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as a, jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { g as
|
|
2
|
+
import { g as d } from "../_commonjsHelpers-DjF3Plf2.js";
|
|
3
3
|
var c = { exports: {} };
|
|
4
4
|
/*!
|
|
5
5
|
Copyright (c) 2018 Jed Watson.
|
|
@@ -36,8 +36,8 @@ var c = { exports: {} };
|
|
|
36
36
|
t.exports ? (i.default = i, t.exports = i) : window.classNames = i;
|
|
37
37
|
})();
|
|
38
38
|
})(c);
|
|
39
|
-
var
|
|
40
|
-
const m = /* @__PURE__ */ x
|
|
39
|
+
var x = c.exports;
|
|
40
|
+
const m = /* @__PURE__ */ d(x), b = (t) => {
|
|
41
41
|
const o = m({
|
|
42
42
|
"text-sm py-2 px-2": t.xs,
|
|
43
43
|
"text-base font-medium py-2 px-3": t.sm,
|
|
@@ -47,7 +47,8 @@ const m = /* @__PURE__ */ x(d), b = (t) => {
|
|
|
47
47
|
"text-white bg-primary-700 border-gray-100 hover:bg-primary-900 active:bg-primary-800": !t.secondary && !t.red && !t.green,
|
|
48
48
|
"text-white bg-red-500 border-gray-100 hover:bg-red-600 active:bg-red-500": t.red,
|
|
49
49
|
"text-white bg-green-600 border-gray-100 hover:bg-green-700 active:bg-green-600": t.green,
|
|
50
|
-
"w-full": t.full
|
|
50
|
+
"w-full": t.full,
|
|
51
|
+
"opacity-50 cursor-not-allowed pointer-events-none": t.disabled
|
|
51
52
|
});
|
|
52
53
|
return (
|
|
53
54
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../node_modules/classnames/index.js","../../src/components/Button.tsx"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import { ReactNode } from \"react\";\n\nimport classNames from \"classnames\";\n\ninterface IButtonProps {\n loading?: boolean;\n xs?: boolean;\n sm?: boolean;\n xl?: boolean;\n secondary?: boolean;\n red?: boolean;\n green?: boolean;\n full?: boolean;\n children: ReactNode;\n}\n\n/**\n * @component\n * @params props - Component props.\n * @param props.loading - Display loading indicator.\n * @param props.xs - Button in xs size.\n * @param props.sm - Button in sm size.\n * @param props.xl - Button in xl size.\n * @param props.secondary - Indicates if the button is a secondary button.\n * @param props.red - Indicates if the button is a red button.\n * @param props.green - Indicates if the button is a green button.\n * @param props.full - Indicates if the button takes 100% width.\n * @param props.children - Children components.\n */\nconst Button = (props: IButtonProps) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call\n const btnClass = classNames({\n \"text-sm py-2 px-2\": props.xs,\n \"text-base font-medium py-2 px-3\": props.sm,\n \"font-extrabold text-xl py-4 px-6\": props.xl,\n \"text-lg font-semibold py-2 px-4\": !props.xl,\n \"bg-white text-gray-700 border-gray-400 hover:bg-gray-100 active:bg-white\": props.secondary,\n \"text-white bg-primary-700 border-gray-100 hover:bg-primary-900 active:bg-primary-800\": !props.secondary && !props.red && !props.green,\n \"text-white bg-red-500 border-gray-100 hover:bg-red-600 active:bg-red-500\": props.red,\n \"text-white bg-green-600 border-gray-100 hover:bg-green-700 active:bg-green-600\": props.green,\n \"w-full\": props.full,\n });\n\n return (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n <div className={`inline-flex rounded-md border items-center justify-center ${btnClass}`}>\n {props.loading && (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"animate-spin h-5 w-5 text-white mr-1\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" />\n <path\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n />\n </svg>\n )}\n\n {props.children}\n </div>\n );\n};\n\nexport { Button };\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","Button","props","btnClass","jsxs","jsx"],"mappings":";;;;;;;;;AAOA,GAAC,WAAY;AAGZ,QAAIA,IAAS,CAAE,EAAC;AAEhB,aAASC,IAAc;AAGtB,eAFIC,IAAU,IAELC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AAC1C,YAAIC,IAAM,UAAUD,CAAC;AACrB,QAAIC,MACHF,IAAUG,EAAYH,GAASI,EAAWF,CAAG,CAAC;AAAA,MAE/C;AAED,aAAOF;AAAA,IACP;AAED,aAASI,EAAYF,GAAK;AACzB,UAAI,OAAOA,KAAQ,YAAY,OAAOA,KAAQ;AAC7C,eAAOA;AAGR,UAAI,OAAOA,KAAQ;AAClB,eAAO;AAGR,UAAI,MAAM,QAAQA,CAAG;AACpB,eAAOH,EAAW,MAAM,MAAMG,CAAG;AAGlC,UAAIA,EAAI,aAAa,OAAO,UAAU,YAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe;AAClG,eAAOA,EAAI;AAGZ,UAAIF,IAAU;AAEd,eAASK,KAAOH;AACf,QAAIJ,EAAO,KAAKI,GAAKG,CAAG,KAAKH,EAAIG,CAAG,MACnCL,IAAUG,EAAYH,GAASK,CAAG;AAIpC,aAAOL;AAAA,IACP;AAED,aAASG,EAAaG,GAAOC,GAAU;AACtC,aAAKA,IAIDD,IACIA,IAAQ,MAAMC,IAGfD,IAAQC,IAPPD;AAAA,IAQR;AAED,IAAqCE,EAAO,WAC3CT,EAAW,UAAUA,GACrBS,EAAA,UAAiBT,KAOjB,OAAO,aAAaA;AAAA,EAEtB;;;
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../node_modules/classnames/index.js","../../src/components/Button.tsx"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import { ReactNode } from \"react\";\n\nimport classNames from \"classnames\";\n\ninterface IButtonProps {\n loading?: boolean;\n xs?: boolean;\n sm?: boolean;\n xl?: boolean;\n secondary?: boolean;\n red?: boolean;\n green?: boolean;\n full?: boolean;\n disabled?: boolean;\n children: ReactNode;\n}\n\n/**\n * @component\n * @params props - Component props.\n * @param props.loading - Display loading indicator.\n * @param props.xs - Button in xs size.\n * @param props.sm - Button in sm size.\n * @param props.xl - Button in xl size.\n * @param props.secondary - Indicates if the button is a secondary button.\n * @param props.red - Indicates if the button is a red button.\n * @param props.green - Indicates if the button is a green button.\n * @param props.full - Indicates if the button takes 100% width.\n * @param props.disabled - Renders the button dimmed and non-interactive.\n * @param props.children - Children components.\n */\nconst Button = (props: IButtonProps) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call\n const btnClass = classNames({\n \"text-sm py-2 px-2\": props.xs,\n \"text-base font-medium py-2 px-3\": props.sm,\n \"font-extrabold text-xl py-4 px-6\": props.xl,\n \"text-lg font-semibold py-2 px-4\": !props.xl,\n \"bg-white text-gray-700 border-gray-400 hover:bg-gray-100 active:bg-white\": props.secondary,\n \"text-white bg-primary-700 border-gray-100 hover:bg-primary-900 active:bg-primary-800\": !props.secondary && !props.red && !props.green,\n \"text-white bg-red-500 border-gray-100 hover:bg-red-600 active:bg-red-500\": props.red,\n \"text-white bg-green-600 border-gray-100 hover:bg-green-700 active:bg-green-600\": props.green,\n \"w-full\": props.full,\n \"opacity-50 cursor-not-allowed pointer-events-none\": props.disabled,\n });\n\n return (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n <div className={`inline-flex rounded-md border items-center justify-center ${btnClass}`}>\n {props.loading && (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"animate-spin h-5 w-5 text-white mr-1\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" />\n <path\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n />\n </svg>\n )}\n\n {props.children}\n </div>\n );\n};\n\nexport { Button };\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","Button","props","btnClass","jsxs","jsx"],"mappings":";;;;;;;;;AAOA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AClF,kFAAkFA,EAAM;AAAA,IACxF,UAAUA,EAAM;AAAA,IAChB,qDAAqDA,EAAM;AAAA,EAAA,CAC5D;AAED;AAAA;AAAA,IAEG,gBAAAE,EAAA,OAAA,EAAI,WAAW,6DAA6DD,CAAQ,IAClF,UAAA;AAAA,MAAAD,EAAM,WACL,gBAAAE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,OAAM;AAAA,UACN,WAAU;AAAA,UACV,MAAK;AAAA,UACL,SAAQ;AAAA,UAER,UAAA;AAAA,YAAC,gBAAAC,EAAA,UAAA,EAAO,IAAG,MAAK,IAAG,MAAK,GAAE,MAAK,QAAO,eAAe,CAAA;AAAA,YACrD,gBAAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,GAAE;AAAA,cAAA;AAAA,YACJ;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,MAGDH,EAAM;AAAA,IAAA,GACT;AAAA;AAEJ;","x_google_ignoreList":[0]}
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { Crosshairs as
|
|
5
|
-
import { InfoDialog as
|
|
6
|
-
import { LabelDialog as
|
|
7
|
-
import { VerifyDialog as
|
|
8
|
-
import { BoundingBox as
|
|
9
|
-
import { T as
|
|
10
|
-
function
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
if (typeof
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
|
|
1
|
+
import { jsxs as B, Fragment as de, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as M, useEffect as ee, useMemo as ue, useState as $, Fragment as he } from "react";
|
|
3
|
+
import { Button as p } from "./Button.js";
|
|
4
|
+
import { Crosshairs as fe } from "./Crosshairs.js";
|
|
5
|
+
import { InfoDialog as me } from "./InfoDialog.js";
|
|
6
|
+
import { LabelDialog as we } from "./LabelDialog.js";
|
|
7
|
+
import { VerifyDialog as J } from "./VerifyDialog.js";
|
|
8
|
+
import { BoundingBox as ie, BoundingBoxType as Q } from "./BoundingBox.js";
|
|
9
|
+
import { T as ge, a as xe } from "../index.esm-FeyXGhGs.js";
|
|
10
|
+
function ye(c, y, h) {
|
|
11
|
+
var w = this, b = M(null), k = M(0), d = M(null), L = M([]), e = M(), o = M(), D = M(c), C = M(!0);
|
|
12
|
+
D.current = c;
|
|
13
|
+
var v = typeof window < "u", P = !y && y !== 0 && v;
|
|
14
|
+
if (typeof c != "function") throw new TypeError("Expected a function");
|
|
15
|
+
y = +y || 0;
|
|
16
|
+
var I = !!(h = h || {}).leading, _ = !("trailing" in h) || !!h.trailing, W = "maxWait" in h, O = "debounceOnServer" in h && !!h.debounceOnServer, Y = W ? Math.max(+h.maxWait || 0, y) : null;
|
|
17
|
+
ee(function() {
|
|
18
|
+
return C.current = !0, function() {
|
|
19
|
+
C.current = !1;
|
|
20
20
|
};
|
|
21
21
|
}, []);
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
return
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
if (!
|
|
30
|
-
var
|
|
31
|
-
return !
|
|
32
|
-
},
|
|
33
|
-
return
|
|
34
|
-
},
|
|
35
|
-
var
|
|
36
|
-
if (
|
|
37
|
-
if (
|
|
38
|
-
var R =
|
|
39
|
-
|
|
22
|
+
var q = ue(function() {
|
|
23
|
+
var X = function(f) {
|
|
24
|
+
var g = L.current, R = e.current;
|
|
25
|
+
return L.current = e.current = null, k.current = f, o.current = D.current.apply(R, g);
|
|
26
|
+
}, A = function(f, g) {
|
|
27
|
+
P && cancelAnimationFrame(d.current), d.current = P ? requestAnimationFrame(f) : setTimeout(f, g);
|
|
28
|
+
}, T = function(f) {
|
|
29
|
+
if (!C.current) return !1;
|
|
30
|
+
var g = f - b.current;
|
|
31
|
+
return !b.current || g >= y || g < 0 || W && f - k.current >= Y;
|
|
32
|
+
}, z = function(f) {
|
|
33
|
+
return d.current = null, _ && L.current ? X(f) : (L.current = e.current = null, o.current);
|
|
34
|
+
}, E = function f() {
|
|
35
|
+
var g = Date.now();
|
|
36
|
+
if (T(g)) return z(g);
|
|
37
|
+
if (C.current) {
|
|
38
|
+
var R = y - (g - b.current), Z = W ? Math.min(R, Y - (g - k.current)) : R;
|
|
39
|
+
A(f, Z);
|
|
40
40
|
}
|
|
41
41
|
}, K = function() {
|
|
42
|
-
if (
|
|
43
|
-
var f = Date.now(),
|
|
44
|
-
if (
|
|
45
|
-
if (!
|
|
46
|
-
if (W) return
|
|
42
|
+
if (v || O) {
|
|
43
|
+
var f = Date.now(), g = T(f);
|
|
44
|
+
if (L.current = [].slice.call(arguments), e.current = w, b.current = f, g) {
|
|
45
|
+
if (!d.current && C.current) return k.current = b.current, A(E, y), I ? X(b.current) : o.current;
|
|
46
|
+
if (W) return A(E, y), X(b.current);
|
|
47
47
|
}
|
|
48
|
-
return
|
|
48
|
+
return d.current || A(E, y), o.current;
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
return K.cancel = function() {
|
|
52
|
-
|
|
52
|
+
d.current && (P ? cancelAnimationFrame(d.current) : clearTimeout(d.current)), k.current = 0, L.current = b.current = e.current = d.current = null;
|
|
53
53
|
}, K.isPending = function() {
|
|
54
|
-
return !!
|
|
54
|
+
return !!d.current;
|
|
55
55
|
}, K.flush = function() {
|
|
56
|
-
return
|
|
56
|
+
return d.current ? z(Date.now()) : o.current;
|
|
57
57
|
}, K;
|
|
58
|
-
}, [
|
|
59
|
-
return
|
|
58
|
+
}, [I, W, y, Y, _, P, v, O]);
|
|
59
|
+
return q;
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
var
|
|
63
|
-
const
|
|
61
|
+
const ke = (c) => {
|
|
62
|
+
var ne;
|
|
63
|
+
const y = [
|
|
64
64
|
{ codes: ["?"], action: "Shortcut help" },
|
|
65
65
|
{ codes: ["w"], action: "Add Box" },
|
|
66
66
|
{ codes: ["d"], action: "Mark Difficult" },
|
|
@@ -73,7 +73,7 @@ const Le = (a) => {
|
|
|
73
73
|
{ codes: ["Shift", "← ↑ → ↓"], action: "Resize Box" },
|
|
74
74
|
{ codes: ["f"], action: "Toggle Unselected Boxes" },
|
|
75
75
|
{ codes: ["Spacebar"], action: "Verify and Save" }
|
|
76
|
-
], [
|
|
76
|
+
], [h, w] = $([]), [b, k] = $([]), [d, L] = $(!1), [e, o] = $({
|
|
77
77
|
createMode: !1,
|
|
78
78
|
drawingMode: !1,
|
|
79
79
|
showBoxes: !0,
|
|
@@ -82,66 +82,68 @@ const Le = (a) => {
|
|
|
82
82
|
showVerify: !1,
|
|
83
83
|
showDelete: !1,
|
|
84
84
|
showConfirmDeleteFalsePositive: !1,
|
|
85
|
-
showTutorial:
|
|
85
|
+
showTutorial: c.userAnnotationCount === 0,
|
|
86
86
|
drawStartX: 0,
|
|
87
87
|
drawStartY: 0,
|
|
88
|
-
selectedLabel:
|
|
88
|
+
selectedLabel: c.labels.find((t) => !(c.verifiedLabels ?? []).includes(t)) ?? c.labels[0],
|
|
89
89
|
difficult: !1,
|
|
90
90
|
width: 1,
|
|
91
91
|
height: 1
|
|
92
|
-
}),
|
|
93
|
-
var
|
|
94
|
-
const t = ((
|
|
95
|
-
let
|
|
96
|
-
|
|
92
|
+
}), D = M(null), C = M(null), v = M(null), P = () => {
|
|
93
|
+
var F, V, U, re;
|
|
94
|
+
const t = ((F = D.current) == null ? void 0 : F.naturalHeight) ?? 1, i = (((V = D.current) == null ? void 0 : V.naturalWidth) ?? 1) / t, r = ((U = C.current) == null ? void 0 : U.clientHeight) ?? 0, a = ((re = C.current) == null ? void 0 : re.clientWidth) ?? 0, u = r - 5, s = a - 5, m = u * i;
|
|
95
|
+
let x, S;
|
|
96
|
+
m > s ? (x = s, S = Math.round(s / i)) : (x = m, S = Math.round(m / i)), o({
|
|
97
97
|
...e,
|
|
98
|
-
width:
|
|
99
|
-
height:
|
|
98
|
+
width: x,
|
|
99
|
+
height: S
|
|
100
100
|
});
|
|
101
|
-
const
|
|
102
|
-
return { leftPad:
|
|
103
|
-
},
|
|
104
|
-
|
|
101
|
+
const j = x * 0.1 / 2, H = S * 0.1 / 2;
|
|
102
|
+
return { leftPad: j, topPad: H };
|
|
103
|
+
}, I = ye(() => {
|
|
104
|
+
P();
|
|
105
105
|
}, 200);
|
|
106
|
-
|
|
106
|
+
ee(() => {
|
|
107
107
|
var t, n;
|
|
108
|
-
return window.addEventListener("resize",
|
|
109
|
-
window.removeEventListener("resize",
|
|
108
|
+
return window.addEventListener("resize", I), (n = (t = C.current) == null ? void 0 : t.parentElement) == null || n.focus(), () => {
|
|
109
|
+
window.removeEventListener("resize", I);
|
|
110
110
|
};
|
|
111
|
-
}, [
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
}, [I]), ee(() => {
|
|
112
|
+
L(!1);
|
|
113
|
+
}, [c.imageUrl]);
|
|
114
|
+
const _ = (t, n, i) => {
|
|
115
|
+
w(
|
|
116
|
+
(r) => r.map((a) => a.id === i ? {
|
|
117
|
+
...a,
|
|
116
118
|
x: n.x / e.width,
|
|
117
119
|
y: n.y / e.height,
|
|
118
120
|
w: t.offsetWidth / e.width,
|
|
119
121
|
h: t.offsetHeight / e.height
|
|
120
|
-
} :
|
|
122
|
+
} : a)
|
|
121
123
|
);
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
+
}, W = (t, n) => {
|
|
125
|
+
w(
|
|
124
126
|
(i) => i.map((r) => r.id === n ? {
|
|
125
127
|
...r,
|
|
126
128
|
x: t.x / e.width,
|
|
127
129
|
y: t.y / e.height
|
|
128
130
|
} : r)
|
|
129
131
|
);
|
|
130
|
-
},
|
|
132
|
+
}, O = (t) => {
|
|
131
133
|
var n, i;
|
|
132
134
|
if (e.createMode) {
|
|
133
|
-
const r = ((n =
|
|
135
|
+
const r = ((n = v.current) == null ? void 0 : n.instance.transformState.scale) ?? 1, a = (i = D.current) == null ? void 0 : i.getBoundingClientRect(), u = (t.clientX - ((a == null ? void 0 : a.left) ?? 0)) / r / e.width, s = (t.clientY - ((a == null ? void 0 : a.top) ?? 0)) / r / e.height;
|
|
134
136
|
o({
|
|
135
137
|
...e,
|
|
136
138
|
drawingMode: !0,
|
|
137
|
-
drawStartX:
|
|
139
|
+
drawStartX: u,
|
|
138
140
|
drawStartY: s,
|
|
139
141
|
selectedBox: "draft"
|
|
140
|
-
}),
|
|
141
|
-
...
|
|
142
|
+
}), w((m) => [
|
|
143
|
+
...m,
|
|
142
144
|
{
|
|
143
145
|
id: "draft",
|
|
144
|
-
x:
|
|
146
|
+
x: u,
|
|
145
147
|
y: s,
|
|
146
148
|
w: 0,
|
|
147
149
|
h: 0
|
|
@@ -149,7 +151,7 @@ const Le = (a) => {
|
|
|
149
151
|
]);
|
|
150
152
|
} else
|
|
151
153
|
o({ ...e, selectedBox: void 0 });
|
|
152
|
-
},
|
|
154
|
+
}, Y = (t) => {
|
|
153
155
|
if (e.drawingMode) {
|
|
154
156
|
const n = Date.now().toString();
|
|
155
157
|
o({
|
|
@@ -157,153 +159,153 @@ const Le = (a) => {
|
|
|
157
159
|
drawingMode: !1,
|
|
158
160
|
createMode: !1,
|
|
159
161
|
selectedBox: n
|
|
160
|
-
}),
|
|
161
|
-
(i) => i.reduce((r,
|
|
162
|
-
var
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
162
|
+
}), w(
|
|
163
|
+
(i) => i.reduce((r, a) => {
|
|
164
|
+
var u, s;
|
|
165
|
+
if (a.id === "draft") {
|
|
166
|
+
const m = ((u = v.current) == null ? void 0 : u.instance.transformState.scale) ?? 1, x = (s = D.current) == null ? void 0 : s.getBoundingClientRect(), S = (t.clientX - ((x == null ? void 0 : x.left) ?? 0)) / m / e.width, j = (t.clientY - ((x == null ? void 0 : x.top) ?? 0)) / m / e.height;
|
|
165
167
|
if (Math.min(
|
|
166
|
-
Math.abs(e.drawStartX -
|
|
167
|
-
Math.abs(e.drawStartY -
|
|
168
|
+
Math.abs(e.drawStartX - S),
|
|
169
|
+
Math.abs(e.drawStartY - j)
|
|
168
170
|
) > 1e-3) {
|
|
169
|
-
let
|
|
170
|
-
|
|
171
|
-
...
|
|
171
|
+
let H = Math.min(e.drawStartX, S), F = Math.min(e.drawStartY, j), V = Math.abs(e.drawStartX - S), U = Math.abs(e.drawStartY - j);
|
|
172
|
+
H < 0 && (V -= Math.abs(H), H = 0), F < 0 && (U -= Math.abs(F), F = 0), r.push({
|
|
173
|
+
...a,
|
|
172
174
|
id: n,
|
|
173
175
|
label: e.selectedLabel,
|
|
174
176
|
difficult: !1,
|
|
175
|
-
x:
|
|
176
|
-
y:
|
|
177
|
-
w: Math.min(1 -
|
|
178
|
-
h: Math.min(1 -
|
|
177
|
+
x: H,
|
|
178
|
+
y: F,
|
|
179
|
+
w: Math.min(1 - H, V),
|
|
180
|
+
h: Math.min(1 - F, U)
|
|
179
181
|
});
|
|
180
182
|
}
|
|
181
183
|
} else
|
|
182
|
-
r.push(
|
|
184
|
+
r.push(a);
|
|
183
185
|
return r;
|
|
184
186
|
}, [])
|
|
185
187
|
);
|
|
186
188
|
}
|
|
187
|
-
},
|
|
188
|
-
e.drawingMode &&
|
|
189
|
+
}, q = (t) => {
|
|
190
|
+
e.drawingMode && w(
|
|
189
191
|
(n) => n.map((i) => {
|
|
190
|
-
var r,
|
|
192
|
+
var r, a;
|
|
191
193
|
if (i.id === "draft") {
|
|
192
|
-
const
|
|
194
|
+
const u = ((r = v.current) == null ? void 0 : r.instance.transformState.scale) ?? 1, s = (a = D.current) == null ? void 0 : a.getBoundingClientRect(), m = (t.pageX - ((s == null ? void 0 : s.left) ?? 0)) / u / e.width, x = (t.pageY - ((s == null ? void 0 : s.top) ?? 0)) / u / e.height;
|
|
193
195
|
return {
|
|
194
196
|
...i,
|
|
195
|
-
x: Math.min(e.drawStartX,
|
|
196
|
-
y: Math.min(e.drawStartY,
|
|
197
|
-
w: Math.abs(e.drawStartX -
|
|
198
|
-
h: Math.abs(e.drawStartY -
|
|
197
|
+
x: Math.min(e.drawStartX, m),
|
|
198
|
+
y: Math.min(e.drawStartY, x),
|
|
199
|
+
w: Math.abs(e.drawStartX - m),
|
|
200
|
+
h: Math.abs(e.drawStartY - x)
|
|
199
201
|
};
|
|
200
202
|
}
|
|
201
203
|
return i;
|
|
202
204
|
})
|
|
203
205
|
);
|
|
204
|
-
},
|
|
206
|
+
}, X = () => {
|
|
205
207
|
o({ ...e, createMode: !e.createMode });
|
|
206
|
-
},
|
|
207
|
-
const n =
|
|
208
|
+
}, A = (t) => {
|
|
209
|
+
const n = h.find((i) => i.id === t);
|
|
208
210
|
o({
|
|
209
211
|
...e,
|
|
210
212
|
selectedBox: t,
|
|
211
213
|
selectedLabel: (n == null ? void 0 : n.label) ?? e.selectedLabel,
|
|
212
214
|
difficult: (n == null ? void 0 : n.difficult) ?? e.difficult
|
|
213
215
|
});
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
(r) => r.map((
|
|
217
|
-
...
|
|
216
|
+
}, T = (t, n, i) => {
|
|
217
|
+
w(
|
|
218
|
+
(r) => r.map((a) => a.id === t ? {
|
|
219
|
+
...a,
|
|
218
220
|
x: Math.min(
|
|
219
|
-
1 -
|
|
220
|
-
Math.max(0,
|
|
221
|
+
1 - a.w,
|
|
222
|
+
Math.max(0, a.x + i / e.width)
|
|
221
223
|
),
|
|
222
224
|
y: Math.min(
|
|
223
|
-
1 -
|
|
224
|
-
Math.max(0,
|
|
225
|
+
1 - a.h,
|
|
226
|
+
Math.max(0, a.y + n / e.height)
|
|
225
227
|
)
|
|
226
|
-
} :
|
|
228
|
+
} : a)
|
|
227
229
|
);
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
(r) => r.map((
|
|
231
|
-
...
|
|
232
|
-
w: Math.min(1 -
|
|
233
|
-
h: Math.min(1 -
|
|
234
|
-
} :
|
|
230
|
+
}, z = (t, n, i) => {
|
|
231
|
+
w(
|
|
232
|
+
(r) => r.map((a) => a.id === t ? {
|
|
233
|
+
...a,
|
|
234
|
+
w: Math.min(1 - a.x, a.w + i / e.width),
|
|
235
|
+
h: Math.min(1 - a.y, a.h + n / e.height)
|
|
236
|
+
} : a)
|
|
235
237
|
);
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
+
}, E = (t) => {
|
|
239
|
+
w(
|
|
238
240
|
(n) => n.map((i) => i.id === t ? {
|
|
239
241
|
...i,
|
|
240
242
|
difficult: !i.difficult
|
|
241
243
|
} : i)
|
|
242
244
|
);
|
|
243
|
-
},
|
|
244
|
-
const i =
|
|
245
|
+
}, K = (t, n = !1) => {
|
|
246
|
+
const i = c.labels.findIndex(
|
|
245
247
|
(s) => e.selectedLabel === s
|
|
246
|
-
), r =
|
|
247
|
-
let
|
|
248
|
-
n ?
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
(s) => s.map((
|
|
252
|
-
...
|
|
253
|
-
label:
|
|
254
|
-
} :
|
|
255
|
-
), o({ ...e, selectedLabel:
|
|
256
|
-
}, H = (t) => {
|
|
257
|
-
m((n) => n.filter((i) => i.id !== t));
|
|
258
|
-
}, K = (t) => {
|
|
259
|
-
k((n) => n.filter((i) => i.id !== t));
|
|
248
|
+
), r = c.labels.length - 1;
|
|
249
|
+
let a = 0;
|
|
250
|
+
n ? a = i === 0 ? r : i - 1 : a = i === r ? 0 : i + 1;
|
|
251
|
+
const u = c.labels[a];
|
|
252
|
+
w(
|
|
253
|
+
(s) => s.map((m) => m.id === t ? {
|
|
254
|
+
...m,
|
|
255
|
+
label: u
|
|
256
|
+
} : m)
|
|
257
|
+
), o({ ...e, selectedLabel: u });
|
|
260
258
|
}, f = (t) => {
|
|
259
|
+
w((n) => n.filter((i) => i.id !== t));
|
|
260
|
+
}, g = (t) => {
|
|
261
|
+
k((n) => n.filter((i) => i.id !== t));
|
|
262
|
+
}, R = (t) => {
|
|
261
263
|
var n;
|
|
262
|
-
return (n =
|
|
263
|
-
},
|
|
264
|
+
return (n = b.find((i) => i.id === t)) == null ? void 0 : n.label;
|
|
265
|
+
}, Z = (t) => h.find((n) => n.id === t), le = (t) => {
|
|
264
266
|
if (!t)
|
|
265
|
-
return
|
|
266
|
-
const n =
|
|
267
|
-
return n ===
|
|
268
|
-
},
|
|
269
|
-
if (t.code === "Escape" && (e.createMode ? o({ ...e, createMode: !1 }) : o({ ...e, selectedBox: void 0 })), t.code === "KeyW" && (e.createMode ? o({ ...e, createMode: !1 }) : o({ ...e, createMode: !0, selectedBox: void 0 })), t.code === "KeyF" && o({ ...e, showBoxes: !e.showBoxes }), t.code === "KeyD" && e.selectedBox &&
|
|
270
|
-
const n =
|
|
267
|
+
return h[0].id;
|
|
268
|
+
const n = h.findIndex((i) => i.id === t);
|
|
269
|
+
return n === h.length - 1 ? h[0].id : h[n + 1].id;
|
|
270
|
+
}, N = 5 / (((ne = v.current) == null ? void 0 : ne.instance.transformState.scale) ?? 1), ae = (t) => {
|
|
271
|
+
if (t.code === "Escape" && (e.createMode ? o({ ...e, createMode: !1 }) : o({ ...e, selectedBox: void 0 })), t.code === "KeyW" && (e.createMode ? o({ ...e, createMode: !1 }) : o({ ...e, createMode: !0, selectedBox: void 0 })), t.code === "KeyF" && o({ ...e, showBoxes: !e.showBoxes }), t.code === "KeyD" && e.selectedBox && E(e.selectedBox), t.code === "KeyS" && e.selectedBox && K(e.selectedBox, t.shiftKey), t.code === "Delete" && e.selectedBox && (f(e.selectedBox), o({ ...e, selectedBox: void 0 })), t.code === "Tab") {
|
|
272
|
+
const n = le(e.selectedBox), i = Z(n);
|
|
271
273
|
o({
|
|
272
274
|
...e,
|
|
273
275
|
selectedBox: n,
|
|
274
276
|
selectedLabel: (i == null ? void 0 : i.label) ?? e.selectedLabel
|
|
275
277
|
}), t.preventDefault();
|
|
276
278
|
}
|
|
277
|
-
t.code === "Space" &&
|
|
278
|
-
},
|
|
279
|
-
const n =
|
|
280
|
-
return
|
|
281
|
-
|
|
282
|
-
), k(
|
|
279
|
+
t.code === "Space" && G(!0), t.code === "Slash" && t.shiftKey && o({ ...e, showHelp: !0 }), e.selectedBox && (t.code === "ArrowLeft" && (t.shiftKey ? z(e.selectedBox, 0, -N) : T(e.selectedBox, 0, -N)), t.code === "ArrowRight" && (t.shiftKey ? z(e.selectedBox, 0, N) : T(e.selectedBox, 0, N)), t.code === "ArrowUp" && (t.shiftKey ? z(e.selectedBox, -N, 0) : T(e.selectedBox, -N, 0)), t.code === "ArrowDown" && (t.shiftKey ? z(e.selectedBox, N, 0) : T(e.selectedBox, N, 0)));
|
|
280
|
+
}, oe = (t) => {
|
|
281
|
+
const n = P();
|
|
282
|
+
return w(
|
|
283
|
+
c.annotations.concat(c.suggestions).sort((i, r) => r.w * r.h - i.w * i.h)
|
|
284
|
+
), k(c.falsePositives.sort((i, r) => r.w * r.h - i.w * i.h)), L(!0), n;
|
|
283
285
|
}, ce = () => {
|
|
284
|
-
o({ ...e, showLabeler: !1 }),
|
|
286
|
+
o({ ...e, showLabeler: !1 }), w(
|
|
285
287
|
(t) => t.map((n) => n.id === e.selectedBox ? {
|
|
286
288
|
...n,
|
|
287
289
|
label: e.selectedLabel,
|
|
288
290
|
difficult: e.difficult
|
|
289
291
|
} : n)
|
|
290
292
|
);
|
|
291
|
-
},
|
|
292
|
-
o({ ...e, showLabeler: !1 }),
|
|
293
|
-
},
|
|
294
|
-
|
|
295
|
-
},
|
|
296
|
-
return /* @__PURE__ */
|
|
297
|
-
/* @__PURE__ */ l(
|
|
293
|
+
}, se = () => {
|
|
294
|
+
o({ ...e, showLabeler: !1 }), w((t) => t.filter((n) => n.label));
|
|
295
|
+
}, G = (t) => {
|
|
296
|
+
d && c.save(h, c.suggestions.map((n) => n.id), b.length === 0, t ? c.labels : []);
|
|
297
|
+
}, te = e.showBoxes ? 0 : -1;
|
|
298
|
+
return /* @__PURE__ */ B(de, { children: [
|
|
299
|
+
/* @__PURE__ */ l(ge, { ref: v, disabled: e.createMode || e.drawingMode, minScale: 0.9, children: ({ zoomIn: t, zoomOut: n, setTransform: i }) => /* @__PURE__ */ B(
|
|
298
300
|
"div",
|
|
299
301
|
{
|
|
300
302
|
className: "flex h-screen min-w-[600px] flex-col bg-slate-900",
|
|
301
|
-
onKeyDown:
|
|
303
|
+
onKeyDown: ae,
|
|
302
304
|
tabIndex: 0,
|
|
303
305
|
children: [
|
|
304
|
-
/* @__PURE__ */
|
|
305
|
-
/* @__PURE__ */ l("div", { className: "flex-initial", children: /* @__PURE__ */ l("button", { type: "button", onClick:
|
|
306
|
-
/* @__PURE__ */
|
|
306
|
+
/* @__PURE__ */ B("div", { className: "flex flex-initial bg-slate-300 p-1", children: [
|
|
307
|
+
/* @__PURE__ */ l("div", { className: "flex-initial", children: /* @__PURE__ */ l("button", { type: "button", onClick: c.back, children: /* @__PURE__ */ l(p, { secondary: !0, sm: !0, children: "Back" }) }) }),
|
|
308
|
+
/* @__PURE__ */ B("div", { className: "flex flex-auto justify-center", children: [
|
|
307
309
|
/* @__PURE__ */ l(
|
|
308
310
|
"button",
|
|
309
311
|
{
|
|
@@ -311,7 +313,7 @@ const Le = (a) => {
|
|
|
311
313
|
onClick: () => {
|
|
312
314
|
n();
|
|
313
315
|
},
|
|
314
|
-
children: /* @__PURE__ */ l(
|
|
316
|
+
children: /* @__PURE__ */ l(p, { children: /* @__PURE__ */ l(
|
|
315
317
|
"svg",
|
|
316
318
|
{
|
|
317
319
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -339,7 +341,7 @@ const Le = (a) => {
|
|
|
339
341
|
onClick: () => {
|
|
340
342
|
t();
|
|
341
343
|
},
|
|
342
|
-
children: /* @__PURE__ */ l(
|
|
344
|
+
children: /* @__PURE__ */ l(p, { children: /* @__PURE__ */ l(
|
|
343
345
|
"svg",
|
|
344
346
|
{
|
|
345
347
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -360,25 +362,29 @@ const Le = (a) => {
|
|
|
360
362
|
) })
|
|
361
363
|
}
|
|
362
364
|
),
|
|
363
|
-
/* @__PURE__ */ l("button", { type: "button", onClick:
|
|
365
|
+
/* @__PURE__ */ l("button", { type: "button", onClick: X, children: /* @__PURE__ */ l(p, { secondary: !0, sm: !0, children: "Add (w)" }) })
|
|
364
366
|
] }),
|
|
365
|
-
/* @__PURE__ */
|
|
367
|
+
/* @__PURE__ */ B("div", { className: "flex-initial", children: [
|
|
366
368
|
/* @__PURE__ */ l(
|
|
367
369
|
"button",
|
|
368
370
|
{
|
|
371
|
+
disabled: !d,
|
|
372
|
+
title: d ? void 0 : "Waiting for the image to load",
|
|
369
373
|
onClick: () => {
|
|
370
374
|
o({ ...e, showVerify: !0 });
|
|
371
375
|
},
|
|
372
|
-
children: /* @__PURE__ */ l(
|
|
376
|
+
children: /* @__PURE__ */ l(p, { sm: !0, disabled: !d, children: "Verify & Save" })
|
|
373
377
|
}
|
|
374
378
|
),
|
|
375
379
|
/* @__PURE__ */ l(
|
|
376
380
|
"button",
|
|
377
381
|
{
|
|
382
|
+
disabled: !d,
|
|
383
|
+
title: d ? void 0 : "Waiting for the image to load",
|
|
378
384
|
onClick: () => {
|
|
379
|
-
|
|
385
|
+
G(!1);
|
|
380
386
|
},
|
|
381
|
-
children: /* @__PURE__ */ l(
|
|
387
|
+
children: /* @__PURE__ */ l(p, { green: !0, sm: !0, disabled: !d, children: "Save" })
|
|
382
388
|
}
|
|
383
389
|
),
|
|
384
390
|
/* @__PURE__ */ l(
|
|
@@ -387,7 +393,7 @@ const Le = (a) => {
|
|
|
387
393
|
onClick: () => {
|
|
388
394
|
o({ ...e, showDelete: !0 });
|
|
389
395
|
},
|
|
390
|
-
children: /* @__PURE__ */ l(
|
|
396
|
+
children: /* @__PURE__ */ l(p, { red: !0, sm: !0, children: "Delete" })
|
|
391
397
|
}
|
|
392
398
|
),
|
|
393
399
|
/* @__PURE__ */ l(
|
|
@@ -396,7 +402,7 @@ const Le = (a) => {
|
|
|
396
402
|
onClick: () => {
|
|
397
403
|
o({ ...e, showHelp: !0 });
|
|
398
404
|
},
|
|
399
|
-
children: /* @__PURE__ */ l(
|
|
405
|
+
children: /* @__PURE__ */ l(p, { sm: !0, secondary: !0, children: "?" })
|
|
400
406
|
}
|
|
401
407
|
)
|
|
402
408
|
] })
|
|
@@ -404,26 +410,26 @@ const Le = (a) => {
|
|
|
404
410
|
/* @__PURE__ */ l(
|
|
405
411
|
"div",
|
|
406
412
|
{
|
|
407
|
-
ref:
|
|
413
|
+
ref: C,
|
|
408
414
|
className: "grid flex-auto place-content-center",
|
|
409
|
-
children: /* @__PURE__ */ l(
|
|
415
|
+
children: /* @__PURE__ */ l(xe, { children: /* @__PURE__ */ B(
|
|
410
416
|
"div",
|
|
411
417
|
{
|
|
412
418
|
className: "grid place-content-center",
|
|
413
|
-
onMouseDown:
|
|
414
|
-
onMouseUp:
|
|
415
|
-
onMouseMove:
|
|
419
|
+
onMouseDown: O,
|
|
420
|
+
onMouseUp: Y,
|
|
421
|
+
onMouseMove: q,
|
|
416
422
|
children: [
|
|
417
423
|
/* @__PURE__ */ l(
|
|
418
424
|
"img",
|
|
419
425
|
{
|
|
420
|
-
ref:
|
|
426
|
+
ref: D,
|
|
421
427
|
className: "col-start-1 row-start-1 h-full w-full",
|
|
422
428
|
alt: "annotate",
|
|
423
|
-
src:
|
|
429
|
+
src: c.imageUrl,
|
|
424
430
|
onLoad: (r) => {
|
|
425
|
-
const
|
|
426
|
-
i(
|
|
431
|
+
const a = oe();
|
|
432
|
+
i(a.leftPad, a.topPad, 0.9, 0);
|
|
427
433
|
},
|
|
428
434
|
style: {
|
|
429
435
|
width: e.width,
|
|
@@ -431,22 +437,22 @@ const Le = (a) => {
|
|
|
431
437
|
}
|
|
432
438
|
}
|
|
433
439
|
),
|
|
434
|
-
|
|
435
|
-
var
|
|
440
|
+
b.map((r) => {
|
|
441
|
+
var a;
|
|
436
442
|
return /* @__PURE__ */ l(
|
|
437
|
-
|
|
443
|
+
ie,
|
|
438
444
|
{
|
|
439
|
-
type:
|
|
445
|
+
type: Q.falsePositive,
|
|
440
446
|
label: r.label ?? "",
|
|
441
|
-
zIndex: r.id === e.selectedBox ? 1 :
|
|
447
|
+
zIndex: r.id === e.selectedBox ? 1 : te,
|
|
442
448
|
x: r.x * e.width,
|
|
443
449
|
y: r.y * e.height,
|
|
444
450
|
w: r.w * e.width,
|
|
445
451
|
h: r.h * e.height,
|
|
446
|
-
initialScale: (
|
|
452
|
+
initialScale: (a = v.current) == null ? void 0 : a.instance.transformState.scale,
|
|
447
453
|
selected: r.id === e.selectedBox,
|
|
448
|
-
onMouseDown: (
|
|
449
|
-
e.createMode || (
|
|
454
|
+
onMouseDown: (u) => {
|
|
455
|
+
e.createMode || (A(r.id), u.stopPropagation());
|
|
450
456
|
},
|
|
451
457
|
onClickDelete: () => {
|
|
452
458
|
o({
|
|
@@ -458,32 +464,32 @@ const Le = (a) => {
|
|
|
458
464
|
r.id
|
|
459
465
|
);
|
|
460
466
|
}),
|
|
461
|
-
|
|
462
|
-
var
|
|
467
|
+
h.map((r) => {
|
|
468
|
+
var a;
|
|
463
469
|
return /* @__PURE__ */ l(
|
|
464
|
-
|
|
470
|
+
ie,
|
|
465
471
|
{
|
|
466
|
-
type: r.suggestion ?
|
|
472
|
+
type: r.suggestion ? Q.suggestion : Q.truePositive,
|
|
467
473
|
label: r.label ?? "",
|
|
468
474
|
difficult: r.difficult,
|
|
469
|
-
zIndex: r.id === e.selectedBox ? 1 :
|
|
475
|
+
zIndex: r.id === e.selectedBox ? 1 : te,
|
|
470
476
|
x: r.x * e.width,
|
|
471
477
|
y: r.y * e.height,
|
|
472
478
|
w: r.w * e.width,
|
|
473
479
|
h: r.h * e.height,
|
|
474
|
-
initialScale: (
|
|
480
|
+
initialScale: (a = v.current) == null ? void 0 : a.instance.transformState.scale,
|
|
475
481
|
selected: r.id === e.selectedBox,
|
|
476
|
-
onMouseDown: (
|
|
477
|
-
e.createMode || (
|
|
482
|
+
onMouseDown: (u) => {
|
|
483
|
+
e.createMode || (A(r.id), u.stopPropagation());
|
|
478
484
|
},
|
|
479
|
-
onDragStop: (
|
|
480
|
-
|
|
485
|
+
onDragStop: (u, s) => {
|
|
486
|
+
W(s, r.id);
|
|
481
487
|
},
|
|
482
|
-
onResizeStop: (
|
|
483
|
-
|
|
488
|
+
onResizeStop: (u, s, m, x, S) => {
|
|
489
|
+
_(m, S, r.id);
|
|
484
490
|
},
|
|
485
491
|
onClickDelete: () => {
|
|
486
|
-
|
|
492
|
+
f(r.id);
|
|
487
493
|
},
|
|
488
494
|
onClickEdit: () => {
|
|
489
495
|
o({ ...e, showLabeler: !0 });
|
|
@@ -493,7 +499,7 @@ const Le = (a) => {
|
|
|
493
499
|
);
|
|
494
500
|
}),
|
|
495
501
|
/* @__PURE__ */ l(
|
|
496
|
-
|
|
502
|
+
fe,
|
|
497
503
|
{
|
|
498
504
|
className: `col-start-1 row-start-1 ${e.createMode && !e.drawingMode ? "z-10" : "-z-10"}`,
|
|
499
505
|
show: e.createMode && !e.drawingMode
|
|
@@ -508,15 +514,15 @@ const Le = (a) => {
|
|
|
508
514
|
}
|
|
509
515
|
) }),
|
|
510
516
|
/* @__PURE__ */ l(
|
|
511
|
-
|
|
517
|
+
we,
|
|
512
518
|
{
|
|
513
519
|
title: "Annotate",
|
|
514
520
|
show: e.showLabeler,
|
|
515
521
|
cancelText: "Cancel",
|
|
516
|
-
button: /* @__PURE__ */ l("button", { type: "button", onClick: ce, children: /* @__PURE__ */ l(
|
|
517
|
-
handleCancel:
|
|
518
|
-
children: /* @__PURE__ */
|
|
519
|
-
/* @__PURE__ */
|
|
522
|
+
button: /* @__PURE__ */ l("button", { type: "button", onClick: ce, children: /* @__PURE__ */ l(p, { sm: !0, green: !0, children: "Save" }) }),
|
|
523
|
+
handleCancel: se,
|
|
524
|
+
children: /* @__PURE__ */ B("div", { className: "my-2 grid grid-cols-1 gap-y-2", children: [
|
|
525
|
+
/* @__PURE__ */ B("div", { children: [
|
|
520
526
|
/* @__PURE__ */ l(
|
|
521
527
|
"select",
|
|
522
528
|
{
|
|
@@ -525,12 +531,12 @@ const Le = (a) => {
|
|
|
525
531
|
onChange: (t) => {
|
|
526
532
|
o({ ...e, selectedLabel: t.target.value });
|
|
527
533
|
},
|
|
528
|
-
children:
|
|
534
|
+
children: c.labels.map((t) => /* @__PURE__ */ l("option", { value: t, children: t }, t))
|
|
529
535
|
}
|
|
530
536
|
),
|
|
531
|
-
|
|
537
|
+
c.manageLabelUrl && /* @__PURE__ */ l("a", { className: "text-primary-500 hover:text-primary-600 underline text-sm", href: c.manageLabelUrl, target: "_blank", children: "Manage Label Options" })
|
|
532
538
|
] }),
|
|
533
|
-
/* @__PURE__ */
|
|
539
|
+
/* @__PURE__ */ B("div", { className: "flex items-center", children: [
|
|
534
540
|
/* @__PURE__ */ l(
|
|
535
541
|
"input",
|
|
536
542
|
{
|
|
@@ -549,14 +555,14 @@ const Le = (a) => {
|
|
|
549
555
|
}
|
|
550
556
|
),
|
|
551
557
|
/* @__PURE__ */ l(
|
|
552
|
-
|
|
558
|
+
me,
|
|
553
559
|
{
|
|
554
560
|
title: "Keyboard shortcuts",
|
|
555
561
|
show: e.showHelp,
|
|
556
562
|
handleClose: () => {
|
|
557
563
|
o({ ...e, showHelp: !1 });
|
|
558
564
|
},
|
|
559
|
-
children: /* @__PURE__ */ l("div", { className: "grid w-full grid-cols-2 place-content-center gap-2 p-5", children:
|
|
565
|
+
children: /* @__PURE__ */ l("div", { className: "grid w-full grid-cols-2 place-content-center gap-2 p-5", children: y.map((t) => /* @__PURE__ */ B(he, { children: [
|
|
560
566
|
/* @__PURE__ */ l("div", { children: t.action }),
|
|
561
567
|
/* @__PURE__ */ l("div", { className: "justify-self-end", children: t.codes.map((n) => /* @__PURE__ */ l(
|
|
562
568
|
"span",
|
|
@@ -570,7 +576,7 @@ const Le = (a) => {
|
|
|
570
576
|
}
|
|
571
577
|
),
|
|
572
578
|
/* @__PURE__ */ l(
|
|
573
|
-
|
|
579
|
+
J,
|
|
574
580
|
{
|
|
575
581
|
title: "Are all of the objects in this image labeled?",
|
|
576
582
|
description: " ",
|
|
@@ -584,17 +590,18 @@ const Le = (a) => {
|
|
|
584
590
|
"button",
|
|
585
591
|
{
|
|
586
592
|
type: "button",
|
|
593
|
+
disabled: !d,
|
|
587
594
|
onClick: () => {
|
|
588
|
-
|
|
595
|
+
G(!0), o({ ...e, showVerify: !1 });
|
|
589
596
|
},
|
|
590
|
-
children: /* @__PURE__ */ l(
|
|
597
|
+
children: /* @__PURE__ */ l(p, { sm: !0, green: !0, disabled: !d, children: "Yes, all objects are labeled" })
|
|
591
598
|
}
|
|
592
599
|
),
|
|
593
|
-
children: /* @__PURE__ */ l("div", { className: "flex flex-wrap", children:
|
|
600
|
+
children: /* @__PURE__ */ l("div", { className: "flex flex-wrap", children: c.labels.map((t) => /* @__PURE__ */ l("div", { className: "font-mono m-1 bg-slate-200 p-1 rounded-md", children: t }, t)) })
|
|
594
601
|
}
|
|
595
602
|
),
|
|
596
603
|
/* @__PURE__ */ l(
|
|
597
|
-
|
|
604
|
+
J,
|
|
598
605
|
{
|
|
599
606
|
title: "Are you sure you want to delete this image?",
|
|
600
607
|
description: "",
|
|
@@ -608,16 +615,16 @@ const Le = (a) => {
|
|
|
608
615
|
{
|
|
609
616
|
type: "button",
|
|
610
617
|
onClick: () => {
|
|
611
|
-
|
|
618
|
+
c.delete(), o({ ...e, showDelete: !1 });
|
|
612
619
|
},
|
|
613
|
-
children: /* @__PURE__ */ l(
|
|
620
|
+
children: /* @__PURE__ */ l(p, { sm: !0, red: !0, children: "Yes, permanently delete" })
|
|
614
621
|
}
|
|
615
622
|
),
|
|
616
623
|
children: "This cannot be undone."
|
|
617
624
|
}
|
|
618
625
|
),
|
|
619
626
|
/* @__PURE__ */ l(
|
|
620
|
-
|
|
627
|
+
J,
|
|
621
628
|
{
|
|
622
629
|
title: "Are you sure you want to delete this reported false positive?",
|
|
623
630
|
description: " ",
|
|
@@ -632,16 +639,16 @@ const Le = (a) => {
|
|
|
632
639
|
{
|
|
633
640
|
type: "button",
|
|
634
641
|
onClick: () => {
|
|
635
|
-
e.selectedBox &&
|
|
642
|
+
e.selectedBox && g(e.selectedBox), o({
|
|
636
643
|
...e,
|
|
637
644
|
showConfirmDeleteFalsePositive: !1,
|
|
638
645
|
selectedBox: void 0
|
|
639
646
|
});
|
|
640
647
|
},
|
|
641
|
-
children: /* @__PURE__ */
|
|
648
|
+
children: /* @__PURE__ */ B(p, { sm: !0, red: !0, children: [
|
|
642
649
|
"Do not teach my model that this is not a",
|
|
643
650
|
" ",
|
|
644
|
-
e.selectedBox ?
|
|
651
|
+
e.selectedBox ? R(e.selectedBox) : " "
|
|
645
652
|
] })
|
|
646
653
|
}
|
|
647
654
|
),
|
|
@@ -651,6 +658,6 @@ const Le = (a) => {
|
|
|
651
658
|
] });
|
|
652
659
|
};
|
|
653
660
|
export {
|
|
654
|
-
|
|
661
|
+
ke as ImageAnnotator
|
|
655
662
|
};
|
|
656
663
|
//# sourceMappingURL=ImageAnnotator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageAnnotator.js","sources":["../../node_modules/use-debounce/dist/index.module.js","../../src/components/ImageAnnotator.tsx"],"sourcesContent":["import{useRef as r,useEffect as n,useMemo as t,useReducer as e,useCallback as u}from\"react\";function c(e,u,c){var i=this,a=r(null),o=r(0),f=r(null),l=r([]),v=r(),m=r(),d=r(e),g=r(!0);d.current=e;var p=\"undefined\"!=typeof window,w=!u&&0!==u&&p;if(\"function\"!=typeof e)throw new TypeError(\"Expected a function\");u=+u||0;var s=!!(c=c||{}).leading,x=!(\"trailing\"in c)||!!c.trailing,h=\"maxWait\"in c,y=\"debounceOnServer\"in c&&!!c.debounceOnServer,F=h?Math.max(+c.maxWait||0,u):null;n(function(){return g.current=!0,function(){g.current=!1}},[]);var A=t(function(){var r=function(r){var n=l.current,t=v.current;return l.current=v.current=null,o.current=r,m.current=d.current.apply(t,n)},n=function(r,n){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(r):setTimeout(r,n)},t=function(r){if(!g.current)return!1;var n=r-a.current;return!a.current||n>=u||n<0||h&&r-o.current>=F},e=function(n){return f.current=null,x&&l.current?r(n):(l.current=v.current=null,m.current)},c=function r(){var c=Date.now();if(t(c))return e(c);if(g.current){var i=u-(c-a.current),f=h?Math.min(i,F-(c-o.current)):i;n(r,f)}},A=function(){if(p||y){var e=Date.now(),d=t(e);if(l.current=[].slice.call(arguments),v.current=i,a.current=e,d){if(!f.current&&g.current)return o.current=a.current,n(c,u),s?r(a.current):m.current;if(h)return n(c,u),r(a.current)}return f.current||n(c,u),m.current}};return A.cancel=function(){f.current&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=v.current=f.current=null},A.isPending=function(){return!!f.current},A.flush=function(){return f.current?e(Date.now()):m.current},A},[s,h,u,F,x,w,p,y]);return A}function i(r,n){return r===n}function a(r,n){return n}function o(n,t,o){var f=o&&o.equalityFn||i,l=e(a,n),v=l[0],m=l[1],d=c(u(function(r){return m(r)},[m]),t,o),g=r(n);return f(g.current,n)||(d(n),g.current=n),[v,d]}function f(r,n,t){var e=void 0===t?{}:t,u=e.leading,i=e.trailing;return c(r,n,{maxWait:n,leading:void 0===u||u,trailing:void 0===i||i})}export{o as useDebounce,c as useDebouncedCallback,f as useThrottledCallback};\n//# sourceMappingURL=index.module.js.map\n","import {\n useState,\n useRef,\n MouseEventHandler,\n KeyboardEventHandler,\n Fragment,\n useEffect,\n} from \"react\";\n\nimport { Position, DraggableData } from \"react-rnd\";\n\nimport { Button } from \"./Button\";\nimport { Crosshairs } from \"./Crosshairs\";\nimport { InfoDialog } from \"./InfoDialog\";\nimport { LabelDialog } from \"./LabelDialog\";\nimport { VerifyDialog } from \"./VerifyDialog\";\nimport { BoundingBox, BoundingBoxType } from \"./BoundingBox\";\nimport { Annotation } from \"../types/Annotation\";\nimport { FalsePositive } from \"../types/FalsePositive\";\nimport { ReactZoomPanPinchRef, TransformComponent, TransformWrapper } from \"react-zoom-pan-pinch\";\nimport { useDebouncedCallback } from \"use-debounce\";\n\ninterface EditorState {\n createMode: boolean;\n drawingMode: boolean;\n showBoxes: boolean;\n drawStartX: number;\n drawStartY: number;\n selectedBox?: string;\n showLabeler: boolean;\n selectedLabel: string;\n difficult: boolean;\n height: number;\n width: number;\n showHelp: boolean;\n showVerify: boolean;\n showDelete: boolean;\n showTutorial: boolean;\n showConfirmDeleteFalsePositive: boolean;\n}\n\ninterface IImageAnnotationProps {\n annotations: Annotation[];\n suggestions: Annotation[];\n falsePositives: FalsePositive[];\n nextImage: () => void;\n save: (\n annotations: Annotation[],\n reviewedSuggestions: string[],\n deleteFalsePositive: boolean,\n verified: string[],\n ) => void;\n delete: () => void;\n back: () => void;\n imageUrl: string;\n labels: string[];\n manageLabelUrl?: string;\n verifiedLabels: string[];\n userAnnotationCount: number;\n}\n\ntype Pad = { leftPad: number; topPad: number };\n\n/**\n * A image annotation component.\n * @component\n * @params props - Component props.\n * @param props.annotations - Bounding boxes\n * @param props.save - Callback for the save button.\n */\nconst ImageAnnotator = (props: IImageAnnotationProps) => {\n const shortcuts = [\n { codes: [\"?\"], action: \"Shortcut help\" },\n { codes: [\"w\"], action: \"Add Box\" },\n { codes: [\"d\"], action: \"Mark Difficult\" },\n { codes: [\"s\"], action: \"Cycle Label\" },\n { codes: [\"Shift\", \"s\"], action: \"Previous Label\" },\n { codes: [\"Tab\"], action: \"Select Next Box\" },\n { codes: [\"Del\"], action: \"Delete Box\" },\n { codes: [\"Esc\"], action: \"Deselect/Cancel\" },\n { codes: [\"← ↑ → ↓\"], action: \"Move Box\" },\n { codes: [\"Shift\", \"← ↑ → ↓\"], action: \"Resize Box\" },\n { codes: [\"f\"], action: \"Toggle Unselected Boxes\" },\n { codes: [\"Spacebar\"], action: \"Verify and Save\" },\n ];\n\n const [bboxes, setBBoxes] = useState<Annotation[]>([]);\n\n const [fpboxes, setFPBoxes] = useState<FalsePositive[]>([]);\n\n const [state, setState] = useState<EditorState>({\n createMode: false,\n drawingMode: false,\n showBoxes: true,\n showLabeler: false,\n showHelp: false,\n showVerify: false,\n showDelete: false,\n showConfirmDeleteFalsePositive: false,\n showTutorial: props.userAnnotationCount === 0,\n drawStartX: 0,\n drawStartY: 0,\n selectedLabel: props.labels.find((l) => !(props.verifiedLabels ?? []).includes(l)) ?? props.labels[0],\n difficult: false,\n width: 1,\n height: 1,\n });\n\n const ref = useRef<HTMLImageElement>(null);\n\n const editorRef = useRef<HTMLDivElement>(null);\n\n const transformRef = useRef<ReactZoomPanPinchRef>(null);\n\n const resize = () => {\n const naturalHeight = ref.current?.naturalHeight ?? 1;\n const naturalWidth = ref.current?.naturalWidth ?? 1;\n const aspectRatio = naturalWidth/naturalHeight;\n\n const editorHeight = editorRef.current?.clientHeight ?? 0;\n const editorWidth = editorRef.current?.clientWidth ?? 0;\n\n const maxHeight = editorHeight - 5;\n const maxWidth = editorWidth - 5;\n const desiredWidth = maxHeight * aspectRatio;\n \n // if too wide when max height, then use maxWidth\n let calculatedWidth;\n let calculatedHeight;\n\n if (desiredWidth > maxWidth) {\n calculatedWidth = maxWidth;\n calculatedHeight = Math.round(maxWidth/aspectRatio);\n } else {\n calculatedWidth = desiredWidth;\n calculatedHeight = Math.round(desiredWidth/aspectRatio);\n }\n\n setState({\n ...state,\n width: calculatedWidth,\n height: calculatedHeight,\n });\n\n\n const leftPad = (calculatedWidth * 0.1) / 2;\n const topPad = (calculatedHeight * 0.1) / 2;\n\n return {leftPad, topPad};\n }\n\n const handleResize = useDebouncedCallback(() => {\n resize()\n }, 200);\n\n useEffect(() => {\n window.addEventListener('resize', handleResize);\n editorRef.current?.parentElement?.focus();\n\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [handleResize]);\n \n const onResizeStop = (\n elem: HTMLElement,\n position: Position,\n boxId: string,\n ) => {\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === boxId) {\n return {\n ...a,\n x: position.x / state.width,\n y: position.y / state.height,\n w: elem.offsetWidth / state.width,\n h: elem.offsetHeight / state.height,\n };\n }\n return a;\n }),\n );\n };\n const onDragStop = (d: DraggableData, boxId: string) => {\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === boxId) {\n return {\n ...a,\n x: d.x / state.width,\n y: d.y / state.height,\n };\n }\n return a;\n }),\n );\n };\n\n const onMouseDown: MouseEventHandler<HTMLImageElement> = (e) => {\n if (state.createMode) {\n const scale = transformRef.current?.instance.transformState.scale ?? 1;\n const bounds = ref.current?.getBoundingClientRect();\n const x =\n (e.clientX - (bounds?.left ?? 0)) / scale /\n state.width;\n const y =\n (e.clientY - (bounds?.top ?? 0)) / scale /\n state.height;\n\n setState({\n ...state,\n drawingMode: true,\n drawStartX: x,\n drawStartY: y,\n selectedBox: \"draft\",\n });\n setBBoxes((prev) => [\n ...prev,\n {\n id: \"draft\",\n x,\n y,\n w: 0.0,\n h: 0.0,\n },\n ]);\n } else {\n setState({ ...state, selectedBox: undefined });\n }\n };\n\n const onMouseUp: MouseEventHandler<HTMLImageElement> = (e) => {\n if (state.drawingMode) {\n const newId = Date.now().toString();\n setState({\n ...state,\n drawingMode: false,\n createMode: false,\n selectedBox: newId,\n });\n setBBoxes((prev) =>\n prev.reduce<Annotation[]>((out, a) => {\n if (a.id === \"draft\") {\n const scale = transformRef.current?.instance.transformState.scale ?? 1;\n const bounds = ref.current?.getBoundingClientRect();\n const x =\n (e.clientX - (bounds?.left ?? 0)) / scale /\n state.width;\n const y =\n (e.clientY - (bounds?.top ?? 0)) / scale /\n state.height;\n\n if (\n Math.min(\n Math.abs(state.drawStartX - x),\n Math.abs(state.drawStartY - y),\n ) > 0.001\n ) {\n let left = Math.min(state.drawStartX, x);\n let top = Math.min(state.drawStartY, y);\n let width = Math.abs(state.drawStartX - x);\n let height = Math.abs(state.drawStartY - y);\n if (left < 0) {\n width -= Math.abs(left);\n left = 0;\n }\n if (top < 0) {\n height -= Math.abs(top);\n top = 0;\n }\n out.push({\n ...a,\n id: newId,\n label: state.selectedLabel,\n difficult: false,\n x: left,\n y: top,\n w: Math.min(1.0 - left, width),\n h: Math.min(1.0 - top, height),\n });\n }\n } else {\n out.push(a);\n }\n return out;\n }, []),\n );\n }\n };\n\n const onMouseMove: MouseEventHandler<HTMLImageElement> = (e) => {\n if (state.drawingMode) {\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === \"draft\") {\n const scale = transformRef.current?.instance.transformState.scale ?? 1;\n const bounds = ref.current?.getBoundingClientRect();\n const x =\n (e.pageX - (bounds?.left ?? 0)) / scale /\n state.width;\n const y =\n (e.pageY - (bounds?.top ?? 0)) / scale /\n state.height;\n\n return {\n ...a,\n x: Math.min(state.drawStartX, x),\n y: Math.min(state.drawStartY, y),\n w: Math.abs(state.drawStartX - x),\n h: Math.abs(state.drawStartY - y),\n };\n }\n return a;\n }),\n );\n }\n };\n\n const clickCreate: MouseEventHandler<HTMLButtonElement> = () => {\n setState({ ...state, createMode: !state.createMode });\n };\n\n const onClickBBox = (boxId: string) => {\n const selectedBox = bboxes.find((b) => b.id === boxId);\n setState({\n ...state,\n selectedBox: boxId,\n selectedLabel: selectedBox?.label ?? state.selectedLabel,\n difficult: selectedBox?.difficult ?? state.difficult,\n });\n };\n\n const moveBox = (boxId: string, vertical: number, horizontal: number) => {\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === boxId) {\n return {\n ...a,\n x: Math.min(\n 1.0 - a.w,\n Math.max(0.0, a.x + horizontal / state.width),\n ),\n y: Math.min(\n 1.0 - a.h,\n Math.max(0.0, a.y + vertical / state.height),\n ),\n };\n }\n return a;\n }),\n );\n };\n\n const resizeBox = (boxId: string, vertical: number, horizontal: number) => {\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === boxId) {\n return {\n ...a,\n w: Math.min(1.0 - a.x, a.w + horizontal / state.width),\n h: Math.min(1.0 - a.y, a.h + vertical / state.height),\n };\n }\n return a;\n }),\n );\n };\n\n const toggleDifficult = (boxId: string) => {\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === boxId) {\n return {\n ...a,\n difficult: !a.difficult,\n };\n }\n return a;\n }),\n );\n };\n\n const cycleLabel = (boxId: string, reverse = false) => {\n const currentLabelIndex = props.labels.findIndex(\n (label) => state.selectedLabel === label,\n );\n const lastIndex = props.labels.length - 1;\n\n let newIndex = 0;\n if (reverse) {\n newIndex = currentLabelIndex === 0 ? lastIndex : currentLabelIndex - 1;\n } else {\n newIndex = currentLabelIndex === lastIndex ? 0 : currentLabelIndex + 1;\n }\n const newLabel = props.labels[newIndex];\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === boxId) {\n return {\n ...a,\n label: newLabel,\n };\n }\n return a;\n }),\n );\n setState({ ...state, selectedLabel: newLabel });\n };\n\n const deleteBox = (boxId: string) => {\n setBBoxes((prev) => prev.filter((a) => a.id !== boxId));\n };\n\n const deleteFP = (boxId: string) => {\n setFPBoxes((prev) => prev.filter((a) => a.id !== boxId));\n };\n\n const getFPLabel = (boxId: string) => {\n return fpboxes.find((box) => box.id === boxId)?.label;\n };\n\n const getBox = (boxId: string) => {\n return bboxes.find((box) => box.id === boxId);\n };\n\n const nextBox = (boxId?: string) => {\n if (!boxId) {\n return bboxes[0].id;\n }\n const currentIndex = bboxes.findIndex((box) => box.id === boxId);\n if (currentIndex === bboxes.length - 1) {\n return bboxes[0].id;\n } else {\n return bboxes[currentIndex + 1].id;\n }\n };\n\n const stepSize = 5 / (transformRef.current?.instance.transformState.scale ?? 1);\n const onKeyDown: KeyboardEventHandler<HTMLDivElement> = (e) => {\n if (e.code === \"Escape\") {\n if (state.createMode) {\n setState({ ...state, createMode: false });\n } else {\n setState({ ...state, selectedBox: undefined });\n }\n }\n if (e.code === \"KeyW\") {\n if (!state.createMode) {\n setState({ ...state, createMode: true, selectedBox: undefined });\n } else {\n setState({ ...state, createMode: false });\n }\n }\n if (e.code === \"KeyF\") {\n setState({ ...state, showBoxes: !state.showBoxes });\n }\n if (e.code === \"KeyD\") {\n if (state.selectedBox) {\n toggleDifficult(state.selectedBox);\n }\n }\n if (e.code === \"KeyS\") {\n if (state.selectedBox) {\n cycleLabel(state.selectedBox, e.shiftKey);\n }\n }\n if (e.code === \"Delete\" && state.selectedBox) {\n deleteBox(state.selectedBox);\n setState({ ...state, selectedBox: undefined });\n }\n if (e.code === \"Tab\") {\n const next = nextBox(state.selectedBox);\n const box = getBox(next);\n setState({\n ...state,\n selectedBox: next,\n selectedLabel: box?.label ?? state.selectedLabel,\n });\n e.preventDefault();\n }\n if (e.code === \"Space\") {\n save(true);\n }\n if (e.code === \"Slash\" && e.shiftKey) {\n setState({ ...state, showHelp: true });\n }\n if (state.selectedBox) {\n if (e.code === \"ArrowLeft\") {\n if (e.shiftKey) {\n resizeBox(state.selectedBox, 0, -stepSize);\n } else {\n moveBox(state.selectedBox, 0, -stepSize);\n }\n }\n if (e.code === \"ArrowRight\") {\n if (e.shiftKey) {\n resizeBox(state.selectedBox, 0, stepSize);\n } else {\n moveBox(state.selectedBox, 0, stepSize);\n }\n }\n if (e.code === \"ArrowUp\") {\n if (e.shiftKey) {\n resizeBox(state.selectedBox, -stepSize, 0);\n } else {\n moveBox(state.selectedBox, -stepSize, 0);\n }\n }\n if (e.code === \"ArrowDown\") {\n if (e.shiftKey) {\n resizeBox(state.selectedBox, stepSize, 0);\n } else {\n moveBox(state.selectedBox, stepSize, 0);\n }\n }\n }\n };\n\n const onLoad = (_e: React.SyntheticEvent<HTMLImageElement>): Pad => {\n const pad = resize();\n\n setBBoxes(\n props.annotations\n .concat(props.suggestions)\n .sort((a, b) => b.w * b.h - a.w * a.h),\n );\n setFPBoxes(props.falsePositives.sort((a, b) => b.w * b.h - a.w * a.h));\n\n return pad\n };\n\n const onSaveLabel: MouseEventHandler<HTMLButtonElement> = () => {\n setState({ ...state, showLabeler: false });\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === state.selectedBox) {\n return {\n ...a,\n label: state.selectedLabel,\n difficult: state.difficult,\n };\n }\n return a;\n }),\n );\n };\n\n const onCancelLabel = () => {\n setState({ ...state, showLabeler: false });\n setBBoxes((prev) => prev.filter((a) => a.label));\n };\n \n const save = (verified: boolean) => {\n props.save(bboxes, props.suggestions.map((s) => s.id), fpboxes.length === 0, verified ? props.labels : []);\n }\n\n const defaultZIndex = state.showBoxes ? 0 : -1;\n\n return (\n <>\n <TransformWrapper ref={transformRef} disabled={state.createMode || state.drawingMode} minScale={0.9}>\n {({ zoomIn, zoomOut, setTransform }) => (\n <div\n className=\"flex h-screen min-w-[600px] flex-col bg-slate-900\"\n onKeyDown={onKeyDown}\n tabIndex={0}\n >\n <div className=\"flex flex-initial bg-slate-300 p-1\">\n <div className=\"flex-initial\">\n <button type=\"button\" onClick={props.back}>\n <Button secondary sm>\n Back\n </Button>\n </button>\n </div>\n <div className=\"flex flex-auto justify-center\">\n <button\n type=\"button\"\n onClick={() => {\n zoomOut();\n }}\n >\n <Button>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"h-6 w-6\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n d=\"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM13 10H7\"\n />\n </svg>\n </Button>\n </button>\n <button\n type=\"button\"\n onClick={() => {\n zoomIn();\n }}\n >\n <Button>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"h-6 w-6\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n d=\"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7\"\n />\n </svg>\n </Button>\n </button>\n <button type=\"button\" onClick={clickCreate}>\n <Button secondary sm>\n Add (w)\n </Button>\n </button>\n </div>\n <div className=\"flex-initial\">\n <button\n onClick={() => {\n setState({ ...state, showVerify: true });\n }}\n >\n <Button sm>Verify & Save</Button>\n </button>\n <button\n onClick={() => {\n save(false);\n }}\n >\n <Button green sm>\n Save\n </Button>\n </button>\n <button\n onClick={() => {\n setState({ ...state, showDelete: true });\n }}\n >\n <Button red sm>\n Delete\n </Button>\n </button>\n <button\n onClick={() => {\n setState({ ...state, showHelp: true });\n }}\n >\n <Button sm secondary>\n ?\n </Button>\n </button>\n </div>\n </div>\n <div\n ref={editorRef}\n className=\"grid flex-auto place-content-center\"\n >\n <TransformComponent>\n <div\n className=\"grid place-content-center\"\n onMouseDown={onMouseDown}\n onMouseUp={onMouseUp}\n onMouseMove={onMouseMove}\n >\n <img\n ref={ref}\n className=\"col-start-1 row-start-1 h-full w-full\"\n alt=\"annotate\"\n src={props.imageUrl}\n onLoad={(e) => {\n const pad = onLoad(e);\n setTransform(pad.leftPad, pad.topPad, 0.9, 0)\n }}\n style={{\n width: state.width,\n height: state.height,\n }}\n />\n {fpboxes.map((box) => (\n <BoundingBox\n type={BoundingBoxType.falsePositive}\n label={box.label ?? \"\"}\n key={box.id}\n zIndex={box.id === state.selectedBox ? 1 : defaultZIndex}\n x={box.x * state.width}\n y={box.y * state.height}\n w={box.w * state.width}\n h={box.h * state.height}\n initialScale={transformRef.current?.instance.transformState.scale}\n selected={box.id === state.selectedBox}\n onMouseDown={(e: { stopPropagation: () => void }) => {\n if (!state.createMode) {\n onClickBBox(box.id);\n e.stopPropagation();\n }\n }}\n onClickDelete={() => {\n setState({\n ...state,\n showConfirmDeleteFalsePositive: true,\n });\n }}\n />\n ))}\n {bboxes.map((box) => (\n <BoundingBox\n type={\n box.suggestion\n ? BoundingBoxType.suggestion\n : BoundingBoxType.truePositive\n }\n label={box.label ?? \"\"}\n difficult={box.difficult}\n key={box.id}\n zIndex={box.id === state.selectedBox ? 1 : defaultZIndex}\n x={box.x * state.width}\n y={box.y * state.height}\n w={box.w * state.width}\n h={box.h * state.height}\n initialScale={transformRef.current?.instance.transformState.scale}\n selected={box.id === state.selectedBox}\n onMouseDown={(e: { stopPropagation: () => void }) => {\n if (!state.createMode) {\n onClickBBox(box.id);\n e.stopPropagation();\n }\n }}\n onDragStop={(_e, d) => {\n onDragStop(d, box.id);\n }}\n onResizeStop={(_e, _d, r: HTMLElement, _delta, p) => {\n onResizeStop(r, p, box.id);\n }}\n onClickDelete={() => {\n deleteBox(box.id);\n }}\n onClickEdit={() => {\n setState({ ...state, showLabeler: true });\n }}\n />\n ))}\n <Crosshairs\n className={`col-start-1 row-start-1 ${(state.createMode && !state.drawingMode) ? 'z-10' : '-z-10'}`}\n show={state.createMode && !state.drawingMode}\n />\n </div>\n </TransformComponent>\n </div>\n </div>\n )}\n </TransformWrapper>\n <LabelDialog\n title=\"Annotate\"\n show={state.showLabeler}\n cancelText=\"Cancel\"\n button={\n <button type=\"button\" onClick={onSaveLabel}>\n <Button sm green>\n Save\n </Button>\n </button>\n }\n handleCancel={onCancelLabel}\n >\n <div className=\"my-2 grid grid-cols-1 gap-y-2\">\n <div>\n <select\n className=\"w-full rounded-md border-gray-300 shadow-sm focus:border-primary-300 focus:ring focus:ring-primary-200 focus:ring-opacity-50\"\n value={state.selectedLabel}\n onChange={(e) => {\n setState({ ...state, selectedLabel: e.target.value });\n }}\n >\n {props.labels.map((o) => (\n <option key={o} value={o}>\n {o}\n </option>\n ))}\n </select>\n\n {props.manageLabelUrl && (\n <a className=\"text-primary-500 hover:text-primary-600 underline text-sm\" href={props.manageLabelUrl} target=\"_blank\">Manage Label Options</a>\n )}\n </div>\n <div className=\"flex items-center\">\n <input\n id=\"difficult\"\n className=\"border-gray-300 text-primary-600 shadow-sm hover:border-gray-300 focus:border-primary-300 focus:ring focus:ring-primary-200 focus:ring-opacity-50 focus:ring-offset-0 rounded\"\n type=\"checkbox\"\n checked={state.difficult}\n onChange={(e) => {\n setState({ ...state, difficult: e.target.checked });\n }}\n />\n <label htmlFor=\"difficult\" className=\"ml-2\">\n Difficult?\n </label>\n </div>\n </div>\n </LabelDialog>\n <InfoDialog\n title=\"Keyboard shortcuts\"\n show={state.showHelp}\n handleClose={() => {\n setState({ ...state, showHelp: false });\n }}\n >\n <div className=\"grid w-full grid-cols-2 place-content-center gap-2 p-5\">\n {shortcuts.map((s) => (\n <Fragment key={s.action}>\n <div>{s.action}</div>\n <div className=\"justify-self-end\">\n {s.codes\n .map<React.ReactNode>((c) => (\n <span\n key={c}\n className=\"rounded-md bg-slate-100 p-1 font-mono text-xs shadow-inner\"\n >\n {c}\n </span>\n ))\n .reduce((prev, curr) => [prev, \" + \", curr])}\n </div>\n </Fragment>\n ))}\n </div>\n </InfoDialog>\n <VerifyDialog\n title=\"Are all of the objects in this image labeled?\"\n description=\" \"\n maxWidthClass=\"max-w-lg\"\n handleCancel={() => {\n setState({ ...state, showVerify: false });\n }}\n show={state.showVerify}\n cancelText=\"Cancel\"\n button={\n <button\n type=\"button\"\n onClick={() => {\n save(true);\n setState({ ...state, showVerify: false });\n }}\n >\n <Button sm green>\n Yes, all objects are labeled\n </Button>\n </button>\n }\n >\n <div className=\"flex flex-wrap\">\n {props.labels.map((o) => (\n <div className=\"font-mono m-1 bg-slate-200 p-1 rounded-md\" key={o}>{o}</div>\n ))}\n </div>\n </VerifyDialog>\n <VerifyDialog\n title=\"Are you sure you want to delete this image?\"\n description=\"\"\n handleCancel={() => {\n setState({ ...state, showDelete: false });\n }}\n show={state.showDelete}\n cancelText=\"Cancel\"\n button={\n <button\n type=\"button\"\n onClick={() => {\n props.delete();\n setState({ ...state, showDelete: false });\n }}\n >\n <Button sm red>\n Yes, permanently delete\n </Button>\n </button>\n }\n >\n This cannot be undone.\n </VerifyDialog>\n <VerifyDialog\n title=\"Are you sure you want to delete this reported false positive?\"\n description=\" \"\n maxWidthClass=\"max-w-xl\"\n handleCancel={() => {\n setState({ ...state, showConfirmDeleteFalsePositive: false });\n }}\n show={state.showConfirmDeleteFalsePositive}\n cancelText=\"Cancel\"\n button={\n <button\n type=\"button\"\n onClick={() => {\n if (state.selectedBox) {\n deleteFP(state.selectedBox);\n }\n setState({\n ...state,\n showConfirmDeleteFalsePositive: false,\n selectedBox: undefined,\n });\n }}\n >\n <Button sm red>\n Do not teach my model that this is not a{\" \"}\n {state.selectedBox ? getFPLabel(state.selectedBox) : \" \"}\n </Button>\n </button>\n }\n >\n <p>\n False positives submitted from Frigate are used to improve your model\n and should not be deleted unless you submitted them accidentally.\n </p>\n </VerifyDialog>\n </>\n );\n};\n\nexport { ImageAnnotator };\n"],"names":["c","e","u","i","a","r","o","f","l","v","m","d","g","p","w","s","x","h","y","F","n","A","t","ImageAnnotator","props","shortcuts","bboxes","setBBoxes","useState","fpboxes","setFPBoxes","state","setState","ref","useRef","editorRef","transformRef","resize","naturalHeight","_a","aspectRatio","_b","editorHeight","_c","editorWidth","_d","maxHeight","maxWidth","desiredWidth","calculatedWidth","calculatedHeight","leftPad","topPad","handleResize","useDebouncedCallback","useEffect","onResizeStop","elem","position","boxId","prev","onDragStop","onMouseDown","scale","bounds","onMouseUp","newId","out","left","top","width","height","onMouseMove","clickCreate","onClickBBox","selectedBox","b","moveBox","vertical","horizontal","resizeBox","toggleDifficult","cycleLabel","reverse","currentLabelIndex","label","lastIndex","newIndex","newLabel","deleteBox","deleteFP","getFPLabel","box","getBox","nextBox","currentIndex","stepSize","onKeyDown","next","save","onLoad","_e","pad","onSaveLabel","onCancelLabel","verified","defaultZIndex","jsxs","Fragment","jsx","TransformWrapper","zoomIn","zoomOut","setTransform","Button","TransformComponent","BoundingBox","BoundingBoxType","_delta","Crosshairs","LabelDialog","InfoDialog","curr","VerifyDialog"],"mappings":";;;;;;;;;AAA4F,SAASA,GAAEC,GAAEC,GAAEF,GAAE;AAAC,MAAIG,IAAE,MAAKC,IAAEC,EAAE,IAAI,GAAEC,IAAED,EAAE,CAAC,GAAEE,IAAEF,EAAE,IAAI,GAAEG,IAAEH,EAAE,EAAE,GAAEI,IAAEJ,EAAG,GAACK,IAAEL,KAAIM,IAAEN,EAAEJ,C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AGH,0IAAA,CAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"ImageAnnotator.js","sources":["../../node_modules/use-debounce/dist/index.module.js","../../src/components/ImageAnnotator.tsx"],"sourcesContent":["import{useRef as r,useEffect as n,useMemo as t,useReducer as e,useCallback as u}from\"react\";function c(e,u,c){var i=this,a=r(null),o=r(0),f=r(null),l=r([]),v=r(),m=r(),d=r(e),g=r(!0);d.current=e;var p=\"undefined\"!=typeof window,w=!u&&0!==u&&p;if(\"function\"!=typeof e)throw new TypeError(\"Expected a function\");u=+u||0;var s=!!(c=c||{}).leading,x=!(\"trailing\"in c)||!!c.trailing,h=\"maxWait\"in c,y=\"debounceOnServer\"in c&&!!c.debounceOnServer,F=h?Math.max(+c.maxWait||0,u):null;n(function(){return g.current=!0,function(){g.current=!1}},[]);var A=t(function(){var r=function(r){var n=l.current,t=v.current;return l.current=v.current=null,o.current=r,m.current=d.current.apply(t,n)},n=function(r,n){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(r):setTimeout(r,n)},t=function(r){if(!g.current)return!1;var n=r-a.current;return!a.current||n>=u||n<0||h&&r-o.current>=F},e=function(n){return f.current=null,x&&l.current?r(n):(l.current=v.current=null,m.current)},c=function r(){var c=Date.now();if(t(c))return e(c);if(g.current){var i=u-(c-a.current),f=h?Math.min(i,F-(c-o.current)):i;n(r,f)}},A=function(){if(p||y){var e=Date.now(),d=t(e);if(l.current=[].slice.call(arguments),v.current=i,a.current=e,d){if(!f.current&&g.current)return o.current=a.current,n(c,u),s?r(a.current):m.current;if(h)return n(c,u),r(a.current)}return f.current||n(c,u),m.current}};return A.cancel=function(){f.current&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=v.current=f.current=null},A.isPending=function(){return!!f.current},A.flush=function(){return f.current?e(Date.now()):m.current},A},[s,h,u,F,x,w,p,y]);return A}function i(r,n){return r===n}function a(r,n){return n}function o(n,t,o){var f=o&&o.equalityFn||i,l=e(a,n),v=l[0],m=l[1],d=c(u(function(r){return m(r)},[m]),t,o),g=r(n);return f(g.current,n)||(d(n),g.current=n),[v,d]}function f(r,n,t){var e=void 0===t?{}:t,u=e.leading,i=e.trailing;return c(r,n,{maxWait:n,leading:void 0===u||u,trailing:void 0===i||i})}export{o as useDebounce,c as useDebouncedCallback,f as useThrottledCallback};\n//# sourceMappingURL=index.module.js.map\n","import {\n useState,\n useRef,\n MouseEventHandler,\n KeyboardEventHandler,\n Fragment,\n useEffect,\n} from \"react\";\n\nimport { Position, DraggableData } from \"react-rnd\";\n\nimport { Button } from \"./Button\";\nimport { Crosshairs } from \"./Crosshairs\";\nimport { InfoDialog } from \"./InfoDialog\";\nimport { LabelDialog } from \"./LabelDialog\";\nimport { VerifyDialog } from \"./VerifyDialog\";\nimport { BoundingBox, BoundingBoxType } from \"./BoundingBox\";\nimport { Annotation } from \"../types/Annotation\";\nimport { FalsePositive } from \"../types/FalsePositive\";\nimport { ReactZoomPanPinchRef, TransformComponent, TransformWrapper } from \"react-zoom-pan-pinch\";\nimport { useDebouncedCallback } from \"use-debounce\";\n\ninterface EditorState {\n createMode: boolean;\n drawingMode: boolean;\n showBoxes: boolean;\n drawStartX: number;\n drawStartY: number;\n selectedBox?: string;\n showLabeler: boolean;\n selectedLabel: string;\n difficult: boolean;\n height: number;\n width: number;\n showHelp: boolean;\n showVerify: boolean;\n showDelete: boolean;\n showTutorial: boolean;\n showConfirmDeleteFalsePositive: boolean;\n}\n\ninterface IImageAnnotationProps {\n annotations: Annotation[];\n suggestions: Annotation[];\n falsePositives: FalsePositive[];\n nextImage: () => void;\n save: (\n annotations: Annotation[],\n reviewedSuggestions: string[],\n deleteFalsePositive: boolean,\n verified: string[],\n ) => void;\n delete: () => void;\n back: () => void;\n imageUrl: string;\n labels: string[];\n manageLabelUrl?: string;\n verifiedLabels: string[];\n userAnnotationCount: number;\n}\n\ntype Pad = { leftPad: number; topPad: number };\n\n/**\n * A image annotation component.\n * @component\n * @params props - Component props.\n * @param props.annotations - Bounding boxes\n * @param props.save - Callback for the save button.\n */\nconst ImageAnnotator = (props: IImageAnnotationProps) => {\n const shortcuts = [\n { codes: [\"?\"], action: \"Shortcut help\" },\n { codes: [\"w\"], action: \"Add Box\" },\n { codes: [\"d\"], action: \"Mark Difficult\" },\n { codes: [\"s\"], action: \"Cycle Label\" },\n { codes: [\"Shift\", \"s\"], action: \"Previous Label\" },\n { codes: [\"Tab\"], action: \"Select Next Box\" },\n { codes: [\"Del\"], action: \"Delete Box\" },\n { codes: [\"Esc\"], action: \"Deselect/Cancel\" },\n { codes: [\"← ↑ → ↓\"], action: \"Move Box\" },\n { codes: [\"Shift\", \"← ↑ → ↓\"], action: \"Resize Box\" },\n { codes: [\"f\"], action: \"Toggle Unselected Boxes\" },\n { codes: [\"Spacebar\"], action: \"Verify and Save\" },\n ];\n\n const [bboxes, setBBoxes] = useState<Annotation[]>([]);\n\n const [fpboxes, setFPBoxes] = useState<FalsePositive[]>([]);\n\n // bboxes and fpboxes are only copied from props once the image fires onLoad.\n // Saving before that sends empty lists, which wipes the image's annotations\n // and false positives, so saves are refused until the image has loaded.\n const [imageLoaded, setImageLoaded] = useState(false);\n\n const [state, setState] = useState<EditorState>({\n createMode: false,\n drawingMode: false,\n showBoxes: true,\n showLabeler: false,\n showHelp: false,\n showVerify: false,\n showDelete: false,\n showConfirmDeleteFalsePositive: false,\n showTutorial: props.userAnnotationCount === 0,\n drawStartX: 0,\n drawStartY: 0,\n selectedLabel: props.labels.find((l) => !(props.verifiedLabels ?? []).includes(l)) ?? props.labels[0],\n difficult: false,\n width: 1,\n height: 1,\n });\n\n const ref = useRef<HTMLImageElement>(null);\n\n const editorRef = useRef<HTMLDivElement>(null);\n\n const transformRef = useRef<ReactZoomPanPinchRef>(null);\n\n const resize = () => {\n const naturalHeight = ref.current?.naturalHeight ?? 1;\n const naturalWidth = ref.current?.naturalWidth ?? 1;\n const aspectRatio = naturalWidth/naturalHeight;\n\n const editorHeight = editorRef.current?.clientHeight ?? 0;\n const editorWidth = editorRef.current?.clientWidth ?? 0;\n\n const maxHeight = editorHeight - 5;\n const maxWidth = editorWidth - 5;\n const desiredWidth = maxHeight * aspectRatio;\n \n // if too wide when max height, then use maxWidth\n let calculatedWidth;\n let calculatedHeight;\n\n if (desiredWidth > maxWidth) {\n calculatedWidth = maxWidth;\n calculatedHeight = Math.round(maxWidth/aspectRatio);\n } else {\n calculatedWidth = desiredWidth;\n calculatedHeight = Math.round(desiredWidth/aspectRatio);\n }\n\n setState({\n ...state,\n width: calculatedWidth,\n height: calculatedHeight,\n });\n\n\n const leftPad = (calculatedWidth * 0.1) / 2;\n const topPad = (calculatedHeight * 0.1) / 2;\n\n return {leftPad, topPad};\n }\n\n const handleResize = useDebouncedCallback(() => {\n resize()\n }, 200);\n\n useEffect(() => {\n window.addEventListener('resize', handleResize);\n editorRef.current?.parentElement?.focus();\n\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [handleResize]);\n\n useEffect(() => {\n setImageLoaded(false);\n }, [props.imageUrl]);\n\n const onResizeStop = (\n elem: HTMLElement,\n position: Position,\n boxId: string,\n ) => {\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === boxId) {\n return {\n ...a,\n x: position.x / state.width,\n y: position.y / state.height,\n w: elem.offsetWidth / state.width,\n h: elem.offsetHeight / state.height,\n };\n }\n return a;\n }),\n );\n };\n const onDragStop = (d: DraggableData, boxId: string) => {\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === boxId) {\n return {\n ...a,\n x: d.x / state.width,\n y: d.y / state.height,\n };\n }\n return a;\n }),\n );\n };\n\n const onMouseDown: MouseEventHandler<HTMLImageElement> = (e) => {\n if (state.createMode) {\n const scale = transformRef.current?.instance.transformState.scale ?? 1;\n const bounds = ref.current?.getBoundingClientRect();\n const x =\n (e.clientX - (bounds?.left ?? 0)) / scale /\n state.width;\n const y =\n (e.clientY - (bounds?.top ?? 0)) / scale /\n state.height;\n\n setState({\n ...state,\n drawingMode: true,\n drawStartX: x,\n drawStartY: y,\n selectedBox: \"draft\",\n });\n setBBoxes((prev) => [\n ...prev,\n {\n id: \"draft\",\n x,\n y,\n w: 0.0,\n h: 0.0,\n },\n ]);\n } else {\n setState({ ...state, selectedBox: undefined });\n }\n };\n\n const onMouseUp: MouseEventHandler<HTMLImageElement> = (e) => {\n if (state.drawingMode) {\n const newId = Date.now().toString();\n setState({\n ...state,\n drawingMode: false,\n createMode: false,\n selectedBox: newId,\n });\n setBBoxes((prev) =>\n prev.reduce<Annotation[]>((out, a) => {\n if (a.id === \"draft\") {\n const scale = transformRef.current?.instance.transformState.scale ?? 1;\n const bounds = ref.current?.getBoundingClientRect();\n const x =\n (e.clientX - (bounds?.left ?? 0)) / scale /\n state.width;\n const y =\n (e.clientY - (bounds?.top ?? 0)) / scale /\n state.height;\n\n if (\n Math.min(\n Math.abs(state.drawStartX - x),\n Math.abs(state.drawStartY - y),\n ) > 0.001\n ) {\n let left = Math.min(state.drawStartX, x);\n let top = Math.min(state.drawStartY, y);\n let width = Math.abs(state.drawStartX - x);\n let height = Math.abs(state.drawStartY - y);\n if (left < 0) {\n width -= Math.abs(left);\n left = 0;\n }\n if (top < 0) {\n height -= Math.abs(top);\n top = 0;\n }\n out.push({\n ...a,\n id: newId,\n label: state.selectedLabel,\n difficult: false,\n x: left,\n y: top,\n w: Math.min(1.0 - left, width),\n h: Math.min(1.0 - top, height),\n });\n }\n } else {\n out.push(a);\n }\n return out;\n }, []),\n );\n }\n };\n\n const onMouseMove: MouseEventHandler<HTMLImageElement> = (e) => {\n if (state.drawingMode) {\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === \"draft\") {\n const scale = transformRef.current?.instance.transformState.scale ?? 1;\n const bounds = ref.current?.getBoundingClientRect();\n const x =\n (e.pageX - (bounds?.left ?? 0)) / scale /\n state.width;\n const y =\n (e.pageY - (bounds?.top ?? 0)) / scale /\n state.height;\n\n return {\n ...a,\n x: Math.min(state.drawStartX, x),\n y: Math.min(state.drawStartY, y),\n w: Math.abs(state.drawStartX - x),\n h: Math.abs(state.drawStartY - y),\n };\n }\n return a;\n }),\n );\n }\n };\n\n const clickCreate: MouseEventHandler<HTMLButtonElement> = () => {\n setState({ ...state, createMode: !state.createMode });\n };\n\n const onClickBBox = (boxId: string) => {\n const selectedBox = bboxes.find((b) => b.id === boxId);\n setState({\n ...state,\n selectedBox: boxId,\n selectedLabel: selectedBox?.label ?? state.selectedLabel,\n difficult: selectedBox?.difficult ?? state.difficult,\n });\n };\n\n const moveBox = (boxId: string, vertical: number, horizontal: number) => {\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === boxId) {\n return {\n ...a,\n x: Math.min(\n 1.0 - a.w,\n Math.max(0.0, a.x + horizontal / state.width),\n ),\n y: Math.min(\n 1.0 - a.h,\n Math.max(0.0, a.y + vertical / state.height),\n ),\n };\n }\n return a;\n }),\n );\n };\n\n const resizeBox = (boxId: string, vertical: number, horizontal: number) => {\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === boxId) {\n return {\n ...a,\n w: Math.min(1.0 - a.x, a.w + horizontal / state.width),\n h: Math.min(1.0 - a.y, a.h + vertical / state.height),\n };\n }\n return a;\n }),\n );\n };\n\n const toggleDifficult = (boxId: string) => {\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === boxId) {\n return {\n ...a,\n difficult: !a.difficult,\n };\n }\n return a;\n }),\n );\n };\n\n const cycleLabel = (boxId: string, reverse = false) => {\n const currentLabelIndex = props.labels.findIndex(\n (label) => state.selectedLabel === label,\n );\n const lastIndex = props.labels.length - 1;\n\n let newIndex = 0;\n if (reverse) {\n newIndex = currentLabelIndex === 0 ? lastIndex : currentLabelIndex - 1;\n } else {\n newIndex = currentLabelIndex === lastIndex ? 0 : currentLabelIndex + 1;\n }\n const newLabel = props.labels[newIndex];\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === boxId) {\n return {\n ...a,\n label: newLabel,\n };\n }\n return a;\n }),\n );\n setState({ ...state, selectedLabel: newLabel });\n };\n\n const deleteBox = (boxId: string) => {\n setBBoxes((prev) => prev.filter((a) => a.id !== boxId));\n };\n\n const deleteFP = (boxId: string) => {\n setFPBoxes((prev) => prev.filter((a) => a.id !== boxId));\n };\n\n const getFPLabel = (boxId: string) => {\n return fpboxes.find((box) => box.id === boxId)?.label;\n };\n\n const getBox = (boxId: string) => {\n return bboxes.find((box) => box.id === boxId);\n };\n\n const nextBox = (boxId?: string) => {\n if (!boxId) {\n return bboxes[0].id;\n }\n const currentIndex = bboxes.findIndex((box) => box.id === boxId);\n if (currentIndex === bboxes.length - 1) {\n return bboxes[0].id;\n } else {\n return bboxes[currentIndex + 1].id;\n }\n };\n\n const stepSize = 5 / (transformRef.current?.instance.transformState.scale ?? 1);\n const onKeyDown: KeyboardEventHandler<HTMLDivElement> = (e) => {\n if (e.code === \"Escape\") {\n if (state.createMode) {\n setState({ ...state, createMode: false });\n } else {\n setState({ ...state, selectedBox: undefined });\n }\n }\n if (e.code === \"KeyW\") {\n if (!state.createMode) {\n setState({ ...state, createMode: true, selectedBox: undefined });\n } else {\n setState({ ...state, createMode: false });\n }\n }\n if (e.code === \"KeyF\") {\n setState({ ...state, showBoxes: !state.showBoxes });\n }\n if (e.code === \"KeyD\") {\n if (state.selectedBox) {\n toggleDifficult(state.selectedBox);\n }\n }\n if (e.code === \"KeyS\") {\n if (state.selectedBox) {\n cycleLabel(state.selectedBox, e.shiftKey);\n }\n }\n if (e.code === \"Delete\" && state.selectedBox) {\n deleteBox(state.selectedBox);\n setState({ ...state, selectedBox: undefined });\n }\n if (e.code === \"Tab\") {\n const next = nextBox(state.selectedBox);\n const box = getBox(next);\n setState({\n ...state,\n selectedBox: next,\n selectedLabel: box?.label ?? state.selectedLabel,\n });\n e.preventDefault();\n }\n if (e.code === \"Space\") {\n save(true);\n }\n if (e.code === \"Slash\" && e.shiftKey) {\n setState({ ...state, showHelp: true });\n }\n if (state.selectedBox) {\n if (e.code === \"ArrowLeft\") {\n if (e.shiftKey) {\n resizeBox(state.selectedBox, 0, -stepSize);\n } else {\n moveBox(state.selectedBox, 0, -stepSize);\n }\n }\n if (e.code === \"ArrowRight\") {\n if (e.shiftKey) {\n resizeBox(state.selectedBox, 0, stepSize);\n } else {\n moveBox(state.selectedBox, 0, stepSize);\n }\n }\n if (e.code === \"ArrowUp\") {\n if (e.shiftKey) {\n resizeBox(state.selectedBox, -stepSize, 0);\n } else {\n moveBox(state.selectedBox, -stepSize, 0);\n }\n }\n if (e.code === \"ArrowDown\") {\n if (e.shiftKey) {\n resizeBox(state.selectedBox, stepSize, 0);\n } else {\n moveBox(state.selectedBox, stepSize, 0);\n }\n }\n }\n };\n\n const onLoad = (_e: React.SyntheticEvent<HTMLImageElement>): Pad => {\n const pad = resize();\n\n setBBoxes(\n props.annotations\n .concat(props.suggestions)\n .sort((a, b) => b.w * b.h - a.w * a.h),\n );\n setFPBoxes(props.falsePositives.sort((a, b) => b.w * b.h - a.w * a.h));\n setImageLoaded(true);\n\n return pad\n };\n\n const onSaveLabel: MouseEventHandler<HTMLButtonElement> = () => {\n setState({ ...state, showLabeler: false });\n setBBoxes((prev) =>\n prev.map((a) => {\n if (a.id === state.selectedBox) {\n return {\n ...a,\n label: state.selectedLabel,\n difficult: state.difficult,\n };\n }\n return a;\n }),\n );\n };\n\n const onCancelLabel = () => {\n setState({ ...state, showLabeler: false });\n setBBoxes((prev) => prev.filter((a) => a.label));\n };\n \n const save = (verified: boolean) => {\n if (!imageLoaded) {\n return;\n }\n props.save(bboxes, props.suggestions.map((s) => s.id), fpboxes.length === 0, verified ? props.labels : []);\n }\n\n const defaultZIndex = state.showBoxes ? 0 : -1;\n\n return (\n <>\n <TransformWrapper ref={transformRef} disabled={state.createMode || state.drawingMode} minScale={0.9}>\n {({ zoomIn, zoomOut, setTransform }) => (\n <div\n className=\"flex h-screen min-w-[600px] flex-col bg-slate-900\"\n onKeyDown={onKeyDown}\n tabIndex={0}\n >\n <div className=\"flex flex-initial bg-slate-300 p-1\">\n <div className=\"flex-initial\">\n <button type=\"button\" onClick={props.back}>\n <Button secondary sm>\n Back\n </Button>\n </button>\n </div>\n <div className=\"flex flex-auto justify-center\">\n <button\n type=\"button\"\n onClick={() => {\n zoomOut();\n }}\n >\n <Button>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"h-6 w-6\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n d=\"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM13 10H7\"\n />\n </svg>\n </Button>\n </button>\n <button\n type=\"button\"\n onClick={() => {\n zoomIn();\n }}\n >\n <Button>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"h-6 w-6\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n d=\"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7\"\n />\n </svg>\n </Button>\n </button>\n <button type=\"button\" onClick={clickCreate}>\n <Button secondary sm>\n Add (w)\n </Button>\n </button>\n </div>\n <div className=\"flex-initial\">\n <button\n disabled={!imageLoaded}\n title={imageLoaded ? undefined : 'Waiting for the image to load'}\n onClick={() => {\n setState({ ...state, showVerify: true });\n }}\n >\n <Button sm disabled={!imageLoaded}>\n Verify & Save\n </Button>\n </button>\n <button\n disabled={!imageLoaded}\n title={imageLoaded ? undefined : 'Waiting for the image to load'}\n onClick={() => {\n save(false);\n }}\n >\n <Button green sm disabled={!imageLoaded}>\n Save\n </Button>\n </button>\n <button\n onClick={() => {\n setState({ ...state, showDelete: true });\n }}\n >\n <Button red sm>\n Delete\n </Button>\n </button>\n <button\n onClick={() => {\n setState({ ...state, showHelp: true });\n }}\n >\n <Button sm secondary>\n ?\n </Button>\n </button>\n </div>\n </div>\n <div\n ref={editorRef}\n className=\"grid flex-auto place-content-center\"\n >\n <TransformComponent>\n <div\n className=\"grid place-content-center\"\n onMouseDown={onMouseDown}\n onMouseUp={onMouseUp}\n onMouseMove={onMouseMove}\n >\n <img\n ref={ref}\n className=\"col-start-1 row-start-1 h-full w-full\"\n alt=\"annotate\"\n src={props.imageUrl}\n onLoad={(e) => {\n const pad = onLoad(e);\n setTransform(pad.leftPad, pad.topPad, 0.9, 0)\n }}\n style={{\n width: state.width,\n height: state.height,\n }}\n />\n {fpboxes.map((box) => (\n <BoundingBox\n type={BoundingBoxType.falsePositive}\n label={box.label ?? \"\"}\n key={box.id}\n zIndex={box.id === state.selectedBox ? 1 : defaultZIndex}\n x={box.x * state.width}\n y={box.y * state.height}\n w={box.w * state.width}\n h={box.h * state.height}\n initialScale={transformRef.current?.instance.transformState.scale}\n selected={box.id === state.selectedBox}\n onMouseDown={(e: { stopPropagation: () => void }) => {\n if (!state.createMode) {\n onClickBBox(box.id);\n e.stopPropagation();\n }\n }}\n onClickDelete={() => {\n setState({\n ...state,\n showConfirmDeleteFalsePositive: true,\n });\n }}\n />\n ))}\n {bboxes.map((box) => (\n <BoundingBox\n type={\n box.suggestion\n ? BoundingBoxType.suggestion\n : BoundingBoxType.truePositive\n }\n label={box.label ?? \"\"}\n difficult={box.difficult}\n key={box.id}\n zIndex={box.id === state.selectedBox ? 1 : defaultZIndex}\n x={box.x * state.width}\n y={box.y * state.height}\n w={box.w * state.width}\n h={box.h * state.height}\n initialScale={transformRef.current?.instance.transformState.scale}\n selected={box.id === state.selectedBox}\n onMouseDown={(e: { stopPropagation: () => void }) => {\n if (!state.createMode) {\n onClickBBox(box.id);\n e.stopPropagation();\n }\n }}\n onDragStop={(_e, d) => {\n onDragStop(d, box.id);\n }}\n onResizeStop={(_e, _d, r: HTMLElement, _delta, p) => {\n onResizeStop(r, p, box.id);\n }}\n onClickDelete={() => {\n deleteBox(box.id);\n }}\n onClickEdit={() => {\n setState({ ...state, showLabeler: true });\n }}\n />\n ))}\n <Crosshairs\n className={`col-start-1 row-start-1 ${(state.createMode && !state.drawingMode) ? 'z-10' : '-z-10'}`}\n show={state.createMode && !state.drawingMode}\n />\n </div>\n </TransformComponent>\n </div>\n </div>\n )}\n </TransformWrapper>\n <LabelDialog\n title=\"Annotate\"\n show={state.showLabeler}\n cancelText=\"Cancel\"\n button={\n <button type=\"button\" onClick={onSaveLabel}>\n <Button sm green>\n Save\n </Button>\n </button>\n }\n handleCancel={onCancelLabel}\n >\n <div className=\"my-2 grid grid-cols-1 gap-y-2\">\n <div>\n <select\n className=\"w-full rounded-md border-gray-300 shadow-sm focus:border-primary-300 focus:ring focus:ring-primary-200 focus:ring-opacity-50\"\n value={state.selectedLabel}\n onChange={(e) => {\n setState({ ...state, selectedLabel: e.target.value });\n }}\n >\n {props.labels.map((o) => (\n <option key={o} value={o}>\n {o}\n </option>\n ))}\n </select>\n\n {props.manageLabelUrl && (\n <a className=\"text-primary-500 hover:text-primary-600 underline text-sm\" href={props.manageLabelUrl} target=\"_blank\">Manage Label Options</a>\n )}\n </div>\n <div className=\"flex items-center\">\n <input\n id=\"difficult\"\n className=\"border-gray-300 text-primary-600 shadow-sm hover:border-gray-300 focus:border-primary-300 focus:ring focus:ring-primary-200 focus:ring-opacity-50 focus:ring-offset-0 rounded\"\n type=\"checkbox\"\n checked={state.difficult}\n onChange={(e) => {\n setState({ ...state, difficult: e.target.checked });\n }}\n />\n <label htmlFor=\"difficult\" className=\"ml-2\">\n Difficult?\n </label>\n </div>\n </div>\n </LabelDialog>\n <InfoDialog\n title=\"Keyboard shortcuts\"\n show={state.showHelp}\n handleClose={() => {\n setState({ ...state, showHelp: false });\n }}\n >\n <div className=\"grid w-full grid-cols-2 place-content-center gap-2 p-5\">\n {shortcuts.map((s) => (\n <Fragment key={s.action}>\n <div>{s.action}</div>\n <div className=\"justify-self-end\">\n {s.codes\n .map<React.ReactNode>((c) => (\n <span\n key={c}\n className=\"rounded-md bg-slate-100 p-1 font-mono text-xs shadow-inner\"\n >\n {c}\n </span>\n ))\n .reduce((prev, curr) => [prev, \" + \", curr])}\n </div>\n </Fragment>\n ))}\n </div>\n </InfoDialog>\n <VerifyDialog\n title=\"Are all of the objects in this image labeled?\"\n description=\" \"\n maxWidthClass=\"max-w-lg\"\n handleCancel={() => {\n setState({ ...state, showVerify: false });\n }}\n show={state.showVerify}\n cancelText=\"Cancel\"\n button={\n <button\n type=\"button\"\n disabled={!imageLoaded}\n onClick={() => {\n save(true);\n setState({ ...state, showVerify: false });\n }}\n >\n <Button sm green disabled={!imageLoaded}>\n Yes, all objects are labeled\n </Button>\n </button>\n }\n >\n <div className=\"flex flex-wrap\">\n {props.labels.map((o) => (\n <div className=\"font-mono m-1 bg-slate-200 p-1 rounded-md\" key={o}>{o}</div>\n ))}\n </div>\n </VerifyDialog>\n <VerifyDialog\n title=\"Are you sure you want to delete this image?\"\n description=\"\"\n handleCancel={() => {\n setState({ ...state, showDelete: false });\n }}\n show={state.showDelete}\n cancelText=\"Cancel\"\n button={\n <button\n type=\"button\"\n onClick={() => {\n props.delete();\n setState({ ...state, showDelete: false });\n }}\n >\n <Button sm red>\n Yes, permanently delete\n </Button>\n </button>\n }\n >\n This cannot be undone.\n </VerifyDialog>\n <VerifyDialog\n title=\"Are you sure you want to delete this reported false positive?\"\n description=\" \"\n maxWidthClass=\"max-w-xl\"\n handleCancel={() => {\n setState({ ...state, showConfirmDeleteFalsePositive: false });\n }}\n show={state.showConfirmDeleteFalsePositive}\n cancelText=\"Cancel\"\n button={\n <button\n type=\"button\"\n onClick={() => {\n if (state.selectedBox) {\n deleteFP(state.selectedBox);\n }\n setState({\n ...state,\n showConfirmDeleteFalsePositive: false,\n selectedBox: undefined,\n });\n }}\n >\n <Button sm red>\n Do not teach my model that this is not a{\" \"}\n {state.selectedBox ? getFPLabel(state.selectedBox) : \" \"}\n </Button>\n </button>\n }\n >\n <p>\n False positives submitted from Frigate are used to improve your model\n and should not be deleted unless you submitted them accidentally.\n </p>\n </VerifyDialog>\n </>\n );\n};\n\nexport { ImageAnnotator };\n"],"names":["c","e","u","i","a","r","o","f","l","v","m","d","g","p","w","s","x","h","y","F","n","A","t","ImageAnnotator","props","shortcuts","bboxes","setBBoxes","useState","fpboxes","setFPBoxes","imageLoaded","setImageLoaded","state","setState","ref","useRef","editorRef","transformRef","resize","naturalHeight","_a","aspectRatio","_b","editorHeight","_c","editorWidth","_d","maxHeight","maxWidth","desiredWidth","calculatedWidth","calculatedHeight","leftPad","topPad","handleResize","useDebouncedCallback","useEffect","onResizeStop","elem","position","boxId","prev","onDragStop","onMouseDown","scale","bounds","onMouseUp","newId","out","left","top","width","height","onMouseMove","clickCreate","onClickBBox","selectedBox","b","moveBox","vertical","horizontal","resizeBox","toggleDifficult","cycleLabel","reverse","currentLabelIndex","label","lastIndex","newIndex","newLabel","deleteBox","deleteFP","getFPLabel","box","getBox","nextBox","currentIndex","stepSize","onKeyDown","next","save","onLoad","_e","pad","onSaveLabel","onCancelLabel","verified","defaultZIndex","jsxs","Fragment","jsx","TransformWrapper","zoomIn","zoomOut","setTransform","Button","TransformComponent","BoundingBox","BoundingBoxType","_delta","Crosshairs","LabelDialog","InfoDialog","curr","VerifyDialog"],"mappings":";;;;;;;;;AAA4F,SAASA,GAAEC,GAAEC,GAAEF,GAAE;AAAC,MAAIG,IAAE,MAAKC,IAAEC,EAAE,IAAI,GAAEC,IAAED,EAAE,CAAC,GAAEE,IAAEF,EAAE,IAAI,GAAEG,IAAEH,EAAE,EAAE,GAAEI,IAAEJ,EAAG,GAACK,IAAEL,KAAIM,IAAEN,EAAEJ,CAAC,GAAEW,IAAEP,EAAE,EAAE;AAAE,EAAAM,EAAE,UAAQV;AAAE,MAAIY,IAAe,OAAO,SAApB,KAA2BC,IAAE,CAACZ,KAAOA,MAAJ,KAAOW;AAAE,MAAe,OAAOZ,KAAnB,WA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;AAAA,cAAA;AAAA,cAC4B;AAAA,cACxCnF,EAAM,cAAc4D,EAAW5D,EAAM,WAAW,IAAI;AAAA,YAAA,GACvD;AAAA,UAAA;AAAA,QACF;AAAA,QAGF,UAAA,gBAAA8E,EAAC,OAAE,UAGH,0IAAA,CAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ;","x_google_ignoreList":[0]}
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export declare enum BoundingBoxType {
|
|
|
34
34
|
* @param props.red - Indicates if the button is a red button.
|
|
35
35
|
* @param props.green - Indicates if the button is a green button.
|
|
36
36
|
* @param props.full - Indicates if the button takes 100% width.
|
|
37
|
+
* @param props.disabled - Renders the button dimmed and non-interactive.
|
|
37
38
|
* @param props.children - Children components.
|
|
38
39
|
*/
|
|
39
40
|
export declare const Button: (props: IButtonProps) => JSX_2.Element;
|
|
@@ -77,6 +78,7 @@ declare interface IButtonProps {
|
|
|
77
78
|
red?: boolean;
|
|
78
79
|
green?: boolean;
|
|
79
80
|
full?: boolean;
|
|
81
|
+
disabled?: boolean;
|
|
80
82
|
children: ReactNode;
|
|
81
83
|
}
|
|
82
84
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frigate-nvr/image-annotator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "image annotator designed for frigate nvr",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/frigate-nvr/image-annotator.git"
|
|
8
|
+
},
|
|
5
9
|
"exports": "./dist/index.js",
|
|
6
10
|
"module": "./dist/index.js",
|
|
7
11
|
"types": "./dist/index.d.ts",
|