UNPKG

mirador

Version:

An open-source, web-based 'multi-up' viewer that supports zoom-pan-rotate functionality, ability to display/compare simple images, and images with annotations.

164 lines (163 loc) • 6.54 kB
import { B as e, E as t, F as n, L as r, O as i, S as a, at as o, f as s, ft as c, m as l, q as u, rt as d, tt as f, u as p, w as m, z as h } from "./getters-H0mV17lW.js"; import { $t as g, Lt as _, Xt as v, Zt as y, dn as b, en as x, p as S, t as C } from "./canvases-CWytFm4k.js"; import { useEffect as w, useMemo as T, useRef as E } from "react"; //#region node_modules/lodash/_isFlattenable.js var D = /* @__PURE__ */ c(((e, n) => { var r = d(), i = t(), a = o(), s = r ? r.isConcatSpreadable : void 0; function c(e) { return a(e) || i(e) || !!(s && e && e[s]); } n.exports = c; })), O = /* @__PURE__ */ c(((e, t) => { var n = v(), r = D(); function i(e, t, a, o, s) { var c = -1, l = e.length; for (a ||= r, s ||= []; ++c < l;) { var u = e[c]; t > 0 && a(u) ? t > 1 ? i(u, t - 1, a, o, s) : n(s, u) : o || (s[s.length] = u); } return s; } t.exports = i; })), k = /* @__PURE__ */ c(((t, n) => { var r = e(), i = Math.max; function a(e, t, n) { return t = i(t === void 0 ? e.length - 1 : t, 0), function() { for (var a = arguments, o = -1, s = i(a.length - t, 0), c = Array(s); ++o < s;) c[o] = a[t + o]; o = -1; for (var l = Array(t + 1); ++o < t;) l[o] = a[o]; return l[t] = n(c), r(e, this, l); }; } n.exports = a; })), A = /* @__PURE__ */ c(((e, t) => { var n = u(), i = k(), a = r(); function o(e, t) { return a(i(e, t, n), e + ""); } t.exports = o; })), j = /* @__PURE__ */ c(((e, t) => { function n(e, t, n) { for (var r = -1, i = e == null ? 0 : e.length; ++r < i;) if (n(t, e[r])) return !0; return !1; } t.exports = n; })), M = /* @__PURE__ */ c(((e, t) => { var n = i(), r = h(), a = y(); t.exports = n && 1 / a(new n([, -0]))[1] == 1 / 0 ? function(e) { return new n(e); } : r; })), N = /* @__PURE__ */ c(((e, t) => { var r = x(), i = n(), a = j(), o = g(), s = M(), c = y(), l = 200; function u(e, t, n) { var u = -1, d = i, f = e.length, p = !0, m = [], h = m; if (n) p = !1, d = a; else if (f >= l) { var g = t ? null : s(e); if (g) return c(g); p = !1, d = o, h = new r(); } else h = t ? [] : m; outer: for (; ++u < f;) { var _ = e[u], v = t ? t(_) : _; if (_ = n || _ !== 0 ? _ : 0, p && v === v) { for (var y = h.length; y--;) if (h[y] === v) continue outer; t && h.push(v), m.push(_); } else d(h, v, n) || (h !== m && h.push(v), m.push(_)); } return m; } t.exports = u; })), P = /* @__PURE__ */ c(((e, t) => { var n = m(), r = f(); function i(e) { return r(e) && n(e); } t.exports = i; })), F = /* @__PURE__ */ c(((e, t) => { var r = x(), i = n(), o = j(), s = b(), c = a(), l = g(), u = 200; function d(e, t, n, a) { var d = -1, f = i, p = !0, m = e.length, h = [], g = t.length; if (!m) return h; n && (t = s(t, c(n))), a ? (f = o, p = !1) : t.length >= u && (f = l, p = !1, t = new r(t)); outer: for (; ++d < m;) { var _ = e[d], v = n == null ? _ : n(_); if (_ = a || _ !== 0 ? _ : 0, p && v === v) { for (var y = g; y--;) if (t[y] === v) continue outer; h.push(_); } else f(t, v, a) || h.push(_); } return h; } t.exports = d; })), I = l([C, _], (e, t) => e ? t(e).imageResources : []), L = l([(e) => s(e).layers, (e, { windowId: t }) => t], (e, t) => e && e[t] || p), R = l([L, (e, { canvasId: t }) => t], (e, t) => e[t]), z = l([I, R], (e, t) => t ? e.sort((e, n) => t[e.id] && t[e.id].index !== void 0 && t[n.id] && t[n.id].index !== void 0 ? t[e.id].index - t[n.id].index : t[e.id] && t[e.id].index !== void 0 ? -1 : t[n.id] && t[n.id].index !== void 0 ? 1 : 0) : e), B = l([S, L], (e, t) => e.reduce((e, n) => (e[n] = t[n], e), {})); //#endregion //#region node_modules/use-debounce/dist/index.module.js function V(e, t, n, r) { var i = this, a = E(null), o = E(0), s = E(0), c = E(null), l = E([]), u = E(), d = E(), f = E(e), p = E(!0), m = E(), h = E(); f.current = e; var g = typeof window < "u", _ = !t && t !== 0 && g; if (typeof e != "function") throw TypeError("Expected a function"); t = +t || 0; var v = !!(n ||= {}).leading, y = !("trailing" in n) || !!n.trailing, b = !!n.flushOnExit && y, x = "maxWait" in n, S = "debounceOnServer" in n && !!n.debounceOnServer, C = x ? Math.max(+n.maxWait || 0, t) : null, D = T(function() { var e = function(e) { var t = l.current, n = u.current; return l.current = u.current = null, o.current = e, s.current = s.current || e, d.current = f.current.apply(n, t); }, n = function(e, t) { _ && cancelAnimationFrame(c.current), c.current = _ ? requestAnimationFrame(e) : setTimeout(e, t); }, w = function(e) { if (!p.current) return !1; var n = e - a.current; return !a.current || n >= t || n < 0 || x && e - o.current >= C; }, T = function(t) { return c.current = null, y && l.current ? e(t) : (l.current = u.current = null, d.current); }, E = function e() { var r = Date.now(); if (v && s.current === o.current && D(), w(r)) return T(r); if (p.current) { var i = t - (r - a.current); n(e, x ? Math.min(i, C - (r - o.current)) : i); } }, D = function() { r && r({}); }, O = function() { if (g || S) { var r, s = Date.now(), f = w(s); if (l.current = [].slice.call(arguments), u.current = i, a.current = s, b && !m.current && (m.current = function() { globalThis.document?.visibilityState === "hidden" && h.current.flush(); }, (r = globalThis.document) == null || r.addEventListener == null || r.addEventListener("visibilitychange", m.current)), f) { if (!c.current && p.current) return o.current = a.current, n(E, t), v ? e(a.current) : d.current; if (x) return n(E, t), e(a.current); } return c.current || n(E, t), d.current; } }; return O.cancel = function() { var e = c.current; e && (_ ? cancelAnimationFrame(c.current) : clearTimeout(c.current)), o.current = 0, l.current = a.current = u.current = c.current = null, e && r && r({}); }, O.isPending = function() { return !!c.current; }, O.flush = function() { return c.current ? T(Date.now()) : d.current; }, O; }, [ v, x, t, C, y, b, _, g, S, r ]); return h.current = D, w(function() { return p.current = !0, function() { var e; b && h.current.flush(), m.current &&= ((e = globalThis.document) == null || e.removeEventListener == null || e.removeEventListener("visibilitychange", m.current), null), p.current = !1; }; }, [b]), D; } //#endregion export { L as a, P as c, k as d, O as f, B as i, N as l, I as n, z as o, R as r, F as s, V as t, A as u }; //# sourceMappingURL=index.module-8PXj8htN.js.map