@egjs/svelte-conveyer
Version:
Svelte Conveyer adds Drag gestures to your Native Scroll.
1,501 lines (1,497 loc) • 82.9 kB
JavaScript
import { onMount as fe, onDestroy as Ct } from "svelte/internal";
import { writable as le } from "svelte/store";
/*!
* @egjs/svelte-conveyer v1.8.1-alpha.0
* (c) 2025 [object Object]
* @license MIT
*/
function Ot(i, r) {
for (var e = i.length, t = 0; t < e; ++t)
if (r(i[t], t))
return !0;
return !1;
}
function Ft(i, r) {
for (var e = i.length, t = 0; t < e; ++t)
if (r(i[t], t))
return i[t];
return null;
}
function kt(i) {
var r = i;
if (typeof r > "u") {
if (typeof navigator > "u" || !navigator)
return "";
r = navigator.userAgent || "";
}
return r.toLowerCase();
}
function wt(i, r) {
try {
return new RegExp(i, "g").exec(r);
} catch {
return null;
}
}
function he() {
if (typeof navigator > "u" || !navigator || !navigator.userAgentData)
return !1;
var i = navigator.userAgentData, r = i.brands || i.uaList;
return !!(r && r.length);
}
function ve(i, r) {
var e = wt("(" + i + ")((?:\\/|\\s|:)([0-9|\\.|_]+))", r);
return e ? e[3] : "";
}
function vt(i) {
return i.replace(/_/g, ".");
}
function B(i, r) {
var e = null, t = "-1";
return Ot(i, function(n) {
var s = wt("(" + n.test + ")((?:\\/|\\s|:)([0-9|\\.|_]+))?", r);
return !s || n.brand ? !1 : (e = n, t = s[3] || "-1", n.versionAlias ? t = n.versionAlias : n.versionTest && (t = ve(n.versionTest.toLowerCase(), r) || t), t = vt(t), !0);
}), {
preset: e,
version: t
};
}
function K(i, r) {
var e = {
brand: "",
version: "-1"
};
return Ot(i, function(t) {
var n = Ht(r, t);
return n ? (e.brand = t.id, e.version = t.versionAlias || n.version, e.version !== "-1") : !1;
}), e;
}
function Ht(i, r) {
return Ft(i, function(e) {
var t = e.brand;
return wt("" + r.test, t.toLowerCase());
});
}
var Xt = [{
test: "phantomjs",
id: "phantomjs"
}, {
test: "whale",
id: "whale"
}, {
test: "edgios|edge|edg",
id: "edge"
}, {
test: "msie|trident|windows phone",
id: "ie",
versionTest: "iemobile|msie|rv"
}, {
test: "miuibrowser",
id: "miui browser"
}, {
test: "samsungbrowser",
id: "samsung internet"
}, {
test: "samsung",
id: "samsung internet",
versionTest: "version"
}, {
test: "chrome|crios",
id: "chrome"
}, {
test: "firefox|fxios",
id: "firefox"
}, {
test: "android",
id: "android browser",
versionTest: "version"
}, {
test: "safari|iphone|ipad|ipod",
id: "safari",
versionTest: "version"
}], Ut = [{
test: "(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)",
id: "chrome",
versionTest: "chrome"
}, {
test: "chromium",
id: "chrome"
}, {
test: "whale",
id: "chrome",
versionAlias: "-1",
brand: !0
}], dt = [{
test: "applewebkit",
id: "webkit",
versionTest: "applewebkit|safari"
}], Kt = [{
test: "(?=(iphone|ipad))(?!(.*version))",
id: "webview"
}, {
test: "(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))",
id: "webview"
}, {
// test webview
test: "webview",
id: "webview"
}], qt = [{
test: "windows phone",
id: "windows phone"
}, {
test: "windows 2000",
id: "window",
versionAlias: "5.0"
}, {
test: "windows nt",
id: "window"
}, {
test: "win32|windows",
id: "window"
}, {
test: "iphone|ipad|ipod",
id: "ios",
versionTest: "iphone os|cpu os"
}, {
test: "macos|macintel|mac os x",
id: "mac"
}, {
test: "android|linux armv81",
id: "android"
}, {
test: "tizen",
id: "tizen"
}, {
test: "webos|web0s",
id: "webos"
}];
function $t(i) {
return !!B(Kt, i).preset;
}
function de(i) {
var r = kt(i), e = !!/mobi/g.exec(r), t = {
name: "unknown",
version: "-1",
majorVersion: -1,
webview: $t(r),
chromium: !1,
chromiumVersion: "-1",
webkit: !1,
webkitVersion: "-1"
}, n = {
name: "unknown",
version: "-1",
majorVersion: -1
}, s = B(Xt, r), a = s.preset, o = s.version, u = B(qt, r), c = u.preset, f = u.version, l = B(Ut, r);
if (t.chromium = !!l.preset, t.chromiumVersion = l.version, !t.chromium) {
var h = B(dt, r);
t.webkit = !!h.preset, t.webkitVersion = h.version;
}
return c && (n.name = c.id, n.version = f, n.majorVersion = parseInt(f, 10)), a && (t.name = a.id, t.version = o, t.webview && n.name === "ios" && t.name !== "safari" && (t.webview = !1)), t.majorVersion = parseInt(t.version, 10), {
browser: t,
os: n,
isMobile: e,
isHints: !1
};
}
function _e(i) {
var r = navigator.userAgentData, e = (r.uaList || r.brands).slice(), t = r.mobile || !1, n = e[0], s = (r.platform || navigator.platform).toLowerCase(), a = {
name: n.brand,
version: n.version,
majorVersion: -1,
webkit: !1,
webkitVersion: "-1",
chromium: !1,
chromiumVersion: "-1",
webview: !!K(Kt, e).brand || $t(kt())
}, o = {
name: "unknown",
version: "-1",
majorVersion: -1
};
a.webkit = !a.chromium && Ot(dt, function(h) {
return Ht(e, h);
});
var u = K(Ut, e);
if (a.chromium = !!u.brand, a.chromiumVersion = u.version || "-1", !a.chromium) {
var c = K(dt, e);
a.webkit = !!c.brand, a.webkitVersion = c.version || "-1";
}
var f = Ft(qt, function(h) {
return new RegExp("" + h.test, "g").exec(s);
});
o.name = f ? f.id : "";
{
var l = K(Xt, e);
a.name = l.brand || a.name, a.version = l.brand && i ? i.uaFullVersion : l.version;
}
return a.webkit && (o.name = t ? "ios" : "mac"), o.name === "ios" && a.webview && (a.version = "-1"), o.version = vt(o.version), a.version = vt(a.version), o.majorVersion = parseInt(o.version, 10), a.majorVersion = parseInt(a.version, 10), {
browser: a,
os: o,
isMobile: t,
isHints: !0
};
}
function ge(i) {
return he() ? _e() : de(i);
}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function pe(i) {
var r = typeof Symbol == "function" && Symbol.iterator, e = r && i[r], t = 0;
if (e) return e.call(i);
if (i && typeof i.length == "number") return {
next: function() {
return i && t >= i.length && (i = void 0), {
value: i && i[t++],
done: !i
};
}
};
throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function me(i, r) {
var e = typeof Symbol == "function" && i[Symbol.iterator];
if (!e) return i;
var t = e.call(i), n, s = [], a;
try {
for (; (r === void 0 || r-- > 0) && !(n = t.next()).done; ) s.push(n.value);
} catch (o) {
a = {
error: o
};
} finally {
try {
n && !n.done && (e = t.return) && e.call(t);
} finally {
if (a) throw a.error;
}
}
return s;
}
function it() {
for (var i = [], r = 0; r < arguments.length; r++) i = i.concat(me(arguments[r]));
return i;
}
var W = function(i) {
return typeof i > "u";
}, _t = /* @__PURE__ */ (function() {
function i(e, t) {
var n, s;
if (this._canceled = !1, t)
try {
for (var a = pe(Object.keys(t)), o = a.next(); !o.done; o = a.next()) {
var u = o.value;
this[u] = t[u];
}
} catch (c) {
n = {
error: c
};
} finally {
try {
o && !o.done && (s = a.return) && s.call(a);
} finally {
if (n) throw n.error;
}
}
this.eventType = e;
}
var r = i.prototype;
return r.stop = function() {
this._canceled = !0;
}, r.isCanceled = function() {
return this._canceled;
}, i;
})(), tt = /* @__PURE__ */ (function() {
function i() {
this._eventHandler = {};
}
var r = i.prototype;
return r.trigger = function(e) {
for (var t = [], n = 1; n < arguments.length; n++)
t[n - 1] = arguments[n];
var s = e instanceof _t ? e.eventType : e, a = it(this._eventHandler[s] || []);
return a.length <= 0 ? this : (e instanceof _t ? (e.currentTarget = this, a.forEach(function(o) {
o(e);
})) : a.forEach(function(o) {
o.apply(void 0, it(t));
}), this);
}, r.once = function(e, t) {
var n = this;
if (typeof e == "object" && W(t)) {
var s = e;
for (var a in s)
this.once(a, s[a]);
return this;
} else if (typeof e == "string" && typeof t == "function") {
var o = function() {
for (var u = [], c = 0; c < arguments.length; c++)
u[c] = arguments[c];
t.apply(void 0, it(u)), n.off(e, o);
};
this.on(e, o);
}
return this;
}, r.hasOn = function(e) {
return !!this._eventHandler[e];
}, r.on = function(e, t) {
if (typeof e == "object" && W(t)) {
var n = e;
for (var s in n)
this.on(s, n[s]);
return this;
} else if (typeof e == "string" && typeof t == "function") {
var a = this._eventHandler[e];
W(a) && (this._eventHandler[e] = [], a = this._eventHandler[e]), a.push(t);
}
return this;
}, r.off = function(e, t) {
if (W(e))
return this._eventHandler = {}, this;
if (W(t)) {
if (typeof e == "string")
return delete this._eventHandler[e], this;
var n = e;
for (var s in n)
this.off(s, n[s]);
return this;
}
var a = this._eventHandler[e];
if (a) {
for (var o = a.length, u = 0; u < o; ++u)
if (a[u] === t) {
a.splice(u, 1), o <= 1 && delete this._eventHandler[e];
break;
}
}
return this;
}, i.VERSION = "3.0.5", i;
})(), R = _t;
function Gt(i) {
return Object.keys(i);
}
function Ee(i) {
return i.replace(/[\s-_]([a-z])/g, function(r, e) {
return e.toUpperCase();
});
}
function be(i) {
return typeof i == "function";
}
var gt = "__observers__", G = "__computed__", st = 1, at = "__CFCS_DETECTED_DEPENDENCIES__", pt = function(i, r) {
return pt = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(e, t) {
e.__proto__ = t;
} || function(e, t) {
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, pt(i, r);
};
function ye(i, r) {
if (typeof r != "function" && r !== null) throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
pt(i, r);
function e() {
this.constructor = i;
}
i.prototype = r === null ? Object.create(r) : (e.prototype = r.prototype, new e());
}
function Rt(i, r, e) {
if (arguments.length === 2) for (var t = 0, n = r.length, s; t < n; t++)
(s || !(t in r)) && (s || (s = Array.prototype.slice.call(r, 0, t)), s[t] = r[t]);
return i.concat(s || Array.prototype.slice.call(r));
}
function Pt() {
Object[at] = Object[at] || {};
var i = Object[at];
return i[st] = i[st] || [], i[st];
}
function xe() {
var i = Pt();
return i[i.length - 1];
}
function Me(i) {
var r = Pt(), e = [], t = {
host: i,
observers: e,
push: function(n) {
i !== n && e.indexOf(n) === -1 && e.push(n);
}
};
return r.push(t), t;
}
function Oe() {
var i = Pt();
return i.pop();
}
var Qt = /* @__PURE__ */ (function() {
function i(e) {
this._emitter = new tt(), this._current = e;
}
var r = i.prototype;
return Object.defineProperty(r, "current", {
/**
* return the current value.
*/
get: function() {
var e = xe();
return e?.push(this), this._current;
},
set: function(e) {
this._setCurrent(e);
},
enumerable: !1,
configurable: !0
}), r.subscribe = function(e) {
return this.current, this._emitter.on("update", e), this;
}, r.unsubscribe = function(e) {
return this._emitter.off("update", e), this;
}, r._setCurrent = function(e) {
var t = this._current, n = e !== t;
this._current = e, n && this._emitter.trigger("update", e, t);
}, r.toString = function() {
return "".concat(this.current);
}, r.valueOf = function() {
return this.current;
}, i;
})(), we = /* @__PURE__ */ (function(i) {
ye(r, i);
function r(t) {
var n = i.call(this) || this;
return n._computedCallback = t, n._registered = [], n._onCheckUpdate = function() {
n._setCurrent(n.current);
}, n._current = n.current, n;
}
var e = r.prototype;
return Object.defineProperty(e, "current", {
get: function() {
var t = this;
Me(this);
var n = this._computedCallback(), s = Oe();
return this._registered.forEach(function(a) {
a.unsubscribe(t._onCheckUpdate);
}), s.observers.forEach(function(a) {
a.subscribe(t._onCheckUpdate);
}), this._registered = s.observers, n;
},
enumerable: !1,
configurable: !0
}), r;
})(Qt);
function zt(i, r, e) {
e === void 0 && (e = r);
var t = {
configurable: !0,
get: function() {
return D(this, e).current;
},
set: function(n) {
D(this, e, n).current = n;
}
};
Object.defineProperty(i, r, t), e !== r && Object.defineProperty(i, e, {
configurable: !0,
get: function() {
return D(this, e).current;
}
});
}
function Zt() {
for (var i = [], r = 0; r < arguments.length; r++)
i[r] = arguments[r];
return i.length > 1 ? zt(i[0], i[1]) : function(e, t) {
return zt(e, t, i[0]);
};
}
function ot() {
for (var i = [], r = 0; r < arguments.length; r++)
i[r] = arguments[r];
return Zt.apply(void 0, i);
}
function Pe(i) {
i.subscribe = function(r, e) {
this[r], D(this, r).subscribe(e);
}, i.unsubscribe = function(r, e) {
var t = this;
if (!r) {
Gt(et(this)).forEach(function(n) {
t.unsubscribe(n);
});
return;
}
r in this && D(this, r).unsubscribe(e);
};
}
function Jt(i) {
var r = i.prototype;
Pe(r);
}
function Se(i) {
return new Qt(i);
}
function Te(i) {
return new we(i);
}
function Ie(i, r) {
var e = {};
return r && r.forEach(function(t) {
e[t] = function() {
for (var n = [], s = 0; s < arguments.length; s++)
n[s] = arguments[s];
var a = i.current || i.value;
return a[t].apply(a, n);
};
}), e;
}
function De(i) {
var r = {};
return Object.defineProperty(i, gt, {
get: function() {
return r;
}
}), r;
}
function et(i, r) {
var e, t;
i[gt] || De(i);
var n = i[gt];
if (!r) {
var s = (t = (e = i?.constructor) === null || e === void 0 ? void 0 : e.prototype) === null || t === void 0 ? void 0 : t[G];
s && s.forEach(function(a) {
!(a in n) && a in i && i[a];
});
}
return n;
}
function D(i, r, e) {
var t = et(i);
return t[r] || (t[r] = Se(e)), t[r];
}
function Ae(i, r) {
var e = be(i) ? {
setup: i
} : i;
function t() {
var d, p, x, S, I;
return (I = (x = (d = void 0) !== null && d !== void 0 ? d : (p = e.props) === null || p === void 0 ? void 0 : p.call(e)) !== null && x !== void 0 ? x : (S = e.data) === null || S === void 0 ? void 0 : S.call(e)) !== null && I !== void 0 ? I : {};
}
var n = new tt(), s = [], a = [], o = [], u = [], c = {
current: null
}, f = [], l = null, h = [], v = [], _ = function(d) {
s.push(d);
}, m = function(d) {
a.push(d);
}, b = function(d) {
o.push(d);
}, E = function(d) {
u.push(d);
}, g = function(d) {
for (var p = [], x = 1; x < arguments.length; x++)
p[x - 1] = arguments[x];
n.trigger.apply(n, Rt([d], p, !1));
}, y = function(d) {
l = d;
}, O = function(d) {
h = d;
}, w = function(d) {
v = d;
};
return e.setup && (c.current = e.setup({
getProps: t,
setInitialState: y,
setEvents: O,
setMethods: w,
onMounted: _,
onDestroy: b,
onInit: m,
emit: g,
on: E
}) || null), e.created && (c.current = e.created(t()) || null), e.events && O(e.events), e.state && y(e.state), e.methods && w(e.methods), e.mounted && _(e.mounted), e.destroy && o.push(e.destroy), e.init && a.push(e.init), e.on && u.push(function(d, p, x) {
var S = e.on(d, p, x);
return function() {
var I;
S && S(), (I = e.off) === null || I === void 0 || I.call(e, d, p, x);
};
}), {
events: function() {
return h;
},
state: function() {
var d = c.current;
if (l)
return l;
if (d) {
var p = et(d);
y(Gt(p).reduce(function(x, S) {
return x[S] = p[S].current, x;
}, {}));
}
return l || {};
},
instance: function() {
return c.current;
},
mounted: function() {
var d = t();
s.forEach(function(p) {
c.current = p(d, c.current) || c.current;
});
},
init: function() {
var d = c.current, p = t();
f = h.map(function(x) {
var S = function() {
for (var X, At = [], U = 0; U < arguments.length; U++)
At[U] = arguments[U];
(X = n).trigger.apply(X, Rt([x], At, !1));
}, I = c.current;
return u.map(function(X) {
return X(I, x, S);
}).filter(Boolean);
}), a.forEach(function(x) {
x(d, p);
});
},
destroy: function() {
f.forEach(function(x) {
x.forEach(function(S) {
S();
});
}), n.off();
var d = c.current, p = t();
o.forEach(function(x) {
x(d, p);
});
},
methods: function() {
return Ie(c, v);
},
on: function(d, p) {
n.on(d, p);
},
off: function(d, p) {
n.off(d, p);
}
};
}
function Ce(i, r, e) {
var t = e.get;
function n() {
var o = et(this, !0);
return r in o || (o[r] = Te(t.bind(this))), D(this, r).current;
}
var s = {
configurable: !0,
get: n
};
i[G] || (i[G] = []);
var a = i[G];
return a.indexOf(r) === -1 && a.push(r), Object.defineProperty(i, r, s), s;
}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var mt = function(i, r) {
return mt = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(e, t) {
e.__proto__ = t;
} || function(e, t) {
for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
}, mt(i, r);
};
function V(i, r) {
mt(i, r);
function e() {
this.constructor = i;
}
i.prototype = r === null ? Object.create(r) : (e.prototype = r.prototype, new e());
}
var M = function() {
return M = Object.assign || function(r) {
for (var e, t = 1, n = arguments.length; t < n; t++) {
e = arguments[t];
for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (r[s] = e[s]);
}
return r;
}, M.apply(this, arguments);
};
function Et(i, r, e, t) {
var n = arguments.length, s = n < 3 ? r : t === null ? t = Object.getOwnPropertyDescriptor(r, e) : t, a;
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(i, r, e, t);
else for (var o = i.length - 1; o >= 0; o--) (a = i[o]) && (s = (n < 3 ? a(s) : n > 3 ? a(r, e, s) : a(r, e)) || s);
return n > 3 && s && Object.defineProperty(r, e, s), s;
}
var P;
typeof window > "u" ? P = {
navigator: {
userAgent: ""
}
} : P = window;
var H = 1, Re = 2, ze = 4, A = 6, je = 8, Le = 16, C = 24, nt = 30, J = "left", bt = "right", yt = "middle", te = {
1: J,
2: yt,
3: bt
}, St = "any", Ve = "none", We = "shift", Be = "ctrl", Ne = "alt", Ye = "meta", Fe = 16, ke = 30, jt = "ontouchstart" in P && ge().browser.name === "safari", He = (function() {
if (typeof document > "u")
return "";
for (var i = (document.head || document.getElementsByTagName("head")[0]).style, r = ["transform", "webkitTransform", "msTransform", "mozTransform"], e = 0, t = r.length; e < t; e++)
if (r[e] in i)
return r[e];
return "";
})(), xt = {
"-webkit-user-select": "none",
"-ms-user-select": "none",
"-moz-user-select": "none",
"user-select": "none",
"-webkit-user-drag": "none"
}, Lt = function(i) {
for (var r = [], e = 0, t = i.length; e < t; e++)
r.push(i[e]);
return r;
}, Tt = function(i, r) {
r === void 0 && (r = !1);
var e;
if (typeof i == "string") {
var t = i.match(/^<([a-z]+)\s*([^>]*)>/);
if (t) {
var n = document.createElement("div");
n.innerHTML = i, e = Lt(n.childNodes);
} else
e = Lt(document.querySelectorAll(i));
r || (e = e.length >= 1 ? e[0] : void 0);
} else i === P ? e = i : "value" in i || "current" in i ? e = i.value || i.current : i.nodeName && (i.nodeType === 1 || i.nodeType === 9) ? e = i : "jQuery" in P && i instanceof jQuery || i.constructor.prototype.jquery ? e = r ? i.toArray() : i.get(0) : Array.isArray(i) && (e = i.map(function(s) {
return Tt(s);
}), r || (e = e.length >= 1 ? e[0] : void 0));
return e;
}, z = P.requestAnimationFrame || P.webkitRequestAnimationFrame, N = P.cancelAnimationFrame || P.webkitCancelAnimationFrame;
if (z && !N) {
var ut = {}, Xe = z;
z = function(i) {
var r = function(t) {
ut[e] && i(t);
}, e = Xe(r);
return ut[e] = !0, e;
}, N = function(i) {
delete ut[i];
};
} else z && N || (z = function(i) {
return P.setTimeout(function() {
i(P.performance && P.performance.now && P.performance.now() || (/* @__PURE__ */ new Date()).getTime());
}, 16);
}, N = P.clearTimeout);
var Ue = function(i) {
return z(i);
}, Ke = function(i) {
N(i);
}, T = function(i, r) {
var e = {};
for (var t in i)
t && (e[t] = r(i[t], t));
return e;
}, ee = function(i, r) {
var e = {};
for (var t in i)
t && r(i[t], t) && (e[t] = i[t]);
return e;
}, It = function(i, r) {
for (var e in i)
if (e && !r(i[e], e))
return !1;
return !0;
}, Y = function(i, r) {
return It(i, function(e, t) {
return e === r[t];
});
}, ct = {}, ne = function(i, r) {
return ct[r] || (ct[r] = $e(r)), ct[r](i);
}, Vt = function(i, r) {
return !i || !r ? i : T(i, function(e, t) {
return ne(e, typeof r == "number" ? r : r[t]);
});
}, Q = function(i) {
if (!isFinite(i))
return 0;
var r = "".concat(i);
if (r.indexOf("e") >= 0) {
for (var e = 0, t = 1; Math.round(i * t) / t !== i; )
t *= 10, e++;
return e;
}
return r.indexOf(".") >= 0 ? r.length - r.indexOf(".") - 1 : 0;
}, qe = function(i) {
return 1 / Math.pow(10, i);
}, $e = function(i) {
var r = i < 1 ? Math.pow(10, Q(i)) : 1;
return function(e) {
return i === 0 ? 0 : Math.round(Math.round(e / i) * i * r) / r;
};
}, Ge = function(i, r) {
return Math.atan2(r, i) * 180 / Math.PI;
}, Qe = function(i) {
var r = !0;
return Object.keys(xt).forEach(function(e) {
(!i || i[e] !== xt[e]) && (r = !1);
}), r;
}, re = function(i, r) {
return i && r ? nt : i ? A : r ? C : H;
}, j = function(i, r, e) {
return e ? !!(r === nt || r & i && e & i) : !!(r & i);
}, Ze = function(i, r, e) {
var t, n = (t = {}, t[H] = "auto", t[nt] = "none", t[C] = "pan-x", t[A] = "pan-y", t), s = {};
if (i && i.style) {
var a = r.touchAction ? r.touchAction : n[e], o = M(M({}, xt), {
"touch-action": i.style["touch-action"] === "none" ? "none" : a
});
Object.keys(o).forEach(function(u) {
s[u] = i.style[u];
}), Object.keys(o).forEach(function(u) {
i.style[u] = o[u];
});
}
return s;
}, Je = function(i, r) {
i && i.style && r && Object.keys(r).forEach(function(e) {
i.style[e] = r[e];
});
}, tn = /* @__PURE__ */ (function() {
function i(e) {
this._axes = e, this.holdingCount = 0;
}
var r = i.prototype;
return r.hold = function(e, t) {
var n = this._getRoundPos(e).roundPos;
this._axes.trigger(new R("hold", {
pos: n,
input: t.input || null,
inputEvent: t.event || null,
isTrusted: !0
}));
}, r.triggerRelease = function(e) {
var t = this._getRoundPos(e.destPos, e.depaPos), n = t.roundPos, s = t.roundDepa;
e.destPos = n, e.depaPos = s, e.setTo = this._createUserControll(e.destPos, e.duration), this._axes.trigger(new R("release", M(M({}, e), {
bounceRatio: this._getBounceRatio(n)
})));
}, r.triggerChange = function(e, t, n, s) {
var a = this;
s === void 0 && (s = !1);
var o = this.animationManager, u = o.axisManager, c = o.getEventInfo(), f = this._getRoundPos(e, t), l = f.roundPos, h = f.roundDepa, v = u.moveTo(l, h), _ = n?.event || c?.event || null, m = {
pos: v.pos,
delta: v.delta,
bounceRatio: this._getBounceRatio(v.pos),
holding: s,
inputEvent: _,
isTrusted: !!_,
input: n?.input || c?.input || null,
set: _ ? this._createUserControll(v.pos) : function() {
}
// eslint-disable-line @typescript-eslint/no-empty-function
}, b = new R("change", m);
return this._axes.trigger(b), Object.keys(v.pos).forEach(function(E) {
var g = v.pos[E];
D(a._axes, E, g).current = g;
}), _ && u.set(m.set().destPos), !b.isCanceled();
}, r.triggerAnimationStart = function(e) {
var t = this._getRoundPos(e.destPos, e.depaPos), n = t.roundPos, s = t.roundDepa;
e.destPos = n, e.depaPos = s, e.setTo = this._createUserControll(e.destPos, e.duration);
var a = new R("animationStart", e);
return this._axes.trigger(a), !a.isCanceled();
}, r.triggerAnimationEnd = function(e) {
e === void 0 && (e = !1), this._axes.trigger(new R("animationEnd", {
isTrusted: e
}));
}, r.triggerFinish = function(e) {
e === void 0 && (e = !1), this._axes.trigger(new R("finish", {
isTrusted: e
}));
}, r.setAnimationManager = function(e) {
this.animationManager = e;
}, r.destroy = function() {
this._axes.off();
}, r._createUserControll = function(e, t) {
t === void 0 && (t = 0);
var n = {
destPos: M({}, e),
duration: t
};
return function(s, a) {
return s && (n.destPos = M({}, s)), a !== void 0 && (n.duration = a), n;
};
}, r._getRoundPos = function(e, t) {
var n = this._axes.options.round;
return {
roundPos: Vt(e, n),
roundDepa: Vt(t, n)
};
}, r._getBounceRatio = function(e) {
return this._axes.axisManager.map(e, function(t, n) {
return t < n.range[0] && n.bounce[0] !== 0 ? (n.range[0] - t) / n.bounce[0] : t > n.range[1] && n.bounce[1] !== 0 ? (t - n.range[1]) / n.bounce[1] : 0;
});
}, Et([Zt], i.prototype, "holdingCount", void 0), i;
})(), en = /* @__PURE__ */ (function() {
function i(e) {
this._options = e, this._prevented = !1;
}
var r = i.prototype;
return r.isInterrupting = function() {
return this._options.interruptable || this._prevented;
}, r.isInterrupted = function() {
return !this._options.interruptable && this._prevented;
}, r.setInterrupt = function(e) {
this._options.interruptable || (this._prevented = e);
}, i;
})(), ie = function(i, r, e, t) {
var n = i, s = [e[0] ? r[0] : t ? r[0] - t[0] : r[0], e[1] ? r[1] : t ? r[1] + t[1] : r[1]];
return n = Math.max(s[0], n), n = Math.min(s[1], n), n;
}, se = function(i, r) {
return i < r[0] || i > r[1];
}, nn = function(i, r, e, t) {
return !t[0] && i === r[0] - e[0] || !t[1] && i === r[1] + e[1];
}, rn = function(i, r) {
var e = Math.sqrt(i / r * 2);
return e < 100 ? 0 : e;
}, Wt = function(i, r, e) {
return e[1] && i > r[1] || e[0] && i < r[0];
}, k = function(i, r, e) {
var t = i, n = r[0], s = r[1], a = s - n;
return e[1] && i > s && (t = (t - s) % a + n), e[0] && i < n && (t = (t - n) % a + s), t;
}, sn = /* @__PURE__ */ (function() {
function i(e) {
var t = this;
this._axis = e, this._complementOptions(), this._pos = Object.keys(this._axis).reduce(function(n, s) {
return n[s] = t._axis[s].startPos, n;
}, {});
}
var r = i.prototype;
return r.getDelta = function(e, t) {
var n = this.get(e);
return T(this.get(t), function(s, a) {
return s - n[a];
});
}, r.get = function(e) {
var t = this;
return e && Array.isArray(e) ? e.reduce(function(n, s) {
return s && s in t._pos && (n[s] = t._pos[s]), n;
}, {}) : M(M({}, this._pos), e || {});
}, r.moveTo = function(e, t) {
t === void 0 && (t = this._pos);
var n = T(this._pos, function(s, a) {
return a in e && a in t ? e[a] - t[a] : 0;
});
return this.set(this.map(e, function(s, a) {
return a ? k(s, a.range, a.circular) : 0;
})), {
pos: M({}, this._pos),
delta: n
};
}, r.set = function(e) {
for (var t in e)
t && t in this._pos && (this._pos[t] = e[t]);
}, r.every = function(e, t) {
var n = this._axis;
return It(e, function(s, a) {
return t(s, n[a], a);
});
}, r.filter = function(e, t) {
var n = this._axis;
return ee(e, function(s, a) {
return t(s, n[a], a);
});
}, r.map = function(e, t) {
var n = this._axis;
return T(e, function(s, a) {
return t(s, n[a], a);
});
}, r.isOutside = function(e) {
return !this.every(e ? this.get(e) : this._pos, function(t, n) {
return !se(t, n.range);
});
}, r.getAxisOptions = function(e) {
return this._axis[e];
}, r.setAxis = function(e) {
var t = this;
Object.keys(e).forEach(function(n) {
if (!t._axis[n])
throw new Error("Axis ".concat(n, " does not exist in Axes instance"));
t._axis[n] = M(M({}, t._axis[n]), e[n]);
}), this._complementOptions();
}, r._complementOptions = function() {
var e = this;
Object.keys(this._axis).forEach(function(t) {
e._axis[t] = M({
range: [0, 100],
startPos: e._axis[t].range[0],
bounce: [0, 0],
circular: [!1, !1]
}, e._axis[t]), ["bounce", "circular"].forEach(function(n) {
var s = e._axis, a = s[t][n];
/string|number|boolean/.test(typeof a) && (s[t][n] = [a, a]);
});
});
}, i;
})(), an = "ontouchstart" in P, Z = "PointerEvent" in P, on = "MSPointerEvent" in P, un = Z || on, ae = function(i, r) {
return !!(!r || r.indexOf(St) > -1 || r.indexOf(Ve) > -1 && !i.shiftKey && !i.ctrlKey && !i.altKey && !i.metaKey || r.indexOf(We) > -1 && i.shiftKey || r.indexOf(Be) > -1 && i.ctrlKey || r.indexOf(Ne) > -1 && i.altKey || r.indexOf(Ye) > -1 && i.metaKey);
}, rt = /* @__PURE__ */ (function() {
function i() {
var e = this;
this._stopContextMenu = function(t) {
t.preventDefault(), P.removeEventListener("contextmenu", e._stopContextMenu);
};
}
var r = i.prototype;
return r.extendEvent = function(e) {
var t, n = this.prevEvent, s = this._getCenter(e), a = n ? this._getMovement(e) : {
x: 0,
y: 0
}, o = n ? this._getScale(e) : 1, u = n ? Ge(s.x - n.center.x, s.y - n.center.y) : 0, c = n ? n.deltaX + a.x : a.x, f = n ? n.deltaY + a.y : a.y, l = a.x, h = a.y, v = this._latestInterval, _ = Date.now(), m = v ? _ - v.timestamp : 0, b = n ? n.velocityX : 0, E = n ? n.velocityY : 0, g = n ? n.directionX : 1, y = n ? n.directionY : 1;
return l > 0 ? g = 1 : l < 0 && (g = -1), h > 0 ? y = 1 : h < 0 && (y = -1), (!v || m >= Fe) && (v && (t = [(c - v.deltaX) / m, (f - v.deltaY) / m], b = t[0], E = t[1]), this._latestInterval = {
timestamp: _,
deltaX: c,
deltaY: f
}), {
srcEvent: e,
scale: o,
angle: u,
center: s,
deltaX: c,
deltaY: f,
offsetX: l,
offsetY: h,
directionX: g,
directionY: y,
velocityX: b,
velocityY: E,
preventSystemEvent: !0
};
}, r._getDistance = function(e, t) {
var n = t.clientX - e.clientX, s = t.clientY - e.clientY;
return Math.sqrt(n * n + s * s);
}, r._getButton = function(e) {
var t = {
1: J,
2: bt,
4: yt
}, n = this._isTouchEvent(e) ? J : t[e.buttons];
return n || null;
}, r._isTouchEvent = function(e) {
return e.type && e.type.indexOf("touch") > -1;
}, r._isValidButton = function(e, t) {
return t.indexOf(e) > -1;
}, r._isValidEvent = function(e, t, n) {
return (!t || ae(e, t)) && (!n || this._isValidButton(this._getButton(e), n));
}, r._preventMouseButton = function(e, t) {
t === bt ? P.addEventListener("contextmenu", this._stopContextMenu) : t === yt && e.preventDefault();
}, i;
})(), cn = /* @__PURE__ */ (function(i) {
V(r, i);
function r() {
var t = i !== null && i.apply(this, arguments) || this;
return t.start = ["mousedown"], t.move = ["mousemove"], t.end = ["mouseup"], t;
}
var e = r.prototype;
return e.onEventStart = function(t, n, s) {
var a = this._getButton(t);
return this._isValidEvent(t, n, s) ? (this._preventMouseButton(t, a), this.extendEvent(t)) : null;
}, e.onEventMove = function(t, n, s) {
return this._isValidEvent(t, n, s) ? this.extendEvent(t) : null;
}, e.onEventEnd = function() {
}, e.onRelease = function() {
this.prevEvent = null;
}, e.getTouches = function(t, n) {
return n && this._isValidButton(te[t.which], n) && this.end.indexOf(t.type) === -1 ? 1 : 0;
}, e._getScale = function() {
return 1;
}, e._getCenter = function(t) {
return {
x: t.clientX,
y: t.clientY
};
}, e._getMovement = function(t) {
var n = this.prevEvent.srcEvent;
return {
x: t.clientX - n.clientX,
y: t.clientY - n.clientY
};
}, r;
})(rt), fn = /* @__PURE__ */ (function(i) {
V(r, i);
function r() {
var t = i !== null && i.apply(this, arguments) || this;
return t.start = ["touchstart"], t.move = ["touchmove"], t.end = ["touchend", "touchcancel"], t;
}
var e = r.prototype;
return e.onEventStart = function(t, n) {
return this._baseTouches = t.touches, this._isValidEvent(t, n) ? this.extendEvent(t) : null;
}, e.onEventMove = function(t, n) {
return this._isValidEvent(t, n) ? this.extendEvent(t) : null;
}, e.onEventEnd = function(t) {
this._baseTouches = t.touches;
}, e.onRelease = function() {
this.prevEvent = null, this._baseTouches = null;
}, e.getTouches = function(t) {
return t.touches.length;
}, e._getScale = function(t) {
return t.touches.length !== 2 || this._baseTouches.length < 2 ? null : this._getDistance(t.touches[0], t.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]);
}, e._getCenter = function(t) {
return {
x: t.touches[0].clientX,
y: t.touches[0].clientY
};
}, e._getMovement = function(t) {
var n = this.prevEvent.srcEvent;
return t.touches[0].identifier !== n.touches[0].identifier ? {
x: 0,
y: 0
} : {
x: t.touches[0].clientX - n.touches[0].clientX,
y: t.touches[0].clientY - n.touches[0].clientY
};
}, r;
})(rt), ln = /* @__PURE__ */ (function(i) {
V(r, i);
function r() {
var t = i !== null && i.apply(this, arguments) || this;
return t.start = Z ? ["pointerdown"] : ["MSPointerDown"], t.move = Z ? ["pointermove"] : ["MSPointerMove"], t.end = Z ? ["pointerup", "pointercancel"] : ["MSPointerUp", "MSPointerCancel"], t._firstInputs = [], t._recentInputs = [], t;
}
var e = r.prototype;
return e.onEventStart = function(t, n, s) {
var a = this._getButton(t);
return this._isValidEvent(t, n, s) ? (this._preventMouseButton(t, a), this._updatePointerEvent(t), this.extendEvent(t)) : null;
}, e.onEventMove = function(t, n, s) {
return this._isValidEvent(t, n, s) ? (this._updatePointerEvent(t), this.extendEvent(t)) : null;
}, e.onEventEnd = function(t) {
this._removePointerEvent(t);
}, e.onRelease = function() {
this.prevEvent = null, this._firstInputs = [], this._recentInputs = [];
}, e.getTouches = function() {
return this._recentInputs.length;
}, e._getScale = function() {
return this._recentInputs.length !== 2 ? null : this._getDistance(this._recentInputs[0], this._recentInputs[1]) / this._getDistance(this._firstInputs[0], this._firstInputs[1]);
}, e._getCenter = function(t) {
return {
x: t.clientX,
y: t.clientY
};
}, e._getMovement = function(t) {
var n = this.prevEvent.srcEvent;
return t.pointerId !== n.pointerId ? {
x: 0,
y: 0
} : {
x: t.clientX - n.clientX,
y: t.clientY - n.clientY
};
}, e._updatePointerEvent = function(t) {
var n = this, s = !1;
this._recentInputs.forEach(function(a, o) {
a.pointerId === t.pointerId && (s = !0, n._recentInputs[o] = t);
}), s || (this._firstInputs.push(t), this._recentInputs.push(t));
}, e._removePointerEvent = function(t) {
this._firstInputs = this._firstInputs.filter(function(n) {
return n.pointerId !== t.pointerId;
}), this._recentInputs = this._recentInputs.filter(function(n) {
return n.pointerId !== t.pointerId;
});
}, r;
})(rt), hn = /* @__PURE__ */ (function(i) {
V(r, i);
function r() {
var t = i !== null && i.apply(this, arguments) || this;
return t.start = ["mousedown", "touchstart"], t.move = ["mousemove", "touchmove"], t.end = ["mouseup", "touchend", "touchcancel"], t;
}
var e = r.prototype;
return e.onEventStart = function(t, n, s) {
var a = this._getButton(t);
return this._isTouchEvent(t) && (this._baseTouches = t.touches), this._isValidEvent(t, n, s) ? (this._preventMouseButton(t, a), this.extendEvent(t)) : null;
}, e.onEventMove = function(t, n, s) {
return this._isValidEvent(t, n, s) ? this.extendEvent(t) : null;
}, e.onEventEnd = function(t) {
this._isTouchEvent(t) && (this._baseTouches = t.touches);
}, e.onRelease = function() {
this.prevEvent = null, this._baseTouches = null;
}, e.getTouches = function(t, n) {
return this._isTouchEvent(t) ? t.touches.length : this._isValidButton(te[t.which], n) && this.end.indexOf(t.type) === -1 ? 1 : 0;
}, e._getScale = function(t) {
return this._isTouchEvent(t) ? t.touches.length !== 2 || this._baseTouches.length < 2 ? 1 : this._getDistance(t.touches[0], t.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]) : this.prevEvent.scale;
}, e._getCenter = function(t) {
return this._isTouchEvent(t) ? {
x: t.touches[0].clientX,
y: t.touches[0].clientY
} : {
x: t.clientX,
y: t.clientY
};
}, e._getMovement = function(t) {
var n = this, s = this.prevEvent.srcEvent, a = [t, s].map(function(c) {
return n._isTouchEvent(c) ? {
id: c.touches[0].identifier,
x: c.touches[0].clientX,
y: c.touches[0].clientY
} : {
id: null,
x: c.clientX,
y: c.clientY
};
}), o = a[0], u = a[1];
return o.id === u.id ? {
x: o.x - u.x,
y: o.y - u.y
} : {
x: 0,
y: 0
};
}, r;
})(rt), Dt = function(i, r) {
return r.reduce(function(e, t, n) {
return i[n] && (e[i[n]] = t), e;
}, {});
}, Bt = function(i) {
i === void 0 && (i = []);
var r = !1, e = !1, t = !1;
return i.forEach(function(n) {
switch (n) {
case "mouse":
e = !0;
break;
case "touch":
r = an;
break;
case "pointer":
t = un;
}
}), t ? new ln() : r && e ? new hn() : r ? new fn() : e ? new cn() : null;
};
function Nt(i) {
return i.indexOf("touch") > -1 ? {
passive: !1
} : !1;
}
var vn = /* @__PURE__ */ (function() {
function i(e) {
var t = e.options, n = e.interruptManager, s = e.eventManager, a = e.axisManager, o = e.animationManager;
this._isOutside = !1, this._moveDistance = null, this._isStopped = !1, this.options = t, this._interruptManager = n, this._eventManager = s, this._axisManager = a, this._animationManager = o;
}
var r = i.prototype;
return r.get = function(e) {
return this._axisManager.get(e.axes);
}, r.hold = function(e, t) {
if (!(this._interruptManager.isInterrupted() || !e.axes.length)) {
var n = {
input: e,
event: t
};
this._isStopped = !1, this._interruptManager.setInterrupt(!0), this._animationManager.stopAnimation(n), ++this._eventManager.holdingCount, this._moveDistance || this._eventManager.hold(this._axisManager.get(), n), this._isOutside = this._axisManager.isOutside(e.axes), this._moveDistance = this._axisManager.get(e.axes);
}
}, r.change = function(e, t, n, s) {
if (!(this._isStopped || !this._interruptManager.isInterrupting() || this._axisManager.every(n, function(h) {
return h === 0;
}))) {
var a = t.srcEvent ? t.srcEvent : t;
if (!a.__childrenAxesAlreadyChanged) {
var o = this._moveDistance || this._axisManager.get(e.axes), u;
u = T(o, function(h, v) {
return h + (n[v] || 0);
}), this._moveDistance && (this._moveDistance = this._axisManager.map(u, function(h, v) {
var _ = v.circular, m = v.range;
return _ && (_[0] || _[1]) ? k(h, m, _) : h;
})), this._isOutside && this._axisManager.every(o, function(h, v) {
return !se(h, v.range);
}) && (this._isOutside = !1), o = this._atOutside(o), u = this._atOutside(u), (!this.options.nested || !this._isEndofAxis(n, o, u)) && (a.__childrenAxesAlreadyChanged = !0);
var c = {
input: e,
event: t
};
if (s) {
var f = this._animationManager.getDuration(u, o);
this._animationManager.animateTo(u, f, c);
} else {
var l = !this._eventManager.triggerChange(u, o, c, !0);
l && (this._isStopped = !0, this._moveDistance = null, this._animationManager.finish(!1));
}
}
}
}, r.release = function(e, t, n, s) {
if (!(this._isStopped || !this._interruptManager.isInterrupting() || !this._moveDistance)) {
var a = t.srcEvent ? t.srcEvent : t;
a.__childrenAxesAlreadyReleased && (n = n.map(function() {
return 0;
}));
var o = this._axisManager.get(e.axes), u = this._axisManager.get(), c = this._animationManager.getDisplacement(n), f = Dt(e.axes, c), l = this._axisManager.get(this._axisManager.map(f, function(E, g, y) {
return g.circular && (g.circular[0] || g.circular[1]) ? o[y] + E : ie(o[y] + E, g.range, g.circular, g.bounce);
}));
a.__childrenAxesAlreadyReleased = !0;
var h = this._animationManager.getDuration(l, o, s);
h === 0 && (l = M({}, u));
var v = {
depaPos: u,
destPos: l,
duration: h,
delta: this._axisManager.getDelta(u, l),
inputEvent: t,
input: e,
isTrusted: !0
};
--this._eventManager.holdingCount, this._eventManager.triggerRelease(v), this._eventManager.holdingCount === 0 && (this._moveDistance = null);
var _ = this._animationManager.getUserControl(v), m = Y(_.destPos, u), b = {
input: e,
event: t
};
m || _.duration === 0 ? (m || this._eventManager.triggerChange(_.destPos, u, b, !0), this._interruptManager.setInterrupt(!1), this._axisManager.isOutside() ? this._animationManager.restore(b) : this._eventManager.triggerFinish(!0)) : this._animationManager.animateTo(_.destPos, _.duration, b);
}
}, r._atOutside = function(e) {
var t = this;
return this._isOutside ? this._axisManager.map(e, function(n, s) {
var a = s.range[0] - s.bounce[0], o = s.range[1] + s.bounce[1];
return n > o ? o : n < a ? a : n;
}) : this._axisManager.map(e, function(n, s) {
var a = s.range[0], o = s.range[1], u = s.bounce, c = s.circular;
return c[0] && n < a || c[1] && n > o ? n : n < a ? a - t._animationManager.interpolate(a - n, u[0]) : n > o ? o + t._animationManager.interpolate(n - o, u[1]) : n;
});
}, r._isEndofAxis = function(e, t, n) {
return this._axisManager.every(t, function(s, a, o) {
return e[o] === 0 || t[o] === n[o] && nn(s, a.range, a.bounce, a.circular);
});
}, i;
})(), ft = function(i, r, e) {
return Math.max(Math.min(i, e), r);
}, dn = /* @__PURE__ */ (function() {
function i(e) {
var t = e.options, n = e.interruptManager, s = e.eventManager, a = e.axisManager;
this._options = t, this.interruptManager = n, this.eventManager = s, this.axisManager = a, this.animationEnd = this.animationEnd.bind(this);
}
var r = i.prototype;
return r.getDuration = function(e, t, n) {
var s = this, a;
if (typeof n < "u")
a = n;
else {
var o = T(t, function(u, c) {
return rn(Math.abs(u - e[c]), s._options.deceleration);
});
a = Object.keys(o).reduce(function(u, c) {
return Math.max(u, o[c]);
}, -1 / 0);
}
return ft(a, this._options.minimumDuration, this._options.maximumDuration);
}, r.getDisplacement = function(e) {
var t = Math.pow(e.reduce(function(s, a) {
return s + a * a;
}, 0), 1 / e.length), n = Math.abs(t / -this._options.deceleration);
return e.map(function(s) {
return s / 2 * n;
});
}, r.stopAnimation = function(e) {
if (this._animateParam) {
var t = this.axisManager.get(), n = this.axisManager.map(t, function(s, a) {
return k(s, a.range, a.circular);
});
It(n, function(s, a) {
return t[a] === s;
}) || this.eventManager.triggerChange(n, t, e, !!e), this._animateParam = null, this._raf && Ke(this._raf), this._raf = null, this.eventManager.triggerAnimationEnd(!!e?.event);
}
}, r.getEventInfo = function() {
return this._animateParam && this._animateParam.input && this._animateParam.inputEvent ? {
input: this._animateParam.input,
event: this._animateParam.inputEvent
} : null;
}, r.restore = function(e) {
var t = this.axisManager.get(), n = this.axisManager.map(t, function(s, a) {
return Math.min(a.range[1], Math.max(a.range[0], s));
});
this.stopAnimation(), this.animateTo(n, this.getDuration(t, n), e);
}, r.animationEnd = function() {
var e = this.getEventInfo();
this._animateParam = null;
var t = this.axisManager.filter(this.axisManager.get(), function(n, s) {
return Wt(n, s.range, s.circular);
});
Object.keys(t).length > 0 && this.setTo(this.axisManager.map(t, function(n, s) {
return k(n, s.range, s.circular);
})), this.interruptManager.setInterrupt(!1), this.eventManager.triggerAnimationEnd(!!e), this.axisManager.isOutside() ? this.restore(e) : this.finish(!!e);
}, r.finish = function(e) {
this._animateParam = null, this.interruptManager.setInterrupt(!1), this.eventManager.triggerFinish(e);
}, r.getUserControl = function(e) {
var t = e.setTo();
return t.destPos = this.axisManager.get(t.destPos), t.duration = ft(t.duration, this._options.minimumDuration, this._options.maximumDuration), t;
}, r.animateTo = function(e, t, n) {
var s = this;
this.stopAnimation();
var a = this._createAnimationParam(e, t, n), o = M({}, a.depaPos), u = this.eventManager.triggerAnimationStart(a), c = this.getUserControl(a);
if (!u && this.axisManager.every(c.destPos, function(l, h) {
return Wt(l, h.range, h.circular);
}) && console.warn("You can't stop the 'animation' event when 'circular' is true."), u && !Y(c.destPos, o)) {
var f = n?.event || null;
this._animateLoop({
depaPos: o,
destPos: c.destPos,
duration: c.duration,
delta: this.axisManager.getDelta(o, c.destPos),
isTrusted: !!f,
inputEvent: f,
input: n?.input || null
}, function() {
return s.animationEnd();
});
}
}, r.setTo = function(e, t) {
t === void 0 && (t = 0);
var n = Object.keys(e), s = this.axisManager.get(n);
if (Y(e, s))
return this;
this.interruptManager.setInterrupt(!0);
var a = ee(e, function(o, u) {
return s[u] !== o;
});
return Object.keys(a).length ? (a = this.axisManager.map(a, function(o, u) {
var c = u.range, f = u.circular;
return f && (f[0] || f[1]) ? o : ie(o, c, f);
}), Y(a, s) ? this : (t > 0 ? this.animateTo(a, t) : (this.stopAnimation(), this.eventManager.triggerChange(a), this.finish(!1)), this)) : this;
}, r.setBy = function(e, t) {
return t === void 0 && (t = 0), this.setTo(T(this.axisManager.get(Object.keys(e)), function(n, s) {
return n + e[s];
}), t);
}, r.setOptions = function(e) {
this._options = M(M({}, this._options), e);
}, r._createAnimationParam = function(e, t, n) {
var s = this.axisManager.get(), a = e, o = n?.event || null;
return {
depaPos: s,
destPos: a,
duration: ft(t, this._options.minimumDuration, this._options.maximumDuration),
delta: this.axisManager.getDelta(s, a),
inputEvent: o,
input: n?.input || null,
isTrusted: !!o,
done: this.animationEnd
};
}, r._animateLoop = function(e, t) {
var n = this;
if (e.duration) {
this._animateParam = M(M({}, e), {
startTime: (/* @__PURE__ */ new Date()).getTime()
});
var s = T(e.destPos, function(u) {
return u;
}), a = this._initState(this._animateParam), o = function() {
n._raf = null;
var u = n._animateParam, c = n._getNextState(a), f = !n.eventManager.triggerChange(c.pos, a.pos);
if (a = c, c.finis