avada-wheel-canvas-react
Version:
A React component library for lucky draw games
1,399 lines (1,397 loc) • 82.1 kB
JavaScript
import K from "react";
var Ot = { exports: {} }, gt = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Zt;
function $e() {
if (Zt) return gt;
Zt = 1;
var l = K, t = Symbol.for("react.element"), e = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, r = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = { key: !0, ref: !0, __self: !0, __source: !0 };
function h(o, a, f) {
var u, c = {}, g = null, w = null;
f !== void 0 && (g = "" + f), a.key !== void 0 && (g = "" + a.key), a.ref !== void 0 && (w = a.ref);
for (u in a) i.call(a, u) && !n.hasOwnProperty(u) && (c[u] = a[u]);
if (o && o.defaultProps) for (u in a = o.defaultProps, a) c[u] === void 0 && (c[u] = a[u]);
return { $$typeof: t, type: o, key: g, ref: w, props: c, _owner: r.current };
}
return gt.Fragment = e, gt.jsx = h, gt.jsxs = h, gt;
}
var pt = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Qt;
function Ae() {
return Qt || (Qt = 1, process.env.NODE_ENV !== "production" && function() {
var l = K, t = Symbol.for("react.element"), e = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), r = Symbol.for("react.strict_mode"), n = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), o = Symbol.for("react.context"), a = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), c = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), w = Symbol.for("react.offscreen"), y = Symbol.iterator, E = "@@iterator";
function p(s) {
if (s === null || typeof s != "object")
return null;
var d = y && s[y] || s[E];
return typeof d == "function" ? d : null;
}
var k = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function b(s) {
{
for (var d = arguments.length, m = new Array(d > 1 ? d - 1 : 0), v = 1; v < d; v++)
m[v - 1] = arguments[v];
x("error", s, m);
}
}
function x(s, d, m) {
{
var v = k.ReactDebugCurrentFrame, _ = v.getStackAddendum();
_ !== "" && (d += "%s", m = m.concat([_]));
var R = m.map(function(z) {
return String(z);
});
R.unshift("Warning: " + d), Function.prototype.apply.call(console[s], console, R);
}
}
var S = !1, A = !1, T = !1, I = !1, W = !1, D;
D = Symbol.for("react.module.reference");
function O(s) {
return !!(typeof s == "string" || typeof s == "function" || s === i || s === n || W || s === r || s === f || s === u || I || s === w || S || A || T || typeof s == "object" && s !== null && (s.$$typeof === g || s.$$typeof === c || s.$$typeof === h || s.$$typeof === o || s.$$typeof === a || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
s.$$typeof === D || s.getModuleId !== void 0));
}
function H(s, d, m) {
var v = s.displayName;
if (v)
return v;
var _ = d.displayName || d.name || "";
return _ !== "" ? m + "(" + _ + ")" : m;
}
function Y(s) {
return s.displayName || "Context";
}
function F(s) {
if (s == null)
return null;
if (typeof s.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof s == "function")
return s.displayName || s.name || null;
if (typeof s == "string")
return s;
switch (s) {
case i:
return "Fragment";
case e:
return "Portal";
case n:
return "Profiler";
case r:
return "StrictMode";
case f:
return "Suspense";
case u:
return "SuspenseList";
}
if (typeof s == "object")
switch (s.$$typeof) {
case o:
var d = s;
return Y(d) + ".Consumer";
case h:
var m = s;
return Y(m._context) + ".Provider";
case a:
return H(s, s.render, "ForwardRef");
case c:
var v = s.displayName || null;
return v !== null ? v : F(s.type) || "Memo";
case g: {
var _ = s, R = _._payload, z = _._init;
try {
return F(z(R));
} catch {
return null;
}
}
}
return null;
}
var j = Object.assign, U = 0, it, lt, $, ct, V, Z, st;
function rt() {
}
rt.__reactDisabledLog = !0;
function ut() {
{
if (U === 0) {
it = console.log, lt = console.info, $ = console.warn, ct = console.error, V = console.group, Z = console.groupCollapsed, st = console.groupEnd;
var s = {
configurable: !0,
enumerable: !0,
value: rt,
writable: !0
};
Object.defineProperties(console, {
info: s,
log: s,
warn: s,
error: s,
group: s,
groupCollapsed: s,
groupEnd: s
});
}
U++;
}
}
function Ct() {
{
if (U--, U === 0) {
var s = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: j({}, s, {
value: it
}),
info: j({}, s, {
value: lt
}),
warn: j({}, s, {
value: $
}),
error: j({}, s, {
value: ct
}),
group: j({}, s, {
value: V
}),
groupCollapsed: j({}, s, {
value: Z
}),
groupEnd: j({}, s, {
value: st
})
});
}
U < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var Q = k.ReactCurrentDispatcher, nt;
function X(s, d, m) {
{
if (nt === void 0)
try {
throw Error();
} catch (_) {
var v = _.stack.trim().match(/\n( *(at )?)/);
nt = v && v[1] || "";
}
return `
` + nt + s;
}
}
var ft = !1, wt;
{
var oe = typeof WeakMap == "function" ? WeakMap : Map;
wt = new oe();
}
function Ft(s, d) {
if (!s || ft)
return "";
{
var m = wt.get(s);
if (m !== void 0)
return m;
}
var v;
ft = !0;
var _ = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var R;
R = Q.current, Q.current = null, ut();
try {
if (d) {
var z = function() {
throw Error();
};
if (Object.defineProperty(z.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(z, []);
} catch (B) {
v = B;
}
Reflect.construct(s, [], z);
} else {
try {
z.call();
} catch (B) {
v = B;
}
s.call(z.prototype);
}
} else {
try {
throw Error();
} catch (B) {
v = B;
}
s();
}
} catch (B) {
if (B && v && typeof B.stack == "string") {
for (var C = B.stack.split(`
`), M = v.stack.split(`
`), L = C.length - 1, P = M.length - 1; L >= 1 && P >= 0 && C[L] !== M[P]; )
P--;
for (; L >= 1 && P >= 0; L--, P--)
if (C[L] !== M[P]) {
if (L !== 1 || P !== 1)
do
if (L--, P--, P < 0 || C[L] !== M[P]) {
var N = `
` + C[L].replace(" at new ", " at ");
return s.displayName && N.includes("<anonymous>") && (N = N.replace("<anonymous>", s.displayName)), typeof s == "function" && wt.set(s, N), N;
}
while (L >= 1 && P >= 0);
break;
}
}
} finally {
ft = !1, Q.current = R, Ct(), Error.prepareStackTrace = _;
}
var at = s ? s.displayName || s.name : "", tt = at ? X(at) : "";
return typeof s == "function" && wt.set(s, tt), tt;
}
function ae(s, d, m) {
return Ft(s, !1);
}
function he(s) {
var d = s.prototype;
return !!(d && d.isReactComponent);
}
function bt(s, d, m) {
if (s == null)
return "";
if (typeof s == "function")
return Ft(s, he(s));
if (typeof s == "string")
return X(s);
switch (s) {
case f:
return X("Suspense");
case u:
return X("SuspenseList");
}
if (typeof s == "object")
switch (s.$$typeof) {
case a:
return ae(s.render);
case c:
return bt(s.type, d, m);
case g: {
var v = s, _ = v._payload, R = v._init;
try {
return bt(R(_), d, m);
} catch {
}
}
}
return "";
}
var dt = Object.prototype.hasOwnProperty, Dt = {}, jt = k.ReactDebugCurrentFrame;
function vt(s) {
if (s) {
var d = s._owner, m = bt(s.type, s._source, d ? d.type : null);
jt.setExtraStackFrame(m);
} else
jt.setExtraStackFrame(null);
}
function le(s, d, m, v, _) {
{
var R = Function.call.bind(dt);
for (var z in s)
if (R(s, z)) {
var C = void 0;
try {
if (typeof s[z] != "function") {
var M = Error((v || "React class") + ": " + m + " type `" + z + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof s[z] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw M.name = "Invariant Violation", M;
}
C = s[z](d, z, v, m, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (L) {
C = L;
}
C && !(C instanceof Error) && (vt(_), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", v || "React class", m, z, typeof C), vt(null)), C instanceof Error && !(C.message in Dt) && (Dt[C.message] = !0, vt(_), b("Failed %s type: %s", m, C.message), vt(null));
}
}
}
var ce = Array.isArray;
function Et(s) {
return ce(s);
}
function ue(s) {
{
var d = typeof Symbol == "function" && Symbol.toStringTag, m = d && s[Symbol.toStringTag] || s.constructor.name || "Object";
return m;
}
}
function fe(s) {
try {
return Mt(s), !1;
} catch {
return !0;
}
}
function Mt(s) {
return "" + s;
}
function Ht(s) {
if (fe(s))
return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ue(s)), Mt(s);
}
var Bt = k.ReactCurrentOwner, de = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, Nt, Ut;
function ge(s) {
if (dt.call(s, "ref")) {
var d = Object.getOwnPropertyDescriptor(s, "ref").get;
if (d && d.isReactWarning)
return !1;
}
return s.ref !== void 0;
}
function pe(s) {
if (dt.call(s, "key")) {
var d = Object.getOwnPropertyDescriptor(s, "key").get;
if (d && d.isReactWarning)
return !1;
}
return s.key !== void 0;
}
function me(s, d) {
typeof s.ref == "string" && Bt.current;
}
function ye(s, d) {
{
var m = function() {
Nt || (Nt = !0, b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", d));
};
m.isReactWarning = !0, Object.defineProperty(s, "key", {
get: m,
configurable: !0
});
}
}
function we(s, d) {
{
var m = function() {
Ut || (Ut = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", d));
};
m.isReactWarning = !0, Object.defineProperty(s, "ref", {
get: m,
configurable: !0
});
}
}
var be = function(s, d, m, v, _, R, z) {
var C = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: t,
// Built-in properties that belong on the element
type: s,
key: d,
ref: m,
props: z,
// Record the component responsible for creating this element.
_owner: R
};
return C._store = {}, Object.defineProperty(C._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(C, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: v
}), Object.defineProperty(C, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: _
}), Object.freeze && (Object.freeze(C.props), Object.freeze(C)), C;
};
function ve(s, d, m, v, _) {
{
var R, z = {}, C = null, M = null;
m !== void 0 && (Ht(m), C = "" + m), pe(d) && (Ht(d.key), C = "" + d.key), ge(d) && (M = d.ref, me(d, _));
for (R in d)
dt.call(d, R) && !de.hasOwnProperty(R) && (z[R] = d[R]);
if (s && s.defaultProps) {
var L = s.defaultProps;
for (R in L)
z[R] === void 0 && (z[R] = L[R]);
}
if (C || M) {
var P = typeof s == "function" ? s.displayName || s.name || "Unknown" : s;
C && ye(z, P), M && we(z, P);
}
return be(s, C, M, _, v, Bt.current, z);
}
}
var xt = k.ReactCurrentOwner, Yt = k.ReactDebugCurrentFrame;
function ot(s) {
if (s) {
var d = s._owner, m = bt(s.type, s._source, d ? d.type : null);
Yt.setExtraStackFrame(m);
} else
Yt.setExtraStackFrame(null);
}
var zt;
zt = !1;
function _t(s) {
return typeof s == "object" && s !== null && s.$$typeof === t;
}
function Xt() {
{
if (xt.current) {
var s = F(xt.current.type);
if (s)
return `
Check the render method of \`` + s + "`.";
}
return "";
}
}
function Se(s) {
return "";
}
var Gt = {};
function ke(s) {
{
var d = Xt();
if (!d) {
var m = typeof s == "string" ? s : s.displayName || s.name;
m && (d = `
Check the top-level render call using <` + m + ">.");
}
return d;
}
}
function Vt(s, d) {
{
if (!s._store || s._store.validated || s.key != null)
return;
s._store.validated = !0;
var m = ke(d);
if (Gt[m])
return;
Gt[m] = !0;
var v = "";
s && s._owner && s._owner !== xt.current && (v = " It was passed a child from " + F(s._owner.type) + "."), ot(s), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', m, v), ot(null);
}
}
function qt(s, d) {
{
if (typeof s != "object")
return;
if (Et(s))
for (var m = 0; m < s.length; m++) {
var v = s[m];
_t(v) && Vt(v, d);
}
else if (_t(s))
s._store && (s._store.validated = !0);
else if (s) {
var _ = p(s);
if (typeof _ == "function" && _ !== s.entries)
for (var R = _.call(s), z; !(z = R.next()).done; )
_t(z.value) && Vt(z.value, d);
}
}
}
function Ce(s) {
{
var d = s.type;
if (d == null || typeof d == "string")
return;
var m;
if (typeof d == "function")
m = d.propTypes;
else if (typeof d == "object" && (d.$$typeof === a || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
d.$$typeof === c))
m = d.propTypes;
else
return;
if (m) {
var v = F(d);
le(m, s.props, "prop", v, s);
} else if (d.PropTypes !== void 0 && !zt) {
zt = !0;
var _ = F(d);
b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _ || "Unknown");
}
typeof d.getDefaultProps == "function" && !d.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function Ee(s) {
{
for (var d = Object.keys(s.props), m = 0; m < d.length; m++) {
var v = d[m];
if (v !== "children" && v !== "key") {
ot(s), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", v), ot(null);
break;
}
}
s.ref !== null && (ot(s), b("Invalid attribute `ref` supplied to `React.Fragment`."), ot(null));
}
}
var Jt = {};
function Kt(s, d, m, v, _, R) {
{
var z = O(s);
if (!z) {
var C = "";
(s === void 0 || typeof s == "object" && s !== null && Object.keys(s).length === 0) && (C += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var M = Se();
M ? C += M : C += Xt();
var L;
s === null ? L = "null" : Et(s) ? L = "array" : s !== void 0 && s.$$typeof === t ? (L = "<" + (F(s.type) || "Unknown") + " />", C = " Did you accidentally export a JSX literal instead of a component?") : L = typeof s, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", L, C);
}
var P = ve(s, d, m, _, R);
if (P == null)
return P;
if (z) {
var N = d.children;
if (N !== void 0)
if (v)
if (Et(N)) {
for (var at = 0; at < N.length; at++)
qt(N[at], s);
Object.freeze && Object.freeze(N);
} else
b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
else
qt(N, s);
}
if (dt.call(d, "key")) {
var tt = F(s), B = Object.keys(d).filter(function(Oe) {
return Oe !== "key";
}), Rt = B.length > 0 ? "{key: someKey, " + B.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!Jt[tt + Rt]) {
var Te = B.length > 0 ? "{" + B.join(": ..., ") + ": ...}" : "{}";
b(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`, Rt, tt, Te, tt), Jt[tt + Rt] = !0;
}
}
return s === i ? Ee(P) : Ce(P), P;
}
}
function xe(s, d, m) {
return Kt(s, d, m, !0);
}
function ze(s, d, m) {
return Kt(s, d, m, !1);
}
var _e = ze, Re = xe;
pt.Fragment = i, pt.jsx = _e, pt.jsxs = Re;
}()), pt;
}
process.env.NODE_ENV === "production" ? Ot.exports = $e() : Ot.exports = Ae();
var $t = Ot.exports;
Array.prototype.includes || Object.defineProperty(Array.prototype, "includes", {
value: function(l, t) {
if (this == null)
throw new TypeError('"this" is null or not defined');
var e = Object(this), i = e.length >>> 0;
if (i === 0)
return !1;
var r = t | 0, n = Math.max(r >= 0 ? r : i - Math.abs(r), 0);
function h(o, a) {
return o === a || typeof o == "number" && typeof a == "number" && isNaN(o) && isNaN(a);
}
for (; n < i; ) {
if (h(e[n], l))
return !0;
n++;
}
return !1;
}
});
String.prototype.includes || (String.prototype.includes = function(l, t) {
return typeof t != "number" && (t = 0), t + l.length > this.length ? !1 : this.indexOf(l, t) !== -1;
});
Array.prototype.find || Object.defineProperty(Array.prototype, "find", {
value: function(l) {
if (this == null)
throw new TypeError('"this" is null or not defined');
var t = Object(this), e = t.length >>> 0;
if (typeof l != "function")
throw new TypeError("predicate must be a function");
for (var i = arguments[1], r = 0; r < e; ) {
var n = t[r];
if (l.call(i, n, r, t))
return n;
r++;
}
}
});
const mt = (l, ...t) => t.some((e) => Object.prototype.toString.call(l).slice(8, -1).toLowerCase() === e), ht = (l, t) => Object.prototype.hasOwnProperty.call(l, t), At = (l) => [].filter.call(l, (t) => t !== `
`).join(""), Ie = (l) => l === null ? 0 : typeof l == "object" ? NaN : typeof l == "number" ? l : typeof l == "string" ? l[l.length - 1] === "%" ? Number(l.slice(0, -1)) / 100 : Number(l) : NaN, J = (l) => {
if (typeof l != "string" || (l = l.toLocaleLowerCase().trim(), l === "transparent")) return !1;
if (/^rgba/.test(l)) {
const t = /([^\s,]+)\)$/.exec(l);
if (Ie(t) === 0) return !1;
}
return !0;
}, ie = (l, t) => {
var a;
let e = ((a = l.padding) == null ? void 0 : a.split(" ").map((f) => t(f))) || [0], i = 0, r = 0, n = 0, h = 0;
switch (e.length) {
case 1:
i = r = n = h = e[0];
break;
case 2:
i = r = e[0], n = h = e[1];
break;
case 3:
i = e[0], n = h = e[1], r = e[2];
break;
default:
i = e[0], r = e[1], n = e[2], h = e[3];
}
const o = { paddingTop: i, paddingBottom: r, paddingLeft: n, paddingRight: h };
for (let f in o)
o[f] = ht(l, f) && mt(l[f], "string", "number") ? t(l[f]) : o[f];
return [i, r, n, h];
}, Le = (l, t = 300) => {
let e = null;
return function(...i) {
e || (e = setTimeout(() => {
l.apply(this, i), clearTimeout(e), e = null;
}, t));
};
}, se = (l) => {
const t = [], e = l.map((r) => Number(r)).reduce((r, n) => {
if (n > 0) {
const h = r + n;
return t.push(h), h;
} else
return t.push(NaN), r;
}, 0), i = Math.random() * e;
return t.findIndex((r) => i <= r);
}, It = (l, t, e, i = 1 / 0) => {
i <= 0 && (i = 1 / 0);
const r = t.split(" ");
let n = [], h = "";
const o = l.measureText("...").width;
for (let a = 0; a < r.length; a++) {
let f = r[a], u = h ? h + " " + f : f, c = l.measureText(u).width;
const g = e(n);
if (i === n.length + 1 && (c += o), g < 0) return n;
if (c > g && h) {
if (n.push(h), h = f, n.length === i)
return n[n.length - 1] += "...", n;
} else
h = u;
}
return h && n.push(h), n.length || n.push(t), n;
}, Pe = (l, t) => {
const e = {}, i = [];
for (let r = 0; r < l.length; r++)
e[r] = l[r];
for (let r = 0; r < t.length; r++) {
const n = e[t[r]];
n && (i[r] = n);
}
return i;
}, We = "avada-wheel-canvas", Tt = "1.0.0";
class et {
/**
* Subscription center constructor
*/
constructor() {
this.subs = [];
}
/**
* Collect dependencies
* @param {*} sub
*/
addSub(t) {
this.subs.includes(t) || this.subs.push(t);
}
/**
* Dispatch updates
*/
notify() {
this.subs.forEach((t) => {
t.update();
});
}
}
const Fe = "__proto__" in {};
function te(l, t, e, i) {
Object.defineProperty(l, t, {
value: e,
enumerable: !1,
writable: !0,
configurable: !0
});
}
function De(l) {
l += ".";
let t = [], e = "";
for (let i = 0; i < l.length; i++) {
let r = l[i];
if (/\[|\./.test(r))
t.push(e), e = "";
else {
if (/\W/.test(r))
continue;
e += r;
}
}
return function(i) {
return t.reduce((r, n) => r[n], i);
};
}
function je(l) {
const t = (e) => {
mt(e, "array", "object") && Object.keys(e).forEach((i) => {
const r = e[i];
t(r);
});
};
t(l);
}
const re = Array.prototype, St = Object.create(re), Me = ["push", "pop", "shift", "unshift", "sort", "splice", "reverse"];
Me.forEach((l) => {
St[l] = function(...t) {
const e = re[l].apply(this, t), i = this.__luckyOb__;
return ["push", "unshift", "splice"].includes(l) && i.walk(this), i.dep.notify(), e;
};
});
class He {
/**
* Observer constructor
* @param value
*/
constructor(t) {
this.dep = new et(), te(t, "__luckyOb__", this), Array.isArray(t) && (Fe ? t.__proto__ = St : Object.getOwnPropertyNames(St).forEach((e) => {
te(t, e, St[e]);
})), this.walk(t);
}
walk(t) {
Object.keys(t).forEach((e) => {
ne(t, e, t[e]);
});
}
}
function ee(l) {
if (!l || typeof l != "object") return;
let t;
return "__luckyOb__" in l ? t = l.__luckyOb__ : t = new He(l), t;
}
function ne(l, t, e) {
const i = new et(), r = Object.getOwnPropertyDescriptor(l, t);
if (r && r.configurable === !1)
return;
const n = r && r.get, h = r && r.set;
(!n || h) && arguments.length === 2 && (e = l[t]);
let o = ee(e);
Object.defineProperty(l, t, {
get: () => {
const a = n ? n.call(l) : e;
return et.target && (i.addSub(et.target), o && o.dep.addSub(et.target)), a;
},
set: (a) => {
a !== e && (e = a, !(n && !h) && (h ? h.call(l, a) : e = a, o = ee(a), i.notify()));
}
});
}
let Be = 0;
class Ne {
/**
* Observer constructor
* @param {*} $lucky
* @param {*} expr
* @param {*} cb
*/
constructor(t, e, i, r = {}) {
this.id = Be++, this.$lucky = t, this.expr = e, this.deep = !!r.deep, typeof e == "function" ? this.getter = e : this.getter = De(e), this.cb = i, this.value = this.get();
}
/**
* Get new value based on expression
*/
get() {
et.target = this;
const t = this.getter.call(this.$lucky, this.$lucky);
return this.deep && je(t), et.target = null, t;
}
/**
* Trigger watcher update
*/
update() {
const t = this.get(), e = this.value;
this.value = t, this.cb.call(this.$lucky, t, e);
}
}
const Wt = class Wt {
/**
* Common constructor
* @param config
*/
constructor(t, e) {
this.version = Tt, this.htmlFontSize = 16, this.rAF = function() {
}, this.boxWidth = 0, this.boxHeight = 0, typeof t == "string" ? t = { el: t } : t.nodeType === 1 && (t = { el: "", divElement: t }), t = t, this.config = t, this.data = e, t.flag || (t.flag = "WEB"), t.el && (t.divElement = document.querySelector(t.el)), t.divElement && (t.canvasElement = document.createElement("canvas"), t.divElement.appendChild(t.canvasElement)), t.canvasElement && (t.ctx = t.canvasElement.getContext("2d"), t.canvasElement.setAttribute("package", `${We}@${Tt}`), t.canvasElement.addEventListener("click", (i) => this.handleClick(i))), this.ctx = t.ctx, this.initWindowFunction(), this.config.ctx || console.error("Unable to get CanvasContext2D"), window && typeof window.addEventListener == "function" && window.addEventListener("resize", Le(() => this.resize(), 300)), window && typeof window.MutationObserver == "function" && new window.MutationObserver(() => {
this.resize();
}).observe(document.documentElement, { attributes: !0 });
}
/**
* Initialize component size/units
*/
resize() {
var t, e;
(e = (t = this.config).beforeResize) == null || e.call(t), this.setHTMLFontSize(), this.setDpr(), this.resetWidthAndHeight(), this.zoomCanvas();
}
/**
* Initialize method
*/
initLucky() {
if (this.resize(), !this.boxWidth || !this.boxHeight)
return console.error("Unable to get width or height");
}
/**
* Mouse click event
* @param e Event parameters
*/
handleClick(t) {
}
/**
* Root tag font size
*/
setHTMLFontSize() {
window && (this.htmlFontSize = +window.getComputedStyle(document.documentElement).fontSize.slice(0, -2));
}
// Clear canvas
clearCanvas() {
const [t, e] = [this.boxWidth, this.boxHeight];
this.ctx.clearRect(-t, -e, t * 2, e * 2);
}
/**
* Device pixel ratio
* Automatically obtained in window environment, manually passed in other environments
*/
setDpr() {
const { config: t } = this;
t.dpr || (window ? window.dpr = t.dpr = window.devicePixelRatio || 1 : t.dpr || console.error(t, "No dpr provided may cause rendering issues"));
}
/**
* Reset box and canvas width/height
*/
resetWidthAndHeight() {
const { config: t, data: e } = this;
let i = 0, r = 0;
t.divElement && (i = t.divElement.offsetWidth, r = t.divElement.offsetHeight), this.boxWidth = this.getLength(e.width || t.width) || i, this.boxHeight = this.getLength(e.height || t.height) || r, t.divElement && (t.divElement.style.overflow = "hidden", t.divElement.style.width = this.boxWidth + "px", t.divElement.style.height = this.boxHeight + "px");
}
/**
* Scale canvas according to dpr and handle displacement
*/
zoomCanvas() {
const { config: t, ctx: e } = this, { canvasElement: i, dpr: r } = t, [n, h] = [this.boxWidth * r, this.boxHeight * r];
i && (i.width = n, i.height = h, i.style.width = `${n}px`, i.style.height = `${h}px`, i.style["transform-origin"] = "left top", i.style.transform = `scale(${1 / r})`, e.scale(r, r));
}
/**
* Get some methods from window object
*/
initWindowFunction() {
const { config: t } = this;
if (window) {
this.rAF = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(e) {
window.setTimeout(e, 1e3 / 60);
}, t.setTimeout = window.setTimeout, t.setInterval = window.setInterval, t.clearTimeout = window.clearTimeout, t.clearInterval = window.clearInterval;
return;
}
if (t.rAF)
this.rAF = t.rAF;
else if (t.setTimeout) {
const e = t.setTimeout;
this.rAF = (i) => e(i, 16.7);
} else
this.rAF = (e) => setTimeout(e, 16.7);
}
isWeb() {
return ["WEB", "UNI-H5", "TARO-H5"].includes(this.config.flag);
}
/**
* Asynchronously load image and return image geometric information
* @param src Image path
* @param info Image information
*/
loadImg(t, e, i = "$resolve") {
return new Promise((r, n) => {
if (t || n(`=> '${e.src}' cannot be empty or invalid`), this.config.flag === "WEB") {
let h = new Image();
h.crossorigin = "anonymous", h.onload = () => r(h), h.onerror = () => n(`=> '${e.src}' image load failed`), h.src = t;
} else {
e[i] = r, e.$reject = n;
return;
}
});
}
/**
* Common method for drawing images
* @param imgObj Image object
* @param rectInfo: [x-axis position, y-axis position, render width, render height]
*/
drawImage(t, e, ...i) {
var a, f;
let r;
const { flag: n, dpr: h } = this.config;
if (["WEB", "MP-WX"].includes(n))
r = e;
else if (["UNI-H5", "UNI-MP", "TARO-H5", "TARO-MP"].includes(n))
r = e.path;
else
return console.error("Unexpected flag, platform not yet compatible!");
const o = (f = (a = r.canvas || r).getContext) == null ? void 0 : f.call(a, "2d");
if (o && !this.isWeb()) {
i = i.map((c) => c * h);
const u = o.getImageData(...i.slice(0, 4));
t.putImageData(u, ...i.slice(4, 6));
} else {
i.length === 8 && (i = i.map((u, c) => c < 4 ? u * h : u));
try {
t.drawImage(r, ...i);
} catch {
}
}
}
/**
* Calculate image render width and height
* @param imgObj Image tag element
* @param imgInfo Image information
* @param maxWidth Maximum width
* @param maxHeight Maximum height
* @return [render width, render height]
*/
computedWidthAndHeight(t, e, i, r) {
if (!e.width && !e.height)
return [t.width, t.height];
if (e.width && !e.height) {
let n = this.getLength(e.width, i);
return [n, t.height * (n / t.width)];
} else if (!e.width && e.height) {
let n = this.getLength(e.height, r);
return [t.width * (n / t.height), n];
}
return [
this.getLength(e.width, i),
this.getLength(e.height, r)
];
}
/**
* Convert units
* @param { string } value Value to convert
* @param { number } denominator Denominator
* @return { number } Return new string
*/
changeUnits(t, e = 1) {
const { config: i } = this;
return Number(t.replace(/^([-]*[0-9.]*)([a-z%]*)$/, (r, n, h) => {
const o = {
"%": (f) => f * (e / 100),
px: (f) => f * 1,
rem: (f) => f * this.htmlFontSize,
vw: (f) => f / 100 * window.innerWidth
}[h];
if (o) return o(n);
const a = i.handleCssUnit || i.unitFunc;
return a ? a(n, h) : n;
}));
}
/**
* Get length
* @param length Length to convert
* @param maxLength Maximum length
* @return Length
*/
getLength(t, e) {
return mt(t, "number") ? t : mt(t, "string") ? this.changeUnits(t, e) : 0;
}
/**
* Get relative (centered) X coordinate
* @param width
* @param col
*/
getOffsetX(t, e = 0) {
return (e - t) / 2;
}
getOffscreenCanvas(t, e) {
if (!ht(this, "_offscreenCanvas") && (window && window.document && this.config.flag === "WEB" ? this._offscreenCanvas = document.createElement("canvas") : this._offscreenCanvas = this.config.offscreenCanvas, !this._offscreenCanvas))
return console.error("Offscreen Canvas cannot render!");
const i = this.config.dpr, r = this._offscreenCanvas;
r.width = (t || 300) * i, r.height = (e || 150) * i;
const n = r.getContext("2d");
return n.clearRect(0, 0, t, e), n.scale(i, i), n.dpr = i, { _offscreenCanvas: r, _ctx: n };
}
/**
* Add a new reactive data (temporary)
* @param data Data
* @param key Property
* @param value New value
*/
$set(t, e, i) {
!t || typeof t != "object" || ne(t, e, i);
}
/**
* Add a computed property (temporary)
* @param data Source data
* @param key Property name
* @param callback Callback function
*/
$computed(t, e, i) {
Object.defineProperty(t, e, {
get: () => i.call(this)
});
}
/**
* Add an observer create user watcher
* @param expr Expression
* @param handler Callback function
* @param watchOpt Configuration parameters
* @return Function to uninstall current observer (not yet returned)
*/
$watch(t, e, i = {}) {
typeof e == "object" && (i = e, e = i.handler);
const r = new Ne(this, t, e, i);
return i.immediate && e.call(this, r.value), function() {
};
}
};
Wt.version = Tt;
let yt = Wt;
const q = (l) => Math.PI / 180 * l, Ue = (l, t) => [+(Math.cos(l) * t).toFixed(8), +(Math.sin(l) * t).toFixed(8)], Ye = (l, t, e, i, r, n) => {
l.beginPath();
let h = q(90 / Math.PI / e * n), o = i + h, a = r - h;
l.arc(0, 0, e, o, a, !1), l.lineTo(
...Ue(
(i + r) / 2,
n / 2 / Math.abs(Math.sin((i - r) / 2))
)
), l.closePath();
}, kt = (l, ...[t, e, i, r, n]) => {
const h = Math.min(i, r), o = Math.PI;
n > h / 2 && (n = h / 2), l.beginPath(), l.moveTo(t + n, e), l.lineTo(t + n, e), l.lineTo(t + i - n, e), l.arc(t + i - n, e + n, n, -o / 2, 0), l.lineTo(t + i, e + r - n), l.arc(t + i - n, e + r - n, n, 0, o / 2), l.lineTo(t + n, e + r), l.arc(t + n, e + r - n, n, o / 2, o), l.lineTo(t, e + n), l.arc(t + n, e + n, n, o, -o / 2), l.closePath();
}, Xe = (l, t, e, i, r, n) => {
const h = /linear-gradient\((.+)\)/.exec(n)[1].split(",").map((u) => u.trim());
let o = h.shift(), a = [0, 0, 0, 0];
if (o.includes("deg")) {
o = o.slice(0, -3) % 360;
const u = (c) => Math.tan(c / 180 * Math.PI);
o >= 0 && o < 45 ? a = [t, e + r, t + i, e + r - i * u(o - 0)] : o >= 45 && o < 90 ? a = [t, e + r, t + i - r * u(o - 45), e] : o >= 90 && o < 135 ? a = [t + i, e + r, t + i - r * u(o - 90), e] : o >= 135 && o < 180 ? a = [t + i, e + r, t, e + i * u(o - 135)] : o >= 180 && o < 225 ? a = [t + i, e, t, e + i * u(o - 180)] : o >= 225 && o < 270 ? a = [t + i, e, t + r * u(o - 225), e + r] : o >= 270 && o < 315 ? a = [t, e, t + r * u(o - 270), e + r] : o >= 315 && o < 360 && (a = [t, e, t + i, e + r - i * u(o - 315)]);
} else o.includes("top") ? a = [t, e + r, t, e] : o.includes("bottom") ? a = [t, e, t, e + r] : o.includes("left") ? a = [t + i, e, t, e] : o.includes("right") && (a = [t, e, t + i, e]);
const f = l.createLinearGradient(...a.map((u) => u >> 0));
return h.reduce((u, c, g) => {
const w = c.split(" ");
return w.length === 1 ? u.addColorStop(g, w[0]) : w.length === 2 && u.addColorStop(...w), u;
}, f);
}, G = {
easeIn: function(l, t, e, i) {
return l >= i && (l = i), e * (l /= i) * l + t;
},
easeOut: function(l, t, e, i) {
return l >= i && (l = i), -e * (l /= i) * (l - 2) + t;
}
};
class Ge extends yt {
/**
* Lucky wheel constructor
* @param config Configuration
* @param data Lottery data
*/
constructor(t, e) {
var i;
super(t, {
width: e.width,
height: e.height
}), this.blocks = [], this.prizes = [], this.buttons = [], this.defaultConfig = {}, this.defaultStyle = {}, this._defaultConfig = {}, this._defaultStyle = {}, this.Radius = 0, this.prizeRadius = 0, this.prizeDeg = 0, this.prizeAng = 0, this.rotateDeg = 0, this.maxBtnRadius = 0, this.startTime = 0, this.endTime = 0, this.stopDeg = 0, this.endDeg = 0, this.FPS = 16.6, this.step = 0, this.ImageCache = /* @__PURE__ */ new Map(), this.initData(e), this.initWatch(), this.initComputed(), (i = t.beforeCreate) == null || i.call(this), this.init();
}
resize() {
var t, e;
super.resize(), this.Radius = Math.min(this.boxWidth, this.boxHeight) / 2, this.ctx.translate(this.Radius, this.Radius), this.draw(), (e = (t = this.config).afterResize) == null || e.call(t);
}
initLucky() {
this.Radius = 0, this.prizeRadius = 0, this.prizeDeg = 0, this.prizeAng = 0, this.rotateDeg = 0, this.maxBtnRadius = 0, this.startTime = 0, this.endTime = 0, this.stopDeg = 0, this.endDeg = 0, this.FPS = 16.6, this.prizeFlag = -1, this.step = 0, super.initLucky();
}
/**
* Initialize data
* @param data
*/
initData(t) {
this.$set(this, "width", t.width), this.$set(this, "height", t.height), this.$set(this, "blocks", t.blocks || []), this.$set(this, "prizes", t.prizes || []), this.$set(this, "buttons", t.buttons || []), this.$set(this, "defaultConfig", t.defaultConfig || {}), this.$set(this, "defaultStyle", t.defaultStyle || {}), this.$set(this, "startCallback", t.start), this.$set(this, "endCallback", t.end);
}
/**
* Initialize computed properties
*/
initComputed() {
this.$computed(this, "_defaultConfig", () => ({
gutter: "0px",
offsetDegree: 0,
speed: 20,
speedFunction: "quad",
accelerationTime: 2500,
decelerationTime: 2500,
stopRange: 0,
...this.defaultConfig
})), this.$computed(this, "_defaultStyle", () => ({
fontSize: "18px",
fontColor: "#000",
fontStyle: "sans-serif",
fontWeight: "400",
background: "rgba(0,0,0,0)",
wordWrap: !0,
lengthLimit: "90%",
...this.defaultStyle
}));
}
/**
* Initialize observers
*/
initWatch() {
this.$watch("width", (t) => {
this.data.width = t, this.resize();
}), this.$watch("height", (t) => {
this.data.height = t, this.resize();
}), this.$watch("blocks", (t) => {
this.initImageCache();
}, { deep: !0 }), this.$watch("prizes", (t) => {
this.initImageCache();
}, { deep: !0 }), this.$watch("buttons", (t) => {
this.initImageCache();
}, { deep: !0 }), this.$watch("defaultConfig", () => this.draw(), { deep: !0 }), this.$watch("defaultStyle", () => this.draw(), { deep: !0 }), this.$watch("startCallback", () => this.init()), this.$watch("endCallback", () => this.init());
}
/**
* Initialize canvas lottery
*/
async init() {
var e, i;
this.initLucky();
const { config: t } = this;
(e = t.beforeInit) == null || e.call(this), this.draw(), this.draw(), await this.initImageCache(), (i = t.afterInit) == null || i.call(this);
}
initImageCache() {
return new Promise((t) => {
const e = {
blocks: this.blocks.map((i) => i.imgs),
prizes: this.prizes.map((i) => i.imgs),
buttons: this.buttons.map((i) => i.imgs)
};
Object.keys(e).forEach((i) => {
const r = e[i], n = [];
r && r.forEach((h, o) => {
h && h.forEach((a, f) => {
n.push(this.loadAndCacheImg(i, o, f));
});
}), Promise.all(n).then(() => {
this.draw(), t();
});
});
});
}
/**
* Canvas click event
* @param e Event parameters
*/
handleClick(t) {
var i;
const { ctx: e } = this;
e.beginPath(), e.arc(0, 0, this.maxBtnRadius, 0, Math.PI * 2, !1), e.isPointInPath(t.offsetX, t.offsetY) && this.step === 0 && ((i = this.startCallback) == null || i.call(this, t));
}
/**
* Load and cache specified image by index
* @param cellName Module name
* @param cellIndex Module index
* @param imgName Module image cache
* @param imgIndex Image index
*/
async loadAndCacheImg(t, e, i) {
return new Promise((r, n) => {
const h = this[t][e];
if (!h || !h.imgs) return;
const o = h.imgs[i];
o && this.loadImg(o.src, o).then(async (a) => {
typeof o.formatter == "function" && (a = await Promise.resolve(o.formatter.call(this, a))), this.ImageCache.set(o.src, a), r();
}).catch((a) => {
console.error(`${t}[${e}].imgs[${i}] ${a}`), n();
});
});
}
drawBlock(t, e, i) {
const { ctx: r } = this;
J(e.background) && (r.beginPath(), r.fillStyle = e.background, r.arc(0, 0, t, 0, Math.PI * 2, !1), r.fill()), e.imgs && e.imgs.forEach((n, h) => {
const o = this.ImageCache.get(n.src);
if (!o) return;
const [a, f] = this.computedWidthAndHeight(o, n, t * 2, t * 2), [u, c] = [this.getOffsetX(a) + this.getLength(n.left, t * 2), this.getLength(n.top, t * 2) - t];
r.save(), n.rotate && r.rotate(q(this.rotateDeg)), this.drawImage(r, o, u, c, a, f), r.restore();
});
}
/**
* Start drawing
*/
draw() {
var f, u;
const { config: t, ctx: e, _defaultConfig: i, _defaultStyle: r } = this;
(f = t.beforeDraw) == null || f.call(this, e), e.clearRect(-this.Radius, -this.Radius, this.Radius * 2, this.Radius * 2), this.prizeRadius = this.blocks.reduce((c, g, w) => (this.drawBlock(c, g, w), c - this.getLength(g.padding && g.padding.split(" ")[0])), this.Radius), this.prizeDeg = 360 / this.prizes.length, this.prizeAng = q(this.prizeDeg);
const n = this.prizeRadius * Math.sin(this.prizeAng / 2) * 2;
let h = q(this.rotateDeg - 90 + this.prizeDeg / 2 + i.offsetDegree);
const o = (c, g) => this.getOffsetX(e.measureText(g).width) + this.getLength(c.left, n), a = (c, g, w) => {
const y = c.lineHeight || r.lineHeight || c.fontSize || r.fontSize;
return this.getLength(c.top, g) + (w + 1) * this.getLength(y);
};
e.save(), this.prizes.forEach((c, g) => {
let w = h + g * this.prizeAng, y = this.prizeRadius - this.maxBtnRadius;
const E = c.background || r.background;
J(E) && (e.fillStyle = E, Ye(
e,
this.maxBtnRadius,
this.prizeRadius,
w - this.prizeAng / 2,
w + this.prizeAng / 2,
this.getLength(i.gutter)
), e.fill());
let p = Math.cos(w) * this.prizeRadius, k = Math.sin(w) * this.prizeRadius;
e.translate(p, k), e.rotate(w + q(90)), c.imgs && c.imgs.forEach((b, x) => {
const S = this.ImageCache.get(b.src);
if (!S) return;
const [A, T] = this.computedWidthAndHeight(
S,
b,
this.prizeAng * this.prizeRadius,
y
), [I, W] = [
this.getOffsetX(A) + this.getLength(b.left, n),
this.getLength(b.top, y)
];
this.drawImage(e, S, I, W, A, T);
}), c.fonts && c.fonts.forEach((b) => {
const x = b.fontColor || r.fontColor, S = b.fontWeight || r.fontWeight, A = this.getLength(b.fontSize || r.fontSize), T = b.fontStyle || r.fontStyle, I = ht(b, "wordWrap") ? b.wordWrap : r.wordWrap, W = b.lengthLimit || r.lengthLimit, D = b.lineClamp || r.lineClamp, O = b.rotate || 0;
e.fillStyle = x, e.font = `${S} ${A >> 0}px ${T}`;
let H = [], Y = String(b.text);
I ? H = It(e, At(Y), (F) => {
let j = (this.prizeRadius - a(b, y, F.length)) * Math.tan(this.prizeAng / 2) * 2 - this.getLength(i.gutter);
return this.getLength(W, j);
}, D) : H = Y.split(`
`), H.filter((F) => !!F).forEach((F, j) => {
const U = o(b, F), it = a(b, y, j);
e.save(), e.translate(U, it), e.rotate(q(O)), e.fillText(F, 0, 0), e.restore();
});
}), e.rotate(q(360) - w - q(90)), e.translate(-p, -k);
}), e.restore(), this.buttons.forEach((c, g) => {
let w = this.getLength(c.radius, this.prizeRadius);
this.maxBtnRadius = Math.max(this.maxBtnRadius, w), J(c.background) && (e.beginPath(), e.fillStyle = c.background, e.arc(0, 0, w, 0, Math.PI * 2, !1), e.fill()), c.pointer && J(c.background) && (e.beginPath(), e.fillStyle = c.background, e.moveTo(-w, 0), e.lineTo(w, 0), e.lineTo(0, -w * 2), e.closePath(), e.fill()), c.imgs && c.imgs.forEach((y, E) => {
const p = this.ImageCache.get(y.src);
if (!p) return;
const [k, b] = this.computedWidthAndHeight(p, y, w * 2, w * 2), [x, S] = [this.getOffsetX(k) + this.getLength(y.left, w), this.getLength(y.top, w)];
this.drawImage(e, p, x, S, k, b);
}), c.fonts && c.fonts.forEach((y) => {
let E = y.fontColor || r.fontColor, p = y.fontWeight || r.fontWeight, k = this.getLength(y.fontSize || r.fontSize), b = y.fontStyle || r.fontStyle;
e.fillStyle = E, e.font = `${p} ${k >> 0}px ${b}`, String(y.text).split(`
`).forEach((x, S) => {
e.fillText(x, o(y, x), a(y, w, S));
});
});
}), (u = t.afterDraw) == null || u.call(this, e);
}
/**
* Carve on gunwale of moving boat
*/
carveOnGunwaleOfAMovingBoat() {
const { _defaultConfig: t, prizeFlag: e, prizeDeg: i, rotateDeg: r } = this;
this.endTime = Date.now();
const n = this.stopDeg = r, h = t.speed, o = (Math.random() * i - i / 2) * this.getLength(t.stopRange);
let a = 0, f = 0, u = 0;
for (; ++a; ) {
const c = 360 * a - e * i - r - t.offsetDegree + o - i / 2;
let g = G.easeOut(this.FPS, n, c, t.decelerationTime) - n;
if (g > h) {
this.endDeg = h - f > g - h ? c : u;
break;
}
u = c, f = g;
}
}
/**
* Exposed: Start lottery method
*/
play() {
var t, e;
this.step === 0 && (this.startTime = Date.now(), this.prizeFlag = void 0, this.step = 1, (e = (t = this.config).afterStart) == null || e.call(t), this.run());
}
/**
* Exposed: Slow stop method
* @param index Prize index
*/
stop(t) {
if (!(this.step === 0 || this.step === 3)) {
if (!t && t !== 0) {
const e = this.prizes.map((i) => i.range);
t = se(e);
}
t < 0 ? (this.step = 0, this.prizeFlag = -1) : (this.step = 2, this.prizeFlag = t % this.prizes.length);
}
}
/**
* Actually start execution method
* @param num Record how many times frame animation executed
*/
run(t = 0) {
var g;
const { rAF: e, step: i, prizeFlag: r, _defaultConfig: n } = this, { accelerationTime: h, decelerationTime: o, speed: a } = n;
if (i === 0) {
(g = this.endCallback) == null || g.call(this, this.prizes.find((w, y) => y === r) || {});
return;
}
if (r === -1) return;
i === 3 && !this.endDeg && this.carveOnGunwaleOfAMovingBoat();
const f = Date.now() - this.startTime, u = Date.now() - this.endTime;
let c = this.rotateDeg;
if (i === 1 || f < h) {
this.FPS = f / t;
const w = G.easeIn(f, 0, a, h);
w === a && (this.step = 2), c = c + w % 360;
} else i === 2 ? (c = c + a % 360, r !== void 0 && r >= 0 && (this.step = 3, this.stopDeg = 0, this.endDeg = 0)) : i === 3 ? (c = G.easeOut(u, this.stopDeg, this.endDeg, o), u >= o && (this.step = 0)) : this.stop(-1);
this.rotateDeg = c, this.draw(), e(this.run.bind(this, t + 1));
}
/**
* Convert render coordinates
* @param x
* @param y
*/
conversionAxis(t, e) {
const { config: i } = this;
return [t