@konnectio/core
Version:
Konnectio Core Frontend Integration.
1,375 lines • 342 kB
JavaScript
import { r as __toESM, t as __commonJSMin } from "./chunk-BPfpcrXh.js";
import { $ as renderList, A as createSlots, At as toDisplayString, B as mergeModels, D as createBlock, Dt as normalizeClass, E as createBaseVNode, Et as unref, F as getCurrentInstance, H as nextTick, J as onUnmounted, L as h, M as createVNode, O as createCommentVNode, P as defineComponent, R as inject, T as computed$1, Y as openBlock, _ as vShow, b as Comment, bt as ref, d as Transition, dt as withCtx, et as renderSlot, ft as withDirectives, gt as isRef, j as createTextVNode, k as createElementBlock, kt as normalizeStyle, lt as watch, nt as resolveDirective, o as useI18n, ot as useModel, q as onMounted, st as useSlots, t as mitt_default, tt as resolveComponent, u as storeToRefs, vt as reactive, w as Text, x as Fragment, y as withModifiers } from "./mitt-Dp_pykgV.js";
import { A as usePaymentStore, C as useAvailabilityStore, E as useUtilityStore, F as capitalized, G as showDate, I as convertDescription, J as showPrice, L as daysBetweenDates, O as useHotelStore, Q as BookingLayout, S as _plugin_vue_export_helper_default, V as getUserLanguage, Z as BookingHeaderLayout, _ as InputField_default, j as useApplyGiftCardStore, k as emitter, n as TextField_default, v as Clickable_default, w as useEventStore, x as Icon_default } from "./SelectField-CfD2awPl.js";
import { n as __default } from "./Field-BjtJJFJG.js";
import { t as ActionField_default } from "./ActionField-DlqhtdHW.js";
import { a as Base_default$1, n as GoogleNotice_default, r as Checkbox_default } from "./CheckoutWindow-Cx1MBwXg.js";
//#region node_modules/@egjs/component/dist/component.esm.js
function __values$1(e) {
var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
if (n) return n.call(e);
if (e && typeof e.length == "number") return { next: function() {
return e && r >= e.length && (e = void 0), {
value: e && e[r++],
done: !e
};
} };
throw TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read$1(e, t) {
var n = typeof Symbol == "function" && e[Symbol.iterator];
if (!n) return e;
var r = n.call(e), i, s = [], l;
try {
for (; (t === void 0 || t-- > 0) && !(i = r.next()).done;) s.push(i.value);
} catch (e) {
l = { error: e };
} finally {
try {
i && !i.done && (n = r.return) && n.call(r);
} finally {
if (l) throw l.error;
}
}
return s;
}
function __spread$1() {
for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(__read$1(arguments[t]));
return e;
}
var isUndefined = function(e) {
return e === void 0;
}, ComponentEvent = /* @__PURE__ */ function() {
function e(e, t) {
var n, r;
if (this._canceled = !1, t) try {
for (var i = __values$1(Object.keys(t)), s = i.next(); !s.done; s = i.next()) {
var l = s.value;
this[l] = t[l];
}
} catch (e) {
n = { error: e };
} finally {
try {
s && !s.done && (r = i.return) && r.call(i);
} finally {
if (n) throw n.error;
}
}
this.eventType = e;
}
var t = e.prototype;
return t.stop = function() {
this._canceled = !0;
}, t.isCanceled = function() {
return this._canceled;
}, e;
}(), Component = /* @__PURE__ */ function() {
function e() {
this._eventHandler = {};
}
var t = e.prototype;
return t.trigger = function(e) {
var t = [...arguments].slice(1), n = e instanceof ComponentEvent ? e.eventType : e, r = __spread$1(this._eventHandler[n] || []);
return r.length <= 0 || (e instanceof ComponentEvent ? (e.currentTarget = this, r.forEach(function(t) {
t(e);
})) : r.forEach(function(e) {
e.apply(void 0, __spread$1(t));
})), this;
}, t.once = function(e, t) {
var n = this;
if (typeof e == "object" && isUndefined(t)) {
var r = e;
for (var i in r) this.once(i, r[i]);
return this;
} else if (typeof e == "string" && typeof t == "function") {
var s = function() {
var r = [...arguments];
t.apply(void 0, __spread$1(r)), n.off(e, s);
};
this.on(e, s);
}
return this;
}, t.hasOn = function(e) {
return !!this._eventHandler[e];
}, t.on = function(e, t) {
if (typeof e == "object" && isUndefined(t)) {
var n = e;
for (var r in n) this.on(r, n[r]);
return this;
} else if (typeof e == "string" && typeof t == "function") {
var i = this._eventHandler[e];
isUndefined(i) && (this._eventHandler[e] = [], i = this._eventHandler[e]), i.push(t);
}
return this;
}, t.off = function(e, t) {
if (isUndefined(e)) return this._eventHandler = {}, this;
if (isUndefined(t)) {
if (typeof e == "string") return delete this._eventHandler[e], this;
var n = e;
for (var r in n) this.off(r, n[r]);
return this;
}
var i = this._eventHandler[e];
if (i) {
for (var s = i.length, l = 0; l < s; ++l) if (i[l] === t) {
i.splice(l, 1), s <= 1 && delete this._eventHandler[e];
break;
}
}
return this;
}, e.VERSION = "3.0.5", e;
}(), ComponentEvent$1 = ComponentEvent;
//#endregion
//#region node_modules/@egjs/agent/dist/agent.esm.js
function some(e, t) {
for (var n = e.length, r = 0; r < n; ++r) if (t(e[r], r)) return !0;
return !1;
}
function find$1(e, t) {
for (var n = e.length, r = 0; r < n; ++r) if (t(e[r], r)) return e[r];
return null;
}
function getUserAgentString(e) {
var t = e;
if (t === void 0) {
if (typeof navigator > "u" || !navigator) return "";
t = navigator.userAgent || "";
}
return t.toLowerCase();
}
function execRegExp(e, t) {
try {
return new RegExp(e, "g").exec(t);
} catch {
return null;
}
}
function hasUserAgentData() {
if (typeof navigator > "u" || !navigator || !navigator.userAgentData) return !1;
var e = navigator.userAgentData, t = e.brands || e.uaList;
return !!(t && t.length);
}
function findVersion(e, t) {
var n = execRegExp("(" + e + ")((?:\\/|\\s|:)([0-9|\\.|_]+))", t);
return n ? n[3] : "";
}
function convertVersion(e) {
return e.replace(/_/g, ".");
}
function findPreset(e, t) {
var n = null, r = "-1";
return some(e, function(e) {
var i = execRegExp("(" + e.test + ")((?:\\/|\\s|:)([0-9|\\.|_]+))?", t);
return !i || e.brand ? !1 : (n = e, r = i[3] || "-1", e.versionAlias ? r = e.versionAlias : e.versionTest && (r = findVersion(e.versionTest.toLowerCase(), t) || r), r = convertVersion(r), !0);
}), {
preset: n,
version: r
};
}
function findPresetBrand(e, t) {
var n = {
brand: "",
version: "-1"
};
return some(e, function(e) {
var r = findBrand(t, e);
return r ? (n.brand = e.id, n.version = e.versionAlias || r.version, n.version !== "-1") : !1;
}), n;
}
function findBrand(e, t) {
return find$1(e, function(e) {
var n = e.brand;
return execRegExp("" + t.test, n.toLowerCase());
});
}
var BROWSER_PRESETS = [
{
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"
}
], CHROMIUM_PRESETS = [
{
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
}
], WEBKIT_PRESETS = [{
test: "applewebkit",
id: "webkit",
versionTest: "applewebkit|safari"
}], WEBVIEW_PRESETS = [
{
test: "(?=(iphone|ipad))(?!(.*version))",
id: "webview"
},
{
test: "(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))",
id: "webview"
},
{
test: "webview",
id: "webview"
}
], OS_PRESETS = [
{
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 isWebView(e) {
return !!findPreset(WEBVIEW_PRESETS, e).preset;
}
function getLegacyAgent(e) {
var t = getUserAgentString(e), n = !!/mobi/g.exec(t), r = {
name: "unknown",
version: "-1",
majorVersion: -1,
webview: isWebView(t),
chromium: !1,
chromiumVersion: "-1",
webkit: !1,
webkitVersion: "-1"
}, i = {
name: "unknown",
version: "-1",
majorVersion: -1
}, s = findPreset(BROWSER_PRESETS, t), l = s.preset, u = s.version, d = findPreset(OS_PRESETS, t), f = d.preset, p = d.version, m = findPreset(CHROMIUM_PRESETS, t);
if (r.chromium = !!m.preset, r.chromiumVersion = m.version, !r.chromium) {
var g = findPreset(WEBKIT_PRESETS, t);
r.webkit = !!g.preset, r.webkitVersion = g.version;
}
return f && (i.name = f.id, i.version = p, i.majorVersion = parseInt(p, 10)), l && (r.name = l.id, r.version = u, r.webview && i.name === "ios" && r.name !== "safari" && (r.webview = !1)), r.majorVersion = parseInt(r.version, 10), {
browser: r,
os: i,
isMobile: n,
isHints: !1
};
}
function getClientHintsAgent(e) {
var t = navigator.userAgentData, n = (t.uaList || t.brands).slice(), r = e && e.fullVersionList, i = t.mobile || !1, s = n[0], l = (e && e.platform || t.platform || navigator.platform).toLowerCase(), u = {
name: s.brand,
version: s.version,
majorVersion: -1,
webkit: !1,
webkitVersion: "-1",
chromium: !1,
chromiumVersion: "-1",
webview: !!findPresetBrand(WEBVIEW_PRESETS, n).brand || isWebView(getUserAgentString())
}, d = {
name: "unknown",
version: "-1",
majorVersion: -1
};
u.webkit = !u.chromium && some(WEBKIT_PRESETS, function(e) {
return findBrand(n, e);
});
var f = findPresetBrand(CHROMIUM_PRESETS, n);
if (u.chromium = !!f.brand, u.chromiumVersion = f.version || "-1", !u.chromium) {
var p = findPresetBrand(WEBKIT_PRESETS, n);
u.webkit = !!p.brand, u.webkitVersion = p.version || "-1";
}
var m = find$1(OS_PRESETS, function(e) {
return RegExp("" + e.test, "g").exec(l);
});
if (d.name = m ? m.id : "", e && (d.version = e.platformVersion || "-1"), r && r.length) {
var g = findPresetBrand(BROWSER_PRESETS, r);
u.name = g.brand || u.name, u.version = g.version || u.version;
} else {
var _ = findPresetBrand(BROWSER_PRESETS, n);
u.name = _.brand || u.name, u.version = _.brand && e ? e.uaFullVersion : _.version;
}
return u.webkit && (d.name = i ? "ios" : "mac"), d.name === "ios" && u.webview && (u.version = "-1"), d.version = convertVersion(d.version), u.version = convertVersion(u.version), d.majorVersion = parseInt(d.version, 10), u.majorVersion = parseInt(u.version, 10), {
browser: u,
os: d,
isMobile: i,
isHints: !0
};
}
function agent(e) {
return e === void 0 && hasUserAgentData() ? getClientHintsAgent() : getLegacyAgent(e);
}
//#endregion
//#region node_modules/@cfcs/core/dist/cfcs.esm.js
function keys(e) {
return Object.keys(e);
}
var OBSERVERS_PATH = "__observers__", COMPUTED_PATH = "__computed__", CFCS_DETECTED_DEPENDENCIES_VERSION = 1, CFCS_DETECTED_DEPENDENCIES = "__CFCS_DETECTED_DEPENDENCIES__", extendStatics$5 = function(e, t) {
return extendStatics$5 = 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]);
}, extendStatics$5(e, t);
};
function __extends$5(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
extendStatics$5(e, t);
function n() {
this.constructor = e;
}
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
}
function getDetectedStack() {
Object[CFCS_DETECTED_DEPENDENCIES] = Object[CFCS_DETECTED_DEPENDENCIES] || {};
var e = Object[CFCS_DETECTED_DEPENDENCIES];
return e[CFCS_DETECTED_DEPENDENCIES_VERSION] = e[CFCS_DETECTED_DEPENDENCIES_VERSION] || [], e[CFCS_DETECTED_DEPENDENCIES_VERSION];
}
function getCurrentDetected() {
var e = getDetectedStack();
return e[e.length - 1];
}
function detectDependencies(e) {
var t = getDetectedStack(), n = [], r = {
host: e,
observers: n,
push: function(t) {
e !== t && n.indexOf(t) === -1 && n.push(t);
}
};
return t.push(r), r;
}
function endDetectDependencies() {
return getDetectedStack().pop();
}
var Observer = /* @__PURE__ */ function() {
function e(e) {
this._emitter = new Component(), this._current = e;
}
var t = e.prototype;
return Object.defineProperty(t, "current", {
get: function() {
return getCurrentDetected()?.push(this), this._current;
},
set: function(e) {
this._setCurrent(e);
},
enumerable: !1,
configurable: !0
}), t.subscribe = function(e) {
return this.current, this._emitter.on("update", e), this;
}, t.unsubscribe = function(e) {
return this._emitter.off("update", e), this;
}, t._setCurrent = function(e) {
var t = this._current, n = e !== t;
this._current = e, n && this._emitter.trigger("update", e, t);
}, t.toString = function() {
return `${this.current}`;
}, t.valueOf = function() {
return this.current;
}, e;
}(), ComputedObserver = /* @__PURE__ */ function(e) {
__extends$5(t, e);
function t(t) {
var n = e.call(this) || this;
return n._computedCallback = t, n._registered = [], n._onCheckUpdate = function() {
n._setCurrent(n.current);
}, n._current = n.current, n;
}
var n = t.prototype;
return Object.defineProperty(n, "current", {
get: function() {
var e = this;
detectDependencies(this);
var t = this._computedCallback(), n = endDetectDependencies();
return this._registered.forEach(function(t) {
t.unsubscribe(e._onCheckUpdate);
}), n.observers.forEach(function(t) {
t.subscribe(e._onCheckUpdate);
}), this._registered = n.observers, t;
},
enumerable: !1,
configurable: !0
}), t;
}(Observer);
function injectObserve(e, t, n) {
n === void 0 && (n = t), Object.defineProperty(e, t, {
configurable: !0,
get: function() {
return getObserver(this, n).current;
},
set: function(e) {
getObserver(this, n, e).current = e;
}
}), n !== t && Object.defineProperty(e, n, {
configurable: !0,
get: function() {
return getObserver(this, n).current;
}
});
}
function Observe() {
var e = [...arguments];
return e.length > 1 ? injectObserve(e[0], e[1]) : function(t, n) {
return injectObserve(t, n, e[0]);
};
}
function injectReactiveSubscribe(e) {
e.subscribe = function(e, t) {
this[e], getObserver(this, e).subscribe(t);
}, e.unsubscribe = function(e, t) {
var n = this;
if (!e) {
keys(getObservers(this)).forEach(function(e) {
n.unsubscribe(e);
});
return;
}
e in this && getObserver(this, e).unsubscribe(t);
};
}
function ReactiveSubscribe(e) {
var t = e.prototype;
injectReactiveSubscribe(t);
}
function observe(e) {
return new Observer(e);
}
function computed(e) {
return new ComputedObserver(e);
}
function defineObservers(e) {
var t = {};
return Object.defineProperty(e, OBSERVERS_PATH, { get: function() {
return t;
} }), t;
}
function getObservers(e, t) {
var n, r;
e[OBSERVERS_PATH] || defineObservers(e);
var i = e[OBSERVERS_PATH];
if (!t) {
var s = e?.constructor?.prototype?.[COMPUTED_PATH];
s && s.forEach(function(t) {
!(t in i) && t in e && e[t];
});
}
return i;
}
function getObserver(e, t, n) {
var r = getObservers(e);
return r[t] || (r[t] = observe(n)), r[t];
}
function Computed(e, t, n) {
var r = n.get;
function i() {
var e = getObservers(this, !0);
return t in e || (e[t] = computed(r.bind(this))), getObserver(this, t).current;
}
var s = {
configurable: !0,
get: i
};
e[COMPUTED_PATH] || (e[COMPUTED_PATH] = []);
var l = e[COMPUTED_PATH];
return l.indexOf(t) === -1 && l.push(t), Object.defineProperty(e, t, s), s;
}
//#endregion
//#region node_modules/@egjs/axes/dist/axes.esm.js
var extendStatics$4 = function(e, t) {
return extendStatics$4 = 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]);
}, extendStatics$4(e, t);
};
function __extends$4(e, t) {
extendStatics$4(e, t);
function n() {
this.constructor = e;
}
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
}
var __assign$3 = function() {
return __assign$3 = Object.assign || function(e) {
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
return e;
}, __assign$3.apply(this, arguments);
};
function __decorate(e, t, n, r) {
var i = arguments.length, s = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, l;
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(e, t, n, r);
else for (var u = e.length - 1; u >= 0; u--) (l = e[u]) && (s = (i < 3 ? l(s) : i > 3 ? l(t, n, s) : l(t, n)) || s);
return i > 3 && s && Object.defineProperty(t, n, s), s;
}
var win = typeof window > "u" ? { navigator: { userAgent: "" } } : window, DIRECTION_NONE = 1, DIRECTION_LEFT = 2, DIRECTION_RIGHT = 4, DIRECTION_HORIZONTAL = 6, DIRECTION_UP = 8, DIRECTION_DOWN = 16, DIRECTION_VERTICAL = 24, DIRECTION_ALL = 30, MOUSE_LEFT = "left", MOUSE_RIGHT = "right", MOUSE_MIDDLE = "middle", MOUSE_BUTTON_CODE_MAP = {
1: MOUSE_LEFT,
2: MOUSE_MIDDLE,
3: MOUSE_RIGHT
}, ANY = "any", NONE = "none", SHIFT = "shift", CTRL = "ctrl", ALT = "alt", META = "meta", VELOCITY_INTERVAL = 16, IOS_EDGE_THRESHOLD = 30, IS_IOS_SAFARI = "ontouchstart" in win && agent().browser.name === "safari", TRANSFORM = function() {
if (typeof document > "u") return "";
for (var e = (document.head || document.getElementsByTagName("head")[0]).style, t = [
"transform",
"webkitTransform",
"msTransform",
"mozTransform"
], n = 0, r = t.length; n < r; n++) if (t[n] in e) return t[n];
return "";
}(), PREVENT_DRAG_CSSPROPS = {
"-webkit-user-select": "none",
"-ms-user-select": "none",
"-moz-user-select": "none",
"user-select": "none",
"-webkit-user-drag": "none"
}, toArray$2 = function(e) {
for (var t = [], n = 0, r = e.length; n < r; n++) t.push(e[n]);
return t;
}, $ = function(e, t) {
t === void 0 && (t = !1);
var n;
if (typeof e == "string") {
if (e.match(/^<([a-z]+)\s*([^>]*)>/)) {
var r = document.createElement("div");
r.innerHTML = e, n = toArray$2(r.childNodes);
} else n = toArray$2(document.querySelectorAll(e));
t || (n = n.length >= 1 ? n[0] : void 0);
} else e === win ? n = e : "value" in e || "current" in e ? n = e.value || e.current : e.nodeName && (e.nodeType === 1 || e.nodeType === 9) ? n = e : "jQuery" in win && e instanceof jQuery || e.constructor.prototype.jquery ? n = t ? e.toArray() : e.get(0) : Array.isArray(e) && (n = e.map(function(e) {
return $(e);
}), t || (n = n.length >= 1 ? n[0] : void 0));
return n;
}, raf$1 = win.requestAnimationFrame || win.webkitRequestAnimationFrame, caf$1 = win.cancelAnimationFrame || win.webkitCancelAnimationFrame;
if (raf$1 && !caf$1) {
var keyInfo_1 = {}, oldraf_1 = raf$1;
raf$1 = function(e) {
var t = oldraf_1(function(n) {
keyInfo_1[t] && e(n);
});
return keyInfo_1[t] = !0, t;
}, caf$1 = function(e) {
delete keyInfo_1[e];
};
} else raf$1 && caf$1 || (raf$1 = function(e) {
return win.setTimeout(function() {
e(win.performance && win.performance.now && win.performance.now() || (/* @__PURE__ */ new Date()).getTime());
}, 16);
}, caf$1 = win.clearTimeout);
var requestAnimationFrame$2 = function(e) {
return raf$1(e);
}, cancelAnimationFrame$1 = function(e) {
caf$1(e);
}, map = function(e, t) {
var n = {};
for (var r in e) r && (n[r] = t(e[r], r));
return n;
}, filter = function(e, t) {
var n = {};
for (var r in e) r && t(e[r], r) && (n[r] = e[r]);
return n;
}, every = function(e, t) {
for (var n in e) if (n && !t(e[n], n)) return !1;
return !0;
}, equal = function(e, t) {
return every(e, function(e, n) {
return e === t[n];
});
}, roundNumFunc = {}, roundNumber = function(e, t) {
return roundNumFunc[t] || (roundNumFunc[t] = getRoundFunc(t)), roundNumFunc[t](e);
}, roundNumbers = function(e, t) {
return !e || !t ? e : map(e, function(e, n) {
return roundNumber(e, typeof t == "number" ? t : t[n]);
});
}, getDecimalPlace = function(e) {
if (!isFinite(e)) return 0;
var t = `${e}`;
if (t.indexOf("e") >= 0) {
for (var n = 0, r = 1; Math.round(e * r) / r !== e;) r *= 10, n++;
return n;
}
return t.indexOf(".") >= 0 ? t.length - t.indexOf(".") - 1 : 0;
}, inversePow = function(e) {
return 1 / 10 ** e;
}, getRoundFunc = function(e) {
var t = e < 1 ? 10 ** getDecimalPlace(e) : 1;
return function(n) {
return e === 0 ? 0 : Math.round(Math.round(n / e) * e * t) / t;
};
}, getAngle = function(e, t) {
return Math.atan2(t, e) * 180 / Math.PI;
}, isCssPropsFromAxes = function(e) {
var t = !0;
return Object.keys(PREVENT_DRAG_CSSPROPS).forEach(function(n) {
(!e || e[n] !== PREVENT_DRAG_CSSPROPS[n]) && (t = !1);
}), t;
}, getDirection$1 = function(e, t) {
return e && t ? DIRECTION_ALL : e ? DIRECTION_HORIZONTAL : t ? DIRECTION_VERTICAL : DIRECTION_NONE;
}, useDirection = function(e, t, n) {
return n ? !!(t === DIRECTION_ALL || t & e && n & e) : !!(t & e);
}, setCssProps = function(e, t, n) {
var r, i = (r = {}, r[DIRECTION_NONE] = "auto", r[DIRECTION_ALL] = "none", r[DIRECTION_VERTICAL] = "pan-x", r[DIRECTION_HORIZONTAL] = "pan-y", r), s = {};
if (e && e.style) {
var l = t.touchAction ? t.touchAction : i[n], u = __assign$3(__assign$3({}, PREVENT_DRAG_CSSPROPS), { "touch-action": e.style["touch-action"] === "none" ? "none" : l });
Object.keys(u).forEach(function(t) {
s[t] = e.style[t];
}), Object.keys(u).forEach(function(t) {
e.style[t] = u[t];
});
}
return s;
}, revertCssProps = function(e, t) {
e && e.style && t && Object.keys(t).forEach(function(n) {
e.style[n] = t[n];
});
}, EventManager = /* @__PURE__ */ function() {
function e(e) {
this._axes = e, this.holdingCount = 0;
}
var t = e.prototype;
return t.hold = function(e, t) {
var n = this._getRoundPos(e).roundPos;
this._axes.trigger(new ComponentEvent$1("hold", {
pos: n,
input: t.input || null,
inputEvent: t.event || null,
isTrusted: !0
}));
}, t.triggerRelease = function(e) {
var t = this._getRoundPos(e.destPos, e.depaPos), n = t.roundPos, r = t.roundDepa;
e.destPos = n, e.depaPos = r, e.setTo = this._createUserControll(e.destPos, e.duration), this._axes.trigger(new ComponentEvent$1("release", __assign$3(__assign$3({}, e), { bounceRatio: this._getBounceRatio(n) })));
}, t.triggerChange = function(e, t, n, r) {
var i = this;
r === void 0 && (r = !1);
var s = this.animationManager, l = s.axisManager, u = s.getEventInfo(), d = this._getRoundPos(e, t), f = d.roundPos, p = d.roundDepa, m = l.moveTo(f, p), g = n?.event || u?.event || null, _ = {
pos: m.pos,
delta: m.delta,
bounceRatio: this._getBounceRatio(m.pos),
holding: r,
inputEvent: g,
isTrusted: !!g,
input: n?.input || u?.input || null,
set: g ? this._createUserControll(m.pos) : function() {}
}, v = new ComponentEvent$1("change", _);
return this._axes.trigger(v), Object.keys(m.pos).forEach(function(e) {
var t = m.pos[e];
getObserver(i._axes, e, t).current = t;
}), g && l.set(_.set().destPos), !v.isCanceled();
}, t.triggerAnimationStart = function(e) {
var t = this._getRoundPos(e.destPos, e.depaPos), n = t.roundPos, r = t.roundDepa;
e.destPos = n, e.depaPos = r, e.setTo = this._createUserControll(e.destPos, e.duration);
var i = new ComponentEvent$1("animationStart", e);
return this._axes.trigger(i), !i.isCanceled();
}, t.triggerAnimationEnd = function(e) {
e === void 0 && (e = !1), this._axes.trigger(new ComponentEvent$1("animationEnd", { isTrusted: e }));
}, t.triggerFinish = function(e) {
e === void 0 && (e = !1), this._axes.trigger(new ComponentEvent$1("finish", { isTrusted: e }));
}, t.setAnimationManager = function(e) {
this.animationManager = e;
}, t.destroy = function() {
this._axes.off();
}, t._createUserControll = function(e, t) {
t === void 0 && (t = 0);
var n = {
destPos: __assign$3({}, e),
duration: t
};
return function(e, t) {
return e && (n.destPos = __assign$3({}, e)), t !== void 0 && (n.duration = t), n;
};
}, t._getRoundPos = function(e, t) {
var n = this._axes.options.round;
return {
roundPos: roundNumbers(e, n),
roundDepa: roundNumbers(t, n)
};
}, t._getBounceRatio = function(e) {
return this._axes.axisManager.map(e, function(e, t) {
return e < t.range[0] && t.bounce[0] !== 0 ? (t.range[0] - e) / t.bounce[0] : e > t.range[1] && t.bounce[1] !== 0 ? (e - t.range[1]) / t.bounce[1] : 0;
});
}, __decorate([Observe], e.prototype, "holdingCount", void 0), e;
}(), InterruptManager = /* @__PURE__ */ function() {
function e(e) {
this._options = e, this._prevented = !1;
}
var t = e.prototype;
return t.isInterrupting = function() {
return this._options.interruptable || this._prevented;
}, t.isInterrupted = function() {
return !this._options.interruptable && this._prevented;
}, t.setInterrupt = function(e) {
this._options.interruptable || (this._prevented = e);
}, e;
}(), getInsidePosition = function(e, t, n, r) {
var i = e, s = [n[0] ? t[0] : r ? t[0] - r[0] : t[0], n[1] ? t[1] : r ? t[1] + r[1] : t[1]];
return i = Math.max(s[0], i), i = Math.min(s[1], i), i;
}, isOutside = function(e, t) {
return e < t[0] || e > t[1];
}, isEndofBounce = function(e, t, n, r) {
return !r[0] && e === t[0] - n[0] || !r[1] && e === t[1] + n[1];
}, getDuration = function(e, t) {
var n = Math.sqrt(e / t * 2);
return n < 100 ? 0 : n;
}, isCircularable = function(e, t, n) {
return n[1] && e > t[1] || n[0] && e < t[0];
}, getCirculatedPos = function(e, t, n) {
var r = e, i = t[0], s = t[1], l = s - i;
return n[1] && e > s && (r = (r - s) % l + i), n[0] && e < i && (r = (r - i) % l + s), r;
}, AxisManager = /* @__PURE__ */ function() {
function e(e) {
var t = this;
this._axis = e, this._complementOptions(), this._pos = Object.keys(this._axis).reduce(function(e, n) {
return e[n] = t._axis[n].startPos, e;
}, {});
}
var t = e.prototype;
return t.getDelta = function(e, t) {
var n = this.get(e);
return map(this.get(t), function(e, t) {
return e - n[t];
});
}, t.get = function(e) {
var t = this;
return e && Array.isArray(e) ? e.reduce(function(e, n) {
return n && n in t._pos && (e[n] = t._pos[n]), e;
}, {}) : __assign$3(__assign$3({}, this._pos), e || {});
}, t.moveTo = function(e, t) {
t === void 0 && (t = this._pos);
var n = map(this._pos, function(n, r) {
return r in e && r in t ? e[r] - t[r] : 0;
});
return this.set(this.map(e, function(e, t) {
return t ? getCirculatedPos(e, t.range, t.circular) : 0;
})), {
pos: __assign$3({}, this._pos),
delta: n
};
}, t.set = function(e) {
for (var t in e) t && t in this._pos && (this._pos[t] = e[t]);
}, t.every = function(e, t) {
var n = this._axis;
return every(e, function(e, r) {
return t(e, n[r], r);
});
}, t.filter = function(e, t) {
var n = this._axis;
return filter(e, function(e, r) {
return t(e, n[r], r);
});
}, t.map = function(e, t) {
var n = this._axis;
return map(e, function(e, r) {
return t(e, n[r], r);
});
}, t.isOutside = function(e) {
return !this.every(e ? this.get(e) : this._pos, function(e, t) {
return !isOutside(e, t.range);
});
}, t.getAxisOptions = function(e) {
return this._axis[e];
}, t.setAxis = function(e) {
var t = this;
Object.keys(e).forEach(function(n) {
if (!t._axis[n]) throw Error(`Axis ${n} does not exist in Axes instance`);
t._axis[n] = __assign$3(__assign$3({}, t._axis[n]), e[n]);
}), this._complementOptions();
}, t._complementOptions = function() {
var e = this;
Object.keys(this._axis).forEach(function(t) {
e._axis[t] = __assign$3({
range: [0, 100],
startPos: e._axis[t].range[0],
bounce: [0, 0],
circular: [!1, !1]
}, e._axis[t]), ["bounce", "circular"].forEach(function(n) {
var r = e._axis, i = r[t][n];
/string|number|boolean/.test(typeof i) && (r[t][n] = [i, i]);
});
});
}, e;
}(), SUPPORT_TOUCH = "ontouchstart" in win, SUPPORT_POINTER = "PointerEvent" in win, SUPPORT_MSPOINTER = "MSPointerEvent" in win, SUPPORT_POINTER_EVENTS = SUPPORT_POINTER || SUPPORT_MSPOINTER, isValidKey = function(e, t) {
return !!(!t || t.indexOf(ANY) > -1 || t.indexOf(NONE) > -1 && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey || t.indexOf(SHIFT) > -1 && e.shiftKey || t.indexOf(CTRL) > -1 && e.ctrlKey || t.indexOf(ALT) > -1 && e.altKey || t.indexOf(META) > -1 && e.metaKey);
}, EventInput = /* @__PURE__ */ function() {
function e() {
var e = this;
this._stopContextMenu = function(t) {
t.preventDefault(), win.removeEventListener("contextmenu", e._stopContextMenu);
};
}
var t = e.prototype;
return t.extendEvent = function(e) {
var t, n = this.prevEvent, r = this._getCenter(e), i = n ? this._getMovement(e) : {
x: 0,
y: 0
}, s = n ? this._getScale(e) : 1, l = n ? getAngle(r.x - n.center.x, r.y - n.center.y) : 0, u = n ? n.deltaX + i.x : i.x, d = n ? n.deltaY + i.y : i.y, f = i.x, p = i.y, m = this._latestInterval, g = Date.now(), _ = m ? g - m.timestamp : 0, v = n ? n.velocityX : 0, y = n ? n.velocityY : 0;
return (!m || _ >= VELOCITY_INTERVAL) && (m && (t = [(u - m.deltaX) / _, (d - m.deltaY) / _], v = t[0], y = t[1]), this._latestInterval = {
timestamp: g,
deltaX: u,
deltaY: d
}), {
srcEvent: e,
scale: s,
angle: l,
center: r,
deltaX: u,
deltaY: d,
offsetX: f,
offsetY: p,
velocityX: v,
velocityY: y,
preventSystemEvent: !0
};
}, t._getDistance = function(e, t) {
var n = t.clientX - e.clientX, r = t.clientY - e.clientY;
return Math.sqrt(n * n + r * r);
}, t._getButton = function(e) {
var t = {
1: MOUSE_LEFT,
2: MOUSE_RIGHT,
4: MOUSE_MIDDLE
};
return (this._isTouchEvent(e) ? MOUSE_LEFT : t[e.buttons]) || null;
}, t._isTouchEvent = function(e) {
return e.type && e.type.indexOf("touch") > -1;
}, t._isValidButton = function(e, t) {
return t.indexOf(e) > -1;
}, t._isValidEvent = function(e, t, n) {
return (!t || isValidKey(e, t)) && (!n || this._isValidButton(this._getButton(e), n));
}, t._preventMouseButton = function(e, t) {
t === MOUSE_RIGHT ? win.addEventListener("contextmenu", this._stopContextMenu) : t === MOUSE_MIDDLE && e.preventDefault();
}, e;
}(), MouseEventInput = /* @__PURE__ */ function(e) {
__extends$4(t, e);
function t() {
var t = e !== null && e.apply(this, arguments) || this;
return t.start = ["mousedown"], t.move = ["mousemove"], t.end = ["mouseup"], t;
}
var n = t.prototype;
return n.onEventStart = function(e, t, n) {
var r = this._getButton(e);
return this._isValidEvent(e, t, n) ? (this._preventMouseButton(e, r), this.extendEvent(e)) : null;
}, n.onEventMove = function(e, t, n) {
return this._isValidEvent(e, t, n) ? this.extendEvent(e) : null;
}, n.onEventEnd = function() {}, n.onRelease = function() {
this.prevEvent = null;
}, n.getTouches = function(e, t) {
return t && this._isValidButton(MOUSE_BUTTON_CODE_MAP[e.which], t) && this.end.indexOf(e.type) === -1 ? 1 : 0;
}, n._getScale = function() {
return 1;
}, n._getCenter = function(e) {
return {
x: e.clientX,
y: e.clientY
};
}, n._getMovement = function(e) {
var t = this.prevEvent.srcEvent;
return {
x: e.clientX - t.clientX,
y: e.clientY - t.clientY
};
}, t;
}(EventInput), TouchEventInput = /* @__PURE__ */ function(e) {
__extends$4(t, e);
function t() {
var t = e !== null && e.apply(this, arguments) || this;
return t.start = ["touchstart"], t.move = ["touchmove"], t.end = ["touchend", "touchcancel"], t;
}
var n = t.prototype;
return n.onEventStart = function(e, t) {
return this._baseTouches = e.touches, this._isValidEvent(e, t) ? this.extendEvent(e) : null;
}, n.onEventMove = function(e, t) {
return this._isValidEvent(e, t) ? this.extendEvent(e) : null;
}, n.onEventEnd = function(e) {
this._baseTouches = e.touches;
}, n.onRelease = function() {
this.prevEvent = null, this._baseTouches = null;
}, n.getTouches = function(e) {
return e.touches.length;
}, n._getScale = function(e) {
return e.touches.length !== 2 || this._baseTouches.length < 2 ? null : this._getDistance(e.touches[0], e.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]);
}, n._getCenter = function(e) {
return {
x: e.touches[0].clientX,
y: e.touches[0].clientY
};
}, n._getMovement = function(e) {
var t = this.prevEvent.srcEvent;
return e.touches[0].identifier === t.touches[0].identifier ? {
x: e.touches[0].clientX - t.touches[0].clientX,
y: e.touches[0].clientY - t.touches[0].clientY
} : {
x: 0,
y: 0
};
}, t;
}(EventInput), PointerEventInput = /* @__PURE__ */ function(e) {
__extends$4(t, e);
function t() {
var t = e !== null && e.apply(this, arguments) || this;
return t.start = SUPPORT_POINTER ? ["pointerdown"] : ["MSPointerDown"], t.move = SUPPORT_POINTER ? ["pointermove"] : ["MSPointerMove"], t.end = SUPPORT_POINTER ? ["pointerup", "pointercancel"] : ["MSPointerUp", "MSPointerCancel"], t._firstInputs = [], t._recentInputs = [], t;
}
var n = t.prototype;
return n.onEventStart = function(e, t, n) {
var r = this._getButton(e);
return this._isValidEvent(e, t, n) ? (this._preventMouseButton(e, r), this._updatePointerEvent(e), this.extendEvent(e)) : null;
}, n.onEventMove = function(e, t, n) {
return this._isValidEvent(e, t, n) ? (this._updatePointerEvent(e), this.extendEvent(e)) : null;
}, n.onEventEnd = function(e) {
this._removePointerEvent(e);
}, n.onRelease = function() {
this.prevEvent = null, this._firstInputs = [], this._recentInputs = [];
}, n.getTouches = function() {
return this._recentInputs.length;
}, n._getScale = function() {
return this._recentInputs.length === 2 ? this._getDistance(this._recentInputs[0], this._recentInputs[1]) / this._getDistance(this._firstInputs[0], this._firstInputs[1]) : null;
}, n._getCenter = function(e) {
return {
x: e.clientX,
y: e.clientY
};
}, n._getMovement = function(e) {
var t = this.prevEvent.srcEvent;
return e.pointerId === t.pointerId ? {
x: e.clientX - t.clientX,
y: e.clientY - t.clientY
} : {
x: 0,
y: 0
};
}, n._updatePointerEvent = function(e) {
var t = this, n = !1;
this._recentInputs.forEach(function(r, i) {
r.pointerId === e.pointerId && (n = !0, t._recentInputs[i] = e);
}), n || (this._firstInputs.push(e), this._recentInputs.push(e));
}, n._removePointerEvent = function(e) {
this._firstInputs = this._firstInputs.filter(function(t) {
return t.pointerId !== e.pointerId;
}), this._recentInputs = this._recentInputs.filter(function(t) {
return t.pointerId !== e.pointerId;
});
}, t;
}(EventInput), TouchMouseEventInput = /* @__PURE__ */ function(e) {
__extends$4(t, e);
function t() {
var t = e !== null && e.apply(this, arguments) || this;
return t.start = ["mousedown", "touchstart"], t.move = ["mousemove", "touchmove"], t.end = [
"mouseup",
"touchend",
"touchcancel"
], t;
}
var n = t.prototype;
return n.onEventStart = function(e, t, n) {
var r = this._getButton(e);
return this._isTouchEvent(e) && (this._baseTouches = e.touches), this._isValidEvent(e, t, n) ? (this._preventMouseButton(e, r), this.extendEvent(e)) : null;
}, n.onEventMove = function(e, t, n) {
return this._isValidEvent(e, t, n) ? this.extendEvent(e) : null;
}, n.onEventEnd = function(e) {
this._isTouchEvent(e) && (this._baseTouches = e.touches);
}, n.onRelease = function() {
this.prevEvent = null, this._baseTouches = null;
}, n.getTouches = function(e, t) {
return this._isTouchEvent(e) ? e.touches.length : this._isValidButton(MOUSE_BUTTON_CODE_MAP[e.which], t) && this.end.indexOf(e.type) === -1 ? 1 : 0;
}, n._getScale = function(e) {
return this._isTouchEvent(e) ? e.touches.length !== 2 || this._baseTouches.length < 2 ? 1 : this._getDistance(e.touches[0], e.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]) : this.prevEvent.scale;
}, n._getCenter = function(e) {
return this._isTouchEvent(e) ? {
x: e.touches[0].clientX,
y: e.touches[0].clientY
} : {
x: e.clientX,
y: e.clientY
};
}, n._getMovement = function(e) {
var t = this, n = [e, this.prevEvent.srcEvent].map(function(e) {
return t._isTouchEvent(e) ? {
id: e.touches[0].identifier,
x: e.touches[0].clientX,
y: e.touches[0].clientY
} : {
id: null,
x: e.clientX,
y: e.clientY
};
}), r = n[0], i = n[1];
return r.id === i.id ? {
x: r.x - i.x,
y: r.y - i.y
} : {
x: 0,
y: 0
};
}, t;
}(EventInput), toAxis = function(e, t) {
return t.reduce(function(t, n, r) {
return e[r] && (t[e[r]] = n), t;
}, {});
}, convertInputType = function(e) {
e === void 0 && (e = []);
var t = !1, n = !1, r = !1;
return e.forEach(function(e) {
switch (e) {
case "mouse":
n = !0;
break;
case "touch":
t = SUPPORT_TOUCH;
break;
case "pointer": r = SUPPORT_POINTER_EVENTS;
}
}), r ? new PointerEventInput() : t && n ? new TouchMouseEventInput() : t ? new TouchEventInput() : n ? new MouseEventInput() : null;
};
function getAddEventOptions(e) {
return e.indexOf("touch") > -1 ? { passive: !1 } : !1;
}
var InputObserver = /* @__PURE__ */ function() {
function e(e) {
var t = e.options, n = e.interruptManager, r = e.eventManager, i = e.axisManager, s = e.animationManager;
this._isOutside = !1, this._moveDistance = null, this._isStopped = !1, this.options = t, this._interruptManager = n, this._eventManager = r, this._axisManager = i, this._animationManager = s;
}
var t = e.prototype;
return t.get = function(e) {
return this._axisManager.get(e.axes);
}, t.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);
}
}, t.change = function(e, t, n, r) {
if (!(this._isStopped || !this._interruptManager.isInterrupting() || this._axisManager.every(n, function(e) {
return e === 0;
}))) {
var i = t.srcEvent ? t.srcEvent : t;
if (!i.__childrenAxesAlreadyChanged) {
var s = this._moveDistance || this._axisManager.get(e.axes), l = map(s, function(e, t) {
return e + (n[t] || 0);
});
this._moveDistance &&= this._axisManager.map(l, function(e, t) {
var n = t.circular, r = t.range;
return n && (n[0] || n[1]) ? getCirculatedPos(e, r, n) : e;
}), this._isOutside && this._axisManager.every(s, function(e, t) {
return !isOutside(e, t.range);
}) && (this._isOutside = !1), s = this._atOutside(s), l = this._atOutside(l), (!this.options.nested || !this._isEndofAxis(n, s, l)) && (i.__childrenAxesAlreadyChanged = !0);
var u = {
input: e,
event: t
};
if (r) {
var d = this._animationManager.getDuration(l, s);
this._animationManager.animateTo(l, d, u);
} else this._eventManager.triggerChange(l, s, u, !0) || (this._isStopped = !0, this._moveDistance = null, this._animationManager.finish(!1));
}
}
}, t.release = function(e, t, n, r) {
if (!(this._isStopped || !this._interruptManager.isInterrupting() || !this._moveDistance)) {
var i = t.srcEvent ? t.srcEvent : t;
i.__childrenAxesAlreadyReleased && (n = n.map(function() {
return 0;
}));
var s = this._axisManager.get(e.axes), l = this._axisManager.get(), u = this._animationManager.getDisplacement(n), d = toAxis(e.axes, u), f = this._axisManager.get(this._axisManager.map(d, function(e, t, n) {
return t.circular && (t.circular[0] || t.circular[1]) ? s[n] + e : getInsidePosition(s[n] + e, t.range, t.circular, t.bounce);
}));
i.__childrenAxesAlreadyReleased = !0;
var p = this._animationManager.getDuration(f, s, r);
p === 0 && (f = __assign$3({}, l));
var m = {
depaPos: l,
destPos: f,
duration: p,
delta: this._axisManager.getDelta(l, f),
inputEvent: t,
input: e,
isTrusted: !0
};
--this._eventManager.holdingCount, this._eventManager.triggerRelease(m), this._eventManager.holdingCount === 0 && (this._moveDistance = null);
var g = this._animationManager.getUserControl(m), _ = equal(g.destPos, l), v = {
input: e,
event: t
};
_ || g.duration === 0 ? (_ || this._eventManager.triggerChange(g.destPos, l, v, !0), this._interruptManager.setInterrupt(!1), this._axisManager.isOutside() ? this._animationManager.restore(v) : this._eventManager.triggerFinish(!0)) : this._animationManager.animateTo(g.destPos, g.duration, v);
}
}, t._atOutside = function(e) {
var t = this;
return this._isOutside ? this._axisManager.map(e, function(e, t) {
var n = t.range[0] - t.bounce[0], r = t.range[1] + t.bounce[1];
return e > r ? r : e < n ? n : e;
}) : this._axisManager.map(e, function(e, n) {
var r = n.range[0], i = n.range[1], s = n.bounce, l = n.circular;
return l[0] && e < r || l[1] && e > i ? e : e < r ? r - t._animationManager.interpolate(r - e, s[0]) : e > i ? i + t._animationManager.interpolate(e - i, s[1]) : e;
});
}, t._isEndofAxis = function(e, t, n) {
return this._axisManager.every(t, function(r, i, s) {
return e[s] === 0 || t[s] === n[s] && isEndofBounce(r, i.range, i.bounce, i.circular);
});
}, e;
}(), clamp$1 = function(e, t, n) {
return Math.max(Math.min(e, n), t);
}, EasingManager = /* @__PURE__ */ function(e) {
__extends$4(t, e);
function t() {
var t = e !== null && e.apply(this, arguments) || this;
return t._useDuration = !0, t;
}
var n = t.prototype;
return n.interpolate = function(e, t) {
var n = this._easing(1e-5) / 1e-5;
return this._easing(e / (t * n)) * t;
}, n.updateAnimation = function(e) {
var t, n = this._animateParam;
if (n) {
var r = (/* @__PURE__ */ new Date()).getTime() - n.startTime, i = e?.destPos || n.destPos, s = e?.duration ?? n.duration;
if (e?.restart || s <= r) {
this.setTo(i, s - r);
return;
}
if (e?.destPos) {
var l = this.axisManager.get();
this._initialEasingPer = this._prevEasingPer, n.delta = this.axisManager.getDelta(l, i), n.destPos = i;
}
if (e?.duration) {
var u = (r + this._durationOffset) / n.duration;
this._durationOffset = u * s - r, n.duration = s;
}
}
}, n._initState = function(e) {
return this._initialEasingPer = 0, this._prevEasingPer = 0, this._durationOffset = 0, {
pos: e.depaPos,
easingPer: 0,
finished: !1
};
}, n._getNextState = function(e) {
var t = this, n = this._animateParam, r = e.pos, i = n.destPos, s = map(r, function(e, t) {
return e <= i[t] ? 1 : -1;
}), l = ((/* @__PURE__ */ new Date()).getTime() - n.startTime + this._durationOffset) / n.duration, u = this._easing(l), d = this.axisManager.map(r, function(e, d, f) {
var p = l >= 1 ? i[f] : e + n.delta[f] * (u - t._prevEasingPer) / (1 - t._initialEasingPer), m = getCirculatedPos(p, d.range, d.circular);
if (p !== m) {
var g = s[f] * (d.range[1] - d.range[0]);
i[f] -= g, r[f] -= g;
}
return m;
});
return this._prevEasingPer = u, {
pos: d,
easingPer: u,
finished: u >= 1
};
}, n._easing = function(e) {
return e > 1 ? 1 : this._options.easing(e);
}, t;
}(/* @__PURE__ */ function() {
function e(e) {
var t = e.options, n = e.interruptManager, r = e.eventManager, i = e.axisManager;
this._options = t, this.interruptManager = n, this.eventManager = r, this.axisManager = i, this.animationEnd = this.animationEnd.bind(this);
}
var t = e.prototype;
return t.getDuration = function(e, t, n) {
var r = this, i;
if (n !== void 0) i = n;
else {
var s = map(t, function(t, n) {
return getDuration(Math.abs(t - e[n]), r._options.deceleration);
});
i = Object.keys(s).reduce(function(e, t) {
return Math.max(e, s[t]);
}, -Infinity);
}
return clamp$1(i, this._options.minimumDuration, this._options.maximumDuration);
}, t.getDisplacement = function(e) {
var t = e.reduce(function(e, t) {
return e + t * t;
}, 0) ** (1 / e.length), n = Math.abs(t / -this._options.deceleration);
return e.map(function(e) {
return e / 2 * n;
});
}, t.stopAnimation = function(e) {
if (this._animateParam) {
var t = this.axisManager.get(), n = this.axisManager.map(t, function(e, t) {
return getCirculatedPos(e, t.range, t.circular);
});
every(n, function(e, n) {
return t[n] === e;
}) || this.eventManager.triggerChange(n, t, e, !!e), this._animateParam = null, this._raf && cancelAnimationFrame$1(this._raf), this._raf = null, this.eventManager.triggerAnimationEnd(!!e?.event);
}
}, t.getEventInfo = function() {
return this._animateParam && this._animateParam.input && this._animateParam.inputEvent ? {
input: this._animateParam.input,
event: this._animateParam.inputEvent
} : null;
}, t.restore = function(e) {
var t = this.axisManager.get(), n = this.axisManager.map(t, function(e, t) {
return Math.min(t.range[1], Math.max(t.range[0], e));
});
this.stopAnimation(), this.animateTo(n, this.getDuration(t, n), e);
}, t.animationEnd = function() {
var e = this.getEventInfo();
this._animateParam = null;
var t = this.axisManager.filter(this.axisManager.get(), function(e, t) {
return isCircularable(e, t.range, t.circular);
});
Object.keys(t).length > 0 && this.setTo(this.axisManager.map(t, function(e, t) {
return getCirculatedPos(e, t.range, t.circular);
})), this.interruptManager.setInterrupt(!1), this.eventManager.triggerAnimationEnd(!!e), this.axisManager.isOutside() ? this.restore(e) : this.finish(!!e);
}, t.finish = function(e) {
this._animateParam = null, this.interruptManager.setInterrupt(!1), this.eventManager.triggerFinish(e);
}, t.getUserControl = function(e) {
var t = e.setTo();
return t.destPos = this.axisManager.get(t.destPos), t.duration = clamp$1(t.duration, this._options.minimumDuration, this._options.maximumDuration), t;
}, t.animateTo = function(e, t, n) {
var r = this;
this.stopAnimation();
var i = this._createAnimationParam(e, t, n), s = __assign$3({}, i.depaPos), l = this.eventManager.triggerAnimationStart(i), u = this.getUserControl(i);
if (!l && this.axisManager.every(u.destPos, function(e, t) {
return isCircularable(e, t.range, t.circular);
}) && console.warn("You can't stop the 'animation' event when 'circular' is true."), l && !equal(u.destPos, s)) {
var d = n?.event || null;
this._animateLoop({
depaPos: s,
destPos: u.destPos,
duration: u.duration,
delta: this.axisManager.getDelta(s, u.destPos),
isTrusted: !!d,
inputEvent: d,
input: n?.input || null
}, function() {
return r.animationEnd();
});
}
}, t.setTo = function(e, t) {
t === void 0 && (t = 0);
var n = Object.keys(e), r = this.axisManager.get(n);
if (equal(e, r)) return this;
this.interruptManager.setInterrupt(!0);
var i = filter(e, function(e, t) {
return r[t] !== e;
});
return !Object.keys(i).length || (i = this.axisManager.map(i, function(e, t) {
var n = t.range, r = t.circular;
return r && (r[0] || r[1]) ? e : getInsidePosition(e, n, r);
}), equal(i, r)) || (t > 0 ? this.animateTo(i, t) : (this.stopAnimation(), this.eventManager.triggerChange(i), this.finish(!1))), this;
}, t.setBy = function(e, t) {
return t === void 0 && (t = 0), this.setTo(map(this.axisManager.get(Object.keys(e)), function(t, n) {
return t + e[n];
}), t);
}, t.setOptions = function(e) {
this._options = __assign$3(__assign$3({}, this._options), e);
}, t._createAnimationParam = function(e, t, n) {
var r = this.axisManager.get(), i = e, s = n?.event || null;
return {
depaPos: r,
destPos: i,
duration: clamp$1(t, this._options.minimumDuration, this._options.maximumDuration),
delta: this.axisManager.getDelta(r, i),
inputEvent: s,
input: n?.input || null,
isTrusted: !!s,
done: this.animationEnd
};
}, t._animateLoop = function(e, t) {
var n = this;
if (e.duration) {
this._animateParam = __assign$3(__assign$3({}, e), { startTime: (/* @__PURE__ */ new Date()).getTime() });
var r = map(e.destPos, function(e) {
return e;
}), i = this._initState(this._animateParam), s = function() {
n._raf = null;
var e = n._animateParam, l = n._getNextState(i), u = !n.eventManager.triggerChange(l.pos, i.pos);
if (i = l, l.finished) {
e.destPos = n._getFinalPos(e.destPos, r), equal(e.destPos, n.axisManager.get(Object.keys(e.destPos))) || n.eventManager.triggerChange(e.destPos, l.pos), t();
return;
} else u ? n.finish(!1) : n._raf = requestAnimationFrame$2(s);
};
s();
} else this.eventManager.triggerChange(e.destPos), t();
}, t._getFinalPos = function(e, t) {
var n = this, r = 1e-6;
return map(e, function(e, i) {
return e >= t[i] - r && e <= t[i] + r ? t[i] : roundNumber(e, n._getRoundUnit(e, i));
});
}, t._getRoundUnit = function(e, t) {
var n = this._options.round, r = null;
if (!n) {
var i = this.axisManager.getAxisOptions(t);
r = inversePow(Math.max(getDecimalPlace(i.range[0]), getDecimalPlace(i.range[1]), getDecimalPlace(e)));
}
return r || n;
}, e;
}()), Axes = /* @__PURE__ */ function(e) {
__extends$4(t, e);
fun