marquee-selection 0.0.13 → 0.0.14
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.
- package/dist/index.d.ts +1 -0
- package/dist/marquee-selection.es.js +474 -459
- package/dist/marquee-selection.es.js.map +1 -1
- package/dist/marquee-selection.umd.js +1 -1
- package/dist/marquee-selection.umd.js.map +1 -1
- package/index.html +1521 -140
- package/package.json +1 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
function
|
|
1
|
+
function ye(Jt) {
|
|
2
2
|
const {
|
|
3
3
|
container: B,
|
|
4
|
-
selectable:
|
|
5
|
-
exclude:
|
|
6
|
-
selectionMode:
|
|
7
|
-
minOverlapRatio:
|
|
8
|
-
overlapMetric:
|
|
9
|
-
selectedClass:
|
|
10
|
-
onChange:
|
|
11
|
-
preventAncestorSelection:
|
|
12
|
-
conflictStrategy:
|
|
4
|
+
selectable: dt = "img",
|
|
5
|
+
exclude: ot,
|
|
6
|
+
selectionMode: yt = "intersects",
|
|
7
|
+
minOverlapRatio: Qt = 0,
|
|
8
|
+
overlapMetric: Zt = "element",
|
|
9
|
+
selectedClass: st = "selected",
|
|
10
|
+
onChange: gt,
|
|
11
|
+
preventAncestorSelection: te = !0,
|
|
12
|
+
conflictStrategy: ee,
|
|
13
13
|
groupMode: q = !1,
|
|
14
|
-
groupOverlayClass:
|
|
15
|
-
groupColor:
|
|
16
|
-
groupRandomColor:
|
|
17
|
-
groupColorPalette:
|
|
18
|
-
multi:
|
|
19
|
-
combineMode:
|
|
20
|
-
hoverHighlight:
|
|
21
|
-
hoverClass:
|
|
22
|
-
onSelectionEnd:
|
|
23
|
-
quickGroupOnDblClick:
|
|
24
|
-
quickGroupSelector:
|
|
25
|
-
allowIntersectionSelection:
|
|
26
|
-
allowUnionSelection:
|
|
27
|
-
allowContainmentSelection:
|
|
28
|
-
toolbarButtons:
|
|
29
|
-
} =
|
|
30
|
-
if (!t || !
|
|
31
|
-
for (const e of
|
|
14
|
+
groupOverlayClass: It,
|
|
15
|
+
groupColor: mt,
|
|
16
|
+
groupRandomColor: ne = !1,
|
|
17
|
+
groupColorPalette: lt,
|
|
18
|
+
multi: Nt = !1,
|
|
19
|
+
combineMode: bt,
|
|
20
|
+
hoverHighlight: rt = !1,
|
|
21
|
+
hoverClass: Ot = "hovered",
|
|
22
|
+
onSelectionEnd: Gt,
|
|
23
|
+
quickGroupOnDblClick: vt = !1,
|
|
24
|
+
quickGroupSelector: Ft,
|
|
25
|
+
allowIntersectionSelection: V = !0,
|
|
26
|
+
allowUnionSelection: W = !0,
|
|
27
|
+
allowContainmentSelection: K = !0,
|
|
28
|
+
toolbarButtons: M
|
|
29
|
+
} = Jt, Pt = Array.isArray(ot) ? ot.filter(Boolean) : ot ? [ot] : [], xt = (t) => {
|
|
30
|
+
if (!t || !Pt.length) return !1;
|
|
31
|
+
for (const e of Pt)
|
|
32
32
|
try {
|
|
33
33
|
if (t instanceof Element && t.matches(e)) return !0;
|
|
34
34
|
} catch {
|
|
@@ -36,206 +36,206 @@ function pe(Wt) {
|
|
|
36
36
|
return !1;
|
|
37
37
|
};
|
|
38
38
|
if (!B) throw new Error("container is required");
|
|
39
|
-
let
|
|
40
|
-
const
|
|
39
|
+
let wt = 0, Et = 0, J = !1, $ = null, St = !1, D = /* @__PURE__ */ new Set(), _ = null, Ct = "replace", a = [], it = [], I = [], H = [], U = [];
|
|
40
|
+
const oe = () => (M ?? []).map((t) => ({
|
|
41
41
|
label: (t == null ? void 0 : t.label) ?? "",
|
|
42
42
|
title: (t == null ? void 0 : t.title) ?? ""
|
|
43
|
-
})),
|
|
44
|
-
if (
|
|
45
|
-
return
|
|
46
|
-
if (
|
|
47
|
-
if (Array.isArray(
|
|
48
|
-
const t = Math.floor(Math.random() *
|
|
49
|
-
return
|
|
43
|
+
})), Q = (t) => !M || M.length === 0 ? null : (U[t] || (U[t] = oe()), U[t]), se = () => `hsl(${Math.floor(Math.random() * 360)}, 70%, 55%)`, zt = () => {
|
|
44
|
+
if (mt && typeof mt == "string")
|
|
45
|
+
return mt;
|
|
46
|
+
if (ne) {
|
|
47
|
+
if (Array.isArray(lt) && lt.length > 0) {
|
|
48
|
+
const t = Math.floor(Math.random() * lt.length);
|
|
49
|
+
return lt[t];
|
|
50
50
|
}
|
|
51
|
-
return
|
|
51
|
+
return se();
|
|
52
52
|
}
|
|
53
53
|
return "rgba(255, 165, 0, 0.9)";
|
|
54
54
|
};
|
|
55
|
-
let
|
|
56
|
-
const
|
|
57
|
-
let
|
|
58
|
-
const
|
|
55
|
+
let k = null;
|
|
56
|
+
const Z = [], $t = [];
|
|
57
|
+
let j = null;
|
|
58
|
+
const Mt = (t) => {
|
|
59
59
|
if (!t.length) return null;
|
|
60
60
|
const e = new Set(t);
|
|
61
|
-
for (let
|
|
62
|
-
const i = a[
|
|
61
|
+
for (let r = 0; r < a.length; r++) {
|
|
62
|
+
const i = a[r] || [];
|
|
63
63
|
if (i.length !== e.size) continue;
|
|
64
64
|
let c = !0;
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
65
|
+
const s = new Set(i);
|
|
66
|
+
if (s.size !== e.size && (c = !1), c) {
|
|
67
67
|
for (const n of e)
|
|
68
|
-
if (!
|
|
68
|
+
if (!s.has(n)) {
|
|
69
69
|
c = !1;
|
|
70
70
|
break;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
if (c) return
|
|
73
|
+
if (c) return r;
|
|
74
74
|
}
|
|
75
75
|
return null;
|
|
76
76
|
};
|
|
77
|
-
let
|
|
78
|
-
const
|
|
79
|
-
const e = !!
|
|
80
|
-
for (const i of
|
|
77
|
+
let Tt = null;
|
|
78
|
+
const Bt = (t) => {
|
|
79
|
+
const e = !!I[t], r = a[t] || [];
|
|
80
|
+
for (const i of r)
|
|
81
81
|
i.style.visibility = e ? "hidden" : "";
|
|
82
|
-
},
|
|
83
|
-
let
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
},
|
|
82
|
+
}, ct = (t, e) => t < 0 || t >= a.length ? !1 : (I[t] = e, Bt(t), !0);
|
|
83
|
+
let tt = null;
|
|
84
|
+
const at = (t) => {
|
|
85
|
+
rt && (tt && tt !== t && tt.classList.remove(Ot), t && tt !== t && t.classList.add(Ot), tt = t);
|
|
86
|
+
}, le = () => {
|
|
87
87
|
const t = document.createElement("div");
|
|
88
88
|
return t.style.position = "fixed", t.style.left = "0px", t.style.top = "0px", t.style.width = "0px", t.style.height = "0px", t.style.outline = "1px dashed #268aff", t.style.background = "rgba(38,138,255,0.12)", t.style.pointerEvents = "none", t.style.zIndex = "2147483647", t.style.boxSizing = "border-box", document.body.appendChild(t), t;
|
|
89
|
-
},
|
|
90
|
-
const
|
|
91
|
-
return
|
|
92
|
-
},
|
|
93
|
-
const
|
|
94
|
-
return
|
|
95
|
-
},
|
|
96
|
-
const c = Math.min(t,
|
|
97
|
-
return { left: c, top:
|
|
98
|
-
},
|
|
89
|
+
}, ft = (t, e) => t.left < e.right && t.right > e.left && t.top < e.bottom && t.bottom > e.top, re = (t, e) => t.left <= e.left && t.right >= e.right && t.top <= e.top && t.bottom >= e.bottom, ie = (t, e) => {
|
|
90
|
+
const r = Math.max(t.left, e.left), i = Math.min(t.right, e.right), c = Math.max(t.top, e.top), s = Math.min(t.bottom, e.bottom), n = Math.max(0, i - r), l = Math.max(0, s - c), f = n * l, u = Math.max(1, e.width * e.height);
|
|
91
|
+
return f / u;
|
|
92
|
+
}, ce = (t, e) => {
|
|
93
|
+
const r = Math.max(t.left, e.left), i = Math.min(t.right, e.right), c = Math.max(t.top, e.top), s = Math.min(t.bottom, e.bottom), n = Math.max(0, i - r), l = Math.max(0, s - c), f = n * l, u = Math.max(1, t.width * t.height), p = Math.max(1, e.width * e.height), d = u + p - f;
|
|
94
|
+
return f / d;
|
|
95
|
+
}, qt = (t, e) => Zt === "iou" ? ce(t, e) : ie(t, e), Yt = (t, e, r, i) => {
|
|
96
|
+
const c = Math.min(t, r), s = Math.min(e, i), n = Math.abs(r - t), l = Math.abs(i - e);
|
|
97
|
+
return { left: c, top: s, width: n, height: l };
|
|
98
|
+
}, kt = (t) => {
|
|
99
99
|
const e = t.map((n) => n.getBoundingClientRect()).filter((n) => n.width > 0 && n.height > 0);
|
|
100
100
|
if (!e.length) return null;
|
|
101
|
-
const
|
|
102
|
-
return { left:
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
if (
|
|
107
|
-
const t = [], e = (
|
|
108
|
-
a.forEach((
|
|
109
|
-
const c =
|
|
101
|
+
const r = Math.min(...e.map((n) => n.left)), i = Math.min(...e.map((n) => n.top)), c = Math.max(...e.map((n) => n.right)), s = Math.max(...e.map((n) => n.bottom));
|
|
102
|
+
return { left: r, top: i, width: c - r, height: s - i };
|
|
103
|
+
}, et = () => {
|
|
104
|
+
it.forEach((t) => t.remove()), it = [];
|
|
105
|
+
}, N = () => {
|
|
106
|
+
if (et(), !q) return;
|
|
107
|
+
const t = [], e = (r, i) => r.left < i.right && r.right > i.left && r.top < i.bottom && r.bottom > i.top;
|
|
108
|
+
a.forEach((r, i) => {
|
|
109
|
+
const c = kt(r);
|
|
110
110
|
if (!c) return;
|
|
111
|
-
const
|
|
112
|
-
n.style.position = "fixed", n.style.pointerEvents = "none", n.style.zIndex = "2147483646", n.style.left = `${c.left}px`, n.style.top = `${c.top}px`, n.style.width = `${c.width}px`, n.style.height = `${c.height}px`, n.style.boxSizing = "border-box", n.style.outline = `1px solid ${
|
|
111
|
+
const s = H[i] || "rgba(255, 165, 0, 0.9)", n = document.createElement("div");
|
|
112
|
+
n.style.position = "fixed", n.style.pointerEvents = "none", n.style.zIndex = "2147483646", n.style.left = `${c.left}px`, n.style.top = `${c.top}px`, n.style.width = `${c.width}px`, n.style.height = `${c.height}px`, n.style.boxSizing = "border-box", n.style.outline = `1px solid ${s}`, n.style.background = "transparent", document.body.appendChild(n);
|
|
113
113
|
const l = document.createElement("div");
|
|
114
|
-
l.style.position = "absolute", l.style.display = "inline-
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
v.stopPropagation(),
|
|
114
|
+
l.style.position = "absolute", l.style.display = "inline-grid", l.style.gridTemplateColumns = "1fr 1fr 1fr", l.style.gap = "2px", l.style.minWidth = "max-content", l.style.padding = "3px 4px", l.style.fontSize = "11px", l.style.lineHeight = "14px", l.style.color = "#fff", l.style.background = s, l.style.borderRadius = "4px", l.style.pointerEvents = "auto", l.style.opacity = "0.35", l.style.transition = "opacity 0.15s ease";
|
|
115
|
+
const f = document.createElement("span");
|
|
116
|
+
f.textContent = `${i + 1}`, f.style.position = "absolute", f.style.left = "0", f.style.top = "0", f.style.fontSize = "9px", f.style.lineHeight = "14px", f.style.minWidth = "14px", f.style.textAlign = "center", f.style.padding = "0 3px", f.style.background = s, f.style.color = "#fff", f.style.borderRadius = "0 0 4px 0", f.style.fontWeight = "bold", f.style.pointerEvents = "none", n.appendChild(f);
|
|
117
|
+
const u = document.createElement("button");
|
|
118
|
+
u.textContent = I[i] ? "显示" : "隐藏", u.style.background = "rgba(0,0,0,0.15)", u.style.border = "none", u.style.color = "#fff", u.style.padding = "2px 4px", u.style.borderRadius = "3px", u.style.cursor = "pointer", u.style.fontSize = "10px", u.style.textAlign = "center", u.onclick = (v) => {
|
|
119
|
+
v.stopPropagation(), ct(i, !I[i]), N(), F();
|
|
120
120
|
};
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
v.stopPropagation(),
|
|
124
|
-
}, l.appendChild(
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
if (!
|
|
128
|
-
const
|
|
129
|
-
return a.forEach((
|
|
130
|
-
if (
|
|
131
|
-
const
|
|
132
|
-
if (!
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
}),
|
|
121
|
+
const p = document.createElement("button");
|
|
122
|
+
p.textContent = "取消组", p.style.background = "rgba(0,0,0,0.15)", p.style.border = "none", p.style.color = "#fff", p.style.padding = "2px 4px", p.style.borderRadius = "3px", p.style.cursor = "pointer", p.style.fontSize = "10px", p.style.textAlign = "center", p.onclick = (v) => {
|
|
123
|
+
v.stopPropagation(), ct(i, !1), Dt(i);
|
|
124
|
+
}, l.appendChild(u), l.appendChild(p);
|
|
125
|
+
const d = (v) => {
|
|
126
|
+
const o = c ? new DOMRect(c.left, c.top, c.width, c.height) : null;
|
|
127
|
+
if (!o) return [];
|
|
128
|
+
const h = [];
|
|
129
|
+
return a.forEach((y, b) => {
|
|
130
|
+
if (b === v) return;
|
|
131
|
+
const w = kt(y);
|
|
132
|
+
if (!w) return;
|
|
133
|
+
const E = new DOMRect(w.left, w.top, w.width, w.height);
|
|
134
|
+
ft(o, E) && h.push(b);
|
|
135
|
+
}), h;
|
|
136
136
|
};
|
|
137
137
|
if ((() => {
|
|
138
|
-
if (
|
|
139
|
-
const v =
|
|
138
|
+
if (k !== i) return;
|
|
139
|
+
const v = d(i);
|
|
140
140
|
if (v.length === 0) return;
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
const u = document.createElement("div");
|
|
147
|
-
u.className = "merge-panel", u.style.position = "absolute", u.style.left = "0", u.style.top = "22px", u.style.minWidth = "160px", u.style.padding = "8px", u.style.background = "#fff", u.style.color = "#333", u.style.border = "1px solid rgba(0,0,0,0.15)", u.style.borderRadius = "6px", u.style.boxShadow = "0 4px 12px rgba(0,0,0,0.15)", u.style.pointerEvents = "auto", u.style.zIndex = "2147483647";
|
|
141
|
+
const o = document.createElement("button");
|
|
142
|
+
o.textContent = "合并", o.style.background = "rgba(0,0,0,0.15)", o.style.border = "none", o.style.color = "#fff", o.style.padding = "2px 4px", o.style.borderRadius = "3px", o.style.cursor = "pointer", o.style.fontSize = "10px", o.style.textAlign = "center";
|
|
143
|
+
const h = () => {
|
|
144
|
+
const y = l.querySelector(".merge-panel");
|
|
145
|
+
y && y.remove();
|
|
148
146
|
const b = document.createElement("div");
|
|
149
|
-
b.
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const C = document.createElement("
|
|
164
|
-
C.
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
147
|
+
b.className = "merge-panel", b.style.position = "absolute", b.style.left = "0", b.style.top = "22px", b.style.minWidth = "160px", b.style.padding = "8px", b.style.background = "#fff", b.style.color = "#333", b.style.border = "1px solid rgba(0,0,0,0.15)", b.style.borderRadius = "6px", b.style.boxShadow = "0 4px 12px rgba(0,0,0,0.15)", b.style.pointerEvents = "auto", b.style.zIndex = "2147483647";
|
|
148
|
+
const w = document.createElement("div");
|
|
149
|
+
w.textContent = "选择要合并的组", w.style.fontSize = "12px", w.style.marginBottom = "6px", b.appendChild(w);
|
|
150
|
+
const E = document.createElement("div");
|
|
151
|
+
E.style.maxHeight = "200px", E.style.overflow = "auto";
|
|
152
|
+
const z = [];
|
|
153
|
+
v.forEach((T) => {
|
|
154
|
+
const G = document.createElement("label");
|
|
155
|
+
G.style.display = "flex", G.style.alignItems = "center", G.style.gap = "6px", G.style.fontSize = "12px", G.style.margin = "4px 0";
|
|
156
|
+
const Y = document.createElement("input");
|
|
157
|
+
Y.type = "checkbox", Y.checked = !0, Y.value = String(T);
|
|
158
|
+
const At = document.createElement("span");
|
|
159
|
+
At.textContent = `组 ${T + 1}`, G.appendChild(Y), G.appendChild(At), E.appendChild(G), z.push(Y);
|
|
160
|
+
}), b.appendChild(E);
|
|
161
|
+
const C = document.createElement("div");
|
|
162
|
+
C.style.display = "flex", C.style.gap = "8px", C.style.marginTop = "8px";
|
|
163
|
+
const R = document.createElement("button");
|
|
164
|
+
R.textContent = "确认", R.style.padding = "2px 8px", R.style.cursor = "pointer";
|
|
165
|
+
const P = document.createElement("button");
|
|
166
|
+
P.textContent = "取消", P.style.padding = "2px 8px", P.style.cursor = "pointer", C.appendChild(R), C.appendChild(P), b.appendChild(C), P.onclick = (T) => {
|
|
167
|
+
T.stopPropagation(), b.remove();
|
|
168
|
+
}, R.onclick = (T) => {
|
|
169
|
+
T.stopPropagation();
|
|
170
|
+
const G = z.filter((S) => S.checked).map((S) => parseInt(S.value, 10)).filter((S) => !Number.isNaN(S));
|
|
171
|
+
if (G.length === 0) {
|
|
172
|
+
b.remove();
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
|
-
const
|
|
176
|
-
(a[i] || []).forEach((
|
|
177
|
-
(a[
|
|
178
|
-
}), a[i] = Array.from(
|
|
179
|
-
const
|
|
180
|
-
let
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}),
|
|
184
|
-
const
|
|
185
|
-
a.forEach((
|
|
186
|
-
}, l.appendChild(
|
|
175
|
+
const Y = /* @__PURE__ */ new Set();
|
|
176
|
+
(a[i] || []).forEach((S) => Y.add(S)), G.forEach((S) => {
|
|
177
|
+
(a[S] || []).forEach((de) => Y.add(de));
|
|
178
|
+
}), a[i] = Array.from(Y);
|
|
179
|
+
const he = [...G].sort((S, ht) => ht - S);
|
|
180
|
+
let Lt = i;
|
|
181
|
+
he.forEach((S) => {
|
|
182
|
+
S < 0 || S >= a.length || S === i || (ct(S, !1), a.splice(S, 1), I.splice(S, 1), H.splice(S, 1), U.length > S && U.splice(S, 1), k !== null && (k === S ? k = null : k > S && k--), S < Lt && Lt--);
|
|
183
|
+
}), k = Lt;
|
|
184
|
+
const _t = /* @__PURE__ */ new Set();
|
|
185
|
+
a.forEach((S) => S.forEach((ht) => _t.add(ht))), O(_t), N(), b.remove(), F();
|
|
186
|
+
}, l.appendChild(b);
|
|
187
187
|
};
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}, l.appendChild(
|
|
191
|
-
})(), n.appendChild(l),
|
|
192
|
-
const v = (
|
|
193
|
-
const
|
|
194
|
-
if (!
|
|
195
|
-
const
|
|
196
|
-
label:
|
|
197
|
-
title:
|
|
198
|
-
}),
|
|
199
|
-
|
|
188
|
+
o.onclick = (y) => {
|
|
189
|
+
y.stopPropagation(), h();
|
|
190
|
+
}, l.appendChild(o);
|
|
191
|
+
})(), n.appendChild(l), M && M.length) {
|
|
192
|
+
const v = (o, h) => {
|
|
193
|
+
const y = document.createElement("button"), b = Q(i);
|
|
194
|
+
if (!b) return;
|
|
195
|
+
const w = b[h] ?? (b[h] = {
|
|
196
|
+
label: o.label || "按钮",
|
|
197
|
+
title: o.title || ""
|
|
198
|
+
}), E = () => {
|
|
199
|
+
y.textContent = w.label || "", y.title = w.title || "";
|
|
200
200
|
};
|
|
201
|
-
|
|
202
|
-
var
|
|
203
|
-
|
|
204
|
-
const
|
|
201
|
+
E(), y.style.background = "rgba(0,0,0,0.15)", y.style.border = "none", y.style.color = "#fff", y.style.padding = "2px 4px", y.style.borderRadius = "3px", y.style.cursor = "pointer", y.style.fontSize = "10px", y.style.textAlign = "center", o.className && (y.className += (y.className ? " " : "") + o.className), y.onclick = (z) => {
|
|
202
|
+
var P;
|
|
203
|
+
z.stopPropagation();
|
|
204
|
+
const C = {
|
|
205
205
|
index: i,
|
|
206
206
|
group: a[i] || [],
|
|
207
|
-
controller:
|
|
208
|
-
getSnapshot: () =>
|
|
207
|
+
controller: Tt,
|
|
208
|
+
getSnapshot: () => ut(),
|
|
209
209
|
refresh: () => {
|
|
210
|
-
|
|
210
|
+
N(), F();
|
|
211
211
|
},
|
|
212
|
-
mouseX:
|
|
213
|
-
mouseY:
|
|
212
|
+
mouseX: z.clientX,
|
|
213
|
+
mouseY: z.clientY,
|
|
214
214
|
anchorRect: l.getBoundingClientRect(),
|
|
215
215
|
anchorEl: l,
|
|
216
216
|
overlayEl: n,
|
|
217
|
-
label:
|
|
218
|
-
title:
|
|
219
|
-
buttonEl:
|
|
220
|
-
},
|
|
221
|
-
Object.defineProperty(
|
|
217
|
+
label: w.label,
|
|
218
|
+
title: w.title,
|
|
219
|
+
buttonEl: y
|
|
220
|
+
}, R = (T) => {
|
|
221
|
+
Object.defineProperty(C, T, {
|
|
222
222
|
configurable: !0,
|
|
223
|
-
get: () =>
|
|
224
|
-
set: (
|
|
225
|
-
const
|
|
226
|
-
|
|
223
|
+
get: () => w[T],
|
|
224
|
+
set: (G) => {
|
|
225
|
+
const Y = G ?? "";
|
|
226
|
+
w[T] !== Y && (w[T] = Y, E());
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
229
|
};
|
|
230
|
-
|
|
230
|
+
R("label"), R("title");
|
|
231
231
|
try {
|
|
232
|
-
(
|
|
232
|
+
(P = o.onClick) == null || P.call(o, C);
|
|
233
233
|
} catch {
|
|
234
234
|
}
|
|
235
|
-
}, l.appendChild(
|
|
235
|
+
}, l.appendChild(y);
|
|
236
236
|
};
|
|
237
|
-
|
|
238
|
-
(
|
|
237
|
+
M.forEach(
|
|
238
|
+
(o, h) => v(o, h)
|
|
239
239
|
);
|
|
240
240
|
}
|
|
241
241
|
(() => {
|
|
@@ -244,474 +244,489 @@ function pe(Wt) {
|
|
|
244
244
|
"tr",
|
|
245
245
|
"bl",
|
|
246
246
|
"br"
|
|
247
|
-
],
|
|
247
|
+
], o = l.style.visibility;
|
|
248
248
|
l.style.visibility = "hidden";
|
|
249
|
-
const
|
|
250
|
-
t: for (let
|
|
251
|
-
for (let
|
|
249
|
+
const h = 28, y = 6;
|
|
250
|
+
t: for (let b = 0; b < v.length; b++)
|
|
251
|
+
for (let w = 0; w < 6; w++) {
|
|
252
252
|
l.style.left = "", l.style.right = "", l.style.top = "", l.style.bottom = "";
|
|
253
|
-
const
|
|
254
|
-
v[
|
|
255
|
-
const
|
|
256
|
-
left:
|
|
257
|
-
top:
|
|
258
|
-
right:
|
|
259
|
-
bottom:
|
|
253
|
+
const E = l.offsetHeight || 22;
|
|
254
|
+
v[b] === "tl" ? (l.style.left = "0", l.style.top = `${-E - y + w * h}px`) : v[b] === "tr" ? (l.style.right = "0", l.style.top = `${-E - y + w * h}px`) : v[b] === "bl" ? (l.style.left = "0", l.style.top = `${c.height + y + w * h}px`) : (l.style.right = "0", l.style.top = `${c.height + y + w * h}px`);
|
|
255
|
+
const z = l.getBoundingClientRect(), C = {
|
|
256
|
+
left: z.left,
|
|
257
|
+
top: z.top,
|
|
258
|
+
right: z.right,
|
|
259
|
+
bottom: z.bottom
|
|
260
260
|
};
|
|
261
|
-
let
|
|
262
|
-
for (const
|
|
263
|
-
if (e(
|
|
264
|
-
|
|
261
|
+
let R = !1;
|
|
262
|
+
for (const P of t)
|
|
263
|
+
if (e(C, P)) {
|
|
264
|
+
R = !0;
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
|
-
if (!
|
|
268
|
-
t.push(
|
|
267
|
+
if (!R) {
|
|
268
|
+
t.push(C);
|
|
269
269
|
break t;
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
l.style.visibility =
|
|
273
|
-
})()
|
|
272
|
+
l.style.visibility = o;
|
|
273
|
+
})();
|
|
274
|
+
const x = () => {
|
|
275
|
+
l.style.opacity = "1";
|
|
276
|
+
}, X = () => {
|
|
277
|
+
l.style.opacity = "0.35";
|
|
278
|
+
};
|
|
279
|
+
l.addEventListener("mouseenter", () => {
|
|
280
|
+
x();
|
|
274
281
|
try {
|
|
275
|
-
|
|
282
|
+
it.forEach((v) => v.style.zIndex = "2147483646"), n.style.zIndex = "2147483647";
|
|
276
283
|
} catch {
|
|
277
284
|
}
|
|
285
|
+
}), l.addEventListener("mouseleave", X);
|
|
286
|
+
const A = document.createElement("div");
|
|
287
|
+
A.style.position = "absolute", A.style.inset = "0", A.style.pointerEvents = "auto", A.style.background = "transparent", A.style.zIndex = "0", n.appendChild(A), A.addEventListener("mouseenter", x), A.addEventListener("mouseleave", () => {
|
|
288
|
+
setTimeout(() => {
|
|
289
|
+
!l.matches(":hover") && !A.matches(":hover") && X();
|
|
290
|
+
}, 100);
|
|
278
291
|
});
|
|
279
|
-
const
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
const
|
|
283
|
-
v === "top" ? (
|
|
284
|
-
|
|
285
|
-
const
|
|
292
|
+
const L = (v) => {
|
|
293
|
+
const o = document.createElement("div");
|
|
294
|
+
o.style.position = "absolute", o.style.pointerEvents = "auto", o.style.background = "transparent", o.style.zIndex = "2147483647";
|
|
295
|
+
const h = 8;
|
|
296
|
+
v === "top" ? (o.style.cursor = "ns-resize", o.style.left = "-4px", o.style.right = "-4px", o.style.top = `-${h / 2 | 0}px`, o.style.height = `${h}px`) : v === "bottom" ? (o.style.cursor = "ns-resize", o.style.left = "-4px", o.style.right = "-4px", o.style.bottom = `-${h / 2 | 0}px`, o.style.height = `${h}px`) : v === "left" ? (o.style.cursor = "ew-resize", o.style.top = "-4px", o.style.bottom = "-4px", o.style.left = `-${h / 2 | 0}px`, o.style.width = `${h}px`) : v === "right" ? (o.style.cursor = "ew-resize", o.style.top = "-4px", o.style.bottom = "-4px", o.style.right = `-${h / 2 | 0}px`, o.style.width = `${h}px`) : v === "nw" ? (o.style.cursor = "nwse-resize", o.style.left = `-${h / 2 | 0}px`, o.style.top = `-${h / 2 | 0}px`, o.style.width = `${h}px`, o.style.height = `${h}px`) : v === "ne" ? (o.style.cursor = "nesw-resize", o.style.right = `-${h / 2 | 0}px`, o.style.top = `-${h / 2 | 0}px`, o.style.width = `${h}px`, o.style.height = `${h}px`) : v === "sw" ? (o.style.cursor = "nesw-resize", o.style.left = `-${h / 2 | 0}px`, o.style.bottom = `-${h / 2 | 0}px`, o.style.width = `${h}px`, o.style.height = `${h}px`) : v === "se" && (o.style.cursor = "nwse-resize", o.style.right = `-${h / 2 | 0}px`, o.style.bottom = `-${h / 2 | 0}px`, o.style.width = `${h}px`, o.style.height = `${h}px`), o.onmousedown = (y) => {
|
|
297
|
+
y.preventDefault(), y.stopPropagation();
|
|
298
|
+
const b = {
|
|
286
299
|
left: parseFloat(n.style.left || "0"),
|
|
287
300
|
top: parseFloat(n.style.top || "0"),
|
|
288
301
|
width: parseFloat(n.style.width || "0"),
|
|
289
302
|
height: parseFloat(n.style.height || "0")
|
|
290
303
|
};
|
|
291
|
-
|
|
304
|
+
j = {
|
|
292
305
|
idx: i,
|
|
293
306
|
side: v,
|
|
294
|
-
startX:
|
|
295
|
-
startY:
|
|
296
|
-
startRect:
|
|
307
|
+
startX: y.clientX,
|
|
308
|
+
startY: y.clientY,
|
|
309
|
+
startRect: b,
|
|
297
310
|
overlay: n
|
|
298
|
-
}, document.addEventListener("mousemove",
|
|
299
|
-
}, n.appendChild(
|
|
311
|
+
}, document.addEventListener("mousemove", Rt), document.addEventListener("mouseup", ae, { once: !0 });
|
|
312
|
+
}, n.appendChild(o);
|
|
300
313
|
};
|
|
301
|
-
|
|
314
|
+
L("top"), L("right"), L("bottom"), L("left"), L("nw"), L("ne"), L("sw"), L("se"), It && n.classList.add(It), it.push(n);
|
|
302
315
|
});
|
|
303
|
-
},
|
|
304
|
-
if (!
|
|
305
|
-
const { idx: e, side:
|
|
306
|
-
let
|
|
316
|
+
}, Rt = (t) => {
|
|
317
|
+
if (!j) return;
|
|
318
|
+
const { idx: e, side: r, startX: i, startY: c, startRect: s, overlay: n } = j, l = t.clientX - i, f = t.clientY - c;
|
|
319
|
+
let u = s.left, p = s.top, d = s.width, g = s.height;
|
|
307
320
|
const m = 4;
|
|
308
|
-
|
|
309
|
-
const x =
|
|
310
|
-
a.forEach((
|
|
311
|
-
|
|
321
|
+
r === "left" || r === "nw" || r === "sw" ? (u = s.left + l, d = s.width - l, d < m && (u = s.left + (s.width - m), d = m)) : (r === "right" || r === "ne" || r === "se") && (d = s.width + l, d < m && (d = m)), r === "top" || r === "nw" || r === "ne" ? (p = s.top + f, g = s.height - f, g < m && (p = s.top + (s.height - m), g = m)) : (r === "bottom" || r === "sw" || r === "se") && (g = s.height + f, g < m && (g = m)), n.style.left = `${u}px`, n.style.top = `${p}px`, n.style.width = `${d}px`, n.style.height = `${g}px`;
|
|
322
|
+
const x = nt(u, p, d, g), X = new Set(a[e] || []), A = /* @__PURE__ */ new Set();
|
|
323
|
+
a.forEach((E, z) => {
|
|
324
|
+
z !== e && E.forEach((C) => A.add(C));
|
|
312
325
|
});
|
|
313
|
-
const
|
|
314
|
-
let
|
|
315
|
-
for (let
|
|
316
|
-
if (
|
|
317
|
-
const
|
|
318
|
-
let
|
|
319
|
-
for (const
|
|
320
|
-
if (
|
|
321
|
-
if (
|
|
322
|
-
|
|
323
|
-
else if (
|
|
324
|
-
|
|
326
|
+
const L = new Set(x);
|
|
327
|
+
let v = !1, o = !1;
|
|
328
|
+
for (let E = 0; E < a.length; E++) {
|
|
329
|
+
if (E === e) continue;
|
|
330
|
+
const z = new Set(a[E] || []);
|
|
331
|
+
let C = 0;
|
|
332
|
+
for (const R of L) z.has(R) && C++;
|
|
333
|
+
if (C !== 0 && !(C === z.size && C === L.size))
|
|
334
|
+
if (C === z.size)
|
|
335
|
+
o = !0;
|
|
336
|
+
else if (C === L.size)
|
|
337
|
+
o = !0;
|
|
325
338
|
else {
|
|
326
|
-
|
|
339
|
+
v = !0;
|
|
327
340
|
break;
|
|
328
341
|
}
|
|
329
342
|
}
|
|
330
|
-
const
|
|
331
|
-
if (
|
|
343
|
+
const h = x.filter((E) => !X.has(E)).length, y = !V && (v || !K && o), b = !W && h > 0;
|
|
344
|
+
if (y || b) {
|
|
332
345
|
n.style.outline = "1px dashed #ff4d4f", n.style.background = "rgba(255,77,79,0.06)";
|
|
333
|
-
const
|
|
334
|
-
a.forEach((
|
|
335
|
-
(
|
|
336
|
-
}),
|
|
346
|
+
const E = /* @__PURE__ */ new Set();
|
|
347
|
+
a.forEach((z, C) => {
|
|
348
|
+
(C === e ? a[e] || [] : z).forEach((P) => E.add(P));
|
|
349
|
+
}), O(E);
|
|
337
350
|
} else {
|
|
338
|
-
const
|
|
339
|
-
n.style.outline = `1px solid ${
|
|
340
|
-
const
|
|
341
|
-
a.forEach((
|
|
342
|
-
(
|
|
343
|
-
}),
|
|
351
|
+
const E = H[e] || "rgba(255, 165, 0, 0.9)";
|
|
352
|
+
n.style.outline = `1px solid ${E}`, n.style.background = "transparent";
|
|
353
|
+
const z = /* @__PURE__ */ new Set();
|
|
354
|
+
a.forEach((C, R) => {
|
|
355
|
+
(R === e ? x : C).forEach((T) => z.add(T));
|
|
356
|
+
}), O(z);
|
|
344
357
|
}
|
|
345
|
-
},
|
|
346
|
-
if (!
|
|
347
|
-
const { idx: e, overlay:
|
|
348
|
-
a.forEach((
|
|
349
|
-
|
|
358
|
+
}, ae = (t) => {
|
|
359
|
+
if (!j) return;
|
|
360
|
+
const { idx: e, overlay: r, startRect: i } = j, c = parseFloat(r.style.left || "0"), s = parseFloat(r.style.top || "0"), n = parseFloat(r.style.width || "0"), l = parseFloat(r.style.height || "0"), f = nt(c, s, n, l), u = new Set(a[e] || []), p = /* @__PURE__ */ new Set();
|
|
361
|
+
a.forEach((o, h) => {
|
|
362
|
+
h !== e && o.forEach((y) => p.add(y));
|
|
350
363
|
});
|
|
351
|
-
const
|
|
364
|
+
const d = new Set(f);
|
|
352
365
|
let g = !1, m = !1;
|
|
353
|
-
for (let
|
|
354
|
-
if (
|
|
355
|
-
const
|
|
356
|
-
let
|
|
357
|
-
for (const
|
|
358
|
-
if (
|
|
359
|
-
if (
|
|
366
|
+
for (let o = 0; o < a.length; o++) {
|
|
367
|
+
if (o === e) continue;
|
|
368
|
+
const h = new Set(a[o] || []);
|
|
369
|
+
let y = 0;
|
|
370
|
+
for (const b of d) h.has(b) && y++;
|
|
371
|
+
if (y !== 0 && !(y === h.size && y === d.size))
|
|
372
|
+
if (y === h.size || y === d.size)
|
|
360
373
|
m = !0;
|
|
361
374
|
else {
|
|
362
375
|
g = !0;
|
|
363
376
|
break;
|
|
364
377
|
}
|
|
365
378
|
}
|
|
366
|
-
const x =
|
|
367
|
-
if (
|
|
368
|
-
const
|
|
369
|
-
a.forEach((
|
|
379
|
+
const x = f.filter((o) => !u.has(o)).length, X = !V && (g || !K && m), A = !W && x > 0;
|
|
380
|
+
if (X || A) {
|
|
381
|
+
const o = /* @__PURE__ */ new Set();
|
|
382
|
+
a.forEach((h) => h.forEach((y) => o.add(y))), O(o), N(), j = null, document.removeEventListener("mousemove", Rt), F();
|
|
370
383
|
return;
|
|
371
384
|
}
|
|
372
|
-
a[e] =
|
|
373
|
-
const
|
|
374
|
-
a.forEach((
|
|
375
|
-
},
|
|
385
|
+
a[e] = f;
|
|
386
|
+
const v = /* @__PURE__ */ new Set();
|
|
387
|
+
a.forEach((o) => o.forEach((h) => v.add(h))), O(v), N(), j = null, document.removeEventListener("mousemove", Rt), F();
|
|
388
|
+
}, Dt = (t) => {
|
|
376
389
|
if (t < 0 || t >= a.length) return !1;
|
|
377
390
|
const e = a[t];
|
|
378
|
-
e && e.forEach((i) => i.style.visibility = ""), a.splice(t, 1),
|
|
379
|
-
const
|
|
380
|
-
return a.forEach((i) => i.forEach((c) =>
|
|
381
|
-
},
|
|
382
|
-
if (!q || !
|
|
383
|
-
const i =
|
|
391
|
+
e && e.forEach((i) => i.style.visibility = ""), a.splice(t, 1), I.splice(t, 1), H.splice(t, 1), U.length > t && U.splice(t, 1), k !== null && (k === t ? k = null : k > t && k--), et(), N();
|
|
392
|
+
const r = /* @__PURE__ */ new Set();
|
|
393
|
+
return a.forEach((i) => i.forEach((c) => r.add(c))), O(r), F(), !0;
|
|
394
|
+
}, fe = (t, e, r) => {
|
|
395
|
+
if (!q || !M || M.length === 0 || t < 0 || t >= a.length || e < 0 || e >= M.length) return !1;
|
|
396
|
+
const i = Q(t);
|
|
384
397
|
if (!i) return !1;
|
|
385
398
|
const c = i[e];
|
|
386
399
|
if (!c) return !1;
|
|
387
|
-
let
|
|
388
|
-
if (
|
|
389
|
-
const n =
|
|
390
|
-
c.label !== n && (c.label = n,
|
|
400
|
+
let s = !1;
|
|
401
|
+
if (r.label !== void 0) {
|
|
402
|
+
const n = r.label ?? "";
|
|
403
|
+
c.label !== n && (c.label = n, s = !0);
|
|
391
404
|
}
|
|
392
|
-
if (
|
|
393
|
-
const n =
|
|
394
|
-
c.title !== n && (c.title = n,
|
|
405
|
+
if (r.title !== void 0) {
|
|
406
|
+
const n = r.title ?? "";
|
|
407
|
+
c.title !== n && (c.title = n, s = !0);
|
|
395
408
|
}
|
|
396
|
-
return
|
|
397
|
-
},
|
|
409
|
+
return s && N(), s;
|
|
410
|
+
}, pe = (t) => {
|
|
398
411
|
if (!q || !Array.isArray(t) || t.length === 0) return !1;
|
|
399
|
-
const e = Array.from(new Set(t)).filter((
|
|
400
|
-
var
|
|
412
|
+
const e = Array.from(new Set(t)).filter((p) => {
|
|
413
|
+
var d;
|
|
401
414
|
try {
|
|
402
|
-
return !!
|
|
415
|
+
return !!p && B.contains(p) && !xt(p) && ((d = p.matches) == null ? void 0 : d.call(p, dt));
|
|
403
416
|
} catch {
|
|
404
417
|
return !1;
|
|
405
418
|
}
|
|
406
419
|
});
|
|
407
|
-
if (e.length === 0 ||
|
|
420
|
+
if (e.length === 0 || Mt(e) !== null) return !1;
|
|
408
421
|
const i = new Set(e);
|
|
409
|
-
let c = !1,
|
|
410
|
-
for (const
|
|
411
|
-
const
|
|
422
|
+
let c = !1, s = !1;
|
|
423
|
+
for (const p of a) {
|
|
424
|
+
const d = new Set(p);
|
|
412
425
|
let g = 0;
|
|
413
|
-
for (const m of i)
|
|
414
|
-
if (g !== 0 && !(g ===
|
|
415
|
-
if (g ===
|
|
416
|
-
|
|
426
|
+
for (const m of i) d.has(m) && g++;
|
|
427
|
+
if (g !== 0 && !(g === d.size && g === i.size))
|
|
428
|
+
if (g === d.size || g === i.size)
|
|
429
|
+
s = !0;
|
|
417
430
|
else {
|
|
418
431
|
c = !0;
|
|
419
432
|
break;
|
|
420
433
|
}
|
|
421
434
|
}
|
|
422
|
-
const n = new Set(
|
|
423
|
-
if (l ||
|
|
424
|
-
a.push(e),
|
|
425
|
-
const
|
|
426
|
-
return a.forEach((
|
|
427
|
-
},
|
|
435
|
+
const n = new Set(D), l = !V && (c || !K && s), f = !W && n.size > 0 && e.length > 0;
|
|
436
|
+
if (l || f) return !1;
|
|
437
|
+
a.push(e), I.push(!1), H.push(zt()), M != null && M.length && Q(a.length - 1), k = a.length - 1;
|
|
438
|
+
const u = /* @__PURE__ */ new Set();
|
|
439
|
+
return a.forEach((p) => p.forEach((d) => u.add(d))), O(u), N(), F(), !0;
|
|
440
|
+
}, ue = (t) => {
|
|
428
441
|
if (q) return "add";
|
|
429
|
-
const e =
|
|
430
|
-
return
|
|
431
|
-
},
|
|
432
|
-
for (const e of Array.from(
|
|
433
|
-
t.has(e) || e.classList.remove(
|
|
442
|
+
const e = Nt ? bt ?? "add" : "replace";
|
|
443
|
+
return Nt ? bt === "auto" ? t.shiftKey ? "add" : t.altKey ? "subtract" : t.metaKey || t.ctrlKey ? "toggle" : "add" : bt ?? e : "replace";
|
|
444
|
+
}, O = (t) => {
|
|
445
|
+
for (const e of Array.from(D))
|
|
446
|
+
t.has(e) || e.classList.remove(st);
|
|
434
447
|
for (const e of Array.from(t))
|
|
435
|
-
|
|
436
|
-
|
|
448
|
+
D.has(e) || e.classList.add(st);
|
|
449
|
+
D = t, gt && gt(q ? {
|
|
437
450
|
type: "groups",
|
|
438
451
|
groups: a.slice(),
|
|
439
|
-
flat: Array.from(
|
|
440
|
-
} : { type: "single", selected: Array.from(
|
|
441
|
-
},
|
|
442
|
-
if (
|
|
452
|
+
flat: Array.from(D)
|
|
453
|
+
} : { type: "single", selected: Array.from(D) });
|
|
454
|
+
}, Xt = (t, e, r) => {
|
|
455
|
+
if (r === "replace") return new Set(e);
|
|
443
456
|
const i = new Set(t);
|
|
444
|
-
if (
|
|
457
|
+
if (r === "add")
|
|
445
458
|
for (const c of e) i.add(c);
|
|
446
|
-
else if (
|
|
459
|
+
else if (r === "subtract")
|
|
447
460
|
for (const c of e) i.delete(c);
|
|
448
|
-
else if (
|
|
461
|
+
else if (r === "toggle")
|
|
449
462
|
for (const c of e)
|
|
450
463
|
i.has(c) ? i.delete(c) : i.add(c);
|
|
451
464
|
return i;
|
|
452
|
-
},
|
|
465
|
+
}, Ht = (t) => {
|
|
453
466
|
if (t.button !== 0) return;
|
|
454
467
|
const e = t.target;
|
|
455
|
-
!B.contains(e) && e !== document.body || (
|
|
456
|
-
},
|
|
468
|
+
!B.contains(e) && e !== document.body || (wt = t.clientX, Et = t.clientY, J = !0, $ = le(), Ct = ue(t), _ = new Set(D), t.preventDefault());
|
|
469
|
+
}, Ut = (t) => {
|
|
457
470
|
var g;
|
|
458
|
-
if (!
|
|
459
|
-
const m = t.target, x = (g = m == null ? void 0 : m.closest) == null ? void 0 : g.call(m,
|
|
460
|
-
x && B.contains(x) && !
|
|
471
|
+
if (!J && rt) {
|
|
472
|
+
const m = t.target, x = (g = m == null ? void 0 : m.closest) == null ? void 0 : g.call(m, dt);
|
|
473
|
+
x && B.contains(x) && !xt(x) ? at(x) : at(null);
|
|
461
474
|
}
|
|
462
|
-
if (!
|
|
463
|
-
const { left: e, top:
|
|
464
|
-
vt,
|
|
475
|
+
if (!J || !$) return;
|
|
476
|
+
const { left: e, top: r, width: i, height: c } = Yt(
|
|
465
477
|
wt,
|
|
478
|
+
Et,
|
|
466
479
|
t.clientX,
|
|
467
480
|
t.clientY
|
|
468
481
|
);
|
|
469
|
-
$.style.left = `${e}px`, $.style.top = `${
|
|
470
|
-
const
|
|
471
|
-
let
|
|
472
|
-
for (const m of l) n.has(m) &&
|
|
473
|
-
let
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
477
|
-
|
|
482
|
+
$.style.left = `${e}px`, $.style.top = `${r}px`, $.style.width = `${i}px`, $.style.height = `${c}px`;
|
|
483
|
+
const s = nt(e, r, i, c), n = _ ?? /* @__PURE__ */ new Set(), l = new Set(s);
|
|
484
|
+
let f = 0;
|
|
485
|
+
for (const m of l) n.has(m) && f++;
|
|
486
|
+
let u = "disjoint";
|
|
487
|
+
f === 0 ? u = "disjoint" : f === l.size && f === n.size ? u = "equal" : f === l.size || f === n.size ? u = "containment" : u = "partial";
|
|
488
|
+
const p = !V && (u === "partial" || !K && u === "containment"), d = !W && n.size > 0 && s.length > 0;
|
|
489
|
+
if (St = p || d, $ && (St ? ($.style.outline = "1px dashed #ff4d4f", $.style.background = "rgba(255,77,79,0.12)") : ($.style.outline = "1px dashed #268aff", $.style.background = "rgba(38,138,255,0.12)")), St)
|
|
490
|
+
O(n);
|
|
478
491
|
else {
|
|
479
|
-
const m =
|
|
480
|
-
|
|
492
|
+
const m = Xt(n, s, Ct);
|
|
493
|
+
O(m);
|
|
481
494
|
}
|
|
482
|
-
},
|
|
483
|
-
if (!
|
|
484
|
-
|
|
485
|
-
const { left: e, top:
|
|
486
|
-
vt,
|
|
495
|
+
}, jt = (t) => {
|
|
496
|
+
if (!J) return;
|
|
497
|
+
J = !1, $ && $.parentNode && $.parentNode.removeChild($), $ = null;
|
|
498
|
+
const { left: e, top: r, width: i, height: c } = Yt(
|
|
487
499
|
wt,
|
|
500
|
+
Et,
|
|
488
501
|
t.clientX,
|
|
489
502
|
t.clientY
|
|
490
|
-
),
|
|
491
|
-
let
|
|
492
|
-
for (const x of l) n.has(x) &&
|
|
493
|
-
let
|
|
494
|
-
|
|
495
|
-
const
|
|
496
|
-
if (
|
|
497
|
-
|
|
503
|
+
), s = nt(e, r, i, c), n = _ ?? /* @__PURE__ */ new Set(), l = new Set(s);
|
|
504
|
+
let f = 0;
|
|
505
|
+
for (const x of l) n.has(x) && f++;
|
|
506
|
+
let u = "disjoint";
|
|
507
|
+
f === 0 ? u = "disjoint" : f === l.size && f === n.size ? u = "equal" : f === l.size || f === n.size ? u = "containment" : u = "partial";
|
|
508
|
+
const p = !V && (u === "partial" || !K && u === "containment"), d = !W && n.size > 0 && s.length > 0;
|
|
509
|
+
if (p || d) {
|
|
510
|
+
O(n), _ = null, F();
|
|
498
511
|
return;
|
|
499
512
|
}
|
|
500
|
-
const m =
|
|
501
|
-
if (
|
|
502
|
-
const x =
|
|
513
|
+
const m = Xt(n, s, Ct);
|
|
514
|
+
if (O(m), q && s.length > 0) {
|
|
515
|
+
const x = Mt(s);
|
|
503
516
|
if (x !== null) {
|
|
504
517
|
try {
|
|
505
518
|
console.warn(`重复编组被阻止:与已存在的第${x + 1}组元素完全一致`);
|
|
506
519
|
} catch {
|
|
507
520
|
}
|
|
508
|
-
|
|
521
|
+
_ = null, F();
|
|
509
522
|
return;
|
|
510
523
|
}
|
|
511
|
-
a.push(
|
|
512
|
-
const
|
|
513
|
-
a.forEach((
|
|
524
|
+
a.push(s), k = a.length - 1, I.push(!1), H.push(zt()), M != null && M.length && Q(a.length - 1);
|
|
525
|
+
const X = /* @__PURE__ */ new Set();
|
|
526
|
+
a.forEach((A) => A.forEach((L) => X.add(L))), O(X), N();
|
|
514
527
|
}
|
|
515
|
-
|
|
516
|
-
},
|
|
528
|
+
_ = null, F();
|
|
529
|
+
}, Vt = (t) => {
|
|
517
530
|
var m;
|
|
518
|
-
if (!
|
|
531
|
+
if (!vt || !q) return;
|
|
519
532
|
const e = t.target;
|
|
520
533
|
if (!e) return;
|
|
521
|
-
let
|
|
522
|
-
if (
|
|
523
|
-
const i =
|
|
534
|
+
let r = e;
|
|
535
|
+
if (Ft && (r = ((m = e.closest) == null ? void 0 : m.call(e, Ft)) || null), !r || !B.contains(r)) return;
|
|
536
|
+
const i = r.getBoundingClientRect(), c = nt(i.left, i.top, i.width, i.height), s = new Set(D), n = new Set(c);
|
|
524
537
|
let l = 0;
|
|
525
|
-
for (const x of n)
|
|
526
|
-
let
|
|
527
|
-
l === 0 ?
|
|
528
|
-
const
|
|
529
|
-
if (c.length === 0 ||
|
|
538
|
+
for (const x of n) s.has(x) && l++;
|
|
539
|
+
let f = "disjoint";
|
|
540
|
+
l === 0 ? f = "disjoint" : l === n.size && l === s.size ? f = "equal" : l === n.size || l === s.size ? f = "containment" : f = "partial";
|
|
541
|
+
const u = !V && (f === "partial" || !K && f === "containment"), p = !W && s.size > 0 && c.length > 0;
|
|
542
|
+
if (c.length === 0 || u || p) {
|
|
530
543
|
F();
|
|
531
544
|
return;
|
|
532
545
|
}
|
|
533
|
-
const
|
|
534
|
-
if (
|
|
546
|
+
const d = Mt(c);
|
|
547
|
+
if (d !== null) {
|
|
535
548
|
try {
|
|
536
|
-
console.warn(`重复编组被阻止:与已存在的第${
|
|
549
|
+
console.warn(`重复编组被阻止:与已存在的第${d + 1}组元素完全一致`);
|
|
537
550
|
} catch {
|
|
538
551
|
}
|
|
539
552
|
F();
|
|
540
553
|
return;
|
|
541
554
|
}
|
|
542
|
-
a.push(c),
|
|
555
|
+
a.push(c), k = a.length - 1, I.push(!1), H.push(zt()), M != null && M.length && Q(a.length - 1);
|
|
543
556
|
const g = /* @__PURE__ */ new Set();
|
|
544
|
-
a.forEach((x) => x.forEach((
|
|
545
|
-
},
|
|
546
|
-
function
|
|
547
|
-
if (
|
|
548
|
-
const c = B.getBoundingClientRect(),
|
|
549
|
-
if (!
|
|
550
|
-
const n = Array.from(B.querySelectorAll(
|
|
557
|
+
a.forEach((x) => x.forEach((X) => g.add(X))), O(g), N(), F();
|
|
558
|
+
}, Wt = () => at(null);
|
|
559
|
+
function nt(t, e, r, i) {
|
|
560
|
+
if (r === 0 || i === 0) return [];
|
|
561
|
+
const c = B.getBoundingClientRect(), s = new DOMRect(t, e, r, i);
|
|
562
|
+
if (!ft(s, c)) return [];
|
|
563
|
+
const n = Array.from(B.querySelectorAll(dt));
|
|
551
564
|
let l = [];
|
|
552
|
-
const
|
|
553
|
-
for (const
|
|
554
|
-
if (
|
|
555
|
-
const
|
|
556
|
-
if (!
|
|
565
|
+
const f = /* @__PURE__ */ new Map();
|
|
566
|
+
for (const p of n) {
|
|
567
|
+
if (xt(p)) continue;
|
|
568
|
+
const d = p.getBoundingClientRect();
|
|
569
|
+
if (!ft(d, c)) continue;
|
|
557
570
|
let g = !1;
|
|
558
|
-
if (
|
|
559
|
-
g =
|
|
560
|
-
else if (
|
|
561
|
-
const m =
|
|
562
|
-
g = m >=
|
|
571
|
+
if (yt === "contains")
|
|
572
|
+
g = re(s, d);
|
|
573
|
+
else if (yt === "center") {
|
|
574
|
+
const m = d.left + d.width / 2, x = d.top + d.height / 2;
|
|
575
|
+
g = m >= s.left && m <= s.right && x >= s.top && x <= s.bottom;
|
|
563
576
|
} else
|
|
564
|
-
|
|
577
|
+
ft(s, d) && (g = qt(s, d) >= Math.max(0, Math.min(1, Qt)));
|
|
565
578
|
if (g) {
|
|
566
|
-
const m =
|
|
567
|
-
|
|
579
|
+
const m = yt === "contains" ? 1 : qt(s, d);
|
|
580
|
+
f.set(p, m), l.push(p);
|
|
568
581
|
}
|
|
569
582
|
}
|
|
570
|
-
const
|
|
571
|
-
if (
|
|
572
|
-
if (
|
|
583
|
+
const u = ee ?? (te ? "leaf" : "none");
|
|
584
|
+
if (u !== "none" && l.length > 1) {
|
|
585
|
+
if (u === "leaf")
|
|
573
586
|
l = l.filter(
|
|
574
|
-
(
|
|
575
|
-
(
|
|
587
|
+
(p) => !l.some(
|
|
588
|
+
(d) => d !== p && p.contains(d)
|
|
576
589
|
)
|
|
577
590
|
);
|
|
578
|
-
else if (
|
|
579
|
-
const
|
|
580
|
-
(g, m) => (
|
|
581
|
-
),
|
|
582
|
-
for (const g of
|
|
583
|
-
|
|
591
|
+
else if (u === "best") {
|
|
592
|
+
const p = [...l].sort(
|
|
593
|
+
(g, m) => (f.get(m) || 0) - (f.get(g) || 0)
|
|
594
|
+
), d = [];
|
|
595
|
+
for (const g of p)
|
|
596
|
+
d.find(
|
|
584
597
|
(x) => x.contains(g) || g.contains(x)
|
|
585
|
-
) ||
|
|
586
|
-
l =
|
|
598
|
+
) || d.push(g);
|
|
599
|
+
l = d;
|
|
587
600
|
}
|
|
588
601
|
}
|
|
589
602
|
return l;
|
|
590
603
|
}
|
|
591
|
-
document.addEventListener("mousedown",
|
|
592
|
-
const
|
|
593
|
-
q && (window.addEventListener("scroll",
|
|
594
|
-
const
|
|
604
|
+
document.addEventListener("mousedown", Ht, !0), document.addEventListener("mousemove", Ut), document.addEventListener("mouseup", jt), rt && B.addEventListener("mouseleave", Wt), q && vt && B.addEventListener("dblclick", Vt);
|
|
605
|
+
const pt = () => N();
|
|
606
|
+
q && (window.addEventListener("scroll", pt, !0), window.addEventListener("resize", pt));
|
|
607
|
+
const ut = () => {
|
|
595
608
|
if (q) {
|
|
596
|
-
const t = a.map((
|
|
597
|
-
(
|
|
609
|
+
const t = a.map((s) => kt(s)), e = Array(a.length).fill(null), r = t.map(
|
|
610
|
+
(s) => s ? Math.max(0, s.width * s.height) : Number.POSITIVE_INFINITY
|
|
598
611
|
);
|
|
599
|
-
for (let
|
|
600
|
-
const n = t[
|
|
612
|
+
for (let s = 0; s < a.length; s++) {
|
|
613
|
+
const n = t[s];
|
|
601
614
|
if (!n) continue;
|
|
602
|
-
let l = null,
|
|
603
|
-
for (let
|
|
604
|
-
if (
|
|
605
|
-
const
|
|
606
|
-
if (!
|
|
607
|
-
if (
|
|
608
|
-
const g = Number(
|
|
609
|
-
g <
|
|
615
|
+
let l = null, f = Number.POSITIVE_INFINITY;
|
|
616
|
+
for (let u = 0; u < a.length; u++) {
|
|
617
|
+
if (s === u) continue;
|
|
618
|
+
const p = t[u];
|
|
619
|
+
if (!p) continue;
|
|
620
|
+
if (p.left <= n.left && p.top <= n.top && p.left + p.width >= n.left + n.width && p.top + p.height >= n.top + n.height) {
|
|
621
|
+
const g = Number(r[u]);
|
|
622
|
+
g < f && (f = g, l = u);
|
|
610
623
|
}
|
|
611
624
|
}
|
|
612
|
-
e[
|
|
625
|
+
e[s] = l;
|
|
613
626
|
}
|
|
614
627
|
const i = Array.from(
|
|
615
628
|
{ length: a.length },
|
|
616
629
|
() => []
|
|
617
630
|
);
|
|
618
|
-
for (let
|
|
619
|
-
const n = e[
|
|
620
|
-
n != null && i[n] && i[n].push(
|
|
631
|
+
for (let s = 0; s < a.length; s++) {
|
|
632
|
+
const n = e[s];
|
|
633
|
+
n != null && i[n] && i[n].push(s);
|
|
621
634
|
}
|
|
622
635
|
const c = [];
|
|
623
|
-
for (let
|
|
624
|
-
(e[
|
|
636
|
+
for (let s = 0; s < a.length; s++)
|
|
637
|
+
(e[s] === null || e[s] === void 0) && c.push(s);
|
|
625
638
|
return {
|
|
626
639
|
type: "groups",
|
|
627
|
-
groups: a.map((
|
|
628
|
-
flat: Array.from(
|
|
629
|
-
hidden:
|
|
640
|
+
groups: a.map((s) => s.slice()),
|
|
641
|
+
flat: Array.from(D),
|
|
642
|
+
hidden: I.slice(),
|
|
630
643
|
groupRects: t,
|
|
631
644
|
groupNesting: { parents: e, children: i, roots: c }
|
|
632
645
|
};
|
|
633
646
|
}
|
|
634
|
-
return { type: "single", selected: Array.from(
|
|
647
|
+
return { type: "single", selected: Array.from(D) };
|
|
635
648
|
}, F = () => {
|
|
636
|
-
const t =
|
|
637
|
-
if (
|
|
649
|
+
const t = ut();
|
|
650
|
+
if (Gt)
|
|
638
651
|
try {
|
|
639
|
-
|
|
652
|
+
Gt(t);
|
|
640
653
|
} catch {
|
|
641
654
|
}
|
|
642
|
-
for (const
|
|
655
|
+
for (const r of Z)
|
|
643
656
|
try {
|
|
644
|
-
|
|
657
|
+
r(t);
|
|
645
658
|
} catch {
|
|
646
659
|
}
|
|
647
|
-
const e =
|
|
648
|
-
for (const
|
|
660
|
+
const e = $t.splice(0);
|
|
661
|
+
for (const r of e)
|
|
649
662
|
try {
|
|
650
|
-
|
|
663
|
+
r(t);
|
|
651
664
|
} catch {
|
|
652
665
|
}
|
|
653
|
-
},
|
|
666
|
+
}, Kt = {
|
|
654
667
|
destroy() {
|
|
655
|
-
document.removeEventListener("mousedown",
|
|
656
|
-
(e) => e.forEach((
|
|
657
|
-
), a = [],
|
|
668
|
+
document.removeEventListener("mousedown", Ht), document.removeEventListener("mousemove", Ut), document.removeEventListener("mouseup", jt), $ && $.parentNode && $.parentNode.removeChild($), $ = null, B.querySelectorAll(`.${st}`).forEach((e) => e.classList.remove(st)), rt && (B.removeEventListener("mouseleave", Wt), at(null)), q && (window.removeEventListener("scroll", pt, !0), window.removeEventListener("resize", pt)), q && vt && B.removeEventListener("dblclick", Vt), et(), a.forEach(
|
|
669
|
+
(e) => e.forEach((r) => r.style.visibility = "")
|
|
670
|
+
), a = [], I = [], H = [], U = [], k = null, D.clear(), Z.splice(0), $t.splice(0);
|
|
658
671
|
},
|
|
659
672
|
getGroups() {
|
|
660
673
|
return a.slice();
|
|
661
674
|
},
|
|
662
675
|
clearGroups() {
|
|
663
676
|
a.forEach(
|
|
664
|
-
(e) => e.forEach((
|
|
665
|
-
), a = [],
|
|
677
|
+
(e) => e.forEach((r) => r.style.visibility = "")
|
|
678
|
+
), a = [], I = [], H = [], U = [], k = null, et(), O(/* @__PURE__ */ new Set());
|
|
666
679
|
},
|
|
667
680
|
removeGroup(t) {
|
|
668
|
-
return
|
|
681
|
+
return Dt(t);
|
|
669
682
|
},
|
|
670
683
|
addGroup(t) {
|
|
671
|
-
return
|
|
684
|
+
return pe(t);
|
|
672
685
|
},
|
|
673
686
|
setGroupVisibility(t, e) {
|
|
674
|
-
return
|
|
687
|
+
return ct(t, e);
|
|
675
688
|
},
|
|
676
689
|
toggleGroupVisibility(t) {
|
|
677
|
-
return t < 0 || t >= a.length ? !1 : (
|
|
690
|
+
return t < 0 || t >= a.length ? !1 : (I[t] = !I[t], Bt(t), N(), !0);
|
|
678
691
|
},
|
|
679
692
|
getSelectionResult() {
|
|
680
|
-
return
|
|
693
|
+
return ut();
|
|
681
694
|
},
|
|
682
695
|
refresh() {
|
|
683
|
-
|
|
696
|
+
N();
|
|
684
697
|
},
|
|
685
698
|
hideOverlays() {
|
|
686
|
-
|
|
699
|
+
et();
|
|
687
700
|
},
|
|
688
701
|
showAndRefreshOverlays() {
|
|
689
|
-
|
|
702
|
+
N();
|
|
690
703
|
},
|
|
691
704
|
// 获取当前组级嵌套信息
|
|
692
705
|
getGroupNesting() {
|
|
693
|
-
const t =
|
|
706
|
+
const t = ut();
|
|
694
707
|
return t.type === "groups" ? t.groupNesting : null;
|
|
695
708
|
},
|
|
696
|
-
setToolbarButtonProps(t, e,
|
|
697
|
-
return
|
|
709
|
+
setToolbarButtonProps(t, e, r) {
|
|
710
|
+
return fe(t, e, r);
|
|
711
|
+
},
|
|
712
|
+
setViewScale(t) {
|
|
698
713
|
},
|
|
699
714
|
onSelectionEnd(t) {
|
|
700
|
-
return
|
|
701
|
-
const e =
|
|
702
|
-
e >= 0 &&
|
|
715
|
+
return Z.push(t), () => {
|
|
716
|
+
const e = Z.indexOf(t);
|
|
717
|
+
e >= 0 && Z.splice(e, 1);
|
|
703
718
|
};
|
|
704
719
|
},
|
|
705
720
|
waitForSelectionEnd() {
|
|
706
721
|
return new Promise((t) => {
|
|
707
|
-
|
|
722
|
+
$t.push(t);
|
|
708
723
|
});
|
|
709
724
|
}
|
|
710
725
|
};
|
|
711
|
-
return
|
|
726
|
+
return Tt = Kt, Kt;
|
|
712
727
|
}
|
|
713
728
|
export {
|
|
714
|
-
|
|
715
|
-
|
|
729
|
+
ye as default,
|
|
730
|
+
ye as marqueeSelection
|
|
716
731
|
};
|
|
717
732
|
//# sourceMappingURL=marquee-selection.es.js.map
|