yugioh-card
Version:
<h1 align="center">🎉 游戏王卡片 - Yugioh Card 🎉</h1>
1,258 lines • 563 kB
JavaScript
const U = { toURL(e, t) {
let A = encodeURIComponent(e);
return t === "text" ? A = "data:text/plain;charset=utf-8," + A : t === "svg" && (A = "data:image/svg+xml," + A), A;
}, image: { hitCanvasSize: 100, maxCacheSize: 4096e3, maxPatternSize: 8847360, crossOrigin: "anonymous", getRealURL(e) {
const { prefix: t, suffix: A } = U.image;
return !A || e.startsWith("data:") || e.startsWith("blob:") || (e += (e.includes("?") ? "&" : "?") + A), t && e[0] === "/" && (e = t + e), e;
} } }, iA = { RUNTIME: "runtime", LEAF: "leaf", TASK: "task", CNAVAS: "canvas", IMAGE: "image", types: {}, create(e) {
const { types: t } = RB;
return t[e] ? t[e]++ : (t[e] = 1, 0);
} }, RB = iA;
var To;
(function(e) {
e[e.No = 0] = "No", e[e.Yes = 1] = "Yes", e[e.NoAndSkip = 2] = "NoAndSkip", e[e.YesAndSkip = 3] = "YesAndSkip";
})(To || (To = {}));
const MB = {};
function E(e) {
return e === void 0;
}
function Ot(e) {
return e == null;
}
function G(e) {
return typeof e == "string";
}
const { isFinite: OB } = Number;
function lt(e) {
return typeof e == "number";
}
const PB = /^-?\d+(?:\.\d+)?$/;
function $B(e) {
return typeof e == "string" && PB.test(e) ? +e : e;
}
const { isArray: V } = Array;
function P(e) {
return e && typeof e == "object";
}
function WB(e) {
return P(e) && !V(e);
}
function XB(e) {
return JSON.stringify(e) === "{}";
}
const At = { default: (e, t) => (tr(t, e), tr(e, t), e), assign(e, t, A) {
let s;
Object.keys(t).forEach((i) => {
var r, n;
if (s = t[i], s?.constructor === Object && ((r = e[i]) === null || r === void 0 ? void 0 : r.constructor) === Object) return tr(e[i], t[i], A && A[i]);
A && i in A ? ((n = A[i]) === null || n === void 0 ? void 0 : n.constructor) === Object && tr(e[i] = {}, t[i], A[i]) : e[i] = t[i];
});
}, copyAttrs: (e, t, A) => (A.forEach((s) => {
E(t[s]) || (e[s] = t[s]);
}), e), clone: (e) => JSON.parse(JSON.stringify(e)), toMap(e) {
const t = {};
for (let A = 0, s = e.length; A < s; A++) t[e[A]] = !0;
return t;
}, stintSet(e, t, A) {
A || (A = void 0), e[t] !== A && (e[t] = A);
} }, { assign: tr } = At;
let rg = class {
get __useNaturalRatio() {
return !0;
}
get __isLinePath() {
const { path: t } = this;
return t && t.length === 6 && t[0] === 1;
}
get __blendMode() {
if (this.eraser && this.eraser !== "path") return "destination-out";
const { blendMode: t } = this;
return t === "pass-through" ? null : t;
}
constructor(t) {
this.__leaf = t;
}
__get(t) {
if (this.__input) {
const A = this.__input[t];
if (!E(A)) return A;
}
return this[t];
}
__getData() {
const t = { tag: this.__leaf.tag }, { __input: A } = this;
let s;
for (let i in this) i[0] !== "_" && (s = A ? A[i] : void 0, t[i] = E(s) ? this[i] : s);
return t;
}
__setInput(t, A) {
this.__input || (this.__input = {}), this.__input[t] = A;
}
__getInput(t) {
if (this.__input) {
const A = this.__input[t];
if (!E(A)) return A;
}
if (t !== "path" || this.__pathInputed) return this["_" + t];
}
__removeInput(t) {
this.__input && !E(this.__input[t]) && (this.__input[t] = void 0);
}
__getInputData(t, A) {
const s = {};
if (t) if (V(t)) for (let i of t) s[i] = this.__getInput(i);
else for (let i in t) s[i] = this.__getInput(i);
else {
let i, r, { __input: n } = this;
s.tag = this.__leaf.tag;
for (let a in this) if (a[0] !== "_" && (i = this["_" + a], !E(i))) {
if (a === "path" && !this.__pathInputed) continue;
r = n ? n[a] : void 0, s[a] = E(r) ? i : r;
}
}
if (A && A.matrix) {
const { a: i, b: r, c: n, d: a, e: o, f: h } = this.__leaf.__localMatrix;
s.matrix = { a: i, b: r, c: n, d: a, e: o, f: h };
}
return s;
}
__setMiddle(t, A) {
this.__middle || (this.__middle = {}), this.__middle[t] = A;
}
__getMiddle(t) {
return this.__middle && this.__middle[t];
}
__checkSingle() {
const t = this;
if (t.blendMode === "pass-through") {
const A = this.__leaf;
t.opacity < 1 && (A.isBranch || t.__hasMultiPaint) || A.__hasEraser || t.eraser || t.filter ? t.__single = !0 : t.__single && (t.__single = !1);
} else t.__single = !0;
}
__removeNaturalSize() {
this.__naturalWidth = this.__naturalHeight = void 0;
}
destroy() {
this.__input = this.__middle = null;
}
};
const { round: zB, pow: GB, PI: vh } = Math, Ft = { within: (e, t, A) => (P(t) && (A = t.max, t = t.min), !E(t) && e < t && (e = t), !E(A) && e > A && (e = A), e), fourNumber(e, t) {
let A;
if (V(e)) switch (e.length) {
case 4:
A = E(t) ? e : [...e];
break;
case 2:
A = [e[0], e[1], e[0], e[1]];
break;
case 3:
A = [e[0], e[1], e[2], e[1]];
break;
case 1:
e = e[0];
break;
default:
e = 0;
}
if (A || (A = [e, e, e, e]), t) for (let s = 0; s < 4; s++) A[s] > t && (A[s] = t);
return A;
}, formatRotation: (e, t) => (e %= 360, t ? e < 0 && (e += 360) : (e > 180 && (e -= 360), e < -180 && (e += 360)), Ft.float(e)), getGapRotation(e, t, A = 0) {
let s = e + A;
if (t > 1) {
const i = Math.abs(s % t);
(i < 1 || i > t - 1) && (s = Math.round(s / t) * t);
}
return s - A;
}, float(e, t) {
const A = E(t) ? 1e12 : GB(10, t);
return (e = zB(e * A) / A) === -0 ? 0 : e;
}, getScaleData(e, t, A, s) {
if (s || (s = {}), t) {
const i = (lt(t) ? t : t.width || 0) / A.width, r = (lt(t) ? t : t.height || 0) / A.height;
s.scaleX = i || r || 1, s.scaleY = r || i || 1;
} else e && Ft.assignScale(s, e);
return s;
}, assignScale(e, t) {
lt(t) ? e.scaleX = e.scaleY = t : (e.scaleX = t.x, e.scaleY = t.y);
}, randInt: er, randColor: (e) => `rgba(${er(255)},${er(255)},${er(255)},${e || 1})` };
function er(e) {
return Math.round(Math.random() * e);
}
const ht = vh / 180, me = 2 * vh, Fs = vh / 2;
function ng() {
return { x: 0, y: 0 };
}
function ag() {
return { x: 0, y: 0, width: 0, height: 0 };
}
function Eh() {
return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };
}
const { sin: Gn, cos: Vn, acos: Ar, sqrt: Yn } = Math, { float: es } = Ft, As = {};
function Al() {
return Object.assign(Object.assign(Object.assign({}, { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }), { x: 0, y: 0, width: 0, height: 0 }), { scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 });
}
const $ = { defaultMatrix: { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }, defaultWorld: Al(), tempMatrix: {}, set(e, t = 1, A = 0, s = 0, i = 1, r = 0, n = 0) {
e.a = t, e.b = A, e.c = s, e.d = i, e.e = r, e.f = n;
}, get: Eh, getWorld: Al, copy(e, t) {
e.a = t.a, e.b = t.b, e.c = t.c, e.d = t.d, e.e = t.e, e.f = t.f;
}, translate(e, t, A) {
e.e += t, e.f += A;
}, translateInner(e, t, A, s) {
e.e += e.a * t + e.c * A, e.f += e.b * t + e.d * A, s && (e.e -= t, e.f -= A);
}, scale(e, t, A = t) {
e.a *= t, e.b *= t, e.c *= A, e.d *= A;
}, scaleOfOuter(e, t, A, s) {
Ct.toInnerPoint(e, t, As), Ct.scaleOfInner(e, As, A, s);
}, scaleOfInner(e, t, A, s = A) {
Ct.translateInner(e, t.x, t.y), Ct.scale(e, A, s), Ct.translateInner(e, -t.x, -t.y);
}, rotate(e, t) {
const { a: A, b: s, c: i, d: r } = e, n = Vn(t *= ht), a = Gn(t);
e.a = A * n - s * a, e.b = A * a + s * n, e.c = i * n - r * a, e.d = i * a + r * n;
}, rotateOfOuter(e, t, A) {
Ct.toInnerPoint(e, t, As), Ct.rotateOfInner(e, As, A);
}, rotateOfInner(e, t, A) {
Ct.translateInner(e, t.x, t.y), Ct.rotate(e, A), Ct.translateInner(e, -t.x, -t.y);
}, skew(e, t, A) {
const { a: s, b: i, c: r, d: n } = e;
A && (A *= ht, e.a = s + r * A, e.b = i + n * A), t && (t *= ht, e.c = r + s * t, e.d = n + i * t);
}, skewOfOuter(e, t, A, s) {
Ct.toInnerPoint(e, t, As), Ct.skewOfInner(e, As, A, s);
}, skewOfInner(e, t, A, s = 0) {
Ct.translateInner(e, t.x, t.y), Ct.skew(e, A, s), Ct.translateInner(e, -t.x, -t.y);
}, multiply(e, t) {
const { a: A, b: s, c: i, d: r, e: n, f: a } = e;
e.a = t.a * A + t.b * i, e.b = t.a * s + t.b * r, e.c = t.c * A + t.d * i, e.d = t.c * s + t.d * r, e.e = t.e * A + t.f * i + n, e.f = t.e * s + t.f * r + a;
}, multiplyParent(e, t, A, s, i, r) {
let { e: n, f: a } = e;
if (r && (n += r.scrollX, a += r.scrollY), A || (A = e), E(s) && (s = e.a !== 1 || e.b || e.c || e.d !== 1), s) {
const { a: o, b: h, c: l, d: c } = e;
A.a = o * t.a + h * t.c, A.b = o * t.b + h * t.d, A.c = l * t.a + c * t.c, A.d = l * t.b + c * t.d, i && (A.scaleX = t.scaleX * i.scaleX, A.scaleY = t.scaleY * i.scaleY);
} else A.a = t.a, A.b = t.b, A.c = t.c, A.d = t.d, i && (A.scaleX = t.scaleX, A.scaleY = t.scaleY);
A.e = n * t.a + a * t.c + t.e, A.f = n * t.b + a * t.d + t.f;
}, divide(e, t) {
Ct.multiply(e, Ct.tempInvert(t));
}, divideParent(e, t) {
Ct.multiplyParent(e, Ct.tempInvert(t));
}, tempInvert(e) {
const { tempMatrix: t } = Ct;
return Ct.copy(t, e), Ct.invert(t), t;
}, invert(e) {
const { a: t, b: A, c: s, d: i, e: r, f: n } = e;
if (A || s) {
const a = 1 / (t * i - A * s);
e.a = i * a, e.b = -A * a, e.c = -s * a, e.d = t * a, e.e = -(r * i - n * s) * a, e.f = -(n * t - r * A) * a;
} else if (t === 1 && i === 1) e.e = -r, e.f = -n;
else {
const a = 1 / (t * i);
e.a = i * a, e.d = t * a, e.e = -r * i * a, e.f = -n * t * a;
}
}, toOuterPoint(e, t, A, s) {
const { x: i, y: r } = t;
A || (A = t), A.x = i * e.a + r * e.c, A.y = i * e.b + r * e.d, s || (A.x += e.e, A.y += e.f);
}, toInnerPoint(e, t, A, s) {
const { a: i, b: r, c: n, d: a } = e, o = 1 / (i * a - r * n), { x: h, y: l } = t;
if (A || (A = t), A.x = (h * a - l * n) * o, A.y = (l * i - h * r) * o, !s) {
const { e: c, f: d } = e;
A.x -= (c * a - d * n) * o, A.y -= (d * i - c * r) * o;
}
}, setLayout(e, t, A, s, i) {
const { x: r, y: n, scaleX: a, scaleY: o } = t;
if (E(i) && (i = t.rotation || t.skewX || t.skewY), i) {
const { rotation: h, skewX: l, skewY: c } = t, d = h * ht, u = Vn(d), g = Gn(d);
if (l || c) {
const B = l * ht, f = c * ht;
e.a = (u + f * -g) * a, e.b = (g + f * u) * a, e.c = (B * u - g) * o, e.d = (u + B * g) * o;
} else e.a = u * a, e.b = g * a, e.c = -g * o, e.d = u * o;
} else e.a = a, e.b = 0, e.c = 0, e.d = o;
e.e = r, e.f = n, (A = A || s) && Ct.translateInner(e, -A.x, -A.y, !s);
}, getLayout(e, t, A, s) {
const { a: i, b: r, c: n, d: a, e: o, f: h } = e;
let l, c, d, u, g, B = o, f = h;
if (r || n) {
const _ = i * a - r * n;
if (n && !s) {
l = Yn(i * i + r * r), c = _ / l;
const m = i / l;
d = r > 0 ? Ar(m) : -Ar(m);
} else {
c = Yn(n * n + a * a), l = _ / c;
const m = n / c;
d = Fs - (a > 0 ? Ar(-m) : -Ar(m));
}
const p = es(Vn(d)), Q = Gn(d);
l = es(l), c = es(c), u = p ? es((n / c + Q) / p / ht, 9) : 0, g = p ? es((r / l - Q) / p / ht, 9) : 0, d = es(d / ht);
} else l = i, c = a, d = u = g = 0;
return (t = A || t) && (B += t.x * i + t.y * n, f += t.x * r + t.y * a, A || (B -= t.x, f -= t.y)), { x: B, y: f, scaleX: l, scaleY: c, rotation: d, skewX: u, skewY: g };
}, withScale(e, t, A = t) {
const s = e;
if (!t || !A) {
const { a: i, b: r, c: n, d: a } = e;
r || n ? A = (i * a - r * n) / (t = Yn(i * i + r * r)) : (t = i, A = a);
}
return s.scaleX = t, s.scaleY = A, s;
}, reset(e) {
Ct.set(e);
} }, Ct = $, { toInnerPoint: Nn, toOuterPoint: sl } = $, { sin: il, cos: rl, abs: nl, sqrt: VB, atan2: YB, min: NB, round: sr } = Math, x = { defaultPoint: { x: 0, y: 0 }, tempPoint: {}, tempRadiusPoint: {}, set(e, t = 0, A = 0) {
e.x = t, e.y = A;
}, setRadius(e, t, A) {
e.radiusX = t, e.radiusY = E(A) ? t : A;
}, copy(e, t) {
e.x = t.x, e.y = t.y;
}, copyFrom(e, t, A) {
e.x = t, e.y = A;
}, round(e, t) {
e.x = t ? sr(e.x - 0.5) + 0.5 : sr(e.x), e.y = t ? sr(e.y - 0.5) + 0.5 : sr(e.y);
}, move(e, t, A) {
P(t) ? (e.x += t.x, e.y += t.y) : (e.x += t, e.y += A);
}, scale(e, t, A = t) {
e.x && (e.x *= t), e.y && (e.y *= A);
}, scaleOf(e, t, A, s = A) {
e.x += (e.x - t.x) * (A - 1), e.y += (e.y - t.y) * (s - 1);
}, rotate(e, t, A) {
A || (A = IA.defaultPoint);
const s = rl(t *= ht), i = il(t), r = e.x - A.x, n = e.y - A.y;
e.x = A.x + r * s - n * i, e.y = A.y + r * i + n * s;
}, tempToInnerOf(e, t) {
const { tempPoint: A } = IA;
return jn(A, e), Nn(t, A, A), A;
}, tempToOuterOf(e, t) {
const { tempPoint: A } = IA;
return jn(A, e), sl(t, A, A), A;
}, tempToInnerRadiusPointOf(e, t) {
const { tempRadiusPoint: A } = IA;
return jn(A, e), IA.toInnerRadiusPointOf(e, t, A), A;
}, toInnerRadiusPointOf(e, t, A) {
A || (A = e), Nn(t, e, A), A.radiusX = Math.abs(e.radiusX / t.scaleX), A.radiusY = Math.abs(e.radiusY / t.scaleY);
}, toInnerOf(e, t, A) {
Nn(t, e, A);
}, toOuterOf(e, t, A) {
sl(t, e, A);
}, getCenter: (e, t) => ({ x: e.x + (t.x - e.x) / 2, y: e.y + (t.y - e.y) / 2 }), getCenterX: (e, t) => e + (t - e) / 2, getCenterY: (e, t) => e + (t - e) / 2, getDistance: (e, t) => Jn(e.x, e.y, t.x, t.y), getDistanceFrom(e, t, A, s) {
const i = nl(A - e), r = nl(s - t);
return VB(i * i + r * r);
}, getMinDistanceFrom: (e, t, A, s, i, r) => NB(Jn(e, t, A, s), Jn(A, s, i, r)), getAngle: (e, t) => al(e, t) / ht, getRotation: (e, t, A, s) => (s || (s = t), IA.getRadianFrom(e.x, e.y, t.x, t.y, A.x, A.y, s.x, s.y) / ht), getRadianFrom(e, t, A, s, i, r, n, a) {
E(n) && (n = A, a = s);
const o = e - A, h = t - s, l = i - n, c = r - a;
return Math.atan2(o * c - h * l, o * l + h * c);
}, getAtan2: (e, t) => YB(t.y - e.y, t.x - e.x), getDistancePoint(e, t, A, s) {
const i = al(e, t);
return (t = s ? t : {}).x = e.x + rl(i) * A, t.y = e.y + il(i) * A, t;
}, toNumberPoints(e) {
let t = e;
return P(e[0]) && (t = [], e.forEach((A) => t.push(A.x, A.y))), t;
}, reset(e) {
} }, IA = x, { getDistanceFrom: Jn, copy: jn, getAtan2: al } = IA;
let JB = class ln {
constructor(t, A) {
this.set(t, A);
}
set(t, A) {
return P(t) ? x.copy(this, t) : x.set(this, t, A), this;
}
get() {
const { x: t, y: A } = this;
return { x: t, y: A };
}
clone() {
return new ln(this);
}
move(t, A) {
return x.move(this, t, A), this;
}
scale(t, A) {
return x.scale(this, t, A), this;
}
scaleOf(t, A, s) {
return x.scaleOf(this, t, A, s), this;
}
rotate(t, A) {
return x.rotate(this, t, A), this;
}
rotateOf(t, A) {
return x.rotate(this, A, t), this;
}
getRotation(t, A, s) {
return x.getRotation(this, t, A, s);
}
toInnerOf(t, A) {
return x.toInnerOf(this, t, A), this;
}
toOuterOf(t, A) {
return x.toOuterOf(this, t, A), this;
}
getCenter(t) {
return new ln(x.getCenter(this, t));
}
getDistance(t) {
return x.getDistance(this, t);
}
getDistancePoint(t, A, s) {
return new ln(x.getDistancePoint(this, t, A, s));
}
getAngle(t) {
return x.getAngle(this, t);
}
getAtan2(t) {
return x.getAtan2(this, t);
}
reset() {
return this;
}
};
new JB();
let ie = class og {
constructor(t, A, s, i, r, n) {
this.set(t, A, s, i, r, n);
}
set(t, A, s, i, r, n) {
return P(t) ? $.copy(this, t) : $.set(this, t, A, s, i, r, n), this;
}
setWith(t) {
return $.copy(this, t), this.scaleX = t.scaleX, this.scaleY = t.scaleY, this;
}
get() {
const { a: t, b: A, c: s, d: i, e: r, f: n } = this;
return { a: t, b: A, c: s, d: i, e: r, f: n };
}
clone() {
return new og(this);
}
translate(t, A) {
return $.translate(this, t, A), this;
}
translateInner(t, A) {
return $.translateInner(this, t, A), this;
}
scale(t, A) {
return $.scale(this, t, A), this;
}
scaleWith(t, A) {
return $.scale(this, t, A), this.scaleX *= t, this.scaleY *= A || t, this;
}
scaleOfOuter(t, A, s) {
return $.scaleOfOuter(this, t, A, s), this;
}
scaleOfInner(t, A, s) {
return $.scaleOfInner(this, t, A, s), this;
}
rotate(t) {
return $.rotate(this, t), this;
}
rotateOfOuter(t, A) {
return $.rotateOfOuter(this, t, A), this;
}
rotateOfInner(t, A) {
return $.rotateOfInner(this, t, A), this;
}
skew(t, A) {
return $.skew(this, t, A), this;
}
skewOfOuter(t, A, s) {
return $.skewOfOuter(this, t, A, s), this;
}
skewOfInner(t, A, s) {
return $.skewOfInner(this, t, A, s), this;
}
multiply(t) {
return $.multiply(this, t), this;
}
multiplyParent(t) {
return $.multiplyParent(this, t), this;
}
divide(t) {
return $.divide(this, t), this;
}
divideParent(t) {
return $.divideParent(this, t), this;
}
invert() {
return $.invert(this), this;
}
invertWith() {
return $.invert(this), this.scaleX = 1 / this.scaleX, this.scaleY = 1 / this.scaleY, this;
}
toOuterPoint(t, A, s) {
$.toOuterPoint(this, t, A, s);
}
toInnerPoint(t, A, s) {
$.toInnerPoint(this, t, A, s);
}
setLayout(t, A, s) {
return $.setLayout(this, t, A, s), this;
}
getLayout(t, A, s) {
return $.getLayout(this, t, A, s);
}
withScale(t, A) {
return $.withScale(this, t, A);
}
reset() {
$.reset(this);
}
};
new ie();
const Vi = { tempPointBounds: {}, setPoint(e, t, A) {
e.minX = e.maxX = t, e.minY = e.maxY = A;
}, addPoint(e, t, A) {
e.minX = t < e.minX ? t : e.minX, e.minY = A < e.minY ? A : e.minY, e.maxX = t > e.maxX ? t : e.maxX, e.maxY = A > e.maxY ? A : e.maxY;
}, addBounds(e, t, A, s, i) {
ol(e, t, A), ol(e, t + s, A + i);
}, copy(e, t) {
e.minX = t.minX, e.minY = t.minY, e.maxX = t.maxX, e.maxY = t.maxY;
}, addPointBounds(e, t) {
e.minX = t.minX < e.minX ? t.minX : e.minX, e.minY = t.minY < e.minY ? t.minY : e.minY, e.maxX = t.maxX > e.maxX ? t.maxX : e.maxX, e.maxY = t.maxY > e.maxY ? t.maxY : e.maxY;
}, toBounds(e, t) {
t.x = e.minX, t.y = e.minY, t.width = e.maxX - e.minX, t.height = e.maxY - e.minY;
} }, { addPoint: ol } = Vi;
var Do, Is;
(function(e) {
e[e.top = 0] = "top", e[e.right = 1] = "right", e[e.bottom = 2] = "bottom", e[e.left = 3] = "left";
})(Do || (Do = {})), function(e) {
e[e.topLeft = 0] = "topLeft", e[e.top = 1] = "top", e[e.topRight = 2] = "topRight", e[e.right = 3] = "right", e[e.bottomRight = 4] = "bottomRight", e[e.bottom = 5] = "bottom", e[e.bottomLeft = 6] = "bottomLeft", e[e.left = 7] = "left", e[e.center = 8] = "center", e[e["top-left"] = 0] = "top-left", e[e["top-right"] = 2] = "top-right", e[e["bottom-right"] = 4] = "bottom-right", e[e["bottom-left"] = 6] = "bottom-left";
}(Is || (Is = {}));
const Lh = [{ x: 0, y: 0 }, { x: 0.5, y: 0 }, { x: 1, y: 0 }, { x: 1, y: 0.5 }, { x: 1, y: 1 }, { x: 0.5, y: 1 }, { x: 0, y: 1 }, { x: 0, y: 0.5 }, { x: 0.5, y: 0.5 }];
Lh.forEach((e) => e.type = "percent");
const be = { directionData: Lh, tempPoint: {}, get: hl, toPoint(e, t, A, s, i, r) {
const n = hl(e);
A.x = n.x, A.y = n.y, n.type === "percent" && (A.x *= t.width, A.y *= t.height, i && (r || (A.x -= i.x, A.y -= i.y), n.x && (A.x -= n.x === 1 ? i.width : n.x === 0.5 ? n.x * i.width : 0), n.y && (A.y -= n.y === 1 ? i.height : n.y === 0.5 ? n.y * i.height : 0))), s || (A.x += t.x, A.y += t.y);
}, getPoint: (e, t, A) => (A || (A = {}), be.toPoint(e, t, A, !0), A) };
function hl(e) {
return G(e) ? Lh[Is[e]] : e;
}
const { toPoint: jB } = be, xh = { toPoint(e, t, A, s, i, r) {
jB(e, A, s, i, t, r);
} }, { tempPointBounds: hA, setPoint: ll, addPoint: ir, toBounds: cl } = Vi, { toOuterPoint: rr } = $, { float: nr, fourNumber: ZB } = Ft, { floor: dl, ceil: ar } = Math;
let Se, ke, mA, QA;
const $e = {}, le = {}, FA = {}, v = { tempBounds: FA, set(e, t = 0, A = 0, s = 0, i = 0) {
e.x = t, e.y = A, e.width = s, e.height = i;
}, copy(e, t) {
e.x = t.x, e.y = t.y, e.width = t.width, e.height = t.height;
}, copyAndSpread(e, t, A, s, i) {
const { x: r, y: n, width: a, height: o } = t;
if (V(A)) {
const h = ZB(A);
s ? nt.set(e, r + h[3], n + h[0], a - h[1] - h[3], o - h[2] - h[0]) : nt.set(e, r - h[3], n - h[0], a + h[1] + h[3], o + h[2] + h[0]);
} else s && (A = -A), nt.set(e, r - A, n - A, a + 2 * A, o + 2 * A);
i && (i === "width" ? (e.y = n, e.height = o) : (e.x = r, e.width = a));
}, minX: (e) => e.width > 0 ? e.x : e.x + e.width, minY: (e) => e.height > 0 ? e.y : e.y + e.height, maxX: (e) => e.width > 0 ? e.x + e.width : e.x, maxY: (e) => e.height > 0 ? e.y + e.height : e.y, move(e, t, A) {
e.x += t, e.y += A;
}, getByMove: (e, t, A) => (e = Object.assign({}, e), nt.move(e, t, A), e), toOffsetOutBounds(e, t, A) {
t ? gl(t, e) : t = e, A ? (t.offsetX = -(nt.maxX(A) - e.x), t.offsetY = -(nt.maxY(A) - e.y)) : (t.offsetX = e.x + e.width, t.offsetY = e.y + e.height), nt.move(t, -t.offsetX, -t.offsetY);
}, scale(e, t, A = t, s) {
s || x.scale(e, t, A), e.width *= t, e.height *= A;
}, scaleOf(e, t, A, s = A) {
x.scaleOf(e, t, A, s), e.width *= A, e.height *= s;
}, tempToOuterOf: (e, t) => (nt.copy(FA, e), nt.toOuterOf(FA, t), FA), getOuterOf: (e, t) => (e = Object.assign({}, e), nt.toOuterOf(e, t), e), toOuterOf(e, t, A) {
if (A || (A = e), t.b === 0 && t.c === 0) {
const { a: s, d: i } = t;
s > 0 ? (A.width = e.width * s, A.x = t.e + e.x * s) : (A.width = e.width * -s, A.x = t.e + e.x * s - A.width), i > 0 ? (A.height = e.height * i, A.y = t.f + e.y * i) : (A.height = e.height * -i, A.y = t.f + e.y * i - A.height);
} else $e.x = e.x, $e.y = e.y, rr(t, $e, le), ll(hA, le.x, le.y), $e.x = e.x + e.width, rr(t, $e, le), ir(hA, le.x, le.y), $e.y = e.y + e.height, rr(t, $e, le), ir(hA, le.x, le.y), $e.x = e.x, rr(t, $e, le), ir(hA, le.x, le.y), cl(hA, A);
}, toInnerOf(e, t, A) {
A || (A = e), nt.move(A, -t.e, -t.f), nt.scale(A, 1 / t.a, 1 / t.d);
}, getFitMatrix(e, t, A = 1) {
const s = Math.min(A, nt.getFitScale(e, t));
return new ie(s, 0, 0, s, -t.x * s, -t.y * s);
}, getFitScale(e, t, A) {
const s = e.width / t.width, i = e.height / t.height;
return A ? Math.max(s, i) : Math.min(s, i);
}, put(e, t, A = "center", s = 1, i = !0, r) {
r || (r = t), G(s) && (s = nt.getFitScale(e, t, s === "cover")), FA.width = i ? t.width *= s : t.width * s, FA.height = i ? t.height *= s : t.height * s, xh.toPoint(A, FA, e, r, !0, !0);
}, getSpread(e, t, A) {
const s = {};
return nt.copyAndSpread(s, e, t, !1, A), s;
}, spread(e, t, A) {
nt.copyAndSpread(e, e, t, !1, A);
}, shrink(e, t, A) {
nt.copyAndSpread(e, e, t, !0, A);
}, ceil(e) {
const { x: t, y: A } = e;
e.x = dl(e.x), e.y = dl(e.y), e.width = t > e.x ? ar(e.width + t - e.x) : ar(e.width), e.height = A > e.y ? ar(e.height + A - e.y) : ar(e.height);
}, unsign(e) {
e.width < 0 && (e.x += e.width, e.width = -e.width), e.height < 0 && (e.y += e.height, e.height = -e.height);
}, float(e, t) {
e.x = nr(e.x, t), e.y = nr(e.y, t), e.width = nr(e.width, t), e.height = nr(e.height, t);
}, add(e, t, A) {
Se = e.x + e.width, ke = e.y + e.height, mA = t.x, QA = t.y, A || (mA += t.width, QA += t.height), Se = Se > mA ? Se : mA, ke = ke > QA ? ke : QA, e.x = e.x < t.x ? e.x : t.x, e.y = e.y < t.y ? e.y : t.y, e.width = Se - e.x, e.height = ke - e.y;
}, addList(e, t) {
nt.setListWithFn(e, t, void 0, !0);
}, setList(e, t, A = !1) {
nt.setListWithFn(e, t, void 0, A);
}, addListWithFn(e, t, A) {
nt.setListWithFn(e, t, A, !0);
}, setListWithFn(e, t, A, s = !1) {
let i, r = !0;
for (let n = 0, a = t.length; n < a; n++) i = A ? A(t[n], n) : t[n], i && (i.width || i.height) && (r ? (r = !1, s || gl(e, i)) : ul(e, i));
r && nt.reset(e);
}, setPoints(e, t) {
t.forEach((A, s) => s === 0 ? ll(hA, A.x, A.y) : ir(hA, A.x, A.y)), cl(hA, e);
}, setPoint(e, t) {
nt.set(e, t.x, t.y);
}, addPoint(e, t) {
ul(e, t, !0);
}, getPoints(e) {
const { x: t, y: A, width: s, height: i } = e;
return [{ x: t, y: A }, { x: t + s, y: A }, { x: t + s, y: A + i }, { x: t, y: A + i }];
}, hitRadiusPoint: (e, t, A) => (A && (t = x.tempToInnerRadiusPointOf(t, A)), t.x >= e.x - t.radiusX && t.x <= e.x + e.width + t.radiusX && t.y >= e.y - t.radiusY && t.y <= e.y + e.height + t.radiusY), hitPoint: (e, t, A) => (A && (t = x.tempToInnerOf(t, A)), t.x >= e.x && t.x <= e.x + e.width && t.y >= e.y && t.y <= e.y + e.height), hit: (e, t, A) => (A && (t = nt.tempToOuterOf(t, A)), !(e.y + e.height < t.y || t.y + t.height < e.y || e.x + e.width < t.x || t.x + t.width < e.x)), includes: (e, t, A) => (A && (t = nt.tempToOuterOf(t, A)), e.x <= t.x && e.y <= t.y && e.x + e.width >= t.x + t.width && e.y + e.height >= t.y + t.height), getIntersectData(e, t, A) {
if (A && (t = nt.tempToOuterOf(t, A)), !nt.hit(e, t)) return { x: 0, y: 0, width: 0, height: 0 };
let { x: s, y: i, width: r, height: n } = t;
return Se = s + r, ke = i + n, mA = e.x + e.width, QA = e.y + e.height, s = s > e.x ? s : e.x, i = i > e.y ? i : e.y, Se = Se < mA ? Se : mA, ke = ke < QA ? ke : QA, r = Se - s, n = ke - i, { x: s, y: i, width: r, height: n };
}, intersect(e, t, A) {
nt.copy(e, nt.getIntersectData(e, t, A));
}, isSame: (e, t) => e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height, isEmpty: (e) => e.x === 0 && e.y === 0 && e.width === 0 && e.height === 0, reset(e) {
nt.set(e);
} }, nt = v, { add: ul, copy: gl } = nt;
let ft = class Ko {
get minX() {
return v.minX(this);
}
get minY() {
return v.minY(this);
}
get maxX() {
return v.maxX(this);
}
get maxY() {
return v.maxY(this);
}
constructor(t, A, s, i) {
this.set(t, A, s, i);
}
set(t, A, s, i) {
return P(t) ? v.copy(this, t) : v.set(this, t, A, s, i), this;
}
get() {
const { x: t, y: A, width: s, height: i } = this;
return { x: t, y: A, width: s, height: i };
}
clone() {
return new Ko(this);
}
move(t, A) {
return v.move(this, t, A), this;
}
scale(t, A, s) {
return v.scale(this, t, A, s), this;
}
scaleOf(t, A, s) {
return v.scaleOf(this, t, A, s), this;
}
toOuterOf(t, A) {
return v.toOuterOf(this, t, A), this;
}
toInnerOf(t, A) {
return v.toInnerOf(this, t, A), this;
}
getFitMatrix(t, A) {
return v.getFitMatrix(this, t, A);
}
put(t, A, s) {
v.put(this, t, A, s);
}
spread(t, A) {
return v.spread(this, t, A), this;
}
shrink(t, A) {
return v.shrink(this, t, A), this;
}
ceil() {
return v.ceil(this), this;
}
unsign() {
return v.unsign(this), this;
}
float(t) {
return v.float(this, t), this;
}
add(t) {
return v.add(this, t), this;
}
addList(t) {
return v.setList(this, t, !0), this;
}
setList(t) {
return v.setList(this, t), this;
}
addListWithFn(t, A) {
return v.setListWithFn(this, t, A, !0), this;
}
setListWithFn(t, A) {
return v.setListWithFn(this, t, A), this;
}
setPoint(t) {
return v.setPoint(this, t), this;
}
setPoints(t) {
return v.setPoints(this, t), this;
}
addPoint(t) {
return v.addPoint(this, t), this;
}
getPoints() {
return v.getPoints(this);
}
hitPoint(t, A) {
return v.hitPoint(this, t, A);
}
hitRadiusPoint(t, A) {
return v.hitRadiusPoint(this, t, A);
}
hit(t, A) {
return v.hit(this, t, A);
}
includes(t, A) {
return v.includes(this, t, A);
}
intersect(t, A) {
return v.intersect(this, t, A), this;
}
getIntersect(t, A) {
return new Ko(v.getIntersectData(this, t, A));
}
isSame(t) {
return v.isSame(this, t);
}
isEmpty() {
return v.isEmpty(this);
}
reset() {
v.reset(this);
}
};
const q = new ft();
let qB = class {
constructor(t, A, s, i, r, n) {
P(t) ? this.copy(t) : this.set(t, A, s, i, r, n);
}
set(t = 0, A = 0, s = 0, i = 0, r = 0, n = 0) {
this.top = t, this.right = A, this.bottom = s, this.left = i, this.width = r, this.height = n;
}
copy(t) {
const { top: A, right: s, bottom: i, left: r, width: n, height: a } = t;
this.set(A, s, i, r, n, a);
}
getBoundsFrom(t) {
const { top: A, right: s, bottom: i, left: r, width: n, height: a } = this;
return new ft(r, A, n || t.width - r - s, a || t.height - A - i);
}
};
const tf = { 0: 1, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, ".": 1, e: 1, E: 1 }, { randColor: Bl } = Ft;
let dt = class Io {
constructor(t) {
this.repeatMap = {}, this.name = t;
}
static get(t) {
return new Io(t);
}
static set filter(t) {
this.filterList = fl(t);
}
static set exclude(t) {
this.excludeList = fl(t);
}
static drawRepaint(t, A) {
const s = Bl();
t.fillWorld(A, s.replace("1)", ".1)")), t.strokeWorld(A, s);
}
static drawBounds(t, A, s) {
const i = Io.showBounds === "hit", r = t.__nowWorld, n = Bl();
i && (A.setWorld(r), t.__drawHitPath(A), A.fillStyle = n.replace("1)", ".2)"), A.fill()), A.resetTransform(), A.setStroke(n, 2), i ? A.stroke() : A.strokeWorld(r, n);
}
log(...t) {
if (CA.enable) {
if (CA.filterList.length && CA.filterList.every((A) => A !== this.name) || CA.excludeList.length && CA.excludeList.some((A) => A === this.name)) return;
console.log("%c" + this.name, "color:#21ae62", ...t);
}
}
tip(...t) {
CA.enable && this.warn(...t);
}
warn(...t) {
CA.showWarn && console.warn(this.name, ...t);
}
repeat(t, ...A) {
this.repeatMap[t] || (this.warn("repeat:" + t, ...A), this.repeatMap[t] = !0);
}
error(...t) {
try {
throw new Error();
} catch (A) {
console.error(this.name, ...t, A);
}
}
};
function fl(e) {
return e ? G(e) && (e = [e]) : e = [], e;
}
dt.filterList = [], dt.excludeList = [], dt.showWarn = !0;
const CA = dt, ef = dt.get("RunTime"), ve = { currentId: 0, currentName: "", idMap: {}, nameMap: {}, nameToIdMap: {}, start(e, t) {
const A = iA.create(iA.RUNTIME);
return ce.currentId = ce.idMap[A] = t ? performance.now() : Date.now(), ce.currentName = ce.nameMap[A] = e, ce.nameToIdMap[e] = A, A;
}, end(e, t) {
const A = ce.idMap[e], s = ce.nameMap[e], i = t ? (performance.now() - A) / 1e3 : Date.now() - A;
ce.idMap[e] = ce.nameMap[e] = ce.nameToIdMap[s] = void 0, ef.log(s, i, "ms");
}, endOfName(e, t) {
const A = ce.nameToIdMap[e];
E(A) || ce.end(A, t);
} }, ce = ve, hg = [], st = { list: {}, add(e, ...t) {
this.list[e] = !0, hg.push(...t);
}, has(e, t) {
const A = this.list[e];
return !A && t && this.need(e), A;
}, need(e) {
console.error("please install and import plugin: " + (e.includes("-x") ? "" : "@leafer-in/") + e);
} };
setTimeout(() => hg.forEach((e) => st.has(e, !0)));
const Bt = { editor: (e) => st.need("editor") }, pl = dt.get("UICreator"), Yi = { list: {}, register(e) {
const { __tag: t } = e.prototype;
or[t] && pl.repeat(t), or[t] = e;
}, get(e, t, A, s, i, r) {
or[e] || pl.error("not register " + e);
const n = new or[e](t);
return E(A) || (n.x = A, s && (n.y = s), i && (n.width = i), r && (n.height = r)), n;
} }, { list: or } = Yi, Af = dt.get("EventCreator"), Rs = { nameList: {}, register(e) {
let t;
Object.keys(e).forEach((A) => {
t = e[A], G(t) && (Vs[t] && Af.repeat(t), Vs[t] = e);
});
}, changeName(e, t) {
const A = Vs[e];
if (A) {
const s = Object.keys(A).find((i) => A[i] === e);
s && (A[s] = t, Vs[t] = A);
}
}, has(e) {
return !!this.nameList[e];
}, get: (e, ...t) => new Vs[e](...t) }, { nameList: Vs } = Rs;
let lg = class {
constructor() {
this.list = [];
}
add(t) {
t.manager = this, this.list.push(t);
}
get(t) {
let A;
const { list: s } = this;
for (let r = 0, n = s.length; r < n; r++) if (A = s[r], A.recycled && A.isSameSize(t)) return A.recycled = !1, A.manager || (A.manager = this), A;
const i = Bt.canvas(t);
return this.add(i), i;
}
recycle(t) {
t.recycled = !0;
}
clearRecycled() {
let t;
const A = [];
for (let s = 0, i = this.list.length; s < i; s++) t = this.list[s], t.recycled ? t.destroy() : A.push(t);
this.list = A;
}
clear() {
this.list.forEach((t) => {
t.destroy();
}), this.list.length = 0;
}
destroy() {
this.clear();
}
};
function S(e, t, A, s) {
var i, r = arguments.length, n = r < 3 ? t : s === null ? s = Object.getOwnPropertyDescriptor(t, A) : s;
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") n = Reflect.decorate(e, t, A, s);
else for (var a = e.length - 1; a >= 0; a--) (i = e[a]) && (n = (r < 3 ? i(n) : r > 3 ? i(t, A, n) : i(t, A)) || n);
return r > 3 && n && Object.defineProperty(t, A, n), n;
}
function cg(e, t, A, s) {
return new (A || (A = Promise))(function(i, r) {
function n(h) {
try {
o(s.next(h));
} catch (l) {
r(l);
}
}
function a(h) {
try {
o(s.throw(h));
} catch (l) {
r(l);
}
}
function o(h) {
var l;
h.done ? i(h.value) : (l = h.value, l instanceof A ? l : new A(function(c) {
c(l);
})).then(n, a);
}
o((s = s.apply(e, [])).next());
});
}
function yt(e) {
return (t, A) => {
e || (e = A);
const s = { get() {
return this.context[e];
}, set(i) {
this.context[e] = i;
} };
A === "strokeCap" && (s.set = function(i) {
this.context[e] = i === "none" ? "butt" : i;
}), Object.defineProperty(t, A, s);
};
}
const dg = [];
function et() {
return (e, t) => {
dg.push(t);
};
}
const sf = [];
let k = class {
set blendMode(t) {
t === "normal" && (t = "source-over"), this.context.globalCompositeOperation = t;
}
get blendMode() {
return this.context.globalCompositeOperation;
}
set dashPattern(t) {
this.context.setLineDash(t || sf);
}
get dashPattern() {
return this.context.getLineDash();
}
__bindContext() {
let t;
dg.forEach((A) => {
t = this.context[A], t && (this[A] = t.bind(this.context));
}), this.textBaseline = "alphabetic";
}
setTransform(t, A, s, i, r, n) {
}
resetTransform() {
}
getTransform() {
}
save() {
}
restore() {
}
transform(t, A, s, i, r, n) {
P(t) ? this.context.transform(t.a, t.b, t.c, t.d, t.e, t.f) : this.context.transform(t, A, s, i, r, n);
}
translate(t, A) {
}
scale(t, A) {
}
rotate(t) {
}
fill(t, A) {
}
stroke(t) {
}
clip(t, A) {
}
fillRect(t, A, s, i) {
}
strokeRect(t, A, s, i) {
}
clearRect(t, A, s, i) {
}
drawImage(t, A, s, i, r, n, a, o, h) {
switch (arguments.length) {
case 9:
if (A < 0) {
const l = -A / i * o;
i += A, A = 0, n += l, o -= l;
}
if (s < 0) {
const l = -s / r * h;
r += s, s = 0, a += l, h -= l;
}
this.context.drawImage(t, A, s, i, r, n, a, o, h);
break;
case 5:
this.context.drawImage(t, A, s, i, r);
break;
case 3:
this.context.drawImage(t, A, s);
}
}
beginPath() {
}
moveTo(t, A) {
}
lineTo(t, A) {
}
bezierCurveTo(t, A, s, i, r, n) {
}
quadraticCurveTo(t, A, s, i) {
}
closePath() {
}
arc(t, A, s, i, r, n) {
}
arcTo(t, A, s, i, r) {
}
ellipse(t, A, s, i, r, n, a, o) {
}
rect(t, A, s, i) {
}
roundRect(t, A, s, i, r) {
}
createConicGradient(t, A, s) {
}
createLinearGradient(t, A, s, i) {
}
createPattern(t, A) {
}
createRadialGradient(t, A, s, i, r, n) {
}
fillText(t, A, s, i) {
}
measureText(t) {
}
strokeText(t, A, s, i) {
}
destroy() {
this.context = null;
}
};
S([yt("imageSmoothingEnabled")], k.prototype, "smooth", void 0), S([yt("imageSmoothingQuality")], k.prototype, "smoothLevel", void 0), S([yt("globalAlpha")], k.prototype, "opacity", void 0), S([yt()], k.prototype, "fillStyle", void 0), S([yt()], k.prototype, "strokeStyle", void 0), S([yt("lineWidth")], k.prototype, "strokeWidth", void 0), S([yt("lineCap")], k.prototype, "strokeCap", void 0), S([yt("lineJoin")], k.prototype, "strokeJoin", void 0), S([yt("lineDashOffset")], k.prototype, "dashOffset", void 0), S([yt()], k.prototype, "miterLimit", void 0), S([yt()], k.prototype, "shadowBlur", void 0), S([yt()], k.prototype, "shadowColor", void 0), S([yt()], k.prototype, "shadowOffsetX", void 0), S([yt()], k.prototype, "shadowOffsetY", void 0), S([yt()], k.prototype, "filter", void 0), S([yt()], k.prototype, "font", void 0), S([yt()], k.prototype, "fontKerning", void 0), S([yt()], k.prototype, "fontStretch", void 0), S([yt()], k.prototype, "fontVariantCaps", void 0), S([yt()], k.prototype, "textAlign", void 0), S([yt()], k.prototype, "textBaseline", void 0), S([yt()], k.prototype, "textRendering", void 0), S([yt()], k.prototype, "wordSpacing", void 0), S([yt()], k.prototype, "letterSpacing", void 0), S([yt()], k.prototype, "direction", void 0), S([et()], k.prototype, "setTransform", null), S([et()], k.prototype, "resetTransform", null), S([et()], k.prototype, "getTransform", null), S([et()], k.prototype, "save", null), S([et()], k.prototype, "restore", null), S([et()], k.prototype, "translate", null), S([et()], k.prototype, "scale", null), S([et()], k.prototype, "rotate", null), S([et()], k.prototype, "fill", null), S([et()], k.prototype, "stroke", null), S([et()], k.prototype, "clip", null), S([et()], k.prototype, "fillRect", null), S([et()], k.prototype, "strokeRect", null), S([et()], k.prototype, "clearRect", null), S([et()], k.prototype, "beginPath", null), S([et()], k.prototype, "moveTo", null), S([et()], k.prototype, "lineTo", null), S([et()], k.prototype, "bezierCurveTo", null), S([et()], k.prototype, "quadraticCurveTo", null), S([et()], k.prototype, "closePath", null), S([et()], k.prototype, "arc", null), S([et()], k.prototype, "arcTo", null), S([et()], k.prototype, "ellipse", null), S([et()], k.prototype, "rect", null), S([et()], k.prototype, "roundRect", null), S([et()], k.prototype, "createConicGradient", null), S([et()], k.prototype, "createLinearGradient", null), S([et()], k.prototype, "createPattern", null), S([et()], k.prototype, "createRadialGradient", null), S([et()], k.prototype, "fillText", null), S([et()], k.prototype, "measureText", null), S([et()], k.prototype, "strokeText", null);
const { copy: rf, multiplyParent: nf } = $, { round: hr } = Math, af = { width: 1, height: 1, pixelRatio: 1 }, Ce = ["width", "height", "pixelRatio"];
let bh = class extends k {
get width() {
return this.size.width;
}
get height() {
return this.size.height;
}
get pixelRatio() {
return this.size.pixelRatio;
}
get pixelWidth() {
return this.width * this.pixelRatio || 0;
}
get pixelHeight() {
return this.height * this.pixelRatio || 0;
}
get pixelSnap() {
return this.config.pixelSnap;
}
set pixelSnap(t) {
this.config.pixelSnap = t;
}
get allowBackgroundColor() {
return this.view && this.parentView;
}
constructor(t, A) {
super(), this.size = {}, this.worldTransform = {}, t || (t = af), this.manager = A, this.innerId = iA.create(iA.CNAVAS);
const { width: s, height: i, pixelRatio: r } = t;
this.autoLayout = !s || !i, this.size.pixelRatio = r | U.devicePixelRatio, this.config = t, this.init();
}
init() {
}
__createContext() {
const { view: t } = this, { contextSettings: A } = this.config;
this.context = A ? t.getContext("2d", A) : t.getContext("2d"), this.__bindContext();
}
export(t, A) {
}
toBlob(t, A) {
}
toDataURL(t, A) {
}
saveAs(t, A) {
}
resize(t, A = !0) {
if (this.isSameSize(t)) return;
let s;
this.context && !this.unreal && A && this.width && (s = this.getSameCanvas(), s.copyWorld(this));
const i = this.size;
At.copyAttrs(i, t, Ce), Ce.forEach((r) => i[r] || (i[r] = 1)), this.bounds = new ft(0, 0, this.width, this.height), this.context && !this.unreal && (this.updateViewSize(), this.smooth = this.config.smooth), this.updateClientBounds(), this.context && !this.unreal && s && (this.clearWorld(s.bounds), this.copyWorld(s), s.recycle());
}
updateViewSize() {
}
updateClientBounds() {
}
getClientBounds(t) {
return t && this.updateClientBounds(), this.clientBounds || this.bounds;
}
startAutoLayout(t, A) {
}
stopAutoLayout() {
}
setCursor(t) {
}
setWorld(t, A) {
const { pixelRatio: s, pixelSnap: i } = this, r = this.worldTransform;
A && nf(t, A, r), r.a = t.a * s, r.b = t.b * s, r.c = t.c * s, r.d = t.d * s, r.e = t.e * s, r.f = t.f * s, i && (t.half && t.half * s % 2 ? (r.e = hr(r.e - 0.5) + 0.5, r.f = hr(r.f - 0.5) + 0.5) : (r.e = hr(r.e), r.f = hr(r.f))), this.setTransform(r.a, r.b, r.c, r.d, r.e, r.f);
}
useWorldTransform(t) {
t && (this.worldTransform = t);
const A = this.worldTransform;
A && this.setTransform(A.a, A.b, A.c, A.d, A.e, A.f);
}
setStroke(t, A, s, i) {
A && (this.strokeWidth = A), t && (this.strokeStyle = t), s && this.setStrokeOptions(s, i);
}
setStrokeOptions(t, A) {
let { strokeCap: s, strokeJoin: i, dashPattern: r, dashOffset: n, miterLimit: a } = t;
A && (A.strokeCap && (s = A.strokeCap), A.strokeJoin && (i = A.strokeJoin), E(A.dashPattern) || (r = A.dashPattern), E(A.dashOffset) || (n = A.dashOffset), A.miterLimit && (a = A.miterLimit)), this.strokeCap = s, this.strokeJoin = i, this.dashPattern = r, this.dashOffset = n, this.miterLimit = a;
}
saveBlendMode(t) {
this.savedBlendMode = this.blendMode, this.blendMode = t;
}
restoreBlendMode() {
this.blendMode = this.savedBlendMode;
}
hitFill(t, A) {
return !0;
}
hitStroke(t, A) {
return !0;
}
hitPixel(t, A, s = 1) {
return !0;
}
setWorldShadow(t, A, s, i) {
const { pixelRatio: r } = this;
this.shadowOffsetX = t * r, this.shadowOffsetY = A * r, this.shadowBlur = s * r, this.shadowColor = i || "black";
}
setWorldBlur(t) {
const { pixelRatio: A } = this;
this.filter = `blur(${t * A}px)`;
}
copyWorld(t, A, s, i) {
if (i && (this.blendMode = i), A) {
const { pixelRatio: r } = this;
s || (s = A), this.drawImage(t.view, A.x * r, A.y * r, A.width * r, A.height * r, s.x * r, s.y * r, s.width * r, s.height * r);
} else this.drawImage(t.view, 0, 0);
i && (this.blendMode = "source-over");
}
copyWorldToInner(t, A, s, i) {
if (i && (this.blendMode = i), A.b || A.c) this.save(), this.resetTransform(), this.copyWorld(t, A, v.tempToOuterOf(s, A)), this.restore();
else {
const { pixelRatio: r } = this;
this.drawImage(t.view, A.x * r, A.y * r, A.width * r, A.height * r, s.x, s.y, s.width, s.height);
}
i && (this.blendMode = "source-over");
}
copyWorldByReset(t, A, s, i, r) {
this.resetTransform(), this.copyWorld(t, A, s, i), r || this.useWorldTransform();
}
useGrayscaleAlpha(t) {
let A, s;
this.setTempBounds(t, !0, !0);
const { context: i } = this, r = i.getImageData(q.x, q.y, q.width, q.height), { data: n } = r;
for (let a = 0, o = n.length; a < o; a += 4) s = 0.299 * n[a] + 0.587 * n[a + 1] + 0.114 * n[a + 2], (A = n[a + 3]) && (n[a + 3] = A === 255 ? s : A * (s / 255));
i.putImageData(r, q.x, q.y);
}
useMask(t, A, s) {
this.copyWorld(t, A, s, "destination-in");
}
useEraser(t, A, s) {
this.copyWorld(t, A, s, "destination-out");
}
fillWorld(t, A, s) {
s && (this.blendMode = s), this.fillStyle = A, this.setTempBounds(t), this.fillRect(q.x, q.y, q.width, q.height), s && (this.blendMode = "source-over");
}
strokeWorld(t, A, s) {
s && (this.blendMode = s), this.strokeStyle = A, this.setTempBounds(t), this.strokeRect(q.x, q.y, q.width, q.height), s && (this.blendMode = "source-over");
}
clipWorld(t, A) {
this.beginPath(), this.setTempBounds(t, A), this.rect(q.x, q.y, q.width, q.height), this.clip();
}
clipUI(t) {
t.windingRule ? this.clip(t.windingRule) : this.clip();
}
clearWorld(t, A) {
this.setTempBounds(t, A), this.clearRect(q.x, q.y, q.width, q.height);
}
clear() {
const { pixelRatio: t } = this;
this.clearRect(0, 0, this.width * t + 2, this.height * t + 2);
}
setTempBounds(t, A, s) {
q.set(t), s && q.intersect(this.bounds), q.scale(this.pixelRatio), A && q.ceil();
}
isSameSize(t) {
return this.width === t.width && this.height === t.height && (!t.pixelRatio || this.pixelRatio === t.pixelRatio);
}
getSameCanvas(t, A) {
const { size: s, pixelSnap: i } = this, r = this.manager ? this.manager.get(s) : Bt.canvas(Object.assign({}, s));
return r.save(), t && (rf(r.worldTransform, this.worldTransform), r.useWorldTransform()), A && (r.smooth = this.smooth), r.pixelSnap !== i && (r.pixelSnap = i), r;
}
recycle(t) {
this.recycled || (this.restore(), t ? this.clearWorld(t, !0) : this.clear(), this.manager ? this.manager.recycle(this) : this.destroy());
}
updateRender(t) {
}
unrealCanvas() {
}
destroy() {
this.manager = this.view = this.parentView = null;
}
};
const Ke = { creator: {}, parse(e, t) {
}, convertToCanvasData(e, t) {
} }, ug = { N: 21, D: 22, X: 23, G: 24, F: 25, O: 26, P: 27, U: 28 }, Gt = Object.assign({ M: 1, m: 10, L: 2, l: 20, H: 3, h: 30, V: 4, v: 40, C: 5, c: 50, S: 6, s: 60, Q: 7, q: 70, T: 8, t: 80, A: 9, a: 90, Z: 11, z: 11, R: 12 }, ug), gg = { M: 3, m: 3, L: 3, l: 3, H: 2, h: 2, V: 2, v: 2, C: 7, c: 7, S: 5, s: 5, Q: 5, q: 5, T: 3, t: 3, A: 8, a: 8, Z: 1, z: 1, N: 5, D: 9, X: 6, G: 9, F: 5, O: 7, P: 4, U: 6 }, Bg = { m: 10, l: 20, H: 3, h: 30, V: 4, v: 40, c: 50, S: 6, s: 60, q: 70, T: 8, t: 80, A: 9, a: 90 }, of = Object.assign(Object.assign({}, Bg), ug), mn = Gt, fg = {};
for (let e in mn) fg[mn[e]] = e;
const Hh = {};
for (let e in mn) Hh[mn[e]] = gg[e];
const pg = { drawRoundRect(e, t, A, s, i, r) {
const n = Ft.fourNumber(r, Math.min(s / 2, i / 2)), a = t + s, o = A + i;
n[0] ? e.moveTo(t + n[0], A) : e.moveTo(t, A), n[1] ? e.arcTo(a, A, a, o, n[1]) : e.lineTo(a, A), n[2] ? e.arcTo(a, o, t, o, n[2]) : e.lineTo(a, o), n[3] ? e.arcTo(t, o, t, A, n[3]) : e.lineTo(t, o), n[0] ? e.arcTo(t, A, a, A, n[0]) : e.lineTo(t, A);
} }, { sin: ss, cos: Ys, atan2: wl, ceil: hf, abs: Zn, PI: _l, sqrt: yl, pow: lr } = Math, { setPoint: qn, addPoint: cr } = Vi, { set: dr, toNumberPoints: lf } = x, { M: ml, L: ta, C: ea, Q: Ql, Z: cf } = Gt, Aa = {}, eA = { points(e, t, A, s) {
let i = lf(t);
if (e.push(ml, i[0], i[1]), A && i.length > 5) {
let r, n, a, o, h, l, c, d, u, g, B, f, _, p = i.length;
const Q = A === !0 ? 0.5 : A;
s && (i = [i[p - 2], i[p - 1], ...i, i[0], i[1], i[2], i[3]], p = i.length);
for (let m = 2; m < p - 2; m += 2) r = i[m - 2], n = i[m - 1], a = i[m], o = i[m + 1], h = i[m + 2], l = i[m + 3], B = yl(lr(a - r, 2) + lr(o - n, 2)), f = yl(lr(h - a, 2) + lr(l - o, 2)), (B || f) && (_ = B + f, B = Q * B / _, f = Q * f / _, h -= r, l -= n, c = a - B * h, d = o - B * l, m === 2 ? s || e.push(Ql, c, d, a, o) : e.push(ea, u, g, c, d, a, o), u = a + f * h, g = o + f * l);
s || e.push(Ql, u, g, i[p - 2], i[p - 1]);
} else for (let r = 2, n = i.length; r < n; r += 2) e.push(ta, i[r], i[r + 1]);
s && e.push(cf);
}, rect(e, t, A, s, i) {
Ke.creator.path = e, Ke.creator.moveTo(t, A).lineTo(t + s, A).lineTo(t + s, A + i).lineTo(t, A + i).lineTo(t, A);
}, roundRect(e, t, A, s, i, r) {
Ke.creator.path = [], pg.drawRoundRect(Ke.creator, t, A, s, i, r), e.push(...Ke.convertToCanvasData(Ke.creator.path, !0));
}, arcTo(e, t, A, s, i, r, n, a, o, h, l) {
const c = s - t, d = i - A, u = r - s, g = n - i;
let B = wl(d, c), f = wl(g, u), _ = f - B;
if (_ < 0 && (_ += me), _ === _l || Zn(c + d) < 1e-12 || Zn(u + g) < 1e-12) return e && e.push(ta, s, i), o && (qn(o, t, A), cr(o, s, i)), l && dr(l, t, A), void (h && dr(h, s, i));
const p = c * g - u * d < 0, Q = p ? -1 : 1, m = a / Ys(_ / 2), C = s + m * Ys(B + _ / 2 + Fs * Q), H = i + m * ss(B + _ / 2 + Fs * Q);
return B -= Fs * Q, f -= Fs * Q, Ul(e, C, H, a, a, 0, B / ht, f / ht, p, o, h, l);
}, arc: (e, t, A, s, i, r, n, a, o, h) => Ul(e, t, A, s, s, 0, i, r, n, a, o, h), ellipse(e, t, A, s, i, r, n, a, o, h, l, c) {
const d = r * ht, u = ss(d), g = Ys(d);
let B = n * ht, f = a * ht;
B > _l && (B -= me), f < 0 && (f += me);
let _ = f - B;
_ < 0 ? _ += me : _ > me && (_ -= me), o && (_ -= me);
const p = hf(Zn(_ / Fs)), Q = _ / p, m = ss(Q / 4), C = 8 / 3 * m * m / ss(Q / 2);
f = B + Q;
let H, F, b, I, O, K, R, T, Y = Ys(B), D = ss(B), Z = b = g * s * Y - u * i * D, it = I = u * s * Y + g * i * D, ut = t + b, j = A + I;
e && e.push(e.length ? ta : ml, ut, j), h && qn(h, ut, j), c && dr(c, ut, j);
for (let St = 0; St < p; St++) H = Ys(f), F = ss(f), b = g * s * H - u * i * F, I = u * s * H + g * i * F, O = t + Z - C * (g * s * D + u * i * Y), K = A + it - C * (u * s * D - g * i * Y), R = t + b + C * (g * s * F + u * i * H), T = A + I + C * (u * s * F - g * i * H), e && e.push(ea, O, K, R, T, t + b, A + I), h && Cl(t + Z, A + it, O, K, R, T, t + b, A + I, h, !0), Z = b, it = I, Y = H, D = F, B = f, f += Q;
l && dr(l, t + b, A + I);
}, quadraticCurveTo(e, t, A, s, i, r, n) {
e.push(ea, (t + 2 * s) / 3, (A + 2 * i) / 3, (r + 2 * s) / 3, (n + 2 * i) / 3, r, n);
}, toTwoPointBoundsByQuadraticCurve(e, t, A, s, i, r, n, a) {
Cl(e, t, (e + 2 * A) / 3, (t + 2 * s) / 3, (i + 2 * A) / 3, (r + 2 * s) / 3, i, r, n, a);
}, toTwoPointBounds(e, t, A, s, i, r, n, a, o, h) {
const l = [];
let c, d, u, g, B, f, _, p, Q = e, m = A, C = i, H = n;
for (let F = 0; F < 2; ++F) if (F == 1 && (Q = t, m = s, C = r, H = a), c = -3 * Q + 9 * m - 9 * C + 3 * H, d = 6 * Q - 12 * m + 6 * C, u = 3 * m - 3 * Q, Math.abs(c) < 1e-12) {
if (Math.abs(d) < 1e-12) continue;
g = -u / d, 0 < g && g < 1 && l.push(g);
} else _ = d * d - 4 * u * c, p = Math.sqrt(_), _ < 0 || (B = (-d + p) / (2 * c), 0 < B && B < 1 && l.push(B), f = (-d - p) / (2 * c), 0 < f && f < 1 && l.push(f));
h ? cr(o, e, t) : qn(o, e, t), cr(o, n, a);
for (let F = 0, b = l.length; F < b; F++) Fl(l[F], e, t, A, s, i, r, n, a, Aa), cr(o, Aa.x, Aa.y);
}, getPointAndSet(e, t, A, s, i, r, n, a, o, h) {
const l = 1 - e, c = l * l * l, d = 3 * l * l * e, u = 3 * l * e * e, g = e * e * e;
h.x = c * t + d * s + u * r + g * a, h.y = c * A + d * i + u * n + g * o;
}, getPoint(e, t, A, s, i, r, n, a, o) {
const h = {};
return Fl(e, t, A, s, i, r, n, a, o, h), h;
}, getDerivative(e, t, A, s, i) {
const r = 1 - e;
return 3 * r * r * (A - t) + 6 * r * e * (s - A