UNPKG

@chamn/engine

Version:
1,228 lines (1,226 loc) 3.68 MB
var ade = Object.defineProperty; var lde = (e, t, n) => t in e ? ade(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var He = (e, t, n) => lde(e, typeof t != "symbol" ? t + "" : t, n); import * as We from "react"; import ue, { memo as rr, useCallback as kt, useMemo as ot, PureComponent as wf, createContext as Ai, useContext as An, useEffect as nt, version as ude, isValidElement as b2, Component as Tf, createElement as Xd, useState as rt, useRef as ze, forwardRef as jr, useLayoutEffect as S2, useReducer as cde, useImperativeHandle as Ri } from "react"; import cF, { flushSync as dde, createPortal as w2, unstable_batchedUpdates as Xy } from "react-dom"; import { Button as Mr, Popover as q0, Collapse as bg, Input as mo, Tabs as T2, message as Mm, ConfigProvider as dr, InputNumber as rG, Modal as _f, Switch as fde, Select as Sg, AutoComplete as Bb, ColorPicker as iG, Slider as hde, Radio as zn, Row as Ln, Col as On, Card as _2, Alert as pde, Tooltip as mde, Dropdown as x2, TreeSelect as gde, Space as k2, Empty as dF, Segmented as yde } from "antd"; import { isExpression as sG, getRandomStr as eo, findContainerNode as vde, isPageModel as bde, isNodeModel as oG, isJSSlotPropNode as Sde, getMTitle as XO, isSpecialMaterialPropType as aG, getMTitleTip as lG, traversePageNode as wde, InnerComponentNameEnum as Tde, CNodePropsTypeEnum as C2, SetterTypeEnum as _de, LogicType as ti, AssignValueType as YO, DEV_CONFIG_KEY as Uu, isFunction as xde, HTMl_TAGS as uG, DEFAULT_EVENT_LIST as kde, CPage as fF, EmptyPage as Cde } from "@chamn/model"; import { Sensor as cG, Layout as Nde, LayoutMode as hF, addEventListenerReturnCancel as nT } from "@chamn/layout"; export * from "@chamn/layout"; function zl(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } function dG(e) { if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e; var t = e.default; if (typeof t == "function") { var n = function r() { return this instanceof r ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments); }; n.prototype = t.prototype; } else n = {}; return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) { var i = Object.getOwnPropertyDescriptor(e, r); Object.defineProperty(n, r, i.get ? i : { enumerable: !0, get: function() { return e[r]; } }); }), n; } var Yy = { exports: {} }, ch = {}; /** * @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 pF; function Ede() { if (pF) return ch; pF = 1; var e = ue, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function o(a, l, d) { var h, f = {}, u = null, c = null; d !== void 0 && (u = "" + d), l.key !== void 0 && (u = "" + l.key), l.ref !== void 0 && (c = l.ref); for (h in l) r.call(l, h) && !s.hasOwnProperty(h) && (f[h] = l[h]); if (a && a.defaultProps) for (h in l = a.defaultProps, l) f[h] === void 0 && (f[h] = l[h]); return { $$typeof: t, type: a, key: u, ref: c, props: f, _owner: i.current }; } return ch.Fragment = n, ch.jsx = o, ch.jsxs = o, ch; } var dh = {}, mF; function Ode() { if (mF) return dh; mF = 1; /** * @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. */ return "{}".NODE_ENV !== "production" && function() { var e = ue, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), a = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), u = Symbol.for("react.lazy"), c = Symbol.for("react.offscreen"), p = Symbol.iterator, m = "@@iterator"; function g(be) { if (be === null || typeof be != "object") return null; var Ge = p && be[p] || be[m]; return typeof Ge == "function" ? Ge : null; } var y = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function v(be) { { for (var Ge = arguments.length, Qe = new Array(Ge > 1 ? Ge - 1 : 0), ct = 1; ct < Ge; ct++) Qe[ct - 1] = arguments[ct]; w("error", be, Qe); } } function w(be, Ge, Qe) { { var ct = y.ReactDebugCurrentFrame, wt = ct.getStackAddendum(); wt !== "" && (Ge += "%s", Qe = Qe.concat([wt])); var It = Qe.map(function(Ct) { return String(Ct); }); It.unshift("Warning: " + Ge), Function.prototype.apply.call(console[be], console, It); } } var b = !1, _ = !1, N = !1, O = !1, T = !1, E; E = Symbol.for("react.module.reference"); function L(be) { return !!(typeof be == "string" || typeof be == "function" || be === r || be === s || T || be === i || be === d || be === h || O || be === c || b || _ || N || typeof be == "object" && be !== null && (be.$$typeof === u || be.$$typeof === f || be.$$typeof === o || be.$$typeof === a || be.$$typeof === l || // 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. be.$$typeof === E || be.getModuleId !== void 0)); } function P(be, Ge, Qe) { var ct = be.displayName; if (ct) return ct; var wt = Ge.displayName || Ge.name || ""; return wt !== "" ? Qe + "(" + wt + ")" : Qe; } function z(be) { return be.displayName || "Context"; } function C(be) { if (be == null) return null; if (typeof be.tag == "number" && v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof be == "function") return be.displayName || be.name || null; if (typeof be == "string") return be; switch (be) { case r: return "Fragment"; case n: return "Portal"; case s: return "Profiler"; case i: return "StrictMode"; case d: return "Suspense"; case h: return "SuspenseList"; } if (typeof be == "object") switch (be.$$typeof) { case a: var Ge = be; return z(Ge) + ".Consumer"; case o: var Qe = be; return z(Qe._context) + ".Provider"; case l: return P(be, be.render, "ForwardRef"); case f: var ct = be.displayName || null; return ct !== null ? ct : C(be.type) || "Memo"; case u: { var wt = be, It = wt._payload, Ct = wt._init; try { return C(Ct(It)); } catch { return null; } } } return null; } var k = Object.assign, A = 0, R, j, q, W, I, H, Q; function F() { } F.__reactDisabledLog = !0; function V() { { if (A === 0) { R = console.log, j = console.info, q = console.warn, W = console.error, I = console.group, H = console.groupCollapsed, Q = console.groupEnd; var be = { configurable: !0, enumerable: !0, value: F, writable: !0 }; Object.defineProperties(console, { info: be, log: be, warn: be, error: be, group: be, groupCollapsed: be, groupEnd: be }); } A++; } } function D() { { if (A--, A === 0) { var be = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: k({}, be, { value: R }), info: k({}, be, { value: j }), warn: k({}, be, { value: q }), error: k({}, be, { value: W }), group: k({}, be, { value: I }), groupCollapsed: k({}, be, { value: H }), groupEnd: k({}, be, { value: Q }) }); } A < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var K = y.ReactCurrentDispatcher, $; function ee(be, Ge, Qe) { { if ($ === void 0) try { throw Error(); } catch (wt) { var ct = wt.stack.trim().match(/\n( *(at )?)/); $ = ct && ct[1] || ""; } return ` ` + $ + be; } } var re = !1, me; { var ke = typeof WeakMap == "function" ? WeakMap : Map; me = new ke(); } function he(be, Ge) { if (!be || re) return ""; { var Qe = me.get(be); if (Qe !== void 0) return Qe; } var ct; re = !0; var wt = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var It; It = K.current, K.current = null, V(); try { if (Ge) { 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 (Di) { ct = Di; } Reflect.construct(be, [], Ct); } else { try { Ct.call(); } catch (Di) { ct = Di; } be.call(Ct.prototype); } } else { try { throw Error(); } catch (Di) { ct = Di; } be(); } } catch (Di) { if (Di && ct && typeof Di.stack == "string") { for (var Lt = Di.stack.split(` `), yn = ct.stack.split(` `), $t = Lt.length - 1, jn = yn.length - 1; $t >= 1 && jn >= 0 && Lt[$t] !== yn[jn]; ) jn--; for (; $t >= 1 && jn >= 0; $t--, jn--) if (Lt[$t] !== yn[jn]) { if ($t !== 1 || jn !== 1) do if ($t--, jn--, jn < 0 || Lt[$t] !== yn[jn]) { var Fr = ` ` + Lt[$t].replace(" at new ", " at "); return be.displayName && Fr.includes("<anonymous>") && (Fr = Fr.replace("<anonymous>", be.displayName)), typeof be == "function" && me.set(be, Fr), Fr; } while ($t >= 1 && jn >= 0); break; } } } finally { re = !1, K.current = It, D(), Error.prepareStackTrace = wt; } var Tr = be ? be.displayName || be.name : "", Co = Tr ? ee(Tr) : ""; return typeof be == "function" && me.set(be, Co), Co; } function ie(be, Ge, Qe) { return he(be, !1); } function le(be) { var Ge = be.prototype; return !!(Ge && Ge.isReactComponent); } function se(be, Ge, Qe) { if (be == null) return ""; if (typeof be == "function") return he(be, le(be)); if (typeof be == "string") return ee(be); switch (be) { case d: return ee("Suspense"); case h: return ee("SuspenseList"); } if (typeof be == "object") switch (be.$$typeof) { case l: return ie(be.render); case f: return se(be.type, Ge, Qe); case u: { var ct = be, wt = ct._payload, It = ct._init; try { return se(It(wt), Ge, Qe); } catch { } } } return ""; } var _e = Object.prototype.hasOwnProperty, Se = {}, Re = y.ReactDebugCurrentFrame; function ge(be) { if (be) { var Ge = be._owner, Qe = se(be.type, be._source, Ge ? Ge.type : null); Re.setExtraStackFrame(Qe); } else Re.setExtraStackFrame(null); } function Pe(be, Ge, Qe, ct, wt) { { var It = Function.call.bind(_e); for (var Ct in be) if (It(be, Ct)) { var Lt = void 0; try { if (typeof be[Ct] != "function") { var yn = Error((ct || "React class") + ": " + Qe + " type `" + Ct + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof be[Ct] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw yn.name = "Invariant Violation", yn; } Lt = be[Ct](Ge, Ct, ct, Qe, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch ($t) { Lt = $t; } Lt && !(Lt instanceof Error) && (ge(wt), v("%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).", ct || "React class", Qe, Ct, typeof Lt), ge(null)), Lt instanceof Error && !(Lt.message in Se) && (Se[Lt.message] = !0, ge(wt), v("Failed %s type: %s", Qe, Lt.message), ge(null)); } } } var Fe = Array.isArray; function Ne(be) { return Fe(be); } function Je(be) { { var Ge = typeof Symbol == "function" && Symbol.toStringTag, Qe = Ge && be[Symbol.toStringTag] || be.constructor.name || "Object"; return Qe; } } function st(be) { try { return ve(be), !1; } catch { return !0; } } function ve(be) { return "" + be; } function Ee(be) { if (st(be)) return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Je(be)), ve(be); } var Y = y.ReactCurrentOwner, U = { key: !0, ref: !0, __self: !0, __source: !0 }, J, de; function Z(be) { if (_e.call(be, "ref")) { var Ge = Object.getOwnPropertyDescriptor(be, "ref").get; if (Ge && Ge.isReactWarning) return !1; } return be.ref !== void 0; } function ye(be) { if (_e.call(be, "key")) { var Ge = Object.getOwnPropertyDescriptor(be, "key").get; if (Ge && Ge.isReactWarning) return !1; } return be.key !== void 0; } function xe(be, Ge) { typeof be.ref == "string" && Y.current; } function Ue(be, Ge) { { var Qe = function() { J || (J = !0, v("%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)", Ge)); }; Qe.isReactWarning = !0, Object.defineProperty(be, "key", { get: Qe, configurable: !0 }); } } function Ce(be, Ge) { { var Qe = function() { de || (de = !0, v("%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)", Ge)); }; Qe.isReactWarning = !0, Object.defineProperty(be, "ref", { get: Qe, configurable: !0 }); } } var Be = function(be, Ge, Qe, ct, wt, It, Ct) { var Lt = { // This tag allows us to uniquely identify this as a React Element $$typeof: t, // Built-in properties that belong on the element type: be, key: Ge, ref: Qe, props: Ct, // Record the component responsible for creating this element. _owner: It }; return Lt._store = {}, Object.defineProperty(Lt._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(Lt, "_self", { configurable: !1, enumerable: !1, writable: !1, value: ct }), Object.defineProperty(Lt, "_source", { configurable: !1, enumerable: !1, writable: !1, value: wt }), Object.freeze && (Object.freeze(Lt.props), Object.freeze(Lt)), Lt; }; function te(be, Ge, Qe, ct, wt) { { var It, Ct = {}, Lt = null, yn = null; Qe !== void 0 && (Ee(Qe), Lt = "" + Qe), ye(Ge) && (Ee(Ge.key), Lt = "" + Ge.key), Z(Ge) && (yn = Ge.ref, xe(Ge, wt)); for (It in Ge) _e.call(Ge, It) && !U.hasOwnProperty(It) && (Ct[It] = Ge[It]); if (be && be.defaultProps) { var $t = be.defaultProps; for (It in $t) Ct[It] === void 0 && (Ct[It] = $t[It]); } if (Lt || yn) { var jn = typeof be == "function" ? be.displayName || be.name || "Unknown" : be; Lt && Ue(Ct, jn), yn && Ce(Ct, jn); } return Be(be, Lt, yn, wt, ct, Y.current, Ct); } } var Ae = y.ReactCurrentOwner, $e = y.ReactDebugCurrentFrame; function G(be) { if (be) { var Ge = be._owner, Qe = se(be.type, be._source, Ge ? Ge.type : null); $e.setExtraStackFrame(Qe); } else $e.setExtraStackFrame(null); } var Le; Le = !1; function Me(be) { return typeof be == "object" && be !== null && be.$$typeof === t; } function oe() { { if (Ae.current) { var be = C(Ae.current.type); if (be) return ` Check the render method of \`` + be + "`."; } return ""; } } function we(be) { return ""; } var je = {}; function it(be) { { var Ge = oe(); if (!Ge) { var Qe = typeof be == "string" ? be : be.displayName || be.name; Qe && (Ge = ` Check the top-level render call using <` + Qe + ">."); } return Ge; } } function ae(be, Ge) { { if (!be._store || be._store.validated || be.key != null) return; be._store.validated = !0; var Qe = it(Ge); if (je[Qe]) return; je[Qe] = !0; var ct = ""; be && be._owner && be._owner !== Ae.current && (ct = " It was passed a child from " + C(be._owner.type) + "."), G(be), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', Qe, ct), G(null); } } function fe(be, Ge) { { if (typeof be != "object") return; if (Ne(be)) for (var Qe = 0; Qe < be.length; Qe++) { var ct = be[Qe]; Me(ct) && ae(ct, Ge); } else if (Me(be)) be._store && (be._store.validated = !0); else if (be) { var wt = g(be); if (typeof wt == "function" && wt !== be.entries) for (var It = wt.call(be), Ct; !(Ct = It.next()).done; ) Me(Ct.value) && ae(Ct.value, Ge); } } } function Ve(be) { { var Ge = be.type; if (Ge == null || typeof Ge == "string") return; var Qe; if (typeof Ge == "function") Qe = Ge.propTypes; else if (typeof Ge == "object" && (Ge.$$typeof === l || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. Ge.$$typeof === f)) Qe = Ge.propTypes; else return; if (Qe) { var ct = C(Ge); Pe(Qe, be.props, "prop", ct, be); } else if (Ge.PropTypes !== void 0 && !Le) { Le = !0; var wt = C(Ge); v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", wt || "Unknown"); } typeof Ge.getDefaultProps == "function" && !Ge.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function Xe(be) { { for (var Ge = Object.keys(be.props), Qe = 0; Qe < Ge.length; Qe++) { var ct = Ge[Qe]; if (ct !== "children" && ct !== "key") { G(be), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", ct), G(null); break; } } be.ref !== null && (G(be), v("Invalid attribute `ref` supplied to `React.Fragment`."), G(null)); } } function et(be, Ge, Qe, ct, wt, It) { { var Ct = L(be); if (!Ct) { var Lt = ""; (be === void 0 || typeof be == "object" && be !== null && Object.keys(be).length === 0) && (Lt += " 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 yn = we(); yn ? Lt += yn : Lt += oe(); var $t; be === null ? $t = "null" : Ne(be) ? $t = "array" : be !== void 0 && be.$$typeof === t ? ($t = "<" + (C(be.type) || "Unknown") + " />", Lt = " Did you accidentally export a JSX literal instead of a component?") : $t = typeof be, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", $t, Lt); } var jn = te(be, Ge, Qe, wt, It); if (jn == null) return jn; if (Ct) { var Fr = Ge.children; if (Fr !== void 0) if (ct) if (Ne(Fr)) { for (var Tr = 0; Tr < Fr.length; Tr++) fe(Fr[Tr], be); Object.freeze && Object.freeze(Fr); } else v("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 fe(Fr, be); } return be === r ? Xe(jn) : Ve(jn), jn; } } function pt(be, Ge, Qe) { return et(be, Ge, Qe, !0); } function mt(be, Ge, Qe) { return et(be, Ge, Qe, !1); } var dn = mt, tn = pt; dh.Fragment = r, dh.jsx = dn, dh.jsxs = tn; }(), dh; } var gF; function Lde() { return gF || (gF = 1, "{}".NODE_ENV === "production" ? Yy.exports = Ede() : Yy.exports = Ode()), Yy.exports; } var B = Lde(), _r = function() { return _r = Object.assign || function(e) { for (var t, n = 1, r = arguments.length; n < r; n++) { t = arguments[n]; for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]); } return e; }, _r.apply(this, arguments); }, yF = { width: "100%", height: "10px", top: "0px", left: "0px", cursor: "row-resize" }, vF = { width: "10px", height: "100%", top: "0px", left: "0px", cursor: "col-resize" }, Zy = { width: "20px", height: "20px", position: "absolute", zIndex: 1 }, Ade = { top: _r(_r({}, yF), { top: "-5px" }), right: _r(_r({}, vF), { left: void 0, right: "-5px" }), bottom: _r(_r({}, yF), { top: void 0, bottom: "-5px" }), left: _r(_r({}, vF), { left: "-5px" }), topRight: _r(_r({}, Zy), { right: "-10px", top: "-10px", cursor: "ne-resize" }), bottomRight: _r(_r({}, Zy), { right: "-10px", bottom: "-10px", cursor: "se-resize" }), bottomLeft: _r(_r({}, Zy), { left: "-10px", bottom: "-10px", cursor: "sw-resize" }), topLeft: _r(_r({}, Zy), { left: "-10px", top: "-10px", cursor: "nw-resize" }) }, Rde = rr(function(e) { var t = e.onResizeStart, n = e.direction, r = e.children, i = e.replaceStyles, s = e.className, o = kt(function(d) { t(d, n); }, [t, n]), a = kt(function(d) { t(d, n); }, [t, n]), l = ot(function() { return _r(_r({ position: "absolute", userSelect: "none" }, Ade[n]), i ?? {}); }, [i, n]); return B.jsx("div", { className: s || void 0, style: l, onMouseDown: o, onTouchStart: a, children: r }); }), Pde = /* @__PURE__ */ function() { var e = function(t, n) { return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, i) { r.__proto__ = i; } || function(r, i) { for (var s in i) Object.prototype.hasOwnProperty.call(i, s) && (r[s] = i[s]); }, e(t, n); }; return function(t, n) { if (typeof n != "function" && n !== null) throw new TypeError("Class extends value " + String(n) + " is not a constructor or null"); e(t, n); function r() { this.constructor = t; } t.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r()); }; }(), Mo = function() { return Mo = Object.assign || function(e) { for (var t, n = 1, r = arguments.length; n < r; n++) { t = arguments[n]; for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]); } return e; }, Mo.apply(this, arguments); }, Mde = { width: "auto", height: "auto" }, Qy = function(e, t, n) { return Math.max(Math.min(e, n), t); }, bF = function(e, t, n) { var r = Math.round(e / t); return r * t + n * (r - 1); }, Uc = function(e, t) { return new RegExp(e, "i").test(t); }, $y = function(e) { return !!(e.touches && e.touches.length); }, jde = function(e) { return !!((e.clientX || e.clientX === 0) && (e.clientY || e.clientY === 0)); }, SF = function(e, t, n) { n === void 0 && (n = 0); var r = t.reduce(function(s, o, a) { return Math.abs(o - e) < Math.abs(t[s] - e) ? a : s; }, 0), i = Math.abs(t[r] - e); return n === 0 || i < n ? t[r] : e; }, rT = function(e) { return e = e.toString(), e === "auto" || e.endsWith("px") || e.endsWith("%") || e.endsWith("vh") || e.endsWith("vw") || e.endsWith("vmax") || e.endsWith("vmin") ? e : "".concat(e, "px"); }, ev = function(e, t, n, r) { if (e && typeof e == "string") { if (e.endsWith("px")) return Number(e.replace("px", "")); if (e.endsWith("%")) { var i = Number(e.replace("%", "")) / 100; return t * i; } if (e.endsWith("vw")) { var i = Number(e.replace("vw", "")) / 100; return n * i; } if (e.endsWith("vh")) { var i = Number(e.replace("vh", "")) / 100; return r * i; } } return e; }, Ide = function(e, t, n, r, i, s, o) { return r = ev(r, e.width, t, n), i = ev(i, e.height, t, n), s = ev(s, e.width, t, n), o = ev(o, e.height, t, n), { maxWidth: typeof r > "u" ? void 0 : Number(r), maxHeight: typeof i > "u" ? void 0 : Number(i), minWidth: typeof s > "u" ? void 0 : Number(s), minHeight: typeof o > "u" ? void 0 : Number(o) }; }, Fde = function(e) { return Array.isArray(e) ? e : [e, e]; }, Dde = [ "as", "ref", "style", "className", "grid", "gridGap", "snap", "bounds", "boundsByDirection", "size", "defaultSize", "minWidth", "minHeight", "maxWidth", "maxHeight", "lockAspectRatio", "lockAspectRatioExtraWidth", "lockAspectRatioExtraHeight", "enable", "handleStyles", "handleClasses", "handleWrapperStyle", "handleWrapperClass", "children", "onResizeStart", "onResize", "onResizeStop", "handleComponent", "scale", "resizeRatio", "snapGap" ], wF = "__resizable_base__", TF = ( /** @class */ function(e) { Pde(t, e); function t(n) { var r, i, s, o, a = e.call(this, n) || this; return a.ratio = 1, a.resizable = null, a.parentLeft = 0, a.parentTop = 0, a.resizableLeft = 0, a.resizableRight = 0, a.resizableTop = 0, a.resizableBottom = 0, a.targetLeft = 0, a.targetTop = 0, a.delta = { width: 0, height: 0 }, a.appendBase = function() { if (!a.resizable || !a.window) return null; var l = a.parentNode; if (!l) return null; var d = a.window.document.createElement("div"); return d.style.width = "100%", d.style.height = "100%", d.style.position = "absolute", d.style.transform = "scale(0, 0)", d.style.left = "0", d.style.flex = "0 0 100%", d.classList ? d.classList.add(wF) : d.className += wF, l.appendChild(d), d; }, a.removeBase = function(l) { var d = a.parentNode; d && d.removeChild(l); }, a.state = { isResizing: !1, width: (i = (r = a.propsSize) === null || r === void 0 ? void 0 : r.width) !== null && i !== void 0 ? i : "auto", height: (o = (s = a.propsSize) === null || s === void 0 ? void 0 : s.height) !== null && o !== void 0 ? o : "auto", direction: "right", original: { x: 0, y: 0, width: 0, height: 0 }, backgroundStyle: { height: "100%", width: "100%", backgroundColor: "rgba(0,0,0,0)", cursor: "auto", opacity: 0, position: "fixed", zIndex: 9999, top: "0", left: "0", bottom: "0", right: "0" }, flexBasis: void 0 }, a.onResizeStart = a.onResizeStart.bind(a), a.onMouseMove = a.onMouseMove.bind(a), a.onMouseUp = a.onMouseUp.bind(a), a; } return Object.defineProperty(t.prototype, "parentNode", { get: function() { return this.resizable ? this.resizable.parentNode : null; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "window", { get: function() { return !this.resizable || !this.resizable.ownerDocument ? null : this.resizable.ownerDocument.defaultView; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "propsSize", { get: function() { return this.props.size || this.props.defaultSize || Mde; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "size", { get: function() { var n = 0, r = 0; if (this.resizable && this.window) { var i = this.resizable.offsetWidth, s = this.resizable.offsetHeight, o = this.resizable.style.position; o !== "relative" && (this.resizable.style.position = "relative"), n = this.resizable.style.width !== "auto" ? this.resizable.offsetWidth : i, r = this.resizable.style.height !== "auto" ? this.resizable.offsetHeight : s, this.resizable.style.position = o; } return { width: n, height: r }; }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "sizeStyle", { get: function() { var n = this, r = this.props.size, i = function(a) { var l; if (typeof n.state[a] > "u" || n.state[a] === "auto") return "auto"; if (n.propsSize && n.propsSize[a] && (!((l = n.propsSize[a]) === null || l === void 0) && l.toString().endsWith("%"))) { if (n.state[a].toString().endsWith("%")) return n.state[a].toString(); var d = n.getParentSize(), h = Number(n.state[a].toString().replace("px", "")), f = h / d[a] * 100; return "".concat(f, "%"); } return rT(n.state[a]); }, s = r && typeof r.width < "u" && !this.state.isResizing ? rT(r.width) : i("width"), o = r && typeof r.height < "u" && !this.state.isResizing ? rT(r.height) : i("height"); return { width: s, height: o }; }, enumerable: !1, configurable: !0 }), t.prototype.getParentSize = function() { if (!this.parentNode) return this.window ? { width: this.window.innerWidth, height: this.window.innerHeight } : { width: 0, height: 0 }; var n = this.appendBase(); if (!n) return { width: 0, height: 0 }; var r = !1, i = this.parentNode.style.flexWrap; i !== "wrap" && (r = !0, this.parentNode.style.flexWrap = "wrap"), n.style.position = "relative", n.style.minWidth = "100%", n.style.minHeight = "100%"; var s = { width: n.offsetWidth, height: n.offsetHeight }; return r && (this.parentNode.style.flexWrap = i), this.removeBase(n), s; }, t.prototype.bindEvents = function() { this.window && (this.window.addEventListener("mouseup", this.onMouseUp), this.window.addEventListener("mousemove", this.onMouseMove), this.window.addEventListener("mouseleave", this.onMouseUp), this.window.addEventListener("touchmove", this.onMouseMove, { capture: !0, passive: !1 }), this.window.addEventListener("touchend", this.onMouseUp)); }, t.prototype.unbindEvents = function() { this.window && (this.window.removeEventListener("mouseup", this.onMouseUp), this.window.removeEventListener("mousemove", this.onMouseMove), this.window.removeEventListener("mouseleave", this.onMouseUp), this.window.removeEventListener("touchmove", this.onMouseMove, !0), this.window.removeEventListener("touchend", this.onMouseUp)); }, t.prototype.componentDidMount = function() { if (!(!this.resizable || !this.window)) { var n = this.window.getComputedStyle(this.resizable); this.setState({ width: this.state.width || this.size.width, height: this.state.height || this.size.height, flexBasis: n.flexBasis !== "auto" ? n.flexBasis : void 0 }); } }, t.prototype.componentWillUnmount = function() { this.window && this.unbindEvents(); }, t.prototype.createSizeForCssProperty = function(n, r) { var i = this.propsSize && this.propsSize[r]; return this.state[r] === "auto" && this.state.original[r] === n && (typeof i > "u" || i === "auto") ? "auto" : n; }, t.prototype.calculateNewMaxFromBoundary = function(n, r) { var i = this.props.boundsByDirection, s = this.state.direction, o = i && Uc("left", s), a = i && Uc("top", s), l, d; if (this.props.bounds === "parent") { var h = this.parentNode; h && (l = o ? this.resizableRight - this.parentLeft : h.offsetWidth + (this.parentLeft - this.resizableLeft), d = a ? this.resizableBottom - this.parentTop : h.offsetHeight + (this.parentTop - this.resizableTop)); } else this.props.bounds === "window" ? this.window && (l = o ? this.resizableRight : this.window.innerWidth - this.resizableLeft, d = a ? this.resizableBottom : this.window.innerHeight - this.resizableTop) : this.props.bounds && (l = o ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft), d = a ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop)); return l && Number.isFinite(l) && (n = n && n < l ? n : l), d && Number.isFinite(d) && (r = r && r < d ? r : d), { maxWidth: n, maxHeight: r }; }, t.prototype.calculateNewSizeFromDirection = function(n, r) { var i = this.props.scale || 1, s = Fde(this.props.resizeRatio || 1), o = s[0], a = s[1], l = this.state, d = l.direction, h = l.original, f = this.props, u = f.lockAspectRatio, c = f.lockAspectRatioExtraHeight, p = f.lockAspectRatioExtraWidth, m = h.width, g = h.height, y = c || 0, v = p || 0; return Uc("right", d) && (m = h.width + (n - h.x) * o / i, u && (g = (m - v) / this.ratio + y)), Uc("left", d) && (m = h.width - (n - h.x) * o / i, u && (g = (m - v) / this.ratio + y)), Uc("bottom", d) && (g = h.height + (r - h.y) * a / i, u && (m = (g - y) * this.ratio + v)), Uc("top", d) && (g = h.height - (r - h.y) * a / i, u && (m = (g - y) * this.ratio + v)), { newWidth: m, newHeight: g }; }, t.prototype.calculateNewSizeFromAspectRatio = function(n, r, i, s) { var o = this.props, a = o.lockAspectRatio, l = o.lockAspectRatioExtraHeight, d = o.lockAspectRatioExtraWidth, h = typeof s.width > "u" ? 10 : s.width, f = typeof i.width > "u" || i.width < 0 ? n : i.width, u = typeof s.height > "u" ? 10 : s.height, c = typeof i.height > "u" || i.height < 0 ? r : i.height, p = l || 0, m = d || 0; if (a) { var g = (u - p) * this.ratio + m, y = (c - p) * this.ratio + m, v = (h - m) / this.ratio + p, w = (f - m) / this.ratio + p, b = Math.max(h, g), _ = Math.min(f, y), N = Math.max(u, v), O = Math.min(c, w); n = Qy(n, b, _), r = Qy(r, N, O); } else n = Qy(n, h, f), r = Qy(r, u, c); return { newWidth: n, newHeight: r }; }, t.prototype.setBoundingClientRect = function() { var n = 1 / (this.props.scale || 1); if (this.props.bounds === "parent") { var r = this.parentNode; if (r) { var i = r.getBoundingClientRect(); this.parentLeft = i.left * n, this.parentTop = i.top * n; } } if (this.props.bounds && typeof this.props.bounds != "string") { var s = this.props.bounds.getBoundingClientRect(); this.targetLeft = s.left * n, this.targetTop = s.top * n; } if (this.resizable) { var o = this.resizable.getBoundingClientRect(), a = o.left, l = o.top, d = o.right, h = o.bottom; this.resizableLeft = a * n, this.resizableRight = d * n, this.resizableTop = l * n, this.resizableBottom = h * n; } }, t.prototype.onResizeStart = function(n, r) { if (!(!this.resizable || !this.window)) { var i = 0, s = 0; if (n.nativeEvent && jde(n.nativeEvent) ? (i = n.nativeEvent.clientX, s = n.nativeEvent.clientY) : n.nativeEvent && $y(n.nativeEvent) && (i = n.nativeEvent.touches[0].clientX, s = n.nativeEvent.touches[0].clientY), this.props.onResizeStart && this.resizable) { var o = this.props.onResizeStart(n, r, this.resizable); if (o === !1) return; } this.props.size && (typeof this.props.size.height < "u" && this.props.size.height !== this.state.height && this.setState({ height: this.props.size.height }), typeof this.props.size.width < "u" && this.props.size.width !== this.state.width && this.setState({ width: this.props.size.width })), this.ratio = typeof this.props.lockAspectRatio == "number" ? this.props.lockAspectRatio : this.size.width / this.size.height; var a, l = this.window.getComputedStyle(this.resizable); if (l.flexBasis !== "auto") { var d = this.parentNode; if (d) { var h = this.window.getComputedStyle(d).flexDirection; this.flexDir = h.startsWith("row") ? "row" : "column", a = l.flexBasis; } } this.setBoundingClientRect(), this.bindEvents(); var f = { original: { x: i, y: s, width: this.size.width, height: this.size.height }, isResizing: !0, backgroundStyle: Mo(Mo({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(n.target).cursor || "auto" }), direction: r, flexBasis: a }; this.setState(f); } }, t.prototype.onMouseMove = function(n) { var r = this; if (!(!this.state.isResizing || !this.resizable || !this.window)) { if (this.window.TouchEvent && $y(n)) try { n.preventDefault(), n.stopPropagation(); } catch { } var i = this.props, s = i.maxWidth, o = i.maxHeight, a = i.minWidth, l = i.minHeight, d = $y(n) ? n.touches[0].clientX : n.clientX, h = $y(n) ? n.touches[0].clientY : n.clientY, f = this.state, u = f.direction, c = f.original, p = f.width, m = f.height, g = this.getParentSize(), y = Ide(g, this.window.innerWidth, this.window.innerHeight, s, o, a, l); s = y.maxWidth, o = y.maxHeight, a = y.minWidth, l = y.minHeight; var v = this.calculateNewSizeFromDirection(d, h), w = v.newHeight, b = v.newWidth, _ = this.calculateNewMaxFromBoundary(s, o); this.props.snap && this.props.snap.x && (b = SF(b, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (w = SF(w, this.props.snap.y, this.props.snapGap)); var N = this.calculateNewSizeFromAspectRatio(b, w, { width: _.maxWidth, height: _.maxHeight }, { width: a, height: l }); if (b = N.newWidth, w = N.newHeight, this.props.grid) { var O = bF(b, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), T = bF(w, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), E = this.props.snapGap || 0, L = E === 0 || Math.abs(O - b) <= E ? O : b, P = E === 0 || Math.abs(T - w) <= E ? T : w; b = L, w = P; } var z = { width: b - c.width, height: w - c.height }; if (this.delta = z, p && typeof p == "string") { if (p.endsWith("%")) { var C = b / g.width * 100; b = "".concat(C, "%"); } else if (p.endsWith("vw")) { var k = b / this.window.innerWidth * 100; b = "".concat(k, "vw"); } else if (p.endsWith("vh")) { var A = b / this.window.innerHeight * 100; b = "".concat(A, "vh"); } } if (m && typeof m == "string") { if (m.endsWith("%")) { var C = w / g.height * 100; w = "".concat(C, "%"); } else if (m.endsWith("vw")) { var k = w / this.window.innerWidth * 100; w = "".concat(k, "vw"); } else if (m.endsWith("vh")) { var A = w / this.window.innerHeight * 100; w = "".concat(A, "vh"); } } var R = { width: this.createSizeForCssProperty(b, "width"), height: this.createSizeForCssProperty(w, "height") }; this.flexDir === "row" ? R.flexBasis = R.width : this.flexDir === "column" && (R.flexBasis = R.height); var j = this.state.width !== R.width, q = this.state.height !== R.height, W = this.state.flexBasis !== R.flexBasis, I = j || q || W; I && dde(function() { r.setState(R); }), this.props.onResize && I && this.props.onResize(n, u, this.resizable, z); } }, t.prototype.onMouseUp = function(n) { var r, i, s = this.state, o = s.isResizing, a = s.direction; s.original, !(!o || !this.resizable) && (this.props.onResizeStop && this.props.onResizeStop(n, a, this.resizable, this.delta), this.props.size && this.setState({ width: (r = this.props.size.width) !== null && r !== void 0 ? r : "auto", height: (i = this.props.size.height) !== null && i !== void 0 ? i : "auto" }), this.unbindEvents(), this.setState({ isResizing: !1, backgroundStyle: Mo(Mo({}, this.state.backgroundStyle), { cursor: "auto" }) })); }, t.prototype.updateSize = function(n) { var r, i; this.setState({ width: (r = n.width) !== null && r !== void 0 ? r : "auto", height: (i = n.height) !== null && i !== void 0 ? i : "auto" }); }, t.prototype.renderResizer = function() { var n = this, r = this.props, i = r.enable, s = r.handleStyles, o = r.handleClasses, a = r.handleWrapperStyle, l = r.handleWrapperClass, d = r.handleComponent; if (!i) return null; var h = Object.keys(i).map(function(f) { return i[f] !== !1 ? B.jsx(Rde, { direction: f, onResizeStart: n.onResizeStart, replaceStyles: s && s[f], className: o && o[f], children: d && d[f] ? d[f] : null }, f) : null; }); return B.jsx("div", { className: l, style: a, children: h }); }, t.prototype.render = function() { var n = this, r = Object.keys(this.props).reduce(function(o, a) { return Dde.indexOf(a) !== -1 || (o[a] = n.props[a]), o; }, {}), i = Mo(Mo(Mo({ position: "relative", userSelect: this.state.isResizing ? "none" : "auto" }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: "border-box", flexShrink: 0 }); this.state.flexBasis && (i.flexBasis = this.state.flexBasis); var s = this.props.as || "div"; return B.jsxs(s, Mo({ style: i, className: this.props.className }, r, { // `ref` is after `extendsProps` to ensure this one wins over a version // passed in ref: function(o) { o && (n.resizable = o); }, children: [this.state.isResizing && B.jsx("div", { style: this.state.backgroundStyle }), this.props.children, this.renderResizer()] })); }, t.defaultProps = { as: "div", onResizeStart: function() { }, onResize: function() { }, onResizeStop: function() { }, enable: { top: !0, right: !0, bottom: !0, left: !0, topRight: !0, bottomRight: !0, bottomLeft: !0, topLeft: !0 }, style: {}, grid: [1, 1], gridGap: [0, 0], lockAspectRatio: !1, lockAspectRatioExtraWidth: 0, lockAspectRatioExtraHeight: 0, scale: 1, resizeRatio: 1, snapGap: 0 }, t; }(wf) ); const Bde = "_workbenchContainer_1z0k5_2", zde = "_topToolBarBox_1z0k5_9", Ude = "_topToolBarView_1z0k5_15", qde = "_bodyContent_1z0k5_18", Vde = "_leftBox_1z0k5_24", Hde = "_pluginIconBar_1z0k5_31", Wde = "_pluginIconItem_1z0k5_36", Gde = "_active_1z0k5_46", Jde = "_pluginPanelBoxResizeBox_1z0k5_62", Kde = "_pluginHeader_1z0k5_69", Xde = "_pluginNameText_1z0k5_77", Yde = "_closeBtn_1z0k5_84", Zde = "_fixedBtn_1z0k5_85", Qde = "_pluginPanelBox_1z0k5_62", $de = "_hiddenLeftPanel_1z0k5_101", efe = "_rightResizeBox_1z0k5_104", tfe = "_arrowCursor_1z0k5_108", nfe = "_rightBox_1z0k5_123", rfe = "_hiddenRightPanel_1z0k5_130", ife = "_centerBox_1z0k5_134", sfe = "_subTopToolbarBox_1z0k5_141", ofe = "_canvasBox_1z0k5_146", afe = "_scrollBox_1z0k5_153", lfe = "_canvasBoxPadding_1z0k5_157", ufe = "_customViewBox_1z0k5_161", Mn = { workbenchContainer: Bde, topToolBarBox: zde, topToolBarView: Ude, bodyContent: qde, leftBox: Vde, pluginIconBar: Hde, pluginIconItem: Wde, active: Gde, pluginPanelBoxResizeBox: Jde, pluginHeader: Kde, pluginNameText: Xde, closeBtn: Yde, fixedBtn: Zde, pluginPanelBox: Qde, hiddenLeftPanel: $de, rightResizeBox: efe, arrowCursor: tfe, rightBox: nfe, hiddenRightPanel: rfe, centerBox: ife, subTopToolbarBox: sfe, canvasBox: ofe, scrollBox: afe, canvasBoxPadding: lfe, customViewBox: ufe }; var fG = /* @__PURE__ */ Ai({}); function Vn() { return Vn = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var n = arguments[t]; for (var r in n) ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]); } return e; }, Vn.apply(null, arguments); } function hG(e) { if (Array.isArray(e)) return e; } function cfe(e, t) { var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"]; if (n != null) { var r, i, s, o, a = [], l = !0, d = !1; try { if (s = (n = n.call(e)).next, t === 0) { if (Object(n) !== n) return; l = !1; } else for (; !(l = (r = s.call(n)).done) && (a.push(r.value), a.length !== t); l = !0) ; } catch (h) { d = !0, i = h; } finally { try { if (!l && n.return != null && (o = n.return(), Object(o) !== o)) return; } finally { if (d) throw i; } } return a; } } function ZO(e, t) { (t == null || t > e.length) && (t = e.length); for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n]; return r; } function N2(e, t) { if (e) { if (typeof e == "string") return ZO(e, t); var n = {}.toString.call(e).slice(8, -1); return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? ZO(e, t) : void 0; } } function pG() { throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } function Xt(e, t) { return hG(e) || cfe(e, t) || N2(e, t) || pG(); } function cn(e) { "@babel/helpers - typeof"; return cn = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) { return typeof t; } : function(t) { return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t; }, cn(e); } function dfe(e, t) { if (cn(e) != "object" || !e) return e; var n = e[Symbol.toPrimitive]; if (n !== void 0) { var r = n.call(e, t); if (cn(r) != "object") return r; throw new TypeError("@@toPrimitive must return a primitive value."); } return (t === "string" ? String : Number)(e); } function mG(e) { var t = dfe(e, "string"); return cn(t) == "symbol" ? t : t + ""; } function vt(e, t, n) { return (t = mG(t)) in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e; } function ffe(e, t) { if (e == null) return {}; var n = {}; for (var r in e) if ({}.hasOwnProperty.call(e, r)) { if (t.indexOf(r) !== -1) continue; n[r] = e[r]; } return n; } function Yd(e, t) { if (e == null) return {}; var n, r, i = ff