@harvard-lts/mirador-annotations-auth-plugin 0.0.2 → 0.0.4
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/es/index.js +288 -303
- package/package.json +3 -3
package/dist/es/index.js
CHANGED
|
@@ -13,7 +13,11 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
|
13
13
|
import { withStyles } from '@material-ui/core/styles';
|
|
14
14
|
import { withTranslation } from 'react-i18next';
|
|
15
15
|
import { getVisibleCanvasIds, getCanvases, getCanvasLabel } from 'mirador/dist/es/src/state/selectors';
|
|
16
|
+
import AnnotationFactory from 'mirador/dist/es/src/lib/AnnotationFactory';
|
|
16
17
|
|
|
18
|
+
function _OverloadYield(e, d) {
|
|
19
|
+
this.v = e, this.k = d;
|
|
20
|
+
}
|
|
17
21
|
function _assertThisInitialized(e) {
|
|
18
22
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
19
23
|
return e;
|
|
@@ -98,306 +102,178 @@ function _possibleConstructorReturn(t, e) {
|
|
|
98
102
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
99
103
|
return _assertThisInitialized(t);
|
|
100
104
|
}
|
|
101
|
-
function
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
105
|
+
function _regenerator() {
|
|
106
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
107
|
+
var e,
|
|
108
|
+
t,
|
|
109
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
110
|
+
n = r.iterator || "@@iterator",
|
|
111
|
+
o = r.toStringTag || "@@toStringTag";
|
|
112
|
+
function i(r, n, o, i) {
|
|
113
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
114
|
+
u = Object.create(c.prototype);
|
|
115
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
116
|
+
var i,
|
|
117
|
+
c,
|
|
118
|
+
u,
|
|
119
|
+
f = 0,
|
|
120
|
+
p = o || [],
|
|
121
|
+
y = !1,
|
|
122
|
+
G = {
|
|
123
|
+
p: 0,
|
|
124
|
+
n: 0,
|
|
125
|
+
v: e,
|
|
126
|
+
a: d,
|
|
127
|
+
f: d.bind(e, 4),
|
|
128
|
+
d: function (t, r) {
|
|
129
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
function d(r, n) {
|
|
133
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
134
|
+
var o,
|
|
135
|
+
i = p[t],
|
|
136
|
+
d = G.p,
|
|
137
|
+
l = i[2];
|
|
138
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
139
|
+
}
|
|
140
|
+
if (o || r > 1) return a;
|
|
141
|
+
throw y = !0, n;
|
|
142
|
+
}
|
|
143
|
+
return function (o, p, l) {
|
|
144
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
145
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
146
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
147
|
+
try {
|
|
148
|
+
if (f = 2, i) {
|
|
149
|
+
if (c || (o = "next"), t = i[o]) {
|
|
150
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
151
|
+
if (!t.done) return t;
|
|
152
|
+
u = t.value, c < 2 && (c = 0);
|
|
153
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
154
|
+
i = e;
|
|
155
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
156
|
+
} catch (t) {
|
|
157
|
+
i = e, c = 1, u = t;
|
|
158
|
+
} finally {
|
|
159
|
+
f = 1;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
value: t,
|
|
164
|
+
done: y
|
|
165
|
+
};
|
|
149
166
|
};
|
|
150
|
-
}
|
|
167
|
+
}(r, o, i), !0), u;
|
|
151
168
|
}
|
|
152
|
-
|
|
153
|
-
var h = "suspendedStart",
|
|
154
|
-
l = "suspendedYield",
|
|
155
|
-
f = "executing",
|
|
156
|
-
s = "completed",
|
|
157
|
-
y = {};
|
|
169
|
+
var a = {};
|
|
158
170
|
function Generator() {}
|
|
159
171
|
function GeneratorFunction() {}
|
|
160
172
|
function GeneratorFunctionPrototype() {}
|
|
161
|
-
|
|
162
|
-
|
|
173
|
+
t = Object.getPrototypeOf;
|
|
174
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
175
|
+
return this;
|
|
176
|
+
}), t),
|
|
177
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
178
|
+
function f(e) {
|
|
179
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
180
|
+
}
|
|
181
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
163
182
|
return this;
|
|
183
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
184
|
+
return "[object Generator]";
|
|
185
|
+
}), (_regenerator = function () {
|
|
186
|
+
return {
|
|
187
|
+
w: i,
|
|
188
|
+
m: f
|
|
189
|
+
};
|
|
190
|
+
})();
|
|
191
|
+
}
|
|
192
|
+
function _regeneratorAsync(n, e, r, t, o) {
|
|
193
|
+
var a = _regeneratorAsyncGen(n, e, r, t, o);
|
|
194
|
+
return a.next().then(function (n) {
|
|
195
|
+
return n.done ? n.value : a.next();
|
|
164
196
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
197
|
+
}
|
|
198
|
+
function _regeneratorAsyncGen(r, e, t, o, n) {
|
|
199
|
+
return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || Promise);
|
|
200
|
+
}
|
|
201
|
+
function _regeneratorAsyncIterator(t, e) {
|
|
202
|
+
function n(r, o, i, f) {
|
|
203
|
+
try {
|
|
204
|
+
var c = t[r](o),
|
|
205
|
+
u = c.value;
|
|
206
|
+
return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) {
|
|
207
|
+
n("next", t, i, f);
|
|
208
|
+
}, function (t) {
|
|
209
|
+
n("throw", t, i, f);
|
|
210
|
+
}) : e.resolve(u).then(function (t) {
|
|
211
|
+
c.value = t, i(c);
|
|
212
|
+
}, function (t) {
|
|
213
|
+
return n("throw", t, i, f);
|
|
173
214
|
});
|
|
174
|
-
})
|
|
215
|
+
} catch (t) {
|
|
216
|
+
f(t);
|
|
217
|
+
}
|
|
175
218
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}, function (t) {
|
|
185
|
-
invoke("throw", t, i, a);
|
|
186
|
-
}) : e.resolve(h).then(function (t) {
|
|
187
|
-
u.value = t, i(u);
|
|
188
|
-
}, function (t) {
|
|
189
|
-
return invoke("throw", t, i, a);
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
a(c.arg);
|
|
219
|
+
var r;
|
|
220
|
+
this.next || (_regeneratorDefine(_regeneratorAsyncIterator.prototype), _regeneratorDefine(_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
|
|
221
|
+
return this;
|
|
222
|
+
})), _regeneratorDefine(this, "_invoke", function (t, o, i) {
|
|
223
|
+
function f() {
|
|
224
|
+
return new e(function (e, r) {
|
|
225
|
+
n(t, i, e, r);
|
|
226
|
+
});
|
|
193
227
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
});
|
|
228
|
+
return r = r ? r.then(f, f) : f();
|
|
229
|
+
}, !0);
|
|
230
|
+
}
|
|
231
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
232
|
+
var i = Object.defineProperty;
|
|
233
|
+
try {
|
|
234
|
+
i({}, "", {});
|
|
235
|
+
} catch (e) {
|
|
236
|
+
i = 0;
|
|
205
237
|
}
|
|
206
|
-
function
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
238
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
239
|
+
function o(r, n) {
|
|
240
|
+
_regeneratorDefine(e, r, function (e) {
|
|
241
|
+
return this._invoke(r, n, e);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
r ? i ? i(e, r, {
|
|
245
|
+
value: n,
|
|
246
|
+
enumerable: !t,
|
|
247
|
+
configurable: !t,
|
|
248
|
+
writable: !t
|
|
249
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
250
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
251
|
+
}
|
|
252
|
+
function _regeneratorKeys(e) {
|
|
253
|
+
var n = Object(e),
|
|
254
|
+
r = [];
|
|
255
|
+
for (var t in n) r.unshift(t);
|
|
256
|
+
return function e() {
|
|
257
|
+
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
|
|
258
|
+
return e.done = !0, e;
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function _regeneratorValues(e) {
|
|
262
|
+
if (null != e) {
|
|
263
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
264
|
+
r = 0;
|
|
265
|
+
if (t) return t.call(e);
|
|
266
|
+
if ("function" == typeof e.next) return e;
|
|
267
|
+
if (!isNaN(e.length)) return {
|
|
268
|
+
next: function () {
|
|
269
|
+
return e && r >= e.length && (e = void 0), {
|
|
270
|
+
value: e && e[r++],
|
|
271
|
+
done: !e
|
|
215
272
|
};
|
|
216
273
|
}
|
|
217
|
-
for (n.method = i, n.arg = a;;) {
|
|
218
|
-
var c = n.delegate;
|
|
219
|
-
if (c) {
|
|
220
|
-
var u = maybeInvokeDelegate(c, n);
|
|
221
|
-
if (u) {
|
|
222
|
-
if (u === y) continue;
|
|
223
|
-
return u;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
227
|
-
if (o === h) throw o = s, n.arg;
|
|
228
|
-
n.dispatchException(n.arg);
|
|
229
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
230
|
-
o = f;
|
|
231
|
-
var p = tryCatch(e, r, n);
|
|
232
|
-
if ("normal" === p.type) {
|
|
233
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
234
|
-
return {
|
|
235
|
-
value: p.arg,
|
|
236
|
-
done: n.done
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
240
|
-
}
|
|
241
274
|
};
|
|
242
275
|
}
|
|
243
|
-
|
|
244
|
-
var n = r.method,
|
|
245
|
-
o = e.iterator[n];
|
|
246
|
-
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
247
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
248
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
249
|
-
var a = i.arg;
|
|
250
|
-
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
251
|
-
}
|
|
252
|
-
function pushTryEntry(t) {
|
|
253
|
-
var e = {
|
|
254
|
-
tryLoc: t[0]
|
|
255
|
-
};
|
|
256
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
257
|
-
}
|
|
258
|
-
function resetTryEntry(t) {
|
|
259
|
-
var e = t.completion || {};
|
|
260
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
261
|
-
}
|
|
262
|
-
function Context(t) {
|
|
263
|
-
this.tryEntries = [{
|
|
264
|
-
tryLoc: "root"
|
|
265
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
266
|
-
}
|
|
267
|
-
function values(e) {
|
|
268
|
-
if (e || "" === e) {
|
|
269
|
-
var r = e[a];
|
|
270
|
-
if (r) return r.call(e);
|
|
271
|
-
if ("function" == typeof e.next) return e;
|
|
272
|
-
if (!isNaN(e.length)) {
|
|
273
|
-
var o = -1,
|
|
274
|
-
i = function next() {
|
|
275
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
276
|
-
return next.value = t, next.done = !0, next;
|
|
277
|
-
};
|
|
278
|
-
return i.next = i;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
282
|
-
}
|
|
283
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
284
|
-
value: GeneratorFunctionPrototype,
|
|
285
|
-
configurable: !0
|
|
286
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
287
|
-
value: GeneratorFunction,
|
|
288
|
-
configurable: !0
|
|
289
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
290
|
-
var e = "function" == typeof t && t.constructor;
|
|
291
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
292
|
-
}, e.mark = function (t) {
|
|
293
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
294
|
-
}, e.awrap = function (t) {
|
|
295
|
-
return {
|
|
296
|
-
__await: t
|
|
297
|
-
};
|
|
298
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
299
|
-
return this;
|
|
300
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
301
|
-
void 0 === i && (i = Promise);
|
|
302
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
303
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
304
|
-
return t.done ? t.value : a.next();
|
|
305
|
-
});
|
|
306
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
307
|
-
return this;
|
|
308
|
-
}), define(g, "toString", function () {
|
|
309
|
-
return "[object Generator]";
|
|
310
|
-
}), e.keys = function (t) {
|
|
311
|
-
var e = Object(t),
|
|
312
|
-
r = [];
|
|
313
|
-
for (var n in e) r.push(n);
|
|
314
|
-
return r.reverse(), function next() {
|
|
315
|
-
for (; r.length;) {
|
|
316
|
-
var t = r.pop();
|
|
317
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
318
|
-
}
|
|
319
|
-
return next.done = !0, next;
|
|
320
|
-
};
|
|
321
|
-
}, e.values = values, Context.prototype = {
|
|
322
|
-
constructor: Context,
|
|
323
|
-
reset: function (e) {
|
|
324
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
325
|
-
},
|
|
326
|
-
stop: function () {
|
|
327
|
-
this.done = !0;
|
|
328
|
-
var t = this.tryEntries[0].completion;
|
|
329
|
-
if ("throw" === t.type) throw t.arg;
|
|
330
|
-
return this.rval;
|
|
331
|
-
},
|
|
332
|
-
dispatchException: function (e) {
|
|
333
|
-
if (this.done) throw e;
|
|
334
|
-
var r = this;
|
|
335
|
-
function handle(n, o) {
|
|
336
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
337
|
-
}
|
|
338
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
339
|
-
var i = this.tryEntries[o],
|
|
340
|
-
a = i.completion;
|
|
341
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
342
|
-
if (i.tryLoc <= this.prev) {
|
|
343
|
-
var c = n.call(i, "catchLoc"),
|
|
344
|
-
u = n.call(i, "finallyLoc");
|
|
345
|
-
if (c && u) {
|
|
346
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
347
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
348
|
-
} else if (c) {
|
|
349
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
350
|
-
} else {
|
|
351
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
352
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
abrupt: function (t, e) {
|
|
358
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
359
|
-
var o = this.tryEntries[r];
|
|
360
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
361
|
-
var i = o;
|
|
362
|
-
break;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
366
|
-
var a = i ? i.completion : {};
|
|
367
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
368
|
-
},
|
|
369
|
-
complete: function (t, e) {
|
|
370
|
-
if ("throw" === t.type) throw t.arg;
|
|
371
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
372
|
-
},
|
|
373
|
-
finish: function (t) {
|
|
374
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
375
|
-
var r = this.tryEntries[e];
|
|
376
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
377
|
-
}
|
|
378
|
-
},
|
|
379
|
-
catch: function (t) {
|
|
380
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
381
|
-
var r = this.tryEntries[e];
|
|
382
|
-
if (r.tryLoc === t) {
|
|
383
|
-
var n = r.completion;
|
|
384
|
-
if ("throw" === n.type) {
|
|
385
|
-
var o = n.arg;
|
|
386
|
-
resetTryEntry(r);
|
|
387
|
-
}
|
|
388
|
-
return o;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
throw Error("illegal catch attempt");
|
|
392
|
-
},
|
|
393
|
-
delegateYield: function (e, r, n) {
|
|
394
|
-
return this.delegate = {
|
|
395
|
-
iterator: values(e),
|
|
396
|
-
resultName: r,
|
|
397
|
-
nextLoc: n
|
|
398
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
399
|
-
}
|
|
400
|
-
}, e;
|
|
276
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
401
277
|
}
|
|
402
278
|
function _setPrototypeOf(t, e) {
|
|
403
279
|
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
@@ -418,6 +294,74 @@ function _toPropertyKey(t) {
|
|
|
418
294
|
var i = _toPrimitive(t, "string");
|
|
419
295
|
return "symbol" == typeof i ? i : i + "";
|
|
420
296
|
}
|
|
297
|
+
function _regeneratorRuntime() {
|
|
298
|
+
|
|
299
|
+
var r = _regenerator(),
|
|
300
|
+
e = r.m(_regeneratorRuntime),
|
|
301
|
+
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
|
|
302
|
+
function n(r) {
|
|
303
|
+
var e = "function" == typeof r && r.constructor;
|
|
304
|
+
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
|
|
305
|
+
}
|
|
306
|
+
var o = {
|
|
307
|
+
throw: 1,
|
|
308
|
+
return: 2,
|
|
309
|
+
break: 3,
|
|
310
|
+
continue: 3
|
|
311
|
+
};
|
|
312
|
+
function a(r) {
|
|
313
|
+
var e, t;
|
|
314
|
+
return function (n) {
|
|
315
|
+
e || (e = {
|
|
316
|
+
stop: function () {
|
|
317
|
+
return t(n.a, 2);
|
|
318
|
+
},
|
|
319
|
+
catch: function () {
|
|
320
|
+
return n.v;
|
|
321
|
+
},
|
|
322
|
+
abrupt: function (r, e) {
|
|
323
|
+
return t(n.a, o[r], e);
|
|
324
|
+
},
|
|
325
|
+
delegateYield: function (r, o, a) {
|
|
326
|
+
return e.resultName = o, t(n.d, _regeneratorValues(r), a);
|
|
327
|
+
},
|
|
328
|
+
finish: function (r) {
|
|
329
|
+
return t(n.f, r);
|
|
330
|
+
}
|
|
331
|
+
}, t = function (r, t, o) {
|
|
332
|
+
n.p = e.prev, n.n = e.next;
|
|
333
|
+
try {
|
|
334
|
+
return r(t, o);
|
|
335
|
+
} finally {
|
|
336
|
+
e.next = n.n;
|
|
337
|
+
}
|
|
338
|
+
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
|
|
339
|
+
try {
|
|
340
|
+
return r.call(this, e);
|
|
341
|
+
} finally {
|
|
342
|
+
n.p = e.prev, n.n = e.next;
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
return (_regeneratorRuntime = function () {
|
|
347
|
+
return {
|
|
348
|
+
wrap: function (e, t, n, o) {
|
|
349
|
+
return r.w(a(e), t, n, o && o.reverse());
|
|
350
|
+
},
|
|
351
|
+
isGeneratorFunction: n,
|
|
352
|
+
mark: r.m,
|
|
353
|
+
awrap: function (r, e) {
|
|
354
|
+
return new _OverloadYield(r, e);
|
|
355
|
+
},
|
|
356
|
+
AsyncIterator: _regeneratorAsyncIterator,
|
|
357
|
+
async: function (r, e, t, o, u) {
|
|
358
|
+
return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u);
|
|
359
|
+
},
|
|
360
|
+
keys: _regeneratorKeys,
|
|
361
|
+
values: _regeneratorValues
|
|
362
|
+
};
|
|
363
|
+
})();
|
|
364
|
+
}
|
|
421
365
|
|
|
422
366
|
var AnnotationsAuthSidePanel = /*#__PURE__*/function (_Component) {
|
|
423
367
|
function AnnotationsAuthSidePanel(props) {
|
|
@@ -430,10 +374,12 @@ var AnnotationsAuthSidePanel = /*#__PURE__*/function (_Component) {
|
|
|
430
374
|
_this.handleAnnotationBlur = _this.handleAnnotationBlur.bind(_this);
|
|
431
375
|
var _this$props = _this.props,
|
|
432
376
|
windowId = _this$props.windowId,
|
|
433
|
-
canvasAnnotationPages = _this$props.canvasAnnotationPages
|
|
377
|
+
canvasAnnotationPages = _this$props.canvasAnnotationPages,
|
|
378
|
+
canvasAnnotationList = _this$props.canvasAnnotationList;
|
|
434
379
|
_this.state = {
|
|
435
380
|
windowId: windowId,
|
|
436
|
-
canvasAnnotationPages: canvasAnnotationPages
|
|
381
|
+
canvasAnnotationPages: canvasAnnotationPages,
|
|
382
|
+
canvasAnnotationList: canvasAnnotationList
|
|
437
383
|
};
|
|
438
384
|
return _this;
|
|
439
385
|
}
|
|
@@ -480,11 +426,25 @@ var AnnotationsAuthSidePanel = /*#__PURE__*/function (_Component) {
|
|
|
480
426
|
key: "componentDidMount",
|
|
481
427
|
value: function () {
|
|
482
428
|
var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
483
|
-
var canvasAnnotationPages, promises, results;
|
|
429
|
+
var _this$state, canvasAnnotationPages, canvasAnnotationList, promises, results;
|
|
484
430
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
485
431
|
while (1) switch (_context2.prev = _context2.next) {
|
|
486
432
|
case 0:
|
|
487
|
-
|
|
433
|
+
_this$state = this.state, canvasAnnotationPages = _this$state.canvasAnnotationPages, canvasAnnotationList = _this$state.canvasAnnotationList;
|
|
434
|
+
if (!(canvasAnnotationList.json !== undefined)) {
|
|
435
|
+
_context2.next = 5;
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
if (!(canvasAnnotationList.json[0].items !== undefined)) {
|
|
439
|
+
_context2.next = 5;
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
this.setState({
|
|
443
|
+
annotationData: canvasAnnotationList.json[0].items,
|
|
444
|
+
loading: false
|
|
445
|
+
});
|
|
446
|
+
return _context2.abrupt("return");
|
|
447
|
+
case 5:
|
|
488
448
|
promises = [];
|
|
489
449
|
canvasAnnotationPages.forEach(function (annotationPage, index) {
|
|
490
450
|
var promise = new Promise(/*#__PURE__*/function () {
|
|
@@ -520,30 +480,30 @@ var AnnotationsAuthSidePanel = /*#__PURE__*/function (_Component) {
|
|
|
520
480
|
}());
|
|
521
481
|
promises.push(promise);
|
|
522
482
|
});
|
|
523
|
-
_context2.prev =
|
|
524
|
-
_context2.next =
|
|
483
|
+
_context2.prev = 7;
|
|
484
|
+
_context2.next = 10;
|
|
525
485
|
return Promise.all(promises);
|
|
526
|
-
case
|
|
486
|
+
case 10:
|
|
527
487
|
results = _context2.sent;
|
|
528
488
|
this.setState({
|
|
529
489
|
annotationData: results,
|
|
530
490
|
loading: false
|
|
531
491
|
});
|
|
532
|
-
_context2.next =
|
|
492
|
+
_context2.next = 18;
|
|
533
493
|
break;
|
|
534
|
-
case
|
|
535
|
-
_context2.prev =
|
|
536
|
-
_context2.t0 = _context2["catch"](
|
|
494
|
+
case 14:
|
|
495
|
+
_context2.prev = 14;
|
|
496
|
+
_context2.t0 = _context2["catch"](7);
|
|
537
497
|
console.error('There was a problem receiving the annotation:', _context2.t0);
|
|
538
498
|
this.setState({
|
|
539
499
|
loading: false,
|
|
540
500
|
error: _context2.t0.message
|
|
541
501
|
});
|
|
542
|
-
case
|
|
502
|
+
case 18:
|
|
543
503
|
case "end":
|
|
544
504
|
return _context2.stop();
|
|
545
505
|
}
|
|
546
|
-
}, _callee2, this, [[
|
|
506
|
+
}, _callee2, this, [[7, 14]]);
|
|
547
507
|
}));
|
|
548
508
|
function componentDidMount() {
|
|
549
509
|
return _componentDidMount.apply(this, arguments);
|
|
@@ -562,10 +522,10 @@ var AnnotationsAuthSidePanel = /*#__PURE__*/function (_Component) {
|
|
|
562
522
|
listContainerComponent = _this$props5.listContainerComponent,
|
|
563
523
|
hoveredAnnotationIds = _this$props5.hoveredAnnotationIds,
|
|
564
524
|
htmlSanitizationRuleSet = _this$props5.htmlSanitizationRuleSet;
|
|
565
|
-
var _this$
|
|
566
|
-
annotationData = _this$
|
|
567
|
-
loading = _this$
|
|
568
|
-
error = _this$
|
|
525
|
+
var _this$state2 = this.state,
|
|
526
|
+
annotationData = _this$state2.annotationData,
|
|
527
|
+
loading = _this$state2.loading,
|
|
528
|
+
error = _this$state2.error;
|
|
569
529
|
if ({
|
|
570
530
|
annotationData: annotationData
|
|
571
531
|
}.length === 0) return /*#__PURE__*/jsx(Fragment, {});
|
|
@@ -580,6 +540,7 @@ var AnnotationsAuthSidePanel = /*#__PURE__*/function (_Component) {
|
|
|
580
540
|
})]
|
|
581
541
|
}), annotationData && /*#__PURE__*/jsx(Fragment, {
|
|
582
542
|
children: annotationData.map(function (annotation, i) {
|
|
543
|
+
var _annotation$body, _annotation$resources;
|
|
583
544
|
return /*#__PURE__*/jsx(MenuList, {
|
|
584
545
|
autoFocusItem: true,
|
|
585
546
|
variant: "selectedMenu",
|
|
@@ -625,7 +586,7 @@ var AnnotationsAuthSidePanel = /*#__PURE__*/function (_Component) {
|
|
|
625
586
|
},
|
|
626
587
|
children: /*#__PURE__*/jsx(SanitizedHtml, {
|
|
627
588
|
ruleSet: htmlSanitizationRuleSet,
|
|
628
|
-
htmlString: annotation.resources[0].resource.chars
|
|
589
|
+
htmlString: ((_annotation$body = annotation.body) === null || _annotation$body === void 0 ? void 0 : _annotation$body.value) || ((_annotation$resources = annotation.resources) === null || _annotation$resources === void 0 || (_annotation$resources = _annotation$resources[0]) === null || _annotation$resources === void 0 || (_annotation$resources = _annotation$resources.resource) === null || _annotation$resources === void 0 ? void 0 : _annotation$resources.chars) || ''
|
|
629
590
|
})
|
|
630
591
|
})
|
|
631
592
|
}, {
|
|
@@ -643,6 +604,7 @@ var AnnotationsAuthSidePanel = /*#__PURE__*/function (_Component) {
|
|
|
643
604
|
}(Component);
|
|
644
605
|
AnnotationsAuthSidePanel.propTypes = {
|
|
645
606
|
canvasAnnotationPages: PropTypes.arrayOf(PropTypes.string),
|
|
607
|
+
canvasAnnotationList: PropTypes.arrayOf(PropTypes.object),
|
|
646
608
|
canvasLabel: PropTypes.string,
|
|
647
609
|
classes: PropTypes.objectOf(PropTypes.string),
|
|
648
610
|
htmlSanitizationRuleSet: PropTypes.string,
|
|
@@ -655,6 +617,7 @@ AnnotationsAuthSidePanel.propTypes = {
|
|
|
655
617
|
};
|
|
656
618
|
AnnotationsAuthSidePanel.defaultProps = {
|
|
657
619
|
canvasAnnotationPages: [],
|
|
620
|
+
canvasAnnotationList: [],
|
|
658
621
|
canvasLabel: null,
|
|
659
622
|
classes: {},
|
|
660
623
|
htmlSanitizationRuleSet: 'iiif',
|
|
@@ -715,6 +678,23 @@ function getAnnotationPages(canvases, canvasIds) {
|
|
|
715
678
|
}
|
|
716
679
|
return annotationPages;
|
|
717
680
|
}
|
|
681
|
+
function getAnnotationList(canvases, canvasIds) {
|
|
682
|
+
var annotationList = [];
|
|
683
|
+
for (var i = 0; i < canvases.length; i++) {
|
|
684
|
+
if (canvases[i].id === canvasIds[0]) {
|
|
685
|
+
if (canvases[i].__jsonld.otherContent !== undefined) {
|
|
686
|
+
// Version 2 Annotation Page
|
|
687
|
+
annotationList = AnnotationFactory.determineAnnotation(canvases[i].__jsonld.otherContent);
|
|
688
|
+
}
|
|
689
|
+
if (canvases[i].__jsonld.annotations !== undefined) {
|
|
690
|
+
// Version 3 Annotation Page
|
|
691
|
+
annotationList = AnnotationFactory.determineAnnotation(canvases[i].__jsonld.annotations);
|
|
692
|
+
}
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
return annotationList;
|
|
697
|
+
}
|
|
718
698
|
var mapStateToProps = function mapStateToProps(state, _ref) {
|
|
719
699
|
var canvasId = _ref.canvasId,
|
|
720
700
|
windowId = _ref.windowId;
|
|
@@ -724,6 +704,11 @@ var mapStateToProps = function mapStateToProps(state, _ref) {
|
|
|
724
704
|
}), getVisibleCanvasIds(state, {
|
|
725
705
|
windowId: windowId
|
|
726
706
|
})),
|
|
707
|
+
canvasAnnotationList: getAnnotationList(getCanvases(state, {
|
|
708
|
+
windowId: windowId
|
|
709
|
+
}), getVisibleCanvasIds(state, {
|
|
710
|
+
windowId: windowId
|
|
711
|
+
})),
|
|
727
712
|
canvasLabel: getCanvasLabel(state, {
|
|
728
713
|
canvasId: canvasId,
|
|
729
714
|
windowId: windowId
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-component"
|
|
7
7
|
],
|
|
8
|
-
"version": "0.0.
|
|
8
|
+
"version": "0.0.4",
|
|
9
9
|
"description": "A Mirador 3 plugin for including authentication cookies for annotations.",
|
|
10
10
|
"module": "dist/es/index.js",
|
|
11
11
|
"files": [
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@testing-library/react": "^12.0.0",
|
|
35
35
|
"babel-jest": "^29.7.0",
|
|
36
36
|
"babel-loader": "^9.1.2",
|
|
37
|
-
"jest": "^
|
|
38
|
-
"jest-environment-jsdom": "^
|
|
37
|
+
"jest": "^30.0.2",
|
|
38
|
+
"jest-environment-jsdom": "^30.0.2",
|
|
39
39
|
"mirador": "^3.4.3",
|
|
40
40
|
"npm-run-all": "^4.1.5",
|
|
41
41
|
"rollup": "^3.29.5",
|