UNPKG

@nextgengmb/product-visualizer-sdk

Version:

SDK to visualize furniture/products in user-uploaded spaces.

1,552 lines (1,550 loc) 772 kB
import * as Sa from "react"; import Pn, { useState as ep, useRef as G1 } from "react"; var ny = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function $y(g) { return g && g.__esModule && Object.prototype.hasOwnProperty.call(g, "default") ? g.default : g; } var B1 = { exports: {} }, zf = {}; /** * @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 ry; function E8() { if (ry) return zf; ry = 1; var g = Pn, r = Symbol.for("react.element"), s = Symbol.for("react.fragment"), c = Object.prototype.hasOwnProperty, f = g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, h = { key: !0, ref: !0, __self: !0, __source: !0 }; function p(y, S, _) { var D, A = {}, N = null, O = null; _ !== void 0 && (N = "" + _), S.key !== void 0 && (N = "" + S.key), S.ref !== void 0 && (O = S.ref); for (D in S) c.call(S, D) && !h.hasOwnProperty(D) && (A[D] = S[D]); if (y && y.defaultProps) for (D in S = y.defaultProps, S) A[D] === void 0 && (A[D] = S[D]); return { $$typeof: r, type: y, key: N, ref: O, props: A, _owner: f.current }; } return zf.Fragment = s, zf.jsx = p, zf.jsxs = p, zf; } var kf = {}; /** * @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 ay; function x8() { return ay || (ay = 1, process.env.NODE_ENV !== "production" && function() { var g = Pn, r = Symbol.for("react.element"), s = Symbol.for("react.portal"), c = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), p = Symbol.for("react.provider"), y = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), _ = Symbol.for("react.suspense"), D = Symbol.for("react.suspense_list"), A = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), O = Symbol.for("react.offscreen"), T = Symbol.iterator, L = "@@iterator"; function F(k) { if (k === null || typeof k != "object") return null; var he = T && k[T] || k[L]; return typeof he == "function" ? he : null; } var V = g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function j(k) { { for (var he = arguments.length, be = new Array(he > 1 ? he - 1 : 0), Ge = 1; Ge < he; Ge++) be[Ge - 1] = arguments[Ge]; R("error", k, be); } } function R(k, he, be) { { var Ge = V.ReactDebugCurrentFrame, Tt = Ge.getStackAddendum(); Tt !== "" && (he += "%s", be = be.concat([Tt])); var Lt = be.map(function(ct) { return String(ct); }); Lt.unshift("Warning: " + he), Function.prototype.apply.call(console[k], console, Lt); } } var w = !1, U = !1, G = !1, ne = !1, z = !1, W; W = Symbol.for("react.module.reference"); function H(k) { return !!(typeof k == "string" || typeof k == "function" || k === c || k === h || z || k === f || k === _ || k === D || ne || k === O || w || U || G || typeof k == "object" && k !== null && (k.$$typeof === N || k.$$typeof === A || k.$$typeof === p || k.$$typeof === y || k.$$typeof === S || // 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. k.$$typeof === W || k.getModuleId !== void 0)); } function te(k, he, be) { var Ge = k.displayName; if (Ge) return Ge; var Tt = he.displayName || he.name || ""; return Tt !== "" ? be + "(" + Tt + ")" : be; } function ae(k) { return k.displayName || "Context"; } function ue(k) { if (k == null) return null; if (typeof k.tag == "number" && j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof k == "function") return k.displayName || k.name || null; if (typeof k == "string") return k; switch (k) { case c: return "Fragment"; case s: return "Portal"; case h: return "Profiler"; case f: return "StrictMode"; case _: return "Suspense"; case D: return "SuspenseList"; } if (typeof k == "object") switch (k.$$typeof) { case y: var he = k; return ae(he) + ".Consumer"; case p: var be = k; return ae(be._context) + ".Provider"; case S: return te(k, k.render, "ForwardRef"); case A: var Ge = k.displayName || null; return Ge !== null ? Ge : ue(k.type) || "Memo"; case N: { var Tt = k, Lt = Tt._payload, ct = Tt._init; try { return ue(ct(Lt)); } catch { return null; } } } return null; } var De = Object.assign, ve = 0, we, We, Z, me, oe, ye, Ae; function ot() { } ot.__reactDisabledLog = !0; function Mt() { { if (ve === 0) { we = console.log, We = console.info, Z = console.warn, me = console.error, oe = console.group, ye = console.groupCollapsed, Ae = console.groupEnd; var k = { configurable: !0, enumerable: !0, value: ot, writable: !0 }; Object.defineProperties(console, { info: k, log: k, warn: k, error: k, group: k, groupCollapsed: k, groupEnd: k }); } ve++; } } function Yt() { { if (ve--, ve === 0) { var k = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: De({}, k, { value: we }), info: De({}, k, { value: We }), warn: De({}, k, { value: Z }), error: De({}, k, { value: me }), group: De({}, k, { value: oe }), groupCollapsed: De({}, k, { value: ye }), groupEnd: De({}, k, { value: Ae }) }); } ve < 0 && j("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var $e = V.ReactCurrentDispatcher, I; function de(k, he, be) { { if (I === void 0) try { throw Error(); } catch (Tt) { var Ge = Tt.stack.trim().match(/\n( *(at )?)/); I = Ge && Ge[1] || ""; } return ` ` + I + k; } } var Le = !1, ut; { var qe = typeof WeakMap == "function" ? WeakMap : Map; ut = new qe(); } function gt(k, he) { if (!k || Le) return ""; { var be = ut.get(k); if (be !== void 0) return be; } var Ge; Le = !0; var Tt = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var Lt; Lt = $e.current, $e.current = null, Mt(); try { if (he) { var ct = function() { throw Error(); }; if (Object.defineProperty(ct.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(ct, []); } catch (qn) { Ge = qn; } Reflect.construct(k, [], ct); } else { try { ct.call(); } catch (qn) { Ge = qn; } k.call(ct.prototype); } } else { try { throw Error(); } catch (qn) { Ge = qn; } k(); } } catch (qn) { if (qn && Ge && typeof qn.stack == "string") { for (var at = qn.stack.split(` `), on = Ge.stack.split(` `), Ft = at.length - 1, un = on.length - 1; Ft >= 1 && un >= 0 && at[Ft] !== on[un]; ) un--; for (; Ft >= 1 && un >= 0; Ft--, un--) if (at[Ft] !== on[un]) { if (Ft !== 1 || un !== 1) do if (Ft--, un--, un < 0 || at[Ft] !== on[un]) { var Yn = ` ` + at[Ft].replace(" at new ", " at "); return k.displayName && Yn.includes("<anonymous>") && (Yn = Yn.replace("<anonymous>", k.displayName)), typeof k == "function" && ut.set(k, Yn), Yn; } while (Ft >= 1 && un >= 0); break; } } } finally { Le = !1, $e.current = Lt, Yt(), Error.prepareStackTrace = Tt; } var Ni = k ? k.displayName || k.name : "", ri = Ni ? de(Ni) : ""; return typeof k == "function" && ut.set(k, ri), ri; } function Rt(k, he, be) { return gt(k, !1); } function Dn(k) { var he = k.prototype; return !!(he && he.isReactComponent); } function ht(k, he, be) { if (k == null) return ""; if (typeof k == "function") return gt(k, Dn(k)); if (typeof k == "string") return de(k); switch (k) { case _: return de("Suspense"); case D: return de("SuspenseList"); } if (typeof k == "object") switch (k.$$typeof) { case S: return Rt(k.render); case A: return ht(k.type, he, be); case N: { var Ge = k, Tt = Ge._payload, Lt = Ge._init; try { return ht(Lt(Tt), he, be); } catch { } } } return ""; } var Sn = Object.prototype.hasOwnProperty, ln = {}, In = V.ReactDebugCurrentFrame; function _a(k) { if (k) { var he = k._owner, be = ht(k.type, k._source, he ? he.type : null); In.setExtraStackFrame(be); } else In.setExtraStackFrame(null); } function Hr(k, he, be, Ge, Tt) { { var Lt = Function.call.bind(Sn); for (var ct in k) if (Lt(k, ct)) { var at = void 0; try { if (typeof k[ct] != "function") { var on = Error((Ge || "React class") + ": " + be + " type `" + ct + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof k[ct] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw on.name = "Invariant Violation", on; } at = k[ct](he, ct, Ge, be, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (Ft) { at = Ft; } at && !(at instanceof Error) && (_a(Tt), j("%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).", Ge || "React class", be, ct, typeof at), _a(null)), at instanceof Error && !(at.message in ln) && (ln[at.message] = !0, _a(Tt), j("Failed %s type: %s", be, at.message), _a(null)); } } } var dn = Array.isArray; function Ca(k) { return dn(k); } function Il(k) { { var he = typeof Symbol == "function" && Symbol.toStringTag, be = he && k[Symbol.toStringTag] || k.constructor.name || "Object"; return be; } } function za(k) { try { return Di(k), !1; } catch { return !0; } } function Di(k) { return "" + k; } function wi(k) { if (za(k)) return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Il(k)), Di(k); } var ll = V.ReactCurrentOwner, Yl = { key: !0, ref: !0, __self: !0, __source: !0 }, ql, Ce; function Ke(k) { if (Sn.call(k, "ref")) { var he = Object.getOwnPropertyDescriptor(k, "ref").get; if (he && he.isReactWarning) return !1; } return k.ref !== void 0; } function ft(k) { if (Sn.call(k, "key")) { var he = Object.getOwnPropertyDescriptor(k, "key").get; if (he && he.isReactWarning) return !1; } return k.key !== void 0; } function Be(k, he) { typeof k.ref == "string" && ll.current; } function sn(k, he) { { var be = function() { ql || (ql = !0, j("%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)", he)); }; be.isReactWarning = !0, Object.defineProperty(k, "key", { get: be, configurable: !0 }); } } function sr(k, he) { { var be = function() { Ce || (Ce = !0, j("%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)", he)); }; be.isReactWarning = !0, Object.defineProperty(k, "ref", { get: be, configurable: !0 }); } } var ke = function(k, he, be, Ge, Tt, Lt, ct) { var at = { // This tag allows us to uniquely identify this as a React Element $$typeof: r, // Built-in properties that belong on the element type: k, key: he, ref: be, props: ct, // Record the component responsible for creating this element. _owner: Lt }; return at._store = {}, Object.defineProperty(at._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(at, "_self", { configurable: !1, enumerable: !1, writable: !1, value: Ge }), Object.defineProperty(at, "_source", { configurable: !1, enumerable: !1, writable: !1, value: Tt }), Object.freeze && (Object.freeze(at.props), Object.freeze(at)), at; }; function Pe(k, he, be, Ge, Tt) { { var Lt, ct = {}, at = null, on = null; be !== void 0 && (wi(be), at = "" + be), ft(he) && (wi(he.key), at = "" + he.key), Ke(he) && (on = he.ref, Be(he, Tt)); for (Lt in he) Sn.call(he, Lt) && !Yl.hasOwnProperty(Lt) && (ct[Lt] = he[Lt]); if (k && k.defaultProps) { var Ft = k.defaultProps; for (Lt in Ft) ct[Lt] === void 0 && (ct[Lt] = Ft[Lt]); } if (at || on) { var un = typeof k == "function" ? k.displayName || k.name || "Unknown" : k; at && sn(ct, un), on && sr(ct, un); } return ke(k, at, on, Tt, Ge, ll.current, ct); } } var Wt = V.ReactCurrentOwner, Gt = V.ReactDebugCurrentFrame; function lt(k) { if (k) { var he = k._owner, be = ht(k.type, k._source, he ? he.type : null); Gt.setExtraStackFrame(be); } else Gt.setExtraStackFrame(null); } var ia; ia = !1; function ei(k) { return typeof k == "object" && k !== null && k.$$typeof === r; } function zs() { { if (Wt.current) { var k = ue(Wt.current.type); if (k) return ` Check the render method of \`` + k + "`."; } return ""; } } function yt(k) { return ""; } var Gr = {}; function ti(k) { { var he = zs(); if (!he) { var be = typeof k == "string" ? k : k.displayName || k.name; be && (he = ` Check the top-level render call using <` + be + ">."); } return he; } } function Ea(k, he) { { if (!k._store || k._store.validated || k.key != null) return; k._store.validated = !0; var be = ti(he); if (Gr[be]) return; Gr[be] = !0; var Ge = ""; k && k._owner && k._owner !== Wt.current && (Ge = " It was passed a child from " + ue(k._owner.type) + "."), lt(k), j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', be, Ge), lt(null); } } function la(k, he) { { if (typeof k != "object") return; if (Ca(k)) for (var be = 0; be < k.length; be++) { var Ge = k[be]; ei(Ge) && Ea(Ge, he); } else if (ei(k)) k._store && (k._store.validated = !0); else if (k) { var Tt = F(k); if (typeof Tt == "function" && Tt !== k.entries) for (var Lt = Tt.call(k), ct; !(ct = Lt.next()).done; ) ei(ct.value) && Ea(ct.value, he); } } } function sa(k) { { var he = k.type; if (he == null || typeof he == "string") return; var be; if (typeof he == "function") be = he.propTypes; else if (typeof he == "object" && (he.$$typeof === S || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. he.$$typeof === A)) be = he.propTypes; else return; if (be) { var Ge = ue(he); Hr(be, k.props, "prop", Ge, k); } else if (he.PropTypes !== void 0 && !ia) { ia = !0; var Tt = ue(he); j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Tt || "Unknown"); } typeof he.getDefaultProps == "function" && !he.getDefaultProps.isReactClassApproved && j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function ni(k) { { for (var he = Object.keys(k.props), be = 0; be < he.length; be++) { var Ge = he[be]; if (Ge !== "children" && Ge !== "key") { lt(k), j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Ge), lt(null); break; } } k.ref !== null && (lt(k), j("Invalid attribute `ref` supplied to `React.Fragment`."), lt(null)); } } var Kl = {}; function No(k, he, be, Ge, Tt, Lt) { { var ct = H(k); if (!ct) { var at = ""; (k === void 0 || typeof k == "object" && k !== null && Object.keys(k).length === 0) && (at += " 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 on = yt(); on ? at += on : at += zs(); var Ft; k === null ? Ft = "null" : Ca(k) ? Ft = "array" : k !== void 0 && k.$$typeof === r ? (Ft = "<" + (ue(k.type) || "Unknown") + " />", at = " Did you accidentally export a JSX literal instead of a component?") : Ft = typeof k, j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Ft, at); } var un = Pe(k, he, be, Tt, Lt); if (un == null) return un; if (ct) { var Yn = he.children; if (Yn !== void 0) if (Ge) if (Ca(Yn)) { for (var Ni = 0; Ni < Yn.length; Ni++) la(Yn[Ni], k); Object.freeze && Object.freeze(Yn); } else j("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 la(Yn, k); } if (Sn.call(he, "key")) { var ri = ue(k), qn = Object.keys(he).filter(function(Wl) { return Wl !== "key"; }), Mi = qn.length > 0 ? "{key: someKey, " + qn.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Kl[ri + Mi]) { var ai = qn.length > 0 ? "{" + qn.join(": ..., ") + ": ...}" : "{}"; j(`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} />`, Mi, ri, ai, ri), Kl[ri + Mi] = !0; } } return k === c ? ni(un) : sa(un), un; } } function sl(k, he, be) { return No(k, he, be, !0); } function wn(k, he, be) { return No(k, he, be, !1); } var ks = wn, Mo = sl; kf.Fragment = c, kf.jsx = ks, kf.jsxs = Mo; }()), kf; } process.env.NODE_ENV === "production" ? B1.exports = E8() : B1.exports = x8(); var aa = B1.exports, e5 = { exports: {} }, op = {}, rp = {}, vt = {}; (function(g) { Object.defineProperty(g, "__esModule", { value: !0 }), g._registerNode = g.Konva = g.glob = void 0; const r = Math.PI / 180; function s() { return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]"); } g.glob = typeof ny < "u" ? ny : typeof window < "u" ? window : typeof WorkerGlobalScope < "u" ? self : {}, g.Konva = { _global: g.glob, version: "9.3.22", isBrowser: s(), isUnminified: /param/.test((function(f) { }).toString()), dblClickWindow: 400, getAngle(f) { return g.Konva.angleDeg ? f * r : f; }, enableTrace: !1, pointerEventsEnabled: !0, autoDrawEnabled: !0, hitOnDragEnabled: !1, capturePointerEventsEnabled: !1, _mouseListenClick: !1, _touchListenClick: !1, _pointerListenClick: !1, _mouseInDblClickWindow: !1, _touchInDblClickWindow: !1, _pointerInDblClickWindow: !1, _mouseDblClickPointerId: null, _touchDblClickPointerId: null, _pointerDblClickPointerId: null, _fixTextRendering: !1, pixelRatio: typeof window < "u" && window.devicePixelRatio || 1, dragDistance: 3, angleDeg: !0, showWarnings: !0, dragButtons: [0, 1], isDragging() { return g.Konva.DD.isDragging; }, isTransforming() { var f; return (f = g.Konva.Transformer) === null || f === void 0 ? void 0 : f.isTransforming(); }, isDragReady() { return !!g.Konva.DD.node; }, releaseCanvasOnDestroy: !0, document: g.glob.document, _injectGlobal(f) { g.glob.Konva = f; } }; const c = (f) => { g.Konva[f.prototype.getClassName()] = f; }; g._registerNode = c, g.Konva._injectGlobal(g.Konva); })(vt); var yn = {}; (function(g) { Object.defineProperty(g, "__esModule", { value: !0 }), g.Util = g.Transform = void 0; const r = vt; class s { constructor(w = [1, 0, 0, 1, 0, 0]) { this.dirty = !1, this.m = w && w.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 s(this.m); } copyInto(w) { w.m[0] = this.m[0], w.m[1] = this.m[1], w.m[2] = this.m[2], w.m[3] = this.m[3], w.m[4] = this.m[4], w.m[5] = this.m[5]; } point(w) { const U = this.m; return { x: U[0] * w.x + U[2] * w.y + U[4], y: U[1] * w.x + U[3] * w.y + U[5] }; } translate(w, U) { return this.m[4] += this.m[0] * w + this.m[2] * U, this.m[5] += this.m[1] * w + this.m[3] * U, this; } scale(w, U) { return this.m[0] *= w, this.m[1] *= w, this.m[2] *= U, this.m[3] *= U, this; } rotate(w) { const U = Math.cos(w), G = Math.sin(w), ne = this.m[0] * U + this.m[2] * G, z = this.m[1] * U + this.m[3] * G, W = this.m[0] * -G + this.m[2] * U, H = this.m[1] * -G + this.m[3] * U; return this.m[0] = ne, this.m[1] = z, this.m[2] = W, this.m[3] = H, this; } getTranslation() { return { x: this.m[4], y: this.m[5] }; } skew(w, U) { const G = this.m[0] + this.m[2] * U, ne = this.m[1] + this.m[3] * U, z = this.m[2] + this.m[0] * w, W = this.m[3] + this.m[1] * w; return this.m[0] = G, this.m[1] = ne, this.m[2] = z, this.m[3] = W, this; } multiply(w) { const U = this.m[0] * w.m[0] + this.m[2] * w.m[1], G = this.m[1] * w.m[0] + this.m[3] * w.m[1], ne = this.m[0] * w.m[2] + this.m[2] * w.m[3], z = this.m[1] * w.m[2] + this.m[3] * w.m[3], W = this.m[0] * w.m[4] + this.m[2] * w.m[5] + this.m[4], H = this.m[1] * w.m[4] + this.m[3] * w.m[5] + this.m[5]; return this.m[0] = U, this.m[1] = G, this.m[2] = ne, this.m[3] = z, this.m[4] = W, this.m[5] = H, this; } invert() { const w = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]), U = this.m[3] * w, G = -this.m[1] * w, ne = -this.m[2] * w, z = this.m[0] * w, W = w * (this.m[2] * this.m[5] - this.m[3] * this.m[4]), H = w * (this.m[1] * this.m[4] - this.m[0] * this.m[5]); return this.m[0] = U, this.m[1] = G, this.m[2] = ne, this.m[3] = z, this.m[4] = W, this.m[5] = H, this; } getMatrix() { return this.m; } decompose() { const w = this.m[0], U = this.m[1], G = this.m[2], ne = this.m[3], z = this.m[4], W = this.m[5], H = w * ne - U * G, te = { x: z, y: W, rotation: 0, scaleX: 0, scaleY: 0, skewX: 0, skewY: 0 }; if (w != 0 || U != 0) { const ae = Math.sqrt(w * w + U * U); te.rotation = U > 0 ? Math.acos(w / ae) : -Math.acos(w / ae), te.scaleX = ae, te.scaleY = H / ae, te.skewX = (w * G + U * ne) / H, te.skewY = 0; } else if (G != 0 || ne != 0) { const ae = Math.sqrt(G * G + ne * ne); te.rotation = Math.PI / 2 - (ne > 0 ? Math.acos(-G / ae) : -Math.acos(G / ae)), te.scaleX = H / ae, te.scaleY = ae, te.skewX = 0, te.skewY = (w * G + U * ne) / H; } return te.rotation = g.Util._getRotation(te.rotation), te; } } g.Transform = s; const c = "[object Array]", f = "[object Number]", h = "[object String]", p = "[object Boolean]", y = Math.PI / 180, S = 180 / Math.PI, _ = "#", D = "", A = "0", N = "Konva warning: ", O = "Konva error: ", T = "rgb(", L = { 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] }, F = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/; let V = []; const j = typeof requestAnimationFrame < "u" && requestAnimationFrame || function(R) { setTimeout(R, 60); }; g.Util = { _isElement(R) { return !!(R && R.nodeType == 1); }, _isFunction(R) { return !!(R && R.constructor && R.call && R.apply); }, _isPlainObject(R) { return !!R && R.constructor === Object; }, _isArray(R) { return Object.prototype.toString.call(R) === c; }, _isNumber(R) { return Object.prototype.toString.call(R) === f && !isNaN(R) && isFinite(R); }, _isString(R) { return Object.prototype.toString.call(R) === h; }, _isBoolean(R) { return Object.prototype.toString.call(R) === p; }, isObject(R) { return R instanceof Object; }, isValidSelector(R) { if (typeof R != "string") return !1; const w = R[0]; return w === "#" || w === "." || w === w.toUpperCase(); }, _sign(R) { return R === 0 || R > 0 ? 1 : -1; }, requestAnimFrame(R) { V.push(R), V.length === 1 && j(function() { const w = V; V = [], w.forEach(function(U) { U(); }); }); }, createCanvasElement() { const R = document.createElement("canvas"); try { R.style = R.style || {}; } catch { } return R; }, createImageElement() { return document.createElement("img"); }, _isInDocument(R) { for (; R = R.parentNode; ) if (R == document) return !0; return !1; }, _urlToImage(R, w) { const U = g.Util.createImageElement(); U.onload = function() { w(U); }, U.src = R; }, _rgbToHex(R, w, U) { return ((1 << 24) + (R << 16) + (w << 8) + U).toString(16).slice(1); }, _hexToRgb(R) { R = R.replace(_, D); const w = parseInt(R, 16); return { r: w >> 16 & 255, g: w >> 8 & 255, b: w & 255 }; }, getRandomColor() { let R = (Math.random() * 16777215 << 0).toString(16); for (; R.length < 6; ) R = A + R; return _ + R; }, getRGB(R) { let w; return R in L ? (w = L[R], { r: w[0], g: w[1], b: w[2] }) : R[0] === _ ? this._hexToRgb(R.substring(1)) : R.substr(0, 4) === T ? (w = F.exec(R.replace(/ /g, "")), { r: parseInt(w[1], 10), g: parseInt(w[2], 10), b: parseInt(w[3], 10) }) : { r: 0, g: 0, b: 0 }; }, colorToRGBA(R) { return R = R || "black", g.Util._namedColorToRBA(R) || g.Util._hex3ColorToRGBA(R) || g.Util._hex4ColorToRGBA(R) || g.Util._hex6ColorToRGBA(R) || g.Util._hex8ColorToRGBA(R) || g.Util._rgbColorToRGBA(R) || g.Util._rgbaColorToRGBA(R) || g.Util._hslColorToRGBA(R); }, _namedColorToRBA(R) { const w = L[R.toLowerCase()]; return w ? { r: w[0], g: w[1], b: w[2], a: 1 } : null; }, _rgbColorToRGBA(R) { if (R.indexOf("rgb(") === 0) { R = R.match(/rgb\(([^)]+)\)/)[1]; const w = R.split(/ *, */).map(Number); return { r: w[0], g: w[1], b: w[2], a: 1 }; } }, _rgbaColorToRGBA(R) { if (R.indexOf("rgba(") === 0) { R = R.match(/rgba\(([^)]+)\)/)[1]; const w = R.split(/ *, */).map((U, G) => U.slice(-1) === "%" ? G === 3 ? parseInt(U) / 100 : parseInt(U) / 100 * 255 : Number(U)); return { r: w[0], g: w[1], b: w[2], a: w[3] }; } }, _hex8ColorToRGBA(R) { if (R[0] === "#" && R.length === 9) return { r: parseInt(R.slice(1, 3), 16), g: parseInt(R.slice(3, 5), 16), b: parseInt(R.slice(5, 7), 16), a: parseInt(R.slice(7, 9), 16) / 255 }; }, _hex6ColorToRGBA(R) { if (R[0] === "#" && R.length === 7) return { r: parseInt(R.slice(1, 3), 16), g: parseInt(R.slice(3, 5), 16), b: parseInt(R.slice(5, 7), 16), a: 1 }; }, _hex4ColorToRGBA(R) { if (R[0] === "#" && R.length === 5) return { r: parseInt(R[1] + R[1], 16), g: parseInt(R[2] + R[2], 16), b: parseInt(R[3] + R[3], 16), a: parseInt(R[4] + R[4], 16) / 255 }; }, _hex3ColorToRGBA(R) { if (R[0] === "#" && R.length === 4) return { r: parseInt(R[1] + R[1], 16), g: parseInt(R[2] + R[2], 16), b: parseInt(R[3] + R[3], 16), a: 1 }; }, _hslColorToRGBA(R) { if (/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(R)) { const [w, ...U] = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(R), G = Number(U[0]) / 360, ne = Number(U[1]) / 100, z = Number(U[2]) / 100; let W, H, te; if (ne === 0) return te = z * 255, { r: Math.round(te), g: Math.round(te), b: Math.round(te), a: 1 }; z < 0.5 ? W = z * (1 + ne) : W = z + ne - z * ne; const ae = 2 * z - W, ue = [0, 0, 0]; for (let De = 0; De < 3; De++) H = G + 1 / 3 * -(De - 1), H < 0 && H++, H > 1 && H--, 6 * H < 1 ? te = ae + (W - ae) * 6 * H : 2 * H < 1 ? te = W : 3 * H < 2 ? te = ae + (W - ae) * (2 / 3 - H) * 6 : te = ae, ue[De] = te * 255; return { r: Math.round(ue[0]), g: Math.round(ue[1]), b: Math.round(ue[2]), a: 1 }; } }, haveIntersection(R, w) { return !(w.x > R.x + R.width || w.x + w.width < R.x || w.y > R.y + R.height || w.y + w.height < R.y); }, cloneObject(R) { const w = {}; for (const U in R) this._isPlainObject(R[U]) ? w[U] = this.cloneObject(R[U]) : this._isArray(R[U]) ? w[U] = this.cloneArray(R[U]) : w[U] = R[U]; return w; }, cloneArray(R) { return R.slice(0); }, degToRad(R) { return R * y; }, radToDeg(R) { return R * S; }, _degToRad(R) { return g.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."), g.Util.degToRad(R); }, _radToDeg(R) { return g.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."), g.Util.radToDeg(R); }, _getRotation(R) { return r.Konva.angleDeg ? g.Util.radToDeg(R) : R; }, _capitalize(R) { return R.charAt(0).toUpperCase() + R.slice(1); }, throw(R) { throw new Error(O + R); }, error(R) { console.error(O + R); }, warn(R) { r.Konva.showWarnings && console.warn(N + R); }, each(R, w) { for (const U in R) w(U, R[U]); }, _inRange(R, w, U) { return w <= R && R < U; }, _getProjectionToSegment(R, w, U, G, ne, z) { let W, H, te; const ae = (R - U) * (R - U) + (w - G) * (w - G); if (ae == 0) W = R, H = w, te = (ne - U) * (ne - U) + (z - G) * (z - G); else { const ue = ((ne - R) * (U - R) + (z - w) * (G - w)) / ae; ue < 0 ? (W = R, H = w, te = (R - ne) * (R - ne) + (w - z) * (w - z)) : ue > 1 ? (W = U, H = G, te = (U - ne) * (U - ne) + (G - z) * (G - z)) : (W = R + ue * (U - R), H = w + ue * (G - w), te = (W - ne) * (W - ne) + (H - z) * (H - z)); } return [W, H, te]; }, _getProjectionToLine(R, w, U) { const G = g.Util.cloneObject(R); let ne = Number.MAX_VALUE; return w.forEach(function(z, W) { if (!U && W === w.length - 1) return; const H = w[(W + 1) % w.length], te = g.Util._getProjectionToSegment(z.x, z.y, H.x, H.y, R.x, R.y), ae = te[0], ue = te[1], De = te[2]; De < ne && (G.x = ae, G.y = ue, ne = De); }), G; }, _prepareArrayForTween(R, w, U) { const G = [], ne = []; if (R.length > w.length) { const W = w; w = R, R = W; } for (let W = 0; W < R.length; W += 2) G.push({ x: R[W], y: R[W + 1] }); for (let W = 0; W < w.length; W += 2) ne.push({ x: w[W], y: w[W + 1] }); const z = []; return ne.forEach(function(W) { const H = g.Util._getProjectionToLine(W, G, U); z.push(H.x), z.push(H.y); }), z; }, _prepareToStringify(R) { let w; R.visitedByCircularReferenceRemoval = !0; for (const U in R) if (R.hasOwnProperty(U) && R[U] && typeof R[U] == "object") { if (w = Object.getOwnPropertyDescriptor(R, U), R[U].visitedByCircularReferenceRemoval || g.Util._isElement(R[U])) if (w.configurable) delete R[U]; else return null; else if (g.Util._prepareToStringify(R[U]) === null) if (w.configurable) delete R[U]; else return null; } return delete R.visitedByCircularReferenceRemoval, R; }, _assign(R, w) { for (const U in w) R[U] = w[U]; return R; }, _getFirstPointerId(R) { return R.touches ? R.changedTouches[0].identifier : R.pointerId || 999; }, releaseCanvas(...R) { r.Konva.releaseCanvasOnDestroy && R.forEach((w) => { w.width = 0, w.height = 0; }); }, drawRoundedRectPath(R, w, U, G) { let ne = 0, z = 0, W = 0, H = 0; typeof G == "number" ? ne = z = W = H = Math.min(G, w / 2, U / 2) : (ne = Math.min(G[0] || 0, w / 2, U / 2), z = Math.min(G[1] || 0, w / 2, U / 2), H = Math.min(G[2] || 0, w / 2, U / 2), W = Math.min(G[3] || 0, w / 2, U / 2)), R.moveTo(ne, 0), R.lineTo(w - z, 0), R.arc(w - z, z, z, Math.PI * 3 / 2, 0, !1), R.lineTo(w, U - H), R.arc(w - H, U - H, H, 0, Math.PI / 2, !1), R.lineTo(W, U), R.arc(W, U - W, W, Math.PI / 2, Math.PI, !1), R.lineTo(0, ne), R.arc(ne, ne, ne, Math.PI, Math.PI * 3 / 2, !1); } }; })(yn); var fn = {}, Ti = {}, Hl = {}; Object.defineProperty(Hl, "__esModule", { value: !0 }); Hl.HitContext = Hl.SceneContext = Hl.Context = void 0; const t5 = yn, R8 = vt; function T8(g) { const r = [], s = g.length, c = t5.Util; for (let f = 0; f < s; f++) { let h = g[f]; c._isNumber(h) ? h = Math.round(h * 1e3) / 1e3 : c._isString(h) || (h = h + ""), r.push(h); } return r; } const iy = ",", b8 = "(", D8 = ")", w8 = "([", N8 = "])", M8 = ";", O8 = "()", A8 = "=", ly = [ "arc", "arcTo", "beginPath", "bezierCurveTo", "clearRect", "clip", "closePath", "createLinearGradient", "createPattern", "createRadialGradient", "drawImage", "ellipse", "fill", "fillText", "getImageData", "createImageData", "lineTo", "moveTo", "putImageData", "quadraticCurveTo", "rect", "roundRect", "restore", "rotate", "save", "scale", "setLineDash", "setTransform", "stroke", "strokeText", "transform", "translate" ], P8 = [ "fillStyle", "strokeStyle", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY", "letterSpacing", "lineCap", "lineDashOffset", "lineJoin", "lineWidth", "miterLimit", "direction", "font", "textAlign", "textBaseline", "globalAlpha", "globalCompositeOperation", "imageSmoothingEnabled" ], L8 = 100; class up { constructor(r) { this.canvas = r, R8.Konva.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, s) { let c = this.traceArr, f = c.length, h = "", p, y, S, _; for (p = 0; p < f; p++) y = c[p], S = y.method, S ? (_ = y.args, h += S, r ? h += O8 : t5.Util._isArray(_[0]) ? h += w8 + _.join(iy) + N8 : (s && (_ = _.map((D) => typeof D == "number" ? Math.floor(D) : D)), h += b8 + _.join(iy) + D8)) : (h += y.property, r || (h += A8 + y.val)), h += M8; return h; } clearTrace() { this.traceArr = []; } _trace(r) { let s = this.traceArr, c; s.push(r), c = s.length, c >= L8 && s.shift(); } reset() { const r = this.getCanvas().getPixelRatio(); this.setTransform(1 * r, 0, 0, 1 * r, 0, 0); } getCanvas() { return this.canvas; } clear(r) { const s = this.getCanvas(); r ? this.clearRect(r.x || 0, r.y || 0, r.width || 0, r.height || 0) : this.clearRect(0, 0, s.getWidth() / s.pixelRatio, s.getHeight() / s.pixelRatio); } _applyLineCap(r) { const s = r.attrs.lineCap; s && this.setAttr("lineCap", s); } _applyOpacity(r) { const s = r.getAbsoluteOpacity(); s !== 1 && this.setAttr("globalAlpha", s); } _applyLineJoin(r) { const s = r.attrs.lineJoin; s && this.setAttr("lineJoin", s); } setAttr(r, s) { this._context[r] = s; } arc(r, s, c, f, h, p) { this._context.arc(r, s, c, f, h, p); } arcTo(r, s, c, f, h) { this._context.arcTo(r, s, c, f, h); } beginPath() { this._context.beginPath(); } bezierCurveTo(r, s, c, f, h, p) { this._context.bezierCurveTo(r, s, c, f, h, p); } clearRect(r, s, c, f) { this._context.clearRect(r, s, c, f); } clip(...r) { this._context.clip.apply(this._context, r); } closePath() { this._context.closePath(); } createImageData(r, s) { const c = arguments; if (c.length === 2) return this._context.createImageData(r, s); if (c.length === 1) return this._context.createImageData(r); } createLinearGradient(r, s, c, f) { return this._context.createLinearGradient(r, s, c, f); } createPattern(r, s) { return this._context.createPattern(r, s); } createRadialGradient(r, s, c, f, h, p) { return this._context.createRadialGradient(r, s, c, f, h, p); } drawImage(r, s, c, f, h, p, y, S, _) { const D = arguments, A = this._context; D.length === 3 ? A.drawImage(r, s, c) : D.length === 5 ? A.drawImage(r, s, c, f, h) : D.length === 9 && A.drawImage(r, s, c, f, h, p, y, S, _); } ellipse(r, s, c, f, h, p, y, S) { this._context.ellipse(r, s, c, f, h, p, y, S); } isPointInPath(r, s, c, f) { return c ? this._context.isPointInPath(c, r, s, f) : this._context.isPointInPath(r, s, f); } fill(...r) { this._context.fill.apply(this._context, r); } fillRect(r, s, c, f) { this._context.fillRect(r, s, c, f); } strokeRect(r, s, c, f) { this._context.strokeRect(r, s, c, f); } fillText(r, s, c, f) { f ? this._context.fillText(r, s, c, f) : this._context.fillText(r, s, c); } measureText(r) { return this._context.measureText(r); } getImageData(r, s, c, f) { return this._context.getImageData(r, s, c, f); } lineTo(r, s) { this._context.lineTo(r, s); } moveTo(r, s) { this._context.moveTo(r, s); } rect(r, s, c, f) { this._context.rect(r, s, c, f); } roundRect(r, s, c, f, h) { this._context.roundRect(r, s, c, f, h); } putImageData(r, s, c) { this._context.putImageData(r, s, c); } quadraticCurveTo(r, s, c, f) { this._context.quadraticCurveTo(r, s, c, f); } restore() { this._context.restore(); } rotate(r) { this._context.rotate(r); } save() { this._context.save(); } scale(r, s) { this._context.scale(r, s); } setLineDash(r) { this._context.setLineDash ? this._context.setLineDash(r) : "mozDash" in this._context ? this._context.mozDash = r : "webkitLineDash" in this._context && (this._context.webkitLineDash = r); } getLineDash() { return this._context.getLineDash(); } setTransform(r, s, c, f, h, p) { this._context.setTransform(r, s, c, f, h, p); } stroke(r) { r ? this._context.stroke(r) : this._context.stroke(); } strokeText(r, s, c, f) { this._context.strokeText(r, s, c, f); } transform(r, s, c, f, h, p) { this._context.transform(r, s, c, f, h, p); } translate(r, s) { this._context.translate(r, s); } _enableTrace() { let r = this, s = ly.length, c = this.setAttr, f, h; const p = function(y) { let S = r[y], _; r[y] = function() { return h = T8(Array.prototype.slice.call(arguments, 0)), _ = S.apply(r, arguments), r._trace({ method: y, args: h }), _; }; }; for (f = 0; f < s; f++) p(ly[f]); r.setAttr = function() { c.apply(r, arguments); const y = arguments[0]; let S = arguments[1]; (y === "shadowOffsetX" || y === "shadowOffsetY" || y === "shadowBlur") && (S = S / this.canvas.getPixelRatio()), r._trace({ property: y, val: S }); }; } _applyGlobalCompositeOperation(r) { const s = r.attrs.globalCompositeOperation; !s || s === "source-over" || this.setAttr("globalCompositeOperation", s); } } Hl.Context = up; P8.forEach(function(g) { Object.defineProperty(up.prototype, g, { get() { return this._context[g]; }, set(r) { this._context[g] = r; } }); }); class F8 extends up { constructor(r, { willReadFrequently: s = !1 } = {}) { super(r), this._context = r._canvas.getContext("2d", { willReadFrequently: s }); } _fillColor(r) { const s = r.fill(); this.setAttr("fillStyle", s), r._fillFunc(this); } _fillPattern(r) { this.setAttr("fillStyle", r._getFillPattern()), r._fillFunc(this); } _fillLinearGradient(r) { const s = r._getLinearGradient(); s && (this.setAttr("fillStyle", s), r._fillFunc(this)); } _fillRadialGradient(r) { const s = r._getRadialGradient(); s && (this.setAttr("fillStyle", s), r._fillFunc(this)); } _fill(r) { const s = r.fill(), c = r.getFillPriority(); if (s && c === "color") { this._fillColor(r); return; } const f = r.getFillPatternImage(); if (f && c === "pattern") { this._fillPattern(r); return; } const h = r.getFillLinearGradientColorStops(); if (h && c === "linear-gradient") { this._fillLi