@annotorious/core 3.0.0-rc.27 → 3.0.0-rc.29
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/annotorious-core.es.js +229 -227
- package/dist/annotorious-core.es.js.map +1 -1
- package/dist/lifecycle/Lifecycle.d.ts +2 -2
- package/dist/lifecycle/Lifecycle.d.ts.map +1 -1
- package/dist/model/Annotator.d.ts +2 -2
- package/dist/model/Annotator.d.ts.map +1 -1
- package/dist/state/Selection.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
var
|
|
1
|
+
var M = Object.prototype.hasOwnProperty;
|
|
2
2
|
function B(e, n) {
|
|
3
3
|
var t, o;
|
|
4
|
-
if (e === n)
|
|
5
|
-
return !0;
|
|
4
|
+
if (e === n) return !0;
|
|
6
5
|
if (e && n && (t = e.constructor) === n.constructor) {
|
|
7
|
-
if (t === Date)
|
|
8
|
-
|
|
9
|
-
if (t === RegExp)
|
|
10
|
-
return e.toString() === n.toString();
|
|
6
|
+
if (t === Date) return e.getTime() === n.getTime();
|
|
7
|
+
if (t === RegExp) return e.toString() === n.toString();
|
|
11
8
|
if (t === Array) {
|
|
12
9
|
if ((o = e.length) === n.length)
|
|
13
|
-
for (; o-- && B(e[o], n[o]); )
|
|
14
|
-
;
|
|
10
|
+
for (; o-- && B(e[o], n[o]); ) ;
|
|
15
11
|
return o === -1;
|
|
16
12
|
}
|
|
17
13
|
if (!t || typeof e == "object") {
|
|
18
14
|
o = 0;
|
|
19
15
|
for (t in e)
|
|
20
|
-
if (
|
|
21
|
-
return !1;
|
|
16
|
+
if (M.call(e, t) && ++o && !M.call(n, t) || !(t in n) || !B(e[t], n[t])) return !1;
|
|
22
17
|
return Object.keys(n).length === o;
|
|
23
18
|
}
|
|
24
19
|
}
|
|
@@ -26,19 +21,19 @@ function B(e, n) {
|
|
|
26
21
|
}
|
|
27
22
|
function z() {
|
|
28
23
|
}
|
|
29
|
-
function
|
|
24
|
+
function H(e, n) {
|
|
30
25
|
return e != e ? n == n : e !== n || e && typeof e == "object" || typeof e == "function";
|
|
31
26
|
}
|
|
32
27
|
const k = [];
|
|
33
|
-
function
|
|
28
|
+
function Y(e, n = z) {
|
|
34
29
|
let t;
|
|
35
30
|
const o = /* @__PURE__ */ new Set();
|
|
36
31
|
function i(b) {
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
32
|
+
if (H(e, b) && (e = b, t)) {
|
|
33
|
+
const y = !k.length;
|
|
39
34
|
for (const u of o)
|
|
40
35
|
u[1](), k.push(u, e);
|
|
41
|
-
if (
|
|
36
|
+
if (y) {
|
|
42
37
|
for (let u = 0; u < k.length; u += 2)
|
|
43
38
|
k[u][0](k[u + 1]);
|
|
44
39
|
k.length = 0;
|
|
@@ -48,16 +43,16 @@ function _(e, n = z) {
|
|
|
48
43
|
function p(b) {
|
|
49
44
|
i(b(e));
|
|
50
45
|
}
|
|
51
|
-
function w(b,
|
|
52
|
-
const u = [b,
|
|
46
|
+
function w(b, y = z) {
|
|
47
|
+
const u = [b, y];
|
|
53
48
|
return o.add(u), o.size === 1 && (t = n(i, p) || z), b(e), () => {
|
|
54
49
|
o.delete(u), o.size === 0 && t && (t(), t = null);
|
|
55
50
|
};
|
|
56
51
|
}
|
|
57
52
|
return { set: i, update: p, subscribe: w };
|
|
58
53
|
}
|
|
59
|
-
const
|
|
60
|
-
const { subscribe: n, set: t } =
|
|
54
|
+
const Ce = (e) => {
|
|
55
|
+
const { subscribe: n, set: t } = Y();
|
|
61
56
|
let o;
|
|
62
57
|
return n((i) => o = i), e.observe(({ changes: i }) => {
|
|
63
58
|
if (o) {
|
|
@@ -73,9 +68,9 @@ const we = (e) => {
|
|
|
73
68
|
set: t
|
|
74
69
|
};
|
|
75
70
|
};
|
|
76
|
-
var
|
|
77
|
-
const V = { selected: [] },
|
|
78
|
-
const { subscribe: t, set: o } =
|
|
71
|
+
var F = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE = "NONE", e))(F || {});
|
|
72
|
+
const V = { selected: [] }, Le = (e, n = "EDIT") => {
|
|
73
|
+
const { subscribe: t, set: o } = Y(V);
|
|
79
74
|
let i = V;
|
|
80
75
|
t((s) => i = s);
|
|
81
76
|
const p = () => o(V), w = () => {
|
|
@@ -86,25 +81,30 @@ const V = { selected: [] }, Ce = (e, n = "EDIT") => {
|
|
|
86
81
|
return !1;
|
|
87
82
|
const h = typeof s == "string" ? s : s.id;
|
|
88
83
|
return i.selected.some((L) => L.id === h);
|
|
89
|
-
},
|
|
84
|
+
}, y = (s, h) => {
|
|
90
85
|
const L = e.getAnnotation(s);
|
|
91
86
|
if (L) {
|
|
92
|
-
const
|
|
93
|
-
o(
|
|
87
|
+
const v = P(L, n);
|
|
88
|
+
o(v === "EDIT" ? { selected: [{ id: s, editable: !0 }], pointerEvent: h } : v === "SELECT" ? { selected: [{ id: s }], pointerEvent: h } : { selected: [], pointerEvent: h });
|
|
94
89
|
} else
|
|
95
90
|
console.warn("Invalid selection: " + s);
|
|
96
|
-
}, u = (s, h
|
|
97
|
-
const L = Array.isArray(s) ? s : [s],
|
|
98
|
-
o({
|
|
91
|
+
}, u = (s, h) => {
|
|
92
|
+
const L = Array.isArray(s) ? s : [s], v = L.map((S) => e.getAnnotation(S)).filter(Boolean);
|
|
93
|
+
o({
|
|
94
|
+
selected: v.map((S) => {
|
|
95
|
+
const E = h === void 0 ? P(S, n) === "EDIT" : h;
|
|
96
|
+
return { id: S.id, editable: E };
|
|
97
|
+
})
|
|
98
|
+
}), v.length !== L.length && console.warn("Invalid selection", s);
|
|
99
99
|
}, U = (s) => {
|
|
100
100
|
if (i.selected.length === 0)
|
|
101
101
|
return !1;
|
|
102
102
|
const { selected: h } = i;
|
|
103
|
-
h.filter(({ id:
|
|
103
|
+
h.filter(({ id: v }) => s.includes(v)).length > 0 && o({ selected: h.filter(({ id: v }) => !s.includes(v)) });
|
|
104
104
|
};
|
|
105
105
|
return e.observe(({ changes: s }) => U((s.deleted || []).map((h) => h.id))), {
|
|
106
106
|
clear: p,
|
|
107
|
-
clickSelect:
|
|
107
|
+
clickSelect: y,
|
|
108
108
|
get selected() {
|
|
109
109
|
return i ? [...i.selected] : null;
|
|
110
110
|
},
|
|
@@ -116,73 +116,73 @@ const V = { selected: [] }, Ce = (e, n = "EDIT") => {
|
|
|
116
116
|
setSelected: u,
|
|
117
117
|
subscribe: t
|
|
118
118
|
};
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
}, P = (e, n) => typeof n == "function" ? n(e) || "EDIT" : n || "EDIT";
|
|
120
|
+
var D = [];
|
|
121
|
+
for (var _ = 0; _ < 256; ++_)
|
|
122
|
+
D.push((_ + 256).toString(16).slice(1));
|
|
123
|
+
function J(e, n = 0) {
|
|
124
|
+
return (D[e[n + 0]] + D[e[n + 1]] + D[e[n + 2]] + D[e[n + 3]] + "-" + D[e[n + 4]] + D[e[n + 5]] + "-" + D[e[n + 6]] + D[e[n + 7]] + "-" + D[e[n + 8]] + D[e[n + 9]] + "-" + D[e[n + 10]] + D[e[n + 11]] + D[e[n + 12]] + D[e[n + 13]] + D[e[n + 14]] + D[e[n + 15]]).toLowerCase();
|
|
125
|
+
}
|
|
126
|
+
var $, Q = new Uint8Array(16);
|
|
127
|
+
function X() {
|
|
123
128
|
if (!$ && ($ = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !$))
|
|
124
129
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
125
|
-
return $(
|
|
130
|
+
return $(Q);
|
|
126
131
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
function Q(e, n = 0) {
|
|
131
|
-
return D[e[n + 0]] + D[e[n + 1]] + D[e[n + 2]] + D[e[n + 3]] + "-" + D[e[n + 4]] + D[e[n + 5]] + "-" + D[e[n + 6]] + D[e[n + 7]] + "-" + D[e[n + 8]] + D[e[n + 9]] + "-" + D[e[n + 10]] + D[e[n + 11]] + D[e[n + 12]] + D[e[n + 13]] + D[e[n + 14]] + D[e[n + 15]];
|
|
132
|
-
}
|
|
133
|
-
const X = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), M = {
|
|
134
|
-
randomUUID: X
|
|
132
|
+
var Z = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
133
|
+
const W = {
|
|
134
|
+
randomUUID: Z
|
|
135
135
|
};
|
|
136
|
-
function
|
|
137
|
-
if (
|
|
138
|
-
return
|
|
136
|
+
function K(e, n, t) {
|
|
137
|
+
if (W.randomUUID && !n && !e)
|
|
138
|
+
return W.randomUUID();
|
|
139
139
|
e = e || {};
|
|
140
|
-
|
|
141
|
-
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128,
|
|
140
|
+
var o = e.random || (e.rng || X)();
|
|
141
|
+
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, J(o);
|
|
142
142
|
}
|
|
143
|
-
const
|
|
143
|
+
const Ue = (e) => {
|
|
144
144
|
const { creator: n, updatedBy: t } = e.target, o = e.bodies.reduce((i, p) => [...i, p.creator, p.updatedBy].filter(Boolean), []);
|
|
145
145
|
return [
|
|
146
146
|
n,
|
|
147
147
|
t,
|
|
148
148
|
...o
|
|
149
149
|
].filter((i) => i);
|
|
150
|
-
},
|
|
151
|
-
id:
|
|
150
|
+
}, Se = (e, n, t, o) => ({
|
|
151
|
+
id: K(),
|
|
152
152
|
annotation: e.id,
|
|
153
153
|
created: t || /* @__PURE__ */ new Date(),
|
|
154
154
|
creator: o,
|
|
155
155
|
...n
|
|
156
|
-
}),
|
|
156
|
+
}), ee = (e, n) => {
|
|
157
157
|
const t = new Set(e.bodies.map((o) => o.id));
|
|
158
158
|
return n.bodies.filter((o) => !t.has(o.id));
|
|
159
|
-
},
|
|
159
|
+
}, te = (e, n) => {
|
|
160
160
|
const t = new Set(n.bodies.map((o) => o.id));
|
|
161
161
|
return e.bodies.filter((o) => !t.has(o.id));
|
|
162
|
-
},
|
|
162
|
+
}, ne = (e, n) => n.bodies.map((t) => {
|
|
163
163
|
const o = e.bodies.find((i) => i.id === t.id);
|
|
164
164
|
return { newBody: t, oldBody: o && !B(o, t) ? o : void 0 };
|
|
165
|
-
}).filter(({ oldBody: t }) => t).map(({ oldBody: t, newBody: o }) => ({ oldBody: t, newBody: o })),
|
|
166
|
-
const t =
|
|
165
|
+
}).filter(({ oldBody: t }) => t).map(({ oldBody: t, newBody: o }) => ({ oldBody: t, newBody: o })), oe = (e, n) => !B(e.target, n.target), q = (e, n) => {
|
|
166
|
+
const t = ee(e, n), o = te(e, n), i = ne(e, n);
|
|
167
167
|
return {
|
|
168
168
|
oldValue: e,
|
|
169
169
|
newValue: n,
|
|
170
170
|
bodiesCreated: t.length > 0 ? t : void 0,
|
|
171
171
|
bodiesDeleted: o.length > 0 ? o : void 0,
|
|
172
172
|
bodiesUpdated: i.length > 0 ? i : void 0,
|
|
173
|
-
targetUpdated:
|
|
173
|
+
targetUpdated: oe(e, n) ? { oldTarget: e.target, newTarget: n.target } : void 0
|
|
174
174
|
};
|
|
175
175
|
};
|
|
176
|
-
var
|
|
177
|
-
const
|
|
176
|
+
var se = /* @__PURE__ */ ((e) => (e.BODY_ONLY = "BODY_ONLY", e.TARGET_ONLY = "TARGET_ONLY", e))(se || {}), O = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(O || {});
|
|
177
|
+
const ie = (e, n) => {
|
|
178
178
|
var p, w;
|
|
179
179
|
const { changes: t, origin: o } = n;
|
|
180
180
|
if (!(!e.options.origin || e.options.origin === o))
|
|
181
181
|
return !1;
|
|
182
182
|
if (e.options.ignore) {
|
|
183
|
-
const { ignore: b } = e.options,
|
|
184
|
-
if (!(
|
|
185
|
-
const U = (p = t.updated) == null ? void 0 : p.some((h) =>
|
|
183
|
+
const { ignore: b } = e.options, y = (U) => U && U.length > 0;
|
|
184
|
+
if (!(y(t.created) || y(t.deleted))) {
|
|
185
|
+
const U = (p = t.updated) == null ? void 0 : p.some((h) => y(h.bodiesCreated) || y(h.bodiesDeleted) || y(h.bodiesUpdated)), s = (w = t.updated) == null ? void 0 : w.some((h) => h.targetUpdated);
|
|
186
186
|
if (b === "BODY_ONLY" && U && !s || b === "TARGET_ONLY" && s && !U)
|
|
187
187
|
return !1;
|
|
188
188
|
}
|
|
@@ -196,8 +196,8 @@ const se = (e, n) => {
|
|
|
196
196
|
return !!(Array.isArray(e.options.annotations) ? e.options.annotations : [e.options.annotations]).find((u) => b.has(u));
|
|
197
197
|
} else
|
|
198
198
|
return !0;
|
|
199
|
-
},
|
|
200
|
-
const t = new Set((e.created || []).map((s) => s.id)), o = new Set((e.updated || []).map(({ newValue: s }) => s.id)), i = new Set((n.created || []).map((s) => s.id)), p = new Set((n.deleted || []).map((s) => s.id)), w = new Set((n.updated || []).map(({ oldValue: s }) => s.id)), b = new Set((n.updated || []).filter(({ oldValue: s }) => t.has(s.id) || o.has(s.id)).map(({ oldValue: s }) => s.id)),
|
|
199
|
+
}, de = (e, n) => {
|
|
200
|
+
const t = new Set((e.created || []).map((s) => s.id)), o = new Set((e.updated || []).map(({ newValue: s }) => s.id)), i = new Set((n.created || []).map((s) => s.id)), p = new Set((n.deleted || []).map((s) => s.id)), w = new Set((n.updated || []).map(({ oldValue: s }) => s.id)), b = new Set((n.updated || []).filter(({ oldValue: s }) => t.has(s.id) || o.has(s.id)).map(({ oldValue: s }) => s.id)), y = [
|
|
201
201
|
...(e.created || []).filter((s) => !p.has(s.id)).map((s) => w.has(s.id) ? n.updated.find(({ oldValue: h }) => h.id === s.id).newValue : s),
|
|
202
202
|
...n.created || []
|
|
203
203
|
], u = [
|
|
@@ -207,15 +207,15 @@ const se = (e, n) => {
|
|
|
207
207
|
...(e.updated || []).filter(({ newValue: s }) => !p.has(s.id)).map((s) => {
|
|
208
208
|
const { oldValue: h, newValue: L } = s;
|
|
209
209
|
if (w.has(L.id)) {
|
|
210
|
-
const
|
|
211
|
-
return
|
|
210
|
+
const v = n.updated.find((S) => S.oldValue.id === L.id).newValue;
|
|
211
|
+
return q(h, v);
|
|
212
212
|
} else
|
|
213
213
|
return s;
|
|
214
214
|
}),
|
|
215
215
|
...(n.updated || []).filter(({ oldValue: s }) => !b.has(s.id))
|
|
216
216
|
];
|
|
217
|
-
return { created:
|
|
218
|
-
},
|
|
217
|
+
return { created: y, deleted: u, updated: U };
|
|
218
|
+
}, ae = (e) => e.id !== void 0, Oe = () => {
|
|
219
219
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), t = [], o = (d, r = {}) => t.push({ onChange: d, options: r }), i = (d) => {
|
|
220
220
|
const r = t.findIndex((c) => c.onChange == d);
|
|
221
221
|
r > -1 && t.splice(r, 1);
|
|
@@ -230,7 +230,7 @@ const se = (e, n) => {
|
|
|
230
230
|
state: [...e.values()]
|
|
231
231
|
};
|
|
232
232
|
t.forEach((f) => {
|
|
233
|
-
|
|
233
|
+
ie(f, c) && f.onChange(c);
|
|
234
234
|
});
|
|
235
235
|
}, w = (d, r = O.LOCAL) => {
|
|
236
236
|
if (e.get(d.id))
|
|
@@ -239,12 +239,12 @@ const se = (e, n) => {
|
|
|
239
239
|
}, b = (d, r) => {
|
|
240
240
|
const c = typeof d == "string" ? r : d, f = typeof d == "string" ? d : d.id, C = e.get(f);
|
|
241
241
|
if (C) {
|
|
242
|
-
const T =
|
|
243
|
-
return f === c.id ? e.set(f, c) : (e.delete(f), e.set(c.id, c)), C.bodies.forEach((
|
|
242
|
+
const T = q(C, c);
|
|
243
|
+
return f === c.id ? e.set(f, c) : (e.delete(f), e.set(c.id, c)), C.bodies.forEach((x) => n.delete(x.id)), c.bodies.forEach((x) => n.set(x.id, c.id)), T;
|
|
244
244
|
} else
|
|
245
245
|
console.warn(`Cannot update annotation ${f} - does not exist`);
|
|
246
|
-
},
|
|
247
|
-
const f =
|
|
246
|
+
}, y = (d, r = O.LOCAL, c = O.LOCAL) => {
|
|
247
|
+
const f = ae(r) ? c : r, C = b(d, r);
|
|
248
248
|
C && p(f, { updated: [C] });
|
|
249
249
|
}, u = (d, r = O.LOCAL) => {
|
|
250
250
|
const c = d.reduce((f, C) => {
|
|
@@ -277,8 +277,8 @@ const se = (e, n) => {
|
|
|
277
277
|
}), p(c, { created: d, deleted: f });
|
|
278
278
|
} else {
|
|
279
279
|
const f = d.reduce((C, T) => {
|
|
280
|
-
const
|
|
281
|
-
return
|
|
280
|
+
const x = e.get(T.id);
|
|
281
|
+
return x ? [...C, x] : C;
|
|
282
282
|
}, []);
|
|
283
283
|
if (f.length > 0)
|
|
284
284
|
throw Error(`Bulk insert would overwrite the following annotations: ${f.map((C) => C.id).join(", ")}`);
|
|
@@ -286,17 +286,17 @@ const se = (e, n) => {
|
|
|
286
286
|
e.set(C.id, C), C.bodies.forEach((T) => n.set(T.id, C.id));
|
|
287
287
|
}), p(c, { created: d });
|
|
288
288
|
}
|
|
289
|
-
},
|
|
289
|
+
}, v = (d) => {
|
|
290
290
|
const r = typeof d == "string" ? d : d.id, c = e.get(r);
|
|
291
291
|
if (c)
|
|
292
292
|
return e.delete(r), c.bodies.forEach((f) => n.delete(f.id)), c;
|
|
293
293
|
console.warn(`Attempt to delete missing annotation: ${r}`);
|
|
294
294
|
}, S = (d, r = O.LOCAL) => {
|
|
295
|
-
const c =
|
|
295
|
+
const c = v(d);
|
|
296
296
|
c && p(r, { deleted: [c] });
|
|
297
|
-
},
|
|
297
|
+
}, E = (d, r = O.LOCAL) => {
|
|
298
298
|
const c = d.reduce((f, C) => {
|
|
299
|
-
const T =
|
|
299
|
+
const T = v(C);
|
|
300
300
|
return T ? [...f, T] : f;
|
|
301
301
|
}, []);
|
|
302
302
|
c.length > 0 && p(r, { deleted: c });
|
|
@@ -325,13 +325,13 @@ const se = (e, n) => {
|
|
|
325
325
|
}, a = (d, r = O.LOCAL) => {
|
|
326
326
|
const c = d.map((f) => l(f)).filter(Boolean);
|
|
327
327
|
c.length > 0 && p(r, { updated: c });
|
|
328
|
-
},
|
|
328
|
+
}, m = (d) => {
|
|
329
329
|
const r = e.get(d);
|
|
330
330
|
return r ? { ...r } : void 0;
|
|
331
|
-
},
|
|
331
|
+
}, A = (d) => {
|
|
332
332
|
const r = n.get(d);
|
|
333
333
|
if (r) {
|
|
334
|
-
const f =
|
|
334
|
+
const f = m(r).bodies.find((C) => C.id === d);
|
|
335
335
|
if (f)
|
|
336
336
|
return f;
|
|
337
337
|
console.error(`Store integrity error: body ${d} in index, but not in annotation`);
|
|
@@ -356,10 +356,10 @@ const se = (e, n) => {
|
|
|
356
356
|
}, N = (d, r, c = O.LOCAL) => {
|
|
357
357
|
const f = R(d, r);
|
|
358
358
|
f && p(c, { updated: [f] });
|
|
359
|
-
},
|
|
359
|
+
}, I = (d, r = O.LOCAL) => {
|
|
360
360
|
const c = d.map((f) => R({ id: f.id, annotation: f.annotation }, f)).filter(Boolean);
|
|
361
361
|
p(r, { updated: c });
|
|
362
|
-
},
|
|
362
|
+
}, j = (d) => {
|
|
363
363
|
const r = e.get(d.annotation);
|
|
364
364
|
if (r) {
|
|
365
365
|
const c = {
|
|
@@ -385,36 +385,36 @@ const se = (e, n) => {
|
|
|
385
385
|
addBody: U,
|
|
386
386
|
all: s,
|
|
387
387
|
bulkAddAnnotation: L,
|
|
388
|
-
bulkDeleteAnnotation:
|
|
388
|
+
bulkDeleteAnnotation: E,
|
|
389
389
|
bulkDeleteBodies: a,
|
|
390
390
|
bulkUpdateAnnotation: u,
|
|
391
|
-
bulkUpdateBodies:
|
|
391
|
+
bulkUpdateBodies: I,
|
|
392
392
|
bulkUpdateTargets: (d, r = O.LOCAL) => {
|
|
393
|
-
const c = d.map((f) =>
|
|
393
|
+
const c = d.map((f) => j(f)).filter(Boolean);
|
|
394
394
|
c.length > 0 && p(r, { updated: c });
|
|
395
395
|
},
|
|
396
396
|
clear: h,
|
|
397
397
|
deleteAnnotation: S,
|
|
398
398
|
deleteBody: g,
|
|
399
|
-
getAnnotation:
|
|
400
|
-
getBody:
|
|
399
|
+
getAnnotation: m,
|
|
400
|
+
getBody: A,
|
|
401
401
|
observe: o,
|
|
402
402
|
unobserve: i,
|
|
403
|
-
updateAnnotation:
|
|
403
|
+
updateAnnotation: y,
|
|
404
404
|
updateBody: N,
|
|
405
405
|
updateTarget: (d, r = O.LOCAL) => {
|
|
406
|
-
const c =
|
|
406
|
+
const c = j(d);
|
|
407
407
|
c && p(r, { updated: [c] });
|
|
408
408
|
}
|
|
409
409
|
};
|
|
410
|
-
},
|
|
410
|
+
}, Te = (e) => ({
|
|
411
411
|
...e,
|
|
412
412
|
subscribe: (t) => {
|
|
413
413
|
const o = (i) => t(i.state);
|
|
414
414
|
return e.observe(o), t(e.all()), () => e.unobserve(o);
|
|
415
415
|
}
|
|
416
416
|
});
|
|
417
|
-
let
|
|
417
|
+
let G = () => ({
|
|
418
418
|
emit(e, ...n) {
|
|
419
419
|
for (let t = 0, o = this.events[e] || [], i = o.length; t < i; t++)
|
|
420
420
|
o[t](...n);
|
|
@@ -428,76 +428,79 @@ let W = () => ({
|
|
|
428
428
|
};
|
|
429
429
|
}
|
|
430
430
|
});
|
|
431
|
-
const
|
|
432
|
-
const n =
|
|
431
|
+
const re = 250, De = (e) => {
|
|
432
|
+
const n = G(), t = [];
|
|
433
433
|
let o = -1, i = !1, p = 0;
|
|
434
434
|
const w = (a) => {
|
|
435
435
|
if (!i) {
|
|
436
|
-
const { changes:
|
|
437
|
-
if (
|
|
438
|
-
t.splice(o + 1), t.push(
|
|
436
|
+
const { changes: m } = a, A = performance.now();
|
|
437
|
+
if (A - p > re)
|
|
438
|
+
t.splice(o + 1), t.push(m), o = t.length - 1;
|
|
439
439
|
else {
|
|
440
440
|
const R = t.length - 1;
|
|
441
|
-
t[R] =
|
|
441
|
+
t[R] = de(t[R], m);
|
|
442
442
|
}
|
|
443
|
-
p =
|
|
443
|
+
p = A;
|
|
444
444
|
}
|
|
445
445
|
i = !1;
|
|
446
446
|
};
|
|
447
447
|
e.observe(w, { origin: O.LOCAL });
|
|
448
|
-
const b = (a) => a && a.length > 0 && e.bulkDeleteAnnotation(a),
|
|
448
|
+
const b = (a) => a && a.length > 0 && e.bulkDeleteAnnotation(a), y = (a) => a && a.length > 0 && e.bulkAddAnnotation(a, !1), u = (a) => a && a.length > 0 && e.bulkUpdateAnnotation(a.map(({ oldValue: m }) => m)), U = (a) => a && a.length > 0 && e.bulkUpdateAnnotation(a.map(({ newValue: m }) => m)), s = (a) => a && a.length > 0 && e.bulkAddAnnotation(a, !1), h = (a) => a && a.length > 0 && e.bulkDeleteAnnotation(a);
|
|
449
449
|
return {
|
|
450
450
|
canRedo: () => t.length - 1 > o,
|
|
451
451
|
canUndo: () => o > -1,
|
|
452
452
|
destroy: () => e.unobserve(w),
|
|
453
|
-
on: (a,
|
|
453
|
+
on: (a, m) => n.on(a, m),
|
|
454
454
|
redo: () => {
|
|
455
455
|
if (t.length - 1 > o) {
|
|
456
456
|
i = !0;
|
|
457
|
-
const { created: a, updated:
|
|
458
|
-
|
|
457
|
+
const { created: a, updated: m, deleted: A } = t[o + 1];
|
|
458
|
+
y(a), U(m), h(A), n.emit("redo", t[o + 1]), o += 1;
|
|
459
459
|
}
|
|
460
460
|
},
|
|
461
461
|
undo: () => {
|
|
462
462
|
if (o > -1) {
|
|
463
463
|
i = !0;
|
|
464
|
-
const { created: a, updated:
|
|
465
|
-
b(a), u(
|
|
464
|
+
const { created: a, updated: m, deleted: A } = t[o];
|
|
465
|
+
b(a), u(m), s(A), n.emit("undo", t[o]), o -= 1;
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
};
|
|
469
|
-
},
|
|
470
|
-
const { subscribe: e, set: n } =
|
|
469
|
+
}, Re = () => {
|
|
470
|
+
const { subscribe: e, set: n } = Y([]);
|
|
471
471
|
return {
|
|
472
472
|
subscribe: e,
|
|
473
473
|
set: n
|
|
474
474
|
};
|
|
475
|
-
},
|
|
476
|
-
const { store: i, selection: p, hover: w, viewport: b } = e,
|
|
475
|
+
}, Be = (e, n, t, o) => {
|
|
476
|
+
const { store: i, selection: p, hover: w, viewport: b } = e, y = /* @__PURE__ */ new Map();
|
|
477
477
|
let u = [], U, s;
|
|
478
478
|
const h = (l, g) => {
|
|
479
|
-
|
|
479
|
+
y.has(l) ? y.get(l).push(g) : y.set(l, [g]);
|
|
480
480
|
}, L = (l, g) => {
|
|
481
|
-
const a =
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
481
|
+
const a = y.get(l);
|
|
482
|
+
if (a) {
|
|
483
|
+
const m = a.indexOf(g);
|
|
484
|
+
m !== -1 && a.splice(m, 1);
|
|
485
|
+
}
|
|
486
|
+
}, v = (l, g, a) => {
|
|
487
|
+
y.has(l) && setTimeout(() => {
|
|
488
|
+
y.get(l).forEach((m) => {
|
|
486
489
|
if (t) {
|
|
487
|
-
const
|
|
488
|
-
A
|
|
490
|
+
const A = Array.isArray(g) ? g.map((N) => t.serialize(N)) : t.serialize(g), R = a ? a instanceof PointerEvent ? a : t.serialize(a) : void 0;
|
|
491
|
+
m(A, R);
|
|
489
492
|
} else
|
|
490
|
-
|
|
493
|
+
m(g, a);
|
|
491
494
|
});
|
|
492
495
|
}, 1);
|
|
493
496
|
}, S = () => {
|
|
494
497
|
const { selected: l } = p, g = (l || []).map(({ id: a }) => i.getAnnotation(a));
|
|
495
498
|
g.forEach((a) => {
|
|
496
|
-
const
|
|
497
|
-
(!
|
|
499
|
+
const m = u.find((A) => A.id === a.id);
|
|
500
|
+
(!m || !B(m, a)) && v("updateAnnotation", a, m);
|
|
498
501
|
}), u = u.map((a) => {
|
|
499
|
-
const
|
|
500
|
-
return
|
|
502
|
+
const m = g.find(({ id: A }) => A === a.id);
|
|
503
|
+
return m || a;
|
|
501
504
|
});
|
|
502
505
|
};
|
|
503
506
|
p.subscribe(({ selected: l }) => {
|
|
@@ -507,50 +510,50 @@ const ae = 250, Te = (e) => {
|
|
|
507
510
|
else if (u.length > 0 && l.length === 0)
|
|
508
511
|
u.forEach((g) => {
|
|
509
512
|
const a = i.getAnnotation(g.id);
|
|
510
|
-
a && !B(a, g) &&
|
|
513
|
+
a && !B(a, g) && v("updateAnnotation", a, g);
|
|
511
514
|
}), u = [];
|
|
512
515
|
else {
|
|
513
|
-
const g = new Set(u.map((
|
|
514
|
-
u.filter((
|
|
515
|
-
const R = i.getAnnotation(
|
|
516
|
-
R && !B(R,
|
|
516
|
+
const g = new Set(u.map((A) => A.id)), a = new Set(l.map(({ id: A }) => A));
|
|
517
|
+
u.filter((A) => !a.has(A.id)).forEach((A) => {
|
|
518
|
+
const R = i.getAnnotation(A.id);
|
|
519
|
+
R && !B(R, A) && v("updateAnnotation", R, A);
|
|
517
520
|
}), u = [
|
|
518
521
|
// Remove annotations that were deselected
|
|
519
|
-
...u.filter((
|
|
522
|
+
...u.filter((A) => a.has(A.id)),
|
|
520
523
|
// Add editable annotations that were selected
|
|
521
|
-
...l.filter(({ id:
|
|
524
|
+
...l.filter(({ id: A }) => !g.has(A)).map(({ id: A }) => i.getAnnotation(A))
|
|
522
525
|
];
|
|
523
526
|
}
|
|
524
|
-
|
|
527
|
+
v("selectionChanged", u);
|
|
525
528
|
}
|
|
526
529
|
}), w.subscribe((l) => {
|
|
527
|
-
!U && l ?
|
|
528
|
-
}), b == null || b.subscribe((l) =>
|
|
530
|
+
!U && l ? v("mouseEnterAnnotation", i.getAnnotation(l)) : U && !l ? v("mouseLeaveAnnotation", i.getAnnotation(U)) : U && l && (v("mouseLeaveAnnotation", i.getAnnotation(U)), v("mouseEnterAnnotation", i.getAnnotation(l))), U = l;
|
|
531
|
+
}), b == null || b.subscribe((l) => v("viewportIntersect", l.map((g) => i.getAnnotation(g)))), i.observe((l) => {
|
|
529
532
|
o && (s && clearTimeout(s), s = setTimeout(S, 1e3));
|
|
530
533
|
const { created: g, deleted: a } = l.changes;
|
|
531
|
-
(g || []).forEach((
|
|
532
|
-
...
|
|
533
|
-
...
|
|
534
|
-
...
|
|
535
|
-
].length > 0).forEach(({ oldValue:
|
|
536
|
-
const N = u.find((
|
|
537
|
-
u = u.map((
|
|
534
|
+
(g || []).forEach((A) => v("createAnnotation", A)), (a || []).forEach((A) => v("deleteAnnotation", A)), (l.changes.updated || []).filter((A) => [
|
|
535
|
+
...A.bodiesCreated || [],
|
|
536
|
+
...A.bodiesDeleted || [],
|
|
537
|
+
...A.bodiesUpdated || []
|
|
538
|
+
].length > 0).forEach(({ oldValue: A, newValue: R }) => {
|
|
539
|
+
const N = u.find((I) => I.id === A.id) || A;
|
|
540
|
+
u = u.map((I) => I.id === A.id ? R : I), v("updateAnnotation", R, N);
|
|
538
541
|
});
|
|
539
542
|
}, { origin: O.LOCAL }), i.observe((l) => {
|
|
540
543
|
if (u) {
|
|
541
|
-
const g = new Set(u.map((
|
|
542
|
-
a.length > 0 && (u = u.map((
|
|
543
|
-
const
|
|
544
|
-
return
|
|
544
|
+
const g = new Set(u.map((m) => m.id)), a = (l.changes.updated || []).filter(({ newValue: m }) => g.has(m.id)).map(({ newValue: m }) => m);
|
|
545
|
+
a.length > 0 && (u = u.map((m) => {
|
|
546
|
+
const A = a.find((R) => R.id === m.id);
|
|
547
|
+
return A || m;
|
|
545
548
|
}));
|
|
546
549
|
}
|
|
547
550
|
}, { origin: O.REMOTE });
|
|
548
|
-
const
|
|
551
|
+
const E = (l) => (g) => {
|
|
549
552
|
const { updated: a } = g;
|
|
550
|
-
l ? (a || []).forEach((
|
|
553
|
+
l ? (a || []).forEach((m) => v("updateAnnotation", m.oldValue, m.newValue)) : (a || []).forEach((m) => v("updateAnnotation", m.newValue, m.oldValue));
|
|
551
554
|
};
|
|
552
|
-
return n.on("undo",
|
|
553
|
-
},
|
|
555
|
+
return n.on("undo", E(!0)), n.on("redo", E(!1)), { on: h, off: L, emit: v };
|
|
556
|
+
}, Ie = (e) => (n) => n.map((t) => e.serialize(t)), ce = (e) => (n) => n.reduce((t, o) => {
|
|
554
557
|
const { parsed: i, error: p } = e.parse(o);
|
|
555
558
|
return p ? {
|
|
556
559
|
parsed: t.parsed,
|
|
@@ -562,44 +565,44 @@ const ae = 250, Te = (e) => {
|
|
|
562
565
|
...t
|
|
563
566
|
};
|
|
564
567
|
}, { parsed: [], failed: [] }), xe = (e, n, t) => {
|
|
565
|
-
const { store: o, selection: i } = e, p = (
|
|
568
|
+
const { store: o, selection: i } = e, p = (E) => {
|
|
566
569
|
if (t) {
|
|
567
|
-
const { parsed: l, error: g } = t.parse(
|
|
570
|
+
const { parsed: l, error: g } = t.parse(E);
|
|
568
571
|
l ? o.addAnnotation(l, O.REMOTE) : console.error(g);
|
|
569
572
|
} else
|
|
570
|
-
o.addAnnotation(
|
|
571
|
-
}, w = () => i.clear(), b = () => o.clear(),
|
|
572
|
-
const l = o.getAnnotation(
|
|
573
|
+
o.addAnnotation(E, O.REMOTE);
|
|
574
|
+
}, w = () => i.clear(), b = () => o.clear(), y = (E) => {
|
|
575
|
+
const l = o.getAnnotation(E);
|
|
573
576
|
return t && l ? t.serialize(l) : l;
|
|
574
577
|
}, u = () => t ? o.all().map(t.serialize) : o.all(), U = () => {
|
|
575
578
|
var g;
|
|
576
579
|
const l = (((g = i.selected) == null ? void 0 : g.map((a) => a.id)) || []).map((a) => o.getAnnotation(a)).filter(Boolean);
|
|
577
580
|
return t ? l.map(t.serialize) : l;
|
|
578
|
-
}, s = (
|
|
579
|
-
if (typeof
|
|
580
|
-
const l = o.getAnnotation(
|
|
581
|
-
if (o.deleteAnnotation(
|
|
581
|
+
}, s = (E, l = !0) => fetch(E).then((g) => g.json()).then((g) => (L(g, l), g)), h = (E) => {
|
|
582
|
+
if (typeof E == "string") {
|
|
583
|
+
const l = o.getAnnotation(E);
|
|
584
|
+
if (o.deleteAnnotation(E), l)
|
|
582
585
|
return t ? t.serialize(l) : l;
|
|
583
586
|
} else {
|
|
584
|
-
const l = t ? t.parse(
|
|
587
|
+
const l = t ? t.parse(E).parsed : E;
|
|
585
588
|
if (l)
|
|
586
|
-
return o.deleteAnnotation(l),
|
|
589
|
+
return o.deleteAnnotation(l), E;
|
|
587
590
|
}
|
|
588
|
-
}, L = (
|
|
591
|
+
}, L = (E, l = !0) => {
|
|
589
592
|
if (t) {
|
|
590
|
-
const { parsed: g, failed: a } =
|
|
593
|
+
const { parsed: g, failed: a } = ce(t)(E);
|
|
591
594
|
a.length > 0 && console.warn(`Discarded ${a.length} invalid annotations`, a), o.bulkAddAnnotation(g, l, O.REMOTE);
|
|
592
595
|
} else
|
|
593
|
-
o.bulkAddAnnotation(
|
|
594
|
-
},
|
|
595
|
-
|
|
596
|
-
}, S = (
|
|
596
|
+
o.bulkAddAnnotation(E, l, O.REMOTE);
|
|
597
|
+
}, v = (E, l) => {
|
|
598
|
+
E ? i.setSelected(E, l) : i.clear();
|
|
599
|
+
}, S = (E) => {
|
|
597
600
|
if (t) {
|
|
598
|
-
const l = t.parse(
|
|
601
|
+
const l = t.parse(E).parsed, g = t.serialize(o.getAnnotation(l.id));
|
|
599
602
|
return o.updateAnnotation(l), g;
|
|
600
603
|
} else {
|
|
601
|
-
const l = o.getAnnotation(
|
|
602
|
-
return o.updateAnnotation(
|
|
604
|
+
const l = o.getAnnotation(E.id);
|
|
605
|
+
return o.updateAnnotation(E), l;
|
|
603
606
|
}
|
|
604
607
|
};
|
|
605
608
|
return {
|
|
@@ -608,36 +611,35 @@ const ae = 250, Te = (e) => {
|
|
|
608
611
|
canRedo: n.canRedo,
|
|
609
612
|
canUndo: n.canUndo,
|
|
610
613
|
clearAnnotations: b,
|
|
611
|
-
getAnnotationById:
|
|
614
|
+
getAnnotationById: y,
|
|
612
615
|
getAnnotations: u,
|
|
613
616
|
getSelected: U,
|
|
614
617
|
loadAnnotations: s,
|
|
615
618
|
redo: n.redo,
|
|
616
619
|
removeAnnotation: h,
|
|
617
620
|
setAnnotations: L,
|
|
618
|
-
setSelected:
|
|
621
|
+
setSelected: v,
|
|
619
622
|
undo: n.undo,
|
|
620
623
|
updateAnnotation: S
|
|
621
624
|
};
|
|
622
|
-
},
|
|
623
|
-
let
|
|
625
|
+
}, le = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
626
|
+
let ue = (e) => crypto.getRandomValues(new Uint8Array(e)), fe = (e, n, t) => {
|
|
624
627
|
let o = (2 << Math.log(e.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * n / e.length);
|
|
625
628
|
return (p = n) => {
|
|
626
629
|
let w = "";
|
|
627
630
|
for (; ; ) {
|
|
628
|
-
let b = t(i),
|
|
629
|
-
for (;
|
|
630
|
-
if (w += e[b[
|
|
631
|
-
return w;
|
|
631
|
+
let b = t(i), y = i;
|
|
632
|
+
for (; y--; )
|
|
633
|
+
if (w += e[b[y] & o] || "", w.length === p) return w;
|
|
632
634
|
}
|
|
633
635
|
};
|
|
634
|
-
},
|
|
636
|
+
}, pe = (e, n = 21) => fe(e, n, ue), he = (e = 21) => {
|
|
635
637
|
let n = "", t = crypto.getRandomValues(new Uint8Array(e));
|
|
636
638
|
for (; e--; )
|
|
637
|
-
n +=
|
|
639
|
+
n += le[t[e] & 63];
|
|
638
640
|
return n;
|
|
639
641
|
};
|
|
640
|
-
const
|
|
642
|
+
const ke = () => ({ isGuest: !0, id: pe("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), ge = (e) => {
|
|
641
643
|
const n = JSON.stringify(e);
|
|
642
644
|
let t = 0;
|
|
643
645
|
for (let o = 0, i = n.length; o < i; o++) {
|
|
@@ -645,20 +647,20 @@ const Ie = () => ({ isGuest: !0, id: fe("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
645
647
|
t = (t << 5) - t + p, t |= 0;
|
|
646
648
|
}
|
|
647
649
|
return `${t}`;
|
|
648
|
-
},
|
|
649
|
-
const { id: o, type: i, purpose: p, value: w, created: b, modified:
|
|
650
|
+
}, me = (e) => e ? typeof e == "object" ? { ...e } : e : void 0, Ne = (e, n) => (Array.isArray(e) ? e : [e]).map((t) => {
|
|
651
|
+
const { id: o, type: i, purpose: p, value: w, created: b, modified: y, creator: u, ...U } = t;
|
|
650
652
|
return {
|
|
651
|
-
id: o || `temp-${
|
|
653
|
+
id: o || `temp-${ge(t)}`,
|
|
652
654
|
annotation: n,
|
|
653
655
|
type: i,
|
|
654
656
|
purpose: p,
|
|
655
657
|
value: w,
|
|
656
|
-
creator:
|
|
658
|
+
creator: me(u),
|
|
657
659
|
created: b ? new Date(b) : void 0,
|
|
658
|
-
updated:
|
|
660
|
+
updated: y ? new Date(y) : void 0,
|
|
659
661
|
...U
|
|
660
662
|
};
|
|
661
|
-
}),
|
|
663
|
+
}), $e = (e) => e.map((n) => {
|
|
662
664
|
var b;
|
|
663
665
|
const { annotation: t, created: o, updated: i, ...p } = n, w = {
|
|
664
666
|
...p,
|
|
@@ -666,7 +668,7 @@ const Ie = () => ({ isGuest: !0, id: fe("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
666
668
|
modified: i == null ? void 0 : i.toISOString()
|
|
667
669
|
};
|
|
668
670
|
return (b = w.id) != null && b.startsWith("temp-") && delete w.id, w;
|
|
669
|
-
}),
|
|
671
|
+
}), Ae = [
|
|
670
672
|
"#ff7c00",
|
|
671
673
|
// orange
|
|
672
674
|
"#1ac938",
|
|
@@ -685,14 +687,14 @@ const Ie = () => ({ isGuest: !0, id: fe("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
685
687
|
// cyan
|
|
686
688
|
"#023eff"
|
|
687
689
|
// blue
|
|
688
|
-
],
|
|
689
|
-
const e = [...
|
|
690
|
+
], be = () => {
|
|
691
|
+
const e = [...Ae];
|
|
690
692
|
return { assignRandomColor: () => {
|
|
691
693
|
const o = Math.floor(Math.random() * e.length), i = e[o];
|
|
692
694
|
return e.splice(o, 1), i;
|
|
693
695
|
}, releaseColor: (o) => e.push(o) };
|
|
694
|
-
},
|
|
695
|
-
const e =
|
|
696
|
+
}, ve = () => {
|
|
697
|
+
const e = be();
|
|
696
698
|
return { addUser: (o, i) => {
|
|
697
699
|
const p = e.assignRandomColor();
|
|
698
700
|
return {
|
|
@@ -701,8 +703,8 @@ const Ie = () => ({ isGuest: !0, id: fe("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
701
703
|
color: p
|
|
702
704
|
};
|
|
703
705
|
}, removeUser: (o) => e.releaseColor(o.appearance.color) };
|
|
704
|
-
}, Ee = (e, n) => e.every((t) => e.includes(t)) && n.every((t) => e.includes(t)),
|
|
705
|
-
const n =
|
|
706
|
+
}, Ee = (e, n) => e.every((t) => e.includes(t)) && n.every((t) => e.includes(t)), ze = he(), Ve = (e = ve()) => {
|
|
707
|
+
const n = G(), t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (s, h) => {
|
|
706
708
|
if (t.has(s)) {
|
|
707
709
|
console.warn("Attempt to add user that is already present", s, h);
|
|
708
710
|
return;
|
|
@@ -721,20 +723,20 @@ const Ie = () => ({ isGuest: !0, id: fe("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
721
723
|
}
|
|
722
724
|
e.removeUser(h), t.delete(s);
|
|
723
725
|
}, w = (s) => {
|
|
724
|
-
const h = new Set(s.map((S) => S.presenceKey)), L = s.filter(({ presenceKey: S }) => !t.has(S)),
|
|
725
|
-
L.forEach(({ presenceKey: S, user:
|
|
726
|
-
const { presenceKey:
|
|
727
|
-
o.has(
|
|
728
|
-
}), (L.length > 0 ||
|
|
726
|
+
const h = new Set(s.map((S) => S.presenceKey)), L = s.filter(({ presenceKey: S }) => !t.has(S)), v = Array.from(t.values()).filter((S) => !h.has(S.presenceKey));
|
|
727
|
+
L.forEach(({ presenceKey: S, user: E }) => i(S, E)), v.forEach((S) => {
|
|
728
|
+
const { presenceKey: E } = S;
|
|
729
|
+
o.has(E) && n.emit("selectionChange", S, null), p(E);
|
|
730
|
+
}), (L.length > 0 || v.length > 0) && n.emit("presence", u());
|
|
729
731
|
}, b = (s, h) => {
|
|
730
732
|
const L = t.get(s);
|
|
731
733
|
if (!L) {
|
|
732
734
|
console.warn("Activity notification from user that is not present");
|
|
733
735
|
return;
|
|
734
736
|
}
|
|
735
|
-
const
|
|
736
|
-
(!
|
|
737
|
-
},
|
|
737
|
+
const v = o.get(s);
|
|
738
|
+
(!v || !Ee(v, h)) && (o.set(s, h), n.emit("selectionChange", L, h));
|
|
739
|
+
}, y = (s, h) => {
|
|
738
740
|
const L = t.get(s);
|
|
739
741
|
if (!L) {
|
|
740
742
|
console.warn("Selection change for user that is not present", s);
|
|
@@ -747,36 +749,36 @@ const Ie = () => ({ isGuest: !0, id: fe("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
747
749
|
notifyActivity: b,
|
|
748
750
|
on: (s, h) => n.on(s, h),
|
|
749
751
|
syncUsers: w,
|
|
750
|
-
updateSelection:
|
|
752
|
+
updateSelection: y
|
|
751
753
|
};
|
|
752
754
|
};
|
|
753
755
|
export {
|
|
754
|
-
|
|
756
|
+
se as Ignore,
|
|
755
757
|
O as Origin,
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
758
|
+
ze as PRESENCE_KEY,
|
|
759
|
+
F as PointerSelectAction,
|
|
760
|
+
ke as createAnonymousGuest,
|
|
759
761
|
xe as createBaseAnnotator,
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
762
|
+
Se as createBody,
|
|
763
|
+
ve as createDefaultAppearenceProvider,
|
|
764
|
+
Ce as createHoverState,
|
|
765
|
+
Be as createLifecycleObserver,
|
|
766
|
+
Ve as createPresenceState,
|
|
767
|
+
Le as createSelectionState,
|
|
768
|
+
Oe as createStore,
|
|
769
|
+
De as createUndoStack,
|
|
770
|
+
Re as createViewportState,
|
|
771
|
+
be as defaultColorProvider,
|
|
772
|
+
q as diffAnnotations,
|
|
773
|
+
Ue as getContributors,
|
|
774
|
+
de as mergeChanges,
|
|
775
|
+
P as onPointerSelect,
|
|
776
|
+
ce as parseAll,
|
|
777
|
+
Ne as parseW3CBodies,
|
|
778
|
+
me as parseW3CUser,
|
|
779
|
+
Ie as serializeAll,
|
|
780
|
+
$e as serializeW3CBodies,
|
|
781
|
+
ie as shouldNotify,
|
|
782
|
+
Te as toSvelteStore
|
|
781
783
|
};
|
|
782
784
|
//# sourceMappingURL=annotorious-core.es.js.map
|