react-mindee-js
Version:
Front-End Computer Vision SDK for React
1,499 lines (1,495 loc) • 2.34 MB
JavaScript
var ea = Object.defineProperty;
var aa = (f, r, e) => r in f ? ea(f, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[r] = e;
var tr = (f, r, e) => (aa(f, typeof r != "symbol" ? r + "" : r, e), e), Pr = (f, r, e) => {
if (!r.has(f))
throw TypeError("Cannot " + e);
};
var F = (f, r, e) => (Pr(f, r, "read from private field"), e ? e.call(f) : r.get(f)), c0 = (f, r, e) => {
if (r.has(f))
throw TypeError("Cannot add the same private member more than once");
r instanceof WeakSet ? r.add(f) : r.set(f, e);
}, R0 = (f, r, e, a) => (Pr(f, r, "write to private field"), a ? a.call(f, e) : r.set(f, e), e), gr = (f, r, e, a) => ({
set _(t) {
R0(f, r, t, e);
},
get _() {
return F(f, r, a);
}
}), k0 = (f, r, e) => (Pr(f, r, "access private method"), e);
import require$$0, { useRef, useEffect } from "react";
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function getDefaultExportFromCjs(f) {
return f && f.__esModule && Object.prototype.hasOwnProperty.call(f, "default") ? f.default : f;
}
function getAugmentedNamespace(f) {
if (f.__esModule)
return f;
var r = f.default;
if (typeof r == "function") {
var e = function a() {
if (this instanceof a) {
var t = [null];
t.push.apply(t, arguments);
var s = Function.bind.apply(r, t);
return new s();
}
return r.apply(this, arguments);
};
e.prototype = r.prototype;
} else
e = {};
return Object.defineProperty(e, "__esModule", { value: !0 }), Object.keys(f).forEach(function(a) {
var t = Object.getOwnPropertyDescriptor(f, a);
Object.defineProperty(e, a, t.get ? t : {
enumerable: !0,
get: function() {
return f[a];
}
});
}), e;
}
var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
/**
* @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 hasRequiredReactJsxRuntime_production_min;
function requireReactJsxRuntime_production_min() {
if (hasRequiredReactJsxRuntime_production_min)
return reactJsxRuntime_production_min;
hasRequiredReactJsxRuntime_production_min = 1;
var f = require$$0, r = Symbol.for("react.element"), e = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, t = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
function n(o, A, l) {
var u, h = {}, c = null, g = null;
l !== void 0 && (c = "" + l), A.key !== void 0 && (c = "" + A.key), A.ref !== void 0 && (g = A.ref);
for (u in A)
a.call(A, u) && !s.hasOwnProperty(u) && (h[u] = A[u]);
if (o && o.defaultProps)
for (u in A = o.defaultProps, A)
h[u] === void 0 && (h[u] = A[u]);
return { $$typeof: r, type: o, key: c, ref: g, props: h, _owner: t.current };
}
return reactJsxRuntime_production_min.Fragment = e, reactJsxRuntime_production_min.jsx = n, reactJsxRuntime_production_min.jsxs = n, reactJsxRuntime_production_min;
}
var reactJsxRuntime_development = {};
/**
* @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 hasRequiredReactJsxRuntime_development;
function requireReactJsxRuntime_development() {
return hasRequiredReactJsxRuntime_development || (hasRequiredReactJsxRuntime_development = 1, process.env.NODE_ENV !== "production" && function() {
var f = require$$0, r = Symbol.for("react.element"), e = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), t = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), n = Symbol.for("react.provider"), o = Symbol.for("react.context"), A = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), c = Symbol.for("react.lazy"), g = Symbol.for("react.offscreen"), v = Symbol.iterator, m = "@@iterator";
function b(L) {
if (L === null || typeof L != "object")
return null;
var s0 = v && L[v] || L[m];
return typeof s0 == "function" ? s0 : null;
}
var _ = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function k(L) {
{
for (var s0 = arguments.length, w0 = new Array(s0 > 1 ? s0 - 1 : 0), G0 = 1; G0 < s0; G0++)
w0[G0 - 1] = arguments[G0];
p("error", L, w0);
}
}
function p(L, s0, w0) {
{
var G0 = _.ReactDebugCurrentFrame, P0 = G0.getStackAddendum();
P0 !== "" && (s0 += "%s", w0 = w0.concat([P0]));
var Q0 = w0.map(function(Y0) {
return String(Y0);
});
Q0.unshift("Warning: " + s0), Function.prototype.apply.call(console[L], console, Q0);
}
}
var C = !1, d = !1, y = !1, G = !1, T = !1, R;
R = Symbol.for("react.module.reference");
function M(L) {
return !!(typeof L == "string" || typeof L == "function" || L === a || L === s || T || L === t || L === l || L === u || G || L === g || C || d || y || typeof L == "object" && L !== null && (L.$$typeof === c || L.$$typeof === h || L.$$typeof === n || L.$$typeof === o || L.$$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.
L.$$typeof === R || L.getModuleId !== void 0));
}
function W(L, s0, w0) {
var G0 = L.displayName;
if (G0)
return G0;
var P0 = s0.displayName || s0.name || "";
return P0 !== "" ? w0 + "(" + P0 + ")" : w0;
}
function Y(L) {
return L.displayName || "Context";
}
function U(L) {
if (L == null)
return null;
if (typeof L.tag == "number" && k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof L == "function")
return L.displayName || L.name || null;
if (typeof L == "string")
return L;
switch (L) {
case a:
return "Fragment";
case e:
return "Portal";
case s:
return "Profiler";
case t:
return "StrictMode";
case l:
return "Suspense";
case u:
return "SuspenseList";
}
if (typeof L == "object")
switch (L.$$typeof) {
case o:
var s0 = L;
return Y(s0) + ".Consumer";
case n:
var w0 = L;
return Y(w0._context) + ".Provider";
case A:
return W(L, L.render, "ForwardRef");
case h:
var G0 = L.displayName || null;
return G0 !== null ? G0 : U(L.type) || "Memo";
case c: {
var P0 = L, Q0 = P0._payload, Y0 = P0._init;
try {
return U(Y0(Q0));
} catch {
return null;
}
}
}
return null;
}
var O = Object.assign, a0 = 0, o0, l0, E, V, z, J, f0;
function P() {
}
P.__reactDisabledLog = !0;
function w() {
{
if (a0 === 0) {
o0 = console.log, l0 = console.info, E = console.warn, V = console.error, z = console.group, J = console.groupCollapsed, f0 = console.groupEnd;
var L = {
configurable: !0,
enumerable: !0,
value: P,
writable: !0
};
Object.defineProperties(console, {
info: L,
log: L,
warn: L,
error: L,
group: L,
groupCollapsed: L,
groupEnd: L
});
}
a0++;
}
}
function I() {
{
if (a0--, a0 === 0) {
var L = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: O({}, L, {
value: o0
}),
info: O({}, L, {
value: l0
}),
warn: O({}, L, {
value: E
}),
error: O({}, L, {
value: V
}),
group: O({}, L, {
value: z
}),
groupCollapsed: O({}, L, {
value: J
}),
groupEnd: O({}, L, {
value: f0
})
});
}
a0 < 0 && k("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var B = _.ReactCurrentDispatcher, D;
function N(L, s0, w0) {
{
if (D === void 0)
try {
throw Error();
} catch (P0) {
var G0 = P0.stack.trim().match(/\n( *(at )?)/);
D = G0 && G0[1] || "";
}
return `
` + D + L;
}
}
var H = !1, q;
{
var i0 = typeof WeakMap == "function" ? WeakMap : Map;
q = new i0();
}
function u0(L, s0) {
if (!L || H)
return "";
{
var w0 = q.get(L);
if (w0 !== void 0)
return w0;
}
var G0;
H = !0;
var P0 = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var Q0;
Q0 = B.current, B.current = null, w();
try {
if (s0) {
var Y0 = function() {
throw Error();
};
if (Object.defineProperty(Y0.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(Y0, []);
} catch (nr) {
G0 = nr;
}
Reflect.construct(L, [], Y0);
} else {
try {
Y0.call();
} catch (nr) {
G0 = nr;
}
L.call(Y0.prototype);
}
} else {
try {
throw Error();
} catch (nr) {
G0 = nr;
}
L();
}
} catch (nr) {
if (nr && G0 && typeof nr.stack == "string") {
for (var H0 = nr.stack.split(`
`), q0 = G0.stack.split(`
`), $0 = H0.length - 1, rr = q0.length - 1; $0 >= 1 && rr >= 0 && H0[$0] !== q0[rr]; )
rr--;
for (; $0 >= 1 && rr >= 0; $0--, rr--)
if (H0[$0] !== q0[rr]) {
if ($0 !== 1 || rr !== 1)
do
if ($0--, rr--, rr < 0 || H0[$0] !== q0[rr]) {
var er = `
` + H0[$0].replace(" at new ", " at ");
return L.displayName && er.includes("<anonymous>") && (er = er.replace("<anonymous>", L.displayName)), typeof L == "function" && q.set(L, er), er;
}
while ($0 >= 1 && rr >= 0);
break;
}
}
} finally {
H = !1, B.current = Q0, I(), Error.prepareStackTrace = P0;
}
var ir = L ? L.displayName || L.name : "", ar = ir ? N(ir) : "";
return typeof L == "function" && q.set(L, ar), ar;
}
function h0(L, s0, w0) {
return u0(L, !1);
}
function _0(L) {
var s0 = L.prototype;
return !!(s0 && s0.isReactComponent);
}
function E0(L, s0, w0) {
if (L == null)
return "";
if (typeof L == "function")
return u0(L, _0(L));
if (typeof L == "string")
return N(L);
switch (L) {
case l:
return N("Suspense");
case u:
return N("SuspenseList");
}
if (typeof L == "object")
switch (L.$$typeof) {
case A:
return h0(L.render);
case h:
return E0(L.type, s0, w0);
case c: {
var G0 = L, P0 = G0._payload, Q0 = G0._init;
try {
return E0(Q0(P0), s0, w0);
} catch {
}
}
}
return "";
}
var S0 = Object.prototype.hasOwnProperty, b0 = {}, Z0 = _.ReactDebugCurrentFrame;
function X0(L) {
if (L) {
var s0 = L._owner, w0 = E0(L.type, L._source, s0 ? s0.type : null);
Z0.setExtraStackFrame(w0);
} else
Z0.setExtraStackFrame(null);
}
function D0(L, s0, w0, G0, P0) {
{
var Q0 = Function.call.bind(S0);
for (var Y0 in L)
if (Q0(L, Y0)) {
var H0 = void 0;
try {
if (typeof L[Y0] != "function") {
var q0 = Error((G0 || "React class") + ": " + w0 + " type `" + Y0 + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof L[Y0] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw q0.name = "Invariant Violation", q0;
}
H0 = L[Y0](s0, Y0, G0, w0, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch ($0) {
H0 = $0;
}
H0 && !(H0 instanceof Error) && (X0(P0), k("%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).", G0 || "React class", w0, Y0, typeof H0), X0(null)), H0 instanceof Error && !(H0.message in b0) && (b0[H0.message] = !0, X0(P0), k("Failed %s type: %s", w0, H0.message), X0(null));
}
}
}
var V0 = Array.isArray;
function F0(L) {
return V0(L);
}
function p0(L) {
{
var s0 = typeof Symbol == "function" && Symbol.toStringTag, w0 = s0 && L[Symbol.toStringTag] || L.constructor.name || "Object";
return w0;
}
}
function m0(L) {
try {
return I0(L), !1;
} catch {
return !0;
}
}
function I0(L) {
return "" + L;
}
function O0(L) {
if (m0(L))
return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", p0(L)), I0(L);
}
var L0 = _.ReactCurrentOwner, z0 = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, J0, K0, Q;
Q = {};
function T0(L) {
if (S0.call(L, "ref")) {
var s0 = Object.getOwnPropertyDescriptor(L, "ref").get;
if (s0 && s0.isReactWarning)
return !1;
}
return L.ref !== void 0;
}
function M0(L) {
if (S0.call(L, "key")) {
var s0 = Object.getOwnPropertyDescriptor(L, "key").get;
if (s0 && s0.isReactWarning)
return !1;
}
return L.key !== void 0;
}
function U0(L, s0) {
if (typeof L.ref == "string" && L0.current && s0 && L0.current.stateNode !== s0) {
var w0 = U(L0.current.type);
Q[w0] || (k('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', U(L0.current.type), L.ref), Q[w0] = !0);
}
}
function K(L, s0) {
{
var w0 = function() {
J0 || (J0 = !0, k("%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)", s0));
};
w0.isReactWarning = !0, Object.defineProperty(L, "key", {
get: w0,
configurable: !0
});
}
}
function t0(L, s0) {
{
var w0 = function() {
K0 || (K0 = !0, k("%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)", s0));
};
w0.isReactWarning = !0, Object.defineProperty(L, "ref", {
get: w0,
configurable: !0
});
}
}
var Z = function(L, s0, w0, G0, P0, Q0, Y0) {
var H0 = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: r,
// Built-in properties that belong on the element
type: L,
key: s0,
ref: w0,
props: Y0,
// Record the component responsible for creating this element.
_owner: Q0
};
return H0._store = {}, Object.defineProperty(H0._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(H0, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: G0
}), Object.defineProperty(H0, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: P0
}), Object.freeze && (Object.freeze(H0.props), Object.freeze(H0)), H0;
};
function g0(L, s0, w0, G0, P0) {
{
var Q0, Y0 = {}, H0 = null, q0 = null;
w0 !== void 0 && (O0(w0), H0 = "" + w0), M0(s0) && (O0(s0.key), H0 = "" + s0.key), T0(s0) && (q0 = s0.ref, U0(s0, P0));
for (Q0 in s0)
S0.call(s0, Q0) && !z0.hasOwnProperty(Q0) && (Y0[Q0] = s0[Q0]);
if (L && L.defaultProps) {
var $0 = L.defaultProps;
for (Q0 in $0)
Y0[Q0] === void 0 && (Y0[Q0] = $0[Q0]);
}
if (H0 || q0) {
var rr = typeof L == "function" ? L.displayName || L.name || "Unknown" : L;
H0 && K(Y0, rr), q0 && t0(Y0, rr);
}
return Z(L, H0, q0, P0, G0, L0.current, Y0);
}
}
var B0 = _.ReactCurrentOwner, S = _.ReactDebugCurrentFrame;
function C0(L) {
if (L) {
var s0 = L._owner, w0 = E0(L.type, L._source, s0 ? s0.type : null);
S.setExtraStackFrame(w0);
} else
S.setExtraStackFrame(null);
}
var $;
$ = !1;
function X(L) {
return typeof L == "object" && L !== null && L.$$typeof === r;
}
function r0() {
{
if (B0.current) {
var L = U(B0.current.type);
if (L)
return `
Check the render method of \`` + L + "`.";
}
return "";
}
}
function A0(L) {
{
if (L !== void 0) {
var s0 = L.fileName.replace(/^.*[\\\/]/, ""), w0 = L.lineNumber;
return `
Check your code at ` + s0 + ":" + w0 + ".";
}
return "";
}
}
var x0 = {};
function y0(L) {
{
var s0 = r0();
if (!s0) {
var w0 = typeof L == "string" ? L : L.displayName || L.name;
w0 && (s0 = `
Check the top-level render call using <` + w0 + ">.");
}
return s0;
}
}
function W0(L, s0) {
{
if (!L._store || L._store.validated || L.key != null)
return;
L._store.validated = !0;
var w0 = y0(s0);
if (x0[w0])
return;
x0[w0] = !0;
var G0 = "";
L && L._owner && L._owner !== B0.current && (G0 = " It was passed a child from " + U(L._owner.type) + "."), C0(L), k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', w0, G0), C0(null);
}
}
function v0(L, s0) {
{
if (typeof L != "object")
return;
if (F0(L))
for (var w0 = 0; w0 < L.length; w0++) {
var G0 = L[w0];
X(G0) && W0(G0, s0);
}
else if (X(L))
L._store && (L._store.validated = !0);
else if (L) {
var P0 = b(L);
if (typeof P0 == "function" && P0 !== L.entries)
for (var Q0 = P0.call(L), Y0; !(Y0 = Q0.next()).done; )
X(Y0.value) && W0(Y0.value, s0);
}
}
}
function j0(L) {
{
var s0 = L.type;
if (s0 == null || typeof s0 == "string")
return;
var w0;
if (typeof s0 == "function")
w0 = s0.propTypes;
else if (typeof s0 == "object" && (s0.$$typeof === A || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
s0.$$typeof === h))
w0 = s0.propTypes;
else
return;
if (w0) {
var G0 = U(s0);
D0(w0, L.props, "prop", G0, L);
} else if (s0.PropTypes !== void 0 && !$) {
$ = !0;
var P0 = U(s0);
k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", P0 || "Unknown");
}
typeof s0.getDefaultProps == "function" && !s0.getDefaultProps.isReactClassApproved && k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function N0(L) {
{
for (var s0 = Object.keys(L.props), w0 = 0; w0 < s0.length; w0++) {
var G0 = s0[w0];
if (G0 !== "children" && G0 !== "key") {
C0(L), k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", G0), C0(null);
break;
}
}
L.ref !== null && (C0(L), k("Invalid attribute `ref` supplied to `React.Fragment`."), C0(null));
}
}
function e0(L, s0, w0, G0, P0, Q0) {
{
var Y0 = M(L);
if (!Y0) {
var H0 = "";
(L === void 0 || typeof L == "object" && L !== null && Object.keys(L).length === 0) && (H0 += " 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 q0 = A0(P0);
q0 ? H0 += q0 : H0 += r0();
var $0;
L === null ? $0 = "null" : F0(L) ? $0 = "array" : L !== void 0 && L.$$typeof === r ? ($0 = "<" + (U(L.type) || "Unknown") + " />", H0 = " Did you accidentally export a JSX literal instead of a component?") : $0 = typeof L, k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", $0, H0);
}
var rr = g0(L, s0, w0, P0, Q0);
if (rr == null)
return rr;
if (Y0) {
var er = s0.children;
if (er !== void 0)
if (G0)
if (F0(er)) {
for (var ir = 0; ir < er.length; ir++)
v0(er[ir], L);
Object.freeze && Object.freeze(er);
} else
k("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
v0(er, L);
}
return L === a ? N0(rr) : j0(rr), rr;
}
}
function x(L, s0, w0) {
return e0(L, s0, w0, !0);
}
function j(L, s0, w0) {
return e0(L, s0, w0, !1);
}
var n0 = j, d0 = x;
reactJsxRuntime_development.Fragment = a, reactJsxRuntime_development.jsx = n0, reactJsxRuntime_development.jsxs = d0;
}()), reactJsxRuntime_development;
}
process.env.NODE_ENV === "production" ? jsxRuntime.exports = requireReactJsxRuntime_production_min() : jsxRuntime.exports = requireReactJsxRuntime_development();
var jsxRuntimeExports = jsxRuntime.exports, PI_OVER_180 = Math.PI / 180;
function detectBrowser() {
return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
}
const glob = typeof global < "u" ? global : typeof window < "u" ? window : typeof WorkerGlobalScope < "u" ? self : {}, Konva$2 = {
_global: glob,
version: "8.1.3",
isBrowser: detectBrowser(),
isUnminified: /param/.test(function(f) {
}.toString()),
dblClickWindow: 400,
getAngle(f) {
return Konva$2.angleDeg ? f * PI_OVER_180 : f;
},
enableTrace: !1,
pointerEventsEnabled: !0,
autoDrawEnabled: !0,
hitOnDragEnabled: !1,
capturePointerEventsEnabled: !1,
_mouseListenClick: !1,
_touchListenClick: !1,
_pointerListenClick: !1,
_mouseInDblClickWindow: !1,
_touchInDblClickWindow: !1,
_pointerInDblClickWindow: !1,
pixelRatio: typeof window < "u" && window.devicePixelRatio || 1,
dragDistance: 3,
angleDeg: !0,
showWarnings: !0,
dragButtons: [0, 1],
isDragging() {
return Konva$2.DD.isDragging;
},
isDragReady() {
return !!Konva$2.DD.node;
},
document: glob.document,
_injectGlobal(f) {
glob.Konva = f;
}
}, _registerNode = (f) => {
Konva$2[f.prototype.getClassName()] = f;
};
Konva$2._injectGlobal(Konva$2);
class Transform {
constructor(r = [1, 0, 0, 1, 0, 0]) {
this.dirty = !1, this.m = r && r.slice() || [1, 0, 0, 1, 0, 0];
}
reset() {
this.m[0] = 1, this.m[1] = 0, this.m[2] = 0, this.m[3] = 1, this.m[4] = 0, this.m[5] = 0;
}
copy() {
return new Transform(this.m);
}
copyInto(r) {
r.m[0] = this.m[0], r.m[1] = this.m[1], r.m[2] = this.m[2], r.m[3] = this.m[3], r.m[4] = this.m[4], r.m[5] = this.m[5];
}
point(r) {
var e = this.m;
return {
x: e[0] * r.x + e[2] * r.y + e[4],
y: e[1] * r.x + e[3] * r.y + e[5]
};
}
translate(r, e) {
return this.m[4] += this.m[0] * r + this.m[2] * e, this.m[5] += this.m[1] * r + this.m[3] * e, this;
}
scale(r, e) {
return this.m[0] *= r, this.m[1] *= r, this.m[2] *= e, this.m[3] *= e, this;
}
rotate(r) {
var e = Math.cos(r), a = Math.sin(r), t = this.m[0] * e + this.m[2] * a, s = this.m[1] * e + this.m[3] * a, n = this.m[0] * -a + this.m[2] * e, o = this.m[1] * -a + this.m[3] * e;
return this.m[0] = t, this.m[1] = s, this.m[2] = n, this.m[3] = o, this;
}
getTranslation() {
return {
x: this.m[4],
y: this.m[5]
};
}
skew(r, e) {
var a = this.m[0] + this.m[2] * e, t = this.m[1] + this.m[3] * e, s = this.m[2] + this.m[0] * r, n = this.m[3] + this.m[1] * r;
return this.m[0] = a, this.m[1] = t, this.m[2] = s, this.m[3] = n, this;
}
multiply(r) {
var e = this.m[0] * r.m[0] + this.m[2] * r.m[1], a = this.m[1] * r.m[0] + this.m[3] * r.m[1], t = this.m[0] * r.m[2] + this.m[2] * r.m[3], s = this.m[1] * r.m[2] + this.m[3] * r.m[3], n = this.m[0] * r.m[4] + this.m[2] * r.m[5] + this.m[4], o = this.m[1] * r.m[4] + this.m[3] * r.m[5] + this.m[5];
return this.m[0] = e, this.m[1] = a, this.m[2] = t, this.m[3] = s, this.m[4] = n, this.m[5] = o, this;
}
invert() {
var r = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]), e = this.m[3] * r, a = -this.m[1] * r, t = -this.m[2] * r, s = this.m[0] * r, n = r * (this.m[2] * this.m[5] - this.m[3] * this.m[4]), o = r * (this.m[1] * this.m[4] - this.m[0] * this.m[5]);
return this.m[0] = e, this.m[1] = a, this.m[2] = t, this.m[3] = s, this.m[4] = n, this.m[5] = o, this;
}
getMatrix() {
return this.m;
}
setAbsolutePosition(r, e) {
var a = this.m[0], t = this.m[1], s = this.m[2], n = this.m[3], o = this.m[4], A = this.m[5], l = (a * (e - A) - t * (r - o)) / (a * n - t * s), u = (r - o - s * l) / a;
return this.translate(u, l);
}
decompose() {
var r = this.m[0], e = this.m[1], a = this.m[2], t = this.m[3], s = this.m[4], n = this.m[5], o = r * t - e * a;
let A = {
x: s,
y: n,
rotation: 0,
scaleX: 0,
scaleY: 0,
skewX: 0,
skewY: 0
};
if (r != 0 || e != 0) {
var l = Math.sqrt(r * r + e * e);
A.rotation = e > 0 ? Math.acos(r / l) : -Math.acos(r / l), A.scaleX = l, A.scaleY = o / l, A.skewX = (r * a + e * t) / o, A.skewY = 0;
} else if (a != 0 || t != 0) {
var u = Math.sqrt(a * a + t * t);
A.rotation = Math.PI / 2 - (t > 0 ? Math.acos(-a / u) : -Math.acos(a / u)), A.scaleX = o / u, A.scaleY = u, A.skewX = 0, A.skewY = (r * a + e * t) / o;
}
return A.rotation = Util._getRotation(A.rotation), A;
}
}
var OBJECT_ARRAY = "[object Array]", OBJECT_NUMBER = "[object Number]", OBJECT_STRING = "[object String]", OBJECT_BOOLEAN = "[object Boolean]", PI_OVER_DEG180 = Math.PI / 180, DEG180_OVER_PI = 180 / Math.PI, HASH$1 = "#", EMPTY_STRING$1 = "", ZERO = "0", KONVA_WARNING = "Konva warning: ", KONVA_ERROR = "Konva error: ", RGB_PAREN = "rgb(", COLORS = {
aliceblue: [240, 248, 255],
antiquewhite: [250, 235, 215],
aqua: [0, 255, 255],
aquamarine: [127, 255, 212],
azure: [240, 255, 255],
beige: [245, 245, 220],
bisque: [255, 228, 196],
black: [0, 0, 0],
blanchedalmond: [255, 235, 205],
blue: [0, 0, 255],
blueviolet: [138, 43, 226],
brown: [165, 42, 42],
burlywood: [222, 184, 135],
cadetblue: [95, 158, 160],
chartreuse: [127, 255, 0],
chocolate: [210, 105, 30],
coral: [255, 127, 80],
cornflowerblue: [100, 149, 237],
cornsilk: [255, 248, 220],
crimson: [220, 20, 60],
cyan: [0, 255, 255],
darkblue: [0, 0, 139],
darkcyan: [0, 139, 139],
darkgoldenrod: [184, 132, 11],
darkgray: [169, 169, 169],
darkgreen: [0, 100, 0],
darkgrey: [169, 169, 169],
darkkhaki: [189, 183, 107],
darkmagenta: [139, 0, 139],
darkolivegreen: [85, 107, 47],
darkorange: [255, 140, 0],
darkorchid: [153, 50, 204],
darkred: [139, 0, 0],
darksalmon: [233, 150, 122],
darkseagreen: [143, 188, 143],
darkslateblue: [72, 61, 139],
darkslategray: [47, 79, 79],
darkslategrey: [47, 79, 79],
darkturquoise: [0, 206, 209],
darkviolet: [148, 0, 211],
deeppink: [255, 20, 147],
deepskyblue: [0, 191, 255],
dimgray: [105, 105, 105],
dimgrey: [105, 105, 105],
dodgerblue: [30, 144, 255],
firebrick: [178, 34, 34],
floralwhite: [255, 255, 240],
forestgreen: [34, 139, 34],
fuchsia: [255, 0, 255],
gainsboro: [220, 220, 220],
ghostwhite: [248, 248, 255],
gold: [255, 215, 0],
goldenrod: [218, 165, 32],
gray: [128, 128, 128],
green: [0, 128, 0],
greenyellow: [173, 255, 47],
grey: [128, 128, 128],
honeydew: [240, 255, 240],
hotpink: [255, 105, 180],
indianred: [205, 92, 92],
indigo: [75, 0, 130],
ivory: [255, 255, 240],
khaki: [240, 230, 140],
lavender: [230, 230, 250],
lavenderblush: [255, 240, 245],
lawngreen: [124, 252, 0],
lemonchiffon: [255, 250, 205],
lightblue: [173, 216, 230],
lightcoral: [240, 128, 128],
lightcyan: [224, 255, 255],
lightgoldenrodyellow: [250, 250, 210],
lightgray: [211, 211, 211],
lightgreen: [144, 238, 144],
lightgrey: [211, 211, 211],
lightpink: [255, 182, 193],
lightsalmon: [255, 160, 122],
lightseagreen: [32, 178, 170],
lightskyblue: [135, 206, 250],
lightslategray: [119, 136, 153],
lightslategrey: [119, 136, 153],
lightsteelblue: [176, 196, 222],
lightyellow: [255, 255, 224],
lime: [0, 255, 0],
limegreen: [50, 205, 50],
linen: [250, 240, 230],
magenta: [255, 0, 255],
maroon: [128, 0, 0],
mediumaquamarine: [102, 205, 170],
mediumblue: [0, 0, 205],
mediumorchid: [186, 85, 211],
mediumpurple: [147, 112, 219],
mediumseagreen: [60, 179, 113],
mediumslateblue: [123, 104, 238],
mediumspringgreen: [0, 250, 154],
mediumturquoise: [72, 209, 204],
mediumvioletred: [199, 21, 133],
midnightblue: [25, 25, 112],
mintcream: [245, 255, 250],
mistyrose: [255, 228, 225],
moccasin: [255, 228, 181],
navajowhite: [255, 222, 173],
navy: [0, 0, 128],
oldlace: [253, 245, 230],
olive: [128, 128, 0],
olivedrab: [107, 142, 35],
orange: [255, 165, 0],
orangered: [255, 69, 0],
orchid: [218, 112, 214],
palegoldenrod: [238, 232, 170],
palegreen: [152, 251, 152],
paleturquoise: [175, 238, 238],
palevioletred: [219, 112, 147],
papayawhip: [255, 239, 213],
peachpuff: [255, 218, 185],
peru: [205, 133, 63],
pink: [255, 192, 203],
plum: [221, 160, 203],
powderblue: [176, 224, 230],
purple: [128, 0, 128],
rebeccapurple: [102, 51, 153],
red: [255, 0, 0],
rosybrown: [188, 143, 143],
royalblue: [65, 105, 225],
saddlebrown: [139, 69, 19],
salmon: [250, 128, 114],
sandybrown: [244, 164, 96],
seagreen: [46, 139, 87],
seashell: [255, 245, 238],
sienna: [160, 82, 45],
silver: [192, 192, 192],
skyblue: [135, 206, 235],
slateblue: [106, 90, 205],
slategray: [119, 128, 144],
slategrey: [119, 128, 144],
snow: [255, 255, 250],
springgreen: [0, 255, 127],
steelblue: [70, 130, 180],
tan: [210, 180, 140],
teal: [0, 128, 128],
thistle: [216, 191, 216],
transparent: [255, 255, 255, 0],
tomato: [255, 99, 71],
turquoise: [64, 224, 208],
violet: [238, 130, 238],
wheat: [245, 222, 179],
white: [255, 255, 255],
whitesmoke: [245, 245, 245],
yellow: [255, 255, 0],
yellowgreen: [154, 205, 5]
}, RGB_REGEX = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/, animQueue = [];
const req = typeof requestAnimationFrame < "u" && requestAnimationFrame || function(f) {
setTimeout(f, 60);
}, Util = {
_isElement(f) {
return !!(f && f.nodeType == 1);
},
_isFunction(f) {
return !!(f && f.constructor && f.call && f.apply);
},
_isPlainObject(f) {
return !!f && f.constructor === Object;
},
_isArray(f) {
return Object.prototype.toString.call(f) === OBJECT_ARRAY;
},
_isNumber(f) {
return Object.prototype.toString.call(f) === OBJECT_NUMBER && !isNaN(f) && isFinite(f);
},
_isString(f) {
return Object.prototype.toString.call(f) === OBJECT_STRING;
},
_isBoolean(f) {
return Object.prototype.toString.call(f) === OBJECT_BOOLEAN;
},
isObject(f) {
return f instanceof Object;
},
isValidSelector(f) {
if (typeof f != "string")
return !1;
var r = f[0];
return r === "#" || r === "." || r === r.toUpperCase();
},
_sign(f) {
return f === 0 || f > 0 ? 1 : -1;
},
requestAnimFrame(f) {
animQueue.push(f), animQueue.length === 1 && req(function() {
const r = animQueue;
animQueue = [], r.forEach(function(e) {
e();
});
});
},
createCanvasElement() {
var f = document.createElement("canvas");
try {
f.style = f.style || {};
} catch {
}
return f;
},
createImageElement() {
return document.createElement("img");
},
_isInDocument(f) {
for (; f = f.parentNode; )
if (f == document)
return !0;
return !1;
},
_urlToImage(f, r) {
var e = Util.createImageElement();
e.onload = function() {
r(e);
}, e.src = f;
},
_rgbToHex(f, r, e) {
return ((1 << 24) + (f << 16) + (r << 8) + e).toString(16).slice(1);
},
_hexToRgb(f) {
f = f.replace(HASH$1, EMPTY_STRING$1);
var r = parseInt(f, 16);
return {
r: r >> 16 & 255,
g: r >> 8 & 255,
b: r & 255
};
},
getRandomColor() {
for (var f = (Math.random() * 16777215 << 0).toString(16); f.length < 6; )
f = ZERO + f;
return HASH$1 + f;
},
getRGB(f) {
var r;
return f in COLORS ? (r = COLORS[f], {
r: r[0],
g: r[1],
b: r[2]
}) : f[0] === HASH$1 ? this._hexToRgb(f.substring(1)) : f.substr(0, 4) === RGB_PAREN ? (r = RGB_REGEX.exec(f.replace(/ /g, "")), {
r: parseInt(r[1], 10),
g: parseInt(r[2], 10),
b: parseInt(r[3], 10)
}) : {
r: 0,
g: 0,
b: 0
};
},
colorToRGBA(f) {
return f = f || "black", Util._namedColorToRBA(f) || Util._hex3ColorToRGBA(f) || Util._hex6ColorToRGBA(f) || Util._rgbColorToRGBA(f) || Util._rgbaColorToRGBA(f) || Util._hslColorToRGBA(f);
},
_namedColorToRBA(f) {
var r = COLORS[f.toLowerCase()];
return r ? {
r: r[0],
g: r[1],
b: r[2],
a: 1
} : null;
},
_rgbColorToRGBA(f) {
if (f.indexOf("rgb(") === 0) {
f = f.match(/rgb\(([^)]+)\)/)[1];
var r = f.split(/ *, */).map(Number);
return {
r: r[0],
g: r[1],
b: r[2],
a: 1
};
}
},
_rgbaColorToRGBA(f) {
if (f.indexOf("rgba(") === 0) {
f = f.match(/rgba\(([^)]+)\)/)[1];
var r = f.split(/ *, */).map(Number);
return {
r: r[0],
g: r[1],
b: r[2],
a: r[3]
};
}
},
_hex6ColorToRGBA(f) {
if (f[0] === "#" && f.length === 7)
return {
r: parseInt(f.slice(1, 3), 16),
g: parseInt(f.slice(3, 5), 16),
b: parseInt(f.slice(5, 7), 16),
a: 1
};
},
_hex3ColorToRGBA(f) {
if (f[0] === "#" && f.length === 4)
return {
r: parseInt(f[1] + f[1], 16),
g: parseInt(f[2] + f[2], 16),
b: parseInt(f[3] + f[3], 16),
a: 1
};
},
_hslColorToRGBA(f) {
if (/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(f)) {
const [r, ...e] = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(f), a = Number(e[0]) / 360, t = Number(e[1]) / 100, s = Number(e[2]) / 100;
let n, o, A;
if (t === 0)
return A = s * 255, {
r: Math.round(A),
g: Math.round(A),
b: Math.round(A),
a: 1
};
s < 0.5 ? n = s * (1 + t) : n = s + t - s * t;
const l = 2 * s - n, u = [0, 0, 0];
for (let h = 0; h < 3; h++)
o = a + 1 / 3 * -(h - 1), o < 0 && o++, o > 1 && o--, 6 * o < 1 ? A = l + (n - l) * 6 * o : 2 * o < 1 ? A = n : 3 * o < 2 ? A = l + (n - l) * (2 / 3 - o) * 6 : A = l, u[h] = A * 255;
return {
r: Math.round(u[0]),
g: Math.round(u[1]),
b: Math.round(u[2]),
a: 1
};
}
},
haveIntersection(f, r) {
return !(r.x > f.x + f.width || r.x + r.width < f.x || r.y > f.y + f.height || r.y + r.height < f.y);
},
cloneObject(f) {
var r = {};
for (var e in f)
this._isPlainObject(f[e]) ? r[e] = this.cloneObject(f[e]) : this._isArray(f[e]) ? r[e] = this.cloneArray(f[e]) : r[e] = f[e];
return r;
},
cloneArray(f) {
return f.slice(0);
},
degToRad(f) {
return f * PI_OVER_DEG180;
},
radToDeg(f) {
return f * DEG180_OVER_PI;
},
_degToRad(f) {
return Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."), Util.degToRad(f);
},
_radToDeg(f) {
return Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."), Util.radToDeg(f);
},
_getRotation(f) {
return Konva$2.angleDeg ? Util.radToDeg(f) : f;
},
_capitalize(f) {
return f.charAt(0).toUpperCase() + f.slice(1);
},
throw(f) {
throw new Error(KONVA_ERROR + f);
},
error(f) {
console.error(KONVA_ERROR + f);
},
warn(f) {
Konva$2.showWarnings && console.warn(KONVA_WARNING + f);
},
each(f, r) {
for (var e in f)
r(e, f[e]);
},
_inRange(f, r, e) {
return r <= f && f < e;
},
_getProjectionToSegment(f, r, e, a, t, s) {
var n, o, A, l = (f - e) * (f - e) + (r - a) * (r - a);
if (l == 0)
n = f, o = r, A = (t - e) * (t - e) + (s - a) * (s - a);
else {
var u = ((t - f) * (e - f) + (s - r) * (a - r)) / l;
u < 0 ? (n = f, o = r, A = (f - t) * (f - t) + (r - s) * (r - s)) : u > 1 ? (n = e, o = a, A = (e - t) * (e - t) + (a - s) * (a - s)) : (n = f + u * (e - f), o = r + u * (a - r), A = (n - t) * (n - t) + (o - s) * (o - s));
}
return [n, o, A];
},
_getProjectionToLine(f, r, e) {
var a = Util.cloneObject(f), t = Number.MAX_VALUE;
return r.forEach(function(s, n) {
if (!(!e && n === r.length - 1)) {
var o = r[(n + 1) % r.length], A = Util._getProjectionToSegment(s.x, s.y, o.x, o.y, f.x, f.y), l = A[0], u = A[1], h = A[2];
h < t && (a.x = l, a.y = u, t = h);
}
}), a;
},
_prepareArrayForTween(f, r, e) {
var a, t = [], s = [];
if (f.length > r.length) {
var n = r;
r = f, f = n;
}
for (a = 0; a < f.length; a += 2)
t.push({
x: f[a],
y: f[a + 1]
});
for (a = 0; a < r.length; a += 2)
s.push({
x: r[a],
y: r[a + 1]
});
var o = [];
return s.forEach(function(A) {
var l = Util._getProjectionToLine(A, t, e);
o.push(l.x), o.push(l.y);
}), o;
},
_prepareToStringify(f) {
var r;
f.visitedByCircularReferenceRemoval = !0;
for (var e in f)
if (f.hasOwnProperty(e) && f[e] && typeof f[e] == "object") {
if (r = Object.getOwnPropertyDescriptor(f, e), f[e].visitedByCircularReferenceRemoval || Util._isElement(f[e]))
if (r.configurable)
delete f[e];
else
return null;
else if (Util._prepareToStringify(f[e]) === null)
if (r.configurable)
delete f[e];
else
return null;
}
return delete f.visitedByCircularReferenceRemoval, f;
},
_assign(f, r) {
for (var e in r)
f[e] = r[e];
return f;
},
_getFirstPointerId(f) {
return f.touches ? f.changedTouches[0].identifier : 999;
}
};
function _formatValue(f) {
return Util._isString(f) ? '"' + f + '"' : Object.prototype.toString.call(f) === "[object Number]" || Util._isBoolean(f) ? f : Object.prototype.toString.call(f);
}
function RGBComponent(f) {
return f > 255 ? 255 : f < 0 ? 0 : Math.round(f);
}
function getNumberValidator() {
if (Konva$2.isUnminified)
return function(f, r) {
return Util._isNumber(f) || Util.warn(_formatValue(f) + ' is a not valid value for "' + r + '" attribute. The value should be a number.'), f;
};
}
function getNumberOrArrayOfNumbersValidator(f) {
if (Konva$2.isUnminified)
return function(r, e) {
let a = Util._isNumber(r), t = Util._isArray(r) && r.length == f;
return !a && !t && Util.warn(_formatValue(r) + ' is a not valid value for "' + e + '" attribute. The value should be a number or Array<number>(' + f + ")"), r;
};
}
function getNumberOrAutoValidator() {
if (Konva$2.isUnminified)
return function(f, r) {
var e = Util._isNumber(f), a = f === "auto";
return e || a || Util.warn(_formatValue(f) + ' is a not valid value for "' + r + '" attribute. The value should be a number or "auto".'), f;
};
}
function getStringValidator() {
if (Konva$2.isUnminified)
return function(f, r) {
return Util._isString(f) || Util.warn(_formatValue(f) + ' is a not valid value for "' + r + '" attribute. The value should be a string.'), f;
};
}
function getStringOrGradientValidator() {
if (Konva$2.isUnminified)
return function(f, r) {
const e = Util._isString(f), a = Object.prototype.toString.call(f) === "[object CanvasGradient]" || f && f.addColorStop;
return e || a || Util.warn(_formatValue(f) + ' is a not valid value for "' + r + '" attribute. The value should be a string or a native gradient.'), f;
};
}
function getNumberArrayValidator() {
if (Konva$2.isUnminified)
return function(f, r) {
return Util._isArray(f) ? f.forEach(function(e) {
Util._isNumber(e) || Util.warn('"' + r + '" attribute has non numeric element ' + e + ". Make sure that all elements are numbers.");
}) : Util.warn(_formatValue(f) + ' is a not valid value for "' + r + '" attribute. The value should be a array of numbers.'), f;
};
}
function getBooleanValidator() {
if (Konva$2.isUnminified)
return function(f, r) {
var e = f === !0 || f === !1;
return e || Util.warn(_formatValue(f) + ' is a not valid value for "' + r + '" attribute. The value should be a boolean.'), f;
};
}
function getComponentValidator(f) {
if (Konva$2.isUnminified)
return function(r, e) {
return Util.isObject(r) || Util.warn(_formatValue(r) + ' is a not valid value for "' + e + '" attribute. The value should be an object with properties ' + f), r;
};
}
var GET = "get", SET$1 = "set";
const Factory = {
addGetterSetter(f, r, e, a, t) {
Factory.addGetter(f, r, e), Factory.addSetter(f, r, a, t), Factory.addOverloadedGetterSetter(f, r);
},
addGetter(f, r, e) {
var a = GET + Util._capitalize(r);
f.prototype[a] = f.prototype[a] || function() {
var t = this.attrs[r];
return t === void 0 ? e : t;
};
},
addSetter(f, r, e, a) {
var t = SET$1 + Util._capitalize(r);
f.prototype[t] || Factory.overWriteSetter(f, r, e, a);
},
overWriteSetter(f, r, e, a) {
var t = SET$1 + Util._capitalize(r);
f.prototype[t] = function(s) {
return e && s !== void 0 && s !== null && (s = e.call(this, s, r)), this._setAttr(r, s), a && a.call(this), this;
};
},
addComponentsGetterSetter(f, r, e, a, t) {
var s = e.length, n = Util._capitalize, o = GET + n(r), A = SET$1 + n(r), l, u;
f.prototype[o] = function() {
var c = {};
for (l = 0; l < s; l++)
u = e[l], c[u] = this.getAttr(r + n(u));
return c;
};
var h = getComponentValidator(e);
f.prototype[A] = function(c) {
var g = this.attrs[r], v;
a && (c = a.call(this, c)), h && h.call(this, c, r);
for (v in c)
c.hasOwnProperty(v) && this._setAttr(r + n(v), c[v]);
return this._fireChangeEvent(r, g, c), t && t.call(this), this;
}, Factory.addOverloadedGetterSetter(f, r);
},
addOverloadedGetterSetter(f, r) {
var e = Util._capitalize(r), a = SET$1 + e, t = GET + e;
f.prototype[r] = function() {
return arguments.length ? (this[a](arguments[0]), this) : this[t]();
};
},
addDeprecatedGetterSetter(f, r, e, a) {
Util.error("Adding deprecated " + r);
var t = GET + Util._capitalize(r), s = r + " property is deprecated and will be removed soon. Look at Konva change log for more information.";
f.prototype[t] = function() {
Util.error(s);
var n = this.attrs[r];
return n === void 0 ? e : n;
}, Factory.addSetter(f, r, a, function() {
Util.error(s);
}), Factory.addOverloadedGetterSetter(f, r);
},
backCompat(f, r) {
Util.each(r, function(e, a) {
var t = f.prototype[a], s = GET + Util._capitalize(e), n = SET$1 + Util._capitalize(e);
function o() {
t.apply(this, arguments), Util.error('"' + e + '" method is deprecated and will be removed soon. Use ""' + a + '" instead.');
}
f.prototype[e] = o, f.prototype[s] = o, f.prototype[n] = o;
});
},
afterSetFilter() {
this._filterUpToDate = !1;
}
};
function simplifyArray(f) {
var r = [], e = f.length, a = Util, t, s;
for (t = 0; t < e; t++)
s = f[t], a._isNumber(s) ? s = Math.round(s * 1e3) / 1e3 : a._isString(s) || (s = s + ""), r.push(s);
return r;
}
var COMMA = ",", OPEN_PAREN = "(", CLOSE_PAREN = ")", OPEN_PAREN_BRACKET = "([", CLOSE_BRACKET_PAREN = "])", SEMICOLON = ";", DOUBLE_PAREN = "()", EQUALS = "=", CONTEXT_METHODS = [
"arc",
"arcTo",
"beginPath",
"bezierCurveTo",
"clearRect",
"clip",
"closePath",
"createLinearGradient",
"createPattern",
"createRadialGradient",
"drawImage",
"ellipse",
"fill",
"fillText",
"getImageData",
"createImageData",
"lineTo",
"moveTo",
"putImageData",
"quadraticCurveTo",
"rect",
"restore",
"rotate",
"save",
"scale",
"setLineDash",
"setTransform",
"stroke",
"strokeText",
"transform",
"translate"
], CONTEXT_PROPERTIES = [
"fillStyle",
"strokeStyle",
"shadowColor",
"shadowBlur",
"shadowOffsetX",
"shadowOffsetY",
"lineCap",
"lineDashOffset",
"lineJoin",
"lineWidth",
"miterLimit",
"font",
"textAlign",
"textBaseline",
"globalAlpha",
"globalCompositeOperation",
"imageSmoothingEnabled"
];
const traceArrMax = 100;
class Context {
constructor(r) {
this.canvas = r, this._context = r._canvas.getContext("2d"), Konva$2.enableTrace && (this.traceArr = [], this._enableTrace());
}
fillShape(r) {
r.fillEnabled() && this._fill(r);
}
_fill(r) {
}
strokeShape(r) {
r.hasStroke() && this._stroke(r);
}
_stroke(r) {
}
fillStrokeShape(r) {
r.attrs.fillAfterStrokeEnabled ? (this.strokeShape(r), this.fillShape(r)) : (this.fillShape(r), this.strokeShape(r));
}
getTrace(r, e) {
var a = this.traceArr, t = a.length, s = "", n, o, A, l;
for (n = 0; n < t; n++)
o = a[n], A = o.method, A ? (l = o.args, s += A, r ? s += DOUBLE_PAREN : Util._isArray(l[0]) ? s += OPEN_PAREN_BRACKET + l.join(COMMA) + CLOSE_BRACKET_PAREN : (e && (l = l.map((u) => typeof u == "number" ? Math.floor(u) : u)), s += OPEN_PAREN + l.join(COMMA) + CLOSE_PAREN)) : (s += o.property, r || (s += EQUALS + o.val)), s += SEMICOLON;
return s;
}
clearTrace() {
this.traceArr = [];
}
_trace(r) {
var e = this.traceArr, a;
e.push(r), a = e.length, a >= traceArrMax && e.shift();
}
reset() {
var r = this.getCanvas().getPixelRatio();
this.setTransform(1 * r, 0, 0, 1 * r, 0, 0);
}
getCanvas() {
return this.canvas;
}
clear(r) {
var e = this.getCanvas();
r ? this.clearRect(r.x || 0, r.y || 0, r.width || 0, r.height || 0) : this.clearRect(0, 0, e.getWidth() / e.pixelRatio, e.getHeight() / e.pixelRatio);
}
_applyLineCap(r) {
var e = r.getLineCap();
e && this.setAttr("lineCap", e);
}
_applyOpacity(r) {
var e = r.getAbsoluteOpacity();
e !== 1 && this.setAttr("globalAlpha", e);
}
_applyLineJoin(r) {
var e = r.attrs.lineJoin;
e && this.setAttr("lineJoin", e);
}
setAttr(r, e) {
this._context[r] = e;
}
arc(r, e, a, t, s, n) {
this._context.arc(r, e, a, t, s, n);
}
arcTo(r, e, a, t, s) {
this._context.arcTo(r, e, a, t, s);
}
beginPath() {
this._context.beginPath();
}
bezierCurveTo(r, e, a, t, s, n) {
this._context.bezierCurveTo(r, e, a, t, s, n);
}
clearRect(r, e, a, t) {
this._context.clearRect(r, e, a, t);
}
clip() {
this._context.clip();