From 255d7228d42587dfa53b8fa5b8ef6cebce3fcba2 Mon Sep 17 00:00:00 2001 From: Yasuhito Takamiya Date: Tue, 18 Jun 2024 13:23:05 +0900 Subject: [PATCH] refactoring --- apps/tutorial/application.js | 6901 ++++++++--------- apps/tutorial/application.js.map | 8 +- apps/tutorial/serviceworker.js | 40 +- apps/tutorial/serviceworker.js.map | 8 +- packages/common/src/detailed-error.ts | 50 - packages/common/src/index.ts | 1 - packages/elements/src/angle-slider-element.ts | 4 +- .../elements/src/circle-notation-element.ts | 14 +- .../elements/src/circuit-editor-element.ts | 6 +- packages/elements/src/circuit-step-element.ts | 3 +- .../elements/src/quantum-simulator-element.ts | 4 +- 11 files changed, 3469 insertions(+), 3570 deletions(-) delete mode 100644 packages/common/src/detailed-error.ts diff --git a/apps/tutorial/application.js b/apps/tutorial/application.js index 68f942b63..88b33afd5 100644 --- a/apps/tutorial/application.js +++ b/apps/tutorial/application.js @@ -2,49 +2,49 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); // ../../packages/elements/dist/index.js -var pg = Object.create; -var Co = Object.defineProperty; -var Op = Object.getOwnPropertyDescriptor; -var dg = Object.getOwnPropertyNames; -var Tp = Object.getOwnPropertySymbols; -var fg = Object.getPrototypeOf; -var Mp = Object.prototype.hasOwnProperty; -var hg = Object.prototype.propertyIsEnumerable; -var Cp = /* @__PURE__ */ __name((t, r, e) => r in t ? Co(t, r, { enumerable: true, configurable: true, writable: true, value: e }) : t[r] = e, "Cp"); -var Ip = /* @__PURE__ */ __name((t, r) => { +var sg = Object.create; +var To = Object.defineProperty; +var Sp = Object.getOwnPropertyDescriptor; +var lg = Object.getOwnPropertyNames; +var xp = Object.getOwnPropertySymbols; +var ug = Object.getPrototypeOf; +var Tp = Object.prototype.hasOwnProperty; +var cg = Object.prototype.propertyIsEnumerable; +var Ep = /* @__PURE__ */ __name((t, r, e) => r in t ? To(t, r, { enumerable: true, configurable: true, writable: true, value: e }) : t[r] = e, "Ep"); +var Cp = /* @__PURE__ */ __name((t, r) => { for (var e in r || (r = {})) - Mp.call(r, e) && Cp(t, e, r[e]); - if (Tp) - for (var e of Tp(r)) - hg.call(r, e) && Cp(t, e, r[e]); + Tp.call(r, e) && Ep(t, e, r[e]); + if (xp) + for (var e of xp(r)) + cg.call(r, e) && Ep(t, e, r[e]); return t; -}, "Ip"); -var u = /* @__PURE__ */ __name((t, r) => Co(t, "name", { value: r, configurable: true }), "u"); +}, "Cp"); +var u = /* @__PURE__ */ __name((t, r) => To(t, "name", { value: r, configurable: true }), "u"); var Tt = /* @__PURE__ */ __name((t, r) => () => (r || t((r = { exports: {} }).exports, r), r.exports), "Tt"); -var mg = /* @__PURE__ */ __name((t, r, e, n) => { +var pg = /* @__PURE__ */ __name((t, r, e, n) => { if (r && typeof r == "object" || typeof r == "function") - for (let s of dg(r)) - !Mp.call(t, s) && s !== e && Co(t, s, { get: () => r[s], enumerable: !(n = Op(r, s)) || n.enumerable }); + for (let s of lg(r)) + !Tp.call(t, s) && s !== e && To(t, s, { get: () => r[s], enumerable: !(n = Sp(r, s)) || n.enumerable }); return t; -}, "mg"); -var jt = /* @__PURE__ */ __name((t, r, e) => (e = t != null ? pg(fg(t)) : {}, mg(r || !t || !t.__esModule ? Co(e, "default", { value: t, enumerable: true }) : e, t)), "jt"); +}, "pg"); +var er = /* @__PURE__ */ __name((t, r, e) => (e = t != null ? sg(ug(t)) : {}, pg(r || !t || !t.__esModule ? To(e, "default", { value: t, enumerable: true }) : e, t)), "er"); var M = /* @__PURE__ */ __name((t, r, e, n) => { - for (var s = n > 1 ? void 0 : n ? Op(r, e) : r, a = t.length - 1, p; a >= 0; a--) + for (var s = n > 1 ? void 0 : n ? Sp(r, e) : r, a = t.length - 1, p; a >= 0; a--) (p = t[a]) && (s = (n ? p(r, e, s) : p(s)) || s); - return n && s && Co(r, e, s), s; + return n && s && To(r, e, s), s; }, "M"); -var Ap = /* @__PURE__ */ __name((t, r, e) => { +var Op = /* @__PURE__ */ __name((t, r, e) => { if (!r.has(t)) throw TypeError("Cannot " + e); -}, "Ap"); -var Ka = /* @__PURE__ */ __name((t, r, e) => (Ap(t, r, "read from private field"), e ? e.call(t) : r.get(t)), "Ka"); -var Ja = /* @__PURE__ */ __name((t, r, e) => { +}, "Op"); +var Xa = /* @__PURE__ */ __name((t, r, e) => (Op(t, r, "read from private field"), e ? e.call(t) : r.get(t)), "Xa"); +var Za = /* @__PURE__ */ __name((t, r, e) => { if (r.has(t)) throw TypeError("Cannot add the same private member more than once"); r instanceof WeakSet ? r.add(t) : r.set(t, e); -}, "Ja"); -var Qa = /* @__PURE__ */ __name((t, r, e, n) => (Ap(t, r, "write to private field"), n ? n.call(t, e) : r.set(t, e), e), "Qa"); -var zp = Tt((Jl, Pp) => { +}, "Za"); +var Ka = /* @__PURE__ */ __name((t, r, e, n) => (Op(t, r, "write to private field"), n ? n.call(t, e) : r.set(t, e), e), "Ka"); +var Ip = Tt((Zl, Mp) => { (function(t) { "use strict"; var r = 2e3, e = { s: 1, n: 0, d: 1 }; @@ -76,7 +76,7 @@ var zp = Tt((Jl, Pp) => { __name(a, "a"); u(a, "factorize"); var p = u(function(w, S) { - var T = 0, C = 1, R = 1, _ = 0, L = 0, $ = 0, A = 1, ee = 1, z = 0, H = 1, te = 1, Q = 1, ue = 1e7, K; + var T = 0, C = 1, R = 1, _ = 0, L = 0, B = 0, A = 1, ee = 1, z = 0, H = 1, te = 1, Q = 1, ue = 1e7, K; if (w != null) if (S !== void 0) { if (T = w, C = S, R = T * C, T % 1 !== 0 || C % 1 !== 0) @@ -111,8 +111,8 @@ var zp = Tt((Jl, Pp) => { case "string": { if (H = w.match(/\d+|./g), H === null) throw g.InvalidParameter; - if (H[z] === "-" ? (R = -1, z++) : H[z] === "+" && z++, H.length === z + 1 ? L = n(H[z++], R) : H[z + 1] === "." || H[z] === "." ? (H[z] !== "." && (_ = n(H[z++], R)), z++, (z + 1 === H.length || H[z + 1] === "(" && H[z + 3] === ")" || H[z + 1] === "'" && H[z + 3] === "'") && (L = n(H[z], R), A = Math.pow(10, H[z].length), z++), (H[z] === "(" && H[z + 2] === ")" || H[z] === "'" && H[z + 2] === "'") && ($ = n(H[z + 1], R), ee = Math.pow(10, H[z + 1].length) - 1, z += 3)) : H[z + 1] === "/" || H[z + 1] === ":" ? (L = n(H[z], R), A = n(H[z + 2], 1), z += 3) : H[z + 3] === "/" && H[z + 1] === " " && (_ = n(H[z], R), L = n(H[z + 2], R), A = n(H[z + 4], 1), z += 5), H.length <= z) { - C = A * ee, R = T = $ + C * _ + ee * L; + if (H[z] === "-" ? (R = -1, z++) : H[z] === "+" && z++, H.length === z + 1 ? L = n(H[z++], R) : H[z + 1] === "." || H[z] === "." ? (H[z] !== "." && (_ = n(H[z++], R)), z++, (z + 1 === H.length || H[z + 1] === "(" && H[z + 3] === ")" || H[z + 1] === "'" && H[z + 3] === "'") && (L = n(H[z], R), A = Math.pow(10, H[z].length), z++), (H[z] === "(" && H[z + 2] === ")" || H[z] === "'" && H[z + 2] === "'") && (B = n(H[z + 1], R), ee = Math.pow(10, H[z + 1].length) - 1, z += 3)) : H[z + 1] === "/" || H[z + 1] === ":" ? (L = n(H[z], R), A = n(H[z + 2], 1), z += 3) : H[z + 3] === "/" && H[z + 1] === " " && (_ = n(H[z], R), L = n(H[z + 2], R), A = n(H[z + 4], 1), z += 5), H.length <= z) { + C = A * ee, R = T = B + C * _ + ee * L; break; } } @@ -290,13 +290,13 @@ var zp = Tt((Jl, Pp) => { return _; } }, typeof define == "function" && define.amd ? define([], function() { return g; - }) : typeof Jl == "object" ? (Object.defineProperty(g, "__esModule", { value: true }), g.default = g, g.Fraction = g, Pp.exports = g) : t.Fraction = g; - })(Jl); + }) : typeof Zl == "object" ? (Object.defineProperty(g, "__esModule", { value: true }), g.default = g, g.Fraction = g, Mp.exports = g) : t.Fraction = g; + })(Zl); }); -var jp = Tt((Y0, Gp) => { +var Ld = Tt((CE, _d) => { "use strict"; - var _p = u((t = 0) => (r) => `\x1B[${38 + t};5;${r}m`, "wrapAnsi256"), Lp = u((t = 0) => (r, e, n) => `\x1B[${38 + t};2;${r};${e};${n}m`, "wrapAnsi16m"); - function wg() { + var kd = u((t = 0) => (r) => `\x1B[${38 + t};5;${r}m`, "wrapAnsi256"), Nd = u((t = 0) => (r, e, n) => `\x1B[${38 + t};2;${r};${e};${n}m`, "wrapAnsi16m"); + function Dg() { let t = /* @__PURE__ */ new Map(), r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } }; r.color.gray = r.color.blackBright, r.bgColor.bgGray = r.bgColor.bgBlackBright, r.color.grey = r.color.blackBright, r.bgColor.bgGrey = r.bgColor.bgBlackBright; for (let [e, n] of Object.entries(r)) { @@ -304,7 +304,7 @@ var jp = Tt((Y0, Gp) => { r[s] = { open: `\x1B[${a[0]}m`, close: `\x1B[${a[1]}m` }, n[s] = r[s], t.set(a[0], a[1]); Object.defineProperty(r, e, { value: n, enumerable: false }); } - return Object.defineProperty(r, "codes", { value: t, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi256 = _p(), r.color.ansi16m = Lp(), r.bgColor.ansi256 = _p(10), r.bgColor.ansi16m = Lp(10), Object.defineProperties(r, { rgbToAnsi256: { value: (e, n, s) => e === n && n === s ? e < 8 ? 16 : e > 248 ? 231 : Math.round((e - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(e / 255 * 5) + 6 * Math.round(n / 255 * 5) + Math.round(s / 255 * 5), enumerable: false }, hexToRgb: { value: (e) => { + return Object.defineProperty(r, "codes", { value: t, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi256 = kd(), r.color.ansi16m = Nd(), r.bgColor.ansi256 = kd(10), r.bgColor.ansi16m = Nd(10), Object.defineProperties(r, { rgbToAnsi256: { value: (e, n, s) => e === n && n === s ? e < 8 ? 16 : e > 248 ? 231 : Math.round((e - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(e / 255 * 5) + 6 * Math.round(n / 255 * 5) + Math.round(s / 255 * 5), enumerable: false }, hexToRgb: { value: (e) => { let n = new RegExp("(?[a-f\\d]{6}|[a-f\\d]{3})", "i").exec(e.toString(16)); if (!n) return [0, 0, 0]; @@ -314,24 +314,24 @@ var jp = Tt((Y0, Gp) => { return [a >> 16 & 255, a >> 8 & 255, a & 255]; }, enumerable: false }, hexToAnsi256: { value: (e) => r.rgbToAnsi256(...r.hexToRgb(e)), enumerable: false } }), r; } - __name(wg, "wg"); - u(wg, "assembleStyles"); - Object.defineProperty(Gp, "exports", { enumerable: true, get: wg }); + __name(Dg, "Dg"); + u(Dg, "assembleStyles"); + Object.defineProperty(_d, "exports", { enumerable: true, get: Dg }); }); -var Mo = Tt((Di) => { +var Fo = Tt((Xi) => { "use strict"; - Object.defineProperty(Di, "__esModule", { value: true }); - Di.printIteratorEntries = Eg; - Di.printIteratorValues = Sg; - Di.printListItems = Tg; - Di.printObjectProperties = Cg; - var xg = u((t, r) => { + Object.defineProperty(Xi, "__esModule", { value: true }); + Xi.printIteratorEntries = Ng; + Xi.printIteratorValues = _g; + Xi.printListItems = Lg; + Xi.printObjectProperties = Gg; + var kg = u((t, r) => { let e = Object.keys(t), n = r !== null ? e.sort(r) : e; return Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(t).forEach((s) => { Object.getOwnPropertyDescriptor(t, s).enumerable && n.push(s); }), n; }, "getKeysOfEnumerableProperties"); - function Eg(t, r, e, n, s, a, p = ": ") { + function Ng(t, r, e, n, s, a, p = ": ") { let v = "", m = 0, d = t.next(); if (!d.done) { v += r.spacingOuter; @@ -348,9 +348,9 @@ var Mo = Tt((Di) => { } return v; } - __name(Eg, "Eg"); - u(Eg, "printIteratorEntries"); - function Sg(t, r, e, n, s, a) { + __name(Ng, "Ng"); + u(Ng, "printIteratorEntries"); + function _g(t, r, e, n, s, a) { let p = "", v = 0, m = t.next(); if (!m.done) { p += r.spacingOuter; @@ -366,9 +366,9 @@ var Mo = Tt((Di) => { } return p; } - __name(Sg, "Sg"); - u(Sg, "printIteratorValues"); - function Tg(t, r, e, n, s, a) { + __name(_g, "_g"); + u(_g, "printIteratorValues"); + function Lg(t, r, e, n, s, a) { let p = ""; if (t.length) { p += r.spacingOuter; @@ -384,10 +384,10 @@ var Mo = Tt((Di) => { } return p; } - __name(Tg, "Tg"); - u(Tg, "printListItems"); - function Cg(t, r, e, n, s, a) { - let p = "", v = xg(t, r.compareKeys); + __name(Lg, "Lg"); + u(Lg, "printListItems"); + function Gg(t, r, e, n, s, a) { + let p = "", v = kg(t, r.compareKeys); if (v.length) { p += r.spacingOuter; let m = e + r.indent; @@ -399,66 +399,66 @@ var Mo = Tt((Di) => { } return p; } - __name(Cg, "Cg"); - u(Cg, "printObjectProperties"); + __name(Gg, "Gg"); + u(Gg, "printObjectProperties"); }); -var qp = Tt((xn) => { +var $d = Tt((Cn) => { "use strict"; - Object.defineProperty(xn, "__esModule", { value: true }); - xn.test = xn.serialize = xn.default = void 0; - var Hp = Mo(), tu = globalThis["jest-symbol-do-not-touch"] || globalThis.Symbol, Og = typeof tu == "function" && tu.for ? tu.for("jest.asymmetricMatcher") : 1267621, ts = " ", Bp = u((t, r, e, n, s, a) => { + Object.defineProperty(Cn, "__esModule", { value: true }); + Cn.test = Cn.serialize = Cn.default = void 0; + var Gd = Fo(), ku = globalThis["jest-symbol-do-not-touch"] || globalThis.Symbol, jg = typeof ku == "function" && ku.for ? ku.for("jest.asymmetricMatcher") : 1267621, Is = " ", jd = u((t, r, e, n, s, a) => { let p = t.toString(); if (p === "ArrayContaining" || p === "ArrayNotContaining") - return ++n > r.maxDepth ? `[${p}]` : `${p + ts}[${(0, Hp.printListItems)(t.sample, r, e, n, s, a)}]`; + return ++n > r.maxDepth ? `[${p}]` : `${p + Is}[${(0, Gd.printListItems)(t.sample, r, e, n, s, a)}]`; if (p === "ObjectContaining" || p === "ObjectNotContaining") - return ++n > r.maxDepth ? `[${p}]` : `${p + ts}{${(0, Hp.printObjectProperties)(t.sample, r, e, n, s, a)}}`; + return ++n > r.maxDepth ? `[${p}]` : `${p + Is}{${(0, Gd.printObjectProperties)(t.sample, r, e, n, s, a)}}`; if (p === "StringMatching" || p === "StringNotMatching" || p === "StringContaining" || p === "StringNotContaining") - return p + ts + a(t.sample, r, e, n, s); + return p + Is + a(t.sample, r, e, n, s); if (typeof t.toAsymmetricMatcher != "function") throw new Error(`Asymmetric matcher ${t.constructor.name} does not implement toAsymmetricMatcher()`); return t.toAsymmetricMatcher(); }, "serialize"); - xn.serialize = Bp; - var $p = u((t) => t && t.$$typeof === Og, "test"); - xn.test = $p; - var Mg = { serialize: Bp, test: $p }, Ig = Mg; - xn.default = Ig; + Cn.serialize = jd; + var Hd = u((t) => t && t.$$typeof === jg, "test"); + Cn.test = Hd; + var Hg = { serialize: jd, test: Hd }, $g = Hg; + Cn.default = $g; }); -var Yp = Tt((En) => { +var Wd = Tt((On) => { "use strict"; - Object.defineProperty(En, "__esModule", { value: true }); - En.test = En.serialize = En.default = void 0; - var Fp = Mo(), Ag = " ", Up = ["DOMStringMap", "NamedNodeMap"], Pg = /^(HTML\w*Collection|NodeList)$/, zg = u((t) => Up.indexOf(t) !== -1 || Pg.test(t), "testName"), Wp = u((t) => t && t.constructor && !!t.constructor.name && zg(t.constructor.name), "test"); - En.test = Wp; - var Rg = u((t) => t.constructor.name === "NamedNodeMap", "isNamedNodeMap"), Vp = u((t, r, e, n, s, a) => { + Object.defineProperty(On, "__esModule", { value: true }); + On.test = On.serialize = On.default = void 0; + var Bd = Fo(), Bg = " ", qd = ["DOMStringMap", "NamedNodeMap"], qg = /^(HTML\w*Collection|NodeList)$/, Fg = u((t) => qd.indexOf(t) !== -1 || qg.test(t), "testName"), Fd = u((t) => t && t.constructor && !!t.constructor.name && Fg(t.constructor.name), "test"); + On.test = Fd; + var Ug = u((t) => t.constructor.name === "NamedNodeMap", "isNamedNodeMap"), Ud = u((t, r, e, n, s, a) => { let p = t.constructor.name; - return ++n > r.maxDepth ? `[${p}]` : (r.min ? "" : p + Ag) + (Up.indexOf(p) !== -1 ? `{${(0, Fp.printObjectProperties)(Rg(t) ? Array.from(t).reduce((v, m) => (v[m.name] = m.value, v), {}) : Ip({}, t), r, e, n, s, a)}}` : `[${(0, Fp.printListItems)(Array.from(t), r, e, n, s, a)}]`); + return ++n > r.maxDepth ? `[${p}]` : (r.min ? "" : p + Bg) + (qd.indexOf(p) !== -1 ? `{${(0, Bd.printObjectProperties)(Ug(t) ? Array.from(t).reduce((v, m) => (v[m.name] = m.value, v), {}) : Cp({}, t), r, e, n, s, a)}}` : `[${(0, Bd.printListItems)(Array.from(t), r, e, n, s, a)}]`); }, "serialize"); - En.serialize = Vp; - var Dg = { serialize: Vp, test: Wp }, kg = Dg; - En.default = kg; + On.serialize = Ud; + var Wg = { serialize: Ud, test: Fd }, Vg = Wg; + On.default = Vg; }); -var Xp = Tt((ru) => { +var Vd = Tt((Nu) => { "use strict"; - Object.defineProperty(ru, "__esModule", { value: true }); - ru.default = Ng; - function Ng(t) { + Object.defineProperty(Nu, "__esModule", { value: true }); + Nu.default = Yg; + function Yg(t) { return t.replace(//g, ">"); } - __name(Ng, "Ng"); - u(Ng, "escapeHTML"); + __name(Yg, "Yg"); + u(Yg, "escapeHTML"); }); -var rs = Tt((rr) => { +var As = Tt((tr) => { "use strict"; - Object.defineProperty(rr, "__esModule", { value: true }); - rr.printText = rr.printProps = rr.printElementAsLeaf = rr.printElement = rr.printComment = rr.printChildren = void 0; - var Zp = _g(Xp()); - function _g(t) { + Object.defineProperty(tr, "__esModule", { value: true }); + tr.printText = tr.printProps = tr.printElementAsLeaf = tr.printElement = tr.printComment = tr.printChildren = void 0; + var Yd = Xg(Vd()); + function Xg(t) { return t && t.__esModule ? t : { default: t }; } - __name(_g, "_g"); - u(_g, "_interopRequireDefault"); - var Lg = u((t, r, e, n, s, a, p) => { + __name(Xg, "Xg"); + u(Xg, "_interopRequireDefault"); + var Zg = u((t, r, e, n, s, a, p) => { let v = n + e.indent, m = e.colors; return t.map((d) => { let f = r[d], g = p(f, e, v, s, a); @@ -466,81 +466,81 @@ var rs = Tt((rr) => { `) !== -1 && (g = e.spacingOuter + v + g + e.spacingOuter + n), g = `{${g}}`), `${e.spacingInner + n + m.prop.open + d + m.prop.close}=${m.value.open}${g}${m.value.close}`; }).join(""); }, "printProps"); - rr.printProps = Lg; - var Gg = u((t, r, e, n, s, a) => t.map((p) => r.spacingOuter + e + (typeof p == "string" ? Kp(p, r) : a(p, r, e, n, s))).join(""), "printChildren"); - rr.printChildren = Gg; - var Kp = u((t, r) => { + tr.printProps = Zg; + var Kg = u((t, r, e, n, s, a) => t.map((p) => r.spacingOuter + e + (typeof p == "string" ? Xd(p, r) : a(p, r, e, n, s))).join(""), "printChildren"); + tr.printChildren = Kg; + var Xd = u((t, r) => { let e = r.colors.content; - return e.open + (0, Zp.default)(t) + e.close; + return e.open + (0, Yd.default)(t) + e.close; }, "printText"); - rr.printText = Kp; - var jg = u((t, r) => { + tr.printText = Xd; + var Jg = u((t, r) => { let e = r.colors.comment; - return `${e.open}${e.close}`; + return `${e.open}${e.close}`; }, "printComment"); - rr.printComment = jg; - var Hg = u((t, r, e, n, s) => { + tr.printComment = Jg; + var Qg = u((t, r, e, n, s) => { let a = n.colors.tag; return `${a.open}<${t}${r && a.close + r + n.spacingOuter + s + a.open}${e ? `>${a.close}${e}${n.spacingOuter}${s}${a.open}${a.close}`; }, "printElement"); - rr.printElement = Hg; - var Bg = u((t, r) => { + tr.printElement = Qg; + var eb = u((t, r) => { let e = r.colors.tag; return `${e.open}<${t}${e.close} \u2026${e.open} />${e.close}`; }, "printElementAsLeaf"); - rr.printElementAsLeaf = Bg; + tr.printElementAsLeaf = eb; }); -var nd = Tt((Sn) => { +var tf = Tt((Mn) => { "use strict"; - Object.defineProperty(Sn, "__esModule", { value: true }); - Sn.test = Sn.serialize = Sn.default = void 0; - var ki = rs(), $g = 1, Jp = 3, Qp = 8, ed = 11, qg = /^((HTML|SVG)\w*)?Element$/, Fg = u((t) => { + Object.defineProperty(Mn, "__esModule", { value: true }); + Mn.test = Mn.serialize = Mn.default = void 0; + var Zi = As(), tb = 1, Zd = 3, Kd = 8, Jd = 11, rb = /^((HTML|SVG)\w*)?Element$/, nb = u((t) => { try { return typeof t.hasAttribute == "function" && t.hasAttribute("is"); } catch (r) { return false; } - }, "testHasAttribute"), Ug = u((t) => { - let r = t.constructor.name, { nodeType: e, tagName: n } = t, s = typeof n == "string" && n.includes("-") || Fg(t); - return e === $g && (qg.test(r) || s) || e === Jp && r === "Text" || e === Qp && r === "Comment" || e === ed && r === "DocumentFragment"; - }, "testNode"), td = u((t) => { + }, "testHasAttribute"), ib = u((t) => { + let r = t.constructor.name, { nodeType: e, tagName: n } = t, s = typeof n == "string" && n.includes("-") || nb(t); + return e === tb && (rb.test(r) || s) || e === Zd && r === "Text" || e === Kd && r === "Comment" || e === Jd && r === "DocumentFragment"; + }, "testNode"), Qd = u((t) => { var r; - return ((r = t == null ? void 0 : t.constructor) == null ? void 0 : r.name) && Ug(t); + return ((r = t == null ? void 0 : t.constructor) == null ? void 0 : r.name) && ib(t); }, "test"); - Sn.test = td; - function Wg(t) { - return t.nodeType === Jp; - } - __name(Wg, "Wg"); - u(Wg, "nodeIsText"); - function Vg(t) { - return t.nodeType === Qp; - } - __name(Vg, "Vg"); - u(Vg, "nodeIsComment"); - function nu(t) { - return t.nodeType === ed; - } - __name(nu, "nu"); - u(nu, "nodeIsFragment"); - var rd = u((t, r, e, n, s, a) => { - if (Wg(t)) - return (0, ki.printText)(t.data, r); - if (Vg(t)) - return (0, ki.printComment)(t.data, r); - let p = nu(t) ? "DocumentFragment" : t.tagName.toLowerCase(); - return ++n > r.maxDepth ? (0, ki.printElementAsLeaf)(p, r) : (0, ki.printElement)(p, (0, ki.printProps)(nu(t) ? [] : Array.from(t.attributes).map((v) => v.name).sort(), nu(t) ? {} : Array.from(t.attributes).reduce((v, m) => (v[m.name] = m.value, v), {}), r, e + r.indent, n, s, a), (0, ki.printChildren)(Array.prototype.slice.call(t.childNodes || t.children), r, e + r.indent, n, s, a), r, e); + Mn.test = Qd; + function ob(t) { + return t.nodeType === Zd; + } + __name(ob, "ob"); + u(ob, "nodeIsText"); + function ab(t) { + return t.nodeType === Kd; + } + __name(ab, "ab"); + u(ab, "nodeIsComment"); + function _u(t) { + return t.nodeType === Jd; + } + __name(_u, "_u"); + u(_u, "nodeIsFragment"); + var ef = u((t, r, e, n, s, a) => { + if (ob(t)) + return (0, Zi.printText)(t.data, r); + if (ab(t)) + return (0, Zi.printComment)(t.data, r); + let p = _u(t) ? "DocumentFragment" : t.tagName.toLowerCase(); + return ++n > r.maxDepth ? (0, Zi.printElementAsLeaf)(p, r) : (0, Zi.printElement)(p, (0, Zi.printProps)(_u(t) ? [] : Array.from(t.attributes).map((v) => v.name).sort(), _u(t) ? {} : Array.from(t.attributes).reduce((v, m) => (v[m.name] = m.value, v), {}), r, e + r.indent, n, s, a), (0, Zi.printChildren)(Array.prototype.slice.call(t.childNodes || t.children), r, e + r.indent, n, s, a), r, e); }, "serialize"); - Sn.serialize = rd; - var Yg = { serialize: rd, test: td }, Xg = Yg; - Sn.default = Xg; + Mn.serialize = ef; + var sb = { serialize: ef, test: Qd }, lb = sb; + Mn.default = lb; }); -var ld = Tt((Tn) => { +var sf = Tt((In) => { "use strict"; - Object.defineProperty(Tn, "__esModule", { value: true }); - Tn.test = Tn.serialize = Tn.default = void 0; - var Io = Mo(), Zg = "@@__IMMUTABLE_ITERABLE__@@", Kg = "@@__IMMUTABLE_LIST__@@", Jg = "@@__IMMUTABLE_KEYED__@@", Qg = "@@__IMMUTABLE_MAP__@@", id = "@@__IMMUTABLE_ORDERED__@@", eb = "@@__IMMUTABLE_RECORD__@@", tb = "@@__IMMUTABLE_SEQ__@@", rb = "@@__IMMUTABLE_SET__@@", nb = "@@__IMMUTABLE_STACK__@@", Ni = u((t) => `Immutable.${t}`, "getImmutableName"), ns = u((t) => `[${t}]`, "printAsLeaf"), Ao = " ", od = "\u2026", ib = u((t, r, e, n, s, a, p) => ++n > r.maxDepth ? ns(Ni(p)) : `${Ni(p) + Ao}{${(0, Io.printIteratorEntries)(t.entries(), r, e, n, s, a)}}`, "printImmutableEntries"); - function ob(t) { + Object.defineProperty(In, "__esModule", { value: true }); + In.test = In.serialize = In.default = void 0; + var Uo = Fo(), ub = "@@__IMMUTABLE_ITERABLE__@@", cb = "@@__IMMUTABLE_LIST__@@", pb = "@@__IMMUTABLE_KEYED__@@", db = "@@__IMMUTABLE_MAP__@@", rf = "@@__IMMUTABLE_ORDERED__@@", fb = "@@__IMMUTABLE_RECORD__@@", hb = "@@__IMMUTABLE_SEQ__@@", mb = "@@__IMMUTABLE_SET__@@", vb = "@@__IMMUTABLE_STACK__@@", Ki = u((t) => `Immutable.${t}`, "getImmutableName"), Ps = u((t) => `[${t}]`, "printAsLeaf"), Wo = " ", nf = "\u2026", gb = u((t, r, e, n, s, a, p) => ++n > r.maxDepth ? Ps(Ki(p)) : `${Ki(p) + Wo}{${(0, Uo.printIteratorEntries)(t.entries(), r, e, n, s, a)}}`, "printImmutableEntries"); + function bb(t) { let r = 0; return { next() { if (r < t._keys.length) { @@ -550,69 +550,69 @@ var ld = Tt((Tn) => { return { done: true, value: void 0 }; } }; } - __name(ob, "ob"); - u(ob, "getRecordEntries"); - var ab = u((t, r, e, n, s, a) => { - let p = Ni(t._name || "Record"); - return ++n > r.maxDepth ? ns(p) : `${p + Ao}{${(0, Io.printIteratorEntries)(ob(t), r, e, n, s, a)}}`; - }, "printImmutableRecord"), sb = u((t, r, e, n, s, a) => { - let p = Ni("Seq"); - return ++n > r.maxDepth ? ns(p) : t[Jg] ? `${p + Ao}{${t._iter || t._object ? (0, Io.printIteratorEntries)(t.entries(), r, e, n, s, a) : od}}` : `${p + Ao}[${t._iter || t._array || t._collection || t._iterable ? (0, Io.printIteratorValues)(t.values(), r, e, n, s, a) : od}]`; - }, "printImmutableSeq"), iu = u((t, r, e, n, s, a, p) => ++n > r.maxDepth ? ns(Ni(p)) : `${Ni(p) + Ao}[${(0, Io.printIteratorValues)(t.values(), r, e, n, s, a)}]`, "printImmutableValues"), ad = u((t, r, e, n, s, a) => t[Qg] ? ib(t, r, e, n, s, a, t[id] ? "OrderedMap" : "Map") : t[Kg] ? iu(t, r, e, n, s, a, "List") : t[rb] ? iu(t, r, e, n, s, a, t[id] ? "OrderedSet" : "Set") : t[nb] ? iu(t, r, e, n, s, a, "Stack") : t[tb] ? sb(t, r, e, n, s, a) : ab(t, r, e, n, s, a), "serialize"); - Tn.serialize = ad; - var sd = u((t) => t && (t[Zg] === true || t[eb] === true), "test"); - Tn.test = sd; - var lb = { serialize: ad, test: sd }, ub = lb; - Tn.default = ub; + __name(bb, "bb"); + u(bb, "getRecordEntries"); + var yb = u((t, r, e, n, s, a) => { + let p = Ki(t._name || "Record"); + return ++n > r.maxDepth ? Ps(p) : `${p + Wo}{${(0, Uo.printIteratorEntries)(bb(t), r, e, n, s, a)}}`; + }, "printImmutableRecord"), wb = u((t, r, e, n, s, a) => { + let p = Ki("Seq"); + return ++n > r.maxDepth ? Ps(p) : t[pb] ? `${p + Wo}{${t._iter || t._object ? (0, Uo.printIteratorEntries)(t.entries(), r, e, n, s, a) : nf}}` : `${p + Wo}[${t._iter || t._array || t._collection || t._iterable ? (0, Uo.printIteratorValues)(t.values(), r, e, n, s, a) : nf}]`; + }, "printImmutableSeq"), Lu = u((t, r, e, n, s, a, p) => ++n > r.maxDepth ? Ps(Ki(p)) : `${Ki(p) + Wo}[${(0, Uo.printIteratorValues)(t.values(), r, e, n, s, a)}]`, "printImmutableValues"), of = u((t, r, e, n, s, a) => t[db] ? gb(t, r, e, n, s, a, t[rf] ? "OrderedMap" : "Map") : t[cb] ? Lu(t, r, e, n, s, a, "List") : t[mb] ? Lu(t, r, e, n, s, a, t[rf] ? "OrderedSet" : "Set") : t[vb] ? Lu(t, r, e, n, s, a, "Stack") : t[hb] ? wb(t, r, e, n, s, a) : yb(t, r, e, n, s, a), "serialize"); + In.serialize = of; + var af = u((t) => t && (t[ub] === true || t[fb] === true), "test"); + In.test = af; + var xb = { serialize: of, test: af }, Eb = xb; + In.default = Eb; }); -var cd = Tt((_e) => { +var uf = Tt((_e) => { "use strict"; - var ou = Symbol.for("react.element"), au = Symbol.for("react.portal"), is = Symbol.for("react.fragment"), os = Symbol.for("react.strict_mode"), as = Symbol.for("react.profiler"), ss = Symbol.for("react.provider"), ls = Symbol.for("react.context"), cb = Symbol.for("react.server_context"), us = Symbol.for("react.forward_ref"), cs = Symbol.for("react.suspense"), ps = Symbol.for("react.suspense_list"), ds = Symbol.for("react.memo"), fs = Symbol.for("react.lazy"), pb = Symbol.for("react.offscreen"), ud; - ud = Symbol.for("react.module.reference"); + var Gu = Symbol.for("react.element"), ju = Symbol.for("react.portal"), zs = Symbol.for("react.fragment"), Rs = Symbol.for("react.strict_mode"), Ds = Symbol.for("react.profiler"), ks = Symbol.for("react.provider"), Ns = Symbol.for("react.context"), Sb = Symbol.for("react.server_context"), _s = Symbol.for("react.forward_ref"), Ls = Symbol.for("react.suspense"), Gs = Symbol.for("react.suspense_list"), js = Symbol.for("react.memo"), Hs = Symbol.for("react.lazy"), Tb = Symbol.for("react.offscreen"), lf; + lf = Symbol.for("react.module.reference"); function xr(t) { if (typeof t == "object" && t !== null) { var r = t.$$typeof; switch (r) { - case ou: + case Gu: switch (t = t.type, t) { - case is: - case as: - case os: - case cs: - case ps: + case zs: + case Ds: + case Rs: + case Ls: + case Gs: return t; default: switch (t = t && t.$$typeof, t) { - case cb: - case ls: - case us: - case fs: - case ds: - case ss: + case Sb: + case Ns: + case _s: + case Hs: + case js: + case ks: return t; default: return r; } } - case au: + case ju: return r; } } } __name(xr, "xr"); u(xr, "v"); - _e.ContextConsumer = ls; - _e.ContextProvider = ss; - _e.Element = ou; - _e.ForwardRef = us; - _e.Fragment = is; - _e.Lazy = fs; - _e.Memo = ds; - _e.Portal = au; - _e.Profiler = as; - _e.StrictMode = os; - _e.Suspense = cs; - _e.SuspenseList = ps; + _e.ContextConsumer = Ns; + _e.ContextProvider = ks; + _e.Element = Gu; + _e.ForwardRef = _s; + _e.Fragment = zs; + _e.Lazy = Hs; + _e.Memo = js; + _e.Portal = ju; + _e.Profiler = Ds; + _e.StrictMode = Rs; + _e.Suspense = Ls; + _e.SuspenseList = Gs; _e.isAsyncMode = function() { return false; }; @@ -620,71 +620,71 @@ var cd = Tt((_e) => { return false; }; _e.isContextConsumer = function(t) { - return xr(t) === ls; + return xr(t) === Ns; }; _e.isContextProvider = function(t) { - return xr(t) === ss; + return xr(t) === ks; }; _e.isElement = function(t) { - return typeof t == "object" && t !== null && t.$$typeof === ou; + return typeof t == "object" && t !== null && t.$$typeof === Gu; }; _e.isForwardRef = function(t) { - return xr(t) === us; + return xr(t) === _s; }; _e.isFragment = function(t) { - return xr(t) === is; + return xr(t) === zs; }; _e.isLazy = function(t) { - return xr(t) === fs; + return xr(t) === Hs; }; _e.isMemo = function(t) { - return xr(t) === ds; + return xr(t) === js; }; _e.isPortal = function(t) { - return xr(t) === au; + return xr(t) === ju; }; _e.isProfiler = function(t) { - return xr(t) === as; + return xr(t) === Ds; }; _e.isStrictMode = function(t) { - return xr(t) === os; + return xr(t) === Rs; }; _e.isSuspense = function(t) { - return xr(t) === cs; + return xr(t) === Ls; }; _e.isSuspenseList = function(t) { - return xr(t) === ps; + return xr(t) === Gs; }; _e.isValidElementType = function(t) { - return typeof t == "string" || typeof t == "function" || t === is || t === as || t === os || t === cs || t === ps || t === pb || typeof t == "object" && t !== null && (t.$$typeof === fs || t.$$typeof === ds || t.$$typeof === ss || t.$$typeof === ls || t.$$typeof === us || t.$$typeof === ud || t.getModuleId !== void 0); + return typeof t == "string" || typeof t == "function" || t === zs || t === Ds || t === Rs || t === Ls || t === Gs || t === Tb || typeof t == "object" && t !== null && (t.$$typeof === Hs || t.$$typeof === js || t.$$typeof === ks || t.$$typeof === Ns || t.$$typeof === _s || t.$$typeof === lf || t.getModuleId !== void 0); }; _e.typeOf = xr; }); -var dd = Tt((dw, pd) => { +var pf = Tt((qE, cf) => { "use strict"; - pd.exports = cd(); + cf.exports = uf(); }); -var bd = Tt((Cn) => { +var gf = Tt((An) => { "use strict"; - Object.defineProperty(Cn, "__esModule", { value: true }); - Cn.test = Cn.serialize = Cn.default = void 0; - var Qn = db(dd()), hs = rs(); - function hd(t) { + Object.defineProperty(An, "__esModule", { value: true }); + An.test = An.serialize = An.default = void 0; + var oi = Cb(pf()), $s = As(); + function ff(t) { if (typeof WeakMap != "function") return null; var r = /* @__PURE__ */ new WeakMap(), e = /* @__PURE__ */ new WeakMap(); - return (hd = u(function(n) { + return (ff = u(function(n) { return n ? e : r; }, "_getRequireWildcardCache"))(t); } - __name(hd, "hd"); - u(hd, "_getRequireWildcardCache"); - function db(t, r) { + __name(ff, "ff"); + u(ff, "_getRequireWildcardCache"); + function Cb(t, r) { if (!r && t && t.__esModule) return t; if (t === null || typeof t != "object" && typeof t != "function") return { default: t }; - var e = hd(r); + var e = ff(r); if (e && e.has(t)) return e.get(t); var n = {}, s = Object.defineProperty && Object.getOwnPropertyDescriptor; @@ -695,114 +695,114 @@ var bd = Tt((Cn) => { } return n.default = t, e && e.set(t, n), n; } - __name(db, "db"); - u(db, "_interopRequireWildcard"); - var md = u((t, r = []) => (Array.isArray(t) ? t.forEach((e) => { - md(e, r); - }) : t != null && t !== false && r.push(t), r), "getChildren"), fd = u((t) => { + __name(Cb, "Cb"); + u(Cb, "_interopRequireWildcard"); + var hf = u((t, r = []) => (Array.isArray(t) ? t.forEach((e) => { + hf(e, r); + }) : t != null && t !== false && r.push(t), r), "getChildren"), df = u((t) => { let r = t.type; if (typeof r == "string") return r; if (typeof r == "function") return r.displayName || r.name || "Unknown"; - if (Qn.isFragment(t)) + if (oi.isFragment(t)) return "React.Fragment"; - if (Qn.isSuspense(t)) + if (oi.isSuspense(t)) return "React.Suspense"; if (typeof r == "object" && r !== null) { - if (Qn.isContextProvider(t)) + if (oi.isContextProvider(t)) return "Context.Provider"; - if (Qn.isContextConsumer(t)) + if (oi.isContextConsumer(t)) return "Context.Consumer"; - if (Qn.isForwardRef(t)) { + if (oi.isForwardRef(t)) { if (r.displayName) return r.displayName; let e = r.render.displayName || r.render.name || ""; return e !== "" ? `ForwardRef(${e})` : "ForwardRef"; } - if (Qn.isMemo(t)) { + if (oi.isMemo(t)) { let e = r.displayName || r.type.displayName || r.type.name || ""; return e !== "" ? `Memo(${e})` : "Memo"; } } return "UNDEFINED"; - }, "getType"), fb = u((t) => { + }, "getType"), Ob = u((t) => { let { props: r } = t; return Object.keys(r).filter((e) => e !== "children" && r[e] !== void 0).sort(); - }, "getPropKeys"), vd = u((t, r, e, n, s, a) => ++n > r.maxDepth ? (0, hs.printElementAsLeaf)(fd(t), r) : (0, hs.printElement)(fd(t), (0, hs.printProps)(fb(t), t.props, r, e + r.indent, n, s, a), (0, hs.printChildren)(md(t.props.children), r, e + r.indent, n, s, a), r, e), "serialize"); - Cn.serialize = vd; - var gd = u((t) => t != null && Qn.isElement(t), "test"); - Cn.test = gd; - var hb = { serialize: vd, test: gd }, mb = hb; - Cn.default = mb; + }, "getPropKeys"), mf = u((t, r, e, n, s, a) => ++n > r.maxDepth ? (0, $s.printElementAsLeaf)(df(t), r) : (0, $s.printElement)(df(t), (0, $s.printProps)(Ob(t), t.props, r, e + r.indent, n, s, a), (0, $s.printChildren)(hf(t.props.children), r, e + r.indent, n, s, a), r, e), "serialize"); + An.serialize = mf; + var vf = u((t) => t != null && oi.isElement(t), "test"); + An.test = vf; + var Mb = { serialize: mf, test: vf }, Ib = Mb; + An.default = Ib; }); -var xd = Tt((On) => { +var wf = Tt((Pn) => { "use strict"; - Object.defineProperty(On, "__esModule", { value: true }); - On.test = On.serialize = On.default = void 0; - var ms = rs(), su = globalThis["jest-symbol-do-not-touch"] || globalThis.Symbol, vb = typeof su == "function" && su.for ? su.for("react.test.json") : 245830487, gb = u((t) => { + Object.defineProperty(Pn, "__esModule", { value: true }); + Pn.test = Pn.serialize = Pn.default = void 0; + var Bs = As(), Hu = globalThis["jest-symbol-do-not-touch"] || globalThis.Symbol, Ab = typeof Hu == "function" && Hu.for ? Hu.for("react.test.json") : 245830487, Pb = u((t) => { let { props: r } = t; return r ? Object.keys(r).filter((e) => r[e] !== void 0).sort() : []; - }, "getPropKeys"), yd = u((t, r, e, n, s, a) => ++n > r.maxDepth ? (0, ms.printElementAsLeaf)(t.type, r) : (0, ms.printElement)(t.type, t.props ? (0, ms.printProps)(gb(t), t.props, r, e + r.indent, n, s, a) : "", t.children ? (0, ms.printChildren)(t.children, r, e + r.indent, n, s, a) : "", r, e), "serialize"); - On.serialize = yd; - var wd = u((t) => t && t.$$typeof === vb, "test"); - On.test = wd; - var bb = { serialize: yd, test: wd }, yb = bb; - On.default = yb; + }, "getPropKeys"), bf = u((t, r, e, n, s, a) => ++n > r.maxDepth ? (0, Bs.printElementAsLeaf)(t.type, r) : (0, Bs.printElement)(t.type, t.props ? (0, Bs.printProps)(Pb(t), t.props, r, e + r.indent, n, s, a) : "", t.children ? (0, Bs.printChildren)(t.children, r, e + r.indent, n, s, a) : "", r, e), "serialize"); + Pn.serialize = bf; + var yf = u((t) => t && t.$$typeof === Ab, "test"); + Pn.test = yf; + var zb = { serialize: bf, test: yf }, Rb = zb; + Pn.default = Rb; }); -var on = Tt((nn) => { +var Rn = Tt((an) => { "use strict"; - Object.defineProperty(nn, "__esModule", { value: true }); - nn.default = nn.DEFAULT_OPTIONS = void 0; - nn.format = _d; - nn.plugins = void 0; - var wb = ei(jp()), Po = Mo(), xb = ei(qp()), Eb = ei(Yp()), Sb = ei(nd()), Tb = ei(ld()), Cb = ei(bd()), Ob = ei(xd()); - function ei(t) { + Object.defineProperty(an, "__esModule", { value: true }); + an.default = an.DEFAULT_OPTIONS = void 0; + an.format = Nf; + an.plugins = void 0; + var Db = ai(Ld()), Vo = Fo(), kb = ai($d()), Nb = ai(Wd()), _b = ai(tf()), Lb = ai(sf()), Gb = ai(gf()), jb = ai(wf()); + function ai(t) { return t && t.__esModule ? t : { default: t }; } - __name(ei, "ei"); - u(ei, "_interopRequireDefault"); - var Md = Object.prototype.toString, Mb = Date.prototype.toISOString, Ib = Error.prototype.toString, Ed = RegExp.prototype.toString, lu = u((t) => typeof t.constructor == "function" && t.constructor.name || "Object", "getConstructorName"), Ab = u((t) => typeof window != "undefined" && t === window, "isWindow"), Pb = /^Symbol\((.*)\)(.*)$/, zb = /\n/gi, cu = class cu extends Error { + __name(ai, "ai"); + u(ai, "_interopRequireDefault"); + var Of = Object.prototype.toString, Hb = Date.prototype.toISOString, $b = Error.prototype.toString, xf = RegExp.prototype.toString, $u = u((t) => typeof t.constructor == "function" && t.constructor.name || "Object", "getConstructorName"), Bb = u((t) => typeof window != "undefined" && t === window, "isWindow"), qb = /^Symbol\((.*)\)(.*)$/, Fb = /\n/gi, qu = class qu extends Error { static { - __name(this, "cu"); + __name(this, "qu"); } constructor(r, e) { super(r), this.stack = e, this.name = this.constructor.name; } }; - u(cu, "PrettyFormatPluginError"); - var vs = cu; - function Rb(t) { + u(qu, "PrettyFormatPluginError"); + var qs = qu; + function Ub(t) { return t === "[object Array]" || t === "[object ArrayBuffer]" || t === "[object DataView]" || t === "[object Float32Array]" || t === "[object Float64Array]" || t === "[object Int8Array]" || t === "[object Int16Array]" || t === "[object Int32Array]" || t === "[object Uint8Array]" || t === "[object Uint8ClampedArray]" || t === "[object Uint16Array]" || t === "[object Uint32Array]"; } - __name(Rb, "Rb"); - u(Rb, "isToStringedArrayType"); - function Db(t) { + __name(Ub, "Ub"); + u(Ub, "isToStringedArrayType"); + function Wb(t) { return Object.is(t, -0) ? "-0" : String(t); } - __name(Db, "Db"); - u(Db, "printNumber"); - function kb(t) { + __name(Wb, "Wb"); + u(Wb, "printNumber"); + function Vb(t) { return `${t}n`; } - __name(kb, "kb"); - u(kb, "printBigInt"); - function Sd(t, r) { + __name(Vb, "Vb"); + u(Vb, "printBigInt"); + function Ef(t, r) { return r ? `[Function ${t.name || "anonymous"}]` : "[Function]"; } - __name(Sd, "Sd"); - u(Sd, "printFunction"); - function Td(t) { - return String(t).replace(Pb, "Symbol($1)"); + __name(Ef, "Ef"); + u(Ef, "printFunction"); + function Sf(t) { + return String(t).replace(qb, "Symbol($1)"); } - __name(Td, "Td"); - u(Td, "printSymbol"); - function Cd(t) { - return `[${Ib.call(t)}]`; + __name(Sf, "Sf"); + u(Sf, "printSymbol"); + function Tf(t) { + return `[${$b.call(t)}]`; } - __name(Cd, "Cd"); - u(Cd, "printError"); - function Id(t, r, e, n) { + __name(Tf, "Tf"); + u(Tf, "printError"); + function Mf(t, r, e, n) { if (t === true || t === false) return `${t}`; if (t === void 0) @@ -811,78 +811,78 @@ var on = Tt((nn) => { return "null"; let s = typeof t; if (s === "number") - return Db(t); + return Wb(t); if (s === "bigint") - return kb(t); + return Vb(t); if (s === "string") return n ? `"${t.replace(/"|\\/g, "\\$&")}"` : `"${t}"`; if (s === "function") - return Sd(t, r); + return Ef(t, r); if (s === "symbol") - return Td(t); - let a = Md.call(t); - return a === "[object WeakMap]" ? "WeakMap {}" : a === "[object WeakSet]" ? "WeakSet {}" : a === "[object Function]" || a === "[object GeneratorFunction]" ? Sd(t, r) : a === "[object Symbol]" ? Td(t) : a === "[object Date]" ? isNaN(+t) ? "Date { NaN }" : Mb.call(t) : a === "[object Error]" ? Cd(t) : a === "[object RegExp]" ? e ? Ed.call(t).replace(/[\\^$*+?.()|[\]{}]/g, "\\$&") : Ed.call(t) : t instanceof Error ? Cd(t) : null; + return Sf(t); + let a = Of.call(t); + return a === "[object WeakMap]" ? "WeakMap {}" : a === "[object WeakSet]" ? "WeakSet {}" : a === "[object Function]" || a === "[object GeneratorFunction]" ? Ef(t, r) : a === "[object Symbol]" ? Sf(t) : a === "[object Date]" ? isNaN(+t) ? "Date { NaN }" : Hb.call(t) : a === "[object Error]" ? Tf(t) : a === "[object RegExp]" ? e ? xf.call(t).replace(/[\\^$*+?.()|[\]{}]/g, "\\$&") : xf.call(t) : t instanceof Error ? Tf(t) : null; } - __name(Id, "Id"); - u(Id, "printBasicValue"); - function Ad(t, r, e, n, s, a) { + __name(Mf, "Mf"); + u(Mf, "printBasicValue"); + function If(t, r, e, n, s, a) { if (s.indexOf(t) !== -1) return "[Circular]"; s = s.slice(), s.push(t); let p = ++n > r.maxDepth, v = r.min; if (r.callToJSON && !p && t.toJSON && typeof t.toJSON == "function" && !a) - return Mn(t.toJSON(), r, e, n, s, true); - let m = Md.call(t); - return m === "[object Arguments]" ? p ? "[Arguments]" : `${v ? "" : "Arguments "}[${(0, Po.printListItems)(t, r, e, n, s, Mn)}]` : Rb(m) ? p ? `[${t.constructor.name}]` : `${v || !r.printBasicPrototype && t.constructor.name === "Array" ? "" : `${t.constructor.name} `}[${(0, Po.printListItems)(t, r, e, n, s, Mn)}]` : m === "[object Map]" ? p ? "[Map]" : `Map {${(0, Po.printIteratorEntries)(t.entries(), r, e, n, s, Mn, " => ")}}` : m === "[object Set]" ? p ? "[Set]" : `Set {${(0, Po.printIteratorValues)(t.values(), r, e, n, s, Mn)}}` : p || Ab(t) ? `[${lu(t)}]` : `${v || !r.printBasicPrototype && lu(t) === "Object" ? "" : `${lu(t)} `}{${(0, Po.printObjectProperties)(t, r, e, n, s, Mn)}}`; + return zn(t.toJSON(), r, e, n, s, true); + let m = Of.call(t); + return m === "[object Arguments]" ? p ? "[Arguments]" : `${v ? "" : "Arguments "}[${(0, Vo.printListItems)(t, r, e, n, s, zn)}]` : Ub(m) ? p ? `[${t.constructor.name}]` : `${v || !r.printBasicPrototype && t.constructor.name === "Array" ? "" : `${t.constructor.name} `}[${(0, Vo.printListItems)(t, r, e, n, s, zn)}]` : m === "[object Map]" ? p ? "[Map]" : `Map {${(0, Vo.printIteratorEntries)(t.entries(), r, e, n, s, zn, " => ")}}` : m === "[object Set]" ? p ? "[Set]" : `Set {${(0, Vo.printIteratorValues)(t.values(), r, e, n, s, zn)}}` : p || Bb(t) ? `[${$u(t)}]` : `${v || !r.printBasicPrototype && $u(t) === "Object" ? "" : `${$u(t)} `}{${(0, Vo.printObjectProperties)(t, r, e, n, s, zn)}}`; } - __name(Ad, "Ad"); - u(Ad, "printComplexValue"); - function Nb(t) { + __name(If, "If"); + u(If, "printComplexValue"); + function Yb(t) { return t.serialize != null; } - __name(Nb, "Nb"); - u(Nb, "isNewPlugin"); - function Pd(t, r, e, n, s, a) { + __name(Yb, "Yb"); + u(Yb, "isNewPlugin"); + function Af(t, r, e, n, s, a) { let p; try { - p = Nb(t) ? t.serialize(r, e, n, s, a, Mn) : t.print(r, (v) => Mn(v, e, n, s, a), (v) => { + p = Yb(t) ? t.serialize(r, e, n, s, a, zn) : t.print(r, (v) => zn(v, e, n, s, a), (v) => { let m = n + e.indent; - return m + v.replace(zb, ` + return m + v.replace(Fb, ` ${m}`); }, { edgeSpacing: e.spacingOuter, min: e.min, spacing: e.spacingInner }, e.colors); } catch (v) { - throw new vs(v.message, v.stack); + throw new qs(v.message, v.stack); } if (typeof p != "string") throw new Error(`pretty-format: Plugin must return type "string" but instead returned "${typeof p}".`); return p; } - __name(Pd, "Pd"); - u(Pd, "printPlugin"); - function zd(t, r) { + __name(Af, "Af"); + u(Af, "printPlugin"); + function Pf(t, r) { for (let e = 0; e < t.length; e++) try { if (t[e].test(r)) return t[e]; } catch (n) { - throw new vs(n.message, n.stack); + throw new qs(n.message, n.stack); } return null; } - __name(zd, "zd"); - u(zd, "findPlugin"); - function Mn(t, r, e, n, s, a) { - let p = zd(r.plugins, t); + __name(Pf, "Pf"); + u(Pf, "findPlugin"); + function zn(t, r, e, n, s, a) { + let p = Pf(r.plugins, t); if (p !== null) - return Pd(p, t, r, e, n, s); - let v = Id(t, r.printFunctionName, r.escapeRegex, r.escapeString); - return v !== null ? v : Ad(t, r, e, n, s, a); - } - __name(Mn, "Mn"); - u(Mn, "printer"); - var uu = { comment: "gray", content: "reset", prop: "yellow", tag: "cyan", value: "green" }, Rd = Object.keys(uu), _b = u((t) => t, "toOptionsSubtype"), Er = _b({ callToJSON: true, compareKeys: void 0, escapeRegex: false, escapeString: true, highlight: false, indent: 2, maxDepth: 1 / 0, maxWidth: 1 / 0, min: false, plugins: [], printBasicPrototype: true, printFunctionName: true, theme: uu }); - nn.DEFAULT_OPTIONS = Er; - function Lb(t) { + return Af(p, t, r, e, n, s); + let v = Mf(t, r.printFunctionName, r.escapeRegex, r.escapeString); + return v !== null ? v : If(t, r, e, n, s, a); + } + __name(zn, "zn"); + u(zn, "printer"); + var Bu = { comment: "gray", content: "reset", prop: "yellow", tag: "cyan", value: "green" }, zf = Object.keys(Bu), Xb = u((t) => t, "toOptionsSubtype"), Er = Xb({ callToJSON: true, compareKeys: void 0, escapeRegex: false, escapeString: true, highlight: false, indent: 2, maxDepth: 1 / 0, maxWidth: 1 / 0, min: false, plugins: [], printBasicPrototype: true, printFunctionName: true, theme: Bu }); + an.DEFAULT_OPTIONS = Er; + function Zb(t) { if (Object.keys(t).forEach((r) => { if (!Object.prototype.hasOwnProperty.call(Er, r)) throw new Error(`pretty-format: Unknown option "${r}".`); @@ -895,54 +895,54 @@ ${m}`); throw new Error(`pretty-format: Option "theme" must be of type "object" but instead received "${typeof t.theme}".`); } } - __name(Lb, "Lb"); - u(Lb, "validateOptions"); - var Gb = u((t) => Rd.reduce((r, e) => { - let n = t.theme && t.theme[e] !== void 0 ? t.theme[e] : uu[e], s = n && wb.default[n]; + __name(Zb, "Zb"); + u(Zb, "validateOptions"); + var Kb = u((t) => zf.reduce((r, e) => { + let n = t.theme && t.theme[e] !== void 0 ? t.theme[e] : Bu[e], s = n && Db.default[n]; if (s && typeof s.close == "string" && typeof s.open == "string") r[e] = s; else throw new Error(`pretty-format: Option "theme" has a key "${e}" whose value "${n}" is undefined in ansi-styles.`); return r; - }, /* @__PURE__ */ Object.create(null)), "getColorsHighlight"), jb = u(() => Rd.reduce((t, r) => (t[r] = { close: "", open: "" }, t), /* @__PURE__ */ Object.create(null)), "getColorsEmpty"), Dd = u((t) => { + }, /* @__PURE__ */ Object.create(null)), "getColorsHighlight"), Jb = u(() => zf.reduce((t, r) => (t[r] = { close: "", open: "" }, t), /* @__PURE__ */ Object.create(null)), "getColorsEmpty"), Rf = u((t) => { var r; return (r = t == null ? void 0 : t.printFunctionName) != null ? r : Er.printFunctionName; - }, "getPrintFunctionName"), kd = u((t) => { + }, "getPrintFunctionName"), Df = u((t) => { var r; return (r = t == null ? void 0 : t.escapeRegex) != null ? r : Er.escapeRegex; - }, "getEscapeRegex"), Nd = u((t) => { + }, "getEscapeRegex"), kf = u((t) => { var r; return (r = t == null ? void 0 : t.escapeString) != null ? r : Er.escapeString; - }, "getEscapeString"), Od = u((t) => { + }, "getEscapeString"), Cf = u((t) => { var r, e, n, s, a, p, v; - return { callToJSON: (r = t == null ? void 0 : t.callToJSON) != null ? r : Er.callToJSON, colors: t != null && t.highlight ? Gb(t) : jb(), compareKeys: typeof (t == null ? void 0 : t.compareKeys) == "function" || (t == null ? void 0 : t.compareKeys) === null ? t.compareKeys : Er.compareKeys, escapeRegex: kd(t), escapeString: Nd(t), indent: t != null && t.min ? "" : Hb((e = t == null ? void 0 : t.indent) != null ? e : Er.indent), maxDepth: (n = t == null ? void 0 : t.maxDepth) != null ? n : Er.maxDepth, maxWidth: (s = t == null ? void 0 : t.maxWidth) != null ? s : Er.maxWidth, min: (a = t == null ? void 0 : t.min) != null ? a : Er.min, plugins: (p = t == null ? void 0 : t.plugins) != null ? p : Er.plugins, printBasicPrototype: (v = t == null ? void 0 : t.printBasicPrototype) != null ? v : true, printFunctionName: Dd(t), spacingInner: t != null && t.min ? " " : ` + return { callToJSON: (r = t == null ? void 0 : t.callToJSON) != null ? r : Er.callToJSON, colors: t != null && t.highlight ? Kb(t) : Jb(), compareKeys: typeof (t == null ? void 0 : t.compareKeys) == "function" || (t == null ? void 0 : t.compareKeys) === null ? t.compareKeys : Er.compareKeys, escapeRegex: Df(t), escapeString: kf(t), indent: t != null && t.min ? "" : Qb((e = t == null ? void 0 : t.indent) != null ? e : Er.indent), maxDepth: (n = t == null ? void 0 : t.maxDepth) != null ? n : Er.maxDepth, maxWidth: (s = t == null ? void 0 : t.maxWidth) != null ? s : Er.maxWidth, min: (a = t == null ? void 0 : t.min) != null ? a : Er.min, plugins: (p = t == null ? void 0 : t.plugins) != null ? p : Er.plugins, printBasicPrototype: (v = t == null ? void 0 : t.printBasicPrototype) != null ? v : true, printFunctionName: Rf(t), spacingInner: t != null && t.min ? " " : ` `, spacingOuter: t != null && t.min ? "" : ` ` }; }, "getConfig"); - function Hb(t) { + function Qb(t) { return new Array(t + 1).join(" "); } - __name(Hb, "Hb"); - u(Hb, "createIndent"); - function _d(t, r) { - if (r && (Lb(r), r.plugins)) { - let n = zd(r.plugins, t); + __name(Qb, "Qb"); + u(Qb, "createIndent"); + function Nf(t, r) { + if (r && (Zb(r), r.plugins)) { + let n = Pf(r.plugins, t); if (n !== null) - return Pd(n, t, Od(r), "", 0, []); + return Af(n, t, Cf(r), "", 0, []); } - let e = Id(t, Dd(r), kd(r), Nd(r)); - return e !== null ? e : Ad(t, Od(r), "", 0, []); + let e = Mf(t, Rf(r), Df(r), kf(r)); + return e !== null ? e : If(t, Cf(r), "", 0, []); } - __name(_d, "_d"); - u(_d, "format"); - var Bb = { AsymmetricMatcher: xb.default, DOMCollection: Eb.default, DOMElement: Sb.default, Immutable: Tb.default, ReactElement: Cb.default, ReactTestComponent: Ob.default }; - nn.plugins = Bb; - var $b = _d; - nn.default = $b; + __name(Nf, "Nf"); + u(Nf, "format"); + var ey = { AsymmetricMatcher: kb.default, DOMCollection: Nb.default, DOMElement: _b.default, Immutable: Lb.default, ReactElement: Gb.default, ReactTestComponent: jb.default }; + an.plugins = ey; + var ty = Nf; + an.default = ty; }); -var Zo = Tt((Hf, Vu) => { +var Yo = Tt((_f, Fu) => { (function(t) { - typeof Hf == "object" && typeof Vu != "undefined" ? Vu.exports = t() : typeof define == "function" && define.amd ? define([], t) : (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this).interact = t(); + typeof _f == "object" && typeof Fu != "undefined" ? Fu.exports = t() : typeof define == "function" && define.amd ? define([], t) : (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this).interact = t(); })(function() { var t = {}; Object.defineProperty(t, "__esModule", { value: true }), t.default = void 0, t.default = function(i) { @@ -1044,13 +1044,13 @@ var Zo = Tt((Hf, Vu) => { u(_, "y"); var L = R; C.default = L; - var $ = {}; - Object.defineProperty($, "__esModule", { value: true }), $.default = void 0; + var B = {}; + Object.defineProperty(B, "__esModule", { value: true }), B.default = void 0; var A = { init: function(i) { var o = C.default.Element, l = i.navigator || {}; A.supportsTouch = "ontouchstart" in i || a.default.func(i.DocumentTouch) && C.default.document instanceof i.DocumentTouch, A.supportsPointerEvent = l.pointerEnabled !== false && !!C.default.PointerEvent, A.isIOS = /iP(hone|od|ad)/.test(l.platform), A.isIOS7 = /iP(hone|od|ad)/.test(l.platform) && /OS 7[^\d]/.test(l.appVersion), A.isIe9 = /MSIE 9/.test(l.userAgent), A.isOperaMobile = l.appName === "Opera" && A.supportsTouch && /Presto/.test(l.userAgent), A.prefixedMatchesSelector = "matches" in o.prototype ? "matches" : "webkitMatchesSelector" in o.prototype ? "webkitMatchesSelector" : "mozMatchesSelector" in o.prototype ? "mozMatchesSelector" : "oMatchesSelector" in o.prototype ? "oMatchesSelector" : "msMatchesSelector", A.pEventTypes = A.supportsPointerEvent ? C.default.PointerEvent === i.MSPointerEvent ? { up: "MSPointerUp", down: "MSPointerDown", over: "mouseover", out: "mouseout", move: "MSPointerMove", cancel: "MSPointerCancel" } : { up: "pointerup", down: "pointerdown", over: "pointerover", out: "pointerout", move: "pointermove", cancel: "pointercancel" } : null, A.wheelEvent = C.default.document && "onmousewheel" in C.default.document ? "mousewheel" : "wheel"; }, supportsTouch: null, supportsPointerEvent: null, isIOS7: null, isIOS: null, isIe9: null, isOperaMobile: null, prefixedMatchesSelector: null, pEventTypes: null, wheelEvent: null }, ee = A; - $.default = ee; + B.default = ee; var z = {}; function H(i) { var o = i.parentNode; @@ -1064,7 +1064,7 @@ var Zo = Tt((Hf, Vu) => { __name(H, "H"); u(H, "P"); function te(i, o) { - return r.window !== r.realWindow && (o = o.replace(/\/deep\//g, " ")), i[$.default.prefixedMatchesSelector](o); + return r.window !== r.realWindow && (o = o.replace(/\/deep\//g, " ")), i[B.default.prefixedMatchesSelector](o); } __name(te, "te"); u(te, "O"), Object.defineProperty(z, "__esModule", { value: true }), z.closest = function(i, o) { @@ -1078,7 +1078,7 @@ var Zo = Tt((Hf, Vu) => { return i.correspondingUseElement || i; }, z.getElementClientRect = ie, z.getElementRect = function(i) { var o = ie(i); - if (!$.default.isIOS7 && o) { + if (!B.default.isIOS7 && o) { var l = K(r.getWindow(i)); o.left += l.x, o.right += l.x, o.top += l.y, o.bottom += l.y; } @@ -1264,33 +1264,33 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return i; }; var J = {}; - function ar(i) { + function or(i) { return i instanceof C.default.Event || i instanceof C.default.Touch; } - __name(ar, "ar"); - u(ar, "B"); + __name(or, "or"); + u(or, "B"); function je(i, o, l) { return i = i || "page", (l = l || {}).x = o[i + "X"], l.y = o[i + "Y"], l; } __name(je, "je"); u(je, "Y"); function rt(i, o) { - return o = o || { x: 0, y: 0 }, $.default.isOperaMobile && ar(i) ? (je("screen", i, o), o.x += window.scrollX, o.y += window.scrollY) : je("page", i, o), o; + return o = o || { x: 0, y: 0 }, B.default.isOperaMobile && or(i) ? (je("screen", i, o), o.x += window.scrollX, o.y += window.scrollY) : je("page", i, o), o; } __name(rt, "rt"); u(rt, "W"); - function vr(i, o) { - return o = o || {}, $.default.isOperaMobile && ar(i) ? je("screen", i, o) : je("client", i, o), o; + function mr(i, o) { + return o = o || {}, B.default.isOperaMobile && or(i) ? je("screen", i, o) : je("client", i, o), o; } - __name(vr, "vr"); - u(vr, "L"); - function Ir(i) { + __name(mr, "mr"); + u(mr, "L"); + function Mr(i) { var o = []; return a.default.array(i) ? (o[0] = i[0], o[1] = i[1]) : i.type === "touchend" ? i.touches.length === 1 ? (o[0] = i.touches[0], o[1] = i.changedTouches[0]) : i.touches.length === 0 && (o[0] = i.changedTouches[0], o[1] = i.changedTouches[1]) : (o[0] = i.touches[0], o[1] = i.touches[1]), o; } - __name(Ir, "Ir"); - u(Ir, "U"); - function gr(i) { + __name(Mr, "Mr"); + u(Mr, "U"); + function vr(i) { for (var o = { pageX: 0, pageY: 0, clientX: 0, clientY: 0, screenX: 0, screenY: 0 }, l = 0; l < i.length; l++) { var c = i[l]; for (var h in o) @@ -1300,8 +1300,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho o[b] /= i.length; return o; } - __name(gr, "gr"); - u(gr, "V"), Object.defineProperty(J, "__esModule", { value: true }), J.coordsToEvent = function(i) { + __name(vr, "vr"); + u(vr, "V"), Object.defineProperty(J, "__esModule", { value: true }), J.coordsToEvent = function(i) { return { coords: i, get page() { return this.coords.page; }, get client() { @@ -1330,16 +1330,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } }; }, J.copyCoords = function(i, o) { i.page = i.page || {}, i.page.x = o.page.x, i.page.y = o.page.y, i.client = i.client || {}, i.client.x = o.client.x, i.client.y = o.client.y, i.timeStamp = o.timeStamp; - }, J.getClientXY = vr, J.getEventTargets = function(i) { + }, J.getClientXY = mr, J.getEventTargets = function(i) { var o = a.default.func(i.composedPath) ? i.composedPath() : i.path; return [z.getActualElement(o ? o[0] : i.target), z.getActualElement(i.currentTarget)]; }, J.getPageXY = rt, J.getPointerId = function(i) { return a.default.number(i.pointerId) ? i.pointerId : i.identifier; }, J.getPointerType = function(i) { return a.default.string(i.pointerType) ? i.pointerType : a.default.number(i.pointerType) ? [void 0, void 0, "touch", "pen", "mouse"][i.pointerType] : /touch/.test(i.type || "") || i instanceof C.default.Touch ? "touch" : "mouse"; - }, J.getTouchPair = Ir, J.getXY = je, J.isNativePointer = ar, J.newCoords = function() { + }, J.getTouchPair = Mr, J.getXY = je, J.isNativePointer = or, J.newCoords = function() { return { page: { x: 0, y: 0 }, client: { x: 0, y: 0 }, timeStamp: 0 }; - }, J.pointerAverage = gr, Object.defineProperty(J, "pointerExtend", { enumerable: true, get: function() { + }, J.pointerAverage = vr, Object.defineProperty(J, "pointerExtend", { enumerable: true, get: function() { return Ye.default; } }), J.setCoordDeltas = function(i, o, l) { i.page.x = l.page.x - o.page.x, i.page.y = l.page.y - o.page.y, i.client.x = l.client.x - o.client.x, i.client.y = l.client.y - o.client.y, i.timeStamp = l.timeStamp - o.timeStamp; @@ -1347,42 +1347,42 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho var l = Math.max(o.timeStamp / 1e3, 1e-3); i.page.x = o.page.x / l, i.page.y = o.page.y / l, i.client.x = o.client.x / l, i.client.y = o.client.y / l, i.timeStamp = l; }, J.setCoords = function(i, o, l) { - var c = o.length > 1 ? gr(o) : o[0]; - rt(c, i.page), vr(c, i.client), i.timeStamp = l; + var c = o.length > 1 ? vr(o) : o[0]; + rt(c, i.page), mr(c, i.client), i.timeStamp = l; }, J.setZeroCoords = function(i) { i.page.x = 0, i.page.y = 0, i.client.x = 0, i.client.y = 0; }, J.touchAngle = function(i, o) { - var l = o + "X", c = o + "Y", h = Ir(i), b = h[1][l] - h[0][l], E = h[1][c] - h[0][c]; + var l = o + "X", c = o + "Y", h = Mr(i), b = h[1][l] - h[0][l], E = h[1][c] - h[0][c]; return 180 * Math.atan2(E, b) / Math.PI; }, J.touchBBox = function(i) { if (!i.length) return null; - var o = Ir(i), l = Math.min(o[0].pageX, o[1].pageX), c = Math.min(o[0].pageY, o[1].pageY), h = Math.max(o[0].pageX, o[1].pageX), b = Math.max(o[0].pageY, o[1].pageY); + var o = Mr(i), l = Math.min(o[0].pageX, o[1].pageX), c = Math.min(o[0].pageY, o[1].pageY), h = Math.max(o[0].pageX, o[1].pageX), b = Math.max(o[0].pageY, o[1].pageY); return { x: l, y: c, left: l, top: c, right: h, bottom: b, width: h - l, height: b - c }; }, J.touchDistance = function(i, o) { - var l = o + "X", c = o + "Y", h = Ir(i), b = h[0][l] - h[1][l], E = h[0][c] - h[1][c]; + var l = o + "X", c = o + "Y", h = Mr(i), b = h[0][l] - h[1][l], E = h[0][c] - h[1][c]; return (0, Je.default)(b, E); }; - var sr = {}; - function _r(i, o) { + var ar = {}; + function Nr(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(_r, "_r"); - u(_r, "q"); - function Yr(i, o, l) { + __name(Nr, "Nr"); + u(Nr, "q"); + function Vr(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } - __name(Yr, "Yr"); - u(Yr, "G"), Object.defineProperty(sr, "__esModule", { value: true }), sr.BaseEvent = void 0; - var Ln = function() { + __name(Vr, "Vr"); + u(Vr, "G"), Object.defineProperty(ar, "__esModule", { value: true }), ar.BaseEvent = void 0; + var _n = function() { function i(c) { (function(h, b) { if (!(h instanceof b)) throw new TypeError("Cannot call a class as a function"); - })(this, i), Yr(this, "immediatePropagationStopped", false), Yr(this, "propagationStopped", false), this._interaction = c; + })(this, i), Vr(this, "immediatePropagationStopped", false), Vr(this, "propagationStopped", false), this._interaction = c; } __name(i, "i"); u(i, "t"); @@ -1392,9 +1392,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho this.propagationStopped = true; } }, { key: "stopImmediatePropagation", value: function() { this.immediatePropagationStopped = this.propagationStopped = true; - } }]) && _r(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; + } }]) && Nr(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; }(); - sr.BaseEvent = Ln, Object.defineProperty(Ln.prototype, "interaction", { get: function() { + ar.BaseEvent = _n, Object.defineProperty(_n.prototype, "interaction", { get: function() { return this._interaction._proxy; }, set: function() { } }); @@ -1404,59 +1404,59 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }, Pe.remove = function(i, o) { return i.splice(i.indexOf(o), 1); }; - var Gn = u(function(i, o) { + var Ln = u(function(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; i.push(c); } return i; }, "K"); - Pe.merge = Gn, Pe.from = function(i) { - return Gn([], i); + Pe.merge = Ln, Pe.from = function(i) { + return Ln([], i); }; - var jn = u(function(i, o) { + var Gn = u(function(i, o) { for (var l = 0; l < i.length; l++) if (o(i[l], l, i)) return l; return -1; }, "Z"); - Pe.findIndex = jn, Pe.find = function(i, o) { - return i[jn(i, o)]; + Pe.findIndex = Gn, Pe.find = function(i, o) { + return i[Gn(i, o)]; }; - var _t = {}; - function Xr(i) { - return Xr = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { + var Nt = {}; + function Yr(i) { + return Yr = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { return typeof o; } : function(o) { return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; - }, Xr(i); + }, Yr(i); } - __name(Xr, "Xr"); - u(Xr, "Q"); - function xi(i, o) { + __name(Yr, "Yr"); + u(Yr, "Q"); + function wi(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(xi, "xi"); - u(xi, "tt"); - function mn(i, o) { - return mn = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, c) { + __name(wi, "wi"); + u(wi, "tt"); + function fn(i, o) { + return fn = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, c) { return l.__proto__ = c, l; - }, mn(i, o); + }, fn(i, o); } - __name(mn, "mn"); - u(mn, "et"); - function Ar(i, o) { - if (o && (Xr(o) === "object" || typeof o == "function")) + __name(fn, "fn"); + u(fn, "et"); + function Ir(i, o) { + if (o && (Yr(o) === "object" || typeof o == "function")) return o; if (o !== void 0) throw new TypeError("Derived constructors may only return object or undefined"); return Mt(i); } - __name(Ar, "Ar"); - u(Ar, "nt"); + __name(Ir, "Ir"); + u(Ir, "nt"); function Mt(i) { if (i === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); @@ -1464,23 +1464,23 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } __name(Mt, "Mt"); u(Mt, "rt"); - function Lr(i) { - return Lr = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) { + function _r(i) { + return _r = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) { return o.__proto__ || Object.getPrototypeOf(o); - }, Lr(i); + }, _r(i); } - __name(Lr, "Lr"); - u(Lr, "ot"); - function er(i, o, l) { + __name(_r, "_r"); + u(_r, "ot"); + function Jt(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } - __name(er, "er"); - u(er, "it"), Object.defineProperty(_t, "__esModule", { value: true }), _t.DropEvent = void 0; - var Hn = function(i) { + __name(Jt, "Jt"); + u(Jt, "it"), Object.defineProperty(Nt, "__esModule", { value: true }), Nt.DropEvent = void 0; + var jn = function(i) { (function(y, x) { if (typeof x != "function" && x !== null) throw new TypeError("Super expression must either be null or a function"); - y.prototype = Object.create(x && x.prototype, { constructor: { value: y, writable: true, configurable: true } }), Object.defineProperty(y, "prototype", { writable: false }), x && mn(y, x); + y.prototype = Object.create(x && x.prototype, { constructor: { value: y, writable: true, configurable: true } }), Object.defineProperty(y, "prototype", { writable: false }), x && fn(y, x); })(E, i); var o, l, c, h, b = (c = E, h = function() { if (typeof Reflect == "undefined" || !Reflect.construct || Reflect.construct.sham) @@ -1494,20 +1494,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return false; } }(), function() { - var y, x = Lr(c); + var y, x = _r(c); if (h) { - var O = Lr(this).constructor; + var O = _r(this).constructor; y = Reflect.construct(x, arguments, O); } else y = x.apply(this, arguments); - return Ar(this, y); + return Ir(this, y); }); function E(y, x, O) { var I; (function(D, F) { if (!(D instanceof F)) throw new TypeError("Cannot call a class as a function"); - })(this, E), er(Mt(I = b.call(this, x._interaction)), "dropzone", void 0), er(Mt(I), "dragEvent", void 0), er(Mt(I), "relatedTarget", void 0), er(Mt(I), "draggable", void 0), er(Mt(I), "propagationStopped", false), er(Mt(I), "immediatePropagationStopped", false); + })(this, E), Jt(Mt(I = b.call(this, x._interaction)), "dropzone", void 0), Jt(Mt(I), "dragEvent", void 0), Jt(Mt(I), "relatedTarget", void 0), Jt(Mt(I), "draggable", void 0), Jt(Mt(I), "propagationStopped", false), Jt(Mt(I), "immediatePropagationStopped", false); var P = O === "dragleave" ? y.prev : y.cur, N = P.element, j = P.dropzone; return I.type = O, I.target = N, I.currentTarget = N, I.dropzone = j, I.dragEvent = x, I.relatedTarget = x.target, I.draggable = x.interactable, I.timeStamp = x.timeStamp, I; } @@ -1530,19 +1530,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho this.propagationStopped = true; } }, { key: "stopImmediatePropagation", value: function() { this.immediatePropagationStopped = this.propagationStopped = true; - } }]) && xi(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), E; - }(sr.BaseEvent); - _t.DropEvent = Hn; - var Zr = {}; - function Bn(i, o) { + } }]) && wi(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), E; + }(ar.BaseEvent); + Nt.DropEvent = jn; + var Xr = {}; + function Hn(i, o) { for (var l = 0; l < i.slice().length; l++) { var c = i.slice()[l], h = c.dropzone, b = c.element; o.dropzone = h, o.target = b, h.fire(o), o.propagationStopped = o.immediatePropagationStopped = false; } } - __name(Bn, "Bn"); - u(Bn, "lt"); - function vn(i, o) { + __name(Hn, "Hn"); + u(Hn, "lt"); + function hn(i, o) { for (var l = function(b, E) { for (var y = b.interactables, x = [], O = 0; O < y.list.length; O++) { var I = y.list[O]; @@ -1562,8 +1562,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } return l; } - __name(vn, "vn"); - u(vn, "ut"); + __name(hn, "hn"); + u(hn, "ut"); function $n(i, o, l) { for (var c = i.dropState, h = i.interactable, b = i.element, E = [], y = 0; y < c.activeDrops.length; y++) { var x = c.activeDrops[y], O = x.dropzone, I = x.element, P = x.rect; @@ -1574,30 +1574,30 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } __name($n, "$n"); u($n, "ct"); - function ao(i, o, l) { + function oo(i, o, l) { var c = i.dropState, h = { enter: null, leave: null, activate: null, deactivate: null, move: null, drop: null }; - return l.type === "dragstart" && (h.activate = new _t.DropEvent(c, l, "dropactivate"), h.activate.target = null, h.activate.dropzone = null), l.type === "dragend" && (h.deactivate = new _t.DropEvent(c, l, "dropdeactivate"), h.deactivate.target = null, h.deactivate.dropzone = null), c.rejected || (c.cur.element !== c.prev.element && (c.prev.dropzone && (h.leave = new _t.DropEvent(c, l, "dragleave"), l.dragLeave = h.leave.target = c.prev.element, l.prevDropzone = h.leave.dropzone = c.prev.dropzone), c.cur.dropzone && (h.enter = new _t.DropEvent(c, l, "dragenter"), l.dragEnter = c.cur.element, l.dropzone = c.cur.dropzone)), l.type === "dragend" && c.cur.dropzone && (h.drop = new _t.DropEvent(c, l, "drop"), l.dropzone = c.cur.dropzone, l.relatedTarget = c.cur.element), l.type === "dragmove" && c.cur.dropzone && (h.move = new _t.DropEvent(c, l, "dropmove"), h.move.dragmove = l, l.dropzone = c.cur.dropzone)), h; + return l.type === "dragstart" && (h.activate = new Nt.DropEvent(c, l, "dropactivate"), h.activate.target = null, h.activate.dropzone = null), l.type === "dragend" && (h.deactivate = new Nt.DropEvent(c, l, "dropdeactivate"), h.deactivate.target = null, h.deactivate.dropzone = null), c.rejected || (c.cur.element !== c.prev.element && (c.prev.dropzone && (h.leave = new Nt.DropEvent(c, l, "dragleave"), l.dragLeave = h.leave.target = c.prev.element, l.prevDropzone = h.leave.dropzone = c.prev.dropzone), c.cur.dropzone && (h.enter = new Nt.DropEvent(c, l, "dragenter"), l.dragEnter = c.cur.element, l.dropzone = c.cur.dropzone)), l.type === "dragend" && c.cur.dropzone && (h.drop = new Nt.DropEvent(c, l, "drop"), l.dropzone = c.cur.dropzone, l.relatedTarget = c.cur.element), l.type === "dragmove" && c.cur.dropzone && (h.move = new Nt.DropEvent(c, l, "dropmove"), h.move.dragmove = l, l.dropzone = c.cur.dropzone)), h; } - __name(ao, "ao"); - u(ao, "ft"); - function so(i, o) { + __name(oo, "oo"); + u(oo, "ft"); + function ao(i, o) { var l = i.dropState, c = l.activeDrops, h = l.cur, b = l.prev; - o.leave && b.dropzone.fire(o.leave), o.enter && h.dropzone.fire(o.enter), o.move && h.dropzone.fire(o.move), o.drop && h.dropzone.fire(o.drop), o.deactivate && Bn(c, o.deactivate), l.prev.dropzone = h.dropzone, l.prev.element = h.element; + o.leave && b.dropzone.fire(o.leave), o.enter && h.dropzone.fire(o.enter), o.move && h.dropzone.fire(o.move), o.drop && h.dropzone.fire(o.drop), o.deactivate && Hn(c, o.deactivate), l.prev.dropzone = h.dropzone, l.prev.element = h.element; } - __name(so, "so"); - u(so, "dt"); - function ya(i, o) { + __name(ao, "ao"); + u(ao, "dt"); + function ga(i, o) { var l = i.interaction, c = i.iEvent, h = i.event; if (c.type === "dragmove" || c.type === "dragend") { var b = l.dropState; - o.dynamicDrop && (b.activeDrops = vn(o, l.element)); + o.dynamicDrop && (b.activeDrops = hn(o, l.element)); var E = c, y = $n(l, E, h); - b.rejected = b.rejected && !!y && y.dropzone === b.cur.dropzone && y.element === b.cur.element, b.cur.dropzone = y && y.dropzone, b.cur.element = y && y.element, b.events = ao(l, 0, E); + b.rejected = b.rejected && !!y && y.dropzone === b.cur.dropzone && y.element === b.cur.element, b.cur.dropzone = y && y.dropzone, b.cur.element = y && y.element, b.events = oo(l, 0, E); } } - __name(ya, "ya"); - u(ya, "pt"), Object.defineProperty(Zr, "__esModule", { value: true }), Zr.default = void 0; - var wa = { id: "actions/drop", install: function(i) { + __name(ga, "ga"); + u(ga, "pt"), Object.defineProperty(Xr, "__esModule", { value: true }), Xr.default = void 0; + var ba = { id: "actions/drop", install: function(i) { var o = i.actions, l = i.interactStatic, c = i.Interactable, h = i.defaults; i.usePlugin(f.default), c.prototype.dropzone = function(b) { return function(E, y) { @@ -1624,16 +1624,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho var qe = De.x > W.left && De.x < W.right, Se = De.y > W.top && De.y < W.bottom; ne = qe && Se; } - var Be = D.getRect(F); - if (Be && ae === "center") { - var wr = Be.left + Be.width / 2, en = Be.top + Be.height / 2; - ne = wr >= W.left && wr <= W.right && en >= W.top && en <= W.bottom; + var $e = D.getRect(F); + if ($e && ae === "center") { + var yr = $e.left + $e.width / 2, Qr = $e.top + $e.height / 2; + ne = yr >= W.left && yr <= W.right && Qr >= W.top && Qr <= W.bottom; } - return Be && a.default.number(ae) && (ne = Math.max(0, Math.min(W.right, Be.right) - Math.max(W.left, Be.left)) * Math.max(0, Math.min(W.bottom, Be.bottom) - Math.max(W.top, Be.top)) / (Be.width * Be.height) >= ae), P.options.drop.checker && (ne = P.options.drop.checker(N, j, ne, P, Z, D, F)), ne; + return $e && a.default.number(ae) && (ne = Math.max(0, Math.min(W.right, $e.right) - Math.max(W.left, $e.left)) * Math.max(0, Math.min(W.bottom, $e.bottom) - Math.max(W.top, $e.top)) / ($e.width * $e.height) >= ae), P.options.drop.checker && (ne = P.options.drop.checker(N, j, ne, P, Z, D, F)), ne; }(this, b, E, y, x, O, I); }, l.dynamicDrop = function(b) { return a.default.bool(b) ? (i.dynamicDrop = b, l) : i.dynamicDrop; - }, (0, q.default)(o.phaselessTypes, { dragenter: true, dragleave: true, dropactivate: true, dropdeactivate: true, dropmove: true, drop: true }), o.methodDict.drop = "dropzone", i.dynamicDrop = false, h.actions.drop = wa.defaults; + }, (0, q.default)(o.phaselessTypes, { dragenter: true, dragleave: true, dropactivate: true, dropdeactivate: true, dropmove: true, drop: true }), o.methodDict.drop = "dropzone", i.dynamicDrop = false, h.actions.drop = ba.defaults; }, listeners: { "interactions:before-action-start": function(i) { var o = i.interaction; o.prepared.name === "drag" && (o.dropState = { cur: { dropzone: null, element: null }, prev: { dropzone: null, element: null }, rejected: null, events: null, activeDrops: [] }); @@ -1641,15 +1641,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho var l = i.interaction, c = (i.event, i.iEvent); if (l.prepared.name === "drag") { var h = l.dropState; - h.activeDrops = null, h.events = null, h.activeDrops = vn(o, l.element), h.events = ao(l, 0, c), h.events.activate && (Bn(h.activeDrops, h.events.activate), o.fire("actions/drop:start", { interaction: l, dragEvent: c })); + h.activeDrops = null, h.events = null, h.activeDrops = hn(o, l.element), h.events = oo(l, 0, c), h.events.activate && (Hn(h.activeDrops, h.events.activate), o.fire("actions/drop:start", { interaction: l, dragEvent: c })); } - }, "interactions:action-move": ya, "interactions:after-action-move": function(i, o) { + }, "interactions:action-move": ga, "interactions:after-action-move": function(i, o) { var l = i.interaction, c = i.iEvent; - l.prepared.name === "drag" && (so(l, l.dropState.events), o.fire("actions/drop:move", { interaction: l, dragEvent: c }), l.dropState.events = {}); + l.prepared.name === "drag" && (ao(l, l.dropState.events), o.fire("actions/drop:move", { interaction: l, dragEvent: c }), l.dropState.events = {}); }, "interactions:action-end": function(i, o) { if (i.interaction.prepared.name === "drag") { var l = i.interaction, c = i.iEvent; - ya(i, o), so(l, l.dropState.events), o.fire("actions/drop:end", { interaction: l, dragEvent: c }); + ga(i, o), ao(l, l.dropState.events), o.fire("actions/drop:end", { interaction: l, dragEvent: c }); } }, "interactions:stop": function(i) { var o = i.interaction; @@ -1657,8 +1657,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho var l = o.dropState; l && (l.activeDrops = null, l.events = null, l.cur.dropzone = null, l.cur.element = null, l.prev.dropzone = null, l.prev.element = null, l.rejected = false); } - } }, getActiveDrops: vn, getDrop: $n, getDropEvents: ao, fireDropEvents: so, defaults: { enabled: false, accept: null, overlap: "pointer" } }, yl = wa; - Zr.default = yl; + } }, getActiveDrops: hn, getDrop: $n, getDropEvents: oo, fireDropEvents: ao, defaults: { enabled: false, accept: null, overlap: "pointer" } }, gl = ba; + Xr.default = gl; var G = {}; function re(i) { var o = i.interaction, l = i.iEvent, c = i.phase; @@ -1718,15 +1718,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } __name(xt, "xt"); u(xt, "wt"); - function Lt(i) { + function _t(i) { var o = i.iEvent, l = i.interaction; if (l.prepared.name === "resize" && l.resizeAxes) { var c = o; l.interactable.options.resize.square ? (l.resizeAxes === "y" ? c.delta.x = c.delta.y : c.delta.y = c.delta.x, c.axes = "xy") : (c.axes = l.resizeAxes, l.resizeAxes === "x" ? c.delta.y = 0 : l.resizeAxes === "y" && (c.delta.x = 0)); } } - __name(Lt, "Lt"); - u(Lt, "_t"), Object.defineProperty(xe, "__esModule", { value: true }), xe.default = void 0; + __name(_t, "_t"); + u(_t, "_t"), Object.defineProperty(xe, "__esModule", { value: true }), xe.default = void 0; var It = { id: "actions/resize", before: ["actions/drag"], install: function(i) { var o = i.actions, l = i.browser, c = i.Interactable, h = i.defaults; It.cursors = function(b) { @@ -1745,7 +1745,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho var h = l, b = c.rect; c._rects = { start: (0, q.default)({}, b), corrected: (0, q.default)({}, b), previous: (0, q.default)({}, b), delta: { left: 0, right: 0, width: 0, top: 0, bottom: 0, height: 0 } }, h.edges = c.prepared.edges, h.rect = c._rects.corrected, h.deltaRect = c._rects.delta; } - })(i), Lt(i); + })(i), _t(i); }, "interactions:action-move": function(i) { (function(o) { var l = o.iEvent, c = o.interaction; @@ -1768,7 +1768,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho P[F] = I[F] - N[F]; h.edges = c.prepared.edges, h.rect = I, h.deltaRect = P; } - })(i), Lt(i); + })(i), _t(i); }, "interactions:action-end": function(i) { var o = i.iEvent, l = i.interaction; if (l.prepared.name === "resize" && l.prepared.edges) { @@ -1804,46 +1804,46 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho b = h[E]; } return b; - }, defaultMargin: null }, xa = It; - xe.default = xa; - var br = {}; - Object.defineProperty(br, "__esModule", { value: true }), br.default = void 0; - var lo = { id: "actions", install: function(i) { - i.usePlugin(G.default), i.usePlugin(xe.default), i.usePlugin(f.default), i.usePlugin(Zr.default); + }, defaultMargin: null }, ya = It; + xe.default = ya; + var gr = {}; + Object.defineProperty(gr, "__esModule", { value: true }), gr.default = void 0; + var so = { id: "actions", install: function(i) { + i.usePlugin(G.default), i.usePlugin(xe.default), i.usePlugin(f.default), i.usePlugin(Xr.default); } }; - br.default = lo; + gr.default = so; var At = {}; Object.defineProperty(At, "__esModule", { value: true }), At.default = void 0; - var Pt, Kr, Ei = 0, Si = { request: function(i) { + var Pt, Zr, xi = 0, Ei = { request: function(i) { return Pt(i); }, cancel: function(i) { - return Kr(i); + return Zr(i); }, init: function(i) { - if (Pt = i.requestAnimationFrame, Kr = i.cancelAnimationFrame, !Pt) + if (Pt = i.requestAnimationFrame, Zr = i.cancelAnimationFrame, !Pt) for (var o = ["ms", "moz", "webkit", "o"], l = 0; l < o.length; l++) { var c = o[l]; - Pt = i["".concat(c, "RequestAnimationFrame")], Kr = i["".concat(c, "CancelAnimationFrame")] || i["".concat(c, "CancelRequestAnimationFrame")]; + Pt = i["".concat(c, "RequestAnimationFrame")], Zr = i["".concat(c, "CancelAnimationFrame")] || i["".concat(c, "CancelRequestAnimationFrame")]; } - Pt = Pt && Pt.bind(i), Kr = Kr && Kr.bind(i), Pt || (Pt = u(function(h) { - var b = Date.now(), E = Math.max(0, 16 - (b - Ei)), y = i.setTimeout(function() { + Pt = Pt && Pt.bind(i), Zr = Zr && Zr.bind(i), Pt || (Pt = u(function(h) { + var b = Date.now(), E = Math.max(0, 16 - (b - xi)), y = i.setTimeout(function() { h(b + E); }, E); - return Ei = b + E, y; - }, "jt"), Kr = u(function(h) { + return xi = b + E, y; + }, "jt"), Zr = u(function(h) { return clearTimeout(h); }, "Mt")); } }; - At.default = Si; - var gn = {}; - Object.defineProperty(gn, "__esModule", { value: true }), gn.default = void 0, gn.getContainer = Ea, gn.getScroll = uo, gn.getScrollSize = function(i) { + At.default = Ei; + var mn = {}; + Object.defineProperty(mn, "__esModule", { value: true }), mn.default = void 0, mn.getContainer = wa, mn.getScroll = lo, mn.getScrollSize = function(i) { return a.default.window(i) && (i = window.document.body), { x: i.scrollWidth, y: i.scrollHeight }; - }, gn.getScrollSizeDelta = function(i, o) { + }, mn.getScrollSizeDelta = function(i, o) { var l = i.interaction, c = i.element, h = l && l.interactable.options[l.prepared.name].autoScroll; if (!h || !h.enabled) return o(), { x: 0, y: 0 }; - var b = Ea(h.container, l.interactable, c), E = uo(b); + var b = wa(h.container, l.interactable, c), E = lo(b); o(); - var y = uo(b); + var y = lo(b); return { x: y.x - E.x, y: y.y - E.y }; }; var ce = { defaults: { enabled: false, margin: 60, container: null, speed: 300 }, now: Date.now, interaction: null, i: 0, x: 0, y: 0, isScrolling: false, prevTime: 0, margin: 0, speed: 0, start: function(i) { @@ -1851,13 +1851,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }, stop: function() { ce.isScrolling = false, ce.interaction && (ce.interaction.autoScroll = null), At.default.cancel(ce.i); }, scroll: function() { - var i = ce.interaction, o = i.interactable, l = i.element, c = i.prepared.name, h = o.options[c].autoScroll, b = Ea(h.container, o, l), E = ce.now(), y = (E - ce.prevTime) / 1e3, x = h.speed * y; + var i = ce.interaction, o = i.interactable, l = i.element, c = i.prepared.name, h = o.options[c].autoScroll, b = wa(h.container, o, l), E = ce.now(), y = (E - ce.prevTime) / 1e3, x = h.speed * y; if (x >= 1) { var O = { x: ce.x * x, y: ce.y * x }; if (O.x || O.y) { - var I = uo(b); + var I = lo(b); a.default.window(b) ? b.scrollBy(O.x, O.y) : b && (b.scrollLeft += O.x, b.scrollTop += O.y); - var P = uo(b), N = { x: P.x - I.x, y: P.y - I.y }; + var P = lo(b), N = { x: P.x - I.x, y: P.y - I.y }; (N.x || N.y) && o.fire({ type: "autoscroll", target: l, interactable: o, delta: N, interaction: i, container: b }); } ce.prevTime = E; @@ -1872,7 +1872,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho if (o.simulation) ce.x = ce.y = 0; else { - var c, h, b, E, y = o.interactable, x = o.element, O = o.prepared.name, I = y.options[O].autoScroll, P = Ea(I.container, y, x); + var c, h, b, E, y = o.interactable, x = o.element, O = o.prepared.name, I = y.options[O].autoScroll, P = wa(I.container, y, x); if (a.default.window(P)) E = l.clientX < ce.margin, c = l.clientY < ce.margin, h = l.clientX > P.innerWidth - ce.margin, b = l.clientY > P.innerHeight - ce.margin; else { @@ -1882,17 +1882,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho ce.x = h ? 1 : E ? -1 : 0, ce.y = b ? 1 : c ? -1 : 0, ce.isScrolling || (ce.margin = I.margin, ce.speed = I.speed, ce.start(o)); } } }; - function Ea(i, o, l) { + function wa(i, o, l) { return (a.default.string(i) ? (0, oe.getStringOptionResult)(i, o, l) : i) || (0, r.getWindow)(l); } - __name(Ea, "Ea"); - u(Ea, "zt"); - function uo(i) { + __name(wa, "wa"); + u(wa, "zt"); + function lo(i) { return a.default.window(i) && (i = window.document.body), { x: i.scrollLeft, y: i.scrollTop }; } - __name(uo, "uo"); - u(uo, "Ct"); - var Am = { id: "auto-scroll", install: function(i) { + __name(lo, "lo"); + u(lo, "Ct"); + var Cm = { id: "auto-scroll", install: function(i) { var o = i.defaults, l = i.actions; i.autoScroll = ce, ce.now = function() { return i.now(); @@ -1903,31 +1903,31 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho i.interaction.autoScroll = null, ce.stop(), ce.interaction && (ce.interaction = null); }, "interactions:stop": ce.stop, "interactions:action-move": function(i) { return ce.onInteractionMove(i); - } } }, Pm = Am; - gn.default = Pm; - var lr = {}; - Object.defineProperty(lr, "__esModule", { value: true }), lr.copyAction = function(i, o) { + } } }, Om = Cm; + mn.default = Om; + var sr = {}; + Object.defineProperty(sr, "__esModule", { value: true }), sr.copyAction = function(i, o) { return i.name = o.name, i.axis = o.axis, i.edges = o.edges, i; - }, lr.sign = void 0, lr.warnOnce = function(i, o) { + }, sr.sign = void 0, sr.warnOnce = function(i, o) { var l = false; return function() { return l || (r.window.console.warn(o), l = true), i.apply(this, arguments); }; - }, lr.sign = function(i) { + }, sr.sign = function(i) { return i >= 0 ? 1 : -1; }; - var Sa = {}; - function zm(i) { + var xa = {}; + function Mm(i) { return a.default.bool(i) ? (this.options.styleCursor = i, this) : i === null ? (delete this.options.styleCursor, this) : this.options.styleCursor; } - __name(zm, "zm"); - u(zm, "Yt"); - function Rm(i) { + __name(Mm, "Mm"); + u(Mm, "Yt"); + function Im(i) { return a.default.func(i) ? (this.options.actionChecker = i, this) : i === null ? (delete this.options.actionChecker, this) : this.options.actionChecker; } - __name(Rm, "Rm"); - u(Rm, "Wt"), Object.defineProperty(Sa, "__esModule", { value: true }), Sa.default = void 0; - var Dm = { id: "auto-start/interactableMethods", install: function(i) { + __name(Im, "Im"); + u(Im, "Wt"), Object.defineProperty(xa, "__esModule", { value: true }), xa.default = void 0; + var Am = { id: "auto-start/interactableMethods", install: function(i) { var o = i.Interactable; o.prototype.getAction = function(l, c, h, b) { var E = function(y, x, O, I, P) { @@ -1935,33 +1935,33 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return P.fire("auto-start:check", j), j.action; }(this, c, h, b, i); return this.options.actionChecker ? this.options.actionChecker(l, c, E, this, b, h) : E; - }, o.prototype.ignoreFrom = (0, lr.warnOnce)(function(l) { + }, o.prototype.ignoreFrom = (0, sr.warnOnce)(function(l) { return this._backCompatOption("ignoreFrom", l); - }, "Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."), o.prototype.allowFrom = (0, lr.warnOnce)(function(l) { + }, "Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."), o.prototype.allowFrom = (0, sr.warnOnce)(function(l) { return this._backCompatOption("allowFrom", l); - }, "Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."), o.prototype.actionChecker = Rm, o.prototype.styleCursor = zm; + }, "Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."), o.prototype.actionChecker = Im, o.prototype.styleCursor = Mm; } }; - Sa.default = Dm; - var Ti = {}; - function Pc(i, o, l, c, h) { - return o.testIgnoreAllow(o.options[i.name], l, c) && o.options[i.name].enabled && Ta(o, l, i, h) ? i : null; - } - __name(Pc, "Pc"); - u(Pc, "Vt"); - function km(i, o, l, c, h, b, E) { + xa.default = Am; + var Si = {}; + function Mc(i, o, l, c, h) { + return o.testIgnoreAllow(o.options[i.name], l, c) && o.options[i.name].enabled && Ea(o, l, i, h) ? i : null; + } + __name(Mc, "Mc"); + u(Mc, "Vt"); + function Pm(i, o, l, c, h, b, E) { for (var y = 0, x = c.length; y < x; y++) { var O = c[y], I = h[y], P = O.getAction(o, l, i, I); if (P) { - var N = Pc(P, O, I, b, E); + var N = Mc(P, O, I, b, E); if (N) return { action: N, interactable: O, element: I }; } } return { action: null, interactable: null, element: null }; } - __name(km, "km"); - u(km, "Nt"); - function zc(i, o, l, c, h) { + __name(Pm, "Pm"); + u(Pm, "Nt"); + function Ic(i, o, l, c, h) { var b = [], E = [], y = c; function x(I) { b.push(I), E.push(y); @@ -1969,22 +1969,22 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho __name(x, "x"); for (u(x, "u"); a.default.element(y); ) { b = [], E = [], h.interactables.forEachMatch(y, x); - var O = km(i, o, l, b, E, c, h); + var O = Pm(i, o, l, b, E, c, h); if (O.action && !O.interactable.options[O.action.name].manualStart) return O; y = z.parentNode(y); } return { action: null, interactable: null, element: null }; } - __name(zc, "zc"); - u(zc, "qt"); - function Rc(i, o, l) { + __name(Ic, "Ic"); + u(Ic, "qt"); + function Ac(i, o, l) { var c = o.action, h = o.interactable, b = o.element; - c = c || { name: null }, i.interactable = h, i.element = b, (0, lr.copyAction)(i.prepared, c), i.rect = h && c.name ? h.getRect(b) : null, kc(i, l), l.fire("autoStart:prepared", { interaction: i }); + c = c || { name: null }, i.interactable = h, i.element = b, (0, sr.copyAction)(i.prepared, c), i.rect = h && c.name ? h.getRect(b) : null, zc(i, l), l.fire("autoStart:prepared", { interaction: i }); } - __name(Rc, "Rc"); - u(Rc, "Gt"); - function Ta(i, o, l, c) { + __name(Ac, "Ac"); + u(Ac, "Gt"); + function Ea(i, o, l, c) { var h = i.options, b = h[l.name].max, E = h[l.name].maxPerElement, y = c.autoStart.maxInteractions, x = 0, O = 0, I = 0; if (!(b && E && y)) return false; @@ -1995,20 +1995,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } return y > 0; } - __name(Ta, "Ta"); - u(Ta, "$t"); - function Dc(i, o) { + __name(Ea, "Ea"); + u(Ea, "$t"); + function Pc(i, o) { return a.default.number(i) ? (o.autoStart.maxInteractions = i, this) : o.autoStart.maxInteractions; } - __name(Dc, "Dc"); - u(Dc, "Ht"); - function wl(i, o, l) { + __name(Pc, "Pc"); + u(Pc, "Ht"); + function bl(i, o, l) { var c = l.autoStart.cursorElement; c && c !== i && (c.style.cursor = ""), i.ownerDocument.documentElement.style.cursor = o, i.style.cursor = o, l.autoStart.cursorElement = o ? i : null; } - __name(wl, "wl"); - u(wl, "Kt"); - function kc(i, o) { + __name(bl, "bl"); + u(bl, "Kt"); + function zc(i, o) { var l = i.interactable, c = i.element, h = i.prepared; if (i.pointerType === "mouse" && l && l.options.styleCursor) { var b = ""; @@ -2016,40 +2016,40 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho var E = l.options[h.name].cursorChecker; b = a.default.func(E) ? E(h, l, c, i._interacting) : o.actions.map[h.name].getCursor(h); } - wl(i.element, b || "", o); + bl(i.element, b || "", o); } else - o.autoStart.cursorElement && wl(o.autoStart.cursorElement, "", o); + o.autoStart.cursorElement && bl(o.autoStart.cursorElement, "", o); } - __name(kc, "kc"); - u(kc, "Zt"), Object.defineProperty(Ti, "__esModule", { value: true }), Ti.default = void 0; - var Nm = { id: "auto-start/base", before: ["actions"], install: function(i) { + __name(zc, "zc"); + u(zc, "Zt"), Object.defineProperty(Si, "__esModule", { value: true }), Si.default = void 0; + var zm = { id: "auto-start/base", before: ["actions"], install: function(i) { var o = i.interactStatic, l = i.defaults; - i.usePlugin(Sa.default), l.base.actionChecker = null, l.base.styleCursor = true, (0, q.default)(l.perAction, { manualStart: false, max: 1 / 0, maxPerElement: 1, allowFrom: null, ignoreFrom: null, mouseButtons: 1 }), o.maxInteractions = function(c) { - return Dc(c, i); - }, i.autoStart = { maxInteractions: 1 / 0, withinInteractionLimit: Ta, cursorElement: null }; + i.usePlugin(xa.default), l.base.actionChecker = null, l.base.styleCursor = true, (0, q.default)(l.perAction, { manualStart: false, max: 1 / 0, maxPerElement: 1, allowFrom: null, ignoreFrom: null, mouseButtons: 1 }), o.maxInteractions = function(c) { + return Pc(c, i); + }, i.autoStart = { maxInteractions: 1 / 0, withinInteractionLimit: Ea, cursorElement: null }; }, listeners: { "interactions:down": function(i, o) { var l = i.interaction, c = i.pointer, h = i.event, b = i.eventTarget; - l.interacting() || Rc(l, zc(l, c, h, b, o), o); + l.interacting() || Ac(l, Ic(l, c, h, b, o), o); }, "interactions:move": function(i, o) { (function(l, c) { var h = l.interaction, b = l.pointer, E = l.event, y = l.eventTarget; - h.pointerType !== "mouse" || h.pointerIsDown || h.interacting() || Rc(h, zc(h, b, E, y, c), c); + h.pointerType !== "mouse" || h.pointerIsDown || h.interacting() || Ac(h, Ic(h, b, E, y, c), c); })(i, o), function(l, c) { var h = l.interaction; if (h.pointerIsDown && !h.interacting() && h.pointerWasMoved && h.prepared.name) { c.fire("autoStart:before-start", l); var b = h.interactable, E = h.prepared.name; - E && b && (b.options[E].manualStart || !Ta(b, h.element, h.prepared, c) ? h.stop() : (h.start(h.prepared, b, h.element), kc(h, c))); + E && b && (b.options[E].manualStart || !Ea(b, h.element, h.prepared, c) ? h.stop() : (h.start(h.prepared, b, h.element), zc(h, c))); } }(i, o); }, "interactions:stop": function(i, o) { var l = i.interaction, c = l.interactable; - c && c.options.styleCursor && wl(l.element, "", o); - } }, maxInteractions: Dc, withinInteractionLimit: Ta, validateAction: Pc }, _m = Nm; - Ti.default = _m; - var Ca = {}; - Object.defineProperty(Ca, "__esModule", { value: true }), Ca.default = void 0; - var Lm = { id: "auto-start/dragAxis", listeners: { "autoStart:before-start": function(i, o) { + c && c.options.styleCursor && bl(l.element, "", o); + } }, maxInteractions: Pc, withinInteractionLimit: Ea, validateAction: Mc }, Rm = zm; + Si.default = Rm; + var Sa = {}; + Object.defineProperty(Sa, "__esModule", { value: true }), Sa.default = void 0; + var Dm = { id: "auto-start/dragAxis", listeners: { "autoStart:before-start": function(i, o) { var l = i.interaction, c = i.eventTarget, h = i.dx, b = i.dy; if (l.prepared.name === "drag") { var E = Math.abs(h), y = Math.abs(b), x = l.interactable.options.drag, O = x.startAxis, I = E > y ? "x" : E < y ? "y" : "xy"; @@ -2065,7 +2065,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return false; var ae = ne.options.drag.startAxis; return W === "xy" || ae === "xy" || ae === W; - }(I, D) && Ti.default.validateAction(Z, D, P, c, o)) + }(I, D) && Si.default.validateAction(Z, D, P, c, o)) return D; } } @@ -2080,24 +2080,24 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } } } } }; - Ca.default = Lm; - var Oa = {}; - function xl(i) { + Sa.default = Dm; + var Ta = {}; + function yl(i) { var o = i.prepared && i.prepared.name; if (!o) return null; var l = i.interactable.options; return l[o].hold || l[o].delay; } - __name(xl, "xl"); - u(xl, "re"), Object.defineProperty(Oa, "__esModule", { value: true }), Oa.default = void 0; - var Gm = { id: "auto-start/hold", install: function(i) { + __name(yl, "yl"); + u(yl, "re"), Object.defineProperty(Ta, "__esModule", { value: true }), Ta.default = void 0; + var km = { id: "auto-start/hold", install: function(i) { var o = i.defaults; - i.usePlugin(Ti.default), o.perAction.hold = 0, o.perAction.delay = 0; + i.usePlugin(Si.default), o.perAction.hold = 0, o.perAction.delay = 0; }, listeners: { "interactions:new": function(i) { i.interaction.autoStartHoldTimer = null; }, "autoStart:prepared": function(i) { - var o = i.interaction, l = xl(o); + var o = i.interaction, l = yl(o); l > 0 && (o.autoStartHoldTimer = setTimeout(function() { o.start(o.prepared, o.interactable, o.element); }, l)); @@ -2106,30 +2106,30 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho o.autoStartHoldTimer && o.pointerWasMoved && !l && (clearTimeout(o.autoStartHoldTimer), o.autoStartHoldTimer = null); }, "autoStart:before-start": function(i) { var o = i.interaction; - xl(o) > 0 && (o.prepared.name = null); - } }, getHoldDuration: xl }, jm = Gm; - Oa.default = jm; - var Ma = {}; - Object.defineProperty(Ma, "__esModule", { value: true }), Ma.default = void 0; - var Hm = { id: "auto-start", install: function(i) { - i.usePlugin(Ti.default), i.usePlugin(Oa.default), i.usePlugin(Ca.default); + yl(o) > 0 && (o.prepared.name = null); + } }, getHoldDuration: yl }, Nm = km; + Ta.default = Nm; + var Ca = {}; + Object.defineProperty(Ca, "__esModule", { value: true }), Ca.default = void 0; + var _m = { id: "auto-start", install: function(i) { + i.usePlugin(Si.default), i.usePlugin(Ta.default), i.usePlugin(Sa.default); } }; - Ma.default = Hm; - var Ci = {}; - function Bm(i) { + Ca.default = _m; + var Ti = {}; + function Lm(i) { return /^(always|never|auto)$/.test(i) ? (this.options.preventDefault = i, this) : a.default.bool(i) ? (this.options.preventDefault = i ? "always" : "never", this) : this.options.preventDefault; } - __name(Bm, "Bm"); - u(Bm, "ue"); - function $m(i) { + __name(Lm, "Lm"); + u(Lm, "ue"); + function Gm(i) { var o = i.interaction, l = i.event; o.interactable && o.interactable.checkAndPreventDefault(l); } - __name($m, "$m"); - u($m, "ce"); - function Nc(i) { + __name(Gm, "Gm"); + u(Gm, "ce"); + function Rc(i) { var o = i.Interactable; - o.prototype.preventDefault = Bm, o.prototype.checkAndPreventDefault = function(l) { + o.prototype.preventDefault = Lm, o.prototype.checkAndPreventDefault = function(l) { return function(c, h, b) { var E = c.options.preventDefault; if (E !== "never") @@ -2151,23 +2151,23 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } } }); } - __name(Nc, "Nc"); - u(Nc, "fe"), Object.defineProperty(Ci, "__esModule", { value: true }), Ci.default = void 0, Ci.install = Nc; - var qm = { id: "core/interactablePreventDefault", install: Nc, listeners: ["down", "move", "up", "cancel"].reduce(function(i, o) { - return i["interactions:".concat(o)] = $m, i; + __name(Rc, "Rc"); + u(Rc, "fe"), Object.defineProperty(Ti, "__esModule", { value: true }), Ti.default = void 0, Ti.install = Rc; + var jm = { id: "core/interactablePreventDefault", install: Rc, listeners: ["down", "move", "up", "cancel"].reduce(function(i, o) { + return i["interactions:".concat(o)] = Gm, i; }, {}) }; - Ci.default = qm; - var El = {}; - Object.defineProperty(El, "__esModule", { value: true }), El.default = void 0, El.default = {}; - var co, Sl = {}; - Object.defineProperty(Sl, "__esModule", { value: true }), Sl.default = void 0, function(i) { + Ti.default = jm; + var wl = {}; + Object.defineProperty(wl, "__esModule", { value: true }), wl.default = void 0, wl.default = {}; + var uo, xl = {}; + Object.defineProperty(xl, "__esModule", { value: true }), xl.default = void 0, function(i) { i.touchAction = "touchAction", i.boxSizing = "boxSizing", i.noListeners = "noListeners"; - }(co || (co = {})), co.touchAction, co.boxSizing, co.noListeners; - var Fm = { id: "dev-tools", install: function() { + }(uo || (uo = {})), uo.touchAction, uo.boxSizing, uo.noListeners; + var Hm = { id: "dev-tools", install: function() { } }; - Sl.default = Fm; - var qn = {}; - Object.defineProperty(qn, "__esModule", { value: true }), qn.default = u(/* @__PURE__ */ __name(function i(o) { + xl.default = Hm; + var Bn = {}; + Object.defineProperty(Bn, "__esModule", { value: true }), Bn.default = u(/* @__PURE__ */ __name(function i(o) { var l = {}; for (var c in o) { var h = o[c]; @@ -2175,8 +2175,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } return l; }, "i"), "t"); - var Fn = {}; - function _c(i, o) { + var qn = {}; + function Dc(i, o) { return function(l) { if (Array.isArray(l)) return l; @@ -2202,44 +2202,44 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }(i, o) || function(l, c) { if (l) { if (typeof l == "string") - return Lc(l, c); + return kc(l, c); var h = Object.prototype.toString.call(l).slice(8, -1); - return h === "Object" && l.constructor && (h = l.constructor.name), h === "Map" || h === "Set" ? Array.from(l) : h === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h) ? Lc(l, c) : void 0; + return h === "Object" && l.constructor && (h = l.constructor.name), h === "Map" || h === "Set" ? Array.from(l) : h === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h) ? kc(l, c) : void 0; } }(i, o) || function() { throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); }(); } - __name(_c, "_c"); - u(_c, "be"); - function Lc(i, o) { + __name(Dc, "Dc"); + u(Dc, "be"); + function kc(i, o) { (o == null || o > i.length) && (o = i.length); for (var l = 0, c = Array(o); l < o; l++) c[l] = i[l]; return c; } - __name(Lc, "Lc"); - u(Lc, "xe"); - function Um(i, o) { + __name(kc, "kc"); + u(kc, "xe"); + function $m(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(Um, "Um"); - u(Um, "we"); - function Un(i, o, l) { + __name($m, "$m"); + u($m, "we"); + function Fn(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } - __name(Un, "Un"); - u(Un, "_e"), Object.defineProperty(Fn, "__esModule", { value: true }), Fn.default = void 0, Fn.getRectOffset = Gc; - var Wm = function() { + __name(Fn, "Fn"); + u(Fn, "_e"), Object.defineProperty(qn, "__esModule", { value: true }), qn.default = void 0, qn.getRectOffset = Nc; + var Bm = function() { function i(c) { (function(h, b) { if (!(h instanceof b)) throw new TypeError("Cannot call a class as a function"); - })(this, i), Un(this, "states", []), Un(this, "startOffset", { left: 0, right: 0, top: 0, bottom: 0 }), Un(this, "startDelta", void 0), Un(this, "result", void 0), Un(this, "endResult", void 0), Un(this, "edges", void 0), Un(this, "interaction", void 0), this.interaction = c, this.result = Ia(); + })(this, i), Fn(this, "states", []), Fn(this, "startOffset", { left: 0, right: 0, top: 0, bottom: 0 }), Fn(this, "startDelta", void 0), Fn(this, "result", void 0), Fn(this, "endResult", void 0), Fn(this, "edges", void 0), Fn(this, "interaction", void 0), this.interaction = c, this.result = Oa(); } __name(i, "i"); u(i, "t"); @@ -2254,9 +2254,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return !!N; }); }(E); - this.prepareStates(y), this.edges = (0, q.default)({}, E.edges), this.startOffset = Gc(E.rect, h), this.startDelta = { x: 0, y: 0 }; + this.prepareStates(y), this.edges = (0, q.default)({}, E.edges), this.startOffset = Nc(E.rect, h), this.startDelta = { x: 0, y: 0 }; var x = this.fillArg({ phase: b, pageCoords: h, preEnd: false }); - return this.result = Ia(), this.startAll(x), this.result = this.setAll(x); + return this.result = Oa(), this.startAll(x), this.result = this.setAll(x); } }, { key: "fillArg", value: function(c) { var h = this.interaction; return c.interaction = h, c.interactable = h.interactable, c.element = h.element, c.rect = c.rect || h.rect, c.edges = this.edges, c.startOffset = this.startOffset, c; @@ -2268,7 +2268,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } }, { key: "setAll", value: function(c) { var h = c.phase, b = c.preEnd, E = c.skipModifiers, y = c.rect; c.coords = (0, q.default)({}, c.pageCoords), c.rect = (0, q.default)({}, y); - for (var x = E ? this.states.slice(E) : this.states, O = Ia(c.coords, c.rect), I = 0; I < x.length; I++) { + for (var x = E ? this.states.slice(E) : this.states, O = Oa(c.coords, c.rect), I = 0; I < x.length; I++) { var P, N = x[I], j = N.options, D = (0, q.default)({}, c.coords), F = null; (P = N.methods) != null && P.set && this.shouldDo(j, b, h) && (c.state = N, F = N.methods.set(c), oe.addEdges(this.interaction.edges, c.rect, { x: c.coords.x - D.x, y: c.coords.y - D.y })), O.eventProps.push(F); } @@ -2283,7 +2283,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho var h = this.interaction, b = c.phase, E = h.coords.cur, y = h.coords.start, x = this.result, O = this.startDelta, I = x.delta; b === "start" && (0, q.default)(this.startDelta, x.delta); for (var P = 0; P < [[y, O], [E, I]].length; P++) { - var N = _c([[y, O], [E, I]][P], 2), j = N[0], D = N[1]; + var N = Dc([[y, O], [E, I]][P], 2), j = N[0], D = N[1]; j.page.x += D.x, j.page.y += D.y, j.client.x += D.x, j.client.y += D.y; } var F = this.result.rectDelta, Z = c.rect || h.rect; @@ -2332,7 +2332,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho var h = c.interaction, b = h.coords, E = h.rect, y = h.modification; if (y.result) { for (var x = y.startDelta, O = y.result, I = O.delta, P = O.rectDelta, N = [[b.start, x], [b.cur, I]], j = 0; j < N.length; j++) { - var D = _c(N[j], 2), F = D[0], Z = D[1]; + var D = Dc(N[j], 2), F = D[0], Z = D[1]; F.page.x -= Z.x, F.page.y -= Z.y, F.client.x -= Z.x, F.client.y -= Z.y; } E.left -= P.left, E.right -= P.right, E.top -= P.top, E.bottom -= P.bottom; @@ -2341,30 +2341,30 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return !(!c || c.enabled === false || E && !c.endOnly || c.endOnly && !h || b === "start" && !c.setStart); } }, { key: "copyFrom", value: function(c) { this.startOffset = c.startOffset, this.startDelta = c.startDelta, this.edges = c.edges, this.states = c.states.map(function(h) { - return (0, qn.default)(h); - }), this.result = Ia((0, q.default)({}, c.result.coords), (0, q.default)({}, c.result.rect)); + return (0, Bn.default)(h); + }), this.result = Oa((0, q.default)({}, c.result.coords), (0, q.default)({}, c.result.rect)); } }, { key: "destroy", value: function() { for (var c in this) this[c] = null; - } }]) && Um(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; + } }]) && $m(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; }(); - function Ia(i, o) { + function Oa(i, o) { return { rect: o, coords: i, delta: { x: 0, y: 0 }, rectDelta: { left: 0, right: 0, top: 0, bottom: 0 }, eventProps: [], changed: true }; } - __name(Ia, "Ia"); - u(Ia, "Oe"); - function Gc(i, o) { + __name(Oa, "Oa"); + u(Oa, "Oe"); + function Nc(i, o) { return i ? { left: o.x - i.left, top: o.y - i.top, right: i.right - o.x, bottom: i.bottom - o.y } : { left: 0, top: 0, right: 0, bottom: 0 }; } - __name(Gc, "Gc"); - u(Gc, "Ee"), Fn.default = Wm; + __name(Nc, "Nc"); + u(Nc, "Ee"), qn.default = Bm; var Et = {}; - function Aa(i) { + function Ma(i) { var o = i.iEvent, l = i.interaction.modification.result; l && (o.modifiers = l.eventProps); } - __name(Aa, "Aa"); - u(Aa, "Te"), Object.defineProperty(Et, "__esModule", { value: true }), Et.addEventModifiers = Aa, Et.default = void 0, Et.makeModifier = function(i, o) { + __name(Ma, "Ma"); + u(Ma, "Te"), Object.defineProperty(Et, "__esModule", { value: true }), Et.addEventModifiers = Ma, Et.default = void 0, Et.makeModifier = function(i, o) { var l = i.defaults, c = { start: i.start, set: i.set, beforeEnd: i.beforeEnd, stop: i.stop }, h = u(function(b) { var E = b || {}; for (var y in E.enabled = E.enabled !== false, l) @@ -2378,11 +2378,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }, "o"); return o && typeof o == "string" && (h._defaults = l, h._methods = c), h; }; - var Vm = { id: "modifiers/base", before: ["actions"], install: function(i) { + var qm = { id: "modifiers/base", before: ["actions"], install: function(i) { i.defaults.perAction.modifiers = []; }, listeners: { "interactions:new": function(i) { var o = i.interaction; - o.modification = new Fn.default(o); + o.modification = new qn.default(o); }, "interactions:before-action-start": function(i) { var o = i.interaction.modification; o.start(i, i.interaction.coords.start.page), i.interaction.edges = o.edges, o.applyToInteraction(i); @@ -2390,50 +2390,50 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return i.interaction.modification.setAndApply(i); }, "interactions:before-action-end": function(i) { return i.interaction.modification.beforeEnd(i); - }, "interactions:action-start": Aa, "interactions:action-move": Aa, "interactions:action-end": Aa, "interactions:after-action-start": function(i) { + }, "interactions:action-start": Ma, "interactions:action-move": Ma, "interactions:action-end": Ma, "interactions:after-action-start": function(i) { return i.interaction.modification.restoreInteractionCoords(i); }, "interactions:after-action-move": function(i) { return i.interaction.modification.restoreInteractionCoords(i); }, "interactions:stop": function(i) { return i.interaction.modification.stop(i); - } } }, Ym = Vm; - Et.default = Ym; + } } }, Fm = qm; + Et.default = Fm; + var co = {}; + Object.defineProperty(co, "__esModule", { value: true }), co.defaults = void 0, co.defaults = { base: { preventDefault: "auto", deltaSource: "page" }, perAction: { enabled: false, origin: { x: 0, y: 0 } }, actions: {} }; var po = {}; - Object.defineProperty(po, "__esModule", { value: true }), po.defaults = void 0, po.defaults = { base: { preventDefault: "auto", deltaSource: "page" }, perAction: { enabled: false, origin: { x: 0, y: 0 } }, actions: {} }; - var fo = {}; - function Tl(i) { - return Tl = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { + function El(i) { + return El = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { return typeof o; } : function(o) { return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; - }, Tl(i); + }, El(i); } - __name(Tl, "Tl"); - u(Tl, "De"); - function Xm(i, o) { + __name(El, "El"); + u(El, "De"); + function Um(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(Xm, "Xm"); - u(Xm, "Ae"); - function Cl(i, o) { - return Cl = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, c) { + __name(Um, "Um"); + u(Um, "Ae"); + function Sl(i, o) { + return Sl = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, c) { return l.__proto__ = c, l; - }, Cl(i, o); + }, Sl(i, o); } - __name(Cl, "Cl"); - u(Cl, "ze"); - function Zm(i, o) { - if (o && (Tl(o) === "object" || typeof o == "function")) + __name(Sl, "Sl"); + u(Sl, "ze"); + function Wm(i, o) { + if (o && (El(o) === "object" || typeof o == "function")) return o; if (o !== void 0) throw new TypeError("Derived constructors may only return object or undefined"); return He(i); } - __name(Zm, "Zm"); - u(Zm, "Ce"); + __name(Wm, "Wm"); + u(Wm, "Ce"); function He(i) { if (i === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); @@ -2441,23 +2441,23 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } __name(He, "He"); u(He, "Re"); - function Pa(i) { - return Pa = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) { + function Ia(i) { + return Ia = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) { return o.__proto__ || Object.getPrototypeOf(o); - }, Pa(i); + }, Ia(i); } - __name(Pa, "Pa"); - u(Pa, "Fe"); + __name(Ia, "Ia"); + u(Ia, "Fe"); function Ve(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } __name(Ve, "Ve"); - u(Ve, "Xe"), Object.defineProperty(fo, "__esModule", { value: true }), fo.InteractEvent = void 0; - var jc = function(i) { + u(Ve, "Xe"), Object.defineProperty(po, "__esModule", { value: true }), po.InteractEvent = void 0; + var _c = function(i) { (function(y, x) { if (typeof x != "function" && x !== null) throw new TypeError("Super expression must either be null or a function"); - y.prototype = Object.create(x && x.prototype, { constructor: { value: y, writable: true, configurable: true } }), Object.defineProperty(y, "prototype", { writable: false }), x && Cl(y, x); + y.prototype = Object.create(x && x.prototype, { constructor: { value: y, writable: true, configurable: true } }), Object.defineProperty(y, "prototype", { writable: false }), x && Sl(y, x); })(E, i); var o, l, c, h, b = (c = E, h = function() { if (typeof Reflect == "undefined" || !Reflect.construct || Reflect.construct.sham) @@ -2471,13 +2471,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return false; } }(), function() { - var y, x = Pa(c); + var y, x = Ia(c); if (h) { - var O = Pa(this).constructor; + var O = Ia(this).constructor; y = Reflect.construct(x, arguments, O); } else y = x.apply(this, arguments); - return Zm(this, y); + return Wm(this, y); }); function E(y, x, O, I, P, N, j) { var D; @@ -2485,7 +2485,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho if (!(qe instanceof Se)) throw new TypeError("Cannot call a class as a function"); })(this, E), Ve(He(D = b.call(this, y)), "relatedTarget", null), Ve(He(D), "screenX", void 0), Ve(He(D), "screenY", void 0), Ve(He(D), "button", void 0), Ve(He(D), "buttons", void 0), Ve(He(D), "ctrlKey", void 0), Ve(He(D), "shiftKey", void 0), Ve(He(D), "altKey", void 0), Ve(He(D), "metaKey", void 0), Ve(He(D), "page", void 0), Ve(He(D), "client", void 0), Ve(He(D), "delta", void 0), Ve(He(D), "rect", void 0), Ve(He(D), "x0", void 0), Ve(He(D), "y0", void 0), Ve(He(D), "t0", void 0), Ve(He(D), "dt", void 0), Ve(He(D), "duration", void 0), Ve(He(D), "clientX0", void 0), Ve(He(D), "clientY0", void 0), Ve(He(D), "velocity", void 0), Ve(He(D), "speed", void 0), Ve(He(D), "swipe", void 0), Ve(He(D), "axes", void 0), Ve(He(D), "preEnd", void 0), P = P || y.element; - var F = y.interactable, Z = (F && F.options || po.defaults).deltaSource, W = (0, ze.default)(F, P, O), ne = I === "start", ae = I === "end", ye = ne ? He(D) : y.prevEvent, De = ne ? y.coords.start : ae ? { page: ye.page, client: ye.client, timeStamp: y.coords.cur.timeStamp } : y.coords.cur; + var F = y.interactable, Z = (F && F.options || co.defaults).deltaSource, W = (0, ze.default)(F, P, O), ne = I === "start", ae = I === "end", ye = ne ? He(D) : y.prevEvent, De = ne ? y.coords.start : ae ? { page: ye.page, client: ye.client, timeStamp: y.coords.cur.timeStamp } : y.coords.cur; return D.page = (0, q.default)({}, De.page), D.client = (0, q.default)({}, De.client), D.rect = (0, q.default)({}, y.rect), D.timeStamp = De.timeStamp, ae || (D.page.x -= W.x, D.page.y -= W.y, D.client.x -= W.x, D.client.y -= W.y), D.ctrlKey = x.ctrlKey, D.altKey = x.altKey, D.shiftKey = x.shiftKey, D.metaKey = x.metaKey, D.button = x.button, D.buttons = x.buttons, D.target = P, D.currentTarget = P, D.preEnd = N, D.type = j || O + (I || ""), D.interactable = F, D.t0 = ne ? y.pointers[y.pointers.length - 1].downTime : ye.t0, D.x0 = y.coords.start.page.x - W.x, D.y0 = y.coords.start.page.y - W.y, D.clientX0 = y.coords.start.client.x - W.x, D.clientY0 = y.coords.start.client.y - W.y, D.delta = ne || ae ? { x: 0, y: 0 } : { x: D[Z].x - ye[Z].x, y: D[Z].y - ye[Z].y }, D.dt = y.coords.delta.timeStamp, D.duration = D.timeStamp - D.t0, D.velocity = (0, q.default)({}, y.coords.velocity[Z]), D.speed = (0, Je.default)(D.velocity.x, D.velocity.y), D.swipe = ae || I === "inertiastart" ? D.getSwipe() : null, D; } __name(E, "E"); @@ -2502,9 +2502,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho this.immediatePropagationStopped = this.propagationStopped = true; } }, { key: "stopPropagation", value: function() { this.propagationStopped = true; - } }]) && Xm(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), E; - }(sr.BaseEvent); - fo.InteractEvent = jc, Object.defineProperties(jc.prototype, { pageX: { get: function() { + } }]) && Um(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), E; + }(ar.BaseEvent); + po.InteractEvent = _c, Object.defineProperties(_c.prototype, { pageX: { get: function() { return this.page.x; }, set: function(i) { this.page.x = i; @@ -2537,61 +2537,61 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }, set: function(i) { this.velocity.y = i; } } }); - var ho = {}; - function Hc(i, o) { + var fo = {}; + function Lc(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(Hc, "Hc"); - u(Hc, "We"); - function Km(i, o, l) { - return o && Hc(i.prototype, o), l && Hc(i, l), Object.defineProperty(i, "prototype", { writable: false }), i; + __name(Lc, "Lc"); + u(Lc, "We"); + function Vm(i, o, l) { + return o && Lc(i.prototype, o), l && Lc(i, l), Object.defineProperty(i, "prototype", { writable: false }), i; } - __name(Km, "Km"); - u(Km, "Le"); - function mo(i, o, l) { + __name(Vm, "Vm"); + u(Vm, "Le"); + function ho(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } - __name(mo, "mo"); - u(mo, "Ue"), Object.defineProperty(ho, "__esModule", { value: true }), ho.PointerInfo = void 0; - var Jm = Km(u(/* @__PURE__ */ __name(function i(o, l, c, h, b) { + __name(ho, "ho"); + u(ho, "Ue"), Object.defineProperty(fo, "__esModule", { value: true }), fo.PointerInfo = void 0; + var Ym = Vm(u(/* @__PURE__ */ __name(function i(o, l, c, h, b) { (function(E, y) { if (!(E instanceof y)) throw new TypeError("Cannot call a class as a function"); - })(this, i), mo(this, "id", void 0), mo(this, "pointer", void 0), mo(this, "event", void 0), mo(this, "downTime", void 0), mo(this, "downTarget", void 0), this.id = o, this.pointer = l, this.event = c, this.downTime = h, this.downTarget = b; + })(this, i), ho(this, "id", void 0), ho(this, "pointer", void 0), ho(this, "event", void 0), ho(this, "downTime", void 0), ho(this, "downTarget", void 0), this.id = o, this.pointer = l, this.event = c, this.downTime = h, this.downTarget = b; }, "i"), "t")); - ho.PointerInfo = Jm; - var za, Ra, tr = {}; - function Qm(i, o) { + fo.PointerInfo = Ym; + var Aa, Pa, Qt = {}; + function Xm(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(Qm, "Qm"); - u(Qm, "$e"); + __name(Xm, "Xm"); + u(Xm, "$e"); function Ke(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } __name(Ke, "Ke"); - u(Ke, "He"), Object.defineProperty(tr, "__esModule", { value: true }), tr.Interaction = void 0, Object.defineProperty(tr, "PointerInfo", { enumerable: true, get: function() { - return ho.PointerInfo; - } }), tr.default = tr._ProxyValues = tr._ProxyMethods = void 0, tr._ProxyValues = za, function(i) { + u(Ke, "He"), Object.defineProperty(Qt, "__esModule", { value: true }), Qt.Interaction = void 0, Object.defineProperty(Qt, "PointerInfo", { enumerable: true, get: function() { + return fo.PointerInfo; + } }), Qt.default = Qt._ProxyValues = Qt._ProxyMethods = void 0, Qt._ProxyValues = Aa, function(i) { i.interactable = "", i.element = "", i.prepared = "", i.pointerIsDown = "", i.pointerWasMoved = "", i._proxy = ""; - }(za || (tr._ProxyValues = za = {})), tr._ProxyMethods = Ra, function(i) { + }(Aa || (Qt._ProxyValues = Aa = {})), Qt._ProxyMethods = Pa, function(i) { i.start = "", i.move = "", i.end = "", i.stop = "", i.interacting = ""; - }(Ra || (tr._ProxyMethods = Ra = {})); - var ev = 0, Bc = function() { + }(Pa || (Qt._ProxyMethods = Pa = {})); + var Zm = 0, Gc = function() { function i(c) { var h = this, b = c.pointerType, E = c.scopeFire; (function(N, j) { if (!(N instanceof j)) throw new TypeError("Cannot call a class as a function"); - })(this, i), Ke(this, "interactable", null), Ke(this, "element", null), Ke(this, "rect", null), Ke(this, "_rects", void 0), Ke(this, "edges", null), Ke(this, "_scopeFire", void 0), Ke(this, "prepared", { name: null, axis: null, edges: null }), Ke(this, "pointerType", void 0), Ke(this, "pointers", []), Ke(this, "downEvent", null), Ke(this, "downPointer", {}), Ke(this, "_latestPointer", { pointer: null, event: null, eventTarget: null }), Ke(this, "prevEvent", null), Ke(this, "pointerIsDown", false), Ke(this, "pointerWasMoved", false), Ke(this, "_interacting", false), Ke(this, "_ending", false), Ke(this, "_stopped", true), Ke(this, "_proxy", null), Ke(this, "simulation", null), Ke(this, "doMove", (0, lr.warnOnce)(function(N) { + })(this, i), Ke(this, "interactable", null), Ke(this, "element", null), Ke(this, "rect", null), Ke(this, "_rects", void 0), Ke(this, "edges", null), Ke(this, "_scopeFire", void 0), Ke(this, "prepared", { name: null, axis: null, edges: null }), Ke(this, "pointerType", void 0), Ke(this, "pointers", []), Ke(this, "downEvent", null), Ke(this, "downPointer", {}), Ke(this, "_latestPointer", { pointer: null, event: null, eventTarget: null }), Ke(this, "prevEvent", null), Ke(this, "pointerIsDown", false), Ke(this, "pointerWasMoved", false), Ke(this, "_interacting", false), Ke(this, "_ending", false), Ke(this, "_stopped", true), Ke(this, "_proxy", null), Ke(this, "simulation", null), Ke(this, "doMove", (0, sr.warnOnce)(function(N) { this.move(N); - }, "The interaction.doMove() method has been renamed to interaction.move()")), Ke(this, "coords", { start: J.newCoords(), prev: J.newCoords(), cur: J.newCoords(), delta: J.newCoords(), velocity: J.newCoords() }), Ke(this, "_id", ev++), this._scopeFire = E, this.pointerType = b; + }, "The interaction.doMove() method has been renamed to interaction.move()")), Ke(this, "coords", { start: J.newCoords(), prev: J.newCoords(), cur: J.newCoords(), delta: J.newCoords(), velocity: J.newCoords() }), Ke(this, "_id", Zm++), this._scopeFire = E, this.pointerType = b; var y = this; this._proxy = {}; var x = u(function(N) { @@ -2599,14 +2599,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return y[N]; } }); }, "a"); - for (var O in za) + for (var O in Aa) x(O); var I = u(function(N) { Object.defineProperty(h._proxy, N, { value: function() { return y[N].apply(y, arguments); } }); }, "l"); - for (var P in Ra) + for (var P in Pa) I(P); this._scopeFire("interactions:new", { interaction: this }); } @@ -2619,7 +2619,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho var E = this.updatePointer(c, h, b, true), y = this.pointers[E]; this._scopeFire("interactions:down", { pointer: c, event: h, eventTarget: b, pointerIndex: E, pointerInfo: y, type: "down", interaction: this }); } }, { key: "start", value: function(c, h, b) { - return !(this.interacting() || !this.pointerIsDown || this.pointers.length < (c.name === "gesture" ? 2 : 1) || !h.options[c.name].enabled) && ((0, lr.copyAction)(this.prepared, c), this.interactable = h, this.element = b, this.rect = h.getRect(b), this.edges = this.prepared.edges ? (0, q.default)({}, this.prepared.edges) : { left: true, right: true, top: true, bottom: true }, this._stopped = false, this._interacting = this._doPhase({ interaction: this, event: this.downEvent, phase: "start" }) && !this._stopped, this._interacting); + return !(this.interacting() || !this.pointerIsDown || this.pointers.length < (c.name === "gesture" ? 2 : 1) || !h.options[c.name].enabled) && ((0, sr.copyAction)(this.prepared, c), this.interactable = h, this.element = b, this.rect = h.getRect(b), this.edges = this.prepared.edges ? (0, q.default)({}, this.prepared.edges) : { left: true, right: true, top: true, bottom: true }, this._stopped = false, this._interacting = this._doPhase({ interaction: this, event: this.downEvent, phase: "start" }) && !this._stopped, this._interacting); } }, { key: "pointerMove", value: function(c, h, b) { this.simulation || this.modification && this.modification.endResult || this.updatePointer(c, h, b, false); var E, y, x = this.coords.cur.page.x === this.coords.prev.page.x && this.coords.cur.page.y === this.coords.prev.page.y && this.coords.cur.client.x === this.coords.prev.client.x && this.coords.cur.client.y === this.coords.prev.client.y; @@ -2653,7 +2653,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return this.pointers[this.getPointerIndex(c)]; } }, { key: "updatePointer", value: function(c, h, b, E) { var y = J.getPointerId(c), x = this.getPointerIndex(c), O = this.pointers[x]; - return E = E !== false && (E || /(down|start)$/i.test(h.type)), O ? O.pointer = c : (O = new ho.PointerInfo(y, c, h, null, null), x = this.pointers.length, this.pointers.push(O)), J.setCoords(this.coords.cur, this.pointers.map(function(I) { + return E = E !== false && (E || /(down|start)$/i.test(h.type)), O ? O.pointer = c : (O = new fo.PointerInfo(y, c, h, null, null), x = this.pointers.length, this.pointers.push(O)), J.setCoords(this.coords.cur, this.pointers.map(function(I) { return I.pointer; }), this._now()), J.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur), E && (this.pointerIsDown = true, O.downTime = this.coords.cur.timeStamp, O.downTarget = b, J.pointerExtend(this.downPointer, c), this.interacting() || (J.copyCoords(this.coords.start, this.coords.cur), J.copyCoords(this.coords.prev, this.coords.cur), this.downEvent = h, this.pointerWasMoved = false)), this._updateLatestPointer(c, h, b), this._scopeFire("interactions:update-pointer", { pointer: c, event: h, eventTarget: b, down: E, pointerInfo: O, pointerIndex: x, interaction: this }), x; } }, { key: "removePointer", value: function(c, h) { @@ -2667,7 +2667,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } }, { key: "destroy", value: function() { this._latestPointer.pointer = null, this._latestPointer.event = null, this._latestPointer.eventTarget = null; } }, { key: "_createPreparedEvent", value: function(c, h, b, E) { - return new fo.InteractEvent(this, c, this.prepared.name, h, this.element, b, E); + return new po.InteractEvent(this, c, this.prepared.name, h, this.element, b, E); } }, { key: "_fireEvent", value: function(c) { var h; (h = this.interactable) == null || h.fire(c), (!this.prevEvent || c.timeStamp >= this.prevEvent.timeStamp) && (this.prevEvent = c); @@ -2679,74 +2679,74 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return this._scopeFire("interactions:action-".concat(b), c), b === "start" && (this.prevEvent = O), this._fireEvent(O), this._scopeFire("interactions:after-action-".concat(b), c), true; } }, { key: "_now", value: function() { return Date.now(); - } }], l && Qm(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; + } }], l && Xm(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; }(); - tr.Interaction = Bc; - var tv = Bc; - tr.default = tv; - var Wn = {}; - function $c(i) { - i.pointerIsDown && (Ml(i.coords.cur, i.offset.total), i.offset.pending.x = 0, i.offset.pending.y = 0); - } - __name($c, "$c"); - u($c, "tn"); - function qc(i) { - Ol(i.interaction); + Qt.Interaction = Gc; + var Km = Gc; + Qt.default = Km; + var Un = {}; + function jc(i) { + i.pointerIsDown && (Cl(i.coords.cur, i.offset.total), i.offset.pending.x = 0, i.offset.pending.y = 0); + } + __name(jc, "jc"); + u(jc, "tn"); + function Hc(i) { + Tl(i.interaction); } - __name(qc, "qc"); - u(qc, "en"); - function Ol(i) { + __name(Hc, "Hc"); + u(Hc, "en"); + function Tl(i) { if (!function(l) { return !(!l.offset.pending.x && !l.offset.pending.y); }(i)) return false; var o = i.offset.pending; - return Ml(i.coords.cur, o), Ml(i.coords.delta, o), oe.addEdges(i.edges, i.rect, o), o.x = 0, o.y = 0, true; + return Cl(i.coords.cur, o), Cl(i.coords.delta, o), oe.addEdges(i.edges, i.rect, o), o.x = 0, o.y = 0, true; } - __name(Ol, "Ol"); - u(Ol, "nn"); - function rv(i) { + __name(Tl, "Tl"); + u(Tl, "nn"); + function Jm(i) { var o = i.x, l = i.y; this.offset.pending.x += o, this.offset.pending.y += l, this.offset.total.x += o, this.offset.total.y += l; } - __name(rv, "rv"); - u(rv, "rn"); - function Ml(i, o) { + __name(Jm, "Jm"); + u(Jm, "rn"); + function Cl(i, o) { var l = i.page, c = i.client, h = o.x, b = o.y; l.x += h, l.y += b, c.x += h, c.y += b; } - __name(Ml, "Ml"); - u(Ml, "on"), Object.defineProperty(Wn, "__esModule", { value: true }), Wn.addTotal = $c, Wn.applyPending = Ol, Wn.default = void 0, tr._ProxyMethods.offsetBy = ""; - var nv = { id: "offset", before: ["modifiers", "pointer-events", "actions", "inertia"], install: function(i) { - i.Interaction.prototype.offsetBy = rv; + __name(Cl, "Cl"); + u(Cl, "on"), Object.defineProperty(Un, "__esModule", { value: true }), Un.addTotal = jc, Un.applyPending = Tl, Un.default = void 0, Qt._ProxyMethods.offsetBy = ""; + var Qm = { id: "offset", before: ["modifiers", "pointer-events", "actions", "inertia"], install: function(i) { + i.Interaction.prototype.offsetBy = Jm; }, listeners: { "interactions:new": function(i) { i.interaction.offset = { total: { x: 0, y: 0 }, pending: { x: 0, y: 0 } }; }, "interactions:update-pointer": function(i) { - return $c(i.interaction); - }, "interactions:before-action-start": qc, "interactions:before-action-move": qc, "interactions:before-action-end": function(i) { + return jc(i.interaction); + }, "interactions:before-action-start": Hc, "interactions:before-action-move": Hc, "interactions:before-action-end": function(i) { var o = i.interaction; - if (Ol(o)) + if (Tl(o)) return o.move({ offset: true }), o.end(), false; }, "interactions:stop": function(i) { var o = i.interaction; o.offset.total.x = 0, o.offset.total.y = 0, o.offset.pending.x = 0, o.offset.pending.y = 0; - } } }, iv = nv; - Wn.default = iv; - var Oi = {}; - function ov(i, o) { + } } }, ev = Qm; + Un.default = ev; + var Ci = {}; + function tv(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(ov, "ov"); - u(ov, "un"); + __name(tv, "tv"); + u(tv, "un"); function gt(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } __name(gt, "gt"); - u(gt, "cn"), Object.defineProperty(Oi, "__esModule", { value: true }), Oi.default = Oi.InertiaState = void 0; - var Fc = function() { + u(gt, "cn"), Object.defineProperty(Ci, "__esModule", { value: true }), Ci.default = Ci.InertiaState = void 0; + var $c = function() { function i(c) { (function(h, b) { if (!(h instanceof b)) @@ -2757,10 +2757,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho u(i, "t"); var o, l; return o = i, (l = [{ key: "start", value: function(c) { - var h = this.interaction, b = Da(h); + var h = this.interaction, b = za(h); if (!b || !b.enabled) return false; - var E = h.coords.velocity.client, y = (0, Je.default)(E.x, E.y), x = this.modification || (this.modification = new Fn.default(h)); + var E = h.coords.velocity.client, y = (0, Je.default)(E.x, E.y), x = this.modification || (this.modification = new qn.default(h)); if (x.copyFrom(h.modification), this.t0 = h._now(), this.allowResume = b.allowResume, this.v0 = y, this.currentOffset = { x: 0, y: 0 }, this.startCoords = h.coords.cur.page, this.modifierArg = x.fillArg({ pageCoords: this.startCoords, preEnd: true, phase: "inertiastart" }), this.t0 - h.coords.cur.timeStamp < 50 && y > b.minSpeed && y > b.endSpeed) this.startInertia(); else { @@ -2770,7 +2770,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } return h.modification.result.rect = null, h.offsetBy(this.targetOffset), h._doPhase({ interaction: h, event: c, phase: "inertiastart" }), h.offsetBy({ x: -this.targetOffset.x, y: -this.targetOffset.y }), h.modification.result.rect = null, this.active = true, h.simulation = this, true; } }, { key: "startInertia", value: function() { - var c = this, h = this.interaction.coords.velocity.client, b = Da(this.interaction), E = b.resistance, y = -Math.log(b.endSpeed / this.v0) / E; + var c = this, h = this.interaction.coords.velocity.client, b = za(this.interaction), E = b.resistance, y = -Math.log(b.endSpeed / this.v0) / E; this.targetOffset = { x: (h.x - y) / E, y: (h.y - y) / E }, this.te = y, this.lambda_v0 = E / this.v0, this.one_ve_v0 = 1 - b.endSpeed / this.v0; var x = this.modification, O = this.modifierArg; O.pageCoords = { x: this.startCoords.x + this.targetOffset.x, y: this.startCoords.y + this.targetOffset.y }, x.result = x.setAll(O), x.result.changed && (this.isModified = true, this.modifiedOffset = { x: this.targetOffset.x + x.result.delta.x, y: this.targetOffset.y + x.result.delta.y }), this.onNextFrame(function() { @@ -2787,10 +2787,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho h.active && c(); }); } }, { key: "inertiaTick", value: function() { - var c, h, b, E, y, x = this, O = this.interaction, I = Da(O).resistance, P = (O._now() - this.t0) / 1e3; + var c, h, b, E, y, x = this, O = this.interaction, I = za(O).resistance, P = (O._now() - this.t0) / 1e3; if (P < this.te) { var N, j = 1 - (Math.exp(-I * P) - this.lambda_v0) / this.one_ve_v0; - this.isModified ? (c = this.targetOffset.x, h = this.targetOffset.y, b = this.modifiedOffset.x, E = this.modifiedOffset.y, N = { x: Uc(y = j, 0, c, b), y: Uc(y, 0, h, E) }) : N = { x: this.targetOffset.x * j, y: this.targetOffset.y * j }; + this.isModified ? (c = this.targetOffset.x, h = this.targetOffset.y, b = this.modifiedOffset.x, E = this.modifiedOffset.y, N = { x: Bc(y = j, 0, c, b), y: Bc(y, 0, h, E) }) : N = { x: this.targetOffset.x * j, y: this.targetOffset.y * j }; var D = { x: N.x - this.currentOffset.x, y: N.y - this.currentOffset.y }; this.currentOffset.x += D.x, this.currentOffset.y += D.y, O.offsetBy(D), O.move(), this.onNextFrame(function() { return x.inertiaTick(); @@ -2798,9 +2798,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } else O.offsetBy({ x: this.modifiedOffset.x - this.currentOffset.x, y: this.modifiedOffset.y - this.currentOffset.y }), this.end(); } }, { key: "smoothEndTick", value: function() { - var c = this, h = this.interaction, b = h._now() - this.t0, E = Da(h).smoothEndDuration; + var c = this, h = this.interaction, b = h._now() - this.t0, E = za(h).smoothEndDuration; if (b < E) { - var y = { x: Wc(b, 0, this.targetOffset.x, E), y: Wc(b, 0, this.targetOffset.y, E) }, x = { x: y.x - this.currentOffset.x, y: y.y - this.currentOffset.y }; + var y = { x: qc(b, 0, this.targetOffset.x, E), y: qc(b, 0, this.targetOffset.y, E) }, x = { x: y.x - this.currentOffset.x, y: y.y - this.currentOffset.y }; this.currentOffset.x += x.x, this.currentOffset.y += x.y, h.offsetBy(x), h.move({ skipModifiers: this.modifierCount }), this.onNextFrame(function() { return c.smoothEndTick(); }); @@ -2813,20 +2813,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho this.interaction.move(), this.interaction.end(), this.stop(); } }, { key: "stop", value: function() { this.active = this.smoothEnd = false, this.interaction.simulation = null, At.default.cancel(this.timeout); - } }]) && ov(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; + } }]) && tv(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; }(); - function Da(i) { + function za(i) { var o = i.interactable, l = i.prepared; return o && o.options && l.name && o.options[l.name].inertia; } - __name(Da, "Da"); - u(Da, "dn"), Oi.InertiaState = Fc; - var av = { id: "inertia", before: ["modifiers", "actions"], install: function(i) { + __name(za, "za"); + u(za, "dn"), Ci.InertiaState = $c; + var rv = { id: "inertia", before: ["modifiers", "actions"], install: function(i) { var o = i.defaults; - i.usePlugin(Wn.default), i.usePlugin(Et.default), i.actions.phases.inertiastart = true, i.actions.phases.resume = true, o.perAction.inertia = { enabled: false, resistance: 10, minSpeed: 100, endSpeed: 10, allowResume: true, smoothEndDuration: 300 }; + i.usePlugin(Un.default), i.usePlugin(Et.default), i.actions.phases.inertiastart = true, i.actions.phases.resume = true, o.perAction.inertia = { enabled: false, resistance: 10, minSpeed: 100, endSpeed: 10, allowResume: true, smoothEndDuration: 300 }; }, listeners: { "interactions:new": function(i) { var o = i.interaction; - o.inertia = new Fc(o); + o.inertia = new $c(o); }, "interactions:before-action-end": function(i) { var o = i.interaction, l = i.event; return (!o._interacting || o.simulation || !o.inertia.start(l)) && null; @@ -2853,34 +2853,34 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }, "interactions:after-action-resume": function(i) { return i.interaction.modification.restoreInteractionCoords(i); } } }; - function Uc(i, o, l, c) { + function Bc(i, o, l, c) { var h = 1 - i; return h * h * o + 2 * h * i * l + i * i * c; } - __name(Uc, "Uc"); - u(Uc, "vn"); - function Wc(i, o, l, c) { + __name(Bc, "Bc"); + u(Bc, "vn"); + function qc(i, o, l, c) { return -l * (i /= c) * (i - 2) + o; } - __name(Wc, "Wc"); - u(Wc, "hn"); - var sv = av; - Oi.default = sv; - var vo = {}; - function lv(i, o) { + __name(qc, "qc"); + u(qc, "hn"); + var nv = rv; + Ci.default = nv; + var mo = {}; + function iv(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(lv, "lv"); - u(lv, "mn"); - function go(i, o, l) { + __name(iv, "iv"); + u(iv, "mn"); + function vo(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } - __name(go, "go"); - u(go, "bn"); - function Vc(i, o) { + __name(vo, "vo"); + u(vo, "bn"); + function Fc(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; if (i.immediatePropagationStopped) @@ -2888,21 +2888,21 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho c(i); } } - __name(Vc, "Vc"); - u(Vc, "xn"), Object.defineProperty(vo, "__esModule", { value: true }), vo.Eventable = void 0; - var uv = function() { + __name(Fc, "Fc"); + u(Fc, "xn"), Object.defineProperty(mo, "__esModule", { value: true }), mo.Eventable = void 0; + var ov = function() { function i(c) { (function(h, b) { if (!(h instanceof b)) throw new TypeError("Cannot call a class as a function"); - })(this, i), go(this, "options", void 0), go(this, "types", {}), go(this, "propagationStopped", false), go(this, "immediatePropagationStopped", false), go(this, "global", void 0), this.options = (0, q.default)({}, c || {}); + })(this, i), vo(this, "options", void 0), vo(this, "types", {}), vo(this, "propagationStopped", false), vo(this, "immediatePropagationStopped", false), vo(this, "global", void 0), this.options = (0, q.default)({}, c || {}); } __name(i, "i"); u(i, "t"); var o, l; return o = i, (l = [{ key: "fire", value: function(c) { var h, b = this.global; - (h = this.types[c.type]) && Vc(c, h), !c.propagationStopped && b && (h = b[c.type]) && Vc(c, h); + (h = this.types[c.type]) && Fc(c, h), !c.propagationStopped && b && (h = b[c.type]) && Fc(c, h); } }, { key: "on", value: function(c, h) { var b = (0, Ae.default)(c, h); for (c in b) @@ -2919,11 +2919,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } } }, { key: "getRect", value: function(c) { return null; - } }]) && lv(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; + } }]) && iv(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; }(); - vo.Eventable = uv; - var bo = {}; - Object.defineProperty(bo, "__esModule", { value: true }), bo.default = function(i, o) { + mo.Eventable = ov; + var go = {}; + Object.defineProperty(go, "__esModule", { value: true }), go.default = function(i, o) { if (o.phaselessTypes[i]) return true; for (var l in o.map) @@ -2931,8 +2931,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return true; return false; }; - var Il = {}; - Object.defineProperty(Il, "__esModule", { value: true }), Il.createInteractStatic = function(i) { + var Ol = {}; + Object.defineProperty(Ol, "__esModule", { value: true }), Ol.createInteractStatic = function(i) { var o = u(/* @__PURE__ */ __name(function l(c, h) { var b = i.interactables.get(c, h); return b || ((b = i.interactables.new(c, h)).events.global = l.globalEvents), b; @@ -2941,7 +2941,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return this.scope.usePlugin(l, c), this; }, o.isSet = function(l, c) { return !!this.scope.interactables.get(l, c && c.context); - }, o.on = (0, lr.warnOnce)(function(l, c, h) { + }, o.on = (0, sr.warnOnce)(function(l, c, h) { if (a.default.string(l) && l.search(" ") !== -1 && (l = l.trim().split(/ +/)), a.default.array(l)) { for (var b = 0; b < l.length; b++) { var E = l[b]; @@ -2954,8 +2954,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho this.on(y, l[y], c); return this; } - return (0, bo.default)(l, this.scope.actions) ? this.globalEvents[l] ? this.globalEvents[l].push(c) : this.globalEvents[l] = [c] : this.scope.events.add(this.scope.document, l, c, { options: h }), this; - }, "The interact.on() method is being deprecated"), o.off = (0, lr.warnOnce)(function(l, c, h) { + return (0, go.default)(l, this.scope.actions) ? this.globalEvents[l] ? this.globalEvents[l].push(c) : this.globalEvents[l] = [c] : this.scope.events.add(this.scope.document, l, c, { options: h }), this; + }, "The interact.on() method is being deprecated"), o.off = (0, sr.warnOnce)(function(l, c, h) { if (a.default.string(l) && l.search(" ") !== -1 && (l = l.trim().split(/ +/)), a.default.array(l)) { for (var b = 0; b < l.length; b++) { var E = l[b]; @@ -2969,13 +2969,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return this; } var x; - return (0, bo.default)(l, this.scope.actions) ? l in this.globalEvents && (x = this.globalEvents[l].indexOf(c)) !== -1 && this.globalEvents[l].splice(x, 1) : this.scope.events.remove(this.scope.document, l, c, h), this; + return (0, go.default)(l, this.scope.actions) ? l in this.globalEvents && (x = this.globalEvents[l].indexOf(c)) !== -1 && this.globalEvents[l].splice(x, 1) : this.scope.events.remove(this.scope.document, l, c, h), this; }, "The interact.off() method is being deprecated"), o.debug = function() { return this.scope; }, o.supportsTouch = function() { - return $.default.supportsTouch; + return B.default.supportsTouch; }, o.supportsPointerEvent = function() { - return $.default.supportsPointerEvent; + return B.default.supportsPointerEvent; }, o.stop = function() { for (var l = 0; l < this.scope.interactions.list.length; l++) this.scope.interactions.list[l].stop(); @@ -2988,26 +2988,26 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho this.scope.removeDocument(l); }, o; }; - var ka = {}; - function cv(i, o) { + var Ra = {}; + function av(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(cv, "cv"); - u(cv, "En"); - function Jr(i, o, l) { + __name(av, "av"); + u(av, "En"); + function Kr(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } - __name(Jr, "Jr"); - u(Jr, "Sn"), Object.defineProperty(ka, "__esModule", { value: true }), ka.Interactable = void 0; - var pv = function() { + __name(Kr, "Kr"); + u(Kr, "Sn"), Object.defineProperty(Ra, "__esModule", { value: true }), Ra.Interactable = void 0; + var sv = function() { function i(c, h, b, E) { (function(y, x) { if (!(y instanceof x)) throw new TypeError("Cannot call a class as a function"); - })(this, i), Jr(this, "options", void 0), Jr(this, "_actions", void 0), Jr(this, "target", void 0), Jr(this, "events", new vo.Eventable()), Jr(this, "_context", void 0), Jr(this, "_win", void 0), Jr(this, "_doc", void 0), Jr(this, "_scopeEvents", void 0), Jr(this, "_rectChecker", void 0), this._actions = h.actions, this.target = c, this._context = h.context || b, this._win = (0, r.getWindow)((0, z.trySelector)(c) ? this._context : c), this._doc = this._win.document, this._scopeEvents = E, this.set(h); + })(this, i), Kr(this, "options", void 0), Kr(this, "_actions", void 0), Kr(this, "target", void 0), Kr(this, "events", new mo.Eventable()), Kr(this, "_context", void 0), Kr(this, "_win", void 0), Kr(this, "_doc", void 0), Kr(this, "_scopeEvents", void 0), Kr(this, "_rectChecker", void 0), this._actions = h.actions, this.target = c, this._context = h.context || b, this._win = (0, r.getWindow)((0, z.trySelector)(c) ? this._context : c), this._doc = this._win.document, this._scopeEvents = E, this.set(h); } __name(i, "i"); u(i, "t"); @@ -3022,7 +3022,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho var b = this._defaults; for (var E in h) { var y = E, x = this.options[c], O = h[y]; - y === "listeners" && this.updatePerActionListeners(c, x.listeners, O), a.default.array(O) ? x[y] = Pe.from(O) : a.default.plainObject(O) ? (x[y] = (0, q.default)(x[y] || {}, (0, qn.default)(O)), a.default.object(b.perAction[y]) && "enabled" in b.perAction[y] && (x[y].enabled = O.enabled !== false)) : a.default.bool(O) && a.default.object(b.perAction[y]) ? x[y].enabled = O : x[y] = O; + y === "listeners" && this.updatePerActionListeners(c, x.listeners, O), a.default.array(O) ? x[y] = Pe.from(O) : a.default.plainObject(O) ? (x[y] = (0, q.default)(x[y] || {}, (0, Bn.default)(O)), a.default.object(b.perAction[y]) && "enabled" in b.perAction[y] && (x[y].enabled = O.enabled !== false)) : a.default.bool(O) && a.default.object(b.perAction[y]) ? x[y].enabled = O : x[y] = O; } } }, { key: "getRect", value: function(c) { return c = c || (a.default.element(this.target) ? this.target : null), a.default.string(this.target) && (c = c || this._context.querySelector(this.target)), (0, z.getElementRect)(c); @@ -3059,10 +3059,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho a.default.object(h) && !a.default.array(h) && (E = b, b = null); var y = c === "on" ? "add" : "remove", x = (0, Ae.default)(h, b); for (var O in x) { - O === "wheel" && (O = $.default.wheelEvent); + O === "wheel" && (O = B.default.wheelEvent); for (var I = 0; I < x[O].length; I++) { var P = x[O][I]; - (0, bo.default)(O, this._actions) ? this.events[c](O, P) : a.default.string(this.target) ? this._scopeEvents["".concat(y, "Delegate")](this.target, this._context, O, P, E) : this._scopeEvents[y](this.target, O, P, E); + (0, go.default)(O, this._actions) ? this.events[c](O, P) : a.default.string(this.target) ? this._scopeEvents["".concat(y, "Delegate")](this.target, this._context, O, P, E) : this._scopeEvents[y](this.target, O, P, E); } } return this; @@ -3072,7 +3072,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return this._onOff("off", c, h, b); } }, { key: "set", value: function(c) { var h = this._defaults; - for (var b in a.default.object(c) || (c = {}), this.options = (0, qn.default)(h.base), this._actions.methodDict) { + for (var b in a.default.object(c) || (c = {}), this.options = (0, Bn.default)(h.base), this._actions.methodDict) { var E = b, y = this._actions.methodDict[E]; this.options[E] = {}, this.setPerAction(E, (0, q.default)((0, q.default)({}, h.perAction), h.actions[E])), this[y](c[E]); } @@ -3090,30 +3090,30 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } else this._scopeEvents.remove(this.target, "all"); - } }]) && cv(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; + } }]) && av(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; }(); - ka.Interactable = pv; - var Na = {}; - function dv(i, o) { + Ra.Interactable = sv; + var Da = {}; + function lv(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(dv, "dv"); - u(dv, "Mn"); - function Al(i, o, l) { + __name(lv, "lv"); + u(lv, "Mn"); + function Ml(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } - __name(Al, "Al"); - u(Al, "kn"), Object.defineProperty(Na, "__esModule", { value: true }), Na.InteractableSet = void 0; - var fv = function() { + __name(Ml, "Ml"); + u(Ml, "kn"), Object.defineProperty(Da, "__esModule", { value: true }), Da.InteractableSet = void 0; + var uv = function() { function i(c) { var h = this; (function(b, E) { if (!(b instanceof E)) throw new TypeError("Cannot call a class as a function"); - })(this, i), Al(this, "list", []), Al(this, "selectorMap", {}), Al(this, "scope", void 0), this.scope = c, c.addListeners({ "interactable:unset": function(b) { + })(this, i), Ml(this, "list", []), Ml(this, "selectorMap", {}), Ml(this, "scope", void 0), this.scope = c, c.addListeners({ "interactable:unset": function(b) { var E = b.interactable, y = E.target, x = E._context, O = a.default.string(y) ? h.selectorMap[y] : y[h.scope.id], I = Pe.findIndex(O, function(P) { return P.context === x; }); @@ -3141,24 +3141,24 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho if ((a.default.string(E.target) ? a.default.element(c) && z.matchesSelector(c, E.target) : c === E.target) && E.inContext(c) && (y = h(E)), y !== void 0) return y; } - } }]) && dv(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; + } }]) && lv(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; }(); - Na.InteractableSet = fv; - var _a = {}; - function hv(i, o) { + Da.InteractableSet = uv; + var ka = {}; + function cv(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(hv, "hv"); - u(hv, "An"); - function Pl(i, o, l) { + __name(cv, "cv"); + u(cv, "An"); + function Il(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } - __name(Pl, "Pl"); - u(Pl, "zn"); - function zl(i, o) { + __name(Il, "Il"); + u(Il, "zn"); + function Al(i, o) { return function(l) { if (Array.isArray(l)) return l; @@ -3184,31 +3184,31 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }(i, o) || function(l, c) { if (l) { if (typeof l == "string") - return Yc(l, c); + return Uc(l, c); var h = Object.prototype.toString.call(l).slice(8, -1); - return h === "Object" && l.constructor && (h = l.constructor.name), h === "Map" || h === "Set" ? Array.from(l) : h === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h) ? Yc(l, c) : void 0; + return h === "Object" && l.constructor && (h = l.constructor.name), h === "Map" || h === "Set" ? Array.from(l) : h === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h) ? Uc(l, c) : void 0; } }(i, o) || function() { throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); }(); } - __name(zl, "zl"); - u(zl, "Cn"); - function Yc(i, o) { + __name(Al, "Al"); + u(Al, "Cn"); + function Uc(i, o) { (o == null || o > i.length) && (o = i.length); for (var l = 0, c = Array(o); l < o; l++) c[l] = i[l]; return c; } - __name(Yc, "Yc"); - u(Yc, "Rn"), Object.defineProperty(_a, "__esModule", { value: true }), _a.default = void 0; - var mv = function() { + __name(Uc, "Uc"); + u(Uc, "Rn"), Object.defineProperty(ka, "__esModule", { value: true }), ka.default = void 0; + var pv = function() { function i(c) { (function(h, b) { if (!(h instanceof b)) throw new TypeError("Cannot call a class as a function"); - })(this, i), Pl(this, "currentTarget", void 0), Pl(this, "originalEvent", void 0), Pl(this, "type", void 0), this.originalEvent = c, (0, Ye.default)(this, c); + })(this, i), Il(this, "currentTarget", void 0), Il(this, "originalEvent", void 0), Il(this, "type", void 0), this.originalEvent = c, (0, Ye.default)(this, c); } __name(i, "i"); u(i, "t"); @@ -3219,19 +3219,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho this.originalEvent.stopPropagation(); } }, { key: "stopImmediatePropagation", value: function() { this.originalEvent.stopImmediatePropagation(); - } }]) && hv(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; + } }]) && cv(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), i; }(); - function yo(i) { + function bo(i) { if (!a.default.object(i)) return { capture: !!i, passive: false }; var o = (0, q.default)({}, i); return o.capture = !!i.capture, o.passive = !!i.passive, o; } - __name(yo, "yo"); - u(yo, "Xn"); - var vv = { id: "events", install: function(i) { + __name(bo, "bo"); + u(bo, "Xn"); + var dv = { id: "events", install: function(i) { var o, l = [], c = {}, h = [], b = { add: E, remove: y, addDelegate: function(I, P, N, j, D) { - var F = yo(D); + var F = bo(D); if (!c[N]) { c[N] = []; for (var Z = 0; Z < h.length; Z++) { @@ -3244,14 +3244,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }); ae || (ae = { selector: I, context: P, listeners: [] }, ne.push(ae)), ae.listeners.push([j, F]); }, removeDelegate: function(I, P, N, j, D) { - var F, Z = yo(D), W = c[N], ne = false; + var F, Z = bo(D), W = c[N], ne = false; if (W) for (F = W.length - 1; F >= 0; F--) { var ae = W[F]; if (ae.selector === I && ae.context === P) { for (var ye = ae.listeners, De = ye.length - 1; De >= 0; De--) { - var qe = zl(ye[De], 2), Se = qe[0], Be = qe[1], wr = Be.capture, en = Be.passive; - if (Se === j && wr === Z.capture && en === Z.passive) { + var qe = Al(ye[De], 2), Se = qe[0], $e = qe[1], yr = $e.capture, Qr = $e.passive; + if (Se === j && yr === Z.capture && Qr === Z.passive) { ye.splice(De, 1), ye.length || (W.splice(F, 1), y(P, N, x), y(P, N, O, true)), ne = true; break; } @@ -3262,7 +3262,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } }, delegateListener: x, delegateUseCapture: O, delegatedEvents: c, documents: h, targets: l, supportsOptions: false, supportsPassive: false }; function E(I, P, N, j) { - var D = yo(j), F = Pe.find(l, function(Z) { + var D = bo(j), F = Pe.find(l, function(Z) { return Z.eventTarget === I; }); F || (F = { eventTarget: I, events: {} }, l.push(F)), F.events[P] || (F.events[P] = []), I.addEventListener && !Pe.contains(F.events[P], N) && (I.addEventListener(P, N, b.supportsOptions ? D : D.capture), F.events[P].push(N)); @@ -3270,7 +3270,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho __name(E, "E"); u(E, "s"); function y(I, P, N, j) { - var D = yo(j), F = Pe.findIndex(l, function(De) { + var D = bo(j), F = Pe.findIndex(l, function(De) { return De.eventTarget === I; }), Z = l[F]; if (Z && Z.events) @@ -3296,15 +3296,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho __name(y, "y"); u(y, "l"); function x(I, P) { - for (var N = yo(P), j = new mv(I), D = c[I.type], F = zl(J.getEventTargets(I), 1)[0], Z = F; a.default.element(Z); ) { + for (var N = bo(P), j = new pv(I), D = c[I.type], F = Al(J.getEventTargets(I), 1)[0], Z = F; a.default.element(Z); ) { for (var W = 0; W < D.length; W++) { var ne = D[W], ae = ne.selector, ye = ne.context; if (z.matchesSelector(Z, ae) && z.nodeContains(ye, F) && z.nodeContains(ye, Z)) { var De = ne.listeners; j.currentTarget = Z; for (var qe = 0; qe < De.length; qe++) { - var Se = zl(De[qe], 2), Be = Se[0], wr = Se[1], en = wr.capture, Kl = wr.passive; - en === N.capture && Kl === N.passive && Be(j); + var Se = Al(De[qe], 2), $e = Se[0], yr = Se[1], Qr = yr.capture, Xl = yr.passive; + Qr === N.capture && Xl === N.passive && $e(j); } } } @@ -3323,14 +3323,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return b.supportsPassive = true; } }), i.events = b, b; } }; - _a.default = vv; - var La = {}; - Object.defineProperty(La, "__esModule", { value: true }), La.default = void 0; - var Ga = { methodOrder: ["simulationResume", "mouseOrPen", "hasPointer", "idle"], search: function(i) { - for (var o = 0; o < Ga.methodOrder.length; o++) { + ka.default = dv; + var Na = {}; + Object.defineProperty(Na, "__esModule", { value: true }), Na.default = void 0; + var _a = { methodOrder: ["simulationResume", "mouseOrPen", "hasPointer", "idle"], search: function(i) { + for (var o = 0; o < _a.methodOrder.length; o++) { var l; - l = Ga.methodOrder[o]; - var c = Ga[l](i); + l = _a.methodOrder[o]; + var c = _a[l](i); if (c) return c; } @@ -3356,7 +3356,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho for (var E = 0; E < b.interactions.list.length; E++) { var y = b.interactions.list[E]; if (y.pointerType === c) { - if (y.simulation && !Xc(y, l)) + if (y.simulation && !Wc(y, l)) continue; if (y.interacting()) return y; @@ -3374,7 +3374,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }, hasPointer: function(i) { for (var o = i.pointerId, l = i.scope, c = 0; c < l.interactions.list.length; c++) { var h = l.interactions.list[c]; - if (Xc(h, o)) + if (Wc(h, o)) return h; } return null; @@ -3392,26 +3392,26 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } return null; } }; - function Xc(i, o) { + function Wc(i, o) { return i.pointers.some(function(l) { return l.id === o; }); } - __name(Xc, "Xc"); - u(Xc, "Ln"); - var gv = Ga; - La.default = gv; - var ja = {}; - function Rl(i) { - return Rl = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { + __name(Wc, "Wc"); + u(Wc, "Ln"); + var fv = _a; + Na.default = fv; + var La = {}; + function Pl(i) { + return Pl = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { return typeof o; } : function(o) { return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; - }, Rl(i); + }, Pl(i); } - __name(Rl, "Rl"); - u(Rl, "Nn"); - function Zc(i, o) { + __name(Pl, "Pl"); + u(Pl, "Nn"); + function Vc(i, o) { return function(l) { if (Array.isArray(l)) return l; @@ -3437,48 +3437,48 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }(i, o) || function(l, c) { if (l) { if (typeof l == "string") - return Kc(l, c); + return Yc(l, c); var h = Object.prototype.toString.call(l).slice(8, -1); - return h === "Object" && l.constructor && (h = l.constructor.name), h === "Map" || h === "Set" ? Array.from(l) : h === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h) ? Kc(l, c) : void 0; + return h === "Object" && l.constructor && (h = l.constructor.name), h === "Map" || h === "Set" ? Array.from(l) : h === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h) ? Yc(l, c) : void 0; } }(i, o) || function() { throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); }(); } - __name(Zc, "Zc"); - u(Zc, "qn"); - function Kc(i, o) { + __name(Vc, "Vc"); + u(Vc, "qn"); + function Yc(i, o) { (o == null || o > i.length) && (o = i.length); for (var l = 0, c = Array(o); l < o; l++) c[l] = i[l]; return c; } - __name(Kc, "Kc"); - u(Kc, "Gn"); - function bv(i, o) { + __name(Yc, "Yc"); + u(Yc, "Gn"); + function hv(i, o) { if (!(i instanceof o)) throw new TypeError("Cannot call a class as a function"); } - __name(bv, "bv"); - u(bv, "$n"); - function yv(i, o) { + __name(hv, "hv"); + u(hv, "$n"); + function mv(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(yv, "yv"); - u(yv, "Hn"); - function Dl(i, o) { - return Dl = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, c) { + __name(mv, "mv"); + u(mv, "Hn"); + function zl(i, o) { + return zl = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, c) { return l.__proto__ = c, l; - }, Dl(i, o); + }, zl(i, o); } - __name(Dl, "Dl"); - u(Dl, "Kn"); - function wv(i, o) { - if (o && (Rl(o) === "object" || typeof o == "function")) + __name(zl, "zl"); + u(zl, "Kn"); + function vv(i, o) { + if (o && (Pl(o) === "object" || typeof o == "function")) return o; if (o !== void 0) throw new TypeError("Derived constructors may only return object or undefined"); @@ -3488,52 +3488,52 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return l; }(i); } - __name(wv, "wv"); - u(wv, "Zn"); - function Ha(i) { - return Ha = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) { + __name(vv, "vv"); + u(vv, "Zn"); + function Ga(i) { + return Ga = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) { return o.__proto__ || Object.getPrototypeOf(o); - }, Ha(i); + }, Ga(i); } - __name(Ha, "Ha"); - u(Ha, "Jn"), Object.defineProperty(ja, "__esModule", { value: true }), ja.default = void 0; - var kl = ["pointerDown", "pointerMove", "pointerUp", "updatePointer", "removePointer", "windowBlur"]; - function Jc(i, o) { + __name(Ga, "Ga"); + u(Ga, "Jn"), Object.defineProperty(La, "__esModule", { value: true }), La.default = void 0; + var Rl = ["pointerDown", "pointerMove", "pointerUp", "updatePointer", "removePointer", "windowBlur"]; + function Xc(i, o) { return function(l) { - var c = o.interactions.list, h = J.getPointerType(l), b = Zc(J.getEventTargets(l), 2), E = b[0], y = b[1], x = []; + var c = o.interactions.list, h = J.getPointerType(l), b = Vc(J.getEventTargets(l), 2), E = b[0], y = b[1], x = []; if (/^touch/.test(l.type)) { o.prevTouchTime = o.now(); for (var O = 0; O < l.changedTouches.length; O++) { - var I = l.changedTouches[O], P = { pointer: I, pointerId: J.getPointerId(I), pointerType: h, eventType: l.type, eventTarget: E, curEventTarget: y, scope: o }, N = Qc(P); + var I = l.changedTouches[O], P = { pointer: I, pointerId: J.getPointerId(I), pointerType: h, eventType: l.type, eventTarget: E, curEventTarget: y, scope: o }, N = Zc(P); x.push([P.pointer, P.eventTarget, P.curEventTarget, N]); } } else { var j = false; - if (!$.default.supportsPointerEvent && /mouse/.test(l.type)) { + if (!B.default.supportsPointerEvent && /mouse/.test(l.type)) { for (var D = 0; D < c.length && !j; D++) j = c[D].pointerType !== "mouse" && c[D].pointerIsDown; j = j || o.now() - o.prevTouchTime < 500 || l.timeStamp === 0; } if (!j) { - var F = { pointer: l, pointerId: J.getPointerId(l), pointerType: h, eventType: l.type, curEventTarget: y, eventTarget: E, scope: o }, Z = Qc(F); + var F = { pointer: l, pointerId: J.getPointerId(l), pointerType: h, eventType: l.type, curEventTarget: y, eventTarget: E, scope: o }, Z = Zc(F); x.push([F.pointer, F.eventTarget, F.curEventTarget, Z]); } } for (var W = 0; W < x.length; W++) { - var ne = Zc(x[W], 4), ae = ne[0], ye = ne[1], De = ne[2]; + var ne = Vc(x[W], 4), ae = ne[0], ye = ne[1], De = ne[2]; ne[3][i](ae, l, ye, De); } }; } - __name(Jc, "Jc"); - u(Jc, "tr"); - function Qc(i) { - var o = i.pointerType, l = i.scope, c = { interaction: La.default.search(i), searchDetails: i }; + __name(Xc, "Xc"); + u(Xc, "tr"); + function Zc(i) { + var o = i.pointerType, l = i.scope, c = { interaction: Na.default.search(i), searchDetails: i }; return l.fire("interactions:find", c), c.interaction || l.interactions.new({ pointerType: o }); } - __name(Qc, "Qc"); - u(Qc, "er"); - function Nl(i, o) { + __name(Zc, "Zc"); + u(Zc, "er"); + function Dl(i, o) { var l = i.doc, c = i.scope, h = i.options, b = c.interactions.docEvents, E = c.events, y = E[o]; for (var x in c.browser.isIOS && !h.events && (h.events = { passive: false }), E.delegatedEvents) y(l, x, E.delegateListener), y(l, x, E.delegateUseCapture, true); @@ -3542,14 +3542,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho y(l, P.type, P.listener, O); } } - __name(Nl, "Nl"); - u(Nl, "nr"); - var xv = { id: "core/interactions", install: function(i) { - for (var o = {}, l = 0; l < kl.length; l++) { - var c = kl[l]; - o[c] = Jc(c, i); + __name(Dl, "Dl"); + u(Dl, "nr"); + var gv = { id: "core/interactions", install: function(i) { + for (var o = {}, l = 0; l < Rl.length; l++) { + var c = Rl[l]; + o[c] = Xc(c, i); } - var h, b = $.default.pEventTypes; + var h, b = B.default.pEventTypes; function E() { for (var y = 0; y < i.interactions.list.length; y++) { var x = i.interactions.list[y]; @@ -3572,7 +3572,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho (function(D, F) { if (typeof F != "function" && F !== null) throw new TypeError("Super expression must either be null or a function"); - D.prototype = Object.create(F && F.prototype, { constructor: { value: D, writable: true, configurable: true } }), Object.defineProperty(D, "prototype", { writable: false }), F && Dl(D, F); + D.prototype = Object.create(F && F.prototype, { constructor: { value: D, writable: true, configurable: true } }), Object.defineProperty(D, "prototype", { writable: false }), F && zl(D, F); })(j, y); var x, O, I, P, N = (I = j, P = function() { if (typeof Reflect == "undefined" || !Reflect.construct || Reflect.construct.sham) @@ -3586,16 +3586,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return false; } }(), function() { - var D, F = Ha(I); + var D, F = Ga(I); if (P) { - var Z = Ha(this).constructor; + var Z = Ga(this).constructor; D = Reflect.construct(F, arguments, Z); } else D = F.apply(this, arguments); - return wv(this, D); + return vv(this, D); }); function j() { - return bv(this, j), N.apply(this, arguments); + return hv(this, j), N.apply(this, arguments); } __name(j, "j"); return u(j, "s"), x = j, (O = [{ key: "pointerMoveTolerance", get: function() { @@ -3604,62 +3604,62 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho i.interactions.pointerMoveTolerance = D; } }, { key: "_now", value: function() { return i.now(); - } }]) && yv(x.prototype, O), Object.defineProperty(x, "prototype", { writable: false }), j; - }(tr.default), i.interactions = { list: [], new: function(y) { + } }]) && mv(x.prototype, O), Object.defineProperty(x, "prototype", { writable: false }), j; + }(Qt.default), i.interactions = { list: [], new: function(y) { y.scopeFire = function(O, I) { return i.fire(O, I); }; var x = new i.Interaction(y); return i.interactions.list.push(x), x; - }, listeners: o, docEvents: h, pointerMoveTolerance: 1 }, i.usePlugin(Ci.default); + }, listeners: o, docEvents: h, pointerMoveTolerance: 1 }, i.usePlugin(Ti.default); }, listeners: { "scope:add-document": function(i) { - return Nl(i, "add"); + return Dl(i, "add"); }, "scope:remove-document": function(i) { - return Nl(i, "remove"); + return Dl(i, "remove"); }, "interactable:unset": function(i, o) { for (var l = i.interactable, c = o.interactions.list.length - 1; c >= 0; c--) { var h = o.interactions.list[c]; h.interactable === l && (h.stop(), o.fire("interactions:destroy", { interaction: h }), h.destroy(), o.interactions.list.length > 2 && o.interactions.list.splice(c, 1)); } - } }, onDocSignal: Nl, doOnInteractions: Jc, methodNames: kl }, Ev = xv; - ja.default = Ev; - var wo = {}; - function _l(i) { - return _l = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { + } }, onDocSignal: Dl, doOnInteractions: Xc, methodNames: Rl }, bv = gv; + La.default = bv; + var yo = {}; + function kl(i) { + return kl = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { return typeof o; } : function(o) { return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; - }, _l(i); + }, kl(i); } - __name(_l, "_l"); - u(_l, "ar"); - function xo() { - return xo = typeof Reflect != "undefined" && Reflect.get ? Reflect.get.bind() : function(i, o, l) { - var c = Sv(i, o); + __name(kl, "kl"); + u(kl, "ar"); + function wo() { + return wo = typeof Reflect != "undefined" && Reflect.get ? Reflect.get.bind() : function(i, o, l) { + var c = yv(i, o); if (c) { var h = Object.getOwnPropertyDescriptor(c, o); return h.get ? h.get.call(arguments.length < 3 ? i : l) : h.value; } - }, xo.apply(this, arguments); + }, wo.apply(this, arguments); } - __name(xo, "xo"); - u(xo, "sr"); - function Sv(i, o) { - for (; !Object.prototype.hasOwnProperty.call(i, o) && (i = bn(i)) !== null; ) + __name(wo, "wo"); + u(wo, "sr"); + function yv(i, o) { + for (; !Object.prototype.hasOwnProperty.call(i, o) && (i = vn(i)) !== null; ) ; return i; } - __name(Sv, "Sv"); - u(Sv, "lr"); - function Ll(i, o) { - return Ll = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, c) { + __name(yv, "yv"); + u(yv, "lr"); + function Nl(i, o) { + return Nl = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, c) { return l.__proto__ = c, l; - }, Ll(i, o); + }, Nl(i, o); } - __name(Ll, "Ll"); - u(Ll, "ur"); - function Tv(i, o) { - if (o && (_l(o) === "object" || typeof o == "function")) + __name(Nl, "Nl"); + u(Nl, "ur"); + function wv(i, o) { + if (o && (kl(o) === "object" || typeof o == "function")) return o; if (o !== void 0) throw new TypeError("Derived constructors may only return object or undefined"); @@ -3669,43 +3669,43 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return l; }(i); } - __name(Tv, "Tv"); - u(Tv, "cr"); - function bn(i) { - return bn = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) { + __name(wv, "wv"); + u(wv, "cr"); + function vn(i) { + return vn = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) { return o.__proto__ || Object.getPrototypeOf(o); - }, bn(i); + }, vn(i); } - __name(bn, "bn"); - u(bn, "fr"); - function ep(i, o) { + __name(vn, "vn"); + u(vn, "fr"); + function Kc(i, o) { if (!(i instanceof o)) throw new TypeError("Cannot call a class as a function"); } - __name(ep, "ep"); - u(ep, "dr"); - function tp(i, o) { + __name(Kc, "Kc"); + u(Kc, "dr"); + function Jc(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(tp, "tp"); - u(tp, "pr"); - function rp(i, o, l) { - return o && tp(i.prototype, o), l && tp(i, l), Object.defineProperty(i, "prototype", { writable: false }), i; + __name(Jc, "Jc"); + u(Jc, "pr"); + function Qc(i, o, l) { + return o && Jc(i.prototype, o), l && Jc(i, l), Object.defineProperty(i, "prototype", { writable: false }), i; } - __name(rp, "rp"); - u(rp, "vr"); + __name(Qc, "Qc"); + u(Qc, "vr"); function St(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } __name(St, "St"); - u(St, "hr"), Object.defineProperty(wo, "__esModule", { value: true }), wo.Scope = void 0, wo.initScope = np; - var Cv = function() { + u(St, "hr"), Object.defineProperty(yo, "__esModule", { value: true }), yo.Scope = void 0, yo.initScope = ep; + var xv = function() { function i() { var o = this; - ep(this, i), St(this, "id", "__interact_scope_".concat(Math.floor(100 * Math.random()))), St(this, "isInitialized", false), St(this, "listenerMaps", []), St(this, "browser", $.default), St(this, "defaults", (0, qn.default)(po.defaults)), St(this, "Eventable", vo.Eventable), St(this, "actions", { map: {}, phases: { start: true, move: true, end: true }, methodDict: {}, phaselessTypes: {} }), St(this, "interactStatic", (0, Il.createInteractStatic)(this)), St(this, "InteractEvent", fo.InteractEvent), St(this, "Interactable", void 0), St(this, "interactables", new Na.InteractableSet(this)), St(this, "_win", void 0), St(this, "document", void 0), St(this, "window", void 0), St(this, "documents", []), St(this, "_plugins", { list: [], map: {} }), St(this, "onWindowUnload", function(c) { + Kc(this, i), St(this, "id", "__interact_scope_".concat(Math.floor(100 * Math.random()))), St(this, "isInitialized", false), St(this, "listenerMaps", []), St(this, "browser", B.default), St(this, "defaults", (0, Bn.default)(co.defaults)), St(this, "Eventable", mo.Eventable), St(this, "actions", { map: {}, phases: { start: true, move: true, end: true }, methodDict: {}, phaselessTypes: {} }), St(this, "interactStatic", (0, Ol.createInteractStatic)(this)), St(this, "InteractEvent", po.InteractEvent), St(this, "Interactable", void 0), St(this, "interactables", new Da.InteractableSet(this)), St(this, "_win", void 0), St(this, "document", void 0), St(this, "window", void 0), St(this, "documents", []), St(this, "_plugins", { list: [], map: {} }), St(this, "onWindowUnload", function(c) { return o.removeDocument(c.target); }); var l = this; @@ -3713,7 +3713,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho (function(x, O) { if (typeof O != "function" && O !== null) throw new TypeError("Super expression must either be null or a function"); - x.prototype = Object.create(O && O.prototype, { constructor: { value: x, writable: true, configurable: true } }), Object.defineProperty(x, "prototype", { writable: false }), O && Ll(x, O); + x.prototype = Object.create(O && O.prototype, { constructor: { value: x, writable: true, configurable: true } }), Object.defineProperty(x, "prototype", { writable: false }), O && Nl(x, O); })(y, c); var h, b, E = (h = y, b = function() { if (typeof Reflect == "undefined" || !Reflect.construct || Reflect.construct.sham) @@ -3727,31 +3727,31 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return false; } }(), function() { - var x, O = bn(h); + var x, O = vn(h); if (b) { - var I = bn(this).constructor; + var I = vn(this).constructor; x = Reflect.construct(O, arguments, I); } else x = O.apply(this, arguments); - return Tv(this, x); + return wv(this, x); }); function y() { - return ep(this, y), E.apply(this, arguments); + return Kc(this, y), E.apply(this, arguments); } __name(y, "y"); - return u(y, "i"), rp(y, [{ key: "_defaults", get: function() { + return u(y, "i"), Qc(y, [{ key: "_defaults", get: function() { return l.defaults; } }, { key: "set", value: function(x) { - return xo(bn(y.prototype), "set", this).call(this, x), l.fire("interactable:set", { options: x, interactable: this }), this; + return wo(vn(y.prototype), "set", this).call(this, x), l.fire("interactable:set", { options: x, interactable: this }), this; } }, { key: "unset", value: function() { - xo(bn(y.prototype), "unset", this).call(this); + wo(vn(y.prototype), "unset", this).call(this); var x = l.interactables.list.indexOf(this); - x < 0 || (xo(bn(y.prototype), "unset", this).call(this), l.interactables.list.splice(x, 1), l.fire("interactable:unset", { interactable: this })); + x < 0 || (wo(vn(y.prototype), "unset", this).call(this), l.interactables.list.splice(x, 1), l.fire("interactable:unset", { interactable: this })); } }]), y; - }(ka.Interactable); + }(Ra.Interactable); } __name(i, "i"); - return u(i, "t"), rp(i, [{ key: "addListeners", value: function(o, l) { + return u(i, "t"), Qc(i, [{ key: "addListeners", value: function(o, l) { this.listenerMaps.push({ id: l, map: o }); } }, { key: "fire", value: function(o, l) { for (var c = 0; c < this.listenerMaps.length; c++) { @@ -3760,7 +3760,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return false; } } }, { key: "init", value: function(o) { - return this.isInitialized ? this : np(this, o); + return this.isInitialized ? this : ep(this, o); } }, { key: "pluginIsInstalled", value: function(o) { return this._plugins.map[o.id] || this._plugins.list.indexOf(o) !== -1; } }, { key: "usePlugin", value: function(o, l) { @@ -3770,10 +3770,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return this; if (o.id && (this._plugins.map[o.id] = o), this._plugins.list.push(o), o.install && o.install(this, l), o.listeners && o.before) { for (var c = 0, h = this.listenerMaps.length, b = o.before.reduce(function(y, x) { - return y[x] = true, y[ip(x)] = true, y; + return y[x] = true, y[tp(x)] = true, y; }, {}); c < h; c++) { var E = this.listenerMaps[c].id; - if (b[E] || b[ip(E)]) + if (b[E] || b[tp(E)]) break; } this.listenerMaps.splice(c, 0, { id: o.id, map: o.listeners }); @@ -3800,36 +3800,36 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return (this.window.Date || Date).now(); } }]), i; }(); - function np(i, o) { - return i.isInitialized = true, a.default.window(o) && r.init(o), C.default.init(o), $.default.init(o), At.default.init(o), i.window = o, i.document = o.document, i.usePlugin(ja.default), i.usePlugin(_a.default), i; + function ep(i, o) { + return i.isInitialized = true, a.default.window(o) && r.init(o), C.default.init(o), B.default.init(o), At.default.init(o), i.window = o, i.document = o.document, i.usePlugin(La.default), i.usePlugin(ka.default), i; } - __name(np, "np"); - u(np, "yr"); - function ip(i) { + __name(ep, "ep"); + u(ep, "yr"); + function tp(i) { return i && i.replace(/\/.*$/, ""); } - __name(ip, "ip"); - u(ip, "mr"), wo.Scope = Cv; - var Gl = {}, dt = {}; + __name(tp, "tp"); + u(tp, "mr"), yo.Scope = xv; + var _l = {}, dt = {}; Object.defineProperty(dt, "__esModule", { value: true }); - var Ov = {}; - dt.default = void 0, Object.keys(Gl).forEach(function(i) { - i !== "default" && i !== "__esModule" && (Object.prototype.hasOwnProperty.call(Ov, i) || i in dt && dt[i] === Gl[i] || Object.defineProperty(dt, i, { enumerable: true, get: function() { - return Gl[i]; + var Ev = {}; + dt.default = void 0, Object.keys(_l).forEach(function(i) { + i !== "default" && i !== "__esModule" && (Object.prototype.hasOwnProperty.call(Ev, i) || i in dt && dt[i] === _l[i] || Object.defineProperty(dt, i, { enumerable: true, get: function() { + return _l[i]; } })); }); - var op = new wo.Scope(), Mv = op.interactStatic; - dt.default = Mv; - var Iv = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : void 0; - op.init(Iv); - var Ba = {}; - Object.defineProperty(Ba, "__esModule", { value: true }), Ba.default = void 0, Ba.default = function() { + var rp = new yo.Scope(), Sv = rp.interactStatic; + dt.default = Sv; + var Tv = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : void 0; + rp.init(Tv); + var ja = {}; + Object.defineProperty(ja, "__esModule", { value: true }), ja.default = void 0, ja.default = function() { }; - var $a = {}; - Object.defineProperty($a, "__esModule", { value: true }), $a.default = void 0, $a.default = function() { + var Ha = {}; + Object.defineProperty(Ha, "__esModule", { value: true }), Ha.default = void 0, Ha.default = function() { }; - var qa = {}; - function ap(i, o) { + var $a = {}; + function np(i, o) { return function(l) { if (Array.isArray(l)) return l; @@ -3855,54 +3855,54 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }(i, o) || function(l, c) { if (l) { if (typeof l == "string") - return sp(l, c); + return ip(l, c); var h = Object.prototype.toString.call(l).slice(8, -1); - return h === "Object" && l.constructor && (h = l.constructor.name), h === "Map" || h === "Set" ? Array.from(l) : h === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h) ? sp(l, c) : void 0; + return h === "Object" && l.constructor && (h = l.constructor.name), h === "Map" || h === "Set" ? Array.from(l) : h === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h) ? ip(l, c) : void 0; } }(i, o) || function() { throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); }(); } - __name(ap, "ap"); - u(ap, "jr"); - function sp(i, o) { + __name(np, "np"); + u(np, "jr"); + function ip(i, o) { (o == null || o > i.length) && (o = i.length); for (var l = 0, c = Array(o); l < o; l++) c[l] = i[l]; return c; } - __name(sp, "sp"); - u(sp, "Mr"), Object.defineProperty(qa, "__esModule", { value: true }), qa.default = void 0, qa.default = function(i) { + __name(ip, "ip"); + u(ip, "Mr"), Object.defineProperty($a, "__esModule", { value: true }), $a.default = void 0, $a.default = function(i) { var o = [["x", "y"], ["left", "top"], ["right", "bottom"], ["width", "height"]].filter(function(c) { - var h = ap(c, 2), b = h[0], E = h[1]; + var h = np(c, 2), b = h[0], E = h[1]; return b in i || E in i; }), l = u(function(c, h) { for (var b = i.range, E = i.limits, y = E === void 0 ? { left: -1 / 0, right: 1 / 0, top: -1 / 0, bottom: 1 / 0 } : E, x = i.offset, O = x === void 0 ? { x: 0, y: 0 } : x, I = { range: b, grid: i, x: null, y: null }, P = 0; P < o.length; P++) { - var N = ap(o[P], 2), j = N[0], D = N[1], F = Math.round((c - O.x) / i[j]), Z = Math.round((h - O.y) / i[D]); + var N = np(o[P], 2), j = N[0], D = N[1], F = Math.round((c - O.x) / i[j]), Z = Math.round((h - O.y) / i[D]); I[j] = Math.max(y.left, Math.min(y.right, F * i[j] + O.x)), I[D] = Math.max(y.top, Math.min(y.bottom, Z * i[D] + O.y)); } return I; }, "n"); return l.grid = i, l.coordFields = o, l; }; - var Eo = {}; - Object.defineProperty(Eo, "__esModule", { value: true }), Object.defineProperty(Eo, "edgeTarget", { enumerable: true, get: function() { - return Ba.default; - } }), Object.defineProperty(Eo, "elements", { enumerable: true, get: function() { + var xo = {}; + Object.defineProperty(xo, "__esModule", { value: true }), Object.defineProperty(xo, "edgeTarget", { enumerable: true, get: function() { + return ja.default; + } }), Object.defineProperty(xo, "elements", { enumerable: true, get: function() { + return Ha.default; + } }), Object.defineProperty(xo, "grid", { enumerable: true, get: function() { return $a.default; - } }), Object.defineProperty(Eo, "grid", { enumerable: true, get: function() { - return qa.default; } }); - var Fa = {}; - Object.defineProperty(Fa, "__esModule", { value: true }), Fa.default = void 0; - var Av = { id: "snappers", install: function(i) { + var Ba = {}; + Object.defineProperty(Ba, "__esModule", { value: true }), Ba.default = void 0; + var Cv = { id: "snappers", install: function(i) { var o = i.interactStatic; - o.snappers = (0, q.default)(o.snappers || {}, Eo), o.createSnapGrid = o.snappers.grid; - } }, Pv = Av; - Fa.default = Pv; - var Mi = {}; - function lp(i, o) { + o.snappers = (0, q.default)(o.snappers || {}, xo), o.createSnapGrid = o.snappers.grid; + } }, Ov = Cv; + Ba.default = Ov; + var Oi = {}; + function op(i, o) { var l = Object.keys(i); if (Object.getOwnPropertySymbols) { var c = Object.getOwnPropertySymbols(i); @@ -3912,27 +3912,27 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } return l; } - __name(lp, "lp"); - u(lp, "Cr"); - function jl(i) { + __name(op, "op"); + u(op, "Cr"); + function Ll(i) { for (var o = 1; o < arguments.length; o++) { var l = arguments[o] != null ? arguments[o] : {}; - o % 2 ? lp(Object(l), true).forEach(function(c) { - zv(i, c, l[c]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(i, Object.getOwnPropertyDescriptors(l)) : lp(Object(l)).forEach(function(c) { + o % 2 ? op(Object(l), true).forEach(function(c) { + Mv(i, c, l[c]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(i, Object.getOwnPropertyDescriptors(l)) : op(Object(l)).forEach(function(c) { Object.defineProperty(i, c, Object.getOwnPropertyDescriptor(l, c)); }); } return i; } - __name(jl, "jl"); - u(jl, "Rr"); - function zv(i, o, l) { + __name(Ll, "Ll"); + u(Ll, "Rr"); + function Mv(i, o, l) { return o in i ? Object.defineProperty(i, o, { value: l, enumerable: true, configurable: true, writable: true }) : i[o] = l, i; } - __name(zv, "zv"); - u(zv, "Fr"), Object.defineProperty(Mi, "__esModule", { value: true }), Mi.default = Mi.aspectRatio = void 0; - var up = { start: function(i) { + __name(Mv, "Mv"); + u(Mv, "Fr"), Object.defineProperty(Oi, "__esModule", { value: true }), Oi.default = Oi.aspectRatio = void 0; + var ap = { start: function(i) { var o = i.state, l = i.rect, c = i.edges, h = i.pageCoords, b = o.options.ratio, E = o.options, y = E.equalDelta, x = E.modifiers; b === "preserve" && (b = l.width / l.height), o.startCoords = (0, q.default)({}, h), o.startRect = (0, q.default)({}, l), o.ratio = b, o.equalDelta = y; var O = o.linkedEdges = { top: c.top || c.left && !c.bottom, left: c.left || c.top && !c.right, bottom: c.bottom || c.right && !c.top, right: c.right || c.bottom && !c.left }; @@ -3942,25 +3942,25 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } else o.edgeSign = { x: O.left ? -1 : 1, y: O.top ? -1 : 1 }; if ((0, q.default)(i.edges, O), x && x.length) { - var P = new Fn.default(i.interaction); - P.copyFrom(i.interaction.modification), P.prepareStates(x), o.subModification = P, P.startAll(jl({}, i)); + var P = new qn.default(i.interaction); + P.copyFrom(i.interaction.modification), P.prepareStates(x), o.subModification = P, P.startAll(Ll({}, i)); } }, set: function(i) { - var o = i.state, l = i.rect, c = i.coords, h = (0, q.default)({}, c), b = o.equalDelta ? Rv : Dv; + var o = i.state, l = i.rect, c = i.coords, h = (0, q.default)({}, c), b = o.equalDelta ? Iv : Av; if (b(o, o.xIsPrimaryAxis, c, l), !o.subModification) return null; var E = (0, q.default)({}, l); (0, oe.addEdges)(o.linkedEdges, E, { x: c.x - h.x, y: c.y - h.y }); - var y = o.subModification.setAll(jl(jl({}, i), {}, { rect: E, edges: o.linkedEdges, pageCoords: c, prevCoords: c, prevRect: E })), x = y.delta; + var y = o.subModification.setAll(Ll(Ll({}, i), {}, { rect: E, edges: o.linkedEdges, pageCoords: c, prevCoords: c, prevRect: E })), x = y.delta; return y.changed && (b(o, Math.abs(x.x) > Math.abs(x.y), y.coords, y.rect), (0, q.default)(c, y.coords)), y.eventProps; }, defaults: { ratio: "preserve", equalDelta: false, modifiers: [], enabled: false } }; - function Rv(i, o, l) { + function Iv(i, o, l) { var c = i.startCoords, h = i.edgeSign; o ? l.y = c.y + (l.x - c.x) * h.y : l.x = c.x + (l.y - c.y) * h.x; } - __name(Rv, "Rv"); - u(Rv, "Br"); - function Dv(i, o, l, c) { + __name(Iv, "Iv"); + u(Iv, "Br"); + function Av(i, o, l, c) { var h = i.startRect, b = i.startCoords, E = i.ratio, y = i.edgeSign; if (o) { var x = c.width / E; @@ -3970,31 +3970,31 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho l.x = b.x + (O - h.width) * y.x; } } - __name(Dv, "Dv"); - u(Dv, "Yr"), Mi.aspectRatio = up; - var kv = (0, Et.makeModifier)(up, "aspectRatio"); - Mi.default = kv; - var Vn = {}; - Object.defineProperty(Vn, "__esModule", { value: true }), Vn.default = void 0; - var cp = u(function() { + __name(Av, "Av"); + u(Av, "Yr"), Oi.aspectRatio = ap; + var Pv = (0, Et.makeModifier)(ap, "aspectRatio"); + Oi.default = Pv; + var Wn = {}; + Object.defineProperty(Wn, "__esModule", { value: true }), Wn.default = void 0; + var sp = u(function() { }, "Ur"); - cp._defaults = {}; - var Nv = cp; - Vn.default = Nv; - var Hl = {}; - Object.defineProperty(Hl, "__esModule", { value: true }), Object.defineProperty(Hl, "default", { enumerable: true, get: function() { - return Vn.default; + sp._defaults = {}; + var zv = sp; + Wn.default = zv; + var Gl = {}; + Object.defineProperty(Gl, "__esModule", { value: true }), Object.defineProperty(Gl, "default", { enumerable: true, get: function() { + return Wn.default; } }); - var Gt = {}; - function Bl(i, o, l) { + var Lt = {}; + function jl(i, o, l) { return a.default.func(i) ? oe.resolveRectLike(i, o.interactable, o.element, [l.x, l.y, o]) : oe.resolveRectLike(i, o.interactable, o.element); } - __name(Bl, "Bl"); - u(Bl, "Gr"), Object.defineProperty(Gt, "__esModule", { value: true }), Gt.default = void 0, Gt.getRestrictionRect = Bl, Gt.restrict = void 0; - var pp = { start: function(i) { + __name(jl, "jl"); + u(jl, "Gr"), Object.defineProperty(Lt, "__esModule", { value: true }), Lt.default = void 0, Lt.getRestrictionRect = jl, Lt.restrict = void 0; + var lp = { start: function(i) { var o = i.rect, l = i.startOffset, c = i.state, h = i.interaction, b = i.pageCoords, E = c.options, y = E.elementRect, x = (0, q.default)({ left: 0, top: 0, right: 0, bottom: 0 }, E.offset || {}); if (o && y) { - var O = Bl(E.restriction, h, b); + var O = jl(E.restriction, h, b); if (O) { var I = O.right - O.left - o.width, P = O.bottom - O.top - o.height; I < 0 && (x.left += I, x.right += I), P < 0 && (x.top += P, x.bottom += P); @@ -4003,74 +4003,74 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } c.offset = x; }, set: function(i) { - var o = i.coords, l = i.interaction, c = i.state, h = c.options, b = c.offset, E = Bl(h.restriction, l, o); + var o = i.coords, l = i.interaction, c = i.state, h = c.options, b = c.offset, E = jl(h.restriction, l, o); if (E) { var y = oe.xywhToTlbr(E); o.x = Math.max(Math.min(y.right - b.right, o.x), y.left + b.left), o.y = Math.max(Math.min(y.bottom - b.bottom, o.y), y.top + b.top); } }, defaults: { restriction: null, elementRect: null, offset: null, endOnly: false, enabled: false } }; - Gt.restrict = pp; - var _v = (0, Et.makeModifier)(pp, "restrict"); - Gt.default = _v; - var Gr = {}; - Object.defineProperty(Gr, "__esModule", { value: true }), Gr.restrictEdges = Gr.default = void 0; - var dp = { top: 1 / 0, left: 1 / 0, bottom: -1 / 0, right: -1 / 0 }, fp = { top: -1 / 0, left: -1 / 0, bottom: 1 / 0, right: 1 / 0 }; - function hp(i, o) { + Lt.restrict = lp; + var Rv = (0, Et.makeModifier)(lp, "restrict"); + Lt.default = Rv; + var Lr = {}; + Object.defineProperty(Lr, "__esModule", { value: true }), Lr.restrictEdges = Lr.default = void 0; + var up = { top: 1 / 0, left: 1 / 0, bottom: -1 / 0, right: -1 / 0 }, cp = { top: -1 / 0, left: -1 / 0, bottom: 1 / 0, right: 1 / 0 }; + function pp(i, o) { for (var l = ["top", "left", "bottom", "right"], c = 0; c < l.length; c++) { var h = l[c]; h in i || (i[h] = o[h]); } return i; } - __name(hp, "hp"); - u(hp, "Qr"); - var mp = { noInner: dp, noOuter: fp, start: function(i) { + __name(pp, "pp"); + u(pp, "Qr"); + var dp = { noInner: up, noOuter: cp, start: function(i) { var o, l = i.interaction, c = i.startOffset, h = i.state, b = h.options; if (b) { - var E = (0, Gt.getRestrictionRect)(b.offset, l, l.coords.start.page); + var E = (0, Lt.getRestrictionRect)(b.offset, l, l.coords.start.page); o = oe.rectToXY(E); } o = o || { x: 0, y: 0 }, h.offset = { top: o.y + c.top, left: o.x + c.left, bottom: o.y - c.bottom, right: o.x - c.right }; }, set: function(i) { var o = i.coords, l = i.edges, c = i.interaction, h = i.state, b = h.offset, E = h.options; if (l) { - var y = (0, q.default)({}, o), x = (0, Gt.getRestrictionRect)(E.inner, c, y) || {}, O = (0, Gt.getRestrictionRect)(E.outer, c, y) || {}; - hp(x, dp), hp(O, fp), l.top ? o.y = Math.min(Math.max(O.top + b.top, y.y), x.top + b.top) : l.bottom && (o.y = Math.max(Math.min(O.bottom + b.bottom, y.y), x.bottom + b.bottom)), l.left ? o.x = Math.min(Math.max(O.left + b.left, y.x), x.left + b.left) : l.right && (o.x = Math.max(Math.min(O.right + b.right, y.x), x.right + b.right)); + var y = (0, q.default)({}, o), x = (0, Lt.getRestrictionRect)(E.inner, c, y) || {}, O = (0, Lt.getRestrictionRect)(E.outer, c, y) || {}; + pp(x, up), pp(O, cp), l.top ? o.y = Math.min(Math.max(O.top + b.top, y.y), x.top + b.top) : l.bottom && (o.y = Math.max(Math.min(O.bottom + b.bottom, y.y), x.bottom + b.bottom)), l.left ? o.x = Math.min(Math.max(O.left + b.left, y.x), x.left + b.left) : l.right && (o.x = Math.max(Math.min(O.right + b.right, y.x), x.right + b.right)); } }, defaults: { inner: null, outer: null, offset: null, endOnly: false, enabled: false } }; - Gr.restrictEdges = mp; - var Lv = (0, Et.makeModifier)(mp, "restrictEdges"); - Gr.default = Lv; - var Ii = {}; - Object.defineProperty(Ii, "__esModule", { value: true }), Ii.restrictRect = Ii.default = void 0; - var Gv = (0, q.default)({ get elementRect() { + Lr.restrictEdges = dp; + var Dv = (0, Et.makeModifier)(dp, "restrictEdges"); + Lr.default = Dv; + var Mi = {}; + Object.defineProperty(Mi, "__esModule", { value: true }), Mi.restrictRect = Mi.default = void 0; + var kv = (0, q.default)({ get elementRect() { return { top: 0, left: 0, bottom: 1, right: 1 }; }, set elementRect(i) { - } }, Gt.restrict.defaults), vp = { start: Gt.restrict.start, set: Gt.restrict.set, defaults: Gv }; - Ii.restrictRect = vp; - var jv = (0, Et.makeModifier)(vp, "restrictRect"); - Ii.default = jv; - var Ai = {}; - Object.defineProperty(Ai, "__esModule", { value: true }), Ai.restrictSize = Ai.default = void 0; - var Hv = { width: -1 / 0, height: -1 / 0 }, Bv = { width: 1 / 0, height: 1 / 0 }, gp = { start: function(i) { - return Gr.restrictEdges.start(i); + } }, Lt.restrict.defaults), fp = { start: Lt.restrict.start, set: Lt.restrict.set, defaults: kv }; + Mi.restrictRect = fp; + var Nv = (0, Et.makeModifier)(fp, "restrictRect"); + Mi.default = Nv; + var Ii = {}; + Object.defineProperty(Ii, "__esModule", { value: true }), Ii.restrictSize = Ii.default = void 0; + var _v = { width: -1 / 0, height: -1 / 0 }, Lv = { width: 1 / 0, height: 1 / 0 }, hp = { start: function(i) { + return Lr.restrictEdges.start(i); }, set: function(i) { var o = i.interaction, l = i.state, c = i.rect, h = i.edges, b = l.options; if (h) { - var E = oe.tlbrToXywh((0, Gt.getRestrictionRect)(b.min, o, i.coords)) || Hv, y = oe.tlbrToXywh((0, Gt.getRestrictionRect)(b.max, o, i.coords)) || Bv; - l.options = { endOnly: b.endOnly, inner: (0, q.default)({}, Gr.restrictEdges.noInner), outer: (0, q.default)({}, Gr.restrictEdges.noOuter) }, h.top ? (l.options.inner.top = c.bottom - E.height, l.options.outer.top = c.bottom - y.height) : h.bottom && (l.options.inner.bottom = c.top + E.height, l.options.outer.bottom = c.top + y.height), h.left ? (l.options.inner.left = c.right - E.width, l.options.outer.left = c.right - y.width) : h.right && (l.options.inner.right = c.left + E.width, l.options.outer.right = c.left + y.width), Gr.restrictEdges.set(i), l.options = b; + var E = oe.tlbrToXywh((0, Lt.getRestrictionRect)(b.min, o, i.coords)) || _v, y = oe.tlbrToXywh((0, Lt.getRestrictionRect)(b.max, o, i.coords)) || Lv; + l.options = { endOnly: b.endOnly, inner: (0, q.default)({}, Lr.restrictEdges.noInner), outer: (0, q.default)({}, Lr.restrictEdges.noOuter) }, h.top ? (l.options.inner.top = c.bottom - E.height, l.options.outer.top = c.bottom - y.height) : h.bottom && (l.options.inner.bottom = c.top + E.height, l.options.outer.bottom = c.top + y.height), h.left ? (l.options.inner.left = c.right - E.width, l.options.outer.left = c.right - y.width) : h.right && (l.options.inner.right = c.left + E.width, l.options.outer.right = c.left + y.width), Lr.restrictEdges.set(i), l.options = b; } }, defaults: { min: null, max: null, endOnly: false, enabled: false } }; - Ai.restrictSize = gp; - var $v = (0, Et.makeModifier)(gp, "restrictSize"); - Ai.default = $v; - var $l = {}; - Object.defineProperty($l, "__esModule", { value: true }), Object.defineProperty($l, "default", { enumerable: true, get: function() { - return Vn.default; + Ii.restrictSize = hp; + var Gv = (0, Et.makeModifier)(hp, "restrictSize"); + Ii.default = Gv; + var Hl = {}; + Object.defineProperty(Hl, "__esModule", { value: true }), Object.defineProperty(Hl, "default", { enumerable: true, get: function() { + return Wn.default; } }); - var yn = {}; - Object.defineProperty(yn, "__esModule", { value: true }), yn.snap = yn.default = void 0; - var bp = { start: function(i) { + var gn = {}; + Object.defineProperty(gn, "__esModule", { value: true }), gn.snap = gn.default = void 0; + var mp = { start: function(i) { var o, l = i.interaction, c = i.interactable, h = i.element, b = i.rect, E = i.state, y = i.startOffset, x = E.options, O = x.offsetWithOrigin ? function(N) { var j = N.interaction.element; return (0, oe.rectToXY)((0, oe.resolveRectLike)(N.state.options.origin, null, null, [j])) || (0, ze.default)(N.interactable, j, N.interaction.prepared.name); @@ -4094,28 +4094,28 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho (F = a.default.func(Z) ? Z(P, N, o._proxy, I, j) : Z) && x.push({ x: (a.default.number(F.x) ? F.x : P) + I.x, y: (a.default.number(F.y) ? F.y : N) + I.y, range: a.default.number(F.range) ? F.range : h.range, source: Z, index: j, offset: I }); } for (var W = { target: null, inRange: false, distance: 0, range: 0, delta: { x: 0, y: 0 } }, ne = 0; ne < x.length; ne++) { - var ae = x[ne], ye = ae.range, De = ae.x - y.x, qe = ae.y - y.y, Se = (0, Je.default)(De, qe), Be = Se <= ye; - ye === 1 / 0 && W.inRange && W.range !== 1 / 0 && (Be = false), W.target && !(Be ? W.inRange && ye !== 1 / 0 ? Se / ye < W.distance / W.range : ye === 1 / 0 && W.range !== 1 / 0 || Se < W.distance : !W.inRange && Se < W.distance) || (W.target = ae, W.distance = Se, W.range = ye, W.inRange = Be, W.delta.x = De, W.delta.y = qe); + var ae = x[ne], ye = ae.range, De = ae.x - y.x, qe = ae.y - y.y, Se = (0, Je.default)(De, qe), $e = Se <= ye; + ye === 1 / 0 && W.inRange && W.range !== 1 / 0 && ($e = false), W.target && !($e ? W.inRange && ye !== 1 / 0 ? Se / ye < W.distance / W.range : ye === 1 / 0 && W.range !== 1 / 0 || Se < W.distance : !W.inRange && Se < W.distance) || (W.target = ae, W.distance = Se, W.range = ye, W.inRange = $e, W.delta.x = De, W.delta.y = qe); } return W.inRange && (l.x = W.target.x, l.y = W.target.y), c.closest = W, W; }, defaults: { range: 1 / 0, targets: null, offset: null, offsetWithOrigin: true, origin: null, relativePoints: null, endOnly: false, enabled: false } }; - yn.snap = bp; - var qv = (0, Et.makeModifier)(bp, "snap"); - yn.default = qv; - var Qr = {}; - function yp(i, o) { + gn.snap = mp; + var jv = (0, Et.makeModifier)(mp, "snap"); + gn.default = jv; + var Jr = {}; + function vp(i, o) { (o == null || o > i.length) && (o = i.length); for (var l = 0, c = Array(o); l < o; l++) c[l] = i[l]; return c; } - __name(yp, "yp"); - u(yp, "yo"), Object.defineProperty(Qr, "__esModule", { value: true }), Qr.snapSize = Qr.default = void 0; - var wp = { start: function(i) { + __name(vp, "vp"); + u(vp, "yo"), Object.defineProperty(Jr, "__esModule", { value: true }), Jr.snapSize = Jr.default = void 0; + var gp = { start: function(i) { var o = i.state, l = i.edges, c = o.options; if (!l) return null; - i.state = { options: { targets: null, relativePoints: [{ x: l.left ? 0 : 1, y: l.top ? 0 : 1 }], offset: c.offset || "self", origin: { x: 0, y: 0 }, range: c.range } }, o.targetFields = o.targetFields || [["width", "height"], ["x", "y"]], yn.snap.start(i), o.offsets = i.state.offsets, i.state = o; + i.state = { options: { targets: null, relativePoints: [{ x: l.left ? 0 : 1, y: l.top ? 0 : 1 }], offset: c.offset || "self", origin: { x: 0, y: 0 }, range: c.range } }, o.targetFields = o.targetFields || [["width", "height"], ["x", "y"]], gn.snap.start(i), o.offsets = i.state.offsets, i.state = o; }, set: function(i) { var o, l, c = i.interaction, h = i.state, b = i.coords, E = h.options, y = h.offsets, x = { x: b.x - y[0].x, y: b.y - y[0].y }; h.options = (0, q.default)({}, E), h.options.targets = []; @@ -4129,17 +4129,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }(o) || function(W, ne) { var ae = W == null ? null : typeof Symbol != "undefined" && W[Symbol.iterator] || W["@@iterator"]; if (ae != null) { - var ye, De, qe = [], Se = true, Be = false; + var ye, De, qe = [], Se = true, $e = false; try { for (ae = ae.call(W); !(Se = (ye = ae.next()).done) && (qe.push(ye.value), !ne || qe.length !== ne); Se = true) ; - } catch (wr) { - Be = true, De = wr; + } catch (yr) { + $e = true, De = yr; } finally { try { Se || ae.return == null || ae.return(); } finally { - if (Be) + if ($e) throw De; } } @@ -4148,9 +4148,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }(o, l) || function(W, ne) { if (W) { if (typeof W == "string") - return yp(W, ne); + return vp(W, ne); var ae = Object.prototype.toString.call(W).slice(8, -1); - return ae === "Object" && W.constructor && (ae = W.constructor.name), ae === "Map" || ae === "Set" ? Array.from(W) : ae === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ae) ? yp(W, ne) : void 0; + return ae === "Object" && W.constructor && (ae = W.constructor.name), ae === "Map" || ae === "Set" ? Array.from(W) : ae === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ae) ? vp(W, ne) : void 0; } }(o, l) || function() { throw new TypeError(`Invalid attempt to destructure non-iterable instance. @@ -4164,96 +4164,96 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho h.options.targets.push(P); } } - var Z = yn.snap.set(i); + var Z = gn.snap.set(i); return h.options = E, Z; }, defaults: { range: 1 / 0, targets: null, offset: null, endOnly: false, enabled: false } }; - Qr.snapSize = wp; - var Fv = (0, Et.makeModifier)(wp, "snapSize"); - Qr.default = Fv; - var Pi = {}; - Object.defineProperty(Pi, "__esModule", { value: true }), Pi.snapEdges = Pi.default = void 0; - var xp = { start: function(i) { + Jr.snapSize = gp; + var Hv = (0, Et.makeModifier)(gp, "snapSize"); + Jr.default = Hv; + var Ai = {}; + Object.defineProperty(Ai, "__esModule", { value: true }), Ai.snapEdges = Ai.default = void 0; + var bp = { start: function(i) { var o = i.edges; - return o ? (i.state.targetFields = i.state.targetFields || [[o.left ? "left" : "right", o.top ? "top" : "bottom"]], Qr.snapSize.start(i)) : null; - }, set: Qr.snapSize.set, defaults: (0, q.default)((0, qn.default)(Qr.snapSize.defaults), { targets: null, range: null, offset: { x: 0, y: 0 } }) }; - Pi.snapEdges = xp; - var Uv = (0, Et.makeModifier)(xp, "snapEdges"); - Pi.default = Uv; - var ql = {}; - Object.defineProperty(ql, "__esModule", { value: true }), Object.defineProperty(ql, "default", { enumerable: true, get: function() { - return Vn.default; + return o ? (i.state.targetFields = i.state.targetFields || [[o.left ? "left" : "right", o.top ? "top" : "bottom"]], Jr.snapSize.start(i)) : null; + }, set: Jr.snapSize.set, defaults: (0, q.default)((0, Bn.default)(Jr.snapSize.defaults), { targets: null, range: null, offset: { x: 0, y: 0 } }) }; + Ai.snapEdges = bp; + var $v = (0, Et.makeModifier)(bp, "snapEdges"); + Ai.default = $v; + var $l = {}; + Object.defineProperty($l, "__esModule", { value: true }), Object.defineProperty($l, "default", { enumerable: true, get: function() { + return Wn.default; } }); - var Fl = {}; - Object.defineProperty(Fl, "__esModule", { value: true }), Object.defineProperty(Fl, "default", { enumerable: true, get: function() { - return Vn.default; + var Bl = {}; + Object.defineProperty(Bl, "__esModule", { value: true }), Object.defineProperty(Bl, "default", { enumerable: true, get: function() { + return Wn.default; } }); - var zi = {}; - Object.defineProperty(zi, "__esModule", { value: true }), zi.default = void 0; - var Wv = { aspectRatio: Mi.default, restrictEdges: Gr.default, restrict: Gt.default, restrictRect: Ii.default, restrictSize: Ai.default, snapEdges: Pi.default, snap: yn.default, snapSize: Qr.default, spring: ql.default, avoid: Hl.default, transform: Fl.default, rubberband: $l.default }; - zi.default = Wv; - var Ua = {}; - Object.defineProperty(Ua, "__esModule", { value: true }), Ua.default = void 0; - var Vv = { id: "modifiers", install: function(i) { + var Pi = {}; + Object.defineProperty(Pi, "__esModule", { value: true }), Pi.default = void 0; + var Bv = { aspectRatio: Oi.default, restrictEdges: Lr.default, restrict: Lt.default, restrictRect: Mi.default, restrictSize: Ii.default, snapEdges: Ai.default, snap: gn.default, snapSize: Jr.default, spring: $l.default, avoid: Gl.default, transform: Bl.default, rubberband: Hl.default }; + Pi.default = Bv; + var qa = {}; + Object.defineProperty(qa, "__esModule", { value: true }), qa.default = void 0; + var qv = { id: "modifiers", install: function(i) { var o = i.interactStatic; - for (var l in i.usePlugin(Et.default), i.usePlugin(Fa.default), o.modifiers = zi.default, zi.default) { - var c = zi.default[l], h = c._defaults, b = c._methods; + for (var l in i.usePlugin(Et.default), i.usePlugin(Ba.default), o.modifiers = Pi.default, Pi.default) { + var c = Pi.default[l], h = c._defaults, b = c._methods; h._methods = b, i.defaults.perAction[l] = h; } - } }, Yv = Vv; - Ua.default = Yv; - var Yn = {}; - function Ul(i) { - return Ul = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { + } }, Fv = qv; + qa.default = Fv; + var Vn = {}; + function ql(i) { + return ql = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { return typeof o; } : function(o) { return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; - }, Ul(i); + }, ql(i); } - __name(Ul, "Ul"); - u(Ul, "Io"); - function Xv(i, o) { + __name(ql, "ql"); + u(ql, "Io"); + function Uv(i, o) { for (var l = 0; l < o.length; l++) { var c = o[l]; c.enumerable = c.enumerable || false, c.configurable = true, "value" in c && (c.writable = true), Object.defineProperty(i, c.key, c); } } - __name(Xv, "Xv"); - u(Xv, "Do"); - function Wl(i, o) { - return Wl = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, c) { + __name(Uv, "Uv"); + u(Uv, "Do"); + function Fl(i, o) { + return Fl = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, c) { return l.__proto__ = c, l; - }, Wl(i, o); + }, Fl(i, o); } - __name(Wl, "Wl"); - u(Wl, "Ao"); - function Zv(i, o) { - if (o && (Ul(o) === "object" || typeof o == "function")) + __name(Fl, "Fl"); + u(Fl, "Ao"); + function Wv(i, o) { + if (o && (ql(o) === "object" || typeof o == "function")) return o; if (o !== void 0) throw new TypeError("Derived constructors may only return object or undefined"); - return Vl(i); + return Ul(i); } - __name(Zv, "Zv"); - u(Zv, "zo"); - function Vl(i) { + __name(Wv, "Wv"); + u(Wv, "zo"); + function Ul(i) { if (i === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return i; } - __name(Vl, "Vl"); - u(Vl, "Co"); - function Wa(i) { - return Wa = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) { + __name(Ul, "Ul"); + u(Ul, "Co"); + function Fa(i) { + return Fa = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) { return o.__proto__ || Object.getPrototypeOf(o); - }, Wa(i); + }, Fa(i); } - __name(Wa, "Wa"); - u(Wa, "Ro"), Object.defineProperty(Yn, "__esModule", { value: true }), Yn.default = Yn.PointerEvent = void 0; - var Kv = function(i) { + __name(Fa, "Fa"); + u(Fa, "Ro"), Object.defineProperty(Vn, "__esModule", { value: true }), Vn.default = Vn.PointerEvent = void 0; + var Vv = function(i) { (function(y, x) { if (typeof x != "function" && x !== null) throw new TypeError("Super expression must either be null or a function"); - y.prototype = Object.create(x && x.prototype, { constructor: { value: y, writable: true, configurable: true } }), Object.defineProperty(y, "prototype", { writable: false }), x && Wl(y, x); + y.prototype = Object.create(x && x.prototype, { constructor: { value: y, writable: true, configurable: true } }), Object.defineProperty(y, "prototype", { writable: false }), x && Fl(y, x); })(E, i); var o, l, c, h, b = (c = E, h = function() { if (typeof Reflect == "undefined" || !Reflect.construct || Reflect.construct.sham) @@ -4267,20 +4267,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return false; } }(), function() { - var y, x = Wa(c); + var y, x = Fa(c); if (h) { - var O = Wa(this).constructor; + var O = Fa(this).constructor; y = Reflect.construct(x, arguments, O); } else y = x.apply(this, arguments); - return Zv(this, y); + return Wv(this, y); }); function E(y, x, O, I, P, N) { var j; if (function(Z, W) { if (!(Z instanceof W)) throw new TypeError("Cannot call a class as a function"); - }(this, E), j = b.call(this, P), J.pointerExtend(Vl(j), O), O !== x && J.pointerExtend(Vl(j), x), j.timeStamp = N, j.originalEvent = O, j.type = y, j.pointerId = J.getPointerId(x), j.pointerType = J.getPointerType(x), j.target = I, j.currentTarget = null, y === "tap") { + }(this, E), j = b.call(this, P), J.pointerExtend(Ul(j), O), O !== x && J.pointerExtend(Ul(j), x), j.timeStamp = N, j.originalEvent = O, j.type = y, j.pointerId = J.getPointerId(x), j.pointerType = J.getPointerType(x), j.target = I, j.currentTarget = null, y === "tap") { var D = P.getPointerIndex(x); j.dt = j.timeStamp - P.pointers[D].downTime; var F = j.timeStamp - P.tapTime; @@ -4298,13 +4298,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return this.pageX += x, this.pageY += O, this.clientX += x, this.clientY += O, this; } }, { key: "preventDefault", value: function() { this.originalEvent.preventDefault(); - } }]) && Xv(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), E; - }(sr.BaseEvent); - Yn.PointerEvent = Yn.default = Kv; - var So = {}; - Object.defineProperty(So, "__esModule", { value: true }), So.default = void 0; - var Va = { id: "pointer-events/base", before: ["inertia", "modifiers", "auto-start", "actions"], install: function(i) { - i.pointerEvents = Va, i.defaults.actions.pointerEvents = Va.defaults, (0, q.default)(i.actions.phaselessTypes, Va.types); + } }]) && Uv(o.prototype, l), Object.defineProperty(o, "prototype", { writable: false }), E; + }(ar.BaseEvent); + Vn.PointerEvent = Vn.default = Vv; + var Eo = {}; + Object.defineProperty(Eo, "__esModule", { value: true }), Eo.default = void 0; + var Ua = { id: "pointer-events/base", before: ["inertia", "modifiers", "auto-start", "actions"], install: function(i) { + i.pointerEvents = Ua, i.defaults.actions.pointerEvents = Ua.defaults, (0, q.default)(i.actions.phaselessTypes, Ua.types); }, listeners: { "interactions:new": function(i) { var o = i.interaction; o.prevTap = null, o.tapTime = 0; @@ -4313,7 +4313,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho !o && l.hold || (l.hold = { duration: 1 / 0, timeout: null }); }, "interactions:move": function(i, o) { var l = i.interaction, c = i.pointer, h = i.event, b = i.eventTarget; - i.duplicate || l.pointerIsDown && !l.pointerWasMoved || (l.pointerIsDown && Yl(i), wn({ interaction: l, pointer: c, event: h, eventTarget: b, type: "move" }, o)); + i.duplicate || l.pointerIsDown && !l.pointerWasMoved || (l.pointerIsDown && Wl(i), bn({ interaction: l, pointer: c, event: h, eventTarget: b, type: "move" }, o)); }, "interactions:down": function(i, o) { (function(l, c) { for (var h = l.interaction, b = l.pointer, E = l.event, y = l.eventTarget, x = l.pointerIndex, O = h.pointers[x].hold, I = z.getPath(y), P = { interaction: h, pointer: b, event: E, eventTarget: y, type: "hold", targets: [], path: I, node: null }, N = 0; N < I.length; N++) { @@ -4326,20 +4326,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho Z < D && (D = Z); } O.duration = D, O.timeout = setTimeout(function() { - wn({ interaction: h, eventTarget: y, pointer: b, event: E, type: "hold" }, c); + bn({ interaction: h, eventTarget: y, pointer: b, event: E, type: "hold" }, c); }, D); } - })(i, o), wn(i, o); + })(i, o), bn(i, o); }, "interactions:up": function(i, o) { - Yl(i), wn(i, o), function(l, c) { + Wl(i), bn(i, o), function(l, c) { var h = l.interaction, b = l.pointer, E = l.event, y = l.eventTarget; - h.pointerWasMoved || wn({ interaction: h, eventTarget: y, pointer: b, event: E, type: "tap" }, c); + h.pointerWasMoved || bn({ interaction: h, eventTarget: y, pointer: b, event: E, type: "tap" }, c); }(i, o); }, "interactions:cancel": function(i, o) { - Yl(i), wn(i, o); - } }, PointerEvent: Yn.PointerEvent, fire: wn, collectEventTargets: Ep, defaults: { holdDuration: 600, ignoreFrom: null, allowFrom: null, origin: { x: 0, y: 0 } }, types: { down: true, move: true, up: true, cancel: true, tap: true, doubletap: true, hold: true } }; - function wn(i, o) { - var l = i.interaction, c = i.pointer, h = i.event, b = i.eventTarget, E = i.type, y = i.targets, x = y === void 0 ? Ep(i, o) : y, O = new Yn.PointerEvent(E, c, h, b, l, o.now()); + Wl(i), bn(i, o); + } }, PointerEvent: Vn.PointerEvent, fire: bn, collectEventTargets: yp, defaults: { holdDuration: 600, ignoreFrom: null, allowFrom: null, origin: { x: 0, y: 0 } }, types: { down: true, move: true, up: true, cancel: true, tap: true, doubletap: true, hold: true } }; + function bn(i, o) { + var l = i.interaction, c = i.pointer, h = i.event, b = i.eventTarget, E = i.type, y = i.targets, x = y === void 0 ? yp(i, o) : y, O = new Vn.PointerEvent(E, c, h, b, l, o.now()); o.fire("pointerEvents:new", { pointerEvent: O }); for (var I = { interaction: l, pointer: c, event: h, eventTarget: b, targets: x, type: E, pointerEvent: O }, P = 0; P < x.length; P++) { var N = x[P]; @@ -4350,14 +4350,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho break; } if (o.fire("pointerEvents:fired", I), E === "tap") { - var F = O.double ? wn({ interaction: l, pointer: c, event: h, eventTarget: b, type: "doubletap" }, o) : O; + var F = O.double ? bn({ interaction: l, pointer: c, event: h, eventTarget: b, type: "doubletap" }, o) : O; l.prevTap = F, l.tapTime = F.timeStamp; } return O; } - __name(wn, "wn"); - u(wn, "Yo"); - function Ep(i, o) { + __name(bn, "bn"); + u(bn, "Yo"); + function yp(i, o) { var l = i.interaction, c = i.pointer, h = i.event, b = i.eventTarget, E = i.type, y = l.getPointerIndex(c), x = l.pointers[y]; if (E === "tap" && (l.pointerWasMoved || !x || x.downTarget !== b)) return []; @@ -4370,29 +4370,29 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho return j.eventable.options.holdDuration === ((D = l.pointers[y]) == null ? void 0 : D.hold.duration); })), I.targets; } - __name(Ep, "Ep"); - u(Ep, "Wo"); - function Yl(i) { + __name(yp, "yp"); + u(yp, "Wo"); + function Wl(i) { var o = i.interaction, l = i.pointerIndex, c = o.pointers[l].hold; c && c.timeout && (clearTimeout(c.timeout), c.timeout = null); } - __name(Yl, "Yl"); - u(Yl, "Lo"); - var Jv = Va; - So.default = Jv; - var Ya = {}; - function Qv(i) { + __name(Wl, "Wl"); + u(Wl, "Lo"); + var Yv = Ua; + Eo.default = Yv; + var Wa = {}; + function Xv(i) { var o = i.interaction; o.holdIntervalHandle && (clearInterval(o.holdIntervalHandle), o.holdIntervalHandle = null); } - __name(Qv, "Qv"); - u(Qv, "No"), Object.defineProperty(Ya, "__esModule", { value: true }), Ya.default = void 0; - var eg = { id: "pointer-events/holdRepeat", install: function(i) { - i.usePlugin(So.default); + __name(Xv, "Xv"); + u(Xv, "No"), Object.defineProperty(Wa, "__esModule", { value: true }), Wa.default = void 0; + var Zv = { id: "pointer-events/holdRepeat", install: function(i) { + i.usePlugin(Eo.default); var o = i.pointerEvents; o.defaults.holdRepeatInterval = 0, o.types.holdrepeat = i.actions.phaselessTypes.holdrepeat = true; }, listeners: ["move", "up", "cancel", "endall"].reduce(function(i, o) { - return i["pointerEvents:".concat(o)] = Qv, i; + return i["pointerEvents:".concat(o)] = Xv, i; }, { "pointerEvents:new": function(i) { var o = i.pointerEvent; o.type === "hold" && (o.count = (o.count || 0) + 1); @@ -4404,17 +4404,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho o.pointerEvents.fire({ interaction: l, eventTarget: h, type: "hold", pointer: c, event: c }, o); }, E)); } - } }) }, tg = eg; - Ya.default = tg; - var Xa = {}; - function rg(i) { + } }) }, Kv = Zv; + Wa.default = Kv; + var Va = {}; + function Jv(i) { return (0, q.default)(this.events.options, i), this; } - __name(rg, "rg"); - u(rg, "Ho"), Object.defineProperty(Xa, "__esModule", { value: true }), Xa.default = void 0; - var ng = { id: "pointer-events/interactableTargets", install: function(i) { + __name(Jv, "Jv"); + u(Jv, "Ho"), Object.defineProperty(Va, "__esModule", { value: true }), Va.default = void 0; + var Qv = { id: "pointer-events/interactableTargets", install: function(i) { var o = i.Interactable; - o.prototype.pointerEvents = rg; + o.prototype.pointerEvents = Jv; var l = o.prototype._backCompatOption; o.prototype._backCompatOption = function(c, h) { var b = l.call(this, c, h); @@ -4434,16 +4434,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }, "interactable:set": function(i, o) { var l = i.interactable, c = i.options; (0, q.default)(l.events.options, o.pointerEvents.defaults), (0, q.default)(l.events.options, c.pointerEvents || {}); - } } }, ig = ng; - Xa.default = ig; - var Za = {}; - Object.defineProperty(Za, "__esModule", { value: true }), Za.default = void 0; - var og = { id: "pointer-events", install: function(i) { - i.usePlugin(So), i.usePlugin(Ya.default), i.usePlugin(Xa.default); - } }, ag = og; - Za.default = ag; - var To = {}; - function Sp(i) { + } } }, eg = Qv; + Va.default = eg; + var Ya = {}; + Object.defineProperty(Ya, "__esModule", { value: true }), Ya.default = void 0; + var tg = { id: "pointer-events", install: function(i) { + i.usePlugin(Eo), i.usePlugin(Wa.default), i.usePlugin(Va.default); + } }, rg = tg; + Ya.default = rg; + var So = {}; + function wp(i) { var o = i.Interactable; i.actions.phases.reflow = true, o.prototype.reflow = function(l) { return function(c, h, b) { @@ -4461,12 +4461,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho else { var F = (0, oe.tlbrToXywh)(N), Z = { page: { x: F.x, y: F.y }, client: { x: F.x, y: F.y }, timeStamp: b.now() }, W = J.coordsToEvent(Z); D = function(ne, ae, ye, De, qe) { - var Se = ne.interactions.new({ pointerType: "reflow" }), Be = { interaction: Se, event: qe, pointer: qe, eventTarget: ye, phase: "reflow" }; - Se.interactable = ae, Se.element = ye, Se.prevEvent = qe, Se.updatePointer(qe, qe, ye, true), J.setZeroCoords(Se.coords.delta), (0, lr.copyAction)(Se.prepared, De), Se._doPhase(Be); - var wr = ne.window.Promise, en = wr ? new wr(function(Kl) { - Se._reflowResolve = Kl; + var Se = ne.interactions.new({ pointerType: "reflow" }), $e = { interaction: Se, event: qe, pointer: qe, eventTarget: ye, phase: "reflow" }; + Se.interactable = ae, Se.element = ye, Se.prevEvent = qe, Se.updatePointer(qe, qe, ye, true), J.setZeroCoords(Se.coords.delta), (0, sr.copyAction)(Se.prepared, De), Se._doPhase($e); + var yr = ne.window.Promise, Qr = yr ? new yr(function(Xl) { + Se._reflowResolve = Xl; }) : void 0; - return Se._reflowPromise = en, Se.start(De, ae, ye), Se._interacting ? (Se.move(Be), Se.end(qe)) : (Se.stop(), Se._reflowResolve()), Se.removePointer(qe, qe), en; + return Se._reflowPromise = Qr, Se.start(De, ae, ye), Se._interacting ? (Se.move($e), Se.end(qe)) : (Se.stop(), Se._reflowResolve()), Se.removePointer(qe, qe), Qr; }(b, c, P, h, W); } x && x.push(D); @@ -4478,50 +4478,50 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho }(this, l, i); }; } - __name(Sp, "Sp"); - u(Sp, "ni"), Object.defineProperty(To, "__esModule", { value: true }), To.default = void 0, To.install = Sp; - var sg = { id: "reflow", install: Sp, listeners: { "interactions:stop": function(i, o) { + __name(wp, "wp"); + u(wp, "ni"), Object.defineProperty(So, "__esModule", { value: true }), So.default = void 0, So.install = wp; + var ng = { id: "reflow", install: wp, listeners: { "interactions:stop": function(i, o) { var l = i.interaction; l.pointerType === "reflow" && (l._reflowResolve && l._reflowResolve(), Pe.remove(o.interactions.list, l)); - } } }, lg = sg; - To.default = lg; - var yr = { exports: {} }; - function Xl(i) { - return Xl = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { + } } }, ig = ng; + So.default = ig; + var br = { exports: {} }; + function Vl(i) { + return Vl = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { return typeof o; } : function(o) { return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; - }, Xl(i); + }, Vl(i); } - __name(Xl, "Xl"); - u(Xl, "ai"), Object.defineProperty(yr.exports, "__esModule", { value: true }), yr.exports.default = void 0, dt.default.use(Ci.default), dt.default.use(Wn.default), dt.default.use(Za.default), dt.default.use(Oi.default), dt.default.use(Ua.default), dt.default.use(Ma.default), dt.default.use(br.default), dt.default.use(gn.default), dt.default.use(To.default); - var ug = dt.default; - if (yr.exports.default = ug, Xl(yr) === "object" && yr) + __name(Vl, "Vl"); + u(Vl, "ai"), Object.defineProperty(br.exports, "__esModule", { value: true }), br.exports.default = void 0, dt.default.use(Ti.default), dt.default.use(Un.default), dt.default.use(Ya.default), dt.default.use(Ci.default), dt.default.use(qa.default), dt.default.use(Ca.default), dt.default.use(gr.default), dt.default.use(mn.default), dt.default.use(So.default); + var og = dt.default; + if (br.exports.default = og, Vl(br) === "object" && br) try { - yr.exports = dt.default; + br.exports = dt.default; } catch (i) { } - dt.default.default = dt.default, yr = yr.exports; - var Xn = { exports: {} }; - function Zl(i) { - return Zl = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { + dt.default.default = dt.default, br = br.exports; + var Yn = { exports: {} }; + function Yl(i) { + return Yl = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) { return typeof o; } : function(o) { return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; - }, Zl(i); + }, Yl(i); } - __name(Zl, "Zl"); - u(Zl, "ui"), Object.defineProperty(Xn.exports, "__esModule", { value: true }), Xn.exports.default = void 0; - var cg = yr.default; - if (Xn.exports.default = cg, Zl(Xn) === "object" && Xn) + __name(Yl, "Yl"); + u(Yl, "ui"), Object.defineProperty(Yn.exports, "__esModule", { value: true }), Yn.exports.default = void 0; + var ag = br.default; + if (Yn.exports.default = ag, Yl(Yn) === "object" && Yn) try { - Xn.exports = yr.default; + Yn.exports = br.default; } catch (i) { } - return yr.default.default = yr.default, Xn.exports; + return br.default.default = br.default, Yn.exports; }); }); -var gm = Tt((vm, Ic) => { +var fm = Tt((dm, Cc) => { (function(t) { "use strict"; var r = /* @__PURE__ */ __name(function() { @@ -4589,10 +4589,10 @@ var gm = Tt((vm, Ic) => { var m = t.fastdom = t.fastdom || new n(); typeof define == "function" ? define(function() { return m; - }) : typeof Ic == "object" && (Ic.exports = m); - })(typeof window != "undefined" ? window : vm); + }) : typeof Cc == "object" && (Cc.exports = m); + })(typeof window != "undefined" ? window : dm); }); -var xm = Tt((Ac, wm) => { +var gm = Tt((Oc, vm) => { (function(t) { "use strict"; var r = Math.cosh || function(d) { @@ -4878,11 +4878,11 @@ var xm = Tt((Ac, wm) => { return !(this.isNaN() || this.isFinite()); } }, m.ZERO = new m(0, 0), m.ONE = new m(1, 0), m.I = new m(0, 1), m.PI = new m(Math.PI, 0), m.E = new m(Math.E, 0), m.INFINITY = new m(1 / 0, 1 / 0), m.NAN = new m(NaN, NaN), m.EPSILON = 1e-15, typeof define == "function" && define.amd ? define([], function() { return m; - }) : typeof Ac == "object" ? (Object.defineProperty(m, "__esModule", { value: true }), m.default = m, m.Complex = m, wm.exports = m) : t.Complex = m; - })(Ac); + }) : typeof Oc == "object" ? (Object.defineProperty(m, "__esModule", { value: true }), m.default = m, m.Complex = m, vm.exports = m) : t.Complex = m; + })(Oc); }); -var An = jt(zp()); -function Ql(t, r, e, n) { +var wn = er(Ip()); +function Kl(t, r, e, n) { function s(a) { return a instanceof e ? a : new e(function(p) { p(a); @@ -4915,9 +4915,9 @@ function Ql(t, r, e, n) { u(d, "step"), d((n = n.apply(t, r || [])).next()); }); } -__name(Ql, "Ql"); -u(Ql, "__awaiter"); -function eu(t, r) { +__name(Kl, "Kl"); +u(Kl, "__awaiter"); +function Jl(t, r) { var e = { label: 0, sent: function() { if (a[0] & 1) throw a[1]; @@ -4984,9 +4984,9 @@ function eu(t, r) { } __name(m, "m"); } -__name(eu, "eu"); -u(eu, "__generator"); -function es(t, r) { +__name(Jl, "Jl"); +u(Jl, "__generator"); +function Ja(t, r) { var e = typeof Symbol == "function" && t[Symbol.iterator]; if (!e) return t; @@ -5006,54 +5006,54 @@ function es(t, r) { } return a; } -__name(es, "es"); -u(es, "__read"); -function Jn(t, r, e) { +__name(Ja, "Ja"); +u(Ja, "__read"); +function Kn(t, r, e) { if (e || arguments.length === 2) for (var n = 0, s = r.length, a; n < s; n++) (a || !(n in r)) && (a || (a = Array.prototype.slice.call(r, 0, n)), a[n] = r[n]); return t.concat(a || Array.prototype.slice.call(r)); } -__name(Jn, "Jn"); -u(Jn, "__spreadArray"); -var vg = { withStackTrace: false }; -var Dp = u(function(t, r, e) { - e === void 0 && (e = vg); +__name(Kn, "Kn"); +u(Kn, "__spreadArray"); +var dg = { withStackTrace: false }; +var Pp = u(function(t, r, e) { + e === void 0 && (e = dg); var n = r.isOk() ? { type: "Ok", value: r.value } : { type: "Err", value: r.error }, s = e.withStackTrace ? new Error().stack : void 0; return { data: n, message: t, stack: s }; }, "createNeverThrowError"); -var Ri = function() { +var zi = function() { function t(r) { this._promise = r; } __name(t, "t"); return u(t, "ResultAsync"), t.fromSafePromise = function(r) { var e = r.then(function(n) { - return new Zn(n); + return new Xn(n); }); return new t(e); }, t.fromPromise = function(r, e) { var n = r.then(function(s) { - return new Zn(s); + return new Xn(s); }).catch(function(s) { - return new Kn(e(s)); + return new Zn(e(s)); }); return new t(n); }, t.combine = function(r) { - return bg(r); + return hg(r); }, t.combineWithAllErrors = function(r) { - return yg(r); + return mg(r); }, t.prototype.map = function(r) { var e = this; return new t(this._promise.then(function(n) { - return Ql(e, void 0, void 0, function() { + return Kl(e, void 0, void 0, function() { var s; - return eu(this, function(a) { + return Jl(this, function(a) { switch (a.label) { case 0: - return n.isErr() ? [2, new Kn(n.error)] : (s = Zn.bind, [4, r(n.value)]); + return n.isErr() ? [2, new Zn(n.error)] : (s = Xn.bind, [4, r(n.value)]); case 1: - return [2, new (s.apply(Zn, [void 0, a.sent()]))()]; + return [2, new (s.apply(Xn, [void 0, a.sent()]))()]; } }); }); @@ -5061,14 +5061,14 @@ var Ri = function() { }, t.prototype.mapErr = function(r) { var e = this; return new t(this._promise.then(function(n) { - return Ql(e, void 0, void 0, function() { + return Kl(e, void 0, void 0, function() { var s; - return eu(this, function(a) { + return Jl(this, function(a) { switch (a.label) { case 0: - return n.isOk() ? [2, new Zn(n.value)] : (s = Kn.bind, [4, r(n.error)]); + return n.isOk() ? [2, new Xn(n.value)] : (s = Zn.bind, [4, r(n.error)]); case 1: - return [2, new (s.apply(Kn, [void 0, a.sent()]))()]; + return [2, new (s.apply(Zn, [void 0, a.sent()]))()]; } }); }); @@ -5076,16 +5076,16 @@ var Ri = function() { }, t.prototype.andThen = function(r) { return new t(this._promise.then(function(e) { if (e.isErr()) - return new Kn(e.error); + return new Zn(e.error); var n = r(e.value); return n instanceof t ? n._promise : n; })); }, t.prototype.orElse = function(r) { var e = this; return new t(this._promise.then(function(n) { - return Ql(e, void 0, void 0, function() { - return eu(this, function(s) { - return n.isErr() ? [2, r(n.error)] : [2, new Zn(n.value)]; + return Kl(e, void 0, void 0, function() { + return Jl(this, function(s) { + return n.isErr() ? [2, r(n.error)] : [2, new Xn(n.value)]; }); }); })); @@ -5101,66 +5101,66 @@ var Ri = function() { return this._promise.then(r, e); }, t; }(); -var Rp = u(function(t) { - return new Ri(Promise.resolve(new Kn(t))); +var Ap = u(function(t) { + return new zi(Promise.resolve(new Zn(t))); }, "errAsync"); -var q0 = Ri.fromPromise; -var F0 = Ri.fromSafePromise; -var gg = u(function(t) { +var j0 = zi.fromPromise; +var H0 = zi.fromSafePromise; +var fg = u(function(t) { return function(r) { - return Jn(Jn([], es(r), false), [t], false); + return Kn(Kn([], Ja(r), false), [t], false); }; }, "appendValueToEndOfList"); -var kp = u(function(t) { +var zp = u(function(t) { return t.reduce(function(r, e) { - return r.isOk() ? e.isErr() ? rn(e.error) : r.map(gg(e.value)) : r; - }, tn([])); + return r.isOk() ? e.isErr() ? tn(e.error) : r.map(fg(e.value)) : r; + }, en([])); }, "combineResultList"); -var bg = u(function(t) { - return Ri.fromSafePromise(Promise.all(t)).andThen(kp); +var hg = u(function(t) { + return zi.fromSafePromise(Promise.all(t)).andThen(zp); }, "combineResultAsyncList"); -var Np = u(function(t) { +var Rp = u(function(t) { return t.reduce(function(r, e) { - return e.isErr() ? r.isErr() ? rn(Jn(Jn([], es(r.error), false), [e.error], false)) : rn([e.error]) : r.isErr() ? r : tn(Jn(Jn([], es(r.value), false), [e.value], false)); - }, tn([])); + return e.isErr() ? r.isErr() ? tn(Kn(Kn([], Ja(r.error), false), [e.error], false)) : tn([e.error]) : r.isErr() ? r : en(Kn(Kn([], Ja(r.value), false), [e.value], false)); + }, en([])); }, "combineResultListWithAllErrors"); -var yg = u(function(t) { - return Ri.fromSafePromise(Promise.all(t)).andThen(Np); +var mg = u(function(t) { + return zi.fromSafePromise(Promise.all(t)).andThen(Rp); }, "combineResultAsyncListWithAllErrors"); -var Oo; +var Co; (function(t) { function r(s, a) { return function() { for (var p = [], v = 0; v < arguments.length; v++) p[v] = arguments[v]; try { - var m = s.apply(void 0, Jn([], es(p), false)); - return tn(m); + var m = s.apply(void 0, Kn([], Ja(p), false)); + return en(m); } catch (d) { - return rn(a ? a(d) : d); + return tn(a ? a(d) : d); } }; } __name(r, "r"); u(r, "fromThrowable"), t.fromThrowable = r; function e(s) { - return kp(s); + return zp(s); } __name(e, "e"); u(e, "combine"), t.combine = e; function n(s) { - return Np(s); + return Rp(s); } __name(n, "n"); u(n, "combineWithAllErrors"), t.combineWithAllErrors = n; -})(Oo || (Oo = {})); +})(Co || (Co = {})); +var en = u(function(t) { + return new Xn(t); +}, "ok"); var tn = u(function(t) { return new Zn(t); -}, "ok"); -var rn = u(function(t) { - return new Kn(t); }, "err"); -var Zn = function() { +var Xn = function() { function t(r) { this.value = r; } @@ -5170,17 +5170,17 @@ var Zn = function() { }, t.prototype.isErr = function() { return !this.isOk(); }, t.prototype.map = function(r) { - return tn(r(this.value)); + return en(r(this.value)); }, t.prototype.mapErr = function(r) { - return tn(this.value); + return en(this.value); }, t.prototype.andThen = function(r) { return r(this.value); }, t.prototype.orElse = function(r) { - return tn(this.value); + return en(this.value); }, t.prototype.asyncAndThen = function(r) { return r(this.value); }, t.prototype.asyncMap = function(r) { - return Ri.fromSafePromise(r(this.value)); + return zi.fromSafePromise(r(this.value)); }, t.prototype.unwrapOr = function(r) { return this.value; }, t.prototype.match = function(r, e) { @@ -5188,10 +5188,10 @@ var Zn = function() { }, t.prototype._unsafeUnwrap = function(r) { return this.value; }, t.prototype._unsafeUnwrapErr = function(r) { - throw Dp("Called `_unsafeUnwrapErr` on an Ok", this, r); + throw Pp("Called `_unsafeUnwrapErr` on an Ok", this, r); }, t; }(); -var Kn = function() { +var Zn = function() { function t(r) { this.error = r; } @@ -5201,98 +5201,97 @@ var Kn = function() { }, t.prototype.isErr = function() { return !this.isOk(); }, t.prototype.map = function(r) { - return rn(this.error); + return tn(this.error); }, t.prototype.mapErr = function(r) { - return rn(r(this.error)); + return tn(r(this.error)); }, t.prototype.andThen = function(r) { - return rn(this.error); + return tn(this.error); }, t.prototype.orElse = function(r) { return r(this.error); }, t.prototype.asyncAndThen = function(r) { - return Rp(this.error); + return Ap(this.error); }, t.prototype.asyncMap = function(r) { - return Rp(this.error); + return Ap(this.error); }, t.prototype.unwrapOr = function(r) { return r; }, t.prototype.match = function(r, e) { return e(this.error); }, t.prototype._unsafeUnwrap = function(r) { - throw Dp("Called `_unsafeUnwrap` on an Err", this, r); + throw Pp("Called `_unsafeUnwrap` on an Err", this, r); }, t.prototype._unsafeUnwrapErr = function(r) { return this.error; }, t; }(); -var U0 = Oo.fromThrowable; -var Fd = jt(on()); -function Gd(t) { - let r = Pn(t); - return new An.default(r).valueOf() * Math.PI; -} -__name(Gd, "Gd"); -u(Gd, "G"); -function Do(t) { - let r = Pn(t).split("/"); +var $0 = Co.fromThrowable; +function kp(t) { + let r = xn(t); + return new wn.default(r).valueOf() * Math.PI; +} +__name(kp, "kp"); +u(kp, "C"); +function Mo(t) { + let r = xn(t).split("/"); if (r.length === 1) return 1; if (r.length === 2) return parseInt(r[1]); throw new Error(`Failed to parse angle '${t}'`); } -__name(Do, "Do"); -u(Do, "E"); -function jd(t, r) { - return new An.default(Pn(t)).valueOf() < new An.default(Pn(r)).valueOf(); +__name(Mo, "Mo"); +u(Mo, "w"); +function Np(t, r) { + return new wn.default(xn(t)).valueOf() < new wn.default(xn(r)).valueOf(); } -__name(jd, "jd"); -u(jd, "R"); -function Hd(t, r) { - return new An.default(Pn(t)).valueOf() > new An.default(Pn(r)).valueOf(); +__name(Np, "Np"); +u(Np, "G"); +function _p(t, r) { + return new wn.default(xn(t)).valueOf() > new wn.default(xn(r)).valueOf(); } -__name(Hd, "Hd"); -u(Hd, "M"); -function Bd(t) { +__name(_p, "_p"); +u(_p, "E"); +function Lp(t) { if (t === "0") return true; if (!/π/.test(t)) return false; try { - let r = Pn(t); - return new An.default(r).valueOf(), true; + let r = xn(t); + return new wn.default(r).valueOf(), true; } catch (r) { return false; } } -__name(Bd, "Bd"); -u(Bd, "D"); -function Pn(t) { +__name(Lp, "Lp"); +u(Lp, "R"); +function xn(t) { return t.replace(/(\d+)π/g, "$1").replace(/π/g, "1"); } -__name(Pn, "Pn"); -u(Pn, "l"); -function $d(t) { +__name(xn, "xn"); +u(xn, "l"); +function Gp(t) { try { - let r = Pn(t), e = new An.default(r).toFraction().split("/"), n; + let r = xn(t), e = new wn.default(r).toFraction().split("/"), n; return e[0] === "0" ? n = "0" : e[0] === "1" ? n = "\u03C0" : e[0] === "-1" ? n = "-\u03C0" : n = `${e[0]}\u03C0`, e.length === 1 ? n : `${n}/${e[1]}`; } catch (r) { throw new Error(`Failed to parse angle '${t}'`); } } -__name($d, "$d"); -u($d, "N"); -var qd = [{ character: "\xBD", ref: "\xBD", expanded: "1/2", value: 0.5 }, { character: "\xBC", ref: "\xBC", expanded: "1/4", value: 0.25 }, { character: "\xBE", ref: "\xBE", expanded: "3/4", value: 0.75 }, { character: "\u2153", ref: "\u2153", expanded: "1/3", value: 0.3333333333333333 }, { character: "\u2154", ref: "\u2154", expanded: "2/3", value: 0.6666666666666666 }, { character: "\u2155", ref: "\u2155", expanded: "1/5", value: 0.2 }, { character: "\u2156", ref: "\u2156", expanded: "2/5", value: 0.4 }, { character: "\u2157", ref: "\u2157", expanded: "3/5", value: 0.6 }, { character: "\u2158", ref: "\u2158", expanded: "4/5", value: 0.8 }, { character: "\u2159", ref: "\u2159", expanded: "1/6", value: 0.16666666666666666 }, { character: "\u215A", ref: "\u215A", expanded: "5/6", value: 0.8333333333333334 }, { character: "\u2150", ref: "\u2150", expanded: "1/7", value: 0.14285714285714285 }, { character: "\u215B", ref: "\u215B", expanded: "1/8", value: 0.125 }, { character: "\u215C", ref: "\u215C", expanded: "3/8", value: 0.375 }, { character: "\u215D", ref: "\u215D", expanded: "5/8", value: 0.625 }, { character: "\u215E", ref: "\u215E", expanded: "7/8", value: 0.875 }, { character: "\u2151", ref: "\u2151", expanded: "1/9", value: 0.1111111111111111 }, { character: "\u2152", ref: "\u2152", expanded: "1/10", value: 0.1 }]; -var ur; -var In = (ur = class { +__name(Gp, "Gp"); +u(Gp, "F"); +var jp = [{ character: "\xBD", ref: "\xBD", expanded: "1/2", value: 0.5 }, { character: "\xBC", ref: "\xBC", expanded: "1/4", value: 0.25 }, { character: "\xBE", ref: "\xBE", expanded: "3/4", value: 0.75 }, { character: "\u2153", ref: "\u2153", expanded: "1/3", value: 0.3333333333333333 }, { character: "\u2154", ref: "\u2154", expanded: "2/3", value: 0.6666666666666666 }, { character: "\u2155", ref: "\u2155", expanded: "1/5", value: 0.2 }, { character: "\u2156", ref: "\u2156", expanded: "2/5", value: 0.4 }, { character: "\u2157", ref: "\u2157", expanded: "3/5", value: 0.6 }, { character: "\u2158", ref: "\u2158", expanded: "4/5", value: 0.8 }, { character: "\u2159", ref: "\u2159", expanded: "1/6", value: 0.16666666666666666 }, { character: "\u215A", ref: "\u215A", expanded: "5/6", value: 0.8333333333333334 }, { character: "\u2150", ref: "\u2150", expanded: "1/7", value: 0.14285714285714285 }, { character: "\u215B", ref: "\u215B", expanded: "1/8", value: 0.125 }, { character: "\u215C", ref: "\u215C", expanded: "3/8", value: 0.375 }, { character: "\u215D", ref: "\u215D", expanded: "5/8", value: 0.625 }, { character: "\u215E", ref: "\u215E", expanded: "7/8", value: 0.875 }, { character: "\u2151", ref: "\u2151", expanded: "1/9", value: 0.1111111111111111 }, { character: "\u2152", ref: "\u2152", expanded: "1/10", value: 0.1 }]; +var lr; +var yn = (lr = class { static { - __name(this, "ur"); + __name(this, "lr"); } static parseFloat(r) { if (r.length === 0) throw new Error(`Not a number: '${r}'`); if (r[0] === "-") - return -ur.parseFloat(r.substr(1)); + return -lr.parseFloat(r.substr(1)); if (r[0] === "\u221A") - return Math.sqrt(ur.parseFloat(r.substr(1))); - let e = ur.matchUnicodeFraction((s) => s.character === r); + return Math.sqrt(lr.parseFloat(r.substr(1))); + let e = lr.matchUnicodeFraction((s) => s.character === r); if (e !== void 0) return e.value; let n = parseFloat(r); @@ -5302,18 +5301,18 @@ var In = (ur = class { } static simplifyByRounding(r, e) { if (r < 0) - return -ur.simplifyByRounding(-r, e); + return -lr.simplifyByRounding(-r, e); let n = r % 1; if (n <= e || 1 - n <= e) return Math.round(r); - let s = ur.matchUnicodeFraction((p) => Math.abs(p.value - r) <= e); + let s = lr.matchUnicodeFraction((p) => Math.abs(p.value - r) <= e); if (s !== void 0) return s.value; - let a = ur.matchUnicodeFraction((p) => Math.abs(Math.sqrt(p.value) - r) <= e); + let a = lr.matchUnicodeFraction((p) => Math.abs(Math.sqrt(p.value) - r) <= e); return a !== void 0 ? Math.sqrt(a.value) : r; } static matchUnicodeFraction(r) { - for (let e of qd) + for (let e of jp) if (r(e)) return e; } @@ -5328,21 +5327,21 @@ var In = (ur = class { return "0"; if (r < 0) return `-${this.abbreviateFloat(-r, e, n)}`; - let s = ur.matchUnicodeFraction((p) => Math.abs(p.value - r) <= e); + let s = lr.matchUnicodeFraction((p) => Math.abs(p.value - r) <= e); if (s !== void 0) return s.character; - let a = ur.matchUnicodeFraction((p) => Math.abs(Math.sqrt(p.value) - r) <= e); + let a = lr.matchUnicodeFraction((p) => Math.abs(Math.sqrt(p.value) - r) <= e); return a !== void 0 ? `\u221A${a.character}` : r % 1 !== 0 && n !== void 0 ? r.toFixed(n) : r.toString(); } -}, u(ur, "o"), ur); -In.CONSISTENT = new In(false, 0, 2, ", "), In.EXACT = new In(true, 0, void 0, ", "), In.MINIFIED = new In(true, 0, void 0, ","), In.SIMPLIFIED = new In(true, 5e-4, 3, ", "); -var ri; -var Ld = (ri = class { +}, u(lr, "o"), lr); +yn.CONSISTENT = new yn(false, 0, 2, ", "), yn.EXACT = new yn(true, 0, void 0, ", "), yn.MINIFIED = new yn(true, 0, void 0, ","), yn.SIMPLIFIED = new yn(true, 5e-4, 3, ", "); +var Qn; +var Dp = (Qn = class { static { - __name(this, "ri"); + __name(this, "Qn"); } static matchUnicodeFraction(r) { - for (let e of qd) + for (let e of jp) if (r(e)) return e; } @@ -5357,16 +5356,16 @@ var Ld = (ri = class { return "0"; if (r < 0) return `-${this.abbreviateNumber(-r, e, n)}`; - let s = ri.matchUnicodeFraction((p) => Math.abs(p.value - r) <= e); + let s = Qn.matchUnicodeFraction((p) => Math.abs(p.value - r) <= e); if (s !== void 0) return s.character; - let a = ri.matchUnicodeFraction((p) => Math.abs(Math.sqrt(p.value) - r) <= e); + let a = Qn.matchUnicodeFraction((p) => Math.abs(Math.sqrt(p.value) - r) <= e); return a !== void 0 ? `\u221A${a.character}` : r % 1 !== 0 && n !== void 0 ? r.toFixed(n) : r.toString(); } -}, u(ri, "n"), ri); -var zo = { allowAbbreviation: true, maxAbbreviationError: 0, fixedDigits: void 0 }; +}, u(Qn, "n"), Qn); +var Oo = { allowAbbreviation: true, maxAbbreviationError: 0, fixedDigits: void 0 }; var Fe; -var ti = (Fe = class { +var Jn = (Fe = class { static { __name(this, "Fe"); } @@ -5425,9 +5424,9 @@ var ti = (Fe = class { div(r) { let e = Fe.from(r), n = e.abs2(); if (n === 0) - return rn(Error("Division by Zero")); + return tn(Error("Division by Zero")); let s = this.mult(e.conjugate()); - return tn(new Fe(s.real / n, s.imag / n)); + return en(new Fe(s.real / n, s.imag / n)); } abs() { return Math.sqrt(this.abs2()); @@ -5444,12 +5443,12 @@ var ti = (Fe = class { exp() { return Fe.polar(Math.exp(this.real), this.imag); } - format(r = zo) { - let e = new Ld(r.allowAbbreviation === void 0 ? zo.allowAbbreviation : r.allowAbbreviation, r.maxAbbreviationError || 0, r.fixedDigits); + format(r = Oo) { + let e = new Dp(r.allowAbbreviation === void 0 ? Oo.allowAbbreviation : r.allowAbbreviation, r.maxAbbreviationError || 0, r.fixedDigits); return e.allowAbbreviation ? this.toStringAllowSingleValue(e) : this.toStringBothValues(e); } toString() { - let r = new Ld(zo.allowAbbreviation, zo.maxAbbreviationError, zo.fixedDigits); + let r = new Dp(Oo.allowAbbreviation, Oo.maxAbbreviationError, Oo.fixedDigits); return this.toStringAllowSingleValue(r); } ln() { @@ -5484,39 +5483,21 @@ var ti = (Fe = class { return r.allowAbbreviation && Math.abs(Math.abs(this.imag) - 1) <= r.maxAbbreviationError; } }, u(Fe, "a"), Fe); -ti.ZERO = new ti(0, 0), ti.ONE = new ti(1, 0), ti.I = new ti(0, 1); -var ko = ti; -var No = { MAX_QUBIT_COUNT: 16 }; -var pu = 0; -var Ro; -var zt = (Ro = class extends Error { - static { - __name(this, "Ro"); - } - constructor(r, e) { - super(r), this.detailsObj = e, this.name = "Error", this.message = r, this.stack = new Error().stack, this.stack !== void 0 && (this.stack = this.stack.replace(/^Error\n\s+at new DetailedError (\S+)\s?\n\s+at /, ` - `)), pu++; - try { - this.details = pu === 1 ? (0, Fd.format)(this.detailsObj) : "(failed to prettyFormat detailsObj due to possibly re-entrancy)"; - } catch (n) { - console.error(n), this.details = "(failed to prettyFormat detailsObj, see the console for details)"; - } finally { - pu--; - } - } -}, u(Ro, "y"), Ro); +Jn.ZERO = new Jn(0, 0), Jn.ONE = new Jn(1, 0), Jn.I = new Jn(0, 1); +var Io = Jn; +var Ao = { MAX_QUBIT_COUNT: 16 }; function fe(t, r = {}, e = document) { let n = new CustomEvent(t, { bubbles: true, cancelable: true, detail: r }); return e.dispatchEvent(n); } __name(fe, "fe"); -u(fe, "Q"); -var Ud = u((t) => typeof t == "number" && 1 <= t && t <= No.MAX_QUBIT_COUNT, "H"); -var qb = u(() => ({ message: "Parse Error" }), "C"); -var _i; -var Wd = (_i = class { +u(fe, "$"); +var Hp = u((t) => typeof t == "number" && 1 <= t && t <= Ao.MAX_QUBIT_COUNT, "L"); +var vg = u(() => ({ message: "Parse Error" }), "z"); +var Ri; +var $p = (Ri = class { static { - __name(this, "_i"); + __name(this, "Ri"); } static need(r, e, n) { if (r !== true) { @@ -5529,114 +5510,114 @@ Args: ${s}`; } } static notNull(r) { - _i.need(r != null, "notNull"); + Ri.need(r != null, "notNull"); } static get urlJson() { let r = new URL(location.href, window.location.origin), e = decodeURIComponent(r.pathname), n = e.lastIndexOf("/"); return e.substring(n + 1); } -}, u(_i, "d"), _i); -Wd.safeJsonParse = Oo.fromThrowable(JSON.parse, qb); -var B = Wd; -var du = "\u25E6"; -var fu = "Bloch"; -var hu = "\u2022"; -var gs = "H"; -var bs = "Measure"; -var ys = "P"; -var mu = "QFT\u2020"; -var vu = "QFT"; -var ws = "X^\xBD"; -var xs = "Rx"; -var Es = "Ry"; -var Ss = "Rz"; -var Ts = "S\u2020"; -var Cs = "S"; -var gu = "\u2026"; -var bu = "Swap"; -var Os = "T\u2020"; -var Ms = "T"; -var Vd = "|0>"; -var Yd = "|1>"; -var Is = "X"; -var As = "Y"; -var Ps = "Z"; -var yu = /* @__PURE__ */ new WeakSet(); -function xu(t) { - yu.add(t), t.shadowRoot && Eu(t.shadowRoot), Tu(t), Su(t.ownerDocument); -} -__name(xu, "xu"); -u(xu, "bind"); -function Eu(t) { - Tu(t), Su(t); -} -__name(Eu, "Eu"); -u(Eu, "bindShadow"); -var zs = /* @__PURE__ */ new WeakMap(); -function Su(t = document) { - if (zs.has(t)) - return zs.get(t); +}, u(Ri, "b"), Ri); +$p.safeJsonParse = Co.fromThrowable(JSON.parse, vg); +var $ = $p; +var Ql = "\u25E6"; +var eu = "Bloch"; +var tu = "\u2022"; +var Qa = "H"; +var es = "Measure"; +var ts = "P"; +var ru = "QFT\u2020"; +var nu = "QFT"; +var rs = "X^\xBD"; +var ns = "Rx"; +var is = "Ry"; +var os = "Rz"; +var as = "S\u2020"; +var ss = "S"; +var iu = "\u2026"; +var ou = "Swap"; +var ls = "T\u2020"; +var us = "T"; +var Bp = "|0>"; +var qp = "|1>"; +var cs = "X"; +var ps = "Y"; +var ds = "Z"; +var au = /* @__PURE__ */ new WeakSet(); +function lu(t) { + au.add(t), t.shadowRoot && uu(t.shadowRoot), pu(t), cu(t.ownerDocument); +} +__name(lu, "lu"); +u(lu, "bind"); +function uu(t) { + pu(t), cu(t); +} +__name(uu, "uu"); +u(uu, "bindShadow"); +var fs = /* @__PURE__ */ new WeakMap(); +function cu(t = document) { + if (fs.has(t)) + return fs.get(t); let r = false, e = new MutationObserver((s) => { for (let a of s) if (a.type === "attributes" && a.target instanceof Element) - wu(a.target); + su(a.target); else if (a.type === "childList" && a.addedNodes.length) for (let p of a.addedNodes) - p instanceof Element && Tu(p); + p instanceof Element && pu(p); }); e.observe(t, { childList: true, subtree: true, attributeFilter: ["data-action"] }); let n = { get closed() { return r; }, unsubscribe() { - r = true, zs.delete(t), e.disconnect(); + r = true, fs.delete(t), e.disconnect(); } }; - return zs.set(t, n), n; + return fs.set(t, n), n; } -__name(Su, "Su"); -u(Su, "listenForBind"); -function Tu(t) { +__name(cu, "cu"); +u(cu, "listenForBind"); +function pu(t) { for (let r of t.querySelectorAll("[data-action]")) - wu(r); - t instanceof Element && t.hasAttribute("data-action") && wu(t); + su(r); + t instanceof Element && t.hasAttribute("data-action") && su(t); } -__name(Tu, "Tu"); -u(Tu, "bindElements"); -function Fb(t) { +__name(pu, "pu"); +u(pu, "bindElements"); +function gg(t) { let r = t.currentTarget; - for (let e of Xd(r)) + for (let e of Fp(r)) if (t.type === e.type) { let n = r.closest(e.tag); - yu.has(n) && typeof n[e.method] == "function" && n[e.method](t); + au.has(n) && typeof n[e.method] == "function" && n[e.method](t); let s = r.getRootNode(); - if (s instanceof ShadowRoot && yu.has(s.host) && s.host.matches(e.tag)) { + if (s instanceof ShadowRoot && au.has(s.host) && s.host.matches(e.tag)) { let a = s.host; typeof a[e.method] == "function" && a[e.method](t); } } } -__name(Fb, "Fb"); -u(Fb, "handleEvent"); -function* Xd(t) { +__name(gg, "gg"); +u(gg, "handleEvent"); +function* Fp(t) { for (let r of (t.getAttribute("data-action") || "").trim().split(/\s+/)) { let e = r.lastIndexOf(":"), n = Math.max(0, r.lastIndexOf("#")) || r.length; yield { type: r.slice(0, e), tag: r.slice(e + 1, n), method: r.slice(n + 1) || "handleEvent" }; } } -__name(Xd, "Xd"); -u(Xd, "bindings"); -function wu(t) { - for (let r of Xd(t)) - t.addEventListener(r.type, Fb); +__name(Fp, "Fp"); +u(Fp, "bindings"); +function su(t) { + for (let r of Fp(t)) + t.addEventListener(r.type, gg); } -__name(wu, "wu"); -u(wu, "bindActions"); -function Cu(t) { +__name(su, "su"); +u(su, "bindActions"); +function du(t) { let r = t.name.replace(/([A-Z]($|[a-z]))/g, "-$1").replace(/(^-|-Element$)/g, "").toLowerCase(); window.customElements.get(r) || (window[t.name] = t, window.customElements.define(r, t)); } -__name(Cu, "Cu"); -u(Cu, "register"); -function Ou(t, r) { +__name(du, "du"); +u(du, "register"); +function fu(t, r) { let e = t.tagName.toLowerCase(); if (t.shadowRoot) { for (let n of t.shadowRoot.querySelectorAll(`[data-target~="${e}.${r}"]`)) @@ -5647,9 +5628,9 @@ function Ou(t, r) { if (n.closest(e) === t) return n; } -__name(Ou, "Ou"); -u(Ou, "findTarget"); -function Mu(t, r) { +__name(fu, "fu"); +u(fu, "findTarget"); +function hu(t, r) { let e = t.tagName.toLowerCase(), n = []; if (t.shadowRoot) for (let s of t.shadowRoot.querySelectorAll(`[data-targets~="${e}.${r}"]`)) @@ -5658,38 +5639,38 @@ function Mu(t, r) { s.closest(e) === t && n.push(s); return n; } -__name(Mu, "Mu"); -u(Mu, "findTargets"); +__name(hu, "hu"); +u(hu, "findTargets"); function Oe(t, r) { return Object.defineProperty(t, r, { configurable: true, get() { - return Ou(this, r); + return fu(this, r); } }); } __name(Oe, "Oe"); u(Oe, "target"); function ft(t, r) { return Object.defineProperty(t, r, { configurable: true, get() { - return Mu(this, r); + return hu(this, r); } }); } __name(ft, "ft"); u(ft, "targets"); -function Iu(t) { +function mu(t) { for (let r of t.querySelectorAll("template[data-shadowroot]")) r.parentElement === t && t.attachShadow({ mode: r.getAttribute("data-shadowroot") === "closed" ? "closed" : "open" }).append(r.content.cloneNode(true)); } -__name(Iu, "Iu"); -u(Iu, "autoShadowRoot"); -var Rs = /* @__PURE__ */ new WeakMap(); +__name(mu, "mu"); +u(mu, "autoShadowRoot"); +var hs = /* @__PURE__ */ new WeakMap(); function k(t, r) { - Rs.has(t) || Rs.set(t, []), Rs.get(t).push(r); + hs.has(t) || hs.set(t, []), hs.get(t).push(r); } __name(k, "k"); u(k, "attr"); -function Au(t, r) { - r || (r = Zd(Object.getPrototypeOf(t))); +function vu(t, r) { + r || (r = Up(Object.getPrototypeOf(t))); for (let e of r) { - let n = t[e], s = Kd(e), a = { configurable: true, get() { + let n = t[e], s = Wp(e), a = { configurable: true, get() { return this.getAttribute(s) || ""; }, set(p) { this.setAttribute(s, p || ""); @@ -5705,51 +5686,51 @@ function Au(t, r) { } }), Object.defineProperty(t, e, a), e in t && !t.hasAttribute(s) && a.set.call(t, n); } } -__name(Au, "Au"); -u(Au, "initializeAttrs"); -function Zd(t) { +__name(vu, "vu"); +u(vu, "initializeAttrs"); +function Up(t) { let r = /* @__PURE__ */ new Set(), e = t; for (; e && e !== HTMLElement; ) { - let n = Rs.get(e) || []; + let n = hs.get(e) || []; for (let s of n) r.add(s); e = Object.getPrototypeOf(e); } return r; } -__name(Zd, "Zd"); -u(Zd, "getAttrNames"); -function Kd(t) { +__name(Up, "Up"); +u(Up, "getAttrNames"); +function Wp(t) { return `data-${t.replace(/([A-Z]($|[a-z]))/g, "-$1")}`.replace(/--/g, "-").toLowerCase(); } -__name(Kd, "Kd"); -u(Kd, "attrToAttributeName"); -function Pu(t) { +__name(Wp, "Wp"); +u(Wp, "attrToAttributeName"); +function gu(t) { let r = t.observedAttributes || []; Object.defineProperty(t, "observedAttributes", { configurable: true, get() { - return [...Zd(t.prototype)].map(Kd).concat(r); + return [...Up(t.prototype)].map(Wp).concat(r); }, set(e) { r = e; } }); } -__name(Pu, "Pu"); -u(Pu, "defineObservedAttributes"); -var Ub = /* @__PURE__ */ new WeakSet(); -function Jd(t, r) { - t.toggleAttribute("data-catalyst", true), customElements.upgrade(t), Ub.add(t), Iu(t), Au(t), xu(t), r && r.call(t), t.shadowRoot && Eu(t.shadowRoot); -} -__name(Jd, "Jd"); -u(Jd, "initializeInstance"); -function Qd(t) { - Pu(t), Cu(t); -} -__name(Qd, "Qd"); -u(Qd, "initializeClass"); +__name(gu, "gu"); +u(gu, "defineObservedAttributes"); +var bg = /* @__PURE__ */ new WeakSet(); +function Vp(t, r) { + t.toggleAttribute("data-catalyst", true), customElements.upgrade(t), bg.add(t), mu(t), vu(t), lu(t), r && r.call(t), t.shadowRoot && uu(t.shadowRoot); +} +__name(Vp, "Vp"); +u(Vp, "initializeInstance"); +function Yp(t) { + gu(t), du(t); +} +__name(Yp, "Yp"); +u(Yp, "initializeClass"); function X(t) { let r = t.prototype.connectedCallback; t.prototype.connectedCallback = function() { - Jd(this, r); - }, Qd(t); + Vp(this, r); + }, Yp(t); } __name(X, "X"); u(X, "controller"); @@ -5775,8 +5756,8 @@ function he(t) { } __name(he, "he"); u(he, "ActivateableMixin"); -var ni = u((t) => typeof t == "object" && t !== null && typeof t.angle == "string" && typeof t.reducedAngle == "string", "isAngleable"); -function zn(t) { +var ei = u((t) => typeof t == "object" && t !== null && typeof t.angle == "string" && typeof t.reducedAngle == "string", "isAngleable"); +function En(t) { let e = class e extends t { static { __name(this, "e"); @@ -5791,9 +5772,9 @@ function zn(t) { let r = e; return r; } -__name(zn, "zn"); -u(zn, "AngleableMixin"); -var _o = u((t) => typeof t == "object" && t !== null && typeof t.controls == "object", "isControllable"); +__name(En, "En"); +u(En, "AngleableMixin"); +var Po = u((t) => typeof t == "object" && t !== null && typeof t.controls == "object", "isControllable"); function Le(t) { let e = class e extends t { static { @@ -5861,7 +5842,7 @@ var V = u(function() { return r; }, "__assign"), V.apply(this, arguments); }, "__assign"); -function Li(t, r) { +function Di(t, r) { var e = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && r.indexOf(n) < 0 && (e[n] = t[n]); @@ -5870,8 +5851,8 @@ function Li(t, r) { r.indexOf(n[s]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[s]) && (e[n[s]] = t[n[s]]); return e; } -__name(Li, "Li"); -u(Li, "__rest"); +__name(Di, "Di"); +u(Di, "__rest"); function we(t) { var r = typeof Symbol == "function" && Symbol.iterator, e = r && t[r], n = 0; if (e) @@ -5918,97 +5899,97 @@ var Ne; (function(t) { t.Start = "xstate.start", t.Stop = "xstate.stop", t.Raise = "xstate.raise", t.Send = "xstate.send", t.Cancel = "xstate.cancel", t.NullEvent = "", t.Assign = "xstate.assign", t.After = "xstate.after", t.DoneState = "done.state", t.DoneInvoke = "done.invoke", t.Log = "xstate.log", t.Init = "xstate.init", t.Invoke = "xstate.invoke", t.ErrorExecution = "error.execution", t.ErrorCommunication = "error.communication", t.ErrorPlatform = "error.platform", t.ErrorCustom = "xstate.error", t.Update = "xstate.update", t.Pure = "xstate.pure", t.Choose = "xstate.choose"; })(Ne || (Ne = {})); -var an; +var rn; (function(t) { t.Parent = "#_parent", t.Internal = "#_internal"; -})(an || (an = {})); -var Lo = Ne.Start; -var Gi = Ne.Stop; -var Rn = Ne.Raise; -var ii = Ne.Send; -var Ds = Ne.Cancel; -var ef = Ne.NullEvent; -var zu = Ne.Assign; -var mx = Ne.After; -var vx = Ne.DoneState; -var ks = Ne.Log; -var tf = Ne.Init; -var Go = Ne.Invoke; -var gx = Ne.ErrorExecution; -var Ru = Ne.ErrorPlatform; -var Du = Ne.ErrorCustom; -var jo = Ne.Update; -var rf = Ne.Choose; -var nf = Ne.Pure; -var Ns = "."; -var ku = {}; -var _s = "xstate.guard"; -var of = ""; +})(rn || (rn = {})); +var zo = Ne.Start; +var ki = Ne.Stop; +var Sn = Ne.Raise; +var ti = Ne.Send; +var ms = Ne.Cancel; +var Xp = Ne.NullEvent; +var bu = Ne.Assign; +var Hw = Ne.After; +var $w = Ne.DoneState; +var vs = Ne.Log; +var Zp = Ne.Init; +var Ro = Ne.Invoke; +var Bw = Ne.ErrorExecution; +var yu = Ne.ErrorPlatform; +var wu = Ne.ErrorCustom; +var Do = Ne.Update; +var Kp = Ne.Choose; +var Jp = Ne.Pure; +var gs = "."; +var xu = {}; +var bs = "xstate.guard"; +var Qp = ""; var Ge = true; -var Ls; -function Bo(t, r, e) { - e === void 0 && (e = Ns); - var n = ji(t, e), s = ji(r, e); +var ys; +function No(t, r, e) { + e === void 0 && (e = gs); + var n = Ni(t, e), s = Ni(r, e); return Te(s) ? Te(n) ? s === n : false : Te(n) ? n in s : Object.keys(n).every(function(a) { - return a in s ? Bo(n[a], s[a]) : false; + return a in s ? No(n[a], s[a]) : false; }); } -__name(Bo, "Bo"); -u(Bo, "matchesState"); -function Gs(t) { +__name(No, "No"); +u(No, "matchesState"); +function ws(t) { try { return Te(t) || typeof t == "number" ? "".concat(t) : t.type; } catch (r) { throw new Error("Events must be strings or objects with a string event.type property."); } } -__name(Gs, "Gs"); -u(Gs, "getEventType"); -function js(t, r) { +__name(ws, "ws"); +u(ws, "getEventType"); +function xs(t, r) { try { - return sn(t) ? t : t.toString().split(r); + return nn(t) ? t : t.toString().split(r); } catch (e) { throw new Error("'".concat(t, "' is not a valid state path.")); } } -__name(js, "js"); -u(js, "toStatePath"); -function Wb(t) { +__name(xs, "xs"); +u(xs, "toStatePath"); +function yg(t) { return typeof t == "object" && "value" in t && "context" in t && "event" in t && "_event" in t; } -__name(Wb, "Wb"); -u(Wb, "isStateLike"); -function ji(t, r) { - if (Wb(t)) +__name(yg, "yg"); +u(yg, "isStateLike"); +function Ni(t, r) { + if (yg(t)) return t.value; - if (sn(t)) - return Ho(t); + if (nn(t)) + return ko(t); if (typeof t != "string") return t; - var e = js(t, r); - return Ho(e); + var e = xs(t, r); + return ko(e); } -__name(ji, "ji"); -u(ji, "toStateValue"); -function Ho(t) { +__name(Ni, "Ni"); +u(Ni, "toStateValue"); +function ko(t) { if (t.length === 1) return t[0]; for (var r = {}, e = r, n = 0; n < t.length - 1; n++) n === t.length - 2 ? e[t[n]] = t[n + 1] : (e[t[n]] = {}, e = e[t[n]]); return r; } -__name(Ho, "Ho"); -u(Ho, "pathToStateValue"); -function Hi(t, r) { +__name(ko, "ko"); +u(ko, "pathToStateValue"); +function _i(t, r) { for (var e = {}, n = Object.keys(t), s = 0; s < n.length; s++) { var a = n[s]; e[a] = r(t[a], a, t, s); } return e; } -__name(Hi, "Hi"); -u(Hi, "mapValues"); -function Nu(t, r, e) { +__name(_i, "_i"); +u(_i, "mapValues"); +function Eu(t, r, e) { var n, s, a = {}; try { for (var p = we(Object.keys(t)), v = p.next(); !v.done; v = p.next()) { @@ -6027,9 +6008,9 @@ function Nu(t, r, e) { } return a; } -__name(Nu, "Nu"); -u(Nu, "mapFilterValues"); -var af = u(function(t) { +__name(Eu, "Eu"); +u(Eu, "mapFilterValues"); +var ed = u(function(t) { return function(r) { var e, n, s = r; try { @@ -6050,7 +6031,7 @@ var af = u(function(t) { return s; }; }, "path"); -function sf(t, r) { +function td(t, r) { return function(e) { var n, s, a = e; try { @@ -6071,40 +6052,40 @@ function sf(t, r) { return a; }; } -__name(sf, "sf"); -u(sf, "nestedPath"); -function $o(t) { +__name(td, "td"); +u(td, "nestedPath"); +function _o(t) { if (!t) return [[]]; if (Te(t)) return [[t]]; - var r = $e(Object.keys(t).map(function(e) { + var r = Be(Object.keys(t).map(function(e) { var n = t[e]; - return typeof n != "string" && (!n || !Object.keys(n).length) ? [[e]] : $o(t[e]).map(function(s) { + return typeof n != "string" && (!n || !Object.keys(n).length) ? [[e]] : _o(t[e]).map(function(s) { return [e].concat(s); }); })); return r; } -__name($o, "$o"); -u($o, "toStatePaths"); -function $e(t) { +__name(_o, "_o"); +u(_o, "toStatePaths"); +function Be(t) { var r; return (r = []).concat.apply(r, ke([], Ee(t), false)); } -__name($e, "$e"); -u($e, "flatten"); -function lf(t) { - return sn(t) ? t : [t]; +__name(Be, "Be"); +u(Be, "flatten"); +function rd(t) { + return nn(t) ? t : [t]; } -__name(lf, "lf"); -u(lf, "toArrayStrict"); -function cr(t) { - return t === void 0 ? [] : lf(t); +__name(rd, "rd"); +u(rd, "toArrayStrict"); +function ur(t) { + return t === void 0 ? [] : rd(t); } -__name(cr, "cr"); -u(cr, "toArray"); -function oi(t, r, e) { +__name(ur, "ur"); +u(ur, "toArray"); +function ri(t, r, e) { var n, s; if (Ie(t)) return t(r, e.data); @@ -6126,24 +6107,24 @@ function oi(t, r, e) { } return a; } -__name(oi, "oi"); -u(oi, "mapContext"); -function uf(t) { +__name(ri, "ri"); +u(ri, "mapContext"); +function nd(t) { return /^(done|error)\./.test(t); } -__name(uf, "uf"); -u(uf, "isBuiltInEvent"); -function _u(t) { +__name(nd, "nd"); +u(nd, "isBuiltInEvent"); +function Su(t) { return !!(t instanceof Promise || t !== null && (Ie(t) || typeof t == "object") && Ie(t.then)); } -__name(_u, "_u"); -u(_u, "isPromiseLike"); -function cf(t) { +__name(Su, "Su"); +u(Su, "isPromiseLike"); +function id(t) { return t !== null && typeof t == "object" && "transition" in t && typeof t.transition == "function"; } -__name(cf, "cf"); -u(cf, "isBehavior"); -function pf(t, r) { +__name(id, "id"); +u(id, "isBehavior"); +function od(t, r) { var e, n, s = Ee([[], []], 2), a = s[0], p = s[1]; try { for (var v = we(t), m = v.next(); !m.done; m = v.next()) { @@ -6162,25 +6143,25 @@ function pf(t, r) { } return [a, p]; } -__name(pf, "pf"); -u(pf, "partition"); -function df(t, r) { - return Hi(t.states, function(e, n) { +__name(od, "od"); +u(od, "partition"); +function ad(t, r) { + return _i(t.states, function(e, n) { if (e) { var s = (Te(r) ? void 0 : r[n]) || (e ? e.current : void 0); if (s) - return { current: s, states: df(e, s) }; + return { current: s, states: ad(e, s) }; } }); } -__name(df, "df"); -u(df, "updateHistoryStates"); -function ff(t, r) { - return { current: r, states: df(t, r) }; +__name(ad, "ad"); +u(ad, "updateHistoryStates"); +function sd(t, r) { + return { current: r, states: ad(t, r) }; } -__name(ff, "ff"); -u(ff, "updateHistoryValue"); -function Lu(t, r, e, n) { +__name(sd, "sd"); +u(sd, "updateHistoryValue"); +function Tu(t, r, e, n) { Ge || nt(!!t, "Attempting to update undefined context"); var s = t && e.reduce(function(a, p) { var v, m, d = p.assignment, f = { state: n, action: p, _event: r }, g = {}; @@ -6206,8 +6187,8 @@ function Lu(t, r, e, n) { }, t); return s; } -__name(Lu, "Lu"); -u(Lu, "updateContext"); +__name(Tu, "Tu"); +u(Tu, "updateContext"); var nt = u(function() { }, "warn"); Ge || (nt = u(function(t, r) { @@ -6217,11 +6198,11 @@ Ge || (nt = u(function(t, r) { e && n.push(e), console.warn.apply(console, n); } }, "warn")); -function sn(t) { +function nn(t) { return Array.isArray(t); } -__name(sn, "sn"); -u(sn, "isArray"); +__name(nn, "nn"); +u(nn, "isArray"); function Ie(t) { return typeof t == "function"; } @@ -6232,67 +6213,67 @@ function Te(t) { } __name(Te, "Te"); u(Te, "isString"); -function Hs(t, r) { +function Es(t, r) { if (t) - return Te(t) ? { type: _s, name: t, predicate: r ? r[t] : void 0 } : Ie(t) ? { type: _s, name: t.name, predicate: t } : t; + return Te(t) ? { type: bs, name: t, predicate: r ? r[t] : void 0 } : Ie(t) ? { type: bs, name: t.name, predicate: t } : t; } -__name(Hs, "Hs"); -u(Hs, "toGuard"); -function hf(t) { +__name(Es, "Es"); +u(Es, "toGuard"); +function ld(t) { try { return "subscribe" in t && Ie(t.subscribe); } catch (r) { return false; } } -__name(hf, "hf"); -u(hf, "isObservable"); -var jr = function() { +__name(ld, "ld"); +u(ld, "isObservable"); +var Gr = function() { return typeof Symbol == "function" && Symbol.observable || "@@observable"; }(); -var Ox = (Ls = {}, Ls[jr] = function() { +var Kw = (ys = {}, ys[Gr] = function() { return this; -}, Ls[Symbol.observable] = function() { +}, ys[Symbol.observable] = function() { return this; -}, Ls); -function Hr(t) { +}, ys); +function jr(t) { return !!t && "__xstatenode" in t; } -__name(Hr, "Hr"); -u(Hr, "isMachine"); -function mf(t) { +__name(jr, "jr"); +u(jr, "isMachine"); +function ud(t) { return !!t && typeof t.send == "function"; } -__name(mf, "mf"); -u(mf, "isActor"); -function Bi(t, r) { +__name(ud, "ud"); +u(ud, "isActor"); +function Li(t, r) { return Te(t) || typeof t == "number" ? V({ type: t }, r) : t; } -__name(Bi, "Bi"); -u(Bi, "toEventObject"); +__name(Li, "Li"); +u(Li, "toEventObject"); function st(t, r) { if (!Te(t) && "$$type" in t && t.$$type === "scxml") return t; - var e = Bi(t); + var e = Li(t); return V({ name: e.type, data: e, $$type: "scxml", type: "external" }, r); } __name(st, "st"); u(st, "toSCXMLEvent"); -function ai(t, r) { - var e = lf(r).map(function(n) { - return typeof n == "undefined" || typeof n == "string" || Hr(n) ? { target: n, event: t } : V(V({}, n), { event: t }); +function ni(t, r) { + var e = rd(r).map(function(n) { + return typeof n == "undefined" || typeof n == "string" || jr(n) ? { target: n, event: t } : V(V({}, n), { event: t }); }); return e; } -__name(ai, "ai"); -u(ai, "toTransitionConfigArray"); -function vf(t) { - if (!(t === void 0 || t === of)) - return cr(t); +__name(ni, "ni"); +u(ni, "toTransitionConfigArray"); +function cd(t) { + if (!(t === void 0 || t === Qp)) + return ur(t); } -__name(vf, "vf"); -u(vf, "normalizeTarget"); -function gf(t, r, e) { +__name(cd, "cd"); +u(cd, "normalizeTarget"); +function pd(t, r, e) { if (!Ge) { var n = t.stack ? " Stacktrace was '".concat(t.stack, "'") : ""; if (t === r) @@ -6303,56 +6284,56 @@ function gf(t, r, e) { } } } -__name(gf, "gf"); -u(gf, "reportUnhandledExceptionOnInvocation"); -function Bs(t, r, e, n, s) { +__name(pd, "pd"); +u(pd, "reportUnhandledExceptionOnInvocation"); +function Ss(t, r, e, n, s) { var a = t.options.guards, p = { state: s, cond: r, _event: n }; - if (r.type === _s) + if (r.type === bs) return ((a == null ? void 0 : a[r.name]) || r.predicate)(e, n.data, p); var v = a == null ? void 0 : a[r.type]; if (!v) throw new Error("Guard '".concat(r.type, "' is not implemented on machine '").concat(t.id, "'.")); return v(e, n.data, p); } -__name(Bs, "Bs"); -u(Bs, "evaluateGuard"); -function $s(t) { +__name(Ss, "Ss"); +u(Ss, "evaluateGuard"); +function Ts(t) { return typeof t == "string" ? { type: t } : t; } -__name($s, "$s"); -u($s, "toInvokeSource"); -function $i(t, r, e) { +__name(Ts, "Ts"); +u(Ts, "toInvokeSource"); +function Gi(t, r, e) { var n = u(function() { }, "noop"), s = typeof t == "object", a = s ? t : null; return { next: ((s ? t.next : t) || n).bind(a), error: ((s ? t.error : r) || n).bind(a), complete: ((s ? t.complete : e) || n).bind(a) }; } -__name($i, "$i"); -u($i, "toObserver"); -function qo(t, r) { +__name(Gi, "Gi"); +u(Gi, "toObserver"); +function Lo(t, r) { return "".concat(t, ":invocation[").concat(r, "]"); } -__name(qo, "qo"); -u(qo, "createInvokeId"); -function Fo(t) { - return (t.type === Rn || t.type === ii && t.to === an.Internal) && typeof t.delay != "number"; +__name(Lo, "Lo"); +u(Lo, "createInvokeId"); +function Go(t) { + return (t.type === Sn || t.type === ti && t.to === rn.Internal) && typeof t.delay != "number"; } -__name(Fo, "Fo"); -u(Fo, "isRaisableAction"); -var ln = st({ type: tf }); -function qs(t, r) { +__name(Go, "Go"); +u(Go, "isRaisableAction"); +var on = st({ type: Zp }); +function Cs(t, r) { return r && r[t] || void 0; } -__name(qs, "qs"); -u(qs, "getActionFunction"); -function Fi(t, r) { +__name(Cs, "Cs"); +u(Cs, "getActionFunction"); +function Hi(t, r) { var e; if (Te(t) || typeof t == "number") { - var n = qs(t, r); + var n = Cs(t, r); Ie(n) ? e = { type: t, exec: n } : n ? e = n : e = { type: t, exec: void 0 }; } else if (Ie(t)) e = { type: t.name || t.toString(), exec: t }; else { - var n = qs(t.type, r); + var n = Cs(t.type, r); if (Ie(n)) e = V(V({}, t), { exec: n }); else if (n) { @@ -6363,44 +6344,44 @@ function Fi(t, r) { } return e; } -__name(Fi, "Fi"); -u(Fi, "toActionObject"); -var Br = u(function(t, r) { +__name(Hi, "Hi"); +u(Hi, "toActionObject"); +var Hr = u(function(t, r) { if (!t) return []; - var e = sn(t) ? t : [t]; + var e = nn(t) ? t : [t]; return e.map(function(n) { - return Fi(n, r); + return Hi(n, r); }); }, "toActionObjects"); -function Fs(t) { - var r = Fi(t); +function Os(t) { + var r = Hi(t); return V(V({ id: Te(t) ? t : r.id }, r), { type: r.type }); } -__name(Fs, "Fs"); -u(Fs, "toActivityDefinition"); -function bf(t, r) { - return { type: Rn, event: typeof t == "function" ? t : Bi(t), delay: r ? r.delay : void 0, id: r == null ? void 0 : r.id }; +__name(Os, "Os"); +u(Os, "toActivityDefinition"); +function dd(t, r) { + return { type: Sn, event: typeof t == "function" ? t : Li(t), delay: r ? r.delay : void 0, id: r == null ? void 0 : r.id }; } -__name(bf, "bf"); -u(bf, "raise"); -function Vb(t, r, e, n) { +__name(dd, "dd"); +u(dd, "raise"); +function wg(t, r, e, n) { var s = { _event: e }, a = st(Ie(t.event) ? t.event(r, e.data, s) : t.event), p; if (Te(t.delay)) { var v = n && n[t.delay]; p = Ie(v) ? v(r, e.data, s) : v; } else p = Ie(t.delay) ? t.delay(r, e.data, s) : t.delay; - return V(V({}, t), { type: Rn, _event: a, delay: p }); + return V(V({}, t), { type: Sn, _event: a, delay: p }); } -__name(Vb, "Vb"); -u(Vb, "resolveRaise"); -function yf(t, r) { - return { to: r ? r.to : void 0, type: ii, event: Ie(t) ? t : Bi(t), delay: r ? r.delay : void 0, id: r && r.id !== void 0 ? r.id : Ie(t) ? t.name : Gs(t) }; +__name(wg, "wg"); +u(wg, "resolveRaise"); +function fd(t, r) { + return { to: r ? r.to : void 0, type: ti, event: Ie(t) ? t : Li(t), delay: r ? r.delay : void 0, id: r && r.id !== void 0 ? r.id : Ie(t) ? t.name : ws(t) }; } -__name(yf, "yf"); -u(yf, "send"); -function Yb(t, r, e, n) { +__name(fd, "fd"); +u(fd, "send"); +function xg(t, r, e, n) { var s = { _event: e }, a = st(Ie(t.event) ? t.event(r, e.data, s) : t.event), p; if (Te(t.delay)) { var v = n && n[t.delay]; @@ -6410,68 +6391,68 @@ function Yb(t, r, e, n) { var m = Ie(t.to) ? t.to(r, e.data, s) : t.to; return V(V({}, t), { to: m, _event: a, event: a.data, delay: p }); } -__name(Yb, "Yb"); -u(Yb, "resolveSend"); -var Xb = u(function(t, r, e) { +__name(xg, "xg"); +u(xg, "resolveSend"); +var Eg = u(function(t, r, e) { return V(V({}, t), { value: Te(t.expr) ? t.expr : t.expr(r, e.data, { _event: e }) }); }, "resolveLog"); -var wf = u(function(t) { - return { type: Ds, sendId: t }; +var hd = u(function(t) { + return { type: ms, sendId: t }; }, "cancel"); -function xf(t) { - var r = Fs(t); +function md(t) { + var r = Os(t); return { type: Ne.Start, activity: r, exec: void 0 }; } -__name(xf, "xf"); -u(xf, "start"); -function Ef(t) { - var r = Ie(t) ? t : Fs(t); +__name(md, "md"); +u(md, "start"); +function vd(t) { + var r = Ie(t) ? t : Os(t); return { type: Ne.Stop, activity: r, exec: void 0 }; } -__name(Ef, "Ef"); -u(Ef, "stop"); -function Zb(t, r, e) { +__name(vd, "vd"); +u(vd, "stop"); +function Sg(t, r, e) { var n = Ie(t.activity) ? t.activity(r, e.data) : t.activity, s = typeof n == "string" ? { id: n } : n, a = { type: Ne.Stop, activity: s }; return a; } -__name(Zb, "Zb"); -u(Zb, "resolveStop"); -function Sf(t, r) { +__name(Sg, "Sg"); +u(Sg, "resolveStop"); +function gd(t, r) { var e = r ? "#".concat(r) : ""; return "".concat(Ne.After, "(").concat(t, ")").concat(e); } -__name(Sf, "Sf"); -u(Sf, "after"); -function Uo(t, r) { +__name(gd, "gd"); +u(gd, "after"); +function jo(t, r) { var e = "".concat(Ne.DoneState, ".").concat(t), n = { type: e, data: r }; return n.toString = function() { return e; }, n; } -__name(Uo, "Uo"); -u(Uo, "done"); -function Ui(t, r) { +__name(jo, "jo"); +u(jo, "done"); +function $i(t, r) { var e = "".concat(Ne.DoneInvoke, ".").concat(t), n = { type: e, data: r }; return n.toString = function() { return e; }, n; } -__name(Ui, "Ui"); -u(Ui, "doneInvoke"); -function si(t, r) { +__name($i, "$i"); +u($i, "doneInvoke"); +function ii(t, r) { var e = "".concat(Ne.ErrorPlatform, ".").concat(t), n = { type: e, data: r }; return n.toString = function() { return e; }, n; } -__name(si, "si"); -u(si, "error"); -var Kb = u(function(t) { +__name(ii, "ii"); +u(ii, "error"); +var Tg = u(function(t) { var r, e, n = []; try { for (var s = we(t), a = s.next(); !a.done; a = s.next()) for (var p = a.value, v = 0; v < p.actions.length; ) { - if (p.actions[v].type === zu) { + if (p.actions[v].type === bu) { n.push(p.actions[v]), p.actions.splice(v, 1); continue; } @@ -6489,54 +6470,54 @@ var Kb = u(function(t) { } return n; }, "pluckAssigns"); -function qi(t, r, e, n, s, a, p) { +function ji(t, r, e, n, s, a, p) { p === void 0 && (p = false); - var v = p ? [] : Kb(s), m = v.length ? Lu(e, n, v, r) : e, d = p ? [e] : void 0, f = []; + var v = p ? [] : Tg(s), m = v.length ? Tu(e, n, v, r) : e, d = p ? [e] : void 0, f = []; function g(T, C) { var R; switch (C.type) { - case Rn: { - var _ = Vb(C, m, n, t.options.delays); + case Sn: { + var _ = wg(C, m, n, t.options.delays); return a && typeof _.delay == "number" && a(_, m, n), _; } - case ii: - var L = Yb(C, m, n, t.options.delays); + case ti: + var L = xg(C, m, n, t.options.delays); if (!Ge) { - var $ = C.delay; - nt(!Te($) || typeof L.delay == "number", "No delay reference for delay expression '".concat($, "' was found on machine '").concat(t.id, "'")); + var B = C.delay; + nt(!Te(B) || typeof L.delay == "number", "No delay reference for delay expression '".concat(B, "' was found on machine '").concat(t.id, "'")); } - return a && L.to !== an.Internal && (T === "entry" ? f.push(L) : a(L, m, n)), L; - case ks: { - var A = Xb(C, m, n); + return a && L.to !== rn.Internal && (T === "entry" ? f.push(L) : a(L, m, n)), L; + case vs: { + var A = Eg(C, m, n); return a == null || a(A, m, n), A; } - case rf: { + case Kp: { var ee = C, z = (R = ee.conds.find(function(ze) { - var Ae = Hs(ze.cond, t.options.guards); - return !Ae || Bs(t, Ae, m, n, a ? void 0 : r); + var Ae = Es(ze.cond, t.options.guards); + return !Ae || Ss(t, Ae, m, n, a ? void 0 : r); })) === null || R === void 0 ? void 0 : R.actions; if (!z) return []; - var H = Ee(qi(t, r, m, n, [{ type: T, actions: Br(cr(z), t.options.actions) }], a, p), 2), te = H[0], Q = H[1]; + var H = Ee(ji(t, r, m, n, [{ type: T, actions: Hr(ur(z), t.options.actions) }], a, p), 2), te = H[0], Q = H[1]; return m = Q, d == null || d.push(m), te; } - case nf: { + case Jp: { var z = C.get(m, n.data); if (!z) return []; - var ue = Ee(qi(t, r, m, n, [{ type: T, actions: Br(cr(z), t.options.actions) }], a, p), 2), K = ue[0], ie = ue[1]; + var ue = Ee(ji(t, r, m, n, [{ type: T, actions: Hr(ur(z), t.options.actions) }], a, p), 2), K = ue[0], ie = ue[1]; return m = ie, d == null || d.push(m), K; } - case Gi: { - var A = Zb(C, m, n); + case ki: { + var A = Sg(C, m, n); return a == null || a(A, e, n), A; } - case zu: { - m = Lu(m, n, [C], a ? void 0 : r), d == null || d.push(m); + case bu: { + m = Tu(m, n, [C], a ? void 0 : r), d == null || d.push(m); break; } default: - var q = Fi(C, t.options.actions), oe = q.exec; + var q = Hi(C, t.options.actions), oe = q.exec; if (a) a(q, m, n); else if (oe && d) { @@ -6555,15 +6536,15 @@ function qi(t, r, e, n, s, a, p) { function w(T) { var C, R, _ = []; try { - for (var L = we(T.actions), $ = L.next(); !$.done; $ = L.next()) { - var A = $.value, ee = g(T.type, A); + for (var L = we(T.actions), B = L.next(); !B.done; B = L.next()) { + var A = B.value, ee = g(T.type, A); ee && (_ = _.concat(ee)); } } catch (z) { C = { error: z }; } finally { try { - $ && !$.done && (R = L.return) && R.call(L); + B && !B.done && (R = L.return) && R.call(L); } finally { if (C) throw C.error; @@ -6575,18 +6556,18 @@ function qi(t, r, e, n, s, a, p) { } __name(w, "w"); u(w, "processBlock"); - var S = $e(s.map(w)); + var S = Be(s.map(w)); return [S, m]; } -__name(qi, "qi"); -u(qi, "resolveActions"); -var Tf = []; -var Dn = u(function(t, r) { - Tf.push(t); +__name(ji, "ji"); +u(ji, "resolveActions"); +var bd = []; +var Tn = u(function(t, r) { + bd.push(t); var e = r(t); - return Tf.pop(), e; + return bd.pop(), e; }, "provide"); -function Cf(t) { +function yd(t) { var r; return r = { id: t, send: function() { }, subscribe: function() { @@ -6595,22 +6576,22 @@ function Cf(t) { }, getSnapshot: function() { }, toJSON: function() { return { id: t }; - } }, r[jr] = function() { + } }, r[Gr] = function() { return this; }, r; } -__name(Cf, "Cf"); -u(Cf, "createNullActor"); -function Of(t, r, e, n) { - var s, a = $s(t.src), p = (s = r == null ? void 0 : r.options.services) === null || s === void 0 ? void 0 : s[a.type], v = t.data ? oi(t.data, e, n) : void 0, m = p ? Gu(p, t.id, v) : Cf(t.id); +__name(yd, "yd"); +u(yd, "createNullActor"); +function wd(t, r, e, n) { + var s, a = Ts(t.src), p = (s = r == null ? void 0 : r.options.services) === null || s === void 0 ? void 0 : s[a.type], v = t.data ? ri(t.data, e, n) : void 0, m = p ? Cu(p, t.id, v) : yd(t.id); return m.meta = t, m; } -__name(Of, "Of"); -u(Of, "createInvocableActor"); -function Gu(t, r, e) { - var n = Cf(r); - if (n.deferred = true, Hr(t)) { - var s = n.state = Dn(void 0, function() { +__name(wd, "wd"); +u(wd, "createInvocableActor"); +function Cu(t, r, e) { + var n = yd(r); + if (n.deferred = true, jr(t)) { + var s = n.state = Tn(void 0, function() { return (e ? t.withContext(e) : t).initialState; }); n.getSnapshot = function() { @@ -6619,59 +6600,59 @@ function Gu(t, r, e) { } return n; } -__name(Gu, "Gu"); -u(Gu, "createDeferredActor"); -function Jb(t) { +__name(Cu, "Cu"); +u(Cu, "createDeferredActor"); +function Cg(t) { try { return typeof t.send == "function"; } catch (r) { return false; } } -__name(Jb, "Jb"); -u(Jb, "isActor"); -function Mf(t) { - return Jb(t) && "id" in t; +__name(Cg, "Cg"); +u(Cg, "isActor"); +function xd(t) { + return Cg(t) && "id" in t; } -__name(Mf, "Mf"); -u(Mf, "isSpawnedActor"); -function If(t) { +__name(xd, "xd"); +u(xd, "isSpawnedActor"); +function Ed(t) { var r; return V((r = { subscribe: function() { return { unsubscribe: function() { } }; }, id: "anonymous", getSnapshot: function() { - } }, r[jr] = function() { + } }, r[Gr] = function() { return this; }, r), t); } -__name(If, "If"); -u(If, "toActorRef"); -var Wo = u(function(t) { +__name(Ed, "Ed"); +u(Ed, "toActorRef"); +var Ho = u(function(t) { return t.type === "atomic" || t.type === "final"; }, "isLeafNode"); -function Hu(t) { +function Mu(t) { return Object.keys(t.states).map(function(r) { return t.states[r]; }); } -__name(Hu, "Hu"); -u(Hu, "getAllChildren"); -function Wi(t) { - return Hu(t).filter(function(r) { +__name(Mu, "Mu"); +u(Mu, "getAllChildren"); +function Bi(t) { + return Mu(t).filter(function(r) { return r.type !== "history"; }); } -__name(Wi, "Wi"); -u(Wi, "getChildren"); -function Bu(t) { +__name(Bi, "Bi"); +u(Bi, "getChildren"); +function Iu(t) { var r = [t]; - return Wo(t) ? r : r.concat($e(Wi(t).map(Bu))); + return Ho(t) ? r : r.concat(Be(Bi(t).map(Iu))); } -__name(Bu, "Bu"); -u(Bu, "getAllStateNodes"); -function Vi(t, r) { - var e, n, s, a, p, v, m, d, f = new Set(t), g = ju(f), w = new Set(r); +__name(Iu, "Iu"); +u(Iu, "getAllStateNodes"); +function qi(t, r) { + var e, n, s, a, p, v, m, d, f = new Set(t), g = Ou(f), w = new Set(r); try { for (var S = we(w), T = S.next(); !T.done; T = S.next()) for (var C = T.value, R = C.parent; R && !w.has(R); ) @@ -6686,10 +6667,10 @@ function Vi(t, r) { throw e.error; } } - var _ = ju(w); + var _ = Ou(w); try { - for (var L = we(w), $ = L.next(); !$.done; $ = L.next()) { - var C = $.value; + for (var L = we(w), B = L.next(); !B.done; B = L.next()) { + var C = B.value; if (C.type === "compound" && (!_.get(C) || !_.get(C).length)) g.get(C) ? g.get(C).forEach(function(ue) { return w.add(ue); @@ -6698,7 +6679,7 @@ function Vi(t, r) { }); else if (C.type === "parallel") try { - for (var A = (p = void 0, we(Wi(C))), ee = A.next(); !ee.done; ee = A.next()) { + for (var A = (p = void 0, we(Bi(C))), ee = A.next(); !ee.done; ee = A.next()) { var z = ee.value; w.has(z) || (w.add(z), g.get(z) ? g.get(z).forEach(function(ue) { return w.add(ue); @@ -6721,7 +6702,7 @@ function Vi(t, r) { s = { error: Q }; } finally { try { - $ && !$.done && (a = L.return) && a.call(L); + B && !B.done && (a = L.return) && a.call(L); } finally { if (s) throw s.error; @@ -6743,28 +6724,28 @@ function Vi(t, r) { } return w; } -__name(Vi, "Vi"); -u(Vi, "getConfiguration"); -function Af(t, r) { +__name(qi, "qi"); +u(qi, "getConfiguration"); +function Sd(t, r) { var e = r.get(t); if (!e) return {}; if (t.type === "compound") { var n = e[0]; if (n) { - if (Wo(n)) + if (Ho(n)) return n.key; } else return {}; } var s = {}; return e.forEach(function(a) { - s[a.key] = Af(a, r); + s[a.key] = Sd(a, r); }), s; } -__name(Af, "Af"); -u(Af, "getValueFromAdj"); -function ju(t) { +__name(Sd, "Sd"); +u(Sd, "getValueFromAdj"); +function Ou(t) { var r, e, n = /* @__PURE__ */ new Map(); try { for (var s = we(t), a = s.next(); !a.done; a = s.next()) { @@ -6783,52 +6764,52 @@ function ju(t) { } return n; } -__name(ju, "ju"); -u(ju, "getAdjList"); -function Pf(t, r) { - var e = Vi([t], r); - return Af(t, ju(e)); +__name(Ou, "Ou"); +u(Ou, "getAdjList"); +function Td(t, r) { + var e = qi([t], r); + return Sd(t, Ou(e)); } -__name(Pf, "Pf"); -u(Pf, "getValue"); -function Yi(t, r) { +__name(Td, "Td"); +u(Td, "getValue"); +function Fi(t, r) { return Array.isArray(t) ? t.some(function(e) { return e === r; }) : t instanceof Set ? t.has(r) : false; } -__name(Yi, "Yi"); -u(Yi, "has"); -function zf(t) { - return ke([], Ee(new Set($e(ke([], Ee(t.map(function(r) { +__name(Fi, "Fi"); +u(Fi, "has"); +function Cd(t) { + return ke([], Ee(new Set(Be(ke([], Ee(t.map(function(r) { return r.ownEvents; })), false)))), false); } -__name(zf, "zf"); -u(zf, "nextEvents"); -function Vo(t, r) { - return r.type === "compound" ? Wi(r).some(function(e) { - return e.type === "final" && Yi(t, e); - }) : r.type === "parallel" ? Wi(r).every(function(e) { - return Vo(t, e); +__name(Cd, "Cd"); +u(Cd, "nextEvents"); +function $o(t, r) { + return r.type === "compound" ? Bi(r).some(function(e) { + return e.type === "final" && Fi(t, e); + }) : r.type === "parallel" ? Bi(r).every(function(e) { + return $o(t, e); }) : false; } -__name(Vo, "Vo"); -u(Vo, "isInFinalState"); -function Rf(t) { +__name($o, "$o"); +u($o, "isInFinalState"); +function Od(t) { return t === void 0 && (t = []), t.reduce(function(r, e) { return e.meta !== void 0 && (r[e.id] = e.meta), r; }, {}); } -__name(Rf, "Rf"); -u(Rf, "getMeta"); -function $u(t) { - return new Set($e(t.map(function(r) { +__name(Od, "Od"); +u(Od, "getMeta"); +function Au(t) { + return new Set(Be(t.map(function(r) { return r.tags; }))); } -__name($u, "$u"); -u($u, "getTagsFromConfiguration"); -function qu(t, r) { +__name(Au, "Au"); +u(Au, "getTagsFromConfiguration"); +function Pu(t, r) { if (t === r) return true; if (t === void 0 || r === void 0) @@ -6837,36 +6818,36 @@ function qu(t, r) { return t === r; var e = Object.keys(t), n = Object.keys(r); return e.length === n.length && e.every(function(s) { - return qu(t[s], r[s]); + return Pu(t[s], r[s]); }); } -__name(qu, "qu"); -u(qu, "stateValuesEqual"); -function Df(t) { +__name(Pu, "Pu"); +u(Pu, "stateValuesEqual"); +function Md(t) { return typeof t != "object" || t === null ? false : "value" in t && "_event" in t; } -__name(Df, "Df"); -u(Df, "isStateConfig"); -function kf(t, r) { +__name(Md, "Md"); +u(Md, "isStateConfig"); +function Id(t, r) { var e = t.exec, n = V(V({}, t), { exec: e !== void 0 ? function() { return e(r.context, r.event, { action: t, state: r, _event: r._event }); } : void 0 }); return n; } -__name(kf, "kf"); -u(kf, "bindActionToState"); -var Sr = function() { +__name(Id, "Id"); +u(Id, "bindActionToState"); +var wr = function() { function t(r) { var e = this, n; - this.actions = [], this.activities = ku, this.meta = {}, this.events = [], this.value = r.value, this.context = r.context, this._event = r._event, this._sessionid = r._sessionid, this.event = this._event.data, this.historyValue = r.historyValue, this.history = r.history, this.actions = r.actions || [], this.activities = r.activities || ku, this.meta = Rf(r.configuration), this.events = r.events || [], this.matches = this.matches.bind(this), this.toStrings = this.toStrings.bind(this), this.configuration = r.configuration, this.transitions = r.transitions, this.children = r.children, this.done = !!r.done, this.tags = (n = Array.isArray(r.tags) ? new Set(r.tags) : r.tags) !== null && n !== void 0 ? n : /* @__PURE__ */ new Set(), this.machine = r.machine, Object.defineProperty(this, "nextEvents", { get: function() { - return zf(e.configuration); + this.actions = [], this.activities = xu, this.meta = {}, this.events = [], this.value = r.value, this.context = r.context, this._event = r._event, this._sessionid = r._sessionid, this.event = this._event.data, this.historyValue = r.historyValue, this.history = r.history, this.actions = r.actions || [], this.activities = r.activities || xu, this.meta = Od(r.configuration), this.events = r.events || [], this.matches = this.matches.bind(this), this.toStrings = this.toStrings.bind(this), this.configuration = r.configuration, this.transitions = r.transitions, this.children = r.children, this.done = !!r.done, this.tags = (n = Array.isArray(r.tags) ? new Set(r.tags) : r.tags) !== null && n !== void 0 ? n : /* @__PURE__ */ new Set(), this.machine = r.machine, Object.defineProperty(this, "nextEvents", { get: function() { + return Cd(e.configuration); } }); } __name(t, "t"); return u(t, "State"), t.from = function(r, e) { if (r instanceof t) return r.context !== e ? new t({ value: r.value, context: e, _event: r._event, _sessionid: null, historyValue: r.historyValue, history: r.history, actions: [], activities: r.activities, meta: {}, events: [], configuration: [], transitions: [], children: {} }) : r; - var n = ln; + var n = on; return new t({ value: r, context: e, _event: n, _sessionid: null, historyValue: void 0, history: void 0, actions: [], activities: void 0, meta: void 0, events: [], configuration: [], transitions: [], children: {} }); }, t.create = function(r) { return new t(r); @@ -6874,7 +6855,7 @@ var Sr = function() { if (r instanceof t) { if (!r.actions.length) return r; - var n = ln; + var n = on; return new t({ value: r.value, context: e, _event: n, _sessionid: null, historyValue: r.historyValue, history: r.history, activities: r.activities, configuration: r.configuration, transitions: [], children: {} }); } return t.from(r, e); @@ -6893,10 +6874,10 @@ var Sr = function() { r.configuration, r.transitions; var e = r.tags; r.machine; - var n = Li(r, ["configuration", "transitions", "tags", "machine"]); + var n = Di(r, ["configuration", "transitions", "tags", "machine"]); return V(V({}, n), { tags: Array.from(e) }); }, t.prototype.matches = function(r) { - return Bo(r, this.value); + return No(r, this.value); }, t.prototype.hasTag = function(r) { return this.tags.has(r); }, t.prototype.can = function(r) { @@ -6908,10 +6889,10 @@ var Sr = function() { }); }, t; }(); -var Qb = { deferEvents: false }; -var Fu = function() { +var Og = { deferEvents: false }; +var zu = function() { function t(r) { - this.processingEvent = false, this.queue = [], this.initialized = false, this.options = V(V({}, Qb), r); + this.processingEvent = false, this.queue = [], this.initialized = false, this.options = V(V({}, Og), r); } __name(t, "t"); return u(t, "Scheduler"), t.prototype.initialize = function(r) { @@ -6947,18 +6928,18 @@ var Fu = function() { } }, t; }(); -var Uu = /* @__PURE__ */ new Map(); -var ey = 0; -var Xi = { bookId: function() { - return "x:".concat(ey++); +var Ru = /* @__PURE__ */ new Map(); +var Mg = 0; +var Ui = { bookId: function() { + return "x:".concat(Mg++); }, register: function(t, r) { - return Uu.set(t, r), t; + return Ru.set(t, r), t; }, get: function(t) { - return Uu.get(t); + return Ru.get(t); }, free: function(t) { - Uu.delete(t); + Ru.delete(t); } }; -function Us() { +function Ms() { if (typeof globalThis != "undefined") return globalThis; if (typeof self != "undefined") @@ -6969,24 +6950,24 @@ function Us() { return global; Ge || console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues"); } -__name(Us, "Us"); -u(Us, "getGlobal"); -function ty() { - var t = Us(); +__name(Ms, "Ms"); +u(Ms, "getGlobal"); +function Ig() { + var t = Ms(); if (t && "__xstate__" in t) return t.__xstate__; } -__name(ty, "ty"); -u(ty, "getDevTools"); -function Nf(t) { - if (Us()) { - var r = ty(); +__name(Ig, "Ig"); +u(Ig, "getDevTools"); +function Ad(t) { + if (Ms()) { + var r = Ig(); r && r.register(t); } } -__name(Nf, "Nf"); -u(Nf, "registerService"); -function _f(t, r) { +__name(Ad, "Ad"); +u(Ad, "registerService"); +function Pd(t, r) { r === void 0 && (r = {}); var e = t.initialState, n = /* @__PURE__ */ new Set(), s = [], a = false, p = u(function() { if (!a) { @@ -6998,33 +6979,33 @@ function _f(t, r) { } a = false; } - }, "flush"), v = If({ id: r.id, send: function(d) { + }, "flush"), v = Ed({ id: r.id, send: function(d) { s.push(d), p(); }, getSnapshot: function() { return e; }, subscribe: function(d, f, g) { - var w = $i(d, f, g); + var w = Gi(d, f, g); return n.add(w), w.next(e), { unsubscribe: function() { n.delete(w); } }; } }), m = { parent: r.parent, self: v, id: r.id || "anonymous", observers: n }; return e = t.start ? t.start(m) : e, v; } -__name(_f, "_f"); -u(_f, "spawnBehavior"); -var ry = { sync: false, autoForward: false }; +__name(Pd, "Pd"); +u(Pd, "spawnBehavior"); +var Ag = { sync: false, autoForward: false }; var lt; (function(t) { t[t.NotStarted = 0] = "NotStarted", t[t.Running = 1] = "Running", t[t.Stopped = 2] = "Stopped"; })(lt || (lt = {})); -var Lf = function() { +var zd = function() { function t(r, e) { e === void 0 && (e = t.defaultOptions); var n = this; this.machine = r, this.delayedEventsMap = {}, this.listeners = /* @__PURE__ */ new Set(), this.contextListeners = /* @__PURE__ */ new Set(), this.stopListeners = /* @__PURE__ */ new Set(), this.doneListeners = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Set(), this.sendListeners = /* @__PURE__ */ new Set(), this.initialized = false, this.status = lt.NotStarted, this.children = /* @__PURE__ */ new Map(), this.forwardTo = /* @__PURE__ */ new Set(), this._outgoingQueue = [], this.init = this.start, this.send = function(f, g) { - if (sn(f)) + if (nn(f)) return n.batch(f), n.state; - var w = st(Bi(f, g)); + var w = st(Li(f, g)); if (n.status === lt.Stopped) return Ge || nt(false, 'Event "'.concat(w.name, '" was sent to stopped service "').concat(n.machine.id, `". This service has already reached its final state, and will not transition. Event: `).concat(JSON.stringify(w.data))), n.state; @@ -7037,7 +7018,7 @@ Event: `).concat(JSON.stringify(w.data))); n.update(S, w); }), n._state; }, this.sendTo = function(f, g, w) { - var S = n.parent && (g === an.Parent || n.parent.id === g), T = S ? n.parent : Te(g) ? g === an.Internal ? n : n.children.get(g) || Xi.get(g) : mf(g) ? g : void 0; + var S = n.parent && (g === rn.Parent || n.parent.id === g), T = S ? n.parent : Te(g) ? g === rn.Internal ? n : n.children.get(g) || Ui.get(g) : ud(g) ? g : void 0; if (!T) { if (!S) throw new Error("Unable to send event to child '".concat(g, "' from service '").concat(n.id, "'.")); @@ -7046,14 +7027,14 @@ Event: `).concat(JSON.stringify(w.data))); } if ("machine" in T) { if (n.status !== lt.Stopped || n.parent !== T || n.state.done) { - var C = V(V({}, f), { name: f.name === Du ? "".concat(si(n.id)) : f.name, origin: n.sessionId }); + var C = V(V({}, f), { name: f.name === wu ? "".concat(ii(n.id)) : f.name, origin: n.sessionId }); !w && n.machine.config.predictableActionArguments ? n._outgoingQueue.push([T, C]) : T.send(C); } } else !w && n.machine.config.predictableActionArguments ? n._outgoingQueue.push([T, f.data]) : T.send(f.data); }, this._exec = function(f, g, w, S) { S === void 0 && (S = n.machine.options.actions); - var T = f.exec || qs(f.type, S), C = Ie(T) ? T : T ? T.exec : f.exec; + var T = f.exec || Cs(f.type, S), C = Ie(T) ? T : T ? T.exec : f.exec; if (C) try { return C(g, w.data, n.machine.config.predictableActionArguments ? { action: f, _event: w } : { action: f, state: n.state, _event: w }); @@ -7061,53 +7042,53 @@ Event: `).concat(JSON.stringify(w.data))); throw n.parent && n.parent.send({ type: "xstate.error", data: oe }), oe; } switch (f.type) { - case Rn: { + case Sn: { var R = f; n.defer(R); break; } - case ii: + case ti: var _ = f; if (typeof _.delay == "number") { n.defer(_); return; } else - _.to ? n.sendTo(_._event, _.to, w === ln) : n.send(_._event); + _.to ? n.sendTo(_._event, _.to, w === on) : n.send(_._event); break; - case Ds: + case ms: n.cancel(f.sendId); break; - case Lo: { + case zo: { if (n.status !== lt.Running) return; var L = f.activity; if (!n.machine.config.predictableActionArguments && !n.state.activities[L.id || L.type]) break; if (L.type === Ne.Invoke) { - var $ = $s(L.src), A = n.machine.options.services ? n.machine.options.services[$.type] : void 0, ee = L.id, z = L.data; + var B = Ts(L.src), A = n.machine.options.services ? n.machine.options.services[B.type] : void 0, ee = L.id, z = L.data; Ge || nt(!("forward" in L), "`forward` property is deprecated (found in invocation of '".concat(L.src, "' in in machine '").concat(n.machine.id, "'). ") + "Please use `autoForward` instead."); var H = "autoForward" in L ? L.autoForward : !!L.forward; if (!A) { Ge || nt(false, "No service found for invocation '".concat(L.src, "' in machine '").concat(n.machine.id, "'.")); return; } - var te = z ? oi(z, g, w) : void 0; + var te = z ? ri(z, g, w) : void 0; if (typeof A == "string") return; - var Q = Ie(A) ? A(g, w.data, { data: te, src: $, meta: L.meta }) : A; + var Q = Ie(A) ? A(g, w.data, { data: te, src: B, meta: L.meta }) : A; if (!Q) return; var ue = void 0; - Hr(Q) && (Q = te ? Q.withContext(te) : Q, ue = { autoForward: H }), n.spawn(Q, ee, ue); + jr(Q) && (Q = te ? Q.withContext(te) : Q, ue = { autoForward: H }), n.spawn(Q, ee, ue); } else n.spawnActivity(L); break; } - case Gi: { + case ki: { n.stopChild(f.activity.id); break; } - case ks: + case vs: var K = f, ie = K.label, q = K.value; ie ? n.logger(ie, q) : n.logger(q); break; @@ -7117,12 +7098,12 @@ Event: `).concat(JSON.stringify(w.data))); } }; var s = V(V({}, t.defaultOptions), e), a = s.clock, p = s.logger, v = s.parent, m = s.id, d = m !== void 0 ? m : r.id; - this.id = d, this.logger = p, this.clock = a, this.parent = v, this.options = s, this.scheduler = new Fu({ deferEvents: this.options.deferEvents }), this.sessionId = Xi.bookId(); + this.id = d, this.logger = p, this.clock = a, this.parent = v, this.options = s, this.scheduler = new zu({ deferEvents: this.options.deferEvents }), this.sessionId = Ui.bookId(); } __name(t, "t"); return u(t, "Interpreter"), Object.defineProperty(t.prototype, "initialState", { get: function() { var r = this; - return this._initialState ? this._initialState : Dn(this, function() { + return this._initialState ? this._initialState : Tn(this, function() { return r._initialState = r.machine.initialState, r._initialState; }); }, enumerable: false, configurable: true }), Object.defineProperty(t.prototype, "state", { get: function() { @@ -7146,7 +7127,7 @@ Event: `).concat(JSON.stringify(w.data))); } }, t.prototype.update = function(r, e) { var n, s, a, p, v, m, d, f, g = this; - if (r._sessionid = this.sessionId, this._state = r, (!this.machine.config.predictableActionArguments || e === ln) && this.options.execute) + if (r._sessionid = this.sessionId, this._state = r, (!this.machine.config.predictableActionArguments || e === on) && this.options.execute) this.execute(this.state); else for (var w = void 0; w = this._outgoingQueue.shift(); ) @@ -7185,15 +7166,15 @@ Event: `).concat(JSON.stringify(w.data))); } } try { - for (var L = we(this.contextListeners), $ = L.next(); !$.done; $ = L.next()) { - var A = $.value; + for (var L = we(this.contextListeners), B = L.next(); !B.done; B = L.next()) { + var A = B.value; A(this.state.context, this.state.history ? this.state.history.context : void 0); } } catch (Q) { v = { error: Q }; } finally { try { - $ && !$.done && (m = L.return) && m.call(L); + B && !B.done && (m = L.return) && m.call(L); } finally { if (v) throw v.error; @@ -7202,8 +7183,8 @@ Event: `).concat(JSON.stringify(w.data))); if (this.state.done) { var ee = r.configuration.find(function(Q) { return Q.type === "final" && Q.parent === g.machine; - }), z = ee && ee.doneData ? oi(ee.doneData, r.context, e) : void 0; - this._doneEvent = Ui(this.id, z); + }), z = ee && ee.doneData ? ri(ee.doneData, r.context, e) : void 0; + this._doneEvent = $i(this.id, z); try { for (var H = we(this.doneListeners), te = H.next(); !te.done; te = H.next()) { var C = te.value; @@ -7219,12 +7200,12 @@ Event: `).concat(JSON.stringify(w.data))); throw d.error; } } - this._stop(), this._stopChildren(), Xi.free(this.sessionId); + this._stop(), this._stopChildren(), Ui.free(this.sessionId); } }, t.prototype.onTransition = function(r) { return this.listeners.add(r), this.status === lt.Running && r(this.state, this.state.event), this; }, t.prototype.subscribe = function(r, e, n) { - var s = this, a = $i(r, e, n); + var s = this, a = Gi(r, e, n); this.listeners.add(a.next), this.status !== lt.NotStarted && a.next(this.state); var p = u(function() { s.doneListeners.delete(p), s.stopListeners.delete(p), a.complete(); @@ -7248,12 +7229,12 @@ Event: `).concat(JSON.stringify(w.data))); var e = this; if (this.status === lt.Running) return this; - this.machine._init(), Xi.register(this.sessionId, this), this.initialized = true, this.status = lt.Running; - var n = r === void 0 ? this.initialState : Dn(this, function() { - return Df(r) ? e.machine.resolveState(r) : e.machine.resolveState(Sr.from(r, e.machine.context)); + this.machine._init(), Ui.register(this.sessionId, this), this.initialized = true, this.status = lt.Running; + var n = r === void 0 ? this.initialState : Tn(this, function() { + return Md(r) ? e.machine.resolveState(r) : e.machine.resolveState(wr.from(r, e.machine.context)); }); return this.options.devTools && this.attachDev(), this.scheduler.initialize(function() { - e.update(n, ln); + e.update(n, on); }), this; }, t.prototype._stopChildren = function() { this.children.forEach(function(r) { @@ -7307,15 +7288,15 @@ Event: `).concat(JSON.stringify(w.data))); } } try { - for (var L = we(this.doneListeners), $ = L.next(); !$.done; $ = L.next()) { - var S = $.value; + for (var L = we(this.doneListeners), B = L.next(); !B.done; B = L.next()) { + var S = B.value; this.doneListeners.delete(S); } } catch (H) { v = { error: H }; } finally { try { - $ && !$.done && (m = L.return) && m.call(L); + B && !B.done && (m = L.return) && m.call(L); } finally { if (v) throw v.error; @@ -7339,21 +7320,21 @@ Event: `).concat(JSON.stringify(w.data))); throw d.error; } } - this.scheduler.clear(), this.scheduler = new Fu({ deferEvents: this.options.deferEvents }); + this.scheduler.clear(), this.scheduler = new zu({ deferEvents: this.options.deferEvents }); }, t.prototype.stop = function() { var r = this, e = this.scheduler; return this._stop(), e.schedule(function() { - var n = st({ type: "xstate.stop" }), s = Dn(r, function() { - var a = $e(ke([], Ee(r.state.configuration), false).sort(function(f, g) { + var n = st({ type: "xstate.stop" }), s = Tn(r, function() { + var a = Be(ke([], Ee(r.state.configuration), false).sort(function(f, g) { return g.order - f.order; }).map(function(f) { - return Br(f.onExit, r.machine.options.actions); - })), p = Ee(qi(r.machine, r.state, r.state.context, n, [{ type: "exit", actions: a }], r.machine.config.predictableActionArguments ? r._exec : void 0, r.machine.config.predictableActionArguments || r.machine.config.preserveActionOrder), 2), v = p[0], m = p[1], d = new Sr({ value: r.state.value, context: m, _event: n, _sessionid: r.sessionId, historyValue: void 0, history: r.state, actions: v.filter(function(f) { - return !Fo(f); + return Hr(f.onExit, r.machine.options.actions); + })), p = Ee(ji(r.machine, r.state, r.state.context, n, [{ type: "exit", actions: a }], r.machine.config.predictableActionArguments ? r._exec : void 0, r.machine.config.predictableActionArguments || r.machine.config.preserveActionOrder), 2), v = p[0], m = p[1], d = new wr({ value: r.state.value, context: m, _event: n, _sessionid: r.sessionId, historyValue: void 0, history: r.state, actions: v.filter(function(f) { + return !Go(f); }), activities: {}, events: [], configuration: [], transitions: [], children: {}, done: r.state.done, tags: r.state.tags, machine: r.machine }); return d.changed = true, d; }); - r.update(s, n), r._stopChildren(), Xi.free(r.sessionId); + r.update(s, n), r._stopChildren(), Ui.free(r.sessionId); }), this; }, t.prototype.batch = function(r) { var e = this; @@ -7367,10 +7348,10 @@ Event: `).concat(JSON.stringify(event))); this.scheduler.schedule(function() { var s, a, p = e.state, v = false, m = [], d = u(function(S) { var T = st(S); - e.forward(T), p = Dn(e, function() { + e.forward(T), p = Tn(e, function() { return e.machine.transition(p, T, void 0, n || void 0); }), m.push.apply(m, ke([], Ee(e.machine.config.predictableActionArguments ? p.actions : p.actions.map(function(C) { - return kf(C, p); + return Id(C, p); })), false)), v = v || !!p.changed; }, "_loop_1"); try { @@ -7397,11 +7378,11 @@ Event: `).concat(JSON.stringify(event))); var n = this; e === void 0 && (e = !!this.machine.config.predictableActionArguments && this._exec); var s = st(r); - if (s.name.indexOf(Ru) === 0 && !this.state.nextEvents.some(function(p) { - return p.indexOf(Ru) === 0; + if (s.name.indexOf(yu) === 0 && !this.state.nextEvents.some(function(p) { + return p.indexOf(yu) === 0; })) throw s.data.data; - var a = Dn(this, function() { + var a = Tn(this, function() { return n.machine.transition(n.state, s, void 0, e || void 0); }); return a; @@ -7443,52 +7424,52 @@ Event: `).concat(JSON.stringify(event))); e && (this.removeChild(r), Ie(e.stop) && e.stop()); }, t.prototype.spawn = function(r, e, n) { if (this.status !== lt.Running) - return Gu(r, e); - if (_u(r)) + return Cu(r, e); + if (Su(r)) return this.spawnPromise(Promise.resolve(r), e); if (Ie(r)) return this.spawnCallback(r, e); - if (Mf(r)) + if (xd(r)) return this.spawnActor(r, e); - if (hf(r)) + if (ld(r)) return this.spawnObservable(r, e); - if (Hr(r)) + if (jr(r)) return this.spawnMachine(r, V(V({}, n), { id: e })); - if (cf(r)) + if (id(r)) return this.spawnBehavior(r, e); throw new Error('Unable to spawn entity "'.concat(e, '" of type "').concat(typeof r, '".')); }, t.prototype.spawnMachine = function(r, e) { var n = this; e === void 0 && (e = {}); - var s = new t(r, V(V({}, this.options), { parent: this, id: e.id || r.id })), a = V(V({}, ry), e); + var s = new t(r, V(V({}, this.options), { parent: this, id: e.id || r.id })), a = V(V({}, Ag), e); a.sync && s.onTransition(function(v) { - n.send(jo, { state: v, id: s.id }); + n.send(Do, { state: v, id: s.id }); }); var p = s; return this.children.set(s.id, p), a.autoForward && this.forwardTo.add(s.id), s.onDone(function(v) { n.removeChild(s.id), n.send(st(v, { origin: s.id })); }).start(), p; }, t.prototype.spawnBehavior = function(r, e) { - var n = _f(r, { id: e, parent: this }); + var n = Pd(r, { id: e, parent: this }); return this.children.set(e, n), n; }, t.prototype.spawnPromise = function(r, e) { var n, s = this, a = false, p; r.then(function(m) { - a || (p = m, s.removeChild(e), s.send(st(Ui(e, m), { origin: e }))); + a || (p = m, s.removeChild(e), s.send(st($i(e, m), { origin: e }))); }, function(m) { if (!a) { s.removeChild(e); - var d = si(e, m); + var d = ii(e, m); try { s.send(st(d, { origin: e })); } catch (f) { - gf(m, f, e), s.devTools && s.devTools.send(d, s.state), s.machine.strict && s.stop(); + pd(m, f, e), s.devTools && s.devTools.send(d, s.state), s.machine.strict && s.stop(); } } }); var v = (n = { id: e, send: function() { }, subscribe: function(m, d, f) { - var g = $i(m, d, f), w = false; + var g = Gi(m, d, f), w = false; return r.then(function(S) { w || (g.next(S), !w && g.complete()); }, function(S) { @@ -7502,7 +7483,7 @@ Event: `).concat(JSON.stringify(event))); return { id: e }; }, getSnapshot: function() { return p; - } }, n[jr] = function() { + } }, n[Gr] = function() { return this; }, n); return this.children.set(e, v), v; @@ -7517,16 +7498,16 @@ Event: `).concat(JSON.stringify(event))); p.add(w); }); } catch (w) { - this.send(si(e, w)); + this.send(ii(e, w)); } - if (_u(f)) + if (Su(f)) return this.spawnPromise(f, e); var g = (n = { id: e, send: function(w) { return p.forEach(function(S) { return S(w); }); }, subscribe: function(w) { - var S = $i(w); + var S = Gi(w); return v.add(S.next), { unsubscribe: function() { v.delete(S.next); } }; @@ -7536,7 +7517,7 @@ Event: `).concat(JSON.stringify(event))); return { id: e }; }, getSnapshot: function() { return m; - } }, n[jr] = function() { + } }, n[Gr] = function() { return this; }, n); return this.children.set(e, g), g; @@ -7544,9 +7525,9 @@ Event: `).concat(JSON.stringify(event))); var n, s = this, a, p = r.subscribe(function(m) { a = m, s.send(st(m, { origin: e })); }, function(m) { - s.removeChild(e), s.send(st(si(e, m), { origin: e })); + s.removeChild(e), s.send(st(ii(e, m), { origin: e })); }, function() { - s.removeChild(e), s.send(st(Ui(e), { origin: e })); + s.removeChild(e), s.send(st($i(e), { origin: e })); }), v = (n = { id: e, send: function() { }, subscribe: function(m, d, f) { return r.subscribe(m, d, f); @@ -7556,7 +7537,7 @@ Event: `).concat(JSON.stringify(event))); return a; }, toJSON: function() { return { id: e }; - } }, n[jr] = function() { + } }, n[Gr] = function() { return this; }, n); return this.children.set(e, v), v; @@ -7579,11 +7560,11 @@ Event: `).concat(JSON.stringify(event))); }, stop: e || void 0, getSnapshot: function() { }, toJSON: function() { return { id: r }; - } }, n[jr] = function() { + } }, n[Gr] = function() { return this; }, n)); }, t.prototype.attachDev = function() { - var r = Us(); + var r = Ms(); if (this.options.devTools && r) { if (r.__REDUX_DEVTOOLS_EXTENSION__) { var e = typeof this.options.devTools == "object" ? this.options.devTools : void 0; @@ -7591,11 +7572,11 @@ Event: `).concat(JSON.stringify(event))); return { value: n.value, context: n.context, actions: n.actions }; } }, e), { features: V({ jump: false, skip: false }, e ? e.features : void 0) }), this.machine), this.devTools.init(this.state); } - Nf(this); + Ad(this); } }, t.prototype.toJSON = function() { return { id: this.id }; - }, t.prototype[jr] = function() { + }, t.prototype[Gr] = function() { return this; }, t.prototype.getSnapshot = function() { return this.status === lt.NotStarted ? this.initialState : this._state; @@ -7606,12 +7587,12 @@ Event: `).concat(JSON.stringify(event))); } }, logger: console.log.bind(console), devTools: false }, t.interpret = ut, t; }(); function ut(t, r) { - var e = new Lf(t, r); + var e = new zd(t, r); return e; } __name(ut, "ut"); u(ut, "interpret"); -function ny(t) { +function Pg(t) { if (typeof t == "string") { var r = { type: t }; return r.toString = function() { @@ -7620,47 +7601,47 @@ function ny(t) { } return t; } -__name(ny, "ny"); -u(ny, "toInvokeSource"); -function Yo(t) { - return V(V({ type: Go }, t), { toJSON: function() { +__name(Pg, "Pg"); +u(Pg, "toInvokeSource"); +function Bo(t) { + return V(V({ type: Ro }, t), { toJSON: function() { t.onDone, t.onError; - var r = Li(t, ["onDone", "onError"]); - return V(V({}, r), { type: Go, src: ny(t.src) }); + var r = Di(t, ["onDone", "onError"]); + return V(V({}, r), { type: Ro, src: Pg(t.src) }); } }); } -__name(Yo, "Yo"); -u(Yo, "toInvokeDefinition"); -var Ji = ""; -var Wu = "#"; -var Xo = "*"; -var Zi = {}; -var Ki = u(function(t) { - return t[0] === Wu; +__name(Bo, "Bo"); +u(Bo, "toInvokeDefinition"); +var Yi = ""; +var Du = "#"; +var qo = "*"; +var Wi = {}; +var Vi = u(function(t) { + return t[0] === Du; }, "isStateId"); -var iy = u(function() { +var zg = u(function() { return { actions: {}, guards: {}, services: {}, activities: {}, delays: {} }; }, "createDefaultOptions"); -var oy = u(function(t, r, e) { +var Rg = u(function(t, r, e) { var n = e.slice(0, -1).some(function(a) { - return !("cond" in a) && !("in" in a) && (Te(a.target) || Hr(a.target)); - }), s = r === Ji ? "the transient event" : "event '".concat(r, "'"); + return !("cond" in a) && !("in" in a) && (Te(a.target) || jr(a.target)); + }), s = r === Yi ? "the transient event" : "event '".concat(r, "'"); nt(!n, "One or more transitions for ".concat(s, " on state '").concat(t.id, "' are unreachable. ") + "Make sure that the default transition is the last one defined."); }, "validateArrayifiedTransitions"); -var Gf = function() { +var Rd = function() { function t(r, e, n, s) { n === void 0 && (n = "context" in r ? r.context : void 0); var a = this, p; - this.config = r, this._context = n, this.order = -1, this.__xstatenode = true, this.__cache = { events: void 0, relativeValue: /* @__PURE__ */ new Map(), initialStateValue: void 0, initialState: void 0, on: void 0, transitions: void 0, candidates: {}, delayedTransitions: void 0 }, this.idMap = {}, this.tags = [], this.options = Object.assign(iy(), e), this.parent = s == null ? void 0 : s.parent, this.key = this.config.key || (s == null ? void 0 : s.key) || this.config.id || "(machine)", this.machine = this.parent ? this.parent.machine : this, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.delimiter = this.config.delimiter || (this.parent ? this.parent.delimiter : Ns), this.id = this.config.id || ke([this.machine.key], Ee(this.path), false).join(this.delimiter), this.version = this.parent ? this.parent.version : this.config.version, this.type = this.config.type || (this.config.parallel ? "parallel" : this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.schema = this.parent ? this.machine.schema : (p = this.config.schema) !== null && p !== void 0 ? p : {}, this.description = this.config.description, Ge || nt(!("parallel" in this.config), 'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel ? "Replace with `type: 'parallel'`" : "Use `type: '".concat(this.type, "'`"), " in the config for state node '").concat(this.id, "' instead.")), this.initial = this.config.initial, this.states = this.config.states ? Hi(this.config.states, function(d, f) { + this.config = r, this._context = n, this.order = -1, this.__xstatenode = true, this.__cache = { events: void 0, relativeValue: /* @__PURE__ */ new Map(), initialStateValue: void 0, initialState: void 0, on: void 0, transitions: void 0, candidates: {}, delayedTransitions: void 0 }, this.idMap = {}, this.tags = [], this.options = Object.assign(zg(), e), this.parent = s == null ? void 0 : s.parent, this.key = this.config.key || (s == null ? void 0 : s.key) || this.config.id || "(machine)", this.machine = this.parent ? this.parent.machine : this, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.delimiter = this.config.delimiter || (this.parent ? this.parent.delimiter : gs), this.id = this.config.id || ke([this.machine.key], Ee(this.path), false).join(this.delimiter), this.version = this.parent ? this.parent.version : this.config.version, this.type = this.config.type || (this.config.parallel ? "parallel" : this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.schema = this.parent ? this.machine.schema : (p = this.config.schema) !== null && p !== void 0 ? p : {}, this.description = this.config.description, Ge || nt(!("parallel" in this.config), 'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel ? "Replace with `type: 'parallel'`" : "Use `type: '".concat(this.type, "'`"), " in the config for state node '").concat(this.id, "' instead.")), this.initial = this.config.initial, this.states = this.config.states ? _i(this.config.states, function(d, f) { var g, w = new t(d, {}, void 0, { parent: a, key: f }); return Object.assign(a.idMap, V((g = {}, g[w.id] = w, g), w.idMap)), w; - }) : Zi; + }) : Wi; var v = 0; function m(d) { var f, g; d.order = v++; try { - for (var w = we(Hu(d)), S = w.next(); !S.done; S = w.next()) { + for (var w = we(Mu(d)), S = w.next(); !S.done; S = w.next()) { var T = S.value; m(T); } @@ -7678,33 +7659,33 @@ var Gf = function() { __name(m, "m"); u(m, "dfs"), m(this), this.history = this.config.history === true ? "shallow" : this.config.history || false, this._transient = !!this.config.always || (this.config.on ? Array.isArray(this.config.on) ? this.config.on.some(function(d) { var f = d.event; - return f === Ji; - }) : Ji in this.config.on : false), this.strict = !!this.config.strict, this.onEntry = cr(this.config.entry || this.config.onEntry).map(function(d) { - return Fi(d); - }), this.onExit = cr(this.config.exit || this.config.onExit).map(function(d) { - return Fi(d); - }), this.meta = this.config.meta, this.doneData = this.type === "final" ? this.config.data : void 0, this.invoke = cr(this.config.invoke).map(function(d, f) { + return f === Yi; + }) : Yi in this.config.on : false), this.strict = !!this.config.strict, this.onEntry = ur(this.config.entry || this.config.onEntry).map(function(d) { + return Hi(d); + }), this.onExit = ur(this.config.exit || this.config.onExit).map(function(d) { + return Hi(d); + }), this.meta = this.config.meta, this.doneData = this.type === "final" ? this.config.data : void 0, this.invoke = ur(this.config.invoke).map(function(d, f) { var g, w; - if (Hr(d)) { - var S = qo(a.id, f); - return a.machine.options.services = V((g = {}, g[S] = d, g), a.machine.options.services), Yo({ src: S, id: S }); + if (jr(d)) { + var S = Lo(a.id, f); + return a.machine.options.services = V((g = {}, g[S] = d, g), a.machine.options.services), Bo({ src: S, id: S }); } else if (Te(d.src)) { - var S = d.id || qo(a.id, f); - return Yo(V(V({}, d), { id: S, src: d.src })); - } else if (Hr(d.src) || Ie(d.src)) { - var S = d.id || qo(a.id, f); - return a.machine.options.services = V((w = {}, w[S] = d.src, w), a.machine.options.services), Yo(V(V({ id: S }, d), { src: S })); + var S = d.id || Lo(a.id, f); + return Bo(V(V({}, d), { id: S, src: d.src })); + } else if (jr(d.src) || Ie(d.src)) { + var S = d.id || Lo(a.id, f); + return a.machine.options.services = V((w = {}, w[S] = d.src, w), a.machine.options.services), Bo(V(V({ id: S }, d), { src: S })); } else { var T = d.src; - return Yo(V(V({ id: qo(a.id, f) }, d), { src: T })); + return Bo(V(V({ id: Lo(a.id, f) }, d), { src: T })); } - }), this.activities = cr(this.config.activities).concat(this.invoke).map(function(d) { - return Fs(d); - }), this.transition = this.transition.bind(this), this.tags = cr(this.config.tags); + }), this.activities = ur(this.config.activities).concat(this.invoke).map(function(d) { + return Os(d); + }), this.transition = this.transition.bind(this), this.tags = ur(this.config.tags); } __name(t, "t"); return u(t, "StateNode"), t.prototype._init = function() { - this.__cache.transitions || Bu(this).forEach(function(r) { + this.__cache.transitions || Iu(this).forEach(function(r) { return r.on; }); }, t.prototype.withConfig = function(r, e) { @@ -7715,7 +7696,7 @@ var Gf = function() { }, Object.defineProperty(t.prototype, "context", { get: function() { return Ie(this._context) ? this._context() : this._context; }, enumerable: false, configurable: true }), Object.defineProperty(t.prototype, "definition", { get: function() { - return { id: this.id, key: this.key, version: this.version, context: this.context, type: this.type, initial: this.initial, history: this.history, states: Hi(this.states, function(r) { + return { id: this.id, key: this.key, version: this.version, context: this.context, type: this.type, initial: this.initial, history: this.history, states: _i(this.states, function(r) { return r.definition; }), on: this.on, transitions: this.transitions, entry: this.onEntry, exit: this.onExit, activities: this.activities || [], meta: this.meta, order: this.order || -1, data: this.doneData, invoke: this.invoke, description: this.description, tags: this.tags }; }, enumerable: false, configurable: true }), t.prototype.toJSON = function() { @@ -7734,9 +7715,9 @@ var Gf = function() { }, enumerable: false, configurable: true }), t.prototype.getCandidates = function(r) { if (this.__cache.candidates[r]) return this.__cache.candidates[r]; - var e = r === Ji, n = this.transitions.filter(function(s) { + var e = r === Yi, n = this.transitions.filter(function(s) { var a = s.eventType === r; - return e ? a : a || s.eventType === Xo; + return e ? a : a || s.eventType === qo; }); return this.__cache.candidates[r] = n, n; }, t.prototype.getDelayedTransitions = function() { @@ -7744,14 +7725,14 @@ var Gf = function() { if (!e) return []; var n = u(function(a, p) { - var v = Ie(a) ? "".concat(r.id, ":delay[").concat(p, "]") : a, m = Sf(v, r.id); - return r.onEntry.push(yf(m, { delay: a })), r.onExit.push(wf(m)), m; - }, "mutateEntryExit"), s = sn(e) ? e.map(function(a, p) { + var v = Ie(a) ? "".concat(r.id, ":delay[").concat(p, "]") : a, m = gd(v, r.id); + return r.onEntry.push(fd(m, { delay: a })), r.onExit.push(hd(m)), m; + }, "mutateEntryExit"), s = nn(e) ? e.map(function(a, p) { var v = n(a.delay, p); return V(V({}, a), { event: v }); - }) : $e(Object.keys(e).map(function(a, p) { + }) : Be(Object.keys(e).map(function(a, p) { var v = e[a], m = Te(v) ? { target: v } : v, d = isNaN(+a) ? a : +a, f = n(d, p); - return cr(m).map(function(g) { + return ur(m).map(function(g) { return V(V({}, g), { event: f, delay: d }); }); })); @@ -7763,21 +7744,21 @@ var Gf = function() { var e, n = this; if (!r) return []; - var s = r instanceof Sr ? r.value : ji(r, this.delimiter); + var s = r instanceof wr ? r.value : Ni(r, this.delimiter); if (Te(s)) { var a = this.getStateNode(s).initial; return a !== void 0 ? this.getStateNodes((e = {}, e[s] = a, e)) : [this, this.states[s]]; } var p = Object.keys(s), v = [this]; - return v.push.apply(v, ke([], Ee($e(p.map(function(m) { + return v.push.apply(v, ke([], Ee(Be(p.map(function(m) { return n.getStateNode(m).getStateNodes(s[m]); }))), false)), v; }, t.prototype.handles = function(r) { - var e = Gs(r); + var e = ws(r); return this.events.includes(e); }, t.prototype.resolveState = function(r) { - var e = r instanceof Sr ? r : Sr.create(r), n = Array.from(Vi([], this.getStateNodes(e.value))); - return new Sr(V(V({}, e), { value: this.resolve(e.value), configuration: n, done: Vo(n, this), tags: $u(n), machine: this.machine })); + var e = r instanceof wr ? r : wr.create(r), n = Array.from(qi([], this.getStateNodes(e.value))); + return new wr(V(V({}, e), { value: this.resolve(e.value), configuration: n, done: $o(n, this), tags: Au(n), machine: this.machine })); }, t.prototype.transitionLeafNode = function(r, e, n) { var s = this.getStateNode(r), a = s.next(e, n); return !a || !a.transitions.length ? this.next(e, n) : a; @@ -7806,19 +7787,19 @@ var Gf = function() { } var S = Object.keys(p).map(function(_) { return p[_]; - }), T = $e(S.map(function(_) { + }), T = Be(S.map(function(_) { return _.transitions; })), C = S.some(function(_) { return _.transitions.length > 0; }); if (!C) return this.next(e, n); - var R = $e(Object.keys(p).map(function(_) { + var R = Be(Object.keys(p).map(function(_) { return p[_].configuration; })); - return { transitions: T, exitSet: $e(S.map(function(_) { + return { transitions: T, exitSet: Be(S.map(function(_) { return _.exitSet; - })), configuration: R, source: e, actions: $e(Object.keys(p).map(function(_) { + })), configuration: R, source: e, actions: Be(Object.keys(p).map(function(_) { return p[_].actions; })) }; }, t.prototype._transition = function(r, e, n) { @@ -7829,9 +7810,9 @@ var Gf = function() { var n, s, a = this, p = e.name, v = [], m = [], d; try { for (var f = we(this.getCandidates(p)), g = f.next(); !g.done; g = f.next()) { - var w = g.value, S = w.cond, T = w.in, C = r.context, R = T ? Te(T) && Ki(T) ? r.matches(ji(this.getStateNodeById(T).path, this.delimiter)) : Bo(ji(T, this.delimiter), af(this.path.slice(0, -2))(r.value)) : true, _ = false; + var w = g.value, S = w.cond, T = w.in, C = r.context, R = T ? Te(T) && Vi(T) ? r.matches(Ni(this.getStateNodeById(T).path, this.delimiter)) : No(Ni(T, this.delimiter), ed(this.path.slice(0, -2))(r.value)) : true, _ = false; try { - _ = !S || Bs(this.machine, S, C, e, r); + _ = !S || Ss(this.machine, S, C, e, r); } catch (A) { throw new Error("Unable to evaluate guard '".concat(S.name || S.type, "' in transition for event '").concat(p, "' in state node '").concat(this.id, `': `).concat(A.message)); @@ -7854,10 +7835,10 @@ var Gf = function() { if (d) { if (!m.length) return { transitions: [d], exitSet: [], configuration: r.value ? [this] : [], source: r, actions: v }; - var L = $e(m.map(function(A) { + var L = Be(m.map(function(A) { return a.getRelativeStateNodes(A, r.historyValue); - })), $ = !!d.internal; - return { transitions: [d], exitSet: $ ? [] : $e(m.map(function(A) { + })), B = !!d.internal; + return { transitions: [d], exitSet: B ? [] : Be(m.map(function(A) { return a.getPotentiallyReenteringNodes(A); })), configuration: L, source: r, actions: v }; } @@ -7868,13 +7849,13 @@ var Gf = function() { e.push(n), n = n.parent; return n !== s ? [] : (e.push(s), e); }, t.prototype.getActions = function(r, e, n, s, a, p, v) { - var m, d, f, g, w = this, S = p ? Vi([], this.getStateNodes(p.value)) : [], T = /* @__PURE__ */ new Set(); + var m, d, f, g, w = this, S = p ? qi([], this.getStateNodes(p.value)) : [], T = /* @__PURE__ */ new Set(); try { for (var C = we(Array.from(r).sort(function(K, ie) { return K.order - ie.order; })), R = C.next(); !R.done; R = C.next()) { var _ = R.value; - (!Yi(S, _) || Yi(n.exitSet, _) || _.parent && T.has(_.parent)) && T.add(_); + (!Fi(S, _) || Fi(n.exitSet, _) || _.parent && T.has(_.parent)) && T.add(_); } } catch (K) { m = { error: K }; @@ -7887,15 +7868,15 @@ var Gf = function() { } } try { - for (var L = we(S), $ = L.next(); !$.done; $ = L.next()) { - var _ = $.value; - (!Yi(r, _) || Yi(n.exitSet, _.parent)) && n.exitSet.push(_); + for (var L = we(S), B = L.next(); !B.done; B = L.next()) { + var _ = B.value; + (!Fi(r, _) || Fi(n.exitSet, _.parent)) && n.exitSet.push(_); } } catch (K) { f = { error: K }; } finally { try { - $ && !$.done && (g = L.return) && g.call(L); + B && !B.done && (g = L.return) && g.call(L); } finally { if (f) throw f.error; @@ -7906,37 +7887,37 @@ var Gf = function() { }); var A = Array.from(T).sort(function(K, ie) { return K.order - ie.order; - }), ee = new Set(n.exitSet), z = $e(A.map(function(K) { + }), ee = new Set(n.exitSet), z = Be(A.map(function(K) { var ie = []; if (K.type !== "final") return ie; var q = K.parent; if (!q.parent) return ie; - ie.push(Uo(K.id, K.doneData), Uo(q.id, K.doneData ? oi(K.doneData, s, a) : void 0)); + ie.push(jo(K.id, K.doneData), jo(q.id, K.doneData ? ri(K.doneData, s, a) : void 0)); var oe = q.parent; - return oe.type === "parallel" && Wi(oe).every(function(tt) { - return Vo(n.configuration, tt); - }) && ie.push(Uo(oe.id)), ie; + return oe.type === "parallel" && Bi(oe).every(function(tt) { + return $o(n.configuration, tt); + }) && ie.push(jo(oe.id)), ie; })), H = A.map(function(K) { var ie = K.onEntry, q = K.activities.map(function(oe) { - return xf(oe); + return md(oe); }); - return { type: "entry", actions: Br(v ? ke(ke([], Ee(ie), false), Ee(q), false) : ke(ke([], Ee(q), false), Ee(ie), false), w.machine.options.actions) }; + return { type: "entry", actions: Hr(v ? ke(ke([], Ee(ie), false), Ee(q), false) : ke(ke([], Ee(q), false), Ee(ie), false), w.machine.options.actions) }; }).concat({ type: "state_done", actions: z.map(function(K) { - return bf(K); + return dd(K); }) }), te = Array.from(ee).map(function(K) { - return { type: "exit", actions: Br(ke(ke([], Ee(K.onExit), false), Ee(K.activities.map(function(ie) { - return Ef(ie); + return { type: "exit", actions: Hr(ke(ke([], Ee(K.onExit), false), Ee(K.activities.map(function(ie) { + return vd(ie); })), false), w.machine.options.actions) }; - }), Q = te.concat({ type: "transition", actions: Br(n.actions, this.machine.options.actions) }).concat(H); + }), Q = te.concat({ type: "transition", actions: Hr(n.actions, this.machine.options.actions) }).concat(H); if (e) { - var ue = Br($e(ke([], Ee(r), false).sort(function(K, ie) { + var ue = Hr(Be(ke([], Ee(r), false).sort(function(K, ie) { return ie.order - K.order; }).map(function(K) { return K.onExit; })), this.machine.options.actions).filter(function(K) { - return !Fo(K); + return !Go(K); }); return Q.concat({ type: "stop", actions: ue }); } @@ -7944,32 +7925,32 @@ var Gf = function() { }, t.prototype.transition = function(r, e, n, s) { r === void 0 && (r = this.initialState); var a = st(e), p; - if (r instanceof Sr) - p = n === void 0 ? r : this.resolveState(Sr.from(r, n)); + if (r instanceof wr) + p = n === void 0 ? r : this.resolveState(wr.from(r, n)); else { - var v = Te(r) ? this.resolve(Ho(this.getResolvedPath(r))) : this.resolve(r), m = n != null ? n : this.machine.context; - p = this.resolveState(Sr.from(v, m)); + var v = Te(r) ? this.resolve(ko(this.getResolvedPath(r))) : this.resolve(r), m = n != null ? n : this.machine.context; + p = this.resolveState(wr.from(v, m)); } - if (!Ge && a.name === Xo) - throw new Error("An event cannot have the wildcard type ('".concat(Xo, "')")); - if (this.strict && !this.events.includes(a.name) && !uf(a.name)) + if (!Ge && a.name === qo) + throw new Error("An event cannot have the wildcard type ('".concat(qo, "')")); + if (this.strict && !this.events.includes(a.name) && !nd(a.name)) throw new Error("Machine '".concat(this.id, "' does not accept event '").concat(a.name, "'")); - var d = this._transition(p.value, p, a) || { transitions: [], configuration: [], exitSet: [], source: p, actions: [] }, f = Vi([], this.getStateNodes(p.value)), g = d.configuration.length ? Vi(f, d.configuration) : f; + var d = this._transition(p.value, p, a) || { transitions: [], configuration: [], exitSet: [], source: p, actions: [] }, f = qi([], this.getStateNodes(p.value)), g = d.configuration.length ? qi(f, d.configuration) : f; return d.configuration = ke([], Ee(g), false), this.resolveTransition(d, p, p.context, s, a); }, t.prototype.resolveRaisedTransition = function(r, e, n, s) { var a, p = r.actions; return r = this.transition(r, e, void 0, s), r._event = n, r.event = n.data, (a = r.actions).unshift.apply(a, ke([], Ee(p), false)), r; }, t.prototype.resolveTransition = function(r, e, n, s, a) { var p, v, m, d, f = this; - a === void 0 && (a = ln); - var g = r.configuration, w = !e || r.transitions.length > 0, S = w ? r.configuration : e ? e.configuration : [], T = Vo(S, this), C = w ? Pf(this.machine, g) : void 0, R = e ? e.historyValue ? e.historyValue : r.source ? this.machine.historyValue(e.value) : void 0 : void 0, _ = this.getActions(new Set(S), T, r, n, a, e, s), L = e ? V({}, e.activities) : {}; + a === void 0 && (a = on); + var g = r.configuration, w = !e || r.transitions.length > 0, S = w ? r.configuration : e ? e.configuration : [], T = $o(S, this), C = w ? Td(this.machine, g) : void 0, R = e ? e.historyValue ? e.historyValue : r.source ? this.machine.historyValue(e.value) : void 0 : void 0, _ = this.getActions(new Set(S), T, r, n, a, e, s), L = e ? V({}, e.activities) : {}; try { - for (var $ = we(_), A = $.next(); !A.done; A = $.next()) { + for (var B = we(_), A = B.next(); !A.done; A = B.next()) { var ee = A.value; try { for (var z = (m = void 0, we(ee.actions)), H = z.next(); !H.done; H = z.next()) { var te = H.value; - te.type === Lo ? L[te.activity.id || te.activity.type] = te : te.type === Gi && (L[te.activity.id || te.activity.type] = false); + te.type === zo ? L[te.activity.id || te.activity.type] = te : te.type === ki && (L[te.activity.id || te.activity.type] = false); } } catch (je) { m = { error: je }; @@ -7986,36 +7967,36 @@ var Gf = function() { p = { error: je }; } finally { try { - A && !A.done && (v = $.return) && v.call($); + A && !A.done && (v = B.return) && v.call(B); } finally { if (p) throw p.error; } } - var Q = Ee(qi(this, e, n, a, _, s, this.machine.config.predictableActionArguments || this.machine.config.preserveActionOrder), 2), ue = Q[0], K = Q[1], ie = Ee(pf(ue, Fo), 2), q = ie[0], oe = ie[1], tt = ue.filter(function(je) { + var Q = Ee(ji(this, e, n, a, _, s, this.machine.config.predictableActionArguments || this.machine.config.preserveActionOrder), 2), ue = Q[0], K = Q[1], ie = Ee(od(ue, Go), 2), q = ie[0], oe = ie[1], tt = ue.filter(function(je) { var rt; - return je.type === Lo && ((rt = je.activity) === null || rt === void 0 ? void 0 : rt.type) === Go; + return je.type === zo && ((rt = je.activity) === null || rt === void 0 ? void 0 : rt.type) === Ro; }), Ze = tt.reduce(function(je, rt) { - return je[rt.activity.id] = Of(rt.activity, f.machine, K, a), je; - }, e ? V({}, e.children) : {}), ze = new Sr({ value: C || e.value, context: K, _event: a, _sessionid: e ? e._sessionid : null, historyValue: C ? R ? ff(R, C) : void 0 : e ? e.historyValue : void 0, history: !C || r.source ? e : void 0, actions: C ? oe : [], activities: C ? L : e ? e.activities : {}, events: [], configuration: S, transitions: r.transitions, children: Ze, done: T, tags: $u(S), machine: this }), Ae = n !== K; - ze.changed = a.name === jo || Ae; + return je[rt.activity.id] = wd(rt.activity, f.machine, K, a), je; + }, e ? V({}, e.children) : {}), ze = new wr({ value: C || e.value, context: K, _event: a, _sessionid: e ? e._sessionid : null, historyValue: C ? R ? sd(R, C) : void 0 : e ? e.historyValue : void 0, history: !C || r.source ? e : void 0, actions: C ? oe : [], activities: C ? L : e ? e.activities : {}, events: [], configuration: S, transitions: r.transitions, children: Ze, done: T, tags: Au(S), machine: this }), Ae = n !== K; + ze.changed = a.name === Do || Ae; var We = ze.history; We && delete We.history; var Je = !T && (this._transient || g.some(function(je) { return je._transient; })); - if (!w && (!Je || a.name === Ji)) + if (!w && (!Je || a.name === Yi)) return ze; var Ye = ze; if (!T) - for (Je && (Ye = this.resolveRaisedTransition(Ye, { type: ef }, a, s)); q.length; ) { + for (Je && (Ye = this.resolveRaisedTransition(Ye, { type: Xp }, a, s)); q.length; ) { var J = q.shift(); Ye = this.resolveRaisedTransition(Ye, J._event, a, s); } - var ar = Ye.changed || (We ? !!Ye.actions.length || Ae || typeof We.value != typeof Ye.value || !qu(Ye.value, We.value) : void 0); - return Ye.changed = ar, Ye.history = We, Ye; + var or = Ye.changed || (We ? !!Ye.actions.length || Ae || typeof We.value != typeof Ye.value || !Pu(Ye.value, We.value) : void 0); + return Ye.changed = or, Ye.history = We, Ye; }, t.prototype.getStateNode = function(r) { - if (Ki(r)) + if (Vi(r)) return this.machine.getStateNodeById(r); if (!this.states) throw new Error("Unable to retrieve child state '".concat(r, "' from '").concat(this.id, "'; no child states exist.")); @@ -8024,7 +8005,7 @@ var Gf = function() { throw new Error("Child state '".concat(r, "' does not exist on '").concat(this.id, "'")); return e; }, t.prototype.getStateNodeById = function(r) { - var e = Ki(r) ? r.slice(Wu.length) : r; + var e = Vi(r) ? r.slice(Du.length) : r; if (e === this.id) return this; var n = this.machine.idMap[e]; @@ -8032,12 +8013,12 @@ var Gf = function() { throw new Error("Child state node '#".concat(e, "' does not exist on machine '").concat(this.id, "'")); return n; }, t.prototype.getStateNodeByPath = function(r) { - if (typeof r == "string" && Ki(r)) + if (typeof r == "string" && Vi(r)) try { return this.getStateNodeById(r.slice(1)); } catch (a) { } - for (var e = js(r, this.delimiter).slice(), n = this; e.length; ) { + for (var e = xs(r, this.delimiter).slice(), n = this; e.length; ) { var s = e.shift(); if (!s.length) break; @@ -8047,46 +8028,46 @@ var Gf = function() { }, t.prototype.resolve = function(r) { var e, n = this; if (!r) - return this.initialStateValue || Zi; + return this.initialStateValue || Wi; switch (this.type) { case "parallel": - return Hi(this.initialStateValue, function(a, p) { - return a ? n.getStateNode(p).resolve(r[p] || a) : Zi; + return _i(this.initialStateValue, function(a, p) { + return a ? n.getStateNode(p).resolve(r[p] || a) : Wi; }); case "compound": if (Te(r)) { var s = this.getStateNode(r); return s.type === "parallel" || s.type === "compound" ? (e = {}, e[r] = s.initialStateValue, e) : r; } - return Object.keys(r).length ? Hi(r, function(a, p) { - return a ? n.getStateNode(p).resolve(a) : Zi; + return Object.keys(r).length ? _i(r, function(a, p) { + return a ? n.getStateNode(p).resolve(a) : Wi; }) : this.initialStateValue || {}; default: - return r || Zi; + return r || Wi; } }, t.prototype.getResolvedPath = function(r) { - if (Ki(r)) { - var e = this.machine.idMap[r.slice(Wu.length)]; + if (Vi(r)) { + var e = this.machine.idMap[r.slice(Du.length)]; if (!e) throw new Error("Unable to find state node '".concat(r, "'")); return e.path; } - return js(r, this.delimiter); + return xs(r, this.delimiter); }, Object.defineProperty(t.prototype, "initialStateValue", { get: function() { var r; if (this.__cache.initialStateValue) return this.__cache.initialStateValue; var e; if (this.type === "parallel") - e = Nu(this.states, function(n) { - return n.initialStateValue || Zi; + e = Eu(this.states, function(n) { + return n.initialStateValue || Wi; }, function(n) { return n.type !== "history"; }); else if (this.initial !== void 0) { if (!this.states[this.initial]) throw new Error("Initial state '".concat(this.initial, "' not found on '").concat(this.key, "'")); - e = Wo(this.states[this.initial]) ? this.initial : (r = {}, r[this.initial] = this.states[this.initial].initialStateValue, r); + e = Ho(this.states[this.initial]) ? this.initial : (r = {}, r[this.initial] = this.states[this.initial].initialStateValue, r); } else e = {}; return this.__cache.initialStateValue = e, this.__cache.initialStateValue; @@ -8103,19 +8084,19 @@ var Gf = function() { var r; if (this.type === "history") { var e = this.config; - Te(e.target) ? r = Ki(e.target) ? Ho(this.machine.getStateNodeById(e.target).path.slice(this.path.length - 1)) : e.target : r = e.target; + Te(e.target) ? r = Vi(e.target) ? ko(this.machine.getStateNodeById(e.target).path.slice(this.path.length - 1)) : e.target : r = e.target; } return r; }, enumerable: false, configurable: true }), t.prototype.getRelativeStateNodes = function(r, e, n) { return n === void 0 && (n = true), n ? r.type === "history" ? r.resolveHistory(e) : r.initialStateNodes : [r]; }, Object.defineProperty(t.prototype, "initialStateNodes", { get: function() { var r = this; - if (Wo(this)) + if (Ho(this)) return [this]; if (this.type === "compound" && !this.initial) return Ge || nt(false, "Compound state node '".concat(this.id, "' has no initial state.")), [this]; - var e = $o(this.initialStateValue); - return $e(e.map(function(n) { + var e = _o(this.initialStateValue); + return Be(e.map(function(n) { return r.getFromRelativePath(n); })); }, enumerable: false, configurable: true }), t.prototype.getFromRelativePath = function(r) { @@ -8132,7 +8113,7 @@ var Gf = function() { return this.states[n].getFromRelativePath(s); }, t.prototype.historyValue = function(r) { if (Object.keys(this.states).length) - return { current: r || this.initialStateValue, states: Nu(this.states, function(e, n) { + return { current: r || this.initialStateValue, states: Eu(this.states, function(e, n) { if (!r) return e.historyValue(); var s = Te(r) ? void 0 : r[n]; @@ -8147,16 +8128,16 @@ var Gf = function() { var n = this.parent; if (!r) { var s = this.target; - return s ? $e($o(s).map(function(p) { + return s ? Be(_o(s).map(function(p) { return n.getFromRelativePath(p); })) : n.initialStateNodes; } - var a = sf(n.path, "states")(r).current; - return Te(a) ? [n.getStateNode(a)] : $e($o(a).map(function(p) { + var a = td(n.path, "states")(r).current; + return Te(a) ? [n.getStateNode(a)] : Be(_o(a).map(function(p) { return e.history === "deep" ? n.getFromRelativePath(p) : [n.states[p[0]]]; })); }, Object.defineProperty(t.prototype, "stateIds", { get: function() { - var r = this, e = $e(Object.keys(this.states).map(function(n) { + var r = this, e = Be(Object.keys(this.states).map(function(n) { return r.states[n].stateIds; })); return [this.id].concat(e); @@ -8226,9 +8207,9 @@ var Gf = function() { return e.getStateNodeByPath(a); }); }, t.prototype.formatTransition = function(r) { - var e = this, n = vf(r.target), s = "internal" in r ? r.internal : n ? n.some(function(m) { + var e = this, n = cd(r.target), s = "internal" in r ? r.internal : n ? n.some(function(m) { return Te(m) && m[0] === e.delimiter; - }) : true, a = this.machine.options.guards, p = this.resolveTarget(n), v = V(V({}, r), { actions: Br(cr(r.actions)), cond: Hs(r.cond, a), target: p, source: this, internal: s, eventType: r.event, toJSON: function() { + }) : true, a = this.machine.options.guards, p = this.resolveTarget(n), v = V(V({}, r), { actions: Hr(ur(r.actions)), cond: Es(r.cond, a), target: p, source: this, internal: s, eventType: r.event, toJSON: function() { return V(V({}, v), { target: v.target ? v.target.map(function(m) { return "#".concat(m.id); }) : void 0, source: "#".concat(e.id) }); @@ -8241,21 +8222,21 @@ var Gf = function() { else if (Array.isArray(this.config.on)) s = this.config.on; else { - var a = this.config.on, p = Xo, v = a[p], m = v === void 0 ? [] : v, d = Li(a, [typeof p == "symbol" ? p : p + ""]); - s = $e(Object.keys(d).map(function(L) { - !Ge && L === Ji && nt(false, "Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. " + 'Please check the `on` configuration for "#'.concat(n.id, '".')); - var $ = ai(L, d[L]); - return Ge || oy(n, L, $), $; - }).concat(ai(Xo, m))); - } - var f = this.config.always ? ai("", this.config.always) : [], g = this.config.onDone ? ai(String(Uo(this.id)), this.config.onDone) : []; + var a = this.config.on, p = qo, v = a[p], m = v === void 0 ? [] : v, d = Di(a, [typeof p == "symbol" ? p : p + ""]); + s = Be(Object.keys(d).map(function(L) { + !Ge && L === Yi && nt(false, "Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. " + 'Please check the `on` configuration for "#'.concat(n.id, '".')); + var B = ni(L, d[L]); + return Ge || Rg(n, L, B), B; + }).concat(ni(qo, m))); + } + var f = this.config.always ? ni("", this.config.always) : [], g = this.config.onDone ? ni(String(jo(this.id)), this.config.onDone) : []; Ge || nt(!(this.config.onDone && !this.parent), 'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id, '".')); - var w = $e(this.invoke.map(function(L) { - var $ = []; - return L.onDone && $.push.apply($, ke([], Ee(ai(String(Ui(L.id)), L.onDone)), false)), L.onError && $.push.apply($, ke([], Ee(ai(String(si(L.id)), L.onError)), false)), $; - })), S = this.after, T = $e(ke(ke(ke(ke([], Ee(g), false), Ee(w), false), Ee(s), false), Ee(f), false).map(function(L) { - return cr(L).map(function($) { - return n.formatTransition($); + var w = Be(this.invoke.map(function(L) { + var B = []; + return L.onDone && B.push.apply(B, ke([], Ee(ni(String($i(L.id)), L.onDone)), false)), L.onError && B.push.apply(B, ke([], Ee(ni(String(ii(L.id)), L.onError)), false)), B; + })), S = this.after, T = Be(ke(ke(ke(ke([], Ee(g), false), Ee(w), false), Ee(s), false), Ee(f), false).map(function(L) { + return ur(L).map(function(B) { + return n.formatTransition(B); }); })); try { @@ -8276,17 +8257,17 @@ var Gf = function() { return T; }, t; }(); -var jf = false; +var Dd = false; function ht(t, r) { - return !Ge && !("predictableActionArguments" in t) && !jf && (jf = true, console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")), new Gf(t, r); + return !Ge && !("predictableActionArguments" in t) && !Dd && (Dd = true, console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")), new Rd(t, r); } __name(ht, "ht"); u(ht, "createMachine"); -var Bf = jt(on(), 1); -var Ko = jt(Zo(), 1); -var Vs = u((t) => t != null && typeof t.draggable == "boolean", "isDraggable"); -var Ws = u((t) => t != null && t.tagName === "CIRCUIT-DROPZONE", "isCircuitDropzoneElement"); -var Yu = u((t) => t != null && t.tagName === "PALETTE-DROPZONE", "isPaletteDropzoneElement"); +var Lf = er(Rn(), 1); +var Xo = er(Yo(), 1); +var Us = u((t) => t != null && typeof t.draggable == "boolean", "isDraggable"); +var Fs = u((t) => t != null && t.tagName === "CIRCUIT-DROPZONE", "isCircuitDropzoneElement"); +var Uu = u((t) => t != null && t.tagName === "PALETTE-DROPZONE", "isPaletteDropzoneElement"); function me(t) { let e = class e extends t { static { @@ -8304,19 +8285,19 @@ function me(t) { this.draggableMachine = ht({ id: "draggable", initial: "idle", states: { idle: { entry: ["init"], on: { SET_INTERACT: { target: "grabbable", actions: ["setInteract"] } } }, grabbable: { on: { GRAB: { target: "grabbed", actions: ["grab"] }, UNSET_INTERACT: { target: "idle" } } }, grabbed: { on: { START_DRAGGING: { target: "dragging", actions: ["startDragging"] }, RELEASE: [{ target: "grabbable", actions: ["release"], cond: "isOnCircuitDropzone" }, { target: "deleted", actions: ["release"], cond: "isOnPaletteDropzone" }] } }, dragging: { type: "compound", initial: "unknown", on: { END_DRAGGING: { target: "dropped", actions: ["endDragging"] } }, states: { unknown: { always: [{ target: "snapped", cond: "isOnCircuitDropzone" }, { target: "unsnapped", cond: "isOnPaletteDropzone" }] }, snapped: { entry: ["snap"], on: { UNSNAP: { target: "unsnapped" } } }, unsnapped: { entry: ["unsnap"], on: { SNAP: { target: "snapped" } } } } }, dropped: { entry: ["drop"], always: [{ target: "grabbable", cond: "isDroppedOnCircuitDropzone" }, { target: "deleted", cond: "isTrashed" }] }, deleted: { type: "final", entry: "delete" } } }, { actions: { init: () => { fe("draggable:init", {}, this); }, setInteract: (a, p) => { - B.need(p.type === "SET_INTERACT", "event type must be SET_INTERACT"); - let v = (0, Ko.default)(this); + $.need(p.type === "SET_INTERACT", "event type must be SET_INTERACT"); + let v = (0, Xo.default)(this); v.styleCursor(false), v.pointerEvents({ ignoreFrom: ".resize-handle" }), v.on("down", this.grab.bind(this)), v.on("up", this.release.bind(this)), v.draggable({ onstart: this.startDragging.bind(this), onmove: this.dragMove.bind(this), onend: this.endDragging.bind(this), ignoreFrom: ".resize-handle" }); let m = this.dropzone; - Ws(m) ? this.snappedDropzone = m : this.snappedDropzone = null; + Fs(m) ? this.snappedDropzone = m : this.snappedDropzone = null; }, grab: (a, p) => { - B.need(p.type === "GRAB", "event type must be GRAB"), p.type === "GRAB" && (this.grabbed = true, fe("draggable:grab", {}, this), Yu(this.dropzone) && (this.snapped = false, this.moveByOffset(p.x, p.y), this.classList.remove("qpu-operation-xl"))); + $.need(p.type === "GRAB", "event type must be GRAB"), p.type === "GRAB" && (this.grabbed = true, fe("draggable:grab", {}, this), Uu(this.dropzone) && (this.snapped = false, this.moveByOffset(p.x, p.y), this.classList.remove("qpu-operation-xl"))); }, release: (a, p) => { - B.need(p.type === "RELEASE", "event type must be RELEASE"), this.grabbed = false, fe("draggable:release", {}, this); + $.need(p.type === "RELEASE", "event type must be RELEASE"), this.grabbed = false, fe("draggable:release", {}, this); }, startDragging: (a, p) => { - B.need(p.type === "START_DRAGGING", "event type must be START_DRAGGING"), this.dragging = true; + $.need(p.type === "START_DRAGGING", "event type must be START_DRAGGING"), this.dragging = true; }, endDragging: (a, p) => { - B.need(p.type === "END_DRAGGING", "event type must be END_DRAGGING"), this.grabbed = false, this.dragging = false, fe("draggable:end-dragging", {}, this); + $.need(p.type === "END_DRAGGING", "event type must be END_DRAGGING"), this.grabbed = false, this.dragging = false, fe("draggable:end-dragging", {}, this); }, snap: () => { this.snapped = true, this.snappedDropzone = this.dropzone, fe("draggable:snap-to-dropzone", {}, this); }, unsnap: () => { @@ -8324,10 +8305,10 @@ function me(t) { }, drop: () => { this.snapped && (this.moveTo(0, 0), fe("draggable:drop", {}, this)); }, delete: () => { - (0, Ko.default)(this).unset(), fe("draggable:delete", {}, this); - } }, guards: { isOnCircuitDropzone: () => Ws(this.dropzone), isOnPaletteDropzone: () => Yu(this.dropzone), isDroppedOnCircuitDropzone: () => this.snapped && Ws(this.dropzone), isTrashed: () => !this.snapped } }); + (0, Xo.default)(this).unset(), fe("draggable:delete", {}, this); + } }, guards: { isOnCircuitDropzone: () => Fs(this.dropzone), isOnPaletteDropzone: () => Uu(this.dropzone), isDroppedOnCircuitDropzone: () => this.snapped && Fs(this.dropzone), isTrashed: () => !this.snapped } }); this.draggableService = ut(this.draggableMachine).onTransition((a) => { - this.debugDraggable && console.log(`draggable: ${(0, Bf.format)(a.value)}`); + this.debugDraggable && console.log(`draggable: ${(0, Lf.format)(a.value)}`); }); } get draggable() { @@ -8341,10 +8322,10 @@ function me(t) { } get dropzone() { let a = this.parentElement; - return B.notNull(a), !Yu(a) && !Ws(a) ? null : a; + return $.notNull(a), !Uu(a) && !Fs(a) ? null : a; } set snapTargets(a) { - (0, Ko.default)(this).draggable({ modifiers: [Ko.default.modifiers.snap({ targets: a, range: this.snapRange })], listeners: { move: this.moveEventListener.bind(this) } }); + (0, Xo.default)(this).draggable({ modifiers: [Xo.default.modifiers.snap({ targets: a, range: this.snapRange })], listeners: { move: this.moveEventListener.bind(this) } }); } get snapRange() { return 32; @@ -8390,8 +8371,8 @@ function me(t) { } __name(me, "me"); u(me, "DraggableMixin"); -var li = u((t) => typeof t == "object" && t !== null && typeof t.flag == "string", "isFlaggable"); -function $f(t) { +var si = u((t) => typeof t == "object" && t !== null && typeof t.flag == "string", "isFlaggable"); +function Gf(t) { let e = class e extends t { static { __name(this, "e"); @@ -8405,36 +8386,36 @@ function $f(t) { let r = e; return r; } -__name($f, "$f"); -u($f, "FlaggableMixin"); +__name(Gf, "Gf"); +u(Gf, "FlaggableMixin"); var Qe = "top"; var mt = "bottom"; var ct = "right"; var it = "left"; -var Ys = "auto"; -var kn = [Qe, mt, ct, it]; -var un = "start"; -var ui = "end"; -var qf = "clippingParents"; -var Xs = "viewport"; -var Qi = "popper"; -var Ff = "reference"; -var Xu = kn.reduce(function(t, r) { - return t.concat([r + "-" + un, r + "-" + ui]); +var Ws = "auto"; +var Dn = [Qe, mt, ct, it]; +var sn = "start"; +var li = "end"; +var jf = "clippingParents"; +var Vs = "viewport"; +var Ji = "popper"; +var Hf = "reference"; +var Wu = Dn.reduce(function(t, r) { + return t.concat([r + "-" + sn, r + "-" + li]); }, []); -var Zs = [].concat(kn, [Ys]).reduce(function(t, r) { - return t.concat([r, r + "-" + un, r + "-" + ui]); +var Ys = [].concat(Dn, [Ws]).reduce(function(t, r) { + return t.concat([r, r + "-" + sn, r + "-" + li]); }, []); -var ay = "beforeRead"; -var sy = "read"; -var ly = "afterRead"; -var uy = "beforeMain"; -var cy = "main"; -var py = "afterMain"; -var dy = "beforeWrite"; -var fy = "write"; -var hy = "afterWrite"; -var Uf = [ay, sy, ly, uy, cy, py, dy, fy, hy]; +var ry = "beforeRead"; +var ny = "read"; +var iy = "afterRead"; +var oy = "beforeMain"; +var ay = "main"; +var sy = "afterMain"; +var ly = "beforeWrite"; +var uy = "write"; +var cy = "afterWrite"; +var $f = [ry, ny, iy, oy, ay, sy, ly, uy, cy]; function bt(t) { return t ? (t.nodeName || "").toLowerCase() : null; } @@ -8463,15 +8444,15 @@ function vt(t) { } __name(vt, "vt"); u(vt, "isHTMLElement"); -function Ks(t) { +function Xs(t) { if (typeof ShadowRoot == "undefined") return false; var r = ot(t).ShadowRoot; return t instanceof r || t instanceof ShadowRoot; } -__name(Ks, "Ks"); -u(Ks, "isShadowRoot"); -function my(t) { +__name(Xs, "Xs"); +u(Xs, "isShadowRoot"); +function py(t) { var r = t.state; Object.keys(r.elements).forEach(function(e) { var n = r.styles[e] || {}, s = r.attributes[e] || {}, a = r.elements[e]; @@ -8481,9 +8462,9 @@ function my(t) { })); }); } -__name(my, "my"); -u(my, "applyStyles"); -function vy(t) { +__name(py, "py"); +u(py, "applyStyles"); +function dy(t) { var r = t.state, e = { popper: { position: r.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} }; return Object.assign(r.elements.popper.style, e.popper), r.styles = e, r.elements.arrow && Object.assign(r.elements.arrow.style, e.arrow), function() { Object.keys(r.elements).forEach(function(n) { @@ -8496,39 +8477,39 @@ function vy(t) { }); }; } -__name(vy, "vy"); -u(vy, "effect"); -var Jo = { name: "applyStyles", enabled: true, phase: "write", fn: my, effect: vy, requires: ["computeStyles"] }; +__name(dy, "dy"); +u(dy, "effect"); +var Zo = { name: "applyStyles", enabled: true, phase: "write", fn: py, effect: dy, requires: ["computeStyles"] }; function yt(t) { return t.split("-")[0]; } __name(yt, "yt"); u(yt, "getBasePlacement"); -var Pr = Math.max; -var ci = Math.min; -var cn = Math.round; -function Tr(t, r) { +var Ar = Math.max; +var ui = Math.min; +var ln = Math.round; +function Sr(t, r) { r === void 0 && (r = false); var e = t.getBoundingClientRect(), n = 1, s = 1; if (vt(t) && r) { var a = t.offsetHeight, p = t.offsetWidth; - p > 0 && (n = cn(e.width) / p || 1), a > 0 && (s = cn(e.height) / a || 1); + p > 0 && (n = ln(e.width) / p || 1), a > 0 && (s = ln(e.height) / a || 1); } return { width: e.width / n, height: e.height / s, top: e.top / s, right: e.right / n, bottom: e.bottom / s, left: e.left / n, x: e.left / n, y: e.top / s }; } -__name(Tr, "Tr"); -u(Tr, "getBoundingClientRect"); -function pi(t) { - var r = Tr(t), e = t.offsetWidth, n = t.offsetHeight; +__name(Sr, "Sr"); +u(Sr, "getBoundingClientRect"); +function ci(t) { + var r = Sr(t), e = t.offsetWidth, n = t.offsetHeight; return Math.abs(r.width - e) <= 1 && (e = r.width), Math.abs(r.height - n) <= 1 && (n = r.height), { x: t.offsetLeft, y: t.offsetTop, width: e, height: n }; } -__name(pi, "pi"); -u(pi, "getLayoutRect"); -function Qo(t, r) { +__name(ci, "ci"); +u(ci, "getLayoutRect"); +function Ko(t, r) { var e = r.getRootNode && r.getRootNode(); if (t.contains(r)) return true; - if (e && Ks(e)) { + if (e && Xs(e)) { var n = r; do { if (n && t.isSameNode(n)) @@ -8538,265 +8519,265 @@ function Qo(t, r) { } return false; } -__name(Qo, "Qo"); -u(Qo, "contains"); -function Ht(t) { +__name(Ko, "Ko"); +u(Ko, "contains"); +function Gt(t) { return ot(t).getComputedStyle(t); } -__name(Ht, "Ht"); -u(Ht, "getComputedStyle"); -function Zu(t) { +__name(Gt, "Gt"); +u(Gt, "getComputedStyle"); +function Vu(t) { return ["table", "td", "th"].indexOf(bt(t)) >= 0; } -__name(Zu, "Zu"); -u(Zu, "isTableElement"); +__name(Vu, "Vu"); +u(Vu, "isTableElement"); function Ct(t) { return (($r(t) ? t.ownerDocument : t.document) || window.document).documentElement; } __name(Ct, "Ct"); u(Ct, "getDocumentElement"); -function pn(t) { - return bt(t) === "html" ? t : t.assignedSlot || t.parentNode || (Ks(t) ? t.host : null) || Ct(t); +function un(t) { + return bt(t) === "html" ? t : t.assignedSlot || t.parentNode || (Xs(t) ? t.host : null) || Ct(t); } -__name(pn, "pn"); -u(pn, "getParentNode"); -function Wf(t) { - return !vt(t) || Ht(t).position === "fixed" ? null : t.offsetParent; +__name(un, "un"); +u(un, "getParentNode"); +function Bf(t) { + return !vt(t) || Gt(t).position === "fixed" ? null : t.offsetParent; } -__name(Wf, "Wf"); -u(Wf, "getTrueOffsetParent"); -function gy(t) { +__name(Bf, "Bf"); +u(Bf, "getTrueOffsetParent"); +function fy(t) { var r = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, e = navigator.userAgent.indexOf("Trident") !== -1; if (e && vt(t)) { - var n = Ht(t); + var n = Gt(t); if (n.position === "fixed") return null; } - for (var s = pn(t); vt(s) && ["html", "body"].indexOf(bt(s)) < 0; ) { - var a = Ht(s); + for (var s = un(t); vt(s) && ["html", "body"].indexOf(bt(s)) < 0; ) { + var a = Gt(s); if (a.transform !== "none" || a.perspective !== "none" || a.contain === "paint" || ["transform", "perspective"].indexOf(a.willChange) !== -1 || r && a.willChange === "filter" || r && a.filter && a.filter !== "none") return s; s = s.parentNode; } return null; } -__name(gy, "gy"); -u(gy, "getContainingBlock"); -function zr(t) { - for (var r = ot(t), e = Wf(t); e && Zu(e) && Ht(e).position === "static"; ) - e = Wf(e); - return e && (bt(e) === "html" || bt(e) === "body" && Ht(e).position === "static") ? r : e || gy(t) || r; +__name(fy, "fy"); +u(fy, "getContainingBlock"); +function Pr(t) { + for (var r = ot(t), e = Bf(t); e && Vu(e) && Gt(e).position === "static"; ) + e = Bf(e); + return e && (bt(e) === "html" || bt(e) === "body" && Gt(e).position === "static") ? r : e || fy(t) || r; } -__name(zr, "zr"); -u(zr, "getOffsetParent"); -function di(t) { +__name(Pr, "Pr"); +u(Pr, "getOffsetParent"); +function pi(t) { return ["top", "bottom"].indexOf(t) >= 0 ? "x" : "y"; } -__name(di, "di"); -u(di, "getMainAxisFromPlacement"); -function fi(t, r, e) { - return Pr(t, ci(r, e)); +__name(pi, "pi"); +u(pi, "getMainAxisFromPlacement"); +function di(t, r, e) { + return Ar(t, ui(r, e)); } -__name(fi, "fi"); -u(fi, "within"); -function Vf(t, r, e) { - var n = fi(t, r, e); +__name(di, "di"); +u(di, "within"); +function qf(t, r, e) { + var n = di(t, r, e); return n > e ? e : n; } -__name(Vf, "Vf"); -u(Vf, "withinMaxClamp"); -function ea() { +__name(qf, "qf"); +u(qf, "withinMaxClamp"); +function Jo() { return { top: 0, right: 0, bottom: 0, left: 0 }; } -__name(ea, "ea"); -u(ea, "getFreshSideObject"); -function ta(t) { - return Object.assign({}, ea(), t); +__name(Jo, "Jo"); +u(Jo, "getFreshSideObject"); +function Qo(t) { + return Object.assign({}, Jo(), t); } -__name(ta, "ta"); -u(ta, "mergePaddingObject"); -function ra(t, r) { +__name(Qo, "Qo"); +u(Qo, "mergePaddingObject"); +function ea(t, r) { return r.reduce(function(e, n) { return e[n] = t, e; }, {}); } -__name(ra, "ra"); -u(ra, "expandToHashMap"); -var by = u(function(r, e) { - return r = typeof r == "function" ? r(Object.assign({}, e.rects, { placement: e.placement })) : r, ta(typeof r != "number" ? r : ra(r, kn)); +__name(ea, "ea"); +u(ea, "expandToHashMap"); +var hy = u(function(r, e) { + return r = typeof r == "function" ? r(Object.assign({}, e.rects, { placement: e.placement })) : r, Qo(typeof r != "number" ? r : ea(r, Dn)); }, "toPaddingObject"); -function yy(t) { - var r, e = t.state, n = t.name, s = t.options, a = e.elements.arrow, p = e.modifiersData.popperOffsets, v = yt(e.placement), m = di(v), d = [it, ct].indexOf(v) >= 0, f = d ? "height" : "width"; +function my(t) { + var r, e = t.state, n = t.name, s = t.options, a = e.elements.arrow, p = e.modifiersData.popperOffsets, v = yt(e.placement), m = pi(v), d = [it, ct].indexOf(v) >= 0, f = d ? "height" : "width"; if (!(!a || !p)) { - var g = by(s.padding, e), w = pi(a), S = m === "y" ? Qe : it, T = m === "y" ? mt : ct, C = e.rects.reference[f] + e.rects.reference[m] - p[m] - e.rects.popper[f], R = p[m] - e.rects.reference[m], _ = zr(a), L = _ ? m === "y" ? _.clientHeight || 0 : _.clientWidth || 0 : 0, $ = C / 2 - R / 2, A = g[S], ee = L - w[f] - g[T], z = L / 2 - w[f] / 2 + $, H = fi(A, z, ee), te = m; + var g = hy(s.padding, e), w = ci(a), S = m === "y" ? Qe : it, T = m === "y" ? mt : ct, C = e.rects.reference[f] + e.rects.reference[m] - p[m] - e.rects.popper[f], R = p[m] - e.rects.reference[m], _ = Pr(a), L = _ ? m === "y" ? _.clientHeight || 0 : _.clientWidth || 0 : 0, B = C / 2 - R / 2, A = g[S], ee = L - w[f] - g[T], z = L / 2 - w[f] / 2 + B, H = di(A, z, ee), te = m; e.modifiersData[n] = (r = {}, r[te] = H, r.centerOffset = H - z, r); } } -__name(yy, "yy"); -u(yy, "arrow"); -function wy(t) { +__name(my, "my"); +u(my, "arrow"); +function vy(t) { var r = t.state, e = t.options, n = e.element, s = n === void 0 ? "[data-popper-arrow]" : n; - s != null && (typeof s == "string" && (s = r.elements.popper.querySelector(s), !s) || Qo(r.elements.popper, s) && (r.elements.arrow = s)); + s != null && (typeof s == "string" && (s = r.elements.popper.querySelector(s), !s) || Ko(r.elements.popper, s) && (r.elements.arrow = s)); } -__name(wy, "wy"); -u(wy, "effect"); -var Yf = { name: "arrow", enabled: true, phase: "main", fn: yy, effect: wy, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] }; -function Cr(t) { +__name(vy, "vy"); +u(vy, "effect"); +var Ff = { name: "arrow", enabled: true, phase: "main", fn: my, effect: vy, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] }; +function Tr(t) { return t.split("-")[1]; } -__name(Cr, "Cr"); -u(Cr, "getVariation"); -var xy = { top: "auto", right: "auto", bottom: "auto", left: "auto" }; -function Ey(t) { +__name(Tr, "Tr"); +u(Tr, "getVariation"); +var gy = { top: "auto", right: "auto", bottom: "auto", left: "auto" }; +function by(t) { var r = t.x, e = t.y, n = window, s = n.devicePixelRatio || 1; - return { x: cn(r * s) / s || 0, y: cn(e * s) / s || 0 }; + return { x: ln(r * s) / s || 0, y: ln(e * s) / s || 0 }; } -__name(Ey, "Ey"); -u(Ey, "roundOffsetsByDPR"); -function Xf(t) { +__name(by, "by"); +u(by, "roundOffsetsByDPR"); +function Uf(t) { var r, e = t.popper, n = t.popperRect, s = t.placement, a = t.variation, p = t.offsets, v = t.position, m = t.gpuAcceleration, d = t.adaptive, f = t.roundOffsets, g = t.isFixed, w = p.x, S = w === void 0 ? 0 : w, T = p.y, C = T === void 0 ? 0 : T, R = typeof f == "function" ? f({ x: S, y: C }) : { x: S, y: C }; S = R.x, C = R.y; - var _ = p.hasOwnProperty("x"), L = p.hasOwnProperty("y"), $ = it, A = Qe, ee = window; + var _ = p.hasOwnProperty("x"), L = p.hasOwnProperty("y"), B = it, A = Qe, ee = window; if (d) { - var z = zr(e), H = "clientHeight", te = "clientWidth"; - if (z === ot(e) && (z = Ct(e), Ht(z).position !== "static" && v === "absolute" && (H = "scrollHeight", te = "scrollWidth")), z = z, s === Qe || (s === it || s === ct) && a === ui) { + var z = Pr(e), H = "clientHeight", te = "clientWidth"; + if (z === ot(e) && (z = Ct(e), Gt(z).position !== "static" && v === "absolute" && (H = "scrollHeight", te = "scrollWidth")), z = z, s === Qe || (s === it || s === ct) && a === li) { A = mt; var Q = g && ee.visualViewport ? ee.visualViewport.height : z[H]; C -= Q - n.height, C *= m ? 1 : -1; } - if (s === it || (s === Qe || s === mt) && a === ui) { - $ = ct; + if (s === it || (s === Qe || s === mt) && a === li) { + B = ct; var ue = g && ee.visualViewport ? ee.visualViewport.width : z[te]; S -= ue - n.width, S *= m ? 1 : -1; } } - var K = Object.assign({ position: v }, d && xy), ie = f === true ? Ey({ x: S, y: C }) : { x: S, y: C }; + var K = Object.assign({ position: v }, d && gy), ie = f === true ? by({ x: S, y: C }) : { x: S, y: C }; if (S = ie.x, C = ie.y, m) { var q; - return Object.assign({}, K, (q = {}, q[A] = L ? "0" : "", q[$] = _ ? "0" : "", q.transform = (ee.devicePixelRatio || 1) <= 1 ? "translate(" + S + "px, " + C + "px)" : "translate3d(" + S + "px, " + C + "px, 0)", q)); + return Object.assign({}, K, (q = {}, q[A] = L ? "0" : "", q[B] = _ ? "0" : "", q.transform = (ee.devicePixelRatio || 1) <= 1 ? "translate(" + S + "px, " + C + "px)" : "translate3d(" + S + "px, " + C + "px, 0)", q)); } - return Object.assign({}, K, (r = {}, r[A] = L ? C + "px" : "", r[$] = _ ? S + "px" : "", r.transform = "", r)); + return Object.assign({}, K, (r = {}, r[A] = L ? C + "px" : "", r[B] = _ ? S + "px" : "", r.transform = "", r)); } -__name(Xf, "Xf"); -u(Xf, "mapToStyles"); -function Sy(t) { +__name(Uf, "Uf"); +u(Uf, "mapToStyles"); +function yy(t) { var r = t.state, e = t.options, n = e.gpuAcceleration, s = n === void 0 ? true : n, a = e.adaptive, p = a === void 0 ? true : a, v = e.roundOffsets, m = v === void 0 ? true : v; if (false) var d; - var f = { placement: yt(r.placement), variation: Cr(r.placement), popper: r.elements.popper, popperRect: r.rects.popper, gpuAcceleration: s, isFixed: r.options.strategy === "fixed" }; - r.modifiersData.popperOffsets != null && (r.styles.popper = Object.assign({}, r.styles.popper, Xf(Object.assign({}, f, { offsets: r.modifiersData.popperOffsets, position: r.options.strategy, adaptive: p, roundOffsets: m })))), r.modifiersData.arrow != null && (r.styles.arrow = Object.assign({}, r.styles.arrow, Xf(Object.assign({}, f, { offsets: r.modifiersData.arrow, position: "absolute", adaptive: false, roundOffsets: m })))), r.attributes.popper = Object.assign({}, r.attributes.popper, { "data-popper-placement": r.placement }); + var f = { placement: yt(r.placement), variation: Tr(r.placement), popper: r.elements.popper, popperRect: r.rects.popper, gpuAcceleration: s, isFixed: r.options.strategy === "fixed" }; + r.modifiersData.popperOffsets != null && (r.styles.popper = Object.assign({}, r.styles.popper, Uf(Object.assign({}, f, { offsets: r.modifiersData.popperOffsets, position: r.options.strategy, adaptive: p, roundOffsets: m })))), r.modifiersData.arrow != null && (r.styles.arrow = Object.assign({}, r.styles.arrow, Uf(Object.assign({}, f, { offsets: r.modifiersData.arrow, position: "absolute", adaptive: false, roundOffsets: m })))), r.attributes.popper = Object.assign({}, r.attributes.popper, { "data-popper-placement": r.placement }); } -__name(Sy, "Sy"); -u(Sy, "computeStyles"); -var Zf = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: Sy, data: {} }; -var Js = { passive: true }; -function Ty(t) { +__name(yy, "yy"); +u(yy, "computeStyles"); +var Wf = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: yy, data: {} }; +var Zs = { passive: true }; +function wy(t) { var r = t.state, e = t.instance, n = t.options, s = n.scroll, a = s === void 0 ? true : s, p = n.resize, v = p === void 0 ? true : p, m = ot(r.elements.popper), d = [].concat(r.scrollParents.reference, r.scrollParents.popper); return a && d.forEach(function(f) { - f.addEventListener("scroll", e.update, Js); - }), v && m.addEventListener("resize", e.update, Js), function() { + f.addEventListener("scroll", e.update, Zs); + }), v && m.addEventListener("resize", e.update, Zs), function() { a && d.forEach(function(f) { - f.removeEventListener("scroll", e.update, Js); - }), v && m.removeEventListener("resize", e.update, Js); + f.removeEventListener("scroll", e.update, Zs); + }), v && m.removeEventListener("resize", e.update, Zs); }; } -__name(Ty, "Ty"); -u(Ty, "effect"); -var Kf = { name: "eventListeners", enabled: true, phase: "write", fn: u(function() { -}, "fn"), effect: Ty, data: {} }; -var Cy = { left: "right", right: "left", bottom: "top", top: "bottom" }; -function eo(t) { +__name(wy, "wy"); +u(wy, "effect"); +var Vf = { name: "eventListeners", enabled: true, phase: "write", fn: u(function() { +}, "fn"), effect: wy, data: {} }; +var xy = { left: "right", right: "left", bottom: "top", top: "bottom" }; +function Qi(t) { return t.replace(/left|right|bottom|top/g, function(r) { - return Cy[r]; + return xy[r]; }); } -__name(eo, "eo"); -u(eo, "getOppositePlacement"); -var Oy = { start: "end", end: "start" }; -function Qs(t) { +__name(Qi, "Qi"); +u(Qi, "getOppositePlacement"); +var Ey = { start: "end", end: "start" }; +function Ks(t) { return t.replace(/start|end/g, function(r) { - return Oy[r]; + return Ey[r]; }); } -__name(Qs, "Qs"); -u(Qs, "getOppositeVariationPlacement"); -function hi(t) { +__name(Ks, "Ks"); +u(Ks, "getOppositeVariationPlacement"); +function fi(t) { var r = ot(t), e = r.pageXOffset, n = r.pageYOffset; return { scrollLeft: e, scrollTop: n }; } -__name(hi, "hi"); -u(hi, "getWindowScroll"); -function mi(t) { - return Tr(Ct(t)).left + hi(t).scrollLeft; +__name(fi, "fi"); +u(fi, "getWindowScroll"); +function hi(t) { + return Sr(Ct(t)).left + fi(t).scrollLeft; } -__name(mi, "mi"); -u(mi, "getWindowScrollBarX"); -function Ku(t) { +__name(hi, "hi"); +u(hi, "getWindowScrollBarX"); +function Yu(t) { var r = ot(t), e = Ct(t), n = r.visualViewport, s = e.clientWidth, a = e.clientHeight, p = 0, v = 0; - return n && (s = n.width, a = n.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (p = n.offsetLeft, v = n.offsetTop)), { width: s, height: a, x: p + mi(t), y: v }; + return n && (s = n.width, a = n.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (p = n.offsetLeft, v = n.offsetTop)), { width: s, height: a, x: p + hi(t), y: v }; } -__name(Ku, "Ku"); -u(Ku, "getViewportRect"); -function Ju(t) { - var r, e = Ct(t), n = hi(t), s = (r = t.ownerDocument) == null ? void 0 : r.body, a = Pr(e.scrollWidth, e.clientWidth, s ? s.scrollWidth : 0, s ? s.clientWidth : 0), p = Pr(e.scrollHeight, e.clientHeight, s ? s.scrollHeight : 0, s ? s.clientHeight : 0), v = -n.scrollLeft + mi(t), m = -n.scrollTop; - return Ht(s || e).direction === "rtl" && (v += Pr(e.clientWidth, s ? s.clientWidth : 0) - a), { width: a, height: p, x: v, y: m }; +__name(Yu, "Yu"); +u(Yu, "getViewportRect"); +function Xu(t) { + var r, e = Ct(t), n = fi(t), s = (r = t.ownerDocument) == null ? void 0 : r.body, a = Ar(e.scrollWidth, e.clientWidth, s ? s.scrollWidth : 0, s ? s.clientWidth : 0), p = Ar(e.scrollHeight, e.clientHeight, s ? s.scrollHeight : 0, s ? s.clientHeight : 0), v = -n.scrollLeft + hi(t), m = -n.scrollTop; + return Gt(s || e).direction === "rtl" && (v += Ar(e.clientWidth, s ? s.clientWidth : 0) - a), { width: a, height: p, x: v, y: m }; } -__name(Ju, "Ju"); -u(Ju, "getDocumentRect"); -function vi(t) { - var r = Ht(t), e = r.overflow, n = r.overflowX, s = r.overflowY; +__name(Xu, "Xu"); +u(Xu, "getDocumentRect"); +function mi(t) { + var r = Gt(t), e = r.overflow, n = r.overflowX, s = r.overflowY; return /auto|scroll|overlay|hidden/.test(e + s + n); } -__name(vi, "vi"); -u(vi, "isScrollParent"); -function el(t) { - return ["html", "body", "#document"].indexOf(bt(t)) >= 0 ? t.ownerDocument.body : vt(t) && vi(t) ? t : el(pn(t)); +__name(mi, "mi"); +u(mi, "isScrollParent"); +function Js(t) { + return ["html", "body", "#document"].indexOf(bt(t)) >= 0 ? t.ownerDocument.body : vt(t) && mi(t) ? t : Js(un(t)); } -__name(el, "el"); -u(el, "getScrollParent"); -function Nn(t, r) { +__name(Js, "Js"); +u(Js, "getScrollParent"); +function kn(t, r) { var e; r === void 0 && (r = []); - var n = el(t), s = n === ((e = t.ownerDocument) == null ? void 0 : e.body), a = ot(n), p = s ? [a].concat(a.visualViewport || [], vi(n) ? n : []) : n, v = r.concat(p); - return s ? v : v.concat(Nn(pn(p))); + var n = Js(t), s = n === ((e = t.ownerDocument) == null ? void 0 : e.body), a = ot(n), p = s ? [a].concat(a.visualViewport || [], mi(n) ? n : []) : n, v = r.concat(p); + return s ? v : v.concat(kn(un(p))); } -__name(Nn, "Nn"); -u(Nn, "listScrollParents"); -function to(t) { +__name(kn, "kn"); +u(kn, "listScrollParents"); +function eo(t) { return Object.assign({}, t, { left: t.x, top: t.y, right: t.x + t.width, bottom: t.y + t.height }); } -__name(to, "to"); -u(to, "rectToClientRect"); -function My(t) { - var r = Tr(t); +__name(eo, "eo"); +u(eo, "rectToClientRect"); +function Sy(t) { + var r = Sr(t); return r.top = r.top + t.clientTop, r.left = r.left + t.clientLeft, r.bottom = r.top + t.clientHeight, r.right = r.left + t.clientWidth, r.width = t.clientWidth, r.height = t.clientHeight, r.x = r.left, r.y = r.top, r; } -__name(My, "My"); -u(My, "getInnerBoundingClientRect"); -function Jf(t, r) { - return r === Xs ? to(Ku(t)) : $r(r) ? My(r) : to(Ju(Ct(t))); -} -__name(Jf, "Jf"); -u(Jf, "getClientRectFromMixedType"); -function Iy(t) { - var r = Nn(pn(t)), e = ["absolute", "fixed"].indexOf(Ht(t).position) >= 0, n = e && vt(t) ? zr(t) : t; +__name(Sy, "Sy"); +u(Sy, "getInnerBoundingClientRect"); +function Yf(t, r) { + return r === Vs ? eo(Yu(t)) : $r(r) ? Sy(r) : eo(Xu(Ct(t))); +} +__name(Yf, "Yf"); +u(Yf, "getClientRectFromMixedType"); +function Ty(t) { + var r = kn(un(t)), e = ["absolute", "fixed"].indexOf(Gt(t).position) >= 0, n = e && vt(t) ? Pr(t) : t; return $r(n) ? r.filter(function(s) { - return $r(s) && Qo(s, n) && bt(s) !== "body"; + return $r(s) && Ko(s, n) && bt(s) !== "body"; }) : []; } -__name(Iy, "Iy"); -u(Iy, "getClippingParents"); -function Qu(t, r, e) { - var n = r === "clippingParents" ? Iy(t) : [].concat(r), s = [].concat(n, [e]), a = s[0], p = s.reduce(function(v, m) { - var d = Jf(t, m); - return v.top = Pr(d.top, v.top), v.right = ci(d.right, v.right), v.bottom = ci(d.bottom, v.bottom), v.left = Pr(d.left, v.left), v; - }, Jf(t, a)); +__name(Ty, "Ty"); +u(Ty, "getClippingParents"); +function Zu(t, r, e) { + var n = r === "clippingParents" ? Ty(t) : [].concat(r), s = [].concat(n, [e]), a = s[0], p = s.reduce(function(v, m) { + var d = Yf(t, m); + return v.top = Ar(d.top, v.top), v.right = ui(d.right, v.right), v.bottom = ui(d.bottom, v.bottom), v.left = Ar(d.left, v.left), v; + }, Yf(t, a)); return p.width = p.right - p.left, p.height = p.bottom - p.top, p.x = p.left, p.y = p.top, p; } -__name(Qu, "Qu"); -u(Qu, "getClippingRect"); -function na(t) { - var r = t.reference, e = t.element, n = t.placement, s = n ? yt(n) : null, a = n ? Cr(n) : null, p = r.x + r.width / 2 - e.width / 2, v = r.y + r.height / 2 - e.height / 2, m; +__name(Zu, "Zu"); +u(Zu, "getClippingRect"); +function ta(t) { + var r = t.reference, e = t.element, n = t.placement, s = n ? yt(n) : null, a = n ? Tr(n) : null, p = r.x + r.width / 2 - e.width / 2, v = r.y + r.height / 2 - e.height / 2, m; switch (s) { case Qe: m = { x: p, y: r.y - e.height }; @@ -8813,14 +8794,14 @@ function na(t) { default: m = { x: r.x, y: r.y }; } - var d = s ? di(s) : null; + var d = s ? pi(s) : null; if (d != null) { var f = d === "y" ? "height" : "width"; switch (a) { - case un: + case sn: m[d] = m[d] - (r[f] / 2 - e[f] / 2); break; - case ui: + case li: m[d] = m[d] + (r[f] / 2 - e[f] / 2); break; default: @@ -8828,12 +8809,12 @@ function na(t) { } return m; } -__name(na, "na"); -u(na, "computeOffsets"); -function Rr(t, r) { +__name(ta, "ta"); +u(ta, "computeOffsets"); +function zr(t, r) { r === void 0 && (r = {}); - var e = r, n = e.placement, s = n === void 0 ? t.placement : n, a = e.boundary, p = a === void 0 ? qf : a, v = e.rootBoundary, m = v === void 0 ? Xs : v, d = e.elementContext, f = d === void 0 ? Qi : d, g = e.altBoundary, w = g === void 0 ? false : g, S = e.padding, T = S === void 0 ? 0 : S, C = ta(typeof T != "number" ? T : ra(T, kn)), R = f === Qi ? Ff : Qi, _ = t.rects.popper, L = t.elements[w ? R : f], $ = Qu($r(L) ? L : L.contextElement || Ct(t.elements.popper), p, m), A = Tr(t.elements.reference), ee = na({ reference: A, element: _, strategy: "absolute", placement: s }), z = to(Object.assign({}, _, ee)), H = f === Qi ? z : A, te = { top: $.top - H.top + C.top, bottom: H.bottom - $.bottom + C.bottom, left: $.left - H.left + C.left, right: H.right - $.right + C.right }, Q = t.modifiersData.offset; - if (f === Qi && Q) { + var e = r, n = e.placement, s = n === void 0 ? t.placement : n, a = e.boundary, p = a === void 0 ? jf : a, v = e.rootBoundary, m = v === void 0 ? Vs : v, d = e.elementContext, f = d === void 0 ? Ji : d, g = e.altBoundary, w = g === void 0 ? false : g, S = e.padding, T = S === void 0 ? 0 : S, C = Qo(typeof T != "number" ? T : ea(T, Dn)), R = f === Ji ? Hf : Ji, _ = t.rects.popper, L = t.elements[w ? R : f], B = Zu($r(L) ? L : L.contextElement || Ct(t.elements.popper), p, m), A = Sr(t.elements.reference), ee = ta({ reference: A, element: _, strategy: "absolute", placement: s }), z = eo(Object.assign({}, _, ee)), H = f === Ji ? z : A, te = { top: B.top - H.top + C.top, bottom: H.bottom - B.bottom + C.bottom, left: B.left - H.left + C.left, right: H.right - B.right + C.right }, Q = t.modifiersData.offset; + if (f === Ji && Q) { var ue = Q[s]; Object.keys(te).forEach(function(K) { var ie = [ct, mt].indexOf(K) >= 0 ? 1 : -1, q = [Qe, mt].indexOf(K) >= 0 ? "y" : "x"; @@ -8842,42 +8823,42 @@ function Rr(t, r) { } return te; } -__name(Rr, "Rr"); -u(Rr, "detectOverflow"); -function ec(t, r) { +__name(zr, "zr"); +u(zr, "detectOverflow"); +function Ku(t, r) { r === void 0 && (r = {}); - var e = r, n = e.placement, s = e.boundary, a = e.rootBoundary, p = e.padding, v = e.flipVariations, m = e.allowedAutoPlacements, d = m === void 0 ? Zs : m, f = Cr(n), g = f ? v ? Xu : Xu.filter(function(T) { - return Cr(T) === f; - }) : kn, w = g.filter(function(T) { + var e = r, n = e.placement, s = e.boundary, a = e.rootBoundary, p = e.padding, v = e.flipVariations, m = e.allowedAutoPlacements, d = m === void 0 ? Ys : m, f = Tr(n), g = f ? v ? Wu : Wu.filter(function(T) { + return Tr(T) === f; + }) : Dn, w = g.filter(function(T) { return d.indexOf(T) >= 0; }); w.length === 0 && (w = g); var S = w.reduce(function(T, C) { - return T[C] = Rr(t, { placement: C, boundary: s, rootBoundary: a, padding: p })[yt(C)], T; + return T[C] = zr(t, { placement: C, boundary: s, rootBoundary: a, padding: p })[yt(C)], T; }, {}); return Object.keys(S).sort(function(T, C) { return S[T] - S[C]; }); } -__name(ec, "ec"); -u(ec, "computeAutoPlacement"); -function Ay(t) { - if (yt(t) === Ys) +__name(Ku, "Ku"); +u(Ku, "computeAutoPlacement"); +function Cy(t) { + if (yt(t) === Ws) return []; - var r = eo(t); - return [Qs(t), r, Qs(r)]; + var r = Qi(t); + return [Ks(t), r, Ks(r)]; } -__name(Ay, "Ay"); -u(Ay, "getExpandedFallbackPlacements"); -function Py(t) { +__name(Cy, "Cy"); +u(Cy, "getExpandedFallbackPlacements"); +function Oy(t) { var r = t.state, e = t.options, n = t.name; if (!r.modifiersData[n]._skip) { - for (var s = e.mainAxis, a = s === void 0 ? true : s, p = e.altAxis, v = p === void 0 ? true : p, m = e.fallbackPlacements, d = e.padding, f = e.boundary, g = e.rootBoundary, w = e.altBoundary, S = e.flipVariations, T = S === void 0 ? true : S, C = e.allowedAutoPlacements, R = r.options.placement, _ = yt(R), L = _ === R, $ = m || (L || !T ? [eo(R)] : Ay(R)), A = [R].concat($).reduce(function(je, rt) { - return je.concat(yt(rt) === Ys ? ec(r, { placement: rt, boundary: f, rootBoundary: g, padding: d, flipVariations: T, allowedAutoPlacements: C }) : rt); + for (var s = e.mainAxis, a = s === void 0 ? true : s, p = e.altAxis, v = p === void 0 ? true : p, m = e.fallbackPlacements, d = e.padding, f = e.boundary, g = e.rootBoundary, w = e.altBoundary, S = e.flipVariations, T = S === void 0 ? true : S, C = e.allowedAutoPlacements, R = r.options.placement, _ = yt(R), L = _ === R, B = m || (L || !T ? [Qi(R)] : Cy(R)), A = [R].concat(B).reduce(function(je, rt) { + return je.concat(yt(rt) === Ws ? Ku(r, { placement: rt, boundary: f, rootBoundary: g, padding: d, flipVariations: T, allowedAutoPlacements: C }) : rt); }, []), ee = r.rects.reference, z = r.rects.popper, H = /* @__PURE__ */ new Map(), te = true, Q = A[0], ue = 0; ue < A.length; ue++) { - var K = A[ue], ie = yt(K), q = Cr(K) === un, oe = [Qe, mt].indexOf(ie) >= 0, tt = oe ? "width" : "height", Ze = Rr(r, { placement: K, boundary: f, rootBoundary: g, altBoundary: w, padding: d }), ze = oe ? q ? ct : it : q ? mt : Qe; - ee[tt] > z[tt] && (ze = eo(ze)); - var Ae = eo(ze), We = []; + var K = A[ue], ie = yt(K), q = Tr(K) === sn, oe = [Qe, mt].indexOf(ie) >= 0, tt = oe ? "width" : "height", Ze = zr(r, { placement: K, boundary: f, rootBoundary: g, altBoundary: w, padding: d }), ze = oe ? q ? ct : it : q ? mt : Qe; + ee[tt] > z[tt] && (ze = Qi(ze)); + var Ae = Qi(ze), We = []; if (a && We.push(Ze[ie] <= 0), v && We.push(Ze[ze] <= 0, Ze[Ae] <= 0), We.every(function(je) { return je; })) { @@ -8888,113 +8869,113 @@ function Py(t) { } if (te) for (var Je = T ? 3 : 1, Ye = u(function(rt) { - var vr = A.find(function(Ir) { - var gr = H.get(Ir); - if (gr) - return gr.slice(0, rt).every(function(sr) { - return sr; + var mr = A.find(function(Mr) { + var vr = H.get(Mr); + if (vr) + return vr.slice(0, rt).every(function(ar) { + return ar; }); }); - if (vr) - return Q = vr, "break"; + if (mr) + return Q = mr, "break"; }, "_loop"), J = Je; J > 0; J--) { - var ar = Ye(J); - if (ar === "break") + var or = Ye(J); + if (or === "break") break; } r.placement !== Q && (r.modifiersData[n]._skip = true, r.placement = Q, r.reset = true); } } -__name(Py, "Py"); -u(Py, "flip"); -var Qf = { name: "flip", enabled: true, phase: "main", fn: Py, requiresIfExists: ["offset"], data: { _skip: false } }; -function eh(t, r, e) { +__name(Oy, "Oy"); +u(Oy, "flip"); +var Xf = { name: "flip", enabled: true, phase: "main", fn: Oy, requiresIfExists: ["offset"], data: { _skip: false } }; +function Zf(t, r, e) { return e === void 0 && (e = { x: 0, y: 0 }), { top: t.top - r.height - e.y, right: t.right - r.width + e.x, bottom: t.bottom - r.height + e.y, left: t.left - r.width - e.x }; } -__name(eh, "eh"); -u(eh, "getSideOffsets"); -function th(t) { +__name(Zf, "Zf"); +u(Zf, "getSideOffsets"); +function Kf(t) { return [Qe, ct, mt, it].some(function(r) { return t[r] >= 0; }); } -__name(th, "th"); -u(th, "isAnySideFullyClipped"); -function zy(t) { - var r = t.state, e = t.name, n = r.rects.reference, s = r.rects.popper, a = r.modifiersData.preventOverflow, p = Rr(r, { elementContext: "reference" }), v = Rr(r, { altBoundary: true }), m = eh(p, n), d = eh(v, s, a), f = th(m), g = th(d); +__name(Kf, "Kf"); +u(Kf, "isAnySideFullyClipped"); +function My(t) { + var r = t.state, e = t.name, n = r.rects.reference, s = r.rects.popper, a = r.modifiersData.preventOverflow, p = zr(r, { elementContext: "reference" }), v = zr(r, { altBoundary: true }), m = Zf(p, n), d = Zf(v, s, a), f = Kf(m), g = Kf(d); r.modifiersData[e] = { referenceClippingOffsets: m, popperEscapeOffsets: d, isReferenceHidden: f, hasPopperEscaped: g }, r.attributes.popper = Object.assign({}, r.attributes.popper, { "data-popper-reference-hidden": f, "data-popper-escaped": g }); } -__name(zy, "zy"); -u(zy, "hide"); -var rh = { name: "hide", enabled: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: zy }; -function Ry(t, r, e) { +__name(My, "My"); +u(My, "hide"); +var Jf = { name: "hide", enabled: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: My }; +function Iy(t, r, e) { var n = yt(t), s = [it, Qe].indexOf(n) >= 0 ? -1 : 1, a = typeof e == "function" ? e(Object.assign({}, r, { placement: t })) : e, p = a[0], v = a[1]; return p = p || 0, v = (v || 0) * s, [it, ct].indexOf(n) >= 0 ? { x: v, y: p } : { x: p, y: v }; } -__name(Ry, "Ry"); -u(Ry, "distanceAndSkiddingToXY"); -function Dy(t) { - var r = t.state, e = t.options, n = t.name, s = e.offset, a = s === void 0 ? [0, 0] : s, p = Zs.reduce(function(f, g) { - return f[g] = Ry(g, r.rects, a), f; +__name(Iy, "Iy"); +u(Iy, "distanceAndSkiddingToXY"); +function Ay(t) { + var r = t.state, e = t.options, n = t.name, s = e.offset, a = s === void 0 ? [0, 0] : s, p = Ys.reduce(function(f, g) { + return f[g] = Iy(g, r.rects, a), f; }, {}), v = p[r.placement], m = v.x, d = v.y; r.modifiersData.popperOffsets != null && (r.modifiersData.popperOffsets.x += m, r.modifiersData.popperOffsets.y += d), r.modifiersData[n] = p; } -__name(Dy, "Dy"); -u(Dy, "offset"); -var nh = { name: "offset", enabled: true, phase: "main", requires: ["popperOffsets"], fn: Dy }; -function ky(t) { +__name(Ay, "Ay"); +u(Ay, "offset"); +var Qf = { name: "offset", enabled: true, phase: "main", requires: ["popperOffsets"], fn: Ay }; +function Py(t) { var r = t.state, e = t.name; - r.modifiersData[e] = na({ reference: r.rects.reference, element: r.rects.popper, strategy: "absolute", placement: r.placement }); + r.modifiersData[e] = ta({ reference: r.rects.reference, element: r.rects.popper, strategy: "absolute", placement: r.placement }); } -__name(ky, "ky"); -u(ky, "popperOffsets"); -var ih = { name: "popperOffsets", enabled: true, phase: "read", fn: ky, data: {} }; -function tc(t) { +__name(Py, "Py"); +u(Py, "popperOffsets"); +var eh = { name: "popperOffsets", enabled: true, phase: "read", fn: Py, data: {} }; +function Ju(t) { return t === "x" ? "y" : "x"; } -__name(tc, "tc"); -u(tc, "getAltAxis"); -function Ny(t) { - var r = t.state, e = t.options, n = t.name, s = e.mainAxis, a = s === void 0 ? true : s, p = e.altAxis, v = p === void 0 ? false : p, m = e.boundary, d = e.rootBoundary, f = e.altBoundary, g = e.padding, w = e.tether, S = w === void 0 ? true : w, T = e.tetherOffset, C = T === void 0 ? 0 : T, R = Rr(r, { boundary: m, rootBoundary: d, padding: g, altBoundary: f }), _ = yt(r.placement), L = Cr(r.placement), $ = !L, A = di(_), ee = tc(A), z = r.modifiersData.popperOffsets, H = r.rects.reference, te = r.rects.popper, Q = typeof C == "function" ? C(Object.assign({}, r.rects, { placement: r.placement })) : C, ue = typeof Q == "number" ? { mainAxis: Q, altAxis: Q } : Object.assign({ mainAxis: 0, altAxis: 0 }, Q), K = r.modifiersData.offset ? r.modifiersData.offset[r.placement] : null, ie = { x: 0, y: 0 }; +__name(Ju, "Ju"); +u(Ju, "getAltAxis"); +function zy(t) { + var r = t.state, e = t.options, n = t.name, s = e.mainAxis, a = s === void 0 ? true : s, p = e.altAxis, v = p === void 0 ? false : p, m = e.boundary, d = e.rootBoundary, f = e.altBoundary, g = e.padding, w = e.tether, S = w === void 0 ? true : w, T = e.tetherOffset, C = T === void 0 ? 0 : T, R = zr(r, { boundary: m, rootBoundary: d, padding: g, altBoundary: f }), _ = yt(r.placement), L = Tr(r.placement), B = !L, A = pi(_), ee = Ju(A), z = r.modifiersData.popperOffsets, H = r.rects.reference, te = r.rects.popper, Q = typeof C == "function" ? C(Object.assign({}, r.rects, { placement: r.placement })) : C, ue = typeof Q == "number" ? { mainAxis: Q, altAxis: Q } : Object.assign({ mainAxis: 0, altAxis: 0 }, Q), K = r.modifiersData.offset ? r.modifiersData.offset[r.placement] : null, ie = { x: 0, y: 0 }; if (z) { if (a) { - var q, oe = A === "y" ? Qe : it, tt = A === "y" ? mt : ct, Ze = A === "y" ? "height" : "width", ze = z[A], Ae = ze + R[oe], We = ze - R[tt], Je = S ? -te[Ze] / 2 : 0, Ye = L === un ? H[Ze] : te[Ze], J = L === un ? -te[Ze] : -H[Ze], ar = r.elements.arrow, je = S && ar ? pi(ar) : { width: 0, height: 0 }, rt = r.modifiersData["arrow#persistent"] ? r.modifiersData["arrow#persistent"].padding : ea(), vr = rt[oe], Ir = rt[tt], gr = fi(0, H[Ze], je[Ze]), sr = $ ? H[Ze] / 2 - Je - gr - vr - ue.mainAxis : Ye - gr - vr - ue.mainAxis, _r = $ ? -H[Ze] / 2 + Je + gr + Ir + ue.mainAxis : J + gr + Ir + ue.mainAxis, Yr = r.elements.arrow && zr(r.elements.arrow), Ln = Yr ? A === "y" ? Yr.clientTop || 0 : Yr.clientLeft || 0 : 0, Pe = (q = K == null ? void 0 : K[A]) != null ? q : 0, Gn = ze + sr - Pe - Ln, jn = ze + _r - Pe, _t = fi(S ? ci(Ae, Gn) : Ae, ze, S ? Pr(We, jn) : We); - z[A] = _t, ie[A] = _t - ze; + var q, oe = A === "y" ? Qe : it, tt = A === "y" ? mt : ct, Ze = A === "y" ? "height" : "width", ze = z[A], Ae = ze + R[oe], We = ze - R[tt], Je = S ? -te[Ze] / 2 : 0, Ye = L === sn ? H[Ze] : te[Ze], J = L === sn ? -te[Ze] : -H[Ze], or = r.elements.arrow, je = S && or ? ci(or) : { width: 0, height: 0 }, rt = r.modifiersData["arrow#persistent"] ? r.modifiersData["arrow#persistent"].padding : Jo(), mr = rt[oe], Mr = rt[tt], vr = di(0, H[Ze], je[Ze]), ar = B ? H[Ze] / 2 - Je - vr - mr - ue.mainAxis : Ye - vr - mr - ue.mainAxis, Nr = B ? -H[Ze] / 2 + Je + vr + Mr + ue.mainAxis : J + vr + Mr + ue.mainAxis, Vr = r.elements.arrow && Pr(r.elements.arrow), _n = Vr ? A === "y" ? Vr.clientTop || 0 : Vr.clientLeft || 0 : 0, Pe = (q = K == null ? void 0 : K[A]) != null ? q : 0, Ln = ze + ar - Pe - _n, Gn = ze + Nr - Pe, Nt = di(S ? ui(Ae, Ln) : Ae, ze, S ? Ar(We, Gn) : We); + z[A] = Nt, ie[A] = Nt - ze; } if (v) { - var Xr, xi = A === "x" ? Qe : it, mn = A === "x" ? mt : ct, Ar = z[ee], Mt = ee === "y" ? "height" : "width", Lr = Ar + R[xi], er = Ar - R[mn], Hn = [Qe, it].indexOf(_) !== -1, Zr = (Xr = K == null ? void 0 : K[ee]) != null ? Xr : 0, Bn = Hn ? Lr : Ar - H[Mt] - te[Mt] - Zr + ue.altAxis, vn = Hn ? Ar + H[Mt] + te[Mt] - Zr - ue.altAxis : er, $n = S && Hn ? Vf(Bn, Ar, vn) : fi(S ? Bn : Lr, Ar, S ? vn : er); - z[ee] = $n, ie[ee] = $n - Ar; + var Yr, wi = A === "x" ? Qe : it, fn = A === "x" ? mt : ct, Ir = z[ee], Mt = ee === "y" ? "height" : "width", _r = Ir + R[wi], Jt = Ir - R[fn], jn = [Qe, it].indexOf(_) !== -1, Xr = (Yr = K == null ? void 0 : K[ee]) != null ? Yr : 0, Hn = jn ? _r : Ir - H[Mt] - te[Mt] - Xr + ue.altAxis, hn = jn ? Ir + H[Mt] + te[Mt] - Xr - ue.altAxis : Jt, $n = S && jn ? qf(Hn, Ir, hn) : di(S ? Hn : _r, Ir, S ? hn : Jt); + z[ee] = $n, ie[ee] = $n - Ir; } r.modifiersData[n] = ie; } } -__name(Ny, "Ny"); -u(Ny, "preventOverflow"); -var oh = { name: "preventOverflow", enabled: true, phase: "main", fn: Ny, requiresIfExists: ["offset"] }; -function rc(t) { +__name(zy, "zy"); +u(zy, "preventOverflow"); +var th = { name: "preventOverflow", enabled: true, phase: "main", fn: zy, requiresIfExists: ["offset"] }; +function Qu(t) { return { scrollLeft: t.scrollLeft, scrollTop: t.scrollTop }; } -__name(rc, "rc"); -u(rc, "getHTMLElementScroll"); -function nc(t) { - return t === ot(t) || !vt(t) ? hi(t) : rc(t); +__name(Qu, "Qu"); +u(Qu, "getHTMLElementScroll"); +function ec(t) { + return t === ot(t) || !vt(t) ? fi(t) : Qu(t); } -__name(nc, "nc"); -u(nc, "getNodeScroll"); -function _y(t) { - var r = t.getBoundingClientRect(), e = cn(r.width) / t.offsetWidth || 1, n = cn(r.height) / t.offsetHeight || 1; +__name(ec, "ec"); +u(ec, "getNodeScroll"); +function Ry(t) { + var r = t.getBoundingClientRect(), e = ln(r.width) / t.offsetWidth || 1, n = ln(r.height) / t.offsetHeight || 1; return e !== 1 || n !== 1; } -__name(_y, "_y"); -u(_y, "isElementScaled"); -function ic(t, r, e) { +__name(Ry, "Ry"); +u(Ry, "isElementScaled"); +function tc(t, r, e) { e === void 0 && (e = false); - var n = vt(r), s = vt(r) && _y(r), a = Ct(r), p = Tr(t, s), v = { scrollLeft: 0, scrollTop: 0 }, m = { x: 0, y: 0 }; - return (n || !n && !e) && ((bt(r) !== "body" || vi(a)) && (v = nc(r)), vt(r) ? (m = Tr(r, true), m.x += r.clientLeft, m.y += r.clientTop) : a && (m.x = mi(a))), { x: p.left + v.scrollLeft - m.x, y: p.top + v.scrollTop - m.y, width: p.width, height: p.height }; + var n = vt(r), s = vt(r) && Ry(r), a = Ct(r), p = Sr(t, s), v = { scrollLeft: 0, scrollTop: 0 }, m = { x: 0, y: 0 }; + return (n || !n && !e) && ((bt(r) !== "body" || mi(a)) && (v = ec(r)), vt(r) ? (m = Sr(r, true), m.x += r.clientLeft, m.y += r.clientTop) : a && (m.x = hi(a))), { x: p.left + v.scrollLeft - m.x, y: p.top + v.scrollTop - m.y, width: p.width, height: p.height }; } -__name(ic, "ic"); -u(ic, "getCompositeRect"); -function Ly(t) { +__name(tc, "tc"); +u(tc, "getCompositeRect"); +function Dy(t) { var r = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Set(), n = []; t.forEach(function(a) { r.set(a.name, a); @@ -9014,19 +8995,19 @@ function Ly(t) { e.has(a.name) || s(a); }), n; } -__name(Ly, "Ly"); -u(Ly, "order"); -function oc(t) { - var r = Ly(t); - return Uf.reduce(function(e, n) { +__name(Dy, "Dy"); +u(Dy, "order"); +function rc(t) { + var r = Dy(t); + return $f.reduce(function(e, n) { return e.concat(r.filter(function(s) { return s.phase === n; })); }, []); } -__name(oc, "oc"); -u(oc, "orderModifiers"); -function ac(t) { +__name(rc, "rc"); +u(rc, "orderModifiers"); +function nc(t) { var r; return function() { return r || (r = new Promise(function(e) { @@ -9036,9 +9017,9 @@ function ac(t) { })), r; }; } -__name(ac, "ac"); -u(ac, "debounce"); -function sc(t) { +__name(nc, "nc"); +u(nc, "debounce"); +function ic(t) { var r = t.reduce(function(e, n) { var s = e[n.name]; return e[n.name] = s ? Object.assign({}, s, n, { options: Object.assign({}, s.options, n.options), data: Object.assign({}, s.data, n.data) }) : n, e; @@ -9047,28 +9028,28 @@ function sc(t) { return r[e]; }); } -__name(sc, "sc"); -u(sc, "mergeByName"); -var ah = { placement: "bottom", modifiers: [], strategy: "absolute" }; -function sh() { +__name(ic, "ic"); +u(ic, "mergeByName"); +var rh = { placement: "bottom", modifiers: [], strategy: "absolute" }; +function nh() { for (var t = arguments.length, r = new Array(t), e = 0; e < t; e++) r[e] = arguments[e]; return !r.some(function(n) { return !(n && typeof n.getBoundingClientRect == "function"); }); } -__name(sh, "sh"); -u(sh, "areValidElements"); -function lh(t) { +__name(nh, "nh"); +u(nh, "areValidElements"); +function ih(t) { t === void 0 && (t = {}); - var r = t, e = r.defaultModifiers, n = e === void 0 ? [] : e, s = r.defaultOptions, a = s === void 0 ? ah : s; + var r = t, e = r.defaultModifiers, n = e === void 0 ? [] : e, s = r.defaultOptions, a = s === void 0 ? rh : s; return u(function(v, m, d) { d === void 0 && (d = a); - var f = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, ah, a), modifiersData: {}, elements: { reference: v, popper: m }, attributes: {}, styles: {} }, g = [], w = false, S = { state: f, setOptions: u(function(_) { + var f = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, rh, a), modifiersData: {}, elements: { reference: v, popper: m }, attributes: {}, styles: {} }, g = [], w = false, S = { state: f, setOptions: u(function(_) { var L = typeof _ == "function" ? _(f.options) : _; - C(), f.options = Object.assign({}, a, f.options, L), f.scrollParents = { reference: $r(v) ? Nn(v) : v.contextElement ? Nn(v.contextElement) : [], popper: Nn(m) }; - var $ = oc(sc([].concat(n, f.options.modifiers))); - if (f.orderedModifiers = $.filter(function(K) { + C(), f.options = Object.assign({}, a, f.options, L), f.scrollParents = { reference: $r(v) ? kn(v) : v.contextElement ? kn(v.contextElement) : [], popper: kn(m) }; + var B = rc(ic([].concat(n, f.options.modifiers))); + if (f.orderedModifiers = B.filter(function(K) { return K.enabled; }), false) { var A; @@ -9079,9 +9060,9 @@ function lh(t) { return T(), S.update(); }, "setOptions"), forceUpdate: u(function() { if (!w) { - var _ = f.elements, L = _.reference, $ = _.popper; - if (sh(L, $)) { - f.rects = { reference: ic(L, zr($), f.options.strategy === "fixed"), popper: pi($) }, f.reset = false, f.placement = f.options.placement, f.orderedModifiers.forEach(function(K) { + var _ = f.elements, L = _.reference, B = _.popper; + if (nh(L, B)) { + f.rects = { reference: tc(L, Pr(B), f.options.strategy === "fixed"), popper: ci(B) }, f.reset = false, f.placement = f.options.placement, f.orderedModifiers.forEach(function(K) { return f.modifiersData[K.name] = Object.assign({}, K.data); }); for (var A = 0, ee = 0; ee < f.orderedModifiers.length; ee++) { @@ -9094,23 +9075,23 @@ function lh(t) { } } } - }, "forceUpdate"), update: ac(function() { + }, "forceUpdate"), update: nc(function() { return new Promise(function(R) { S.forceUpdate(), R(f); }); }), destroy: u(function() { C(), w = true; }, "destroy") }; - if (!sh(v, m)) + if (!nh(v, m)) return S; S.setOptions(d).then(function(R) { !w && d.onFirstUpdate && d.onFirstUpdate(R); }); function T() { f.orderedModifiers.forEach(function(R) { - var _ = R.name, L = R.options, $ = L === void 0 ? {} : L, A = R.effect; + var _ = R.name, L = R.options, B = L === void 0 ? {} : L, A = R.effect; if (typeof A == "function") { - var ee = A({ state: f, name: _, instance: S, options: $ }), z = u(function() { + var ee = A({ state: f, name: _, instance: S, options: B }), z = u(function() { }, "noopFn"); g.push(ee || z); } @@ -9127,40 +9108,40 @@ function lh(t) { return u(C, "cleanupModifierEffects"), S; }, "createPopper"); } -__name(lh, "lh"); -u(lh, "popperGenerator"); -var Gy = [Kf, ih, Zf, Jo, nh, Qf, oh, Yf, rh]; -var lc = lh({ defaultModifiers: Gy }); -var jy = "tippy-box"; -var bh = "tippy-content"; -var Hy = "tippy-backdrop"; -var yh = "tippy-arrow"; -var wh = "tippy-svg-arrow"; -var gi = { passive: true, capture: true }; -var xh = u(function() { +__name(ih, "ih"); +u(ih, "popperGenerator"); +var ky = [Vf, eh, Wf, Zo, Qf, Xf, th, Ff, Jf]; +var oc = ih({ defaultModifiers: ky }); +var Ny = "tippy-box"; +var hh = "tippy-content"; +var _y = "tippy-backdrop"; +var mh = "tippy-arrow"; +var vh = "tippy-svg-arrow"; +var vi = { passive: true, capture: true }; +var gh = u(function() { return document.body; }, "TIPPY_DEFAULT_APPEND_TO"); -function uc(t, r, e) { +function ac(t, r, e) { if (Array.isArray(t)) { var n = t[r]; return n == null ? Array.isArray(e) ? e[r] : e : n; } return t; } -__name(uc, "uc"); -u(uc, "getValueAtIndexOrReturn"); -function mc(t, r) { +__name(ac, "ac"); +u(ac, "getValueAtIndexOrReturn"); +function dc(t, r) { var e = {}.toString.call(t); return e.indexOf("[object") === 0 && e.indexOf(r + "]") > -1; } -__name(mc, "mc"); -u(mc, "isType"); -function Eh(t, r) { +__name(dc, "dc"); +u(dc, "isType"); +function bh(t, r) { return typeof t == "function" ? t.apply(void 0, r) : t; } -__name(Eh, "Eh"); -u(Eh, "invokeWithArgsOrReturn"); -function uh(t, r) { +__name(bh, "bh"); +u(bh, "invokeWithArgsOrReturn"); +function oh(t, r) { if (r === 0) return t; var e; @@ -9170,120 +9151,120 @@ function uh(t, r) { }, r); }; } -__name(uh, "uh"); -u(uh, "debounce"); -function By(t) { +__name(oh, "oh"); +u(oh, "debounce"); +function Ly(t) { return t.split(/\s+/).filter(Boolean); } -__name(By, "By"); -u(By, "splitBySpaces"); -function ro(t) { +__name(Ly, "Ly"); +u(Ly, "splitBySpaces"); +function to(t) { return [].concat(t); } -__name(ro, "ro"); -u(ro, "normalizeToArray"); -function ch(t, r) { +__name(to, "to"); +u(to, "normalizeToArray"); +function ah(t, r) { t.indexOf(r) === -1 && t.push(r); } -__name(ch, "ch"); -u(ch, "pushIfUnique"); -function $y(t) { +__name(ah, "ah"); +u(ah, "pushIfUnique"); +function Gy(t) { return t.filter(function(r, e) { return t.indexOf(r) === e; }); } -__name($y, "$y"); -u($y, "unique"); -function qy(t) { +__name(Gy, "Gy"); +u(Gy, "unique"); +function jy(t) { return t.split("-")[0]; } -__name(qy, "qy"); -u(qy, "getBasePlacement"); -function rl(t) { +__name(jy, "jy"); +u(jy, "getBasePlacement"); +function el(t) { return [].slice.call(t); } -__name(rl, "rl"); -u(rl, "arrayFrom"); -function ph(t) { +__name(el, "el"); +u(el, "arrayFrom"); +function sh(t) { return Object.keys(t).reduce(function(r, e) { return t[e] !== void 0 && (r[e] = t[e]), r; }, {}); } -__name(ph, "ph"); -u(ph, "removeUndefinedProps"); -function ia() { +__name(sh, "sh"); +u(sh, "removeUndefinedProps"); +function ra() { return document.createElement("div"); } -__name(ia, "ia"); -u(ia, "div"); -function nl(t) { +__name(ra, "ra"); +u(ra, "div"); +function tl(t) { return ["Element", "Fragment"].some(function(r) { - return mc(t, r); + return dc(t, r); }); } -__name(nl, "nl"); -u(nl, "isElement"); -function Fy(t) { - return mc(t, "NodeList"); +__name(tl, "tl"); +u(tl, "isElement"); +function Hy(t) { + return dc(t, "NodeList"); } -__name(Fy, "Fy"); -u(Fy, "isNodeList"); -function Uy(t) { - return mc(t, "MouseEvent"); +__name(Hy, "Hy"); +u(Hy, "isNodeList"); +function $y(t) { + return dc(t, "MouseEvent"); } -__name(Uy, "Uy"); -u(Uy, "isMouseEvent"); -function Wy(t) { +__name($y, "$y"); +u($y, "isMouseEvent"); +function By(t) { return !!(t && t._tippy && t._tippy.reference === t); } -__name(Wy, "Wy"); -u(Wy, "isReferenceElement"); -function Vy(t) { - return nl(t) ? [t] : Fy(t) ? rl(t) : Array.isArray(t) ? t : rl(document.querySelectorAll(t)); +__name(By, "By"); +u(By, "isReferenceElement"); +function qy(t) { + return tl(t) ? [t] : Hy(t) ? el(t) : Array.isArray(t) ? t : el(document.querySelectorAll(t)); } -__name(Vy, "Vy"); -u(Vy, "getArrayOfElements"); -function cc(t, r) { +__name(qy, "qy"); +u(qy, "getArrayOfElements"); +function sc(t, r) { t.forEach(function(e) { e && (e.style.transitionDuration = r + "ms"); }); } -__name(cc, "cc"); -u(cc, "setTransitionDuration"); -function dh(t, r) { +__name(sc, "sc"); +u(sc, "setTransitionDuration"); +function lh(t, r) { t.forEach(function(e) { e && e.setAttribute("data-state", r); }); } -__name(dh, "dh"); -u(dh, "setVisibilityState"); -function Yy(t) { - var r, e = ro(t), n = e[0]; +__name(lh, "lh"); +u(lh, "setVisibilityState"); +function Fy(t) { + var r, e = to(t), n = e[0]; return n != null && (r = n.ownerDocument) != null && r.body ? n.ownerDocument : document; } -__name(Yy, "Yy"); -u(Yy, "getOwnerDocument"); -function Xy(t, r) { +__name(Fy, "Fy"); +u(Fy, "getOwnerDocument"); +function Uy(t, r) { var e = r.clientX, n = r.clientY; return t.every(function(s) { - var a = s.popperRect, p = s.popperState, v = s.props, m = v.interactiveBorder, d = qy(p.placement), f = p.modifiersData.offset; + var a = s.popperRect, p = s.popperState, v = s.props, m = v.interactiveBorder, d = jy(p.placement), f = p.modifiersData.offset; if (!f) return true; var g = d === "bottom" ? f.top.y : 0, w = d === "top" ? f.bottom.y : 0, S = d === "right" ? f.left.x : 0, T = d === "left" ? f.right.x : 0, C = a.top - n + g > m, R = n - a.bottom - w > m, _ = a.left - e + S > m, L = e - a.right - T > m; return C || R || _ || L; }); } -__name(Xy, "Xy"); -u(Xy, "isCursorOutsideInteractiveBorder"); -function pc(t, r, e) { +__name(Uy, "Uy"); +u(Uy, "isCursorOutsideInteractiveBorder"); +function lc(t, r, e) { var n = r + "EventListener"; ["transitionend", "webkitTransitionEnd"].forEach(function(s) { t[n](s, e); }); } -__name(pc, "pc"); -u(pc, "updateTransitionEndListener"); -function fh(t, r) { +__name(lc, "lc"); +u(lc, "updateTransitionEndListener"); +function uh(t, r) { for (var e = r; e; ) { var n; if (t.contains(e)) @@ -9292,40 +9273,40 @@ function fh(t, r) { } return false; } -__name(fh, "fh"); -u(fh, "actualContains"); -var qr = { isTouch: false }; -var hh = 0; -function Zy() { - qr.isTouch || (qr.isTouch = true, window.performance && document.addEventListener("mousemove", Sh)); -} -__name(Zy, "Zy"); -u(Zy, "onDocumentTouchStart"); -function Sh() { +__name(uh, "uh"); +u(uh, "actualContains"); +var Br = { isTouch: false }; +var ch = 0; +function Wy() { + Br.isTouch || (Br.isTouch = true, window.performance && document.addEventListener("mousemove", yh)); +} +__name(Wy, "Wy"); +u(Wy, "onDocumentTouchStart"); +function yh() { var t = performance.now(); - t - hh < 20 && (qr.isTouch = false, document.removeEventListener("mousemove", Sh)), hh = t; + t - ch < 20 && (Br.isTouch = false, document.removeEventListener("mousemove", yh)), ch = t; } -__name(Sh, "Sh"); -u(Sh, "onDocumentMouseMove"); -function Ky() { +__name(yh, "yh"); +u(yh, "onDocumentMouseMove"); +function Vy() { var t = document.activeElement; - if (Wy(t)) { + if (By(t)) { var r = t._tippy; t.blur && !r.state.isVisible && t.blur(); } } -__name(Ky, "Ky"); -u(Ky, "onWindowBlur"); -function Jy() { - document.addEventListener("touchstart", Zy, gi), window.addEventListener("blur", Ky); +__name(Vy, "Vy"); +u(Vy, "onWindowBlur"); +function Yy() { + document.addEventListener("touchstart", Wy, vi), window.addEventListener("blur", Vy); } -__name(Jy, "Jy"); -u(Jy, "bindGlobalEventListeners"); -var Qy = typeof window != "undefined" && typeof document != "undefined"; -var e0 = Qy ? !!window.msCrypto : false; -var t0 = { animateFill: false, followCursor: false, inlinePositioning: false, sticky: false }; -var r0 = { allowHTML: false, animation: "fade", arrow: true, content: "", inertia: false, maxWidth: 350, role: "tooltip", theme: "", zIndex: 9999 }; -var Dr = Object.assign({ appendTo: xh, aria: { content: "auto", expanded: "auto" }, delay: 0, duration: [300, 250], getReferenceClientRect: null, hideOnClick: true, ignoreAttributes: false, interactive: false, interactiveBorder: 2, interactiveDebounce: 0, moveTransition: "", offset: [0, 10], onAfterUpdate: u(function() { +__name(Yy, "Yy"); +u(Yy, "bindGlobalEventListeners"); +var Xy = typeof window != "undefined" && typeof document != "undefined"; +var Zy = Xy ? !!window.msCrypto : false; +var Ky = { animateFill: false, followCursor: false, inlinePositioning: false, sticky: false }; +var Jy = { allowHTML: false, animation: "fade", arrow: true, content: "", inertia: false, maxWidth: 350, role: "tooltip", theme: "", zIndex: 9999 }; +var Rr = Object.assign({ appendTo: gh, aria: { content: "auto", expanded: "auto" }, delay: 0, duration: [300, 250], getReferenceClientRect: null, hideOnClick: true, ignoreAttributes: false, interactive: false, interactiveBorder: 2, interactiveDebounce: 0, moveTransition: "", offset: [0, 10], onAfterUpdate: u(function() { }, "onAfterUpdate"), onBeforeUpdate: u(function() { }, "onBeforeUpdate"), onCreate: u(function() { }, "onCreate"), onDestroy: u(function() { @@ -9337,29 +9318,29 @@ var Dr = Object.assign({ appendTo: xh, aria: { content: "auto", expanded: "auto" }, "onShown"), onTrigger: u(function() { }, "onTrigger"), onUntrigger: u(function() { }, "onUntrigger"), onClickOutside: u(function() { -}, "onClickOutside"), placement: "top", plugins: [], popperOptions: {}, render: null, showOnCreate: false, touch: true, trigger: "mouseenter focus", triggerTarget: null }, t0, r0); -var n0 = Object.keys(Dr); -var i0 = u(function(r) { +}, "onClickOutside"), placement: "top", plugins: [], popperOptions: {}, render: null, showOnCreate: false, touch: true, trigger: "mouseenter focus", triggerTarget: null }, Ky, Jy); +var Qy = Object.keys(Rr); +var e0 = u(function(r) { var e = Object.keys(r); e.forEach(function(n) { - Dr[n] = r[n]; + Rr[n] = r[n]; }); }, "setDefaultProps"); -function Th(t) { +function wh(t) { var r = t.plugins || [], e = r.reduce(function(n, s) { var a = s.name, p = s.defaultValue; if (a) { var v; - n[a] = t[a] !== void 0 ? t[a] : (v = Dr[a]) != null ? v : p; + n[a] = t[a] !== void 0 ? t[a] : (v = Rr[a]) != null ? v : p; } return n; }, {}); return Object.assign({}, t, e); } -__name(Th, "Th"); -u(Th, "getExtendedPassedProps"); -function o0(t, r) { - var e = r ? Object.keys(Th(Object.assign({}, Dr, { plugins: r }))) : n0, n = e.reduce(function(s, a) { +__name(wh, "wh"); +u(wh, "getExtendedPassedProps"); +function t0(t, r) { + var e = r ? Object.keys(wh(Object.assign({}, Rr, { plugins: r }))) : Qy, n = e.reduce(function(s, a) { var p = (t.getAttribute("data-tippy-" + a) || "").trim(); if (!p) return s; @@ -9375,65 +9356,65 @@ function o0(t, r) { }, {}); return n; } -__name(o0, "o0"); -u(o0, "getDataAttributeProps"); -function mh(t, r) { - var e = Object.assign({}, r, { content: Eh(r.content, [t]) }, r.ignoreAttributes ? {} : o0(t, r.plugins)); - return e.aria = Object.assign({}, Dr.aria, e.aria), e.aria = { expanded: e.aria.expanded === "auto" ? r.interactive : e.aria.expanded, content: e.aria.content === "auto" ? r.interactive ? null : "describedby" : e.aria.content }, e; +__name(t0, "t0"); +u(t0, "getDataAttributeProps"); +function ph(t, r) { + var e = Object.assign({}, r, { content: bh(r.content, [t]) }, r.ignoreAttributes ? {} : t0(t, r.plugins)); + return e.aria = Object.assign({}, Rr.aria, e.aria), e.aria = { expanded: e.aria.expanded === "auto" ? r.interactive : e.aria.expanded, content: e.aria.content === "auto" ? r.interactive ? null : "describedby" : e.aria.content }, e; } -__name(mh, "mh"); -u(mh, "evaluateProps"); -var a0 = u(function() { +__name(ph, "ph"); +u(ph, "evaluateProps"); +var r0 = u(function() { return "innerHTML"; }, "innerHTML"); -function fc(t, r) { - t[a0()] = r; -} -__name(fc, "fc"); -u(fc, "dangerouslySetInnerHTML"); -function vh(t) { - var r = ia(); - return t === true ? r.className = yh : (r.className = wh, nl(t) ? r.appendChild(t) : fc(r, t)), r; -} -__name(vh, "vh"); -u(vh, "createArrowElement"); -function gh(t, r) { - nl(r.content) ? (fc(t, ""), t.appendChild(r.content)) : typeof r.content != "function" && (r.allowHTML ? fc(t, r.content) : t.textContent = r.content); -} -__name(gh, "gh"); -u(gh, "setContent"); -function hc(t) { - var r = t.firstElementChild, e = rl(r.children); +function cc(t, r) { + t[r0()] = r; +} +__name(cc, "cc"); +u(cc, "dangerouslySetInnerHTML"); +function dh(t) { + var r = ra(); + return t === true ? r.className = mh : (r.className = vh, tl(t) ? r.appendChild(t) : cc(r, t)), r; +} +__name(dh, "dh"); +u(dh, "createArrowElement"); +function fh(t, r) { + tl(r.content) ? (cc(t, ""), t.appendChild(r.content)) : typeof r.content != "function" && (r.allowHTML ? cc(t, r.content) : t.textContent = r.content); +} +__name(fh, "fh"); +u(fh, "setContent"); +function pc(t) { + var r = t.firstElementChild, e = el(r.children); return { box: r, content: e.find(function(n) { - return n.classList.contains(bh); + return n.classList.contains(hh); }), arrow: e.find(function(n) { - return n.classList.contains(yh) || n.classList.contains(wh); + return n.classList.contains(mh) || n.classList.contains(vh); }), backdrop: e.find(function(n) { - return n.classList.contains(Hy); + return n.classList.contains(_y); }) }; } -__name(hc, "hc"); -u(hc, "getChildren"); -function Ch(t) { - var r = ia(), e = ia(); - e.className = jy, e.setAttribute("data-state", "hidden"), e.setAttribute("tabindex", "-1"); - var n = ia(); - n.className = bh, n.setAttribute("data-state", "hidden"), gh(n, t.props), r.appendChild(e), e.appendChild(n), s(t.props, t.props); +__name(pc, "pc"); +u(pc, "getChildren"); +function xh(t) { + var r = ra(), e = ra(); + e.className = Ny, e.setAttribute("data-state", "hidden"), e.setAttribute("tabindex", "-1"); + var n = ra(); + n.className = hh, n.setAttribute("data-state", "hidden"), fh(n, t.props), r.appendChild(e), e.appendChild(n), s(t.props, t.props); function s(a, p) { - var v = hc(r), m = v.box, d = v.content, f = v.arrow; - p.theme ? m.setAttribute("data-theme", p.theme) : m.removeAttribute("data-theme"), typeof p.animation == "string" ? m.setAttribute("data-animation", p.animation) : m.removeAttribute("data-animation"), p.inertia ? m.setAttribute("data-inertia", "") : m.removeAttribute("data-inertia"), m.style.maxWidth = typeof p.maxWidth == "number" ? p.maxWidth + "px" : p.maxWidth, p.role ? m.setAttribute("role", p.role) : m.removeAttribute("role"), (a.content !== p.content || a.allowHTML !== p.allowHTML) && gh(d, t.props), p.arrow ? f ? a.arrow !== p.arrow && (m.removeChild(f), m.appendChild(vh(p.arrow))) : m.appendChild(vh(p.arrow)) : f && m.removeChild(f); + var v = pc(r), m = v.box, d = v.content, f = v.arrow; + p.theme ? m.setAttribute("data-theme", p.theme) : m.removeAttribute("data-theme"), typeof p.animation == "string" ? m.setAttribute("data-animation", p.animation) : m.removeAttribute("data-animation"), p.inertia ? m.setAttribute("data-inertia", "") : m.removeAttribute("data-inertia"), m.style.maxWidth = typeof p.maxWidth == "number" ? p.maxWidth + "px" : p.maxWidth, p.role ? m.setAttribute("role", p.role) : m.removeAttribute("role"), (a.content !== p.content || a.allowHTML !== p.allowHTML) && fh(d, t.props), p.arrow ? f ? a.arrow !== p.arrow && (m.removeChild(f), m.appendChild(dh(p.arrow))) : m.appendChild(dh(p.arrow)) : f && m.removeChild(f); } __name(s, "s"); return u(s, "onUpdate"), { popper: r, onUpdate: s }; } -__name(Ch, "Ch"); -u(Ch, "render"); -Ch.$$tippy = true; -var s0 = 1; -var tl = []; -var dc = []; -function l0(t, r) { - var e = mh(t, Object.assign({}, Dr, Th(ph(r)))), n, s, a, p = false, v = false, m = false, d = false, f, g, w, S = [], T = uh(Gn, e.interactiveDebounce), C, R = s0++, _ = null, L = $y(e.plugins), $ = { isEnabled: true, isVisible: false, isDestroyed: false, isMounted: false, isShown: false }, A = { id: R, reference: t, popper: ia(), popperInstance: _, props: e, state: $, plugins: L, clearDelayTimeouts: Bn, setProps: vn, setContent: $n, show: ao, hide: so, hideWithInteractivity: ya, enable: Hn, disable: Zr, unmount: wa, destroy: yl }; +__name(xh, "xh"); +u(xh, "render"); +xh.$$tippy = true; +var n0 = 1; +var Qs = []; +var uc = []; +function i0(t, r) { + var e = ph(t, Object.assign({}, Rr, wh(sh(r)))), n, s, a, p = false, v = false, m = false, d = false, f, g, w, S = [], T = oh(Ln, e.interactiveDebounce), C, R = n0++, _ = null, L = Gy(e.plugins), B = { isEnabled: true, isVisible: false, isDestroyed: false, isMounted: false, isShown: false }, A = { id: R, reference: t, popper: ra(), popperInstance: _, props: e, state: B, plugins: L, clearDelayTimeouts: Hn, setProps: hn, setContent: $n, show: oo, hide: ao, hideWithInteractivity: ga, enable: jn, disable: Xr, unmount: ba, destroy: gl }; if (!e.render) return A; var ee = e.render(A), z = ee.popper, H = ee.onUpdate; @@ -9441,7 +9422,7 @@ function l0(t, r) { var te = L.map(function(G) { return G.fn(A); }), Q = t.hasAttribute("aria-expanded"); - return Yr(), Je(), ze(), Ae("onCreate", [A]), e.showOnCreate && Lr(), z.addEventListener("mouseenter", function() { + return Vr(), Je(), ze(), Ae("onCreate", [A]), e.showOnCreate && _r(), z.addEventListener("mouseenter", function() { A.props.interactive && A.state.isVisible && A.clearDelayTimeouts(); }), z.addEventListener("mouseleave", function() { A.props.interactive && A.props.trigger.indexOf("mouseenter") >= 0 && oe().addEventListener("mousemove", T); @@ -9470,17 +9451,17 @@ function l0(t, r) { u(q, "getCurrentTarget"); function oe() { var G = q().parentNode; - return G ? Yy(G) : document; + return G ? Fy(G) : document; } __name(oe, "oe"); u(oe, "getDocument"); function tt() { - return hc(z); + return pc(z); } __name(tt, "tt"); u(tt, "getDefaultTemplateChildren"); function Ze(G) { - return A.state.isMounted && !A.state.isVisible || qr.isTouch || f && f.type === "focus" ? 0 : uc(A.props.delay, G ? 0 : 1, Dr.delay); + return A.state.isMounted && !A.state.isVisible || Br.isTouch || f && f.type === "focus" ? 0 : ac(A.props.delay, G ? 0 : 1, Rr.delay); } __name(Ze, "Ze"); u(Ze, "getDelay"); @@ -9502,14 +9483,14 @@ function l0(t, r) { function We() { var G = A.props.aria; if (G.content) { - var re = "aria-" + G.content, le = z.id, Re = ro(A.props.triggerTarget || t); + var re = "aria-" + G.content, le = z.id, Re = to(A.props.triggerTarget || t); Re.forEach(function(xe) { var xt = xe.getAttribute(re); if (A.state.isVisible) xe.setAttribute(re, xt ? xt + " " + le : le); else { - var Lt = xt && xt.replace(le, "").trim(); - Lt ? xe.setAttribute(re, Lt) : xe.removeAttribute(re); + var _t = xt && xt.replace(le, "").trim(); + _t ? xe.setAttribute(re, _t) : xe.removeAttribute(re); } }); } @@ -9518,7 +9499,7 @@ function l0(t, r) { u(We, "handleAriaContentAttribute"); function Je() { if (!(Q || !A.props.aria.expanded)) { - var G = ro(A.props.triggerTarget || t); + var G = to(A.props.triggerTarget || t); G.forEach(function(re) { A.props.interactive ? re.setAttribute("aria-expanded", A.state.isVisible && re === q() ? "true" : "false") : re.removeAttribute("aria-expanded"); }); @@ -9527,36 +9508,36 @@ function l0(t, r) { __name(Je, "Je"); u(Je, "handleAriaExpandedAttribute"); function Ye() { - oe().removeEventListener("mousemove", T), tl = tl.filter(function(G) { + oe().removeEventListener("mousemove", T), Qs = Qs.filter(function(G) { return G !== T; }); } __name(Ye, "Ye"); u(Ye, "cleanupInteractiveMouseListeners"); function J(G) { - if (!(qr.isTouch && (m || G.type === "mousedown"))) { + if (!(Br.isTouch && (m || G.type === "mousedown"))) { var re = G.composedPath && G.composedPath()[0] || G.target; - if (!(A.props.interactive && fh(z, re))) { - if (ro(A.props.triggerTarget || t).some(function(le) { - return fh(le, re); + if (!(A.props.interactive && uh(z, re))) { + if (to(A.props.triggerTarget || t).some(function(le) { + return uh(le, re); })) { - if (qr.isTouch || A.state.isVisible && A.props.trigger.indexOf("click") >= 0) + if (Br.isTouch || A.state.isVisible && A.props.trigger.indexOf("click") >= 0) return; } else Ae("onClickOutside", [A, G]); A.props.hideOnClick === true && (A.clearDelayTimeouts(), A.hide(), v = true, setTimeout(function() { v = false; - }), A.state.isMounted || vr()); + }), A.state.isMounted || mr()); } } } __name(J, "J"); u(J, "onDocumentPress"); - function ar() { + function or() { m = true; } - __name(ar, "ar"); - u(ar, "onTouchMove"); + __name(or, "or"); + u(or, "onTouchMove"); function je() { m = false; } @@ -9564,163 +9545,163 @@ function l0(t, r) { u(je, "onTouchStart"); function rt() { var G = oe(); - G.addEventListener("mousedown", J, true), G.addEventListener("touchend", J, gi), G.addEventListener("touchstart", je, gi), G.addEventListener("touchmove", ar, gi); + G.addEventListener("mousedown", J, true), G.addEventListener("touchend", J, vi), G.addEventListener("touchstart", je, vi), G.addEventListener("touchmove", or, vi); } __name(rt, "rt"); u(rt, "addDocumentPress"); - function vr() { + function mr() { var G = oe(); - G.removeEventListener("mousedown", J, true), G.removeEventListener("touchend", J, gi), G.removeEventListener("touchstart", je, gi), G.removeEventListener("touchmove", ar, gi); + G.removeEventListener("mousedown", J, true), G.removeEventListener("touchend", J, vi), G.removeEventListener("touchstart", je, vi), G.removeEventListener("touchmove", or, vi); } - __name(vr, "vr"); - u(vr, "removeDocumentPress"); - function Ir(G, re) { - sr(G, function() { + __name(mr, "mr"); + u(mr, "removeDocumentPress"); + function Mr(G, re) { + ar(G, function() { !A.state.isVisible && z.parentNode && z.parentNode.contains(z) && re(); }); } - __name(Ir, "Ir"); - u(Ir, "onTransitionedOut"); - function gr(G, re) { - sr(G, re); + __name(Mr, "Mr"); + u(Mr, "onTransitionedOut"); + function vr(G, re) { + ar(G, re); } - __name(gr, "gr"); - u(gr, "onTransitionedIn"); - function sr(G, re) { + __name(vr, "vr"); + u(vr, "onTransitionedIn"); + function ar(G, re) { var le = tt().box; function Re(xe) { - xe.target === le && (pc(le, "remove", Re), re()); + xe.target === le && (lc(le, "remove", Re), re()); } __name(Re, "Re"); if (u(Re, "listener"), G === 0) return re(); - pc(le, "remove", g), pc(le, "add", Re), g = Re; + lc(le, "remove", g), lc(le, "add", Re), g = Re; } - __name(sr, "sr"); - u(sr, "onTransitionEnd"); - function _r(G, re, le) { + __name(ar, "ar"); + u(ar, "onTransitionEnd"); + function Nr(G, re, le) { le === void 0 && (le = false); - var Re = ro(A.props.triggerTarget || t); + var Re = to(A.props.triggerTarget || t); Re.forEach(function(xe) { xe.addEventListener(G, re, le), S.push({ node: xe, eventType: G, handler: re, options: le }); }); } - __name(_r, "_r"); - u(_r, "on"); - function Yr() { - K() && (_r("touchstart", Pe, { passive: true }), _r("touchend", jn, { passive: true })), By(A.props.trigger).forEach(function(G) { + __name(Nr, "Nr"); + u(Nr, "on"); + function Vr() { + K() && (Nr("touchstart", Pe, { passive: true }), Nr("touchend", Gn, { passive: true })), Ly(A.props.trigger).forEach(function(G) { if (G !== "manual") - switch (_r(G, Pe), G) { + switch (Nr(G, Pe), G) { case "mouseenter": - _r("mouseleave", jn); + Nr("mouseleave", Gn); break; case "focus": - _r(e0 ? "focusout" : "blur", _t); + Nr(Zy ? "focusout" : "blur", Nt); break; case "focusin": - _r("focusout", _t); + Nr("focusout", Nt); break; } }); } - __name(Yr, "Yr"); - u(Yr, "addListeners"); - function Ln() { + __name(Vr, "Vr"); + u(Vr, "addListeners"); + function _n() { S.forEach(function(G) { var re = G.node, le = G.eventType, Re = G.handler, xe = G.options; re.removeEventListener(le, Re, xe); }), S = []; } - __name(Ln, "Ln"); - u(Ln, "removeListeners"); + __name(_n, "_n"); + u(_n, "removeListeners"); function Pe(G) { var re, le = false; - if (!(!A.state.isEnabled || Xr(G) || v)) { + if (!(!A.state.isEnabled || Yr(G) || v)) { var Re = ((re = f) == null ? void 0 : re.type) === "focus"; - f = G, C = G.currentTarget, Je(), !A.state.isVisible && Uy(G) && tl.forEach(function(xe) { + f = G, C = G.currentTarget, Je(), !A.state.isVisible && $y(G) && Qs.forEach(function(xe) { return xe(G); - }), G.type === "click" && (A.props.trigger.indexOf("mouseenter") < 0 || p) && A.props.hideOnClick !== false && A.state.isVisible ? le = true : Lr(G), G.type === "click" && (p = !le), le && !Re && er(G); + }), G.type === "click" && (A.props.trigger.indexOf("mouseenter") < 0 || p) && A.props.hideOnClick !== false && A.state.isVisible ? le = true : _r(G), G.type === "click" && (p = !le), le && !Re && Jt(G); } } __name(Pe, "Pe"); u(Pe, "onTrigger"); - function Gn(G) { + function Ln(G) { var re = G.target, le = q().contains(re) || z.contains(re); if (!(G.type === "mousemove" && le)) { var Re = Mt().concat(z).map(function(xe) { - var xt, Lt = xe._tippy, It = (xt = Lt.popperInstance) == null ? void 0 : xt.state; + var xt, _t = xe._tippy, It = (xt = _t.popperInstance) == null ? void 0 : xt.state; return It ? { popperRect: xe.getBoundingClientRect(), popperState: It, props: e } : null; }).filter(Boolean); - Xy(Re, G) && (Ye(), er(G)); + Uy(Re, G) && (Ye(), Jt(G)); } } - __name(Gn, "Gn"); - u(Gn, "onMouseMove"); - function jn(G) { - var re = Xr(G) || A.props.trigger.indexOf("click") >= 0 && p; + __name(Ln, "Ln"); + u(Ln, "onMouseMove"); + function Gn(G) { + var re = Yr(G) || A.props.trigger.indexOf("click") >= 0 && p; if (!re) { if (A.props.interactive) { A.hideWithInteractivity(G); return; } - er(G); + Jt(G); } } - __name(jn, "jn"); - u(jn, "onMouseLeave"); - function _t(G) { - A.props.trigger.indexOf("focusin") < 0 && G.target !== q() || A.props.interactive && G.relatedTarget && z.contains(G.relatedTarget) || er(G); + __name(Gn, "Gn"); + u(Gn, "onMouseLeave"); + function Nt(G) { + A.props.trigger.indexOf("focusin") < 0 && G.target !== q() || A.props.interactive && G.relatedTarget && z.contains(G.relatedTarget) || Jt(G); } - __name(_t, "_t"); - u(_t, "onBlurOrFocusOut"); - function Xr(G) { - return qr.isTouch ? K() !== G.type.indexOf("touch") >= 0 : false; + __name(Nt, "Nt"); + u(Nt, "onBlurOrFocusOut"); + function Yr(G) { + return Br.isTouch ? K() !== G.type.indexOf("touch") >= 0 : false; } - __name(Xr, "Xr"); - u(Xr, "isEventListenerStopped"); - function xi() { - mn(); - var G = A.props, re = G.popperOptions, le = G.placement, Re = G.offset, xe = G.getReferenceClientRect, xt = G.moveTransition, Lt = ie() ? hc(z).arrow : null, It = xe ? { getBoundingClientRect: xe, contextElement: xe.contextElement || q() } : t, xa = { name: "$$tippy", enabled: true, phase: "beforeWrite", requires: ["computeStyles"], fn: u(function(At) { + __name(Yr, "Yr"); + u(Yr, "isEventListenerStopped"); + function wi() { + fn(); + var G = A.props, re = G.popperOptions, le = G.placement, Re = G.offset, xe = G.getReferenceClientRect, xt = G.moveTransition, _t = ie() ? pc(z).arrow : null, It = xe ? { getBoundingClientRect: xe, contextElement: xe.contextElement || q() } : t, ya = { name: "$$tippy", enabled: true, phase: "beforeWrite", requires: ["computeStyles"], fn: u(function(At) { var Pt = At.state; if (ie()) { - var Kr = tt(), Ei = Kr.box; - ["placement", "reference-hidden", "escaped"].forEach(function(Si) { - Si === "placement" ? Ei.setAttribute("data-placement", Pt.placement) : Pt.attributes.popper["data-popper-" + Si] ? Ei.setAttribute("data-" + Si, "") : Ei.removeAttribute("data-" + Si); + var Zr = tt(), xi = Zr.box; + ["placement", "reference-hidden", "escaped"].forEach(function(Ei) { + Ei === "placement" ? xi.setAttribute("data-placement", Pt.placement) : Pt.attributes.popper["data-popper-" + Ei] ? xi.setAttribute("data-" + Ei, "") : xi.removeAttribute("data-" + Ei); }), Pt.attributes.popper = {}; } - }, "fn") }, br = [{ name: "offset", options: { offset: Re } }, { name: "preventOverflow", options: { padding: { top: 2, bottom: 2, left: 5, right: 5 } } }, { name: "flip", options: { padding: 5 } }, { name: "computeStyles", options: { adaptive: !xt } }, xa]; - ie() && Lt && br.push({ name: "arrow", options: { element: Lt, padding: 3 } }), br.push.apply(br, (re == null ? void 0 : re.modifiers) || []), A.popperInstance = lc(It, z, Object.assign({}, re, { placement: le, onFirstUpdate: w, modifiers: br })); + }, "fn") }, gr = [{ name: "offset", options: { offset: Re } }, { name: "preventOverflow", options: { padding: { top: 2, bottom: 2, left: 5, right: 5 } } }, { name: "flip", options: { padding: 5 } }, { name: "computeStyles", options: { adaptive: !xt } }, ya]; + ie() && _t && gr.push({ name: "arrow", options: { element: _t, padding: 3 } }), gr.push.apply(gr, (re == null ? void 0 : re.modifiers) || []), A.popperInstance = oc(It, z, Object.assign({}, re, { placement: le, onFirstUpdate: w, modifiers: gr })); } - __name(xi, "xi"); - u(xi, "createPopperInstance"); - function mn() { + __name(wi, "wi"); + u(wi, "createPopperInstance"); + function fn() { A.popperInstance && (A.popperInstance.destroy(), A.popperInstance = null); } - __name(mn, "mn"); - u(mn, "destroyPopperInstance"); - function Ar() { + __name(fn, "fn"); + u(fn, "destroyPopperInstance"); + function Ir() { var G = A.props.appendTo, re, le = q(); - A.props.interactive && G === xh || G === "parent" ? re = le.parentNode : re = Eh(G, [le]), re.contains(z) || re.appendChild(z), A.state.isMounted = true, xi(); + A.props.interactive && G === gh || G === "parent" ? re = le.parentNode : re = bh(G, [le]), re.contains(z) || re.appendChild(z), A.state.isMounted = true, wi(); } - __name(Ar, "Ar"); - u(Ar, "mount"); + __name(Ir, "Ir"); + u(Ir, "mount"); function Mt() { - return rl(z.querySelectorAll("[data-tippy-root]")); + return el(z.querySelectorAll("[data-tippy-root]")); } __name(Mt, "Mt"); u(Mt, "getNestedPopperTree"); - function Lr(G) { + function _r(G) { A.clearDelayTimeouts(), G && Ae("onTrigger", [A, G]), rt(); var re = Ze(true), le = ue(), Re = le[0], xe = le[1]; - qr.isTouch && Re === "hold" && xe && (re = xe), re ? n = setTimeout(function() { + Br.isTouch && Re === "hold" && xe && (re = xe), re ? n = setTimeout(function() { A.show(); }, re) : A.show(); } - __name(Lr, "Lr"); - u(Lr, "scheduleShow"); - function er(G) { + __name(_r, "_r"); + u(_r, "scheduleShow"); + function Jt(G) { if (A.clearDelayTimeouts(), Ae("onUntrigger", [A, G]), !A.state.isVisible) { - vr(); + mr(); return; } if (!(A.props.trigger.indexOf("mouseenter") >= 0 && A.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(G.type) >= 0 && p)) { @@ -9732,124 +9713,124 @@ function l0(t, r) { }); } } - __name(er, "er"); - u(er, "scheduleHide"); - function Hn() { + __name(Jt, "Jt"); + u(Jt, "scheduleHide"); + function jn() { A.state.isEnabled = true; } - __name(Hn, "Hn"); - u(Hn, "enable"); - function Zr() { + __name(jn, "jn"); + u(jn, "enable"); + function Xr() { A.hide(), A.state.isEnabled = false; } - __name(Zr, "Zr"); - u(Zr, "disable"); - function Bn() { + __name(Xr, "Xr"); + u(Xr, "disable"); + function Hn() { clearTimeout(n), clearTimeout(s), cancelAnimationFrame(a); } - __name(Bn, "Bn"); - u(Bn, "clearDelayTimeouts"); - function vn(G) { + __name(Hn, "Hn"); + u(Hn, "clearDelayTimeouts"); + function hn(G) { if (!A.state.isDestroyed) { - Ae("onBeforeUpdate", [A, G]), Ln(); - var re = A.props, le = mh(t, Object.assign({}, re, ph(G), { ignoreAttributes: true })); - A.props = le, Yr(), re.interactiveDebounce !== le.interactiveDebounce && (Ye(), T = uh(Gn, le.interactiveDebounce)), re.triggerTarget && !le.triggerTarget ? ro(re.triggerTarget).forEach(function(Re) { + Ae("onBeforeUpdate", [A, G]), _n(); + var re = A.props, le = ph(t, Object.assign({}, re, sh(G), { ignoreAttributes: true })); + A.props = le, Vr(), re.interactiveDebounce !== le.interactiveDebounce && (Ye(), T = oh(Ln, le.interactiveDebounce)), re.triggerTarget && !le.triggerTarget ? to(re.triggerTarget).forEach(function(Re) { Re.removeAttribute("aria-expanded"); - }) : le.triggerTarget && t.removeAttribute("aria-expanded"), Je(), ze(), H && H(re, le), A.popperInstance && (xi(), Mt().forEach(function(Re) { + }) : le.triggerTarget && t.removeAttribute("aria-expanded"), Je(), ze(), H && H(re, le), A.popperInstance && (wi(), Mt().forEach(function(Re) { requestAnimationFrame(Re._tippy.popperInstance.forceUpdate); })), Ae("onAfterUpdate", [A, G]); } } - __name(vn, "vn"); - u(vn, "setProps"); + __name(hn, "hn"); + u(hn, "setProps"); function $n(G) { A.setProps({ content: G }); } __name($n, "$n"); u($n, "setContent"); - function ao() { - var G = A.state.isVisible, re = A.state.isDestroyed, le = !A.state.isEnabled, Re = qr.isTouch && !A.props.touch, xe = uc(A.props.duration, 0, Dr.duration); + function oo() { + var G = A.state.isVisible, re = A.state.isDestroyed, le = !A.state.isEnabled, Re = Br.isTouch && !A.props.touch, xe = ac(A.props.duration, 0, Rr.duration); if (!(G || re || le || Re) && !q().hasAttribute("disabled") && (Ae("onShow", [A], false), A.props.onShow(A) !== false)) { if (A.state.isVisible = true, ie() && (z.style.visibility = "visible"), ze(), rt(), A.state.isMounted || (z.style.transition = "none"), ie()) { - var xt = tt(), Lt = xt.box, It = xt.content; - cc([Lt, It], 0); + var xt = tt(), _t = xt.box, It = xt.content; + sc([_t, It], 0); } w = u(function() { - var br; + var gr; if (!(!A.state.isVisible || d)) { if (d = true, z.offsetHeight, z.style.transition = A.props.moveTransition, ie() && A.props.animation) { - var lo = tt(), At = lo.box, Pt = lo.content; - cc([At, Pt], xe), dh([At, Pt], "visible"); + var so = tt(), At = so.box, Pt = so.content; + sc([At, Pt], xe), lh([At, Pt], "visible"); } - We(), Je(), ch(dc, A), (br = A.popperInstance) == null || br.forceUpdate(), Ae("onMount", [A]), A.props.animation && ie() && gr(xe, function() { + We(), Je(), ah(uc, A), (gr = A.popperInstance) == null || gr.forceUpdate(), Ae("onMount", [A]), A.props.animation && ie() && vr(xe, function() { A.state.isShown = true, Ae("onShown", [A]); }); } - }, "onFirstUpdate"), Ar(); + }, "onFirstUpdate"), Ir(); } } - __name(ao, "ao"); - u(ao, "show"); - function so() { - var G = !A.state.isVisible, re = A.state.isDestroyed, le = !A.state.isEnabled, Re = uc(A.props.duration, 1, Dr.duration); + __name(oo, "oo"); + u(oo, "show"); + function ao() { + var G = !A.state.isVisible, re = A.state.isDestroyed, le = !A.state.isEnabled, Re = ac(A.props.duration, 1, Rr.duration); if (!(G || re || le) && (Ae("onHide", [A], false), A.props.onHide(A) !== false)) { - if (A.state.isVisible = false, A.state.isShown = false, d = false, p = false, ie() && (z.style.visibility = "hidden"), Ye(), vr(), ze(true), ie()) { - var xe = tt(), xt = xe.box, Lt = xe.content; - A.props.animation && (cc([xt, Lt], Re), dh([xt, Lt], "hidden")); + if (A.state.isVisible = false, A.state.isShown = false, d = false, p = false, ie() && (z.style.visibility = "hidden"), Ye(), mr(), ze(true), ie()) { + var xe = tt(), xt = xe.box, _t = xe.content; + A.props.animation && (sc([xt, _t], Re), lh([xt, _t], "hidden")); } - We(), Je(), A.props.animation ? ie() && Ir(Re, A.unmount) : A.unmount(); + We(), Je(), A.props.animation ? ie() && Mr(Re, A.unmount) : A.unmount(); } } - __name(so, "so"); - u(so, "hide"); - function ya(G) { - oe().addEventListener("mousemove", T), ch(tl, T), T(G); - } - __name(ya, "ya"); - u(ya, "hideWithInteractivity"); - function wa() { - A.state.isVisible && A.hide(), A.state.isMounted && (mn(), Mt().forEach(function(G) { + __name(ao, "ao"); + u(ao, "hide"); + function ga(G) { + oe().addEventListener("mousemove", T), ah(Qs, T), T(G); + } + __name(ga, "ga"); + u(ga, "hideWithInteractivity"); + function ba() { + A.state.isVisible && A.hide(), A.state.isMounted && (fn(), Mt().forEach(function(G) { G._tippy.unmount(); - }), z.parentNode && z.parentNode.removeChild(z), dc = dc.filter(function(G) { + }), z.parentNode && z.parentNode.removeChild(z), uc = uc.filter(function(G) { return G !== A; }), A.state.isMounted = false, Ae("onHidden", [A])); } - __name(wa, "wa"); - u(wa, "unmount"); - function yl() { - A.state.isDestroyed || (A.clearDelayTimeouts(), A.unmount(), Ln(), delete t._tippy, A.state.isDestroyed = true, Ae("onDestroy", [A])); + __name(ba, "ba"); + u(ba, "unmount"); + function gl() { + A.state.isDestroyed || (A.clearDelayTimeouts(), A.unmount(), _n(), delete t._tippy, A.state.isDestroyed = true, Ae("onDestroy", [A])); } - __name(yl, "yl"); - u(yl, "destroy"); + __name(gl, "gl"); + u(gl, "destroy"); } -__name(l0, "l0"); -u(l0, "createTippy"); -function oa(t, r) { +__name(i0, "i0"); +u(i0, "createTippy"); +function na(t, r) { r === void 0 && (r = {}); - var e = Dr.plugins.concat(r.plugins || []); - Jy(); - var n = Object.assign({}, r, { plugins: e }), s = Vy(t); + var e = Rr.plugins.concat(r.plugins || []); + Yy(); + var n = Object.assign({}, r, { plugins: e }), s = qy(t); if (false) var a, p; var v = s.reduce(function(m, d) { - var f = d && l0(d, n); + var f = d && i0(d, n); return f && m.push(f), m; }, []); - return nl(t) ? v[0] : v; + return tl(t) ? v[0] : v; } -__name(oa, "oa"); -u(oa, "tippy"); -oa.defaultProps = Dr; -oa.setDefaultProps = i0; -oa.currentInput = qr; -var V1 = Object.assign({}, Jo, { effect: u(function(r) { +__name(na, "na"); +u(na, "tippy"); +na.defaultProps = Rr; +na.setDefaultProps = e0; +na.currentInput = Br; +var q1 = Object.assign({}, Zo, { effect: u(function(r) { var e = r.state, n = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} }; Object.assign(e.elements.popper.style, n.popper), e.styles = n, e.elements.arrow && Object.assign(e.elements.arrow.style, n.arrow); }, "effect") }); -oa.setDefaultProps({ render: Ch }); -var Rt = oa; -var Oh = jt(on(), 1); -var vc = u((t) => typeof t == "object" && t !== null && typeof t.initHelp == "function", "isHelpable"); +na.setDefaultProps({ render: xh }); +var zt = na; +var Eh = er(Rn(), 1); +var fc = u((t) => typeof t == "object" && t !== null && typeof t.initHelp == "function", "isHelpable"); function ve(t) { let e = class e extends t { static { @@ -9862,7 +9843,7 @@ function ve(t) { this.debugHelpable = false; this.helpableMachine = ht({ id: "helpable", initial: "idle", states: { idle: { on: { INIT: { target: "initialized", actions: ["init"] } } }, initialized: { type: "compound", initial: "unknown", states: { unknown: { always: [{ target: "enabled", cond: "isEnabled" }, { target: "disabled", cond: "isDisabled" }] }, enabled: { on: { SHOW: { target: "enabled", actions: ["show"] }, DISABLE: { target: "disabled", actions: ["disable", "destroy"] } } }, disabled: { on: { ENABLE: { target: "enabled", actions: ["init", "enable"] } } } } } } }, { guards: { isEnabled: () => this.help, isDisabled: () => !this.help }, actions: { init: () => { let a = this.helpContent; - a !== null && (this.popup = Rt(this, { allowHTML: true, animation: false, arrow: true, delay: 0, placement: "auto", theme: "tooltip", onShow(p) { + a !== null && (this.popup = zt(this, { allowHTML: true, animation: false, arrow: true, delay: 0, placement: "auto", theme: "tooltip", onShow(p) { p.setContent(a); } }), this.addEventListener("mouseenter", this.showHelp)); }, show: () => { @@ -9877,7 +9858,7 @@ function ve(t) { (a = this.popup) == null || a.destroy(); } } }); this.helpableService = ut(this.helpableMachine).onTransition((a) => { - this.debugHelpable && console.log(`helpable: ${(0, Oh.format)(a.value)}`); + this.debugHelpable && console.log(`helpable: ${(0, Eh.format)(a.value)}`); }).start(); } initHelp() { @@ -9918,55 +9899,55 @@ function pe(t) { } __name(pe, "pe"); u(pe, "HoverableMixin"); -var il = /* @__PURE__ */ new Map(); -function ol(t) { - if (il.has(t)) - return il.get(t); +var rl = /* @__PURE__ */ new Map(); +function nl(t) { + if (rl.has(t)) + return rl.get(t); let r = t.length, e = 0, n = 0, s = 0, a = []; for (let p = 0; p < r; p += 1) { let v = t[p], m = t[p + 1], d = t[p - 1]; v === "{" && m === "{" && d !== "\\" ? (s += 1, s === 1 && (n = p), p += 1) : v === "}" && m === "}" && d !== "\\" && s && (s -= 1, s === 0 && (n > e && (a.push(Object.freeze({ type: "string", start: e, end: n, value: t.slice(e, n) })), e = n), a.push(Object.freeze({ type: "part", start: n, end: p + 2, value: t.slice(e + 2, p).trim() })), p += 1, e = p + 1)); } - return e < r && a.push(Object.freeze({ type: "string", start: e, end: r, value: t.slice(e, r) })), il.set(t, Object.freeze(a)), il.get(t); + return e < r && a.push(Object.freeze({ type: "string", start: e, end: r, value: t.slice(e, r) })), rl.set(t, Object.freeze(a)), rl.get(t); } -__name(ol, "ol"); -u(ol, "parse"); -var bi = /* @__PURE__ */ new WeakMap(); -var Mh = /* @__PURE__ */ new WeakMap(); -var gc = class gc2 { +__name(nl, "nl"); +u(nl, "parse"); +var gi = /* @__PURE__ */ new WeakMap(); +var Sh = /* @__PURE__ */ new WeakMap(); +var hc = class hc2 { static { - __name(this, "gc"); + __name(this, "hc"); } constructor(r, e) { - this.expression = e, bi.set(this, r), r.updateParent(""); + this.expression = e, gi.set(this, r), r.updateParent(""); } get attributeName() { - return bi.get(this).attr.name; + return gi.get(this).attr.name; } get attributeNamespace() { - return bi.get(this).attr.namespaceURI; + return gi.get(this).attr.namespaceURI; } get value() { - return Mh.get(this); + return Sh.get(this); } set value(r) { - Mh.set(this, r || ""), bi.get(this).updateParent(r); + Sh.set(this, r || ""), gi.get(this).updateParent(r); } get element() { - return bi.get(this).element; + return gi.get(this).element; } get booleanValue() { - return bi.get(this).booleanValue; + return gi.get(this).booleanValue; } set booleanValue(r) { - bi.get(this).booleanValue = r; + gi.get(this).booleanValue = r; } }; -u(gc, "AttributeTemplatePart"); -var dn = gc; -var bc = class bc2 { +u(hc, "AttributeTemplatePart"); +var cn = hc; +var mc = class mc2 { static { - __name(this, "bc"); + __name(this, "mc"); } constructor(r, e) { this.element = r, this.attr = e, this.partList = []; @@ -9991,39 +9972,39 @@ var bc = class bc2 { } } }; -u(bc, "AttributeValueSetter"); -var aa = bc; -var _n = /* @__PURE__ */ new WeakMap(); -var yc = class yc2 { +u(mc, "AttributeValueSetter"); +var ia = mc; +var Nn = /* @__PURE__ */ new WeakMap(); +var vc = class vc2 { static { - __name(this, "yc"); + __name(this, "vc"); } constructor(r, e) { - this.expression = e, _n.set(this, [r]), r.textContent = ""; + this.expression = e, Nn.set(this, [r]), r.textContent = ""; } get value() { - return _n.get(this).map((r) => r.textContent).join(""); + return Nn.get(this).map((r) => r.textContent).join(""); } set value(r) { this.replace(r); } get previousSibling() { - return _n.get(this)[0].previousSibling; + return Nn.get(this)[0].previousSibling; } get nextSibling() { - return _n.get(this)[_n.get(this).length - 1].nextSibling; + return Nn.get(this)[Nn.get(this).length - 1].nextSibling; } replace(...r) { let e = r.map((n) => typeof n == "string" ? new Text(n) : n); - e.length || e.push(new Text("")), _n.get(this)[0].before(...e); - for (let n of _n.get(this)) + e.length || e.push(new Text("")), Nn.get(this)[0].before(...e); + for (let n of Nn.get(this)) n.remove(); - _n.set(this, e); + Nn.set(this, e); } }; -u(yc, "NodeTemplatePart"); -var Bt = yc; -function sa(t) { +u(vc, "NodeTemplatePart"); +var jt = vc; +function oa(t) { return { processCallback(r, e, n) { var s; if (!(typeof n != "object" || !n)) { @@ -10035,162 +10016,162 @@ function sa(t) { } } }; } -__name(sa, "sa"); -u(sa, "createProcessor"); -function la(t, r) { +__name(oa, "oa"); +u(oa, "createProcessor"); +function aa(t, r) { t.value = String(r); } -__name(la, "la"); -u(la, "processPropertyIdentity"); -function al(t, r) { - return typeof r == "boolean" && t instanceof dn && typeof t.element[t.attributeName] == "boolean" ? (t.booleanValue = r, true) : false; +__name(aa, "aa"); +u(aa, "processPropertyIdentity"); +function il(t, r) { + return typeof r == "boolean" && t instanceof cn && typeof t.element[t.attributeName] == "boolean" ? (t.booleanValue = r, true) : false; } -__name(al, "al"); -u(al, "processBooleanAttribute"); -var wc = sa(la); -var u0 = sa((t, r) => { - al(t, r) || la(t, r); +__name(il, "il"); +u(il, "processBooleanAttribute"); +var gc = oa(aa); +var o0 = oa((t, r) => { + il(t, r) || aa(t, r); }); -function* c0(t) { +function* a0(t) { let r = t.ownerDocument.createTreeWalker(t, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT, null, false), e; for (; e = r.nextNode(); ) if (e instanceof Element && e.hasAttributes()) for (let n = 0; n < e.attributes.length; n += 1) { let s = e.attributes.item(n); if (s && s.value.includes("{{")) { - let a = new aa(e, s); - for (let p of ol(s.value)) + let a = new ia(e, s); + for (let p of nl(s.value)) if (p.type === "string") a.append(p.value); else { - let v = new dn(a, p.value); + let v = new cn(a, p.value); a.append(v), yield v; } } } else if (e instanceof Text && e.textContent && e.textContent.includes("{{")) { - let n = ol(e.textContent); + let n = nl(e.textContent); for (let s = 0; s < n.length; s += 1) { let a = n[s]; - a.end < e.textContent.length && e.splitText(a.end), a.type === "part" && (yield new Bt(e, a.value)); + a.end < e.textContent.length && e.splitText(a.end), a.type === "part" && (yield new jt(e, a.value)); break; } } } -__name(c0, "c0"); -u(c0, "collectParts"); -var sl = /* @__PURE__ */ new WeakMap(); -var ll = /* @__PURE__ */ new WeakMap(); -var ua = class ua2 extends DocumentFragment { +__name(a0, "a0"); +u(a0, "collectParts"); +var ol = /* @__PURE__ */ new WeakMap(); +var al = /* @__PURE__ */ new WeakMap(); +var sa = class sa2 extends DocumentFragment { static { - __name(this, "ua"); + __name(this, "sa"); } - constructor(r, e, n = wc) { + constructor(r, e, n = gc) { var s, a; - super(), Object.getPrototypeOf(this) !== ua2.prototype && Object.setPrototypeOf(this, ua2.prototype), this.appendChild(r.content.cloneNode(true)), ll.set(this, Array.from(c0(this))), sl.set(this, n), (a = (s = sl.get(this)).createCallback) === null || a === void 0 || a.call(s, this, ll.get(this), e), sl.get(this).processCallback(this, ll.get(this), e); + super(), Object.getPrototypeOf(this) !== sa2.prototype && Object.setPrototypeOf(this, sa2.prototype), this.appendChild(r.content.cloneNode(true)), al.set(this, Array.from(a0(this))), ol.set(this, n), (a = (s = ol.get(this)).createCallback) === null || a === void 0 || a.call(s, this, al.get(this), e), ol.get(this).processCallback(this, al.get(this), e); } update(r) { - sl.get(this).processCallback(this, ll.get(this), r); + ol.get(this).processCallback(this, al.get(this), r); } }; -u(ua, "TemplateInstance"); -var ca = ua; -var xc = /* @__PURE__ */ new WeakMap(); -var Ih = /* @__PURE__ */ new WeakMap(); -var Ah = /* @__PURE__ */ new WeakMap(); -var pa = class pa2 { +u(sa, "TemplateInstance"); +var la = sa; +var bc = /* @__PURE__ */ new WeakMap(); +var Th = /* @__PURE__ */ new WeakMap(); +var Ch = /* @__PURE__ */ new WeakMap(); +var ua = class ua2 { static { - __name(this, "pa"); + __name(this, "ua"); } constructor(r, e, n) { this.strings = r, this.values = e, this.processor = n; } static setCSPTrustedTypesPolicy(r) { - pa2.cspTrustedTypesPolicy = r; + ua2.cspTrustedTypesPolicy = r; } get template() { var r, e; - if (xc.has(this.strings)) - return xc.get(this.strings); + if (bc.has(this.strings)) + return bc.get(this.strings); { - let n = document.createElement("template"), s = this.strings.length - 1, a = this.strings.reduce((v, m, d) => v + m + (d < s ? `{{ ${d} }}` : ""), ""), p = (e = (r = pa2.cspTrustedTypesPolicy) === null || r === void 0 ? void 0 : r.createHTML(a)) !== null && e !== void 0 ? e : a; - return n.innerHTML = p, xc.set(this.strings, n), n; + let n = document.createElement("template"), s = this.strings.length - 1, a = this.strings.reduce((v, m, d) => v + m + (d < s ? `{{ ${d} }}` : ""), ""), p = (e = (r = ua2.cspTrustedTypesPolicy) === null || r === void 0 ? void 0 : r.createHTML(a)) !== null && e !== void 0 ? e : a; + return n.innerHTML = p, bc.set(this.strings, n), n; } } renderInto(r) { let e = this.template; - if (Ih.get(r) !== e) { - Ih.set(r, e); - let n = new ca(e, this.values, this.processor); - Ah.set(r, n), r instanceof Bt ? r.replace(...n.children) : r.appendChild(n); + if (Th.get(r) !== e) { + Th.set(r, e); + let n = new la(e, this.values, this.processor); + Ch.set(r, n), r instanceof jt ? r.replace(...n.children) : r.appendChild(n); return; } - Ah.get(r).update(this.values); + Ch.get(r).update(this.values); } }; -u(pa, "TemplateResult"); -var Or = pa; -Or.cspTrustedTypesPolicy = null; +u(ua, "TemplateResult"); +var Cr = ua; +Cr.cspTrustedTypesPolicy = null; function Y(t, r) { t.renderInto(r); } __name(Y, "Y"); u(Y, "render"); -var Ph = /* @__PURE__ */ new WeakSet(); -function zh(t) { - return Ph.has(t); -} -__name(zh, "zh"); -u(zh, "isDirective"); -function Rh(t, r) { - return zh(r) ? (r(t), true) : false; -} -__name(Rh, "Rh"); -u(Rh, "processDirective"); -function da(t) { +var Oh = /* @__PURE__ */ new WeakSet(); +function Mh(t) { + return Oh.has(t); +} +__name(Mh, "Mh"); +u(Mh, "isDirective"); +function Ih(t, r) { + return Mh(r) ? (r(t), true) : false; +} +__name(Ih, "Ih"); +u(Ih, "processDirective"); +function ca(t) { return (...r) => { let e = t(...r); - return Ph.add(e), e; + return Oh.add(e), e; }; } -__name(da, "da"); -u(da, "directive"); -var fa = /* @__PURE__ */ new WeakMap(); -var ul = class ul2 { +__name(ca, "ca"); +u(ca, "directive"); +var pa = /* @__PURE__ */ new WeakMap(); +var sl = class sl2 { static { - __name(this, "ul"); + __name(this, "sl"); } constructor(r, e) { - this.element = r, this.type = e, this.element.addEventListener(this.type, this), fa.get(this.element).set(this.type, this); + this.element = r, this.type = e, this.element.addEventListener(this.type, this), pa.get(this.element).set(this.type, this); } set(r) { - typeof r == "function" ? this.handleEvent = r.bind(this.element) : typeof r == "object" && typeof r.handleEvent == "function" ? this.handleEvent = r.handleEvent.bind(r) : (this.element.removeEventListener(this.type, this), fa.get(this.element).delete(this.type)); + typeof r == "function" ? this.handleEvent = r.bind(this.element) : typeof r == "object" && typeof r.handleEvent == "function" ? this.handleEvent = r.handleEvent.bind(r) : (this.element.removeEventListener(this.type, this), pa.get(this.element).delete(this.type)); } static for(r) { - fa.has(r.element) || fa.set(r.element, /* @__PURE__ */ new Map()); - let e = r.attributeName.slice(2), n = fa.get(r.element); - return n.has(e) ? n.get(e) : new ul2(r.element, e); + pa.has(r.element) || pa.set(r.element, /* @__PURE__ */ new Map()); + let e = r.attributeName.slice(2), n = pa.get(r.element); + return n.has(e) ? n.get(e) : new sl2(r.element, e); } }; -u(ul, "EventHandler"); -var Ec = ul; -function Dh(t, r) { - return t instanceof dn && t.attributeName.startsWith("on") ? (Ec.for(t).set(r), t.element.removeAttributeNS(t.attributeNamespace, t.attributeName), true) : false; -} -__name(Dh, "Dh"); -u(Dh, "processEvent"); -function p0(t) { +u(sl, "EventHandler"); +var yc = sl; +function Ah(t, r) { + return t instanceof cn && t.attributeName.startsWith("on") ? (yc.for(t).set(r), t.element.removeAttributeNS(t.attributeNamespace, t.attributeName), true) : false; +} +__name(Ah, "Ah"); +u(Ah, "processEvent"); +function s0(t) { return typeof t == "object" && Symbol.iterator in t; } -__name(p0, "p0"); -u(p0, "isIterable"); -function kh(t, r) { - if (!p0(r)) +__name(s0, "s0"); +u(s0, "isIterable"); +function Ph(t, r) { + if (!s0(r)) return false; - if (t instanceof Bt) { + if (t instanceof jt) { let e = []; for (let n of r) - if (n instanceof Or) { + if (n instanceof Cr) { let s = document.createDocumentFragment(); n.renderInto(s), e.push(...s.childNodes); } else @@ -10199,43 +10180,43 @@ function kh(t, r) { } else return t.value = Array.from(r).join(" "), true; } -__name(kh, "kh"); -u(kh, "processIterable"); -function Nh(t, r) { - return r instanceof DocumentFragment && t instanceof Bt ? (r.childNodes.length && t.replace(...r.childNodes), true) : false; +__name(Ph, "Ph"); +u(Ph, "processIterable"); +function zh(t, r) { + return r instanceof DocumentFragment && t instanceof jt ? (r.childNodes.length && t.replace(...r.childNodes), true) : false; } -__name(Nh, "Nh"); -u(Nh, "processDocumentFragment"); -function _h(t, r) { - return r instanceof Or && t instanceof Bt ? (r.renderInto(t), true) : false; -} -__name(_h, "_h"); -u(_h, "processSubTemplate"); -function cl(t, r) { - Rh(t, r) || al(t, r) || Dh(t, r) || _h(t, r) || Nh(t, r) || kh(t, r) || la(t, r); -} -__name(cl, "cl"); -u(cl, "processPart"); -var Sc = sa(cl); +__name(zh, "zh"); +u(zh, "processDocumentFragment"); +function Rh(t, r) { + return r instanceof Cr && t instanceof jt ? (r.renderInto(t), true) : false; +} +__name(Rh, "Rh"); +u(Rh, "processSubTemplate"); +function ll(t, r) { + Ih(t, r) || il(t, r) || Ah(t, r) || Rh(t, r) || zh(t, r) || Ph(t, r) || aa(t, r); +} +__name(ll, "ll"); +u(ll, "processPart"); +var wc = oa(ll); function U(t, ...r) { - return new Or(t, r, Sc); + return new Cr(t, r, wc); } __name(U, "U"); u(U, "html"); -var Tc = /* @__PURE__ */ new WeakMap(); -var d0 = da((...t) => (r) => { - Tc.has(r) || Tc.set(r, { i: t.length }); - let e = Tc.get(r); +var xc = /* @__PURE__ */ new WeakMap(); +var l0 = ca((...t) => (r) => { + xc.has(r) || xc.set(r, { i: t.length }); + let e = xc.get(r); for (let n = 0; n < t.length; n += 1) t[n] instanceof Promise ? Promise.resolve(t[n]).then((s) => { - n < e.i && (e.i = n, cl(r, s)); - }) : n <= e.i && (e.i = n, cl(r, t[n])); + n < e.i && (e.i = n, ll(r, s)); + }) : n <= e.i && (e.i = n, ll(r, t[n])); }); -var f0 = da((t) => (r) => { +var u0 = ca((t) => (r) => { var e, n; - if (!(r instanceof Bt)) + if (!(r instanceof jt)) return; - let s = document.createElement("template"), a = (n = (e = Or.cspTrustedTypesPolicy) === null || e === void 0 ? void 0 : e.createHTML(t)) !== null && n !== void 0 ? n : t; + let s = document.createElement("template"), a = (n = (e = Cr.cspTrustedTypesPolicy) === null || e === void 0 ? void 0 : e.createHTML(t)) !== null && n !== void 0 ? n : t; s.innerHTML = a; let p = document.importNode(s.content, true); r.replace(...p.childNodes); @@ -10278,7 +10259,7 @@ function be(t) { } __name(be, "be"); u(be, "IconableMixin"); -var fn = u((t) => typeof t == "object" && t !== null && typeof t.if == "string", "isIfable"); +var pn = u((t) => typeof t == "object" && t !== null && typeof t.if == "string", "isIfable"); function Ue(t) { let e = class e extends t { static { @@ -10295,14 +10276,14 @@ function Ue(t) { } __name(Ue, "Ue"); u(Ue, "IfableMixin"); -var pl = u((t) => typeof t == "object" && t !== null && typeof t.initMenu == "function", "isMenuable"); +var ul = u((t) => typeof t == "object" && t !== null && typeof t.initMenu == "function", "isMenuable"); function ge(t) { let e = class e extends t { static { __name(this, "e"); } initMenu() { - this.menu || this.menuContent !== null && (this.addEventListener("click", this.dispatchShowMenuEvent), this.menu = Rt(this, { allowHTML: true, animation: false, arrow: false, content: this.menuContent, interactive: true, appendTo: document.body, offset: [0, 16], placement: "top", theme: "operation-menu", trigger: "manual", onShow: this.initMenuItems.bind(this), onHide: () => { + this.menu || this.menuContent !== null && (this.addEventListener("click", this.dispatchShowMenuEvent), this.menu = zt(this, { allowHTML: true, animation: false, arrow: false, content: this.menuContent, interactive: true, appendTo: document.body, offset: [0, 16], placement: "top", theme: "operation-menu", trigger: "manual", onShow: this.initMenuItems.bind(this), onHide: () => { var a, p, v, m; (a = this.ifTooltip) == null || a.hide(), (p = this.angleTooltip) == null || p.hide(), (v = this.flagTooltip) == null || v.hide(), (m = this.deleteTooltip) == null || m.hide(); } })); @@ -10327,20 +10308,20 @@ function ge(t) { return Y(U`${p}`, v), v; } initMenuItems(a) { - if (fn(a.reference)) { + if (pn(a.reference)) { let v = a.popper.querySelector("button[data-operation-menu-if]"); - B.notNull(v), v.disabled = false, this.ifTooltip = v._tippy, this.ifTooltip === void 0 && (this.ifTooltip = Rt(v, { animation: false, content: "Set `if' Conditional" }), v.addEventListener("mousedown", this.showIfInspector.bind(this))); + $.notNull(v), v.disabled = false, this.ifTooltip = v._tippy, this.ifTooltip === void 0 && (this.ifTooltip = zt(v, { animation: false, content: "Set `if' Conditional" }), v.addEventListener("mousedown", this.showIfInspector.bind(this))); } - if (ni(a.reference)) { + if (ei(a.reference)) { let v = a.popper.querySelector("button[data-operation-menu-angle]"); - B.notNull(v), v.disabled = false, this.angleTooltip = v._tippy, this.angleTooltip === void 0 && (this.angleTooltip = Rt(v, { animation: false, content: "Change Angle" }), v.addEventListener("mousedown", this.showAngleInspector.bind(this))); + $.notNull(v), v.disabled = false, this.angleTooltip = v._tippy, this.angleTooltip === void 0 && (this.angleTooltip = zt(v, { animation: false, content: "Change Angle" }), v.addEventListener("mousedown", this.showAngleInspector.bind(this))); } - if (li(a.reference)) { + if (si(a.reference)) { let v = a.popper.querySelector("button[data-operation-menu-flag]"); - B.notNull(v), v.disabled = false, this.flagTooltip = v._tippy, this.flagTooltip === void 0 && (this.flagTooltip = Rt(v, { animation: false, content: "Set Condifitonal Flag" }), v.addEventListener("mousedown", this.showFlagInspector.bind(this))); + $.notNull(v), v.disabled = false, this.flagTooltip = v._tippy, this.flagTooltip === void 0 && (this.flagTooltip = zt(v, { animation: false, content: "Set Condifitonal Flag" }), v.addEventListener("mousedown", this.showFlagInspector.bind(this))); } let p = a.popper.querySelector("[data-operation-menu-delete]"); - B.notNull(p), this.deleteTooltip = p._tippy, this.deleteTooltip === void 0 && (this.deleteTooltip = Rt(p, { animation: false, content: "Delete" })), p.addEventListener("mousedown", this.destroyMenu.bind(this)), p.addEventListener("mousedown", this.dispatchOperationDeleteEvent.bind(this)); + $.notNull(p), this.deleteTooltip = p._tippy, this.deleteTooltip === void 0 && (this.deleteTooltip = zt(p, { animation: false, content: "Delete" })), p.addEventListener("mousedown", this.destroyMenu.bind(this)), p.addEventListener("mousedown", this.dispatchOperationDeleteEvent.bind(this)); } showIfInspector() { this.hideMenu(), fe("menuable:menu-if", {}, this); @@ -10361,10 +10342,10 @@ function ge(t) { } __name(ge, "ge"); u(ge, "MenuableMixin"); -var Lh = jt(on(), 1); -var dl = jt(Zo(), 1); -var pr = u((t) => t != null && typeof t.resizeable == "boolean", "isResizeable"); -function fl(t) { +var Dh = er(Rn(), 1); +var cl = er(Yo(), 1); +var cr = u((t) => t != null && typeof t.resizeable == "boolean", "isResizeable"); +function pl(t) { let e = class e extends t { static { __name(this, "e"); @@ -10379,22 +10360,22 @@ function fl(t) { this.resizeableMachine = ht({ id: "resizeable", initial: "idle", states: { idle: { entry: ["init"], on: { SET_INTERACT: { target: "resizeHandleGrabbable", actions: ["setInteract"] } } }, resizeHandleGrabbable: { on: { GRAB_RESIZE_HANDLE: { target: "resizeHandleGrabbed", actions: ["grabResizeHandle"] }, UNSET_INTERACT: { target: "idle" } } }, resizeHandleGrabbed: { on: { START_RESIZING: { target: "resizeStart", actions: ["startResizing"] }, RELEASE_RESIZE_HANDLE: { target: "resizeHandleGrabbable", actions: ["releaseResizeHandle"] } } }, resizeStart: { always: [{ target: "resizing" }] }, resizing: { on: { RESIZE_HANDLE_SNAP: { target: "resizing", actions: ["emitResizeEvent"] }, END_RESIZING: { target: "resizeEnd" } } }, resizeEnd: { entry: ["endResizing"], always: [{ target: "resizeHandleGrabbable" }] } } }, { actions: { init: () => { fe("resizeable:init", {}, this); }, setInteract: (a, p) => { - B.need(p.type === "SET_INTERACT", "event type must be SET_INTERACT"), B.notNull(this.resizeHandle); - let v = (0, dl.default)(this.resizeHandle); + $.need(p.type === "SET_INTERACT", "event type must be SET_INTERACT"), $.notNull(this.resizeHandle); + let v = (0, cl.default)(this.resizeHandle); v.styleCursor(false), v.on("down", this.grabResizeHandle.bind(this)), v.on("up", this.releaseResizeHandle.bind(this)), v.draggable({ onstart: this.startResizing.bind(this), onmove: this.moveResizeHandle.bind(this), onend: this.endResizing.bind(this) }); }, grabResizeHandle: (a, p) => { - B.need(p.type === "GRAB_RESIZE_HANDLE", "event type must be GRAB_RESIZE_HANDLE"), this.resizing = true, fe("resizeable:grab-resize-handle", {}, this); + $.need(p.type === "GRAB_RESIZE_HANDLE", "event type must be GRAB_RESIZE_HANDLE"), this.resizing = true, fe("resizeable:grab-resize-handle", {}, this); }, releaseResizeHandle: (a, p) => { - B.need(p.type === "RELEASE_RESIZE_HANDLE", "event type must be RELEASE_RESIZE_HANDLE"), this.resizing = false, fe("resizeable:release-resize-handle", {}, this); + $.need(p.type === "RELEASE_RESIZE_HANDLE", "event type must be RELEASE_RESIZE_HANDLE"), this.resizing = false, fe("resizeable:release-resize-handle", {}, this); }, startResizing: (a, p) => { - B.need(p.type === "START_RESIZING", "event type must be START_RESIZING"), this.resizing = true; + $.need(p.type === "START_RESIZING", "event type must be START_RESIZING"), this.resizing = true; }, emitResizeEvent: (a, p) => { - B.need(p.type === "RESIZE_HANDLE_SNAP", "event type must be RESIZE_HANDLE_SNAP"), fe("resizeable:resize", {}, this); + $.need(p.type === "RESIZE_HANDLE_SNAP", "event type must be RESIZE_HANDLE_SNAP"), fe("resizeable:resize", {}, this); }, endResizing: () => { this.resizing = false, this.moveResizeHandleTo(0, 0), fe("resizeable:end-resizing", {}, this); } } }); this.resizeableService = ut(this.resizeableMachine).onTransition((a) => { - this.debugResizeable && console.log(`resizeable: ${(0, Lh.format)(a.value)}`); + this.debugResizeable && console.log(`resizeable: ${(0, Dh.format)(a.value)}`); }); } get resizeable() { @@ -10404,7 +10385,7 @@ function fl(t) { a ? this.resizeableService.send({ type: "SET_INTERACT" }) : this.resizeableService.send({ type: "UNSET_INTERACT" }); } set resizeHandleSnapTargets(a) { - (0, dl.default)(this.resizeHandle).draggable({ modifiers: [dl.default.modifiers.snap({ targets: a, relativePoints: [{ x: 0.5, y: 0.5 }] })], listeners: { move: this.resizeHandleMoveEventListener.bind(this) } }); + (0, cl.default)(this.resizeHandle).draggable({ modifiers: [cl.default.modifiers.snap({ targets: a, relativePoints: [{ x: 0.5, y: 0.5 }] })], listeners: { move: this.resizeHandleMoveEventListener.bind(this) } }); } initResizeable() { this.resizeableService.state === void 0 && this.resizeableService.start(); @@ -10444,36 +10425,36 @@ function fl(t) { let r = e; return r; } -__name(fl, "fl"); -u(fl, "ResizeableMixin"); -var Gh = ` +__name(pl, "pl"); +u(pl, "ResizeableMixin"); +var kh = ` `; -var dr = class extends ge(ve(me(Me(be(he(pe(HTMLElement))))))) { +var pr = class extends ge(ve(me(Me(be(he(pe(HTMLElement))))))) { static { - __name(this, "dr"); + __name(this, "pr"); } get operationType() { - return du; + return Ql; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(Gh)}
+ Y(U`
${this.iconHtml(kh)}
`, this.shadowRoot); } toJson() { - return `"${du}"`; + return `"${Ql}"`; } }; -u(dr, "AntiControlGateElement"), dr = M([X], dr); -function jh(t) { +u(pr, "AntiControlGateElement"), pr = M([X], pr); +function Nh(t) { return /^-?\d+$/.test(t); } -__name(jh, "jh"); -u(jh, "isNumeric"); +__name(Nh, "Nh"); +u(Nh, "isNumeric"); function Ot(t, r = 4) { return (t >= 0 ? "+" : "") + t.toFixed(r); } @@ -10490,18 +10471,18 @@ var et = class extends ge(ve(me(he(pe(HTMLElement))))) { this.z = 0; } get operationType() { - return fu; + return eu; } showPopup() { this.showInspector(); } showInspector() { - if (B.notNull(this.parentElement), this.parentElement.tagName === "PALETTE-DROPZONE") + if ($.notNull(this.parentElement), this.parentElement.tagName === "PALETTE-DROPZONE") return; let e = this.popup; e && e.destroy(); let n = this.blochInspectorPopupContent(); - this.popup = Rt(this, { allowHTML: true, animation: false, arrow: true, delay: 0, placement: "auto", theme: "tooltip", onShow(s) { + this.popup = zt(this, { allowHTML: true, animation: false, arrow: true, delay: 0, placement: "auto", theme: "tooltip", onShow(s) { s.setContent(n); } }), this.popup.show(); } @@ -10675,7 +10656,7 @@ var et = class extends ge(ve(me(he(pe(HTMLElement))))) {
`, this.shadowRoot); } toJson() { - return `"${fu}"`; + return `"${eu}"`; } updateBlochVector() { var n; @@ -10684,7 +10665,7 @@ var et = class extends ge(ve(me(he(pe(HTMLElement))))) { } get d() { let e = this.getAttribute("data-d"); - return B.notNull(e), parseFloat(e); + return $.notNull(e), parseFloat(e); } set d(e) { this.setAttribute("data-d", e.toString()); @@ -10697,7 +10678,7 @@ var et = class extends ge(ve(me(he(pe(HTMLElement))))) { } get phi() { let e = this.getAttribute("data-phi"); - return B.notNull(e), parseFloat(e); + return $.notNull(e), parseFloat(e); } phiRadian() { return Math.atan2(this.y, this.x) * 180 / Math.PI; @@ -10707,115 +10688,115 @@ var et = class extends ge(ve(me(he(pe(HTMLElement))))) { } get theta() { let e = this.getAttribute("data-theta"); - return B.notNull(e), parseFloat(e); + return $.notNull(e), parseFloat(e); } thetaRadian() { return 180 * Math.max(0, Math.PI / 2 - Math.atan2(this.z, Math.sqrt(this.y * this.y + this.x * this.x))) / Math.PI; } }; u(et, "BlochDisplayElement"), M([Oe], et.prototype, "body", 2), M([Oe], et.prototype, "vectorLine", 2), M([Oe], et.prototype, "vectorEnd", 2), M([Oe], et.prototype, "vector", 2), M([ft], et.prototype, "vectorEndCircles", 2), M([k], et.prototype, "x", 2), M([k], et.prototype, "y", 2), M([k], et.prototype, "z", 2), et = M([X], et); -var Hh = ` +var _h = ` `; -var Dt = class extends ge(ve(me(Me(be(he(pe(HTMLElement))))))) { +var Rt = class extends ge(ve(me(Me(be(he(pe(HTMLElement))))))) { static { - __name(this, "Dt"); + __name(this, "Rt"); } get operationType() { - return hu; + return tu; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(Hh)}
+ Y(U`
${this.iconHtml(_h)}
`, this.shadowRoot); } toJson() { - return `"${hu}"`; + return `"${tu}"`; } }; -u(Dt, "ControlGateElement"), Dt = M([X], Dt); -var Bh = ` +u(Rt, "ControlGateElement"), Rt = M([X], Rt); +var Lh = ` `; -var $t = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { +var Ht = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { static { - __name(this, "$t"); + __name(this, "Ht"); } get operationType() { - return gs; + return Qa; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(Bh)}
+ Y(U`
${this.iconHtml(Lh)}
`, this.shadowRoot); } toJson() { - return this.if !== "" ? `"${gs}<${this.if}"` : `"${gs}"`; + return this.if !== "" ? `"${Qa}<${this.if}"` : `"${Qa}"`; } }; -u($t, "HGateElement"), $t = M([X], $t); -var $h = ` +u(Ht, "HGateElement"), Ht = M([X], Ht); +var Gh = ` `; -var qt = class extends ge(ve($f(me(be(he(pe(HTMLElement))))))) { +var $t = class extends ge(ve(Gf(me(be(he(pe(HTMLElement))))))) { static { - __name(this, "qt"); + __name(this, "$t"); } constructor() { super(...arguments); this.value = ""; } get operationType() { - return bs; + return es; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { Y(U`
- ${this.iconHtml($h)} + ${this.iconHtml(Gh)}
`, this.shadowRoot); } toJson() { - return this.flag === "" ? `"${bs}"` : `"${bs}>${this.flag}"`; + return this.flag === "" ? `"${es}"` : `"${es}>${this.flag}"`; } }; -u(qt, "MeasurementGateElement"), M([k], qt.prototype, "value", 2), qt = M([X], qt); -var qh = ` +u($t, "MeasurementGateElement"), M([k], $t.prototype, "value", 2), $t = M([X], $t); +var jh = ` `; -var Ft = class extends ge(ve(Ue(Le(zn(me(Me(be(he(pe(HTMLElement)))))))))) { +var Bt = class extends ge(ve(Ue(Le(En(me(Me(be(he(pe(HTMLElement)))))))))) { static { - __name(this, "Ft"); + __name(this, "Bt"); } get operationType() { - return ys; + return ts; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(qh)}
+ Y(U`
${this.iconHtml(jh)}
`, this.shadowRoot); } toJson() { - return this.angle === "" ? `"${ys}"` : `"${ys}(${this.angle.replace("/", "_")})"`; + return this.angle === "" ? `"${ts}"` : `"${ts}(${this.angle.replace("/", "_")})"`; } }; -u(Ft, "PhaseGateElement"), Ft = M([X], Ft); -var hl = ` +u(Bt, "PhaseGateElement"), Bt = M([X], Bt); +var dl = ` +var Hh = ` @@ -10837,31 +10818,31 @@ var Fh = ` `; -var fr = class extends ge(ve(fl(me(be(he(pe(HTMLElement))))))) { +var dr = class extends ge(ve(pl(me(be(he(pe(HTMLElement))))))) { static { - __name(this, "fr"); + __name(this, "dr"); } get operationType() { - return mu; + return ru; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable(), this.initResizeable()); } update() { Y(U`
-
${this.iconHtml(Fh)}
+
${this.iconHtml(Hh)}
-
${this.iconHtml(hl)}
+
${this.iconHtml(dl)}
`, this.shadowRoot); } toJson() { - return `"${mu}${this.span}"`; + return `"${ru}${this.span}"`; } }; -u(fr, "QftDaggerGateElement"), fr = M([X], fr); -var Uh = ` +u(dr, "QftDaggerGateElement"), dr = M([X], dr); +var $h = ` @@ -10871,31 +10852,31 @@ var Uh = ` `; -var hr = class extends ge(ve(fl(me(be(he(pe(HTMLElement))))))) { +var fr = class extends ge(ve(pl(me(be(he(pe(HTMLElement))))))) { static { - __name(this, "hr"); + __name(this, "fr"); } get operationType() { - return vu; + return nu; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable(), this.initResizeable()); } update() { Y(U`
-
${this.iconHtml(Uh)}
+
${this.iconHtml($h)}
-
${this.iconHtml(hl)}
+
${this.iconHtml(dl)}
`, this.shadowRoot); } toJson() { - return `"${vu}${this.span}"`; + return `"${nu}${this.span}"`; } }; -u(hr, "QftGateElement"), hr = M([X], hr); -var Wh = ` `; -var Ut = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { +var qt = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { static { - __name(this, "Ut"); + __name(this, "qt"); } get operationType() { - return ws; + return rs; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(Wh)}
+ Y(U`
${this.iconHtml(Bh)}
`, this.shadowRoot); } toJson() { - return this.if !== "" ? `"${ws}<${this.if}"` : `"${ws}"`; + return this.if !== "" ? `"${rs}<${this.if}"` : `"${rs}"`; } }; -u(Ut, "RnotGateElement"), Ut = M([X], Ut); -var Vh = ` +u(qt, "RnotGateElement"), qt = M([X], qt); +var qh = ` `; -var Wt = class extends ge(ve(Ue(Le(zn(me(Me(be(he(pe(HTMLElement)))))))))) { +var Ft = class extends ge(ve(Ue(Le(En(me(Me(be(he(pe(HTMLElement)))))))))) { static { - __name(this, "Wt"); + __name(this, "Ft"); } get operationType() { - return xs; + return ns; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(Vh)}
+ Y(U`
${this.iconHtml(qh)}
`, this.shadowRoot); } toJson() { - return this.angle === "" ? `"${xs}"` : `"${xs}(${this.angle.replace("/", "_")})"`; + return this.angle === "" ? `"${ns}"` : `"${ns}(${this.angle.replace("/", "_")})"`; } }; -u(Wt, "RxGateElement"), Wt = M([X], Wt); -var Yh = ` +u(Ft, "RxGateElement"), Ft = M([X], Ft); +var Fh = ` `; -var Vt = class extends ge(ve(Ue(Le(zn(me(Me(be(he(pe(HTMLElement)))))))))) { +var Ut = class extends ge(ve(Ue(Le(En(me(Me(be(he(pe(HTMLElement)))))))))) { static { - __name(this, "Vt"); + __name(this, "Ut"); } get operationType() { - return Es; + return is; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(Yh)}
+ Y(U`
${this.iconHtml(Fh)}
`, this.shadowRoot); } toJson() { - return this.angle === "" ? `"${Es}"` : `"${Es}(${this.angle.replace("/", "_")})"`; + return this.angle === "" ? `"${is}"` : `"${is}(${this.angle.replace("/", "_")})"`; } }; -u(Vt, "RyGateElement"), Vt = M([X], Vt); -var Xh = ` +u(Ut, "RyGateElement"), Ut = M([X], Ut); +var Uh = ` `; -var Yt = class extends ge(ve(Ue(Le(zn(me(Me(be(he(pe(HTMLElement)))))))))) { +var Wt = class extends ge(ve(Ue(Le(En(me(Me(be(he(pe(HTMLElement)))))))))) { static { - __name(this, "Yt"); + __name(this, "Wt"); } get operationType() { - return Ss; + return os; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(Xh)}
+ Y(U`
${this.iconHtml(Uh)}
`, this.shadowRoot); } toJson() { - return this.angle === "" ? `"${Ss}"` : `"${Ss}(${this.angle.replace("/", "_")})"`; + return this.angle === "" ? `"${os}"` : `"${os}(${this.angle.replace("/", "_")})"`; } }; -u(Yt, "RzGateElement"), Yt = M([X], Yt); -var Zh = ` +u(Wt, "RzGateElement"), Wt = M([X], Wt); +var Wh = ` `; -var nr = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { +var rr = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { static { - __name(this, "nr"); + __name(this, "rr"); } get operationType() { - return Ts; + return as; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(Zh)}
+ Y(U`
${this.iconHtml(Wh)}
`, this.shadowRoot); } toJson() { - return this.if !== "" ? `"${Ts}<${this.if}"` : `"${Ts}"`; + return this.if !== "" ? `"${as}<${this.if}"` : `"${as}"`; } }; -u(nr, "SDaggerGateElement"), nr = M([X], nr); -var Kh = ` +u(rr, "SDaggerGateElement"), rr = M([X], rr); +var Vh = ` `; -var ir = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { +var nr = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { static { - __name(this, "ir"); + __name(this, "nr"); } get operationType() { - return Cs; + return ss; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(Kh)}
+ Y(U`
${this.iconHtml(Vh)}
`, this.shadowRoot); } toJson() { - return this.if !== "" ? `"${Cs}<${this.if}"` : `"${Cs}"`; + return this.if !== "" ? `"${ss}<${this.if}"` : `"${ss}"`; } }; -u(ir, "SGateElement"), ir = M([X], ir); -var Jh = ` +u(nr, "SGateElement"), nr = M([X], nr); +var Yh = ` `; -var mr = class extends ge(ve(me(Me(be(he(pe(HTMLElement))))))) { +var hr = class extends ge(ve(me(Me(be(he(pe(HTMLElement))))))) { static { - __name(this, "mr"); + __name(this, "hr"); } get operationType() { - return gu; + return iu; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(Jh)}
+ Y(U`
${this.iconHtml(Yh)}
`, this.shadowRoot); } toJson() { - return `"${gu}"`; + return `"${iu}"`; } }; -u(mr, "SpacerGateElement"), mr = M([X], mr); -var Qh = ` +u(hr, "SpacerGateElement"), hr = M([X], hr); +var Xh = ` `; -var Xt = class extends ge(ve(Le(me(Me(be(he(pe(HTMLElement)))))))) { +var Vt = class extends ge(ve(Le(me(Me(be(he(pe(HTMLElement)))))))) { static { - __name(this, "Xt"); + __name(this, "Vt"); } get operationType() { - return bu; + return ou; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(Qh)}
+ Y(U`
${this.iconHtml(Xh)}
`, this.shadowRoot); } toJson() { - return `"${bu}"`; + return `"${ou}"`; } }; -u(Xt, "SwapGateElement"), Xt = M([X], Xt); -var em = ` +u(Vt, "SwapGateElement"), Vt = M([X], Vt); +var Zh = ` `; -var or = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { +var ir = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { static { - __name(this, "or"); + __name(this, "ir"); } get operationType() { - return Os; + return ls; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(em)}
+ Y(U`
${this.iconHtml(Zh)}
`, this.shadowRoot); } toJson() { - return this.if !== "" ? `"${Os}<${this.if}"` : `"${Os}"`; + return this.if !== "" ? `"${ls}<${this.if}"` : `"${ls}"`; } }; -u(or, "TDaggerGateElement"), or = M([X], or); -var tm = ` +u(ir, "TDaggerGateElement"), ir = M([X], ir); +var Kh = ` `; -var Zt = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { +var Yt = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { static { - __name(this, "Zt"); + __name(this, "Yt"); } get operationType() { - return Ms; + return us; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(tm)}
+ Y(U`
${this.iconHtml(Kh)}
`, this.shadowRoot); } toJson() { - return this.if !== "" ? `"${Ms}<${this.if}"` : `"${Ms}"`; + return this.if !== "" ? `"${us}<${this.if}"` : `"${us}"`; } }; -u(Zt, "TGateElement"), Zt = M([X], Zt); -var rm = ` +u(Yt, "TGateElement"), Yt = M([X], Yt); +var Jh = ` `; -var kt = class extends ge(ve(me(be(he(pe(HTMLElement)))))) { +var Dt = class extends ge(ve(me(be(he(pe(HTMLElement)))))) { static { - __name(this, "kt"); + __name(this, "Dt"); } constructor() { super(...arguments); @@ -11159,9 +11140,9 @@ var kt = class extends ge(ve(me(be(he(pe(HTMLElement)))))) { get operationType() { switch (this.value) { case "0": - return Vd; + return Bp; case "1": - return Yd; + return qp; default: throw new Error(`Invalid write value: ${this.value}`); } @@ -11171,7 +11152,7 @@ var kt = class extends ge(ve(me(be(he(pe(HTMLElement)))))) { } update() { Y(U`
- ${this.iconHtml(rm)} + ${this.iconHtml(Jh)}
`, this.shadowRoot); @@ -11180,103 +11161,103 @@ var kt = class extends ge(ve(me(be(he(pe(HTMLElement)))))) { return `"|${this.value}>"`; } }; -u(kt, "WriteGateElement"), M([k], kt.prototype, "value", 2), kt = M([X], kt); -var nm = ` +u(Dt, "WriteGateElement"), M([k], Dt.prototype, "value", 2), Dt = M([X], Dt); +var Qh = ` `; -var Kt = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { +var Xt = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { static { - __name(this, "Kt"); + __name(this, "Xt"); } get operationType() { - return Is; + return cs; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(nm)}
+ Y(U`
${this.iconHtml(Qh)}
`, this.shadowRoot); } toJson() { - return this.if !== "" ? `"${Is}<${this.if}"` : `"${Is}"`; + return this.if !== "" ? `"${cs}<${this.if}"` : `"${cs}"`; } }; -u(Kt, "XGateElement"), Kt = M([X], Kt); -var im = ` +u(Xt, "XGateElement"), Xt = M([X], Xt); +var em = ` `; -var Jt = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { +var Zt = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { static { - __name(this, "Jt"); + __name(this, "Zt"); } get operationType() { - return As; + return ps; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(im)}
+ Y(U`
${this.iconHtml(em)}
`, this.shadowRoot); } toJson() { - return this.if !== "" ? `"${As}<${this.if}"` : `"${As}"`; + return this.if !== "" ? `"${ps}<${this.if}"` : `"${ps}"`; } }; -u(Jt, "YGateElement"), Jt = M([X], Jt); -var om = ` +u(Zt, "YGateElement"), Zt = M([X], Zt); +var tm = ` `; -var Qt = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { +var Kt = class extends ge(ve(Ue(Le(me(Me(be(he(pe(HTMLElement))))))))) { static { - __name(this, "Qt"); + __name(this, "Kt"); } get operationType() { - return Ps; + return ds; } connectedCallback() { this.shadowRoot === null && (this.attachShadow({ mode: "open" }), this.update(), this.initDraggable()); } update() { - Y(U`
${this.iconHtml(om)}
+ Y(U`
${this.iconHtml(tm)}
`, this.shadowRoot); } toJson() { - return this.if !== "" ? `"${Ps}<${this.if}"` : `"${Ps}"`; + return this.if !== "" ? `"${ds}<${this.if}"` : `"${ds}"`; } }; -u(Qt, "ZGateElement"), Qt = M([X], Qt); -var Xe = u((t) => t instanceof dr || t instanceof et || t instanceof Dt || t instanceof $t || t instanceof qt || t instanceof Ft || t instanceof fr || t instanceof hr || t instanceof Ut || t instanceof Wt || t instanceof Vt || t instanceof Yt || t instanceof nr || t instanceof ir || t instanceof mr || t instanceof Xt || t instanceof or || t instanceof Zt || t instanceof kt || t instanceof Kt || t instanceof Jt || t instanceof Qt, "isOperation"); -var am = u((t) => t != null && t instanceof $t, "isHGateElement"); -var sm = u((t) => t != null && t instanceof Kt, "isXGateElement"); -var lm = u((t) => t != null && t instanceof Jt, "isYGateElement"); -var um = u((t) => t != null && t instanceof Qt, "isZGateElement"); -var ha = u((t) => t != null && t instanceof Ft, "isPhaseGateElement"); -var cm = u((t) => t != null && t instanceof Zt, "isTGateElement"); -var oD = u((t) => t != null && t instanceof or, "isTDaggerGateElement"); -var pm = u((t) => t != null && t instanceof Ut, "isRnotGateElement"); -var ml = u((t) => t != null && t instanceof Wt, "isRxGateElement"); -var vl = u((t) => t != null && t instanceof Vt, "isRyGateElement"); -var gl = u((t) => t != null && t instanceof Yt, "isRzGateElement"); -var aD = u((t) => t != null && t instanceof ir, "isSGateElement"); -var sD = u((t) => t != null && t instanceof nr, "isSDaggerGateElement"); -var lD = u((t) => t != null && t instanceof mr, "isSpacerGateElement"); -var dm = u((t) => t != null && t instanceof Xt, "isSwapGateElement"); -var Cc = u((t) => t != null && t instanceof Dt, "isControlGateElement"); -var Oc = u((t) => t != null && t instanceof dr, "isAntiControlGateElement"); -var fm = u((t) => t != null && t instanceof et, "isBlochDisplayElement"); -var uD = u((t) => t != null && t instanceof kt, "isWriteGateElement"); -var hm = u((t) => t != null && t instanceof qt, "isMeasurementGateElement"); -var mm = jt(on(), 1); -var ma = jt(Zo(), 1); -var Mc = u((t) => t !== null && t instanceof Mr, "isAngleSliderElement"); -var Mr = class extends HTMLElement { +u(Kt, "ZGateElement"), Kt = M([X], Kt); +var Xe = u((t) => t instanceof pr || t instanceof et || t instanceof Rt || t instanceof Ht || t instanceof $t || t instanceof Bt || t instanceof dr || t instanceof fr || t instanceof qt || t instanceof Ft || t instanceof Ut || t instanceof Wt || t instanceof rr || t instanceof nr || t instanceof hr || t instanceof Vt || t instanceof ir || t instanceof Yt || t instanceof Dt || t instanceof Xt || t instanceof Zt || t instanceof Kt, "isOperation"); +var rm = u((t) => t != null && t instanceof Ht, "isHGateElement"); +var nm = u((t) => t != null && t instanceof Xt, "isXGateElement"); +var im = u((t) => t != null && t instanceof Zt, "isYGateElement"); +var om = u((t) => t != null && t instanceof Kt, "isZGateElement"); +var da = u((t) => t != null && t instanceof Bt, "isPhaseGateElement"); +var am = u((t) => t != null && t instanceof Yt, "isTGateElement"); +var tD = u((t) => t != null && t instanceof ir, "isTDaggerGateElement"); +var sm = u((t) => t != null && t instanceof qt, "isRnotGateElement"); +var fl = u((t) => t != null && t instanceof Ft, "isRxGateElement"); +var hl = u((t) => t != null && t instanceof Ut, "isRyGateElement"); +var ml = u((t) => t != null && t instanceof Wt, "isRzGateElement"); +var rD = u((t) => t != null && t instanceof nr, "isSGateElement"); +var nD = u((t) => t != null && t instanceof rr, "isSDaggerGateElement"); +var iD = u((t) => t != null && t instanceof hr, "isSpacerGateElement"); +var lm = u((t) => t != null && t instanceof Vt, "isSwapGateElement"); +var Ec = u((t) => t != null && t instanceof Rt, "isControlGateElement"); +var Sc = u((t) => t != null && t instanceof pr, "isAntiControlGateElement"); +var um = u((t) => t != null && t instanceof et, "isBlochDisplayElement"); +var oD = u((t) => t != null && t instanceof Dt, "isWriteGateElement"); +var cm = u((t) => t != null && t instanceof $t, "isMeasurementGateElement"); +var pm = er(Rn(), 1); +var fa = er(Yo(), 1); +var Tc = u((t) => t !== null && t instanceof Or, "isAngleSliderElement"); +var Or = class extends HTMLElement { static { - __name(this, "Mr"); + __name(this, "Or"); } constructor() { super(...arguments); @@ -11288,9 +11269,9 @@ var Mr = class extends HTMLElement { this.snapAngles = {}; this.angleSliderMachine = ht({ id: "angle-slider", initial: "idle", states: { idle: { on: { START_MOVE: { target: "moving" }, SET_ANGLE: { target: "idle", actions: ["setDenominatorByAngle", "updateSnapAngles", "setRadianInAngle", "updateHandlePosition", "dispatchUpdateEvent"] }, SET_DENOMINATOR: { target: "idle", actions: ["validateDenominator", "updateSnapAngles", "setAngleInRadian"] } } }, moving: { on: { SET_ANGLE: { target: "moving", actions: ["dispatchChangeEvent"] }, END_MOVE: { target: "idle", actions: ["dispatchUpdateEvent"] } } } } }, { actions: { validateDenominator: () => { if (!Number.isInteger(this.denominator) || this.denominator <= 0) - throw new zt("Bad denominator", this.denominator); + throw new Error(`Bad denominator: ${this.denominator}`); }, setDenominatorByAngle: (e, n) => { - n.type === "SET_ANGLE" && (this.denominator = Do(this.angle)); + n.type === "SET_ANGLE" && (this.denominator = Mo(this.angle)); }, setAngleInRadian: (e, n) => { if (n.type !== "SET_DENOMINATOR") return; @@ -11299,7 +11280,7 @@ var Mr = class extends HTMLElement { }, setRadianInAngle: (e, n) => { if (n.type !== "SET_ANGLE") return; - let [s] = this.findSnapAngle(Gd(this.angle)); + let [s] = this.findSnapAngle(kp(this.angle)); this.radian = s; }, updateSnapAngles: () => { this.updateSnapAngles(); @@ -11311,7 +11292,7 @@ var Mr = class extends HTMLElement { this.dispatchEvent(new Event("angle-slider-update", { bubbles: true })); } } }); this.angleSliderService = ut(this.angleSliderMachine).onTransition((e) => { - this.debug && console.log(`circuit-step: ${(0, mm.format)(e.value)}`); + this.debug && console.log(`circuit-step: ${(0, pm.format)(e.value)}`); }).start(); } attributeChangedCallback(e, n, s) { @@ -11321,7 +11302,7 @@ var Mr = class extends HTMLElement { this.shadowRoot === null && this.attachShadow({ mode: "open" }), this.update(), this.updateSnapAngles(), this.initInteraction(); } disconnectedCallback() { - (0, ma.default)(this).unset(); + (0, fa.default)(this).unset(); } update() { Y(U``, this.shadowRoot); } initInteraction() { - (0, ma.default)(this).draggable({ origin: "self", modifiers: [ma.default.modifiers.restrict({ restriction: "self" })], listeners: { start: this.startMove.bind(this), move: this.move.bind(this), end: this.endMove.bind(this) } }); + (0, fa.default)(this).draggable({ origin: "self", modifiers: [fa.default.modifiers.restrict({ restriction: "self" })], listeners: { start: this.startMove.bind(this), move: this.move.bind(this), end: this.endMove.bind(this) } }); } startMove() { this.angleSliderService.send({ type: "START_MOVE" }); } move(e) { - let n = ma.default.getElementRect(e.target).width, s = e.pageX / n; + let n = fa.default.getElementRect(e.target).width, s = e.pageX / n; this.left = s; let a = this.proportionToRadian(s); this.setAttribute("data-radian", a.toString()); @@ -11370,7 +11351,7 @@ var Mr = class extends HTMLElement { let v = Math.abs(parseFloat(p) - e); (n === null || v < n) && (n = v, s = parseFloat(p), a = this.snapAngles[p]); } - return B.notNull(s), B.notNull(a), [s, a]; + return $.notNull(s), $.notNull(a), [s, a]; } proportionToRadian(e) { return (e - 0.5) * Math.PI * 4; @@ -11379,10 +11360,10 @@ var Mr = class extends HTMLElement { this.style.paddingLeft = `${e * 100}%`; } }; -u(Mr, "AngleSliderElement"), M([k], Mr.prototype, "angle", 2), M([k], Mr.prototype, "radian", 2), M([k], Mr.prototype, "denominator", 2), M([k], Mr.prototype, "disabled", 2), M([k], Mr.prototype, "debug", 2), Mr = M([X], Mr); -var yi = class extends HTMLElement { +u(Or, "AngleSliderElement"), M([k], Or.prototype, "angle", 2), M([k], Or.prototype, "radian", 2), M([k], Or.prototype, "denominator", 2), M([k], Or.prototype, "disabled", 2), M([k], Or.prototype, "debug", 2), Or = M([X], Or); +var bi = class extends HTMLElement { static { - __name(this, "yi"); + __name(this, "bi"); } connectedCallback() { this.attachShadow({ mode: "open" }), this.update(); @@ -11392,14 +11373,14 @@ var yi = class extends HTMLElement { } activateButton(e) { let n = e.currentTarget; - B.notNull(n); + $.notNull(n); for (let s of this.buttons) s.removeAttribute("data-active"); n.setAttribute("data-active", ""); } }; -u(yi, "ButtonGroupElement"), M([ft], yi.prototype, "buttons", 2), yi = M([X], yi); -var no = jt(gm(), 1); +u(bi, "ButtonGroupElement"), M([ft], bi.prototype, "buttons", 2), bi = M([X], bi); +var ro = er(fm(), 1); var at = class extends HTMLElement { static { __name(this, "at"); @@ -11446,7 +11427,7 @@ var at = class extends HTMLElement { this.colorPhase = true; } attributeChangedCallback(e, n, s) { - n !== s && (e === "data-qubit-count" && this.window !== void 0 && this.innerContainer !== void 0 && (B.notNull(s), this.updateQubitCircleSize(), this.updateDimension(), this.resizeWindow(), this.resizeInnerContainer(), this.drawQubitCircles()), e === "data-color-phase" && this.drawQubitCircles()); + n !== s && (e === "data-qubit-count" && this.window !== void 0 && this.innerContainer !== void 0 && ($.notNull(s), this.updateQubitCircleSize(), this.updateDimension(), this.resizeWindow(), this.resizeInnerContainer(), this.drawQubitCircles()), e === "data-color-phase" && this.drawQubitCircles()); } updateQubitCircleSize() { if (this.qubitCount !== 0) @@ -11516,7 +11497,7 @@ var at = class extends HTMLElement { break; } default: - throw new zt("unsupported qubit count", this.qubitCount); + throw new Error(`unsupported qubit count: ${this.qubitCount}`); } } updateDimension() { @@ -11587,20 +11568,20 @@ var at = class extends HTMLElement { break; } default: - throw new zt("unsupported qubit count", this.qubitCount); + throw new Error(`unsupported qubit count: ${this.qubitCount}`); } } updateVisibleQubitCircleKets() { this.visibleQubitCircleKets = this.qubitCircles.map((e) => { let n = e.getAttribute("data-ket"); - return B.notNull(n), parseInt(n); - }), B.need(this.visibleQubitCircleKets.length <= 2 ** this.qubitCount, `visibleQubitCircleKets.length (= ${this.visibleQubitCircleKets.length}) must be <= 2^${this.qubitCount}`), this.dispatchEvent(new CustomEvent("circle-notation-visibility-change", { detail: this.visibleQubitCircleKets, bubbles: true })); + return $.notNull(n), parseInt(n); + }), $.need(this.visibleQubitCircleKets.length <= 2 ** this.qubitCount, `visibleQubitCircleKets.length (= ${this.visibleQubitCircleKets.length}) must be <= 2^${this.qubitCount}`), this.dispatchEvent(new CustomEvent("circle-notation-visibility-change", { detail: this.visibleQubitCircleKets, bubbles: true })); } setAmplitudes(e) { - no.default.mutate(() => { + ro.default.mutate(() => { for (let n of this.qubitCircles) { let s = n.getAttribute("data-ket"); - B.notNull(s); + $.notNull(s); let a = parseInt(s), p = e[a]; if (p === void 0) continue; @@ -11746,7 +11727,7 @@ var at = class extends HTMLElement { case 16: return this.mobile ? this.qubitCircleSizePx * 5 + this.gap * 4 : this.qubitCircleSizePx * 8 + this.gap * 7; default: - throw new zt("unsupported qubit count", this.qubitCount); + throw new Error(`unsupported qubit count: ${this.qubitCount}`); } } get qubitCirclesAreaWidth() { @@ -11784,7 +11765,7 @@ var at = class extends HTMLElement { case 16: return this.qubitCircleSizePx * 32 + this.gap * 31; default: - throw new zt("unsupported qubit count", this.qubitCount); + throw new Error(`unsupported qubit count: ${this.qubitCount}`); } } get windowHeight() { @@ -11848,11 +11829,11 @@ var at = class extends HTMLElement { case 16: return 16; default: - throw new zt("unsupported qubit count", this.qubitCount); + throw new Error(`unsupported qubit count: ${this.qubitCount}`); } } drawQubitCircles() { - B.notNull(this.window), B.notNull(this.innerContainer), this.qubitCount !== 0 && no.default.mutate(() => { + $.notNull(this.window), $.notNull(this.innerContainer), this.qubitCount !== 0 && ro.default.mutate(() => { this.style.setProperty("--width", `${this.qubitCircleSizePx}px`), this.style.setProperty("--height", `${this.qubitCircleSizePx}px`), this.style.setProperty("--magnitude", "0"), this.style.setProperty("--magnitude-color", "rgb(14 165 233)"), this.style.setProperty("--border-width", `${this.qubitCircleLineWidth}px`), this.style.setProperty("--phase-width", `${this.qubitCircleLineWidth}px`); let e = []; this.lastColStartIndex = this.visibleColStartIndex, this.lastColEndIndex = this.visibleColEndIndex, this.lastRowStartIndex = this.visibleRowStartIndex, this.lastRowEndIndex = this.visibleRowEndIndex; @@ -11869,7 +11850,7 @@ var at = class extends HTMLElement { this.drawNewlyVisibleQubitCircles(), this.removeInvisibleQubitCircles(); } drawNewlyVisibleQubitCircles() { - this.window !== void 0 && this.innerContainer !== void 0 && (no.default.measure(() => { + this.window !== void 0 && this.innerContainer !== void 0 && (ro.default.measure(() => { this.qubitCirclePositions = []; let e = this.overscanColStartIndex, n = this.overscanColEndIndex, s = this.overscanRowStartIndex, a = this.overscanRowEndIndex; if (!(this.lastColStartIndex === e && this.lastColEndIndex === n && this.lastRowStartIndex === s && this.lastRowEndIndex === a)) { @@ -11878,7 +11859,7 @@ var at = class extends HTMLElement { (v < this.lastColStartIndex || this.lastColEndIndex < v || p < this.lastRowStartIndex || this.lastRowEndIndex < p) && this.qubitCirclePositions.push({ col: v, row: p }); this.lastColStartIndex = e, this.lastColEndIndex = n, this.lastRowStartIndex = s, this.lastRowEndIndex = a; } - }), no.default.mutate(() => { + }), ro.default.mutate(() => { let e = document.createDocumentFragment(); for (let n of this.allQubitCircleElements(this.qubitCirclePositions)) e.appendChild(n); @@ -11886,10 +11867,10 @@ var at = class extends HTMLElement { })); } removeInvisibleQubitCircles() { - no.default.mutate(() => { + ro.default.mutate(() => { for (let e of this.qubitCircles) { let n = e.getAttribute("data-col"), s = e.getAttribute("data-row"); - B.notNull(n), B.notNull(s); + $.notNull(n), $.notNull(s); let a = parseInt(n), p = parseInt(s); if (a < this.lastColStartIndex || this.lastColEndIndex < a || p < this.lastRowStartIndex || this.lastRowEndIndex < p) { let v = e._tippy; @@ -11947,7 +11928,7 @@ var at = class extends HTMLElement { case 16: return 1; default: - throw new zt("unsupported qubit count", this.qubitCount); + throw new Error(`unsupported qubit count: ${this.qubitCount}`); } } get overscanColStartIndex() { @@ -12000,35 +11981,35 @@ var at = class extends HTMLElement { } showQubitCirclePopup(e) { let n = e.target; - B.need(n.classList.contains("qubit-circle"), "not a qubit-circle"); - let s = Rt(n, { allowHTML: true, animation: false, delay: 0, theme: "tooltip" }); + $.need(n.classList.contains("qubit-circle"), "not a qubit-circle"); + let s = zt(n, { allowHTML: true, animation: false, delay: 0, theme: "tooltip" }); if (this.qubitCirclePopupTemplate === null) return; let a = n.getAttribute("data-ket"); - B.notNull(a); + $.notNull(a); let p = n.getAttribute("data-amplitude-real"); - B.notNull(p); + $.notNull(p); let v = n.getAttribute("data-amplitude-imag"); - B.notNull(v); - let m = parseInt(a), d = parseFloat(p), f = parseFloat(v), g = new ko(d, f), w = g.abs(), S = g.phase() / Math.PI * 180, T = document.importNode(this.qubitCirclePopupTemplate.content, true), C = T.getElementById("qubit-circle-popup--ket-binary-value"), R = T.getElementById("qubit-circle-popup--ket-decimal-value"), _ = T.getElementById("qubit-circle-popup--amplitude"), L = T.getElementById("qubit-circle-popup--amplitude-real-value"), $ = T.getElementById("qubit-circle-popup--amplitude-imag-value"), A = T.getElementById("qubit-circle-popup--probability"), ee = T.getElementById("qubit-circle-popup--probability-value"), z = T.getElementById("qubit-circle-popup--phase"), H = T.getElementById("qubit-circle-popup--phase-value"); - B.notNull(_), B.notNull(L), B.notNull($), B.notNull(A), B.notNull(ee), B.notNull(z), B.notNull(H), C && (C.textContent = m.toString(2).padStart(this.qubitCount, "0")), R && (R.textContent = m.toString()), this.showQubitCirclePopupAmplitude ? (L.textContent = Ot(g.real, 5), $.textContent = `${Ot(g.imag, 5)}i`) : _.style.display = "none", this.showQubitCirclePopupProbability ? ee.textContent = `${Ot(w * w * 100, 4)}%` : A.style.display = "none", this.showQubitCirclePopupPhase ? H.textContent = `${Ot(S, 2)}\xB0` : z.style.display = "none"; + $.notNull(v); + let m = parseInt(a), d = parseFloat(p), f = parseFloat(v), g = new Io(d, f), w = g.abs(), S = g.phase() / Math.PI * 180, T = document.importNode(this.qubitCirclePopupTemplate.content, true), C = T.getElementById("qubit-circle-popup--ket-binary-value"), R = T.getElementById("qubit-circle-popup--ket-decimal-value"), _ = T.getElementById("qubit-circle-popup--amplitude"), L = T.getElementById("qubit-circle-popup--amplitude-real-value"), B = T.getElementById("qubit-circle-popup--amplitude-imag-value"), A = T.getElementById("qubit-circle-popup--probability"), ee = T.getElementById("qubit-circle-popup--probability-value"), z = T.getElementById("qubit-circle-popup--phase"), H = T.getElementById("qubit-circle-popup--phase-value"); + $.notNull(_), $.notNull(L), $.notNull(B), $.notNull(A), $.notNull(ee), $.notNull(z), $.notNull(H), C && (C.textContent = m.toString(2).padStart(this.qubitCount, "0")), R && (R.textContent = m.toString()), this.showQubitCirclePopupAmplitude ? (L.textContent = Ot(g.real, 5), B.textContent = `${Ot(g.imag, 5)}i`) : _.style.display = "none", this.showQubitCirclePopupProbability ? ee.textContent = `${Ot(w * w * 100, 4)}%` : A.style.display = "none", this.showQubitCirclePopupPhase ? H.textContent = `${Ot(S, 2)}\xB0` : z.style.display = "none"; let te = document.createElement("div"); te.appendChild(T), s.setContent(te.innerHTML), s.show(); } hideQubitCirclePopup(e) { let n = e.target; - B.need(n.classList.contains("qubit-circle"), "not a qubit-circle"); + $.need(n.classList.contains("qubit-circle"), "not a qubit-circle"); let s = n._tippy; - B.notNull(s), s.destroy(); + $.notNull(s), s.destroy(); } get qubitCirclePopupTemplate() { return document.getElementById(this.qubitCirclePopupTemplateId); } }; u(at, "CircleNotationElement"), M([k], at.prototype, "qubitCount", 2), M([k], at.prototype, "qubitCircleSize", 2), M([k], at.prototype, "colCount", 2), M([k], at.prototype, "rowCount", 2), M([k], at.prototype, "paddingX", 2), M([k], at.prototype, "paddingY", 2), M([k], at.prototype, "overscanCount", 2), M([k], at.prototype, "colorPhase", 2), M([k], at.prototype, "qubitCirclePopupTemplateId", 2), M([k], at.prototype, "showQubitCirclePopupAmplitude", 2), M([k], at.prototype, "showQubitCirclePopupProbability", 2), M([k], at.prototype, "showQubitCirclePopupPhase", 2), M([Oe], at.prototype, "window", 2), M([Oe], at.prototype, "innerContainer", 2), M([ft], at.prototype, "qubitCircles", 2), at = M([X], at); -var wi = class extends HTMLElement { +var yi = class extends HTMLElement { static { - __name(this, "wi"); + __name(this, "yi"); } connectedCallback() { this.attachShadow({ mode: "open" }), this.renderShadowRoot(); @@ -12043,8 +12024,8 @@ var wi = class extends HTMLElement { Y(U``, this.shadowRoot); } }; -u(wi, "CircleNotationPanelElement"), M([Oe], wi.prototype, "circleNotation", 2), wi = M([X], wi); -var bm = ` +u(yi, "CircleNotationPanelElement"), M([Oe], yi.prototype, "circleNotation", 2), yi = M([X], yi); +var hm = ` +var mm = ` - ${this.iconHtml(bm)} + ${this.iconHtml(hm)}
@@ -12204,7 +12185,7 @@ var kr = class extends HTMLElement { this.currentGateSetIndex === this.gateSets.length - 1 ? this.currentGateSetIndex = 0 : this.currentGateSetIndex++; } validateCurrentGateSetIndex() { - B.need(this.currentGateSetIndex >= 0, "data-current-gate-set-index must be >= 0"), B.need(this.currentGateSetIndex < this.gateSets.length, `data-current-gate-set-index must be < ${this.gateSets.length}`); + $.need(this.currentGateSetIndex >= 0, "data-current-gate-set-index must be >= 0"), $.need(this.currentGateSetIndex < this.gateSets.length, `data-current-gate-set-index must be < ${this.gateSets.length}`); } toggleGateSets() { for (let [e, n] of this.gateSets.entries()) @@ -12220,12 +12201,12 @@ var kr = class extends HTMLElement { } get activeGateSet() { let e = this.gateSets[this.currentGateSetIndex]; - return B.notNull(e), e; + return $.notNull(e), e; } get gatesInActiveGateSet() { return Array.from(this.activeGateSet.children).map((e) => { let n = e.children.item(0); - return B.need(Xe(n), `${n} must be an operation.`), n; + return $.need(Xe(n), `${n} must be an operation.`), n; }); } createPopinAnimationGates() { @@ -12236,7 +12217,7 @@ var kr = class extends HTMLElement { } animatePopinAnimationGates() { for (let [e, n] of this.popinAnimationGates.entries()) { - B.need(e < 4, "#popinGates must be < 4"); + $.need(e < 4, "#popinGates must be < 4"); let s = 0; e === 0 ? s = 500 : e === 1 ? s = 600 : e === 2 ? s = 700 : e === 3 && (s = 800); let a = n.animate([{ transform: "translateY(0px)", offset: 0 }, { transform: "translateY(0px)", offset: 0.2 }, { transform: "translateY(-88px)", offset: 0.6 }, { transform: "translateY(-72px)", offset: 1 }], { duration: s, fill: "forwards", easing: "ease-out" }); @@ -12250,10 +12231,10 @@ var kr = class extends HTMLElement { e === this.currentGateSetIndex ? n.classList.add("dot--active") : n.classList.remove("dot--active"); } }; -u(kr, "GateCarouselElement"), M([k], kr.prototype, "currentGateSetIndex", 2), M([Oe], kr.prototype, "contentClipper", 2), M([ft], kr.prototype, "gateSets", 2), M([ft], kr.prototype, "dots", 2), M([ft], kr.prototype, "popinAnimationGates", 2), kr = M([X], kr); -var io = class extends HTMLElement { +u(Dr, "GateCarouselElement"), M([k], Dr.prototype, "currentGateSetIndex", 2), M([Oe], Dr.prototype, "contentClipper", 2), M([ft], Dr.prototype, "gateSets", 2), M([ft], Dr.prototype, "dots", 2), M([ft], Dr.prototype, "popinAnimationGates", 2), Dr = M([X], Dr); +var no = class extends HTMLElement { static { - __name(this, "io"); + __name(this, "no"); } get isInspectorShown() { return this.popup.state.isVisible; @@ -12284,10 +12265,10 @@ var io = class extends HTMLElement { } get inspector() { let e = this.popup.popper.querySelector("operation-inspector"); - return B.notNull(e), e; + return $.notNull(e), e; } initPopup() { - this.popup = Rt(this, { allowHTML: true, animation: false, arrow: false, content: this.popupContent, interactive: true, offset: [0, 4], placement: "bottom", theme: "operation-inspector", trigger: "manual", hideOnClick: false }); + this.popup = zt(this, { allowHTML: true, animation: false, arrow: false, content: this.popupContent, interactive: true, offset: [0, 4], placement: "bottom", theme: "operation-inspector", trigger: "manual", hideOnClick: false }); } showPopup() { this.popup.show(), this.inspector.disableAllPanes(); @@ -12298,12 +12279,12 @@ var io = class extends HTMLElement { } get popupContent() { let e = document.querySelector("#operation-inspector-template"); - B.notNull(e); + $.notNull(e); let n = e.content.cloneNode(true), s = document.createDocumentFragment(); return Y(U`${n}`, s), s; } }; -u(io, "InspectorButtonElement"), io = M([X], io); +u(no, "InspectorButtonElement"), no = M([X], no); var wt = class extends HTMLElement { static { __name(this, "wt"); @@ -12321,7 +12302,7 @@ var wt = class extends HTMLElement { return this.angleInput.value; } get reducedAngle() { - return $d(this.angleInput.value); + return Gp(this.angleInput.value); } get reduceAngleFraction() { return this.reduceAngleFractionCheckbox.checked; @@ -12330,11 +12311,11 @@ var wt = class extends HTMLElement { return this.flagInput.value; } set operation(e) { - if (this.clear(), this.disableAllPanes(), fn(e) && (this.conditionalGatePaneDisabled = false, this.ifInput.value = e.if), ni(e)) { - let n = Do(e.angle); - ha(e) ? (this.angleInputLabel.textContent = "\u{1D711}", this.denominatorVariableLabel.textContent = "\u{1D711}") : (ml(e) || vl(e) || gl(e)) && (this.angleInputLabel.textContent = "\u{1D6F3}", this.denominatorVariableLabel.textContent = "\u{1D6F3}"), this.anglePaneDisabled = false, this.angleInput.value = e.angle, this.backupCurrentPhi(), this.angleSlider.angle = e.angle, this.denominatorInput.value = n.toString(), this.denominatorLabel.textContent = n.toString(), this.backupCurrentDenominator(), this.reduceAngleFractionCheckbox.checked = e.reducedAngle !== ""; + if (this.clear(), this.disableAllPanes(), pn(e) && (this.conditionalGatePaneDisabled = false, this.ifInput.value = e.if), ei(e)) { + let n = Mo(e.angle); + da(e) ? (this.angleInputLabel.textContent = "\u{1D711}", this.denominatorVariableLabel.textContent = "\u{1D711}") : (fl(e) || hl(e) || ml(e)) && (this.angleInputLabel.textContent = "\u{1D6F3}", this.denominatorVariableLabel.textContent = "\u{1D6F3}"), this.anglePaneDisabled = false, this.angleInput.value = e.angle, this.backupCurrentPhi(), this.angleSlider.angle = e.angle, this.denominatorInput.value = n.toString(), this.denominatorLabel.textContent = n.toString(), this.backupCurrentDenominator(), this.reduceAngleFractionCheckbox.checked = e.reducedAngle !== ""; } - li(e) && (this.conditionalFlagPaneDisabled = false, this.flagInput.value = e.flag); + si(e) && (this.conditionalFlagPaneDisabled = false, this.flagInput.value = e.flag); } clear() { this.ifInput.value = "", this.angleInput.value = "", this.angleSlider.angle = "", this.denominatorInput.value = "", this.reduceAngleFractionCheckbox.checked = false, this.flagInput.value = ""; @@ -12350,13 +12331,13 @@ var wt = class extends HTMLElement { } changeAngle(e) { let n = e.target; - if (!Mc(n)) + if (!Tc(n)) throw new Error(`${n} isn't an angle-slider`); this.angleInput.value = n.angle, this.dispatchEvent(new Event("operation-inspector-angle-change", { bubbles: true })); } updateAngle(e) { let n = e.target; - if (!Mc(n)) + if (!Tc(n)) throw new Error(`${n} isn't an angle-slider`); this.angleInput.value = n.angle, this.dispatchEvent(new Event("operation-inspector-angle-update", { bubbles: true })); } @@ -12365,16 +12346,16 @@ var wt = class extends HTMLElement { } restoreOriginalPhi() { let e = this.angleInput.getAttribute("data-original-value"); - B.notNull(e), this.angleInput.value = e; + $.notNull(e), this.angleInput.value = e; } changeIf() { this.dispatchEvent(new Event("operation-inspector-if-change", { bubbles: true })); } updateAngleInput() { let e = this.angleInput.value; - if (Bd(e)) { - let n, s = Do(e); - this.denominatorInput.value = s.toString(), this.denominatorLabel.textContent = s.toString(), this.backupCurrentDenominator(), jd(e, "-2\u03C0") ? (n = `-${s * 2}\u03C0/${s}`, this.angleInput.value = n) : Hd(e, "2\u03C0") ? (n = `${s * 2}\u03C0/${s}`, this.angleInput.value = n) : n = e, this.backupCurrentPhi(), this.angleSlider.angle = n, this.dispatchEvent(new Event("operation-inspector-angle-update", { bubbles: true })); + if (Lp(e)) { + let n, s = Mo(e); + this.denominatorInput.value = s.toString(), this.denominatorLabel.textContent = s.toString(), this.backupCurrentDenominator(), Np(e, "-2\u03C0") ? (n = `-${s * 2}\u03C0/${s}`, this.angleInput.value = n) : _p(e, "2\u03C0") ? (n = `${s * 2}\u03C0/${s}`, this.angleInput.value = n) : n = e, this.backupCurrentPhi(), this.angleSlider.angle = n, this.dispatchEvent(new Event("operation-inspector-angle-update", { bubbles: true })); } else this.restoreOriginalPhi(); } @@ -12386,21 +12367,21 @@ var wt = class extends HTMLElement { } restoreOriginalDenominator() { let e = this.denominatorInput.getAttribute("data-original-value"); - B.notNull(e), this.denominatorInput.value = e, this.denominatorLabel.textContent = e; + $.notNull(e), this.denominatorInput.value = e, this.denominatorLabel.textContent = e; } changeDenominator() { let e = this.denominatorInput.value; - jh(e) && parseInt(e) > 1 ? (this.denominatorLabel.textContent = e, this.angleSlider.denominator = parseInt(e), this.angleInput.value = this.angleSlider.angle) : this.restoreOriginalDenominator(); + Nh(e) && parseInt(e) > 1 ? (this.denominatorLabel.textContent = e, this.angleSlider.denominator = parseInt(e), this.angleInput.value = this.angleSlider.angle) : this.restoreOriginalDenominator(); } changeReduceSetting() { this.dispatchEvent(new Event("operation-inspector-angle-update", { bubbles: true })); } }; u(wt, "OperationInspectorElement"), M([Oe], wt.prototype, "ifInput", 2), M([Oe], wt.prototype, "angleInputLabel", 2), M([Oe], wt.prototype, "angleInput", 2), M([Oe], wt.prototype, "angleSlider", 2), M([Oe], wt.prototype, "denominatorInput", 2), M([Oe], wt.prototype, "denominatorVariableLabel", 2), M([Oe], wt.prototype, "denominatorLabel", 2), M([Oe], wt.prototype, "reduceAngleFractionCheckbox", 2), M([Oe], wt.prototype, "flagInput", 2), M([k], wt.prototype, "conditionalGatePaneDisabled", 2), M([k], wt.prototype, "anglePaneDisabled", 2), M([k], wt.prototype, "conditionalFlagPaneDisabled", 2), wt = M([X], wt); -var bl = jt(xm(), 1); -var Nt = class extends HTMLElement { +var vl = er(gm(), 1); +var kt = class extends HTMLElement { static { - __name(this, "Nt"); + __name(this, "kt"); } constructor() { super(...arguments); @@ -12511,19 +12492,19 @@ var Nt = class extends HTMLElement { this.addEventListener("mouseenter", this.showPopup), this.addEventListener("mouseleave", this.hidePopup); } showPopup() { - let e = Rt(this, { allowHTML: true, animation: false, delay: 0, theme: "tooltip" }); + let e = zt(this, { allowHTML: true, animation: false, delay: 0, theme: "tooltip" }); if (this.popupTemplate === null) return; - let n = document.importNode(this.popupTemplate.content, true), s = new bl.default(this.amplitude), a = n.getElementById("qubit-circle-popup--header"), p = n.getElementById("qubit-circle-popup--ket-binary-value"), v = n.getElementById("qubit-circle-popup--ket-decimal-value"), m = n.getElementById("qubit-circle-popup--amplitude"), d = n.getElementById("qubit-circle-popup--amplitude-real-value"), f = n.getElementById("qubit-circle-popup--amplitude-imag-value"), g = n.getElementById("qubit-circle-popup--probability"), w = n.getElementById("qubit-circle-popup--probability-value"), S = n.getElementById("qubit-circle-popup--phase"), T = n.getElementById("qubit-circle-popup--phase-value"); - B.notNull(a), B.notNull(p), B.notNull(v), B.notNull(m), B.notNull(d), B.notNull(f), B.notNull(g), B.notNull(w), B.notNull(S), B.notNull(T), this.showPopupHeader ? (p.textContent = this.ket.toString(2).padStart(this.qubitCount, "0"), v.textContent = this.ket.toString()) : a.style.display = "none", this.showPopupAmplitude ? (d.textContent = Ot(s.re, 5), f.textContent = `${Ot(s.im, 5)}i`) : m.style.display = "none", this.showPopupProbability ? w.textContent = `${Ot(this.magnitude * this.magnitude * 100, 4)}%` : g.style.display = "none", this.showPopupPhase ? T.textContent = `${Ot(this.phaseDeg, 2)}\xB0` : S.style.display = "none"; + let n = document.importNode(this.popupTemplate.content, true), s = new vl.default(this.amplitude), a = n.getElementById("qubit-circle-popup--header"), p = n.getElementById("qubit-circle-popup--ket-binary-value"), v = n.getElementById("qubit-circle-popup--ket-decimal-value"), m = n.getElementById("qubit-circle-popup--amplitude"), d = n.getElementById("qubit-circle-popup--amplitude-real-value"), f = n.getElementById("qubit-circle-popup--amplitude-imag-value"), g = n.getElementById("qubit-circle-popup--probability"), w = n.getElementById("qubit-circle-popup--probability-value"), S = n.getElementById("qubit-circle-popup--phase"), T = n.getElementById("qubit-circle-popup--phase-value"); + $.notNull(a), $.notNull(p), $.notNull(v), $.notNull(m), $.notNull(d), $.notNull(f), $.notNull(g), $.notNull(w), $.notNull(S), $.notNull(T), this.showPopupHeader ? (p.textContent = this.ket.toString(2).padStart(this.qubitCount, "0"), v.textContent = this.ket.toString()) : a.style.display = "none", this.showPopupAmplitude ? (d.textContent = Ot(s.re, 5), f.textContent = `${Ot(s.im, 5)}i`) : m.style.display = "none", this.showPopupProbability ? w.textContent = `${Ot(this.magnitude * this.magnitude * 100, 4)}%` : g.style.display = "none", this.showPopupPhase ? T.textContent = `${Ot(this.phaseDeg, 2)}\xB0` : S.style.display = "none"; let C = document.createElement("div"); C.appendChild(n), e.setContent(C.innerHTML), e.show(); } get magnitude() { - return new bl.default(this.amplitude).abs(); + return new vl.default(this.amplitude).abs(); } get phase() { - return new bl.default(this.amplitude).arg(); + return new vl.default(this.amplitude).arg(); } get phaseDeg() { return this.phase / Math.PI * 180; @@ -12533,19 +12514,19 @@ var Nt = class extends HTMLElement { } hidePopup() { let e = this._tippy; - B.notNull(e), e.destroy(); + $.notNull(e), e.destroy(); } get popupTemplate() { return document.getElementById(this.popupTemplateId); } }; -u(Nt, "QubitCircleElement"), M([k], Nt.prototype, "ket", 2), M([k], Nt.prototype, "qubitCount", 2), M([k], Nt.prototype, "amplitude", 2), M([k], Nt.prototype, "hidePhase", 2), M([k], Nt.prototype, "popupTemplateId", 2), M([k], Nt.prototype, "showPopupHeader", 2), M([k], Nt.prototype, "showPopupAmplitude", 2), M([k], Nt.prototype, "showPopupProbability", 2), M([k], Nt.prototype, "showPopupPhase", 2), M([k], Nt.prototype, "darkMode", 2), Nt = M([X], Nt); -var Tm = jt(on(), 1); -var Em = ` +u(kt, "QubitCircleElement"), M([k], kt.prototype, "ket", 2), M([k], kt.prototype, "qubitCount", 2), M([k], kt.prototype, "amplitude", 2), M([k], kt.prototype, "hidePhase", 2), M([k], kt.prototype, "popupTemplateId", 2), M([k], kt.prototype, "showPopupHeader", 2), M([k], kt.prototype, "showPopupAmplitude", 2), M([k], kt.prototype, "showPopupProbability", 2), M([k], kt.prototype, "showPopupPhase", 2), M([k], kt.prototype, "darkMode", 2), kt = M([X], kt); +var wm = er(Rn(), 1); +var bm = ` `; -var Sm = ` +var ym = ` @@ -12577,9 +12558,9 @@ var Sm = ` `; -var Fr = class extends HTMLElement { +var qr = class extends HTMLElement { static { - __name(this, "Fr"); + __name(this, "qr"); } constructor() { super(...arguments); @@ -12601,7 +12582,7 @@ var Fr = class extends HTMLElement { this.dispatchEvent(new Event("run-circuit-button-click", { bubbles: true })); } }, guards: { isIdle: () => !this.running, isRunning: () => this.running } }); this.runCircuitButtonService = ut(this.runCircuitButtonMachine).onTransition((e) => { - this.debug && console.log(`run-circuit-button: ${(0, Tm.format)(e.value)}`); + this.debug && console.log(`run-circuit-button: ${(0, wm.format)(e.value)}`); }); } connectedCallback() { @@ -12641,16 +12622,16 @@ var Fr = class extends HTMLElement { this.runCircuitButtonService.send({ type: "CLICK", clientX: e.clientX, clientY: e.clientY }); } get reloadIcon() { - return U([Em]); + return U([bm]); } get tailSpinIcon() { - return U([Sm]); + return U([ym]); } }; -u(Fr, "RunCircuitButtonElement"), M([k], Fr.prototype, "running", 2), M([k], Fr.prototype, "debug", 2), M([Oe], Fr.prototype, "body", 2), M([Oe], Fr.prototype, "ripple", 2), Fr = M([X], Fr); -var Nr = class extends HTMLElement { +u(qr, "RunCircuitButtonElement"), M([k], qr.prototype, "running", 2), M([k], qr.prototype, "debug", 2), M([Oe], qr.prototype, "body", 2), M([Oe], qr.prototype, "ripple", 2), qr = M([X], qr); +var kr = class extends HTMLElement { static { - __name(this, "Nr"); + __name(this, "kr"); } constructor() { super(...arguments); @@ -12689,10 +12670,10 @@ var Nr = class extends HTMLElement { Y(U``, this.shadowRoot); } }; -u(Nr, "SlideInElement"), M([k], Nr.prototype, "direction", 2), M([k], Nr.prototype, "directionDesktop", 2), M([k], Nr.prototype, "duration", 2), M([k], Nr.prototype, "marginTop", 2), M([k], Nr.prototype, "marginBottom", 2), Nr = M([X], Nr); -var Ur = class extends HTMLElement { +u(kr, "SlideInElement"), M([k], kr.prototype, "direction", 2), M([k], kr.prototype, "directionDesktop", 2), M([k], kr.prototype, "duration", 2), M([k], kr.prototype, "marginTop", 2), M([k], kr.prototype, "marginBottom", 2), kr = M([X], kr); +var Fr = class extends HTMLElement { static { - __name(this, "Ur"); + __name(this, "Fr"); } constructor() { super(...arguments); @@ -12785,9 +12766,9 @@ var Ur = class extends HTMLElement {
`, this.shadowRoot); } }; -u(Ur, "CircuitBlockElement"), M([k], Ur.prototype, "comment", 2), M([k], Ur.prototype, "finalized", 2), Ur = M([X], Ur); -var Cm = jt(on(), 1); -var Wr = u((t) => t != null && t instanceof pt, "isCircuitStepElement"); +u(Fr, "CircuitBlockElement"), M([k], Fr.prototype, "comment", 2), M([k], Fr.prototype, "finalized", 2), Fr = M([X], Fr); +var xm = er(Rn(), 1); +var Ur = u((t) => t != null && t instanceof pt, "isCircuitStepElement"); var Ce = u((t, r) => Array.from(t.reduce((e, n, s, a) => { let p = r(n, s, a), v = e.get(p); return v ? v.push(n) : e.set(p, [n]), e; @@ -12807,14 +12788,14 @@ var pt = class extends HTMLElement { if (!(n.type === "SNAP_DROPZONE" || n.type === "OCCUPY_DROPZONE")) return; let s = n.dropzone, a = this.bit(s); - B.notNull(s.operation), s.operation.bit = a; + $.notNull(s.operation), s.operation.bit = a; }, updateResizeableSpanDropzones: (e, n) => { if (!(n.type === "SNAP_DROPZONE" || n.type === "UNSNAP_DROPZONE" || n.type === "OCCUPY_DROPZONE" || n.type === "DELETE_OPERATION" || n.type === "RESIZE_OPERATION")) return; let s = 1; for (let a of this.dropzones) { let p = a.operation; - if (pr(p)) { + if (cr(p)) { s = p.span; continue; } @@ -12832,7 +12813,7 @@ var pt = class extends HTMLElement { this.shadow = false; } }, guards: { isShadow: () => this.shadow, isVisible: () => !this.shadow, isActive: () => this.active, isInactive: () => !this.active, isBreakpointOn: () => this.breakpoint, isBreakpointOff: () => !this.breakpoint } }); this.circuitStepService = ut(this.circuitStepMachine).onTransition((e) => { - this.debug && console.log(`circuit-step: ${(0, Cm.format)(e.value)}`); + this.debug && console.log(`circuit-step: ${(0, xm.format)(e.value)}`); }); } get maxOccupiedDropzoneBit() { @@ -12841,12 +12822,12 @@ var pt = class extends HTMLElement { if (!s.occupied) continue; let a = parseInt(n, 10) + 1; - if (a > e && (e = a), pr(s.operation)) { + if (a > e && (e = a), cr(s.operation)) { let p = a + s.operation.span - 1; p > e && (e = p); } } - return B.need(0 <= e && e <= No.MAX_QUBIT_COUNT, "invalid number of qubits in use"), e; + return $.need(0 <= e && e <= Ao.MAX_QUBIT_COUNT, "invalid number of qubits in use"), e; } get wireCount() { return this.dropzones.length; @@ -12873,7 +12854,7 @@ var pt = class extends HTMLElement { p.connectTop = false, p.connectBottom = false; let n = this.controlGateDropzones, s = this.antiControlGateDropzones, a = this.controllableDropzones(e); for (let p of a) - _o(p.operation) && (p.operation.controls = [], p.operation.antiControls = []); + Po(p.operation) && (p.operation.controls = [], p.operation.antiControls = []); if (this.updateSwapConnections(e), this.updatePhasePhaseConnections(e), n.length === 1 && a.length === 0) { n[0].operation.disable(); return; @@ -12908,7 +12889,7 @@ var pt = class extends HTMLElement { if (a.angle === "" || e !== void 0 && e.maxPhasePhaseTargetGates === 1) continue; let p = n.filter((v) => { - if (!ha(v.operation)) + if (!da(v.operation)) throw new Error(`${v.operation} isn't a phase-gate element.`); return a.angle === v.operation.angle; }).map((v) => this.bit(v)); @@ -12939,13 +12920,13 @@ var pt = class extends HTMLElement { C.connectBottom = S.some((_) => this.bit(C) < _), C.connectTop = S.some((_) => this.bit(C) > _), v === null || v !== null && parseInt(T) < v ? R.enable() : (C.connectTop = Math.max(...S) > this.bit(C), R.disable()); } for (let T of n) { - if (!_o(T.operation)) + if (!Po(T.operation)) throw new Error(`${T.operation} isn't controllable.`); T.operation.controls = this.controlBits(T, m, e), T.operation.antiControls = d, T.connectTop = S.some((C) => C < this.bit(T)), T.connectBottom = S.some((C) => C > this.bit(T)); } } updateFreeDropzoneConnections(e) { - let n = this.controllableDropzones(e), s = this.controlGateDropzones.filter((f) => Cc(f.operation) && !f.operation.disabled).map((f) => this.bit(f)), a = this.antiControlGateDropzones.filter((f) => Oc(f.operation) && !f.operation.disabled).map((f) => this.bit(f)), p = n.map((f) => this.bit(f)), v = s.concat(a).concat(p), m = Math.min(...v), d = Math.max(...v); + let n = this.controllableDropzones(e), s = this.controlGateDropzones.filter((f) => Ec(f.operation) && !f.operation.disabled).map((f) => this.bit(f)), a = this.antiControlGateDropzones.filter((f) => Sc(f.operation) && !f.operation.disabled).map((f) => this.bit(f)), p = n.map((f) => this.bit(f)), v = s.concat(a).concat(p), m = Math.min(...v), d = Math.max(...v); for (let f of this.freeDropzones) m < this.bit(f) && this.bit(f) < d && (f.connectTop = true, f.connectBottom = true); } @@ -12955,14 +12936,14 @@ var pt = class extends HTMLElement { } bit(e) { let n = this.dropzones.indexOf(e); - return B.need(n !== -1, "circuit-dropzone not found."), n; + return $.need(n !== -1, "circuit-dropzone not found."), n; } get isEmpty() { return this.keep ? false : this.dropzones.every((e) => e.operation === null); } dropzoneAt(e) { let n = this.dropzones[e]; - return B.notNull(n), n; + return $.notNull(n), n; } get lastDropzone() { return this.dropzones[this.wireCount - 1]; @@ -12982,10 +12963,10 @@ var pt = class extends HTMLElement { return this.occupiedDropzones.filter((e) => e.operationName === "phase-gate"); } get controlGateDropzones() { - return this.occupiedDropzones.filter((e) => Cc(e.operation)); + return this.occupiedDropzones.filter((e) => Ec(e.operation)); } get antiControlGateDropzones() { - return this.occupiedDropzones.filter((e) => Oc(e.operation)); + return this.occupiedDropzones.filter((e) => Sc(e.operation)); } numControlGateDropzones(e, n) { if (e === void 0) @@ -12995,7 +12976,7 @@ var pt = class extends HTMLElement { } controllableDropzones(e) { let n = 0, s = 0, a = 0, p = 0, v = 0, m = 0, d = 0, f = 0, g = 0, w = 0; - return this.occupiedDropzones.filter((S) => _o(S.operation)).filter((S) => e === void 0 ? true : am(S.operation) ? (n += 1, e.maxChTargetGates !== 0 && n > e.maxChTargetGates ? false : !e.disableCh) : sm(S.operation) ? (s += 1, e.maxCnotTargetGates !== 0 && s > e.maxCnotTargetGates ? false : !e.disableCnot) : lm(S.operation) ? (a += 1, e.maxCyTargetGates !== 0 && a > e.maxCyTargetGates ? false : !e.disableCy) : um(S.operation) ? (p += 1, e.maxCzTargetGates !== 0 && p > e.maxCzTargetGates ? false : !e.disableCz) : ha(S.operation) ? (v += 1, e.maxCphaseTargetGates !== 0 && v > e.maxCphaseTargetGates ? false : !e.disableCphase) : cm(S.operation) ? (m += 1, e.maxCtTargetGates !== 0 && m > e.maxCtTargetGates ? false : !e.disableCt) : pm(S.operation) ? (d += 1, e.maxCrnotTargetGates !== 0 && d > e.maxCrnotTargetGates ? false : !e.disableCrnot) : ml(S.operation) ? (f += 1, e.maxCrxTargetGates !== 0 && f > e.maxCrxTargetGates ? false : !e.disableCrx) : vl(S.operation) ? (g += 1, e.maxCryTargetGates !== 0 && g > e.maxCryTargetGates ? false : !e.disableCry) : gl(S.operation) ? (w += 1, e.maxCrzTargetGates !== 0 && w > e.maxCrzTargetGates ? false : !e.disableCrz) : dm(S.operation) ? !e.disableCswap : true); + return this.occupiedDropzones.filter((S) => Po(S.operation)).filter((S) => e === void 0 ? true : rm(S.operation) ? (n += 1, e.maxChTargetGates !== 0 && n > e.maxChTargetGates ? false : !e.disableCh) : nm(S.operation) ? (s += 1, e.maxCnotTargetGates !== 0 && s > e.maxCnotTargetGates ? false : !e.disableCnot) : im(S.operation) ? (a += 1, e.maxCyTargetGates !== 0 && a > e.maxCyTargetGates ? false : !e.disableCy) : om(S.operation) ? (p += 1, e.maxCzTargetGates !== 0 && p > e.maxCzTargetGates ? false : !e.disableCz) : da(S.operation) ? (v += 1, e.maxCphaseTargetGates !== 0 && v > e.maxCphaseTargetGates ? false : !e.disableCphase) : am(S.operation) ? (m += 1, e.maxCtTargetGates !== 0 && m > e.maxCtTargetGates ? false : !e.disableCt) : sm(S.operation) ? (d += 1, e.maxCrnotTargetGates !== 0 && d > e.maxCrnotTargetGates ? false : !e.disableCrnot) : fl(S.operation) ? (f += 1, e.maxCrxTargetGates !== 0 && f > e.maxCrxTargetGates ? false : !e.disableCrx) : hl(S.operation) ? (g += 1, e.maxCryTargetGates !== 0 && g > e.maxCryTargetGates ? false : !e.disableCry) : ml(S.operation) ? (w += 1, e.maxCrzTargetGates !== 0 && w > e.maxCrzTargetGates ? false : !e.disableCrz) : lm(S.operation) ? !e.disableCswap : true); } dispatchUpdateEvent() { fe("circuit-step:update", {}, this); @@ -13036,7 +13017,7 @@ var pt = class extends HTMLElement { let e = []; for (let [n, s] of Ce(this.operations, (a) => a.constructor)) switch (n) { - case $t: { + case Ht: { let a = s; for (let [p, v] of Ce(a, (m) => m.if)) for (let [m, d] of Ce(v, (f) => f.controls.toString())) { @@ -13045,7 +13026,7 @@ var pt = class extends HTMLElement { } break; } - case Kt: { + case Xt: { let a = s; for (let [p, v] of Ce(a, (m) => m.if)) for (let [m, d] of Ce(v, (f) => f.controls.toString())) { @@ -13054,7 +13035,7 @@ var pt = class extends HTMLElement { } break; } - case Jt: { + case Zt: { let a = s; for (let [p, v] of Ce(a, (m) => m.if)) for (let [m, d] of Ce(v, (f) => f.controls.toString())) { @@ -13063,7 +13044,7 @@ var pt = class extends HTMLElement { } break; } - case Qt: { + case Kt: { let a = s; for (let [p, v] of Ce(a, (m) => m.if)) for (let [m, d] of Ce(v, (f) => f.controls.toString())) { @@ -13072,7 +13053,7 @@ var pt = class extends HTMLElement { } break; } - case Ft: { + case Bt: { let a = s; for (let [p, v] of Ce(a, (m) => m.angle)) for (let [m, d] of Ce(v, (f) => f.if)) @@ -13082,7 +13063,7 @@ var pt = class extends HTMLElement { } break; } - case ir: { + case nr: { let a = s; for (let [p, v] of Ce(a, (m) => m.if)) for (let [m, d] of Ce(v, (f) => f.controls.toString())) { @@ -13091,7 +13072,7 @@ var pt = class extends HTMLElement { } break; } - case nr: { + case rr: { let a = s; for (let [p, v] of Ce(a, (m) => m.if)) for (let [m, d] of Ce(v, (f) => f.controls.toString())) { @@ -13100,7 +13081,7 @@ var pt = class extends HTMLElement { } break; } - case Zt: { + case Yt: { let a = s; for (let [p, v] of Ce(a, (m) => m.if)) for (let [m, d] of Ce(v, (f) => f.controls.toString())) { @@ -13109,7 +13090,7 @@ var pt = class extends HTMLElement { } break; } - case or: { + case ir: { let a = s; for (let [p, v] of Ce(a, (m) => m.if)) for (let [m, d] of Ce(v, (f) => f.controls.toString())) { @@ -13118,7 +13099,7 @@ var pt = class extends HTMLElement { } break; } - case Ut: { + case qt: { let a = s; for (let [p, v] of Ce(a, (m) => m.if)) for (let [m, d] of Ce(v, (f) => f.controls.toString())) { @@ -13127,7 +13108,7 @@ var pt = class extends HTMLElement { } break; } - case Wt: { + case Ft: { let a = s; for (let [p, v] of Ce(a, (m) => m.angle)) for (let [m, d] of Ce(v, (f) => f.if)) @@ -13137,7 +13118,7 @@ var pt = class extends HTMLElement { } break; } - case Vt: { + case Ut: { let a = s; for (let [p, v] of Ce(a, (m) => m.angle)) for (let [m, d] of Ce(v, (f) => f.if)) @@ -13147,7 +13128,7 @@ var pt = class extends HTMLElement { } break; } - case Yt: { + case Wt: { let a = s; for (let [p, v] of Ce(a, (m) => m.angle)) for (let [m, d] of Ce(v, (f) => f.if)) @@ -13157,12 +13138,12 @@ var pt = class extends HTMLElement { } break; } - case mr: { + case hr: { let a = s, p = a[0].operationType, v = a.map((d) => d.bit), m = { type: p, targets: v }; e.push(m); break; } - case hr: { + case fr: { let a = s; for (let [p, v] of Ce(a, (m) => m.span)) { let d = v[0].operationType, f = v.map((w) => w.bit), g = { type: d, span: p, targets: f }; @@ -13170,7 +13151,7 @@ var pt = class extends HTMLElement { } break; } - case fr: { + case dr: { let a = s; for (let [p, v] of Ce(a, (m) => m.span)) { let d = v[0].operationType, f = v.map((w) => w.bit), g = { type: d, span: p, targets: f }; @@ -13178,7 +13159,7 @@ var pt = class extends HTMLElement { } break; } - case Xt: { + case Vt: { let a = s.filter((d) => !d.disabled); if (a.length !== 2) break; @@ -13186,22 +13167,22 @@ var pt = class extends HTMLElement { v !== void 0 && v.length > 0 && (m.controls = v), e.push(m); break; } - case Dt: { + case Rt: { let a = s.filter((v) => !v.disabled); - if (a.length < 2 || this.operations.some((v) => _o(v) && v.controls.length > 0)) + if (a.length < 2 || this.operations.some((v) => Po(v) && v.controls.length > 0)) break; let p = a.map((v) => v.bit); e.push({ type: a[0].operationType, targets: p }); break; } - case dr: + case pr: break; case et: { let a = s, p = s.map((v) => v.bit); e.push({ type: a[0].operationType, targets: p }); break; } - case kt: { + case Dt: { let a = s; for (let [, p] of Ce(a, (v) => v.value)) { let v = p.map((m) => m.bit); @@ -13209,7 +13190,7 @@ var pt = class extends HTMLElement { } break; } - case qt: { + case $t: { let a = s; for (let [p, v] of Ce(a, (m) => m.flag)) { let m = v.map((g) => g.bit), f = { type: v[0].operationType, targets: m }; @@ -13218,7 +13199,7 @@ var pt = class extends HTMLElement { break; } default: - throw new zt("Unrecognized operation", { klass: n }); + throw new Error(`Unrecognized operation: ${n}`); } return e; } @@ -13233,8 +13214,8 @@ var pt = class extends HTMLElement { } }; u(pt, "CircuitStepElement"), M([k], pt.prototype, "active", 2), M([k], pt.prototype, "breakpoint", 2), M([k], pt.prototype, "shadow", 2), M([k], pt.prototype, "keep", 2), M([k], pt.prototype, "debug", 2), M([ft], pt.prototype, "dropzones", 2), M([ft], pt.prototype, "freeDropzones", 2), M([ft], pt.prototype, "occupiedDropzones", 2), pt = M([X], pt); -var Mm = jt(Zo(), 1); -var Om = ` +var Sm = er(Yo(), 1); +var Em = ` `; -var ga = u((t) => t != null && t instanceof de, "isCircuitDropzoneElement"); -var va; +var ma = u((t) => t != null && t instanceof de, "isCircuitDropzoneElement"); +var ha; var de = class extends HTMLElement { static { __name(this, "de"); } constructor() { super(...arguments); - Ja(this, va, null); + Za(this, ha, null); this.occupied = false; this.operationName = ""; this.inputWireQuantum = false; @@ -13298,9 +13279,9 @@ var de = class extends HTMLElement { this.targets = "circuit-step.dropzones circuit-step.freeDropzones"; this.debug = false; this.circuitDropzoneMachine = ht({ id: "circuit-dropzone", initial: "unknown", strict: true, states: { unknown: { always: [{ target: "empty", cond: "isEmpty" }, { target: "occupied", cond: "isOccupied", actions: ["initOperation"] }] }, empty: { on: { SNAP_OPERATION: { target: "snapped", actions: ["snapOperation"] }, PUT_OPERATION: { target: "occupied", actions: ["putOperation"] }, DELETE_OPERATION: { target: "empty", actions: ["deleteOperation", "dispatchDeleteOperationEvent"] } } }, snapped: { on: { UNSNAP_OPERATION: { target: "empty", actions: ["unsnapOperation"] }, DROP_OPERATION: { target: "occupied", actions: ["dropOperation"] } } }, occupied: { entry: "dispatchOccupiedEvent", on: { UNSNAP_OPERATION: { target: "empty", actions: ["unsnapOperation"] }, DELETE_OPERATION: { target: "empty", actions: ["deleteOperation", "dispatchDeleteOperationEvent"] }, RESIZE_OPERATION: { target: "occupied", actions: ["resizeOperation"] } } } } }, { actions: { initOperation: () => { - B.notNull(this.operation), this.operation.snapped = true; + $.notNull(this.operation), this.operation.snapped = true; }, snapOperation: () => { - B.notNull(this.operation), this.operationName = this.operation.tagName.toLocaleLowerCase(), this.occupied = true, fe("circuit-dropzone:qpu-operation-snap", {}, this); + $.notNull(this.operation), this.operationName = this.operation.tagName.toLocaleLowerCase(), this.occupied = true, fe("circuit-dropzone:qpu-operation-snap", {}, this); }, unsnapOperation: () => { this.removeAttribute("data-operation-name"), this.occupied = false, fe("circuit-dropzone:qpu-operation-unsnap", {}, this); }, dropOperation: () => { @@ -13339,12 +13320,12 @@ var de = class extends HTMLElement { return e === null ? "1" : e.toJson(); } connectedCallback() { - let { signal: e } = Qa(this, va, new AbortController()); + let { signal: e } = Ka(this, ha, new AbortController()); this.attachShadow({ mode: "open" }), this.update(), this.initDropzone(), this.circuitDropzoneService.start(), this.addEventListener("draggable:snap-to-dropzone", this.snap, { signal: e }), this.addEventListener("draggable:unsnap", this.unsnap, { signal: e }), this.addEventListener("draggable:end-dragging", this.dropOperation, { signal: e }), this.addEventListener("draggable:delete", this.deleteOperation, { signal: e }), this.addEventListener("menuable:menu-delete", this.deleteOperation, { signal: e }), this.addEventListener("resizeable:resize", this.resizeOperation, { signal: e }); } disconnectedCallback() { var e; - (e = Ka(this, va)) == null || e.abort(); + (e = Xa(this, ha)) == null || e.abort(); } attributeChangedCallback(e, n, s) { n !== s && e === "data-occupied" && (s !== null ? this.targets = "circuit-step.dropzones circuit-step.occupiedDropzones" : this.targets = "circuit-step.dropzones circuit-step.freeDropzones"); @@ -13383,10 +13364,10 @@ var de = class extends HTMLElement { } get circuitStep() { let e = this.parentElement; - return B.notNull(e), Wr(e) ? e : null; + return $.notNull(e), Ur(e) ? e : null; } initDropzone() { - this.operation !== null && (this.operationName = this.operation.tagName.toLocaleLowerCase(), this.occupied = true), (0, Mm.default)(this).dropzone({ accept: "[data-draggable]", overlap: "center" }); + this.operation !== null && (this.operationName = this.operation.tagName.toLocaleLowerCase(), this.occupied = true), (0, Sm.default)(this).dropzone({ accept: "[data-draggable]", overlap: "center" }); } snap() { this.circuitDropzoneService.send({ type: "SNAP_OPERATION" }); @@ -13405,19 +13386,19 @@ var de = class extends HTMLElement { } resizeOperation(e) { let n = e.target; - if (!pr(n)) + if (!cr(n)) throw new Error(`${n} isn't a Resizeable.`); this.circuitDropzoneService.send({ type: "RESIZE_OPERATION" }); } get wireSvg() { - return U([Om]); + return U([Em]); } }; -va = /* @__PURE__ */ new WeakMap(), u(de, "CircuitDropzoneElement"), M([k], de.prototype, "occupied", 2), M([k], de.prototype, "operationName", 2), M([k], de.prototype, "inputWireQuantum", 2), M([k], de.prototype, "outputWireQuantum", 2), M([k], de.prototype, "connectTop", 2), M([k], de.prototype, "connectBottom", 2), M([k], de.prototype, "shadow", 2), M([k], de.prototype, "targets", 2), M([k], de.prototype, "debug", 2), de = M([X], de); -var Im = jt(on(), 1); -var hn = class extends HTMLElement { +ha = /* @__PURE__ */ new WeakMap(), u(de, "CircuitDropzoneElement"), M([k], de.prototype, "occupied", 2), M([k], de.prototype, "operationName", 2), M([k], de.prototype, "inputWireQuantum", 2), M([k], de.prototype, "outputWireQuantum", 2), M([k], de.prototype, "connectTop", 2), M([k], de.prototype, "connectBottom", 2), M([k], de.prototype, "shadow", 2), M([k], de.prototype, "targets", 2), M([k], de.prototype, "debug", 2), de = M([X], de); +var Tm = er(Rn(), 1); +var dn = class extends HTMLElement { static { - __name(this, "hn"); + __name(this, "dn"); } constructor() { super(...arguments); @@ -13426,7 +13407,7 @@ var hn = class extends HTMLElement { if (n.type !== "GRAB_OPERATION") return; let s = n.operation; - pl(s) && s.menu && s.hideMenu(); + ul(s) && s.menu && s.hideMenu(); }, startCircuitEdit: () => { this.circuit.editing = true; }, endCircuitEdit: () => { @@ -13439,23 +13420,23 @@ var hn = class extends HTMLElement { let s = n.operation, a = this.circuit.snapTargetAt(n.x, n.y); if (s.snapped = true, a.dropzone === null) { let p = a.stepIndex; - B.notNull(p); + $.notNull(p); let v = this.circuit.addShadowStepAfter(p), m = v.dropzones[a.wireIndex]; - B.notNull(m), m.append(s), m.operationName = s.tagName.toLocaleLowerCase(), this.circuit.updateSnapTargets(v.dropzones); + $.notNull(m), m.append(s), m.operationName = s.tagName.toLocaleLowerCase(), this.circuit.updateSnapTargets(v.dropzones); } else a.dropzone.append(s); }, snapResizeHandleIntoDropzone: (e, n) => { if (n.type !== "RESIZE_HANDLE_IN_SNAP_RANGE") return; let s = n.operation; - if (!pr(s)) + if (!cr(s)) throw new Error(`${s} is not resizeable`); let a = s.dropzone; - if (!ga(a)) + if (!ma(a)) throw new Error(`${a} is not a circuit dropzone`); - B.notNull(a.circuitStep); + $.notNull(a.circuitStep); let p = a.circuitStep.dropzones.indexOf(a), m = this.circuit.resizeHandleSnapTargetAt(n.x, n.y).wireIndex - p + 1; - if (!Ud(m)) + if (!Hp(m)) throw new Error(`Invalid span: ${m}`); s.span = m; }, addDocumentCursorGrabbingStyle: () => { @@ -13467,7 +13448,7 @@ var hn = class extends HTMLElement { }, removeDocumentCursorResizingStyle: () => { document.documentElement.removeAttribute("data-resizing"); }, maybeAppendCircuitWire: () => { - this.circuit.wireCount < No.MAX_QUBIT_COUNT && this.circuit.appendWire(); + this.circuit.wireCount < Ao.MAX_QUBIT_COUNT && this.circuit.appendWire(); }, maybeRemoveLastEmptyWires: () => { this.circuit.removeLastEmptyWires(); }, resizeCircuit: () => { @@ -13490,7 +13471,7 @@ var hn = class extends HTMLElement { if (n.type !== "DROP_OPERATION") return; let s = n.operation; - pl(s) && s.initMenu(); + ul(s) && s.initMenu(); }, showOperationMenu: (e, n) => { n.type === "SHOW_OPERATION_MENU" && (this.inspectorButton.isInspectorShown || n.operation.showMenu()); }, showOperationInspectorIf: (e, n) => { @@ -13512,7 +13493,7 @@ var hn = class extends HTMLElement { this.inspectorButton.isInspectorShown && this.inspectorButton.showInspector(s); } } }); this.circuitEditorService = ut(this.circuitEditorMachine).onTransition((e) => { - this.debug && console.log(`circuit-editor: ${(0, Im.format)(e.value)}`); + this.debug && console.log(`circuit-editor: ${(0, Tm.format)(e.value)}`); }); } connectedCallback() { @@ -13523,17 +13504,17 @@ var hn = class extends HTMLElement { } enableDragging(e) { let n = e.target; - if (Vs(n)) + if (Us(n)) n.draggable = true; else - throw new zt("Not a draggable element.", { el: n }); + throw new Error(`Not a draggable element: ${n}`); } enableResizing(e) { let n = e.target; - if (pr(n)) + if (cr(n)) n.resizeable = true; else - throw new zt("Not a resizeable element.", { el: n }); + throw new Error(`Not a resizeable element: ${n}`); } get activeOperation() { return this.circuit.querySelector("circuit-dropzone > [data-active]"); @@ -13542,7 +13523,7 @@ var hn = class extends HTMLElement { if (e.target === this.circuit) { this.circuit.hoverable = true; for (let s of this.circuit.operations) - pl(s) && s.initMenu(); + ul(s) && s.initMenu(); } } maybeDeactivateOperation(e) { @@ -13564,37 +13545,37 @@ var hn = class extends HTMLElement { } showOperationInspectorIf(e) { let n = e.target; - if (!fn(n)) + if (!pn(n)) throw new Error(`${n} isn't an Ifable Operation.`); this.circuitEditorService.send({ type: "SHOW_OPERATION_INSPECTOR_IF", operation: n }); } showOperationInspectorAngle(e) { let n = e.target; - if (!ni(n)) + if (!ei(n)) throw new Error(`${n} isn't an Angleable Operation.`); this.circuitEditorService.send({ type: "SHOW_OPERATION_INSPECTOR_ANGLE", operation: n }); } showOperationInspectorFlag(e) { let n = e.target; - if (!li(n)) + if (!si(n)) throw new Error(`${n} isn't a Flaggable Operation.`); this.circuitEditorService.send({ type: "SHOW_OPERATION_INSPECTOR_FLAG", operation: n }); } setOperationIf(e) { let n = e.target, s = this.activeOperation; - if (!fn(s)) + if (!pn(s)) throw new Error("[data-if] not found."); this.circuitEditorService.send({ type: "SET_OPERATION_IF", operation: s, if: n.if }); } setOperationAngle(e) { let n = e.target, s = this.activeOperation; - if (B.notNull(s), !ni(s)) + if ($.notNull(s), !ei(s)) throw new Error(`${s.outerHTML}: [data-angle] not found.`); this.circuitEditorService.send({ type: "SET_OPERATION_ANGLE", operation: s, angle: n.angle, reducedAngle: n.reduceAngleFraction ? n.reducedAngle : "" }); } setOperationFlag(e) { let n = e.target, s = this.activeOperation; - if (!li(s)) + if (!si(s)) throw new Error("[data-flag] not found."); this.circuitEditorService.send({ type: "SET_OPERATION_FLAG", operation: s, flag: n.flag }); } @@ -13645,19 +13626,19 @@ var hn = class extends HTMLElement { } clickStep(e) { let n = e.target; - if (!Wr(n)) + if (!Ur(n)) throw new Error(`${n} isn't a circuit-step.`); this.circuitEditorService.send({ type: "CLICK_STEP", step: n }); } snapStep(e) { let n = e.target; - if (!Wr(n)) + if (!Ur(n)) throw new Error(`${n} isn't a circuit-step.`); this.circuitEditorService.send({ type: "SNAP_STEP", step: n }); } unsnapStep(e) { let n = e.target; - if (!Wr(n)) + if (!Ur(n)) throw new Error(`${n} isn't a circuit-step.`); this.circuitEditorService.send({ type: "UNSNAP_STEP", step: n }); } @@ -13679,7 +13660,7 @@ var hn = class extends HTMLElement { if (this.circuit.editing) return; let n = e.target; - if (!Wr(n)) + if (!Ur(n)) throw new Error(`${n} isn't a circuit-step.`); this.circuitEditorService.send({ type: "MOUSE_ENTER_STEP", step: n }); } @@ -13687,7 +13668,7 @@ var hn = class extends HTMLElement { if (this.circuit.editing) return; let n = e.target; - if (!Wr(n)) + if (!Ur(n)) throw new Error(`${n} isn't a circuit-step.`); this.circuitEditorService.send({ type: "MOUSE_LEAVE_STEP", step: n }); } @@ -13695,23 +13676,23 @@ var hn = class extends HTMLElement { this.circuitEditorService.send({ type: "MOUSE_LEAVE_CIRCUIT" }); } }; -u(hn, "CircuitEditorElement"), M([k], hn.prototype, "debug", 2), M([Oe], hn.prototype, "circuit", 2), M([Oe], hn.prototype, "inspectorButton", 2), hn = M([X], hn); -var ba; -var oo = class extends HTMLElement { +u(dn, "CircuitEditorElement"), M([k], dn.prototype, "debug", 2), M([Oe], dn.prototype, "circuit", 2), M([Oe], dn.prototype, "inspectorButton", 2), dn = M([X], dn); +var va; +var io = class extends HTMLElement { static { - __name(this, "oo"); + __name(this, "io"); } constructor() { super(...arguments); - Ja(this, ba, null); + Za(this, va, null); } connectedCallback() { - let { signal: e } = Qa(this, ba, new AbortController()); + let { signal: e } = Ka(this, va, new AbortController()); this.attachShadow({ mode: "open" }), this.update(), this.initOperation(this.operation), this.addEventListener("draggable:grab", this.newOperation, { signal: e }), this.addEventListener("draggable:delete", this.deleteOperation, { signal: e }); } disconnectedCallback() { var e; - (e = Ka(this, ba)) == null || e.abort(); + (e = Xa(this, va)) == null || e.abort(); } update() { Y(U`

extends InteractEvent<'resize', P> {\n deltaRect?: FullRect\n edges?: ActionProps['edges']\n}\n\nfunction install (scope: Scope) {\n const {\n actions,\n browser,\n /** @lends Interactable */\n Interactable, // tslint:disable-line no-shadowed-variable\n defaults,\n } = scope\n\n // Less Precision with touch input\n\n resize.cursors = initCursors(browser)\n resize.defaultMargin = browser.supportsTouch || browser.supportsPointerEvent ? 20 : 10\n\n /**\n * ```js\n * interact(element).resizable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * edges: {\n * top : true, // Use pointer coords to check for resize.\n * left : false, // Disable resizing from left edge.\n * bottom: '.resize-s',// Resize if pointer target matches selector\n * right : handleEl // Resize if pointer target is the given Element\n * },\n *\n * // Width and height can be adjusted independently. When `true`, width and\n * // height are adjusted at a 1:1 ratio.\n * square: false,\n *\n * // Width and height can be adjusted independently. When `true`, width and\n * // height maintain the aspect ratio they had when resizing started.\n * preserveAspectRatio: false,\n *\n * // a value of 'none' will limit the resize rect to a minimum of 0x0\n * // 'negate' will allow the rect to have negative width/height\n * // 'reposition' will keep the width/height positive by swapping\n * // the top and bottom edges and/or swapping the left and right edges\n * invert: 'none' || 'negate' || 'reposition'\n *\n * // limit multiple resizes.\n * // See the explanation in the {@link Interactable.draggable} example\n * max: Infinity,\n * maxPerElement: 1,\n * })\n *\n * var isResizeable = interact(element).resizable()\n * ```\n *\n * Gets or sets whether resize actions can be performed on the target\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on resize events (object makes the Interactable\n * resizable)\n * @return {boolean | Interactable} A boolean indicating if this can be the\n * target of resize elements, or this Interactable\n */\n Interactable.prototype.resizable = function (this: Interactable, options: ResizableOptions | boolean) {\n return resizable(this, options, scope)\n } as ResizableMethod\n\n actions.map.resize = resize\n actions.methodDict.resize = 'resizable'\n\n defaults.actions.resize = resize.defaults\n}\n\nfunction resizeChecker (arg) {\n const { interaction, interactable, element, rect, buttons } = arg\n\n if (!rect) {\n return undefined\n }\n\n const page = extend({}, interaction.coords.cur.page)\n const resizeOptions = interactable.options.resize\n\n if (\n !(resizeOptions && resizeOptions.enabled) ||\n // check mouseButton setting if the pointer is down\n (interaction.pointerIsDown &&\n /mouse|pointer/.test(interaction.pointerType) &&\n (buttons & resizeOptions.mouseButtons) === 0)\n ) {\n return undefined\n }\n\n // if using resize.edges\n if (is.object(resizeOptions.edges)) {\n const resizeEdges = {\n left: false,\n right: false,\n top: false,\n bottom: false,\n }\n\n for (const edge in resizeEdges) {\n resizeEdges[edge] = checkResizeEdge(\n edge,\n resizeOptions.edges[edge],\n page,\n interaction._latestPointer.eventTarget,\n element,\n rect,\n resizeOptions.margin || resize.defaultMargin,\n )\n }\n\n resizeEdges.left = resizeEdges.left && !resizeEdges.right\n resizeEdges.top = resizeEdges.top && !resizeEdges.bottom\n\n if (resizeEdges.left || resizeEdges.right || resizeEdges.top || resizeEdges.bottom) {\n arg.action = {\n name: 'resize',\n edges: resizeEdges,\n }\n }\n } else {\n const right = resizeOptions.axis !== 'y' && page.x > rect.right - resize.defaultMargin\n const bottom = resizeOptions.axis !== 'x' && page.y > rect.bottom - resize.defaultMargin\n\n if (right || bottom) {\n arg.action = {\n name: 'resize',\n axes: (right ? 'x' : '') + (bottom ? 'y' : ''),\n }\n }\n }\n\n return arg.action ? false : undefined\n}\n\nfunction resizable (interactable: Interactable, options: OrBoolean | boolean, scope: Scope) {\n if (is.object(options)) {\n interactable.options.resize.enabled = options.enabled !== false\n interactable.setPerAction('resize', options)\n interactable.setOnEvents('resize', options)\n\n if (is.string(options.axis) && /^x$|^y$|^xy$/.test(options.axis)) {\n interactable.options.resize.axis = options.axis\n } else if (options.axis === null) {\n interactable.options.resize.axis = scope.defaults.actions.resize.axis\n }\n\n if (is.bool(options.preserveAspectRatio)) {\n interactable.options.resize.preserveAspectRatio = options.preserveAspectRatio\n } else if (is.bool(options.square)) {\n interactable.options.resize.square = options.square\n }\n\n return interactable\n }\n if (is.bool(options)) {\n interactable.options.resize.enabled = options\n\n return interactable\n }\n return interactable.options.resize\n}\n\nfunction checkResizeEdge (\n name: string,\n value: any,\n page: Point,\n element: Node,\n interactableElement: Element,\n rect: Rect,\n margin: number,\n) {\n // false, '', undefined, null\n if (!value) {\n return false\n }\n\n // true value, use pointer coords and element rect\n if (value === true) {\n // if dimensions are negative, \"switch\" edges\n const width = is.number(rect.width) ? rect.width : rect.right - rect.left\n const height = is.number(rect.height) ? rect.height : rect.bottom - rect.top\n\n // don't use margin greater than half the relevent dimension\n margin = Math.min(margin, Math.abs((name === 'left' || name === 'right' ? width : height) / 2))\n\n if (width < 0) {\n if (name === 'left') {\n name = 'right'\n } else if (name === 'right') {\n name = 'left'\n }\n }\n if (height < 0) {\n if (name === 'top') {\n name = 'bottom'\n } else if (name === 'bottom') {\n name = 'top'\n }\n }\n\n if (name === 'left') {\n const edge = width >= 0 ? rect.left : rect.right\n return page.x < edge + margin\n }\n if (name === 'top') {\n const edge = height >= 0 ? rect.top : rect.bottom\n return page.y < edge + margin\n }\n\n if (name === 'right') {\n return page.x > (width >= 0 ? rect.right : rect.left) - margin\n }\n if (name === 'bottom') {\n return page.y > (height >= 0 ? rect.bottom : rect.top) - margin\n }\n }\n\n // the remaining checks require an element\n if (!is.element(element)) {\n return false\n }\n\n return is.element(value)\n ? // the value is an element to use as a resize handle\n value === element\n : // otherwise check if element matches value as selector\n dom.matchesUpTo(element, value, interactableElement)\n}\n\n/* eslint-disable multiline-ternary */\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nfunction initCursors (browser: typeof import('@interactjs/utils/browser').default) {\n return browser.isIe9\n ? {\n x: 'e-resize',\n y: 's-resize',\n xy: 'se-resize',\n\n top: 'n-resize',\n left: 'w-resize',\n bottom: 's-resize',\n right: 'e-resize',\n topleft: 'se-resize',\n bottomright: 'se-resize',\n topright: 'ne-resize',\n bottomleft: 'ne-resize',\n }\n : {\n x: 'ew-resize',\n y: 'ns-resize',\n xy: 'nwse-resize',\n\n top: 'ns-resize',\n left: 'ew-resize',\n bottom: 'ns-resize',\n right: 'ew-resize',\n topleft: 'nwse-resize',\n bottomright: 'nwse-resize',\n topright: 'nesw-resize',\n bottomleft: 'nesw-resize',\n }\n}\n/* eslint-enable multiline-ternary */\n\nfunction start ({ iEvent, interaction }: { iEvent: InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) {\n return\n }\n\n const resizeEvent = iEvent as ResizeEvent\n const rect = interaction.rect\n\n interaction._rects = {\n start: extend({}, rect),\n corrected: extend({}, rect),\n previous: extend({}, rect),\n delta: {\n left: 0,\n right: 0,\n width: 0,\n top: 0,\n bottom: 0,\n height: 0,\n },\n }\n\n resizeEvent.edges = interaction.prepared.edges\n resizeEvent.rect = interaction._rects.corrected\n resizeEvent.deltaRect = interaction._rects.delta\n}\n\nfunction move ({ iEvent, interaction }: { iEvent: InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) return\n\n const resizeEvent = iEvent as ResizeEvent\n const resizeOptions = interaction.interactable.options.resize\n const invert = resizeOptions.invert\n const invertible = invert === 'reposition' || invert === 'negate'\n\n const current = interaction.rect\n const { start: startRect, corrected, delta: deltaRect, previous } = interaction._rects\n\n extend(previous, corrected)\n\n if (invertible) {\n // if invertible, copy the current rect\n extend(corrected, current)\n\n if (invert === 'reposition') {\n // swap edge values if necessary to keep width/height positive\n if (corrected.top > corrected.bottom) {\n const swap = corrected.top\n\n corrected.top = corrected.bottom\n corrected.bottom = swap\n }\n if (corrected.left > corrected.right) {\n const swap = corrected.left\n\n corrected.left = corrected.right\n corrected.right = swap\n }\n }\n } else {\n // if not invertible, restrict to minimum of 0x0 rect\n corrected.top = Math.min(current.top, startRect.bottom)\n corrected.bottom = Math.max(current.bottom, startRect.top)\n corrected.left = Math.min(current.left, startRect.right)\n corrected.right = Math.max(current.right, startRect.left)\n }\n\n corrected.width = corrected.right - corrected.left\n corrected.height = corrected.bottom - corrected.top\n\n for (const edge in corrected) {\n deltaRect[edge] = corrected[edge] - previous[edge]\n }\n\n resizeEvent.edges = interaction.prepared.edges\n resizeEvent.rect = corrected\n resizeEvent.deltaRect = deltaRect\n}\n\nfunction end ({ iEvent, interaction }: { iEvent: InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) return\n\n const resizeEvent = iEvent as ResizeEvent\n\n resizeEvent.edges = interaction.prepared.edges\n resizeEvent.rect = interaction._rects.corrected\n resizeEvent.deltaRect = interaction._rects.delta\n}\n\nfunction updateEventAxes ({\n iEvent,\n interaction,\n}: {\n iEvent: InteractEvent\n interaction: Interaction\n}) {\n if (interaction.prepared.name !== 'resize' || !interaction.resizeAxes) return\n\n const options = interaction.interactable.options\n const resizeEvent = iEvent as ResizeEvent\n\n if (options.resize.square) {\n if (interaction.resizeAxes === 'y') {\n resizeEvent.delta.x = resizeEvent.delta.y\n } else {\n resizeEvent.delta.y = resizeEvent.delta.x\n }\n resizeEvent.axes = 'xy'\n } else {\n resizeEvent.axes = interaction.resizeAxes\n\n if (interaction.resizeAxes === 'x') {\n resizeEvent.delta.y = 0\n } else if (interaction.resizeAxes === 'y') {\n resizeEvent.delta.x = 0\n }\n }\n}\n\nconst resize: Plugin = {\n id: 'actions/resize',\n before: ['actions/drag'],\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.resizeAxes = 'xy'\n },\n\n 'interactions:action-start': (arg) => {\n start(arg)\n updateEventAxes(arg)\n },\n 'interactions:action-move': (arg) => {\n move(arg)\n updateEventAxes(arg)\n },\n 'interactions:action-end': end,\n 'auto-start:check': resizeChecker,\n },\n\n defaults: {\n square: false,\n preserveAspectRatio: false,\n axis: 'xy',\n\n // use default margin\n margin: NaN,\n\n // object with props left, right, top, bottom which are\n // true/false values to resize when the pointer is over that edge,\n // CSS selectors to match the handles for each direction\n // or the Elements for each handle\n edges: null,\n\n // a value of 'none' will limit the resize rect to a minimum of 0x0\n // 'negate' will alow the rect to have negative width/height\n // 'reposition' will keep the width/height positive by swapping\n // the top and bottom edges and/or swapping the left and right edges\n invert: 'none',\n } as ResizableOptions,\n\n cursors: null as ReturnType,\n\n getCursor ({ edges, axis, name }: ActionProps) {\n const cursors = resize.cursors\n let result: string = null\n\n if (axis) {\n result = cursors[name + axis]\n } else if (edges) {\n let cursorKey = ''\n\n for (const edge of ['top', 'bottom', 'left', 'right']) {\n if (edges[edge]) {\n cursorKey += edge\n }\n }\n\n result = cursors[cursorKey]\n }\n\n return result\n },\n\n defaultMargin: null as number,\n}\n\nexport default resize\n", "import type { Scope } from '@interactjs/core/scope'\n\nimport drag from './drag/plugin'\nimport drop from './drop/plugin'\nimport gesture from './gesture/plugin'\nimport resize from './resize/plugin'\n\nexport default {\n id: 'actions',\n install (scope: Scope) {\n scope.usePlugin(gesture)\n scope.usePlugin(resize)\n scope.usePlugin(drag)\n scope.usePlugin(drop)\n },\n}\n", "let lastTime = 0\nlet request: typeof requestAnimationFrame\nlet cancel: typeof cancelAnimationFrame\n\nfunction init (global: Window | typeof globalThis) {\n request = global.requestAnimationFrame\n cancel = global.cancelAnimationFrame\n\n if (!request) {\n const vendors = ['ms', 'moz', 'webkit', 'o']\n\n for (const vendor of vendors) {\n request = global[`${vendor}RequestAnimationFrame` as 'requestAnimationFrame']\n cancel =\n global[`${vendor}CancelAnimationFrame` as 'cancelAnimationFrame'] ||\n global[`${vendor}CancelRequestAnimationFrame` as 'cancelAnimationFrame']\n }\n }\n\n request = request && request.bind(global)\n cancel = cancel && cancel.bind(global)\n\n if (!request) {\n request = (callback) => {\n const currTime = Date.now()\n const timeToCall = Math.max(0, 16 - (currTime - lastTime))\n const token = global.setTimeout(() => {\n // eslint-disable-next-line n/no-callback-literal\n callback(currTime + timeToCall)\n }, timeToCall)\n\n lastTime = currTime + timeToCall\n return token as any\n }\n\n cancel = (token) => clearTimeout(token)\n }\n}\n\nexport default {\n request: (callback: FrameRequestCallback) => request(callback),\n cancel: (token: number) => cancel(token),\n init,\n}\n", "import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, PointerType } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport raf from '@interactjs/utils/raf'\nimport { getStringOptionResult } from '@interactjs/utils/rect'\nimport { getWindow } from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n autoScroll: typeof autoScroll\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n autoScroll?: typeof autoScroll\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface PerActionDefaults {\n autoScroll?: AutoScrollOptions\n }\n}\n\nexport interface AutoScrollOptions {\n container?: Window | HTMLElement | string\n margin?: number\n distance?: number\n interval?: number\n speed?: number\n enabled?: boolean\n}\n\nfunction install (scope: Scope) {\n const { defaults, actions } = scope\n\n scope.autoScroll = autoScroll\n autoScroll.now = () => scope.now()\n\n actions.phaselessTypes.autoscroll = true\n defaults.perAction.autoScroll = autoScroll.defaults\n}\n\nconst autoScroll = {\n defaults: {\n enabled: false,\n margin: 60,\n\n // the item that is scrolled (Window or HTMLElement)\n container: null as AutoScrollOptions['container'],\n\n // the scroll speed in pixels per second\n speed: 300,\n } as AutoScrollOptions,\n\n now: Date.now,\n\n interaction: null as Interaction | null,\n i: 0, // the handle returned by window.setInterval\n\n // Direction each pulse is to scroll in\n x: 0,\n y: 0,\n\n isScrolling: false,\n prevTime: 0,\n margin: 0,\n speed: 0,\n\n start (interaction: Interaction) {\n autoScroll.isScrolling = true\n raf.cancel(autoScroll.i)\n\n interaction.autoScroll = autoScroll\n autoScroll.interaction = interaction\n autoScroll.prevTime = autoScroll.now()\n autoScroll.i = raf.request(autoScroll.scroll)\n },\n\n stop () {\n autoScroll.isScrolling = false\n if (autoScroll.interaction) {\n autoScroll.interaction.autoScroll = null\n }\n raf.cancel(autoScroll.i)\n },\n\n // scroll the window by the values in scroll.x/y\n scroll () {\n const { interaction } = autoScroll\n const { interactable, element } = interaction\n const actionName = interaction.prepared.name\n const options = interactable.options[actionName].autoScroll\n const container = getContainer(options.container, interactable, element)\n const now = autoScroll.now()\n // change in time in seconds\n const dt = (now - autoScroll.prevTime) / 1000\n // displacement\n const s = options.speed * dt\n\n if (s >= 1) {\n const scrollBy = {\n x: autoScroll.x * s,\n y: autoScroll.y * s,\n }\n\n if (scrollBy.x || scrollBy.y) {\n const prevScroll = getScroll(container)\n\n if (is.window(container)) {\n container.scrollBy(scrollBy.x, scrollBy.y)\n } else if (container) {\n container.scrollLeft += scrollBy.x\n container.scrollTop += scrollBy.y\n }\n\n const curScroll = getScroll(container)\n const delta = {\n x: curScroll.x - prevScroll.x,\n y: curScroll.y - prevScroll.y,\n }\n\n if (delta.x || delta.y) {\n interactable.fire({\n type: 'autoscroll',\n target: element,\n interactable,\n delta,\n interaction,\n container,\n })\n }\n }\n\n autoScroll.prevTime = now\n }\n\n if (autoScroll.isScrolling) {\n raf.cancel(autoScroll.i)\n autoScroll.i = raf.request(autoScroll.scroll)\n }\n },\n check (interactable: Interactable, actionName: ActionName) {\n const options = interactable.options\n\n return options[actionName].autoScroll?.enabled\n },\n onInteractionMove ({\n interaction,\n pointer,\n }: {\n interaction: Interaction\n pointer: PointerType\n }) {\n if (\n !(interaction.interacting() && autoScroll.check(interaction.interactable, interaction.prepared.name))\n ) {\n return\n }\n\n if (interaction.simulation) {\n autoScroll.x = autoScroll.y = 0\n return\n }\n\n let top: boolean\n let right: boolean\n let bottom: boolean\n let left: boolean\n\n const { interactable, element } = interaction\n const actionName = interaction.prepared.name\n const options = interactable.options[actionName].autoScroll\n const container = getContainer(options.container, interactable, element)\n\n if (is.window(container)) {\n left = pointer.clientX < autoScroll.margin\n top = pointer.clientY < autoScroll.margin\n right = pointer.clientX > container.innerWidth - autoScroll.margin\n bottom = pointer.clientY > container.innerHeight - autoScroll.margin\n } else {\n const rect = domUtils.getElementClientRect(container)\n\n left = pointer.clientX < rect.left + autoScroll.margin\n top = pointer.clientY < rect.top + autoScroll.margin\n right = pointer.clientX > rect.right - autoScroll.margin\n bottom = pointer.clientY > rect.bottom - autoScroll.margin\n }\n\n autoScroll.x = right ? 1 : left ? -1 : 0\n autoScroll.y = bottom ? 1 : top ? -1 : 0\n\n if (!autoScroll.isScrolling) {\n // set the autoScroll properties to those of the target\n autoScroll.margin = options.margin\n autoScroll.speed = options.speed\n\n autoScroll.start(interaction)\n }\n },\n}\n\nexport function getContainer (value: any, interactable: Interactable, element: Element) {\n return (\n (is.string(value) ? getStringOptionResult(value, interactable, element) : value) || getWindow(element)\n )\n}\n\nexport function getScroll (container: any) {\n if (is.window(container)) {\n container = window.document.body\n }\n\n return { x: container.scrollLeft, y: container.scrollTop }\n}\n\nexport function getScrollSize (container: any) {\n if (is.window(container)) {\n container = window.document.body\n }\n\n return { x: container.scrollWidth, y: container.scrollHeight }\n}\n\nexport function getScrollSizeDelta (\n {\n interaction,\n element,\n }: {\n interaction: Partial>\n element: Element\n },\n func: any,\n) {\n const scrollOptions = interaction && interaction.interactable.options[interaction.prepared.name].autoScroll\n\n if (!scrollOptions || !scrollOptions.enabled) {\n func()\n return { x: 0, y: 0 }\n }\n\n const scrollContainer = getContainer(scrollOptions.container, interaction.interactable, element)\n\n const prevSize = getScroll(scrollContainer)\n func()\n const curSize = getScroll(scrollContainer)\n\n return {\n x: curSize.x - prevSize.x,\n y: curSize.y - prevSize.y,\n }\n}\n\nconst autoScrollPlugin: Plugin = {\n id: 'auto-scroll',\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.autoScroll = null\n },\n\n 'interactions:destroy': ({ interaction }) => {\n interaction.autoScroll = null\n autoScroll.stop()\n if (autoScroll.interaction) {\n autoScroll.interaction = null\n }\n },\n\n 'interactions:stop': autoScroll.stop,\n\n 'interactions:action-move': (arg: any) => autoScroll.onInteractionMove(arg),\n },\n}\n\nexport default autoScrollPlugin\n", "import type { ActionName, ActionProps } from '@interactjs/core/types'\n\nimport { window } from './window'\n\nexport function warnOnce (this: T, method: (...args: any[]) => any, message: string) {\n let warned = false\n\n return function (this: T) {\n if (!warned) {\n ;(window as any).console.warn(message)\n warned = true\n }\n\n return method.apply(this, arguments)\n }\n}\n\nexport function copyAction (dest: ActionProps, src: ActionProps) {\n dest.name = src.name\n dest.axis = src.axis\n dest.edges = src.edges\n\n return dest\n}\n\nexport const sign = (n: number) => (n >= 0 ? 1 : -1)\n", "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { ActionProps, PointerType, PointerEventType, Element } from '@interactjs/core/types'\nimport is from '@interactjs/utils/is'\nimport { warnOnce } from '@interactjs/utils/misc'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n getAction: (\n this: Interactable,\n pointer: PointerType,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n ) => ActionProps | null\n styleCursor: typeof styleCursor\n actionChecker: typeof actionChecker\n ignoreFrom: {\n (...args: any[]): Interactable\n (): boolean\n }\n allowFrom: {\n (...args: any[]): Interactable\n (): boolean\n }\n }\n}\n\nfunction install (scope: Scope) {\n const {\n /** @lends Interactable */\n Interactable, // tslint:disable-line no-shadowed-variable\n } = scope\n\n Interactable.prototype.getAction = function getAction (\n this: Interactable,\n pointer: PointerType,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n ): ActionProps {\n const action = defaultActionChecker(this, event, interaction, element, scope)\n\n if (this.options.actionChecker) {\n return this.options.actionChecker(pointer, event, action, this, element, interaction)\n }\n\n return action\n }\n\n /**\n * If the target of the `mousedown`, `pointerdown` or `touchstart` event or any\n * of it's parents match the given CSS selector or Element, no\n * drag/resize/gesture is started.\n *\n * @deprecated\n * Don't use this method. Instead set the `ignoreFrom` option for each action\n * or for `pointerEvents`\n *\n * ```js\n * interact(targett)\n * .draggable({\n * ignoreFrom: 'input, textarea, a[href]'',\n * })\n * .pointerEvents({\n * ignoreFrom: '[no-pointer]',\n * })\n * ```\n *\n * @param {string | Element | null} [newValue] a CSS selector string, an\n * Element or `null` to not ignore any elements\n * @return {string | Element | object} The current ignoreFrom value or this\n * Interactable\n */\n Interactable.prototype.ignoreFrom = warnOnce(function (this: Interactable, newValue) {\n return this._backCompatOption('ignoreFrom', newValue)\n }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).')\n\n /**\n *\n * A drag/resize/gesture is started only If the target of the `mousedown`,\n * `pointerdown` or `touchstart` event or any of it's parents match the given\n * CSS selector or Element.\n *\n * @deprecated\n * Don't use this method. Instead set the `allowFrom` option for each action\n * or for `pointerEvents`\n *\n * ```js\n * interact(targett)\n * .resizable({\n * allowFrom: '.resize-handle',\n * .pointerEvents({\n * allowFrom: '.handle',,\n * })\n * ```\n *\n * @param {string | Element | null} [newValue] a CSS selector string, an\n * Element or `null` to allow from any element\n * @return {string | Element | object} The current allowFrom value or this\n * Interactable\n */\n Interactable.prototype.allowFrom = warnOnce(function (this: Interactable, newValue) {\n return this._backCompatOption('allowFrom', newValue)\n }, 'Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue}).')\n\n /**\n * ```js\n * interact('.resize-drag')\n * .resizable(true)\n * .draggable(true)\n * .actionChecker(function (pointer, event, action, interactable, element, interaction) {\n *\n * if (interact.matchesSelector(event.target, '.drag-handle')) {\n * // force drag with handle target\n * action.name = drag\n * }\n * else {\n * // resize from the top and right edges\n * action.name = 'resize'\n * action.edges = { top: true, right: true }\n * }\n *\n * return action\n * })\n * ```\n *\n * Returns or sets the function used to check action to be performed on\n * pointerDown\n *\n * @param {function | null} [checker] A function which takes a pointer event,\n * defaultAction string, interactable, element and interaction as parameters\n * and returns an object with name property 'drag' 'resize' or 'gesture' and\n * optionally an `edges` object with boolean 'top', 'left', 'bottom' and right\n * props.\n * @return {Function | Interactable} The checker function or this Interactable\n */\n Interactable.prototype.actionChecker = actionChecker\n\n /**\n * Returns or sets whether the the cursor should be changed depending on the\n * action that would be performed if the mouse were pressed and dragged.\n *\n * @param {boolean} [newValue]\n * @return {boolean | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.styleCursor = styleCursor\n}\n\nfunction defaultActionChecker (\n interactable: Interactable,\n event: PointerEventType,\n interaction: Interaction,\n element: Element,\n scope: Scope,\n) {\n const rect = interactable.getRect(element)\n const buttons =\n (event as MouseEvent).buttons ||\n {\n 0: 1,\n 1: 4,\n 3: 8,\n 4: 16,\n }[(event as MouseEvent).button as 0 | 1 | 3 | 4]\n const arg = {\n action: null,\n interactable,\n interaction,\n element,\n rect,\n buttons,\n }\n\n scope.fire('auto-start:check', arg)\n\n return arg.action\n}\n\nfunction styleCursor(this: Interactable): boolean\nfunction styleCursor(this: Interactable, newValue: boolean): typeof this\nfunction styleCursor (this: Interactable, newValue?: boolean) {\n if (is.bool(newValue)) {\n this.options.styleCursor = newValue\n\n return this\n }\n\n if (newValue === null) {\n delete this.options.styleCursor\n\n return this\n }\n\n return this.options.styleCursor\n}\n\nfunction actionChecker (this: Interactable, checker: any) {\n if (is.func(checker)) {\n this.options.actionChecker = checker\n\n return this\n }\n\n if (checker === null) {\n delete this.options.actionChecker\n\n return this\n }\n\n return this.options.actionChecker\n}\n\nexport default {\n id: 'auto-start/interactableMethods',\n install,\n}\n", "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type {\n CursorChecker,\n PointerType,\n PointerEventType,\n Element,\n ActionName,\n ActionProps,\n} from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport { copyAction } from '@interactjs/utils/misc'\n\nimport InteractableMethods from './InteractableMethods'\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n maxInteractions: (newValue: any) => any\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n autoStart: AutoStart\n }\n\n interface SignalArgs {\n 'autoStart:before-start': Omit & {\n interaction: Interaction\n }\n 'autoStart:prepared': { interaction: Interaction }\n 'auto-start:check': CheckSignalArg\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface BaseDefaults {\n actionChecker?: any\n cursorChecker?: any\n styleCursor?: any\n }\n\n interface PerActionDefaults {\n manualStart?: boolean\n max?: number\n maxPerElement?: number\n allowFrom?: string | Element\n ignoreFrom?: string | Element\n cursorChecker?: CursorChecker\n\n // only allow left button by default\n // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value\n // TODO: docst\n mouseButtons?: 0 | 1 | 2 | 4 | 8 | 16\n }\n}\n\ninterface CheckSignalArg {\n interactable: Interactable\n interaction: Interaction\n element: Element\n action: ActionProps\n buttons: number\n}\n\nexport interface AutoStart {\n // Allow this many interactions to happen simultaneously\n maxInteractions: number\n withinInteractionLimit: typeof withinInteractionLimit\n cursorElement: Element\n}\n\nfunction install (scope: Scope) {\n const { interactStatic: interact, defaults } = scope\n\n scope.usePlugin(InteractableMethods)\n\n defaults.base.actionChecker = null\n defaults.base.styleCursor = true\n\n extend(defaults.perAction, {\n manualStart: false,\n max: Infinity,\n maxPerElement: 1,\n allowFrom: null,\n ignoreFrom: null,\n\n // only allow left button by default\n // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value\n mouseButtons: 1,\n })\n\n /**\n * Returns or sets the maximum number of concurrent interactions allowed. By\n * default only 1 interaction is allowed at a time (for backwards\n * compatibility). To allow multiple interactions on the same Interactables and\n * elements, you need to enable it in the draggable, resizable and gesturable\n * `'max'` and `'maxPerElement'` options.\n *\n * @alias module:interact.maxInteractions\n *\n * @param {number} [newValue] Any number. newValue <= 0 means no interactions.\n */\n interact.maxInteractions = (newValue: number) => maxInteractions(newValue, scope)\n\n scope.autoStart = {\n // Allow this many interactions to happen simultaneously\n maxInteractions: Infinity,\n withinInteractionLimit,\n cursorElement: null,\n }\n}\n\nfunction prepareOnDown (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:down'],\n scope: Scope,\n) {\n if (interaction.interacting()) return\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction prepareOnMove (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:move'],\n scope: Scope,\n) {\n if (interaction.pointerType !== 'mouse' || interaction.pointerIsDown || interaction.interacting()) return\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget as Element, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction startOnMove (arg: SignalArgs['interactions:move'], scope: Scope) {\n const { interaction } = arg\n\n if (\n !interaction.pointerIsDown ||\n interaction.interacting() ||\n !interaction.pointerWasMoved ||\n !interaction.prepared.name\n ) {\n return\n }\n\n scope.fire('autoStart:before-start', arg)\n\n const { interactable } = interaction\n const actionName = (interaction as Interaction).prepared.name\n\n if (actionName && interactable) {\n // check manualStart and interaction limit\n if (\n interactable.options[actionName].manualStart ||\n !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)\n ) {\n interaction.stop()\n } else {\n interaction.start(interaction.prepared, interactable, interaction.element)\n setInteractionCursor(interaction, scope)\n }\n }\n}\n\nfunction clearCursorOnStop ({ interaction }: { interaction: Interaction }, scope: Scope) {\n const { interactable } = interaction\n\n if (interactable && interactable.options.styleCursor) {\n setCursor(interaction.element, '', scope)\n }\n}\n\n// Check if the current interactable supports the action.\n// If so, return the validated action. Otherwise, return null\nfunction validateAction (\n action: ActionProps,\n interactable: Interactable,\n element: Element,\n eventTarget: Node,\n scope: Scope,\n) {\n if (\n interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) &&\n interactable.options[action.name].enabled &&\n withinInteractionLimit(interactable, element, action, scope)\n ) {\n return action\n }\n\n return null\n}\n\nfunction validateMatches (\n interaction: Interaction,\n pointer: PointerType,\n event: PointerEventType,\n matches: Interactable[],\n matchElements: Element[],\n eventTarget: Node,\n scope: Scope,\n) {\n for (let i = 0, len = matches.length; i < len; i++) {\n const match = matches[i]\n const matchElement = matchElements[i]\n const matchAction = match.getAction(pointer, event, interaction, matchElement)\n\n if (!matchAction) {\n continue\n }\n\n const action = validateAction(matchAction, match, matchElement, eventTarget, scope)\n\n if (action) {\n return {\n action,\n interactable: match,\n element: matchElement,\n }\n }\n }\n\n return { action: null, interactable: null, element: null }\n}\n\nfunction getActionInfo (\n interaction: Interaction,\n pointer: PointerType,\n event: PointerEventType,\n eventTarget: Node,\n scope: Scope,\n) {\n let matches: Interactable[] = []\n let matchElements: Element[] = []\n\n let element = eventTarget as Element\n\n function pushMatches (interactable: Interactable) {\n matches.push(interactable)\n matchElements.push(element)\n }\n\n while (is.element(element)) {\n matches = []\n matchElements = []\n\n scope.interactables.forEachMatch(element, pushMatches)\n\n const actionInfo = validateMatches(\n interaction,\n pointer,\n event,\n matches,\n matchElements,\n eventTarget,\n scope,\n )\n\n if (actionInfo.action && !actionInfo.interactable.options[actionInfo.action.name].manualStart) {\n return actionInfo\n }\n\n element = domUtils.parentNode(element) as Element\n }\n\n return { action: null, interactable: null, element: null }\n}\n\nfunction prepare (\n interaction: Interaction,\n {\n action,\n interactable,\n element,\n }: {\n action: ActionProps\n interactable: Interactable\n element: Element\n },\n scope: Scope,\n) {\n action = action || { name: null }\n\n interaction.interactable = interactable\n interaction.element = element\n copyAction(interaction.prepared, action)\n\n interaction.rect = interactable && action.name ? interactable.getRect(element) : null\n\n setInteractionCursor(interaction, scope)\n\n scope.fire('autoStart:prepared', { interaction })\n}\n\nfunction withinInteractionLimit (\n interactable: Interactable,\n element: Element,\n action: ActionProps,\n scope: Scope,\n) {\n const options = interactable.options\n const maxActions = options[action.name].max\n const maxPerElement = options[action.name].maxPerElement\n const autoStartMax = scope.autoStart.maxInteractions\n let activeInteractions = 0\n let interactableCount = 0\n let elementCount = 0\n\n // no actions if any of these values == 0\n if (!(maxActions && maxPerElement && autoStartMax)) {\n return false\n }\n\n for (const interaction of scope.interactions.list) {\n const otherAction = interaction.prepared.name\n\n if (!interaction.interacting()) {\n continue\n }\n\n activeInteractions++\n\n if (activeInteractions >= autoStartMax) {\n return false\n }\n\n if (interaction.interactable !== interactable) {\n continue\n }\n\n interactableCount += otherAction === action.name ? 1 : 0\n\n if (interactableCount >= maxActions) {\n return false\n }\n\n if (interaction.element === element) {\n elementCount++\n\n if (otherAction === action.name && elementCount >= maxPerElement) {\n return false\n }\n }\n }\n\n return autoStartMax > 0\n}\n\nfunction maxInteractions (newValue: any, scope: Scope) {\n if (is.number(newValue)) {\n scope.autoStart.maxInteractions = newValue\n\n return this\n }\n\n return scope.autoStart.maxInteractions\n}\n\nfunction setCursor (element: Element, cursor: string, scope: Scope) {\n const { cursorElement: prevCursorElement } = scope.autoStart\n\n if (prevCursorElement && prevCursorElement !== element) {\n prevCursorElement.style.cursor = ''\n }\n\n element.ownerDocument.documentElement.style.cursor = cursor\n element.style.cursor = cursor\n scope.autoStart.cursorElement = cursor ? element : null\n}\n\nfunction setInteractionCursor (interaction: Interaction, scope: Scope) {\n const { interactable, element, prepared } = interaction\n\n if (!(interaction.pointerType === 'mouse' && interactable && interactable.options.styleCursor)) {\n // clear previous target element cursor\n if (scope.autoStart.cursorElement) {\n setCursor(scope.autoStart.cursorElement, '', scope)\n }\n\n return\n }\n\n let cursor = ''\n\n if (prepared.name) {\n const cursorChecker = interactable.options[prepared.name].cursorChecker\n\n if (is.func(cursorChecker)) {\n cursor = cursorChecker(prepared, interactable, element, interaction._interacting)\n } else {\n cursor = scope.actions.map[prepared.name].getCursor(prepared)\n }\n }\n\n setCursor(interaction.element, cursor || '', scope)\n}\n\nconst autoStart: Plugin = {\n id: 'auto-start/base',\n before: ['actions'],\n install,\n listeners: {\n 'interactions:down': prepareOnDown,\n 'interactions:move': (arg, scope) => {\n prepareOnMove(arg, scope)\n startOnMove(arg, scope)\n },\n 'interactions:stop': clearCursorOnStop,\n },\n maxInteractions,\n withinInteractionLimit,\n validateAction,\n}\n\nexport default autoStart\n", "import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { SignalArgs, Scope } from '@interactjs/core/scope'\nimport type { ActionName, Element } from '@interactjs/core/types'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\n\nimport autoStart from './base'\n\nfunction beforeStart ({ interaction, eventTarget, dx, dy }: SignalArgs['interactions:move'], scope: Scope) {\n if (interaction.prepared.name !== 'drag') return\n\n // check if a drag is in the correct axis\n const absX = Math.abs(dx)\n const absY = Math.abs(dy)\n const targetOptions = interaction.interactable.options.drag\n const startAxis = targetOptions.startAxis\n const currentAxis = absX > absY ? 'x' : absX < absY ? 'y' : 'xy'\n\n interaction.prepared.axis =\n targetOptions.lockAxis === 'start'\n ? (currentAxis[0] as 'x' | 'y') // always lock to one axis even if currentAxis === 'xy'\n : targetOptions.lockAxis\n\n // if the movement isn't in the startAxis of the interactable\n if (currentAxis !== 'xy' && startAxis !== 'xy' && startAxis !== currentAxis) {\n // cancel the prepared action\n ;(interaction as Interaction).prepared.name = null\n\n // then try to get a drag from another ineractable\n let element = eventTarget as Element\n\n const getDraggable = function (interactable: Interactable): Interactable | void {\n if (interactable === interaction.interactable) return\n\n const options = interaction.interactable.options.drag\n\n if (!options.manualStart && interactable.testIgnoreAllow(options, element, eventTarget)) {\n const action = interactable.getAction(\n interaction.downPointer,\n interaction.downEvent,\n interaction,\n element,\n )\n\n if (\n action &&\n action.name === 'drag' &&\n checkStartAxis(currentAxis, interactable) &&\n autoStart.validateAction(action, interactable, element, eventTarget, scope)\n ) {\n return interactable\n }\n }\n }\n\n // check all interactables\n while (is.element(element)) {\n const interactable = scope.interactables.forEachMatch(element, getDraggable)\n\n if (interactable) {\n ;(interaction as Interaction).prepared.name = 'drag'\n interaction.interactable = interactable\n interaction.element = element\n break\n }\n\n element = parentNode(element) as Element\n }\n }\n}\n\nfunction checkStartAxis (startAxis: string, interactable: Interactable) {\n if (!interactable) {\n return false\n }\n\n const thisAxis = interactable.options.drag.startAxis\n\n return startAxis === 'xy' || thisAxis === 'xy' || thisAxis === startAxis\n}\n\nexport default {\n id: 'auto-start/dragAxis',\n listeners: { 'autoStart:before-start': beforeStart },\n}\n", "import type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\n\nimport basePlugin from './base'\n\ndeclare module '@interactjs/core/options' {\n interface PerActionDefaults {\n hold?: number\n delay?: number\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n autoStartHoldTimer?: any\n }\n}\n\nfunction install (scope: Scope) {\n const { defaults } = scope\n\n scope.usePlugin(basePlugin)\n\n defaults.perAction.hold = 0\n defaults.perAction.delay = 0\n}\n\nfunction getHoldDuration (interaction: Interaction) {\n const actionName = interaction.prepared && interaction.prepared.name\n\n if (!actionName) {\n return null\n }\n\n const options = interaction.interactable.options\n\n return options[actionName].hold || options[actionName].delay\n}\n\nconst hold: Plugin = {\n id: 'auto-start/hold',\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.autoStartHoldTimer = null\n },\n\n 'autoStart:prepared': ({ interaction }) => {\n const hold = getHoldDuration(interaction)\n\n if (hold > 0) {\n interaction.autoStartHoldTimer = setTimeout(() => {\n interaction.start(interaction.prepared, interaction.interactable, interaction.element)\n }, hold)\n }\n },\n\n 'interactions:move': ({ interaction, duplicate }) => {\n if (interaction.autoStartHoldTimer && interaction.pointerWasMoved && !duplicate) {\n clearTimeout(interaction.autoStartHoldTimer)\n interaction.autoStartHoldTimer = null\n }\n },\n\n // prevent regular down->move autoStart\n 'autoStart:before-start': ({ interaction }) => {\n const holdDuration = getHoldDuration(interaction)\n\n if (holdDuration > 0) {\n interaction.prepared.name = null\n }\n },\n },\n getHoldDuration,\n}\nexport default hold\n", "import type { Scope } from '@interactjs/core/scope'\n\nimport autoStart from './base'\nimport dragAxis from './dragAxis'\nimport hold from './hold'\n\nexport default {\n id: 'auto-start',\n install (scope: Scope) {\n scope.usePlugin(autoStart)\n scope.usePlugin(hold)\n scope.usePlugin(dragAxis)\n },\n}\n", "import type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { PointerEventType } from '@interactjs/core/types'\nimport { matchesSelector, nodeContains } from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport { getWindow } from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n preventDefault: typeof preventDefault\n checkAndPreventDefault: (event: Event) => void\n }\n}\n\ntype PreventDefaultValue = 'always' | 'never' | 'auto'\nfunction preventDefault(this: Interactable): PreventDefaultValue\nfunction preventDefault(this: Interactable, newValue: PreventDefaultValue): typeof this\nfunction preventDefault (this: Interactable, newValue?: PreventDefaultValue) {\n if (/^(always|never|auto)$/.test(newValue)) {\n this.options.preventDefault = newValue\n return this\n }\n\n if (is.bool(newValue)) {\n this.options.preventDefault = newValue ? 'always' : 'never'\n return this\n }\n\n return this.options.preventDefault\n}\n\nfunction checkAndPreventDefault (interactable: Interactable, scope: Scope, event: Event) {\n const setting = interactable.options.preventDefault\n\n if (setting === 'never') return\n\n if (setting === 'always') {\n event.preventDefault()\n return\n }\n\n // setting === 'auto'\n\n // if the browser supports passive event listeners and isn't running on iOS,\n // don't preventDefault of touch{start,move} events. CSS touch-action and\n // user-select should be used instead of calling event.preventDefault().\n if (scope.events.supportsPassive && /^touch(start|move)$/.test(event.type)) {\n const doc = getWindow(event.target).document\n const docOptions = scope.getDocOptions(doc)\n\n if (!(docOptions && docOptions.events) || docOptions.events.passive !== false) {\n return\n }\n }\n\n // don't preventDefault of pointerdown events\n if (/^(mouse|pointer|touch)*(down|start)/i.test(event.type)) {\n return\n }\n\n // don't preventDefault on editable elements\n if (\n is.element(event.target) &&\n matchesSelector(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')\n ) {\n return\n }\n\n event.preventDefault()\n}\n\nfunction onInteractionEvent ({ interaction, event }: { interaction: Interaction, event: PointerEventType }) {\n if (interaction.interactable) {\n interaction.interactable.checkAndPreventDefault(event as Event)\n }\n}\n\nexport function install (scope: Scope) {\n /** @lends Interactable */\n const { Interactable } = scope\n\n /**\n * Returns or sets whether to prevent the browser's default behaviour in\n * response to pointer events. Can be set to:\n * - `'always'` to always prevent\n * - `'never'` to never prevent\n * - `'auto'` to let interact.js try to determine what would be best\n *\n * @param {string} [newValue] `'always'`, `'never'` or `'auto'`\n * @return {string | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.preventDefault = preventDefault\n\n Interactable.prototype.checkAndPreventDefault = function (event) {\n return checkAndPreventDefault(this, scope, event)\n }\n\n // prevent native HTML5 drag on interact.js target elements\n scope.interactions.docEvents.push({\n type: 'dragstart',\n listener (event) {\n for (const interaction of scope.interactions.list) {\n if (\n interaction.element &&\n (interaction.element === event.target || nodeContains(interaction.element, event.target))\n ) {\n interaction.interactable.checkAndPreventDefault(event)\n return\n }\n }\n },\n })\n}\n\nexport default {\n id: 'core/interactablePreventDefault',\n install,\n listeners: ['down', 'move', 'up', 'cancel'].reduce((acc, eventType) => {\n acc[`interactions:${eventType}`] = onInteractionEvent\n return acc\n }, {} as any),\n}\n", "export default {}\n", "import type Interaction from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element, OptionMethod } from '@interactjs/core/types'\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport visualizer from '@interactjs/dev-tools/visualizer/plugin'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport * as win from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n logger: Logger\n }\n}\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n visializer: typeof visualizer\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface BaseDefaults {\n devTools?: DevToolsOptions\n }\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n devTools: OptionMethod\n }\n}\n\nexport interface DevToolsOptions {\n ignore: { [P in keyof typeof CheckName]?: boolean }\n}\n\nexport interface Logger {\n warn: (...args: any[]) => void\n error: (...args: any[]) => void\n log: (...args: any[]) => void\n}\n\nexport interface Check {\n name: CheckName\n text: string\n perform: (interaction: Interaction) => boolean\n getInfo: (interaction: Interaction) => any[]\n}\n\nenum CheckName {\n touchAction = 'touchAction',\n boxSizing = 'boxSizing',\n noListeners = 'noListeners',\n}\n\nconst prefix = '[interact.js] '\nconst links = {\n touchAction: 'https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action',\n boxSizing: 'https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing',\n}\n\n// eslint-disable-next-line no-undef\nconst isProduction = process.env.NODE_ENV === 'production'\n\nfunction install (scope: Scope, { logger }: { logger?: Logger } = {}) {\n const { Interactable, defaults } = scope\n\n scope.logger = logger || console\n\n defaults.base.devTools = {\n ignore: {},\n }\n\n Interactable.prototype.devTools = function (options?: object) {\n if (options) {\n extend(this.options.devTools, options)\n return this\n }\n\n return this.options.devTools\n }\n\n scope.usePlugin(visualizer)\n}\n\nconst checks: Check[] = [\n {\n name: CheckName.touchAction,\n perform ({ element }) {\n return !parentHasStyle(element, 'touchAction', /pan-|pinch|none/)\n },\n getInfo ({ element }) {\n return [element, links.touchAction]\n },\n text: 'Consider adding CSS \"touch-action: none\" to this element\\n',\n },\n\n {\n name: CheckName.boxSizing,\n perform (interaction) {\n const { element } = interaction\n\n return (\n interaction.prepared.name === 'resize' &&\n element instanceof domObjects.HTMLElement &&\n !hasStyle(element, 'boxSizing', /border-box/)\n )\n },\n text: 'Consider adding CSS \"box-sizing: border-box\" to this resizable element',\n getInfo ({ element }) {\n return [element, links.boxSizing]\n },\n },\n\n {\n name: CheckName.noListeners,\n perform (interaction) {\n const actionName = interaction.prepared.name\n const moveListeners = interaction.interactable.events.types[`${actionName}move`] || []\n\n return !moveListeners.length\n },\n getInfo (interaction) {\n return [interaction.prepared.name, interaction.interactable]\n },\n text: 'There are no listeners set for this action',\n },\n]\n\nfunction hasStyle (element: HTMLElement, prop: keyof CSSStyleDeclaration, styleRe: RegExp) {\n const value = element.style[prop] || win.window.getComputedStyle(element)[prop]\n return styleRe.test((value || '').toString())\n}\n\nfunction parentHasStyle (element: Element, prop: keyof CSSStyleDeclaration, styleRe: RegExp) {\n let parent = element as HTMLElement\n\n while (is.element(parent)) {\n if (hasStyle(parent, prop, styleRe)) {\n return true\n }\n\n parent = parentNode(parent) as HTMLElement\n }\n\n return false\n}\n\nconst id = 'dev-tools'\nconst defaultExport: Plugin = isProduction\n ? { id, install: () => {} }\n : {\n id,\n install,\n listeners: {\n 'interactions:action-start': ({ interaction }, scope) => {\n for (const check of checks) {\n const options = interaction.interactable && interaction.interactable.options\n\n if (\n !(options && options.devTools && options.devTools.ignore[check.name]) &&\n check.perform(interaction)\n ) {\n scope.logger.warn(prefix + check.text, ...check.getInfo(interaction))\n }\n }\n },\n },\n checks,\n CheckName,\n links,\n prefix,\n }\n\nexport default defaultExport\n", "import * as arr from './arr'\nimport is from './is'\n\n// tslint:disable-next-line ban-types\nexport default function clone (source: T): Partial {\n const dest = {} as Partial\n\n for (const prop in source) {\n const value = source[prop]\n\n if (is.plainObject(value)) {\n dest[prop] = clone(value) as any\n } else if (is.array(value)) {\n dest[prop] = arr.from(value) as typeof value\n } else {\n dest[prop] = value\n }\n }\n\n return dest\n}\n", "import type { EventPhase } from '@interactjs/core/InteractEvent'\nimport type { Interaction, DoAnyPhaseArg } from '@interactjs/core/Interaction'\nimport type { EdgeOptions, FullRect, Point, Rect } from '@interactjs/core/types'\nimport clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { Modifier, ModifierArg, ModifierState } from './base'\n\nexport interface ModificationResult {\n delta: Point\n rectDelta: Rect\n coords: Point\n rect: FullRect\n eventProps: any[]\n changed: boolean\n}\n\ninterface MethodArg {\n phase: EventPhase\n pageCoords: Point\n rect: FullRect\n coords: Point\n preEnd?: boolean\n skipModifiers?: number\n}\n\nexport default class Modification {\n states: ModifierState[] = []\n startOffset: Rect = { left: 0, right: 0, top: 0, bottom: 0 }\n startDelta!: Point\n result!: ModificationResult\n endResult!: Point\n edges!: EdgeOptions\n readonly interaction: Readonly\n\n constructor (interaction: Interaction) {\n this.interaction = interaction\n this.result = createResult()\n }\n\n start ({ phase }: { phase: EventPhase }, pageCoords: Point) {\n const { interaction } = this\n const modifierList = getModifierList(interaction)\n this.prepareStates(modifierList)\n\n this.edges = extend({}, interaction.edges)\n this.startOffset = getRectOffset(interaction.rect, pageCoords)\n this.startDelta = { x: 0, y: 0 }\n\n const arg = this.fillArg({\n phase,\n pageCoords,\n preEnd: false,\n })\n\n this.result = createResult()\n this.startAll(arg)\n\n const result = (this.result = this.setAll(arg))\n\n return result\n }\n\n fillArg (arg: Partial) {\n const { interaction } = this\n\n arg.interaction = interaction\n arg.interactable = interaction.interactable\n arg.element = interaction.element\n arg.rect = arg.rect || interaction.rect\n arg.edges = this.edges\n arg.startOffset = this.startOffset\n\n return arg as ModifierArg\n }\n\n startAll (arg: MethodArg & Partial) {\n for (const state of this.states) {\n if (state.methods.start) {\n arg.state = state\n state.methods.start(arg as ModifierArg)\n }\n }\n }\n\n setAll (arg: MethodArg & Partial): ModificationResult {\n const { phase, preEnd, skipModifiers, rect: unmodifiedRect } = arg\n\n arg.coords = extend({}, arg.pageCoords)\n arg.rect = extend({}, unmodifiedRect)\n\n const states = skipModifiers ? this.states.slice(skipModifiers) : this.states\n\n const newResult = createResult(arg.coords, arg.rect)\n\n for (const state of states) {\n const { options } = state\n const lastModifierCoords = extend({}, arg.coords)\n let returnValue = null\n\n if (state.methods?.set && this.shouldDo(options, preEnd, phase)) {\n arg.state = state\n returnValue = state.methods.set(arg as ModifierArg)\n\n rectUtils.addEdges(this.interaction.edges, arg.rect, {\n x: arg.coords.x - lastModifierCoords.x,\n y: arg.coords.y - lastModifierCoords.y,\n })\n }\n\n newResult.eventProps.push(returnValue)\n }\n\n newResult.delta.x = arg.coords.x - arg.pageCoords.x\n newResult.delta.y = arg.coords.y - arg.pageCoords.y\n\n newResult.rectDelta.left = arg.rect.left - unmodifiedRect.left\n newResult.rectDelta.right = arg.rect.right - unmodifiedRect.right\n newResult.rectDelta.top = arg.rect.top - unmodifiedRect.top\n newResult.rectDelta.bottom = arg.rect.bottom - unmodifiedRect.bottom\n\n const prevCoords = this.result.coords\n const prevRect = this.result.rect\n\n if (prevCoords && prevRect) {\n const rectChanged =\n newResult.rect.left !== prevRect.left ||\n newResult.rect.right !== prevRect.right ||\n newResult.rect.top !== prevRect.top ||\n newResult.rect.bottom !== prevRect.bottom\n\n newResult.changed =\n rectChanged || prevCoords.x !== newResult.coords.x || prevCoords.y !== newResult.coords.y\n }\n\n return newResult\n }\n\n applyToInteraction (arg: { phase: EventPhase, rect?: Rect }) {\n const { interaction } = this\n const { phase } = arg\n const curCoords = interaction.coords.cur\n const startCoords = interaction.coords.start\n const { result, startDelta } = this\n const curDelta = result.delta\n\n if (phase === 'start') {\n extend(this.startDelta, result.delta)\n }\n\n for (const [coordsSet, delta] of [\n [startCoords, startDelta],\n [curCoords, curDelta],\n ] as const) {\n coordsSet.page.x += delta.x\n coordsSet.page.y += delta.y\n coordsSet.client.x += delta.x\n coordsSet.client.y += delta.y\n }\n\n const { rectDelta } = this.result\n const rect = arg.rect || interaction.rect\n\n rect.left += rectDelta.left\n rect.right += rectDelta.right\n rect.top += rectDelta.top\n rect.bottom += rectDelta.bottom\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n setAndApply (\n arg: Partial & {\n phase: EventPhase\n preEnd?: boolean\n skipModifiers?: number\n modifiedCoords?: Point\n },\n ): void | false {\n const { interaction } = this\n const { phase, preEnd, skipModifiers } = arg\n\n const result = this.setAll(\n this.fillArg({\n preEnd,\n phase,\n pageCoords: arg.modifiedCoords || interaction.coords.cur.page,\n }),\n )\n\n this.result = result\n\n // don't fire an action move if a modifier would keep the event in the same\n // cordinates as before\n if (\n !result.changed &&\n (!skipModifiers || skipModifiers < this.states.length) &&\n interaction.interacting()\n ) {\n return false\n }\n\n if (arg.modifiedCoords) {\n const { page } = interaction.coords.cur\n const adjustment = {\n x: arg.modifiedCoords.x - page.x,\n y: arg.modifiedCoords.y - page.y,\n }\n\n result.coords.x += adjustment.x\n result.coords.y += adjustment.y\n result.delta.x += adjustment.x\n result.delta.y += adjustment.y\n }\n\n this.applyToInteraction(arg)\n }\n\n beforeEnd (arg: Omit & { state?: ModifierState }): void | false {\n const { interaction, event } = arg\n const states = this.states\n\n if (!states || !states.length) {\n return\n }\n\n let doPreend = false\n\n for (const state of states) {\n arg.state = state\n const { options, methods } = state\n\n const endPosition = methods.beforeEnd && methods.beforeEnd(arg as unknown as ModifierArg)\n\n if (endPosition) {\n this.endResult = endPosition\n return false\n }\n\n doPreend = doPreend || (!doPreend && this.shouldDo(options, true, arg.phase, true))\n }\n\n if (doPreend) {\n // trigger a final modified move before ending\n interaction.move({ event, preEnd: true })\n }\n }\n\n stop (arg: { interaction: Interaction }) {\n const { interaction } = arg\n\n if (!this.states || !this.states.length) {\n return\n }\n\n const modifierArg: Partial = extend(\n {\n states: this.states,\n interactable: interaction.interactable,\n element: interaction.element,\n rect: null,\n },\n arg,\n )\n\n this.fillArg(modifierArg)\n\n for (const state of this.states) {\n modifierArg.state = state\n\n if (state.methods.stop) {\n state.methods.stop(modifierArg as ModifierArg)\n }\n }\n\n this.states = null\n this.endResult = null\n }\n\n prepareStates (modifierList: Modifier[]) {\n this.states = []\n\n for (let index = 0; index < modifierList.length; index++) {\n const { options, methods, name } = modifierList[index]\n\n this.states.push({\n options,\n methods,\n index,\n name,\n })\n }\n\n return this.states\n }\n\n restoreInteractionCoords ({ interaction: { coords, rect, modification } }: { interaction: Interaction }) {\n if (!modification.result) return\n\n const { startDelta } = modification\n const { delta: curDelta, rectDelta } = modification.result\n\n const coordsAndDeltas = [\n [coords.start, startDelta],\n [coords.cur, curDelta],\n ]\n\n for (const [coordsSet, delta] of coordsAndDeltas as any) {\n coordsSet.page.x -= delta.x\n coordsSet.page.y -= delta.y\n coordsSet.client.x -= delta.x\n coordsSet.client.y -= delta.y\n }\n\n rect.left -= rectDelta.left\n rect.right -= rectDelta.right\n rect.top -= rectDelta.top\n rect.bottom -= rectDelta.bottom\n }\n\n shouldDo (options, preEnd?: boolean, phase?: string, requireEndOnly?: boolean) {\n if (\n // ignore disabled modifiers\n !options ||\n options.enabled === false ||\n // check if we require endOnly option to fire move before end\n (requireEndOnly && !options.endOnly) ||\n // don't apply endOnly modifiers when not ending\n (options.endOnly && !preEnd) ||\n // check if modifier should run be applied on start\n (phase === 'start' && !options.setStart)\n ) {\n return false\n }\n\n return true\n }\n\n copyFrom (other: Modification) {\n this.startOffset = other.startOffset\n this.startDelta = other.startDelta\n this.edges = other.edges\n this.states = other.states.map((s) => clone(s) as ModifierState)\n this.result = createResult(extend({}, other.result.coords), extend({}, other.result.rect))\n }\n\n destroy () {\n for (const prop in this) {\n this[prop] = null\n }\n }\n}\n\nfunction createResult (coords?: Point, rect?: FullRect): ModificationResult {\n return {\n rect,\n coords,\n delta: { x: 0, y: 0 },\n rectDelta: {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n },\n eventProps: [],\n changed: true,\n }\n}\n\nfunction getModifierList (interaction) {\n const actionOptions = interaction.interactable.options[interaction.prepared.name]\n const actionModifiers = actionOptions.modifiers\n\n if (actionModifiers && actionModifiers.length) {\n return actionModifiers\n }\n\n return ['snap', 'snapSize', 'snapEdges', 'restrict', 'restrictEdges', 'restrictSize']\n .map((type) => {\n const options = actionOptions[type]\n\n return (\n options &&\n options.enabled && {\n options,\n methods: options._methods,\n }\n )\n })\n .filter((m) => !!m)\n}\n\nexport function getRectOffset (rect, coords) {\n return rect\n ? {\n left: coords.x - rect.left,\n top: coords.y - rect.top,\n right: rect.right - coords.x,\n bottom: rect.bottom - coords.y,\n }\n : {\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n }\n}\n", "import type { EventPhase, InteractEvent } from '@interactjs/core/InteractEvent'\nimport type { Interactable } from '@interactjs/core/Interactable'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { Plugin } from '@interactjs/core/scope'\nimport type { EdgeOptions, FullRect, Point, Rect } from '@interactjs/core/types'\n\nimport Modification from './Modification'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n modification?: Modification\n }\n}\n\ndeclare module '@interactjs/core/InteractEvent' {\n interface InteractEvent {\n modifiers?: Array<{\n name: string\n [key: string]: any\n }>\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface PerActionDefaults {\n modifiers?: Modifier[]\n }\n}\n\nexport interface Modifier<\n Defaults = any,\n State extends ModifierState = any,\n Name extends string = any,\n Result = any,\n> {\n options: Defaults\n methods: {\n start?: (arg: ModifierArg) => void\n set?: (arg: ModifierArg) => Result\n beforeEnd?: (arg: ModifierArg) => Point | void\n stop?: (arg: ModifierArg) => void\n }\n name?: Name\n enable: () => Modifier\n disable: () => Modifier\n}\n\nexport type ModifierState = {\n options: Defaults\n methods?: Modifier['methods']\n index?: number\n name?: Name\n} & StateProps\n\nexport interface ModifierArg {\n interaction: Interaction\n interactable: Interactable\n phase: EventPhase\n rect: FullRect\n edges: EdgeOptions\n state: State\n element: Element\n pageCoords: Point\n prevCoords: Point\n prevRect?: FullRect\n coords: Point\n startOffset: Rect\n preEnd?: boolean\n}\n\nexport interface ModifierModule<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n Result = unknown,\n> {\n defaults?: Defaults\n start?(arg: ModifierArg): void\n set?(arg: ModifierArg): Result\n beforeEnd?(arg: ModifierArg): Point | void\n stop?(arg: ModifierArg): void\n}\n\nexport interface ModifierFunction<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n Name extends string,\n> {\n (_options?: Partial): Modifier\n _defaults: Defaults\n _methods: ModifierModule\n}\n\nexport function makeModifier<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n Name extends string,\n Result,\n> (module: ModifierModule, name?: Name) {\n const { defaults } = module\n const methods = {\n start: module.start,\n set: module.set,\n beforeEnd: module.beforeEnd,\n stop: module.stop,\n }\n\n const modifier = (_options?: Partial) => {\n const options = (_options || {}) as Defaults\n\n options.enabled = options.enabled !== false\n\n // add missing defaults to options\n for (const prop in defaults) {\n if (!(prop in options)) {\n ;(options as any)[prop] = defaults[prop]\n }\n }\n\n const m: Modifier = {\n options,\n methods,\n name,\n enable: () => {\n options.enabled = true\n return m\n },\n disable: () => {\n options.enabled = false\n return m\n },\n }\n\n return m\n }\n\n if (name && typeof name === 'string') {\n // for backwrads compatibility\n modifier._defaults = defaults\n modifier._methods = methods\n }\n\n return modifier\n}\n\nexport function addEventModifiers ({\n iEvent,\n interaction,\n}: {\n iEvent: InteractEvent\n interaction: Interaction\n}) {\n const result = interaction.modification!.result\n\n if (result) {\n iEvent.modifiers = result.eventProps\n }\n}\n\nconst modifiersBase: Plugin = {\n id: 'modifiers/base',\n before: ['actions'],\n install: (scope) => {\n scope.defaults.perAction.modifiers = []\n },\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.modification = new Modification(interaction)\n },\n\n 'interactions:before-action-start': (arg) => {\n const modification = arg.interaction.modification!\n\n modification.start(arg, arg.interaction.coords.start.page)\n arg.interaction.edges = modification.edges\n modification.applyToInteraction(arg)\n },\n\n 'interactions:before-action-move': (arg) => arg.interaction.modification.setAndApply(arg),\n\n 'interactions:before-action-end': (arg) => arg.interaction.modification.beforeEnd(arg),\n\n 'interactions:action-start': addEventModifiers,\n 'interactions:action-move': addEventModifiers,\n 'interactions:action-end': addEventModifiers,\n\n 'interactions:after-action-start': (arg) => arg.interaction.modification.restoreInteractionCoords(arg),\n 'interactions:after-action-move': (arg) => arg.interaction.modification.restoreInteractionCoords(arg),\n\n 'interactions:stop': (arg) => arg.interaction.modification.stop(arg),\n },\n}\n\nexport default modifiersBase\n", "import type { Point, Listeners, OrBoolean, Element } from '@interactjs/core/types'\n\nexport interface Defaults {\n base: BaseDefaults\n perAction: PerActionDefaults\n actions: ActionDefaults\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface ActionDefaults {}\n\nexport interface BaseDefaults {\n preventDefault?: 'auto' | 'never' | string\n deltaSource?: 'page' | 'client'\n context?: Node\n}\n\nexport interface PerActionDefaults {\n enabled?: boolean\n origin?: Point | string | Element\n listeners?: Listeners\n allowFrom?: string | Element\n ignoreFrom?: string | Element\n}\n\nexport type Options = Partial &\nPartial & {\n [P in keyof ActionDefaults]?: Partial\n}\n\nexport interface OptionsArg extends BaseDefaults, OrBoolean> {}\n\nexport const defaults: Defaults = {\n base: {\n preventDefault: 'auto',\n deltaSource: 'page',\n },\n\n perAction: {\n enabled: false,\n origin: { x: 0, y: 0 },\n },\n\n actions: {} as ActionDefaults,\n}\n", "import type { Point, FullRect, PointerEventType, Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport hypot from '@interactjs/utils/hypot'\n\nimport { BaseEvent } from './BaseEvent'\nimport type { Interaction } from './Interaction'\nimport { defaults } from './options'\nimport type { ActionName } from './types'\n\nexport type EventPhase = keyof PhaseMap\n\nexport interface PhaseMap {\n start: true\n move: true\n end: true\n}\n\n// defined outside of class definition to avoid assignment of undefined during\n// construction\nexport interface InteractEvent {\n pageX: number\n pageY: number\n\n clientX: number\n clientY: number\n\n dx: number\n dy: number\n\n velocityX: number\n velocityY: number\n}\n\nexport class InteractEvent<\n T extends ActionName = never,\n P extends EventPhase = EventPhase,\n> extends BaseEvent {\n declare target: Element\n declare currentTarget: Element\n relatedTarget: Element | null = null\n screenX?: number\n screenY?: number\n button: number\n buttons: number\n ctrlKey: boolean\n shiftKey: boolean\n altKey: boolean\n metaKey: boolean\n page: Point\n client: Point\n delta: Point\n rect: FullRect\n x0: number\n y0: number\n t0: number\n dt: number\n duration: number\n clientX0: number\n clientY0: number\n velocity: Point\n speed: number\n swipe: ReturnType['getSwipe']>\n // resize\n axes?: 'x' | 'y' | 'xy'\n preEnd?: boolean\n\n /** */\n constructor (\n interaction: Interaction,\n event: PointerEventType,\n actionName: T,\n phase: P,\n element: Element,\n preEnd?: boolean,\n type?: string,\n ) {\n super(interaction)\n\n element = element || interaction.element\n\n const target = interaction.interactable\n const deltaSource = (((target && target.options) || defaults) as any).deltaSource as 'page' | 'client'\n const origin = getOriginXY(target, element, actionName)\n const starting = phase === 'start'\n const ending = phase === 'end'\n const prevEvent = starting ? this : interaction.prevEvent\n const coords = starting\n ? interaction.coords.start\n : ending\n ? { page: prevEvent.page, client: prevEvent.client, timeStamp: interaction.coords.cur.timeStamp }\n : interaction.coords.cur\n\n this.page = extend({}, coords.page)\n this.client = extend({}, coords.client)\n this.rect = extend({}, interaction.rect)\n this.timeStamp = coords.timeStamp\n\n if (!ending) {\n this.page.x -= origin.x\n this.page.y -= origin.y\n\n this.client.x -= origin.x\n this.client.y -= origin.y\n }\n\n this.ctrlKey = event.ctrlKey\n this.altKey = event.altKey\n this.shiftKey = event.shiftKey\n this.metaKey = event.metaKey\n this.button = (event as MouseEvent).button\n this.buttons = (event as MouseEvent).buttons\n this.target = element\n this.currentTarget = element\n this.preEnd = preEnd\n this.type = type || actionName + (phase || '')\n this.interactable = target\n\n this.t0 = starting ? interaction.pointers[interaction.pointers.length - 1].downTime : prevEvent.t0\n\n this.x0 = interaction.coords.start.page.x - origin.x\n this.y0 = interaction.coords.start.page.y - origin.y\n this.clientX0 = interaction.coords.start.client.x - origin.x\n this.clientY0 = interaction.coords.start.client.y - origin.y\n\n if (starting || ending) {\n this.delta = { x: 0, y: 0 }\n } else {\n this.delta = {\n x: this[deltaSource].x - prevEvent[deltaSource].x,\n y: this[deltaSource].y - prevEvent[deltaSource].y,\n }\n }\n\n this.dt = interaction.coords.delta.timeStamp\n this.duration = this.timeStamp - this.t0\n\n // velocity and speed in pixels per second\n this.velocity = extend({}, interaction.coords.velocity[deltaSource])\n this.speed = hypot(this.velocity.x, this.velocity.y)\n\n this.swipe = ending || phase === 'inertiastart' ? this.getSwipe() : null\n }\n\n getSwipe () {\n const interaction = this._interaction\n\n if (interaction.prevEvent.speed < 600 || this.timeStamp - interaction.prevEvent.timeStamp > 150) {\n return null\n }\n\n let angle = (180 * Math.atan2(interaction.prevEvent.velocityY, interaction.prevEvent.velocityX)) / Math.PI\n const overlap = 22.5\n\n if (angle < 0) {\n angle += 360\n }\n\n const left = 135 - overlap <= angle && angle < 225 + overlap\n const up = 225 - overlap <= angle && angle < 315 + overlap\n\n const right = !left && (315 - overlap <= angle || angle < 45 + overlap)\n const down = !up && 45 - overlap <= angle && angle < 135 + overlap\n\n return {\n up,\n down,\n left,\n right,\n angle,\n speed: interaction.prevEvent.speed,\n velocity: {\n x: interaction.prevEvent.velocityX,\n y: interaction.prevEvent.velocityY,\n },\n }\n }\n\n preventDefault () {}\n\n /**\n * Don't call listeners on the remaining targets\n */\n stopImmediatePropagation () {\n this.immediatePropagationStopped = this.propagationStopped = true\n }\n\n /**\n * Don't call any other listeners (even on the current target)\n */\n stopPropagation () {\n this.propagationStopped = true\n }\n}\n\n// getters and setters defined here to support typescript 3.6 and below which\n// don't support getter and setters in .d.ts files\nObject.defineProperties(InteractEvent.prototype, {\n pageX: {\n get () {\n return this.page.x\n },\n set (value) {\n this.page.x = value\n },\n },\n pageY: {\n get () {\n return this.page.y\n },\n set (value) {\n this.page.y = value\n },\n },\n\n clientX: {\n get () {\n return this.client.x\n },\n set (value) {\n this.client.x = value\n },\n },\n clientY: {\n get () {\n return this.client.y\n },\n set (value) {\n this.client.y = value\n },\n },\n\n dx: {\n get () {\n return this.delta.x\n },\n set (value) {\n this.delta.x = value\n },\n },\n dy: {\n get () {\n return this.delta.y\n },\n set (value) {\n this.delta.y = value\n },\n },\n\n velocityX: {\n get () {\n return this.velocity.x\n },\n set (value) {\n this.velocity.x = value\n },\n },\n velocityY: {\n get () {\n return this.velocity.y\n },\n set (value) {\n this.velocity.y = value\n },\n },\n})\n", "import type { PointerEventType, PointerType } from '@interactjs/core/types'\n\nexport class PointerInfo {\n id: number\n pointer: PointerType\n event: PointerEventType\n downTime: number\n downTarget: Node\n\n constructor (id: number, pointer: PointerType, event: PointerEventType, downTime: number, downTarget: Node) {\n this.id = id\n this.pointer = pointer\n this.event = event\n this.downTime = downTime\n this.downTarget = downTarget\n }\n}\n", "import type {\n Element,\n EdgeOptions,\n PointerEventType,\n PointerType,\n FullRect,\n CoordsSet,\n} from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport hypot from '@interactjs/utils/hypot'\nimport { warnOnce, copyAction } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { EventPhase } from './InteractEvent'\nimport { InteractEvent } from './InteractEvent'\nimport type { Interactable } from './Interactable'\nimport { PointerInfo } from './PointerInfo'\nimport type { ActionDefaults } from './options'\nimport type { Scope } from './scope'\nimport type { ActionName, ActionProps } from './types'\n\nexport enum _ProxyValues {\n interactable = '',\n element = '',\n prepared = '',\n pointerIsDown = '',\n pointerWasMoved = '',\n _proxy = '',\n}\n\nexport enum _ProxyMethods {\n start = '',\n move = '',\n end = '',\n stop = '',\n interacting = '',\n}\n\nexport type PointerArgProps = {\n pointer: PointerType\n event: PointerEventType\n eventTarget: Node\n pointerIndex: number\n pointerInfo: PointerInfo\n interaction: Interaction\n} & T\n\nexport interface DoPhaseArg {\n event: PointerEventType\n phase: EventPhase\n interaction: Interaction\n iEvent: InteractEvent\n preEnd?: boolean\n type?: string\n}\n\nexport type DoAnyPhaseArg = DoPhaseArg\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:new': { interaction: Interaction }\n 'interactions:down': PointerArgProps<{\n type: 'down'\n }>\n 'interactions:move': PointerArgProps<{\n type: 'move'\n dx: number\n dy: number\n duplicate: boolean\n }>\n 'interactions:up': PointerArgProps<{\n type: 'up'\n curEventTarget: EventTarget\n }>\n 'interactions:cancel': SignalArgs['interactions:up'] & {\n type: 'cancel'\n curEventTarget: EventTarget\n }\n 'interactions:update-pointer': PointerArgProps<{\n down: boolean\n }>\n 'interactions:remove-pointer': PointerArgProps\n 'interactions:blur': { interaction: Interaction, event: Event, type: 'blur' }\n 'interactions:before-action-start': Omit\n 'interactions:action-start': DoAnyPhaseArg\n 'interactions:after-action-start': DoAnyPhaseArg\n 'interactions:before-action-move': Omit\n 'interactions:action-move': DoAnyPhaseArg\n 'interactions:after-action-move': DoAnyPhaseArg\n 'interactions:before-action-end': Omit\n 'interactions:action-end': DoAnyPhaseArg\n 'interactions:after-action-end': DoAnyPhaseArg\n 'interactions:stop': { interaction: Interaction }\n }\n}\n\nexport type InteractionProxy = Pick<\nInteraction,\nkeyof typeof _ProxyValues | keyof typeof _ProxyMethods\n>\n\nlet idCounter = 0\n\nexport class Interaction {\n // current interactable being interacted with\n interactable: Interactable | null = null\n\n // the target element of the interactable\n element: Element | null = null\n rect: FullRect | null = null\n _rects?: {\n start: FullRect\n corrected: FullRect\n previous: FullRect\n delta: FullRect\n }\n edges: EdgeOptions | null = null\n\n _scopeFire: Scope['fire']\n\n // action that's ready to be fired on next move event\n prepared: ActionProps = {\n name: null,\n axis: null,\n edges: null,\n }\n\n pointerType: string\n\n // keep track of added pointers\n pointers: PointerInfo[] = []\n\n // pointerdown/mousedown/touchstart event\n downEvent: PointerEventType | null = null\n\n downPointer: PointerType = {} as PointerType\n\n _latestPointer: {\n pointer: PointerType\n event: PointerEventType\n eventTarget: Node\n } = {\n pointer: null,\n event: null,\n eventTarget: null,\n }\n\n // previous action event\n prevEvent: InteractEvent = null\n\n pointerIsDown = false\n pointerWasMoved = false\n _interacting = false\n _ending = false\n _stopped = true\n _proxy: InteractionProxy | null = null\n\n simulation = null\n\n /** @internal */ get pointerMoveTolerance () {\n return 1\n }\n\n /**\n * @alias Interaction.prototype.move\n */\n doMove = warnOnce(function (this: Interaction, signalArg: any) {\n this.move(signalArg)\n }, 'The interaction.doMove() method has been renamed to interaction.move()')\n\n coords: CoordsSet = {\n // Starting InteractEvent pointer coordinates\n start: pointerUtils.newCoords(),\n // Previous native pointer move event coordinates\n prev: pointerUtils.newCoords(),\n // current native pointer move event coordinates\n cur: pointerUtils.newCoords(),\n // Change in coordinates and time of the pointer\n delta: pointerUtils.newCoords(),\n // pointer velocity\n velocity: pointerUtils.newCoords(),\n }\n\n readonly _id: number = idCounter++\n\n /** */\n constructor ({ pointerType, scopeFire }: { pointerType?: string, scopeFire: Scope['fire'] }) {\n this._scopeFire = scopeFire\n this.pointerType = pointerType\n\n const that = this\n\n this._proxy = {} as InteractionProxy\n\n for (const key in _ProxyValues) {\n Object.defineProperty(this._proxy, key, {\n get () {\n return that[key]\n },\n })\n }\n\n for (const key in _ProxyMethods) {\n Object.defineProperty(this._proxy, key, {\n value: (...args: any[]) => that[key](...args),\n })\n }\n\n this._scopeFire('interactions:new', { interaction: this })\n }\n\n pointerDown (pointer: PointerType, event: PointerEventType, eventTarget: Node) {\n const pointerIndex = this.updatePointer(pointer, event, eventTarget, true)\n const pointerInfo = this.pointers[pointerIndex]\n\n this._scopeFire('interactions:down', {\n pointer,\n event,\n eventTarget,\n pointerIndex,\n pointerInfo,\n type: 'down',\n interaction: this as unknown as Interaction,\n })\n }\n\n /**\n * ```js\n * interact(target)\n * .draggable({\n * // disable the default drag start by down->move\n * manualStart: true\n * })\n * // start dragging after the user holds the pointer down\n * .on('hold', function (event) {\n * var interaction = event.interaction\n *\n * if (!interaction.interacting()) {\n * interaction.start({ name: 'drag' },\n * event.interactable,\n * event.currentTarget)\n * }\n * })\n * ```\n *\n * Start an action with the given Interactable and Element as tartgets. The\n * action must be enabled for the target Interactable and an appropriate\n * number of pointers must be held down - 1 for drag/resize, 2 for gesture.\n *\n * Use it with `interactable.able({ manualStart: false })` to always\n * [start actions manually](https://github.com/taye/interact.js/issues/114)\n *\n * @param {object} action The action to be performed - drag, resize, etc.\n * @param {Interactable} target The Interactable to target\n * @param {Element} element The DOM Element to target\n * @return {Boolean} Whether the interaction was successfully started\n */\n start (action: ActionProps, interactable: Interactable, element: Element): boolean {\n if (\n this.interacting() ||\n !this.pointerIsDown ||\n this.pointers.length < (action.name === 'gesture' ? 2 : 1) ||\n !interactable.options[action.name as keyof ActionDefaults].enabled\n ) {\n return false\n }\n\n copyAction(this.prepared, action)\n\n this.interactable = interactable\n this.element = element\n this.rect = interactable.getRect(element)\n this.edges = this.prepared.edges\n ? extend({}, this.prepared.edges)\n : { left: true, right: true, top: true, bottom: true }\n this._stopped = false\n this._interacting =\n this._doPhase({\n interaction: this,\n event: this.downEvent,\n phase: 'start',\n }) && !this._stopped\n\n return this._interacting\n }\n\n pointerMove (pointer: PointerType, event: PointerEventType, eventTarget: Node) {\n if (!this.simulation && !(this.modification && this.modification.endResult)) {\n this.updatePointer(pointer, event, eventTarget, false)\n }\n\n const duplicateMove =\n this.coords.cur.page.x === this.coords.prev.page.x &&\n this.coords.cur.page.y === this.coords.prev.page.y &&\n this.coords.cur.client.x === this.coords.prev.client.x &&\n this.coords.cur.client.y === this.coords.prev.client.y\n\n let dx: number\n let dy: number\n\n // register movement greater than pointerMoveTolerance\n if (this.pointerIsDown && !this.pointerWasMoved) {\n dx = this.coords.cur.client.x - this.coords.start.client.x\n dy = this.coords.cur.client.y - this.coords.start.client.y\n\n this.pointerWasMoved = hypot(dx, dy) > this.pointerMoveTolerance\n }\n\n const pointerIndex = this.getPointerIndex(pointer)\n const signalArg = {\n pointer,\n pointerIndex,\n pointerInfo: this.pointers[pointerIndex],\n event,\n type: 'move' as const,\n eventTarget,\n dx,\n dy,\n duplicate: duplicateMove,\n interaction: this as unknown as Interaction,\n }\n\n if (!duplicateMove) {\n // set pointer coordinate, time changes and velocity\n pointerUtils.setCoordVelocity(this.coords.velocity, this.coords.delta)\n }\n\n this._scopeFire('interactions:move', signalArg)\n\n if (!duplicateMove && !this.simulation) {\n // if interacting, fire an 'action-move' signal etc\n if (this.interacting()) {\n signalArg.type = null\n this.move(signalArg)\n }\n\n if (this.pointerWasMoved) {\n pointerUtils.copyCoords(this.coords.prev, this.coords.cur)\n }\n }\n }\n\n /**\n * ```js\n * interact(target)\n * .draggable(true)\n * .on('dragmove', function (event) {\n * if (someCondition) {\n * // change the snap settings\n * event.interactable.draggable({ snap: { targets: [] }})\n * // fire another move event with re-calculated snap\n * event.interaction.move()\n * }\n * })\n * ```\n *\n * Force a move of the current action at the same coordinates. Useful if\n * snap/restrict has been changed and you want a movement with the new\n * settings.\n */\n move (signalArg?: any) {\n if (!signalArg || !signalArg.event) {\n pointerUtils.setZeroCoords(this.coords.delta)\n }\n\n signalArg = extend(\n {\n pointer: this._latestPointer.pointer,\n event: this._latestPointer.event,\n eventTarget: this._latestPointer.eventTarget,\n interaction: this,\n },\n signalArg || {},\n )\n\n signalArg.phase = 'move'\n\n this._doPhase(signalArg)\n }\n\n // End interact move events and stop auto-scroll unless simulation is running\n pointerUp (pointer: PointerType, event: PointerEventType, eventTarget: Node, curEventTarget: EventTarget) {\n let pointerIndex = this.getPointerIndex(pointer)\n\n if (pointerIndex === -1) {\n pointerIndex = this.updatePointer(pointer, event, eventTarget, false)\n }\n\n const type = /cancel$/i.test(event.type) ? 'cancel' : 'up'\n\n this._scopeFire(`interactions:${type}` as 'interactions:up' | 'interactions:cancel', {\n pointer,\n pointerIndex,\n pointerInfo: this.pointers[pointerIndex],\n event,\n eventTarget,\n type: type as any,\n curEventTarget,\n interaction: this as unknown as Interaction,\n })\n\n if (!this.simulation) {\n this.end(event)\n }\n\n this.removePointer(pointer, event)\n }\n\n documentBlur (event: Event) {\n this.end(event as any)\n this._scopeFire('interactions:blur', {\n event,\n type: 'blur',\n interaction: this as unknown as Interaction,\n })\n }\n\n /**\n * ```js\n * interact(target)\n * .draggable(true)\n * .on('move', function (event) {\n * if (event.pageX > 1000) {\n * // end the current action\n * event.interaction.end()\n * // stop all further listeners from being called\n * event.stopImmediatePropagation()\n * }\n * })\n * ```\n *\n * @param {PointerEvent} [event]\n */\n end (event?: PointerEventType) {\n this._ending = true\n event = event || this._latestPointer.event\n let endPhaseResult: boolean\n\n if (this.interacting()) {\n endPhaseResult = this._doPhase({\n event,\n interaction: this,\n phase: 'end',\n })\n }\n\n this._ending = false\n\n if (endPhaseResult === true) {\n this.stop()\n }\n }\n\n currentAction () {\n return this._interacting ? this.prepared.name : null\n }\n\n interacting () {\n return this._interacting\n }\n\n /** */\n stop () {\n this._scopeFire('interactions:stop', { interaction: this })\n\n this.interactable = this.element = null\n\n this._interacting = false\n this._stopped = true\n this.prepared.name = this.prevEvent = null\n }\n\n getPointerIndex (pointer: any) {\n const pointerId = pointerUtils.getPointerId(pointer)\n\n // mouse and pen interactions may have only one pointer\n return this.pointerType === 'mouse' || this.pointerType === 'pen'\n ? this.pointers.length - 1\n : arr.findIndex(this.pointers, (curPointer) => curPointer.id === pointerId)\n }\n\n getPointerInfo (pointer: any) {\n return this.pointers[this.getPointerIndex(pointer)]\n }\n\n updatePointer (pointer: PointerType, event: PointerEventType, eventTarget: Node, down?: boolean) {\n const id = pointerUtils.getPointerId(pointer)\n let pointerIndex = this.getPointerIndex(pointer)\n let pointerInfo = this.pointers[pointerIndex]\n\n down = down === false ? false : down || /(down|start)$/i.test(event.type)\n\n if (!pointerInfo) {\n pointerInfo = new PointerInfo(id, pointer, event, null, null)\n\n pointerIndex = this.pointers.length\n this.pointers.push(pointerInfo)\n } else {\n pointerInfo.pointer = pointer\n }\n\n pointerUtils.setCoords(\n this.coords.cur,\n this.pointers.map((p) => p.pointer),\n this._now(),\n )\n pointerUtils.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur)\n\n if (down) {\n this.pointerIsDown = true\n\n pointerInfo.downTime = this.coords.cur.timeStamp\n pointerInfo.downTarget = eventTarget\n pointerUtils.pointerExtend(this.downPointer, pointer)\n\n if (!this.interacting()) {\n pointerUtils.copyCoords(this.coords.start, this.coords.cur)\n pointerUtils.copyCoords(this.coords.prev, this.coords.cur)\n\n this.downEvent = event\n this.pointerWasMoved = false\n }\n }\n\n this._updateLatestPointer(pointer, event, eventTarget)\n\n this._scopeFire('interactions:update-pointer', {\n pointer,\n event,\n eventTarget,\n down,\n pointerInfo,\n pointerIndex,\n interaction: this as unknown as Interaction,\n })\n\n return pointerIndex\n }\n\n removePointer (pointer: PointerType, event: PointerEventType) {\n const pointerIndex = this.getPointerIndex(pointer)\n\n if (pointerIndex === -1) return\n\n const pointerInfo = this.pointers[pointerIndex]\n\n this._scopeFire('interactions:remove-pointer', {\n pointer,\n event,\n eventTarget: null,\n pointerIndex,\n pointerInfo,\n interaction: this as unknown as Interaction,\n })\n\n this.pointers.splice(pointerIndex, 1)\n this.pointerIsDown = false\n }\n\n _updateLatestPointer (pointer: PointerType, event: PointerEventType, eventTarget: Node) {\n this._latestPointer.pointer = pointer\n this._latestPointer.event = event\n this._latestPointer.eventTarget = eventTarget\n }\n\n destroy () {\n this._latestPointer.pointer = null\n this._latestPointer.event = null\n this._latestPointer.eventTarget = null\n }\n\n _createPreparedEvent

(\n event: PointerEventType,\n phase: P,\n preEnd?: boolean,\n type?: string,\n ) {\n return new InteractEvent(this, event, this.prepared.name, phase, this.element, preEnd, type)\n }\n\n _fireEvent

(iEvent: InteractEvent) {\n this.interactable?.fire(iEvent)\n\n if (!this.prevEvent || iEvent.timeStamp >= this.prevEvent.timeStamp) {\n this.prevEvent = iEvent\n }\n }\n\n _doPhase

(\n signalArg: Omit, 'iEvent'> & { iEvent?: InteractEvent },\n ) {\n const { event, phase, preEnd, type } = signalArg\n const { rect } = this\n\n if (rect && phase === 'move') {\n // update the rect changes due to pointer move\n rectUtils.addEdges(this.edges, rect, this.coords.delta[this.interactable.options.deltaSource])\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n const beforeResult = this._scopeFire(`interactions:before-action-${phase}` as any, signalArg)\n\n if (beforeResult === false) {\n return false\n }\n\n const iEvent = (signalArg.iEvent = this._createPreparedEvent(event, phase, preEnd, type))\n\n this._scopeFire(`interactions:action-${phase}` as any, signalArg)\n\n if (phase === 'start') {\n this.prevEvent = iEvent\n }\n\n this._fireEvent(iEvent)\n\n this._scopeFire(`interactions:after-action-${phase}` as any, signalArg)\n\n return true\n }\n\n _now () {\n return Date.now()\n }\n}\n\nexport default Interaction\nexport { PointerInfo }\n", "import type Interaction from '@interactjs/core/Interaction'\nimport { _ProxyMethods } from '@interactjs/core/Interaction'\nimport type { Plugin } from '@interactjs/core/scope'\nimport type { Point } from '@interactjs/core/types'\nimport * as rectUtils from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n offsetBy?: typeof offsetBy\n offset: {\n total: Point\n pending: Point\n }\n }\n\n enum _ProxyMethods {\n offsetBy = '',\n }\n}\n\n;(_ProxyMethods as any).offsetBy = ''\n\nexport function addTotal (interaction: Interaction) {\n if (!interaction.pointerIsDown) {\n return\n }\n\n addToCoords(interaction.coords.cur, interaction.offset.total)\n\n interaction.offset.pending.x = 0\n interaction.offset.pending.y = 0\n}\n\nfunction beforeAction ({ interaction }: { interaction: Interaction }) {\n applyPending(interaction)\n}\n\nfunction beforeEnd ({ interaction }: { interaction: Interaction }): boolean | void {\n const hadPending = applyPending(interaction)\n\n if (!hadPending) return\n\n interaction.move({ offset: true })\n interaction.end()\n\n return false\n}\n\nfunction end ({ interaction }: { interaction: Interaction }) {\n interaction.offset.total.x = 0\n interaction.offset.total.y = 0\n interaction.offset.pending.x = 0\n interaction.offset.pending.y = 0\n}\n\nexport function applyPending (interaction: Interaction) {\n if (!hasPending(interaction)) {\n return false\n }\n\n const { pending } = interaction.offset\n\n addToCoords(interaction.coords.cur, pending)\n addToCoords(interaction.coords.delta, pending)\n rectUtils.addEdges(interaction.edges, interaction.rect, pending)\n\n pending.x = 0\n pending.y = 0\n\n return true\n}\n\nfunction offsetBy (this: Interaction, { x, y }: Point) {\n this.offset.pending.x += x\n this.offset.pending.y += y\n\n this.offset.total.x += x\n this.offset.total.y += y\n}\n\nfunction addToCoords ({ page, client }, { x, y }: Point) {\n page.x += x\n page.y += y\n client.x += x\n client.y += y\n}\n\nfunction hasPending (interaction: Interaction) {\n return !!(interaction.offset.pending.x || interaction.offset.pending.y)\n}\n\nconst offset: Plugin = {\n id: 'offset',\n before: ['modifiers', 'pointer-events', 'actions', 'inertia'],\n install (scope) {\n scope.Interaction.prototype.offsetBy = offsetBy\n },\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.offset = {\n total: { x: 0, y: 0 },\n pending: { x: 0, y: 0 },\n }\n },\n 'interactions:update-pointer': ({ interaction }) => addTotal(interaction),\n 'interactions:before-action-start': beforeAction,\n 'interactions:before-action-move': beforeAction,\n 'interactions:before-action-end': beforeEnd,\n 'interactions:stop': end,\n },\n}\n\nexport default offset\n", "import type { Interaction, DoPhaseArg } from '@interactjs/core/Interaction'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, Point, PointerEventType } from '@interactjs/core/types'\nimport Modification from '@interactjs/modifiers/Modification'\nimport * as modifiers from '@interactjs/modifiers/base'\nimport offset from '@interactjs/offset/plugin'\nimport * as dom from '@interactjs/utils/domUtils'\nimport hypot from '@interactjs/utils/hypot'\nimport is from '@interactjs/utils/is'\nimport { copyCoords } from '@interactjs/utils/pointerUtils'\nimport raf from '@interactjs/utils/raf'\n\ndeclare module '@interactjs/core/InteractEvent' {\n interface PhaseMap {\n resume?: true\n inertiastart?: true\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n inertia?: InertiaState\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface PerActionDefaults {\n inertia?: {\n enabled?: boolean\n resistance?: number // the lambda in exponential decay\n minSpeed?: number // target speed must be above this for inertia to start\n endSpeed?: number // the speed at which inertia is slow enough to stop\n allowResume?: true // allow resuming an action in inertia phase\n smoothEndDuration?: number // animate to snap/restrict endOnly if there's no inertia\n }\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:before-action-inertiastart': Omit, 'iEvent'>\n 'interactions:action-inertiastart': DoPhaseArg\n 'interactions:after-action-inertiastart': DoPhaseArg\n 'interactions:before-action-resume': Omit, 'iEvent'>\n 'interactions:action-resume': DoPhaseArg\n 'interactions:after-action-resume': DoPhaseArg\n }\n}\n\nfunction install (scope: Scope) {\n const { defaults } = scope\n\n scope.usePlugin(offset)\n scope.usePlugin(modifiers.default)\n scope.actions.phases.inertiastart = true\n scope.actions.phases.resume = true\n\n defaults.perAction.inertia = {\n enabled: false,\n resistance: 10, // the lambda in exponential decay\n minSpeed: 100, // target speed must be above this for inertia to start\n endSpeed: 10, // the speed at which inertia is slow enough to stop\n allowResume: true, // allow resuming an action in inertia phase\n smoothEndDuration: 300, // animate to snap/restrict endOnly if there's no inertia\n }\n}\n\nexport class InertiaState {\n active = false\n isModified = false\n smoothEnd = false\n allowResume = false\n\n modification!: Modification\n modifierCount = 0\n modifierArg!: modifiers.ModifierArg\n\n startCoords!: Point\n t0 = 0\n v0 = 0\n\n te = 0\n targetOffset!: Point\n modifiedOffset!: Point\n currentOffset!: Point\n\n lambda_v0? = 0 // eslint-disable-line camelcase\n one_ve_v0? = 0 // eslint-disable-line camelcase\n timeout!: number\n readonly interaction: Interaction\n\n constructor (interaction: Interaction) {\n this.interaction = interaction\n }\n\n start (event: PointerEventType) {\n const { interaction } = this\n const options = getOptions(interaction)\n\n if (!options || !options.enabled) {\n return false\n }\n\n const { client: velocityClient } = interaction.coords.velocity\n const pointerSpeed = hypot(velocityClient.x, velocityClient.y)\n const modification = this.modification || (this.modification = new Modification(interaction))\n\n modification.copyFrom(interaction.modification)\n\n this.t0 = interaction._now()\n this.allowResume = options.allowResume\n this.v0 = pointerSpeed\n this.currentOffset = { x: 0, y: 0 }\n this.startCoords = interaction.coords.cur.page\n\n this.modifierArg = modification.fillArg({\n pageCoords: this.startCoords,\n preEnd: true,\n phase: 'inertiastart',\n })\n\n const thrown =\n this.t0 - interaction.coords.cur.timeStamp < 50 &&\n pointerSpeed > options.minSpeed &&\n pointerSpeed > options.endSpeed\n\n if (thrown) {\n this.startInertia()\n } else {\n modification.result = modification.setAll(this.modifierArg)\n\n if (!modification.result.changed) {\n return false\n }\n\n this.startSmoothEnd()\n }\n\n // force modification change\n interaction.modification.result.rect = null\n\n // bring inertiastart event to the target coords\n interaction.offsetBy(this.targetOffset)\n interaction._doPhase({\n interaction,\n event,\n phase: 'inertiastart',\n })\n interaction.offsetBy({ x: -this.targetOffset.x, y: -this.targetOffset.y })\n // force modification change\n interaction.modification.result.rect = null\n\n this.active = true\n interaction.simulation = this\n\n return true\n }\n\n startInertia () {\n const startVelocity = this.interaction.coords.velocity.client\n const options = getOptions(this.interaction)\n const lambda = options.resistance\n const inertiaDur = -Math.log(options.endSpeed / this.v0) / lambda\n\n this.targetOffset = {\n x: (startVelocity.x - inertiaDur) / lambda,\n y: (startVelocity.y - inertiaDur) / lambda,\n }\n\n this.te = inertiaDur\n this.lambda_v0 = lambda / this.v0\n this.one_ve_v0 = 1 - options.endSpeed / this.v0\n\n const { modification, modifierArg } = this\n\n modifierArg.pageCoords = {\n x: this.startCoords.x + this.targetOffset.x,\n y: this.startCoords.y + this.targetOffset.y,\n }\n\n modification.result = modification.setAll(modifierArg)\n\n if (modification.result.changed) {\n this.isModified = true\n this.modifiedOffset = {\n x: this.targetOffset.x + modification.result.delta.x,\n y: this.targetOffset.y + modification.result.delta.y,\n }\n }\n\n this.onNextFrame(() => this.inertiaTick())\n }\n\n startSmoothEnd () {\n this.smoothEnd = true\n this.isModified = true\n this.targetOffset = {\n x: this.modification.result.delta.x,\n y: this.modification.result.delta.y,\n }\n\n this.onNextFrame(() => this.smoothEndTick())\n }\n\n onNextFrame (tickFn: () => void) {\n this.timeout = raf.request(() => {\n if (this.active) {\n tickFn()\n }\n })\n }\n\n inertiaTick () {\n const { interaction } = this\n const options = getOptions(interaction)\n const lambda = options.resistance\n const t = (interaction._now() - this.t0) / 1000\n\n if (t < this.te) {\n const progress = 1 - (Math.exp(-lambda * t) - this.lambda_v0) / this.one_ve_v0\n let newOffset: Point\n\n if (this.isModified) {\n newOffset = getQuadraticCurvePoint(\n 0,\n 0,\n this.targetOffset.x,\n this.targetOffset.y,\n this.modifiedOffset.x,\n this.modifiedOffset.y,\n progress,\n )\n } else {\n newOffset = {\n x: this.targetOffset.x * progress,\n y: this.targetOffset.y * progress,\n }\n }\n\n const delta = { x: newOffset.x - this.currentOffset.x, y: newOffset.y - this.currentOffset.y }\n\n this.currentOffset.x += delta.x\n this.currentOffset.y += delta.y\n\n interaction.offsetBy(delta)\n interaction.move()\n\n this.onNextFrame(() => this.inertiaTick())\n } else {\n interaction.offsetBy({\n x: this.modifiedOffset.x - this.currentOffset.x,\n y: this.modifiedOffset.y - this.currentOffset.y,\n })\n\n this.end()\n }\n }\n\n smoothEndTick () {\n const { interaction } = this\n const t = interaction._now() - this.t0\n const { smoothEndDuration: duration } = getOptions(interaction)\n\n if (t < duration) {\n const newOffset = {\n x: easeOutQuad(t, 0, this.targetOffset.x, duration),\n y: easeOutQuad(t, 0, this.targetOffset.y, duration),\n }\n const delta = {\n x: newOffset.x - this.currentOffset.x,\n y: newOffset.y - this.currentOffset.y,\n }\n\n this.currentOffset.x += delta.x\n this.currentOffset.y += delta.y\n\n interaction.offsetBy(delta)\n interaction.move({ skipModifiers: this.modifierCount })\n\n this.onNextFrame(() => this.smoothEndTick())\n } else {\n interaction.offsetBy({\n x: this.targetOffset.x - this.currentOffset.x,\n y: this.targetOffset.y - this.currentOffset.y,\n })\n\n this.end()\n }\n }\n\n resume ({ pointer, event, eventTarget }: SignalArgs['interactions:down']) {\n const { interaction } = this\n\n // undo inertia changes to interaction coords\n interaction.offsetBy({\n x: -this.currentOffset.x,\n y: -this.currentOffset.y,\n })\n\n // update pointer at pointer down position\n interaction.updatePointer(pointer, event, eventTarget, true)\n\n // fire resume signals and event\n interaction._doPhase({\n interaction,\n event,\n phase: 'resume',\n })\n copyCoords(interaction.coords.prev, interaction.coords.cur)\n\n this.stop()\n }\n\n end () {\n this.interaction.move()\n this.interaction.end()\n this.stop()\n }\n\n stop () {\n this.active = this.smoothEnd = false\n this.interaction.simulation = null\n raf.cancel(this.timeout)\n }\n}\n\nfunction start ({ interaction, event }: DoPhaseArg) {\n if (!interaction._interacting || interaction.simulation) {\n return null\n }\n\n const started = interaction.inertia.start(event)\n\n // prevent action end if inertia or smoothEnd\n return started ? false : null\n}\n\n// Check if the down event hits the current inertia target\n// control should be return to the user\nfunction resume (arg: SignalArgs['interactions:down']) {\n const { interaction, eventTarget } = arg\n const state = interaction.inertia\n\n if (!state.active) return\n\n let element = eventTarget as Node\n\n // climb up the DOM tree from the event target\n while (is.element(element)) {\n // if interaction element is the current inertia target element\n if (element === interaction.element) {\n state.resume(arg)\n break\n }\n\n element = dom.parentNode(element)\n }\n}\n\nfunction stop ({ interaction }: { interaction: Interaction }) {\n const state = interaction.inertia\n\n if (state.active) {\n state.stop()\n }\n}\n\nfunction getOptions ({ interactable, prepared }: Interaction) {\n return interactable && interactable.options && prepared.name && interactable.options[prepared.name].inertia\n}\n\nconst inertia: Plugin = {\n id: 'inertia',\n before: ['modifiers', 'actions'],\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.inertia = new InertiaState(interaction)\n },\n\n 'interactions:before-action-end': start,\n 'interactions:down': resume,\n 'interactions:stop': stop,\n\n 'interactions:before-action-resume': (arg) => {\n const { modification } = arg.interaction\n\n modification.stop(arg)\n modification.start(arg, arg.interaction.coords.cur.page)\n modification.applyToInteraction(arg)\n },\n\n 'interactions:before-action-inertiastart': (arg) => arg.interaction.modification.setAndApply(arg),\n 'interactions:action-resume': modifiers.addEventModifiers,\n 'interactions:action-inertiastart': modifiers.addEventModifiers,\n 'interactions:after-action-inertiastart': (arg) =>\n arg.interaction.modification.restoreInteractionCoords(arg),\n 'interactions:after-action-resume': (arg) => arg.interaction.modification.restoreInteractionCoords(arg),\n },\n}\n\n// http://stackoverflow.com/a/5634528/2280888\nfunction _getQBezierValue (t: number, p1: number, p2: number, p3: number) {\n const iT = 1 - t\n return iT * iT * p1 + 2 * iT * t * p2 + t * t * p3\n}\n\nfunction getQuadraticCurvePoint (\n startX: number,\n startY: number,\n cpX: number,\n cpY: number,\n endX: number,\n endY: number,\n position: number,\n) {\n return {\n x: _getQBezierValue(position, startX, cpX, endX),\n y: _getQBezierValue(position, startY, cpY, endY),\n }\n}\n\n// http://gizma.com/easing/\nfunction easeOutQuad (t: number, b: number, c: number, d: number) {\n t /= d\n return -c * t * (t - 2) + b\n}\n\nexport default inertia\n", "import type { Listener, ListenersArg, Rect } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport type { NormalizedListeners } from '@interactjs/utils/normalizeListeners'\nimport normalize from '@interactjs/utils/normalizeListeners'\n\nfunction fireUntilImmediateStopped (event: any, listeners: Listener[]) {\n for (const listener of listeners) {\n if (event.immediatePropagationStopped) {\n break\n }\n\n listener(event)\n }\n}\n\nexport class Eventable {\n options: any\n types: NormalizedListeners = {}\n propagationStopped = false\n immediatePropagationStopped = false\n global: any\n\n constructor (options?: { [index: string]: any }) {\n this.options = extend({}, options || {})\n }\n\n fire (event: T) {\n let listeners: Listener[]\n const global = this.global\n\n // Interactable#on() listeners\n // tslint:disable no-conditional-assignment\n if ((listeners = this.types[event.type])) {\n fireUntilImmediateStopped(event, listeners)\n }\n\n // interact.on() listeners\n if (!event.propagationStopped && global && (listeners = global[event.type])) {\n fireUntilImmediateStopped(event, listeners)\n }\n }\n\n on (type: string, listener: ListenersArg) {\n const listeners = normalize(type, listener)\n\n for (type in listeners) {\n this.types[type] = arr.merge(this.types[type] || [], listeners[type])\n }\n }\n\n off (type: string, listener: ListenersArg) {\n const listeners = normalize(type, listener)\n\n for (type in listeners) {\n const eventList = this.types[type]\n\n if (!eventList || !eventList.length) {\n continue\n }\n\n for (const subListener of listeners[type]) {\n const index = eventList.indexOf(subListener)\n\n if (index !== -1) {\n eventList.splice(index, 1)\n }\n }\n }\n }\n\n getRect (_element: Element): Rect {\n return null\n }\n}\n", "import type { Actions } from '@interactjs/core/types'\n\nexport default function isNonNativeEvent (type: string, actions: Actions) {\n if (actions.phaselessTypes[type]) {\n return true\n }\n\n for (const name in actions.map) {\n if (type.indexOf(name) === 0 && type.substr(name.length) in actions.phases) {\n return true\n }\n }\n\n return false\n}\n", "/** @module interact */\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Context, EventTypes, Listener, ListenersArg, Target } from '@interactjs/core/types'\nimport browser from '@interactjs/utils/browser'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport is from '@interactjs/utils/is'\nimport { warnOnce } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport type { Interactable } from './Interactable'\nimport isNonNativeEvent from './isNonNativeEvent'\nimport type { Options } from './options'\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n (target: Target, options?: Options): Interactable\n getPointerAverage: typeof pointerUtils.pointerAverage\n getTouchBBox: typeof pointerUtils.touchBBox\n getTouchDistance: typeof pointerUtils.touchDistance\n getTouchAngle: typeof pointerUtils.touchAngle\n getElementRect: typeof domUtils.getElementRect\n getElementClientRect: typeof domUtils.getElementClientRect\n matchesSelector: typeof domUtils.matchesSelector\n closest: typeof domUtils.closest\n /** @internal */ globalEvents: any\n version: string\n /** @internal */ scope: Scope\n use(\n plugin: Plugin,\n options?: {\n [key: string]: any\n },\n ): any\n isSet(target: Target, options?: any): boolean\n on(type: string | EventTypes, listener: ListenersArg, options?: object): any\n off(type: EventTypes, listener: any, options?: object): any\n debug(): any\n supportsTouch(): boolean\n supportsPointerEvent(): boolean\n stop(): any\n pointerMoveTolerance(newValue?: number): any\n addDocument(doc: Document, options?: object): void\n removeDocument(doc: Document): void\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype _InteractStatic = import('@interactjs/core/InteractStatic').InteractStatic\n\nexport function createInteractStatic (scope: Scope): _InteractStatic {\n /**\n * ```js\n * interact('#draggable').draggable(true)\n *\n * var rectables = interact('rect')\n * rectables\n * .gesturable(true)\n * .on('gesturemove', function (event) {\n * // ...\n * })\n * ```\n *\n * The methods of this variable can be used to set elements as interactables\n * and also to change various default settings.\n *\n * Calling it as a function and passing an element or a valid CSS selector\n * string returns an Interactable object which has various methods to configure\n * it.\n *\n * @global\n *\n * @param {Element | string} target The HTML or SVG Element to interact with\n * or CSS selector\n * @return {Interactable}\n */\n const interact = ((target: Target, options: Options) => {\n let interactable = scope.interactables.get(target, options)\n\n if (!interactable) {\n interactable = scope.interactables.new(target, options)\n interactable.events.global = interact.globalEvents\n }\n\n return interactable\n }) as _InteractStatic\n\n // expose the functions used to calculate multi-touch properties\n interact.getPointerAverage = pointerUtils.pointerAverage\n interact.getTouchBBox = pointerUtils.touchBBox\n interact.getTouchDistance = pointerUtils.touchDistance\n interact.getTouchAngle = pointerUtils.touchAngle\n\n interact.getElementRect = domUtils.getElementRect\n interact.getElementClientRect = domUtils.getElementClientRect\n interact.matchesSelector = domUtils.matchesSelector\n interact.closest = domUtils.closest\n\n interact.globalEvents = {} as any\n\n // eslint-disable-next-line no-undef\n interact.version = process.env.npm_package_version\n interact.scope = scope\n /**\n * Use a plugin\n *\n * @alias module:interact.use\n *\n */\n interact.use = function (plugin, options) {\n this.scope.usePlugin(plugin, options)\n\n return this\n }\n\n /**\n * Check if an element or selector has been set with the {@link interact}\n * function\n *\n * @alias module:interact.isSet\n *\n * @param {Target} target The Element or string being searched for\n * @param {object} options\n * @return {boolean} Indicates if the element or CSS selector was previously\n * passed to interact\n */\n interact.isSet = function (target: Target, options?: { context?: Context }): boolean {\n return !!this.scope.interactables.get(target, options && options.context)\n }\n\n /**\n * @deprecated\n * Add a global listener for an InteractEvent or adds a DOM event to `document`\n *\n * @alias module:interact.on\n *\n * @param {string | array | object} type The types of events to listen for\n * @param {function} listener The function event (s)\n * @param {object | boolean} [options] object or useCapture flag for\n * addEventListener\n * @return {object} interact\n */\n interact.on = warnOnce(function on (type: string | EventTypes, listener: ListenersArg, options?: object) {\n if (is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (is.array(type)) {\n for (const eventType of type as any[]) {\n this.on(eventType, listener, options)\n }\n\n return this\n }\n\n if (is.object(type)) {\n for (const prop in type) {\n this.on(prop, (type as any)[prop], listener)\n }\n\n return this\n }\n\n // if it is an InteractEvent type, add listener to globalEvents\n if (isNonNativeEvent(type, this.scope.actions)) {\n // if this type of event was never bound\n if (!this.globalEvents[type]) {\n this.globalEvents[type] = [listener]\n } else {\n this.globalEvents[type].push(listener)\n }\n }\n // If non InteractEvent type, addEventListener to document\n else {\n this.scope.events.add(this.scope.document, type, listener as Listener, { options })\n }\n\n return this\n }, 'The interact.on() method is being deprecated')\n\n /**\n * @deprecated\n * Removes a global InteractEvent listener or DOM event from `document`\n *\n * @alias module:interact.off\n *\n * @param {string | array | object} type The types of events that were listened\n * for\n * @param {function} listener The listener function to be removed\n * @param {object | boolean} options [options] object or useCapture flag for\n * removeEventListener\n * @return {object} interact\n */\n interact.off = warnOnce(function off (type: EventTypes, listener: any, options?: object) {\n if (is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (is.array(type)) {\n for (const eventType of type) {\n this.off(eventType, listener, options)\n }\n\n return this\n }\n\n if (is.object(type)) {\n for (const prop in type) {\n this.off(prop, type[prop], listener)\n }\n\n return this\n }\n\n if (isNonNativeEvent(type, this.scope.actions)) {\n let index: number\n\n if (type in this.globalEvents && (index = this.globalEvents[type].indexOf(listener)) !== -1) {\n this.globalEvents[type].splice(index, 1)\n }\n } else {\n this.scope.events.remove(this.scope.document, type, listener, options)\n }\n\n return this\n }, 'The interact.off() method is being deprecated')\n\n interact.debug = function () {\n return this.scope\n }\n\n /**\n * @alias module:interact.supportsTouch\n *\n * @return {boolean} Whether or not the browser supports touch input\n */\n interact.supportsTouch = function () {\n return browser.supportsTouch\n }\n\n /**\n * @alias module:interact.supportsPointerEvent\n *\n * @return {boolean} Whether or not the browser supports PointerEvents\n */\n interact.supportsPointerEvent = function () {\n return browser.supportsPointerEvent\n }\n\n /**\n * Cancels all interactions (end events are not fired)\n *\n * @alias module:interact.stop\n *\n * @return {object} interact\n */\n interact.stop = function () {\n for (const interaction of this.scope.interactions.list) {\n interaction.stop()\n }\n\n return this\n }\n\n /**\n * Returns or sets the distance the pointer must be moved before an action\n * sequence occurs. This also affects tolerance for tap events.\n *\n * @alias module:interact.pointerMoveTolerance\n *\n * @param {number} [newValue] The movement from the start position must be greater than this value\n * @return {interact | number}\n */\n interact.pointerMoveTolerance = function (newValue?: number) {\n if (is.number(newValue)) {\n this.scope.interactions.pointerMoveTolerance = newValue\n\n return this\n }\n\n return this.scope.interactions.pointerMoveTolerance\n }\n\n interact.addDocument = function (doc: Document, options?: object) {\n this.scope.addDocument(doc, options)\n }\n\n interact.removeDocument = function (doc: Document) {\n this.scope.removeDocument(doc)\n }\n\n return interact\n}\n", "/* eslint-disable no-dupe-class-members */\nimport type { Scope } from '@interactjs/core/scope'\nimport type {\n ActionMap,\n ActionMethod,\n ActionName,\n Actions,\n Context,\n Element,\n EventTypes,\n Listeners,\n ListenersArg,\n OrBoolean,\n Target,\n} from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport browser from '@interactjs/utils/browser'\nimport clone from '@interactjs/utils/clone'\nimport { getElementRect, matchesUpTo, nodeContains, trySelector } from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport { getWindow } from '@interactjs/utils/window'\n\nimport { Eventable } from './Eventable'\nimport isNonNativeEvent from './isNonNativeEvent'\nimport type { ActionDefaults, Defaults, OptionsArg, PerActionDefaults, Options } from './options'\n\ntype IgnoreValue = string | Element | boolean\ntype DeltaSource = 'page' | 'client'\n\n/** */\nexport class Interactable implements Partial {\n /** @internal */ get _defaults (): Defaults {\n return {\n base: {},\n perAction: {},\n actions: {} as ActionDefaults,\n }\n }\n\n readonly options!: Required\n readonly _actions: Actions\n readonly target: Target\n readonly events = new Eventable()\n readonly _context: Context\n readonly _win: Window\n readonly _doc: Document\n readonly _scopeEvents: Scope['events']\n\n /** @internal */ _rectChecker?: typeof Interactable.prototype.getRect\n\n /** */\n constructor (\n target: Target,\n options: any,\n defaultContext: Document | Element,\n scopeEvents: Scope['events'],\n ) {\n this._actions = options.actions\n this.target = target\n this._context = options.context || defaultContext\n this._win = getWindow(trySelector(target) ? this._context : target)\n this._doc = this._win.document\n this._scopeEvents = scopeEvents\n\n this.set(options)\n }\n\n setOnEvents (actionName: ActionName, phases: NonNullable) {\n if (is.func(phases.onstart)) {\n this.on(`${actionName}start`, phases.onstart)\n }\n if (is.func(phases.onmove)) {\n this.on(`${actionName}move`, phases.onmove)\n }\n if (is.func(phases.onend)) {\n this.on(`${actionName}end`, phases.onend)\n }\n if (is.func(phases.oninertiastart)) {\n this.on(`${actionName}inertiastart`, phases.oninertiastart)\n }\n\n return this\n }\n\n updatePerActionListeners (actionName: ActionName, prev: Listeners, cur: Listeners) {\n if (is.array(prev) || is.object(prev)) {\n this.off(actionName, prev)\n }\n\n if (is.array(cur) || is.object(cur)) {\n this.on(actionName, cur)\n }\n }\n\n setPerAction (actionName: ActionName, options: OrBoolean) {\n const defaults = this._defaults\n\n // for all the default per-action options\n for (const optionName_ in options) {\n const optionName = optionName_ as keyof PerActionDefaults\n const actionOptions = this.options[actionName]\n const optionValue: any = options[optionName]\n\n // remove old event listeners and add new ones\n if (optionName === 'listeners') {\n this.updatePerActionListeners(actionName, actionOptions.listeners, optionValue as Listeners)\n }\n\n // if the option value is an array\n if (is.array(optionValue)) {\n ;(actionOptions[optionName] as any) = arr.from(optionValue)\n }\n // if the option value is an object\n else if (is.plainObject(optionValue)) {\n // copy the object\n ;(actionOptions[optionName] as any) = extend(\n actionOptions[optionName] || ({} as any),\n clone(optionValue),\n )\n\n // set anabled field to true if it exists in the defaults\n if (\n is.object(defaults.perAction[optionName]) &&\n 'enabled' in (defaults.perAction[optionName] as any)\n ) {\n ;(actionOptions[optionName] as any).enabled = optionValue.enabled !== false\n }\n }\n // if the option value is a boolean and the default is an object\n else if (is.bool(optionValue) && is.object(defaults.perAction[optionName])) {\n ;(actionOptions[optionName] as any).enabled = optionValue\n }\n // if it's anything else, do a plain assignment\n else {\n ;(actionOptions[optionName] as any) = optionValue\n }\n }\n }\n\n /**\n * The default function to get an Interactables bounding rect. Can be\n * overridden using {@link Interactable.rectChecker}.\n *\n * @param {Element} [element] The element to measure.\n * @return {Rect} The object's bounding rectangle.\n */\n getRect (element: Element) {\n element = element || (is.element(this.target) ? this.target : null)\n\n if (is.string(this.target)) {\n element = element || this._context.querySelector(this.target)\n }\n\n return getElementRect(element)\n }\n\n /**\n * Returns or sets the function used to calculate the interactable's\n * element's rectangle\n *\n * @param {function} [checker] A function which returns this Interactable's\n * bounding rectangle. See {@link Interactable.getRect}\n * @return {function | object} The checker function or this Interactable\n */\n rectChecker(): (element: Element) => any | null\n rectChecker(checker: (element: Element) => any): this\n rectChecker (checker?: (element: Element) => any) {\n if (is.func(checker)) {\n this._rectChecker = checker\n\n this.getRect = (element) => {\n const rect = extend({}, this._rectChecker(element))\n\n if (!(('width' in rect) as unknown)) {\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n return rect\n }\n\n return this\n }\n\n if (checker === null) {\n delete this.getRect\n delete this._rectChecker\n\n return this\n }\n\n return this.getRect\n }\n\n _backCompatOption (optionName: keyof Options, newValue: any) {\n if (trySelector(newValue) || is.object(newValue)) {\n ;(this.options[optionName] as any) = newValue\n\n for (const action in this._actions.map) {\n ;(this.options[action as keyof ActionMap] as any)[optionName] = newValue\n }\n\n return this\n }\n\n return this.options[optionName]\n }\n\n /**\n * Gets or sets the origin of the Interactable's element. The x and y\n * of the origin will be subtracted from action event coordinates.\n *\n * @param {Element | object | string} [origin] An HTML or SVG Element whose\n * rect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self'\n * or any CSS selector\n *\n * @return {object} The current origin or this Interactable\n */\n origin (newValue: any) {\n return this._backCompatOption('origin', newValue)\n }\n\n /**\n * Returns or sets the mouse coordinate types used to calculate the\n * movement of the pointer.\n *\n * @param {string} [newValue] Use 'client' if you will be scrolling while\n * interacting; Use 'page' if you want autoScroll to work\n * @return {string | object} The current deltaSource or this Interactable\n */\n deltaSource(): DeltaSource\n deltaSource(newValue: DeltaSource): this\n deltaSource (newValue?: DeltaSource) {\n if (newValue === 'page' || newValue === 'client') {\n this.options.deltaSource = newValue\n\n return this\n }\n\n return this.options.deltaSource\n }\n\n /**\n * Gets the selector context Node of the Interactable. The default is\n * `window.document`.\n *\n * @return {Node} The context Node of this Interactable\n */\n context () {\n return this._context\n }\n\n inContext (element: Document | Node) {\n return this._context === element.ownerDocument || nodeContains(this._context, element)\n }\n\n testIgnoreAllow (\n this: Interactable,\n options: { ignoreFrom?: IgnoreValue, allowFrom?: IgnoreValue },\n targetNode: Node,\n eventTarget: Node,\n ) {\n return (\n !this.testIgnore(options.ignoreFrom, targetNode, eventTarget) &&\n this.testAllow(options.allowFrom, targetNode, eventTarget)\n )\n }\n\n testAllow (this: Interactable, allowFrom: IgnoreValue, targetNode: Node, element: Node) {\n if (!allowFrom) {\n return true\n }\n\n if (!is.element(element)) {\n return false\n }\n\n if (is.string(allowFrom)) {\n return matchesUpTo(element, allowFrom, targetNode)\n } else if (is.element(allowFrom)) {\n return nodeContains(allowFrom, element)\n }\n\n return false\n }\n\n testIgnore (this: Interactable, ignoreFrom: IgnoreValue, targetNode: Node, element: Node) {\n if (!ignoreFrom || !is.element(element)) {\n return false\n }\n\n if (is.string(ignoreFrom)) {\n return matchesUpTo(element, ignoreFrom, targetNode)\n } else if (is.element(ignoreFrom)) {\n return nodeContains(ignoreFrom, element)\n }\n\n return false\n }\n\n /**\n * Calls listeners for the given InteractEvent type bound globally\n * and directly to this Interactable\n *\n * @param {InteractEvent} iEvent The InteractEvent object to be fired on this\n * Interactable\n * @return {Interactable} this Interactable\n */\n fire (iEvent: E) {\n this.events.fire(iEvent)\n\n return this\n }\n\n _onOff (method: 'on' | 'off', typeArg: EventTypes, listenerArg?: ListenersArg | null, options?: any) {\n if (is.object(typeArg) && !is.array(typeArg)) {\n options = listenerArg\n listenerArg = null\n }\n\n const addRemove = method === 'on' ? 'add' : 'remove'\n const listeners = normalizeListeners(typeArg, listenerArg)\n\n for (let type in listeners) {\n if (type === 'wheel') {\n type = browser.wheelEvent\n }\n\n for (const listener of listeners[type]) {\n // if it is an action event type\n if (isNonNativeEvent(type, this._actions)) {\n this.events[method](type, listener)\n }\n // delegated event\n else if (is.string(this.target)) {\n this._scopeEvents[`${addRemove}Delegate` as 'addDelegate' | 'removeDelegate'](\n this.target,\n this._context,\n type,\n listener,\n options,\n )\n }\n // remove listener from this Interactable's element\n else {\n this._scopeEvents[addRemove](this.target, type, listener, options)\n }\n }\n }\n\n return this\n }\n\n /**\n * Binds a listener for an InteractEvent, pointerEvent or DOM event.\n *\n * @param {string | array | object} types The types of events to listen\n * for\n * @param {function | array | object} [listener] The event listener function(s)\n * @param {object | boolean} [options] options object or useCapture flag for\n * addEventListener\n * @return {Interactable} This Interactable\n */\n on (types: EventTypes, listener?: ListenersArg, options?: any) {\n return this._onOff('on', types, listener, options)\n }\n\n /**\n * Removes an InteractEvent, pointerEvent or DOM event listener.\n *\n * @param {string | array | object} types The types of events that were\n * listened for\n * @param {function | array | object} [listener] The event listener function(s)\n * @param {object | boolean} [options] options object or useCapture flag for\n * removeEventListener\n * @return {Interactable} This Interactable\n */\n off (types: string | string[] | EventTypes, listener?: ListenersArg, options?: any) {\n return this._onOff('off', types, listener, options)\n }\n\n /**\n * Reset the options of this Interactable\n *\n * @param {object} options The new settings to apply\n * @return {object} This Interactable\n */\n set (options: OptionsArg) {\n const defaults = this._defaults\n\n if (!is.object(options)) {\n options = {}\n }\n\n ;(this.options as Required) = clone(defaults.base) as Required\n\n for (const actionName_ in this._actions.methodDict) {\n const actionName = actionName_ as ActionName\n const methodName = this._actions.methodDict[actionName]\n\n this.options[actionName] = {}\n this.setPerAction(actionName, extend(extend({}, defaults.perAction), defaults.actions[actionName]))\n ;(this[methodName] as ActionMethod)(options[actionName])\n }\n\n for (const setting in options) {\n if (is.func((this as any)[setting])) {\n ;(this as any)[setting](options[setting as keyof typeof options])\n }\n }\n\n return this\n }\n\n /**\n * Remove this interactable from the list of interactables and remove it's\n * action capabilities and event listeners\n */\n unset () {\n if (is.string(this.target)) {\n // remove delegated events\n for (const type in this._scopeEvents.delegatedEvents) {\n const delegated = this._scopeEvents.delegatedEvents[type]\n\n for (let i = delegated.length - 1; i >= 0; i--) {\n const { selector, context, listeners } = delegated[i]\n\n if (selector === this.target && context === this._context) {\n delegated.splice(i, 1)\n }\n\n for (let l = listeners.length - 1; l >= 0; l--) {\n this._scopeEvents.removeDelegate(\n this.target,\n this._context,\n type,\n listeners[l][0],\n listeners[l][1],\n )\n }\n }\n }\n } else {\n this._scopeEvents.remove(this.target as Node, 'all')\n }\n }\n}\n", "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { OptionsArg, Options } from '@interactjs/core/options'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { Target, Context } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactable:new': {\n interactable: Interactable\n target: Target\n options: OptionsArg\n win: Window\n }\n }\n}\n\ninterface InteractableScopeProp {\n context: Context\n interactable: Interactable\n}\n\nexport class InteractableSet {\n // all set interactables\n list: Interactable[] = []\n\n selectorMap: {\n [selector: string]: InteractableScopeProp[]\n } = {}\n\n scope: Scope\n\n constructor (scope: Scope) {\n this.scope = scope\n scope.addListeners({\n 'interactable:unset': ({ interactable }) => {\n const { target, _context: context } = interactable\n const targetMappings: InteractableScopeProp[] = is.string(target)\n ? this.selectorMap[target]\n : (target as any)[this.scope.id]\n\n const targetIndex = arr.findIndex(targetMappings, (m) => m.context === context)\n if (targetMappings[targetIndex]) {\n // Destroying mappingInfo's context and interactable\n targetMappings[targetIndex].context = null\n targetMappings[targetIndex].interactable = null\n }\n targetMappings.splice(targetIndex, 1)\n },\n })\n }\n\n new (target: Target, options?: any): Interactable {\n options = extend(options || {}, {\n actions: this.scope.actions,\n })\n const interactable = new this.scope.Interactable(target, options, this.scope.document, this.scope.events)\n const mappingInfo = { context: interactable._context, interactable }\n\n this.scope.addDocument(interactable._doc)\n this.list.push(interactable)\n\n if (is.string(target)) {\n if (!this.selectorMap[target]) {\n this.selectorMap[target] = []\n }\n this.selectorMap[target].push(mappingInfo)\n } else {\n if (!(interactable.target as any)[this.scope.id]) {\n Object.defineProperty(target, this.scope.id, {\n value: [],\n configurable: true,\n })\n }\n\n ;(target as any)[this.scope.id].push(mappingInfo)\n }\n\n this.scope.fire('interactable:new', {\n target,\n options,\n interactable,\n win: this.scope._win,\n })\n\n return interactable\n }\n\n get (target: Target, options?: Options) {\n const context = (options && options.context) || this.scope.document\n const isSelector = is.string(target)\n const targetMappings: InteractableScopeProp[] = isSelector\n ? this.selectorMap[target as string]\n : (target as any)[this.scope.id]\n\n if (!targetMappings) {\n return null\n }\n\n const found = arr.find(\n targetMappings,\n (m) => m.context === context && (isSelector || m.interactable.inContext(target as any)),\n )\n\n return found && found.interactable\n }\n\n forEachMatch (node: Node, callback: (interactable: Interactable) => T) {\n for (const interactable of this.list) {\n let ret: void | T\n\n if (\n (is.string(interactable.target)\n ? // target is a selector and the element matches\n is.element(node) && domUtils.matchesSelector(node, interactable.target)\n : // target is the element\n node === interactable.target) &&\n // the element is in context\n interactable.inContext(node)\n ) {\n ret = callback(interactable)\n }\n\n if (ret !== undefined) {\n return ret\n }\n }\n }\n}\n", "import type { Scope } from '@interactjs/core/scope'\nimport type { Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport pExtend from '@interactjs/utils/pointerExtend'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n events: ReturnType\n }\n}\n\ntype Listener = (event: Event | FakeEvent) => any\n\nfunction install (scope: Scope) {\n const targets: Array<{\n eventTarget: EventTarget\n events: { [type: string]: Listener[] }\n }> = []\n\n const delegatedEvents: {\n [type: string]: Array<{\n selector: string\n context: Node\n listeners: Array<[Listener, { capture: boolean, passive: boolean }]>\n }>\n } = {}\n const documents: Document[] = []\n\n const eventsMethods = {\n add,\n remove,\n\n addDelegate,\n removeDelegate,\n\n delegateListener,\n delegateUseCapture,\n delegatedEvents,\n documents,\n\n targets,\n\n supportsOptions: false,\n supportsPassive: false,\n }\n\n // check if browser supports passive events and options arg\n scope.document?.createElement('div').addEventListener('test', null, {\n get capture () {\n return (eventsMethods.supportsOptions = true)\n },\n get passive () {\n return (eventsMethods.supportsPassive = true)\n },\n })\n\n scope.events = eventsMethods\n\n function add (eventTarget: EventTarget, type: string, listener: Listener, optionalArg?: boolean | any) {\n const options = getOptions(optionalArg)\n let target = arr.find(targets, (t) => t.eventTarget === eventTarget)\n\n if (!target) {\n target = {\n eventTarget,\n events: {},\n }\n\n targets.push(target)\n }\n\n if (!target.events[type]) {\n target.events[type] = []\n }\n\n if (eventTarget.addEventListener && !arr.contains(target.events[type], listener)) {\n eventTarget.addEventListener(\n type,\n listener as any,\n eventsMethods.supportsOptions ? options : options.capture,\n )\n target.events[type].push(listener)\n }\n }\n\n function remove (\n eventTarget: EventTarget,\n type: string,\n listener?: 'all' | Listener,\n optionalArg?: boolean | any,\n ) {\n const options = getOptions(optionalArg)\n const targetIndex = arr.findIndex(targets, (t) => t.eventTarget === eventTarget)\n const target = targets[targetIndex]\n\n if (!target || !target.events) {\n return\n }\n\n if (type === 'all') {\n for (type in target.events) {\n if (target.events.hasOwnProperty(type)) {\n remove(eventTarget, type, 'all')\n }\n }\n return\n }\n\n let typeIsEmpty = false\n const typeListeners = target.events[type]\n\n if (typeListeners) {\n if (listener === 'all') {\n for (let i = typeListeners.length - 1; i >= 0; i--) {\n remove(eventTarget, type, typeListeners[i], options)\n }\n return\n } else {\n for (let i = 0; i < typeListeners.length; i++) {\n if (typeListeners[i] === listener) {\n eventTarget.removeEventListener(\n type,\n listener as any,\n eventsMethods.supportsOptions ? options : options.capture,\n )\n typeListeners.splice(i, 1)\n\n if (typeListeners.length === 0) {\n delete target.events[type]\n typeIsEmpty = true\n }\n\n break\n }\n }\n }\n }\n\n if (typeIsEmpty && !Object.keys(target.events).length) {\n targets.splice(targetIndex, 1)\n }\n }\n\n function addDelegate (selector: string, context: Node, type: string, listener: Listener, optionalArg?: any) {\n const options = getOptions(optionalArg)\n if (!delegatedEvents[type]) {\n delegatedEvents[type] = []\n\n // add delegate listener functions\n for (const doc of documents) {\n add(doc, type, delegateListener)\n add(doc, type, delegateUseCapture, true)\n }\n }\n\n const delegates = delegatedEvents[type]\n let delegate = arr.find(delegates, (d) => d.selector === selector && d.context === context)\n\n if (!delegate) {\n delegate = { selector, context, listeners: [] }\n delegates.push(delegate)\n }\n\n delegate.listeners.push([listener, options])\n }\n\n function removeDelegate (\n selector: string,\n context: Document | Element,\n type: string,\n listener?: Listener,\n optionalArg?: any,\n ) {\n const options = getOptions(optionalArg)\n const delegates = delegatedEvents[type]\n let matchFound = false\n let index: number\n\n if (!delegates) return\n\n // count from last index of delegated to 0\n for (index = delegates.length - 1; index >= 0; index--) {\n const cur = delegates[index]\n // look for matching selector and context Node\n if (cur.selector === selector && cur.context === context) {\n const { listeners } = cur\n\n // each item of the listeners array is an array: [function, capture, passive]\n for (let i = listeners.length - 1; i >= 0; i--) {\n const [fn, { capture, passive }] = listeners[i]\n\n // check if the listener functions and capture and passive flags match\n if (fn === listener && capture === options.capture && passive === options.passive) {\n // remove the listener from the array of listeners\n listeners.splice(i, 1)\n\n // if all listeners for this target have been removed\n // remove the target from the delegates array\n if (!listeners.length) {\n delegates.splice(index, 1)\n\n // remove delegate function from context\n remove(context, type, delegateListener)\n remove(context, type, delegateUseCapture, true)\n }\n\n // only remove one listener\n matchFound = true\n break\n }\n }\n\n if (matchFound) {\n break\n }\n }\n }\n }\n\n // bound to the interactable context when a DOM event\n // listener is added to a selector interactable\n function delegateListener (event: Event | FakeEvent, optionalArg?: any) {\n const options = getOptions(optionalArg)\n const fakeEvent = new FakeEvent(event as Event)\n const delegates = delegatedEvents[event.type]\n const [eventTarget] = pointerUtils.getEventTargets(event as Event)\n let element: Node = eventTarget\n\n // climb up document tree looking for selector matches\n while (is.element(element)) {\n for (let i = 0; i < delegates.length; i++) {\n const cur = delegates[i]\n const { selector, context } = cur\n\n if (\n domUtils.matchesSelector(element, selector) &&\n domUtils.nodeContains(context, eventTarget) &&\n domUtils.nodeContains(context, element)\n ) {\n const { listeners } = cur\n\n fakeEvent.currentTarget = element\n\n for (const [fn, { capture, passive }] of listeners) {\n if (capture === options.capture && passive === options.passive) {\n fn(fakeEvent)\n }\n }\n }\n }\n\n element = domUtils.parentNode(element)\n }\n }\n\n function delegateUseCapture (this: Element, event: Event | FakeEvent) {\n return delegateListener.call(this, event, true)\n }\n\n // for type inferrence\n return eventsMethods\n}\n\nclass FakeEvent implements Partial {\n currentTarget: Node\n originalEvent: Event\n type: string\n\n constructor (originalEvent: Event) {\n this.originalEvent = originalEvent\n // duplicate the event so that currentTarget can be changed\n pExtend(this, originalEvent)\n }\n\n preventOriginalDefault () {\n this.originalEvent.preventDefault()\n }\n\n stopPropagation () {\n this.originalEvent.stopPropagation()\n }\n\n stopImmediatePropagation () {\n this.originalEvent.stopImmediatePropagation()\n }\n}\n\nfunction getOptions (param: { [index: string]: any } | boolean): { capture: boolean, passive: boolean } {\n if (!is.object(param)) {\n return { capture: !!param, passive: false }\n }\n\n const options = extend({}, param) as any\n\n options.capture = !!param.capture\n options.passive = !!param.passive\n\n return options\n}\n\nexport default {\n id: 'events',\n install,\n}\n", "import type Interaction from '@interactjs/core/Interaction'\nimport type { Scope } from '@interactjs/core/scope'\nimport type { PointerType } from '@interactjs/core/types'\nimport * as dom from '@interactjs/utils/domUtils'\n\nexport interface SearchDetails {\n pointer: PointerType\n pointerId: number\n pointerType: string\n eventType: string\n eventTarget: EventTarget\n curEventTarget: EventTarget\n scope: Scope\n}\n\nconst finder = {\n methodOrder: ['simulationResume', 'mouseOrPen', 'hasPointer', 'idle'] as const,\n\n search (details: SearchDetails) {\n for (const method of finder.methodOrder) {\n const interaction = finder[method](details)\n\n if (interaction) {\n return interaction\n }\n }\n\n return null\n },\n\n // try to resume simulation with a new pointer\n simulationResume ({ pointerType, eventType, eventTarget, scope }: SearchDetails) {\n if (!/down|start/i.test(eventType)) {\n return null\n }\n\n for (const interaction of scope.interactions.list) {\n let element = eventTarget as Node\n\n if (\n interaction.simulation &&\n interaction.simulation.allowResume &&\n interaction.pointerType === pointerType\n ) {\n while (element) {\n // if the element is the interaction element\n if (element === interaction.element) {\n return interaction\n }\n element = dom.parentNode(element)\n }\n }\n }\n\n return null\n },\n\n // if it's a mouse or pen interaction\n mouseOrPen ({ pointerId, pointerType, eventType, scope }: SearchDetails) {\n if (pointerType !== 'mouse' && pointerType !== 'pen') {\n return null\n }\n\n let firstNonActive\n\n for (const interaction of scope.interactions.list) {\n if (interaction.pointerType === pointerType) {\n // if it's a down event, skip interactions with running simulations\n if (interaction.simulation && !hasPointerId(interaction, pointerId)) {\n continue\n }\n\n // if the interaction is active, return it immediately\n if (interaction.interacting()) {\n return interaction\n }\n // otherwise save it and look for another active interaction\n else if (!firstNonActive) {\n firstNonActive = interaction\n }\n }\n }\n\n // if no active mouse interaction was found use the first inactive mouse\n // interaction\n if (firstNonActive) {\n return firstNonActive\n }\n\n // find any mouse or pen interaction.\n // ignore the interaction if the eventType is a *down, and a simulation\n // is active\n for (const interaction of scope.interactions.list) {\n if (interaction.pointerType === pointerType && !(/down/i.test(eventType) && interaction.simulation)) {\n return interaction\n }\n }\n\n return null\n },\n\n // get interaction that has this pointer\n hasPointer ({ pointerId, scope }: SearchDetails) {\n for (const interaction of scope.interactions.list) {\n if (hasPointerId(interaction, pointerId)) {\n return interaction\n }\n }\n\n return null\n },\n\n // get first idle interaction with a matching pointerType\n idle ({ pointerType, scope }: SearchDetails) {\n for (const interaction of scope.interactions.list) {\n // if there's already a pointer held down\n if (interaction.pointers.length === 1) {\n const target = interaction.interactable\n // don't add this pointer if there is a target interactable and it\n // isn't gesturable\n if (target && !(target.options.gesture && target.options.gesture.enabled)) {\n continue\n }\n }\n // maximum of 2 pointers per interaction\n else if (interaction.pointers.length >= 2) {\n continue\n }\n\n if (!interaction.interacting() && pointerType === interaction.pointerType) {\n return interaction\n }\n }\n\n return null\n },\n}\n\nfunction hasPointerId (interaction: Interaction, pointerId: number) {\n return interaction.pointers.some(({ id }) => id === pointerId)\n}\n\nexport default finder\n", "import type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, Listener } from '@interactjs/core/types'\nimport browser from '@interactjs/utils/browser'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { nodeContains } from '@interactjs/utils/domUtils'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nimport InteractionBase from './Interaction'\nimport interactablePreventDefault from './interactablePreventDefault'\nimport type { SearchDetails } from './interactionFinder'\nimport finder from './interactionFinder'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n Interaction: typeof InteractionBase\n interactions: {\n new: (options: any) => InteractionBase\n list: Array>\n listeners: { [type: string]: Listener }\n docEvents: Array<{ type: string, listener: Listener }>\n pointerMoveTolerance: number\n }\n prevTouchTime: number\n }\n\n interface SignalArgs {\n 'interactions:find': {\n interaction: InteractionBase\n searchDetails: SearchDetails\n }\n }\n}\n\nconst methodNames = [\n 'pointerDown',\n 'pointerMove',\n 'pointerUp',\n 'updatePointer',\n 'removePointer',\n 'windowBlur',\n]\n\nfunction install (scope: Scope) {\n const listeners = {} as any\n\n for (const method of methodNames) {\n listeners[method] = doOnInteractions(method, scope)\n }\n\n const pEventTypes = browser.pEventTypes\n let docEvents: typeof scope.interactions.docEvents\n\n if (domObjects.PointerEvent) {\n docEvents = [\n { type: pEventTypes.down, listener: releasePointersOnRemovedEls },\n { type: pEventTypes.down, listener: listeners.pointerDown },\n { type: pEventTypes.move, listener: listeners.pointerMove },\n { type: pEventTypes.up, listener: listeners.pointerUp },\n { type: pEventTypes.cancel, listener: listeners.pointerUp },\n ]\n } else {\n docEvents = [\n { type: 'mousedown', listener: listeners.pointerDown },\n { type: 'mousemove', listener: listeners.pointerMove },\n { type: 'mouseup', listener: listeners.pointerUp },\n\n { type: 'touchstart', listener: releasePointersOnRemovedEls },\n { type: 'touchstart', listener: listeners.pointerDown },\n { type: 'touchmove', listener: listeners.pointerMove },\n { type: 'touchend', listener: listeners.pointerUp },\n { type: 'touchcancel', listener: listeners.pointerUp },\n ]\n }\n\n docEvents.push({\n type: 'blur',\n listener (event) {\n for (const interaction of scope.interactions.list) {\n interaction.documentBlur(event)\n }\n },\n })\n\n // for ignoring browser's simulated mouse events\n scope.prevTouchTime = 0\n\n scope.Interaction = class extends InteractionBase {\n get pointerMoveTolerance () {\n return scope.interactions.pointerMoveTolerance\n }\n\n set pointerMoveTolerance (value) {\n scope.interactions.pointerMoveTolerance = value\n }\n\n _now () {\n return scope.now()\n }\n }\n\n scope.interactions = {\n // all active and idle interactions\n list: [],\n new (options: { pointerType?: string, scopeFire?: Scope['fire'] }) {\n options.scopeFire = (name, arg) => scope.fire(name, arg)\n\n const interaction = new scope.Interaction(options as Required)\n\n scope.interactions.list.push(interaction)\n return interaction\n },\n listeners,\n docEvents,\n pointerMoveTolerance: 1,\n }\n\n function releasePointersOnRemovedEls () {\n // for all inactive touch interactions with pointers down\n for (const interaction of scope.interactions.list) {\n if (!interaction.pointerIsDown || interaction.pointerType !== 'touch' || interaction._interacting) {\n continue\n }\n\n // if a pointer is down on an element that is no longer in the DOM tree\n for (const pointer of interaction.pointers) {\n if (!scope.documents.some(({ doc }) => nodeContains(doc, pointer.downTarget))) {\n // remove the pointer from the interaction\n interaction.removePointer(pointer.pointer, pointer.event)\n }\n }\n }\n }\n\n scope.usePlugin(interactablePreventDefault)\n}\n\nfunction doOnInteractions (method: string, scope: Scope) {\n return function (event: Event) {\n const interactions = scope.interactions.list\n\n const pointerType = pointerUtils.getPointerType(event)\n const [eventTarget, curEventTarget] = pointerUtils.getEventTargets(event)\n const matches: any[] = [] // [ [pointer, interaction], ...]\n\n if (/^touch/.test(event.type)) {\n scope.prevTouchTime = scope.now()\n\n // @ts-expect-error\n for (const changedTouch of event.changedTouches) {\n const pointer = changedTouch\n const pointerId = pointerUtils.getPointerId(pointer)\n const searchDetails: SearchDetails = {\n pointer,\n pointerId,\n pointerType,\n eventType: event.type,\n eventTarget,\n curEventTarget,\n scope,\n }\n const interaction = getInteraction(searchDetails)\n\n matches.push([\n searchDetails.pointer,\n searchDetails.eventTarget,\n searchDetails.curEventTarget,\n interaction,\n ])\n }\n } else {\n let invalidPointer = false\n\n if (!browser.supportsPointerEvent && /mouse/.test(event.type)) {\n // ignore mouse events while touch interactions are active\n for (let i = 0; i < interactions.length && !invalidPointer; i++) {\n invalidPointer = interactions[i].pointerType !== 'mouse' && interactions[i].pointerIsDown\n }\n\n // try to ignore mouse events that are simulated by the browser\n // after a touch event\n invalidPointer =\n invalidPointer ||\n scope.now() - scope.prevTouchTime < 500 ||\n // on iOS and Firefox Mobile, MouseEvent.timeStamp is zero if simulated\n event.timeStamp === 0\n }\n\n if (!invalidPointer) {\n const searchDetails = {\n pointer: event as PointerEvent,\n pointerId: pointerUtils.getPointerId(event as PointerEvent),\n pointerType,\n eventType: event.type,\n curEventTarget,\n eventTarget,\n scope,\n }\n\n const interaction = getInteraction(searchDetails)\n\n matches.push([\n searchDetails.pointer,\n searchDetails.eventTarget,\n searchDetails.curEventTarget,\n interaction,\n ])\n }\n }\n\n // eslint-disable-next-line no-shadow\n for (const [pointer, eventTarget, curEventTarget, interaction] of matches) {\n interaction[method](pointer, event, eventTarget, curEventTarget)\n }\n }\n}\n\nfunction getInteraction (searchDetails: SearchDetails) {\n const { pointerType, scope } = searchDetails\n\n const foundInteraction = finder.search(searchDetails)\n const signalArg = { interaction: foundInteraction, searchDetails }\n\n scope.fire('interactions:find', signalArg)\n\n return signalArg.interaction || scope.interactions.new({ pointerType })\n}\n\nfunction onDocSignal (\n { doc, scope, options }: SignalArgs[T],\n eventMethodName: 'add' | 'remove',\n) {\n const {\n interactions: { docEvents },\n events,\n } = scope\n const eventMethod = events[eventMethodName]\n\n if (scope.browser.isIOS && !options.events) {\n options.events = { passive: false }\n }\n\n // delegate event listener\n for (const eventType in events.delegatedEvents) {\n eventMethod(doc, eventType, events.delegateListener)\n eventMethod(doc, eventType, events.delegateUseCapture, true)\n }\n\n const eventOptions = options && options.events\n\n for (const { type, listener } of docEvents) {\n eventMethod(doc, type, listener, eventOptions)\n }\n}\n\nconst interactions: Plugin = {\n id: 'core/interactions',\n install,\n listeners: {\n 'scope:add-document': (arg) => onDocSignal(arg, 'add'),\n 'scope:remove-document': (arg) => onDocSignal(arg, 'remove'),\n 'interactable:unset': ({ interactable }, scope) => {\n // Stop and destroy related interactions when an Interactable is unset\n for (let i = scope.interactions.list.length - 1; i >= 0; i--) {\n const interaction = scope.interactions.list[i]\n\n if (interaction.interactable !== interactable) {\n continue\n }\n\n interaction.stop()\n scope.fire('interactions:destroy', { interaction })\n interaction.destroy()\n\n if (scope.interactions.list.length > 2) {\n scope.interactions.list.splice(i, 1)\n }\n }\n },\n },\n onDocSignal,\n doOnInteractions,\n methodNames,\n}\n\nexport default interactions\n", "import type Interaction from '@interactjs/core/Interaction'\nimport browser from '@interactjs/utils/browser'\nimport clone from '@interactjs/utils/clone'\nimport domObjects from '@interactjs/utils/domObjects'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport raf from '@interactjs/utils/raf'\nimport * as win from '@interactjs/utils/window'\n\nimport { Eventable } from './Eventable'\nimport { InteractEvent } from './InteractEvent'\nimport { createInteractStatic } from './InteractStatic'\nimport { Interactable as InteractableBase } from './Interactable'\nimport { InteractableSet } from './InteractableSet'\nimport events from './events'\nimport interactions from './interactions'\nimport type { OptionsArg } from './options'\nimport { defaults } from './options'\nimport type { Actions } from './types'\n\nexport interface SignalArgs {\n 'scope:add-document': DocSignalArg\n 'scope:remove-document': DocSignalArg\n 'interactable:unset': { interactable: InteractableBase }\n 'interactable:set': { interactable: InteractableBase, options: OptionsArg }\n 'interactions:destroy': { interaction: Interaction }\n}\n\nexport type ListenerName = keyof SignalArgs\n\nexport type ListenerMap = {\n [P in ListenerName]?: (arg: SignalArgs[P], scope: Scope, signalName: P) => void | boolean\n}\n\ninterface DocSignalArg {\n doc: Document\n window: Window\n scope: Scope\n options: Record\n}\n\nexport interface Plugin {\n [key: string]: any\n id?: string\n listeners?: ListenerMap\n before?: string[]\n install?(scope: Scope, options?: any): void\n}\n\nexport class Scope {\n id = `__interact_scope_${Math.floor(Math.random() * 100)}`\n isInitialized = false\n listenerMaps: Array<{\n map: ListenerMap\n id: string\n }> = []\n\n browser = browser\n defaults = clone(defaults) as typeof defaults\n Eventable = Eventable\n actions: Actions = {\n map: {},\n phases: {\n start: true,\n move: true,\n end: true,\n },\n methodDict: {} as any,\n phaselessTypes: {},\n }\n\n interactStatic = createInteractStatic(this)\n InteractEvent = InteractEvent\n Interactable: typeof InteractableBase\n interactables = new InteractableSet(this)\n\n // main window\n _win!: Window\n\n // main document\n document!: Document\n\n // main window\n window!: Window\n\n // all documents being listened to\n documents: Array<{ doc: Document, options: any }> = []\n\n _plugins: {\n list: Plugin[]\n map: { [id: string]: Plugin }\n } = {\n list: [],\n map: {},\n }\n\n constructor () {\n const scope = this\n\n this.Interactable = class extends InteractableBase {\n get _defaults () {\n return scope.defaults\n }\n\n set (this: T, options: OptionsArg) {\n super.set(options)\n\n scope.fire('interactable:set', {\n options,\n interactable: this,\n })\n\n return this\n }\n\n unset (this: InteractableBase) {\n super.unset()\n\n const index = scope.interactables.list.indexOf(this)\n if (index < 0) return\n\n super.unset()\n scope.interactables.list.splice(index, 1)\n scope.fire('interactable:unset', { interactable: this })\n }\n }\n }\n\n addListeners (map: ListenerMap, id?: string) {\n this.listenerMaps.push({ id, map })\n }\n\n fire (name: T, arg: SignalArgs[T]): void | false {\n for (const {\n map: { [name]: listener },\n } of this.listenerMaps) {\n if (!!listener && listener(arg as any, this, name as never) === false) {\n return false\n }\n }\n }\n\n onWindowUnload = (event: BeforeUnloadEvent) => this.removeDocument(event.target as Document)\n\n init (window: Window | typeof globalThis) {\n return this.isInitialized ? this : initScope(this, window)\n }\n\n pluginIsInstalled (plugin: Plugin) {\n return this._plugins.map[plugin.id] || this._plugins.list.indexOf(plugin) !== -1\n }\n\n usePlugin (plugin: Plugin, options?: { [key: string]: any }) {\n if (!this.isInitialized) {\n return this\n }\n\n if (this.pluginIsInstalled(plugin)) {\n return this\n }\n\n if (plugin.id) {\n this._plugins.map[plugin.id] = plugin\n }\n this._plugins.list.push(plugin)\n\n if (plugin.install) {\n plugin.install(this, options)\n }\n\n if (plugin.listeners && plugin.before) {\n let index = 0\n const len = this.listenerMaps.length\n const before = plugin.before.reduce((acc, id) => {\n acc[id] = true\n acc[pluginIdRoot(id)] = true\n return acc\n }, {})\n\n for (; index < len; index++) {\n const otherId = this.listenerMaps[index].id\n\n if (before[otherId] || before[pluginIdRoot(otherId)]) {\n break\n }\n }\n\n this.listenerMaps.splice(index, 0, { id: plugin.id, map: plugin.listeners })\n } else if (plugin.listeners) {\n this.listenerMaps.push({ id: plugin.id, map: plugin.listeners })\n }\n\n return this\n }\n\n addDocument (doc: Document, options?: any): void | false {\n // do nothing if document is already known\n if (this.getDocIndex(doc) !== -1) {\n return false\n }\n\n const window = win.getWindow(doc)\n\n options = options ? extend({}, options) : {}\n\n this.documents.push({ doc, options })\n this.events.documents.push(doc)\n\n // don't add an unload event for the main document\n // so that the page may be cached in browser history\n if (doc !== this.document) {\n this.events.add(window, 'unload', this.onWindowUnload)\n }\n\n this.fire('scope:add-document', { doc, window, scope: this, options })\n }\n\n removeDocument (doc: Document) {\n const index = this.getDocIndex(doc)\n\n const window = win.getWindow(doc)\n const options = this.documents[index].options\n\n this.events.remove(window, 'unload', this.onWindowUnload)\n\n this.documents.splice(index, 1)\n this.events.documents.splice(index, 1)\n\n this.fire('scope:remove-document', { doc, window, scope: this, options })\n }\n\n getDocIndex (doc: Document) {\n for (let i = 0; i < this.documents.length; i++) {\n if (this.documents[i].doc === doc) {\n return i\n }\n }\n\n return -1\n }\n\n getDocOptions (doc: Document) {\n const docIndex = this.getDocIndex(doc)\n\n return docIndex === -1 ? null : this.documents[docIndex].options\n }\n\n now () {\n return (((this.window as any).Date as typeof Date) || Date).now()\n }\n}\n\nexport function initScope (scope: Scope, window: Window | typeof globalThis) {\n scope.isInitialized = true\n\n if (is.window(window)) {\n win.init(window)\n }\n\n domObjects.init(window)\n browser.init(window)\n raf.init(window)\n\n // @ts-expect-error\n scope.window = window\n scope.document = window.document\n\n scope.usePlugin(interactions)\n scope.usePlugin(events)\n\n return scope\n}\n\nfunction pluginIdRoot (id: string) {\n return id && id.replace(/\\/.*$/, '')\n}\n", "var _$types_28 = {};\n\"use strict\";\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbXX0=", "import { Scope } from '@interactjs/core/scope'\nexport * from '@interactjs/core/types'\n\nconst scope = new Scope()\n\nconst interact = scope.interactStatic\n\nexport default interact\n\nconst _global = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this\nscope.init(_global)\n", "export default () => {}\n", "export default () => {}\n", "import type { Rect, Point } from '@interactjs/core/types'\nimport type { SnapFunction, SnapTarget } from '@interactjs/modifiers/snap/pointer'\n\nexport type GridOptions = (Partial | Point) & {\n range?: number\n limits?: Rect\n offset?: Point\n}\n\nexport default (grid: GridOptions) => {\n const coordFields = (\n [\n ['x', 'y'],\n ['left', 'top'],\n ['right', 'bottom'],\n ['width', 'height'],\n ] as const\n ).filter(([xField, yField]) => xField in grid || yField in grid)\n\n const gridFunc: SnapFunction & {\n grid: typeof grid\n coordFields: typeof coordFields\n } = (x, y) => {\n const {\n range,\n limits = {\n left: -Infinity,\n right: Infinity,\n top: -Infinity,\n bottom: Infinity,\n },\n offset = { x: 0, y: 0 },\n } = grid\n\n const result: SnapTarget & {\n grid: typeof grid\n } = { range, grid, x: null as number, y: null as number }\n\n for (const [xField, yField] of coordFields) {\n const gridx = Math.round((x - offset.x) / (grid as any)[xField])\n const gridy = Math.round((y - offset.y) / (grid as any)[yField])\n\n result[xField] = Math.max(limits.left, Math.min(limits.right, gridx * (grid as any)[xField] + offset.x))\n result[yField] = Math.max(limits.top, Math.min(limits.bottom, gridy * (grid as any)[yField] + offset.y))\n }\n\n return result\n }\n\n gridFunc.grid = grid\n gridFunc.coordFields = coordFields\n\n return gridFunc\n}\n", "import type { Plugin } from '@interactjs/core/scope'\nimport extend from '@interactjs/utils/extend'\n\nimport * as allSnappers from './all'\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n snappers: typeof allSnappers\n createSnapGrid: typeof allSnappers.grid\n }\n}\n\nconst snappersPlugin: Plugin = {\n id: 'snappers',\n install (scope) {\n const { interactStatic: interact } = scope\n\n interact.snappers = extend(interact.snappers || {}, allSnappers)\n interact.createSnapGrid = interact.snappers.grid\n },\n}\n\nexport default snappersPlugin\n", "/**\n * @module modifiers/aspectRatio\n *\n * @description\n * This module forces elements to be resized with a specified dx/dy ratio.\n *\n * ```js\n * interact(target).resizable({\n * modifiers: [\n * interact.modifiers.snapSize({\n * targets: [ interact.snappers.grid({ x: 20, y: 20 }) ],\n * }),\n * interact.aspectRatio({ ratio: 'preserve' }),\n * ],\n * });\n * ```\n */\n\nimport type { Point, Rect, EdgeOptions } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport { addEdges } from '@interactjs/utils/rect'\n\nimport Modification from './Modification'\nimport type { Modifier, ModifierModule, ModifierState } from './base'\nimport { makeModifier } from './base'\n\nexport interface AspectRatioOptions {\n ratio?: number | 'preserve'\n equalDelta?: boolean\n modifiers?: Modifier[]\n enabled?: boolean\n}\n\nexport type AspectRatioState = ModifierState<\nAspectRatioOptions,\n{\n startCoords: Point\n startRect: Rect\n linkedEdges: EdgeOptions\n ratio: number\n equalDelta: boolean\n xIsPrimaryAxis: boolean\n edgeSign: {\n x: number\n y: number\n }\n subModification: Modification\n}\n>\n\nconst aspectRatio: ModifierModule = {\n start (arg) {\n const { state, rect, edges: originalEdges, pageCoords: coords } = arg\n let { ratio } = state.options\n const { equalDelta, modifiers } = state.options\n\n if (ratio === 'preserve') {\n ratio = rect.width / rect.height\n }\n\n state.startCoords = extend({}, coords)\n state.startRect = extend({}, rect)\n state.ratio = ratio\n state.equalDelta = equalDelta\n\n const linkedEdges = (state.linkedEdges = {\n top: originalEdges.top || (originalEdges.left && !originalEdges.bottom),\n left: originalEdges.left || (originalEdges.top && !originalEdges.right),\n bottom: originalEdges.bottom || (originalEdges.right && !originalEdges.top),\n right: originalEdges.right || (originalEdges.bottom && !originalEdges.left),\n })\n\n state.xIsPrimaryAxis = !!(originalEdges.left || originalEdges.right)\n\n if (state.equalDelta) {\n const sign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1)\n state.edgeSign = {\n x: sign,\n y: sign,\n }\n } else {\n state.edgeSign = {\n x: linkedEdges.left ? -1 : 1,\n y: linkedEdges.top ? -1 : 1,\n }\n }\n\n extend(arg.edges, linkedEdges)\n\n if (!modifiers || !modifiers.length) return\n\n const subModification = new Modification(arg.interaction)\n\n subModification.copyFrom(arg.interaction.modification)\n subModification.prepareStates(modifiers)\n\n state.subModification = subModification\n subModification.startAll({ ...arg })\n },\n\n set (arg) {\n const { state, rect, coords } = arg\n const initialCoords = extend({}, coords)\n const aspectMethod = state.equalDelta ? setEqualDelta : setRatio\n\n aspectMethod(state, state.xIsPrimaryAxis, coords, rect)\n\n if (!state.subModification) {\n return null\n }\n\n const correctedRect = extend({}, rect)\n\n addEdges(state.linkedEdges, correctedRect, {\n x: coords.x - initialCoords.x,\n y: coords.y - initialCoords.y,\n })\n\n const result = state.subModification.setAll({\n ...arg,\n rect: correctedRect,\n edges: state.linkedEdges,\n pageCoords: coords,\n prevCoords: coords,\n prevRect: correctedRect,\n })\n\n const { delta } = result\n\n if (result.changed) {\n const xIsCriticalAxis = Math.abs(delta.x) > Math.abs(delta.y)\n\n // do aspect modification again with critical edge axis as primary\n aspectMethod(state, xIsCriticalAxis, result.coords, result.rect)\n extend(coords, result.coords)\n }\n\n return result.eventProps\n },\n\n defaults: {\n ratio: 'preserve',\n equalDelta: false,\n modifiers: [],\n enabled: false,\n },\n}\n\nfunction setEqualDelta ({ startCoords, edgeSign }: AspectRatioState, xIsPrimaryAxis: boolean, coords: Point) {\n if (xIsPrimaryAxis) {\n coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign.y\n } else {\n coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign.x\n }\n}\n\nfunction setRatio (\n { startRect, startCoords, ratio, edgeSign }: AspectRatioState,\n xIsPrimaryAxis: boolean,\n coords: Point,\n rect: Rect,\n) {\n if (xIsPrimaryAxis) {\n const newHeight = rect.width / ratio\n\n coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign.y\n } else {\n const newWidth = rect.height * ratio\n\n coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign.x\n }\n}\n\nexport default makeModifier(aspectRatio, 'aspectRatio')\nexport { aspectRatio }\n", "import type { ModifierFunction } from '@interactjs/modifiers/base'\n\nconst noop = (() => {}) as unknown as ModifierFunction\n\nnoop._defaults = {}\n\nexport default noop\n", "import type Interaction from '@interactjs/core/Interaction'\nimport type { RectResolvable, Rect, Point } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { ModifierArg, ModifierModule, ModifierState } from '../base'\nimport { makeModifier } from '../base'\n\nexport interface RestrictOptions {\n // where to drag over\n restriction: RectResolvable<[number, number, Interaction]>\n // what part of self is allowed to drag over\n elementRect: Rect\n offset: Rect\n // restrict just before the end drag\n endOnly: boolean\n enabled?: boolean\n}\n\nexport type RestrictState = ModifierState<\nRestrictOptions,\n{\n offset: Rect\n}\n>\n\nfunction start ({ rect, startOffset, state, interaction, pageCoords }: ModifierArg) {\n const { options } = state\n const { elementRect } = options\n const offset: Rect = extend(\n {\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n },\n options.offset || {},\n )\n\n if (rect && elementRect) {\n const restriction = getRestrictionRect(options.restriction, interaction, pageCoords)\n\n if (restriction) {\n const widthDiff = restriction.right - restriction.left - rect.width\n const heightDiff = restriction.bottom - restriction.top - rect.height\n\n if (widthDiff < 0) {\n offset.left += widthDiff\n offset.right += widthDiff\n }\n if (heightDiff < 0) {\n offset.top += heightDiff\n offset.bottom += heightDiff\n }\n }\n\n offset.left += startOffset.left - rect.width * elementRect.left\n offset.top += startOffset.top - rect.height * elementRect.top\n\n offset.right += startOffset.right - rect.width * (1 - elementRect.right)\n offset.bottom += startOffset.bottom - rect.height * (1 - elementRect.bottom)\n }\n\n state.offset = offset\n}\n\nfunction set ({ coords, interaction, state }: ModifierArg) {\n const { options, offset } = state\n\n const restriction = getRestrictionRect(options.restriction, interaction, coords)\n\n if (!restriction) return\n\n const rect = rectUtils.xywhToTlbr(restriction)\n\n coords.x = Math.max(Math.min(rect.right - offset.right, coords.x), rect.left + offset.left)\n coords.y = Math.max(Math.min(rect.bottom - offset.bottom, coords.y), rect.top + offset.top)\n}\n\nexport function getRestrictionRect (\n value: RectResolvable<[number, number, Interaction]>,\n interaction: Interaction,\n coords?: Point,\n) {\n if (is.func(value)) {\n return rectUtils.resolveRectLike(value, interaction.interactable, interaction.element, [\n coords.x,\n coords.y,\n interaction,\n ])\n } else {\n return rectUtils.resolveRectLike(value, interaction.interactable, interaction.element)\n }\n}\n\nconst defaults: RestrictOptions = {\n restriction: null,\n elementRect: null,\n offset: null,\n endOnly: false,\n enabled: false,\n}\n\nconst restrict: ModifierModule = {\n start,\n set,\n defaults,\n}\n\nexport default makeModifier(restrict, 'restrict')\nexport { restrict }\n", "// This module adds the options.resize.restrictEdges setting which sets min and\n// max for the top, left, bottom and right edges of the target being resized.\n//\n// interact(target).resize({\n// edges: { top: true, left: true },\n// restrictEdges: {\n// inner: { top: 200, left: 200, right: 400, bottom: 400 },\n// outer: { top: 0, left: 0, right: 600, bottom: 600 },\n// },\n// })\n\nimport type { Point, Rect } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { ModifierArg, ModifierState } from '../base'\nimport { makeModifier } from '../base'\n\nimport type { RestrictOptions } from './pointer'\nimport { getRestrictionRect } from './pointer'\n\nexport interface RestrictEdgesOptions {\n inner: RestrictOptions['restriction']\n outer: RestrictOptions['restriction']\n offset?: RestrictOptions['offset']\n endOnly: boolean\n enabled?: boolean\n}\n\nexport type RestrictEdgesState = ModifierState<\nRestrictEdgesOptions,\n{\n inner: Rect\n outer: Rect\n offset: RestrictEdgesOptions['offset']\n}\n>\n\nconst noInner = { top: +Infinity, left: +Infinity, bottom: -Infinity, right: -Infinity }\nconst noOuter = { top: -Infinity, left: -Infinity, bottom: +Infinity, right: +Infinity }\n\nfunction start ({ interaction, startOffset, state }: ModifierArg) {\n const { options } = state\n let offset: Point\n\n if (options) {\n const offsetRect = getRestrictionRect(options.offset, interaction, interaction.coords.start.page)\n\n offset = rectUtils.rectToXY(offsetRect)\n }\n\n offset = offset || { x: 0, y: 0 }\n\n state.offset = {\n top: offset.y + startOffset.top,\n left: offset.x + startOffset.left,\n bottom: offset.y - startOffset.bottom,\n right: offset.x - startOffset.right,\n }\n}\n\nfunction set ({ coords, edges, interaction, state }: ModifierArg) {\n const { offset, options } = state\n\n if (!edges) {\n return\n }\n\n const page = extend({}, coords)\n const inner = getRestrictionRect(options.inner, interaction, page) || ({} as Rect)\n const outer = getRestrictionRect(options.outer, interaction, page) || ({} as Rect)\n\n fixRect(inner, noInner)\n fixRect(outer, noOuter)\n\n if (edges.top) {\n coords.y = Math.min(Math.max(outer.top + offset.top, page.y), inner.top + offset.top)\n } else if (edges.bottom) {\n coords.y = Math.max(Math.min(outer.bottom + offset.bottom, page.y), inner.bottom + offset.bottom)\n }\n if (edges.left) {\n coords.x = Math.min(Math.max(outer.left + offset.left, page.x), inner.left + offset.left)\n } else if (edges.right) {\n coords.x = Math.max(Math.min(outer.right + offset.right, page.x), inner.right + offset.right)\n }\n}\n\nfunction fixRect (rect: Rect, defaults: Rect) {\n for (const edge of ['top', 'left', 'bottom', 'right']) {\n if (!(edge in rect)) {\n rect[edge] = defaults[edge]\n }\n }\n\n return rect\n}\n\nconst defaults: RestrictEdgesOptions = {\n inner: null,\n outer: null,\n offset: null,\n endOnly: false,\n enabled: false,\n}\n\nconst restrictEdges = {\n noInner,\n noOuter,\n start,\n set,\n defaults,\n}\n\nexport default makeModifier(restrictEdges, 'restrictEdges')\nexport { restrictEdges }\n", "import extend from '@interactjs/utils/extend'\n\nimport { makeModifier } from '../base'\n\nimport { restrict } from './pointer'\n\nconst defaults = extend(\n {\n get elementRect () {\n return { top: 0, left: 0, bottom: 1, right: 1 }\n },\n set elementRect (_) {},\n },\n restrict.defaults,\n)\n\nconst restrictRect = {\n start: restrict.start,\n set: restrict.set,\n defaults,\n}\n\nexport default makeModifier(restrictRect, 'restrictRect')\nexport { restrictRect }\n", "import type { Point, Rect, Size } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\n\nimport type { ModifierArg, ModifierState } from '../base'\nimport { makeModifier } from '../base'\n\nimport type { RestrictEdgesState } from './edges'\nimport { restrictEdges } from './edges'\nimport type { RestrictOptions } from './pointer'\nimport { getRestrictionRect } from './pointer'\n\nconst noMin = { width: -Infinity, height: -Infinity }\nconst noMax = { width: +Infinity, height: +Infinity }\n\nexport interface RestrictSizeOptions {\n min?: Size | Point | RestrictOptions['restriction']\n max?: Size | Point | RestrictOptions['restriction']\n endOnly: boolean\n enabled?: boolean\n}\n\nfunction start (arg: ModifierArg) {\n return restrictEdges.start(arg)\n}\n\nexport type RestrictSizeState = RestrictEdgesState &\nModifierState<\nRestrictSizeOptions & { inner: Rect, outer: Rect },\n{\n min: Rect\n max: Rect\n}\n>\n\nfunction set (arg: ModifierArg) {\n const { interaction, state, rect, edges } = arg\n const { options } = state\n\n if (!edges) {\n return\n }\n\n const minSize =\n rectUtils.tlbrToXywh(getRestrictionRect(options.min as any, interaction, arg.coords)) || noMin\n const maxSize =\n rectUtils.tlbrToXywh(getRestrictionRect(options.max as any, interaction, arg.coords)) || noMax\n\n state.options = {\n endOnly: options.endOnly,\n inner: extend({}, restrictEdges.noInner),\n outer: extend({}, restrictEdges.noOuter),\n }\n\n if (edges.top) {\n state.options.inner.top = rect.bottom - minSize.height\n state.options.outer.top = rect.bottom - maxSize.height\n } else if (edges.bottom) {\n state.options.inner.bottom = rect.top + minSize.height\n state.options.outer.bottom = rect.top + maxSize.height\n }\n if (edges.left) {\n state.options.inner.left = rect.right - minSize.width\n state.options.outer.left = rect.right - maxSize.width\n } else if (edges.right) {\n state.options.inner.right = rect.left + minSize.width\n state.options.outer.right = rect.left + maxSize.width\n }\n\n restrictEdges.set(arg)\n\n state.options = options\n}\n\nconst defaults: RestrictSizeOptions = {\n min: null,\n max: null,\n endOnly: false,\n enabled: false,\n}\n\nconst restrictSize = {\n start,\n set,\n defaults,\n}\n\nexport default makeModifier(restrictSize, 'restrictSize')\nexport { restrictSize }\n", "import type { Interaction, InteractionProxy } from '@interactjs/core/Interaction'\nimport type { ActionName, Point, RectResolvable, Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport hypot from '@interactjs/utils/hypot'\nimport is from '@interactjs/utils/is'\nimport { resolveRectLike, rectToXY } from '@interactjs/utils/rect'\n\nimport type { ModifierArg, ModifierState } from '../base'\nimport { makeModifier } from '../base'\n\nexport interface Offset {\n x: number\n y: number\n index: number\n relativePoint?: Point | null\n}\n\nexport interface SnapPosition {\n x?: number\n y?: number\n range?: number\n offset?: Offset\n [index: string]: any\n}\n\nexport type SnapFunction = (\n x: number,\n y: number,\n interaction: InteractionProxy,\n offset: Offset,\n index: number,\n) => SnapPosition\nexport type SnapTarget = SnapPosition | SnapFunction\nexport interface SnapOptions {\n targets: SnapTarget[] | null\n // target range\n range: number\n // self points for snapping. [0,0] = top left, [1,1] = bottom right\n relativePoints: Point[] | null\n // startCoords = offset snapping from drag start page position\n offset: Point | RectResolvable<[Interaction]> | 'startCoords' | null\n offsetWithOrigin?: boolean\n origin: RectResolvable<[Element]> | Point | null\n endOnly?: boolean\n enabled?: boolean\n}\n\nexport type SnapState = ModifierState<\nSnapOptions,\n{\n offsets?: Offset[]\n closest?: any\n targetFields?: string[][]\n}\n>\n\nfunction start (arg: ModifierArg) {\n const { interaction, interactable, element, rect, state, startOffset } = arg\n const { options } = state\n const origin = options.offsetWithOrigin ? getOrigin(arg) : { x: 0, y: 0 }\n\n let snapOffset: Point\n\n if (options.offset === 'startCoords') {\n snapOffset = {\n x: interaction.coords.start.page.x,\n y: interaction.coords.start.page.y,\n }\n } else {\n const offsetRect = resolveRectLike(options.offset as any, interactable, element, [interaction])\n\n snapOffset = rectToXY(offsetRect) || { x: 0, y: 0 }\n snapOffset.x += origin.x\n snapOffset.y += origin.y\n }\n\n const { relativePoints } = options\n\n state.offsets =\n rect && relativePoints && relativePoints.length\n ? relativePoints.map((relativePoint, index) => ({\n index,\n relativePoint,\n x: startOffset.left - rect.width * relativePoint.x + snapOffset.x,\n y: startOffset.top - rect.height * relativePoint.y + snapOffset.y,\n }))\n : [\n {\n index: 0,\n relativePoint: null,\n x: snapOffset.x,\n y: snapOffset.y,\n },\n ]\n}\n\nfunction set (arg: ModifierArg) {\n const { interaction, coords, state } = arg\n const { options, offsets } = state\n\n const origin = getOriginXY(interaction.interactable, interaction.element, interaction.prepared.name)\n const page = extend({}, coords)\n const targets = []\n\n if (!options.offsetWithOrigin) {\n page.x -= origin.x\n page.y -= origin.y\n }\n\n for (const offset of offsets) {\n const relativeX = page.x - offset.x\n const relativeY = page.y - offset.y\n\n for (let index = 0, len = options.targets.length; index < len; index++) {\n const snapTarget = options.targets[index]\n let target: SnapPosition\n\n if (is.func(snapTarget)) {\n target = snapTarget(relativeX, relativeY, interaction._proxy, offset, index)\n } else {\n target = snapTarget\n }\n\n if (!target) {\n continue\n }\n\n targets.push({\n x: (is.number(target.x) ? target.x : relativeX) + offset.x,\n y: (is.number(target.y) ? target.y : relativeY) + offset.y,\n\n range: is.number(target.range) ? target.range : options.range,\n source: snapTarget,\n index,\n offset,\n })\n }\n }\n\n const closest = {\n target: null,\n inRange: false,\n distance: 0,\n range: 0,\n delta: { x: 0, y: 0 },\n }\n\n for (const target of targets) {\n const range = target.range\n const dx = target.x - page.x\n const dy = target.y - page.y\n const distance = hypot(dx, dy)\n let inRange = distance <= range\n\n // Infinite targets count as being out of range\n // compared to non infinite ones that are in range\n if (range === Infinity && closest.inRange && closest.range !== Infinity) {\n inRange = false\n }\n\n if (\n !closest.target ||\n (inRange\n ? // is the closest target in range?\n closest.inRange && range !== Infinity\n ? // the pointer is relatively deeper in this target\n distance / range < closest.distance / closest.range\n : // this target has Infinite range and the closest doesn't\n (range === Infinity && closest.range !== Infinity) ||\n // OR this target is closer that the previous closest\n distance < closest.distance\n : // The other is not in range and the pointer is closer to this target\n !closest.inRange && distance < closest.distance)\n ) {\n closest.target = target\n closest.distance = distance\n closest.range = range\n closest.inRange = inRange\n closest.delta.x = dx\n closest.delta.y = dy\n }\n }\n\n if (closest.inRange) {\n coords.x = closest.target.x\n coords.y = closest.target.y\n }\n\n state.closest = closest\n return closest\n}\n\nfunction getOrigin (arg: Partial>) {\n const { element } = arg.interaction\n const optionsOrigin = rectToXY(resolveRectLike(arg.state.options.origin as any, null, null, [element]))\n const origin = optionsOrigin || getOriginXY(arg.interactable, element, arg.interaction.prepared.name)\n\n return origin\n}\n\nconst defaults: SnapOptions = {\n range: Infinity,\n targets: null,\n offset: null,\n offsetWithOrigin: true,\n origin: null,\n relativePoints: null,\n endOnly: false,\n enabled: false,\n}\nconst snap = {\n start,\n set,\n defaults,\n}\n\nexport default makeModifier(snap, 'snap')\nexport { snap }\n", "// This module allows snapping of the size of targets during resize\n// interactions.\n\nimport extend from '@interactjs/utils/extend'\nimport is from '@interactjs/utils/is'\n\nimport type { ModifierArg } from '../base'\nimport { makeModifier } from '../base'\n\nimport type { SnapOptions, SnapState } from './pointer'\nimport { snap } from './pointer'\n\nexport type SnapSizeOptions = Pick\n\nfunction start (arg: ModifierArg) {\n const { state, edges } = arg\n const { options } = state\n\n if (!edges) {\n return null\n }\n\n arg.state = {\n options: {\n targets: null,\n relativePoints: [\n {\n x: edges.left ? 0 : 1,\n y: edges.top ? 0 : 1,\n },\n ],\n offset: options.offset || 'self',\n origin: { x: 0, y: 0 },\n range: options.range,\n },\n }\n\n state.targetFields = state.targetFields || [\n ['width', 'height'],\n ['x', 'y'],\n ]\n\n snap.start(arg)\n state.offsets = arg.state.offsets\n\n arg.state = state\n}\n\nfunction set (arg) {\n const { interaction, state, coords } = arg\n const { options, offsets } = state\n const relative = {\n x: coords.x - offsets[0].x,\n y: coords.y - offsets[0].y,\n }\n\n state.options = extend({}, options)\n state.options.targets = []\n\n for (const snapTarget of options.targets || []) {\n let target\n\n if (is.func(snapTarget)) {\n target = snapTarget(relative.x, relative.y, interaction)\n } else {\n target = snapTarget\n }\n\n if (!target) {\n continue\n }\n\n for (const [xField, yField] of state.targetFields) {\n if (xField in target || yField in target) {\n target.x = target[xField]\n target.y = target[yField]\n\n break\n }\n }\n\n state.options.targets.push(target)\n }\n\n const returnValue = snap.set(arg)\n\n state.options = options\n\n return returnValue\n}\n\nconst defaults: SnapSizeOptions = {\n range: Infinity,\n targets: null,\n offset: null,\n endOnly: false,\n enabled: false,\n}\n\nconst snapSize = {\n start,\n set,\n defaults,\n}\n\nexport default makeModifier(snapSize, 'snapSize')\nexport { snapSize }\n", "/**\n * @module modifiers/snapEdges\n *\n * @description\n * WOW> This module allows snapping of the edges of targets during resize\n * interactions.\n *\n * ```js\n * interact(target).resizable({\n * snapEdges: {\n * targets: [interact.snappers.grid({ x: 100, y: 50 })],\n * },\n * })\n *\n * interact(target).resizable({\n * snapEdges: {\n * targets: [\n * interact.snappers.grid({\n * top: 50,\n * left: 50,\n * bottom: 100,\n * right: 100,\n * }),\n * ],\n * },\n * })\n * ```\n */\n\nimport clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\n\nimport type { ModifierArg, ModifierModule } from '../base'\nimport { makeModifier } from '../base'\n\nimport type { SnapOptions, SnapState } from './pointer'\nimport { snapSize } from './size'\n\nexport type SnapEdgesOptions = Pick\n\nfunction start (arg: ModifierArg) {\n const { edges } = arg\n\n if (!edges) {\n return null\n }\n\n arg.state.targetFields = arg.state.targetFields || [\n [edges.left ? 'left' : 'right', edges.top ? 'top' : 'bottom'],\n ]\n\n return snapSize.start(arg)\n}\n\nconst snapEdges: ModifierModule> = {\n start,\n set: snapSize.set,\n defaults: extend(clone(snapSize.defaults), {\n targets: null,\n range: null,\n offset: { x: 0, y: 0 },\n } as const),\n}\n\nexport default makeModifier(snapEdges, 'snapEdges')\nexport { snapEdges }\n", "/* eslint-disable n/no-extraneous-import, import/no-unresolved */\nimport aspectRatio from './aspectRatio'\nimport avoid from './avoid/avoid'\nimport restrictEdges from './restrict/edges'\nimport restrict from './restrict/pointer'\nimport restrictRect from './restrict/rect'\nimport restrictSize from './restrict/size'\nimport rubberband from './rubberband/rubberband'\nimport snapEdges from './snap/edges'\nimport snap from './snap/pointer'\nimport snapSize from './snap/size'\nimport spring from './spring/spring'\nimport transform from './transform/transform'\n\nexport default {\n aspectRatio,\n restrictEdges,\n restrict,\n restrictRect,\n restrictSize,\n snapEdges,\n snap,\n snapSize,\n\n spring,\n avoid,\n transform,\n rubberband,\n}\n", "import type { Plugin } from '@interactjs/core/scope'\nimport snappers from '@interactjs/snappers/plugin'\n\nimport all from './all'\nimport base from './base'\n\ndeclare module '@interactjs/core/InteractStatic' {\n export interface InteractStatic {\n modifiers: typeof all\n }\n}\n\nconst modifiers: Plugin = {\n id: 'modifiers',\n install (scope) {\n const { interactStatic: interact } = scope\n\n scope.usePlugin(base)\n scope.usePlugin(snappers)\n\n interact.modifiers = all\n\n // for backwrads compatibility\n for (const type in all) {\n const { _defaults, _methods } = all[type as keyof typeof all]\n\n ;(_defaults as any)._methods = _methods\n ;(scope.defaults.perAction as any)[type] = _defaults\n }\n },\n}\n\nexport default modifiers\n", "import { BaseEvent } from '@interactjs/core/BaseEvent'\nimport type Interaction from '@interactjs/core/Interaction'\nimport type { PointerEventType, PointerType, Point } from '@interactjs/core/types'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\n\nexport default class PointerEvent extends BaseEvent {\n declare type: T\n declare originalEvent: PointerEventType\n declare pointerId: number\n declare pointerType: string\n declare double: boolean\n declare pageX: number\n declare pageY: number\n declare clientX: number\n declare clientY: number\n declare dt: number\n declare eventable: any;\n [key: string]: any\n\n /** */\n constructor (\n type: T,\n pointer: PointerType | PointerEvent,\n event: PointerEventType,\n eventTarget: Node,\n interaction: Interaction,\n timeStamp: number,\n ) {\n super(interaction)\n pointerUtils.pointerExtend(this, event)\n\n if (event !== pointer) {\n pointerUtils.pointerExtend(this, pointer)\n }\n\n this.timeStamp = timeStamp\n this.originalEvent = event\n this.type = type\n this.pointerId = pointerUtils.getPointerId(pointer)\n this.pointerType = pointerUtils.getPointerType(pointer)\n this.target = eventTarget\n this.currentTarget = null\n\n if (type === 'tap') {\n const pointerIndex = interaction.getPointerIndex(pointer)\n this.dt = this.timeStamp - interaction.pointers[pointerIndex].downTime\n\n const interval = this.timeStamp - interaction.tapTime\n\n this.double =\n !!interaction.prevTap &&\n interaction.prevTap.type !== 'doubletap' &&\n interaction.prevTap.target === this.target &&\n interval < 500\n } else if (type === 'doubletap') {\n this.dt = (pointer as PointerEvent<'tap'>).timeStamp - interaction.tapTime\n this.double = true\n }\n }\n\n _subtractOrigin ({ x: originX, y: originY }: Point) {\n this.pageX -= originX\n this.pageY -= originY\n this.clientX -= originX\n this.clientY -= originY\n\n return this\n }\n\n _addOrigin ({ x: originX, y: originY }: Point) {\n this.pageX += originX\n this.pageY += originY\n this.clientX += originX\n this.clientY += originY\n\n return this\n }\n\n /**\n * Prevent the default behaviour of the original Event\n */\n preventDefault () {\n this.originalEvent.preventDefault()\n }\n}\n\nexport { PointerEvent }\n", "import type { Eventable } from '@interactjs/core/Eventable'\nimport type { Interaction } from '@interactjs/core/Interaction'\nimport type { PerActionDefaults } from '@interactjs/core/options'\nimport type { Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\nimport type { Point, PointerType, PointerEventType, Element } from '@interactjs/core/types'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\n\nimport { PointerEvent } from './PointerEvent'\n\nexport type EventTargetList = Array<{\n node: Node\n eventable: Eventable\n props: { [key: string]: any }\n}>\n\nexport interface PointerEventOptions extends PerActionDefaults {\n enabled?: undefined // not used\n holdDuration?: number\n ignoreFrom?: any\n allowFrom?: any\n origin?: Point | string | Element\n}\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n pointerEvents: typeof pointerEvents\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n prevTap?: PointerEvent\n tapTime?: number\n }\n}\n\ndeclare module '@interactjs/core/PointerInfo' {\n interface PointerInfo {\n hold?: {\n duration: number\n timeout: any\n }\n }\n}\n\ndeclare module '@interactjs/core/options' {\n interface ActionDefaults {\n pointerEvents: Options\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'pointerEvents:new': { pointerEvent: PointerEvent }\n 'pointerEvents:fired': {\n interaction: Interaction\n pointer: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n pointerEvent: PointerEvent\n targets?: EventTargetList\n type: string\n }\n 'pointerEvents:collect-targets': {\n interaction: Interaction\n pointer: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n targets?: EventTargetList\n type: string\n path: Node[]\n node: null\n }\n }\n}\n\nconst defaults: PointerEventOptions = {\n holdDuration: 600,\n ignoreFrom: null,\n allowFrom: null,\n origin: { x: 0, y: 0 },\n}\n\nconst pointerEvents: Plugin = {\n id: 'pointer-events/base',\n before: ['inertia', 'modifiers', 'auto-start', 'actions'],\n install,\n listeners: {\n 'interactions:new': addInteractionProps,\n 'interactions:update-pointer': addHoldInfo,\n 'interactions:move': moveAndClearHold,\n 'interactions:down': (arg, scope) => {\n downAndStartHold(arg, scope)\n fire(arg, scope)\n },\n 'interactions:up': (arg, scope) => {\n clearHold(arg)\n fire(arg, scope)\n tapAfterUp(arg, scope)\n },\n 'interactions:cancel': (arg, scope) => {\n clearHold(arg)\n fire(arg, scope)\n },\n },\n PointerEvent,\n fire,\n collectEventTargets,\n defaults,\n types: {\n down: true,\n move: true,\n up: true,\n cancel: true,\n tap: true,\n doubletap: true,\n hold: true,\n } as { [type: string]: true },\n}\n\nfunction fire (\n arg: {\n pointer: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n interaction: Interaction\n type: T\n targets?: EventTargetList\n },\n scope: Scope,\n) {\n const { interaction, pointer, event, eventTarget, type, targets = collectEventTargets(arg, scope) } = arg\n\n const pointerEvent = new PointerEvent(type, pointer, event, eventTarget, interaction, scope.now())\n\n scope.fire('pointerEvents:new', { pointerEvent })\n\n const signalArg = {\n interaction,\n pointer,\n event,\n eventTarget,\n targets,\n type,\n pointerEvent,\n }\n\n for (let i = 0; i < targets.length; i++) {\n const target = targets[i]\n\n for (const prop in target.props || {}) {\n ;(pointerEvent as any)[prop] = target.props[prop]\n }\n\n const origin = getOriginXY(target.eventable, target.node)\n\n pointerEvent._subtractOrigin(origin)\n pointerEvent.eventable = target.eventable\n pointerEvent.currentTarget = target.node\n\n target.eventable.fire(pointerEvent)\n\n pointerEvent._addOrigin(origin)\n\n if (\n pointerEvent.immediatePropagationStopped ||\n (pointerEvent.propagationStopped &&\n i + 1 < targets.length &&\n targets[i + 1].node !== pointerEvent.currentTarget)\n ) {\n break\n }\n }\n\n scope.fire('pointerEvents:fired', signalArg)\n\n if (type === 'tap') {\n // if pointerEvent should make a double tap, create and fire a doubletap\n // PointerEvent and use that as the prevTap\n const prevTap = pointerEvent.double\n ? fire(\n {\n interaction,\n pointer,\n event,\n eventTarget,\n type: 'doubletap',\n },\n scope,\n )\n : pointerEvent\n\n interaction.prevTap = prevTap\n interaction.tapTime = prevTap.timeStamp\n }\n\n return pointerEvent\n}\n\nfunction collectEventTargets (\n {\n interaction,\n pointer,\n event,\n eventTarget,\n type,\n }: {\n interaction: Interaction\n pointer: PointerType | PointerEvent\n event: PointerEventType | PointerEvent\n eventTarget: Node\n type: T\n },\n scope: Scope,\n) {\n const pointerIndex = interaction.getPointerIndex(pointer)\n const pointerInfo = interaction.pointers[pointerIndex]\n\n // do not fire a tap event if the pointer was moved before being lifted\n if (\n type === 'tap' &&\n (interaction.pointerWasMoved ||\n // or if the pointerup target is different to the pointerdown target\n !(pointerInfo && pointerInfo.downTarget === eventTarget))\n ) {\n return []\n }\n\n const path = domUtils.getPath(eventTarget as Element | Document)\n const signalArg = {\n interaction,\n pointer,\n event,\n eventTarget,\n type,\n path,\n targets: [] as EventTargetList,\n node: null,\n }\n\n for (const node of path) {\n signalArg.node = node\n\n scope.fire('pointerEvents:collect-targets', signalArg)\n }\n\n if (type === 'hold') {\n signalArg.targets = signalArg.targets.filter(\n (target) => target.eventable.options.holdDuration === interaction.pointers[pointerIndex]?.hold.duration,\n )\n }\n\n return signalArg.targets\n}\n\nfunction addInteractionProps ({ interaction }) {\n interaction.prevTap = null // the most recent tap event on this interaction\n interaction.tapTime = 0 // time of the most recent tap event\n}\n\nfunction addHoldInfo ({ down, pointerInfo }: SignalArgs['interactions:update-pointer']) {\n if (!down && pointerInfo.hold) {\n return\n }\n\n pointerInfo.hold = { duration: Infinity, timeout: null }\n}\n\nfunction clearHold ({ interaction, pointerIndex }) {\n const hold = interaction.pointers[pointerIndex].hold\n\n if (hold && hold.timeout) {\n clearTimeout(hold.timeout)\n hold.timeout = null\n }\n}\n\nfunction moveAndClearHold (arg: SignalArgs['interactions:move'], scope: Scope) {\n const { interaction, pointer, event, eventTarget, duplicate } = arg\n\n if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) {\n if (interaction.pointerIsDown) {\n clearHold(arg)\n }\n\n fire(\n {\n interaction,\n pointer,\n event,\n eventTarget: eventTarget as Element,\n type: 'move',\n },\n scope,\n )\n }\n}\n\nfunction downAndStartHold (\n { interaction, pointer, event, eventTarget, pointerIndex }: SignalArgs['interactions:down'],\n scope: Scope,\n) {\n const timer = interaction.pointers[pointerIndex].hold\n const path = domUtils.getPath(eventTarget as Element | Document)\n const signalArg = {\n interaction,\n pointer,\n event,\n eventTarget,\n type: 'hold',\n targets: [] as EventTargetList,\n path,\n node: null,\n }\n\n for (const node of path) {\n signalArg.node = node\n\n scope.fire('pointerEvents:collect-targets', signalArg)\n }\n\n if (!signalArg.targets.length) return\n\n let minDuration = Infinity\n\n for (const target of signalArg.targets) {\n const holdDuration = target.eventable.options.holdDuration\n\n if (holdDuration < minDuration) {\n minDuration = holdDuration\n }\n }\n\n timer.duration = minDuration\n timer.timeout = setTimeout(() => {\n fire(\n {\n interaction,\n eventTarget,\n pointer,\n event,\n type: 'hold',\n },\n scope,\n )\n }, minDuration)\n}\n\nfunction tapAfterUp (\n { interaction, pointer, event, eventTarget }: SignalArgs['interactions:up'],\n scope: Scope,\n) {\n if (!interaction.pointerWasMoved) {\n fire({ interaction, eventTarget, pointer, event, type: 'tap' }, scope)\n }\n}\n\nfunction install (scope: Scope) {\n scope.pointerEvents = pointerEvents\n scope.defaults.actions.pointerEvents = pointerEvents.defaults\n extend(scope.actions.phaselessTypes, pointerEvents.types)\n}\n\nexport default pointerEvents\n", "import type Interaction from '@interactjs/core/Interaction'\nimport type { ListenerMap, Scope, SignalArgs, Plugin } from '@interactjs/core/scope'\n\nimport type PointerEvent from './PointerEvent'\nimport basePlugin from './base'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n holdIntervalHandle?: any\n }\n}\n\ndeclare module '@interactjs/pointer-events/PointerEvent' {\n interface PointerEvent {\n count?: number\n }\n}\n\ndeclare module '@interactjs/pointer-events/base' {\n interface PointerEventOptions {\n holdRepeatInterval?: number\n }\n}\n\nfunction install (scope: Scope) {\n scope.usePlugin(basePlugin)\n\n const { pointerEvents } = scope\n\n // don't repeat by default\n pointerEvents.defaults.holdRepeatInterval = 0\n pointerEvents.types.holdrepeat = scope.actions.phaselessTypes.holdrepeat = true\n}\n\nfunction onNew ({ pointerEvent }: { pointerEvent: PointerEvent }) {\n if (pointerEvent.type !== 'hold') return\n\n pointerEvent.count = (pointerEvent.count || 0) + 1\n}\n\nfunction onFired (\n { interaction, pointerEvent, eventTarget, targets }: SignalArgs['pointerEvents:fired'],\n scope: Scope,\n) {\n if (pointerEvent.type !== 'hold' || !targets.length) return\n\n // get the repeat interval from the first eventable\n const interval = targets[0].eventable.options.holdRepeatInterval\n\n // don't repeat if the interval is 0 or less\n if (interval <= 0) return\n\n // set a timeout to fire the holdrepeat event\n interaction.holdIntervalHandle = setTimeout(() => {\n scope.pointerEvents.fire(\n {\n interaction,\n eventTarget,\n type: 'hold',\n pointer: pointerEvent,\n event: pointerEvent,\n },\n scope,\n )\n }, interval)\n}\n\nfunction endHoldRepeat ({ interaction }: { interaction: Interaction }) {\n // set the interaction's holdStopTime property\n // to stop further holdRepeat events\n if (interaction.holdIntervalHandle) {\n clearInterval(interaction.holdIntervalHandle)\n interaction.holdIntervalHandle = null\n }\n}\n\nconst holdRepeat: Plugin = {\n id: 'pointer-events/holdRepeat',\n install,\n listeners: ['move', 'up', 'cancel', 'endall'].reduce(\n (acc, enderTypes) => {\n ;(acc as any)[`pointerEvents:${enderTypes}`] = endHoldRepeat\n return acc\n },\n {\n 'pointerEvents:new': onNew,\n 'pointerEvents:fired': onFired,\n } as ListenerMap,\n ),\n}\n\nexport default holdRepeat\n", "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { Element } from '@interactjs/core/types'\nimport extend from '@interactjs/utils/extend'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n pointerEvents: typeof pointerEventsMethod\n __backCompatOption: (optionName: string, newValue: any) => any\n }\n}\n\nfunction install (scope: Scope) {\n const { Interactable } = scope\n\n Interactable.prototype.pointerEvents = pointerEventsMethod\n\n const __backCompatOption = Interactable.prototype._backCompatOption\n\n Interactable.prototype._backCompatOption = function (optionName, newValue) {\n const ret = __backCompatOption.call(this, optionName, newValue)\n\n if (ret === this) {\n this.events.options[optionName] = newValue\n }\n\n return ret\n }\n}\n\nfunction pointerEventsMethod (this: Interactable, options: any) {\n extend(this.events.options, options)\n\n return this\n}\n\nconst plugin: Plugin = {\n id: 'pointer-events/interactableTargets',\n install,\n listeners: {\n 'pointerEvents:collect-targets': ({ targets, node, type, eventTarget }, scope) => {\n scope.interactables.forEachMatch(node, (interactable: Interactable) => {\n const eventable = interactable.events\n const options = eventable.options\n\n if (\n eventable.types[type] &&\n eventable.types[type].length &&\n interactable.testIgnoreAllow(options, node, eventTarget)\n ) {\n targets.push({\n node,\n eventable,\n props: { interactable },\n })\n }\n })\n },\n\n 'interactable:new': ({ interactable }) => {\n interactable.events.getRect = function (element: Element) {\n return interactable.getRect(element)\n }\n },\n\n 'interactable:set': ({ interactable, options }, scope) => {\n extend(interactable.events.options, scope.pointerEvents.defaults)\n extend(interactable.events.options, options.pointerEvents || {})\n },\n },\n}\n\nexport default plugin\n", "import type { Plugin } from '@interactjs/core/scope'\n\nimport * as pointerEvents from './base'\nimport holdRepeat from './holdRepeat'\nimport interactableTargets from './interactableTargets'\n\nconst plugin: Plugin = {\n id: 'pointer-events',\n install (scope) {\n scope.usePlugin(pointerEvents)\n scope.usePlugin(holdRepeat)\n scope.usePlugin(interactableTargets)\n },\n}\n\nexport default plugin\n", "import type { Interactable } from '@interactjs/core/Interactable'\nimport type { DoAnyPhaseArg, Interaction } from '@interactjs/core/Interaction'\nimport type { Scope, Plugin } from '@interactjs/core/scope'\nimport type { ActionName, ActionProps, Element } from '@interactjs/core/types'\nimport * as arr from '@interactjs/utils/arr'\nimport is from '@interactjs/utils/is'\nimport { copyAction } from '@interactjs/utils/misc'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport { tlbrToXywh } from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:before-action-reflow': Omit\n 'interactions:action-reflow': DoAnyPhaseArg\n 'interactions:after-action-reflow': DoAnyPhaseArg\n }\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n reflow: (action: ActionProps) => ReturnType\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n _reflowPromise: Promise\n _reflowResolve: (...args: unknown[]) => void\n }\n}\n\ndeclare module '@interactjs/core/InteractEvent' {\n interface PhaseMap {\n reflow?: true\n }\n}\n\nexport function install (scope: Scope) {\n const {\n /** @lends Interactable */\n Interactable,\n } = scope\n\n scope.actions.phases.reflow = true\n\n /**\n * ```js\n * const interactable = interact(target)\n * const drag = { name: drag, axis: 'x' }\n * const resize = { name: resize, edges: { left: true, bottom: true }\n *\n * interactable.reflow(drag)\n * interactable.reflow(resize)\n * ```\n *\n * Start an action sequence to re-apply modifiers, check drops, etc.\n *\n * @param { Object } action The action to begin\n * @param { string } action.name The name of the action\n * @returns { Promise } A promise that resolves to the `Interactable` when actions on all targets have ended\n */\n Interactable.prototype.reflow = function (action: ActionProps) {\n return doReflow(this, action, scope)\n }\n}\n\nfunction doReflow (\n interactable: Interactable,\n action: ActionProps,\n scope: Scope,\n): Promise {\n const elements = (\n is.string(interactable.target)\n ? arr.from(interactable._context.querySelectorAll(interactable.target))\n : [interactable.target]\n ) as Element[]\n\n // tslint:disable-next-line variable-name\n const Promise = (scope.window as any).Promise\n const promises: Array> | null = Promise ? [] : null\n\n for (const element of elements) {\n const rect = interactable.getRect(element as HTMLElement | SVGElement)\n\n if (!rect) {\n break\n }\n\n const runningInteraction = arr.find(scope.interactions.list, (interaction: Interaction) => {\n return (\n interaction.interacting() &&\n interaction.interactable === interactable &&\n interaction.element === element &&\n interaction.prepared.name === action.name\n )\n })\n let reflowPromise: Promise\n\n if (runningInteraction) {\n runningInteraction.move()\n\n if (promises) {\n reflowPromise =\n runningInteraction._reflowPromise ||\n new Promise((resolve: any) => {\n runningInteraction._reflowResolve = resolve\n })\n }\n } else {\n const xywh = tlbrToXywh(rect)\n const coords = {\n page: { x: xywh.x, y: xywh.y },\n client: { x: xywh.x, y: xywh.y },\n timeStamp: scope.now(),\n }\n\n const event = pointerUtils.coordsToEvent(coords)\n reflowPromise = startReflow(scope, interactable, element, action, event)\n }\n\n if (promises) {\n promises.push(reflowPromise)\n }\n }\n\n return promises && Promise.all(promises).then(() => interactable)\n}\n\nfunction startReflow (\n scope: Scope,\n interactable: Interactable,\n element: Element,\n action: ActionProps,\n event: any,\n) {\n const interaction = scope.interactions.new({ pointerType: 'reflow' })\n const signalArg = {\n interaction,\n event,\n pointer: event,\n eventTarget: element,\n phase: 'reflow',\n } as const\n\n interaction.interactable = interactable\n interaction.element = element\n interaction.prevEvent = event\n interaction.updatePointer(event, event, element, true)\n pointerUtils.setZeroCoords(interaction.coords.delta)\n\n copyAction(interaction.prepared, action)\n interaction._doPhase(signalArg)\n\n const { Promise } = scope.window as unknown as { Promise: PromiseConstructor }\n const reflowPromise = Promise\n ? new Promise((resolve) => {\n interaction._reflowResolve = resolve\n })\n : undefined\n\n interaction._reflowPromise = reflowPromise\n interaction.start(action, interactable, element)\n\n if (interaction._interacting) {\n interaction.move(signalArg)\n interaction.end(event)\n } else {\n interaction.stop()\n interaction._reflowResolve()\n }\n\n interaction.removePointer(event, event)\n\n return reflowPromise\n}\n\nconst reflow: Plugin = {\n id: 'reflow',\n install,\n listeners: {\n // remove completed reflow interactions\n 'interactions:stop': ({ interaction }, scope) => {\n if (interaction.pointerType === 'reflow') {\n if (interaction._reflowResolve) {\n interaction._reflowResolve()\n }\n\n arr.remove(scope.interactions.list, interaction)\n }\n },\n },\n}\n\nexport default reflow\n", "import actions from '@interactjs/actions/plugin'\nimport autoScroll from '@interactjs/auto-scroll/plugin'\nimport autoStart from '@interactjs/auto-start/plugin'\nimport interactablePreventDefault from '@interactjs/core/interactablePreventDefault'\nimport devTools from '@interactjs/dev-tools/plugin'\nimport inertia from '@interactjs/inertia/plugin'\nimport interact from '@interactjs/interact'\nimport modifiers from '@interactjs/modifiers/plugin'\nimport offset from '@interactjs/offset/plugin'\nimport pointerEvents from '@interactjs/pointer-events/plugin'\nimport reflow from '@interactjs/reflow/plugin'\n\ninteract.use(interactablePreventDefault)\n\ninteract.use(offset)\n\n// pointerEvents\ninteract.use(pointerEvents)\n\n// inertia\ninteract.use(inertia)\n\n// snap, resize, etc.\ninteract.use(modifiers)\n\n// autoStart, hold\ninteract.use(autoStart)\n\n// drag and drop, resize, gesture\ninteract.use(actions)\n\n// autoScroll\ninteract.use(autoScroll)\n\n// reflow\ninteract.use(reflow)\n\n// eslint-disable-next-line no-undef\nif (process.env.NODE_ENV !== 'production') {\n interact.use(devTools)\n}\n\nexport default interact\n\nif (typeof module === 'object' && !!module) {\n try {\n module.exports = interact\n } catch {}\n}\n\n;(interact as any).default = interact\n", "// eslint-disable-next-line import/no-extraneous-dependencies\nimport interact from '@interactjs/interactjs/index'\n\nexport default interact\n\nif (typeof module === 'object' && !!module) {\n try {\n module.exports = interact\n } catch {}\n}\n\n;(interact as any).default = interact\n", "\nreturn _$index_80;\n\n});\n", "!(function(win) {\n\n/**\n * FastDom\n *\n * Eliminates layout thrashing\n * by batching DOM read/write\n * interactions.\n *\n * @author Wilson Page \n * @author Kornel Lesinski \n */\n\n'use strict';\n\n/**\n * Mini logger\n *\n * @return {Function}\n */\nvar debug = 0 ? console.log.bind(console, '[fastdom]') : function() {};\n\n/**\n * Normalized rAF\n *\n * @type {Function}\n */\nvar raf = win.requestAnimationFrame\n || win.webkitRequestAnimationFrame\n || win.mozRequestAnimationFrame\n || win.msRequestAnimationFrame\n || function(cb) { return setTimeout(cb, 16); };\n\n/**\n * Initialize a `FastDom`.\n *\n * @constructor\n */\nfunction FastDom() {\n var self = this;\n self.reads = [];\n self.writes = [];\n self.raf = raf.bind(win); // test hook\n debug('initialized', self);\n}\n\nFastDom.prototype = {\n constructor: FastDom,\n\n /**\n * We run this inside a try catch\n * so that if any jobs error, we\n * are able to recover and continue\n * to flush the batch until it's empty.\n *\n * @param {Array} tasks\n */\n runTasks: function(tasks) {\n debug('run tasks');\n var task; while (task = tasks.shift()) task();\n },\n\n /**\n * Adds a job to the read batch and\n * schedules a new frame if need be.\n *\n * @param {Function} fn\n * @param {Object} ctx the context to be bound to `fn` (optional).\n * @public\n */\n measure: function(fn, ctx) {\n debug('measure');\n var task = !ctx ? fn : fn.bind(ctx);\n this.reads.push(task);\n scheduleFlush(this);\n return task;\n },\n\n /**\n * Adds a job to the\n * write batch and schedules\n * a new frame if need be.\n *\n * @param {Function} fn\n * @param {Object} ctx the context to be bound to `fn` (optional).\n * @public\n */\n mutate: function(fn, ctx) {\n debug('mutate');\n var task = !ctx ? fn : fn.bind(ctx);\n this.writes.push(task);\n scheduleFlush(this);\n return task;\n },\n\n /**\n * Clears a scheduled 'read' or 'write' task.\n *\n * @param {Object} task\n * @return {Boolean} success\n * @public\n */\n clear: function(task) {\n debug('clear', task);\n return remove(this.reads, task) || remove(this.writes, task);\n },\n\n /**\n * Extend this FastDom with some\n * custom functionality.\n *\n * Because fastdom must *always* be a\n * singleton, we're actually extending\n * the fastdom instance. This means tasks\n * scheduled by an extension still enter\n * fastdom's global task queue.\n *\n * The 'super' instance can be accessed\n * from `this.fastdom`.\n *\n * @example\n *\n * var myFastdom = fastdom.extend({\n * initialize: function() {\n * // runs on creation\n * },\n *\n * // override a method\n * measure: function(fn) {\n * // do extra stuff ...\n *\n * // then call the original\n * return this.fastdom.measure(fn);\n * },\n *\n * ...\n * });\n *\n * @param {Object} props properties to mixin\n * @return {FastDom}\n */\n extend: function(props) {\n debug('extend', props);\n if (typeof props != 'object') throw new Error('expected object');\n\n var child = Object.create(this);\n mixin(child, props);\n child.fastdom = this;\n\n // run optional creation hook\n if (child.initialize) child.initialize();\n\n return child;\n },\n\n // override this with a function\n // to prevent Errors in console\n // when tasks throw\n catch: null\n};\n\n/**\n * Schedules a new read/write\n * batch if one isn't pending.\n *\n * @private\n */\nfunction scheduleFlush(fastdom) {\n if (!fastdom.scheduled) {\n fastdom.scheduled = true;\n fastdom.raf(flush.bind(null, fastdom));\n debug('flush scheduled');\n }\n}\n\n/**\n * Runs queued `read` and `write` tasks.\n *\n * Errors are caught and thrown by default.\n * If a `.catch` function has been defined\n * it is called instead.\n *\n * @private\n */\nfunction flush(fastdom) {\n debug('flush');\n\n var writes = fastdom.writes;\n var reads = fastdom.reads;\n var error;\n\n try {\n debug('flushing reads', reads.length);\n fastdom.runTasks(reads);\n debug('flushing writes', writes.length);\n fastdom.runTasks(writes);\n } catch (e) { error = e; }\n\n fastdom.scheduled = false;\n\n // If the batch errored we may still have tasks queued\n if (reads.length || writes.length) scheduleFlush(fastdom);\n\n if (error) {\n debug('task errored', error.message);\n if (fastdom.catch) fastdom.catch(error);\n else throw error;\n }\n}\n\n/**\n * Remove an item from an Array.\n *\n * @param {Array} array\n * @param {*} item\n * @return {Boolean}\n */\nfunction remove(array, item) {\n var index = array.indexOf(item);\n return !!~index && !!array.splice(index, 1);\n}\n\n/**\n * Mixin own properties of source\n * object into the target.\n *\n * @param {Object} target\n * @param {Object} source\n */\nfunction mixin(target, source) {\n for (var key in source) {\n if (source.hasOwnProperty(key)) target[key] = source[key];\n }\n}\n\n// There should never be more than\n// one instance of `FastDom` in an app\nvar exports = win.fastdom = (win.fastdom || new FastDom()); // jshint ignore:line\n\n// Expose to CJS & AMD\nif ((typeof define) == 'function') define(function() { return exports; });\nelse if ((typeof module) == 'object') module.exports = exports;\n\n})( typeof window !== 'undefined' ? window : this);\n", "/**\n * @license Complex.js v2.1.1 12/05/2020\n *\n * Copyright (c) 2020, Robert Eisele (robert@xarg.org)\n * Dual licensed under the MIT or GPL Version 2 licenses.\n **/\n\n/**\n *\n * This class allows the manipulation of complex numbers.\n * You can pass a complex number in different formats. Either as object, double, string or two integer parameters.\n *\n * Object form\n * { re: , im: }\n * { arg: , abs: }\n * { phi: , r: }\n *\n * Array / Vector form\n * [ real, imaginary ]\n *\n * Double form\n * 99.3 - Single double value\n *\n * String form\n * '23.1337' - Simple real number\n * '15+3i' - a simple complex number\n * '3-i' - a simple complex number\n *\n * Example:\n *\n * var c = new Complex('99.3+8i');\n * c.mul({r: 3, i: 9}).div(4.9).sub(3, 2);\n *\n */\n\n(function(root) {\n\n 'use strict';\n\n var cosh = Math.cosh || function(x) {\n return Math.abs(x) < 1e-9 ? 1 - x : (Math.exp(x) + Math.exp(-x)) * 0.5;\n };\n\n var sinh = Math.sinh || function(x) {\n return Math.abs(x) < 1e-9 ? x : (Math.exp(x) - Math.exp(-x)) * 0.5;\n };\n\n /**\n * Calculates cos(x) - 1 using Taylor series if x is small (-\u00BC\u03C0 \u2264 x \u2264 \u00BC\u03C0).\n *\n * @param {number} x\n * @returns {number} cos(x) - 1\n */\n var cosm1 = function(x) {\n\n var b = Math.PI / 4;\n if (-b > x || x > b) {\n return Math.cos(x) - 1.0;\n }\n\n /* Calculate horner form of polynomial of taylor series in Q\n var fac = 1, alt = 1, pol = {};\n for (var i = 0; i <= 16; i++) {\n fac*= i || 1;\n if (i % 2 == 0) {\n pol[i] = new Fraction(1, alt * fac);\n alt = -alt;\n }\n }\n console.log(new Polynomial(pol).toHorner()); // (((((((1/20922789888000x^2-1/87178291200)x^2+1/479001600)x^2-1/3628800)x^2+1/40320)x^2-1/720)x^2+1/24)x^2-1/2)x^2+1\n */\n\n var xx = x * x;\n return xx * (\n xx * (\n xx * (\n xx * (\n xx * (\n xx * (\n xx * (\n xx / 20922789888000\n - 1 / 87178291200)\n + 1 / 479001600)\n - 1 / 3628800)\n + 1 / 40320)\n - 1 / 720)\n + 1 / 24)\n - 1 / 2);\n };\n\n var hypot = function(x, y) {\n\n var a = Math.abs(x);\n var b = Math.abs(y);\n\n if (a < 3000 && b < 3000) {\n return Math.sqrt(a * a + b * b);\n }\n\n if (a < b) {\n a = b;\n b = x / y;\n } else {\n b = y / x;\n }\n return a * Math.sqrt(1 + b * b);\n };\n\n var parser_exit = function() {\n throw SyntaxError('Invalid Param');\n };\n\n /**\n * Calculates log(sqrt(a^2+b^2)) in a way to avoid overflows\n *\n * @param {number} a\n * @param {number} b\n * @returns {number}\n */\n function logHypot(a, b) {\n\n var _a = Math.abs(a);\n var _b = Math.abs(b);\n\n if (a === 0) {\n return Math.log(_b);\n }\n\n if (b === 0) {\n return Math.log(_a);\n }\n\n if (_a < 3000 && _b < 3000) {\n return Math.log(a * a + b * b) * 0.5;\n }\n\n /* I got 4 ideas to compute this property without overflow:\n *\n * Testing 1000000 times with random samples for a,b \u2208 [1, 1000000000] against a big decimal library to get an error estimate\n *\n * 1. Only eliminate the square root: (OVERALL ERROR: 3.9122483030951116e-11)\n\n Math.log(a * a + b * b) / 2\n\n *\n *\n * 2. Try to use the non-overflowing pythagoras: (OVERALL ERROR: 8.889760039210159e-10)\n\n var fn = function(a, b) {\n a = Math.abs(a);\n b = Math.abs(b);\n var t = Math.min(a, b);\n a = Math.max(a, b);\n t = t / a;\n\n return Math.log(a) + Math.log(1 + t * t) / 2;\n };\n\n * 3. Abuse the identity cos(atan(y/x) = x / sqrt(x^2+y^2): (OVERALL ERROR: 3.4780178737037204e-10)\n\n Math.log(a / Math.cos(Math.atan2(b, a)))\n\n * 4. Use 3. and apply log rules: (OVERALL ERROR: 1.2014087502620896e-9)\n\n Math.log(a) - Math.log(Math.cos(Math.atan2(b, a)))\n\n */\n\n a = a / 2;\n b = b / 2;\n\n return 0.5 * Math.log(a * a + b * b) + Math.LN2;\n }\n\n var parse = function(a, b) {\n\n var z = { 're': 0, 'im': 0 };\n\n if (a === undefined || a === null) {\n z['re'] =\n z['im'] = 0;\n } else if (b !== undefined) {\n z['re'] = a;\n z['im'] = b;\n } else\n switch (typeof a) {\n\n case 'object':\n\n if ('im' in a && 're' in a) {\n z['re'] = a['re'];\n z['im'] = a['im'];\n } else if ('abs' in a && 'arg' in a) {\n if (!Number.isFinite(a['abs']) && Number.isFinite(a['arg'])) {\n return Complex['INFINITY'];\n }\n z['re'] = a['abs'] * Math.cos(a['arg']);\n z['im'] = a['abs'] * Math.sin(a['arg']);\n } else if ('r' in a && 'phi' in a) {\n if (!Number.isFinite(a['r']) && Number.isFinite(a['phi'])) {\n return Complex['INFINITY'];\n }\n z['re'] = a['r'] * Math.cos(a['phi']);\n z['im'] = a['r'] * Math.sin(a['phi']);\n } else if (a.length === 2) { // Quick array check\n z['re'] = a[0];\n z['im'] = a[1];\n } else {\n parser_exit();\n }\n break;\n\n case 'string':\n\n z['im'] = /* void */\n z['re'] = 0;\n\n var tokens = a.match(/\\d+\\.?\\d*e[+-]?\\d+|\\d+\\.?\\d*|\\.\\d+|./g);\n var plus = 1;\n var minus = 0;\n\n if (tokens === null) {\n parser_exit();\n }\n\n for (var i = 0; i < tokens.length; i++) {\n\n var c = tokens[i];\n\n if (c === ' ' || c === '\\t' || c === '\\n') {\n /* void */\n } else if (c === '+') {\n plus++;\n } else if (c === '-') {\n minus++;\n } else if (c === 'i' || c === 'I') {\n\n if (plus + minus === 0) {\n parser_exit();\n }\n\n if (tokens[i + 1] !== ' ' && !isNaN(tokens[i + 1])) {\n z['im'] += parseFloat((minus % 2 ? '-' : '') + tokens[i + 1]);\n i++;\n } else {\n z['im'] += parseFloat((minus % 2 ? '-' : '') + '1');\n }\n plus = minus = 0;\n\n } else {\n\n if (plus + minus === 0 || isNaN(c)) {\n parser_exit();\n }\n\n if (tokens[i + 1] === 'i' || tokens[i + 1] === 'I') {\n z['im'] += parseFloat((minus % 2 ? '-' : '') + c);\n i++;\n } else {\n z['re'] += parseFloat((minus % 2 ? '-' : '') + c);\n }\n plus = minus = 0;\n }\n }\n\n // Still something on the stack\n if (plus + minus > 0) {\n parser_exit();\n }\n break;\n\n case 'number':\n z['im'] = 0;\n z['re'] = a;\n break;\n\n default:\n parser_exit();\n }\n\n if (isNaN(z['re']) || isNaN(z['im'])) {\n // If a calculation is NaN, we treat it as NaN and don't throw\n //parser_exit();\n }\n\n return z;\n };\n\n /**\n * @constructor\n * @returns {Complex}\n */\n function Complex(a, b) {\n\n if (!(this instanceof Complex)) {\n return new Complex(a, b);\n }\n\n var z = parse(a, b);\n\n this['re'] = z['re'];\n this['im'] = z['im'];\n }\n\n Complex.prototype = {\n\n 're': 0,\n 'im': 0,\n\n /**\n * Calculates the sign of a complex number, which is a normalized complex\n *\n * @returns {Complex}\n */\n 'sign': function() {\n\n var abs = this['abs']();\n\n return new Complex(\n this['re'] / abs,\n this['im'] / abs);\n },\n\n /**\n * Adds two complex numbers\n *\n * @returns {Complex}\n */\n 'add': function(a, b) {\n\n var z = new Complex(a, b);\n\n // Infinity + Infinity = NaN\n if (this['isInfinite']() && z['isInfinite']()) {\n return Complex['NAN'];\n }\n\n // Infinity + z = Infinity { where z != Infinity }\n if (this['isInfinite']() || z['isInfinite']()) {\n return Complex['INFINITY'];\n }\n\n return new Complex(\n this['re'] + z['re'],\n this['im'] + z['im']);\n },\n\n /**\n * Subtracts two complex numbers\n *\n * @returns {Complex}\n */\n 'sub': function(a, b) {\n\n var z = new Complex(a, b);\n\n // Infinity - Infinity = NaN\n if (this['isInfinite']() && z['isInfinite']()) {\n return Complex['NAN'];\n }\n\n // Infinity - z = Infinity { where z != Infinity }\n if (this['isInfinite']() || z['isInfinite']()) {\n return Complex['INFINITY'];\n }\n\n return new Complex(\n this['re'] - z['re'],\n this['im'] - z['im']);\n },\n\n /**\n * Multiplies two complex numbers\n *\n * @returns {Complex}\n */\n 'mul': function(a, b) {\n\n var z = new Complex(a, b);\n\n // Infinity * 0 = NaN\n if ((this['isInfinite']() && z['isZero']()) || (this['isZero']() && z['isInfinite']())) {\n return Complex['NAN'];\n }\n\n // Infinity * z = Infinity { where z != 0 }\n if (this['isInfinite']() || z['isInfinite']()) {\n return Complex['INFINITY'];\n }\n\n // Short circuit for real values\n if (z['im'] === 0 && this['im'] === 0) {\n return new Complex(this['re'] * z['re'], 0);\n }\n\n return new Complex(\n this['re'] * z['re'] - this['im'] * z['im'],\n this['re'] * z['im'] + this['im'] * z['re']);\n },\n\n /**\n * Divides two complex numbers\n *\n * @returns {Complex}\n */\n 'div': function(a, b) {\n\n var z = new Complex(a, b);\n\n // 0 / 0 = NaN and Infinity / Infinity = NaN\n if ((this['isZero']() && z['isZero']()) || (this['isInfinite']() && z['isInfinite']())) {\n return Complex['NAN'];\n }\n\n // Infinity / 0 = Infinity\n if (this['isInfinite']() || z['isZero']()) {\n return Complex['INFINITY'];\n }\n\n // 0 / Infinity = 0\n if (this['isZero']() || z['isInfinite']()) {\n return Complex['ZERO'];\n }\n\n a = this['re'];\n b = this['im'];\n\n var c = z['re'];\n var d = z['im'];\n var t, x;\n\n if (0 === d) {\n // Divisor is real\n return new Complex(a / c, b / c);\n }\n\n if (Math.abs(c) < Math.abs(d)) {\n\n x = c / d;\n t = c * x + d;\n\n return new Complex(\n (a * x + b) / t,\n (b * x - a) / t);\n\n } else {\n\n x = d / c;\n t = d * x + c;\n\n return new Complex(\n (a + b * x) / t,\n (b - a * x) / t);\n }\n },\n\n /**\n * Calculate the power of two complex numbers\n *\n * @returns {Complex}\n */\n 'pow': function(a, b) {\n\n var z = new Complex(a, b);\n\n a = this['re'];\n b = this['im'];\n\n if (z['isZero']()) {\n return Complex['ONE'];\n }\n\n // If the exponent is real\n if (z['im'] === 0) {\n\n if (b === 0 && a > 0) {\n\n return new Complex(Math.pow(a, z['re']), 0);\n\n } else if (a === 0) { // If base is fully imaginary\n\n switch ((z['re'] % 4 + 4) % 4) {\n case 0:\n return new Complex(Math.pow(b, z['re']), 0);\n case 1:\n return new Complex(0, Math.pow(b, z['re']));\n case 2:\n return new Complex(-Math.pow(b, z['re']), 0);\n case 3:\n return new Complex(0, -Math.pow(b, z['re']));\n }\n }\n }\n\n /* I couldn't find a good formula, so here is a derivation and optimization\n *\n * z_1^z_2 = (a + bi)^(c + di)\n * = exp((c + di) * log(a + bi)\n * = pow(a^2 + b^2, (c + di) / 2) * exp(i(c + di)atan2(b, a))\n * =>...\n * Re = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * cos(d * log(a^2 + b^2) / 2 + c * atan2(b, a))\n * Im = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * sin(d * log(a^2 + b^2) / 2 + c * atan2(b, a))\n *\n * =>...\n * Re = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * cos(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a))\n * Im = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * sin(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a))\n *\n * =>\n * Re = exp(c * logsq2 - d * arg(z_1)) * cos(d * logsq2 + c * arg(z_1))\n * Im = exp(c * logsq2 - d * arg(z_1)) * sin(d * logsq2 + c * arg(z_1))\n *\n */\n\n if (a === 0 && b === 0 && z['re'] > 0 && z['im'] >= 0) {\n return Complex['ZERO'];\n }\n\n var arg = Math.atan2(b, a);\n var loh = logHypot(a, b);\n\n a = Math.exp(z['re'] * loh - z['im'] * arg);\n b = z['im'] * loh + z['re'] * arg;\n return new Complex(\n a * Math.cos(b),\n a * Math.sin(b));\n },\n\n /**\n * Calculate the complex square root\n *\n * @returns {Complex}\n */\n 'sqrt': function() {\n\n var a = this['re'];\n var b = this['im'];\n var r = this['abs']();\n\n var re, im;\n\n if (a >= 0) {\n\n if (b === 0) {\n return new Complex(Math.sqrt(a), 0);\n }\n\n re = 0.5 * Math.sqrt(2.0 * (r + a));\n } else {\n re = Math.abs(b) / Math.sqrt(2 * (r - a));\n }\n\n if (a <= 0) {\n im = 0.5 * Math.sqrt(2.0 * (r - a));\n } else {\n im = Math.abs(b) / Math.sqrt(2 * (r + a));\n }\n\n return new Complex(re, b < 0 ? -im : im);\n },\n\n /**\n * Calculate the complex exponent\n *\n * @returns {Complex}\n */\n 'exp': function() {\n\n var tmp = Math.exp(this['re']);\n\n if (this['im'] === 0) {\n //return new Complex(tmp, 0);\n }\n return new Complex(\n tmp * Math.cos(this['im']),\n tmp * Math.sin(this['im']));\n },\n\n /**\n * Calculate the complex exponent and subtracts one.\n *\n * This may be more accurate than `Complex(x).exp().sub(1)` if\n * `x` is small.\n *\n * @returns {Complex}\n */\n 'expm1': function() {\n\n /**\n * exp(a + i*b) - 1\n = exp(a) * (cos(b) + j*sin(b)) - 1\n = expm1(a)*cos(b) + cosm1(b) + j*exp(a)*sin(b)\n */\n\n var a = this['re'];\n var b = this['im'];\n\n return new Complex(\n Math.expm1(a) * Math.cos(b) + cosm1(b),\n Math.exp(a) * Math.sin(b));\n },\n\n /**\n * Calculate the natural log\n *\n * @returns {Complex}\n */\n 'log': function() {\n\n var a = this['re'];\n var b = this['im'];\n\n if (b === 0 && a > 0) {\n //return new Complex(Math.log(a), 0);\n }\n\n return new Complex(\n logHypot(a, b),\n Math.atan2(b, a));\n },\n\n /**\n * Calculate the magnitude of the complex number\n *\n * @returns {number}\n */\n 'abs': function() {\n\n return hypot(this['re'], this['im']);\n },\n\n /**\n * Calculate the angle of the complex number\n *\n * @returns {number}\n */\n 'arg': function() {\n\n return Math.atan2(this['im'], this['re']);\n },\n\n /**\n * Calculate the sine of the complex number\n *\n * @returns {Complex}\n */\n 'sin': function() {\n\n // sin(z) = ( e^iz - e^-iz ) / 2i \n // = sin(a)cosh(b) + i cos(a)sinh(b)\n\n var a = this['re'];\n var b = this['im'];\n\n return new Complex(\n Math.sin(a) * cosh(b),\n Math.cos(a) * sinh(b));\n },\n\n /**\n * Calculate the cosine\n *\n * @returns {Complex}\n */\n 'cos': function() {\n\n // cos(z) = ( e^iz + e^-iz ) / 2 \n // = cos(a)cosh(b) - i sin(a)sinh(b)\n\n var a = this['re'];\n var b = this['im'];\n\n return new Complex(\n Math.cos(a) * cosh(b),\n -Math.sin(a) * sinh(b));\n },\n\n /**\n * Calculate the tangent\n *\n * @returns {Complex}\n */\n 'tan': function() {\n\n // tan(z) = sin(z) / cos(z) \n // = ( e^iz - e^-iz ) / ( i( e^iz + e^-iz ) )\n // = ( e^2iz - 1 ) / i( e^2iz + 1 )\n // = ( sin(2a) + i sinh(2b) ) / ( cos(2a) + cosh(2b) )\n\n var a = 2 * this['re'];\n var b = 2 * this['im'];\n var d = Math.cos(a) + cosh(b);\n\n return new Complex(\n Math.sin(a) / d,\n sinh(b) / d);\n },\n\n /**\n * Calculate the cotangent\n *\n * @returns {Complex}\n */\n 'cot': function() {\n\n // cot(c) = i(e^(ci) + e^(-ci)) / (e^(ci) - e^(-ci))\n\n var a = 2 * this['re'];\n var b = 2 * this['im'];\n var d = Math.cos(a) - cosh(b);\n\n return new Complex(\n -Math.sin(a) / d,\n sinh(b) / d);\n },\n\n /**\n * Calculate the secant\n *\n * @returns {Complex}\n */\n 'sec': function() {\n\n // sec(c) = 2 / (e^(ci) + e^(-ci))\n\n var a = this['re'];\n var b = this['im'];\n var d = 0.5 * cosh(2 * b) + 0.5 * Math.cos(2 * a);\n\n return new Complex(\n Math.cos(a) * cosh(b) / d,\n Math.sin(a) * sinh(b) / d);\n },\n\n /**\n * Calculate the cosecans\n *\n * @returns {Complex}\n */\n 'csc': function() {\n\n // csc(c) = 2i / (e^(ci) - e^(-ci))\n\n var a = this['re'];\n var b = this['im'];\n var d = 0.5 * cosh(2 * b) - 0.5 * Math.cos(2 * a);\n\n return new Complex(\n Math.sin(a) * cosh(b) / d,\n -Math.cos(a) * sinh(b) / d);\n },\n\n /**\n * Calculate the complex arcus sinus\n *\n * @returns {Complex}\n */\n 'asin': function() {\n\n // asin(c) = -i * log(ci + sqrt(1 - c^2))\n\n var a = this['re'];\n var b = this['im'];\n\n var t1 = new Complex(\n b * b - a * a + 1,\n -2 * a * b)['sqrt']();\n\n var t2 = new Complex(\n t1['re'] - b,\n t1['im'] + a)['log']();\n\n return new Complex(t2['im'], -t2['re']);\n },\n\n /**\n * Calculate the complex arcus cosinus\n *\n * @returns {Complex}\n */\n 'acos': function() {\n\n // acos(c) = i * log(c - i * sqrt(1 - c^2))\n\n var a = this['re'];\n var b = this['im'];\n\n var t1 = new Complex(\n b * b - a * a + 1,\n -2 * a * b)['sqrt']();\n\n var t2 = new Complex(\n t1['re'] - b,\n t1['im'] + a)['log']();\n\n return new Complex(Math.PI / 2 - t2['im'], t2['re']);\n },\n\n /**\n * Calculate the complex arcus tangent\n *\n * @returns {Complex}\n */\n 'atan': function() {\n\n // atan(c) = i / 2 log((i + x) / (i - x))\n\n var a = this['re'];\n var b = this['im'];\n\n if (a === 0) {\n\n if (b === 1) {\n return new Complex(0, Infinity);\n }\n\n if (b === -1) {\n return new Complex(0, -Infinity);\n }\n }\n\n var d = a * a + (1.0 - b) * (1.0 - b);\n\n var t1 = new Complex(\n (1 - b * b - a * a) / d,\n -2 * a / d).log();\n\n return new Complex(-0.5 * t1['im'], 0.5 * t1['re']);\n },\n\n /**\n * Calculate the complex arcus cotangent\n *\n * @returns {Complex}\n */\n 'acot': function() {\n\n // acot(c) = i / 2 log((c - i) / (c + i))\n\n var a = this['re'];\n var b = this['im'];\n\n if (b === 0) {\n return new Complex(Math.atan2(1, a), 0);\n }\n\n var d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).atan()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).atan();\n },\n\n /**\n * Calculate the complex arcus secant\n *\n * @returns {Complex}\n */\n 'asec': function() {\n\n // asec(c) = -i * log(1 / c + sqrt(1 - i / c^2))\n\n var a = this['re'];\n var b = this['im'];\n\n if (a === 0 && b === 0) {\n return new Complex(0, Infinity);\n }\n\n var d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).acos()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).acos();\n },\n\n /**\n * Calculate the complex arcus cosecans\n *\n * @returns {Complex}\n */\n 'acsc': function() {\n\n // acsc(c) = -i * log(i / c + sqrt(1 - 1 / c^2))\n\n var a = this['re'];\n var b = this['im'];\n\n if (a === 0 && b === 0) {\n return new Complex(Math.PI / 2, Infinity);\n }\n\n var d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).asin()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).asin();\n },\n\n /**\n * Calculate the complex sinh\n *\n * @returns {Complex}\n */\n 'sinh': function() {\n\n // sinh(c) = (e^c - e^-c) / 2\n\n var a = this['re'];\n var b = this['im'];\n\n return new Complex(\n sinh(a) * Math.cos(b),\n cosh(a) * Math.sin(b));\n },\n\n /**\n * Calculate the complex cosh\n *\n * @returns {Complex}\n */\n 'cosh': function() {\n\n // cosh(c) = (e^c + e^-c) / 2\n\n var a = this['re'];\n var b = this['im'];\n\n return new Complex(\n cosh(a) * Math.cos(b),\n sinh(a) * Math.sin(b));\n },\n\n /**\n * Calculate the complex tanh\n *\n * @returns {Complex}\n */\n 'tanh': function() {\n\n // tanh(c) = (e^c - e^-c) / (e^c + e^-c)\n\n var a = 2 * this['re'];\n var b = 2 * this['im'];\n var d = cosh(a) + Math.cos(b);\n\n return new Complex(\n sinh(a) / d,\n Math.sin(b) / d);\n },\n\n /**\n * Calculate the complex coth\n *\n * @returns {Complex}\n */\n 'coth': function() {\n\n // coth(c) = (e^c + e^-c) / (e^c - e^-c)\n\n var a = 2 * this['re'];\n var b = 2 * this['im'];\n var d = cosh(a) - Math.cos(b);\n\n return new Complex(\n sinh(a) / d,\n -Math.sin(b) / d);\n },\n\n /**\n * Calculate the complex coth\n *\n * @returns {Complex}\n */\n 'csch': function() {\n\n // csch(c) = 2 / (e^c - e^-c)\n\n var a = this['re'];\n var b = this['im'];\n var d = Math.cos(2 * b) - cosh(2 * a);\n\n return new Complex(\n -2 * sinh(a) * Math.cos(b) / d,\n 2 * cosh(a) * Math.sin(b) / d);\n },\n\n /**\n * Calculate the complex sech\n *\n * @returns {Complex}\n */\n 'sech': function() {\n\n // sech(c) = 2 / (e^c + e^-c)\n\n var a = this['re'];\n var b = this['im'];\n var d = Math.cos(2 * b) + cosh(2 * a);\n\n return new Complex(\n 2 * cosh(a) * Math.cos(b) / d,\n -2 * sinh(a) * Math.sin(b) / d);\n },\n\n /**\n * Calculate the complex asinh\n *\n * @returns {Complex}\n */\n 'asinh': function() {\n\n // asinh(c) = log(c + sqrt(c^2 + 1))\n\n var tmp = this['im'];\n this['im'] = -this['re'];\n this['re'] = tmp;\n var res = this['asin']();\n\n this['re'] = -this['im'];\n this['im'] = tmp;\n tmp = res['re'];\n\n res['re'] = -res['im'];\n res['im'] = tmp;\n return res;\n },\n\n /**\n * Calculate the complex acosh\n *\n * @returns {Complex}\n */\n 'acosh': function() {\n\n // acosh(c) = log(c + sqrt(c^2 - 1))\n\n var res = this['acos']();\n if (res['im'] <= 0) {\n var tmp = res['re'];\n res['re'] = -res['im'];\n res['im'] = tmp;\n } else {\n var tmp = res['im'];\n res['im'] = -res['re'];\n res['re'] = tmp;\n }\n return res;\n },\n\n /**\n * Calculate the complex atanh\n *\n * @returns {Complex}\n */\n 'atanh': function() {\n\n // atanh(c) = log((1+c) / (1-c)) / 2\n\n var a = this['re'];\n var b = this['im'];\n\n var noIM = a > 1 && b === 0;\n var oneMinus = 1 - a;\n var onePlus = 1 + a;\n var d = oneMinus * oneMinus + b * b;\n\n var x = (d !== 0)\n ? new Complex(\n (onePlus * oneMinus - b * b) / d,\n (b * oneMinus + onePlus * b) / d)\n : new Complex(\n (a !== -1) ? (a / 0) : 0,\n (b !== 0) ? (b / 0) : 0);\n\n var temp = x['re'];\n x['re'] = logHypot(x['re'], x['im']) / 2;\n x['im'] = Math.atan2(x['im'], temp) / 2;\n if (noIM) {\n x['im'] = -x['im'];\n }\n return x;\n },\n\n /**\n * Calculate the complex acoth\n *\n * @returns {Complex}\n */\n 'acoth': function() {\n\n // acoth(c) = log((c+1) / (c-1)) / 2\n\n var a = this['re'];\n var b = this['im'];\n\n if (a === 0 && b === 0) {\n return new Complex(0, Math.PI / 2);\n }\n\n var d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).atanh()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).atanh();\n },\n\n /**\n * Calculate the complex acsch\n *\n * @returns {Complex}\n */\n 'acsch': function() {\n\n // acsch(c) = log((1+sqrt(1+c^2))/c)\n\n var a = this['re'];\n var b = this['im'];\n\n if (b === 0) {\n\n return new Complex(\n (a !== 0)\n ? Math.log(a + Math.sqrt(a * a + 1))\n : Infinity, 0);\n }\n\n var d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).asinh()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).asinh();\n },\n\n /**\n * Calculate the complex asech\n *\n * @returns {Complex}\n */\n 'asech': function() {\n\n // asech(c) = log((1+sqrt(1-c^2))/c)\n\n var a = this['re'];\n var b = this['im'];\n\n if (this['isZero']()) {\n return Complex['INFINITY'];\n }\n\n var d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).acosh()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).acosh();\n },\n\n /**\n * Calculate the complex inverse 1/z\n *\n * @returns {Complex}\n */\n 'inverse': function() {\n\n // 1 / 0 = Infinity and 1 / Infinity = 0\n if (this['isZero']()) {\n return Complex['INFINITY'];\n }\n\n if (this['isInfinite']()) {\n return Complex['ZERO'];\n }\n\n var a = this['re'];\n var b = this['im'];\n\n var d = a * a + b * b;\n\n return new Complex(a / d, -b / d);\n },\n\n /**\n * Returns the complex conjugate\n *\n * @returns {Complex}\n */\n 'conjugate': function() {\n\n return new Complex(this['re'], -this['im']);\n },\n\n /**\n * Gets the negated complex number\n *\n * @returns {Complex}\n */\n 'neg': function() {\n\n return new Complex(-this['re'], -this['im']);\n },\n\n /**\n * Ceils the actual complex number\n *\n * @returns {Complex}\n */\n 'ceil': function(places) {\n\n places = Math.pow(10, places || 0);\n\n return new Complex(\n Math.ceil(this['re'] * places) / places,\n Math.ceil(this['im'] * places) / places);\n },\n\n /**\n * Floors the actual complex number\n *\n * @returns {Complex}\n */\n 'floor': function(places) {\n\n places = Math.pow(10, places || 0);\n\n return new Complex(\n Math.floor(this['re'] * places) / places,\n Math.floor(this['im'] * places) / places);\n },\n\n /**\n * Ceils the actual complex number\n *\n * @returns {Complex}\n */\n 'round': function(places) {\n\n places = Math.pow(10, places || 0);\n\n return new Complex(\n Math.round(this['re'] * places) / places,\n Math.round(this['im'] * places) / places);\n },\n\n /**\n * Compares two complex numbers\n *\n * **Note:** new Complex(Infinity).equals(Infinity) === false\n *\n * @returns {boolean}\n */\n 'equals': function(a, b) {\n\n var z = new Complex(a, b);\n\n return Math.abs(z['re'] - this['re']) <= Complex['EPSILON'] &&\n Math.abs(z['im'] - this['im']) <= Complex['EPSILON'];\n },\n\n /**\n * Clones the actual object\n *\n * @returns {Complex}\n */\n 'clone': function() {\n\n return new Complex(this['re'], this['im']);\n },\n\n /**\n * Gets a string of the actual complex number\n *\n * @returns {string}\n */\n 'toString': function() {\n\n var a = this['re'];\n var b = this['im'];\n var ret = \"\";\n\n if (this['isNaN']()) {\n return 'NaN';\n }\n\n if (this['isInfinite']()) {\n return 'Infinity';\n }\n\n if (Math.abs(a) < Complex['EPSILON']) {\n a = 0;\n }\n\n if (Math.abs(b) < Complex['EPSILON']) {\n b = 0;\n }\n\n // If is real number\n if (b === 0) {\n return ret + a;\n }\n\n if (a !== 0) {\n ret += a;\n ret += \" \";\n if (b < 0) {\n b = -b;\n ret += \"-\";\n } else {\n ret += \"+\";\n }\n ret += \" \";\n } else if (b < 0) {\n b = -b;\n ret += \"-\";\n }\n\n if (1 !== b) { // b is the absolute imaginary part\n ret += b;\n }\n return ret + \"i\";\n },\n\n /**\n * Returns the actual number as a vector\n *\n * @returns {Array}\n */\n 'toVector': function() {\n\n return [this['re'], this['im']];\n },\n\n /**\n * Returns the actual real value of the current object\n *\n * @returns {number|null}\n */\n 'valueOf': function() {\n\n if (this['im'] === 0) {\n return this['re'];\n }\n return null;\n },\n\n /**\n * Determines whether a complex number is not on the Riemann sphere.\n *\n * @returns {boolean}\n */\n 'isNaN': function() {\n return isNaN(this['re']) || isNaN(this['im']);\n },\n\n /**\n * Determines whether or not a complex number is at the zero pole of the\n * Riemann sphere.\n *\n * @returns {boolean}\n */\n 'isZero': function() {\n return this['im'] === 0 && this['re'] === 0;\n },\n\n /**\n * Determines whether a complex number is not at the infinity pole of the\n * Riemann sphere.\n *\n * @returns {boolean}\n */\n 'isFinite': function() {\n return isFinite(this['re']) && isFinite(this['im']);\n },\n\n /**\n * Determines whether or not a complex number is at the infinity pole of the\n * Riemann sphere.\n *\n * @returns {boolean}\n */\n 'isInfinite': function() {\n return !(this['isNaN']() || this['isFinite']());\n }\n };\n\n Complex['ZERO'] = new Complex(0, 0);\n Complex['ONE'] = new Complex(1, 0);\n Complex['I'] = new Complex(0, 1);\n Complex['PI'] = new Complex(Math.PI, 0);\n Complex['E'] = new Complex(Math.E, 0);\n Complex['INFINITY'] = new Complex(Infinity, Infinity);\n Complex['NAN'] = new Complex(NaN, NaN);\n Complex['EPSILON'] = 1e-15;\n\n if (typeof define === 'function' && define['amd']) {\n define([], function() {\n return Complex;\n });\n } else if (typeof exports === 'object') {\n Object.defineProperty(Complex, \"__esModule\", { 'value': true });\n Complex['default'] = Complex;\n Complex['Complex'] = Complex;\n module['exports'] = Complex;\n } else {\n root['Complex'] = Complex;\n }\n\n})(this);\n", "import Fraction from 'fraction.js'\n\nexport function radian(angle: string): number {\n const coefficient = piCoefficient(angle)\n const fraction = new Fraction(coefficient).valueOf()\n\n return fraction * Math.PI\n}\n\n// TODO: neverthrow \u5316\nexport function angleDenominator(angle: string): number {\n const coefficient = piCoefficient(angle)\n const split = coefficient.split('/')\n\n if (split.length === 1) {\n return 1\n } else if (split.length === 2) {\n return parseInt(split[1])\n } else {\n throw new Error(`Failed to parse angle '${angle}'`)\n }\n}\n\n// TODO: neverthrow \u5316\nexport function angleNumerator(angle: string): number {\n const coefficient = piCoefficient(angle)\n const split = coefficient.split('/')\n\n if (split.length === 1) {\n return parseInt(split[0])\n } else if (split.length === 2) {\n return parseInt(split[0])\n } else {\n throw new Error(`Failed to parse angle '${angle}'`)\n }\n}\n\nexport function isAngleLessThan(angle: string, other: string): boolean {\n return new Fraction(piCoefficient(angle)).valueOf() < new Fraction(piCoefficient(other)).valueOf()\n}\n\nexport function isAngleGreaterThan(angle: string, other: string): boolean {\n return new Fraction(piCoefficient(angle)).valueOf() > new Fraction(piCoefficient(other)).valueOf()\n}\n\nexport function isValidAngle(angle: string): boolean {\n if (angle === '0') return true\n if (!/\u03C0/.test(angle)) return false\n\n try {\n const coefficient = piCoefficient(angle)\n new Fraction(coefficient).valueOf()\n\n return true\n } catch (e) {\n return false\n }\n}\n\nexport function piCoefficient(angle: string): string {\n return angle.replace(/(\\d+)\u03C0/g, '$1').replace(/\u03C0/g, '1')\n}\n\nexport function reduceAngle(angle: string): string {\n try {\n const coefficient = piCoefficient(angle)\n const reduced = new Fraction(coefficient).toFraction()\n const split = reduced.split('/')\n\n let numerator: string\n if (split[0] === '0') {\n numerator = '0'\n } else if (split[0] === '1') {\n numerator = `\u03C0`\n } else if (split[0] === '-1') {\n numerator = `-\u03C0`\n } else {\n numerator = `${split[0]}\u03C0`\n }\n\n if (split.length === 1) {\n return numerator\n } else {\n return `${numerator}/${split[1]}`\n }\n } catch (e) {\n throw new Error(`Failed to parse angle '${angle}'`)\n }\n}\n", "type UnicodeFraction = {character: string; ref: string; value: number}\n\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const UNICODE_FRACTIONS = [\n {character: '\\u00BD', ref: '\u00BD', expanded: '1/2', value: 1 / 2},\n {character: '\\u00BC', ref: '\u00BC', expanded: '1/4', value: 1 / 4},\n {character: '\\u00BE', ref: '\u00BE', expanded: '3/4', value: 3 / 4},\n {character: '\\u2153', ref: '\u2153', expanded: '1/3', value: 1 / 3},\n {character: '\\u2154', ref: '\u2154', expanded: '2/3', value: 2 / 3},\n {character: '\\u2155', ref: '\u2155', expanded: '1/5', value: 1 / 5},\n {character: '\\u2156', ref: '\u2156', expanded: '2/5', value: 2 / 5},\n {character: '\\u2157', ref: '\u2157', expanded: '3/5', value: 3 / 5},\n {character: '\\u2158', ref: '\u2158', expanded: '4/5', value: 4 / 5},\n {character: '\\u2159', ref: '\u2159', expanded: '1/6', value: 1 / 6},\n {character: '\\u215A', ref: '\u215A', expanded: '5/6', value: 5 / 6},\n {character: '\\u2150', ref: '\u2150', expanded: '1/7', value: 1 / 7},\n {character: '\\u215B', ref: '\u215B', expanded: '1/8', value: 1 / 8},\n {character: '\\u215C', ref: '\u215C', expanded: '3/8', value: 3 / 8},\n {character: '\\u215D', ref: '\u215D', expanded: '5/8', value: 5 / 8},\n {character: '\\u215E', ref: '\u215E', expanded: '7/8', value: 7 / 8},\n {character: '\\u2151', ref: '\u2151', expanded: '1/9', value: 1 / 9},\n {character: '\\u2152', ref: '\u2152', expanded: '1/10', value: 1 / 10},\n]\n\n/**\n * Stores formatting options, for determining what string output should look\n * like.\n */\nexport class Format {\n /**\n * Returns an approximated result, but with the constraint that when it\n * changes slightly it should \"look the same\". (It should look good when\n * varying and animated.)\n */\n static readonly CONSISTENT = new Format(false, 0, 2, ', ')\n\n /**\n * Returns an accurate result, but favoring looking nice over being small.\n */\n static readonly EXACT = new Format(true, 0, undefined, ', ')\n\n /**\n * Returns an accurate result, favoring being small over looking nice.\n */\n static readonly MINIFIED = new Format(true, 0, undefined, ',')\n\n /**\n * Returns an approximated result, strongly favoring looking nice.\n */\n static readonly SIMPLIFIED = new Format(true, 0.0005, 3, ', ')\n\n /**\n * Parses the given text into a float. Works for text created by\n * [[formatFloat]].\n */\n static parseFloat(text: string): number {\n if (text.length === 0) {\n throw new Error(`Not a number: '${text}'`)\n }\n if (text[0] === '-') {\n return -Format.parseFloat(text.substr(1))\n }\n if (text[0] === '\\u221A') {\n return Math.sqrt(Format.parseFloat(text.substr(1)))\n }\n\n const fraction = Format.matchUnicodeFraction(e => e.character === text)\n if (fraction !== undefined) {\n return fraction.value\n }\n\n const result = parseFloat(text)\n if (isNaN(result)) {\n throw new Error(`Not a number: '${text}'`)\n }\n return result\n }\n\n /**\n * Corrects a value to a nearby simple fraction or root thereof, such as\n * sqrt(1/2), so it can be printed compactly.\n *\n * @param value The value to round.\n * @param epsilon The maximum offset error introduced by the rounding.\n */\n static simplifyByRounding(value: number, epsilon: number): number {\n if (value < 0) {\n return -Format.simplifyByRounding(-value, epsilon)\n }\n\n const r = value % 1\n if (r <= epsilon || 1 - r <= epsilon) {\n return Math.round(value)\n }\n\n const fraction = Format.matchUnicodeFraction(e => Math.abs(e.value - value) <= epsilon)\n if (fraction !== undefined) {\n return fraction.value\n }\n\n const rootFraction = Format.matchUnicodeFraction(e => Math.abs(Math.sqrt(e.value) - value) <= epsilon)\n if (rootFraction !== undefined) {\n return Math.sqrt(rootFraction.value)\n }\n\n return value\n }\n\n /**\n * Returns the first element of an array matching the given predicate, or else\n * returns undefined.\n *\n * @hidden\n */\n static matchUnicodeFraction(predicate: (arrayItem: UnicodeFraction) => boolean): UnicodeFraction | undefined {\n for (const each of UNICODE_FRACTIONS) {\n if (predicate(each)) return each\n }\n return undefined\n }\n\n public allowAbbreviation: boolean\n public maxAbbreviationError: number\n public fixedDigits: number | undefined\n public itemSeparator: string\n\n /**\n * @param allowAbbreviation Should outputs be shortened, if possible?\n * @param maxAbbreviationError How much error is abbreviating allowed to introduce?\n * @param fixedDigits Use toFixed? How many digits?\n * @param itemSeparator What should list items be separated by?\n */\n constructor(\n allowAbbreviation: boolean,\n maxAbbreviationError: number,\n fixedDigits: number | undefined,\n itemSeparator: string,\n ) {\n this.allowAbbreviation = allowAbbreviation\n this.maxAbbreviationError = maxAbbreviationError\n this.fixedDigits = fixedDigits\n this.itemSeparator = itemSeparator\n }\n\n formatFloat(f: number): string {\n if (this.allowAbbreviation) {\n return this.abbreviateFloat(f, this.maxAbbreviationError, this.fixedDigits)\n }\n if (this.fixedDigits !== undefined) {\n return f.toFixed(this.fixedDigits)\n }\n return String(f)\n }\n\n /**\n * Returns a string representation of a float, taking advantage of unicode\n * fractions and square roots.\n *\n * @param value The value to represent as a string.\n * @param epsilon The maximum error introduced by using an expression.\n * @param digits digits The number of digits to use if no expression matches.\n */\n private abbreviateFloat(value: number, epsilon = 0, digits: number | undefined = undefined): string {\n if (Math.abs(value) < epsilon) return '0'\n if (value < 0) return `-${this.abbreviateFloat(-value, epsilon, digits)}`\n\n const fraction = Format.matchUnicodeFraction(e => Math.abs(e.value - value) <= epsilon)\n if (fraction !== undefined) {\n return fraction.character\n }\n\n const rootFraction = Format.matchUnicodeFraction(e => Math.abs(Math.sqrt(e.value) - value) <= epsilon)\n if (rootFraction !== undefined) {\n return `\\u221A${rootFraction.character}`\n }\n\n if (value % 1 !== 0 && digits !== undefined) {\n return value.toFixed(digits)\n }\n\n return value.toString()\n }\n}\n", "import {UNICODE_FRACTIONS} from './format'\n\ntype UnicodeFraction = {character: string; ref: string; value: number}\n\nexport class NumberFormatter {\n public allowAbbreviation: boolean\n public maxAbbreviationError: number\n public fixedDigits: number | undefined\n public itemSeparator: string\n\n static matchUnicodeFraction(predicate: (arrayItem: UnicodeFraction) => boolean): UnicodeFraction | undefined {\n for (const each of UNICODE_FRACTIONS) {\n if (predicate(each)) return each\n }\n return undefined\n }\n\n constructor(\n allowAbbreviation: boolean,\n maxAbbreviationError: number,\n fixedDigits: number | undefined,\n itemSeparator = ', ',\n ) {\n this.allowAbbreviation = allowAbbreviation\n this.maxAbbreviationError = maxAbbreviationError\n this.fixedDigits = fixedDigits\n this.itemSeparator = itemSeparator\n }\n\n format(n: number): string {\n if (this.allowAbbreviation) {\n return this.abbreviateNumber(n, this.maxAbbreviationError, this.fixedDigits)\n }\n if (this.fixedDigits !== undefined) {\n return n.toFixed(this.fixedDigits)\n }\n return String(n)\n }\n\n private abbreviateNumber(value: number, epsilon = 0, digits: number | undefined = undefined): string {\n if (Math.abs(value) < epsilon) return '0'\n if (value < 0) return `-${this.abbreviateNumber(-value, epsilon, digits)}`\n\n const fraction = NumberFormatter.matchUnicodeFraction(e => Math.abs(e.value - value) <= epsilon)\n if (fraction !== undefined) {\n return fraction.character\n }\n\n const rootFraction = NumberFormatter.matchUnicodeFraction(e => Math.abs(Math.sqrt(e.value) - value) <= epsilon)\n if (rootFraction !== undefined) {\n return `\\u221A${rootFraction.character}`\n }\n\n if (value % 1 !== 0 && digits !== undefined) {\n return value.toFixed(digits)\n }\n\n return value.toString()\n }\n}\n", "import {NumberFormatter} from './number-formatter'\nimport {ok, err, Result} from 'neverthrow'\n\ntype FormatOptions = {\n allowAbbreviation?: boolean\n maxAbbreviationError?: number\n fixedDigits?: number | undefined\n}\n\nconst DEFAULT_FORMAT_OPTIONS = {\n allowAbbreviation: true,\n maxAbbreviationError: 0,\n fixedDigits: undefined,\n}\n\nexport class Complex {\n /**\n * Complex { real: 0, imag: 0 }\n */\n static readonly ZERO = new Complex(0, 0)\n /**\n * Complex { real: 1, imag: 0 }\n */\n static readonly ONE = new Complex(1, 0)\n /**\n * The imaginary unit.\n */\n static readonly I = new Complex(0, 1)\n\n /**\n * The real part of the Complex number.\n */\n public real: number\n /**\n * The imaginary part of the Complex number.\n */\n public imag: number\n\n /**\n * Converts the given value to a Complex value.\n *\n * @param value - The value to convert to a Complex value\n */\n static from(value: number | Complex): Complex {\n if (typeof value === 'number') {\n return new Complex(value, 0)\n }\n\n return value\n }\n\n /**\n * Returns the real part of a Complex or a number value.\n *\n * @param value - The value to get the real part of\n */\n static real(value: number | Complex): number {\n if (typeof value === 'number') {\n return value\n }\n\n return value.real\n }\n\n /**\n * Returns the imaginary part of a Complex value, or else 0 for number values.\n *\n * @param value - The value to get the imaginary part of\n */\n static imag(value: number | Complex): number {\n if (typeof value === 'number') {\n return 0\n }\n\n return value.imag\n }\n\n /**\n * Returns a new Complex number with the given magnitude and phase.\n *\n * @param magnitude - The magnitude of the Complex number\n * @param phase - The phase of the Complex number\n */\n static polar(magnitude: number, phase: number): Complex {\n const [cos, sin] = this.cosAndSin(phase)\n\n return new Complex(magnitude * cos, magnitude * sin)\n }\n\n private static cosAndSin(radians: number): number[] {\n const unit = Math.PI / 4\n const i = Math.round(radians / unit)\n if (i * unit === radians) {\n const s = Math.sqrt(0.5)\n const snaps = [\n [1, 0], // 0\n [s, s], // \u03C0/4\n [0, 1], // \u03C0/2\n [-s, s], // 3\u03C0/4\n [-1, 0], // \u03C0\n [-s, -s], // 5\u03C0/4\n [0, -1], // 3\u03C0/2\n [s, -s], // 7\u03C0/4\n ]\n return snaps[i & 7]\n }\n return [Math.cos(radians), Math.sin(radians)]\n }\n\n /**\n * @param real - The real part of the Complex number\n * @param imag - The imaginary part of the Complex number\n */\n constructor(real: number, imag: number) {\n this.real = real\n this.imag = imag\n\n this.isApproximatelyEqualTo = this.nearlyEq // alias for nearlyEq\n this.isEqualTo = this.eq // alias for eq\n this.conj = this.conjugate // alias for conjugate\n this.plus = this.add // alias for add\n // aliases for sub\n this.subtract = this.sub\n this.minus = this.sub\n // aliases for mult\n this.multiply = this.mult\n this.times = this.mult\n this.dividedBy = this.div // alias for div\n this.magnitude = this.abs // alias for abs\n this.norm2 = this.abs2 // alias for abs2\n // aliases for arg\n this.angle = this.arg\n this.phase = this.arg\n }\n\n /**\n * Returns true if complex number is equal to other.\n *\n * @param other - The other value to compare with\n */\n eq(other: unknown): boolean {\n if (typeof other === 'number') {\n return this.real === other && this.imag === 0\n }\n if (other instanceof Complex) {\n return this.real === other.real && this.imag === other.imag\n }\n return false\n }\n\n isEqualTo = this.eq.bind(this)\n\n /**\n * Returns true if the Complex number is close to the value of other.\n *\n * @param other - The other value to compare with\n */\n nearlyEq(other: number | Complex | unknown, epsilon: number): boolean {\n if (typeof other === 'number' || other instanceof Complex) {\n const d = this.sub(Complex.from(other))\n return Math.abs(d.real) <= epsilon && Math.abs(d.imag) <= epsilon && d.abs() <= epsilon\n }\n return false\n }\n\n isApproximatelyEqualTo = this.nearlyEq.bind(this)\n\n /**\n * Returns the complex conjugate.\n *\n * @returns A new Complex representing the complex conjugate of this complex number\n */\n conjugate(): Complex {\n return new Complex(this.real, -this.imag)\n }\n\n conj = this.conjugate.bind(this)\n\n /**\n * Returns negation of the value.\n *\n * @returns A new Complex representing the negation of this complex number.\n */\n neg(): Complex {\n return new Complex(-this.real, -this.imag)\n }\n\n /**\n * Returns the sum of this complex number and value.\n *\n * @param value - The addend number.\n * @returns A new Complex representing the sum of this complex number and value.\n */\n add(value: number | Complex): Complex {\n const c = Complex.from(value)\n\n return new Complex(this.real + c.real, this.imag + c.imag)\n }\n\n plus = this.add.bind(this)\n\n /**\n * Returns the subtraction of this complex number and value.\n *\n * @param value - The subtrahend number.\n * @returns A new Complex representing the subtraction of this complex number and value.\n */\n sub(value: number | Complex): Complex {\n const c = Complex.from(value)\n\n return new Complex(this.real - c.real, this.imag - c.imag)\n }\n\n subtract = this.sub.bind(this)\n minus = this.sub.bind(this)\n\n /**\n * Returns the product of this complex number and value.\n *\n * @param value - The multiplier number.\n * @returns A new Complex representing the product of this complex number and value.\n */\n mult(value: number | Complex): Complex {\n const c = Complex.from(value)\n\n return new Complex(this.real * c.real - this.imag * c.imag, this.real * c.imag + this.imag * c.real)\n }\n\n multiply = this.mult.bind(this)\n times = this.mult.bind(this)\n\n /**\n * Returns a complex number divided by value.\n * If value is zero, returns an error.\n *\n * @param value - The divisor number.\n * @returns A Result object with the result of division or a division-by-zero error.\n * @example\n * ```\n * const res = new Complex(2, 3).div(2)\n * if (res.isOk()) {\n * console.log(res.value) // Complex { real: 1, imag: 1.5 }\n * } else {\n * console.error(res.error)\n * }\n * ```\n */\n div(value: number | Complex): Result {\n const c = Complex.from(value)\n const d = c.abs2()\n if (d === 0) {\n return err(Error('Division by Zero'))\n }\n\n const n = this.mult(c.conjugate())\n return ok(new Complex(n.real / d, n.imag / d))\n }\n\n dividedBy = this.div.bind(this)\n\n /**\n * Returns the absolute part of its polar form.\n *\n * @returns A number representing the absolute part of its polar form.\n * @example\n * ```\n * new Complex(-1, 0).abs() // 1\n * new Complex(3, 4).abs() // 5\n * ```\n */\n abs(): number {\n return Math.sqrt(this.abs2())\n }\n\n magnitude = this.abs.bind(this)\n\n /**\n * Returns square of the absolute value.\n *\n * @returns A number representing the square of the absolute value.\n * @example\n * ```\n * new Complex(-1, 0).abs2() // 1\n * new Complex(3, 4).abs2() // 25\n * ```\n */\n abs2(): number {\n return this.real * this.real + this.imag * this.imag\n }\n\n norm2 = this.abs2.bind(this)\n\n /**\n * Returns the angle part of its polar form.\n *\n * @returns A number representing the angle part of its polar form in radians.\n */\n arg(): number {\n return Math.atan2(this.imag, this.real)\n }\n\n angle = this.arg.bind(this)\n phase = this.arg.bind(this)\n\n /**\n * Returns the exponentiation of a complex number. That is c.pow(x) = c^x.\n *\n * @param exponent - the exponent number\n * @returns A number representing base taken to the power of exponent\n */\n pow(exponent: number | Complex): Complex {\n if (exponent === 0.5 && this.imag === 0 && this.real >= 0) {\n return new Complex(Math.sqrt(this.real), 0)\n }\n if (this.eq(Complex.ZERO)) {\n return Complex.ZERO\n }\n return this.ln().mult(Complex.from(exponent)).exp()\n }\n\n /**\n * Returns e raised to the c power. That is c.exp() = e^c.\n */\n exp(): Complex {\n return Complex.polar(Math.exp(this.real), this.imag)\n }\n\n /**\n * Returns a string representing this complex number according to the specified format.\n *\n * @param options - An object that sets the format options for this complex number.\n * @returns A string representing this complex number.\n * @example\n * ```\n * new Complex(1, 2).format() // '1+2i'\n * new Complex(1, 2).format({\n * allowAbbreviation: false,\n * fixedDigits: 2,\n * }) // '+1.00+2.00i'\n * ```\n */\n format(options: FormatOptions = DEFAULT_FORMAT_OPTIONS): string {\n const format = new NumberFormatter(\n options.allowAbbreviation === undefined ? DEFAULT_FORMAT_OPTIONS.allowAbbreviation : options.allowAbbreviation,\n options.maxAbbreviationError || 0,\n options.fixedDigits,\n )\n return format.allowAbbreviation ? this.toStringAllowSingleValue(format) : this.toStringBothValues(format)\n }\n\n /**\n * Returns a compact string representing this Complex number.\n *\n * @returns A string representing this complex number.\n * @example\n * ```\n * new Complex(1, 2).toString() // '1+2i'\n * new Complex(Math.sqrt(1 / 2), -1 / 3).toString() // '\u221A\u00BD-\u2153i'\n * ```\n */\n toString(): string {\n const formatter = new NumberFormatter(\n DEFAULT_FORMAT_OPTIONS.allowAbbreviation,\n DEFAULT_FORMAT_OPTIONS.maxAbbreviationError,\n DEFAULT_FORMAT_OPTIONS.fixedDigits,\n )\n return this.toStringAllowSingleValue(formatter)\n }\n\n // log(c) = ln|c| + arg(c)i\n private ln(): Complex {\n return new Complex(Math.log(this.abs()), this.arg())\n }\n\n // If a complex number has only real or imaginary parts,\n // convert it to a string with only real or imaginary parts, such as '\u2153' or '-3i'.\n private toStringAllowSingleValue(formatter: NumberFormatter): string {\n if (this.canImagPartBeOmitted(formatter.maxAbbreviationError)) {\n return formatter.format(this.real)\n }\n\n if (this.canRealPartBeOmitted(formatter.maxAbbreviationError)) {\n let imagFactor\n\n if (this.isImagFactorCloseToOne(formatter.maxAbbreviationError)) {\n imagFactor = ''\n } else if (this.isImagFactorMinusOne(formatter.maxAbbreviationError)) {\n imagFactor = '-'\n } else {\n imagFactor = formatter.format(this.imag)\n }\n\n return `${imagFactor}i`\n }\n\n return this.toStringBothValues(formatter)\n }\n\n // Convert a complex number whose real and imaginary parts are not both zero into a string like '\u2153-3i'.\n private toStringBothValues(formatter: NumberFormatter): string {\n const imagSign = this.imag >= 0 ? '+' : '-'\n const imagFactor = this.canImagFactorBeOmitted(formatter) ? '' : formatter.format(Math.abs(this.imag))\n const realPlusSign = formatter.allowAbbreviation || formatter.fixedDigits === undefined || this.real < 0 ? '' : '+'\n\n return `${realPlusSign + formatter.format(this.real) + imagSign + imagFactor}i`\n }\n\n // Returns whether the real part of a complex number can be omitted.\n private canRealPartBeOmitted(maxAbbreviationError: number): boolean {\n return Math.abs(this.real) <= maxAbbreviationError\n }\n\n // Returns whether the imaginary part of a complex number can be omitted.\n private canImagPartBeOmitted(maxAbbreviationError: number): boolean {\n return Math.abs(this.imag) <= maxAbbreviationError\n }\n\n // Returns whether the imaginary part of a complex number is close to 1.\n private isImagFactorCloseToOne(maxAbbreviationError: number): boolean {\n return Math.abs(this.imag - 1) <= maxAbbreviationError\n }\n\n // Returns whether the imaginary part of a complex number is close to -1.\n private isImagFactorMinusOne(maxAbbreviationError: number): boolean {\n return Math.abs(this.imag + 1) <= maxAbbreviationError\n }\n\n // Returns true if the factor of the imaginary part can be omitted, such as i or -i.\n private canImagFactorBeOmitted(formatter: NumberFormatter): boolean {\n return formatter.allowAbbreviation && Math.abs(Math.abs(this.imag) - 1) <= formatter.maxAbbreviationError\n }\n}\n", "export const Config = {\n MAX_QUBIT_COUNT: 16,\n} as const\n", "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {format as prettyFormat} from 'pretty-format'\n\nlet CONSTRUCTOR_CALLS_NESTING = 0\n\nexport class DetailedError extends Error {\n public details: string | undefined\n private detailsObj: unknown\n\n constructor(message: string, detailsObj: unknown) {\n super(message)\n\n this.detailsObj = detailsObj\n this.name = 'Error'\n this.message = message\n this.stack = new Error().stack\n if (this.stack !== undefined) {\n this.stack = this.stack.replace(/^Error\\n\\s+at new DetailedError (\\S+)\\s?\\n\\s+at /, '\\n ')\n }\n\n CONSTRUCTOR_CALLS_NESTING++\n try {\n this.details =\n CONSTRUCTOR_CALLS_NESTING === 1\n ? prettyFormat(this.detailsObj)\n : '(failed to prettyFormat detailsObj due to possibly re-entrancy)'\n } catch (ex) {\n // eslint-disable-next-line no-console\n console.error(ex)\n this.details = '(failed to prettyFormat detailsObj, see the console for details)'\n } finally {\n CONSTRUCTOR_CALLS_NESTING--\n }\n }\n}\n", "/**\n * Emit a custom event\n *\n * @param type The event type\n * @param detail Any details to pass along with the event\n * @param element The element to attach the event to\n */\nexport function emitEvent(type: string, detail = {}, element: Node = document): boolean {\n const event = new CustomEvent(type, {\n bubbles: true,\n cancelable: true,\n detail,\n })\n\n return element.dispatchEvent(event)\n}\n", "import {Config} from './config'\n\nexport type CreateArrayWithLengthX = ACC['length'] extends LENGTH\n ? ACC\n : CreateArrayWithLengthX\n\nexport type NumericRange<\n START_ARR extends number[],\n END extends number,\n ACC extends number = never,\n> = START_ARR['length'] extends END ? ACC | END : NumericRange<[...START_ARR, 1], END, ACC | START_ARR['length']>\n\nexport type ResizeableSpan = NumericRange, typeof Config.MAX_QUBIT_COUNT>\n\nexport const isResizeableSpan = (arg: unknown): arg is ResizeableSpan =>\n typeof arg == 'number' && 1 <= arg && arg <= Config.MAX_QUBIT_COUNT\n", "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Result} from 'neverthrow'\n\ntype ParseError = {message: string}\nconst toParseError = (): ParseError => ({message: 'Parse Error'})\n\nexport class Util {\n static need(expression: boolean, message: string, args?: unknown[]): asserts expression {\n if (expression !== true) {\n const argDesc = args === undefined ? '(not provided)' : `[${Array.prototype.slice.call(args).join(', ')}]`\n const msgDesc = message === undefined ? '(not provided)' : message\n const msg = `Precondition failed\\n\\nMessage: ${msgDesc}\\n\\nArgs: ${argDesc}`\n throw new Error(msg)\n }\n }\n\n static notNull(v: T): asserts v is NonNullable {\n Util.need(v !== null && v !== undefined, 'notNull')\n }\n\n // \u73FE\u5728\u306E URL \u3092\u30D1\u30FC\u30B9\u3057\u3001\u6700\u5F8C\u306E / \u4EE5\u964D\u3092\u30C7\u30B3\u30FC\u30C9\u3057\u305F\u3082\u306E\u3092\u8FD4\u3059\n static get urlJson(): string {\n const url = new URL(location.href, window.location.origin)\n const path = decodeURIComponent(url.pathname)\n const lastSlashIndex = path.lastIndexOf('/')\n\n return path.substring(lastSlashIndex + 1)\n }\n\n static safeJsonParse = Result.fromThrowable(JSON.parse, toParseError)\n}\n", "export const SerializedAntiControlGateType = '\u25E6'\n\nexport type SerializedAntiControlGate = {\n type: typeof SerializedAntiControlGateType\n targets: number[]\n}\n", "export const SerializedBlochDisplayType = 'Bloch'\n\nexport type SerializedBlochDisplay = {\n type: typeof SerializedBlochDisplayType\n targets: number[]\n}\n", "export const SerializedControlGateType = '\u2022'\n\nexport type SerializedControlGate = {\n type: typeof SerializedControlGateType\n targets: number[]\n}\n", "export const SerializedHGateType = 'H'\n\nexport type SerializedHGate = {\n type: typeof SerializedHGateType\n targets: number[]\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "export const SerializedMeasurementGateType = 'Measure'\n\nexport type SerializedMeasurementGate = {\n type: typeof SerializedMeasurementGateType\n targets: number[]\n flag?: string\n}\n", "export const SerializedPhaseGateType = 'P'\n\nexport type SerializedPhaseGate = {\n type: typeof SerializedPhaseGateType\n angle?: string\n targets: number[]\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "import {ResizeableSpan} from './numeric-range'\n\nexport const SerializedQftDaggerGateType = 'QFT\u2020'\n\nexport type SerializedQftDaggerGate = {\n type: typeof SerializedQftDaggerGateType\n span: ResizeableSpan\n targets: number[]\n}\n", "import {ResizeableSpan} from './numeric-range'\n\nexport const SerializedQftGateType = 'QFT'\n\nexport type SerializedQftGate = {\n type: typeof SerializedQftGateType\n span: ResizeableSpan\n targets: number[]\n}\n", "export const SerializedRnotGateType = 'X^\u00BD'\n\nexport type SerializedRnotGate = {\n type: typeof SerializedRnotGateType\n targets: number[]\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "export const SerializedRxGateType = 'Rx'\n\nexport type SerializedRxGate = {\n type: typeof SerializedRxGateType\n targets: number[]\n angle?: string\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "export const SerializedRyGateType = 'Ry'\n\nexport type SerializedRyGate = {\n type: typeof SerializedRyGateType\n targets: number[]\n angle?: string\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "export const SerializedRzGateType = 'Rz'\n\nexport type SerializedRzGate = {\n type: typeof SerializedRzGateType\n targets: number[]\n angle?: string\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "export const SerializedSDaggerGateType = 'S\u2020'\n\nexport type SerializedSDaggerGate = {\n type: typeof SerializedSDaggerGateType\n targets: number[]\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "export const SerializedSGateType = 'S'\n\nexport type SerializedSGate = {\n type: typeof SerializedSGateType\n targets: number[]\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "export const SerializedSpacerGateType = '\u2026'\n\nexport type SerializedSpacerGate = {\n type: typeof SerializedSpacerGateType\n targets: number[]\n}\n", "export const SerializedSwapGateType = 'Swap'\n\nexport type SerializedSwapGate = {\n type: typeof SerializedSwapGateType\n targets: [number, number]\n controls?: number[]\n antiControls?: number[]\n}\n", "export const SerializedTDaggerGateType = 'T\u2020'\n\nexport type SerializedTDaggerGate = {\n type: typeof SerializedTDaggerGateType\n targets: number[]\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "export const SerializedTGateType = 'T'\n\nexport type SerializedTGate = {\n type: typeof SerializedTGateType\n targets: number[]\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "export const SerializedWrite0GateType = '|0>'\nexport const SerializedWrite1GateType = '|1>'\n\nexport type SerializedWriteGate = {\n type: typeof SerializedWrite0GateType | typeof SerializedWrite1GateType\n targets: number[]\n}\n", "export const SerializedXGateType = 'X'\n\nexport type SerializedXGate = {\n type: typeof SerializedXGateType\n targets: number[]\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "export const SerializedYGateType = 'Y'\n\nexport type SerializedYGate = {\n type: typeof SerializedYGateType\n targets: number[]\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "export const SerializedZGateType = 'Z'\n\nexport type SerializedZGate = {\n type: typeof SerializedZGateType\n targets: number[]\n controls?: number[]\n antiControls?: number[]\n if?: string\n}\n", "/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nfunction __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\n\nvar defaultErrorConfig = {\r\n withStackTrace: false\r\n};\r\n// Custom error object\r\n// Context / discussion: https://github.com/supermacro/neverthrow/pull/215\r\nvar createNeverThrowError = function (message, result, config) {\r\n if (config === void 0) { config = defaultErrorConfig; }\r\n var data = result.isOk()\r\n ? { type: 'Ok', value: result.value }\r\n : { type: 'Err', value: result.error };\r\n var maybeStack = config.withStackTrace ? new Error().stack : undefined;\r\n return {\r\n data: data,\r\n message: message,\r\n stack: maybeStack\r\n };\r\n};\n\nvar ResultAsync = /** @class */ (function () {\r\n function ResultAsync(res) {\r\n this._promise = res;\r\n }\r\n ResultAsync.fromSafePromise = function (promise) {\r\n var newPromise = promise.then(function (value) { return new Ok(value); });\r\n return new ResultAsync(newPromise);\r\n };\r\n ResultAsync.fromPromise = function (promise, errorFn) {\r\n var newPromise = promise\r\n .then(function (value) { return new Ok(value); })[\"catch\"](function (e) { return new Err(errorFn(e)); });\r\n return new ResultAsync(newPromise);\r\n };\r\n ResultAsync.combine = function (asyncResultList) {\r\n return combineResultAsyncList(asyncResultList);\r\n };\r\n ResultAsync.combineWithAllErrors = function (asyncResultList) {\r\n return combineResultAsyncListWithAllErrors(asyncResultList);\r\n };\r\n ResultAsync.prototype.map = function (f) {\r\n var _this = this;\r\n return new ResultAsync(this._promise.then(function (res) { return __awaiter(_this, void 0, void 0, function () {\r\n var _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n if (res.isErr()) {\r\n return [2 /*return*/, new Err(res.error)];\r\n }\r\n _a = Ok.bind;\r\n return [4 /*yield*/, f(res.value)];\r\n case 1: return [2 /*return*/, new (_a.apply(Ok, [void 0, _b.sent()]))()];\r\n }\r\n });\r\n }); }));\r\n };\r\n ResultAsync.prototype.mapErr = function (f) {\r\n var _this = this;\r\n return new ResultAsync(this._promise.then(function (res) { return __awaiter(_this, void 0, void 0, function () {\r\n var _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n if (res.isOk()) {\r\n return [2 /*return*/, new Ok(res.value)];\r\n }\r\n _a = Err.bind;\r\n return [4 /*yield*/, f(res.error)];\r\n case 1: return [2 /*return*/, new (_a.apply(Err, [void 0, _b.sent()]))()];\r\n }\r\n });\r\n }); }));\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\r\n ResultAsync.prototype.andThen = function (f) {\r\n return new ResultAsync(this._promise.then(function (res) {\r\n if (res.isErr()) {\r\n return new Err(res.error);\r\n }\r\n var newValue = f(res.value);\r\n return newValue instanceof ResultAsync ? newValue._promise : newValue;\r\n }));\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\r\n ResultAsync.prototype.orElse = function (f) {\r\n var _this = this;\r\n return new ResultAsync(this._promise.then(function (res) { return __awaiter(_this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n if (res.isErr()) {\r\n return [2 /*return*/, f(res.error)];\r\n }\r\n return [2 /*return*/, new Ok(res.value)];\r\n });\r\n }); }));\r\n };\r\n ResultAsync.prototype.match = function (ok, _err) {\r\n return this._promise.then(function (res) { return res.match(ok, _err); });\r\n };\r\n ResultAsync.prototype.unwrapOr = function (t) {\r\n return this._promise.then(function (res) { return res.unwrapOr(t); });\r\n };\r\n // Makes ResultAsync implement PromiseLike\r\n ResultAsync.prototype.then = function (successCallback, failureCallback) {\r\n return this._promise.then(successCallback, failureCallback);\r\n };\r\n return ResultAsync;\r\n}());\r\nvar okAsync = function (value) {\r\n return new ResultAsync(Promise.resolve(new Ok(value)));\r\n};\r\nvar errAsync = function (err) {\r\n return new ResultAsync(Promise.resolve(new Err(err)));\r\n};\r\nvar fromPromise = ResultAsync.fromPromise;\r\nvar fromSafePromise = ResultAsync.fromSafePromise;\n\nvar appendValueToEndOfList = function (value) { return function (list) { return __spreadArray(__spreadArray([], __read(list), false), [value], false); }; };\r\n/**\r\n * Short circuits on the FIRST Err value that we find\r\n */\r\nvar combineResultList = function (resultList) {\r\n return resultList.reduce(function (acc, result) {\r\n return acc.isOk()\r\n ? result.isErr()\r\n ? err(result.error)\r\n : acc.map(appendValueToEndOfList(result.value))\r\n : acc;\r\n }, ok([]));\r\n};\r\n/* This is the typesafe version of Promise.all\r\n *\r\n * Takes a list of ResultAsync and success if all inner results are Ok values\r\n * or fails if one (or more) of the inner results are Err values\r\n */\r\nvar combineResultAsyncList = function (asyncResultList) {\r\n return ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultList);\r\n};\r\n/**\r\n * Give a list of all the errors we find\r\n */\r\nvar combineResultListWithAllErrors = function (resultList) {\r\n return resultList.reduce(function (acc, result) {\r\n return result.isErr()\r\n ? acc.isErr()\r\n ? err(__spreadArray(__spreadArray([], __read(acc.error), false), [result.error], false))\r\n : err([result.error])\r\n : acc.isErr()\r\n ? acc\r\n : ok(__spreadArray(__spreadArray([], __read(acc.value), false), [result.value], false));\r\n }, ok([]));\r\n};\r\nvar combineResultAsyncListWithAllErrors = function (asyncResultList) {\r\n return ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultListWithAllErrors);\r\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\r\nvar Result;\r\n(function (Result) {\r\n /**\r\n * Wraps a function with a try catch, creating a new function with the same\r\n * arguments but returning `Ok` if successful, `Err` if the function throws\r\n *\r\n * @param fn function to wrap with ok on success or err on failure\r\n * @param errorFn when an error is thrown, this will wrap the error result if provided\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n function fromThrowable(fn, errorFn) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n try {\r\n var result = fn.apply(void 0, __spreadArray([], __read(args), false));\r\n return ok(result);\r\n }\r\n catch (e) {\r\n return err(errorFn ? errorFn(e) : e);\r\n }\r\n };\r\n }\r\n Result.fromThrowable = fromThrowable;\r\n function combine(resultList) {\r\n return combineResultList(resultList);\r\n }\r\n Result.combine = combine;\r\n function combineWithAllErrors(resultList) {\r\n return combineResultListWithAllErrors(resultList);\r\n }\r\n Result.combineWithAllErrors = combineWithAllErrors;\r\n})(Result || (Result = {}));\r\nvar ok = function (value) { return new Ok(value); };\r\nvar err = function (err) { return new Err(err); };\r\nvar Ok = /** @class */ (function () {\r\n function Ok(value) {\r\n this.value = value;\r\n }\r\n Ok.prototype.isOk = function () {\r\n return true;\r\n };\r\n Ok.prototype.isErr = function () {\r\n return !this.isOk();\r\n };\r\n Ok.prototype.map = function (f) {\r\n return ok(f(this.value));\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n Ok.prototype.mapErr = function (_f) {\r\n return ok(this.value);\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\r\n Ok.prototype.andThen = function (f) {\r\n return f(this.value);\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\r\n Ok.prototype.orElse = function (_f) {\r\n return ok(this.value);\r\n };\r\n Ok.prototype.asyncAndThen = function (f) {\r\n return f(this.value);\r\n };\r\n Ok.prototype.asyncMap = function (f) {\r\n return ResultAsync.fromSafePromise(f(this.value));\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n Ok.prototype.unwrapOr = function (_v) {\r\n return this.value;\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n Ok.prototype.match = function (ok, _err) {\r\n return ok(this.value);\r\n };\r\n Ok.prototype._unsafeUnwrap = function (_) {\r\n return this.value;\r\n };\r\n Ok.prototype._unsafeUnwrapErr = function (config) {\r\n throw createNeverThrowError('Called `_unsafeUnwrapErr` on an Ok', this, config);\r\n };\r\n return Ok;\r\n}());\r\nvar Err = /** @class */ (function () {\r\n function Err(error) {\r\n this.error = error;\r\n }\r\n Err.prototype.isOk = function () {\r\n return false;\r\n };\r\n Err.prototype.isErr = function () {\r\n return !this.isOk();\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n Err.prototype.map = function (_f) {\r\n return err(this.error);\r\n };\r\n Err.prototype.mapErr = function (f) {\r\n return err(f(this.error));\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\r\n Err.prototype.andThen = function (_f) {\r\n return err(this.error);\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\r\n Err.prototype.orElse = function (f) {\r\n return f(this.error);\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n Err.prototype.asyncAndThen = function (_f) {\r\n return errAsync(this.error);\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n Err.prototype.asyncMap = function (_f) {\r\n return errAsync(this.error);\r\n };\r\n Err.prototype.unwrapOr = function (v) {\r\n return v;\r\n };\r\n Err.prototype.match = function (_ok, err) {\r\n return err(this.error);\r\n };\r\n Err.prototype._unsafeUnwrap = function (config) {\r\n throw createNeverThrowError('Called `_unsafeUnwrap` on an Err', this, config);\r\n };\r\n Err.prototype._unsafeUnwrapErr = function (_) {\r\n return this.error;\r\n };\r\n return Err;\r\n}());\r\nvar fromThrowable = Result.fromThrowable;\r\n//#endregion\n\nexport { Err, Ok, Result, ResultAsync, err, errAsync, fromPromise, fromSafePromise, fromThrowable, ok, okAsync };\n", null, null, null, null, null, null, null, null, "import {Constructor} from './constructor'\nimport {attr} from '@github/catalyst'\nimport {emitEvent} from '@qni/common'\n\nexport declare class Activateable {\n get active(): boolean\n set active(value: boolean)\n activate(): void\n deactivate(): void\n}\n\nexport function ActivateableMixin>(\n Base: TBase,\n): Constructor & TBase {\n class ActivateableMixinClass extends Base {\n @attr active = false\n\n activate() {\n this.active = true\n emitEvent('activateable:active', {}, this)\n }\n\n deactivate() {\n this.active = false\n }\n }\n\n return ActivateableMixinClass as Constructor & TBase\n}\n", "import {Constructor} from './constructor'\nimport {attr} from '@github/catalyst'\n\nexport declare class Angleable {\n get angle(): string\n set angle(value: string)\n get reducedAngle(): string\n set reducedAngle(value: string)\n}\n\nexport const isAngleable = (arg: unknown): arg is Angleable =>\n typeof arg === 'object' &&\n arg !== null &&\n typeof (arg as Angleable).angle === 'string' &&\n typeof (arg as Angleable).reducedAngle === 'string'\n\nexport function AngleableMixin>(Base: TBase): Constructor & TBase {\n class AngleableMixinClass extends Base {\n @attr angle = ''\n @attr reducedAngle = ''\n }\n\n return AngleableMixinClass as Constructor & TBase\n}\n", "import {Constructor} from './constructor'\n\nexport declare class Controllable {\n get controls(): number[]\n set controls(value: number[])\n get antiControls(): number[]\n set antiControls(value: number[])\n get isControlled(): boolean\n get isAntiControlled(): boolean\n}\n\nexport const isControllable = (arg: unknown): arg is Controllable =>\n typeof arg === 'object' && arg !== null && typeof (arg as Controllable).controls === 'object'\n\nexport function ControllableMixin>(\n Base: TBase,\n): Constructor & TBase {\n class ControllableMixinClass extends Base {\n get controls(): number[] {\n const dataControls = this.getAttribute('data-controls')\n if (dataControls === null) return []\n if (dataControls === '') return []\n\n return dataControls\n .split(',')\n .map(each => parseInt(each))\n .sort()\n }\n\n set controls(controls: number[]) {\n this.setAttribute('data-controls', controls.sort().join())\n }\n\n get antiControls(): number[] {\n const dataAntiControls = this.getAttribute('data-anti-controls')\n if (dataAntiControls === null) return []\n if (dataAntiControls === '') return []\n\n return dataAntiControls\n .split(',')\n .map(each => parseInt(each))\n .sort()\n }\n\n set antiControls(antiControls: number[]) {\n this.setAttribute('data-anti-controls', antiControls.sort().join())\n }\n\n get isControlled(): boolean {\n return this.controls.length > 0\n }\n\n get isAntiControlled(): boolean {\n return this.antiControls.length > 0\n }\n }\n\n return ControllableMixinClass as Constructor & TBase\n}\n", "import {Constructor} from './constructor'\nimport {attr} from '@github/catalyst'\n\nexport declare class Disableable {\n get disabled(): boolean\n set disabled(value: boolean)\n get enabled(): boolean\n enable(): void\n disable(): void\n}\n\nexport function DisableableMixin>(\n Base: TBase,\n): Constructor & TBase {\n class DisableableMixinClass extends Base {\n @attr disabled = false\n\n get enabled(): boolean {\n return !this.disabled\n }\n\n enable(): void {\n this.disabled = false\n }\n\n disable(): void {\n this.disabled = true\n }\n }\n\n return DisableableMixinClass as Constructor & TBase\n}\n", "/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nfunction __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nfunction __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\n\nexport { __assign, __read, __rest, __spreadArray, __values };\n", "var ActionTypes;\n\n(function (ActionTypes) {\n ActionTypes[\"Start\"] = \"xstate.start\";\n ActionTypes[\"Stop\"] = \"xstate.stop\";\n ActionTypes[\"Raise\"] = \"xstate.raise\";\n ActionTypes[\"Send\"] = \"xstate.send\";\n ActionTypes[\"Cancel\"] = \"xstate.cancel\";\n ActionTypes[\"NullEvent\"] = \"\";\n ActionTypes[\"Assign\"] = \"xstate.assign\";\n ActionTypes[\"After\"] = \"xstate.after\";\n ActionTypes[\"DoneState\"] = \"done.state\";\n ActionTypes[\"DoneInvoke\"] = \"done.invoke\";\n ActionTypes[\"Log\"] = \"xstate.log\";\n ActionTypes[\"Init\"] = \"xstate.init\";\n ActionTypes[\"Invoke\"] = \"xstate.invoke\";\n ActionTypes[\"ErrorExecution\"] = \"error.execution\";\n ActionTypes[\"ErrorCommunication\"] = \"error.communication\";\n ActionTypes[\"ErrorPlatform\"] = \"error.platform\";\n ActionTypes[\"ErrorCustom\"] = \"xstate.error\";\n ActionTypes[\"Update\"] = \"xstate.update\";\n ActionTypes[\"Pure\"] = \"xstate.pure\";\n ActionTypes[\"Choose\"] = \"xstate.choose\";\n})(ActionTypes || (ActionTypes = {}));\n\nvar SpecialTargets;\n\n(function (SpecialTargets) {\n SpecialTargets[\"Parent\"] = \"#_parent\";\n SpecialTargets[\"Internal\"] = \"#_internal\";\n})(SpecialTargets || (SpecialTargets = {}));\n\nexport { ActionTypes, SpecialTargets };\n", "import { ActionTypes } from './types.js';\n\nvar start = ActionTypes.Start;\nvar stop = ActionTypes.Stop;\nvar raise = ActionTypes.Raise;\nvar send = ActionTypes.Send;\nvar cancel = ActionTypes.Cancel;\nvar nullEvent = ActionTypes.NullEvent;\nvar assign = ActionTypes.Assign;\nvar after = ActionTypes.After;\nvar doneState = ActionTypes.DoneState;\nvar log = ActionTypes.Log;\nvar init = ActionTypes.Init;\nvar invoke = ActionTypes.Invoke;\nvar errorExecution = ActionTypes.ErrorExecution;\nvar errorPlatform = ActionTypes.ErrorPlatform;\nvar error = ActionTypes.ErrorCustom;\nvar update = ActionTypes.Update;\nvar choose = ActionTypes.Choose;\nvar pure = ActionTypes.Pure;\n\nexport { after, assign, cancel, choose, doneState, error, errorExecution, errorPlatform, init, invoke, log, nullEvent, pure, raise, send, start, stop, update };\n", "var STATE_DELIMITER = '.';\nvar EMPTY_ACTIVITY_MAP = {};\nvar DEFAULT_GUARD_TYPE = 'xstate.guard';\nvar TARGETLESS_KEY = '';\n\nexport { DEFAULT_GUARD_TYPE, EMPTY_ACTIVITY_MAP, STATE_DELIMITER, TARGETLESS_KEY };\n", "var IS_PRODUCTION = process.env.NODE_ENV === 'production';\n\nexport { IS_PRODUCTION };\n", "import { __values, __spreadArray, __read, __assign } from './_virtual/_tslib.js';\nimport { SpecialTargets } from './types.js';\nimport { raise, send } from './actionTypes.js';\nimport { DEFAULT_GUARD_TYPE, TARGETLESS_KEY, STATE_DELIMITER } from './constants.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nvar _a;\nfunction keys(value) {\n return Object.keys(value);\n}\nfunction matchesState(parentStateId, childStateId, delimiter) {\n if (delimiter === void 0) {\n delimiter = STATE_DELIMITER;\n }\n\n var parentStateValue = toStateValue(parentStateId, delimiter);\n var childStateValue = toStateValue(childStateId, delimiter);\n\n if (isString(childStateValue)) {\n if (isString(parentStateValue)) {\n return childStateValue === parentStateValue;\n } // Parent more specific than child\n\n\n return false;\n }\n\n if (isString(parentStateValue)) {\n return parentStateValue in childStateValue;\n }\n\n return Object.keys(parentStateValue).every(function (key) {\n if (!(key in childStateValue)) {\n return false;\n }\n\n return matchesState(parentStateValue[key], childStateValue[key]);\n });\n}\nfunction getEventType(event) {\n try {\n return isString(event) || typeof event === 'number' ? \"\".concat(event) : event.type;\n } catch (e) {\n throw new Error('Events must be strings or objects with a string event.type property.');\n }\n}\nfunction getActionType(action) {\n try {\n return isString(action) || typeof action === 'number' ? \"\".concat(action) : isFunction(action) ? action.name : action.type;\n } catch (e) {\n throw new Error('Actions must be strings or objects with a string action.type property.');\n }\n}\nfunction toStatePath(stateId, delimiter) {\n try {\n if (isArray(stateId)) {\n return stateId;\n }\n\n return stateId.toString().split(delimiter);\n } catch (e) {\n throw new Error(\"'\".concat(stateId, \"' is not a valid state path.\"));\n }\n}\nfunction isStateLike(state) {\n return typeof state === 'object' && 'value' in state && 'context' in state && 'event' in state && '_event' in state;\n}\nfunction toStateValue(stateValue, delimiter) {\n if (isStateLike(stateValue)) {\n return stateValue.value;\n }\n\n if (isArray(stateValue)) {\n return pathToStateValue(stateValue);\n }\n\n if (typeof stateValue !== 'string') {\n return stateValue;\n }\n\n var statePath = toStatePath(stateValue, delimiter);\n return pathToStateValue(statePath);\n}\nfunction pathToStateValue(statePath) {\n if (statePath.length === 1) {\n return statePath[0];\n }\n\n var value = {};\n var marker = value;\n\n for (var i = 0; i < statePath.length - 1; i++) {\n if (i === statePath.length - 2) {\n marker[statePath[i]] = statePath[i + 1];\n } else {\n marker[statePath[i]] = {};\n marker = marker[statePath[i]];\n }\n }\n\n return value;\n}\nfunction mapValues(collection, iteratee) {\n var result = {};\n var collectionKeys = Object.keys(collection);\n\n for (var i = 0; i < collectionKeys.length; i++) {\n var key = collectionKeys[i];\n result[key] = iteratee(collection[key], key, collection, i);\n }\n\n return result;\n}\nfunction mapFilterValues(collection, iteratee, predicate) {\n var e_1, _a;\n\n var result = {};\n\n try {\n for (var _b = __values(Object.keys(collection)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var item = collection[key];\n\n if (!predicate(item)) {\n continue;\n }\n\n result[key] = iteratee(item, key, collection);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return result;\n}\n/**\r\n * Retrieves a value at the given path.\r\n * @param props The deep path to the prop of the desired value\r\n */\n\nvar path = function (props) {\n return function (object) {\n var e_2, _a;\n\n var result = object;\n\n try {\n for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {\n var prop = props_1_1.value;\n result = result[prop];\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n return result;\n };\n};\n/**\r\n * Retrieves a value at the given path via the nested accessor prop.\r\n * @param props The deep path to the prop of the desired value\r\n */\n\nfunction nestedPath(props, accessorProp) {\n return function (object) {\n var e_3, _a;\n\n var result = object;\n\n try {\n for (var props_2 = __values(props), props_2_1 = props_2.next(); !props_2_1.done; props_2_1 = props_2.next()) {\n var prop = props_2_1.value;\n result = result[accessorProp][prop];\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (props_2_1 && !props_2_1.done && (_a = props_2.return)) _a.call(props_2);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n return result;\n };\n}\nfunction toStatePaths(stateValue) {\n if (!stateValue) {\n return [[]];\n }\n\n if (isString(stateValue)) {\n return [[stateValue]];\n }\n\n var result = flatten(Object.keys(stateValue).map(function (key) {\n var subStateValue = stateValue[key];\n\n if (typeof subStateValue !== 'string' && (!subStateValue || !Object.keys(subStateValue).length)) {\n return [[key]];\n }\n\n return toStatePaths(stateValue[key]).map(function (subPath) {\n return [key].concat(subPath);\n });\n }));\n return result;\n}\nfunction pathsToStateValue(paths) {\n var e_4, _a;\n\n var result = {};\n\n if (paths && paths.length === 1 && paths[0].length === 1) {\n return paths[0][0];\n }\n\n try {\n for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {\n var currentPath = paths_1_1.value;\n var marker = result; // tslint:disable-next-line:prefer-for-of\n\n for (var i = 0; i < currentPath.length; i++) {\n var subPath = currentPath[i];\n\n if (i === currentPath.length - 2) {\n marker[subPath] = currentPath[i + 1];\n break;\n }\n\n marker[subPath] = marker[subPath] || {};\n marker = marker[subPath];\n }\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n return result;\n}\nfunction flatten(array) {\n var _a;\n\n return (_a = []).concat.apply(_a, __spreadArray([], __read(array), false));\n}\nfunction toArrayStrict(value) {\n if (isArray(value)) {\n return value;\n }\n\n return [value];\n}\nfunction toArray(value) {\n if (value === undefined) {\n return [];\n }\n\n return toArrayStrict(value);\n}\nfunction mapContext(mapper, context, _event) {\n var e_5, _a;\n\n if (isFunction(mapper)) {\n return mapper(context, _event.data);\n }\n\n var result = {};\n\n try {\n for (var _b = __values(Object.keys(mapper)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var subMapper = mapper[key];\n\n if (isFunction(subMapper)) {\n result[key] = subMapper(context, _event.data);\n } else {\n result[key] = subMapper;\n }\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n return result;\n}\nfunction isBuiltInEvent(eventType) {\n return /^(done|error)\\./.test(eventType);\n}\nfunction isPromiseLike(value) {\n if (value instanceof Promise) {\n return true;\n } // Check if shape matches the Promise/A+ specification for a \"thenable\".\n\n\n if (value !== null && (isFunction(value) || typeof value === 'object') && isFunction(value.then)) {\n return true;\n }\n\n return false;\n}\nfunction isBehavior(value) {\n return value !== null && typeof value === 'object' && 'transition' in value && typeof value.transition === 'function';\n}\nfunction partition(items, predicate) {\n var e_6, _a;\n\n var _b = __read([[], []], 2),\n truthy = _b[0],\n falsy = _b[1];\n\n try {\n for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {\n var item = items_1_1.value;\n\n if (predicate(item)) {\n truthy.push(item);\n } else {\n falsy.push(item);\n }\n }\n } catch (e_6_1) {\n e_6 = {\n error: e_6_1\n };\n } finally {\n try {\n if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);\n } finally {\n if (e_6) throw e_6.error;\n }\n }\n\n return [truthy, falsy];\n}\nfunction updateHistoryStates(hist, stateValue) {\n return mapValues(hist.states, function (subHist, key) {\n if (!subHist) {\n return undefined;\n }\n\n var subStateValue = (isString(stateValue) ? undefined : stateValue[key]) || (subHist ? subHist.current : undefined);\n\n if (!subStateValue) {\n return undefined;\n }\n\n return {\n current: subStateValue,\n states: updateHistoryStates(subHist, subStateValue)\n };\n });\n}\nfunction updateHistoryValue(hist, stateValue) {\n return {\n current: stateValue,\n states: updateHistoryStates(hist, stateValue)\n };\n}\nfunction updateContext(context, _event, assignActions, state) {\n if (!IS_PRODUCTION) {\n warn(!!context, 'Attempting to update undefined context');\n }\n\n var updatedContext = context ? assignActions.reduce(function (acc, assignAction) {\n var e_7, _a;\n\n var assignment = assignAction.assignment;\n var meta = {\n state: state,\n action: assignAction,\n _event: _event\n };\n var partialUpdate = {};\n\n if (isFunction(assignment)) {\n partialUpdate = assignment(acc, _event.data, meta);\n } else {\n try {\n for (var _b = __values(Object.keys(assignment)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var propAssignment = assignment[key];\n partialUpdate[key] = isFunction(propAssignment) ? propAssignment(acc, _event.data, meta) : propAssignment;\n }\n } catch (e_7_1) {\n e_7 = {\n error: e_7_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_7) throw e_7.error;\n }\n }\n }\n\n return Object.assign({}, acc, partialUpdate);\n }, context) : context;\n return updatedContext;\n} // tslint:disable-next-line:no-empty\n\nvar warn = function () {};\n\nif (!IS_PRODUCTION) {\n warn = function (condition, message) {\n var error = condition instanceof Error ? condition : undefined;\n\n if (!error && condition) {\n return;\n }\n\n if (console !== undefined) {\n var args = [\"Warning: \".concat(message)];\n\n if (error) {\n args.push(error);\n } // tslint:disable-next-line:no-console\n\n\n console.warn.apply(console, args);\n }\n };\n}\nfunction isArray(value) {\n return Array.isArray(value);\n} // tslint:disable-next-line:ban-types\n\nfunction isFunction(value) {\n return typeof value === 'function';\n}\nfunction isString(value) {\n return typeof value === 'string';\n}\nfunction toGuard(condition, guardMap) {\n if (!condition) {\n return undefined;\n }\n\n if (isString(condition)) {\n return {\n type: DEFAULT_GUARD_TYPE,\n name: condition,\n predicate: guardMap ? guardMap[condition] : undefined\n };\n }\n\n if (isFunction(condition)) {\n return {\n type: DEFAULT_GUARD_TYPE,\n name: condition.name,\n predicate: condition\n };\n }\n\n return condition;\n}\nfunction isObservable(value) {\n try {\n return 'subscribe' in value && isFunction(value.subscribe);\n } catch (e) {\n return false;\n }\n}\nvar symbolObservable = /*#__PURE__*/function () {\n return typeof Symbol === 'function' && Symbol.observable || '@@observable';\n}(); // TODO: to be removed in v5, left it out just to minimize the scope of the change and maintain compatibility with older versions of integration paackages\n\nvar interopSymbols = (_a = {}, _a[symbolObservable] = function () {\n return this;\n}, _a[Symbol.observable] = function () {\n return this;\n}, _a);\nfunction isMachine(value) {\n return !!value && '__xstatenode' in value;\n}\nfunction isActor(value) {\n return !!value && typeof value.send === 'function';\n}\nvar uniqueId = /*#__PURE__*/function () {\n var currentId = 0;\n return function () {\n currentId++;\n return currentId.toString(16);\n };\n}();\nfunction toEventObject(event, payload // id?: TEvent['type']\n) {\n if (isString(event) || typeof event === 'number') {\n return __assign({\n type: event\n }, payload);\n }\n\n return event;\n}\nfunction toSCXMLEvent(event, scxmlEvent) {\n if (!isString(event) && '$$type' in event && event.$$type === 'scxml') {\n return event;\n }\n\n var eventObject = toEventObject(event);\n return __assign({\n name: eventObject.type,\n data: eventObject,\n $$type: 'scxml',\n type: 'external'\n }, scxmlEvent);\n}\nfunction toTransitionConfigArray(event, configLike) {\n var transitions = toArrayStrict(configLike).map(function (transitionLike) {\n if (typeof transitionLike === 'undefined' || typeof transitionLike === 'string' || isMachine(transitionLike)) {\n return {\n target: transitionLike,\n event: event\n };\n }\n\n return __assign(__assign({}, transitionLike), {\n event: event\n });\n });\n return transitions;\n}\nfunction normalizeTarget(target) {\n if (target === undefined || target === TARGETLESS_KEY) {\n return undefined;\n }\n\n return toArray(target);\n}\nfunction reportUnhandledExceptionOnInvocation(originalError, currentError, id) {\n if (!IS_PRODUCTION) {\n var originalStackTrace = originalError.stack ? \" Stacktrace was '\".concat(originalError.stack, \"'\") : '';\n\n if (originalError === currentError) {\n // tslint:disable-next-line:no-console\n console.error(\"Missing onError handler for invocation '\".concat(id, \"', error was '\").concat(originalError, \"'.\").concat(originalStackTrace));\n } else {\n var stackTrace = currentError.stack ? \" Stacktrace was '\".concat(currentError.stack, \"'\") : ''; // tslint:disable-next-line:no-console\n\n console.error(\"Missing onError handler and/or unhandled exception/promise rejection for invocation '\".concat(id, \"'. \") + \"Original error: '\".concat(originalError, \"'. \").concat(originalStackTrace, \" Current error is '\").concat(currentError, \"'.\").concat(stackTrace));\n }\n }\n}\nfunction evaluateGuard(machine, guard, context, _event, state) {\n var guards = machine.options.guards;\n var guardMeta = {\n state: state,\n cond: guard,\n _event: _event\n }; // TODO: do not hardcode!\n\n if (guard.type === DEFAULT_GUARD_TYPE) {\n return ((guards === null || guards === void 0 ? void 0 : guards[guard.name]) || guard.predicate)(context, _event.data, guardMeta);\n }\n\n var condFn = guards === null || guards === void 0 ? void 0 : guards[guard.type];\n\n if (!condFn) {\n throw new Error(\"Guard '\".concat(guard.type, \"' is not implemented on machine '\").concat(machine.id, \"'.\"));\n }\n\n return condFn(context, _event.data, guardMeta);\n}\nfunction toInvokeSource(src) {\n if (typeof src === 'string') {\n return {\n type: src\n };\n }\n\n return src;\n}\nfunction toObserver(nextHandler, errorHandler, completionHandler) {\n var noop = function () {};\n\n var isObserver = typeof nextHandler === 'object';\n var self = isObserver ? nextHandler : null;\n return {\n next: ((isObserver ? nextHandler.next : nextHandler) || noop).bind(self),\n error: ((isObserver ? nextHandler.error : errorHandler) || noop).bind(self),\n complete: ((isObserver ? nextHandler.complete : completionHandler) || noop).bind(self)\n };\n}\nfunction createInvokeId(stateNodeId, index) {\n return \"\".concat(stateNodeId, \":invocation[\").concat(index, \"]\");\n}\nfunction isRaisableAction(action) {\n return (action.type === raise || action.type === send && action.to === SpecialTargets.Internal) && typeof action.delay !== 'number';\n}\n\nexport { createInvokeId, evaluateGuard, flatten, getActionType, getEventType, interopSymbols, isActor, isArray, isBehavior, isBuiltInEvent, isFunction, isMachine, isObservable, isPromiseLike, isRaisableAction, isStateLike, isString, keys, mapContext, mapFilterValues, mapValues, matchesState, nestedPath, normalizeTarget, partition, path, pathToStateValue, pathsToStateValue, reportUnhandledExceptionOnInvocation, symbolObservable, toArray, toArrayStrict, toEventObject, toGuard, toInvokeSource, toObserver, toSCXMLEvent, toStatePath, toStatePaths, toStateValue, toTransitionConfigArray, uniqueId, updateContext, updateHistoryStates, updateHistoryValue, warn };\n", "import { __assign, __spreadArray, __read, __values } from './_virtual/_tslib.js';\nimport { SpecialTargets, ActionTypes } from './types.js';\nimport { init, raise as raise$1, send as send$1, update, log as log$1, cancel as cancel$1, assign as assign$1, error as error$1, stop as stop$1, pure as pure$1, choose as choose$1 } from './actionTypes.js';\nimport * as actionTypes from './actionTypes.js';\nexport { actionTypes };\nimport { toSCXMLEvent, isString, isFunction, toEventObject, getEventType, updateContext, flatten, isArray, toArray, toGuard, evaluateGuard, warn } from './utils.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nvar initEvent = /*#__PURE__*/toSCXMLEvent({\n type: init\n});\nfunction getActionFunction(actionType, actionFunctionMap) {\n return actionFunctionMap ? actionFunctionMap[actionType] || undefined : undefined;\n}\nfunction toActionObject(action, actionFunctionMap) {\n var actionObject;\n\n if (isString(action) || typeof action === 'number') {\n var exec = getActionFunction(action, actionFunctionMap);\n\n if (isFunction(exec)) {\n actionObject = {\n type: action,\n exec: exec\n };\n } else if (exec) {\n actionObject = exec;\n } else {\n actionObject = {\n type: action,\n exec: undefined\n };\n }\n } else if (isFunction(action)) {\n actionObject = {\n // Convert action to string if unnamed\n type: action.name || action.toString(),\n exec: action\n };\n } else {\n var exec = getActionFunction(action.type, actionFunctionMap);\n\n if (isFunction(exec)) {\n actionObject = __assign(__assign({}, action), {\n exec: exec\n });\n } else if (exec) {\n var actionType = exec.type || action.type;\n actionObject = __assign(__assign(__assign({}, exec), action), {\n type: actionType\n });\n } else {\n actionObject = action;\n }\n }\n\n return actionObject;\n}\nvar toActionObjects = function (action, actionFunctionMap) {\n if (!action) {\n return [];\n }\n\n var actions = isArray(action) ? action : [action];\n return actions.map(function (subAction) {\n return toActionObject(subAction, actionFunctionMap);\n });\n};\nfunction toActivityDefinition(action) {\n var actionObject = toActionObject(action);\n return __assign(__assign({\n id: isString(action) ? action : actionObject.id\n }, actionObject), {\n type: actionObject.type\n });\n}\n/**\r\n * Raises an event. This places the event in the internal event queue, so that\r\n * the event is immediately consumed by the machine in the current step.\r\n *\r\n * @param eventType The event to raise.\r\n */\n\nfunction raise(event, options) {\n return {\n type: raise$1,\n event: typeof event === 'function' ? event : toEventObject(event),\n delay: options ? options.delay : undefined,\n id: options === null || options === void 0 ? void 0 : options.id\n };\n}\nfunction resolveRaise(action, ctx, _event, delaysMap) {\n var meta = {\n _event: _event\n };\n var resolvedEvent = toSCXMLEvent(isFunction(action.event) ? action.event(ctx, _event.data, meta) : action.event);\n var resolvedDelay;\n\n if (isString(action.delay)) {\n var configDelay = delaysMap && delaysMap[action.delay];\n resolvedDelay = isFunction(configDelay) ? configDelay(ctx, _event.data, meta) : configDelay;\n } else {\n resolvedDelay = isFunction(action.delay) ? action.delay(ctx, _event.data, meta) : action.delay;\n }\n\n return __assign(__assign({}, action), {\n type: raise$1,\n _event: resolvedEvent,\n delay: resolvedDelay\n });\n}\n/**\r\n * Sends an event. This returns an action that will be read by an interpreter to\r\n * send the event in the next step, after the current step is finished executing.\r\n *\r\n * @deprecated Use the `sendTo(...)` action creator instead.\r\n *\r\n * @param event The event to send.\r\n * @param options Options to pass into the send event:\r\n * - `id` - The unique send event identifier (used with `cancel()`).\r\n * - `delay` - The number of milliseconds to delay the sending of the event.\r\n * - `to` - The target of this event (by default, the machine the event was sent from).\r\n */\n\nfunction send(event, options) {\n return {\n to: options ? options.to : undefined,\n type: send$1,\n event: isFunction(event) ? event : toEventObject(event),\n delay: options ? options.delay : undefined,\n // TODO: don't auto-generate IDs here like that\n // there is too big chance of the ID collision\n id: options && options.id !== undefined ? options.id : isFunction(event) ? event.name : getEventType(event)\n };\n}\nfunction resolveSend(action, ctx, _event, delaysMap) {\n var meta = {\n _event: _event\n }; // TODO: helper function for resolving Expr\n\n var resolvedEvent = toSCXMLEvent(isFunction(action.event) ? action.event(ctx, _event.data, meta) : action.event);\n var resolvedDelay;\n\n if (isString(action.delay)) {\n var configDelay = delaysMap && delaysMap[action.delay];\n resolvedDelay = isFunction(configDelay) ? configDelay(ctx, _event.data, meta) : configDelay;\n } else {\n resolvedDelay = isFunction(action.delay) ? action.delay(ctx, _event.data, meta) : action.delay;\n }\n\n var resolvedTarget = isFunction(action.to) ? action.to(ctx, _event.data, meta) : action.to;\n return __assign(__assign({}, action), {\n to: resolvedTarget,\n _event: resolvedEvent,\n event: resolvedEvent.data,\n delay: resolvedDelay\n });\n}\n/**\r\n * Sends an event to this machine's parent.\r\n *\r\n * @param event The event to send to the parent machine.\r\n * @param options Options to pass into the send event.\r\n */\n\nfunction sendParent(event, options) {\n return send(event, __assign(__assign({}, options), {\n to: SpecialTargets.Parent\n }));\n}\n/**\r\n * Sends an event to an actor.\r\n *\r\n * @param actor The `ActorRef` to send the event to.\r\n * @param event The event to send, or an expression that evaluates to the event to send\r\n * @param options Send action options\r\n * @returns An XState send action object\r\n */\n\nfunction sendTo(actor, event, options) {\n return send(event, __assign(__assign({}, options), {\n to: actor\n }));\n}\n/**\r\n * Sends an update event to this machine's parent.\r\n */\n\nfunction sendUpdate() {\n return sendParent(update);\n}\n/**\r\n * Sends an event back to the sender of the original event.\r\n *\r\n * @param event The event to send back to the sender\r\n * @param options Options to pass into the send event\r\n */\n\nfunction respond(event, options) {\n return send(event, __assign(__assign({}, options), {\n to: function (_, __, _a) {\n var _event = _a._event;\n return _event.origin; // TODO: handle when _event.origin is undefined\n }\n }));\n}\n\nvar defaultLogExpr = function (context, event) {\n return {\n context: context,\n event: event\n };\n};\n/**\r\n *\r\n * @param expr The expression function to evaluate which will be logged.\r\n * Takes in 2 arguments:\r\n * - `ctx` - the current state context\r\n * - `event` - the event that caused this action to be executed.\r\n * @param label The label to give to the logged expression.\r\n */\n\n\nfunction log(expr, label) {\n if (expr === void 0) {\n expr = defaultLogExpr;\n }\n\n return {\n type: log$1,\n label: label,\n expr: expr\n };\n}\nvar resolveLog = function (action, ctx, _event) {\n return __assign(__assign({}, action), {\n value: isString(action.expr) ? action.expr : action.expr(ctx, _event.data, {\n _event: _event\n })\n });\n};\n/**\r\n * Cancels an in-flight `send(...)` action. A canceled sent action will not\r\n * be executed, nor will its event be sent, unless it has already been sent\r\n * (e.g., if `cancel(...)` is called after the `send(...)` action's `delay`).\r\n *\r\n * @param sendId The `id` of the `send(...)` action to cancel.\r\n */\n\nvar cancel = function (sendId) {\n return {\n type: cancel$1,\n sendId: sendId\n };\n};\n/**\r\n * Starts an activity.\r\n *\r\n * @param activity The activity to start.\r\n */\n\nfunction start(activity) {\n var activityDef = toActivityDefinition(activity);\n return {\n type: ActionTypes.Start,\n activity: activityDef,\n exec: undefined\n };\n}\n/**\r\n * Stops an activity.\r\n *\r\n * @param actorRef The activity to stop.\r\n */\n\nfunction stop(actorRef) {\n var activity = isFunction(actorRef) ? actorRef : toActivityDefinition(actorRef);\n return {\n type: ActionTypes.Stop,\n activity: activity,\n exec: undefined\n };\n}\nfunction resolveStop(action, context, _event) {\n var actorRefOrString = isFunction(action.activity) ? action.activity(context, _event.data) : action.activity;\n var resolvedActorRef = typeof actorRefOrString === 'string' ? {\n id: actorRefOrString\n } : actorRefOrString;\n var actionObject = {\n type: ActionTypes.Stop,\n activity: resolvedActorRef\n };\n return actionObject;\n}\n/**\r\n * Updates the current context of the machine.\r\n *\r\n * @param assignment An object that represents the partial context to update.\r\n */\n\nvar assign = function (assignment) {\n return {\n type: assign$1,\n assignment: assignment\n };\n};\nfunction isActionObject(action) {\n return typeof action === 'object' && 'type' in action;\n}\n/**\r\n * Returns an event type that represents an implicit event that\r\n * is sent after the specified `delay`.\r\n *\r\n * @param delayRef The delay in milliseconds\r\n * @param id The state node ID where this event is handled\r\n */\n\nfunction after(delayRef, id) {\n var idSuffix = id ? \"#\".concat(id) : '';\n return \"\".concat(ActionTypes.After, \"(\").concat(delayRef, \")\").concat(idSuffix);\n}\n/**\r\n * Returns an event that represents that a final state node\r\n * has been reached in the parent state node.\r\n *\r\n * @param id The final state node's parent state node `id`\r\n * @param data The data to pass into the event\r\n */\n\nfunction done(id, data) {\n var type = \"\".concat(ActionTypes.DoneState, \".\").concat(id);\n var eventObject = {\n type: type,\n data: data\n };\n\n eventObject.toString = function () {\n return type;\n };\n\n return eventObject;\n}\n/**\r\n * Returns an event that represents that an invoked service has terminated.\r\n *\r\n * An invoked service is terminated when it has reached a top-level final state node,\r\n * but not when it is canceled.\r\n *\r\n * @param id The final state node ID\r\n * @param data The data to pass into the event\r\n */\n\nfunction doneInvoke(id, data) {\n var type = \"\".concat(ActionTypes.DoneInvoke, \".\").concat(id);\n var eventObject = {\n type: type,\n data: data\n };\n\n eventObject.toString = function () {\n return type;\n };\n\n return eventObject;\n}\nfunction error(id, data) {\n var type = \"\".concat(ActionTypes.ErrorPlatform, \".\").concat(id);\n var eventObject = {\n type: type,\n data: data\n };\n\n eventObject.toString = function () {\n return type;\n };\n\n return eventObject;\n}\nfunction pure(getActions) {\n return {\n type: ActionTypes.Pure,\n get: getActions\n };\n}\n/**\r\n * Forwards (sends) an event to a specified service.\r\n *\r\n * @param target The target service to forward the event to.\r\n * @param options Options to pass into the send action creator.\r\n */\n\nfunction forwardTo(target, options) {\n if (!IS_PRODUCTION && (!target || typeof target === 'function')) {\n var originalTarget_1 = target;\n\n target = function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n var resolvedTarget = typeof originalTarget_1 === 'function' ? originalTarget_1.apply(void 0, __spreadArray([], __read(args), false)) : originalTarget_1;\n\n if (!resolvedTarget) {\n throw new Error(\"Attempted to forward event to undefined actor. This risks an infinite loop in the sender.\");\n }\n\n return resolvedTarget;\n };\n }\n\n return send(function (_, event) {\n return event;\n }, __assign(__assign({}, options), {\n to: target\n }));\n}\n/**\r\n * Escalates an error by sending it as an event to this machine's parent.\r\n *\r\n * @param errorData The error data to send, or the expression function that\r\n * takes in the `context`, `event`, and `meta`, and returns the error data to send.\r\n * @param options Options to pass into the send action creator.\r\n */\n\nfunction escalate(errorData, options) {\n return sendParent(function (context, event, meta) {\n return {\n type: error$1,\n data: isFunction(errorData) ? errorData(context, event, meta) : errorData\n };\n }, __assign(__assign({}, options), {\n to: SpecialTargets.Parent\n }));\n}\nfunction choose(conds) {\n return {\n type: ActionTypes.Choose,\n conds: conds\n };\n}\n\nvar pluckAssigns = function (actionBlocks) {\n var e_1, _a;\n\n var assignActions = [];\n\n try {\n for (var actionBlocks_1 = __values(actionBlocks), actionBlocks_1_1 = actionBlocks_1.next(); !actionBlocks_1_1.done; actionBlocks_1_1 = actionBlocks_1.next()) {\n var block = actionBlocks_1_1.value;\n var i = 0;\n\n while (i < block.actions.length) {\n if (block.actions[i].type === assign$1) {\n assignActions.push(block.actions[i]);\n block.actions.splice(i, 1);\n continue;\n }\n\n i++;\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (actionBlocks_1_1 && !actionBlocks_1_1.done && (_a = actionBlocks_1.return)) _a.call(actionBlocks_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return assignActions;\n};\n\nfunction resolveActions(machine, currentState, currentContext, _event, actionBlocks, predictableExec, preserveActionOrder) {\n if (preserveActionOrder === void 0) {\n preserveActionOrder = false;\n }\n\n var assignActions = preserveActionOrder ? [] : pluckAssigns(actionBlocks);\n var updatedContext = assignActions.length ? updateContext(currentContext, _event, assignActions, currentState) : currentContext;\n var preservedContexts = preserveActionOrder ? [currentContext] : undefined;\n var deferredToBlockEnd = [];\n\n function handleAction(blockType, actionObject) {\n var _a;\n\n switch (actionObject.type) {\n case raise$1:\n {\n var raisedAction = resolveRaise(actionObject, updatedContext, _event, machine.options.delays);\n\n if (predictableExec && typeof raisedAction.delay === 'number') {\n predictableExec(raisedAction, updatedContext, _event);\n }\n\n return raisedAction;\n }\n\n case send$1:\n var sendAction = resolveSend(actionObject, updatedContext, _event, machine.options.delays); // TODO: fix ActionTypes.Init\n\n if (!IS_PRODUCTION) {\n var configuredDelay = actionObject.delay; // warn after resolving as we can create better contextual message here\n\n warn(!isString(configuredDelay) || typeof sendAction.delay === 'number', // tslint:disable-next-line:max-line-length\n \"No delay reference for delay expression '\".concat(configuredDelay, \"' was found on machine '\").concat(machine.id, \"'\"));\n }\n\n if (predictableExec && sendAction.to !== SpecialTargets.Internal) {\n if (blockType === 'entry') {\n deferredToBlockEnd.push(sendAction);\n } else {\n predictableExec(sendAction, updatedContext, _event);\n }\n }\n\n return sendAction;\n\n case log$1:\n {\n var resolved = resolveLog(actionObject, updatedContext, _event);\n predictableExec === null || predictableExec === void 0 ? void 0 : predictableExec(resolved, updatedContext, _event);\n return resolved;\n }\n\n case choose$1:\n {\n var chooseAction = actionObject;\n var matchedActions = (_a = chooseAction.conds.find(function (condition) {\n var guard = toGuard(condition.cond, machine.options.guards);\n return !guard || evaluateGuard(machine, guard, updatedContext, _event, !predictableExec ? currentState : undefined);\n })) === null || _a === void 0 ? void 0 : _a.actions;\n\n if (!matchedActions) {\n return [];\n }\n\n var _b = __read(resolveActions(machine, currentState, updatedContext, _event, [{\n type: blockType,\n actions: toActionObjects(toArray(matchedActions), machine.options.actions)\n }], predictableExec, preserveActionOrder), 2),\n resolvedActionsFromChoose = _b[0],\n resolvedContextFromChoose = _b[1];\n\n updatedContext = resolvedContextFromChoose;\n preservedContexts === null || preservedContexts === void 0 ? void 0 : preservedContexts.push(updatedContext);\n return resolvedActionsFromChoose;\n }\n\n case pure$1:\n {\n var matchedActions = actionObject.get(updatedContext, _event.data);\n\n if (!matchedActions) {\n return [];\n }\n\n var _c = __read(resolveActions(machine, currentState, updatedContext, _event, [{\n type: blockType,\n actions: toActionObjects(toArray(matchedActions), machine.options.actions)\n }], predictableExec, preserveActionOrder), 2),\n resolvedActionsFromPure = _c[0],\n resolvedContext = _c[1];\n\n updatedContext = resolvedContext;\n preservedContexts === null || preservedContexts === void 0 ? void 0 : preservedContexts.push(updatedContext);\n return resolvedActionsFromPure;\n }\n\n case stop$1:\n {\n var resolved = resolveStop(actionObject, updatedContext, _event);\n predictableExec === null || predictableExec === void 0 ? void 0 : predictableExec(resolved, currentContext, _event);\n return resolved;\n }\n\n case assign$1:\n {\n updatedContext = updateContext(updatedContext, _event, [actionObject], !predictableExec ? currentState : undefined);\n preservedContexts === null || preservedContexts === void 0 ? void 0 : preservedContexts.push(updatedContext);\n break;\n }\n\n default:\n var resolvedActionObject = toActionObject(actionObject, machine.options.actions);\n var exec_1 = resolvedActionObject.exec;\n\n if (predictableExec) {\n predictableExec(resolvedActionObject, updatedContext, _event);\n } else if (exec_1 && preservedContexts) {\n var contextIndex_1 = preservedContexts.length - 1;\n\n var wrapped = __assign(__assign({}, resolvedActionObject), {\n exec: function (_ctx) {\n var args = [];\n\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n\n exec_1.apply(void 0, __spreadArray([preservedContexts[contextIndex_1]], __read(args), false));\n }\n });\n\n resolvedActionObject = wrapped;\n }\n\n return resolvedActionObject;\n }\n }\n\n function processBlock(block) {\n var e_2, _a;\n\n var resolvedActions = [];\n\n try {\n for (var _b = __values(block.actions), _c = _b.next(); !_c.done; _c = _b.next()) {\n var action = _c.value;\n var resolved = handleAction(block.type, action);\n\n if (resolved) {\n resolvedActions = resolvedActions.concat(resolved);\n }\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n deferredToBlockEnd.forEach(function (action) {\n predictableExec(action, updatedContext, _event);\n });\n deferredToBlockEnd.length = 0;\n return resolvedActions;\n }\n\n var resolvedActions = flatten(actionBlocks.map(processBlock));\n return [resolvedActions, updatedContext];\n}\n\nexport { after, assign, cancel, choose, done, doneInvoke, error, escalate, forwardTo, getActionFunction, initEvent, isActionObject, log, pure, raise, resolveActions, resolveLog, resolveRaise, resolveSend, resolveStop, respond, send, sendParent, sendTo, sendUpdate, start, stop, toActionObject, toActionObjects, toActivityDefinition };\n", "/**\r\n * Maintains a stack of the current service in scope.\r\n * This is used to provide the correct service to spawn().\r\n */\nvar serviceStack = [];\nvar provide = function (service, fn) {\n serviceStack.push(service);\n var result = fn(service);\n serviceStack.pop();\n return result;\n};\nvar consume = function (fn) {\n return fn(serviceStack[serviceStack.length - 1]);\n};\n\nexport { consume, provide };\n", "import { __assign } from './_virtual/_tslib.js';\nimport { symbolObservable, toInvokeSource, mapContext, isMachine } from './utils.js';\nimport { provide } from './serviceScope.js';\n\nfunction createNullActor(id) {\n var _a;\n\n return _a = {\n id: id,\n send: function () {\n return void 0;\n },\n subscribe: function () {\n return {\n unsubscribe: function () {\n return void 0;\n }\n };\n },\n getSnapshot: function () {\n return undefined;\n },\n toJSON: function () {\n return {\n id: id\n };\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a;\n}\n/**\r\n * Creates a deferred actor that is able to be invoked given the provided\r\n * invocation information in its `.meta` value.\r\n *\r\n * @param invokeDefinition The meta information needed to invoke the actor.\r\n */\n\nfunction createInvocableActor(invokeDefinition, machine, context, _event) {\n var _a;\n\n var invokeSrc = toInvokeSource(invokeDefinition.src);\n var serviceCreator = (_a = machine === null || machine === void 0 ? void 0 : machine.options.services) === null || _a === void 0 ? void 0 : _a[invokeSrc.type];\n var resolvedData = invokeDefinition.data ? mapContext(invokeDefinition.data, context, _event) : undefined;\n var tempActor = serviceCreator ? createDeferredActor(serviceCreator, invokeDefinition.id, resolvedData) : createNullActor(invokeDefinition.id); // @ts-ignore\n\n tempActor.meta = invokeDefinition;\n return tempActor;\n}\nfunction createDeferredActor(entity, id, data) {\n var tempActor = createNullActor(id); // @ts-ignore\n\n tempActor.deferred = true;\n\n if (isMachine(entity)) {\n // \"mute\" the existing service scope so potential spawned actors within the `.initialState` stay deferred here\n var initialState_1 = tempActor.state = provide(undefined, function () {\n return (data ? entity.withContext(data) : entity).initialState;\n });\n\n tempActor.getSnapshot = function () {\n return initialState_1;\n };\n }\n\n return tempActor;\n}\nfunction isActor(item) {\n try {\n return typeof item.send === 'function';\n } catch (e) {\n return false;\n }\n}\nfunction isSpawnedActor(item) {\n return isActor(item) && 'id' in item;\n} // TODO: refactor the return type, this could be written in a better way but it's best to avoid unneccessary breaking changes now\n\nfunction toActorRef(actorRefLike) {\n var _a;\n\n return __assign((_a = {\n subscribe: function () {\n return {\n unsubscribe: function () {\n return void 0;\n }\n };\n },\n id: 'anonymous',\n getSnapshot: function () {\n return undefined;\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a), actorRefLike);\n}\n\nexport { createDeferredActor, createInvocableActor, createNullActor, isActor, isSpawnedActor, toActorRef };\n", "import { __values, __spreadArray, __read } from './_virtual/_tslib.js';\nimport { flatten } from './utils.js';\n\nvar isLeafNode = function (stateNode) {\n return stateNode.type === 'atomic' || stateNode.type === 'final';\n};\nfunction getAllChildren(stateNode) {\n return Object.keys(stateNode.states).map(function (key) {\n return stateNode.states[key];\n });\n}\nfunction getChildren(stateNode) {\n return getAllChildren(stateNode).filter(function (sn) {\n return sn.type !== 'history';\n });\n}\nfunction getAllStateNodes(stateNode) {\n var stateNodes = [stateNode];\n\n if (isLeafNode(stateNode)) {\n return stateNodes;\n }\n\n return stateNodes.concat(flatten(getChildren(stateNode).map(getAllStateNodes)));\n}\nfunction getConfiguration(prevStateNodes, stateNodes) {\n var e_1, _a, e_2, _b, e_3, _c, e_4, _d;\n\n var prevConfiguration = new Set(prevStateNodes);\n var prevAdjList = getAdjList(prevConfiguration);\n var configuration = new Set(stateNodes);\n\n try {\n // add all ancestors\n for (var configuration_1 = __values(configuration), configuration_1_1 = configuration_1.next(); !configuration_1_1.done; configuration_1_1 = configuration_1.next()) {\n var s = configuration_1_1.value;\n var m = s.parent;\n\n while (m && !configuration.has(m)) {\n configuration.add(m);\n m = m.parent;\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (configuration_1_1 && !configuration_1_1.done && (_a = configuration_1.return)) _a.call(configuration_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n var adjList = getAdjList(configuration);\n\n try {\n // add descendants\n for (var configuration_2 = __values(configuration), configuration_2_1 = configuration_2.next(); !configuration_2_1.done; configuration_2_1 = configuration_2.next()) {\n var s = configuration_2_1.value; // if previously active, add existing child nodes\n\n if (s.type === 'compound' && (!adjList.get(s) || !adjList.get(s).length)) {\n if (prevAdjList.get(s)) {\n prevAdjList.get(s).forEach(function (sn) {\n return configuration.add(sn);\n });\n } else {\n s.initialStateNodes.forEach(function (sn) {\n return configuration.add(sn);\n });\n }\n } else {\n if (s.type === 'parallel') {\n try {\n for (var _e = (e_3 = void 0, __values(getChildren(s))), _f = _e.next(); !_f.done; _f = _e.next()) {\n var child = _f.value;\n\n if (!configuration.has(child)) {\n configuration.add(child);\n\n if (prevAdjList.get(child)) {\n prevAdjList.get(child).forEach(function (sn) {\n return configuration.add(sn);\n });\n } else {\n child.initialStateNodes.forEach(function (sn) {\n return configuration.add(sn);\n });\n }\n }\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (_f && !_f.done && (_c = _e.return)) _c.call(_e);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n }\n }\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (configuration_2_1 && !configuration_2_1.done && (_b = configuration_2.return)) _b.call(configuration_2);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n try {\n // add all ancestors\n for (var configuration_3 = __values(configuration), configuration_3_1 = configuration_3.next(); !configuration_3_1.done; configuration_3_1 = configuration_3.next()) {\n var s = configuration_3_1.value;\n var m = s.parent;\n\n while (m && !configuration.has(m)) {\n configuration.add(m);\n m = m.parent;\n }\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (configuration_3_1 && !configuration_3_1.done && (_d = configuration_3.return)) _d.call(configuration_3);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n return configuration;\n}\n\nfunction getValueFromAdj(baseNode, adjList) {\n var childStateNodes = adjList.get(baseNode);\n\n if (!childStateNodes) {\n return {}; // todo: fix?\n }\n\n if (baseNode.type === 'compound') {\n var childStateNode = childStateNodes[0];\n\n if (childStateNode) {\n if (isLeafNode(childStateNode)) {\n return childStateNode.key;\n }\n } else {\n return {};\n }\n }\n\n var stateValue = {};\n childStateNodes.forEach(function (csn) {\n stateValue[csn.key] = getValueFromAdj(csn, adjList);\n });\n return stateValue;\n}\n\nfunction getAdjList(configuration) {\n var e_5, _a;\n\n var adjList = new Map();\n\n try {\n for (var configuration_4 = __values(configuration), configuration_4_1 = configuration_4.next(); !configuration_4_1.done; configuration_4_1 = configuration_4.next()) {\n var s = configuration_4_1.value;\n\n if (!adjList.has(s)) {\n adjList.set(s, []);\n }\n\n if (s.parent) {\n if (!adjList.has(s.parent)) {\n adjList.set(s.parent, []);\n }\n\n adjList.get(s.parent).push(s);\n }\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (configuration_4_1 && !configuration_4_1.done && (_a = configuration_4.return)) _a.call(configuration_4);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n return adjList;\n}\nfunction getValue(rootNode, configuration) {\n var config = getConfiguration([rootNode], configuration);\n return getValueFromAdj(rootNode, getAdjList(config));\n}\nfunction has(iterable, item) {\n if (Array.isArray(iterable)) {\n return iterable.some(function (member) {\n return member === item;\n });\n }\n\n if (iterable instanceof Set) {\n return iterable.has(item);\n }\n\n return false; // TODO: fix\n}\nfunction nextEvents(configuration) {\n return __spreadArray([], __read(new Set(flatten(__spreadArray([], __read(configuration.map(function (sn) {\n return sn.ownEvents;\n })), false)))), false);\n}\nfunction isInFinalState(configuration, stateNode) {\n if (stateNode.type === 'compound') {\n return getChildren(stateNode).some(function (s) {\n return s.type === 'final' && has(configuration, s);\n });\n }\n\n if (stateNode.type === 'parallel') {\n return getChildren(stateNode).every(function (sn) {\n return isInFinalState(configuration, sn);\n });\n }\n\n return false;\n}\nfunction getMeta(configuration) {\n if (configuration === void 0) {\n configuration = [];\n }\n\n return configuration.reduce(function (acc, stateNode) {\n if (stateNode.meta !== undefined) {\n acc[stateNode.id] = stateNode.meta;\n }\n\n return acc;\n }, {});\n}\nfunction getTagsFromConfiguration(configuration) {\n return new Set(flatten(configuration.map(function (sn) {\n return sn.tags;\n })));\n}\n\nexport { getAdjList, getAllChildren, getAllStateNodes, getChildren, getConfiguration, getMeta, getTagsFromConfiguration, getValue, has, isInFinalState, isLeafNode, nextEvents };\n", "import { __assign, __spreadArray, __read, __rest } from './_virtual/_tslib.js';\nimport { EMPTY_ACTIVITY_MAP } from './constants.js';\nimport { isString, matchesState, warn } from './utils.js';\nimport { getMeta, nextEvents } from './stateUtils.js';\nimport { initEvent } from './actions.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nfunction stateValuesEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (a === undefined || b === undefined) {\n return false;\n }\n\n if (isString(a) || isString(b)) {\n return a === b;\n }\n\n var aKeys = Object.keys(a);\n var bKeys = Object.keys(b);\n return aKeys.length === bKeys.length && aKeys.every(function (key) {\n return stateValuesEqual(a[key], b[key]);\n });\n}\nfunction isStateConfig(state) {\n if (typeof state !== 'object' || state === null) {\n return false;\n }\n\n return 'value' in state && '_event' in state;\n}\n/**\r\n * @deprecated Use `isStateConfig(object)` or `state instanceof State` instead.\r\n */\n\nvar isState = isStateConfig;\nfunction bindActionToState(action, state) {\n var exec = action.exec;\n\n var boundAction = __assign(__assign({}, action), {\n exec: exec !== undefined ? function () {\n return exec(state.context, state.event, {\n action: action,\n state: state,\n _event: state._event\n });\n } : undefined\n });\n\n return boundAction;\n}\n\nvar State =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n /**\r\n * Creates a new State instance.\r\n * @param value The state value\r\n * @param context The extended state\r\n * @param historyValue The tree representing historical values of the state nodes\r\n * @param history The previous state\r\n * @param actions An array of action objects to execute as side-effects\r\n * @param activities A mapping of activities and whether they are started (`true`) or stopped (`false`).\r\n * @param meta\r\n * @param events Internal event queue. Should be empty with run-to-completion semantics.\r\n * @param configuration\r\n */\n function State(config) {\n var _this = this;\n\n var _a;\n\n this.actions = [];\n this.activities = EMPTY_ACTIVITY_MAP;\n this.meta = {};\n this.events = [];\n this.value = config.value;\n this.context = config.context;\n this._event = config._event;\n this._sessionid = config._sessionid;\n this.event = this._event.data;\n this.historyValue = config.historyValue;\n this.history = config.history;\n this.actions = config.actions || [];\n this.activities = config.activities || EMPTY_ACTIVITY_MAP;\n this.meta = getMeta(config.configuration);\n this.events = config.events || [];\n this.matches = this.matches.bind(this);\n this.toStrings = this.toStrings.bind(this);\n this.configuration = config.configuration;\n this.transitions = config.transitions;\n this.children = config.children;\n this.done = !!config.done;\n this.tags = (_a = Array.isArray(config.tags) ? new Set(config.tags) : config.tags) !== null && _a !== void 0 ? _a : new Set();\n this.machine = config.machine;\n Object.defineProperty(this, 'nextEvents', {\n get: function () {\n return nextEvents(_this.configuration);\n }\n });\n }\n /**\r\n * Creates a new State instance for the given `stateValue` and `context`.\r\n * @param stateValue\r\n * @param context\r\n */\n\n\n State.from = function (stateValue, context) {\n if (stateValue instanceof State) {\n if (stateValue.context !== context) {\n return new State({\n value: stateValue.value,\n context: context,\n _event: stateValue._event,\n _sessionid: null,\n historyValue: stateValue.historyValue,\n history: stateValue.history,\n actions: [],\n activities: stateValue.activities,\n meta: {},\n events: [],\n configuration: [],\n transitions: [],\n children: {}\n });\n }\n\n return stateValue;\n }\n\n var _event = initEvent;\n return new State({\n value: stateValue,\n context: context,\n _event: _event,\n _sessionid: null,\n historyValue: undefined,\n history: undefined,\n actions: [],\n activities: undefined,\n meta: undefined,\n events: [],\n configuration: [],\n transitions: [],\n children: {}\n });\n };\n /**\r\n * Creates a new State instance for the given `config`.\r\n * @param config The state config\r\n */\n\n\n State.create = function (config) {\n return new State(config);\n };\n /**\r\n * Creates a new `State` instance for the given `stateValue` and `context` with no actions (side-effects).\r\n * @param stateValue\r\n * @param context\r\n */\n\n\n State.inert = function (stateValue, context) {\n if (stateValue instanceof State) {\n if (!stateValue.actions.length) {\n return stateValue;\n }\n\n var _event = initEvent;\n return new State({\n value: stateValue.value,\n context: context,\n _event: _event,\n _sessionid: null,\n historyValue: stateValue.historyValue,\n history: stateValue.history,\n activities: stateValue.activities,\n configuration: stateValue.configuration,\n transitions: [],\n children: {}\n });\n }\n\n return State.from(stateValue, context);\n };\n /**\r\n * Returns an array of all the string leaf state node paths.\r\n * @param stateValue\r\n * @param delimiter The character(s) that separate each subpath in the string state node path.\r\n */\n\n\n State.prototype.toStrings = function (stateValue, delimiter) {\n var _this = this;\n\n if (stateValue === void 0) {\n stateValue = this.value;\n }\n\n if (delimiter === void 0) {\n delimiter = '.';\n }\n\n if (isString(stateValue)) {\n return [stateValue];\n }\n\n var valueKeys = Object.keys(stateValue);\n return valueKeys.concat.apply(valueKeys, __spreadArray([], __read(valueKeys.map(function (key) {\n return _this.toStrings(stateValue[key], delimiter).map(function (s) {\n return key + delimiter + s;\n });\n })), false));\n };\n\n State.prototype.toJSON = function () {\n var _a = this;\n _a.configuration;\n _a.transitions;\n var tags = _a.tags;\n _a.machine;\n var jsonValues = __rest(_a, [\"configuration\", \"transitions\", \"tags\", \"machine\"]);\n\n return __assign(__assign({}, jsonValues), {\n tags: Array.from(tags)\n });\n };\n\n State.prototype.matches = function (parentStateValue) {\n return matchesState(parentStateValue, this.value);\n };\n /**\r\n * Whether the current state configuration has a state node with the specified `tag`.\r\n * @param tag\r\n */\n\n\n State.prototype.hasTag = function (tag) {\n return this.tags.has(tag);\n };\n /**\r\n * Determines whether sending the `event` will cause a non-forbidden transition\r\n * to be selected, even if the transitions have no actions nor\r\n * change the state value.\r\n *\r\n * @param event The event to test\r\n * @returns Whether the event will cause a transition\r\n */\n\n\n State.prototype.can = function (event) {\n var _a;\n\n if (IS_PRODUCTION) {\n warn(!!this.machine, \"state.can(...) used outside of a machine-created State object; this will always return false.\");\n }\n\n var transitionData = (_a = this.machine) === null || _a === void 0 ? void 0 : _a.getTransitionData(this, event);\n return !!(transitionData === null || transitionData === void 0 ? void 0 : transitionData.transitions.length) && // Check that at least one transition is not forbidden\n transitionData.transitions.some(function (t) {\n return t.target !== undefined || t.actions.length;\n });\n };\n\n return State;\n}();\n\nexport { State, bindActionToState, isState, isStateConfig, stateValuesEqual };\n", "import { __assign } from './_virtual/_tslib.js';\n\nvar defaultOptions = {\n deferEvents: false\n};\n\nvar Scheduler =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n function Scheduler(options) {\n this.processingEvent = false;\n this.queue = [];\n this.initialized = false;\n this.options = __assign(__assign({}, defaultOptions), options);\n }\n\n Scheduler.prototype.initialize = function (callback) {\n this.initialized = true;\n\n if (callback) {\n if (!this.options.deferEvents) {\n this.schedule(callback);\n return;\n }\n\n this.process(callback);\n }\n\n this.flushEvents();\n };\n\n Scheduler.prototype.schedule = function (task) {\n if (!this.initialized || this.processingEvent) {\n this.queue.push(task);\n return;\n }\n\n if (this.queue.length !== 0) {\n throw new Error('Event queue should be empty when it is not processing events');\n }\n\n this.process(task);\n this.flushEvents();\n };\n\n Scheduler.prototype.clear = function () {\n this.queue = [];\n };\n\n Scheduler.prototype.flushEvents = function () {\n var nextCallback = this.queue.shift();\n\n while (nextCallback) {\n this.process(nextCallback);\n nextCallback = this.queue.shift();\n }\n };\n\n Scheduler.prototype.process = function (callback) {\n this.processingEvent = true;\n\n try {\n callback();\n } catch (e) {\n // there is no use to keep the future events\n // as the situation is not anymore the same\n this.clear();\n throw e;\n } finally {\n this.processingEvent = false;\n }\n };\n\n return Scheduler;\n}();\n\nexport { Scheduler };\n", "var children = /*#__PURE__*/new Map();\nvar sessionIdIndex = 0;\nvar registry = {\n bookId: function () {\n return \"x:\".concat(sessionIdIndex++);\n },\n register: function (id, actor) {\n children.set(id, actor);\n return id;\n },\n get: function (id) {\n return children.get(id);\n },\n free: function (id) {\n children.delete(id);\n }\n};\n\nexport { registry };\n", "import { IS_PRODUCTION } from './environment.js';\n\nfunction getGlobal() {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n }\n\n if (typeof self !== 'undefined') {\n return self;\n }\n\n if (typeof window !== 'undefined') {\n return window;\n }\n\n if (typeof global !== 'undefined') {\n return global;\n }\n\n if (!IS_PRODUCTION) {\n console.warn('XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues');\n }\n}\n\nfunction getDevTools() {\n var global = getGlobal();\n\n if (global && '__xstate__' in global) {\n return global.__xstate__;\n }\n\n return undefined;\n}\n\nfunction registerService(service) {\n if (!getGlobal()) {\n return;\n }\n\n var devTools = getDevTools();\n\n if (devTools) {\n devTools.register(service);\n }\n}\n\nexport { getGlobal, registerService };\n", "import { error, doneInvoke } from './actions.js';\nimport { toActorRef } from './Actor.js';\nimport { toObserver } from './utils.js';\n\n/**\r\n * Returns an actor behavior from a reducer and its initial state.\r\n *\r\n * @param transition The pure reducer that returns the next state given the current state and event.\r\n * @param initialState The initial state of the reducer.\r\n * @returns An actor behavior\r\n */\n\nfunction fromReducer(transition, initialState) {\n return {\n transition: transition,\n initialState: initialState\n };\n}\nfunction fromPromise(promiseFn) {\n var initialState = {\n error: undefined,\n data: undefined,\n status: 'pending'\n };\n return {\n transition: function (state, event, _a) {\n var parent = _a.parent,\n id = _a.id,\n observers = _a.observers;\n\n switch (event.type) {\n case 'fulfill':\n parent === null || parent === void 0 ? void 0 : parent.send(doneInvoke(id, event.data));\n return {\n error: undefined,\n data: event.data,\n status: 'fulfilled'\n };\n\n case 'reject':\n parent === null || parent === void 0 ? void 0 : parent.send(error(id, event.error));\n observers.forEach(function (observer) {\n observer.error(event.error);\n });\n return {\n error: event.error,\n data: undefined,\n status: 'rejected'\n };\n\n default:\n return state;\n }\n },\n initialState: initialState,\n start: function (_a) {\n var self = _a.self;\n promiseFn().then(function (data) {\n self.send({\n type: 'fulfill',\n data: data\n });\n }, function (reason) {\n self.send({\n type: 'reject',\n error: reason\n });\n });\n return initialState;\n }\n };\n}\nfunction spawnBehavior(behavior, options) {\n if (options === void 0) {\n options = {};\n }\n\n var state = behavior.initialState;\n var observers = new Set();\n var mailbox = [];\n var flushing = false;\n\n var flush = function () {\n if (flushing) {\n return;\n }\n\n flushing = true;\n\n while (mailbox.length > 0) {\n var event_1 = mailbox.shift();\n state = behavior.transition(state, event_1, actorCtx);\n observers.forEach(function (observer) {\n return observer.next(state);\n });\n }\n\n flushing = false;\n };\n\n var actor = toActorRef({\n id: options.id,\n send: function (event) {\n mailbox.push(event);\n flush();\n },\n getSnapshot: function () {\n return state;\n },\n subscribe: function (next, handleError, complete) {\n var observer = toObserver(next, handleError, complete);\n observers.add(observer);\n observer.next(state);\n return {\n unsubscribe: function () {\n observers.delete(observer);\n }\n };\n }\n });\n var actorCtx = {\n parent: options.parent,\n self: actor,\n id: options.id || 'anonymous',\n observers: observers\n };\n state = behavior.start ? behavior.start(actorCtx) : state;\n return actor;\n}\n\nexport { fromPromise, fromReducer, spawnBehavior };\n", "import { __values, __spreadArray, __read, __assign } from './_virtual/_tslib.js';\nimport { SpecialTargets, ActionTypes } from './types.js';\nimport { isStateConfig, State, bindActionToState } from './State.js';\nimport { errorPlatform, update, error as error$1, log, stop, start, cancel, send, raise } from './actionTypes.js';\nimport { initEvent, doneInvoke, toActionObjects, resolveActions, error, getActionFunction } from './actions.js';\nimport { IS_PRODUCTION } from './environment.js';\nimport { warn, mapContext, toObserver, isFunction, toSCXMLEvent, flatten, isRaisableAction, isPromiseLike, isObservable, isMachine, isBehavior, reportUnhandledExceptionOnInvocation, symbolObservable, isArray, toEventObject, isString, isActor, toInvokeSource, uniqueId } from './utils.js';\nimport { Scheduler } from './scheduler.js';\nimport { createDeferredActor, isSpawnedActor } from './Actor.js';\nimport { registry } from './registry.js';\nimport { getGlobal, registerService } from './devTools.js';\nimport { provide, consume } from './serviceScope.js';\nimport { spawnBehavior } from './behaviors.js';\n\nvar DEFAULT_SPAWN_OPTIONS = {\n sync: false,\n autoForward: false\n};\nvar InterpreterStatus;\n\n(function (InterpreterStatus) {\n InterpreterStatus[InterpreterStatus[\"NotStarted\"] = 0] = \"NotStarted\";\n InterpreterStatus[InterpreterStatus[\"Running\"] = 1] = \"Running\";\n InterpreterStatus[InterpreterStatus[\"Stopped\"] = 2] = \"Stopped\";\n})(InterpreterStatus || (InterpreterStatus = {}));\n\nvar Interpreter =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n /**\r\n * Creates a new Interpreter instance (i.e., service) for the given machine with the provided options, if any.\r\n *\r\n * @param machine The machine to be interpreted\r\n * @param options Interpreter options\r\n */\n function Interpreter(machine, options) {\n if (options === void 0) {\n options = Interpreter.defaultOptions;\n }\n\n var _this = this;\n\n this.machine = machine;\n this.delayedEventsMap = {};\n this.listeners = new Set();\n this.contextListeners = new Set();\n this.stopListeners = new Set();\n this.doneListeners = new Set();\n this.eventListeners = new Set();\n this.sendListeners = new Set();\n /**\r\n * Whether the service is started.\r\n */\n\n this.initialized = false;\n this.status = InterpreterStatus.NotStarted;\n this.children = new Map();\n this.forwardTo = new Set();\n this._outgoingQueue = [];\n /**\r\n * Alias for Interpreter.prototype.start\r\n */\n\n this.init = this.start;\n /**\r\n * Sends an event to the running interpreter to trigger a transition.\r\n *\r\n * An array of events (batched) can be sent as well, which will send all\r\n * batched events to the running interpreter. The listeners will be\r\n * notified only **once** when all events are processed.\r\n *\r\n * @param event The event(s) to send\r\n */\n\n this.send = function (event, payload) {\n if (isArray(event)) {\n _this.batch(event);\n\n return _this.state;\n }\n\n var _event = toSCXMLEvent(toEventObject(event, payload));\n\n if (_this.status === InterpreterStatus.Stopped) {\n // do nothing\n if (!IS_PRODUCTION) {\n warn(false, \"Event \\\"\".concat(_event.name, \"\\\" was sent to stopped service \\\"\").concat(_this.machine.id, \"\\\". This service has already reached its final state, and will not transition.\\nEvent: \").concat(JSON.stringify(_event.data)));\n }\n\n return _this.state;\n }\n\n if (_this.status !== InterpreterStatus.Running && !_this.options.deferEvents) {\n throw new Error(\"Event \\\"\".concat(_event.name, \"\\\" was sent to uninitialized service \\\"\").concat(_this.machine.id // tslint:disable-next-line:max-line-length\n , \"\\\". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\\nEvent: \").concat(JSON.stringify(_event.data)));\n }\n\n _this.scheduler.schedule(function () {\n // Forward copy of event to child actors\n _this.forward(_event);\n\n var nextState = _this._nextState(_event);\n\n _this.update(nextState, _event);\n });\n\n return _this._state; // TODO: deprecate (should return void)\n // tslint:disable-next-line:semicolon\n };\n\n this.sendTo = function (event, to, immediate) {\n var isParent = _this.parent && (to === SpecialTargets.Parent || _this.parent.id === to);\n var target = isParent ? _this.parent : isString(to) ? to === SpecialTargets.Internal ? _this : _this.children.get(to) || registry.get(to) : isActor(to) ? to : undefined;\n\n if (!target) {\n if (!isParent) {\n throw new Error(\"Unable to send event to child '\".concat(to, \"' from service '\").concat(_this.id, \"'.\"));\n } // tslint:disable-next-line:no-console\n\n\n if (!IS_PRODUCTION) {\n warn(false, \"Service '\".concat(_this.id, \"' has no parent: unable to send event \").concat(event.type));\n }\n\n return;\n }\n\n if ('machine' in target) {\n // perhaps those events should be rejected in the parent\n // but atm it doesn't have easy access to all of the information that is required to do it reliably\n if (_this.status !== InterpreterStatus.Stopped || _this.parent !== target || // we need to send events to the parent from exit handlers of a machine that reached its final state\n _this.state.done) {\n // Send SCXML events to machines\n var scxmlEvent = __assign(__assign({}, event), {\n name: event.name === error$1 ? \"\".concat(error(_this.id)) : event.name,\n origin: _this.sessionId\n });\n\n if (!immediate && _this.machine.config.predictableActionArguments) {\n _this._outgoingQueue.push([target, scxmlEvent]);\n } else {\n target.send(scxmlEvent);\n }\n }\n } else {\n // Send normal events to other targets\n if (!immediate && _this.machine.config.predictableActionArguments) {\n _this._outgoingQueue.push([target, event.data]);\n } else {\n target.send(event.data);\n }\n }\n };\n\n this._exec = function (action, context, _event, actionFunctionMap) {\n if (actionFunctionMap === void 0) {\n actionFunctionMap = _this.machine.options.actions;\n }\n\n var actionOrExec = action.exec || getActionFunction(action.type, actionFunctionMap);\n var exec = isFunction(actionOrExec) ? actionOrExec : actionOrExec ? actionOrExec.exec : action.exec;\n\n if (exec) {\n try {\n return exec(context, _event.data, !_this.machine.config.predictableActionArguments ? {\n action: action,\n state: _this.state,\n _event: _event\n } : {\n action: action,\n _event: _event\n });\n } catch (err) {\n if (_this.parent) {\n _this.parent.send({\n type: 'xstate.error',\n data: err\n });\n }\n\n throw err;\n }\n }\n\n switch (action.type) {\n case raise:\n {\n // if raise action reached the interpreter then it's a delayed one\n var sendAction_1 = action;\n\n _this.defer(sendAction_1);\n\n break;\n }\n\n case send:\n var sendAction = action;\n\n if (typeof sendAction.delay === 'number') {\n _this.defer(sendAction);\n\n return;\n } else {\n if (sendAction.to) {\n _this.sendTo(sendAction._event, sendAction.to, _event === initEvent);\n } else {\n _this.send(sendAction._event);\n }\n }\n\n break;\n\n case cancel:\n _this.cancel(action.sendId);\n\n break;\n\n case start:\n {\n if (_this.status !== InterpreterStatus.Running) {\n return;\n }\n\n var activity = action.activity; // If the activity will be stopped right after it's started\n // (such as in transient states)\n // don't bother starting the activity.\n\n if ( // in v4 with `predictableActionArguments` invokes are called eagerly when the `this.state` still points to the previous state\n !_this.machine.config.predictableActionArguments && !_this.state.activities[activity.id || activity.type]) {\n break;\n } // Invoked services\n\n\n if (activity.type === ActionTypes.Invoke) {\n var invokeSource = toInvokeSource(activity.src);\n var serviceCreator = _this.machine.options.services ? _this.machine.options.services[invokeSource.type] : undefined;\n var id = activity.id,\n data = activity.data;\n\n if (!IS_PRODUCTION) {\n warn(!('forward' in activity), // tslint:disable-next-line:max-line-length\n \"`forward` property is deprecated (found in invocation of '\".concat(activity.src, \"' in in machine '\").concat(_this.machine.id, \"'). \") + \"Please use `autoForward` instead.\");\n }\n\n var autoForward = 'autoForward' in activity ? activity.autoForward : !!activity.forward;\n\n if (!serviceCreator) {\n // tslint:disable-next-line:no-console\n if (!IS_PRODUCTION) {\n warn(false, \"No service found for invocation '\".concat(activity.src, \"' in machine '\").concat(_this.machine.id, \"'.\"));\n }\n\n return;\n }\n\n var resolvedData = data ? mapContext(data, context, _event) : undefined;\n\n if (typeof serviceCreator === 'string') {\n // TODO: warn\n return;\n }\n\n var source = isFunction(serviceCreator) ? serviceCreator(context, _event.data, {\n data: resolvedData,\n src: invokeSource,\n meta: activity.meta\n }) : serviceCreator;\n\n if (!source) {\n // TODO: warn?\n return;\n }\n\n var options = void 0;\n\n if (isMachine(source)) {\n source = resolvedData ? source.withContext(resolvedData) : source;\n options = {\n autoForward: autoForward\n };\n }\n\n _this.spawn(source, id, options);\n } else {\n _this.spawnActivity(activity);\n }\n\n break;\n }\n\n case stop:\n {\n _this.stopChild(action.activity.id);\n\n break;\n }\n\n case log:\n var _a = action,\n label = _a.label,\n value = _a.value;\n\n if (label) {\n _this.logger(label, value);\n } else {\n _this.logger(value);\n }\n\n break;\n\n default:\n if (!IS_PRODUCTION) {\n warn(false, \"No implementation found for action type '\".concat(action.type, \"'\"));\n }\n\n break;\n }\n };\n\n var resolvedOptions = __assign(__assign({}, Interpreter.defaultOptions), options);\n\n var clock = resolvedOptions.clock,\n logger = resolvedOptions.logger,\n parent = resolvedOptions.parent,\n id = resolvedOptions.id;\n var resolvedId = id !== undefined ? id : machine.id;\n this.id = resolvedId;\n this.logger = logger;\n this.clock = clock;\n this.parent = parent;\n this.options = resolvedOptions;\n this.scheduler = new Scheduler({\n deferEvents: this.options.deferEvents\n });\n this.sessionId = registry.bookId();\n }\n\n Object.defineProperty(Interpreter.prototype, \"initialState\", {\n get: function () {\n var _this = this;\n\n if (this._initialState) {\n return this._initialState;\n }\n\n return provide(this, function () {\n _this._initialState = _this.machine.initialState;\n return _this._initialState;\n });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Interpreter.prototype, \"state\", {\n /**\r\n * @deprecated Use `.getSnapshot()` instead.\r\n */\n get: function () {\n if (!IS_PRODUCTION) {\n warn(this.status !== InterpreterStatus.NotStarted, \"Attempted to read state from uninitialized service '\".concat(this.id, \"'. Make sure the service is started first.\"));\n }\n\n return this._state;\n },\n enumerable: false,\n configurable: true\n });\n /**\r\n * Executes the actions of the given state, with that state's `context` and `event`.\r\n *\r\n * @param state The state whose actions will be executed\r\n * @param actionsConfig The action implementations to use\r\n */\n\n Interpreter.prototype.execute = function (state, actionsConfig) {\n var e_1, _a;\n\n try {\n for (var _b = __values(state.actions), _c = _b.next(); !_c.done; _c = _b.next()) {\n var action = _c.value;\n this.exec(action, state, actionsConfig);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n };\n\n Interpreter.prototype.update = function (state, _event) {\n var e_2, _a, e_3, _b, e_4, _c, e_5, _d;\n\n var _this = this; // Attach session ID to state\n\n\n state._sessionid = this.sessionId; // Update state\n\n this._state = state; // Execute actions\n\n if ((!this.machine.config.predictableActionArguments || // this is currently required to execute initial actions as the `initialState` gets cached\n // we can't just recompute it (and execute actions while doing so) because we try to preserve identity of actors created within initial assigns\n _event === initEvent) && this.options.execute) {\n this.execute(this.state);\n } else {\n var item = void 0;\n\n while (item = this._outgoingQueue.shift()) {\n item[0].send(item[1]);\n }\n } // Update children\n\n\n this.children.forEach(function (child) {\n _this.state.children[child.id] = child;\n }); // Dev tools\n\n if (this.devTools) {\n this.devTools.send(_event.data, state);\n } // Execute listeners\n\n\n if (state.event) {\n try {\n for (var _e = __values(this.eventListeners), _f = _e.next(); !_f.done; _f = _e.next()) {\n var listener = _f.value;\n listener(state.event);\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_f && !_f.done && (_a = _e.return)) _a.call(_e);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n }\n\n try {\n for (var _g = __values(this.listeners), _h = _g.next(); !_h.done; _h = _g.next()) {\n var listener = _h.value;\n listener(state, state.event);\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (_h && !_h.done && (_b = _g.return)) _b.call(_g);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n try {\n for (var _j = __values(this.contextListeners), _k = _j.next(); !_k.done; _k = _j.next()) {\n var contextListener = _k.value;\n contextListener(this.state.context, this.state.history ? this.state.history.context : undefined);\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (_k && !_k.done && (_c = _j.return)) _c.call(_j);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n if (this.state.done) {\n // get final child state node\n var finalChildStateNode = state.configuration.find(function (sn) {\n return sn.type === 'final' && sn.parent === _this.machine;\n });\n var doneData = finalChildStateNode && finalChildStateNode.doneData ? mapContext(finalChildStateNode.doneData, state.context, _event) : undefined;\n this._doneEvent = doneInvoke(this.id, doneData);\n\n try {\n for (var _l = __values(this.doneListeners), _m = _l.next(); !_m.done; _m = _l.next()) {\n var listener = _m.value;\n listener(this._doneEvent);\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (_m && !_m.done && (_d = _l.return)) _d.call(_l);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n this._stop();\n\n this._stopChildren();\n\n registry.free(this.sessionId);\n }\n };\n /*\r\n * Adds a listener that is notified whenever a state transition happens. The listener is called with\r\n * the next state and the event object that caused the state transition.\r\n *\r\n * @param listener The state listener\r\n */\n\n\n Interpreter.prototype.onTransition = function (listener) {\n this.listeners.add(listener); // Send current state to listener\n\n if (this.status === InterpreterStatus.Running) {\n listener(this.state, this.state.event);\n }\n\n return this;\n };\n\n Interpreter.prototype.subscribe = function (nextListenerOrObserver, _, // TODO: error listener\n completeListener) {\n var _this = this;\n\n var observer = toObserver(nextListenerOrObserver, _, completeListener);\n this.listeners.add(observer.next); // Send current state to listener\n\n if (this.status !== InterpreterStatus.NotStarted) {\n observer.next(this.state);\n }\n\n var completeOnce = function () {\n _this.doneListeners.delete(completeOnce);\n\n _this.stopListeners.delete(completeOnce);\n\n observer.complete();\n };\n\n if (this.status === InterpreterStatus.Stopped) {\n observer.complete();\n } else {\n this.onDone(completeOnce);\n this.onStop(completeOnce);\n }\n\n return {\n unsubscribe: function () {\n _this.listeners.delete(observer.next);\n\n _this.doneListeners.delete(completeOnce);\n\n _this.stopListeners.delete(completeOnce);\n }\n };\n };\n /**\r\n * Adds an event listener that is notified whenever an event is sent to the running interpreter.\r\n * @param listener The event listener\r\n */\n\n\n Interpreter.prototype.onEvent = function (listener) {\n this.eventListeners.add(listener);\n return this;\n };\n /**\r\n * Adds an event listener that is notified whenever a `send` event occurs.\r\n * @param listener The event listener\r\n */\n\n\n Interpreter.prototype.onSend = function (listener) {\n this.sendListeners.add(listener);\n return this;\n };\n /**\r\n * Adds a context listener that is notified whenever the state context changes.\r\n * @param listener The context listener\r\n */\n\n\n Interpreter.prototype.onChange = function (listener) {\n this.contextListeners.add(listener);\n return this;\n };\n /**\r\n * Adds a listener that is notified when the machine is stopped.\r\n * @param listener The listener\r\n */\n\n\n Interpreter.prototype.onStop = function (listener) {\n this.stopListeners.add(listener);\n return this;\n };\n /**\r\n * Adds a state listener that is notified when the statechart has reached its final state.\r\n * @param listener The state listener\r\n */\n\n\n Interpreter.prototype.onDone = function (listener) {\n if (this.status === InterpreterStatus.Stopped && this._doneEvent) {\n listener(this._doneEvent);\n } else {\n this.doneListeners.add(listener);\n }\n\n return this;\n };\n /**\r\n * Removes a listener.\r\n * @param listener The listener to remove\r\n */\n\n\n Interpreter.prototype.off = function (listener) {\n this.listeners.delete(listener);\n this.eventListeners.delete(listener);\n this.sendListeners.delete(listener);\n this.stopListeners.delete(listener);\n this.doneListeners.delete(listener);\n this.contextListeners.delete(listener);\n return this;\n };\n /**\r\n * Starts the interpreter from the given state, or the initial state.\r\n * @param initialState The state to start the statechart from\r\n */\n\n\n Interpreter.prototype.start = function (initialState) {\n var _this = this;\n\n if (this.status === InterpreterStatus.Running) {\n // Do not restart the service if it is already started\n return this;\n } // yes, it's a hack but we need the related cache to be populated for some things to work (like delayed transitions)\n // this is usually called by `machine.getInitialState` but if we rehydrate from a state we might bypass this call\n // we also don't want to call this method here as it resolves the full initial state which might involve calling assign actions\n // and that could potentially lead to some unwanted side-effects (even such as creating some rogue actors)\n\n\n this.machine._init();\n\n registry.register(this.sessionId, this);\n this.initialized = true;\n this.status = InterpreterStatus.Running;\n var resolvedState = initialState === undefined ? this.initialState : provide(this, function () {\n return isStateConfig(initialState) ? _this.machine.resolveState(initialState) : _this.machine.resolveState(State.from(initialState, _this.machine.context));\n });\n\n if (this.options.devTools) {\n this.attachDev();\n }\n\n this.scheduler.initialize(function () {\n _this.update(resolvedState, initEvent);\n });\n return this;\n };\n\n Interpreter.prototype._stopChildren = function () {\n // TODO: think about converting those to actions\n this.children.forEach(function (child) {\n if (isFunction(child.stop)) {\n child.stop();\n }\n });\n this.children.clear();\n };\n\n Interpreter.prototype._stop = function () {\n var e_6, _a, e_7, _b, e_8, _c, e_9, _d, e_10, _e;\n\n try {\n for (var _f = __values(this.listeners), _g = _f.next(); !_g.done; _g = _f.next()) {\n var listener = _g.value;\n this.listeners.delete(listener);\n }\n } catch (e_6_1) {\n e_6 = {\n error: e_6_1\n };\n } finally {\n try {\n if (_g && !_g.done && (_a = _f.return)) _a.call(_f);\n } finally {\n if (e_6) throw e_6.error;\n }\n }\n\n try {\n for (var _h = __values(this.stopListeners), _j = _h.next(); !_j.done; _j = _h.next()) {\n var listener = _j.value; // call listener, then remove\n\n listener();\n this.stopListeners.delete(listener);\n }\n } catch (e_7_1) {\n e_7 = {\n error: e_7_1\n };\n } finally {\n try {\n if (_j && !_j.done && (_b = _h.return)) _b.call(_h);\n } finally {\n if (e_7) throw e_7.error;\n }\n }\n\n try {\n for (var _k = __values(this.contextListeners), _l = _k.next(); !_l.done; _l = _k.next()) {\n var listener = _l.value;\n this.contextListeners.delete(listener);\n }\n } catch (e_8_1) {\n e_8 = {\n error: e_8_1\n };\n } finally {\n try {\n if (_l && !_l.done && (_c = _k.return)) _c.call(_k);\n } finally {\n if (e_8) throw e_8.error;\n }\n }\n\n try {\n for (var _m = __values(this.doneListeners), _o = _m.next(); !_o.done; _o = _m.next()) {\n var listener = _o.value;\n this.doneListeners.delete(listener);\n }\n } catch (e_9_1) {\n e_9 = {\n error: e_9_1\n };\n } finally {\n try {\n if (_o && !_o.done && (_d = _m.return)) _d.call(_m);\n } finally {\n if (e_9) throw e_9.error;\n }\n }\n\n if (!this.initialized) {\n // Interpreter already stopped; do nothing\n return this;\n }\n\n this.initialized = false;\n this.status = InterpreterStatus.Stopped;\n this._initialState = undefined;\n\n try {\n // we are going to stop within the current sync frame\n // so we can safely just cancel this here as nothing async should be fired anyway\n for (var _p = __values(Object.keys(this.delayedEventsMap)), _q = _p.next(); !_q.done; _q = _p.next()) {\n var key = _q.value;\n this.clock.clearTimeout(this.delayedEventsMap[key]);\n }\n } catch (e_10_1) {\n e_10 = {\n error: e_10_1\n };\n } finally {\n try {\n if (_q && !_q.done && (_e = _p.return)) _e.call(_p);\n } finally {\n if (e_10) throw e_10.error;\n }\n } // clear everything that might be enqueued\n\n\n this.scheduler.clear();\n this.scheduler = new Scheduler({\n deferEvents: this.options.deferEvents\n });\n };\n /**\r\n * Stops the interpreter and unsubscribe all listeners.\r\n *\r\n * This will also notify the `onStop` listeners.\r\n */\n\n\n Interpreter.prototype.stop = function () {\n // TODO: add warning for stopping non-root interpreters\n var _this = this; // grab the current scheduler as it will be replaced in _stop\n\n\n var scheduler = this.scheduler;\n\n this._stop(); // let what is currently processed to be finished\n\n\n scheduler.schedule(function () {\n // it feels weird to handle this here but we need to handle this even slightly \"out of band\"\n var _event = toSCXMLEvent({\n type: 'xstate.stop'\n });\n\n var nextState = provide(_this, function () {\n var exitActions = flatten(__spreadArray([], __read(_this.state.configuration), false).sort(function (a, b) {\n return b.order - a.order;\n }).map(function (stateNode) {\n return toActionObjects(stateNode.onExit, _this.machine.options.actions);\n }));\n\n var _a = __read(resolveActions(_this.machine, _this.state, _this.state.context, _event, [{\n type: 'exit',\n actions: exitActions\n }], _this.machine.config.predictableActionArguments ? _this._exec : undefined, _this.machine.config.predictableActionArguments || _this.machine.config.preserveActionOrder), 2),\n resolvedActions = _a[0],\n updatedContext = _a[1];\n\n var newState = new State({\n value: _this.state.value,\n context: updatedContext,\n _event: _event,\n _sessionid: _this.sessionId,\n historyValue: undefined,\n history: _this.state,\n actions: resolvedActions.filter(function (action) {\n return !isRaisableAction(action);\n }),\n activities: {},\n events: [],\n configuration: [],\n transitions: [],\n children: {},\n done: _this.state.done,\n tags: _this.state.tags,\n machine: _this.machine\n });\n newState.changed = true;\n return newState;\n });\n\n _this.update(nextState, _event);\n\n _this._stopChildren();\n\n registry.free(_this.sessionId);\n });\n return this;\n };\n\n Interpreter.prototype.batch = function (events) {\n var _this = this;\n\n if (this.status === InterpreterStatus.NotStarted && this.options.deferEvents) {\n // tslint:disable-next-line:no-console\n if (!IS_PRODUCTION) {\n warn(false, \"\".concat(events.length, \" event(s) were sent to uninitialized service \\\"\").concat(this.machine.id, \"\\\" and are deferred. Make sure .start() is called for this service.\\nEvent: \").concat(JSON.stringify(event)));\n }\n } else if (this.status !== InterpreterStatus.Running) {\n throw new Error( // tslint:disable-next-line:max-line-length\n \"\".concat(events.length, \" event(s) were sent to uninitialized service \\\"\").concat(this.machine.id, \"\\\". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\"));\n }\n\n if (!events.length) {\n return;\n }\n\n var exec = !!this.machine.config.predictableActionArguments && this._exec;\n this.scheduler.schedule(function () {\n var e_11, _a;\n\n var nextState = _this.state;\n var batchChanged = false;\n var batchedActions = [];\n\n var _loop_1 = function (event_1) {\n var _event = toSCXMLEvent(event_1);\n\n _this.forward(_event);\n\n nextState = provide(_this, function () {\n return _this.machine.transition(nextState, _event, undefined, exec || undefined);\n });\n batchedActions.push.apply(batchedActions, __spreadArray([], __read(_this.machine.config.predictableActionArguments ? nextState.actions : nextState.actions.map(function (a) {\n return bindActionToState(a, nextState);\n })), false));\n batchChanged = batchChanged || !!nextState.changed;\n };\n\n try {\n for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {\n var event_1 = events_1_1.value;\n\n _loop_1(event_1);\n }\n } catch (e_11_1) {\n e_11 = {\n error: e_11_1\n };\n } finally {\n try {\n if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);\n } finally {\n if (e_11) throw e_11.error;\n }\n }\n\n nextState.changed = batchChanged;\n nextState.actions = batchedActions;\n\n _this.update(nextState, toSCXMLEvent(events[events.length - 1]));\n });\n };\n /**\r\n * Returns a send function bound to this interpreter instance.\r\n *\r\n * @param event The event to be sent by the sender.\r\n */\n\n\n Interpreter.prototype.sender = function (event) {\n return this.send.bind(this, event);\n };\n\n Interpreter.prototype._nextState = function (event, exec) {\n var _this = this;\n\n if (exec === void 0) {\n exec = !!this.machine.config.predictableActionArguments && this._exec;\n }\n\n var _event = toSCXMLEvent(event);\n\n if (_event.name.indexOf(errorPlatform) === 0 && !this.state.nextEvents.some(function (nextEvent) {\n return nextEvent.indexOf(errorPlatform) === 0;\n })) {\n throw _event.data.data;\n }\n\n var nextState = provide(this, function () {\n return _this.machine.transition(_this.state, _event, undefined, exec || undefined);\n });\n return nextState;\n };\n /**\r\n * Returns the next state given the interpreter's current state and the event.\r\n *\r\n * This is a pure method that does _not_ update the interpreter's state.\r\n *\r\n * @param event The event to determine the next state\r\n */\n\n\n Interpreter.prototype.nextState = function (event) {\n return this._nextState(event, false);\n };\n\n Interpreter.prototype.forward = function (event) {\n var e_12, _a;\n\n try {\n for (var _b = __values(this.forwardTo), _c = _b.next(); !_c.done; _c = _b.next()) {\n var id = _c.value;\n var child = this.children.get(id);\n\n if (!child) {\n throw new Error(\"Unable to forward event '\".concat(event, \"' from interpreter '\").concat(this.id, \"' to nonexistant child '\").concat(id, \"'.\"));\n }\n\n child.send(event);\n }\n } catch (e_12_1) {\n e_12 = {\n error: e_12_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_12) throw e_12.error;\n }\n }\n };\n\n Interpreter.prototype.defer = function (sendAction) {\n var _this = this;\n\n var timerId = this.clock.setTimeout(function () {\n if ('to' in sendAction && sendAction.to) {\n _this.sendTo(sendAction._event, sendAction.to, true);\n } else {\n _this.send(sendAction._event);\n }\n }, sendAction.delay);\n\n if (sendAction.id) {\n this.delayedEventsMap[sendAction.id] = timerId;\n }\n };\n\n Interpreter.prototype.cancel = function (sendId) {\n this.clock.clearTimeout(this.delayedEventsMap[sendId]);\n delete this.delayedEventsMap[sendId];\n };\n\n Interpreter.prototype.exec = function (action, state, actionFunctionMap) {\n if (actionFunctionMap === void 0) {\n actionFunctionMap = this.machine.options.actions;\n }\n\n this._exec(action, state.context, state._event, actionFunctionMap);\n };\n\n Interpreter.prototype.removeChild = function (childId) {\n var _a;\n\n this.children.delete(childId);\n this.forwardTo.delete(childId); // this.state might not exist at the time this is called,\n // such as when a child is added then removed while initializing the state\n\n (_a = this.state) === null || _a === void 0 ? true : delete _a.children[childId];\n };\n\n Interpreter.prototype.stopChild = function (childId) {\n var child = this.children.get(childId);\n\n if (!child) {\n return;\n }\n\n this.removeChild(childId);\n\n if (isFunction(child.stop)) {\n child.stop();\n }\n };\n\n Interpreter.prototype.spawn = function (entity, name, options) {\n if (this.status !== InterpreterStatus.Running) {\n return createDeferredActor(entity, name);\n }\n\n if (isPromiseLike(entity)) {\n return this.spawnPromise(Promise.resolve(entity), name);\n } else if (isFunction(entity)) {\n return this.spawnCallback(entity, name);\n } else if (isSpawnedActor(entity)) {\n return this.spawnActor(entity, name);\n } else if (isObservable(entity)) {\n return this.spawnObservable(entity, name);\n } else if (isMachine(entity)) {\n return this.spawnMachine(entity, __assign(__assign({}, options), {\n id: name\n }));\n } else if (isBehavior(entity)) {\n return this.spawnBehavior(entity, name);\n } else {\n throw new Error(\"Unable to spawn entity \\\"\".concat(name, \"\\\" of type \\\"\").concat(typeof entity, \"\\\".\"));\n }\n };\n\n Interpreter.prototype.spawnMachine = function (machine, options) {\n var _this = this;\n\n if (options === void 0) {\n options = {};\n }\n\n var childService = new Interpreter(machine, __assign(__assign({}, this.options), {\n parent: this,\n id: options.id || machine.id\n }));\n\n var resolvedOptions = __assign(__assign({}, DEFAULT_SPAWN_OPTIONS), options);\n\n if (resolvedOptions.sync) {\n childService.onTransition(function (state) {\n _this.send(update, {\n state: state,\n id: childService.id\n });\n });\n }\n\n var actor = childService;\n this.children.set(childService.id, actor);\n\n if (resolvedOptions.autoForward) {\n this.forwardTo.add(childService.id);\n }\n\n childService.onDone(function (doneEvent) {\n _this.removeChild(childService.id);\n\n _this.send(toSCXMLEvent(doneEvent, {\n origin: childService.id\n }));\n }).start();\n return actor;\n };\n\n Interpreter.prototype.spawnBehavior = function (behavior, id) {\n var actorRef = spawnBehavior(behavior, {\n id: id,\n parent: this\n });\n this.children.set(id, actorRef);\n return actorRef;\n };\n\n Interpreter.prototype.spawnPromise = function (promise, id) {\n var _a;\n\n var _this = this;\n\n var canceled = false;\n var resolvedData;\n promise.then(function (response) {\n if (!canceled) {\n resolvedData = response;\n\n _this.removeChild(id);\n\n _this.send(toSCXMLEvent(doneInvoke(id, response), {\n origin: id\n }));\n }\n }, function (errorData) {\n if (!canceled) {\n _this.removeChild(id);\n\n var errorEvent = error(id, errorData);\n\n try {\n // Send \"error.platform.id\" to this (parent).\n _this.send(toSCXMLEvent(errorEvent, {\n origin: id\n }));\n } catch (error) {\n reportUnhandledExceptionOnInvocation(errorData, error, id);\n\n if (_this.devTools) {\n _this.devTools.send(errorEvent, _this.state);\n }\n\n if (_this.machine.strict) {\n // it would be better to always stop the state machine if unhandled\n // exception/promise rejection happens but because we don't want to\n // break existing code so enforce it on strict mode only especially so\n // because documentation says that onError is optional\n _this.stop();\n }\n }\n }\n });\n var actor = (_a = {\n id: id,\n send: function () {\n return void 0;\n },\n subscribe: function (next, handleError, complete) {\n var observer = toObserver(next, handleError, complete);\n var unsubscribed = false;\n promise.then(function (response) {\n if (unsubscribed) {\n return;\n }\n\n observer.next(response);\n\n if (unsubscribed) {\n return;\n }\n\n observer.complete();\n }, function (err) {\n if (unsubscribed) {\n return;\n }\n\n observer.error(err);\n });\n return {\n unsubscribe: function () {\n return unsubscribed = true;\n }\n };\n },\n stop: function () {\n canceled = true;\n },\n toJSON: function () {\n return {\n id: id\n };\n },\n getSnapshot: function () {\n return resolvedData;\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a);\n this.children.set(id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnCallback = function (callback, id) {\n var _a;\n\n var _this = this;\n\n var canceled = false;\n var receivers = new Set();\n var listeners = new Set();\n var emitted;\n\n var receive = function (e) {\n emitted = e;\n listeners.forEach(function (listener) {\n return listener(e);\n });\n\n if (canceled) {\n return;\n }\n\n _this.send(toSCXMLEvent(e, {\n origin: id\n }));\n };\n\n var callbackStop;\n\n try {\n callbackStop = callback(receive, function (newListener) {\n receivers.add(newListener);\n });\n } catch (err) {\n this.send(error(id, err));\n }\n\n if (isPromiseLike(callbackStop)) {\n // it turned out to be an async function, can't reliably check this before calling `callback`\n // because transpiled async functions are not recognizable\n return this.spawnPromise(callbackStop, id);\n }\n\n var actor = (_a = {\n id: id,\n send: function (event) {\n return receivers.forEach(function (receiver) {\n return receiver(event);\n });\n },\n subscribe: function (next) {\n var observer = toObserver(next);\n listeners.add(observer.next);\n return {\n unsubscribe: function () {\n listeners.delete(observer.next);\n }\n };\n },\n stop: function () {\n canceled = true;\n\n if (isFunction(callbackStop)) {\n callbackStop();\n }\n },\n toJSON: function () {\n return {\n id: id\n };\n },\n getSnapshot: function () {\n return emitted;\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a);\n this.children.set(id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnObservable = function (source, id) {\n var _a;\n\n var _this = this;\n\n var emitted;\n var subscription = source.subscribe(function (value) {\n emitted = value;\n\n _this.send(toSCXMLEvent(value, {\n origin: id\n }));\n }, function (err) {\n _this.removeChild(id);\n\n _this.send(toSCXMLEvent(error(id, err), {\n origin: id\n }));\n }, function () {\n _this.removeChild(id);\n\n _this.send(toSCXMLEvent(doneInvoke(id), {\n origin: id\n }));\n });\n var actor = (_a = {\n id: id,\n send: function () {\n return void 0;\n },\n subscribe: function (next, handleError, complete) {\n return source.subscribe(next, handleError, complete);\n },\n stop: function () {\n return subscription.unsubscribe();\n },\n getSnapshot: function () {\n return emitted;\n },\n toJSON: function () {\n return {\n id: id\n };\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a);\n this.children.set(id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnActor = function (actor, name) {\n this.children.set(name, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnActivity = function (activity) {\n var implementation = this.machine.options && this.machine.options.activities ? this.machine.options.activities[activity.type] : undefined;\n\n if (!implementation) {\n if (!IS_PRODUCTION) {\n warn(false, \"No implementation found for activity '\".concat(activity.type, \"'\"));\n } // tslint:disable-next-line:no-console\n\n\n return;\n } // Start implementation\n\n\n var dispose = implementation(this.state.context, activity);\n this.spawnEffect(activity.id, dispose);\n };\n\n Interpreter.prototype.spawnEffect = function (id, dispose) {\n var _a;\n\n this.children.set(id, (_a = {\n id: id,\n send: function () {\n return void 0;\n },\n subscribe: function () {\n return {\n unsubscribe: function () {\n return void 0;\n }\n };\n },\n stop: dispose || undefined,\n getSnapshot: function () {\n return undefined;\n },\n toJSON: function () {\n return {\n id: id\n };\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a));\n };\n\n Interpreter.prototype.attachDev = function () {\n var global = getGlobal();\n\n if (this.options.devTools && global) {\n if (global.__REDUX_DEVTOOLS_EXTENSION__) {\n var devToolsOptions = typeof this.options.devTools === 'object' ? this.options.devTools : undefined;\n this.devTools = global.__REDUX_DEVTOOLS_EXTENSION__.connect(__assign(__assign({\n name: this.id,\n autoPause: true,\n stateSanitizer: function (state) {\n return {\n value: state.value,\n context: state.context,\n actions: state.actions\n };\n }\n }, devToolsOptions), {\n features: __assign({\n jump: false,\n skip: false\n }, devToolsOptions ? devToolsOptions.features : undefined)\n }), this.machine);\n this.devTools.init(this.state);\n } // add XState-specific dev tooling hook\n\n\n registerService(this);\n }\n };\n\n Interpreter.prototype.toJSON = function () {\n return {\n id: this.id\n };\n };\n\n Interpreter.prototype[symbolObservable] = function () {\n return this;\n };\n\n Interpreter.prototype.getSnapshot = function () {\n if (this.status === InterpreterStatus.NotStarted) {\n return this.initialState;\n }\n\n return this._state;\n };\n /**\r\n * The default interpreter options:\r\n *\r\n * - `clock` uses the global `setTimeout` and `clearTimeout` functions\r\n * - `logger` uses the global `console.log()` method\r\n */\n\n\n Interpreter.defaultOptions = {\n execute: true,\n deferEvents: true,\n clock: {\n setTimeout: function (fn, ms) {\n return setTimeout(fn, ms);\n },\n clearTimeout: function (id) {\n return clearTimeout(id);\n }\n },\n logger: /*#__PURE__*/console.log.bind(console),\n devTools: false\n };\n Interpreter.interpret = interpret;\n return Interpreter;\n}();\n\nvar resolveSpawnOptions = function (nameOrOptions) {\n if (isString(nameOrOptions)) {\n return __assign(__assign({}, DEFAULT_SPAWN_OPTIONS), {\n name: nameOrOptions\n });\n }\n\n return __assign(__assign(__assign({}, DEFAULT_SPAWN_OPTIONS), {\n name: uniqueId()\n }), nameOrOptions);\n};\n\nfunction spawn(entity, nameOrOptions) {\n var resolvedOptions = resolveSpawnOptions(nameOrOptions);\n return consume(function (service) {\n if (!IS_PRODUCTION) {\n var isLazyEntity = isMachine(entity) || isFunction(entity);\n warn(!!service || isLazyEntity, \"Attempted to spawn an Actor (ID: \\\"\".concat(isMachine(entity) ? entity.id : 'undefined', \"\\\") outside of a service. This will have no effect.\"));\n }\n\n if (service) {\n return service.spawn(entity, resolvedOptions.name, resolvedOptions);\n } else {\n return createDeferredActor(entity, resolvedOptions.name);\n }\n });\n}\n/**\r\n * Creates a new Interpreter instance for the given machine with the provided options, if any.\r\n *\r\n * @param machine The machine to interpret\r\n * @param options Interpreter options\r\n */\n\nfunction interpret(machine, options) {\n var interpreter = new Interpreter(machine, options);\n return interpreter;\n}\n\nexport { Interpreter, InterpreterStatus, interpret, spawn };\n", "import { __assign, __rest } from './_virtual/_tslib.js';\nimport './types.js';\nimport { invoke } from './actionTypes.js';\nimport './utils.js';\nimport './environment.js';\n\nfunction toInvokeSource(src) {\n if (typeof src === 'string') {\n var simpleSrc = {\n type: src\n };\n\n simpleSrc.toString = function () {\n return src;\n }; // v4 compat - TODO: remove in v5\n\n\n return simpleSrc;\n }\n\n return src;\n}\nfunction toInvokeDefinition(invokeConfig) {\n return __assign(__assign({\n type: invoke\n }, invokeConfig), {\n toJSON: function () {\n invokeConfig.onDone;\n invokeConfig.onError;\n var invokeDef = __rest(invokeConfig, [\"onDone\", \"onError\"]);\n\n return __assign(__assign({}, invokeDef), {\n type: invoke,\n src: toInvokeSource(invokeConfig.src)\n });\n }\n });\n}\n\nexport { toInvokeDefinition, toInvokeSource };\n", "import { __assign, __spreadArray, __read, __values, __rest } from './_virtual/_tslib.js';\nimport { isFunction, mapValues, isArray, flatten, toArray, toStateValue, isString, getEventType, toSCXMLEvent, matchesState, path, evaluateGuard, mapContext, isRaisableAction, pathToStateValue, isBuiltInEvent, partition, updateHistoryValue, toStatePath, mapFilterValues, warn, toStatePaths, nestedPath, normalizeTarget, toGuard, toTransitionConfigArray, isMachine, createInvokeId } from './utils.js';\nimport { State, stateValuesEqual } from './State.js';\nimport { start as start$1, stop as stop$1, invoke, update, nullEvent } from './actionTypes.js';\nimport { done, start, toActionObjects, raise, stop, resolveActions, doneInvoke, error, toActionObject, toActivityDefinition, after, send, cancel, initEvent } from './actions.js';\nimport { IS_PRODUCTION } from './environment.js';\nimport { STATE_DELIMITER } from './constants.js';\nimport { getAllStateNodes, getConfiguration, isInFinalState, getTagsFromConfiguration, has, getChildren, getValue, isLeafNode, getAllChildren } from './stateUtils.js';\nimport { createInvocableActor } from './Actor.js';\nimport { toInvokeDefinition } from './invokeUtils.js';\n\nvar NULL_EVENT = '';\nvar STATE_IDENTIFIER = '#';\nvar WILDCARD = '*';\nvar EMPTY_OBJECT = {};\n\nvar isStateId = function (str) {\n return str[0] === STATE_IDENTIFIER;\n};\n\nvar createDefaultOptions = function () {\n return {\n actions: {},\n guards: {},\n services: {},\n activities: {},\n delays: {}\n };\n};\n\nvar validateArrayifiedTransitions = function (stateNode, event, transitions) {\n var hasNonLastUnguardedTarget = transitions.slice(0, -1).some(function (transition) {\n return !('cond' in transition) && !('in' in transition) && (isString(transition.target) || isMachine(transition.target));\n });\n var eventText = event === NULL_EVENT ? 'the transient event' : \"event '\".concat(event, \"'\");\n warn(!hasNonLastUnguardedTarget, \"One or more transitions for \".concat(eventText, \" on state '\").concat(stateNode.id, \"' are unreachable. \") + \"Make sure that the default transition is the last one defined.\");\n};\n\nvar StateNode =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n function StateNode(\n /**\r\n * The raw config used to create the machine.\r\n */\n config, options,\n /**\r\n * The initial extended state\r\n */\n _context, // TODO: this is unsafe, but we're removing it in v5 anyway\n _stateInfo) {\n if (_context === void 0) {\n _context = 'context' in config ? config.context : undefined;\n }\n\n var _this = this;\n\n var _a;\n\n this.config = config;\n this._context = _context;\n /**\r\n * The order this state node appears. Corresponds to the implicit SCXML document order.\r\n */\n\n this.order = -1;\n this.__xstatenode = true;\n this.__cache = {\n events: undefined,\n relativeValue: new Map(),\n initialStateValue: undefined,\n initialState: undefined,\n on: undefined,\n transitions: undefined,\n candidates: {},\n delayedTransitions: undefined\n };\n this.idMap = {};\n this.tags = [];\n this.options = Object.assign(createDefaultOptions(), options);\n this.parent = _stateInfo === null || _stateInfo === void 0 ? void 0 : _stateInfo.parent;\n this.key = this.config.key || (_stateInfo === null || _stateInfo === void 0 ? void 0 : _stateInfo.key) || this.config.id || '(machine)';\n this.machine = this.parent ? this.parent.machine : this;\n this.path = this.parent ? this.parent.path.concat(this.key) : [];\n this.delimiter = this.config.delimiter || (this.parent ? this.parent.delimiter : STATE_DELIMITER);\n this.id = this.config.id || __spreadArray([this.machine.key], __read(this.path), false).join(this.delimiter);\n this.version = this.parent ? this.parent.version : this.config.version;\n this.type = this.config.type || (this.config.parallel ? 'parallel' : this.config.states && Object.keys(this.config.states).length ? 'compound' : this.config.history ? 'history' : 'atomic');\n this.schema = this.parent ? this.machine.schema : (_a = this.config.schema) !== null && _a !== void 0 ? _a : {};\n this.description = this.config.description;\n\n if (!IS_PRODUCTION) {\n warn(!('parallel' in this.config), \"The \\\"parallel\\\" property is deprecated and will be removed in version 4.1. \".concat(this.config.parallel ? \"Replace with `type: 'parallel'`\" : \"Use `type: '\".concat(this.type, \"'`\"), \" in the config for state node '\").concat(this.id, \"' instead.\"));\n }\n\n this.initial = this.config.initial;\n this.states = this.config.states ? mapValues(this.config.states, function (stateConfig, key) {\n var _a;\n\n var stateNode = new StateNode(stateConfig, {}, undefined, {\n parent: _this,\n key: key\n });\n Object.assign(_this.idMap, __assign((_a = {}, _a[stateNode.id] = stateNode, _a), stateNode.idMap));\n return stateNode;\n }) : EMPTY_OBJECT; // Document order\n\n var order = 0;\n\n function dfs(stateNode) {\n var e_1, _a;\n\n stateNode.order = order++;\n\n try {\n for (var _b = __values(getAllChildren(stateNode)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var child = _c.value;\n dfs(child);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n }\n\n dfs(this); // History config\n\n this.history = this.config.history === true ? 'shallow' : this.config.history || false;\n this._transient = !!this.config.always || (!this.config.on ? false : Array.isArray(this.config.on) ? this.config.on.some(function (_a) {\n var event = _a.event;\n return event === NULL_EVENT;\n }) : NULL_EVENT in this.config.on);\n this.strict = !!this.config.strict; // TODO: deprecate (entry)\n\n this.onEntry = toArray(this.config.entry || this.config.onEntry).map(function (action) {\n return toActionObject(action);\n }); // TODO: deprecate (exit)\n\n this.onExit = toArray(this.config.exit || this.config.onExit).map(function (action) {\n return toActionObject(action);\n });\n this.meta = this.config.meta;\n this.doneData = this.type === 'final' ? this.config.data : undefined;\n this.invoke = toArray(this.config.invoke).map(function (invokeConfig, i) {\n var _a, _b;\n\n if (isMachine(invokeConfig)) {\n var invokeId = createInvokeId(_this.id, i);\n _this.machine.options.services = __assign((_a = {}, _a[invokeId] = invokeConfig, _a), _this.machine.options.services);\n return toInvokeDefinition({\n src: invokeId,\n id: invokeId\n });\n } else if (isString(invokeConfig.src)) {\n var invokeId = invokeConfig.id || createInvokeId(_this.id, i);\n return toInvokeDefinition(__assign(__assign({}, invokeConfig), {\n id: invokeId,\n src: invokeConfig.src\n }));\n } else if (isMachine(invokeConfig.src) || isFunction(invokeConfig.src)) {\n var invokeId = invokeConfig.id || createInvokeId(_this.id, i);\n _this.machine.options.services = __assign((_b = {}, _b[invokeId] = invokeConfig.src, _b), _this.machine.options.services);\n return toInvokeDefinition(__assign(__assign({\n id: invokeId\n }, invokeConfig), {\n src: invokeId\n }));\n } else {\n var invokeSource = invokeConfig.src;\n return toInvokeDefinition(__assign(__assign({\n id: createInvokeId(_this.id, i)\n }, invokeConfig), {\n src: invokeSource\n }));\n }\n });\n this.activities = toArray(this.config.activities).concat(this.invoke).map(function (activity) {\n return toActivityDefinition(activity);\n });\n this.transition = this.transition.bind(this);\n this.tags = toArray(this.config.tags); // TODO: this is the real fix for initialization once\n // state node getters are deprecated\n // if (!this.parent) {\n // this._init();\n // }\n }\n\n StateNode.prototype._init = function () {\n if (this.__cache.transitions) {\n return;\n }\n\n getAllStateNodes(this).forEach(function (stateNode) {\n return stateNode.on;\n });\n };\n /**\r\n * Clones this state machine with custom options and context.\r\n *\r\n * @param options Options (actions, guards, activities, services) to recursively merge with the existing options.\r\n * @param context Custom context (will override predefined context)\r\n */\n\n\n StateNode.prototype.withConfig = function (options, context) {\n var _a = this.options,\n actions = _a.actions,\n activities = _a.activities,\n guards = _a.guards,\n services = _a.services,\n delays = _a.delays;\n return new StateNode(this.config, {\n actions: __assign(__assign({}, actions), options.actions),\n activities: __assign(__assign({}, activities), options.activities),\n guards: __assign(__assign({}, guards), options.guards),\n services: __assign(__assign({}, services), options.services),\n delays: __assign(__assign({}, delays), options.delays)\n }, context !== null && context !== void 0 ? context : this.context);\n };\n /**\r\n * Clones this state machine with custom context.\r\n *\r\n * @param context Custom context (will override predefined context, not recursive)\r\n */\n\n\n StateNode.prototype.withContext = function (context) {\n return new StateNode(this.config, this.options, context);\n };\n\n Object.defineProperty(StateNode.prototype, \"context\", {\n get: function () {\n return isFunction(this._context) ? this._context() : this._context;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"definition\", {\n /**\r\n * The well-structured state node definition.\r\n */\n get: function () {\n return {\n id: this.id,\n key: this.key,\n version: this.version,\n context: this.context,\n type: this.type,\n initial: this.initial,\n history: this.history,\n states: mapValues(this.states, function (state) {\n return state.definition;\n }),\n on: this.on,\n transitions: this.transitions,\n entry: this.onEntry,\n exit: this.onExit,\n activities: this.activities || [],\n meta: this.meta,\n order: this.order || -1,\n data: this.doneData,\n invoke: this.invoke,\n description: this.description,\n tags: this.tags\n };\n },\n enumerable: false,\n configurable: true\n });\n\n StateNode.prototype.toJSON = function () {\n return this.definition;\n };\n\n Object.defineProperty(StateNode.prototype, \"on\", {\n /**\r\n * The mapping of events to transitions.\r\n */\n get: function () {\n if (this.__cache.on) {\n return this.__cache.on;\n }\n\n var transitions = this.transitions;\n return this.__cache.on = transitions.reduce(function (map, transition) {\n map[transition.eventType] = map[transition.eventType] || [];\n map[transition.eventType].push(transition);\n return map;\n }, {});\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"after\", {\n get: function () {\n return this.__cache.delayedTransitions || (this.__cache.delayedTransitions = this.getDelayedTransitions(), this.__cache.delayedTransitions);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"transitions\", {\n /**\r\n * All the transitions that can be taken from this state node.\r\n */\n get: function () {\n return this.__cache.transitions || (this.__cache.transitions = this.formatTransitions(), this.__cache.transitions);\n },\n enumerable: false,\n configurable: true\n });\n\n StateNode.prototype.getCandidates = function (eventName) {\n if (this.__cache.candidates[eventName]) {\n return this.__cache.candidates[eventName];\n }\n\n var transient = eventName === NULL_EVENT;\n var candidates = this.transitions.filter(function (transition) {\n var sameEventType = transition.eventType === eventName; // null events should only match against eventless transitions\n\n return transient ? sameEventType : sameEventType || transition.eventType === WILDCARD;\n });\n this.__cache.candidates[eventName] = candidates;\n return candidates;\n };\n /**\r\n * All delayed transitions from the config.\r\n */\n\n\n StateNode.prototype.getDelayedTransitions = function () {\n var _this = this;\n\n var afterConfig = this.config.after;\n\n if (!afterConfig) {\n return [];\n }\n\n var mutateEntryExit = function (delay, i) {\n var delayRef = isFunction(delay) ? \"\".concat(_this.id, \":delay[\").concat(i, \"]\") : delay;\n var eventType = after(delayRef, _this.id);\n\n _this.onEntry.push(send(eventType, {\n delay: delay\n }));\n\n _this.onExit.push(cancel(eventType));\n\n return eventType;\n };\n\n var delayedTransitions = isArray(afterConfig) ? afterConfig.map(function (transition, i) {\n var eventType = mutateEntryExit(transition.delay, i);\n return __assign(__assign({}, transition), {\n event: eventType\n });\n }) : flatten(Object.keys(afterConfig).map(function (delay, i) {\n var configTransition = afterConfig[delay];\n var resolvedTransition = isString(configTransition) ? {\n target: configTransition\n } : configTransition;\n var resolvedDelay = !isNaN(+delay) ? +delay : delay;\n var eventType = mutateEntryExit(resolvedDelay, i);\n return toArray(resolvedTransition).map(function (transition) {\n return __assign(__assign({}, transition), {\n event: eventType,\n delay: resolvedDelay\n });\n });\n }));\n return delayedTransitions.map(function (delayedTransition) {\n var delay = delayedTransition.delay;\n return __assign(__assign({}, _this.formatTransition(delayedTransition)), {\n delay: delay\n });\n });\n };\n /**\r\n * Returns the state nodes represented by the current state value.\r\n *\r\n * @param state The state value or State instance\r\n */\n\n\n StateNode.prototype.getStateNodes = function (state) {\n var _a;\n\n var _this = this;\n\n if (!state) {\n return [];\n }\n\n var stateValue = state instanceof State ? state.value : toStateValue(state, this.delimiter);\n\n if (isString(stateValue)) {\n var initialStateValue = this.getStateNode(stateValue).initial;\n return initialStateValue !== undefined ? this.getStateNodes((_a = {}, _a[stateValue] = initialStateValue, _a)) : [this, this.states[stateValue]];\n }\n\n var subStateKeys = Object.keys(stateValue);\n var subStateNodes = [this];\n subStateNodes.push.apply(subStateNodes, __spreadArray([], __read(flatten(subStateKeys.map(function (subStateKey) {\n return _this.getStateNode(subStateKey).getStateNodes(stateValue[subStateKey]);\n }))), false));\n return subStateNodes;\n };\n /**\r\n * Returns `true` if this state node explicitly handles the given event.\r\n *\r\n * @param event The event in question\r\n */\n\n\n StateNode.prototype.handles = function (event) {\n var eventType = getEventType(event);\n return this.events.includes(eventType);\n };\n /**\r\n * Resolves the given `state` to a new `State` instance relative to this machine.\r\n *\r\n * This ensures that `.events` and `.nextEvents` represent the correct values.\r\n *\r\n * @param state The state to resolve\r\n */\n\n\n StateNode.prototype.resolveState = function (state) {\n var stateFromConfig = state instanceof State ? state : State.create(state);\n var configuration = Array.from(getConfiguration([], this.getStateNodes(stateFromConfig.value)));\n return new State(__assign(__assign({}, stateFromConfig), {\n value: this.resolve(stateFromConfig.value),\n configuration: configuration,\n done: isInFinalState(configuration, this),\n tags: getTagsFromConfiguration(configuration),\n machine: this.machine\n }));\n };\n\n StateNode.prototype.transitionLeafNode = function (stateValue, state, _event) {\n var stateNode = this.getStateNode(stateValue);\n var next = stateNode.next(state, _event);\n\n if (!next || !next.transitions.length) {\n return this.next(state, _event);\n }\n\n return next;\n };\n\n StateNode.prototype.transitionCompoundNode = function (stateValue, state, _event) {\n var subStateKeys = Object.keys(stateValue);\n var stateNode = this.getStateNode(subStateKeys[0]);\n\n var next = stateNode._transition(stateValue[subStateKeys[0]], state, _event);\n\n if (!next || !next.transitions.length) {\n return this.next(state, _event);\n }\n\n return next;\n };\n\n StateNode.prototype.transitionParallelNode = function (stateValue, state, _event) {\n var e_2, _a;\n\n var transitionMap = {};\n\n try {\n for (var _b = __values(Object.keys(stateValue)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var subStateKey = _c.value;\n var subStateValue = stateValue[subStateKey];\n\n if (!subStateValue) {\n continue;\n }\n\n var subStateNode = this.getStateNode(subStateKey);\n\n var next = subStateNode._transition(subStateValue, state, _event);\n\n if (next) {\n transitionMap[subStateKey] = next;\n }\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n var stateTransitions = Object.keys(transitionMap).map(function (key) {\n return transitionMap[key];\n });\n var enabledTransitions = flatten(stateTransitions.map(function (st) {\n return st.transitions;\n }));\n var willTransition = stateTransitions.some(function (st) {\n return st.transitions.length > 0;\n });\n\n if (!willTransition) {\n return this.next(state, _event);\n }\n\n var configuration = flatten(Object.keys(transitionMap).map(function (key) {\n return transitionMap[key].configuration;\n }));\n return {\n transitions: enabledTransitions,\n exitSet: flatten(stateTransitions.map(function (t) {\n return t.exitSet;\n })),\n configuration: configuration,\n source: state,\n actions: flatten(Object.keys(transitionMap).map(function (key) {\n return transitionMap[key].actions;\n }))\n };\n };\n\n StateNode.prototype._transition = function (stateValue, state, _event) {\n // leaf node\n if (isString(stateValue)) {\n return this.transitionLeafNode(stateValue, state, _event);\n } // hierarchical node\n\n\n if (Object.keys(stateValue).length === 1) {\n return this.transitionCompoundNode(stateValue, state, _event);\n } // orthogonal node\n\n\n return this.transitionParallelNode(stateValue, state, _event);\n };\n\n StateNode.prototype.getTransitionData = function (state, event) {\n return this._transition(state.value, state, toSCXMLEvent(event));\n };\n\n StateNode.prototype.next = function (state, _event) {\n var e_3, _a;\n\n var _this = this;\n\n var eventName = _event.name;\n var actions = [];\n var nextStateNodes = [];\n var selectedTransition;\n\n try {\n for (var _b = __values(this.getCandidates(eventName)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var candidate = _c.value;\n var cond = candidate.cond,\n stateIn = candidate.in;\n var resolvedContext = state.context;\n var isInState = stateIn ? isString(stateIn) && isStateId(stateIn) ? // Check if in state by ID\n state.matches(toStateValue(this.getStateNodeById(stateIn).path, this.delimiter)) : // Check if in state by relative grandparent\n matchesState(toStateValue(stateIn, this.delimiter), path(this.path.slice(0, -2))(state.value)) : true;\n var guardPassed = false;\n\n try {\n guardPassed = !cond || evaluateGuard(this.machine, cond, resolvedContext, _event, state);\n } catch (err) {\n throw new Error(\"Unable to evaluate guard '\".concat(cond.name || cond.type, \"' in transition for event '\").concat(eventName, \"' in state node '\").concat(this.id, \"':\\n\").concat(err.message));\n }\n\n if (guardPassed && isInState) {\n if (candidate.target !== undefined) {\n nextStateNodes = candidate.target;\n }\n\n actions.push.apply(actions, __spreadArray([], __read(candidate.actions), false));\n selectedTransition = candidate;\n break;\n }\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n if (!selectedTransition) {\n return undefined;\n }\n\n if (!nextStateNodes.length) {\n return {\n transitions: [selectedTransition],\n exitSet: [],\n configuration: state.value ? [this] : [],\n source: state,\n actions: actions\n };\n }\n\n var allNextStateNodes = flatten(nextStateNodes.map(function (stateNode) {\n return _this.getRelativeStateNodes(stateNode, state.historyValue);\n }));\n var isInternal = !!selectedTransition.internal;\n return {\n transitions: [selectedTransition],\n exitSet: isInternal ? [] : flatten(nextStateNodes.map(function (targetNode) {\n return _this.getPotentiallyReenteringNodes(targetNode);\n })),\n configuration: allNextStateNodes,\n source: state,\n actions: actions\n };\n }; // even though the name of this function mentions reentry nodes\n // we are pushing its result into `exitSet`\n // that's because what we exit might be reentered (it's an invariant of reentrancy)\n\n\n StateNode.prototype.getPotentiallyReenteringNodes = function (targetNode) {\n if (this.order < targetNode.order) {\n return [this];\n }\n\n var nodes = [];\n var marker = this;\n var possibleAncestor = targetNode;\n\n while (marker && marker !== possibleAncestor) {\n nodes.push(marker);\n marker = marker.parent;\n }\n\n if (marker !== possibleAncestor) {\n // we never got to `possibleAncestor`, therefore the initial `marker` \"escapes\" it\n // it's in a different part of the tree so no states will be reentered for such an external transition\n return [];\n }\n\n nodes.push(possibleAncestor);\n return nodes;\n };\n\n StateNode.prototype.getActions = function (resolvedConfig, isDone, transition, currentContext, _event, prevState, predictableExec) {\n var e_4, _a, e_5, _b;\n\n var _this = this;\n\n var prevConfig = prevState ? getConfiguration([], this.getStateNodes(prevState.value)) : [];\n var entrySet = new Set();\n\n try {\n for (var _c = __values(Array.from(resolvedConfig).sort(function (a, b) {\n return a.order - b.order;\n })), _d = _c.next(); !_d.done; _d = _c.next()) {\n var sn = _d.value;\n\n if (!has(prevConfig, sn) || has(transition.exitSet, sn) || sn.parent && entrySet.has(sn.parent)) {\n entrySet.add(sn);\n }\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n try {\n for (var prevConfig_1 = __values(prevConfig), prevConfig_1_1 = prevConfig_1.next(); !prevConfig_1_1.done; prevConfig_1_1 = prevConfig_1.next()) {\n var sn = prevConfig_1_1.value;\n\n if (!has(resolvedConfig, sn) || has(transition.exitSet, sn.parent)) {\n transition.exitSet.push(sn);\n }\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (prevConfig_1_1 && !prevConfig_1_1.done && (_b = prevConfig_1.return)) _b.call(prevConfig_1);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n transition.exitSet.sort(function (a, b) {\n return b.order - a.order;\n });\n var entryStates = Array.from(entrySet).sort(function (a, b) {\n return a.order - b.order;\n });\n var exitStates = new Set(transition.exitSet);\n var doneEvents = flatten(entryStates.map(function (sn) {\n var events = [];\n\n if (sn.type !== 'final') {\n return events;\n }\n\n var parent = sn.parent;\n\n if (!parent.parent) {\n return events;\n }\n\n events.push(done(sn.id, sn.doneData), // TODO: deprecate - final states should not emit done events for their own state.\n done(parent.id, sn.doneData ? mapContext(sn.doneData, currentContext, _event) : undefined));\n var grandparent = parent.parent;\n\n if (grandparent.type === 'parallel') {\n if (getChildren(grandparent).every(function (parentNode) {\n return isInFinalState(transition.configuration, parentNode);\n })) {\n events.push(done(grandparent.id));\n }\n }\n\n return events;\n }));\n var entryActions = entryStates.map(function (stateNode) {\n var entryActions = stateNode.onEntry;\n var invokeActions = stateNode.activities.map(function (activity) {\n return start(activity);\n });\n return {\n type: 'entry',\n actions: toActionObjects(predictableExec ? __spreadArray(__spreadArray([], __read(entryActions), false), __read(invokeActions), false) : __spreadArray(__spreadArray([], __read(invokeActions), false), __read(entryActions), false), _this.machine.options.actions)\n };\n }).concat({\n type: 'state_done',\n actions: doneEvents.map(function (event) {\n return raise(event);\n })\n });\n var exitActions = Array.from(exitStates).map(function (stateNode) {\n return {\n type: 'exit',\n actions: toActionObjects(__spreadArray(__spreadArray([], __read(stateNode.onExit), false), __read(stateNode.activities.map(function (activity) {\n return stop(activity);\n })), false), _this.machine.options.actions)\n };\n });\n var actions = exitActions.concat({\n type: 'transition',\n actions: toActionObjects(transition.actions, this.machine.options.actions)\n }).concat(entryActions);\n\n if (isDone) {\n var stopActions = toActionObjects(flatten(__spreadArray([], __read(resolvedConfig), false).sort(function (a, b) {\n return b.order - a.order;\n }).map(function (stateNode) {\n return stateNode.onExit;\n })), this.machine.options.actions).filter(function (action) {\n return !isRaisableAction(action);\n });\n return actions.concat({\n type: 'stop',\n actions: stopActions\n });\n }\n\n return actions;\n };\n /**\r\n * Determines the next state given the current `state` and sent `event`.\r\n *\r\n * @param state The current State instance or state value\r\n * @param event The event that was sent at the current state\r\n * @param context The current context (extended state) of the current state\r\n */\n\n\n StateNode.prototype.transition = function (state, event, context, exec) {\n if (state === void 0) {\n state = this.initialState;\n }\n\n var _event = toSCXMLEvent(event);\n\n var currentState;\n\n if (state instanceof State) {\n currentState = context === undefined ? state : this.resolveState(State.from(state, context));\n } else {\n var resolvedStateValue = isString(state) ? this.resolve(pathToStateValue(this.getResolvedPath(state))) : this.resolve(state);\n var resolvedContext = context !== null && context !== void 0 ? context : this.machine.context;\n currentState = this.resolveState(State.from(resolvedStateValue, resolvedContext));\n }\n\n if (!IS_PRODUCTION && _event.name === WILDCARD) {\n throw new Error(\"An event cannot have the wildcard type ('\".concat(WILDCARD, \"')\"));\n }\n\n if (this.strict) {\n if (!this.events.includes(_event.name) && !isBuiltInEvent(_event.name)) {\n throw new Error(\"Machine '\".concat(this.id, \"' does not accept event '\").concat(_event.name, \"'\"));\n }\n }\n\n var stateTransition = this._transition(currentState.value, currentState, _event) || {\n transitions: [],\n configuration: [],\n exitSet: [],\n source: currentState,\n actions: []\n };\n var prevConfig = getConfiguration([], this.getStateNodes(currentState.value));\n var resolvedConfig = stateTransition.configuration.length ? getConfiguration(prevConfig, stateTransition.configuration) : prevConfig;\n stateTransition.configuration = __spreadArray([], __read(resolvedConfig), false);\n return this.resolveTransition(stateTransition, currentState, currentState.context, exec, _event);\n };\n\n StateNode.prototype.resolveRaisedTransition = function (state, _event, originalEvent, predictableExec) {\n var _a;\n\n var currentActions = state.actions;\n state = this.transition(state, _event, undefined, predictableExec); // Save original event to state\n // TODO: this should be the raised event! Delete in V5 (breaking)\n\n state._event = originalEvent;\n state.event = originalEvent.data;\n\n (_a = state.actions).unshift.apply(_a, __spreadArray([], __read(currentActions), false));\n\n return state;\n };\n\n StateNode.prototype.resolveTransition = function (stateTransition, currentState, context, predictableExec, _event) {\n var e_6, _a, e_7, _b;\n\n var _this = this;\n\n if (_event === void 0) {\n _event = initEvent;\n }\n\n var configuration = stateTransition.configuration; // Transition will \"apply\" if:\n // - this is the initial state (there is no current state)\n // - OR there are transitions\n\n var willTransition = !currentState || stateTransition.transitions.length > 0;\n var resolvedConfiguration = willTransition ? stateTransition.configuration : currentState ? currentState.configuration : [];\n var isDone = isInFinalState(resolvedConfiguration, this);\n var resolvedStateValue = willTransition ? getValue(this.machine, configuration) : undefined;\n var historyValue = currentState ? currentState.historyValue ? currentState.historyValue : stateTransition.source ? this.machine.historyValue(currentState.value) : undefined : undefined;\n var actionBlocks = this.getActions(new Set(resolvedConfiguration), isDone, stateTransition, context, _event, currentState, predictableExec);\n var activities = currentState ? __assign({}, currentState.activities) : {};\n\n try {\n for (var actionBlocks_1 = __values(actionBlocks), actionBlocks_1_1 = actionBlocks_1.next(); !actionBlocks_1_1.done; actionBlocks_1_1 = actionBlocks_1.next()) {\n var block = actionBlocks_1_1.value;\n\n try {\n for (var _c = (e_7 = void 0, __values(block.actions)), _d = _c.next(); !_d.done; _d = _c.next()) {\n var action = _d.value;\n\n if (action.type === start$1) {\n activities[action.activity.id || action.activity.type] = action;\n } else if (action.type === stop$1) {\n activities[action.activity.id || action.activity.type] = false;\n }\n }\n } catch (e_7_1) {\n e_7 = {\n error: e_7_1\n };\n } finally {\n try {\n if (_d && !_d.done && (_b = _c.return)) _b.call(_c);\n } finally {\n if (e_7) throw e_7.error;\n }\n }\n }\n } catch (e_6_1) {\n e_6 = {\n error: e_6_1\n };\n } finally {\n try {\n if (actionBlocks_1_1 && !actionBlocks_1_1.done && (_a = actionBlocks_1.return)) _a.call(actionBlocks_1);\n } finally {\n if (e_6) throw e_6.error;\n }\n }\n\n var _e = __read(resolveActions(this, currentState, context, _event, actionBlocks, predictableExec, this.machine.config.predictableActionArguments || this.machine.config.preserveActionOrder), 2),\n resolvedActions = _e[0],\n updatedContext = _e[1];\n\n var _f = __read(partition(resolvedActions, isRaisableAction), 2),\n raisedEvents = _f[0],\n nonRaisedActions = _f[1];\n\n var invokeActions = resolvedActions.filter(function (action) {\n var _a;\n\n return action.type === start$1 && ((_a = action.activity) === null || _a === void 0 ? void 0 : _a.type) === invoke;\n });\n var children = invokeActions.reduce(function (acc, action) {\n acc[action.activity.id] = createInvocableActor(action.activity, _this.machine, updatedContext, _event);\n return acc;\n }, currentState ? __assign({}, currentState.children) : {});\n var nextState = new State({\n value: resolvedStateValue || currentState.value,\n context: updatedContext,\n _event: _event,\n // Persist _sessionid between states\n _sessionid: currentState ? currentState._sessionid : null,\n historyValue: resolvedStateValue ? historyValue ? updateHistoryValue(historyValue, resolvedStateValue) : undefined : currentState ? currentState.historyValue : undefined,\n history: !resolvedStateValue || stateTransition.source ? currentState : undefined,\n actions: resolvedStateValue ? nonRaisedActions : [],\n activities: resolvedStateValue ? activities : currentState ? currentState.activities : {},\n events: [],\n configuration: resolvedConfiguration,\n transitions: stateTransition.transitions,\n children: children,\n done: isDone,\n tags: getTagsFromConfiguration(resolvedConfiguration),\n machine: this\n });\n var didUpdateContext = context !== updatedContext;\n nextState.changed = _event.name === update || didUpdateContext; // Dispose of penultimate histories to prevent memory leaks\n\n var history = nextState.history;\n\n if (history) {\n delete history.history;\n } // There are transient transitions if the machine is not in a final state\n // and if some of the state nodes have transient (\"always\") transitions.\n\n\n var hasAlwaysTransitions = !isDone && (this._transient || configuration.some(function (stateNode) {\n return stateNode._transient;\n })); // If there are no enabled transitions, check if there are transient transitions.\n // If there are transient transitions, continue checking for more transitions\n // because an transient transition should be triggered even if there are no\n // enabled transitions.\n //\n // If we're already working on an transient transition then stop to prevent an infinite loop.\n //\n // Otherwise, if there are no enabled nor transient transitions, we are done.\n\n if (!willTransition && (!hasAlwaysTransitions || _event.name === NULL_EVENT)) {\n return nextState;\n }\n\n var maybeNextState = nextState;\n\n if (!isDone) {\n if (hasAlwaysTransitions) {\n maybeNextState = this.resolveRaisedTransition(maybeNextState, {\n type: nullEvent\n }, _event, predictableExec);\n }\n\n while (raisedEvents.length) {\n var raisedEvent = raisedEvents.shift();\n maybeNextState = this.resolveRaisedTransition(maybeNextState, raisedEvent._event, _event, predictableExec);\n }\n } // Detect if state changed\n\n\n var changed = maybeNextState.changed || (history ? !!maybeNextState.actions.length || didUpdateContext || typeof history.value !== typeof maybeNextState.value || !stateValuesEqual(maybeNextState.value, history.value) : undefined);\n maybeNextState.changed = changed; // Preserve original history after raised events\n\n maybeNextState.history = history;\n return maybeNextState;\n };\n /**\r\n * Returns the child state node from its relative `stateKey`, or throws.\r\n */\n\n\n StateNode.prototype.getStateNode = function (stateKey) {\n if (isStateId(stateKey)) {\n return this.machine.getStateNodeById(stateKey);\n }\n\n if (!this.states) {\n throw new Error(\"Unable to retrieve child state '\".concat(stateKey, \"' from '\").concat(this.id, \"'; no child states exist.\"));\n }\n\n var result = this.states[stateKey];\n\n if (!result) {\n throw new Error(\"Child state '\".concat(stateKey, \"' does not exist on '\").concat(this.id, \"'\"));\n }\n\n return result;\n };\n /**\r\n * Returns the state node with the given `stateId`, or throws.\r\n *\r\n * @param stateId The state ID. The prefix \"#\" is removed.\r\n */\n\n\n StateNode.prototype.getStateNodeById = function (stateId) {\n var resolvedStateId = isStateId(stateId) ? stateId.slice(STATE_IDENTIFIER.length) : stateId;\n\n if (resolvedStateId === this.id) {\n return this;\n }\n\n var stateNode = this.machine.idMap[resolvedStateId];\n\n if (!stateNode) {\n throw new Error(\"Child state node '#\".concat(resolvedStateId, \"' does not exist on machine '\").concat(this.id, \"'\"));\n }\n\n return stateNode;\n };\n /**\r\n * Returns the relative state node from the given `statePath`, or throws.\r\n *\r\n * @param statePath The string or string array relative path to the state node.\r\n */\n\n\n StateNode.prototype.getStateNodeByPath = function (statePath) {\n if (typeof statePath === 'string' && isStateId(statePath)) {\n try {\n return this.getStateNodeById(statePath.slice(1));\n } catch (e) {// try individual paths\n // throw e;\n }\n }\n\n var arrayStatePath = toStatePath(statePath, this.delimiter).slice();\n var currentStateNode = this;\n\n while (arrayStatePath.length) {\n var key = arrayStatePath.shift();\n\n if (!key.length) {\n break;\n }\n\n currentStateNode = currentStateNode.getStateNode(key);\n }\n\n return currentStateNode;\n };\n /**\r\n * Resolves a partial state value with its full representation in this machine.\r\n *\r\n * @param stateValue The partial state value to resolve.\r\n */\n\n\n StateNode.prototype.resolve = function (stateValue) {\n var _a;\n\n var _this = this;\n\n if (!stateValue) {\n return this.initialStateValue || EMPTY_OBJECT; // TODO: type-specific properties\n }\n\n switch (this.type) {\n case 'parallel':\n return mapValues(this.initialStateValue, function (subStateValue, subStateKey) {\n return subStateValue ? _this.getStateNode(subStateKey).resolve(stateValue[subStateKey] || subStateValue) : EMPTY_OBJECT;\n });\n\n case 'compound':\n if (isString(stateValue)) {\n var subStateNode = this.getStateNode(stateValue);\n\n if (subStateNode.type === 'parallel' || subStateNode.type === 'compound') {\n return _a = {}, _a[stateValue] = subStateNode.initialStateValue, _a;\n }\n\n return stateValue;\n }\n\n if (!Object.keys(stateValue).length) {\n return this.initialStateValue || {};\n }\n\n return mapValues(stateValue, function (subStateValue, subStateKey) {\n return subStateValue ? _this.getStateNode(subStateKey).resolve(subStateValue) : EMPTY_OBJECT;\n });\n\n default:\n return stateValue || EMPTY_OBJECT;\n }\n };\n\n StateNode.prototype.getResolvedPath = function (stateIdentifier) {\n if (isStateId(stateIdentifier)) {\n var stateNode = this.machine.idMap[stateIdentifier.slice(STATE_IDENTIFIER.length)];\n\n if (!stateNode) {\n throw new Error(\"Unable to find state node '\".concat(stateIdentifier, \"'\"));\n }\n\n return stateNode.path;\n }\n\n return toStatePath(stateIdentifier, this.delimiter);\n };\n\n Object.defineProperty(StateNode.prototype, \"initialStateValue\", {\n get: function () {\n var _a;\n\n if (this.__cache.initialStateValue) {\n return this.__cache.initialStateValue;\n }\n\n var initialStateValue;\n\n if (this.type === 'parallel') {\n initialStateValue = mapFilterValues(this.states, function (state) {\n return state.initialStateValue || EMPTY_OBJECT;\n }, function (stateNode) {\n return !(stateNode.type === 'history');\n });\n } else if (this.initial !== undefined) {\n if (!this.states[this.initial]) {\n throw new Error(\"Initial state '\".concat(this.initial, \"' not found on '\").concat(this.key, \"'\"));\n }\n\n initialStateValue = isLeafNode(this.states[this.initial]) ? this.initial : (_a = {}, _a[this.initial] = this.states[this.initial].initialStateValue, _a);\n } else {\n // The finite state value of a machine without child states is just an empty object\n initialStateValue = {};\n }\n\n this.__cache.initialStateValue = initialStateValue;\n return this.__cache.initialStateValue;\n },\n enumerable: false,\n configurable: true\n });\n\n StateNode.prototype.getInitialState = function (stateValue, context) {\n this._init(); // TODO: this should be in the constructor (see note in constructor)\n\n\n var configuration = this.getStateNodes(stateValue);\n return this.resolveTransition({\n configuration: configuration,\n exitSet: [],\n transitions: [],\n source: undefined,\n actions: []\n }, undefined, context !== null && context !== void 0 ? context : this.machine.context, undefined);\n };\n\n Object.defineProperty(StateNode.prototype, \"initialState\", {\n /**\r\n * The initial State instance, which includes all actions to be executed from\r\n * entering the initial state.\r\n */\n get: function () {\n var initialStateValue = this.initialStateValue;\n\n if (!initialStateValue) {\n throw new Error(\"Cannot retrieve initial state from simple state '\".concat(this.id, \"'.\"));\n }\n\n return this.getInitialState(initialStateValue);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"target\", {\n /**\r\n * The target state value of the history state node, if it exists. This represents the\r\n * default state value to transition to if no history value exists yet.\r\n */\n get: function () {\n var target;\n\n if (this.type === 'history') {\n var historyConfig = this.config;\n\n if (isString(historyConfig.target)) {\n target = isStateId(historyConfig.target) ? pathToStateValue(this.machine.getStateNodeById(historyConfig.target).path.slice(this.path.length - 1)) : historyConfig.target;\n } else {\n target = historyConfig.target;\n }\n }\n\n return target;\n },\n enumerable: false,\n configurable: true\n });\n /**\r\n * Returns the leaf nodes from a state path relative to this state node.\r\n *\r\n * @param relativeStateId The relative state path to retrieve the state nodes\r\n * @param history The previous state to retrieve history\r\n * @param resolve Whether state nodes should resolve to initial child state nodes\r\n */\n\n StateNode.prototype.getRelativeStateNodes = function (relativeStateId, historyValue, resolve) {\n if (resolve === void 0) {\n resolve = true;\n }\n\n return resolve ? relativeStateId.type === 'history' ? relativeStateId.resolveHistory(historyValue) : relativeStateId.initialStateNodes : [relativeStateId];\n };\n\n Object.defineProperty(StateNode.prototype, \"initialStateNodes\", {\n get: function () {\n var _this = this;\n\n if (isLeafNode(this)) {\n return [this];\n } // Case when state node is compound but no initial state is defined\n\n\n if (this.type === 'compound' && !this.initial) {\n if (!IS_PRODUCTION) {\n warn(false, \"Compound state node '\".concat(this.id, \"' has no initial state.\"));\n }\n\n return [this];\n }\n\n var initialStateNodePaths = toStatePaths(this.initialStateValue);\n return flatten(initialStateNodePaths.map(function (initialPath) {\n return _this.getFromRelativePath(initialPath);\n }));\n },\n enumerable: false,\n configurable: true\n });\n /**\r\n * Retrieves state nodes from a relative path to this state node.\r\n *\r\n * @param relativePath The relative path from this state node\r\n * @param historyValue\r\n */\n\n StateNode.prototype.getFromRelativePath = function (relativePath) {\n if (!relativePath.length) {\n return [this];\n }\n\n var _a = __read(relativePath),\n stateKey = _a[0],\n childStatePath = _a.slice(1);\n\n if (!this.states) {\n throw new Error(\"Cannot retrieve subPath '\".concat(stateKey, \"' from node with no states\"));\n }\n\n var childStateNode = this.getStateNode(stateKey);\n\n if (childStateNode.type === 'history') {\n return childStateNode.resolveHistory();\n }\n\n if (!this.states[stateKey]) {\n throw new Error(\"Child state '\".concat(stateKey, \"' does not exist on '\").concat(this.id, \"'\"));\n }\n\n return this.states[stateKey].getFromRelativePath(childStatePath);\n };\n\n StateNode.prototype.historyValue = function (relativeStateValue) {\n if (!Object.keys(this.states).length) {\n return undefined;\n }\n\n return {\n current: relativeStateValue || this.initialStateValue,\n states: mapFilterValues(this.states, function (stateNode, key) {\n if (!relativeStateValue) {\n return stateNode.historyValue();\n }\n\n var subStateValue = isString(relativeStateValue) ? undefined : relativeStateValue[key];\n return stateNode.historyValue(subStateValue || stateNode.initialStateValue);\n }, function (stateNode) {\n return !stateNode.history;\n })\n };\n };\n /**\r\n * Resolves to the historical value(s) of the parent state node,\r\n * represented by state nodes.\r\n *\r\n * @param historyValue\r\n */\n\n\n StateNode.prototype.resolveHistory = function (historyValue) {\n var _this = this;\n\n if (this.type !== 'history') {\n return [this];\n }\n\n var parent = this.parent;\n\n if (!historyValue) {\n var historyTarget = this.target;\n return historyTarget ? flatten(toStatePaths(historyTarget).map(function (relativeChildPath) {\n return parent.getFromRelativePath(relativeChildPath);\n })) : parent.initialStateNodes;\n }\n\n var subHistoryValue = nestedPath(parent.path, 'states')(historyValue).current;\n\n if (isString(subHistoryValue)) {\n return [parent.getStateNode(subHistoryValue)];\n }\n\n return flatten(toStatePaths(subHistoryValue).map(function (subStatePath) {\n return _this.history === 'deep' ? parent.getFromRelativePath(subStatePath) : [parent.states[subStatePath[0]]];\n }));\n };\n\n Object.defineProperty(StateNode.prototype, \"stateIds\", {\n /**\r\n * All the state node IDs of this state node and its descendant state nodes.\r\n */\n get: function () {\n var _this = this;\n\n var childStateIds = flatten(Object.keys(this.states).map(function (stateKey) {\n return _this.states[stateKey].stateIds;\n }));\n return [this.id].concat(childStateIds);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"events\", {\n /**\r\n * All the event types accepted by this state node and its descendants.\r\n */\n get: function () {\n var e_8, _a, e_9, _b;\n\n if (this.__cache.events) {\n return this.__cache.events;\n }\n\n var states = this.states;\n var events = new Set(this.ownEvents);\n\n if (states) {\n try {\n for (var _c = __values(Object.keys(states)), _d = _c.next(); !_d.done; _d = _c.next()) {\n var stateId = _d.value;\n var state = states[stateId];\n\n if (state.states) {\n try {\n for (var _e = (e_9 = void 0, __values(state.events)), _f = _e.next(); !_f.done; _f = _e.next()) {\n var event_1 = _f.value;\n events.add(\"\".concat(event_1));\n }\n } catch (e_9_1) {\n e_9 = {\n error: e_9_1\n };\n } finally {\n try {\n if (_f && !_f.done && (_b = _e.return)) _b.call(_e);\n } finally {\n if (e_9) throw e_9.error;\n }\n }\n }\n }\n } catch (e_8_1) {\n e_8 = {\n error: e_8_1\n };\n } finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n } finally {\n if (e_8) throw e_8.error;\n }\n }\n }\n\n return this.__cache.events = Array.from(events);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"ownEvents\", {\n /**\r\n * All the events that have transitions directly from this state node.\r\n *\r\n * Excludes any inert events.\r\n */\n get: function () {\n var events = new Set(this.transitions.filter(function (transition) {\n return !(!transition.target && !transition.actions.length && transition.internal);\n }).map(function (transition) {\n return transition.eventType;\n }));\n return Array.from(events);\n },\n enumerable: false,\n configurable: true\n });\n\n StateNode.prototype.resolveTarget = function (_target) {\n var _this = this;\n\n if (_target === undefined) {\n // an undefined target signals that the state node should not transition from that state when receiving that event\n return undefined;\n }\n\n return _target.map(function (target) {\n if (!isString(target)) {\n return target;\n }\n\n var isInternalTarget = target[0] === _this.delimiter; // If internal target is defined on machine,\n // do not include machine key on target\n\n if (isInternalTarget && !_this.parent) {\n return _this.getStateNodeByPath(target.slice(1));\n }\n\n var resolvedTarget = isInternalTarget ? _this.key + target : target;\n\n if (_this.parent) {\n try {\n var targetStateNode = _this.parent.getStateNodeByPath(resolvedTarget);\n\n return targetStateNode;\n } catch (err) {\n throw new Error(\"Invalid transition definition for state node '\".concat(_this.id, \"':\\n\").concat(err.message));\n }\n } else {\n return _this.getStateNodeByPath(resolvedTarget);\n }\n });\n };\n\n StateNode.prototype.formatTransition = function (transitionConfig) {\n var _this = this;\n\n var normalizedTarget = normalizeTarget(transitionConfig.target);\n var internal = 'internal' in transitionConfig ? transitionConfig.internal : normalizedTarget ? normalizedTarget.some(function (_target) {\n return isString(_target) && _target[0] === _this.delimiter;\n }) : true;\n var guards = this.machine.options.guards;\n var target = this.resolveTarget(normalizedTarget);\n\n var transition = __assign(__assign({}, transitionConfig), {\n actions: toActionObjects(toArray(transitionConfig.actions)),\n cond: toGuard(transitionConfig.cond, guards),\n target: target,\n source: this,\n internal: internal,\n eventType: transitionConfig.event,\n toJSON: function () {\n return __assign(__assign({}, transition), {\n target: transition.target ? transition.target.map(function (t) {\n return \"#\".concat(t.id);\n }) : undefined,\n source: \"#\".concat(_this.id)\n });\n }\n });\n\n return transition;\n };\n\n StateNode.prototype.formatTransitions = function () {\n var e_10, _a;\n\n var _this = this;\n\n var onConfig;\n\n if (!this.config.on) {\n onConfig = [];\n } else if (Array.isArray(this.config.on)) {\n onConfig = this.config.on;\n } else {\n var _b = this.config.on,\n _c = WILDCARD,\n _d = _b[_c],\n wildcardConfigs = _d === void 0 ? [] : _d,\n strictTransitionConfigs_1 = __rest(_b, [typeof _c === \"symbol\" ? _c : _c + \"\"]);\n\n onConfig = flatten(Object.keys(strictTransitionConfigs_1).map(function (key) {\n if (!IS_PRODUCTION && key === NULL_EVENT) {\n warn(false, \"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. \" + \"Please check the `on` configuration for \\\"#\".concat(_this.id, \"\\\".\"));\n }\n\n var transitionConfigArray = toTransitionConfigArray(key, strictTransitionConfigs_1[key]);\n\n if (!IS_PRODUCTION) {\n validateArrayifiedTransitions(_this, key, transitionConfigArray);\n }\n\n return transitionConfigArray;\n }).concat(toTransitionConfigArray(WILDCARD, wildcardConfigs)));\n }\n\n var eventlessConfig = this.config.always ? toTransitionConfigArray('', this.config.always) : [];\n var doneConfig = this.config.onDone ? toTransitionConfigArray(String(done(this.id)), this.config.onDone) : [];\n\n if (!IS_PRODUCTION) {\n warn(!(this.config.onDone && !this.parent), \"Root nodes cannot have an \\\".onDone\\\" transition. Please check the config of \\\"\".concat(this.id, \"\\\".\"));\n }\n\n var invokeConfig = flatten(this.invoke.map(function (invokeDef) {\n var settleTransitions = [];\n\n if (invokeDef.onDone) {\n settleTransitions.push.apply(settleTransitions, __spreadArray([], __read(toTransitionConfigArray(String(doneInvoke(invokeDef.id)), invokeDef.onDone)), false));\n }\n\n if (invokeDef.onError) {\n settleTransitions.push.apply(settleTransitions, __spreadArray([], __read(toTransitionConfigArray(String(error(invokeDef.id)), invokeDef.onError)), false));\n }\n\n return settleTransitions;\n }));\n var delayedTransitions = this.after;\n var formattedTransitions = flatten(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(doneConfig), false), __read(invokeConfig), false), __read(onConfig), false), __read(eventlessConfig), false).map(function (transitionConfig) {\n return toArray(transitionConfig).map(function (transition) {\n return _this.formatTransition(transition);\n });\n }));\n\n try {\n for (var delayedTransitions_1 = __values(delayedTransitions), delayedTransitions_1_1 = delayedTransitions_1.next(); !delayedTransitions_1_1.done; delayedTransitions_1_1 = delayedTransitions_1.next()) {\n var delayedTransition = delayedTransitions_1_1.value;\n formattedTransitions.push(delayedTransition);\n }\n } catch (e_10_1) {\n e_10 = {\n error: e_10_1\n };\n } finally {\n try {\n if (delayedTransitions_1_1 && !delayedTransitions_1_1.done && (_a = delayedTransitions_1.return)) _a.call(delayedTransitions_1);\n } finally {\n if (e_10) throw e_10.error;\n }\n }\n\n return formattedTransitions;\n };\n\n return StateNode;\n}();\n\nexport { StateNode };\n", "import { StateNode } from './StateNode.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nvar warned = false;\nfunction Machine(config, options, initialContext) {\n if (initialContext === void 0) {\n initialContext = config.context;\n }\n\n return new StateNode(config, options, initialContext);\n}\nfunction createMachine(config, options) {\n if (!IS_PRODUCTION && !('predictableActionArguments' in config) && !warned) {\n warned = true;\n console.warn('It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html');\n }\n\n return new StateNode(config, options);\n}\n\nexport { Machine, createMachine };\n", "import {Util, emitEvent} from '@qni/common'\nimport {createMachine, interpret} from 'xstate'\nimport {CircuitDropzoneElement} from '../circuit-dropzone-element'\nimport {Constructor} from './constructor'\nimport {InteractEvent} from '@interactjs/types'\nimport {PaletteDropzoneElement} from '../palette-dropzone-element'\nimport {attr} from '@github/catalyst'\nimport {format as prettyFormat} from 'pretty-format'\nimport interact from 'interactjs'\n\nexport const isDraggable = (arg: unknown): arg is Draggable =>\n arg !== undefined && arg !== null && typeof (arg as Draggable).draggable === 'boolean'\n\nexport const isCircuitDropzoneElement = (arg: unknown): arg is CircuitDropzoneElement =>\n arg !== undefined && arg !== null && (arg as Element).tagName === 'CIRCUIT-DROPZONE'\n\nexport const isPaletteDropzoneElement = (arg: unknown): arg is PaletteDropzoneElement =>\n arg !== undefined && arg !== null && (arg as Element).tagName === 'PALETTE-DROPZONE'\n\nexport declare class Draggable {\n get operationX(): number\n set operationX(value: number)\n get operationY(): number\n set operationY(value: number)\n get draggable(): boolean\n set draggable(value: boolean)\n get grabbed(): boolean\n set grabbed(value: boolean)\n get dragging(): boolean\n set dragging(value: boolean)\n get snapped(): boolean\n set snapped(value: boolean)\n get bit(): number\n set bit(value: number)\n get dropzone(): PaletteDropzoneElement | CircuitDropzoneElement | null\n get snapRange(): number\n set snapTargets(value: Array<{x: number; y: number}>)\n initDraggable(): void\n}\n\ntype DraggableContext = Record\ntype DraggableEvent =\n | {type: 'SET_INTERACT'}\n | {type: 'UNSET_INTERACT'}\n | {type: 'DELETE'}\n | {type: 'GRAB'; x: number; y: number}\n | {type: 'RELEASE'}\n | {type: 'START_DRAGGING'}\n | {type: 'END_DRAGGING'}\n | {type: 'SNAP'}\n | {type: 'UNSNAP'}\n\nexport function DraggableMixin>(Base: TBase): Constructor & TBase {\n class DraggableMixinClass extends Base {\n @attr operationX = 0\n @attr operationY = 0\n @attr grabbed = false\n @attr dragging = false\n @attr snapped = false\n @attr bit = -1\n @attr debugDraggable = false\n\n private snappedDropzone!: CircuitDropzoneElement | null | undefined\n private draggableMachine = createMachine(\n {\n id: 'draggable',\n initial: 'idle',\n states: {\n idle: {\n entry: ['init'],\n on: {\n SET_INTERACT: {\n target: 'grabbable',\n actions: ['setInteract'],\n },\n },\n },\n grabbable: {\n on: {\n GRAB: {\n target: 'grabbed',\n actions: ['grab'],\n },\n UNSET_INTERACT: {\n target: 'idle',\n },\n },\n },\n grabbed: {\n on: {\n START_DRAGGING: {\n target: 'dragging',\n actions: ['startDragging'],\n },\n RELEASE: [\n {\n target: 'grabbable',\n actions: ['release'],\n cond: 'isOnCircuitDropzone',\n },\n {\n target: 'deleted',\n actions: ['release'],\n cond: 'isOnPaletteDropzone',\n },\n ],\n },\n },\n dragging: {\n type: 'compound',\n initial: 'unknown',\n on: {\n END_DRAGGING: {\n target: 'dropped',\n actions: ['endDragging'],\n },\n },\n states: {\n unknown: {\n always: [\n {target: 'snapped', cond: 'isOnCircuitDropzone'},\n {target: 'unsnapped', cond: 'isOnPaletteDropzone'},\n ],\n },\n snapped: {\n entry: ['snap'],\n on: {\n UNSNAP: {\n target: 'unsnapped',\n },\n },\n },\n unsnapped: {\n entry: ['unsnap'],\n on: {\n SNAP: {\n target: 'snapped',\n },\n },\n },\n },\n },\n dropped: {\n entry: ['drop'],\n always: [\n {target: 'grabbable', cond: 'isDroppedOnCircuitDropzone'},\n {target: 'deleted', cond: 'isTrashed'},\n ],\n },\n deleted: {\n type: 'final',\n entry: 'delete',\n },\n },\n },\n {\n actions: {\n init: () => {\n emitEvent('draggable:init', {}, this)\n },\n setInteract: (_context, event) => {\n Util.need(event.type === 'SET_INTERACT', 'event type must be SET_INTERACT')\n\n const interactable = interact(this)\n interactable.styleCursor(false)\n\n interactable.pointerEvents({\n ignoreFrom: '.resize-handle',\n })\n interactable.on('down', this.grab.bind(this))\n interactable.on('up', this.release.bind(this))\n\n interactable.draggable({\n onstart: this.startDragging.bind(this),\n onmove: this.dragMove.bind(this),\n onend: this.endDragging.bind(this),\n ignoreFrom: '.resize-handle',\n })\n\n const dropzone = this.dropzone\n if (isCircuitDropzoneElement(dropzone)) {\n this.snappedDropzone = dropzone\n } else {\n this.snappedDropzone = null\n }\n },\n grab: (_context, event) => {\n Util.need(event.type === 'GRAB', 'event type must be GRAB')\n if (event.type !== 'GRAB') return\n\n this.grabbed = true\n emitEvent('draggable:grab', {}, this)\n\n if (isPaletteDropzoneElement(this.dropzone)) {\n this.snapped = false\n this.moveByOffset(event.x, event.y)\n this.classList.remove('qpu-operation-xl')\n }\n },\n release: (_context, event) => {\n Util.need(event.type === 'RELEASE', 'event type must be RELEASE')\n\n this.grabbed = false\n emitEvent('draggable:release', {}, this)\n },\n startDragging: (_context, event) => {\n Util.need(event.type === 'START_DRAGGING', 'event type must be START_DRAGGING')\n\n this.dragging = true\n },\n endDragging: (_context, event) => {\n Util.need(event.type === 'END_DRAGGING', 'event type must be END_DRAGGING')\n\n this.grabbed = false\n this.dragging = false\n emitEvent('draggable:end-dragging', {}, this)\n },\n snap: () => {\n this.snapped = true\n this.snappedDropzone = this.dropzone as CircuitDropzoneElement\n emitEvent('draggable:snap-to-dropzone', {}, this)\n },\n unsnap: () => {\n this.snapped = false\n if (this.snappedDropzone) {\n emitEvent('draggable:unsnap', {}, this.snappedDropzone)\n }\n },\n drop: () => {\n if (!this.snapped) return\n\n this.moveTo(0, 0)\n emitEvent('draggable:drop', {}, this)\n },\n delete: () => {\n interact(this).unset()\n emitEvent('draggable:delete', {}, this)\n },\n },\n guards: {\n isOnCircuitDropzone: () => {\n return isCircuitDropzoneElement(this.dropzone)\n },\n isOnPaletteDropzone: () => {\n return isPaletteDropzoneElement(this.dropzone)\n },\n isDroppedOnCircuitDropzone: () => {\n return this.snapped && isCircuitDropzoneElement(this.dropzone)\n },\n isTrashed: () => {\n return !this.snapped\n },\n },\n },\n )\n public draggableService = interpret(this.draggableMachine).onTransition(state => {\n if (this.debugDraggable) {\n // eslint-disable-next-line no-console\n console.log(`draggable: ${prettyFormat(state.value)}`)\n }\n })\n\n get draggable(): boolean {\n return this.draggableService.state !== undefined\n }\n\n set draggable(value: boolean) {\n if (value) {\n this.draggableService.send({type: 'SET_INTERACT'})\n } else {\n this.draggableService.send({type: 'UNSET_INTERACT'})\n }\n }\n\n initDraggable(): void {\n if (this.draggableService.state !== undefined) {\n return\n }\n\n this.draggableService.start()\n }\n\n get dropzone(): PaletteDropzoneElement | CircuitDropzoneElement | null {\n const el = this.parentElement\n Util.notNull(el)\n\n if (!isPaletteDropzoneElement(el) && !isCircuitDropzoneElement(el)) {\n return null\n }\n return el as PaletteDropzoneElement | CircuitDropzoneElement\n }\n\n set snapTargets(values: Array<{x: number; y: number}>) {\n interact(this).draggable({\n modifiers: [\n interact.modifiers.snap({\n targets: values,\n range: this.snapRange,\n }),\n ],\n listeners: {\n move: this.moveEventListener.bind(this),\n },\n })\n }\n\n get snapRange(): number {\n return 32\n }\n\n private moveEventListener(event: InteractEvent) {\n const snapModifier = event.modifiers![0]\n\n if (snapModifier.inRange) {\n const snapTargetInfo = snapModifier.target.source\n emitEvent('draggable:in-snap-range', {snapTargetInfo}, this)\n\n this.moveTo(0, 0)\n\n if (this.snappedDropzone && this.snappedDropzone !== this.dropzone) {\n this.draggableService.send({type: 'UNSNAP'})\n }\n\n this.draggableService.send({type: 'SNAP'})\n } else {\n if (this.snapped) {\n this.draggableService.send({type: 'UNSNAP'})\n }\n }\n }\n\n private grab(event: MouseEvent): void {\n this.draggableService.send({type: 'GRAB', x: event.offsetX, y: event.offsetY})\n }\n\n private release(): void {\n this.draggableService.send({type: 'RELEASE'})\n }\n\n private startDragging(): void {\n this.draggableService.send({type: 'START_DRAGGING'})\n }\n\n private endDragging(): void {\n this.draggableService.send({type: 'END_DRAGGING'})\n }\n\n private dragMove(event: InteractEvent): void {\n this.move(event.dx, event.dy)\n }\n\n private move(dx: number, dy: number): void {\n const x = this.operationX + dx\n const y = this.operationY + dy\n this.moveTo(x, y)\n }\n\n private moveTo(x: number, y: number): void {\n this.operationX = x\n this.operationY = y\n this.style.transform = `translate(${x}px, ${y}px)`\n }\n\n private moveByOffset(offsetX: number, offsetY: number): void {\n const dx = offsetX - this.clientWidth / 2\n const dy = offsetY - this.clientHeight / 2\n this.move(dx, dy)\n }\n }\n\n return DraggableMixinClass as Constructor & TBase\n}\n", "import {Constructor} from './constructor'\nimport {attr} from '@github/catalyst'\n\nexport declare class Flaggable {\n get flag(): string\n set flag(value: string)\n}\n\nexport const isFlaggable = (arg: unknown): arg is Flaggable =>\n typeof arg === 'object' && arg !== null && typeof (arg as Flaggable).flag === 'string'\n\nexport function FlaggableMixin>(Base: TBase): Constructor & TBase {\n class FlaggableMixinClass extends Base {\n @attr flag = ''\n }\n\n return FlaggableMixinClass as Constructor & TBase\n}\n", "export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];", "export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}", "export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}", "import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };", "import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};", "import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}", "export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;", "import { isHTMLElement } from \"./instanceOf.js\";\nimport { round } from \"../utils/math.js\";\nexport default function getBoundingClientRect(element, includeScale) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n var rect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1;\n\n if (isHTMLElement(element) && includeScale) {\n var offsetHeight = element.offsetHeight;\n var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale\n // Fallback to 1 in case both values are `0`\n\n if (offsetWidth > 0) {\n scaleX = round(rect.width) / offsetWidth || 1;\n }\n\n if (offsetHeight > 0) {\n scaleY = round(rect.height) / offsetHeight || 1;\n }\n }\n\n return {\n width: rect.width / scaleX,\n height: rect.height / scaleY,\n top: rect.top / scaleY,\n right: rect.right / scaleX,\n bottom: rect.bottom / scaleY,\n left: rect.left / scaleX,\n x: rect.left / scaleX,\n y: rect.top / scaleY\n };\n}", "import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}", "import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}", "import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}", "import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}", "import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}", "import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}", "import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;\n var isIE = navigator.userAgent.indexOf('Trident') !== -1;\n\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n\n var currentNode = getParentNode(element);\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}", "export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}", "import { max as mathMax, min as mathMin } from \"./math.js\";\nexport function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}\nexport function withinMaxClamp(min, value, max) {\n var v = within(min, value, max);\n return v > max ? max : v;\n}", "export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}", "import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}", "export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}", "import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport { within } from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n if (!isHTMLElement(arrowElement)) {\n console.error(['Popper: \"arrow\" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: \"arrow\" modifier\\'s `element` must be a child of the popper', 'element.'].join(' '));\n }\n\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};", "export default function getVariation(placement) {\n return placement.split('-')[1];\n}", "import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref) {\n var x = _ref.x,\n y = _ref.y;\n var win = window;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(x * dpr) / dpr || 0,\n y: round(y * dpr) / dpr || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets,\n isFixed = _ref2.isFixed;\n var _offsets$x = offsets.x,\n x = _offsets$x === void 0 ? 0 : _offsets$x,\n _offsets$y = offsets.y,\n y = _offsets$y === void 0 ? 0 : _offsets$y;\n\n var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref3.x;\n y = _ref3.y;\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom;\n var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]\n offsetParent[heightProp];\n y -= offsetY - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right;\n var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]\n offsetParent[widthProp];\n x -= offsetX - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n var _ref4 = roundOffsets === true ? roundOffsetsByDPR({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref4.x;\n y = _ref4.y;\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref5) {\n var state = _ref5.state,\n options = _ref5.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n\n if (process.env.NODE_ENV !== \"production\") {\n var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';\n\n if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {\n return transitionProperty.indexOf(property) >= 0;\n })) {\n console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: \"transform\", \"top\", \"right\", \"bottom\", \"left\".', '\\n\\n', 'Disable the \"computeStyles\" modifier\\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\\n\\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));\n }\n }\n\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration,\n isFixed: state.options.strategy === 'fixed'\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};", "import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};", "var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}", "var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}", "import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}", "import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}", "import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nexport default function getViewportRect(element) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper\n // can be obscured underneath it.\n // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even\n // if it isn't open, so if this isn't available, the popper will be detected\n // to overflow the bottom of the screen too early.\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)\n // In Chrome, it returns a value very close to 0 (+/-) but contains rounding\n // errors due to floating point numbers, so we need to check precision.\n // Safari returns a number <= 0, usually < -1 when pinch-zoomed\n // Feature detection fails in mobile emulation mode in Chrome.\n // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <\n // 0.001\n // Fallback here: \"Not Safari\" userAgent\n\n if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}", "import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}", "import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}", "import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}", "import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}", "export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}", "import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element) {\n var rect = getBoundingClientRect(element);\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}", "import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}", "import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}", "import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, \"auto\" cannot be used to allow \"bottom-start\".', 'Use \"auto-start\" instead.'].join(' '));\n }\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}", "import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases \u2013 research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};", "import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};", "import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};", "import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};", "export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}", "import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport { within, withinMaxClamp } from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { min as mathMin, max as mathMax } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {\n mainAxis: tetherOffsetValue,\n altAxis: tetherOffsetValue\n } : Object.assign({\n mainAxis: 0,\n altAxis: 0\n }, tetherOffsetValue);\n var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis) {\n var _offsetModifierState$;\n\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = offset + overflow[mainSide];\n var max = offset - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;\n var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = offset + maxOffset - offsetModifierValue;\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _offsetModifierState$2;\n\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _len = altAxis === 'y' ? 'height' : 'width';\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var isOriginSide = [top, left].indexOf(basePlacement) !== -1;\n\n var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;\n\n var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;\n\n var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;\n\n var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};", "export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}", "import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}", "import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport { round } from \"../utils/math.js\";\n\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = round(rect.width) / element.offsetWidth || 1;\n var scaleY = round(rect.height) / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}", "import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}", "export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}", "export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}", "import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport getComputedStyle from \"./dom-utils/getComputedStyle.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport validateModifiers from \"./utils/validateModifiers.js\";\nimport uniqueBy from \"./utils/uniqueBy.js\";\nimport getBasePlacement from \"./utils/getBasePlacement.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nimport { auto } from \"./enums.js\";\nvar INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';\nvar INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n }); // Validate the provided modifiers so that the consumer will get warned\n // if one of the modifiers is invalid for any reason\n\n if (process.env.NODE_ENV !== \"production\") {\n var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {\n var name = _ref.name;\n return name;\n });\n validateModifiers(modifiers);\n\n if (getBasePlacement(state.options.placement) === auto) {\n var flipModifier = state.orderedModifiers.find(function (_ref2) {\n var name = _ref2.name;\n return name === 'flip';\n });\n\n if (!flipModifier) {\n console.error(['Popper: \"auto\" placements require the \"flip\" modifier be', 'present and enabled to work.'].join(' '));\n }\n }\n\n var _getComputedStyle = getComputedStyle(popper),\n marginTop = _getComputedStyle.marginTop,\n marginRight = _getComputedStyle.marginRight,\n marginBottom = _getComputedStyle.marginBottom,\n marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can\n // cause bugs with positioning, so we'll warn the consumer\n\n\n if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {\n return parseFloat(margin);\n })) {\n console.warn(['Popper: CSS \"margin\" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));\n }\n }\n\n runModifierEffects();\n return instance.update();\n },\n // Sync update \u2013 it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n var __debug_loops__ = 0;\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (process.env.NODE_ENV !== \"production\") {\n __debug_loops__ += 1;\n\n if (__debug_loops__ > 100) {\n console.error(INFINITE_LOOP_ERROR);\n break;\n }\n }\n\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update \u2013 it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref3) {\n var name = _ref3.name,\n _ref3$options = _ref3.options,\n options = _ref3$options === void 0 ? {} : _ref3$options,\n effect = _ref3.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };", "import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";", "export const ROUND_ARROW =\n '';\n\nexport const BOX_CLASS = `__NAMESPACE_PREFIX__-box`;\nexport const CONTENT_CLASS = `__NAMESPACE_PREFIX__-content`;\nexport const BACKDROP_CLASS = `__NAMESPACE_PREFIX__-backdrop`;\nexport const ARROW_CLASS = `__NAMESPACE_PREFIX__-arrow`;\nexport const SVG_ARROW_CLASS = `__NAMESPACE_PREFIX__-svg-arrow`;\n\nexport const TOUCH_OPTIONS = {passive: true, capture: true};\n\nexport const TIPPY_DEFAULT_APPEND_TO = () => document.body;\n", "import {BasePlacement, Placement} from './types';\n\nexport function hasOwnProperty(\n obj: Record,\n key: string\n): boolean {\n return {}.hasOwnProperty.call(obj, key);\n}\n\nexport function getValueAtIndexOrReturn(\n value: T | [T | null, T | null],\n index: number,\n defaultValue: T | [T, T]\n): T {\n if (Array.isArray(value)) {\n const v = value[index];\n return v == null\n ? Array.isArray(defaultValue)\n ? defaultValue[index]\n : defaultValue\n : v;\n }\n\n return value;\n}\n\nexport function isType(value: any, type: string): boolean {\n const str = {}.toString.call(value);\n return str.indexOf('[object') === 0 && str.indexOf(`${type}]`) > -1;\n}\n\nexport function invokeWithArgsOrReturn(value: any, args: any[]): any {\n return typeof value === 'function' ? value(...args) : value;\n}\n\nexport function debounce(\n fn: (arg: T) => void,\n ms: number\n): (arg: T) => void {\n // Avoid wrapping in `setTimeout` if ms is 0 anyway\n if (ms === 0) {\n return fn;\n }\n\n let timeout: any;\n\n return (arg): void => {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n fn(arg);\n }, ms);\n };\n}\n\nexport function removeProperties(obj: T, keys: string[]): Partial {\n const clone = {...obj};\n keys.forEach((key) => {\n delete (clone as any)[key];\n });\n return clone;\n}\n\nexport function splitBySpaces(value: string): string[] {\n return value.split(/\\s+/).filter(Boolean);\n}\n\nexport function normalizeToArray(value: T | T[]): T[] {\n return ([] as T[]).concat(value);\n}\n\nexport function pushIfUnique(arr: T[], value: T): void {\n if (arr.indexOf(value) === -1) {\n arr.push(value);\n }\n}\n\nexport function appendPxIfNumber(value: string | number): string {\n return typeof value === 'number' ? `${value}px` : value;\n}\n\nexport function unique(arr: T[]): T[] {\n return arr.filter((item, index) => arr.indexOf(item) === index);\n}\n\nexport function getNumber(value: string | number): number {\n return typeof value === 'number' ? value : parseFloat(value);\n}\n\nexport function getBasePlacement(placement: Placement): BasePlacement {\n return placement.split('-')[0] as BasePlacement;\n}\n\nexport function arrayFrom(value: ArrayLike): any[] {\n return [].slice.call(value);\n}\n\nexport function removeUndefinedProps(\n obj: Record\n): Partial> {\n return Object.keys(obj).reduce((acc, key) => {\n if (obj[key] !== undefined) {\n (acc as any)[key] = obj[key];\n }\n\n return acc;\n }, {});\n}\n", "import {ReferenceElement, Targets} from './types';\nimport {PopperTreeData} from './types-internal';\nimport {arrayFrom, isType, normalizeToArray, getBasePlacement} from './utils';\n\nexport function div(): HTMLDivElement {\n return document.createElement('div');\n}\n\nexport function isElement(value: unknown): value is Element | DocumentFragment {\n return ['Element', 'Fragment'].some((type) => isType(value, type));\n}\n\nexport function isNodeList(value: unknown): value is NodeList {\n return isType(value, 'NodeList');\n}\n\nexport function isMouseEvent(value: unknown): value is MouseEvent {\n return isType(value, 'MouseEvent');\n}\n\nexport function isReferenceElement(value: any): value is ReferenceElement {\n return !!(value && value._tippy && value._tippy.reference === value);\n}\n\nexport function getArrayOfElements(value: Targets): Element[] {\n if (isElement(value)) {\n return [value];\n }\n\n if (isNodeList(value)) {\n return arrayFrom(value);\n }\n\n if (Array.isArray(value)) {\n return value;\n }\n\n return arrayFrom(document.querySelectorAll(value));\n}\n\nexport function setTransitionDuration(\n els: (HTMLDivElement | null)[],\n value: number\n): void {\n els.forEach((el) => {\n if (el) {\n el.style.transitionDuration = `${value}ms`;\n }\n });\n}\n\nexport function setVisibilityState(\n els: (HTMLDivElement | null)[],\n state: 'visible' | 'hidden'\n): void {\n els.forEach((el) => {\n if (el) {\n el.setAttribute('data-state', state);\n }\n });\n}\n\nexport function getOwnerDocument(\n elementOrElements: Element | Element[]\n): Document {\n const [element] = normalizeToArray(elementOrElements);\n\n // Elements created via a