@annotorious/svelte 3.0.0-rc.10 → 3.0.0-rc.11
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-svelte.es.js +17 -14
- package/dist/annotorious-svelte.es.js.map +1 -1
- package/dist/annotorious-svelte.es2.js +1 -1
- package/dist/annotorious-svelte.es3.js +90 -2
- package/dist/annotorious-svelte.es3.js.map +1 -1
- package/dist/annotorious-svelte.es4.js +109 -9
- package/dist/annotorious-svelte.es4.js.map +1 -1
- package/dist/annotorious-svelte.es5.js +115 -1286
- package/dist/annotorious-svelte.es5.js.map +1 -1
- package/dist/annotorious-svelte.es6.js +305 -101
- package/dist/annotorious-svelte.es6.js.map +1 -1
- package/dist/annotorious-svelte.es7.js +116 -119
- package/dist/annotorious-svelte.es7.js.map +1 -1
- package/dist/annotorious-svelte.es8.js +2 -313
- package/dist/annotorious-svelte.es8.js.map +1 -1
- package/dist/index.d.ts +11 -8
- package/dist/index.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/index.ts +41 -21
- package/dist/annotorious-svelte.es10.js +0 -123
- package/dist/annotorious-svelte.es10.js.map +0 -1
- package/dist/annotorious-svelte.es11.js +0 -5
- package/dist/annotorious-svelte.es11.js.map +0 -1
- package/dist/annotorious-svelte.es12.js +0 -20
- package/dist/annotorious-svelte.es12.js.map +0 -1
- package/dist/annotorious-svelte.es13.js +0 -7
- package/dist/annotorious-svelte.es13.js.map +0 -1
- package/dist/annotorious-svelte.es14.js +0 -11
- package/dist/annotorious-svelte.es14.js.map +0 -1
- package/dist/annotorious-svelte.es15.js +0 -10
- package/dist/annotorious-svelte.es15.js.map +0 -1
- package/dist/annotorious-svelte.es9.js +0 -22156
- package/dist/annotorious-svelte.es9.js.map +0 -1
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { PointerSelectAction as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { default as
|
|
6
|
-
|
|
7
|
-
const c = o, m = e, s = t, i = r;
|
|
1
|
+
import { default as c } from "./annotorious-svelte.es2.js";
|
|
2
|
+
import { Origin as g, PointerSelectAction as d, createAnonymousGuest as u, createBody as i, defaultColorProvider as l } from "./annotorious-svelte.es3.js";
|
|
3
|
+
import { createImageAnnotator as e, ShapeType as o, W3CImageFormat as a } from "@annotorious/annotorious";
|
|
4
|
+
import { default as I } from "./annotorious-svelte.es4.js";
|
|
5
|
+
import { default as x } from "./annotorious-svelte.es5.js";
|
|
6
|
+
const r = e, n = o, p = a;
|
|
8
7
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
c as MouseOverTooltip,
|
|
9
|
+
I as OpenSeadragonAnnotator,
|
|
10
|
+
x as OpenSeadragonPopup,
|
|
11
|
+
g as Origin,
|
|
12
|
+
d as PointerSelectAction,
|
|
13
|
+
n as ShapeType,
|
|
14
|
+
p as W3CImageFormat,
|
|
15
|
+
u as createAnonymousGuest,
|
|
16
|
+
i as createBody,
|
|
17
|
+
r as createImageAnnotator,
|
|
18
|
+
l as defaultColorProvider
|
|
16
19
|
};
|
|
17
20
|
//# sourceMappingURL=annotorious-svelte.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-svelte.es.js","sources":["../src/index.ts"],"sourcesContent":["export * from './osd';\n\nexport { default as MouseOverTooltip } from './MouseOverTooltip.svelte';\n\n// Essential re-exports from @annotorious/core\nexport type {\n Annotation,\n AnnotationBody,\n AnnotationTarget,\n Annotator,\n AnnotatorState,\n
|
|
1
|
+
{"version":3,"file":"annotorious-svelte.es.js","sources":["../src/index.ts"],"sourcesContent":["export * from './osd';\n\nexport { default as MouseOverTooltip } from './MouseOverTooltip.svelte';\n\n// Essential re-exports from @annotorious/core\nexport type {\n Annotation,\n AnnotationBody,\n AnnotationTarget,\n Annotator,\n AnnotatorState,\n Appearance,\n AppearanceProvider,\n Color,\n DrawingStyle,\n Filter,\n FormatAdapter,\n HoverState,\n LifecycleEvents,\n ParseResult,\n PresentUser,\n Purpose,\n Selection,\n SelectionState,\n Store,\n StoreChangeEvent,\n StoreObserver,\n SvelteAnnotator,\n SvelteAnnotatorState,\n User,\n W3CAnnotation,\n W3CAnnotationBody,\n W3CAnnotationTarget,\n W3CSelector\n} from '@annotorious/core';\n\nimport {\n createAnonymousGuest as _createAnonymousGuest, \n createBody as _createBody,\n defaultColorProvider as _defaultColorProvider,\n Origin as _Origin,\n PointerSelectAction as _PointerSelectAction\n} from '@annotorious/core';\n\nexport { _createAnonymousGuest as createAnonymousGuest };\nexport { _createBody as createBody };\nexport { _defaultColorProvider as defaultColorProvider };\nexport { _Origin as Origin };\nexport { _PointerSelectAction as PointerSelectAction };\n\n// Essential re-exports from @annotorious/annotorious \nexport type {\n AnnotoriousOpts,\n DrawingMode,\n DrawingTool,\n ImageAnnotator as AnnotoriousImageAnnotator,\n ImageAnnotation,\n ImageAnnotator,\n ImageAnnotatorState,\n Polygon,\n PolygonGeometry,\n Rectangle,\n RectangleGeometry,\n Shape\n} from '@annotorious/annotorious';\n\nimport { \n createImageAnnotator as _createImageAnnotator,\n ShapeType as _ShapeType,\n W3CImageFormat as _W3CImageFormat\n} from '@annotorious/annotorious';\n\nexport const createImageAnnotator = _createImageAnnotator;\nexport const ShapeType = _ShapeType;\nexport const W3CImageFormat = _W3CImageFormat;\n\n// Essential re-exports from @annotorious/openseadragon \nexport type {\n OpenSeadragonAnnotator as AnnotoriousOpenSeadragonAnnotator\n} from '@annotorious/openseadragon';\n\nexport type { Viewer } from 'openseadragon';"],"names":["createImageAnnotator","_createImageAnnotator","ShapeType","_ShapeType","W3CImageFormat","_W3CImageFormat"],"mappings":";;;;;AAwEO,MAAMA,IAAuBC,GACvBC,IAAYC,GACZC,IAAiBC;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SvelteComponent as O, init as T, safe_not_equal as q, empty as w, insert as E, transition_in as u, transition_out as _, check_outros as A, detach as L, getContext as N, component_subscribe as S, onMount as X, create_slot as Y, element as j, attr as c, update_slot_base as z, get_all_dirty_from_scope as B, get_slot_changes as D, group_outros as F } from "./annotorious-svelte.
|
|
1
|
+
import { SvelteComponent as O, init as T, safe_not_equal as q, empty as w, insert as E, transition_in as u, transition_out as _, check_outros as A, detach as L, getContext as N, component_subscribe as S, onMount as X, create_slot as Y, element as j, attr as c, update_slot_base as z, get_all_dirty_from_scope as B, get_slot_changes as D, group_outros as F } from "./annotorious-svelte.es6.js";
|
|
2
2
|
const G = (o) => ({ hovered: o & /*hovered*/
|
|
3
3
|
16 }), b = (o) => ({ hovered: (
|
|
4
4
|
/*hovered*/
|
|
@@ -1,5 +1,93 @@
|
|
|
1
|
-
var
|
|
1
|
+
var f = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(f || {});
|
|
2
|
+
let s;
|
|
3
|
+
const p = new Uint8Array(16);
|
|
4
|
+
function y() {
|
|
5
|
+
if (!s && (s = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !s))
|
|
6
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
7
|
+
return s(p);
|
|
8
|
+
}
|
|
9
|
+
const e = [];
|
|
10
|
+
for (let t = 0; t < 256; ++t)
|
|
11
|
+
e.push((t + 256).toString(16).slice(1));
|
|
12
|
+
function g(t, o = 0) {
|
|
13
|
+
return e[t[o + 0]] + e[t[o + 1]] + e[t[o + 2]] + e[t[o + 3]] + "-" + e[t[o + 4]] + e[t[o + 5]] + "-" + e[t[o + 6]] + e[t[o + 7]] + "-" + e[t[o + 8]] + e[t[o + 9]] + "-" + e[t[o + 10]] + e[t[o + 11]] + e[t[o + 12]] + e[t[o + 13]] + e[t[o + 14]] + e[t[o + 15]];
|
|
14
|
+
}
|
|
15
|
+
const m = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), i = {
|
|
16
|
+
randomUUID: m
|
|
17
|
+
};
|
|
18
|
+
function U(t, o, r) {
|
|
19
|
+
if (i.randomUUID && !o && !t)
|
|
20
|
+
return i.randomUUID();
|
|
21
|
+
t = t || {};
|
|
22
|
+
const a = t.random || (t.rng || y)();
|
|
23
|
+
if (a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, o) {
|
|
24
|
+
r = r || 0;
|
|
25
|
+
for (let n = 0; n < 16; ++n)
|
|
26
|
+
o[r + n] = a[n];
|
|
27
|
+
return o;
|
|
28
|
+
}
|
|
29
|
+
return g(a);
|
|
30
|
+
}
|
|
31
|
+
const S = (t, o, r, a) => ({
|
|
32
|
+
id: U(),
|
|
33
|
+
annotation: t.id,
|
|
34
|
+
created: r || /* @__PURE__ */ new Date(),
|
|
35
|
+
creator: a,
|
|
36
|
+
...o
|
|
37
|
+
});
|
|
38
|
+
var h = /* @__PURE__ */ ((t) => (t.LOCAL = "LOCAL", t.REMOTE = "REMOTE", t))(h || {});
|
|
39
|
+
const v = (t) => ({
|
|
40
|
+
...t,
|
|
41
|
+
subscribe: (o) => {
|
|
42
|
+
const r = (a) => o(a.state);
|
|
43
|
+
return t.observe(r), o(t.all()), () => t.unobserve(r);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
let E = (t) => crypto.getRandomValues(new Uint8Array(t)), b = (t, o, r) => {
|
|
47
|
+
let a = (2 << Math.log(t.length - 1) / Math.LN2) - 1, n = -~(1.6 * a * o / t.length);
|
|
48
|
+
return (l = o) => {
|
|
49
|
+
let c = "";
|
|
50
|
+
for (; ; ) {
|
|
51
|
+
let d = r(n), u = n;
|
|
52
|
+
for (; u--; )
|
|
53
|
+
if (c += t[d[u] & a] || "", c.length === l)
|
|
54
|
+
return c;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}, C = (t, o = 21) => b(t, o, E), D = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((o, r) => (r &= 63, r < 36 ? o += r.toString(36) : r < 62 ? o += (r - 26).toString(36).toUpperCase() : r > 62 ? o += "-" : o += "_", o), "");
|
|
58
|
+
const O = () => ({ isGuest: !0, id: C("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), R = [
|
|
59
|
+
"#ff7c00",
|
|
60
|
+
// orange
|
|
61
|
+
"#1ac938",
|
|
62
|
+
// green
|
|
63
|
+
"#e8000b",
|
|
64
|
+
// red
|
|
65
|
+
"#8b2be2",
|
|
66
|
+
// purple
|
|
67
|
+
"#9f4800",
|
|
68
|
+
// brown
|
|
69
|
+
"#f14cc1",
|
|
70
|
+
// pink
|
|
71
|
+
"#ffc400",
|
|
72
|
+
// khaki
|
|
73
|
+
"#00d7ff",
|
|
74
|
+
// cyan
|
|
75
|
+
"#023eff"
|
|
76
|
+
// blue
|
|
77
|
+
], A = () => {
|
|
78
|
+
const t = [...R];
|
|
79
|
+
return { assignRandomColor: () => {
|
|
80
|
+
const o = Math.floor(Math.random() * t.length), r = t[o];
|
|
81
|
+
return t.splice(o, 1), r;
|
|
82
|
+
}, releaseColor: (o) => t.push(o) };
|
|
83
|
+
};
|
|
84
|
+
D();
|
|
2
85
|
export {
|
|
3
|
-
|
|
86
|
+
h as Origin,
|
|
87
|
+
f as PointerSelectAction,
|
|
88
|
+
O as createAnonymousGuest,
|
|
89
|
+
S as createBody,
|
|
90
|
+
A as defaultColorProvider,
|
|
91
|
+
v as toSvelteStore
|
|
4
92
|
};
|
|
5
93
|
//# sourceMappingURL=annotorious-svelte.es3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-svelte.es3.js","sources":["../../annotorious-core/src/state/Selection.ts"],"sourcesContent":["import { writable } from 'svelte/store';\nimport type { Annotation } from '../model';\nimport type { Store } from './Store';\n \nexport type Selection = {\n\n selected: { id: string, editable?: boolean }[],\n\n pointerEvent?: PointerEvent;\n\n}\n\nexport type SelectionState<T extends Annotation> = ReturnType<typeof createSelectionState<T>>;\n\nexport enum PointerSelectAction {\n\n EDIT = 'EDIT', // Make annotation target(s) editable on pointer select\n \n SELECT = 'SELECT', // Just select, but don't make editable\n\n NONE = 'NONE' // Click won't select - annotation is completely inert\n\n}\n\nconst EMPTY: Selection = { selected: [] };\n\nexport const createSelectionState = <T extends Annotation>(\n store: Store<T>,\n selectAction: PointerSelectAction | ((a: Annotation) => PointerSelectAction) = PointerSelectAction.EDIT\n) => {\n const { subscribe, set } = writable<Selection>(EMPTY);\n\n let currentSelection: Selection = EMPTY;\n\n subscribe(updated => currentSelection = updated);\n\n const clear = () => set(EMPTY);\n\n const isEmpty = () => currentSelection.selected?.length === 0;\n\n const isSelected = (annotationOrId: T | string) => {\n if (currentSelection.selected.length === 0)\n return false;\n\n const id = typeof annotationOrId === 'string' ? annotationOrId : annotationOrId.id;\n return currentSelection.selected.some(i => i.id === id);\n }\n\n // TODO enable CTRL select\n const clickSelect = (id: string, pointerEvent: PointerEvent) => {\n const annotation = store.getAnnotation(id);\n if (annotation) {\n const action = onPointerSelect(annotation, selectAction);\n if (action === PointerSelectAction.EDIT)\n set({ selected: [{ id, editable: true }], pointerEvent }); \n else if (action === PointerSelectAction.SELECT)\n set({ selected: [{ id }], pointerEvent }); \n else\n set({ selected: [], pointerEvent });\n } else {\n console.warn('Invalid selection: ' + id);\n }\n }\n\n const setSelected = (idOrIds: string | string[], editable: boolean = true) => {\n const ids = Array.isArray(idOrIds) ? idOrIds : [idOrIds];\n\n // Remove invalid\n const annotations = \n ids.map(id => store.getAnnotation(id)).filter(a => a); \n\n set({ selected: annotations.map(({ id }) => ({ id, editable })) });\n \n if (annotations.length !== ids.length)\n console.warn('Invalid selection', idOrIds);\n }\n\n const removeFromSelection = (ids: string[]) => {\n if (currentSelection.selected.length === 0)\n return false;\n\n const { selected } = currentSelection;\n\n // Checks which of the given annotations are actually in the selection\n const toRemove = selected.filter(({ id }) => ids.includes(id))\n\n if (toRemove.length > 0)\n set({ selected: selected.filter(({ id }) => !ids.includes(id)) });\n }\n\n // Track store delete and update events\n store.observe(({ changes }) =>\n removeFromSelection(changes.deleted.map(a => a.id)));\n\n return { \n clear, \n clickSelect, \n get selected() { return currentSelection ? [...currentSelection.selected ] : null},\n get pointerEvent() { return currentSelection ? currentSelection.pointerEvent : null },\n isEmpty, \n isSelected, \n setSelected, \n subscribe \n };\n\n}\n\nexport const onPointerSelect = (\n annotation: Annotation, \n action?: PointerSelectAction | ((a: Annotation) => PointerSelectAction)\n): PointerSelectAction => (typeof action === 'function') ?\n (action(annotation) || PointerSelectAction.EDIT) : \n (action || PointerSelectAction.EDIT);\n"],"names":["PointerSelectAction"],"mappings":"AAcY,IAAAA,sBAAAA,OAEVA,EAAA,OAAO,QAEPA,EAAA,SAAS,UAETA,EAAA,OAAO,QANGA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
1
|
+
{"version":3,"file":"annotorious-svelte.es3.js","sources":["../../annotorious-core/dist/annotorious-core.es.js"],"sourcesContent":["var Y = Object.prototype.hasOwnProperty;\nfunction B(e, n) {\n var t, o;\n if (e === n)\n return !0;\n if (e && n && (t = e.constructor) === n.constructor) {\n if (t === Date)\n return e.getTime() === n.getTime();\n if (t === RegExp)\n return e.toString() === n.toString();\n if (t === Array) {\n if ((o = e.length) === n.length)\n for (; o-- && B(e[o], n[o]); )\n ;\n return o === -1;\n }\n if (!t || typeof e == \"object\") {\n o = 0;\n for (t in e)\n if (Y.call(e, t) && ++o && !Y.call(n, t) || !(t in n) || !B(e[t], n[t]))\n return !1;\n return Object.keys(n).length === o;\n }\n }\n return e !== e && n !== n;\n}\nfunction $() {\n}\nfunction q(e, n) {\n return e != e ? n == n : e !== n || e && typeof e == \"object\" || typeof e == \"function\";\n}\nconst k = [];\nfunction _(e, n = $) {\n let t;\n const o = /* @__PURE__ */ new Set();\n function i(b) {\n if (q(e, b) && (e = b, t)) {\n const v = !k.length;\n for (const u of o)\n u[1](), k.push(u, e);\n if (v) {\n for (let u = 0; u < k.length; u += 2)\n k[u][0](k[u + 1]);\n k.length = 0;\n }\n }\n }\n function h(b) {\n i(b(e));\n }\n function U(b, v = $) {\n const u = [b, v];\n return o.add(u), o.size === 1 && (t = n(i) || $), b(e), () => {\n o.delete(u), o.size === 0 && t && (t(), t = null);\n };\n }\n return { set: i, update: h, subscribe: U };\n}\nconst Ee = (e) => {\n const { subscribe: n, set: t } = _(null);\n let o = null;\n return n((i) => o = i), e.observe(({ changes: i }) => {\n if (o) {\n i.deleted.some((b) => b.id === o) && t(null);\n const U = i.updated.find(({ oldValue: b }) => b.id === o);\n U && t(U.newValue.id);\n }\n }), {\n get current() {\n return o;\n },\n subscribe: n,\n set: t\n };\n};\nvar G = /* @__PURE__ */ ((e) => (e.EDIT = \"EDIT\", e.SELECT = \"SELECT\", e.NONE = \"NONE\", e))(G || {});\nconst V = { selected: [] }, be = (e, n = \"EDIT\") => {\n const { subscribe: t, set: o } = _(V);\n let i = V;\n t((s) => i = s);\n const h = () => o(V), U = () => {\n var s;\n return ((s = i.selected) == null ? void 0 : s.length) === 0;\n }, b = (s) => {\n if (i.selected.length === 0)\n return !1;\n const f = typeof s == \"string\" ? s : s.id;\n return i.selected.some((y) => y.id === f);\n }, v = (s, f) => {\n const y = e.getAnnotation(s);\n if (y) {\n const A = W(y, n);\n o(A === \"EDIT\" ? { selected: [{ id: s, editable: !0 }], pointerEvent: f } : A === \"SELECT\" ? { selected: [{ id: s }], pointerEvent: f } : { selected: [], pointerEvent: f });\n } else\n console.warn(\"Invalid selection: \" + s);\n }, u = (s, f = !0) => {\n const y = Array.isArray(s) ? s : [s], A = y.map((L) => e.getAnnotation(L)).filter((L) => L);\n o({ selected: A.map(({ id: L }) => ({ id: L, editable: f })) }), A.length !== y.length && console.warn(\"Invalid selection\", s);\n }, T = (s) => {\n if (i.selected.length === 0)\n return !1;\n const { selected: f } = i;\n f.filter(({ id: A }) => s.includes(A)).length > 0 && o({ selected: f.filter(({ id: A }) => !s.includes(A)) });\n };\n return e.observe(({ changes: s }) => T(s.deleted.map((f) => f.id))), {\n clear: h,\n clickSelect: v,\n get selected() {\n return i ? [...i.selected] : null;\n },\n get pointerEvent() {\n return i ? i.pointerEvent : null;\n },\n isEmpty: U,\n isSelected: b,\n setSelected: u,\n subscribe: t\n };\n}, W = (e, n) => typeof n == \"function\" ? n(e) || \"EDIT\" : n || \"EDIT\";\nlet z;\nconst H = new Uint8Array(16);\nfunction F() {\n if (!z && (z = typeof crypto < \"u\" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !z))\n throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");\n return z(H);\n}\nconst R = [];\nfor (let e = 0; e < 256; ++e)\n R.push((e + 256).toString(16).slice(1));\nfunction J(e, n = 0) {\n return R[e[n + 0]] + R[e[n + 1]] + R[e[n + 2]] + R[e[n + 3]] + \"-\" + R[e[n + 4]] + R[e[n + 5]] + \"-\" + R[e[n + 6]] + R[e[n + 7]] + \"-\" + R[e[n + 8]] + R[e[n + 9]] + \"-\" + R[e[n + 10]] + R[e[n + 11]] + R[e[n + 12]] + R[e[n + 13]] + R[e[n + 14]] + R[e[n + 15]];\n}\nconst Q = typeof crypto < \"u\" && crypto.randomUUID && crypto.randomUUID.bind(crypto), j = {\n randomUUID: Q\n};\nfunction X(e, n, t) {\n if (j.randomUUID && !n && !e)\n return j.randomUUID();\n e = e || {};\n const o = e.random || (e.rng || F)();\n if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, n) {\n t = t || 0;\n for (let i = 0; i < 16; ++i)\n n[t + i] = o[i];\n return n;\n }\n return J(o);\n}\nconst ve = (e) => {\n const { creator: n, updatedBy: t } = e.target, o = e.bodies.reduce((i, h) => [...i, h.creator, h.updatedBy], []);\n return [\n n,\n t,\n ...o\n ].filter((i) => i);\n}, Ce = (e, n, t, o) => ({\n id: X(),\n annotation: e.id,\n created: t || /* @__PURE__ */ new Date(),\n creator: o,\n ...n\n}), Z = (e, n) => {\n const t = new Set(e.bodies.map((o) => o.id));\n return n.bodies.filter((o) => !t.has(o.id));\n}, K = (e, n) => {\n const t = new Set(n.bodies.map((o) => o.id));\n return e.bodies.filter((o) => !t.has(o.id));\n}, ee = (e, n) => n.bodies.map((t) => {\n const o = e.bodies.find((i) => i.id === t.id);\n return { newBody: t, oldBody: o && !B(o, t) ? o : void 0 };\n}).filter(({ oldBody: t }) => t), te = (e, n) => !B(e.target, n.target), M = (e, n) => {\n const t = Z(e, n), o = K(e, n), i = ee(e, n);\n return {\n oldValue: e,\n newValue: n,\n bodiesCreated: t.length > 0 ? t : void 0,\n bodiesDeleted: o.length > 0 ? o : void 0,\n bodiesUpdated: i.length > 0 ? i : void 0,\n targetUpdated: te(e, n) ? { oldTarget: e.target, newTarget: n.target } : void 0\n };\n};\nvar ne = /* @__PURE__ */ ((e) => (e.BODY_ONLY = \"BODY_ONLY\", e.TARGET_ONLY = \"TARGET_ONLY\", e))(ne || {}), O = /* @__PURE__ */ ((e) => (e.LOCAL = \"LOCAL\", e.REMOTE = \"REMOTE\", e))(O || {});\nconst oe = (e, n) => {\n var h, U;\n const { changes: t, origin: o } = n;\n if (!(!e.options.origin || e.options.origin === o))\n return !1;\n if (e.options.ignore) {\n const { ignore: b } = e.options, v = (T) => (T == null ? void 0 : T.length) > 0;\n if (!(v(t.created) || v(t.deleted))) {\n const T = (h = t.updated) == null ? void 0 : h.some((f) => v(f.bodiesCreated) || v(f.bodiesDeleted) || v(f.bodiesUpdated)), s = (U = t.updated) == null ? void 0 : U.some((f) => f.targetUpdated);\n if (b === \"BODY_ONLY\" && T && !s || b === \"TARGET_ONLY\" && s && !T)\n return !1;\n }\n }\n if (e.options.annotations) {\n const b = /* @__PURE__ */ new Set([\n ...t.created.map((u) => u.id),\n ...t.deleted.map((u) => u.id),\n ...t.updated.map(({ oldValue: u }) => u.id)\n ]);\n return !!(Array.isArray(e.options.annotations) ? e.options.annotations : [e.options.annotations]).find((u) => b.has(u));\n } else\n return !0;\n}, se = (e, n) => {\n 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)), h = new Set((n.deleted || []).map((s) => s.id)), U = 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)), v = [\n ...(e.created || []).filter((s) => !h.has(s.id)).map((s) => U.has(s.id) ? n.updated.find(({ oldValue: f }) => f.id === s.id).newValue : s),\n ...n.created || []\n ], u = [\n ...(e.deleted || []).filter((s) => !i.has(s.id)),\n ...(n.deleted || []).filter((s) => !t.has(s.id))\n ], T = [\n ...(e.updated || []).filter(({ newValue: s }) => !h.has(s.id)).map((s) => {\n const { oldValue: f, newValue: y } = s;\n if (U.has(y.id)) {\n const A = n.updated.find((L) => L.oldValue.id === y.id).newValue;\n return M(f, A);\n } else\n return s;\n }),\n ...(n.updated || []).filter(({ oldValue: s }) => !b.has(s.id))\n ];\n return { created: v, deleted: u, updated: T };\n}, ie = (e) => e.id !== void 0, we = () => {\n const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), t = [], o = (r, l = {}) => t.push({ onChange: r, options: l }), i = (r) => {\n const l = t.findIndex((a) => a.onChange == r);\n l > -1 && t.splice(l, 1);\n }, h = (r, l) => {\n const a = {\n origin: r,\n changes: {\n created: l.created || [],\n updated: l.updated || [],\n deleted: l.deleted || []\n },\n state: [...e.values()]\n };\n t.forEach((p) => {\n oe(p, a) && p.onChange(a);\n });\n }, U = (r, l = O.LOCAL) => {\n if (e.get(r.id))\n throw Error(`Cannot add annotation ${r.id} - exists already`);\n e.set(r.id, r), r.bodies.forEach((p) => n.set(p.id, r.id)), h(l, { created: [r] });\n }, b = (r, l) => {\n const a = typeof r == \"string\" ? l : r, p = typeof r == \"string\" ? r : r.id, C = e.get(p);\n if (C) {\n const D = M(C, a);\n return p === a.id ? e.set(p, a) : (e.delete(p), e.set(a.id, a)), C.bodies.forEach((x) => n.delete(x.id)), a.bodies.forEach((x) => n.set(x.id, a.id)), D;\n } else\n console.warn(`Cannot update annotation ${p} - does not exist`);\n }, v = (r, l = O.LOCAL, a = O.LOCAL) => {\n const p = ie(l) ? a : l, C = b(r, l);\n C && h(p, { updated: [C] });\n }, u = (r, l = O.LOCAL) => {\n const a = r.reduce((p, C) => {\n const D = b(C);\n return D ? [...p, D] : p;\n }, []);\n a.length > 0 && h(l, { updated: a });\n }, T = (r, l = O.LOCAL) => {\n const a = e.get(r.annotation);\n if (a) {\n const p = {\n ...a,\n bodies: [...a.bodies, r]\n };\n e.set(a.id, p), n.set(r.id, p.id), h(l, { updated: [{\n oldValue: a,\n newValue: p,\n bodiesCreated: [r]\n }] });\n } else\n console.warn(`Attempt to add body to missing annotation: ${r.annotation}`);\n }, s = () => [...e.values()], f = (r = O.LOCAL) => {\n const l = [...e.values()];\n e.clear(), n.clear(), h(r, { deleted: l });\n }, y = (r, l = !0, a = O.LOCAL) => {\n if (l) {\n const p = [...e.values()];\n e.clear(), n.clear(), r.forEach((C) => {\n e.set(C.id, C), C.bodies.forEach((D) => n.set(D.id, C.id));\n }), h(a, { created: r, deleted: p });\n } else {\n const p = r.reduce((C, D) => {\n const x = e.get(D.id);\n return x ? [...C, x] : C;\n }, []);\n if (p.length > 0)\n throw Error(`Bulk insert would overwrite the following annotations: ${p.map((C) => C.id).join(\", \")}`);\n r.forEach((C) => {\n e.set(C.id, C), C.bodies.forEach((D) => n.set(D.id, C.id));\n }), h(a, { created: r });\n }\n }, A = (r) => {\n const l = typeof r == \"string\" ? r : r.id, a = e.get(l);\n if (a)\n return e.delete(l), a.bodies.forEach((p) => n.delete(p.id)), a;\n console.warn(`Attempt to delete missing annotation: ${l}`);\n }, L = (r, l = O.LOCAL) => {\n const a = A(r);\n a && h(l, { deleted: [a] });\n }, w = (r, l = O.LOCAL) => {\n const a = r.reduce((p, C) => {\n const D = A(C);\n return D ? [...p, D] : p;\n }, []);\n a.length > 0 && h(l, { deleted: a });\n }, c = (r, l = O.LOCAL) => {\n const a = e.get(r.annotation);\n if (a) {\n const p = a.bodies.find((C) => C.id === r.id);\n if (p) {\n n.delete(p.id);\n const C = {\n ...a,\n bodies: a.bodies.filter((x) => x.id !== r.id)\n };\n e.set(a.id, C), h(l, { updated: [{\n oldValue: a,\n newValue: C,\n bodiesDeleted: [p]\n }] });\n } else\n console.warn(`Attempt to delete missing body ${r.id} from annotation ${r.annotation}`);\n } else\n console.warn(`Attempt to delete body from missing annotation ${r.annotation}`);\n }, m = (r) => {\n const l = e.get(r);\n return l ? { ...l } : void 0;\n }, d = (r) => {\n const l = n.get(r);\n if (l) {\n const p = m(l).bodies.find((C) => C.id === r);\n if (p)\n return p;\n console.error(`Store integrity error: body ${r} in index, but not in annotation`);\n } else\n console.warn(`Attempt to retrieve missing body: ${r}`);\n }, E = (r, l) => {\n if (r.annotation !== l.annotation)\n throw \"Annotation integrity violation: annotation ID must be the same when updating bodies\";\n const a = e.get(r.annotation);\n if (a) {\n const p = a.bodies.find((D) => D.id === r.id), C = {\n ...a,\n bodies: a.bodies.map((D) => D.id === p.id ? l : D)\n };\n return e.set(a.id, C), p.id !== l.id && (n.delete(p.id), n.set(l.id, C.id)), {\n oldValue: a,\n newValue: C,\n bodiesUpdated: [{ oldBody: p, newBody: l }]\n };\n } else\n console.warn(`Attempt to add body to missing annotation ${r.annotation}`);\n }, g = (r, l, a = O.LOCAL) => {\n const p = E(r, l);\n h(a, { updated: [p] });\n }, S = (r, l = O.LOCAL) => {\n const a = r.map((p) => E({ id: p.id, annotation: p.annotation }, p));\n h(l, { updated: a });\n }, I = (r) => {\n const l = e.get(r.annotation);\n if (l) {\n const a = {\n ...l,\n target: {\n ...l.target,\n ...r\n }\n };\n return e.set(l.id, a), {\n oldValue: l,\n newValue: a,\n targetUpdated: {\n oldTarget: l.target,\n newTarget: r\n }\n };\n } else\n console.warn(`Attempt to update target on missing annotation: ${r.annotation}`);\n };\n return {\n addAnnotation: U,\n addBody: T,\n all: s,\n bulkAddAnnotation: y,\n bulkDeleteAnnotation: w,\n bulkUpdateAnnotation: u,\n bulkUpdateBodies: S,\n bulkUpdateTargets: (r, l = O.LOCAL) => {\n const a = r.map(I).filter((p) => p);\n a.length > 0 && h(l, { updated: a });\n },\n clear: f,\n deleteAnnotation: L,\n deleteBody: c,\n getAnnotation: m,\n getBody: d,\n observe: o,\n unobserve: i,\n updateAnnotation: v,\n updateBody: g,\n updateTarget: (r, l = O.LOCAL) => {\n const a = I(r);\n a && h(l, { updated: [a] });\n }\n };\n}, ye = (e) => ({\n ...e,\n subscribe: (t) => {\n const o = (i) => t(i.state);\n return e.observe(o), t(e.all()), () => e.unobserve(o);\n }\n});\nlet P = () => ({\n emit(e, ...n) {\n let t = this.events[e] || [];\n for (let o = 0, i = t.length; o < i; o++)\n t[o](...n);\n },\n events: {},\n on(e, n) {\n var t;\n return (t = this.events[e]) != null && t.push(n) || (this.events[e] = [n]), () => {\n var o;\n this.events[e] = (o = this.events[e]) == null ? void 0 : o.filter((i) => n !== i);\n };\n }\n});\nconst de = 250, Ue = (e) => {\n const n = P(), t = [];\n let o = -1, i = !1, h = 0;\n const U = (d) => {\n if (!i) {\n const { changes: E } = d, g = performance.now();\n if (g - h > de)\n t.splice(o + 1), t.push(E), o = t.length - 1;\n else {\n const S = t.length - 1;\n t[S] = se(t[S], E);\n }\n h = g;\n }\n i = !1;\n };\n e.observe(U, { origin: O.LOCAL });\n const b = (d) => (d == null ? void 0 : d.length) > 0 && e.bulkDeleteAnnotation(d), v = (d) => (d == null ? void 0 : d.length) > 0 && e.bulkAddAnnotation(d, !1), u = (d) => (d == null ? void 0 : d.length) > 0 && e.bulkUpdateAnnotation(d.map(({ oldValue: E }) => E)), T = (d) => (d == null ? void 0 : d.length) > 0 && e.bulkUpdateAnnotation(d.map(({ newValue: E }) => E)), s = (d) => (d == null ? void 0 : d.length) > 0 && e.bulkAddAnnotation(d, !1), f = (d) => (d == null ? void 0 : d.length) > 0 && e.bulkDeleteAnnotation(d);\n return {\n canRedo: () => t.length - 1 > o,\n canUndo: () => o > -1,\n destroy: () => e.unobserve(U),\n on: (d, E) => n.on(d, E),\n redo: () => {\n if (t.length - 1 > o) {\n i = !0;\n const { created: d, updated: E, deleted: g } = t[o + 1];\n v(d), T(E), f(g), n.emit(\"redo\", t[o + 1]), o += 1;\n }\n },\n undo: () => {\n if (o > -1) {\n i = !0;\n const { created: d, updated: E, deleted: g } = t[o];\n b(d), u(E), s(g), n.emit(\"undo\", t[o]), o -= 1;\n }\n }\n };\n}, Le = () => {\n const { subscribe: e, set: n } = _([]);\n return {\n subscribe: e,\n set: n\n };\n}, Se = (e, n, t, o) => {\n const { store: i, selection: h, hover: U, viewport: b } = e, v = /* @__PURE__ */ new Map();\n let u = [], T, s;\n const f = (c, m) => {\n v.has(c) ? v.get(c).push(m) : v.set(c, [m]);\n }, y = (c, m) => {\n const d = v.get(c);\n d && d.indexOf(m) > 0 && d.splice(d.indexOf(m), 1);\n }, A = (c, m, d) => {\n v.has(c) && setTimeout(() => {\n v.get(c).forEach((E) => {\n if (t) {\n const g = Array.isArray(m) ? m.map((I) => t.serialize(I)) : t.serialize(m), S = d ? d instanceof PointerEvent ? d : t.serialize(d) : void 0;\n E(g, S);\n } else\n E(m, d);\n });\n }, 1);\n }, L = () => {\n const { selected: c } = h, m = c.map(({ id: d }) => i.getAnnotation(d));\n m.forEach((d) => {\n const E = u.find((g) => g.id === d.id);\n (!E || !B(E, d)) && A(\"updateAnnotation\", d, E);\n }), u = u.map((d) => {\n const E = m.find(({ id: g }) => g === d.id);\n return E || d;\n });\n };\n h.subscribe(({ selected: c }) => {\n if (!(u.length === 0 && c.length === 0)) {\n if (u.length === 0 && c.length > 0)\n u = c.map(({ id: m }) => i.getAnnotation(m));\n else if (u.length > 0 && c.length === 0)\n u.forEach((m) => {\n const d = i.getAnnotation(m.id);\n d && !B(d, m) && A(\"updateAnnotation\", d, m);\n }), u = [];\n else {\n const m = new Set(u.map((g) => g.id)), d = new Set(c.map(({ id: g }) => g));\n u.filter((g) => !d.has(g.id)).forEach((g) => {\n const S = i.getAnnotation(g.id);\n S && !B(S, g) && A(\"updateAnnotation\", S, g);\n }), u = [\n // Remove annotations that were deselected\n ...u.filter((g) => d.has(g.id)),\n // Add editable annotations that were selected\n ...c.filter(({ id: g }) => !m.has(g)).map(({ id: g }) => i.getAnnotation(g))\n ];\n }\n A(\"selectionChanged\", u);\n }\n }), U.subscribe((c) => {\n !T && c ? A(\"mouseEnterAnnotation\", i.getAnnotation(c)) : T && !c ? A(\"mouseLeaveAnnotation\", i.getAnnotation(T)) : T && c && (A(\"mouseLeaveAnnotation\", i.getAnnotation(T)), A(\"mouseEnterAnnotation\", i.getAnnotation(c))), T = c;\n }), b == null || b.subscribe((c) => A(\"viewportIntersect\", c.map(i.getAnnotation))), i.observe((c) => {\n o && (s && clearTimeout(s), s = setTimeout(L, 1e3));\n const { created: m, deleted: d } = c.changes;\n m.forEach((g) => A(\"createAnnotation\", g)), d.forEach((g) => A(\"deleteAnnotation\", g)), c.changes.updated.filter((g) => [\n ...g.bodiesCreated || [],\n ...g.bodiesDeleted || [],\n ...g.bodiesUpdated || []\n ].length > 0).forEach(({ oldValue: g, newValue: S }) => {\n const I = u.find((N) => N.id === g.id) || g;\n u = u.map((N) => N.id === g.id ? S : N), A(\"updateAnnotation\", S, I);\n });\n }, { origin: O.LOCAL }), i.observe((c) => {\n if (u) {\n const m = new Set(u.map((E) => E.id)), d = c.changes.updated.filter(({ newValue: E }) => m.has(E.id)).map(({ newValue: E }) => E);\n d.length > 0 && (u = u.map((E) => {\n const g = d.find((S) => S.id === E.id);\n return g || E;\n }));\n }\n }, { origin: O.REMOTE });\n const w = (c) => (m) => {\n const { created: d, deleted: E, updated: g } = m;\n d.forEach((S) => A(\"createAnnotation\", S)), E.forEach((S) => A(\"deleteAnnotation\", S)), c ? g.forEach((S) => A(\"updateAnnotation\", S.oldValue, S.newValue)) : g.forEach((S) => A(\"updateAnnotation\", S.newValue, S.oldValue));\n };\n return n.on(\"undo\", w(!0)), n.on(\"redo\", w(!1)), { on: f, off: y, emit: A };\n}, Te = (e) => (n) => n.map((t) => e.serialize(t)), re = (e) => (n) => n.reduce((t, o) => {\n const { parsed: i, error: h } = e.parse(o);\n return h ? {\n parsed: t.parsed,\n failed: [...t.failed, o]\n } : {\n parsed: [...t.parsed, i],\n failed: t.failed\n };\n}, { parsed: [], failed: [] }), Oe = (e, n, t) => {\n const { store: o, selection: i } = e, h = (w) => {\n if (t) {\n const { parsed: c, error: m } = t.parse(w);\n c ? o.addAnnotation(c, O.REMOTE) : console.error(m);\n } else\n o.addAnnotation(w, O.REMOTE);\n }, U = () => i.clear(), b = () => o.clear(), v = (w) => {\n const c = o.getAnnotation(w);\n return t && c ? t.serialize(c) : c;\n }, u = () => t ? o.all().map(t.serialize) : o.all(), T = () => {\n var m;\n const c = (((m = i.selected) == null ? void 0 : m.map((d) => d.id)) || []).map((d) => o.getAnnotation(d));\n return t ? c.map(t.serialize) : c;\n }, s = (w) => fetch(w).then((c) => c.json()).then((c) => (y(c), c)), f = (w) => {\n if (typeof w == \"string\") {\n const c = o.getAnnotation(w);\n return o.deleteAnnotation(w), t ? t.serialize(c) : c;\n } else {\n const c = t ? t.parse(w).parsed : w;\n return o.deleteAnnotation(c), w;\n }\n }, y = (w) => {\n if (t) {\n const { parsed: c, failed: m } = re(t)(w);\n m.length > 0 && console.warn(`Discarded ${m.length} invalid annotations`, m), o.bulkAddAnnotation(c, !0, O.REMOTE);\n } else\n o.bulkAddAnnotation(w, !0, O.REMOTE);\n }, A = (w) => {\n w ? i.setSelected(w) : i.clear();\n }, L = (w) => {\n if (t) {\n const c = t.parse(w).parsed, m = t.serialize(o.getAnnotation(c.id));\n return o.updateAnnotation(c), m;\n } else {\n const c = o.getAnnotation(w.id);\n return o.updateAnnotation(w), c;\n }\n };\n return {\n addAnnotation: h,\n cancelSelected: U,\n canRedo: n.canRedo,\n canUndo: n.canUndo,\n clearAnnotations: b,\n getAnnotationById: v,\n getAnnotations: u,\n getSelected: T,\n loadAnnotations: s,\n redo: n.redo,\n removeAnnotation: f,\n setAnnotations: y,\n setSelected: A,\n undo: n.undo,\n updateAnnotation: L\n };\n};\nlet ae = (e) => crypto.getRandomValues(new Uint8Array(e)), ce = (e, n, t) => {\n let o = (2 << Math.log(e.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * n / e.length);\n return (h = n) => {\n let U = \"\";\n for (; ; ) {\n let b = t(i), v = i;\n for (; v--; )\n if (U += e[b[v] & o] || \"\", U.length === h)\n return U;\n }\n };\n}, le = (e, n = 21) => ce(e, n, ae), ue = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((n, t) => (t &= 63, t < 36 ? n += t.toString(36) : t < 62 ? n += (t - 26).toString(36).toUpperCase() : t > 62 ? n += \"-\" : n += \"_\", n), \"\");\nconst De = () => ({ isGuest: !0, id: le(\"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_\", 20)() }), fe = (e) => {\n const n = JSON.stringify(e);\n let t = 0;\n for (let o = 0, i = n.length; o < i; o++) {\n let h = n.charCodeAt(o);\n t = (t << 5) - t + h, t |= 0;\n }\n return `${t}`;\n}, Re = (e, n) => (Array.isArray(e) ? e : [e]).map((t) => {\n const { id: o, type: i, purpose: h, value: U, created: b, creator: v, ...u } = t;\n return {\n id: o || `temp-${fe(t)}`,\n annotation: n,\n type: i,\n purpose: h,\n value: U,\n created: b,\n creator: v ? typeof v == \"object\" ? { ...v } : v : void 0,\n ...u\n };\n}), xe = (e) => e.map((n) => {\n var o;\n const t = { ...n };\n return delete t.annotation, (o = t.id) != null && o.startsWith(\"temp-\") && delete t.id, t;\n}), pe = [\n \"#ff7c00\",\n // orange\n \"#1ac938\",\n // green\n \"#e8000b\",\n // red\n \"#8b2be2\",\n // purple\n \"#9f4800\",\n // brown\n \"#f14cc1\",\n // pink\n \"#ffc400\",\n // khaki\n \"#00d7ff\",\n // cyan\n \"#023eff\"\n // blue\n], he = () => {\n const e = [...pe];\n return { assignRandomColor: () => {\n const o = Math.floor(Math.random() * e.length), i = e[o];\n return e.splice(o, 1), i;\n }, releaseColor: (o) => e.push(o) };\n}, ge = () => {\n const e = he();\n return { addUser: (o, i) => {\n const h = e.assignRandomColor();\n return {\n label: i.name || i.id,\n avatar: i.avatar,\n color: h\n };\n }, removeUser: (o) => e.releaseColor(o.appearance.color) };\n}, me = (e, n) => e.every((t) => e.includes(t)) && n.every((t) => e.includes(t)), Be = ue(), Ie = (e = ge()) => {\n const n = P(), t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (s, f) => {\n if (t.has(s)) {\n console.warn(\"Attempt to add user that is already present\", s, f);\n return;\n }\n const y = e.addUser(s, f);\n t.set(s, {\n ...f,\n presenceKey: s,\n appearance: y\n });\n }, h = (s) => {\n const f = t.get(s);\n if (!f) {\n console.warn(\"Attempt to remove user that is not present\", s);\n return;\n }\n e.removeUser(f), t.delete(s);\n }, U = (s) => {\n const f = new Set(s.map((L) => L.presenceKey)), y = s.filter(({ presenceKey: L }) => !t.has(L)), A = Array.from(t.values()).filter((L) => !f.has(L.presenceKey));\n y.forEach(({ presenceKey: L, user: w }) => i(L, w)), A.forEach((L) => {\n const { presenceKey: w } = L;\n o.has(w) && n.emit(\"selectionChange\", L, null), h(w);\n }), (y.length > 0 || A.length > 0) && n.emit(\"presence\", u());\n }, b = (s, f) => {\n const y = t.get(s);\n if (!y) {\n console.warn(\"Activity notification from user that is not present\");\n return;\n }\n const A = o.get(s);\n (!A || !me(A, f)) && (o.set(s, f), n.emit(\"selectionChange\", y, f));\n }, v = (s, f) => {\n const y = t.get(s);\n if (!y) {\n console.warn(\"Selection change for user that is not present\", s);\n return;\n }\n f ? o.set(s, f) : o.delete(s), n.emit(\"selectionChange\", y, f);\n }, u = () => [...Array.from(t.values())];\n return {\n getPresentUsers: u,\n notifyActivity: b,\n on: (s, f) => n.on(s, f),\n syncUsers: U,\n updateSelection: v\n };\n};\nexport {\n ne as Ignore,\n O as Origin,\n Be as PRESENCE_KEY,\n G as PointerSelectAction,\n De as createAnonymousGuest,\n Oe as createBaseAnnotator,\n Ce as createBody,\n ge as createDefaultAppearenceProvider,\n Ee as createHoverState,\n Se as createLifecyleObserver,\n Ie as createPresenceState,\n be as createSelectionState,\n we as createStore,\n Ue as createUndoStack,\n Le as createViewportState,\n he as defaultColorProvider,\n M as diffAnnotations,\n ve as getContributors,\n se as mergeChanges,\n W as onPointerSelect,\n re as parseAll,\n Re as parseW3CBodies,\n Te as serializeAll,\n xe as serializeW3CBodies,\n oe as shouldNotify,\n ye as toSvelteStore\n};\n//# sourceMappingURL=annotorious-core.es.js.map\n"],"names":["G","e","z","H","F","R","J","n","Q","j","X","t","o","i","Ce","O","ye","ae","ce","h","U","b","v","le","ue","De","pe","he"],"mappings":"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"}
|
|
@@ -1,12 +1,112 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { SvelteComponent as g, init as b, safe_not_equal as h, empty as k, insert as w, transition_in as l, transition_out as c, check_outros as A, detach as O, create_slot as v, update_slot_base as y, get_all_dirty_from_scope as C, get_slot_changes as q, group_outros as D, setContext as m } from "./annotorious-svelte.es6.js";
|
|
2
|
+
import { toSvelteStore as N } from "./annotorious-svelte.es3.js";
|
|
3
|
+
import { createOSDAnnotator as j } from "@annotorious/openseadragon";
|
|
4
|
+
function d(s) {
|
|
5
|
+
let n;
|
|
6
|
+
const o = (
|
|
7
|
+
/*#slots*/
|
|
8
|
+
s[4].default
|
|
9
|
+
), t = v(
|
|
10
|
+
o,
|
|
11
|
+
s,
|
|
12
|
+
/*$$scope*/
|
|
13
|
+
s[3],
|
|
14
|
+
null
|
|
15
|
+
);
|
|
16
|
+
return {
|
|
17
|
+
c() {
|
|
18
|
+
t && t.c();
|
|
19
|
+
},
|
|
20
|
+
m(e, i) {
|
|
21
|
+
t && t.m(e, i), n = !0;
|
|
22
|
+
},
|
|
23
|
+
p(e, i) {
|
|
24
|
+
t && t.p && (!n || i & /*$$scope*/
|
|
25
|
+
8) && y(
|
|
26
|
+
t,
|
|
27
|
+
o,
|
|
28
|
+
e,
|
|
29
|
+
/*$$scope*/
|
|
30
|
+
e[3],
|
|
31
|
+
n ? q(
|
|
32
|
+
o,
|
|
33
|
+
/*$$scope*/
|
|
34
|
+
e[3],
|
|
35
|
+
i,
|
|
36
|
+
null
|
|
37
|
+
) : C(
|
|
38
|
+
/*$$scope*/
|
|
39
|
+
e[3]
|
|
40
|
+
),
|
|
41
|
+
null
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
i(e) {
|
|
45
|
+
n || (l(t, e), n = !0);
|
|
46
|
+
},
|
|
47
|
+
o(e) {
|
|
48
|
+
c(t, e), n = !1;
|
|
49
|
+
},
|
|
50
|
+
d(e) {
|
|
51
|
+
t && t.d(e);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function z(s) {
|
|
56
|
+
let n, o, t = (
|
|
57
|
+
/*viewer*/
|
|
58
|
+
s[0] && d(s)
|
|
59
|
+
);
|
|
60
|
+
return {
|
|
61
|
+
c() {
|
|
62
|
+
t && t.c(), n = k();
|
|
63
|
+
},
|
|
64
|
+
m(e, i) {
|
|
65
|
+
t && t.m(e, i), w(e, n, i), o = !0;
|
|
66
|
+
},
|
|
67
|
+
p(e, [i]) {
|
|
68
|
+
/*viewer*/
|
|
69
|
+
e[0] ? t ? (t.p(e, i), i & /*viewer*/
|
|
70
|
+
1 && l(t, 1)) : (t = d(e), t.c(), l(t, 1), t.m(n.parentNode, n)) : t && (D(), c(t, 1, 1, () => {
|
|
71
|
+
t = null;
|
|
72
|
+
}), A());
|
|
73
|
+
},
|
|
74
|
+
i(e) {
|
|
75
|
+
o || (l(t), o = !0);
|
|
76
|
+
},
|
|
77
|
+
o(e) {
|
|
78
|
+
c(t), o = !1;
|
|
79
|
+
},
|
|
80
|
+
d(e) {
|
|
81
|
+
t && t.d(e), e && O(n);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function B(s, n, o) {
|
|
86
|
+
let { $$slots: t = {}, $$scope: e } = n, { viewer: i } = n, { opts: f = {} } = n, { anno: a = void 0 } = n;
|
|
87
|
+
const S = (r) => {
|
|
88
|
+
if (r) {
|
|
89
|
+
const u = j(r, f), p = N(u.state.store), _ = {
|
|
90
|
+
...u,
|
|
91
|
+
state: { ...u.state, store: p }
|
|
92
|
+
};
|
|
93
|
+
m("anno", _), m("viewer", r), o(1, a = _);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return s.$$set = (r) => {
|
|
97
|
+
"viewer" in r && o(0, i = r.viewer), "opts" in r && o(2, f = r.opts), "anno" in r && o(1, a = r.anno), "$$scope" in r && o(3, e = r.$$scope);
|
|
98
|
+
}, s.$$.update = () => {
|
|
99
|
+
s.$$.dirty & /*viewer*/
|
|
100
|
+
1 && S(i);
|
|
101
|
+
}, [i, a, f, e, t];
|
|
102
|
+
}
|
|
103
|
+
class E extends g {
|
|
104
|
+
constructor(n) {
|
|
105
|
+
super(), b(this, n, B, z, h, { viewer: 0, opts: 2, anno: 1 });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const I = E;
|
|
9
109
|
export {
|
|
10
|
-
|
|
110
|
+
I as default
|
|
11
111
|
};
|
|
12
112
|
//# sourceMappingURL=annotorious-svelte.es4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-svelte.es4.js","sources":["
|
|
1
|
+
{"version":3,"file":"annotorious-svelte.es4.js","sources":["../src/osd/OpenSeadragonAnnotator.svelte"],"sourcesContent":["<script lang=\"ts\">\n import { setContext } from 'svelte';\n import { SvelteAnnotator, SvelteAnnotatorState, toSvelteStore } from '@annotorious/core';\n import { createOSDAnnotator, ImageAnnotation } from '@annotorious/openseadragon';\n import type OpenSeadragon from 'openseadragon';\n\n /** props **/\n export let viewer: OpenSeadragon.Viewer;\n export let opts = {};\n export let anno: SvelteAnnotator<ImageAnnotation> = undefined;\n\n $: init(viewer);\n\n const init = (viewer: OpenSeadragon.Viewer) => {\n if (viewer) {\n const annotator = createOSDAnnotator(viewer, opts);\n\n // Wrap the store for Svelte reactivity\n const svelteStore = toSvelteStore(annotator.state.store);\n\n const shim = {\n ...annotator,\n state: {\n ...annotator.state,\n store: svelteStore\n } as SvelteAnnotatorState<ImageAnnotation>\n } as SvelteAnnotator<ImageAnnotation>\n\n setContext('anno', shim);\n setContext('viewer', viewer);\n\n anno = shim;\n }\n }\n</script>\n\n{#if viewer}\n <slot />\n{/if}\n"],"names":["ctx","create_if_block","viewer","$$props","opts","anno","init","annotator","createOSDAnnotator","svelteStore","toSvelteStore","shim","setContext","$$invalidate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoCKA,EAAM,CAAA,KAAAC,EAAAD,CAAA;AAAA;;;;;;;;;;MAANA,EAAM,CAAA;;;;;;;;;;;;;;;;;6CA7BE,QAAAE,EAA4B,IAAAC,KAC5B,MAAAC,IAAI,GAAA,IAAAD,GACJ,EAAA,MAAAE,IAAyC,OAAS,IAAAF;AAIvD,QAAAG,IAAQ,CAAAJ,MAA4B;QACpCA,GAAM;AACF,YAAAK,IAAYC,EAAmBN,GAAQE,CAAI,GAG3CK,IAAcC,EAAcH,EAAU,MAAM,KAAK,GAEjDI,IAAI;AAAA,WACLJ;AAAA,QACH,YACKA,EAAU,OACb,OAAOE,EAAA;AAAA;AAIX,MAAAG,EAAW,QAAQD,CAAI,GACvBC,EAAW,UAAUV,CAAM,GAE3BW,EAAA,GAAAR,IAAOM,CAAI;AAAA;;;;;;SApBZL,EAAKJ,CAAM;AAAA;;;;;;;;"}
|