ice-entity-designer 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +287 -26
- package/dist/index.cjs +30 -0
- package/dist/index.mjs +30 -0
- package/dist/index.umd.js +10 -5
- package/dist/react.cjs +30 -0
- package/dist/react.mjs +30 -0
- package/dist/types/designer/EntityDesigner.d.mts +102 -0
- package/dist/types/designer/EntityDesigner.d.ts +102 -0
- package/dist/types/er-component/Entity.d.mts +104 -0
- package/dist/types/er-component/Entity.d.ts +104 -62
- package/dist/types/er-component/Relation.d.mts +50 -0
- package/dist/types/er-component/Relation.d.ts +50 -24
- package/dist/types/gl-matrix.d.mts +3273 -0
- package/dist/types/gl-matrix.d.ts +3273 -0
- package/dist/types/ice-render/FrameManager.d.mts +26 -0
- package/dist/types/ice-render/FrameManager.d.ts +26 -0
- package/dist/types/ice-render/ICE.d.mts +369 -0
- package/dist/types/ice-render/ICE.d.ts +369 -0
- package/dist/types/ice-render/a11y/accessibility.d.mts +46 -0
- package/dist/types/ice-render/a11y/accessibility.d.ts +46 -0
- package/dist/types/ice-render/animation/AnimationManager.d.mts +96 -0
- package/dist/types/ice-render/animation/AnimationManager.d.ts +96 -0
- package/dist/types/ice-render/animation/Easing.d.mts +33 -0
- package/dist/types/ice-render/animation/Easing.d.ts +33 -0
- package/dist/types/ice-render/consts/BIG_ZINDEX_NUMBER.d.mts +14 -0
- package/dist/types/ice-render/consts/BIG_ZINDEX_NUMBER.d.ts +14 -0
- package/dist/types/ice-render/consts/COMPONENT_TYPE_MAPPING.d.mts +45 -0
- package/dist/types/ice-render/consts/COMPONENT_TYPE_MAPPING.d.ts +45 -0
- package/dist/types/ice-render/consts/DOM_EVENT_MAPPING_CONSTS.d.mts +37 -0
- package/dist/types/ice-render/consts/DOM_EVENT_MAPPING_CONSTS.d.ts +37 -0
- package/dist/types/ice-render/consts/ICE_EVENT_NAME_CONSTS.d.mts +27 -0
- package/dist/types/ice-render/consts/ICE_EVENT_NAME_CONSTS.d.ts +27 -0
- package/dist/types/ice-render/control-panel/AlignmentGuideManager.d.mts +92 -0
- package/dist/types/ice-render/control-panel/AlignmentGuideManager.d.ts +92 -0
- package/dist/types/ice-render/control-panel/ICEControlPanel.d.mts +37 -0
- package/dist/types/ice-render/control-panel/ICEControlPanel.d.ts +37 -0
- package/dist/types/ice-render/control-panel/ICEControlPanelManager.d.mts +25 -0
- package/dist/types/ice-render/control-panel/ICEControlPanelManager.d.ts +25 -0
- package/dist/types/ice-render/control-panel/link-controls/LineControlPanel.d.mts +39 -0
- package/dist/types/ice-render/control-panel/link-controls/LineControlPanel.d.ts +39 -0
- package/dist/types/ice-render/control-panel/transform-controls/ResizeControl.d.mts +38 -0
- package/dist/types/ice-render/control-panel/transform-controls/ResizeControl.d.ts +38 -0
- package/dist/types/ice-render/control-panel/transform-controls/RotateControl.d.mts +12 -0
- package/dist/types/ice-render/control-panel/transform-controls/RotateControl.d.ts +12 -0
- package/dist/types/ice-render/control-panel/transform-controls/TransformControlPanel.d.mts +83 -0
- package/dist/types/ice-render/control-panel/transform-controls/TransformControlPanel.d.ts +83 -0
- package/dist/types/ice-render/control-panel/transform-controls/constraints.d.mts +24 -0
- package/dist/types/ice-render/control-panel/transform-controls/constraints.d.ts +24 -0
- package/dist/types/ice-render/cross-platform/PolyfillPath2D.d.mts +31 -0
- package/dist/types/ice-render/cross-platform/PolyfillPath2D.d.ts +31 -0
- package/dist/types/ice-render/cross-platform/root.d.mts +7 -0
- package/dist/types/ice-render/cross-platform/root.d.ts +7 -0
- package/dist/types/ice-render/event/DOMEventDispatcher.d.mts +68 -0
- package/dist/types/ice-render/event/DOMEventDispatcher.d.ts +68 -0
- package/dist/types/ice-render/event/DOMEventInterceptor.d.mts +36 -0
- package/dist/types/ice-render/event/DOMEventInterceptor.d.ts +36 -0
- package/dist/types/ice-render/event/EventBus.d.mts +27 -0
- package/dist/types/ice-render/event/EventBus.d.ts +27 -0
- package/dist/types/ice-render/event/ICEEvent.d.mts +46 -0
- package/dist/types/ice-render/event/ICEEvent.d.ts +46 -0
- package/dist/types/ice-render/event/ICEEventTarget.d.mts +106 -0
- package/dist/types/ice-render/event/ICEEventTarget.d.ts +106 -0
- package/dist/types/ice-render/event/input-normalize.d.mts +75 -0
- package/dist/types/ice-render/event/input-normalize.d.ts +75 -0
- package/dist/types/ice-render/geometry/GeoLine.d.mts +24 -0
- package/dist/types/ice-render/geometry/GeoLine.d.ts +24 -0
- package/dist/types/ice-render/geometry/GeoPoint.d.mts +53 -0
- package/dist/types/ice-render/geometry/GeoPoint.d.ts +53 -0
- package/dist/types/ice-render/geometry/GeoUtil.d.mts +73 -0
- package/dist/types/ice-render/geometry/GeoUtil.d.ts +73 -0
- package/dist/types/ice-render/geometry/ICEBoundingBox.d.mts +81 -0
- package/dist/types/ice-render/geometry/ICEBoundingBox.d.ts +81 -0
- package/dist/types/ice-render/graphic/ICEComponent.d.mts +486 -0
- package/dist/types/ice-render/graphic/ICEComponent.d.ts +486 -0
- package/dist/types/ice-render/graphic/ICEDotPath.d.mts +99 -0
- package/dist/types/ice-render/graphic/ICEDotPath.d.ts +99 -0
- package/dist/types/ice-render/graphic/ICEImage.d.mts +17 -0
- package/dist/types/ice-render/graphic/ICEImage.d.ts +17 -0
- package/dist/types/ice-render/graphic/ICEPath.d.mts +39 -0
- package/dist/types/ice-render/graphic/ICEPath.d.ts +39 -0
- package/dist/types/ice-render/graphic/container/ICEGroup.d.mts +101 -0
- package/dist/types/ice-render/graphic/container/ICEGroup.d.ts +101 -0
- package/dist/types/ice-render/graphic/link/ICEBezier.d.mts +23 -0
- package/dist/types/ice-render/graphic/link/ICEBezier.d.ts +23 -0
- package/dist/types/ice-render/graphic/link/ICELinkHook.d.mts +52 -0
- package/dist/types/ice-render/graphic/link/ICELinkHook.d.ts +52 -0
- package/dist/types/ice-render/graphic/link/ICELinkSlot.d.mts +54 -0
- package/dist/types/ice-render/graphic/link/ICELinkSlot.d.ts +54 -0
- package/dist/types/ice-render/graphic/link/ICELinkSlotManager.d.mts +28 -0
- package/dist/types/ice-render/graphic/link/ICELinkSlotManager.d.ts +28 -0
- package/dist/types/ice-render/graphic/link/ICEPolyLine.d.mts +292 -0
- package/dist/types/ice-render/graphic/link/ICEPolyLine.d.ts +292 -0
- package/dist/types/ice-render/graphic/link/ICEVisioLink.d.mts +163 -0
- package/dist/types/ice-render/graphic/link/ICEVisioLink.d.ts +163 -0
- package/dist/types/ice-render/graphic/shape/ICECircle.d.mts +19 -0
- package/dist/types/ice-render/graphic/shape/ICECircle.d.ts +19 -0
- package/dist/types/ice-render/graphic/shape/ICEEllipse.d.mts +29 -0
- package/dist/types/ice-render/graphic/shape/ICEEllipse.d.ts +29 -0
- package/dist/types/ice-render/graphic/shape/ICEIsogon.d.mts +52 -0
- package/dist/types/ice-render/graphic/shape/ICEIsogon.d.ts +52 -0
- package/dist/types/ice-render/graphic/shape/ICERect.d.mts +10 -0
- package/dist/types/ice-render/graphic/shape/ICERect.d.ts +10 -0
- package/dist/types/ice-render/graphic/shape/ICERose.d.mts +41 -0
- package/dist/types/ice-render/graphic/shape/ICERose.d.ts +41 -0
- package/dist/types/ice-render/graphic/shape/ICEStar.d.mts +45 -0
- package/dist/types/ice-render/graphic/shape/ICEStar.d.ts +45 -0
- package/dist/types/ice-render/graphic/text/ICEText.d.mts +137 -0
- package/dist/types/ice-render/graphic/text/ICEText.d.ts +137 -0
- package/dist/types/ice-render/index.d.mts +55 -0
- package/dist/types/ice-render/index.d.ts +55 -0
- package/dist/types/ice-render/layout/ICEBorderLayout.d.mts +34 -0
- package/dist/types/ice-render/layout/ICEBorderLayout.d.ts +34 -0
- package/dist/types/ice-render/layout/ICEBoxLayout.d.mts +30 -0
- package/dist/types/ice-render/layout/ICEBoxLayout.d.ts +30 -0
- package/dist/types/ice-render/layout/ICECardLayout.d.mts +36 -0
- package/dist/types/ice-render/layout/ICECardLayout.d.ts +36 -0
- package/dist/types/ice-render/layout/ICEFlowLayout.d.mts +31 -0
- package/dist/types/ice-render/layout/ICEFlowLayout.d.ts +31 -0
- package/dist/types/ice-render/layout/ICEGridLayout.d.mts +33 -0
- package/dist/types/ice-render/layout/ICEGridLayout.d.ts +33 -0
- package/dist/types/ice-render/layout/ICELayeredLayout.d.mts +49 -0
- package/dist/types/ice-render/layout/ICELayeredLayout.d.ts +49 -0
- package/dist/types/ice-render/layout/ICELayoutManager.d.mts +33 -0
- package/dist/types/ice-render/layout/ICELayoutManager.d.ts +33 -0
- package/dist/types/ice-render/layout/ICEOverlayLayout.d.mts +25 -0
- package/dist/types/ice-render/layout/ICEOverlayLayout.d.ts +25 -0
- package/dist/types/ice-render/persistence/Deserializer.d.mts +43 -0
- package/dist/types/ice-render/persistence/Deserializer.d.ts +43 -0
- package/dist/types/ice-render/persistence/Serializer.d.mts +35 -0
- package/dist/types/ice-render/persistence/Serializer.d.ts +35 -0
- package/dist/types/ice-render/plugin/PluginHost.d.mts +86 -0
- package/dist/types/ice-render/plugin/PluginHost.d.ts +86 -0
- package/dist/types/ice-render/renderer/CanvasRenderer.d.mts +150 -0
- package/dist/types/ice-render/renderer/CanvasRenderer.d.ts +150 -0
- package/dist/types/ice-render/renderer/ObjectCache.d.mts +79 -0
- package/dist/types/ice-render/renderer/ObjectCache.d.ts +79 -0
- package/dist/types/ice-render/renderer/dirty-rect-util.d.mts +86 -0
- package/dist/types/ice-render/renderer/dirty-rect-util.d.ts +86 -0
- package/dist/types/ice-render/theme/ICETheme.d.mts +382 -0
- package/dist/types/ice-render/theme/ICETheme.d.ts +382 -0
- package/dist/types/ice-render/util/ImageCache.d.mts +19 -0
- package/dist/types/ice-render/util/ImageCache.d.ts +19 -0
- package/dist/types/ice-render/util/data-util.d.mts +43 -0
- package/dist/types/ice-render/util/data-util.d.ts +43 -0
- package/dist/types/ice-render/util/gl-matrix-skew.d.mts +14 -0
- package/dist/types/ice-render/util/gl-matrix-skew.d.ts +14 -0
- package/dist/types/ice-render/util/lang.d.mts +28 -0
- package/dist/types/ice-render/util/lang.d.ts +28 -0
- package/dist/types/ice-render/util/uuid.d.mts +1 -0
- package/dist/types/ice-render/util/uuid.d.ts +1 -0
- package/dist/types/index.d.mts +30 -0
- package/dist/types/index.d.ts +30 -10
- package/dist/types/react/EntityDesignerCanvas.d.mts +12 -0
- package/dist/types/react/EntityDesignerCanvas.d.ts +12 -0
- package/dist/types/react/context.d.mts +25 -0
- package/dist/types/react/context.d.ts +25 -0
- package/dist/types/react/index.d.mts +17 -0
- package/dist/types/react/index.d.ts +17 -0
- package/dist/types/react/session.d.mts +30 -0
- package/dist/types/react/session.d.ts +30 -0
- package/dist/types/react/types.d.mts +64 -0
- package/dist/types/react/types.d.ts +64 -0
- package/dist/types/utils/camelcase_util.d.mts +4 -0
- package/dist/types/utils/camelcase_util.d.ts +4 -4
- package/dist/types/utils/component_type_util.d.mts +4 -0
- package/dist/types/utils/component_type_util.d.ts +4 -0
- package/dist/types/utils/pluralize_util.d.mts +25 -0
- package/dist/types/utils/pluralize_util.d.ts +25 -25
- package/dist/types/utils/project_schema.d.mts +27 -0
- package/dist/types/utils/project_schema.d.ts +27 -0
- package/dist/types/utils/schema_validator.d.mts +10 -0
- package/dist/types/utils/schema_validator.d.ts +10 -0
- package/dist/types/utils/serialization_util.d.mts +2 -0
- package/dist/types/utils/serialization_util.d.ts +2 -2
- package/package.json +145 -96
- package/react.d.ts +2 -0
- package/react.js +3 -0
- package/dist/index.cjs.js +0 -25
- package/dist/index.js +0 -25
package/dist/index.umd.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MIT License
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Copyright (c) 2022 大漠穷秋
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
|
8
8
|
* in the Software without restriction, including without limitation the rights
|
|
9
9
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
10
|
* copies of the Software, and to permit persons to whom the Software is
|
|
11
11
|
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* The above copyright notice and this permission notice shall be included in all
|
|
14
14
|
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
15
|
+
*
|
|
16
16
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
17
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
18
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
@@ -22,4 +22,9 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).IED={})}(this,function(S){"use strict";function ownKeys$1(e,t){var n,i=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)),i}function _objectSpread2$1(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(n),!0).forEach(function(t){_defineProperty$2(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys$1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _classCallCheck$1(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function _createClass$1(t,e,n){e&&_defineProperties$1(t.prototype,e),n&&_defineProperties$1(t,n),Object.defineProperty(t,"prototype",{writable:!1})}function _defineProperty$2(t,e,n){e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}function _inherits$1(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf$1(t,e)}function _getPrototypeOf$1(t){return(_getPrototypeOf$1=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _setPrototypeOf$1(t,e){return(_setPrototypeOf$1=Object.setPrototypeOf||function _setPrototypeOf(t,e){return t.__proto__=e,t})(t,e)}function _assertThisInitialized$1(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _createSuper$1(n){var i=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function _createSuperInternal(){var t,e=_getPrototypeOf$1(n);return function _possibleConstructorReturn$1(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$1(t)}(this,i?(t=_getPrototypeOf$1(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _get$1(){return(_get$1="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,e,n){var i=function _superPropBase$1(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf$1(t)););return t}(t,e);if(i)return(i=Object.getOwnPropertyDescriptor(i,e)).get?i.get.call(arguments.length<3?t:n):i.value}).apply(this,arguments)}function _arrayLikeToArray$1(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function ownKeys(e,t){var n,i=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)),i}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty$1(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _defineProperty$1(t,e,n){e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&function _setPrototypeOf(t,e){(Object.setPrototypeOf||function _setPrototypeOf(t,e){return t.__proto__=e,t})(t,e)}(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _createSuper(n){var i=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function _createSuperInternal(){var t,e=_getPrototypeOf(n);return function _possibleConstructorReturn(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}(this,i?(t=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _get(){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,e,n){var i=function _superPropBase(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}(t,e);if(i)return(i=Object.getOwnPropertyDescriptor(i,e)).get?i.get.call(arguments.length<3?t:n):i.value}).apply(this,arguments)}function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(n="Object"===n&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function p(t){var e=O.call(t,I),n=t[I];try{var i=!(t[I]=void 0)}catch(t){}var r=j.call(t);return i&&(e?t[I]=n:delete t[I]),r}function q(t){return M.call(t)}function s(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(A&&A in Object(t)?p:q)(t)}function u(t){return null!=t&&"object"==typeof t}function y(t){return"string"==typeof t||!L(t)&&T(t)&&"[object String]"==B(t)}function z(t){return void 0===t}function P(t,e){return t===e||t!=t&&e!=e}function R(t,e){for(var n=t.length;n--;)if(Y(t[n][0],e))return n;return-1}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t="object"==typeof t&&t&&t.Object===Object&&t,e="object"==typeof self&&self&&self.Object===Object&&self,e=t||e||Function("return this")(),n=e.Symbol,i=Object.prototype,O=i.hasOwnProperty,j=i.toString,I=n?n.toStringTag:void 0,M=Object.prototype.toString,A=n?n.toStringTag:void 0,i=Array.isArray,B=s,L=i,T=u,N="ICE_FRAME_EVENT",D="AFTER_RENDER",H="BEFORE_ADD",F="AFTER_ADD",V="BEFORE_REMOVE",U="ROUND_FINISH",J="HOOK_MOUSEMOVE",X="HOOK_MOUSEUP",W="BEFORE_RESIZE",c="AFTER_RESIZE",G="AFTER_ROTATE",K="AFTER_MOVE",Q={linear:function linear(t,e,n,i){return t+(e-t)/n*(Date.now()-i)},easeInQuad:function easeInQuad(t,e,n,i){return t+(e-t)/n*((i=Date.now()-i)/n)*i},easeOutQuad:function easeOutQuad(t,e,n,i){return i=Date.now()-i,-(e-t)*(i/=n)*(i-2)+t},easeInOutQuad:function easeInOutQuad(t,e,n,i){return i=Date.now()-i,e-=t,(i/=n/2)<1?e/2*i*i+t:-e/2*(--i*(i-2)-1)+t},easeInQuart:function easeInQuart(t,e,n,i){return i=Date.now()-i,(e-t)*(i/=n)*i*i*i+t},easeOutQuart:function easeOutQuart(t,e,n,i){return-(e-t)*((e=(Date.now()-i)/n-1)*e*e*e-1)+t},easeInOutQuart:function easeInOutQuart(t,e,n,i){return i=Date.now()-i,e-=t,(i/=n/2)<1?e/2*i*i*i*i+t:-e/2*((i-=2)*i*i*i-2)+t},easeInCubic:function easeInCubic(t,e,n,i){return i=Date.now()-i,(e-t)*(i/=n)*i*i+t},easeOutCubic:function easeOutCubic(t,e,n,i){return(e-t)*((e=(Date.now()-i)/n-1)*e*e+1)+t},easeInOutCubic:function easeInOutCubic(t,e,n,i){return i=Date.now()-i,e-=t,(i/=n/2)<1?e/2*i*i*i+t:e/2*((i-=2)*i*i+2)+t}},Z=(_createClass(AnimationManager,[{key:"start",value:function start(){return this.ice.evtBus.on(N,this.frameEventHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(N,this.frameEventHandler,this),this}},{key:"frameEventHandler",value:function frameEventHandler(t){for(var e=_toConsumableArray(this.animationMap.values()),n=0;n<e.length;n++){var i=e[n];i.state.interactive=!1,this.tween(i),i.state.interactive=!0}}},{key:"tween",value:function tween(t){var e,n={},i=t.props.animations,r=1;for(e in i){var o=i[e];if(o.finished){if(++r===Object.keys(i).length){this.remove(t);break}}else{var s=o.from,a=o.to,l=o.duration;a<(z(o.startTime)&&(o.startTime=Date.now()),z(o.easing)&&(o.easing="linear"),s=Q[o.easing](s,a,l,o.startTime))&&(s=a,o.finished=!0),n[e]=Math.floor(s)}}return t.setState(_objectSpread2({},n)),t}},{key:"add",value:function add(t){this.animationMap.set(t.props.id,t)}},{key:"remove",value:function remove(t){y(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}}]),AnimationManager),Y=P,tt=R,et=Array.prototype.splice,nt=R,it=R,rt=R;function AnimationManager(t){_classCallCheck(this,AnimationManager),_defineProperty$1(this,"animationMap",new Map),this.ice=t}function ListCache$4$1(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}ListCache$4$1.prototype.clear=function listCacheClear$1(){this.__data__=[],this.size=0},ListCache$4$1.prototype.delete=function listCacheDelete$1(t){var e=this.__data__;return!((t=tt(e,t))<0||(t==e.length-1?e.pop():et.call(e,t,1),--this.size,0))},ListCache$4$1.prototype.get=function listCacheGet$1(t){var e=this.__data__;return(t=nt(e,t))<0?void 0:e[t][1]},ListCache$4$1.prototype.has=function listCacheHas$1(t){return-1<it(this.__data__,t)},ListCache$4$1.prototype.set=function listCacheSet$1(t,e){var n=this.__data__,i=rt(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this};function _(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ca(t){return!!at(t)&&("[object Function]"==(t=st(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function ga(t){if(null!=t){try{return ct.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function ia(t){return!!lt&< in t}function ra(t,e){return function baseIsNative$1(t){return ut(t)&&!ia(t)&&(ht(t)?pt:ft).test(dt(t))}(t=function getValue$1(t,e){return null==t?void 0:t[e]}(t,e))?t:void 0}function Ba(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t}function Ca(t){var e,n=this.__data__;return gt?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:vt.call(n,t)?n[t]:void 0}var r=ListCache$4$1,ot=r,st=s,at=_,o=e["__core-js_shared__"],lt=(o=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+o:"",ct=Function.prototype.toString,ht=ca,ut=_,dt=ga,ft=/^\[object .+?Constructor\]$/,o=Function.prototype,a=Object.prototype,o=o.toString,a=a.hasOwnProperty,pt=RegExp("^"+o.call(a).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),o=ra(e,"Map"),a=ra(Object,"create"),yt=a,gt=a,vt=Object.prototype.hasOwnProperty,mt=a,bt=Object.prototype.hasOwnProperty,Ct=a;function Hash$1$1(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Hash$1$1.prototype.clear=function hashClear$1(){this.__data__=yt?yt(null):{},this.size=0},Hash$1$1.prototype.delete=Ba,Hash$1$1.prototype.get=Ca,Hash$1$1.prototype.has=function hashHas$1(t){var e=this.__data__;return mt?void 0!==e[t]:bt.call(e,t)},Hash$1$1.prototype.set=function hashSet$1(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ct&&void 0===e?"__lodash_hash_undefined__":e,this};function Ga(t,e){return t=t.__data__,function isKeyable$1(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?t["string"==typeof e?"string":"hash"]:t.map}var _t=Hash$1$1,kt=r,wt=o,Pt=Ga,xt=Ga,Et=Ga,St=Ga;function MapCache$1$1(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}MapCache$1$1.prototype.clear=function mapCacheClear$1(){this.size=0,this.__data__={hash:new _t,map:new(wt||kt),string:new _t}},MapCache$1$1.prototype.delete=function mapCacheDelete$1(t){return t=Pt(this,t).delete(t),this.size-=t?1:0,t},MapCache$1$1.prototype.get=function mapCacheGet$1(t){return xt(this,t).get(t)},MapCache$1$1.prototype.has=function mapCacheHas$1(t){return Et(this,t).has(t)},MapCache$1$1.prototype.set=function mapCacheSet$1(t,e){var n=St(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};function Qa(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t}function Ra(t){return this.__data__.get(t)}function Sa(t){return this.__data__.has(t)}var Ot=r,jt=o,It=MapCache$1$1,$t=r;function Stack$2(t){t=this.__data__=new $t(t),this.size=t.size}Stack$2.prototype.clear=function stackClear$1(){this.__data__=new ot,this.size=0},Stack$2.prototype.delete=Qa,Stack$2.prototype.get=Ra,Stack$2.prototype.has=Sa,Stack$2.prototype.set=function stackSet$1(t,e){var n=this.__data__;if(n instanceof Ot){var i=n.__data__;if(!jt||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new It(i)}return n.set(t,e),this.size=n.size,this};function Xa(t,e,n){"__proto__"==e&&Tt?Tt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function $a(t,e,n){(void 0===n||Rt(t[e],n))&&(void 0!==n||e in t)||zt(t,e,n)}function c0(t){var e=new t.constructor(t.byteLength);return new Dt(e).set(new Dt(t)),e}function e0(t,e){return e=e?Ht(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.length)}function f0(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e}function j0(e,n){return function(t){return e(n(t))}}function m0(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ut)}function q0(t){return"function"!=typeof t.constructor||Xt(t)?{}:qt(Jt(t))}function t0(t){return Gt(t)&&"[object Arguments]"==Wt(t)}function z0(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991}function C0(t){return null!=t&&te(t.length)&&!Yt(t)}function T0(t){return ve(t)&&ye(t.length)&&!!m[he(t)]}function U0(e){return function(t){return e(t)}}function _0(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function db(t,e,n){var i=t[e];ke.call(t,e)&&be(i,n)&&(void 0!==n||e in t)||me(t,e,n)}function gb(t,e,n,i){var r=!n;n=n||{};for(var o=-1,s=e.length;++o<s;){var a=e[o],l=i?i(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),(r?Pe:we)(n,a,l)}return n}function ib(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Ee.test(t))&&-1<t&&t%1==0&&t<e}function pb(t,e){var n,i=je(t),r=!i&&Se(t),o=!i&&!r&&Ie(t),s=!i&&!r&&!o&&Me(t),a=i||r||o||s,l=a?function baseTimes$1(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}(t.length,String):[],c=l.length;for(n in t)!e&&!Ae.call(t,n)||a&&("length"==n||o&&("offset"==n||"parent"==n)||s&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||$e(n,c))||l.push(n);return l}function ub(t){if(!Le(t))return function nativeKeysIn$1(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e,n=Te(t),i=[];for(e in t)("constructor"!=e||!n&&ze.call(t,e))&&i.push(e);return i}function wb(t){return Fe(t)?He(t,!0):ub(t)}function Qb(t,e,n,i,r,o,s){var a,l,c,h=ln(t,n),u=ln(e,n),d=s.get(u);d||((e=void 0===(d=o?o(h,u,n+"",t,e,s):void 0))&&(l=!(a=Ze(u))&&en(u),c=!a&&!l&&an(u),d=u,a||l||c?d=Ze(h)?h:tn(h)?Ge(h):l?Xe(u,!(e=!1)):c?We(u,!(e=!1)):[]:sn(u)||Qe(u)?Qe(d=h)?d=function toPlainObject$1(t){return Ve(t,Ue(t))}(h):rn(h)&&!nn(h)||(d=Ke(u)):e=!1),e&&(s.set(u,d),r(d,u,i,o,s),s.delete(u))),qe(t,n,d)}function Ub(t){return t}function Vb(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Xb(t){return function(){return t}}function b1(o,s,a){return s=yn(void 0===s?o.length-1:s,0),function(){for(var t=arguments,e=-1,n=yn(t.length-s,0),i=Array(n);++e<n;)i[e]=t[s+e];for(var e=-1,r=Array(s+1);++e<s;)r[e]=t[e];return r[s]=a(i),Vb(o,this,r)}}function h1(i,r,o,s,a){i!==r&&un(r,function(t,e){var n;a=a||new cn,dn(t)?Qb(i,r,e,o,h1,s,a):(n=s?s(pn(i,e),t,e+"",i,r,a):void 0,hn(i,e,n=void 0===n?t:n))},fn)}var Mt,At,Bt,a=Stack$2,Lt=ra,r=function(){try{var t=Lt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Tt=r,zt=Xa,Rt=P,l=function createBaseFor$1(l){return function(t,e,n){for(var i=-1,r=Object(t),o=n(t),s=o.length;s--;){var a=o[l?s:++i];if(!1===e(r[a],a,r))break}return t}}(),Nt={exports:{}},Dt=(Bt=(d=(d=(h=(h=(f=Nt).exports)&&!h.nodeType&&h)&&f&&!f.nodeType&&f)&&d.exports===h?e.Buffer:void 0)?d.allocUnsafe:void 0,f.exports=function cloneBuffer(t,e){return e?t.slice():(e=t.length,e=Bt?Bt(e):new t.constructor(e),t.copy(e),e)},e.Uint8Array),Ht=c0,Ft=_,Vt=Object.create,h=j0(Object.getPrototypeOf,Object),Ut=Object.prototype,qt=function(t){return Ft(t)?Vt?Vt(t):(object.prototype=t,t=new object,object.prototype=void 0,t):{}},Jt=h,Xt=m0,Wt=s,Gt=u,Kt=u,d=Object.prototype,Qt=d.hasOwnProperty,Zt=d.propertyIsEnumerable,f=t0(function(){return arguments}())?t0:function(t){return Kt(t)&&Qt.call(t,"callee")&&!Zt.call(t,"callee")},Yt=ca,te=z0,ne=C0,ie=u,d={exports:{}},re=(b=((g=(g=(b=(b=(v=d).exports)&&!b.nodeType&&b)&&v&&!v.nodeType&&v)&&g.exports===b?e.Buffer:void 0)?g.isBuffer:void 0)||function stubFalse(){return!1},v.exports=b,s),oe=h,se=u,g=Function.prototype,v=Object.prototype,ae=g.toString,le=v.hasOwnProperty,ce=ae.call(Object),he=s,ye=z0,ve=u,m={},b=(m["[object Float32Array]"]=m["[object Float64Array]"]=m["[object Int8Array]"]=m["[object Int16Array]"]=m["[object Int32Array]"]=m["[object Uint8Array]"]=m["[object Uint8ClampedArray]"]=m["[object Uint16Array]"]=m["[object Uint32Array]"]=!0,m["[object Arguments]"]=m["[object Array]"]=m["[object ArrayBuffer]"]=m["[object Boolean]"]=m["[object DataView]"]=m["[object Date]"]=m["[object Error]"]=m["[object Function]"]=m["[object Map]"]=m["[object Number]"]=m["[object Object]"]=m["[object RegExp]"]=m["[object Set]"]=m["[object String]"]=m["[object WeakMap]"]=!1,{exports:{}}),t=(Mt=(v=(v=(g=b).exports)&&!v.nodeType&&v)&&g&&!g.nodeType&&g,At=Mt&&Mt.exports===v&&t.process,v=function(){try{return Mt&&Mt.require&&Mt.require("util").types||At&&At.binding&&At.binding("util")}catch(t){}}(),g.exports=v,T0),g=U0,v=b.exports,v=v&&v.isTypedArray,g=v?g(v):t,me=Xa,be=P,ke=Object.prototype.hasOwnProperty,we=db,Pe=Xa,Ee=/^(?:0|[1-9]\d*)$/,Se=f,je=i,Ie=d.exports,$e=ib,Me=g,Ae=Object.prototype.hasOwnProperty,Le=_,Te=m0,ze=Object.prototype.hasOwnProperty,He=pb,Fe=C0,Ve=gb,Ue=wb,qe=$a,Xe=Nt.exports,We=e0,Ge=f0,Ke=q0,Qe=f,Ze=i,tn=function isArrayLikeObject$1(t){return ie(t)&&ne(t)},en=d.exports,nn=ca,rn=_,sn=function isPlainObject$1(t){return!(!se(t)||"[object Object]"!=re(t))&&(null===(t=oe(t))||"function"==typeof(t=le.call(t,"constructor")&&t.constructor)&&t instanceof t&&ae.call(t)==ce)},an=g,ln=_0,cn=a,hn=$a,un=l,dn=_,fn=wb,pn=_0,yn=Math.max,gn=r,vn=Date.now,v=function shortOut$1(n){var i=0,r=0;return function(){var t=vn(),e=16-(t-r);if(r=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(gn?function(t,e){return gn(t,"toString",{configurable:!0,enumerable:!1,value:Xb(e),writable:!0})}:Ub),mn=Ub,bn=v,Cn=P,_n=C0,kn=ib,wn=_,Pn=function createAssigner$1(a){return function baseRest$1(t,e){return bn(b1(t,e,mn),t+"")}(function(t,e){var n=-1,i=e.length,r=1<i?e[i-1]:void 0,o=2<i?e[2]:void 0,r=3<a.length&&"function"==typeof r?(i--,r):void 0;for(o&&function isIterateeCall$1(t,e,n){var i;if(wn(n))return i=typeof e,("number"==i?_n(n)&&kn(e,n.length):"string"==i&&e in n)&&Cn(n[e],t)}(e[0],e[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++n<i;){var s=e[n];s&&a(t,s,n,r)}return t})}(function(t,e,n){h1(t,e,n)}),xn="undefined"!=typeof Float32Array?Float32Array:Array,En=Math.PI/180;function object(){}function toRadian(t){return t*En}function invert(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],s=e[4],a=(e=e[5],n*o-i*r);return a?(t[0]=o*(a=1/a),t[1]=-i*a,t[2]=-r*a,t[3]=n*a,t[4]=(r*e-o*s)*a,t[5]=(i*s-n*e)*a,t):null}function multiply(t,e,n){var i=e[0],r=e[1],o=e[2],s=e[3],a=e[4],l=(e=e[5],n[0]),c=n[1],h=n[2],u=n[3],d=n[4];return n=n[5],t[0]=i*l+o*c,t[1]=r*l+s*c,t[2]=i*h+o*u,t[3]=r*h+s*u,t[4]=i*d+o*n+a,t[5]=r*d+s*n+e,t}function transformMat2d(t,e,n){var i=e[0];return e=e[1],t[0]=n[0]*i+n[2]*e+n[4],t[1]=n[1]*i+n[3]*e+n[5],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),function create(){var t=new xn(2);xn!=Float32Array&&(t[0]=0,t[1]=0)}();function p1(t){if(!Sn(t))return On(t);var e,n=[];for(e in Object(t))jn.call(t,e)&&"constructor"!=e&&n.push(e);return n}function t1(t){return(Mn(t)?In:$n)(t)}function y1(){return[]}function F1(t,e){for(var n=-1,i=e.length,r=t.length;++n<i;)t[r+n]=e[n];return t}function P1(t,e,n){return e=e(t),Xn(t)?e:Jn(e,n(t))}function oc(t,e){return e=e?li(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.byteLength)}function pc(t){var e=new t.constructor(t.source,ci.exec(t));return e.lastIndex=t.lastIndex,e}function Ec(t,e){for(var n=-1,i=null==t?0:t.length;++n<i&&!1!==e(t[n],n,t););return t}function Gc(t,e){return t&&An(e,Bn(e),t)}function Hc(t,e){return t&&Ln(e,Tn(e),t)}function Kc(t,e){return Nn(t,Dn(t),e)}function Lc(t,e){return Un(t,qn(t),e)}function Mc(t){return Wn(t,Kn,Gn)}function Nc(t){return Qn(t,Yn,Zn)}function Pc(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&ai.call(t,"index")&&(n.index=t.index,n.input=t.input),n}function Qc(t,e,n){var i=t.constructor;switch(e){case"[object ArrayBuffer]":return ui(t);case"[object Boolean]":case"[object Date]":return new i(+t);case"[object DataView]":return oc(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return di(t,n);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(t);case"[object RegExp]":return pc(t);case"[object Set]":return new i;case"[object Symbol]":return function cloneSymbol$1(t){return hi?Object(hi.call(t)):{}}(t)}}function _c(t){return Ii(t,5)}function m2(t){if(null==t)return!0;if(Li(t)&&(Bi(t)||"string"==typeof t||"function"==typeof t.splice||Ti(t)||Ri(t)||Ai(t)))return!t.length;var e,n=Mi(t);if("[object Map]"==n||"[object Set]"==n)return!t.size;if(zi(t))return!$i(t).length;for(e in t)if(Ni.call(t,e))return!1;return!0}var t=j0(Object.keys,Object),Sn=m0,On=t,jn=Object.prototype.hasOwnProperty,In=pb,$n=p1,Mn=C0,An=gb,Bn=t1,Ln=gb,Tn=wb,zn=Object.prototype.propertyIsEnumerable,Rn=Object.getOwnPropertySymbols,l=Rn?function(e){return null==e?[]:(e=Object(e),function arrayFilter$1(t,e){for(var n=-1,i=null==t?0:t.length,r=0,o=[];++n<i;){var s=t[n];e(s,n,t)&&(o[r++]=s)}return o}(Rn(e),function(t){return zn.call(e,t)}))}:y1,Nn=gb,Dn=l,Hn=F1,Fn=h,Vn=l,r=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Hn(e,Vn(t)),t=Fn(t);return e}:y1,Un=gb,qn=r,Jn=F1,Xn=i,Wn=P1,Gn=l,Kn=t1,Qn=P1,Zn=r,Yn=wb,v=ra(e,"DataView"),t=o,h=ra(e,"Promise"),l=ra(e,"Set"),r=ra(e,"WeakMap"),ti=s,ei=ga,ni=ei(v),ii=ei(t),ri=ei(h),oi=ei(l),si=ei(r),o=ti,v=o=v&&"[object DataView]"!=o(new v(new ArrayBuffer(1)))||t&&"[object Map]"!=o(new t)||h&&"[object Promise]"!=o(h.resolve())||l&&"[object Set]"!=o(new l)||r&&"[object WeakMap]"!=o(new r)?function(t){var e=ti(t);if(t=(t="[object Object]"==e?t.constructor:void 0)?ei(t):"")switch(t){case ni:return"[object DataView]";case ii:return"[object Map]";case ri:return"[object Promise]";case oi:return"[object Set]";case si:return"[object WeakMap]"}return e}:o,ai=Object.prototype.hasOwnProperty,li=c0,ci=/\w*$/,t=n?n.prototype:void 0,hi=t?t.valueOf:void 0,ui=c0,di=e0,fi=v,pi=u,h=U0,l=b.exports,r=l&&l.isMap,o=r?h(r):function baseIsMap$1(t){return pi(t)&&"[object Map]"==fi(t)},yi=v,gi=u,t=U0,l=b.exports,h=l&&l.isSet,r=h?t(h):function baseIsSet$1(t){return gi(t)&&"[object Set]"==yi(t)},vi=a,mi=db,bi=Nt.exports,Ci=f0,_i=v,ki=q0,wi=i,Pi=d.exports,xi=o,Ei=_,Si=r,Oi=t1,ji=wb,C={},Ii=(C["[object Arguments]"]=C["[object Array]"]=C["[object ArrayBuffer]"]=C["[object DataView]"]=C["[object Boolean]"]=C["[object Date]"]=C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Map]"]=C["[object Number]"]=C["[object Object]"]=C["[object RegExp]"]=C["[object Set]"]=C["[object String]"]=C["[object Symbol]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0,C["[object Error]"]=C["[object Function]"]=C["[object WeakMap]"]=!1,function baseClone$1(n,i,r,t,e,o){var s,a=1&i,l=2&i,c=4&i;if(void 0!==(s=r?e?r(n,t,e,o):r(n):s))return s;if(!Ei(n))return n;if(t=wi(n)){if(s=Pc(n),!a)return Ci(n,s)}else{var h=_i(n),u="[object Function]"==h||"[object GeneratorFunction]"==h;if(Pi(n))return bi(n,a);if("[object Object]"==h||"[object Arguments]"==h||u&&!e){if(s=l||u?{}:ki(n),!a)return l?Lc(n,Hc(s,n)):Kc(n,Gc(s,n))}else{if(!C[h])return e?n:{};s=Qc(n,h,a)}}if(u=(o=o||new vi).get(n))return u;o.set(n,s),Si(n)?n.forEach(function(t){s.add(baseClone$1(t,i,r,t,n,o))}):xi(n)&&n.forEach(function(t,e){s.set(e,baseClone$1(t,i,r,e,n,o))});var d=t?void 0:(c?l?Nc:Mc:l?ji:Oi)(n);return Ec(d||n,function(t,e){d&&(t=n[e=t]),mi(s,e,baseClone$1(t,i,r,e,n,o))}),s}),b=null,k=((b=window||global||{}).requestFrame=b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame,b),w=(_createClass(ICEEvent,[{key:"composedPath",value:function composedPath(){throw new Error("Method not implemented.")}},{key:"initEvent",value:function initEvent(t,e,n){throw new Error("Method not implemented.")}},{key:"preventDefault",value:function preventDefault(){throw new Error("Method not implemented.")}},{key:"stopImmediatePropagation",value:function stopImmediatePropagation(){throw new Error("Method not implemented.")}},{key:"stopPropagation",value:function stopPropagation(){throw new Error("Method not implemented.")}}]),ICEEvent),$i=p1,Mi=v,Ai=f,Bi=i,Li=C0,Ti=d.exports,zi=m0,Ri=g,Ni=Object.prototype.hasOwnProperty,l=(_createClass(ICEEventTarget,[{key:"on",value:function on(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:k;this.listeners[t]||(this.listeners[t]=[]),this.off(t,e,n),this.listeners[t].push({callback:e,scope:n})}},{key:"off",value:function off(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:k;if(i=this.listeners[t])for(var i=_toConsumableArray(i),r=0;r<i.length;r++){var o=i[r];if(o.callback===e&&o.scope===n)return void this.listeners[t].splice(r,1)}}},{key:"once",value:function once(e,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:k,r=this;r.on(e,function callback(t){r.off(e,callback,i),n.call(i,t)},i)}},{key:"trigger",value:function trigger(t){var e,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(m2(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;n?((e=new w(n)).originalEvent=n.originalEvent||n,e.param=_objectSpread2({},i)):e=new w({type:t,timeStamp:Date.now(),param:_objectSpread2({},i)});for(var r=this.listeners[t],o=0;o<r.length;o++){var s=r[o];s.callback.call(s.scope,e)}return!0}},{key:"suspend",value:function suspend(t){t&&!this.suspendedEventNames.includes(t)&&this.suspendedEventNames.push(t)}},{key:"resume",value:function resume(e){this.suspendedEventNames.splice(this.suspendedEventNames.findIndex(function(t){return t===e}),1)}},{key:"purgeEvents",value:function purgeEvents(){this.listeners={},this.suspendedEventNames=[]}},{key:"hasListener",value:function hasListener(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:k;if(!this.listeners[t])return!1;var i=this.listeners[t];if(!i)return!1;for(var r=0;r<i.length;r++){var o=i[r];if(o.callback===e&&o.scope===n)return!0}return!1}}]),ICEEventTarget),Di=(l.prototype.addEventListener=l.prototype.on,l.prototype.removeEventListener=l.prototype.off,l.prototype.dispatchEvent=l.prototype.trigger,_createClass(GeoUtil,null,[{key:"calcRotateAngle",value:function calcRotateAngle(t,e,n,i){return t-=n,(((n=e-i)/(e=Math.hypot(t,n))<0?-1:1)*Math.acos(t/e)*180/Math.PI+360)%360}},{key:"calcRotateAngleFromMatrix",value:function calcRotateAngleFromMatrix(t){var e=0,n=t[0],i=(t=t[1],Math.hypot(n,t));return t/=i,e=Math.acos(n/i),t<0&&(e+=Math.PI/2),e*(180/Math.PI)}},{key:"calcScaleFromMatrix",value:function calcScaleFromMatrix(t){var e=t[0],n=t[1],i=t[2];return t=t[3],[Math.hypot(e,n)/e,Math.hypot(i,t)/t]}}]),GeoUtil),Hi=(_createClass(ICEBoundingBox,[{key:"containsPoint",value:function containsPoint(t){var e=(r=this.getMinAndMaxPoint()).minX,n=r.minY,i=r.maxX,r=r.maxY;if(t[0]<e||t[0]>i||t[1]<n||t[1]>r)return!1;for(var o=0,s=this.getBoundingLines(),a=0;a<s.length;a++){var l,c=s[a];t[1]>c.o[1]&&t[1]>c.d[1]||t[1]<c.o[1]&&t[1]<c.d[1]||(c.o[0]===c.d[0]&&c.o[0]>=t[0]?c.o[0]:(l=(c.d[1]-c.o[1])/(c.d[0]-c.o[0]),c.o[0]+(t[1]-c.o[1])/l))>t[0]&&o++}return 0!==o&&o%2==1}},{key:"getBoundingLines",value:function getBoundingLines(){return[{o:_toConsumableArray(this.tl),d:_toConsumableArray(this.tr)},{o:_toConsumableArray(this.tr),d:_toConsumableArray(this.br)},{o:_toConsumableArray(this.br),d:_toConsumableArray(this.bl)},{o:_toConsumableArray(this.bl),d:_toConsumableArray(this.tl)}]}},{key:"getMinAndMaxPoint",value:function getMinAndMaxPoint(){for(var t=this.tl[0],e=this.tl[1],n=this.tl[0],i=this.tl[1],r=[this.tr,this.bl,this.br],o=0;o<r.length;o++){var s=r[o];s[0]<t&&(t=s[0]),s[0]>n&&(n=s[0]),s[1]<e&&(e=s[1]),s[1]>i&&(i=s[1])}return{minX:t,minY:e,maxX:n,maxY:i}}},{key:"containsBox",value:function containsBox(t){return!1}},{key:"isIntersect",value:function isIntersect(t){var e=this.tl[0],n=this.br[0],i=this.tl[1],r=this.br[1],o=t.tl[0],s=t.br[0],a=t.tl[1];return t=t.br[1],!(s<e||t<i||n<o||r<a)}},{key:"transform",value:function transform(t){var e=transformMat2d([],this.tl,t),n=transformMat2d([],this.tr,t),i=transformMat2d([],this.bl,t),r=transformMat2d([],this.br,t);return t=transformMat2d([],this.center,t),new ICEBoundingBox([].concat(_toConsumableArray(e),_toConsumableArray(n),_toConsumableArray(i),_toConsumableArray(r),_toConsumableArray(t)))}},{key:"union",value:function union(t){return null}},{key:"width",get:function get(){var t=this.br[0]-this.bl[0],e=this.br[1]-this.bl[1];return Math.hypot(t,e)}},{key:"height",get:function get(){var t=this.br[0]-this.tr[0],e=this.br[1]-this.tr[1];return Math.hypot(t,e)}},{key:"left",get:function get(){return this.tl[0]},set:function set(t){throw new Error("Can not set left to ICEBoundingBox directly.")}},{key:"top",get:function get(){return this.tl[1]},set:function set(t){throw new Error("Can not set top to ICEBoundingBox directly.")}},{key:"centerX",get:function get(){return this.center[0]}},{key:"centerY",get:function get(){return this.center[1]}},{key:"centerPoint",get:function get(){return this.center}}],[{key:"fromDimension",value:function fromDimension(t,e,n,i){return new ICEBoundingBox([].concat([t,e],[t+n,e],[t,e+i],[t+n,e+i],[t+n/2,e+i/2]))}}]),ICEBoundingBox);function ICEBoundingBox(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[0,0,0,0,0,0,0,0,0,0];_classCallCheck(this,ICEBoundingBox),_defineProperty$1(this,"tl",[0,0]),_defineProperty$1(this,"tr",[0,0]),_defineProperty$1(this,"bl",[0,0]),_defineProperty$1(this,"br",[0,0]),_defineProperty$1(this,"tc",[0,0]),_defineProperty$1(this,"rc",[0,0]),_defineProperty$1(this,"bc",[0,0]),_defineProperty$1(this,"lc",[0,0]),_defineProperty$1(this,"center",[0,0]),this.tl=[t[0],t[1]],this.tr=[t[2],t[3]],this.bl=[t[4],t[5]],this.br=[t[6],t[7]],this.tc=[(this.tr[0]+this.tl[0])/2,(this.tr[1]+this.tl[1])/2],this.bc=[(this.br[0]+this.bl[0])/2,(this.br[1]+this.bl[1])/2],this.lc=[(this.bl[0]+this.tl[0])/2,(this.bl[1]+this.tl[1])/2],this.rc=[(this.br[0]+this.tr[0])/2,(this.br[1]+this.tr[1])/2],this.center=[t[8],t[9]]}function GeoUtil(){throw _classCallCheck(this,GeoUtil),new Error("GeoUtil is a static util class.")}function ICEEventTarget(){_classCallCheck(this,ICEEventTarget),_defineProperty$1(this,"listeners",{}),_defineProperty$1(this,"suspendedEventNames",[])}function ICEEvent(){var t,e,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};for(t in _classCallCheck(this,ICEEvent),n)this[t]=n[t];for(e in i)this[e]=i[e]}function getVal(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function flattenTree(t,e,n,i){for(var r=0<arguments.length&&void 0!==t?t:[],o=1<arguments.length&&void 0!==e?e:[],s=2<arguments.length&&void 0!==n?n:1,a=3<arguments.length&&void 0!==i?i:null,l=0;l<o.length;l++){var c=o[l];c._level=s,c._pid=a,r.push(c),flattenTree(r,c.childNodes||[],s+1,c.id)}return r}function v2(t){return null==t}function E2(t){return"symbol"==typeof t||lr(t)&&"[object Symbol]"==ar(t)}function F2(t){return t&&t.slice(0,function trimmedEndIndex$1(t){for(var e=t.length;e--&&or.test(t.charAt(e)););return e}(t)+1).replace(sr,"")}function M2(t){if("number"==typeof t)return t;if(hr(t))return NaN;if(cr(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=cr(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=F2(t);var e=dr.test(t);return e||fr.test(t)?pr(t.slice(2),e?2:8):ur.test(t)?NaN:+t}function S2(t){if("string"==typeof t)return t;if(gr(t))return function arrayMap$1(t,e){for(var n=-1,i=null==t?0:t.length,r=Array(i);++n<i;)r[n]=e(t[n],n,t);return r}(t,S2)+"";if(vr(t))return mr?mr.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function T2(t){var e=(t=function toFinite$1(t){return t?(t=yr(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}(t))%1;return t==t?e?t-e:t:0}function V2(t){return null==t?"":S2(t)}_inherits(ICEComponent,l),nr=_createSuper(ICEComponent),_createClass(ICEComponent,[{key:"initEvents",value:function initEvents(){this.on("mousedown",this.mouseDownEvtHandler,this),this.on("keydown",this.keyboardEvtHandler,this),this.on("keyup",this.keyboardEvtHandler,this)}},{key:"mouseDownEvtHandler",value:function mouseDownEvtHandler(t){this.state.interactive&&this.state.draggable&&(this.on("mousemove",this.mouseMoveEvtHandler,this),this.on("mouseup",this.mouseUpEvtHandler,this))}},{key:"mouseMoveEvtHandler",value:function mouseMoveEvtHandler(t){var e=t.movementX,n=t.movementY;return this.moveGlobalPosition(e,n,t),!0}},{key:"mouseUpEvtHandler",value:function mouseUpEvtHandler(t){this.off("mousemove",this.mouseMoveEvtHandler,this),this.off("mouseup",this.mouseUpEvtHandler,this)}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){switch(t.key){case"ArrowUp":this.moveGlobalPosition(0,-2,t);break;case"ArrowDown":this.moveGlobalPosition(0,2,t);break;case"ArrowLeft":this.moveGlobalPosition(-2,0,t);break;case"ArrowRight":this.moveGlobalPosition(2,0,t);break;case"Delete":(this.parentNode&&this.parentNode.removeChild?this.parentNode:this.ice).removeChild(this)}}},{key:"render",value:function render(){this.trigger("BEFORE_RENDER"),this.state.display&&(this.calcComponentParams(),this.applyStyleToCtx(),this.applyTransformToCtx(),this.doRender(),this.trigger(D),this.dirty=!1)}},{key:"applyStyleToCtx",value:function applyStyleToCtx(){var t,e=_objectSpread2(_objectSpread2({},this.props.style),this.state.style);for(t in e)this.ctx[t]=e[t]}},{key:"calcComponentParams",value:function calcComponentParams(){return{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function calcLocalOrigin(){var t=[0,0],e=this.state.origin;return e&&"localCenter"!==e||(t[0]=this.state.width/2,t[1]=this.state.height/2),this.state.localOrigin=t}},{key:"calcAbsoluteOrigin",value:function calcAbsoluteOrigin(){var t=getVal(this,"state.transform.translate.0")+this.state.left,e=getVal(this,"state.transform.translate.1")+this.state.top,n=_toConsumableArray(this.calcLocalOrigin());return n[0]+=t,n[1]+=e,this.parentNode&&(n=transformMat2d([],n,[1,0,0,1,-this.parentNode.state.localOrigin[0],-this.parentNode.state.localOrigin[1]]),n=transformMat2d([],n,this.parentNode.state.composedMatrix)),this.state.absoluteOrigin=n}},{key:"calcLinearMatrix",value:function calcLinearMatrix(){var t=function create$1(){var t=new xn(6);return xn!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}(),e=getVal(this,"state.transform.skew.0"),n=getVal(this,"state.transform.skew.1"),t=function scale(t,e,n){var i=e[0],r=e[1],o=e[2],s=e[3],a=e[4],l=(e=e[5],n[0]);return n=n[1],t[0]=i*l,t[1]=r*l,t[2]=o*n,t[3]=s*n,t[4]=a,t[5]=e,t}([],function rotate(t,e,n){var i=e[0],r=e[1],o=e[2],s=e[3],a=e[4],l=(e=e[5],Math.sin(n));return n=Math.cos(n),t[0]=i*n+o*l,t[1]=r*n+s*l,t[2]=i*-l+o*n,t[3]=r*-l+s*n,t[4]=a,t[5]=e,t}([],function skew(t,e,n,i){return n=Math.tan(n),i=Math.tan(i),t[0]=e[0],t[1]=e[1]+n,t[2]=e[2]+i,t[3]=e[3],t[4]=e[4],t[5]=e[5],t}([],t,e*En,n*En),toRadian(getVal(this,"state.transform.rotate"))),[getVal(this,"state.transform.scale.0"),getVal(this,"state.transform.scale.1")]);return this.state.linearMatrix=t}},{key:"calcAbsoluteLinearMatrix",value:function calcAbsoluteLinearMatrix(){for(var t=this,e=t.calcLinearMatrix();t.parentNode;)e=multiply([],t.parentNode.state.linearMatrix,e),t=t.parentNode;return this.state.absoluteLinearMatrix=e}},{key:"composeMatrix",value:function composeMatrix(){var t=multiply([],[1,0,0,1,(t=this.calcAbsoluteOrigin())[0],t[1]],this.calcAbsoluteLinearMatrix());return this.state.composedMatrix=t}},{key:"applyTransformToCtx",value:function applyTransformToCtx(){var t,e=this.dirty?this.composeMatrix():this.state.composedMatrix;(t=this.ctx).setTransform.apply(t,_toConsumableArray(e))}},{key:"doRender",value:function doRender(){var t;this.ctx.setTransform(1,0,0,1,0,0),this.ctx.lineWidth=1,this.state.showMinBoundingBox&&(t=this.getMinBoundingBox(),this.ctx.strokeStyle="#ff0000",this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.beginPath(),this.ctx.moveTo(t.tl[0],t.tl[1]),this.ctx.lineTo(t.tr[0],t.tr[1]),this.ctx.lineTo(t.br[0],t.br[1]),this.ctx.lineTo(t.bl[0],t.bl[1]),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fill()),this.state.showMaxBoundingBox&&(t=this.getMaxBoundingBox(),this.ctx.strokeStyle="#0000ff",this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.beginPath(),this.ctx.moveTo(t.tl[0],t.tl[1]),this.ctx.lineTo(t.tr[0],t.tr[1]),this.ctx.lineTo(t.br[0],t.br[1]),this.ctx.lineTo(t.bl[0],t.bl[1]),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fill())}},{key:"getMinBoundingBox",value:function getMinBoundingBox(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=this.state.localOrigin[0],n=this.state.localOrigin[1],i=this.state.width,r=this.state.height,e=new Hi([0-e,0-n,0-e+i,0-n,0-e,0-n+r,0-e+i,0-n+r,0,0]),i=t?this.composeMatrix():this.state.composedMatrix;return e.transform(i)}},{key:"getMaxBoundingBox",value:function getMaxBoundingBox(){var t=(i=(r=this.getMinBoundingBox(0<arguments.length&&void 0!==arguments[0]&&arguments[0])).getMinAndMaxPoint()).minX,e=i.minY,n=i.maxX,i=i.maxY,r=r.centerPoint;return new Hi([t,e,n,e,t,i,n,i,r[0],r[1]])}},{key:"setState",value:function setState(t){Pn(this.state,t),this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"dirty",get:function get(){return this.__dirty},set:function set(t){this.__dirty=t}},{key:"setPosition",value:function setPosition(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new w;this.trigger("BEFORE_MOVE",_objectSpread2(_objectSpread2({},n),{},{left:t,top:e})),this.setState({left:t,top:e}),this.trigger(K,_objectSpread2(_objectSpread2({},n),{},{left:t,top:e}))}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e){var n,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new w;this.parentNode&&(t=(n=transformMat2d([],[t,e],invert([],this.parentNode.state.absoluteLinearMatrix)))[0],e=n[1]),this.setPosition(this.state.left+t,this.state.top+e,_objectSpread2(_objectSpread2({},i),{},{tx:t,ty:e}))}},{key:"setGlobalPosition",value:function setGlobalPosition(t,e){var n,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new w;this.parentNode&&(t=(n=transformMat2d([],[t,e],invert([],this.parentNode.state.absoluteLinearMatrix)))[0],e=n[1]),this.setPosition(t,e,_objectSpread2(_objectSpread2({},i),{},{left:t,top:e}))}},{key:"setGlobalRotate",value:function setGlobalRotate(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteLinearMatrix,t-=Di.calcRotateAngleFromMatrix(e)),this.setState({transform:{rotate:t}})}},{key:"localToGlobal",value:function localToGlobal(t,e){return transformMat2d([],t=[t,e],this.state.composedMatrix)}},{key:"globalToLocal",value:function globalToLocal(t,e){return transformMat2d([],t=[t,e],invert([],this.state.composedMatrix))}},{key:"getRotateAngle",value:function getRotateAngle(){var t=this.state.composedMatrix;return Di.calcRotateAngleFromMatrix(t)}},{key:"getLocalLeftTop",value:function getLocalLeftTop(){var t=this.getMinBoundingBox(!0),e=t.width,n=t.height;return{left:t.centerX-t.width/2,top:t.centerY-t.height/2,width:e,height:n}}},{key:"containsPoint",value:function containsPoint(t,e){return this.getMinBoundingBox().containsPoint([t,e])}},{key:"destory",value:function destory(){this.trigger(V,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}]);var Fi,Vi,Ui,qi,Ji,Xi,Wi,Gi,Ki,Qi,Zi,Yi,tr,er,nr,t=ICEComponent,h=(_defineProperty$1(t,"instanceCounter",0),_inherits(ICEPath,t),er=_createSuper(ICEPath),_createClass(ICEPath,[{key:"doRender",value:function doRender(){this.dirty&&(this.ctx.beginPath(),this.createPathObject()),this.state.closePath&&this.path2D.closePath(),this.state.fill&&this.ctx.fill(this.path2D),this.state.stroke&&this.ctx.stroke(this.path2D),_get(_getPrototypeOf(ICEPath.prototype),"doRender",this).call(this)}}]),ICEPath),a=(_inherits(ICERect,h),tr=_createSuper(ICERect),_createClass(ICERect,[{key:"createPathObject",value:function createPathObject(){return this.path2D=new Path2D,this.path2D.rect(0-this.state.localOrigin[0],0-this.state.localOrigin[1],this.state.width,this.state.height),this.path2D}}]),ICERect),Nt=(_inherits(ICEGroup,a),Yi=_createSuper(ICEGroup),_createClass(ICEGroup,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEGroup.prototype),"initEvents",this).call(this),this.once(F,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function afterAddHandler(){for(var t=0;t<this.childNodes.length;t++){var e=this.childNodes[t];this.syncChildEvents(e)}}},{key:"syncChildEvents",value:function syncChildEvents(t){t.trigger(H),t.ice=this.ice,t.ctx=this.ice.ctx,t.evtBus=this.ice.evtBus,t.trigger(F)}},{key:"addChild",value:function addChild(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];-1===this.childNodes.indexOf(t)&&((t.parentNode=this).childNodes.push(t),this.dirty=e,this.ice&&(this.syncChildEvents(t),this.ice.dirty=e))}},{key:"addChildren",value:function addChildren(t){for(var e=0;e<t.length;e++){var n=t[e];this.addChild(n,!1)}this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"removeChild",value:function removeChild(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1),this.dirty=e,this.ice&&(this.ice.dirty=e)}},{key:"removeChildren",value:function removeChildren(t){for(var e=0;e<t.length;e++){var n=t[e];this.removeChild(n,!1)}this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"setState",value:function setState(t){Pn(this.state,t),this.dirty=!0,function setRecursively(t){if(t.dirty=!0,t.childNodes&&t.childNodes.length)for(var e=0;e<t.childNodes.length;e++)setRecursively(t.childNodes[e])}(this),this.ice&&(this.ice.dirty=!0)}},{key:"destory",value:function destory(){this.removeChildren(this.childNodes),_get(_getPrototypeOf(ICEGroup.prototype),"destory",this).call(this)}}]),ICEGroup),o=(_inherits(ICEControlPanel,Nt),Zi=_createSuper(ICEControlPanel),_createClass(ICEControlPanel,[{key:"doRender",value:function doRender(){_get(_getPrototypeOf(ICEControlPanel.prototype),"doRender",this).call(this),this.updateControlPositions()}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e,n){_get(_getPrototypeOf(ICEControlPanel.prototype),"moveGlobalPosition",this).call(this,t,e,n),this._targetComponent&&this._targetComponent.moveGlobalPosition(t,e,n)}}]),ICEControlPanel),r=(_inherits(ICEEllipse,h),Qi=_createSuper(ICEEllipse),_createClass(ICEEllipse,[{key:"createPathObject",value:function createPathObject(){return this.path2D=new Path2D,this.path2D.ellipse(this.state.radiusX-this.state.localOrigin[0],this.state.radiusY-this.state.localOrigin[1],this.state.radiusX,this.state.radiusY,this.state.rotation,this.state.startAngle,this.state.endAngle,this.state.counterclockwise),this.path2D.closePath(),this.path2D}},{key:"setState",value:function setState(t){v2(t.radiusX)?v2(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,v2(t.radiusY)?v2(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,_get(_getPrototypeOf(ICEEllipse.prototype),"setState",this).call(this,t)}}]),ICEEllipse),b=(_inherits(ICECircle,r),Ki=_createSuper(ICECircle),_createClass(ICECircle)),ir=(_inherits(ICELinkHook,b),Gi=_createSuper(ICELinkHook),_createClass(ICELinkHook,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICELinkHook.prototype),"initEvents",this).call(this),this.on("mousedown",this.mosueDownHandler,this),this.on("mousemove",this.mosueMoveHandler,this),this.on("mouseup",this.mosueUpHandler,this),this.on(K,this.resizeEvtHandler,this)}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){}},{key:"mosueDownHandler",value:function mosueDownHandler(t){this.evtBus.trigger("HOOK_MOUSEDOWN",new w({target:this}))}},{key:"mosueMoveHandler",value:function mosueMoveHandler(t){this.evtBus.trigger(J,new w({target:this}))}},{key:"mosueUpHandler",value:function mosueUpHandler(t){this.evtBus.trigger(X,new w({target:this}))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(W,new w(t,{position:e})),this.parentNode.trigger(c,new w(t,{position:e})))}}]),ICELinkHook),rr=(_inherits(LineControlPanel,o),Wi=_createSuper(LineControlPanel),_createClass(LineControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=this.controlSize/2;this.startControl=new ir({zIndex:10001001,display:!1,left:-n,top:-n,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"start"}),this.addChild(this.startControl),this.endControl=new ir({zIndex:10001002,display:!1,left:t-n,top:e-n,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"end"}),this.addChild(this.endControl)}},{key:"initEvents",value:function initEvents(){this.on(c,this.resizeEvtHandler,this)}},{key:"enable",value:function enable(){this.setState({display:!0}),this.resume(c),this.showHooks()}},{key:"disable",value:function disable(){this.setState({display:!1}),this.suspend(c),this.hideHooks()}},{key:"updateControlPositions",value:function updateControlPositions(){}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.targetComponent){var e=t.position,n=t.movementX,i=t.movementY,r=(t=this.targetComponent.state).points.length,o=t.points[0][0],s=t.points[0][1],a=t.points[r-1][0],l=t.points[r-1][1],n=(r=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)))[0],i=r[1];switch(e){case"start":o+=n,s+=i;break;case"end":a+=n,l+=i}this.targetComponent.setState({startPoint:[o,s],endPoint:[a,l]})}}},{key:"updatePosition",value:function updatePosition(){var t,e,n;this.targetComponent&&(this.setState({left:0,top:-5,width:3,height:3,transform:{translate:[0,0],scale:[1,1],skew:[0,0],rotate:0}}),t=this.controlSize/2,n=this.targetComponent.state.points.length,e=this.targetComponent.state.points[0],n=this.targetComponent.state.points[n-1],e=[e[0],e[1]],n=[n[0],n[1]],this.startControl.setState({left:e[0]-t,top:e[1]-t}),this.endControl.setState({left:n[0]-t,top:n[1]-t}))}},{key:"targetComponent",get:function get(){return this._targetComponent},set:function set(t){var e=this;this._targetComponent&&this._targetComponent.off(K,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(K,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(V,function(){e.targetComponent=null,e.disable()},this),this.updatePosition()}},{key:"showHooks",value:function showHooks(){this.startControl.setState({display:!0}),this.endControl.setState({display:!0})}},{key:"hideHooks",value:function hideHooks(){this.startControl.setState({display:!1}),this.endControl.setState({display:!1})}}]),LineControlPanel),or=/\s/,sr=/^\s+/,ar=s,lr=u,cr=_,hr=E2,ur=/^[-+]0x[0-9a-f]+$/i,dr=/^0b[01]+$/i,fr=/^0o[0-7]+$/i,pr=parseInt,yr=M2,gr=i,vr=E2,v=n?n.prototype:void 0,mr=v?v.toString:void 0,br=M2,Cr=e.isFinite,_r=Math.min,kr=function createRound$1(t){var r=Math[t];return function(t,e){var n,i;return t=br(t),(e=null==e?0:_r(T2(e),292))&&Cr(t)?(n=(V2(t)+"e").split("e"),i=r(n[0]+"e"+(+n[1]+e)),+((n=(V2(i)+"e").split("e"))[0]+"e"+(+n[1]-e))):r(t)}}("round"),wr=(_inherits(ResizeControl,a),Xi=_createSuper(ResizeControl),_createClass(ResizeControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ResizeControl.prototype),"initEvents",this).call(this),this.on(K,this.resizeEvtHandler,this)}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.parentNode){var e,n=t.quadrant,i=t.movementX,r=t.movementY,o=(e=this.parentNode.state).left,s=e.top,a=e.width,l=e.height,i=(e=transformMat2d([],[i,r],invert([],e.absoluteLinearMatrix)))[0],r=e[1];switch(n){case 1:o-=i,s+=r,a+=2*i,l-=2*r;break;case 2:o+=i,s+=r,a-=2*i,l-=2*r;break;case 3:o+=i,s-=r,a-=2*i,l+=2*r;break;case 4:o-=i,s-=r,a+=2*i,l+=2*r;break;case 5:s+=r,l-=2*r;break;case 6:s-=r,l+=2*r;break;case 7:o+=i,a-=2*i;break;case 8:o-=i,a+=2*i}e={top:s,left:o,width:Math.abs(a),height:Math.abs(l)},this.parentNode.trigger(W,new w(t,{quadrant:n})),this.parentNode.setState(e),this.parentNode.trigger(c,new w(t,{quadrant:n}))}}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new w,i=0<t?1:-1,r=0<e?1:-1,o=(h=this.parentNode.state).localOrigin,s=h.width,a=h.height,l=(t=(h=transformMat2d([],[t,e],invert([],h.absoluteLinearMatrix)))[0],e=h[1],(h=this.state).left),c=h.top,h=h.quadrant,u=this.state.width/2,d=0;"x"===this.state.direction?d=0<(l=0===kr(l+=t)?.5*i:l)+u-o[0]?8:7:"y"===this.state.direction?d=0<(c=0===kr(c+=e)?.5*r:c)+u-o[1]?6:5:"xy"===this.state.direction&&(r=-a/2/(0===kr(r=-s/2)?.5*i:r),0===kr(s/=2)&&(s=.5*i),c+=e=2===h||4==h?r*(l+u-o[0]+t)-(c+u-o[1]):-a/2/s*(l+u-o[0]+t)-(c+u-o[1]),d=0<(l+=t)+u-o[0]?0<c+u-o[1]?4:1:0<c+u-o[1]?3:2),h!==d&&this.parentNode.toggleControlQuadrant(this,d),this.setPosition(l,c,new w(n,{left:l,top:c,tx:t,ty:e,quadrant:d}))}}]),ResizeControl),Pr=(_inherits(RotateControl,b),Ji=_createSuper(RotateControl),_createClass(RotateControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(RotateControl.prototype),"initEvents",this).call(this),this.on(K,this.rotateEvtHandler,this)}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteOrigin,t={transform:{rotate:Di.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger("BEFORE_ROTATE",new w(t)),this.parentNode.setState(t),this.parentNode.trigger(G,new w(t)))}}]),RotateControl),xr=(_inherits(TransformControlPanel,o),qi=_createSuper(TransformControlPanel),_createClass(TransformControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=t/2,i=e/2,r=this.resizeControlSize/2,o=[{direction:"xy",quadrant:2,position:[-r,-r]},{direction:"y",quadrant:5,position:[n-r,-r]},{direction:"xy",quadrant:1,position:[t-r,-r]},{direction:"x",quadrant:8,position:[t-r,i-r]},{direction:"xy",quadrant:4,position:[t-r,e-r]},{direction:"y",quadrant:6,position:[n-r,e-r]},{direction:"xy",quadrant:3,position:[-r,e-r]},{direction:"x",quadrant:7,position:[-r,i-r]}];this.resizeControlInstanceCache=[];for(var s=0;s<o.length;s++){var a=new wr({zIndex:10000002,display:!1,left:(a=o[s]).position[0],top:a.position[1],width:this.resizeControlSize,height:this.resizeControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1},direction:a.direction,quadrant:a.quadrant});this.addChild(a),this.resizeControlInstanceCache.push(a)}t=this.state.width/2-this.rotateControlSize,n=-this.rotateControlffsetY,this.rotateControlInstance=new Pr({zIndex:10000003,display:!1,left:t,top:n,radius:this.rotateControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1}}),this.addChild(this.rotateControlInstance)}},{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(TransformControlPanel.prototype),"initEvents",this).call(this),this.on(c,this.resizeEvtHandler,this),this.on(G,this.rotateEvtHandler,this),this.on("keydown",this.keyboardEvtHandler,this),this.on("keyup",this.keyboardEvtHandler,this)}},{key:"enable",value:function enable(){this.rotateControlInstance.setState({display:!0});for(var t=0;t<this.resizeControlInstanceCache.length;t++)this.resizeControlInstanceCache[t].setState({display:!0});this.setState({display:!0}),this.resume(c),this.resume(G),this.resume("keydown"),this.resume("keyup")}},{key:"disable",value:function disable(){this.rotateControlInstance.setState({display:!1});for(var t=0;t<this.resizeControlInstanceCache.length;t++)this.resizeControlInstanceCache[t].setState({display:!1});this.setState({display:!1}),this.suspend(c),this.suspend(G),this.suspend("keydown"),this.suspend("keyup")}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){this.targetComponent&&this.targetComponent.trigger(t.type,t,{component:this.targetComponent})}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.targetComponent&&(e=this.state.transform.rotate,this.targetComponent.setGlobalRotate(e),this.targetComponent.trigger(G))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.targetComponent){var e=t.quadrant,n=t.movementX,i=t.movementY,r=(t=this.targetComponent.state).left,o=t.top,s=t.width,a=t.height,n=(t=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)))[0],i=t[1];switch(e){case 1:r-=n,o+=i,s+=2*n,a-=2*i;break;case 2:r+=n,o+=i,s-=2*n,a-=2*i;break;case 3:r+=n,o-=i,s-=2*n,a+=2*i;break;case 4:r-=n,o-=i,s+=2*n,a+=2*i;break;case 5:o+=i,a-=2*i;break;case 6:o-=i,a+=2*i;break;case 7:r+=n,s-=2*n;break;case 8:r-=n,s+=2*n}this.targetComponent.setState({left:r,top:o,width:Math.abs(s),height:Math.abs(a)}),this.targetComponent.trigger(c)}}},{key:"updateControlPositions",value:function updateControlPositions(){for(var t=this.state.width,e=this.state.height,n=t/2,i=e/2,r=this.resizeControlSize/2,o=0;o<this.resizeControlInstanceCache.length;o++){var s=this.resizeControlInstanceCache[o],a=[0,0];switch(s.state.quadrant){case 1:a=[t-r,-r];break;case 2:a=[-r,-r];break;case 3:a=[-r,e-r];break;case 4:a=[t-r,e-r];break;case 5:a=[n-r,-r];break;case 6:a=[n-r,e-r];break;case 7:a=[-r,i-r];break;case 8:a=[t-r,i-r]}s.setState({left:a[0],top:a[1]})}var l=this.state.width/2-this.rotateControlSize,c=-this.rotateControlffsetY;this.rotateControlInstance.setState({left:l,top:c})}},{key:"updatePanel",value:function updatePanel(){var t,e,n,i,r;this.targetComponent&&(t=this.targetComponent.getRotateAngle(),e=(r=this.targetComponent.getLocalLeftTop()).left,n=r.top,i=r.width,r=r.height,this.setState({left:e,top:n,width:i,height:r,transform:{rotate:t}}))}},{key:"targetComponent",get:function get(){return this._targetComponent},set:function set(t){var e=this;this._targetComponent&&this._targetComponent.off(K,this.updatePanel,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(K,this.updatePanel,this),this._targetComponent&&this._targetComponent.once(V,function(){e.targetComponent=null,e.disable()},this),this.updatePanel()}},{key:"toggleControlQuadrant",value:function toggleControlQuadrant(t,e){for(var n=0;n<this.resizeControlInstanceCache.length;n++){var i=this.resizeControlInstanceCache[n];if(i.state.quadrant===e){var r=0;switch(e){case 1:r=3;break;case 2:r=4;break;case 3:r=1;break;case 4:r=2;break;case 5:r=6;break;case 6:r=5;break;case 7:r=8;break;case 8:r=7}i.setState({quadrant:r})}}t.setState({quadrant:e})}}]),TransformControlPanel),Er=(_createClass(ICEControlPanelManager,[{key:"start",value:function start(){return this.ice.evtBus.on("mousedown",this.mouseDownHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off("mousedown",this.mouseDownHandler,this),this}},{key:"mouseDownHandler",value:function mouseDownHandler(t){if(!(t=t.target).ice||!t.state.interactive||!t.state.transformable)return this.lineControlPanel.disable(),void this.transformControlPanel.disable();t&&(t.isControlPanel||t.parentNode&&t.parentNode.isControlPanel)||(this.ice.selectionList=[t],this.lineControlPanel.disable(),this.transformControlPanel.disable(),t.isLine?(this.lineControlPanel.targetComponent=t,this.lineControlPanel.enable()):(this.transformControlPanel.targetComponent=t,this.transformControlPanel.enable()))}}]),ICEControlPanelManager),Sr=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dblclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],Or=[["keydown","ICE_KEYDOWN"],["keyup","ICE_KEYUP"]],jr=(_createClass(DOMEventDispatcher,[{key:"start",value:function start(){for(var i=this,r=null,o=[].concat(_toConsumableArray(Sr),_toConsumableArray(Or)),t=0;t<o.length;t++)!function fk(t){var e=(t=o[t])[0],n=t[1];i.ice.evtBus.on(n,function(t){i._stopped||((r="ICE_MOUSEMOVE"!==n&&-1===n.indexOf("KEY")?i.findTargetComponent(t):r)&&(t.target=r).trigger(e,t),i.ice.evtBus.trigger(e,t,{component:r}))})}(t);return this}},{key:"stopped",get:function get(){return this._stopped},set:function set(t){this._stopped=t}},{key:"findTargetComponent",value:function findTargetComponent(t){if(this._stopped)return null;var e=t.offsetX,n=t.offsetY,i=(t=flattenTree([],this.ice.childNodes),flattenTree([],this.ice.toolNodes)),r=[].concat(_toConsumableArray(t),_toConsumableArray(i));r.sort(function(t,e){return t.state.zIndex-e.state.zIndex});for(var o=0;o<r.length;o++){var s=r[o],a=(l=s.state).interactive,l=l.display;s.containsPoint(e,n)&&a&&l&&this.selectionCandidates.push(s)}return t=this.selectionCandidates.pop(),this.selectionCandidates=[],t}}]),DOMEventDispatcher),Ir={evtBuses:[],start:function start(){if(k&&k.addEventListener){function Bk(t){for(var n=Ir.evtBuses[t],i=[].concat(_toConsumableArray(Sr),_toConsumableArray(Or)),e=0;e<i.length;e++)!function Gk(t){var e=i[t];k.addEventListener(e[0],function(t){n.trigger(e[1],t)})}(e)}for(var t=0;t<Ir.evtBuses.length;t++)Bk(t)}},regitserEvtBus:function regitserEvtBus(t){Ir.evtBuses.includes(t)||Ir.evtBuses.push(t)},delEvtBus:function delEvtBus(t){Ir.evtBuses.includes(t)&&Ir.evtBuses.splice(Ir.evtBuses.indexOf(t),1)}},$r=(_inherits(EventBus,l),Ui=_createSuper(EventBus),_createClass(EventBus)),Mr=(_createClass(GeoLine,[{key:"contains",value:function contains(t,e){var n=Math.hypot(this.endPoint.x-this.startPoint.x,this.endPoint.y-this.startPoint.y),i=Math.hypot(t-this.startPoint.x,e-this.startPoint.y);return n-3<=i+(t=Math.hypot(t-this.endPoint.x,e-this.endPoint.y))&&i+t<=n+3}}]),GeoLine),$=(_createClass(GeoPoint,[{key:"equals",value:function equals(t){return this.x==t.x&&this.y==t.y}},{key:"clone",value:function clone(){return new GeoPoint(this.x,this.y)}}],[{key:"load",value:function load(t){return new GeoPoint(Number(t.x),Number(t.y))}},{key:"cloneArray",value:function cloneArray(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n].clone());return e}}]),GeoPoint),f=(_inherits(ICEDotPath,h),Vi=_createSuper(ICEDotPath),_createClass(ICEDotPath,[{key:"calcComponentParams",value:function calcComponentParams(){if(!this.dirty)return{width:this.state.width,height:this.state.height};this.calcDots();var t=this.calc4VertexPoints(),e=Math.abs(t[1][0]-t[0][0]),t=Math.abs(t[2][1]-t[0][1]);return this.state.width=e,this.state.height=t,{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function calcLocalOrigin(){for(var t=_get(_getPrototypeOf(ICEDotPath.prototype),"calcLocalOrigin",this).call(this),e=0;e<this.state.dots.length;e++){var n=transformMat2d([],this.state.dots[e],[1,0,0,1,-t[0],-t[1]]);this.state.dots[e]=n}return t}},{key:"createPathObject",value:function createPathObject(){this.path2D=new Path2D,this.path2D.moveTo(this.state.dots[0][0],this.state.dots[0][1]);for(var t=1;t<this.state.dots.length;t++){var e=this.state.dots[t];this.path2D.lineTo(e[0],e[1])}return this.path2D}},{key:"calcDots",value:function calcDots(){return this.state.dots=[],this.state.dots}},{key:"calc4VertexPoints",value:function calc4VertexPoints(){for(var t=this.state.dots[0][0],e=this.state.dots[0][1],n=this.state.dots[0][0],i=this.state.dots[0][1],r=1;r<this.state.dots.length;r++){var o=this.state.dots[r];o[0]<t&&(t=o[0]),o[0]>n&&(n=o[0]),o[1]<e&&(e=o[1]),o[1]>i&&(i=o[1])}return[[t,e],[n,e],[t,i],[n,i]]}},{key:"getTransformedDots",value:function getTransformedDots(){for(var t=this.state.composedMatrix,e=this.state.dots,n=[],i=0;i<e.length;i++){var r=transformMat2d([],e[i],t);n.push(r)}return n}}]),ICEDotPath),d=(_inherits(ICEImage,t),Fi=_createSuper(ICEImage),_createClass(ICEImage,[{key:"doRender",value:function doRender(){var t,e;this.state.src&&(t=(e=this.ice.imageCache.setImage(this.state.src)).loaded,e=e.image,t&&this.ctx.drawImage(e,0-this.state.localOrigin[0],0-this.state.localOrigin[1],this.state.width,this.state.height)),_get(_getPrototypeOf(ICEImage.prototype),"doRender",this).call(this)}}]),ICEImage);function ICEImage(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEImage),Fi.call(this,_objectSpread2({width:100,height:100,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALkAAAC2CAYAAACF+yyJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAtoSURBVHhe7Z3tj15FHYb9VxUVo7zFUBWC8YXoF9++GENMRAWRKAkxGj8pihpjFBVF1CBlKaUU+wK0pYVqt12fn+6xs7PXnDPzO3O2Z+a5r+T6ss995nm2vXf3vM68570vXNuTsmdVctm9KrnsXpVcdq9KLrtXJZfdq5LL7lXJZfeq5LJ7VXLZvSq57F6VXHavSi67VyWX3auSy+5VyWX3quSye1Vy2b0quexelVx2r0ouu1cll92rksvuVcll96rksntVctm9KrnsXpVcdq9KLrtXJZfdq5LL7lXJZfeq5LJ7VfIjcIy7j/M2sp4q+YKWQNvLOqrkC+nhodO7OJacp0q+gHO4/2UVvbYqeWXH+O2lG3sf29nd++Eb1/e/wtC40q9KXtGfX+Dy3v4PzpspKCt9quQVJSgXS1BO+lTJK0pQLvab/zz8F+CjL3FWlquSV/KBE7v79bwJ5VISlJPlquSV/AXsj1MuJUE5Wa5KXsmfvKWSr1WVvJJ2BiWGciljLm/2figny1XJK0pQLvbS4d15zEmfKnlFicfPXsdsKEE56VMlr+hdx7mwqV2P75/ji0dvboahvPSpkle2BjSu9KuSL+AcaDw5T5V8IT3QOHK+KvmCni/oOm0v66iSO/zz5Rv71cwr56Nn+ADzmUs3MB8bQq/LcVVyhzHvg0wsQbnYmCfPTZ+SlAdVyQv92mm4crPhzokHkgnKhaagrEyrkjtM8eAr6UfXCMoNpqCsHFcld5rC7g3PzVPOTPHZkR8imbbpkqeg7BKm+NXFw0Un4swH4CavgTuOaH6Wd/gYGbOt2GTJc8k5IJxrileuHjxzQoSv37uTHutWfh8x9zU4m0BTJd959+apu1z+tdmExgoN+euVvNN6oSnCe1aI4bUvneKDWWPI5PrhFw++F2VC6dG7HGistdpMyc/9u7zgA/bfSGMOxlBmyhT2qVOv29efSNykZYTj5xrz2Jn0KcdvOQs+QGOu0SZKbn+u5/LAyJ/ZGO/uQSnPvp3+waXxc4x57nL6L9Ncnh0Ze002UfIUlDVTUNYkKJdjDWjcHD938vBuD+XMFJQ1U1B2ba6+5HZWgaBsKPFwhdN7Oc6BxsuVoJxJUC6UuJi4V35Nrr7kBOVIYk6uRA80TonEnBxJUG5NquQbbZLNGMqVWgJtX2rMcNA7lTMoR9JRBOXWZHMlt4d+KUc+VTBNRIydzaFcqTnQdqXeVjBbAEE5ki5YUW5NNlfy+CLLmN876y+5QTmPYyc/Ke+RoJxJUC5lDGXWpHZX9iUo55WgnFeCciZBOfL5K4d/ZCm3JlXyfR+BBxso55WgnFeCciZBOZKg3Jpcfcl/nJiwnrKhqWt5x3byLwr98kK9BxQIynmNscn+KWemoGxo6uIVZdfk6ktupqCseW1sJ3gf2o6gnEeCch4vwPCUy4G2M/8OuykGZddmEyW3ZUjG+PSJ3f9etr+eUe6Y8H2I8PU5EpTzSISv0370FF8+tbv38c1fA/oBCgnfZ602UXJzSexGJXsPe7A4Jv4cXgnKeSTs6zXu+Rkj/hxrtZmSm15yt6Xc11+vc/80QTmPMXb7Qg60bS7xZ1izTZXcLLmn/Orm/zrc1vubLRzDK0G5Un9zsXxXxB7GDsewSUlLCLdtweZKPjh2f/m7Ublj/zhyiytBY5RKUK7UEuy7pjEGfwZXiENomxZstuQ1zIW2LfE1ezwpAeVLzIW23Ra3uuSDOdB2U9rzkDn8yfnwQQ73ahU5/SYv4Y3NJjQO6eGDI4vahqYmOBpjm5dM3KqSp66elnL3yPQQNaBxB2twttIdlq3YfcmXJHyfF96ZPpgdzvb84HzeD1s4/pJ8pvNJi7or+e8Lz5wQdrXPxqIFaGNy/zbEn9PM4W8ZVyvte7bxPhRNR+Hh7YL79Vuxq5J7ic+nx6ZmlcqBxoudA403+LuJ2yHGoPFadWtL/qnNb2kaY8wShlsFch2bIo6gMcYsvRBmD5zQOC26NSWvdbD1/oky2k1itF2uT8Py5SHfrVS+qYNw2qZVuyq5FSDkngVPmxGU80pQrpYhdqsyZVq1uwPPo5KgnFeCcnJaldwpQTmvBOXktCq5U4JyXgnKyWlVcqcE5bwSlJPTquROCcp5JSgnp1XJnRKU80pQTk6rkjslKOeVoJycViV3SlDOK0E5Oa1K7pSgnFeCcnJaldwpQTmvBOXktF2VPL6sP/Zww1wJynklKFfLkKm7Mluzq5KPUesGram7Be3mVtou119PTDGhG7TK3ZqSx3xy4VttHx1ZWpC05ztLoDHG1K22nehl6mkYPTTRtt0deP6hwuNvX3z1f7/l7bf9FLmTjMaf08zBVoiewiZLsvFqPP4WriLdi92VPPQoJ7zMeZB5WAJdDzIfrV2XPLbWlBR3aUqKptyqkseWcqagHB40udAybnXJB3Og7ab8ROY0cXaASNtPmXM4oGni9Js8C9q2xFOa8POW2mzJbdchhZ3yo20GS8/A0BilEpQrtQT7rmmMQVsIbAzapgWbK/lLmoT/gJ5J+L/62sGzKY/B8o5jhNu2YFMl95K7LeVaXE7lG6/nlZa2zSX+DGu2mZIvyTDbFV0hjD+HV4JyHgn7+lFeJ1izTZQ8Z4lDuzqpJQ5vEr6ec9U05guv7u7d//Lu3lsTPyfh+6zVJkqegrLmyDHp/6HtCMp5JCjn8SgWq039oFB2ba6+5LWXHS9ZjrvlZceP7XDOTEHZ0NRZKcquydWXnKAcSVDOfATOMFDOK0E5rwTlTIJyJEG5NamS70tQzitBOa8E5UyCcuRzlw//Nqfcmmyu5Ceu5l8Ctxv/YyhnEpTzOHZCj/IeCcqZBOVSxlBmTTZX8pLlPmjxVcqZMbYYLuVKzYG2K5XmTaecSVCOLHmftajdlY12qiyGcqWWQNuXGmM7Fjk5g3IkHXpSbk2q5AW5Ej3QOCUSc3IkQbk1ufqS33Hc9w9LfDuxjg9BuVznQOPlSlDOJCgXStg5esquydWX3ExBWTMFZU2CcjnWgMbN8fMn83e7UlDWTEHZtdlEyUtXRiPGpqCIsXs+KDdlKc+PXG6n8XOMsVN+lDPnYldBady12UTJTVvX3kvqAGwwhjJTphjem7CvP3EufYIxHD/XmO+MzP9iN6bNgcZco82U3Bx7wibF1AMUZshfRn7zpUxxJXhvYnjtK6fSj8kNmVzvjI5hKBP6sLPoNNZabarkg7l4dztKTHEyumhFhK8f20kX/VZ+HzH23Cptv2abLPlgCsouYQqbzzAnG2duHzn2+MiLB7NLaWt4Ekfxg7aUTZf8VpoitQ9MUM5M4VkqXarkLlM8ODITFUG5wRSUleOq5IWmJvaxAz7KDxKUC01BWZlWJXcYcxtkYgnKxcY8ea7egxzbokruMLynml6PtbnKiWcyZ84KodfluCr5gp5P73EcgraXdVTJF9IDjSPnq5Iv4BxoPDlPlbyyNaBxpV+VvKK2pCJxaZeL+zg8g2q8uRmG8tKnSl5RImdJQoJy0qdKXlGCcrEX4foS5aRPlbySdHMV5VLGlMxKIMdVySv504LpL0iCcrJclbyStEoD5VISlJPlquSVpIVtKZeSoJwsVyWvKEG5WHrWcpuXJKytSl5RgnKxBOWkT5W8ok8nVk+zNe8pb6agrPSpkld2DLu11hYB+NHE8uc0rvSrki/gHO5r8Gn4tauSL6SHh06r4Euoki9oCbS9rKNKfgSOcY9OFS6uSi67VyWX3auSy+5VyWX3quSye1Vy2b0quexelVx2r0ouu1cll92rksvuVcll96rksntVctm9KrnsXpVcdq9KLrtXJZfdq5LL7lXJZfeq5LJ7VXLZvSq57F6VXHavSi67VyWX3auSy+5VyWX3quSye1Vy2b0quezca3v/AeMnvtkH1pHJAAAAAElFTkSuQmCC"},t))}function ICEDotPath(t){return _classCallCheck(this,ICEDotPath),Vi.call(this,_objectSpread2({dots:[],closePath:!0},t))}function GeoPoint(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;_classCallCheck(this,GeoPoint),this.x=t,this.y=e}function GeoLine(t,e){_classCallCheck(this,GeoLine),this.startPoint=t,this.endPoint=e}function EventBus(){return _classCallCheck(this,EventBus),Ui.call(this)}function DOMEventDispatcher(t){_classCallCheck(this,DOMEventDispatcher),_defineProperty$1(this,"selectionCandidates",[]),_defineProperty$1(this,"_stopped",!1),this.ice=t}function ICEControlPanelManager(t){_classCallCheck(this,ICEControlPanelManager),this.ice=t,this.transformControlPanel=new xr({left:500,top:100,width:100,height:100,style:{strokeStyle:"#8b0000",fillStyle:"rgba(255, 255, 49, 0.2)",lineWidth:1},transform:{rotate:45}}),this.ice.addTool(this.transformControlPanel),this.transformControlPanel.disable(),this.lineControlPanel=new rr({left:700,top:50,width:100,height:100,style:{strokeStyle:"rgba(255, 255, 49, 0)",fillStyle:"rgba(255, 255, 49, 0)",lineWidth:1}}),this.ice.addTool(this.lineControlPanel),this.lineControlPanel.disable()}function TransformControlPanel(t){return _classCallCheck(this,TransformControlPanel),_defineProperty$1(_assertThisInitialized(t=qi.call(this,_objectSpread2(_objectSpread2({},t),{},{zIndex:10000001,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"rotateControlSize",8),_defineProperty$1(_assertThisInitialized(t),"rotateControlffsetY",60),_defineProperty$1(_assertThisInitialized(t),"resizeControlInstanceCache",[]),_defineProperty$1(_assertThisInitialized(t),"resizeControlSize",16),t.initControls(),t}function RotateControl(t){return _classCallCheck(this,RotateControl),Ji.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))}function ResizeControl(t){return _classCallCheck(this,ResizeControl),Xi.call(this,_objectSpread2(_objectSpread2({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}function LineControlPanel(t){return _classCallCheck(this,LineControlPanel),_defineProperty$1(_assertThisInitialized(t=Wi.call(this,_objectSpread2(_objectSpread2({},t),{},{zIndex:10001e3,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"controlSize",16),t.initControls(),t}function ICELinkHook(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkHook),Gi.call(this,_objectSpread2({linkable:!1},t))}function ICECircle(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICECircle),(t=_objectSpread2({radius:10},t)).radiusX=t.radius,t.radiusY=t.radius,Ki.call(this,t)}function ICEEllipse(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEEllipse),(t=_objectSpread2({radiusX:20,radiusY:10,rotation:0,startAngle:0,endAngle:2*Math.PI,counterclockwise:!0},t)).width=2*t.radiusX,t.height=2*t.radiusY,Qi.call(this,t)}function ICEControlPanel(t){return _classCallCheck(this,ICEControlPanel),_defineProperty$1(_assertThisInitialized(t=Zi.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))),"isControlPanel",!0),t}function ICEGroup(t){return _classCallCheck(this,ICEGroup),_defineProperty$1(_assertThisInitialized(t=Yi.call(this,t)),"parentNode",null),_defineProperty$1(_assertThisInitialized(t),"childNodes",[]),t}function ICERect(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICERect),tr.call(this,_objectSpread2({width:10,height:10},t))}function ICEPath(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEPath),_defineProperty$1(_assertThisInitialized(t=er.call(this,_objectSpread2({closePath:!0},t))),"path2D",new Path2D),t}function ICEComponent(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEComponent),_defineProperty$1(_assertThisInitialized(t=nr.call(this)),"__dirty",!0),_defineProperty$1(_assertThisInitialized(t),"props",{id:"ICE_"+function uuid(){if(k.crypto)return k.crypto.randomUUID();var n=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"==t?e:3&e|8).toString(16)})}(),left:0,top:0,width:0,height:0,style:{fillStyle:"red",strokeStyle:"blue",lineWidth:1},fill:!0,stroke:!0,animations:{},transform:{translate:[0,0],scale:[1,1],skew:[0,0],rotate:0},linearMatrix:[],composedMatrix:[],origin:"localCenter",localOrigin:[0,0],absoluteOrigin:[0,0],zIndex:ICEComponent.instanceCounter++,display:!0,draggable:!0,transformable:!0,interactive:!0,linkable:!0,showMinBoundingBox:!1,showMaxBoundingBox:!1}),_defineProperty$1(_assertThisInitialized(t),"state",{}),t.props=Pn(t.props,e),t.state=_c(t.props),t.root=k,t.initEvents(),t}_createClass(function ICEBezier(){_classCallCheck(this,ICEBezier)});_inherits(ICELinkSlot,b),Tr=_createSuper(ICELinkSlot),_createClass(ICELinkSlot,[{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){}},{key:"destory",value:function destory(){this.hostComponent=null,_get(_getPrototypeOf(ICELinkSlot.prototype),"destory",this).call(this)}},{key:"updatePosition",value:function updatePosition(){var t=this._hostComponent.getMinBoundingBox(),e=0,n=0;switch(this.state.position){case"T":e=t.tc[0]-this.state.radius,n=t.tc[1]-this.state.radius;break;case"R":e=t.rc[0]-this.state.radius,n=t.rc[1]-this.state.radius;break;case"B":e=t.bc[0]-this.state.radius,n=t.bc[1]-this.state.radius;break;case"L":e=t.lc[0]-this.state.radius,n=t.lc[1]-this.state.radius}this.setState({left:e,top:n})}},{key:"hostComponent",get:function get(){return this._hostComponent},set:function set(t){var e=this;this._hostComponent&&this._hostComponent.off(D,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(D,this.updatePosition,this),this._hostComponent&&this._hostComponent.once(V,function(){e._hostComponent=null,e.setState({display:!1})},this),this._hostComponent&&this.setState({display:!0})}}]);var Ar,Br,Lr,Tr,zr,Rr=ICELinkSlot,Nr=(_inherits(ICEPolyLine,f),Lr=_createSuper(ICEPolyLine),_createClass(ICEPolyLine,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEPolyLine.prototype),"initEvents",this).call(this),this.once(F,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function afterAddHandler(t){this.evtBus.once(U,this.syncConnections,this)}},{key:"syncConnections",value:function syncConnections(){this.removeLink("start"),this.removeLink("end");var t=this.state.links;t&&(t.start&&t.start.id&&t.start.position&&this.createLink(t.start.id,t.start.position),t.end&&t.end.id&&t.end.position&&this.createLink(t.end.id,t.end.position)),this.dirty=!0,this.ice.dirty=!0}},{key:"createLink",value:function createLink(t,e){(t=this.ice.findComponent(t))&&t.on(K,this.followComponent,this),t&&t.on(c,this.followComponent,this),t&&t.on(G,this.followComponent,this),t&&t.once(D,this.followComponent,this),t&&this.followComponent(),this.state.draggable=!1}},{key:"removeLink",value:function removeLink(t,e,n){var i;this.state.links&&this.state.links[t]&&(i=this.state.links[t].id,t=this.state.links[t].position,n=n||t,i===(e=e||i)&&t===n&&((e=this.ice.findComponent(i))&&e.off(K,this.followComponent,this),e&&e.off(c,this.followComponent,this),e&&e.off(G,this.followComponent,this)),t=!0,this.state.links.start&&this.state.links.start.id&&(t=!1),this.state.links.end&&this.state.links.end.id&&(t=!1),this.state.draggable=t)}},{key:"getLinkFromId",value:function getLinkFromId(){return this.state.links.start.id}},{key:"getLinkToId",value:function getLinkToId(){return this.state.links.end.id}},{key:"followComponent",value:function followComponent(t){for(var e in this.state.links)if(this.state.links[e]&&this.state.links[e].id&&this.state.links[e].position){var n=this.state.links[e].id,i=this.state.links[e].position;if(n=this.ice.findComponent(n)){var r=n.getMinBoundingBox(),o=[0,0];switch(i){case"T":o=r.tc;break;case"R":o=r.rc;break;case"B":o=r.bc;break;case"L":o=r.lc}switch(e){case"start":this.setState({startPoint:_toConsumableArray(o)});break;case"end":this.setState({endPoint:_toConsumableArray(o)})}}}}},{key:"calcLocalOrigin",value:function calcLocalOrigin(){return this.state.localOrigin=[0,0]}},{key:"calcDots",value:function calcDots(){var t=this.state.left,e=this.state.top;this.state.dots=[];for(var n=0;n<this.state.points.length;n++){var i=(r=this.state.points[n])[0]-t,r=r[1]-e;this.state.dots.push([i,r])}return this.calcArrowPoints(),this.state.dots}},{key:"calcArrowPoints",value:function calcArrowPoints(){var t,e,n;"start"!==this.state.arrow&&"both"!==this.state.arrow||(n=_toConsumableArray(this.state.dots[0]),e=[_toConsumableArray(this.state.dots[0]),_toConsumableArray(this.state.dots[1])],e=this.doCalcArrowPoints(e),(t=this.state.dots).unshift.apply(t,_toConsumableArray(e)),this.state.dots.unshift(_toConsumableArray(n))),"end"!==this.state.arrow&&"both"!==this.state.arrow||(t=this.state.dots.length,e=_toConsumableArray(this.state.dots[t-1]),n=[_toConsumableArray(this.state.dots[t-1]),_toConsumableArray(this.state.dots[t-2])],n=this.doCalcArrowPoints(n),(t=this.state.dots).push.apply(t,_toConsumableArray(n)),this.state.dots.push(_toConsumableArray(e)))}},{key:"doCalcArrowPoints",value:function doCalcArrowPoints(t){var e=t[0],n=((t=t[1])[0]=t[0]-e[0],t[1]=t[1]-e[1],t[0]/Math.hypot.apply(Math,_toConsumableArray(t))),i=(t=t[1]/Math.hypot.apply(Math,_toConsumableArray(t)),Math.cos(this.state.arrowAngel)),r=Math.sin(this.state.arrowAngel),o=this.state.arrowLength*(n*i-t*r),s=this.state.arrowLength*(t*i+n*r),a=this.state.arrowLength*(n*i+t*r);return t=this.state.arrowLength*(t*i-n*r),[[o+=e[0],s+=e[1]],[a+=e[0],t+=e[1]]]}},{key:"addDot",value:function addDot(t,e){this.state.points.splice(e,0,t),this.state.dots.splice(e,0,[t[0],t[1]])}},{key:"rmDot",value:function rmDot(t){return!(this.state.points.length<3||(this.state.points.splice(t,1),this.state.dots.splice(t,1),0))}},{key:"calcComponentParams",value:function calcComponentParams(){if(!this.dirty)return{width:this.state.width,height:this.state.height};this.calcDots();var t=this.calc4VertexPoints(),e=Math.abs(t[1][0]-t[0][0]),n=this.state.style.lineWidth;return this.isDotsOnSameLine()||(n=Math.abs(t[2][1]-t[0][1])),this.state.width=e,this.state.height=n,{width:this.state.width,height:this.state.height}}},{key:"isDotsOnSameLine",value:function isDotsOnSameLine(){for(var t,e=this.state.points.length,n=kr(this.state.points[0][0],2),i=kr(this.state.points[0][1],2),r=0,o=[kr(this.state.points[e-1][0],2)-n,kr(this.state.points[e-1][1],2)-i],s=0;s<e;s++){var a=[(a=this.state.points[s])[0]-n,a[1]-i];0===(a=o[0]*a[1]-o[1]*a[0],(t=[])[0]=t[1]=0,t[2]=a,t[2])&&r++}return r===e}},{key:"calc4VertexPoints",value:function calc4VertexPoints(){return this.isDotsOnSameLine()?this.splitEndpointsTo4Points():_get(_getPrototypeOf(ICEPolyLine.prototype),"calc4VertexPoints",this).call(this)}},{key:"splitEndpointsTo4Points",value:function splitEndpointsTo4Points(){var t=this.state.points.length,e=this.state.points[t-1][0]-this.state.points[0][0],n=(t=this.state.points[t-1][1]-this.state.points[0][1],this.getRotateAngle()),i=this.state.height,r=Math.cos(n*Math.PI/180)*i/2,n=Math.sin(n*Math.PI/180)*i/2;return[[0+(r=kr(r,3)),0+(n=kr(n,3))],[0-r,0-n],[e+r,t+n],[e-r,t-n]]}},{key:"getMinBoundingBox",value:function getMinBoundingBox(){var t=this.state.localOrigin[0],e=this.state.localOrigin[1],n=this.calc4VertexPoints();return(t=new Hi([n[0][0]-t,n[0][1]-e,n[1][0]-t,n[1][1]-e,n[2][0]-t,n[2][1]-e,n[3][0]-t,n[3][1]-e,0,0])).transform(this.state.composedMatrix)}},{key:"setState",value:function setState(t){if(v2(t.width)||delete t.width,v2(t.height)||delete t.height,v2(t.transform)||delete t.transform,!v2(t.left))for(var e=t.left-this.state.points[0][0],n=0;n<this.state.points.length;n++)this.state.points[n][0]+=e;if(!v2(t.top))for(var i=t.top-this.state.points[0][1],r=0;r<this.state.points.length;r++)this.state.points[r][1]+=i;var o;v2(t.startPoint)||(this.state.points[0]=_toConsumableArray(t.startPoint),this.state.left=this.state.points[0][0],this.state.top=this.state.points[0][1]),v2(t.endPoint)||(o=this.state.points.length,this.state.points[o-1]=_toConsumableArray(t.endPoint)),v2(t.links)||(Pn(this.state.links,t.links),this.syncConnections()),_get(_getPrototypeOf(ICEPolyLine.prototype),"setState",this).call(this,t)}},{key:"getRotateAngle",value:function getRotateAngle(){var t,e;return this.isDotsOnSameLine()?(e=this.state.points.length,t=this.state.points[e-1][0]-this.state.points[0][0],e=this.state.points[e-1][1]-this.state.points[0][1],Di.calcRotateAngle(t,e,0,0)+90):_get(_getPrototypeOf(ICEPolyLine.prototype),"getRotateAngle",this).call(this)}},{key:"containsPoint",value:function containsPoint(t,e){for(var n=this.getLines(),i=0;i<n.length;i++){var r=(a=n[i]).o[0],o=a.o[1],s=a.d[0],a=a.d[1],l=Math.hypot(s-r,a-o);if(l-3<=(r=Math.hypot(r-t,o-e))+(o=Math.hypot(s-t,a-e))&&r+o<=l+3)return!0}return!1}},{key:"getLines",value:function getLines(){var t=[],e=this.getTransformedDots();if(!e||e.length<2)return t;for(var n=0;n<e.length-1;n++){var i={o:[e[n][0],e[n][1]],d:[e[n+1][0],e[n+1][1]]};t.push(i)}return t}},{key:"destory",value:function destory(){this.removeLink("start"),this.removeLink("end"),_get(_getPrototypeOf(ICEPolyLine.prototype),"destory",this).call(this)}}],[{key:"arrangeParam",value:function arrangeParam(t){var e=Pn({},{lineType:"solid",lineWidth:1,arrow:"none",arrowLength:15,arrowAngel:30*En,points:[],showMinBoundingBox:!1,showMaxBoundingBox:!1,links:{},style:{lineJoin:"round"}},t,{linkable:!1,closePath:!1,fill:!1}),n=e.points.length;return n<2&&(0===n?(e.points.push([0,0]),e.points.push([10,10])):1===n&&e.points.push([10,10])),(e=_objectSpread2(_objectSpread2({},e),{left:t.points[0][0],top:t.points[0][1],transform:{translate:[0,0],scale:[1,1],skew:[0,0],rotate:0}})).style.lineWidth<1&&(e.style.lineWidth=1),e}}]),ICEPolyLine),g=(_inherits(ICEVisioLink,Nr),Br=_createSuper(ICEVisioLink),_createClass(ICEVisioLink,[{key:"calcDots",value:function calcDots(){var t=this.interpolate(),e=this.state,n=e.left,i=e.top,r=t[0][2];this.state.points=[],this.state.dots=[];for(var o=0;o<r.length;o++){var s=r[o];this.state.points.push([s.x,s.y]),this.state.dots.push([s.x-n,s.y-i])}return this.calcArrowPoints(),this.state.dots}},{key:"interpolate",value:function interpolate(){var t=this.state.points.length,e=this.state.points[0][0],n=this.state.points[0][1],i=this.state.points[t-1][0],r=(t=this.state.points[t-1][1],new $(e,n)),o=new $(i,t),s=[],a=null,l=null,c=[],h=new Hi,u=new Hi;if(p=this.ice&&this.state.links&&this.state.links.start&&this.state.links.start.id?this.ice.findComponent(this.state.links.start.id):p){h=p.getMinBoundingBox(),s[0]=new $(r.x,h.tl[1]-this.state.escapeDistance),s[1]=new $(h.tr[0]+this.state.escapeDistance,r.y),s[2]=new $(r.x,h.br[1]+this.state.escapeDistance),s[3]=new $(h.tl[0]-this.state.escapeDistance,r.y);for(var a=s[0],d=1;d<s.length;d++)this.distance(r,s[d])<this.distance(r,a)&&(a=s[d])}if(y=this.ice&&this.state.links&&this.state.links.end&&this.state.links.end.id?this.ice.findComponent(this.state.links.end.id):y){u=y.getMinBoundingBox(),s[0]=new $(o.x,u.tl[1]-this.state.escapeDistance),s[1]=new $(u.tr[0]+this.state.escapeDistance,o.y),s[2]=new $(o.x,u.br[1]+this.state.escapeDistance),s[3]=new $(u.tl[0]-this.state.escapeDistance,o.y);for(var l=s[0],f=1;f<s.length;f++)this.distance(o,s[f])<this.distance(o,l)&&(l=s[f])}e=0,n=[r],a&&(n.push(a),e=1),l&&n.push(l),n.push(o),i=$.cloneArray(n),c.push(["s0","s0",i]),t=$.cloneArray(n),(p=$.cloneArray(t)).splice(e+1,0,new $(p[e].x,p[e+1].y)),c.push(["s1","s1_1",p]),(y=$.cloneArray(t)).splice(e+1,0,new $(y[e+1].x,y[e].y)),c.push(["s1","s1_2",y]);var i=$.cloneArray(t),n=new $((i[e].x+i[e+1].x)/2,i[e].y),p=new $((i[e].x+i[e+1].x)/2,i[e+1].y),y=(i.splice(e+1,0,n,p),c.push(["s2","s2_1",i]),$.cloneArray(t));n=new $(y[e].x,(y[e].y+y[e+1].y)/2),p=new $(y[e+1].x,(y[e].y+y[e+1].y)/2),n=[(y.splice(e+1,0,n,p),c.push(["s2","s2_2",y]),(i=$.cloneArray(t))[e].x+20),i[e+1].x+20],h&&n.push(h.br[0]+20),u&&n.push(u.br[0]+20),p=this.max(n),y=new $(p,i[e].y),n=new $(p,i[e+1].y),y=[(i.splice(e+1,0,y,n),c.push(["s2","s2_3",i]),(p=$.cloneArray(t))[e].y-20),p[e+1].y-20],h&&y.push(h.tl[1]-20),u&&y.push(u.tl[1]-20),n=this.min(y),i=new $(p[e].x,n),y=new $(p[e+1].x,n),i=[(p.splice(e+1,0,i,y),c.push(["s2","s2_4",p]),(n=$.cloneArray(t))[e].x-20),n[e+1].x-20],h&&i.push(h.tl[0]-20),u&&i.push(u.tl[0]-20),y=this.min(i),p=new $(y,n[e].y),i=new $(y,n[e+1].y),p=[(n.splice(e+1,0,p,i),c.push(["s2","s2_5",n]),(y=$.cloneArray(t))[e].y+20),y[e+1].y+20],h&&p.push(h.tl[1]+h.height+20),u&&p.push(u.tl[1]+u.height+20),i=this.max(p),n=new $(y[e].x,i),t=new $(y[e+1].x,i),y.splice(e+1,0,n,t),c.push(["s2","s2_6",y]);for(var g=[],v=0;v<c.length;v++){var m=c[v][2];this.orthogonalPath(m)&&g.push(c[v])}if(c=g,!r.equals(o)){for(var b=[],C=0;C<c.length;C++){var _=c[C][2];this.forwardPath(_)&&b.push(c[C])}(c=b).length}for(var k=[],w=0;w<c.length;w++){var P=!1,x=c[w][2].slice();(u||h)&&(x=x.slice(1,x.length-1)),h&&(P=P||this.polylineIntersectsRectangle(x,h)),(P=u?P||this.polylineIntersectsRectangle(x,u):P)||k.push(c[w])}(c=0!=k.length?k:c).length;for(var E=c[0][2].length,S=[],O=0;O<c.length;O++)c[O][2].length==E&&S.push(c[O]);for(var c=S,j=0,I=0;I<c.length;I++)this.scorePath(c[j][2])<this.scorePath(c[I][2])&&(j=I);return[c[j]]}},{key:"orthogonalPath",value:function orthogonalPath(t){if(t.length<=1)return!0;for(var e=0;e<t.length-1;e++)if(t[e].x!=t[e+1].x&&t[e].y!=t[e+1].y)return!1;return!0}},{key:"lineIntersectsLine",value:function lineIntersectsLine(t,e){if(t.startPoint.x==t.endPoint.x&&e.startPoint.x==e.endPoint.x)return t.startPoint.x==e.startPoint.x&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));if(t.startPoint.x==t.endPoint.x||e.startPoint.x==e.endPoint.x)return t.startPoint.x==t.endPoint.x&&(r=t,t=e,e=r),r=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),n=t.startPoint.y-r*t.startPoint.x,i=e.startPoint.x,t.contains(i,r=r*i+n)&&e.contains(i,r);var n=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),i=t.startPoint.y-n*t.startPoint.x,r=(e.endPoint.y-e.startPoint.y)/(e.endPoint.x-e.startPoint.x),o=e.startPoint.y-r*e.startPoint.x;return n==r?i==o&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y)):(r=n*(o=(o-i)/(n-r))+i,t.contains(o,r)&&e.contains(o,r))}},{key:"polylineIntersectsRectangle",value:function polylineIntersectsRectangle(t,e){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=[];i.push(new Mr(new $(e.x1,e.y1),new $(e.x2,e.y1))),i.push(new Mr(new $(e.x2,e.y1),new $(e.x2,e.y2))),i.push(new Mr(new $(e.x2,e.y2),new $(e.x1,e.y2))),i.push(new Mr(new $(e.x1,e.y2),new $(e.x1,e.y1)));for(var r=0;r<t.length-1;r++)for(var o=new Mr(t[r],t[r+1]),s=0;s<i.length;s++)if(this.lineIntersectsLine(o,i[s]))return!0;if(n)for(var a=new Mr(t[t.length-1],t[0]),l=0;l<i.length;l++)if(this.lineIntersectsLine(a,i[l]))return!0;return!1}},{key:"scorePath",value:function scorePath(t){if(t.length<=2)return-1;for(var e=0,n=1;n<t.length-1;n++)if(t[n-1].x==t[n].x&&t[n].x==t[n+1].x){if(this.signum(t[n+1].y-t[n].y)!=this.signum(t[n].y-t[n-1].y))return-1;e++}else if(t[n-1].y==t[n].y&&t[n].y==t[n+1].y){if(this.signum(t[n+1].x-t[n].x)!=this.signum(t[n].x-t[n-1].x))return-1;e++}else e--;return e}},{key:"signum",value:function signum(t){return 0<t?1:t<0?-1:0}},{key:"forwardPath",value:function forwardPath(t){if(t.length<=2)return!0;for(var e=0;e<t.length-2;e++)if(t[e].x==t[e+1].x&&t[e+1].x==t[e+2].x){if(0!=this.signum(t[e+1].y-t[e].y)&&this.signum(t[e+1].y-t[e].y)==-1*this.signum(t[e+2].y-t[e+1].y))return!1}else if(t[e].y==t[e+1].y&&t[e+1].y==t[e+2].y&&0!=this.signum(t[e+1].x-t[e].x)&&this.signum(t[e+1].x-t[e].x)==-1*this.signum(t[e+2].x-t[e+1].x))return!1;return!0}},{key:"distance",value:function distance(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}},{key:"max",value:function max(t){if(0==t.lenght)return NaN;for(var e=t[0],n=0;n<t.length;n++)e<t[n]&&(e=t[n]);return e}},{key:"min",value:function min(t){if(0==t.lenght)return NaN;for(var e=t[0],n=0;n<t.length;n++)e>t[n]&&(e=t[n]);return e}},{key:"addDot",value:function addDot(t,e){throw new Error("Can NOT add dot to ICEVisioLink mannually.")}},{key:"rmDot",value:function rmDot(t){throw new Error("Can NOT remove dot from ICEVisioLink mannually.")}}],[{key:"arrangeParam",value:function arrangeParam(t){return v2(t.startPoint)&&(t.startPoint=[0,0]),v2(t.endPoint)&&(t.endPoint=[10,10]),t.points=[_toConsumableArray(t.startPoint),_toConsumableArray(t.endPoint)],_objectSpread2({escapeDistance:30},t)}}]),ICEVisioLink),i=(_inherits(ICEIsogon,f),Ar=_createSuper(ICEIsogon),_createClass(ICEIsogon,[{key:"calcDots",value:function calcDots(){this.state.dots=[];for(var t=2*Math.PI/this.state.edges,e=this.state.radius,n=0;n<this.state.edges;n++){var i=t*n-toRadian(this.state.startAngle),r=Math.floor(e*Math.cos(i)+e),i=Math.floor(e*Math.sin(i)+e);this.state.dots.push([r,i])}return this.state.dots}},{key:"calcComponentParams",value:function calcComponentParams(){return this.dirty&&(this.calcDots(),this.state.width=2*this.state.radius,this.state.height=2*this.state.radius),{width:this.state.width,height:this.state.height}}},{key:"setState",value:function setState(t){v2(t.radius)?v2(t.width)?v2(t.height)||(t.radius=t.height/2):t.radius=t.width/2:(t.width=2*t.radius,t.height=2*t.radius),_get(_getPrototypeOf(ICEIsogon.prototype),"setState",this).call(this,t)}}]),ICEIsogon);function ICEIsogon(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEIsogon),(t=_objectSpread2({radius:10,edges:3,startAngle:90},t)).edges=Math.floor(3<=t.edges?t.edges:3),t.width=2*t.radius,t.height=2*t.radius,Ar.call(this,t)}function ICEVisioLink(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEVisioLink),t=ICEVisioLink.arrangeParam(t),Br.call(this,t)}function ICEPolyLine(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEPolyLine),t=ICEPolyLine.arrangeParam(t),_defineProperty$1(_assertThisInitialized(t=Lr.call(this,t)),"isLine",!0),t}function ICELinkSlot(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkSlot),Tr.call(this,_objectSpread2({linkable:!1,draggable:!1,position:"T"},t))}function ICERose(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICERose),(t=_objectSpread2({radius:50,leafNum:2,pointNumber:100},t)).leafNum=Math.floor(2<=t.leafNum?t.leafNum:2),t.width=2*t.radius,t.height=2*t.radius,zr.call(this,t)}_inherits(ICERose,f),zr=_createSuper(ICERose),_createClass(ICERose,[{key:"calcDots",value:function calcDots(){var t=this.state.radius,e=this.state.leafNum;this.state.dots=[];for(var n,i,r=Math.PI/this.state.pointNumber,o=0;n=t+t*Math.sin(e*o)*Math.cos(o),i=t+t*Math.sin(e*o)*Math.sin(o),this.state.dots.push([n,i]),!((o+=r)>=2*Math.PI););return this.state.dots}},{key:"calcComponentParams",value:function calcComponentParams(){return this.dirty&&(this.calcDots(),this.state.width=2*this.state.radius,this.state.height=2*this.state.radius),{width:this.state.width,height:this.state.height}}},{key:"setState",value:function setState(t){v2(t.radius)?v2(t.width)?v2(t.height)||(t.radius=t.height/2,t.width=t.height):(t.radius=t.width/2,t.height=t.width):(t.width=2*t.radius,t.height=2*t.radius),_get(_getPrototypeOf(ICERose.prototype),"setState",this).call(this,t)}}]);_inherits(ICEStar,f),Fr=_createSuper(ICEStar),_createClass(ICEStar,[{key:"calcDots",value:function calcDots(){this.state.dots=[];for(var t,e,n=toRadian(this.state.startAngle),i=Math.PI/this.state.spikes,r=this.state.outerRadius,o=this.state.innerRadius,s=0;s<this.state.spikes;s++)t=Math.cos(n)*r+r,e=Math.sin(n)*r+r,this.state.dots.push([t,e]),n+=i,t=Math.cos(n)*o+r,e=Math.sin(n)*o+r,this.state.dots.push([t,e]),n+=i;return this.state.dots}},{key:"calcComponentParams",value:function calcComponentParams(){return this.dirty&&(this.calcDots(),this.state.width=2*this.state.outerRadius,this.state.height=2*this.state.outerRadius),{width:this.state.width,height:this.state.height}}},{key:"setState",value:function setState(t){v2(t.outerRadius)?v2(t.width)?v2(t.height)||(t.outerRadius=t.height/2):t.outerRadius=t.width/2:(t.width=2*t.outerRadius,t.height=2*t.outerRadius),_get(_getPrototypeOf(ICEStar.prototype),"setState",this).call(this,t)}}]);var Dr,Hr,Fr,n=ICEStar,Vr="__ICE_UTILS_TEXT_MEASURE_DIV__",Ur=(_inherits(ICEText,t),Hr=_createSuper(ICEText),_createClass(ICEText,[{key:"calcComponentParams",value:function calcComponentParams(){return this.dirty?this.measureText():{width:this.state.width,height:this.state.height}}},{key:"measureText",value:function measureText(t){var e;try{if(!(e=this.root.document.getElementById(Vr))){(e=this.root.document.createElement("div")).setAttribute("id",Vr);var n,i={visibility:"hidden",position:"absolute",top:"0",left:"0",padding:"0",margin:"0",border:"none",fontFamily:this.state.style.fontFamily,fontWeight:this.state.style.fontWeight,fontSize:this.state.style.fontSize+"px"};for(n in i)e.style[n]=i[n];e.contenteditable=!1,this.root.document.body.appendChild(e)}e.innerHTML=this.state.text;var r=this.state.style,o=r.paddingTop,s=r.paddingBottom,a=r.paddingLeft,l=r.paddingRight,c={width:e.offsetWidth+a+l,height:e.offsetHeight+o+s};return this.props.width=c.width,this.props.height=c.height,this.state.width=c.width,this.state.height=c.height,{width:this.state.width,height:this.state.height}}catch(t){}}},{key:"doRender",value:function doRender(){this.dirty&&this.measureText();var t=this.state.style,e=(t.paddingTop,t.paddingBottom),n=t.paddingLeft;t.paddingRight,this.state.stroke&&this.ctx.strokeText(this.state.text,0-this.state.localOrigin[0]+n,0-this.state.localOrigin[1]+this.state.height-e,this.state.width),this.state.fill&&this.ctx.fillText(this.state.text,0-this.state.localOrigin[0]+n,0-this.state.localOrigin[1]+this.state.height-e,this.state.width),_get(_getPrototypeOf(ICEText.prototype),"doRender",this).call(this)}}],[{key:"arrangeParam",value:function arrangeParam(t){return(t=Pn({text:"",left:0,top:0,width:10,height:10,style:{fontWeight:"bold",fontSize:32,fontFamily:"Arial",lineWidth:1,textBaseline:"bottom",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}},t)).style=_objectSpread2(_objectSpread2({},t.style),{},{font:"".concat(t.style.fontWeight," ").concat(t.style.fontSize,"px ").concat(t.style.fontFamily)}),t}}]),ICEText),qr={ICERect:a,ICECircle:b,ICEEllipse:r,ICEStar:n,ICEIsogon:i,ICEText:Ur,ICEImage:d,ICEGroup:Nt,ICEVisioLink:g,ICEPolyLine:Nr},x={evtBuses:[],stopped:!1,frameCallback:function frameCallback(){for(var t=0;t<x.evtBuses.length;t++){if(x.stopped)return;x.evtBuses[t].trigger(N)}x.stopped||k.requestFrame(x.frameCallback)},start:function start(){x.stopped=!1,k.requestFrame(x.frameCallback)},stop:function stop(){x.stopped=!0},pause:function pause(){},resume:function resume(){},regitserEvtBus:function regitserEvtBus(t){x.evtBuses.includes(t)||x.evtBuses.push(t)},delEvtBus:function delEvtBus(t){x.evtBuses.includes(t)&&x.evtBuses.splice(x.evtBuses.indexOf(t),1)}},Jr=(_createClass(ICELinkSlotManager,[{key:"start",value:function start(){return this.createLinkSlots(),this.ice.evtBus.on(J,this.hookMouseMoveHandler,this),this.ice.evtBus.on(X,this.hookMouseUpHandler,this),this.ice.evtBus.on("mouseup",this.globalMouseUpHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(J,this.hookMouseMoveHandler,this),this.ice.evtBus.off(X,this.hookMouseUpHandler,this),this.ice.evtBus.off("mouseup",this.globalMouseUpHandler,this),this}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){for(var e=t.target,n=e.getMaxBoundingBox(),i=null,r=_toConsumableArray(this.ice.childNodes),o=0;o<r.length;o++){var s=r[o];if(s&&s.state.linkable&&s.getMaxBoundingBox().isIntersect(n)){i=s;break}}if(i)for(var a=0;a<this.ice._linkSlots.length;a++){var l=this.ice._linkSlots[a];l.hostComponent!==i&&(l.hostComponent=i),l.setState({display:!0,style:{fillStyle:"#3ce92c"}}),e.setState({style:{fillStyle:"#3ce92c"}}),l.getMaxBoundingBox().isIntersect(n)&&(l.setState({style:{fillStyle:"#fffb00"}}),e.setState({style:{fillStyle:"#fffb00"}}))}}},{key:"hookMouseUpHandler",value:function hookMouseUpHandler(t){for(var e=(t=t.target).state.position,n=t.parentNode.targetComponent,i=t.getMaxBoundingBox(),r=!1,o=0;o<this.ice._linkSlots.length;o++){var s,a=this.ice._linkSlots[o];a.getMaxBoundingBox().isIntersect(i)&&(r=!0,(s={})[e]={id:a.hostComponent.state.id,position:a.state.position},n&&n.setState({links:s})),a.setState({display:!1,style:{fillStyle:"#3ce92c"}})}r||((t={})[e]=null,n&&n.setState({links:t}))}},{key:"globalMouseUpHandler",value:function globalMouseUpHandler(t){for(var e=0;e<this.ice._linkSlots.length;e++)this.ice._linkSlots[e].setState({display:!1,style:{fillStyle:"#3ce92c"}})}},{key:"createLinkSlots",value:function createLinkSlots(){var t,e,n,i;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new Rr({zIndex:10000010,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"T",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(t),e=new Rr({zIndex:10000011,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"R",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(e),n=new Rr({zIndex:10000012,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"B",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(n),i=new Rr({zIndex:10000013,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"L",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(i),this.ice._linkSlots=[t,e,n,i])}}]),ICELinkSlotManager),Xr=(_createClass(Deserializer,[{key:"fromJSONObject",value:function fromJSONObject(t){for(var e=t.childNodes,n=0;n<e.length;n++)this.decodeRecursively(this.ice,e[n])}},{key:"fromJSONString",value:function fromJSONString(t){t=JSON.parse(t),this.fromJSONObject(t)}},{key:"decodeRecursively",value:function decodeRecursively(t,e){var n=new(this.ice.getType(e.type))(e.state),i=(t.addChild(n),e.childNodes);if(i&&i.length)for(var r=0;r<i.length;r++)this.decodeRecursively(n,i[r])}}]),Deserializer),Wr=(_createClass(Serializer,[{key:"toJSONString",value:function toJSONString(){return JSON.stringify(this.toJSONObject())}},{key:"toJSONObject",value:function toJSONObject(){for(var t={createTime:(new Date).toLocaleString(),lastModifyTime:(new Date).toLocaleString(),childNodes:[]},e=0;e<this.ice.childNodes.length;e++){var n=this.ice.childNodes[e];this.encodeRecursively(n,t)}return t}},{key:"encodeRecursively",value:function encodeRecursively(t,e){var n={state:t.state,type:t.constructor.name,childNodes:[]};if(e.childNodes.push(n),t.childNodes&&t.childNodes.length)for(var i=0;i<t.childNodes.length;i++)this.encodeRecursively(t.childNodes[i],n)}}]),Serializer),Gr=(_inherits(CanvasRenderer,l),Dr=_createSuper(CanvasRenderer),_createClass(CanvasRenderer,[{key:"start",value:function start(){return this.stopped=!1,this.ice.evtBus.on(N,this.frameEvtHandler,this),this}},{key:"stop",value:function stop(){return this.stopped=!0,this.ice.evtBus.off(N,this.frameEvtHandler,this),this}},{key:"frameEvtHandler",value:function frameEvtHandler(t){this.ice.dirty&&this.doRender()}},{key:"refreshQueue",value:function refreshQueue(){this.componentQueue=flattenTree([],this.ice.childNodes),this.componentQueue.sort(function(t,e){return t.state.zIndex-e.state.zIndex}),this.toolsQueue=flattenTree([],this.ice.toolNodes),this.toolsQueue.sort(function(t,e){return t.state.zIndex-e.state.zIndex})}},{key:"doRender",value:function doRender(){this.refreshQueue(),this.ice.ctx.clearRect(0,0,this.ice.canvasWidth,this.ice.canvasHeight);for(var t=0;t<this.componentQueue.length;t++){var e=this.componentQueue[t];e.root=this.ice.root,e.ctx=this.ice.ctx,e.evtBus=this.ice.evtBus,e.ice=this.ice,e.render()}for(var n=0;n<this.toolsQueue.length;n++){var i=this.toolsQueue[n];i.root=this.ice.root,i.ctx=this.ice.ctx,i.evtBus=this.ice.evtBus,i.ice=this.ice,i.render()}this.ice.dirty=!1,this.ice.evtBus.trigger(U)}}]),CanvasRenderer),Kr=(_createClass(ImageCache,[{key:"setImage",value:function setImage(t){var e=this,n=this.imageCache.get(t);return n||((n=new Image).onload=function(){e.ice.dirty=!0},n.onerror=function(){},n.src=t,this.imageCache.size>ImageCache.CACHE_SIZE&&this.imageCache.delete(this.imageCache.keys().next().value),this.imageCache.set(t,n)),{loaded:this.loaded(n),image:n}}},{key:"loaded",value:function loaded(t){return t.complete&&0<t.naturalWidth}}]),ImageCache);function ImageCache(t){_classCallCheck(this,ImageCache),_defineProperty$1(this,"imageCache",new Map),this.ice=t}function CanvasRenderer(t){var e;return _classCallCheck(this,CanvasRenderer),_defineProperty$1(_assertThisInitialized(e=Dr.call(this)),"stopped",!1),_defineProperty$1(_assertThisInitialized(e),"componentQueue",[]),_defineProperty$1(_assertThisInitialized(e),"toolsQueue",[]),e.ice=t,e}function Serializer(t){_classCallCheck(this,Serializer),this.ice=t}function Deserializer(t){_classCallCheck(this,Deserializer),this.ice=t}function ICELinkSlotManager(t){_classCallCheck(this,ICELinkSlotManager),_defineProperty$1(this,"slotRadius",10),this.ice=t}function ICEText(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEText),t=ICEText.arrangeParam(t),(t=Hr.call(this,t)).measureText(),t}function ICEStar(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEStar),(t=_objectSpread2({outerRadius:50,innerRadius:20,startAngle:90,spikes:5},t)).spikes=Math.floor(1<=t.spikes?t.spikes:1),t.width=2*t.outerRadius,t.height=2*t.outerRadius,Fr.call(this,t)}_defineProperty$1(Kr,"CACHE_SIZE",100),_createClass(function ICE(){_classCallCheck(this,ICE),_defineProperty$1(this,"childNodes",[]),_defineProperty$1(this,"toolNodes",[]),_defineProperty$1(this,"canvasWidth",0),_defineProperty$1(this,"canvasHeight",0),_defineProperty$1(this,"selectionList",[]),_defineProperty$1(this,"typeMapping",{}),_defineProperty$1(this,"__dirty",!0),_defineProperty$1(this,"_lastUpdateTime",Date.now())},[{key:"init",value:function init(t){if(!t)throw new Error("ICE.init() failed...");if(this.ctx===t)throw new Error("同一个 canvas 实例只能 init 一次...");for(var e in qr)this.typeMapping[e]=qr[e];return this.root=k,y(t)?(this.canvasEl=this.root.document.getElementById(t),this.canvasEl.oncontextmenu=function(t){t.preventDefault(),t.stopPropagation()},this.canvasWidth=this.canvasEl.width,this.canvasHeight=this.canvasEl.height,this.canvasBoundingClientRect=this.canvasEl.getBoundingClientRect(),this.ctx=this.canvasEl.getContext("2d")):this.ctx=t,this.evtBus=new $r,x.regitserEvtBus(this.evtBus),x.start(),Ir.regitserEvtBus(this.evtBus),Ir.start(),this.eventDispatcher=new jr(this).start(),this.animationManager=new Z(this).start(),this.controlPanelManager=new Er(this).start(),this.renderer=new Gr(this).start(),this.linkSlotManager=new Jr(this).start(),this.serializer=new Wr(this),this.deserializer=new Xr(this),this.imageCache=new Kr(this),this}},{key:"addTool",value:function addTool(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(H,null,{component:t}),t.trigger(H),t.ice=this,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(F,null,{component:t}),t.trigger(F))}},{key:"removeTool",value:function removeTool(t){this.evtBus.trigger(V,null,{component:t}),t.destory(),this.toolNodes.splice(this.toolNodes.indexOf(t),1),this.dirty=!0}},{key:"addChild",value:function addChild(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(H,null,{component:t}),t.trigger(H),t.ice=this,t.ctx=this.ctx,t.evtBus=this.evtBus,t.parentNode=null,this.childNodes.push(t),Object.keys(t.props.animations).length&&this.animationManager.add(t),this.dirty=e,this.evtBus.trigger(F,null,{component:t}),t.trigger(F))}},{key:"addChildren",value:function addChildren(t){for(var e=0;e<t.length;e++)this.addChild(t[e],!1);this.dirty=!0}},{key:"removeChild",value:function removeChild(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];this.evtBus.trigger(V,null,{component:t}),t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1),this.dirty=e}},{key:"removeChildren",value:function removeChildren(t){for(var e=0;e<t.length;e++)this.removeChild(t[e],!1);this.dirty=!0}},{key:"clearAll",value:function clearAll(){this.removeChildren(_toConsumableArray(this.childNodes))}},{key:"findComponent",value:function findComponent(e){return this.childNodes.filter(function(t){return t.props.id===e})[0]}},{key:"dirty",get:function get(){return this.__dirty},set:function set(t){this.__dirty=t}},{key:"registerType",value:function registerType(t,e){this.typeMapping[t]=e}},{key:"getType",value:function getType(t){return this.typeMapping[t]}},{key:"toJSONString",value:function toJSONString(){return this.serializer.toJSONString()}},{key:"toJSONObject",value:function toJSONObject(){return this.serializer.toJSONObject()}},{key:"fromJSONObject",value:function fromJSONObject(t){var e=this;x.stop(),this.renderer.stop(),this.eventDispatcher.stopped=!0,this.animationManager.stop(),this.controlPanelManager.stop(),this.linkSlotManager.stop(),this.clearAll(),this.deserializer.fromJSONObject(t),x.start(),this.renderer.start(),this.animationManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(function(){e.eventDispatcher.stopped=!1},300)}},{key:"fromJSONString",value:function fromJSONString(t){t=JSON.parse(t),this.fromJSONObject(t)}}]);function Ad(t){return null==t}function Cd(t,e){return t===e||t!=t&&e!=e}function Ed(t,e){for(var n=t.length;n--;)if(Qr(t[n][0],e))return n;return-1}function Ld(t){var e=this.__data__;return!((t=Zr(e,t))<0||(t==e.length-1?e.pop():Yr.call(e,t,1),--this.size,0))}function Md(t){var e=this.__data__;return(t=to(e,t))<0?void 0:e[t][1]}function Nd(t){return-1<eo(this.__data__,t)}function Od(t,e){var n=this.__data__,i=no(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}var v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Qr=Cd,Zr=Ed,Yr=Array.prototype.splice,to=Ed,eo=Ed,no=Ed;function ListCache$4(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}ListCache$4.prototype.clear=function listCacheClear$1(){this.__data__=[],this.size=0},ListCache$4.prototype.delete=Ld,ListCache$4.prototype.get=Md,ListCache$4.prototype.has=Nd,ListCache$4.prototype.set=Od;function Rd(){this.__data__=new io,this.size=0}function Sd(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t}function Td(t){return this.__data__.get(t)}function Ud(t){return this.__data__.has(t)}function g3(t){return ao.call(t)}function i3(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(co&&co in Object(t)?lo:g3)(t)}function j3(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function n3(t){return!!uo(t)&&("[object Function]"==(t=ho(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function C3(t){return!(!vo(t)||go(t))&&(yo(t)?Co:bo).test(mo(t))}function D3(t,e){return null==t?void 0:t[e]}function E3(t,e){return t=D3(t,e),C3(t)?t:void 0}function R3(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t}function S3(t){var e,n=this.__data__;return ko?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:wo.call(n,t)?n[t]:void 0}function T3(t){var e=this.__data__;return Po?void 0!==e[t]:xo.call(e,t)}function U3(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Eo&&void 0===e?"__lodash_hash_undefined__":e,this}var e=ListCache$4,io=e,o="object"==typeof v&&v&&v.Object===Object&&v,h="object"==typeof self&&self&&self.Object===Object&&self,f=o||h||Function("return this")(),t=f.Symbol,a=Object.prototype,ro=a.hasOwnProperty,oo=a.toString,so=t?t.toStringTag:void 0,ao=Object.prototype.toString,lo=function getRawTag$1(t){var e=ro.call(t,so),n=t[so];try{var i=!(t[so]=void 0)}catch(t){}var r=oo.call(t);return i&&(e?t[so]=n:delete t[so]),r},co=t?t.toStringTag:void 0,ho=i3,uo=j3,b=f["__core-js_shared__"],fo=(r=/[^.]+$/.exec(b&&b.keys&&b.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",po=Function.prototype.toString,yo=n3,go=function isMasked$1(t){return!!fo&&fo in t},vo=j3,mo=function toSource$1(t){if(null!=t){try{return po.call(t)}catch(t){}try{return t+""}catch(t){}}return""},bo=/^\[object .+?Constructor\]$/,n=Function.prototype,i=Object.prototype,d=n.toString,l=i.hasOwnProperty,Co=RegExp("^"+d.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),v=E3(f,"Map"),h=E3(Object,"create"),_o=h,ko=h,wo=Object.prototype.hasOwnProperty,Po=h,xo=Object.prototype.hasOwnProperty,Eo=h;function Hash$1(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Hash$1.prototype.clear=function hashClear$1(){this.__data__=_o?_o(null):{},this.size=0},Hash$1.prototype.delete=R3,Hash$1.prototype.get=S3,Hash$1.prototype.has=T3,Hash$1.prototype.set=U3;function Y3(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function Z3(t,e){return t=t.__data__,Y3(e)?t["string"==typeof e?"string":"hash"]:t.map}function de(t){return t=Io(this,t).delete(t),this.size-=t?1:0,t}function ee(t){return $o(this,t).get(t)}function fe(t){return Mo(this,t).has(t)}function ge(t,e){var n=Ao(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}var So=Hash$1,Oo=e,jo=v,Io=Z3,$o=Z3,Mo=Z3,Ao=Z3;function MapCache$1(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}MapCache$1.prototype.clear=function mapCacheClear$1(){this.size=0,this.__data__={hash:new So,map:new(jo||Oo),string:new So}},MapCache$1.prototype.delete=de,MapCache$1.prototype.get=ee,MapCache$1.prototype.has=fe,MapCache$1.prototype.set=ge;function pe(t,e){var n=this.__data__;if(n instanceof Bo){var i=n.__data__;if(!Lo||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new To(i)}return n.set(t,e),this.size=n.size,this}var Bo=e,Lo=v,To=MapCache$1,zo=e,a=Sd,t=Td,b=Ud;function Stack$1(t){t=this.__data__=new zo(t);this.size=t.size}Stack$1.prototype.clear=Rd,Stack$1.prototype.delete=a,Stack$1.prototype.get=t,Stack$1.prototype.has=b,Stack$1.prototype.set=pe;function ue(t,e,n){"__proto__"==e&&Uo?Uo(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function xe(t,e,n){(void 0===n||Jo(t[e],n))&&(void 0!==n||e in t)||qo(t,e,n)}function Be(t){var e=new t.constructor(t.byteLength);return new Xo(e).set(new Xo(t)),e}function Ce(t,e){return e=e?Be(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.length)}function De(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e}function Je(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ko)}function Ne(t){return"function"!=typeof t.constructor||Yo(t)?{}:Qo(Zo(t))}function Oe(t){return null!=t&&"object"==typeof t}function Re(t){return es(t)&&"[object Arguments]"==ts(t)}function Ye(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991}function _e(t){return null!=t&&ss(t.length)&&!os(t)}function c4(t){return ls(t)&&as(t)}function n4(t){return!(!us(t)||"[object Object]"!=cs(t))&&(null===(t=hs(t))||"function"==typeof(t=fs.call(t,"constructor")&&t.constructor)&&t instanceof t&&ds.call(t)==ps)}function s4(t){return vs(t)&&gs(t.length)&&!!E[ys(t)]}function t4(e){return function(t){return e(t)}}function A4(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function E4(t,e,n){var i=t[e];Cs.call(t,e)&&bs(i,n)&&(void 0!==n||e in t)||ms(t,e,n)}function I4(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&ks.test(t))&&-1<t&&t%1==0&&t<e}function J4(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}function W4(t){if(!js(t))return $s(t);var e,n=Is(t),i=[];for(e in t)("constructor"!=e||!n&&Ms.call(t,e))&&i.push(e);return i}function Y4(t){return Bs(t)?As(t,!0):W4(t)}function sf(t,e,n,i,r,o,s){var a,l,c,h=Ks(t,n),u=Ks(e,n),d=s.get(u);d?zs(t,n,d):((e=void 0===(d=o?o(h,u,n+"",t,e,s):void 0))&&(l=!(a=Vs(u))&&qs(u),c=!a&&!l&&Gs(u),d=u,a||l||c?d=Vs(h)?h:Us(h)?Ds(h):l?Rs(u,!(e=!1)):c?Ns(u,!(e=!1)):[]:Ws(u)||Fs(u)?Fs(d=h)?d=Qs(h):Xs(h)&&!Js(h)||(d=Hs(u)):e=!1),e&&(s.set(u,d),r(d,u,i,o,s),s.delete(u)),zs(t,n,d))}function xf(t){return t}function yf(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Bf(t){return function(){return t}}function Nf(t,e){return da(ua(t,e,ha),t+"")}function Of(t,e,n){if(!va(n))return!1;var i=typeof e;return!!("number"==i?pa(n)&&ya(e,n.length):"string"==i&&e in n)&&fa(n[e],t)}var Ro,No,Do,Ho,Fo,r=Stack$1,Vo=E3,n=function(){try{var t=Vo(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Uo=n,qo=ue,Jo=Cd,i=function createBaseFor$1(l){return function(t,e,n){for(var i=-1,r=Object(t),o=n(t),s=o.length;s--;){var a=o[l?s:++i];if(!1===e(r[a],a,r))break}return t}}(),d={exports:{}},Xo=(h=(h=(l=d).exports)&&!h.nodeType&&h,v=(v=h&&l&&!l.nodeType&&l)&&v.exports===h?f.Buffer:void 0,Ro=v?v.allocUnsafe:void 0,l.exports=function cloneBuffer(t,e){if(e)return t.slice();e=t.length,e=Ro?Ro(e):new t.constructor(e);return t.copy(e),e},f.Uint8Array),Wo=j3,Go=Object.create,e=function(){function object(){}return function(t){if(!Wo(t))return{};if(Go)return Go(t);object.prototype=t;t=new object;return object.prototype=void 0,t}}(),a=function overArg$1(e,n){return function(t){return e(n(t))}}(Object.getPrototypeOf,Object),Ko=Object.prototype,Qo=e,Zo=a,Yo=Je,ts=i3,es=Oe,ns=Oe,t=Object.prototype,is=t.hasOwnProperty,rs=t.propertyIsEnumerable,b=Re(function(){return arguments}())?Re:function(t){return ns(t)&&is.call(t,"callee")&&!rs.call(t,"callee")},h=Array.isArray,os=n3,ss=Ye,as=_e,ls=Oe,v={exports:{}},cs=(e=(e=(l=v).exports)&&!e.nodeType&&e,t=(t=e&&l&&!l.nodeType&&l)&&t.exports===e?f.Buffer:void 0,e=(t?t.isBuffer:void 0)||function stubFalse(){return!1},l.exports=e,i3),hs=a,us=Oe,f=Function.prototype,t=Object.prototype,ds=f.toString,fs=t.hasOwnProperty,ps=ds.call(Object),ys=i3,gs=Ye,vs=Oe,E={},l=(E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E["[object Arguments]"]=E["[object Array]"]=E["[object ArrayBuffer]"]=E["[object Boolean]"]=E["[object DataView]"]=E["[object Date]"]=E["[object Error]"]=E["[object Function]"]=E["[object Map]"]=E["[object Number]"]=E["[object Object]"]=E["[object RegExp]"]=E["[object Set]"]=E["[object String]"]=E["[object WeakMap]"]=!1,{exports:{}}),f=(a=(a=(e=l).exports)&&!a.nodeType&&a,No=a&&e&&!e.nodeType&&e,Do=No&&No.exports===a&&o.process,a=function(){try{return No&&No.require&&No.require("util").types||Do&&Do.binding&&Do.binding("util")}catch(t){}}(),e.exports=a,s4),t=t4,o=l.exports,e=o&&o.isTypedArray,a=e?t(e):f,ms=ue,bs=Cd,Cs=Object.prototype.hasOwnProperty,_s=ue,ks=/^(?:0|[1-9]\d*)$/,ws=b,Ps=h,xs=v.exports,Es=I4,Ss=a,Os=Object.prototype.hasOwnProperty,js=j3,Is=Je,$s=function nativeKeysIn$1(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Ms=Object.prototype.hasOwnProperty,As=function arrayLikeKeys$1(t,e){var n,i=Ps(t),r=!i&&ws(t),o=!i&&!r&&xs(t),s=!i&&!r&&!o&&Ss(t),a=i||r||o||s,l=a?J4(t.length,String):[],c=l.length;for(n in t)!e&&!Os.call(t,n)||a&&("length"==n||o&&("offset"==n||"parent"==n)||s&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||Es(n,c))||l.push(n);return l},Bs=_e,Ls=function copyObject$1(t,e,n,i){var r=!n;n=n||{};for(var o=-1,s=e.length;++o<s;){var a=e[o],l=i?i(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),(r?_s:E4)(n,a,l)}return n},Ts=Y4,zs=xe,Rs=d.exports,Ns=Ce,Ds=De,Hs=Ne,Fs=b,Vs=h,Us=c4,qs=v.exports,Js=n3,Xs=j3,Ws=n4,Gs=a,Ks=A4,Qs=function toPlainObject$1(t){return Ls(t,Ts(t))},Zs=r,Ys=xe,ta=i,ea=j3,na=Y4,oa=A4,sa=Math.max,aa=n,la=Date.now,l=function shortOut$1(n){var i=0,r=0;return function(){var t=la(),e=16-(t-r);if(r=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(aa?function(t,e){return aa(t,"toString",{configurable:!0,enumerable:!1,value:Bf(e),writable:!0})}:xf),ha=xf,ua=function overRest$1(o,s,a){return s=sa(void 0===s?o.length-1:s,0),function(){for(var t=arguments,e=-1,n=sa(t.length-s,0),i=Array(n);++e<n;)i[e]=t[s+e];for(var e=-1,r=Array(s+1);++e<s;)r[e]=t[e];return r[s]=a(i),yf(o,this,r)}},da=l,fa=Cd,pa=_e,ya=I4,va=j3,ma=function baseMerge$1(i,r,o,s,a){i!==r&&ta(r,function(t,e){var n;a=a||new Zs,ea(t)?sf(i,r,e,o,baseMerge$1,s,a):(n=s?s(oa(i,e),t,e+"",i,r,a):void 0,Ys(i,e,n=void 0===n?t:n))},na)},ba=function createAssigner$1(a){return Nf(function(t,e){var n=-1,i=e.length,r=1<i?e[i-1]:void 0,o=2<i?e[2]:void 0,r=3<a.length&&"function"==typeof r?(i--,r):void 0;for(o&&Of(e[0],e[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++n<i;){var s=e[n];s&&a(t,s,n,r)}return t})}(function(t,e,n){ma(t,e,n)}),o=(_inherits$1(Entity,Nt),Fo=_createSuper$1(Entity),_createClass$1(Entity,[{key:"syncEntityNameAndFields",value:function syncEntityNameAndFields(){if(this.entityNameComponent&&this.removeChild(this.entityNameComponent),this.deviderLine&&this.removeChild(this.deviderLine),this.entityFieldsComponent.length&&(this.removeChildren(this.entityFieldsComponent),this.entityFieldsComponent.length=0),this.state.entityName&&(this.entityNameComponent=new Ur({left:0,top:0,text:this.state.entityName,style:{strokeStyle:"#222",fillStyle:"#222",fontSize:18,fontWeight:"bold",paddingTop:10,paddingLeft:10,paddingRight:10,paddingBottom:10},interactive:!1,stroke:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}),this.addChild(this.entityNameComponent),this.deviderLine=new Nr({left:0,top:0,points:[[0,0],[this.state.width,0]],style:{strokeStyle:"#333",fillStyle:"#333",lineWidth:2},interactive:!1}),this.addChild(this.deviderLine)),!Ad(this.state.fields)){for(var t=this.state.fields.length,e=0;e<t;e++){var n=this.state.fields[e],n=new Ur({left:0,top:0,text:"".concat(n.name," ").concat(n.type," ").concat(n.length),style:{strokeStyle:"#222",fillStyle:"#222",fontSize:18,fontWeight:"normal",paddingTop:10,paddingLeft:10,paddingRight:10,paddingBottom:e===t-1?10:0},interactive:!1,stroke:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1});this.entityFieldsComponent.push(n)}this.addChildren(this.entityFieldsComponent)}}},{key:"calcComponentParams",value:function calcComponentParams(){var t=this.state.width,e=0,n=0;this.entityNameComponent&&(e=this.childNodes[0].state.height,t=Math.max(t,this.childNodes[0].state.width),n=e+=this.deviderLine.state.height);for(var i=0;i<this.entityFieldsComponent.length;i++){var r=this.entityFieldsComponent[i];r.setState({left:0,top:e}),e+=r.state.height,t=Math.max(t,r.state.width)}this.deviderLine&&this.deviderLine.setState({points:[[0,n],[t,n]]});var n=t,o=Math.max(e,this.state.height);return{width:this.state.width=n,height:this.state.height=o}}},{key:"toEntityObject",value:function toEntityObject(){var n={name:this.state.entityName,columns:{}};return this.state.fields.forEach(function(t,e){n.columns[t.name]=_objectSpread2$1({},t)}),n}},{key:"setState",value:function setState(t){var e=!1;Ad(t.fields)||(this.state.fields=t.fields,e=!0),Ad(t.entityName)||(this.state.entityName=t.entityName,e=!0),e&&this.syncEntityNameAndFields(),_get$1(_getPrototypeOf$1(Entity.prototype),"setState",this).call(this,t)}}],[{key:"arrangeParam",value:function arrangeParam(t){t=ba({entityName:"Entity Name",fields:[],style:{strokeStyle:"#000",fillStyle:"#00eeff"}},t,{transformable:!1});return Ad(t.entityName)&&(t.entityName="Entity Name"),Ad(t.fields)&&(t.fields=[]),t}}]),Entity),t=(_inherits$1(Relation,g),Ho=_createSuper$1(Relation),_createClass$1(Relation,[{key:"toEntityObject",value:function toEntityObject(){var t,e,n,i,r=this.state,o=r.title,s=r.relationType,r=r.referencedColumnName;return this.state.links&&this.state.links.start&&this.state.links.start.id&&(t=this.state.links.start.id,e=this.ice.findComponent(t).state.entityName),this.state.links&&this.state.links.end&&this.state.links.end.id&&(n=this.state.links.end.id,i=this.ice.findComponent(n).state.entityName),{title:o,fromId:t,fromName:e,toId:n,toName:i,relationType:s,referencedColumnName:r}}}]),Relation);function Relation(t){return _classCallCheck$1(this,Relation),Ho.call(this,_objectSpread2$1({title:"Relation",relationType:"one-to-one",referencedColumnName:"id"},t))}function Entity(t){_classCallCheck$1(this,Entity);var t=Entity.arrangeParam(t);return _defineProperty$2(_assertThisInitialized$1(t=Fo.call(this,t)),"entityFieldsComponent",[]),t.syncEntityNameAndFields(),t}function camelCase(t,e){e=1<arguments.length&&void 0!==e&&e;return function toCamelCase(t,e){for(var n=0<arguments.length&&void 0!==t?t:[],i=1<arguments.length&&void 0!==e&&e,r="",o=0,s=n.length;o<s;o++){var a=n[o].toLowerCase();r+=a=!i&&0==o?a:a.substr(0,1).toUpperCase()+a.substr(1)}return r}(function toWords(t){return(t=function convertToString(t){return"string"==typeof(t=t||"")?t:String(t)}(t)).match(/[A-Z\xC0-\xD6\xD8-\xDE]?[a-z\xDF-\xF6\xF8-\xFF]+|[A-Z\xC0-\xD6\xD8-\xDE]+(?![a-z\xDF-\xF6\xF8-\xFF])|\d+/g)}(t),e)}var _a=[],ka=[],wa={},Pa={},xa={};function sanitizeRule(t){return"string"==typeof t?new RegExp("^"+t+"$","i"):t}function restoreCase(t,e){return t===e?e:t===t.toLowerCase()?e.toLowerCase():t===t.toUpperCase()?e.toUpperCase():t[0]===t[0].toUpperCase()?e.charAt(0).toUpperCase()+e.substr(1).toLowerCase():e.toLowerCase()}function replace(i,r){return i.replace(r[0],function(t,e){var n=function interpolate(t,n){return t.replace(/\$(\d{1,2})/g,function(t,e){return n[e]||""})}(r[1],arguments);return restoreCase(""===t?i[e-1]:t,n)})}function sanitizeWord(t,e,n){if(!t.length||wa.hasOwnProperty(t))return e;for(var i=n.length;i--;){var r=n[i];if(r[0].test(e))return replace(e,r)}return e}function replaceWord(n,i,r){return function(t){var e=t.toLowerCase();return i.hasOwnProperty(e)?restoreCase(t,e):n.hasOwnProperty(e)?restoreCase(t,n[e]):sanitizeWord(e,t,r)}}function checkWord(e,n,i){return function(t){t=t.toLowerCase();return!!n.hasOwnProperty(t)||!e.hasOwnProperty(t)&&sanitizeWord(t,t,i)===t}}function pluralize(t,e,n){return(n?e+" ":"")+(1===e?pluralize.singular(t):pluralize.plural(t))}function toSchemaObject(t){for(var e=function _toConsumableArray$1(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray$1(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray$1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(n="Object"===n&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray$1(t,e):void 0}}(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t),n=[],i={},r=0;r<e.length;r++){var o=e[r];"Relation"===o.constructor.name?n.push(o):"Entity"===o.constructor.name&&(i[o.state.id]=o.toEntityObject())}for(var s=0;s<n.length;s++){var a=n[s].toEntityObject(),l=a.fromId,c=a.fromName,h=a.toId,u=a.toName,d=a.relationType,a=a.referencedColumnName,l=i[l],h=i[h];l&&h&&(l.relations||(l.relations={}),h.relations||(h.relations={}),"one-to-one"===d?(l.relations["".concat(camelCase(u))]={type:d,target:u,joinColumn:{target:u,referencedColumnName:a}},h.relations["".concat(camelCase(c))]={type:d,target:c}):"one-to-many"===d?l.relations["".concat(camelCase(u))]={type:d,target:u}:"many-to-one"===d?h.relations["".concat(camelCase(c))]={type:"one-to-many",target:c}:"many-to-many"===d&&(l.relations["".concat(pluralize(camelCase(u)))]={type:d,target:u,joinTable:{target:u}},h.relations["".concat(pluralize(camelCase(c)))]={type:d,target:c}))}var f,p=[];for(f in i)p.push(i[f]);return p}pluralize.plural=replaceWord(xa,Pa,_a),pluralize.isPlural=checkWord(xa,Pa,_a),pluralize.singular=replaceWord(Pa,xa,ka),pluralize.isSingular=checkWord(Pa,xa,ka),pluralize.addPluralRule=function(t,e){_a.push([sanitizeRule(t),e])},pluralize.addSingularRule=function(t,e){ka.push([sanitizeRule(t),e])},pluralize.addUncountableRule=function(t){"string"!=typeof t?(pluralize.addPluralRule(t,"$0"),pluralize.addSingularRule(t,"$0")):wa[t.toLowerCase()]=!0},pluralize.addIrregularRule=function(t,e){e=e.toLowerCase(),t=t.toLowerCase(),xa[t]=e,Pa[e]=t},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(t){return pluralize.addIrregularRule(t[0],t[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(t){return pluralize.addPluralRule(t[0],t[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(t){return pluralize.addSingularRule(t[0],t[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(pluralize.addUncountableRule),S.Entity=o,S.Relation=t,S.toSchemaObject=toSchemaObject,S.toSchemaString=function toSchemaString(t){return JSON.stringify(toSchemaObject(t))},Object.defineProperty(S,"__esModule",{value:!0})});
|
|
25
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).IED={})}(this,(function(t){"use strict";function _defineProperty$1(t,e,i){return(e=function _toPropertyKey(t){var e=function _toPrimitive(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ownKeys(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function _objectSpread2(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(i),!0).forEach((function(e){_defineProperty$1(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function isNil$1(t){return null==t}function isString(t){return"string"==typeof t}function isUndefined(t){return void 0===t}function round(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0===e)return Math.round(t);const[i,s]="".concat(t).split("e"),n=s?parseInt(s,10):0,o=Math.round(Number("".concat(i,"e").concat(n+e))),[r,a]="".concat(o).split("e");return Number("".concat(r,"e").concat((a?parseInt(a,10):0)-e))}function isPlainObject$2(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}function merge$1(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];for(const e of i)if(null!=e)for(const i in e){const s=e[i];if(void 0===s)continue;const n=t[i];isPlainObject$2(s)&&isPlainObject$2(n)?(Object.prototype.hasOwnProperty.call(t,i)||(t[i]=cloneDeep(n)),merge$1(t[i],s)):t[i]=s}return t}function cloneDeep(t){if(Array.isArray(t))return t.map(t=>cloneDeep(t));if(isPlainObject$2(t)){const e={};for(const i in t)e[i]=cloneDeep(t[i]);return e}return t}
|
|
26
|
+
//!ICE 自定的事件名称常量,原生 DOM 事件的名称不变。
|
|
27
|
+
var e="ICE_FRAME_EVENT",i="BEFORE_RENDER",s="AFTER_RENDER",n="BEFORE_ADD",o="AFTER_ADD",r="BEFORE_REMOVE",a="AFTER_REMOVE",h="ROUND_FINISH",l="HOOK_MOUSEDOWN",c="HOOK_MOUSEMOVE",d="HOOK_MOUSEUP",u="BEFORE_RESIZE",p="AFTER_RESIZE",f="BEFORE_ROTATE",g="AFTER_ROTATE",y="BEFORE_MOVE",m="AFTER_MOVE";function springProgress(t,e){const i=t,s=Math.sqrt(Math.max(1e-6,1-t*t));return t=>{const n=Math.max(0,t)*e;return 1-Math.exp(-i*n)*(Math.cos(s*n)+i/s*Math.sin(s*n))}}const _={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>t*(2-t),easeInOutQuad:t=>t<.5?2*t*t:(4-2*t)*t-1,easeInQuart:t=>t*t*t*t,easeOutQuart:t=>1-Math.pow(1-t,4),easeInOutQuart:t=>t<.5?8*t*t*t*t:1-8*Math.pow(1-t,4),easeInCubic:t=>t*t*t,easeOutCubic:t=>1-Math.pow(1-t,3),easeInOutCubic:t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,spring:springProgress(.55,12),springSoft:springProgress(.75,14),springSnappy:springProgress(.4,9)},v={color:{blue:{50:"#EFF6FF",100:"#DBEAFE",200:"#BFDBFE",300:"#93C5FD",400:"#60A5FA",500:"#3B82F6",600:"#2563EB",700:"#1D4ED8",800:"#1E40AF",900:"#1E3A8A"},emerald:{50:"#ECFDF5",100:"#D1FAE5",200:"#A7F3D0",300:"#6EE7B7",400:"#34D399",500:"#10B981",600:"#059669",700:"#047857",800:"#065F46",900:"#064E3B"},amber:{50:"#FFFBEB",100:"#FEF3C7",200:"#FDE68A",300:"#FCD34D",400:"#FBBF24",500:"#F59E0B",600:"#D97706",700:"#B45309",800:"#92400E",900:"#78350F"},red:{50:"#FEF2F2",100:"#FEE2E2",200:"#FECACA",300:"#FCA5A5",400:"#F87171",500:"#EF4444",600:"#DC2626",700:"#B91C1C",800:"#991B1B",900:"#7F1D1D"},gray:{50:"#F9FAFB",100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",600:"#4B5563",700:"#374151",800:"#1F2937",900:"#111827"},violet:{50:"#F5F3FF",100:"#EDE9FE",200:"#DDD6FE",300:"#C4B5FD",400:"#A78BFA",500:"#8B5CF6",600:"#7C3AED",700:"#6D28D9",800:"#5B21B6",900:"#4C1D95"},teal:{50:"#F0FDFA",100:"#CCFBF1",200:"#99F6E4",300:"#5EEAD4",400:"#2DD4BF",500:"#14B8A6",600:"#0D9488",700:"#0F766E",800:"#115E59",900:"#134E4A"},pink:{50:"#FDF2F8",100:"#FCE7F3",200:"#FBCFE8",300:"#F9A8D4",400:"#F472B6",500:"#EC4899",600:"#DB2777",700:"#BE185D",800:"#9D174D",900:"#831843"},indigo:{50:"#EEF2FF",100:"#E0E7FF",200:"#C7D2FE",300:"#A5B4FC",400:"#818CF8",500:"#6366F1",600:"#4F46E5",700:"#4338CA",800:"#3730A3",900:"#312E81"}},spacing:{1:4,2:8,3:12,4:16,6:24,8:32,12:48,16:64},radius:{sm:4,md:8,lg:12,xl:16,full:9999},fontSize:{sm:12,md:14,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":44},fontFamily:{base:"Arial"},fontWeight:{normal:400,bold:700}};function buildSemantic(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=t.color;return _objectSpread2({primary:i.blue[500],success:i.emerald[500],warning:i.amber[500],danger:i.red[500],info:i.blue[400],text:i.gray[800],muted:i.gray[500],hint:i.gray[400],border:i.gray[200],background:"#ffffff",palette:[i.blue[500],i.emerald[500],i.amber[500],i.red[500],i.violet[500],i.teal[500],i.pink[500],i.indigo[500]],motion:{duration:{fast:100,normal:200,slow:300,slower:500},easing:{linear:"linear",out:"easeOutCubic",inOut:"easeInOutCubic",outQuart:"easeOutQuart",spring:"spring",springSoft:"springSoft",springSnappy:"springSnappy"}}},e)}const x={base:v,semantic:buildSemantic(v)},b={base:v,semantic:buildSemantic(v,{primary:v.color.blue[400],success:v.color.emerald[400],warning:v.color.amber[400],danger:v.color.red[400],info:v.color.teal[400],text:v.color.gray[200],muted:v.color.gray[400],hint:v.color.gray[500],border:v.color.gray[700],background:v.color.gray[900],palette:[v.color.blue[400],v.color.emerald[400],v.color.amber[400],v.color.red[400],v.color.violet[400],v.color.teal[400],v.color.pink[400],v.color.indigo[400]]})},C={default:x,dark:b};let w=x;function registerTheme(t,e){C[t]=e}function resolveTheme(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w;return"string"==typeof t?C[t]||x:{base:e.base,semantic:_objectSpread2(_objectSpread2({},e.semantic),t)}}function setTheme(t){return w=resolveTheme(t,w),w}function getTheme(){return w}const S={card:t=>({radius:t.base.radius.lg,style:{fillStyle:t.semantic.background,strokeStyle:t.semantic.border,lineWidth:1,shadow:"md"}}),gradient:t=>({radius:t.base.radius.lg,style:{fillGradient:{type:"linear",from:[0,0],to:[0,200],stops:[[0,t.semantic.primary],[1,t.semantic.background]]},strokeStyle:t.semantic.border,lineWidth:1}}),panel:t=>({radius:t.base.radius.md,style:{fillStyle:t.semantic.background,strokeStyle:t.semantic.border,lineWidth:1,shadow:"sm"}}),button:t=>({radius:t.base.radius.md,style:{fillStyle:t.semantic.primary,strokeStyle:t.semantic.primary,lineWidth:1,shadow:"sm"}}),"button-danger":t=>({radius:t.base.radius.md,style:{fillStyle:t.semantic.danger,strokeStyle:t.semantic.danger,lineWidth:1,shadow:"sm"}}),title:t=>({stroke:!1,style:{fontSize:t.base.fontSize["2xl"],fontWeight:t.base.fontWeight.bold,fillStyle:t.semantic.text}}),subtitle:t=>({stroke:!1,style:{fontSize:t.base.fontSize.lg,fillStyle:t.semantic.muted}}),body:t=>({stroke:!1,style:{fontSize:t.base.fontSize.md,fillStyle:t.semantic.text}}),label:t=>({stroke:!1,style:{fontSize:t.base.fontSize.sm,fillStyle:t.semantic.hint}})};var P={baseTokens:v,DEFAULT_THEME:x,DARK_THEME:b,registerTheme:registerTheme,setTheme:setTheme,getTheme:getTheme,STYLE_PRESETS:S},E=class AnimationManager{constructor(t){_defineProperty$1(this,"animationMap",new Map),_defineProperty$1(this,"paused",!1),_defineProperty$1(this,"pausedAt",0),_defineProperty$1(this,"warned",new WeakSet),this.ice=t}start(){return this.ice.evtBus.on(e,this.frameEventHandler,this),this}stop(){return this.ice.evtBus.off(e,this.frameEventHandler,this),this}frameEventHandler(t){if(this.paused)return;const e=Date.now(),i=[...this.animationMap.values()];for(let t=0;t<i.length;t++){const s=i[t],n=s.state.interactive;s.state.interactive=!1,this.tween(s,e),s.state.interactive=n}}__writeValue(t,e,i){const s=e.indexOf(".");if(-1===s)return void(t[e]=i);const n=e.slice(0,s),o=e.slice(s+1);t[n]&&"object"==typeof t[n]||(t[n]={}),this.__writeValue(t[n],o,i)}tween(t,e){const i={},s=t.props.animations,n=isUndefined(e)?Date.now():e;let o=!1;for(const t in s){const e=s[t];if(e.finished)continue;let r;if(isUndefined(e.startTime)&&(e.startTime=n,this.__resolveMotion(e)),isUndefined(e.easing)&&(e.easing="linear"),Array.isArray(e.keyframes)){const i=this.__normalizeKeyframes(e);if(!i){this.__reject(e,"[ICE] 动画属性「".concat(t,"」的 keyframes 非法:需要 ≥2 帧、offset 为数字、各帧取值同型(都是数字或等长的数字数组);已跳过。"));continue}r=i}else if(!this.__isTweenable(e.from,e.to)){this.__reject(e,"[ICE] 动画属性「".concat(t,"」的取值必须都是数字或等长的数字数组,当前为 ")+"".concat(this.__describe(e.from)," → ").concat(this.__describe(e.to),";已跳过。"));continue}const a=Number(e.duration);if(!Number.isFinite(a)||a<=0){this.__reject(e,"[ICE] 动画属性「".concat(t,"」的 duration 必须是正数,当前为 ").concat(String(e.duration),";已直接落到终点。")),this.__writeValue(i,t,this.__roundIfNeeded(e,this.__sampleValue(r,e,1)));continue}const h=Number(e.delay)||0,l=n-e.startTime-h;if(l<0){o=!0,this.__writeValue(i,t,this.__sampleValue(r,e,0));continue}if(l>=a){let s=this.__sampleValue(r,e,1);this.shouldRepeat(e)?(e.startTime=n,s=this.__sampleValue(r,e,0),o=!0):e.finished=!0,this.__writeValue(i,t,this.__roundIfNeeded(e,s));continue}o=!0;const c=r?l/a:this.__easingFn(e.easing,e)(l/a);this.__writeValue(i,t,this.__roundIfNeeded(e,this.__sampleValue(r,e,c)))}return o||this.remove(t),Object.keys(i).length>0&&t.setState(i),t}__sampleValue(t,e,i){if(!t)return this.__interpolate(e.from,e.to,i);const s=t[0],n=t[t.length-1];if(i<=s.offset)return s.value;if(i>=n.offset)return n.value;for(let s=0;s<t.length-1;s++){const n=t[s],o=t[s+1];if(i<n.offset||i>o.offset)continue;const r=o.offset-n.offset;if(r<=0)return o.value;const a=(i-n.offset)/r,h=this.__easingFn(isUndefined(n.easing)?e.easing:n.easing,e);return this.__interpolate(n.value,o.value,h(a))}return n.value}__interpolate(t,e,i){if("number"==typeof t)return t+(e-t)*i;const s=new Array(t.length);for(let n=0;n<t.length;n++)s[n]=t[n]+(e[n]-t[n])*i;return s}__isTweenable(t,e){const i=this.__valueKind(t);return null!==i&&i===this.__valueKind(e)&&("number"===i||t.length===e.length)}__valueKind(t){if("number"==typeof t)return"number";if(Array.isArray(t)&&t.length>0){for(let e=0;e<t.length;e++)if("number"!=typeof t[e])return null;return"array"}return null}__normalizeKeyframes(t){if(t.__frames)return t.__frames;const e=t.keyframes;if(!Array.isArray(e)||e.length<2)return null;const i=[];for(let t=0;t<e.length;t++){const s=e[t]||{},n=isUndefined(s.offset)?t/(e.length-1):Number(s.offset);if(!Number.isFinite(n))return null;i.push({offset:Math.min(1,Math.max(0,n)),value:s.value,easing:s.easing})}i.sort((t,e)=>t.offset-e.offset);const s=this.__valueKind(i[0].value);if(null===s)return null;const n="array"===s?i[0].value.length:0;for(let t=1;t<i.length;t++){if(this.__valueKind(i[t].value)!==s)return null;if("array"===s&&i[t].value.length!==n)return null}return t.__frames=i,i}__easingFn(t,e){return("string"==typeof t?_[t]:void 0)||(e&&this.__warnOnce(e,"[ICE] 未知的缓动「".concat(String(t),"」,已回退为 linear。可用:").concat(Object.keys(_).join(" / "))),_.linear)}__roundIfNeeded(t,e){return t.round?"number"==typeof e?Math.round(e):e.map(t=>Math.round(t)):e}__describe(t){return Array.isArray(t)?"数组[".concat(t.length,"]"):typeof t}__reject(t,e){t.finished=!0,this.__warnOnce(t,e)}__warnOnce(t,e){t&&"object"==typeof t&&(this.warned.has(t)||this.warned.add(t))}__resolveMotion(t){const e=(this.ice&&this.ice.theme||getTheme()).semantic.motion;"string"==typeof t.duration&&void 0!==e.duration[t.duration]&&(t.duration=e.duration[t.duration]),"string"==typeof t.easing&&void 0!==e.easing[t.easing]&&(t.easing=e.easing[t.easing])}shouldRepeat(t){return!0===t.loop||"number"==typeof t.iterationCount&&t.iterationCount>1&&(t.iterationCount--,!0)}pause(){this.paused||(this.paused=!0,this.pausedAt=Date.now())}resume(){if(!this.paused)return;const t=Date.now()-this.pausedAt,e=[...this.animationMap.values()];for(const i of e){const e=i.props.animations;for(const i in e){const s=e[i];isUndefined(s.startTime)||(s.startTime+=t)}}this.paused=!1}isPaused(){return this.paused}add(t){this.animationMap.set(t.props.id,t)}remove(t){isString(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}};let M=0;function bumpVisibilityEpoch(){M++}function getVisibilityEpoch(){return M}function isEffectivelyVisible(t){return t&&"function"==typeof t.isEffectivelyVisible?t.isEffectivelyVisible():!!(t&&t.state&&t.state.display)}function flattenAllComponents(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return flattenTree(e,t.childNodes||[]),flattenTree(e,t.toolNodes||[]),e}function hitTestComponents(t,e,i,s){const n=flattenAllComponents(t);n.sort((t,e)=>t.state.zIndex-e.state.zIndex);const o=t.renderer,r=o&&"function"==typeof o.getWorldBox;let a=null;for(let t=0;t<n.length;t++){const h=n[t];if(!h.isControlPanel&&h.state.interactive&&isEffectivelyVisible(h)){if(r){const t=o.getWorldBox(h);if(t&&(e<t[0]-s||e>t[2]+s||i<t[1]-s||i>t[3]+s))continue}if(h.containsPoint(e,i)){if("function"==typeof h.isPointClippedOut&&h.isPointClippedOut(e,i))continue;a=h}}}return a}function flattenTree(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;for(let n=0;n<e.length;n++){const o=e[n];o._level=i,o._pid=s,t.push(o);const r=o.props&&void 0!==o.props.id?o.props.id:o.id;flattenTree(t,o.childNodes||[],i+1,r)}return t}class PolyfillPath2D{constructor(){_defineProperty$1(this,"_isPolyfill",!0),_defineProperty$1(this,"_commands",[]),_defineProperty$1(this,"_closed",!1)}moveTo(t,e){this._commands.push(["moveTo",t,e])}lineTo(t,e){this._commands.push(["lineTo",t,e])}bezierCurveTo(t,e,i,s,n,o){this._commands.push(["bezierCurveTo",t,e,i,s,n,o])}quadraticCurveTo(t,e,i,s){this._commands.push(["quadraticCurveTo",t,e,i,s])}arcTo(t,e,i,s,n){this._commands.push(["arcTo",t,e,i,s,n])}rect(t,e,i,s){this._commands.push(["rect",t,e,i,s])}ellipse(t,e,i,s,n,o,r,a){this._commands.push(["ellipse",t,e,i,s,n,o,r,a])}closePath(){this._closed=!0}}let k=null;(()=>{const t="undefined"!=typeof window?window:"undefined"!=typeof global?global:{};k=t||{},k.requestFrame=k.requestAnimationFrame||k.webkitRequestAnimationFrame||k.mozRequestAnimationFrame||k.oRequestAnimationFrame||k.msRequestAnimationFrame,"function"!=typeof k.requestFrame&&(k.requestFrame=function(t){return setTimeout((function(){t(Date.now())}),16)}),k.createPath2D=()=>"function"==typeof k.Path2D?new k.Path2D:new PolyfillPath2D,k.loadFont=(t,e)=>{if("function"==typeof k.FontFace&&k.document&&k.document.fonts){const i=new k.FontFace(t,e);return k.document.fonts.add(i),i.load()}return k.wx&&"function"==typeof k.wx.loadFont?k.wx.loadFont(e):Promise.resolve()},k.createImage=()=>{if("function"==typeof k.Image)return new k.Image;if(k.wx&&"function"==typeof k.wx.createImage)return k.wx.createImage();throw new Error("当前运行时没有可用的 Image 构造器,无法加载图片。")},"number"==typeof k.devicePixelRatio&&k.devicePixelRatio>0||(k.devicePixelRatio=(()=>{if(k.wx&&"function"==typeof k.wx.getSystemInfoSync)try{return k.wx.getSystemInfoSync().pixelRatio||1}catch(t){return 1}return 1})()),k.createOffscreenCanvas=(t,e)=>{if(k.wx&&"function"==typeof k.wx.createOffscreenCanvas){const i=k.wx.createOffscreenCanvas({type:"2d",width:t,height:e}),s=i.getContext("2d");if(!s)throw new Error("当前运行时无法创建 2d 离屏上下文。");return{canvas:i,ctx:s}}if(k.document&&"function"==typeof k.document.createElement){const i=k.document.createElement("canvas");i.width=t,i.height=e;const s=i.getContext("2d");if(!s)throw new Error("当前运行时无法创建 2d 离屏上下文。");return{canvas:i,ctx:s}}throw new Error("当前运行时没有可用的离屏 canvas。")}})();var I=k,B="undefined"!=typeof Float32Array?Float32Array:Array,T=Math.PI/180;function toRadian(t){return t*T}function invert(t,e){var i=e[0],s=e[1],n=e[2],o=e[3],r=e[4],a=e[5],h=i*o-s*n;return h?(h=1/h,t[0]=o*h,t[1]=-s*h,t[2]=-n*h,t[3]=i*h,t[4]=(n*a-o*r)*h,t[5]=(s*r-i*a)*h,t):null}function multiply(t,e,i){var s=e[0],n=e[1],o=e[2],r=e[3],a=e[4],h=e[5],l=i[0],c=i[1],d=i[2],u=i[3],p=i[4],f=i[5];return t[0]=s*l+o*c,t[1]=n*l+r*c,t[2]=s*d+o*u,t[3]=n*d+r*u,t[4]=s*p+o*f+a,t[5]=n*p+r*f+h,t}function cross(t,e,i){var s=e[0]*i[1]-e[1]*i[0];return t[0]=t[1]=0,t[2]=s,t}function transformMat2d(t,e,i){var s=e[0],n=e[1];return t[0]=i[0]*s+i[2]*n+i[4],t[1]=i[1]*s+i[3]*n+i[5],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),function create(){var t=new B(2);B!=Float32Array&&(t[0]=0,t[1]=0)}();var O=class ICEEvent{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_defineProperty$1(this,"AT_TARGET",2),_defineProperty$1(this,"BUBBLING_PHASE",3),_defineProperty$1(this,"CAPTURING_PHASE",1),_defineProperty$1(this,"NONE",0);for(const e in t)this[e]=t[e];for(const t in e)this[t]=e[t]}composedPath(){throw new Error("Method not implemented.")}initEvent(t,e,i){throw new Error("Method not implemented.")}preventDefault(){throw new Error("Method not implemented.")}stopImmediatePropagation(){throw new Error("Method not implemented.")}stopPropagation(){throw new Error("Method not implemented.")}};class ICEEventTarget{constructor(){_defineProperty$1(this,"listeners",{}),_defineProperty$1(this,"suspendedEventNames",[])}on(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:I;this.listeners[t]||(this.listeners[t]=[]),this.off(t,e,i),this.listeners[t].push({callback:e,scope:i})}off(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:I,s=this.listeners[t];if(s){s=[...s];for(let n=0;n<s.length;n++){const o=s[n],r=o.callback;if((r===e||r&&r.__onceOriginal===e)&&o.scope===i)return void this.listeners[t].splice(n,1)}}}trigger(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function isEmpty(t){return null==t||(Array.isArray(t)||"string"==typeof t?0===t.length:"object"!=typeof t||0===Object.keys(t).length)}(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;i?(e=new O(i),e.originalEvent=i.originalEvent?i.originalEvent:i,e.param=_objectSpread2({},s)):e=new O({type:t,timeStamp:Date.now(),param:_objectSpread2({},s)});const n=this.listeners[t];for(let t=0;t<n.length;t++){const i=n[t];i.callback.call(i.scope,e)}return!0}once(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:I;const s=this;function callback(n){s.off(t,callback,i),e.call(i,n)}callback.__onceOriginal=e,s.on(t,callback,i)}suspend(t){t&&!this.suspendedEventNames.includes(t)&&this.suspendedEventNames.push(t)}resume(t){const e=this.suspendedEventNames.indexOf(t);-1!==e&&this.suspendedEventNames.splice(e,1)}purgeEvents(){this.listeners={},this.suspendedEventNames=[]}hasListener(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:I;if(!this.listeners[t])return!1;const s=this.listeners[t];if(!s)return!1;for(let t=0;t<s.length;t++){const n=s[t];if(n.callback===e&&n.scope===i)return!0}return!1}}ICEEventTarget.prototype.addEventListener=ICEEventTarget.prototype.on,ICEEventTarget.prototype.removeEventListener=ICEEventTarget.prototype.off,ICEEventTarget.prototype.dispatchEvent=ICEEventTarget.prototype.trigger;var N=ICEEventTarget;class GeoUtil{constructor(){throw new Error("GeoUtil is a static util class.")}static pointInPolygon(t,e,i){if(!i||i.length<3)return!1;let s=!1;for(let n=0,o=i.length-1;n<i.length;o=n++){const r=i[n][0],a=i[n][1],h=i[o][0],l=i[o][1];a>e!=l>e&&t<(h-r)*(e-a)/(l-a)+r&&(s=!s)}return s}static distanceToSegment(t,e,i,s,n,o){const r=n-i,a=o-s,h=r*r+a*a;let l=0===h?0:((t-i)*r+(e-s)*a)/h;return l=l<0?0:l>1?1:l,Math.hypot(t-(i+l*r),e-(s+l*a))}static distanceToPolyline(t,e,i){if(!t||0===t.length)return 1/0;if(1===t.length)return Math.hypot(e-t[0][0],i-t[0][1]);let s=1/0;for(let n=0;n<t.length-1;n++){const o=GeoUtil.distanceToSegment(e,i,t[n][0],t[n][1],t[n+1][0],t[n+1][1]);o<s&&(s=o)}return s}static samplePolyline(t,e){const i=[];if(!t||t.length<2||e<1)return t?t.map(t=>[t[0],t[1]]):i;const s=[];let n=0;for(let e=0;e<t.length-1;e++){const i=Math.hypot(t[e+1][0]-t[e][0],t[e+1][1]-t[e][1]);s.push(i),n+=i}if(0===n)return[t[0].slice(),t[t.length-1].slice()];for(let o=0;o<=e;o++){const r=n*o/e;let a=0;for(let e=0;e<s.length;e++){if(a+s[e]>=r||e===s.length-1){const n=0===s[e]?0:(r-a)/s[e];i.push([t[e][0]+(t[e+1][0]-t[e][0])*n,t[e][1]+(t[e+1][1]-t[e][1])*n]);break}a+=s[e]}}return i}static segmentIntersect(t,e,i,s){const n=e[0]-t[0],o=e[1]-t[1],r=s[0]-i[0],a=s[1]-i[1],h=n*a-o*r;if(0===h)return null;const l=((i[0]-t[0])*a-(i[1]-t[1])*r)/h,c=((i[0]-t[0])*o-(i[1]-t[1])*n)/h;return l<0||l>1||c<0||c>1?null:[t[0]+l*n,t[1]+l*o]}static calcRotateAngle(t,e,i,s){const n=t-i,o=e-s,r=Math.hypot(n,o),a=n/r;let h=(o/r<0?-1:1)*Math.acos(a)*180/Math.PI+360;return h%=360,h}static calcRotateAngleFromMatrix(t){const e=t[0],i=t[1];return Math.atan2(i,e)*(180/Math.PI)}static calcScaleFromMatrix(t){const e=t[0],i=t[1],s=t[2],n=t[3];return[Math.hypot(e,i),Math.hypot(s,n)]}}class ICEBoundingBox{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0,0,0,0,0,0,0,0];_defineProperty$1(this,"tl",[0,0]),_defineProperty$1(this,"tr",[0,0]),_defineProperty$1(this,"bl",[0,0]),_defineProperty$1(this,"br",[0,0]),_defineProperty$1(this,"tc",[0,0]),_defineProperty$1(this,"rc",[0,0]),_defineProperty$1(this,"bc",[0,0]),_defineProperty$1(this,"lc",[0,0]),_defineProperty$1(this,"center",[0,0]),this.tl=[t[0],t[1]],this.tr=[t[2],t[3]],this.bl=[t[4],t[5]],this.br=[t[6],t[7]],this.tc=[(this.tr[0]+this.tl[0])/2,(this.tr[1]+this.tl[1])/2],this.bc=[(this.br[0]+this.bl[0])/2,(this.br[1]+this.bl[1])/2],this.lc=[(this.bl[0]+this.tl[0])/2,(this.bl[1]+this.tl[1])/2],this.rc=[(this.br[0]+this.tr[0])/2,(this.br[1]+this.tr[1])/2],this.center=[t[8],t[9]]}static fromDimension(t,e,i,s){return new ICEBoundingBox([t,e,t+i,e,t,e+s,t+i,e+s,t+i/2,e+s/2])}containsPoint(t){const{minX:e,minY:i,maxX:s,maxY:n}=this.getMinAndMaxPoint();if(t[0]<e||t[0]>s||t[1]<i||t[1]>n)return!1;let o,r=0;const a=this.getBoundingLines();for(let e=0;e<a.length;e++){const i=a[e];if(!(t[1]>i.o[1]&&t[1]>i.d[1]||t[1]<i.o[1]&&t[1]<i.d[1])){if(i.o[0]===i.d[0]&&i.o[0]>=t[0])o=i.o[0];else{const e=(i.d[1]-i.o[1])/(i.d[0]-i.o[0]);o=i.o[0]+(t[1]-i.o[1])/e}o>t[0]&&r++}}return 0!==r&&r%2==1}getBoundingLines(){return[{o:[...this.tl],d:[...this.tr]},{o:[...this.tr],d:[...this.br]},{o:[...this.br],d:[...this.bl]},{o:[...this.bl],d:[...this.tl]}]}getMinAndMaxPoint(){let t=this.tl[0],e=this.tl[1],i=this.tl[0],s=this.tl[1];const n=[this.tr,this.bl,this.br];for(let o=0;o<n.length;o++){const r=n[o];r[0]<t&&(t=r[0]),r[0]>i&&(i=r[0]),r[1]<e&&(e=r[1]),r[1]>s&&(s=r[1])}return{minX:t,minY:e,maxX:i,maxY:s}}containsBox(t){const e=this.getMinAndMaxPoint(),i=t.getMinAndMaxPoint();return i.minX>=e.minX&&i.maxX<=e.maxX&&i.minY>=e.minY&&i.maxY<=e.maxY}isIntersect(t){const e=this.tl[0],i=this.br[0],s=this.tl[1],n=this.br[1],o=t.tl[0],r=t.br[0],a=t.tl[1],h=t.br[1];return!(e>r||s>h||i<o||n<a)}transform(t){const e=transformMat2d([],this.tl,t),i=transformMat2d([],this.tr,t),s=transformMat2d([],this.bl,t),n=transformMat2d([],this.br,t),o=transformMat2d([],this.center,t);return new ICEBoundingBox([...e,...i,...s,...n,...o])}union(t){const e=this.getMinAndMaxPoint(),i=t.getMinAndMaxPoint(),s=Math.min(e.minX,i.minX),n=Math.min(e.minY,i.minY),o=Math.max(e.maxX,i.maxX),r=Math.max(e.maxY,i.maxY);return ICEBoundingBox.fromDimension(s,n,o-s,r-n)}get width(){const t=this.br[0]-this.bl[0],e=this.br[1]-this.bl[1];return Math.hypot(t,e)}get height(){const t=this.br[0]-this.tr[0],e=this.br[1]-this.tr[1];return Math.hypot(t,e)}get left(){return this.tl[0]}set left(t){throw new Error("Can not set left to ICEBoundingBox directly.")}get top(){return this.tl[1]}set top(t){throw new Error("Can not set top to ICEBoundingBox directly.")}get centerX(){return this.center[0]}get centerY(){return this.center[1]}get centerPoint(){return this.center}}var D=ICEBoundingBox;const $={sm:{shadowColor:"rgba(0,0,0,0.12)",shadowBlur:4,shadowOffsetX:0,shadowOffsetY:1},md:{shadowColor:"rgba(0,0,0,0.18)",shadowBlur:10,shadowOffsetX:0,shadowOffsetY:3},lg:{shadowColor:"rgba(0,0,0,0.25)",shadowBlur:20,shadowOffsetX:0,shadowOffsetY:6}},A=[["shadowColor","rgba(0,0,0,0)"],["shadowBlur",0],["shadowOffsetX",0],["shadowOffsetY",0],["globalAlpha",1],["globalCompositeOperation","source-over"],["lineCap","butt"],["lineJoin","miter"],["miterLimit",10],["textAlign","start"],["textBaseline","alphabetic"]],L=Object.freeze([1,0,0,1,0,0]),R={left:0,top:0,width:0,height:0,style:Object.freeze({fillStyle:"red",strokeStyle:"blue",lineWidth:1}),lineDash:Object.freeze([]),lineDashOffset:0,lineDashFlow:!1,lineDashFlowSpeed:60,lineBorder:!1,lineBorderWidth:1.5,lineBorderColor:"#999999",fill:!0,stroke:!0,animations:Object.freeze({}),transform:Object.freeze({translate:Object.freeze([0,0]),scale:Object.freeze([1,1]),skew:Object.freeze([0,0]),rotate:0}),linearMatrix:Object.freeze([]),composedMatrix:Object.freeze([]),origin:"localCenter",originX:0,originY:0,clipChildren:!1,opacity:1,localOrigin:Object.freeze([0,0]),absoluteOrigin:Object.freeze([0,0]),display:!0,draggable:!0,transformable:!0,interactive:!0,linkable:!0,showMinBoundingBox:!1,showMaxBoundingBox:!1};function normalizeGradientStops(t){const e=[];if(!Array.isArray(t))return e;for(let i=0;i<t.length;i++){const s=t[i];let n=NaN,o="";Array.isArray(s)?(n=Number(s[0]),o=String(s[1])):s&&"object"==typeof s&&(n=Number(s.offset),o=String(s.color)),isFinite(n)&&o&&e.push([n<0?0:n>1?1:n,o])}return e.sort((t,e)=>t[0]-e[0]),e}class ICEComponent extends N{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),_defineProperty$1(this,"__dirty",!0),_defineProperty$1(this,"__everRendered",!1),_defineProperty$1(this,"__localBoxScratch",[0,0,0,0]),_defineProperty$1(this,"__activeCtm",null),_defineProperty$1(this,"__activeWorldMatrix",null),_defineProperty$1(this,"__visEpoch",-1),_defineProperty$1(this,"__visValue",!0),_defineProperty$1(this,"__opacityApplied",!1),_defineProperty$1(this,"__gradCache",{}),_defineProperty$1(this,"__paramsDirty",!0),_defineProperty$1(this,"__absScratchA",null),_defineProperty$1(this,"__absScratchB",null),_defineProperty$1(this,"__transScratch",null),_defineProperty$1(this,"__originScratch",null),_defineProperty$1(this,"__composeScratch",null),_defineProperty$1(this,"__viewportScratch",null),this.__userProps=t,t&&t.preset&&S[t.preset]&&(this.__presetName=t.preset,t=merge$1({},S[t.preset](getTheme()),t)),this.props=Object.create(R),this.props.id="ICE_"+function uuid(){if(I.crypto)return I.crypto.randomUUID();{let t=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:3&i|8).toString(16)}))}}(),this.props.zIndex=ICEComponent.instanceCounter++,merge$1(this.props,t),this.__initState(),this.root=I,this.initEvents()}__initState(){this.state=Object.create(R),this.state.id=this.props.id,this.state.zIndex=this.props.zIndex;for(const t in this.props)Object.prototype.hasOwnProperty.call(this.props,t)&&(this.state[t]=cloneDeep(this.props[t]));this.state.linearMatrix=[],this.state.composedMatrix=[],this.state.localOrigin=[0,0],this.state.absoluteOrigin=[0,0]}__reapplyPreset(t){if(!this.__presetName||!S[this.__presetName])return;const e=S[this.__presetName](t||getTheme()),i=this.__userProps||{},s={};for(const t in e)"style"===t?s.style=merge$1({},e.style,i.style):void 0!==i[t]?s[t]=i[t]:s[t]=e[t];this.setState(s)}initEvents(){this.on("mousedown",this.mouseDownEvtHandler,this),this.on("keydown",this.keyboardEvtHandler,this),this.on("keyup",this.keyboardEvtHandler,this)}mouseDownEvtHandler(t){this.state.interactive&&this.state.draggable&&(this.on("mousemove",this.mouseMoveEvtHandler,this),this.on("mouseup",this.mouseUpEvtHandler,this))}mouseMoveEvtHandler(t){const e=this.ice&&this.ice.viewport?this.ice.viewport.scale:1,i=t.movementX/e,s=t.movementY/e;return this.moveGlobalPosition(i,s,t),!0}mouseUpEvtHandler(t){this.off("mousemove",this.mouseMoveEvtHandler,this),this.off("mouseup",this.mouseUpEvtHandler,this)}keyboardEvtHandler(t){switch(t.key){case"ArrowUp":this.moveGlobalPosition(0,-2,t);break;case"ArrowDown":this.moveGlobalPosition(0,2,t);break;case"ArrowLeft":this.moveGlobalPosition(-2,0,t);break;case"ArrowRight":this.moveGlobalPosition(2,0,t);break;case"Delete":this.parentNode&&this.parentNode.removeChild?this.parentNode.removeChild(this):this.ice.removeChild(this)}}render(){this.__renderCore(null,!0)}renderTo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!t)return;const i=this.ctx;this.ctx=t;try{this.__renderCore(e,!1)}finally{this.ctx=i}}isEffectivelyVisible(){if(this.__visEpoch===getVisibilityEpoch())return this.__visValue;const t=this.__computeEffectivelyVisible();return this.__visEpoch=getVisibilityEpoch(),this.__visValue=t,t}__computeEffectivelyVisible(){if(!this.state.display)return!1;let t=this.parentNode;for(;t&&t.state;){if(!t.state.display)return!1;t=t.parentNode}return!0}__renderCore(t,e){if(this.trigger(i),!this.isEffectivelyVisible())return;this.refreshParams(),this.applyStyleToCtx();const n=this.__effectiveOpacity();1!==n&&(this.__applyStyleProp("globalAlpha",(Number(this.ctx.globalAlpha)||1)*n),this.__opacityApplied=!0),this.applyTransformToCtx(t,e);const o=this.__applyAncestorClips();this.doRender(),o&&this.ctx.restore(),this.__resetLeakyCtxState(),this.trigger(s),this.__everRendered=!0,this.dirty=!1}applyStyleToCtx(){const t=this.props.style,e=this.state.style;let i=null,s=null;if(t)for(const e in t)"fillGradient"!==e?"strokeGradient"!==e?this.__applyStyleProp(e,t[e]):s=t[e]:i=t[e];if(e)for(const t in e)"fillGradient"!==t?"strokeGradient"!==t?this.__applyStyleProp(t,e[t]):s=e[t]:i=e[t];i&&this.__applyStyleProp("fillGradient",i),s&&this.__applyStyleProp("strokeGradient",s)}__applyStyleProp(t,e){if("fillGradient"!==t&&"strokeGradient"!==t){if("shadow"===t&&"string"==typeof e&&$[e]){const t=$[e];return this.ctx.shadowColor=t.shadowColor,this.ctx.shadowBlur=t.shadowBlur,this.ctx.shadowOffsetX=t.shadowOffsetX,void(this.ctx.shadowOffsetY=t.shadowOffsetY)}this.ctx[t]=e}else{const i="fillGradient"===t?"fillStyle":"strokeStyle",s=this.__resolveGradient("fillGradient"===t?"fill":"stroke",e);if(s)this.ctx[i]=s;else if(e){const t=normalizeGradientStops(e.stops);t.length&&(this.ctx[i]=t[Math.floor(t.length/2)][1])}}}__resolveGradient(t,e){if(!e||"object"!=typeof e)return null;const i=this.__gradCache[t];if(i&&i.src===e)return i.grad;const s=this.__buildGradient(e);return this.__gradCache[t]={src:e,grad:s},s}__buildGradient(t){const e=this.ctx;if(!e)return null;const i=normalizeGradientStops(t.stops);if(i.length<1)return null;const s=Number(this.state.width)||0,n=Number(this.state.height)||0,o=t.type||"linear";let r=null;if("radial"===o&&"function"==typeof e.createRadialGradient){const i=Array.isArray(t.center)?t.center:[s/2,n/2],o=Number(t.radius)>0?Number(t.radius):Math.max(s,n)/2,a=Number(t.innerRadius)>0?Number(t.innerRadius):0;r=e.createRadialGradient(i[0],i[1],a,i[0],i[1],o)}else if("conic"===o&&"function"==typeof e.createConicGradient){const i=Array.isArray(t.center)?t.center:[s/2,n/2];r=e.createConicGradient(Number(t.startAngle)||0,i[0],i[1])}else{if("conic"===o)return null;if("function"==typeof e.createLinearGradient){const i=Array.isArray(t.from)?t.from:[0,0],n=Array.isArray(t.to)?t.to:[s,0];r=e.createLinearGradient(i[0],i[1],n[0],n[1])}}if(!r&&"function"!=typeof e.createLinearGradient)return null;if(!r)return null;for(let e=0;e<i.length;e++)try{r.addColorStop(i[e][0],i[e][1])}catch(t){}return r}calcComponentParams(){return{width:this.state.width,height:this.state.height}}__localBox(){const t=this.__localBoxScratch;return t[0]=0,t[1]=0,t[2]=this.state.width||0,t[3]=this.state.height||0,t}measure(){this.refreshParams()}refreshParams(){this.__paramsDirty&&(this.calcComponentParams(),this.__paramsDirty=!1,this.__gradCache.fill=void 0,this.__gradCache.stroke=void 0)}calcLocalOrigin(){let t=this.state.localOrigin;(!t||t.length<2)&&(t=this.state.localOrigin=[0,0]),t[0]=0,t[1]=0;const e=this.state.origin;return e&&"localCenter"!==e?"top-left"===e?(t[0]=0,t[1]=0):"custom"===e&&(t[0]=Number(this.state.originX)||0,t[1]=Number(this.state.originY)||0):(t[0]=this.state.width/2,t[1]=this.state.height/2),this.state.localOrigin=t,t}calcAbsoluteOrigin(){const t=this.state.transform,e=t.translate[0]+this.state.left,i=t.translate[1]+this.state.top,s=this.calcLocalOrigin();let n=this.__originScratch;return n||(n=this.__originScratch=[0,0]),n[0]=s[0]+e,n[1]=s[1]+i,this.parentNode&&(transformMat2d(n,n,[1,0,0,1,-this.parentNode.state.localOrigin[0],-this.parentNode.state.localOrigin[1]]),transformMat2d(n,n,this.parentNode.state.composedMatrix)),this.state.absoluteOrigin=n,n}calcLinearMatrix(){(!this.state.linearMatrix||this.state.linearMatrix.length<6)&&(this.state.linearMatrix=function create$1(){var t=new B(6);return B!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}());const t=this.state.linearMatrix;!function identity(t){t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0}(t);const e=this.state.transform,i=e.skew[0],s=e.skew[1];return function skew(t,e,i,s){const n=Math.tan(i),o=Math.tan(s);t[0]=e[0],t[1]=e[1]+n,t[2]=e[2]+o,t[3]=e[3],t[4]=e[4],t[5]=e[5]}(t,t,toRadian(i),toRadian(s)),function rotate(t,e,i){var s=e[0],n=e[1],o=e[2],r=e[3],a=e[4],h=e[5],l=Math.sin(i),c=Math.cos(i);t[0]=s*c+o*l,t[1]=n*c+r*l,t[2]=s*-l+o*c,t[3]=n*-l+r*c,t[4]=a,t[5]=h}(t,t,toRadian(e.rotate)),function scale(t,e,i){var s=e[0],n=e[1],o=e[2],r=e[3],a=e[4],h=e[5],l=i[0],c=i[1];t[0]=s*l,t[1]=n*l,t[2]=o*c,t[3]=r*c,t[4]=a,t[5]=h}(t,t,[e.scale[0],e.scale[1]]),this.state.linearMatrix=t,t}calcAbsoluteLinearMatrix(){let t=this,e=t.calcLinearMatrix();this.__absScratchA||(this.__absScratchA=[0,0,0,0,0,0]),this.__absScratchB||(this.__absScratchB=[0,0,0,0,0,0]);let i=this.__absScratchA;for(;t.parentNode;){const s=t.parentNode,n=s.state&&s.state.linearMatrix&&s.state.linearMatrix.length>=6&&!s.dirty?s.state.linearMatrix:s.calcLinearMatrix();i=i===this.__absScratchA?this.__absScratchB:this.__absScratchA,multiply(i,n,e),e=i,t=s}return this.state.absoluteLinearMatrix=e,e}composeMatrix(){if(this.parentNode&&"function"==typeof this.parentNode.composeMatrix){const t=this.parentNode,e=t.state?t.state.composedMatrix:null;(t.dirty||!e||e.length<6)&&t.composeMatrix()}const t=this.calcAbsoluteOrigin();this.__transScratch||(this.__transScratch=[1,0,0,1,0,0]),this.__transScratch[4]=t[0],this.__transScratch[5]=t[1];const e=this.__transScratch,i=this.calcAbsoluteLinearMatrix();(!this.state.composedMatrix||this.state.composedMatrix.length<6)&&(this.state.composedMatrix=[1,0,0,1,0,0]);const s=multiply(this.state.composedMatrix,e,i);return this.state.composedMatrix=s,s}applyTransformToCtx(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.dirty?this.composeMatrix():this.state.composedMatrix,s=e&&this.ice?this.ice.getRenderViewport():null,n=s&&(1!==s.scale||0!==s.tx||0!==s.ty);let o=null;if(n){this.__viewportScratch||(this.__viewportScratch=[1,0,0,1,0,0]);const t=this.__viewportScratch;t[0]=s.scale,t[1]=0,t[2]=0,t[3]=s.scale,t[4]=s.tx,t[5]=s.ty,o=t}else t&&(o=t);if(this.__activeWorldMatrix=o,t||n){this.__composeScratch||(this.__composeScratch=[1,0,0,1,0,0]);const e=this.__composeScratch;multiply(e,o||t,i),this.__activeCtm=e,this.ctx.setTransform(e[0],e[1],e[2],e[3],e[4],e[5])}else this.__activeCtm=i,this.ctx.setTransform(...i)}applyActiveTransform(){const t=this.__activeCtm;t?this.ctx.setTransform(t[0],t[1],t[2],t[3],t[4],t[5]):this.applyTransformToCtx(null,!0)}hasClippingAncestor(){let t=this.parentNode;for(;t&&t.state;){if(t.state.clipChildren)return!0;t=t.parentNode}return!1}__effectiveOpacity(){const t=this.state.opacity;let e=void 0===t?1:Number(t);e>=0||(e=1);let i=this.parentNode;for(;i&&i.state;){const t=void 0===i.state.opacity?1:Number(i.state.opacity);t>=0&&1!==t&&(e*=t),i=i.parentNode}return e}isPointClippedOut(t,e){let i=this.parentNode;for(;i&&i.state;){if(i.state.clipChildren){const s=i.__paintWorldBox();if(t<s[0]||t>s[2]||e<s[1]||e>s[3])return!0}i=i.parentNode}return!1}__applyAncestorClips(){const t=this.parentNode;if(!t||!t.state)return!1;const e=this.ctx;if(!e||"function"!=typeof e.clip||"function"!=typeof e.rect)return!1;let i=null,s=t;for(;s&&s.state;)s.state.clipChildren&&(i||(i=[])).push(s),s=s.parentNode;if(!i)return!1;const n=this.__activeWorldMatrix||L;e.save(),e.setTransform(1,0,0,1,0,0);for(let t=i.length-1;t>=0;t--){const s=i[t].__paintWorldBox(),o=n[0]*s[0]+n[2]*s[1]+n[4],r=n[1]*s[0]+n[3]*s[1]+n[5],a=n[0]*s[2]+n[2]*s[1]+n[4],h=n[1]*s[2]+n[3]*s[1]+n[5],l=n[0]*s[0]+n[2]*s[3]+n[4],c=n[1]*s[0]+n[3]*s[3]+n[5],d=n[0]*s[2]+n[2]*s[3]+n[4],u=n[1]*s[2]+n[3]*s[3]+n[5],p=Math.min(o,a,l,d),f=Math.min(r,h,c,u),g=Math.max(o,a,l,d),y=Math.max(r,h,c,u);e.beginPath(),e.rect(p,f,g-p,y-f),e.clip()}return this.applyActiveTransform(),!0}applyWorldTransform(){const t=this.__activeWorldMatrix;t?(this.ctx.setTransform(t[0],t[1],t[2],t[3],t[4],t[5]),this.ctx.lineWidth=1/(Math.abs(t[0])||Math.abs(t[3])||1)):(this.ctx.setTransform(1,0,0,1,0,0),this.ctx.lineWidth=1)}doRender(){if(this.applyWorldTransform(),this.state.showMinBoundingBox||this.state.showMaxBoundingBox){const t=this.state.showMinBoundingBox?this.getMinBoundingBox():null,e=this.state.showMaxBoundingBox?this.getMaxBoundingBox():null,i=t&&e&&this.__areBoundingBoxesNearlyEqual(t,e);t&&!i&&(this.ctx.strokeStyle="#ff0000",this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.beginPath(),this.ctx.moveTo(t.tl[0],t.tl[1]),this.ctx.lineTo(t.tr[0],t.tr[1]),this.ctx.lineTo(t.br[0],t.br[1]),this.ctx.lineTo(t.bl[0],t.bl[1]),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fill()),e&&(this.ctx.strokeStyle="#0000ff",this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.beginPath(),this.ctx.moveTo(e.tl[0],e.tl[1]),this.ctx.lineTo(e.tr[0],e.tr[1]),this.ctx.lineTo(e.br[0],e.br[1]),this.ctx.lineTo(e.bl[0],e.bl[1]),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fill())}}__areBoundingBoxesNearlyEqual(t,e){const i=[[t.tl,e.tl],[t.tr,e.tr],[t.bl,e.bl],[t.br,e.br]];for(const[t,e]of i)if(Math.abs(t[0]-e[0])>1||Math.abs(t[1]-e[1])>1)return!1;return!0}getMinBoundingBox(){const t=arguments.length>0&&void 0!==arguments[0]&&arguments[0]?this.composeMatrix():this.state.composedMatrix,e=this.state.localOrigin[0],i=this.state.localOrigin[1],s=this.__localBox(),n=s[0]-e,o=s[1]-i,r=s[2]-e,a=s[3]-i;let h=new D([n,o,r,o,n,a,r,a,0,0]);return h=h.transform(t),h}getMaxBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.getMinBoundingBox(t);const{minX:i,minY:s,maxX:n,maxY:o}=e.getMinAndMaxPoint(),r=e.centerPoint;return e=new D([i,s,n,s,i,o,n,o,r[0],r[1]]),e}setState(t){const e=this.__beforeStateMerge(t);merge$1(this.state,t),this.paramsDirty=!0,this.dirty=!0,this.ice&&(this.ice.dirty=!0),this.__afterStateMerge(e)}__beforeStateMerge(t){const e=!!t&&(void 0!==t.width&&t.width!==this.state.width||void 0!==t.height&&t.height!==this.state.height);return t&&void 0!==t.display&&t.display!==this.state.display&&bumpVisibilityEpoch(),e}__afterStateMerge(t){t&&this.parentNode&&"function"==typeof this.parentNode.requestLayout&&this.parentNode.requestLayout()}set dirty(t){this.__dirty=t}get dirty(){return this.__dirty}__applyDirty(t){this.dirty=t||!this.__everRendered}set paramsDirty(t){this.__paramsDirty=t}get paramsDirty(){return this.__paramsDirty}setPosition(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new O;this.trigger(y,_objectSpread2(_objectSpread2({},i),{},{left:t,top:e})),this.setState({left:t,top:e}),this.trigger(m,_objectSpread2(_objectSpread2({},i),{},{left:t,top:e}))}moveGlobalPosition(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new O;if(this.parentNode){let i=[t,e];i=transformMat2d([],i,invert([],this.parentNode.calcAbsoluteLinearMatrix())),t=i[0],e=i[1]}this.setPosition(this.state.left+t,this.state.top+e,_objectSpread2(_objectSpread2({},i),{},{tx:t,ty:e}))}setGlobalPosition(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new O;if(this.parentNode){let i=[t,e];i=transformMat2d([],i,invert([],this.parentNode.calcAbsoluteLinearMatrix())),t=i[0],e=i[1]}this.setPosition(t,e,_objectSpread2(_objectSpread2({},i),{},{left:t,top:e}))}setGlobalRotate(t){if(this.parentNode){const e=this.parentNode.calcAbsoluteLinearMatrix();t-=GeoUtil.calcRotateAngleFromMatrix(e)}this.setState({transform:{rotate:t}})}localToGlobal(t,e){let i=[t,e];return i=transformMat2d([],i,this.state.composedMatrix),i}globalToLocal(t,e){let i=[t,e];return i=transformMat2d([],i,invert([],this.state.composedMatrix)),i}getRotateAngle(){const t=arguments.length>0&&void 0!==arguments[0]&&arguments[0]?this.composeMatrix():this.state.composedMatrix;return GeoUtil.calcRotateAngleFromMatrix(t)}getLocalLeftTop(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.getMinBoundingBox(t),i=e.width,s=e.height;return{left:e.centerX-e.width/2,top:e.centerY-e.height/2,width:i,height:s}}__resetLeakyCtxState(){let t=0;const scan=e=>{if(e)for(const i in e){const e=this.__leakyIndex(i);e>=0&&(t|=1<<e)}};if(scan(this.props.style),scan(this.state.style),this.__opacityApplied&&(t|=1<<this.__leakyIndex("globalAlpha"),this.__opacityApplied=!1),this.state.lineDash&&this.state.lineDash.length&&(t|=2048),(this.state.lineDashFlow||this.state.lineDashOffset)&&(t|=2048),!t)return;const e=this.ctx;for(let i=0;i<A.length;i++)t&1<<i&&(e[A[i][0]]=A[i][1]);2048&t&&"function"==typeof e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0)}__leakyIndex(t){switch(t){case"shadowColor":return 0;case"shadowBlur":return 1;case"shadowOffsetX":return 2;case"shadowOffsetY":return 3;case"globalAlpha":return 4;case"globalCompositeOperation":return 5;case"lineCap":return 6;case"lineJoin":return 7;case"miterLimit":return 8;case"textAlign":return 9;case"textBaseline":return 10;default:return-1}}__paintWorldBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0,0];const e=this.state.composedMatrix,i=this.state.localOrigin,s=i?i[0]:0,n=i?i[1]:0,o=this.__localBox(),r=[o[0]-s,o[2]-s],a=[o[1]-n,o[3]-n];if(t[0]=t[1]=1/0,t[2]=t[3]=-1/0,!e||e.length<6)return t[0]=r[0],t[1]=a[0],t[2]=r[1],t[3]=a[1],t;const h=e[0],l=e[1],c=e[2],d=e[3],u=e[4],p=e[5];for(let e=0;e<2;e++){const i=r[e];for(let e=0;e<2;e++){const s=a[e],n=h*i+c*s+u,o=l*i+d*s+p;n<t[0]&&(t[0]=n),n>t[2]&&(t[2]=n),o<t[1]&&(t[1]=o),o>t[3]&&(t[3]=o)}}return t}containsPoint(t,e){const i=this.state.composedMatrix;if(!i||i.length<6)return this.getMinBoundingBox().containsPoint([t,e]);const s=transformMat2d([],[t,e],invert([],i));return this.containsLocalPoint(s[0],s[1])}containsLocalPoint(t,e){const i=this.state.width/2,s=this.state.height/2;return t>=-i&&t<=i&&e>=-s&&e<=s}destroy(){this.destory()}destory(){this.ice&&this.ice.animationManager&&this.ice.animationManager.remove(this),this.trigger(r,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}_defineProperty$1(ICEComponent,"instanceCounter",0);var z=ICEComponent,j=class ICEPath extends z{constructor(){super(_objectSpread2({closePath:!0},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})),_defineProperty$1(this,"path2D",I.createPath2D()),_defineProperty$1(this,"__flowRegistered",!1)}doRender(){this.dirty&&this.createPathObject(),this.state.closePath&&this.path2D.closePath();const t=this.state.lineDash,e=Array.isArray(t)&&t.length>0,i=this.state.lineDashFlow;if(i&&this.__ensureFlowAnimation(),this.state.lineBorder&&e&&this.state.stroke){const t=this.ctx;t.save(),t.setLineDash([]),t.lineWidth=(this.state.style.lineWidth||1)+2*(this.state.lineBorderWidth||4),t.strokeStyle=this.state.lineBorderColor||"#c8c8c8",this.path2D._isPolyfill?(this.replayPath(),t.stroke()):t.stroke(this.path2D),t.restore()}if(e&&"function"==typeof this.ctx.setLineDash)if(this.ctx.setLineDash(t),i&&"number"==typeof this.ctx.lineDashOffset){const e=t.reduce((t,e)=>t+e,0)||1,i=this.state.lineDashFlowSpeed||60;this.ctx.lineDashOffset=-Date.now()/1e3*i%e}else this.state.lineDashOffset&&(this.ctx.lineDashOffset=this.state.lineDashOffset);this.path2D._isPolyfill?(this.replayPath(),this.state.fill&&this.ctx.fill(),this.state.stroke&&this.ctx.stroke()):(this.state.fill&&this.ctx.fill(this.path2D),this.state.stroke&&this.ctx.stroke(this.path2D)),e&&"function"==typeof this.ctx.setLineDash&&this.ctx.setLineDash([]),super.doRender()}__ensureFlowAnimation(){this.__flowRegistered||(this.__flowRegistered=!0,this.props.animations=_objectSpread2(_objectSpread2({},this.props.animations),{},{__flow:{from:0,to:1,duration:100,loop:!0}}),this.ice&&this.ice.animationManager&&this.ice.animationManager.add(this))}replayPath(){const t=this.ctx;t.beginPath();const e=this.path2D._commands;for(let i=0;i<e.length;i++){const s=e[i];t[s[0]](...s.slice(1))}this.path2D._closed&&t.closePath()}},F=class ICERect extends j{constructor(){super(_objectSpread2({width:10,height:10},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}))}createPathObject(){this.path2D=I.createPath2D();const t=0-this.state.localOrigin[0],e=0-this.state.localOrigin[1],i=this.state.width,s=this.state.height,n=Math.min(this.state.radius||0,i/2,s/2);return n>0?(this.path2D.moveTo(t+n,e),this.path2D.lineTo(t+i-n,e),this.path2D.arcTo(t+i,e,t+i,e+n,n),this.path2D.lineTo(t+i,e+s-n),this.path2D.arcTo(t+i,e+s,t+i-n,e+s,n),this.path2D.lineTo(t+n,e+s),this.path2D.arcTo(t,e+s,t,e+s-n,n),this.path2D.lineTo(t,e+n),this.path2D.arcTo(t,e,t+n,e,n),this.path2D.closePath()):this.path2D.rect(t,e,i,s),this.path2D}};class ICEGroup extends F{constructor(t){super(t),_defineProperty$1(this,"parentNode",null),_defineProperty$1(this,"childNodes",[]),_defineProperty$1(this,"__childSet",new WeakSet),_defineProperty$1(this,"layoutManager",null),_defineProperty$1(this,"__layoutExplicit",!1),_defineProperty$1(this,"__layoutRequested",!1),_defineProperty$1(this,"__layingOut",!1),_defineProperty$1(this,"__inBatch",!1)}setLayout(t){this.layoutManager=t,this.__layoutExplicit=!0,t&&(this.doLayout(),this.__disableTransformRecursively(this)),this.__propagateLayout(t)}__disableTransformRecursively(t){if(t&&t.childNodes)for(const e of t.childNodes)e.state.transformable=!1,e.state.draggable=!1,this.__disableTransformRecursively(e)}__propagateLayout(t){for(const e of this.childNodes)e instanceof ICEGroup&&!e.__layoutExplicit&&(e.layoutManager=t,e.doLayout(),e.__propagateLayout(t))}doLayout(){if(this.layoutManager){this.__layingOut=!0;try{for(let t=0;t<this.childNodes.length;t++){const e=this.childNodes[t];"function"==typeof e.measure&&e.measure()}this.layoutManager.layoutContainer(this)}finally{this.__layingOut=!1,this.__layoutRequested=!1}}}requestLayout(){this.layoutManager&&!this.__layingOut&&(this.__layoutRequested=!0,this.dirty=!0,this.ice&&(this.ice.dirty=!0))}getPreferredSize(){return this.layoutManager?this.layoutManager.getPreferredSize(this):[0,0]}doRender(){this.__layoutRequested&&this.doLayout(),super.doRender()}initEvents(){super.initEvents(),this.once(o,this.afterAddHandler,this)}afterAddHandler(){for(let t=0;t<this.childNodes.length;t++){const e=this.childNodes[t];this.syncChildEvents(e)}}syncChildEvents(t){t.trigger(n),t.ice=this.ice,t.ctx=this.ice.ctx,t.evtBus=this.ice.evtBus,t.trigger(o)}addChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.__childSet.has(t)||(t.parentNode=this,this.childNodes.push(t),this.__childSet.add(t),bumpVisibilityEpoch(),this.layoutManager&&(t.state.transformable=!1,t.state.draggable=!1,this.__disableTransformRecursively(t)),this.__applyDirty(e),this.ice&&(this.syncChildEvents(t),this.ice.dirty=e,this.ice.renderer&&this.ice.renderer.markQueueDirty()),this.layoutManager&&(t instanceof ICEGroup&&!t.__layoutExplicit&&(t.layoutManager=this.layoutManager),this.__inBatch||this.doLayout()))}addChildren(t){this.__inBatch=!0;try{for(let e=0;e<t.length;e++)this.addChild(t[e],!1)}finally{this.__inBatch=!1}this.dirty=!0,this.ice&&(this.ice.dirty=!0),this.doLayout()}removeChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.__childSet.has(t))return;t.trigger(r);const i=this.childNodes.indexOf(t);-1!==i&&this.childNodes.splice(i,1),this.__childSet.delete(t),bumpVisibilityEpoch(),t.trigger(a),this.__applyDirty(e),this.ice&&(this.ice.dirty=e,this.ice.renderer&&this.ice.renderer.markQueueDirty()),t.destory(),this.layoutManager&&!this.__inBatch&&this.doLayout()}removeChildren(t){this.__inBatch=!0;try{for(let e=0;e<t.length;e++)this.removeChild(t[e],!1)}finally{this.__inBatch=!1}this.dirty=!0,this.ice&&(this.ice.dirty=!0),this.doLayout()}setState(t){const e=this.__beforeStateMerge(t);merge$1(this.state,t),this.paramsDirty=!0,this.dirty=!0,function setRecursively(t){if(t.dirty=!0,t.childNodes&&t.childNodes.length)for(let e=0;e<t.childNodes.length;e++)setRecursively(t.childNodes[e])}(this),this.ice&&(this.ice.dirty=!0),this.__afterStateMerge(e)}destory(){this.removeChildren(this.childNodes),super.destory()}}var X=ICEGroup;class ICEControlPanel extends X{constructor(t){super(_objectSpread2(_objectSpread2({},t),{},{linkable:!1})),_defineProperty$1(this,"isControlPanel",!0)}doRender(){super.doRender(),this.updateControlPositions()}moveGlobalPosition(t,e,i){super.moveGlobalPosition(t,e,i),this._targetComponent&&this._targetComponent.moveGlobalPosition(t,e,i)}}var H=class ICEEllipse extends j{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=_objectSpread2({radiusX:20,radiusY:10,rotation:0,startAngle:0,endAngle:2*Math.PI,counterclockwise:!0},t);void 0===t.radiusX&&void 0!==t.width&&(e.radiusX=Number(t.width)/2),void 0===t.radiusY&&void 0!==t.height&&(e.radiusY=Number(t.height)/2),e.width=2*e.radiusX,e.height=2*e.radiusY,super(e)}createPathObject(){return this.path2D=I.createPath2D(),this.path2D.ellipse(this.state.radiusX-this.state.localOrigin[0],this.state.radiusY-this.state.localOrigin[1],this.state.radiusX,this.state.radiusY,this.state.rotation,this.state.startAngle,this.state.endAngle,this.state.counterclockwise),this.path2D.closePath(),this.path2D}containsLocalPoint(t,e){const i=this.state.radiusX,s=this.state.radiusY;if(!i||!s)return!1;let n=t,o=e;const r=this.state.rotation||0;if(r){const i=Math.cos(r),s=Math.sin(r);n=t*i+e*s,o=-t*s+e*i}const a=n/i,h=o/s;return a*a+h*h<=1}setState(t){isNil$1(t.radiusX)?isNil$1(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,isNil$1(t.radiusY)?isNil$1(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,super.setState(t)}},V=class ICECircle extends H{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=_objectSpread2({radius:10},t);void 0===t.radius&&void 0!==t.width?e.radius=Number(t.width)/2:void 0===t.radius&&void 0!==t.height&&(e.radius=Number(t.height)/2),e.radiusX=e.radius,e.radiusY=e.radius,super(e)}};class ICELinkHook extends V{constructor(){super(_objectSpread2({linkable:!1},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}))}initEvents(){super.initEvents(),this.on("mousedown",this.mosueDownHandler,this),this.on("mousemove",this.mosueMoveHandler,this),this.on("mouseup",this.mosueUpHandler,this),this.on(m,this.resizeEvtHandler,this)}keyboardEvtHandler(t){}mosueDownHandler(t){this.evtBus.trigger(l,new O({target:this}))}mosueMoveHandler(t){this.evtBus.trigger(c,new O({target:this}))}mosueUpHandler(t){this.evtBus.trigger(d,new O({target:this}))}resizeEvtHandler(t){if(!this.parentNode)return;const e=this.props.position;this.parentNode.trigger(u,new O(t,{position:e})),this.parentNode.trigger(p,new O(t,{position:e}))}}class LineControlPanel extends ICEControlPanel{constructor(t){super(_objectSpread2(_objectSpread2({},t),{},{zIndex:10001e3,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1})),_defineProperty$1(this,"controlSize",16),this.initControls()}initControls(){const t=this.state.width,e=this.state.height,i=this.controlSize/2;this.startControl=new ICELinkHook({zIndex:10001001,display:!1,left:-i,top:-i,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"start"}),this.addChild(this.startControl),this.endControl=new ICELinkHook({zIndex:10001002,display:!1,left:t-i,top:e-i,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"end"}),this.addChild(this.endControl)}initEvents(){this.on(p,this.resizeEvtHandler,this)}enable(){this.setState({display:!0}),this.resume(p),this.showHooks()}disable(){this.setState({display:!1}),this.suspend(p),this.hideHooks()}updateControlPositions(){}resizeEvtHandler(t){if(!this.targetComponent)return;const e=t.position;let i=t.movementX,s=t.movementY;const n=this.targetComponent.state,o=n.points.length;let r=n.points[0][0],a=n.points[0][1],h=n.points[o-1][0],l=n.points[o-1][1];const c=transformMat2d([],[i,s],invert([],this.targetComponent.calcAbsoluteLinearMatrix()));switch(i=c[0],s=c[1],e){case"start":r+=i,a+=s;break;case"end":h+=i,l+=s}this.targetComponent.setState({startPoint:[r,a],endPoint:[h,l]})}updatePosition(){if(!this.targetComponent)return;this.setState({left:0,top:-5,width:3,height:3,transform:{translate:[0,0],scale:[1,1],skew:[0,0],rotate:0}});const t=this.controlSize/2,e=this.targetComponent.state.points.length,i=this.targetComponent.state.points[0],s=this.targetComponent.state.points[e-1],n=[i[0],i[1]],o=[s[0],s[1]];this.startControl.setState({left:n[0]-t,top:n[1]-t}),this.endControl.setState({left:o[0]-t,top:o[1]-t})}set targetComponent(t){this._targetComponent&&this._targetComponent.off(m,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(m,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(r,()=>{this.targetComponent=null,this.disable()},this),this.updatePosition()}get targetComponent(){return this._targetComponent}showHooks(){this.startControl.setState({display:!0}),this.endControl.setState({display:!0})}hideHooks(){this.startControl.setState({display:!1}),this.endControl.setState({display:!1})}}class ResizeControl extends F{constructor(t){super(_objectSpread2(_objectSpread2({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}initEvents(){super.initEvents(),this.on(m,this.resizeEvtHandler,this)}resizeEvtHandler(t){if(!this.parentNode)return;const{quadrant:e}=t;let i=t.movementX,s=t.movementY;const n=this.parentNode.state;let o=n.left,r=n.top,a=n.width,h=n.height;const l=transformMat2d([],[i,s],invert([],this.parentNode.calcAbsoluteLinearMatrix()));switch(i=l[0],s=l[1],e){case 1:o-=i,r+=s,a+=2*i,h-=2*s;break;case 2:o+=i,r+=s,a-=2*i,h-=2*s;break;case 3:o+=i,r-=s,a-=2*i,h+=2*s;break;case 4:o-=i,r-=s,a+=2*i,h+=2*s;break;case 5:r+=s,h-=2*s;break;case 6:r-=s,h+=2*s;break;case 7:o+=i,a-=2*i;break;case 8:o-=i,a+=2*i}const c={top:r,left:o,width:Math.abs(a),height:Math.abs(h)};this.parentNode.trigger(u,new O(t,{quadrant:e})),this.parentNode.setState(c),this.parentNode.trigger(p,new O(t,{quadrant:e}))}moveGlobalPosition(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new O;const s=t>0?1:-1,n=e>0?1:-1,o=this.parentNode.state.localOrigin,r=transformMat2d([],[t,e],invert([],this.parentNode.calcAbsoluteLinearMatrix()));t=r[0],e=r[1];let{left:a,top:h}=this.state;const{quadrant:l}=this.state,c=this.state.width/2;let d=0;"x"===this.state.direction?(a+=t,0===round(a)&&(a=.5*s),d=a+c-o[0]>0?8:7):"y"===this.state.direction?(h+=e,0===round(h)&&(h=.5*n),d=h+c-o[1]>0?6:5):"xy"===this.state.direction&&(a+=t,h+=e,d=a+c-o[0]>0?h+c-o[1]>0?4:1:h+c-o[1]>0?3:2),l!==d&&this.parentNode.toggleControlQuadrant(this,l,d),this.setPosition(a,h,new O(i,{left:a,top:h,tx:t,ty:e,quadrant:d}))}}class RotateControl extends V{constructor(t){super(_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))}initEvents(){super.initEvents(),this.on(m,this.rotateEvtHandler,this)}rotateEvtHandler(t){if(!this.parentNode)return;const e=this.parentNode.calcAbsoluteOrigin();let i=GeoUtil.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90;t&&t.shiftKey&&(i=function snapAngle(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;return e>0&&isFinite(t)?Math.round(t/e)*e:t}(i));const s={transform:{rotate:i}};this.parentNode.trigger(f,new O(s)),this.parentNode.setState(s),this.parentNode.trigger(g,new O(s))}}class TransformControlPanel extends ICEControlPanel{constructor(t){super(_objectSpread2(_objectSpread2({},t),{},{zIndex:10000001,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1})),_defineProperty$1(this,"rotateControlSize",8),_defineProperty$1(this,"rotateControlOffsetY",60),_defineProperty$1(this,"resizeControlInstanceCache",[]),_defineProperty$1(this,"resizeControlSize",16),_defineProperty$1(this,"__onTargetRemoved",()=>{this.targetComponent=null,this.disable()}),this.initControls()}initControls(){const t=this.state.width,e=this.state.height,i=t/2,s=e/2,n=this.resizeControlSize/2,o=[{direction:"xy",quadrant:2,position:[-n,-n]},{direction:"y",quadrant:5,position:[i-n,-n]},{direction:"xy",quadrant:1,position:[t-n,-n]},{direction:"x",quadrant:8,position:[t-n,s-n]},{direction:"xy",quadrant:4,position:[t-n,e-n]},{direction:"y",quadrant:6,position:[i-n,e-n]},{direction:"xy",quadrant:3,position:[-n,e-n]},{direction:"x",quadrant:7,position:[-n,s-n]}];this.resizeControlInstanceCache=[];for(let t=0;t<o.length;t++){const e=o[t],i=new ResizeControl({zIndex:10000002,display:!1,left:e.position[0],top:e.position[1],width:this.resizeControlSize,height:this.resizeControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1},direction:e.direction,quadrant:e.quadrant});this.addChild(i),this.resizeControlInstanceCache.push(i)}const r=this.state.width/2-this.rotateControlSize,a=-this.rotateControlOffsetY;this.rotateControlInstance=new RotateControl({zIndex:10000003,display:!1,left:r,top:a,radius:this.rotateControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1}}),this.addChild(this.rotateControlInstance)}initEvents(){super.initEvents(),this.on(p,this.resizeEvtHandler,this),this.on(g,this.rotateEvtHandler,this),this.on("keydown",this.keyboardEvtHandler,this),this.on("keyup",this.keyboardEvtHandler,this)}enable(){this.rotateControlInstance.setState({display:!0});for(let t=0;t<this.resizeControlInstanceCache.length;t++)this.resizeControlInstanceCache[t].setState({display:!0});this.setState({display:!0}),this.resume(p),this.resume(g),this.resume("keydown"),this.resume("keyup")}disable(){this.rotateControlInstance.setState({display:!1});for(let t=0;t<this.resizeControlInstanceCache.length;t++)this.resizeControlInstanceCache[t].setState({display:!1});this.setState({display:!1}),this.suspend(p),this.suspend(g),this.suspend("keydown"),this.suspend("keyup")}keyboardEvtHandler(t){this.targetComponent&&this.targetComponent.trigger(t.type,t,{component:this.targetComponent})}rotateEvtHandler(t){if(!this.targetComponent)return;const{rotate:e}=this.state.transform;this.targetComponent.setGlobalRotate(e),this.targetComponent.trigger(g),this.updatePanel()}resizeEvtHandler(t){if(!this.targetComponent)return;const{quadrant:e}=t;let i=t.movementX,s=t.movementY;const n=this.targetComponent.state;let o=n.left,r=n.top,a=n.width,h=n.height;const l=transformMat2d([],[i,s],invert([],this.targetComponent.calcAbsoluteLinearMatrix()));switch(i=l[0],s=l[1],e){case 1:o-=i,r+=s,a+=2*i,h-=2*s;break;case 2:o+=i,r+=s,a-=2*i,h-=2*s;break;case 3:o+=i,r-=s,a-=2*i,h+=2*s;break;case 4:o-=i,r-=s,a+=2*i,h+=2*s;break;case 5:r+=s,h-=2*s;break;case 6:r-=s,h+=2*s;break;case 7:o+=i,a-=2*i;break;case 8:o-=i,a+=2*i}if(t&&t.shiftKey){const t=function applyAspectLock(t,e,i,s){const n=Math.abs(i),o=Math.abs(s);if(!(t>0&&e>0))return{width:n,height:o};const r=Math.max(n/t,o/e);return{width:t*r,height:e*r}}(n.width,n.height,a,h),e=r+h/2;o=o+a/2-t.width/2,r=e-t.height/2,a=t.width,h=t.height}this.targetComponent.setState({left:o,top:r,width:Math.abs(a),height:Math.abs(h)}),this.targetComponent.trigger(p),this.updatePanel()}updateControlPositions(){const t=this.state.width,e=this.state.height,i=t/2,s=e/2,n=this.resizeControlSize/2;for(let o=0;o<this.resizeControlInstanceCache.length;o++){const r=this.resizeControlInstanceCache[o];let a=[0,0];switch(r.state.quadrant){case 1:a=[t-n,-n];break;case 2:a=[-n,-n];break;case 3:a=[-n,e-n];break;case 4:a=[t-n,e-n];break;case 5:a=[i-n,-n];break;case 6:a=[i-n,e-n];break;case 7:a=[-n,s-n];break;case 8:a=[t-n,s-n]}r.setState({left:a[0],top:a[1]})}const o=this.state.width/2-this.rotateControlSize,r=-this.rotateControlOffsetY;this.rotateControlInstance.setState({left:o,top:r})}updatePanel(){if(!this.targetComponent)return;const t=this.targetComponent.getRotateAngle(!0),{left:e,top:i,width:s,height:n}=this.targetComponent.getLocalLeftTop(!0);this.setState({left:e,top:i,width:s,height:n,transform:{rotate:t}})}set targetComponent(t){const e=this._targetComponent;e&&(e.off(m,this.updatePanel,this),e.off(r,this.__onTargetRemoved,this)),this._targetComponent=t,t&&(t.on(m,this.updatePanel,this),t.on(r,this.__onTargetRemoved,this)),this.updatePanel()}get targetComponent(){return this._targetComponent}toggleControlQuadrant(t,e,i){for(let t=0;t<this.resizeControlInstanceCache.length;t++){const s=this.resizeControlInstanceCache[t];s.state.quadrant===i&&s.setState({quadrant:e})}t.setState({quadrant:i})}}var W=class ICEControlPanelManager{constructor(t){this.ice=t,this.transformControlPanel=new TransformControlPanel({left:500,top:100,width:100,height:100,style:{strokeStyle:"#8b0000",fillStyle:"rgba(255, 255, 49, 0.2)",lineWidth:1},transform:{rotate:45}}),this.ice.addTool(this.transformControlPanel),this.transformControlPanel.disable(),this.lineControlPanel=new LineControlPanel({left:700,top:50,width:100,height:100,style:{strokeStyle:"rgba(255, 255, 49, 0)",fillStyle:"rgba(255, 255, 49, 0)",lineWidth:1}}),this.ice.addTool(this.lineControlPanel),this.lineControlPanel.disable()}start(){return this.ice.evtBus.on("mousedown",this.mouseDownHandler,this),this}stop(){return this.ice.evtBus.off("mousedown",this.mouseDownHandler,this),this}mouseDownHandler(t){const e=t.target;if(!e.ice||!e.state.interactive||!e.state.transformable)return this.lineControlPanel.disable(),void this.transformControlPanel.disable();if(e&&(e.isControlPanel||e.parentNode&&e.parentNode.isControlPanel))return;const i=this.ice.setSelection([e]);this.lineControlPanel.disable(),this.transformControlPanel.disable(),i||(e.isLine?(this.lineControlPanel.targetComponent=e,this.lineControlPanel.enable()):(this.transformControlPanel.targetComponent=e,this.transformControlPanel.enable()))}},Y=class AlignmentGuideManager{constructor(t){_defineProperty$1(this,"options",{threshold:3,hysteresis:1,edge:!0,center:!0,spacing:!0,guideStyle:{fillStyle:"#EC4899"},guideZIndex:10000010,guideWidth:1}),_defineProperty$1(this,"enabled",!1),_defineProperty$1(this,"active",null),_defineProperty$1(this,"snapping",!1),_defineProperty$1(this,"intentLeft",0),_defineProperty$1(this,"intentTop",0),_defineProperty$1(this,"cachedTargets",[]),_defineProperty$1(this,"engagedX",!1),_defineProperty$1(this,"engagedY",!1),_defineProperty$1(this,"guideX",null),_defineProperty$1(this,"guideY",null),this.ice=t}enable(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.options=_objectSpread2(_objectSpread2({},this.options),t),this.enabled||(this.enabled=!0,this.ice.evtBus.on("mousedown",this.__onMouseDown,this),this.ice.evtBus.on("mouseup",this.__onMouseUp,this)),this}disable(){return this.enabled?(this.enabled=!1,this.ice.evtBus.off("mousedown",this.__onMouseDown,this),this.ice.evtBus.off("mouseup",this.__onMouseUp,this),this.__detach(),this):this}isEnabled(){return this.enabled}setOptions(t){return this.options=_objectSpread2(_objectSpread2({},this.options),t),this}__onMouseDown(t){const e=t&&t.target;this.__isAlignmentParticipant(e)&&(this.__detach(),this.active=e,this.intentLeft=e.state.left,this.intentTop=e.state.top,this.cachedTargets=this.__computeTargets(),this.engagedX=!1,this.engagedY=!1,this.__ensureGuides(),e.on("mousemove",this.__onDrag,this))}__onDrag(t){if(!this.active||this.snapping)return;const e=t&&"number"==typeof t.movementX?t.movementX:0,i=t&&"number"==typeof t.movementY?t.movementY:0,s=this.ice.viewport?this.ice.viewport.scale:1;this.intentLeft+=e/s,this.intentTop+=i/s,this.snapping=!0,this.active.setState({left:this.intentLeft,top:this.intentTop});const n=this.__boxOf(this.active);if(this.snapping=!1,!n)return;const o=this.options.threshold/s,r=(this.options.threshold+this.options.hysteresis)/s,a=function computeSnap(t,e,i,s,n){const o={x:null,y:null},consider=t=>{if(!t)return;const e=o[t.axis];(!e||Math.abs(t.delta)<Math.abs(e.delta))&&(o[t.axis]=t)};for(const i of e)n.edge&&(consider({axis:"x",type:"edge",delta:i.minX-t.minX,guideValue:i.minX,guideStart:Math.min(t.minY,i.minY),guideEnd:Math.max(t.maxY,i.maxY)}),consider({axis:"x",type:"edge",delta:i.maxX-t.minX,guideValue:i.maxX,guideStart:Math.min(t.minY,i.minY),guideEnd:Math.max(t.maxY,i.maxY)}),consider({axis:"x",type:"edge",delta:i.minX-t.maxX,guideValue:i.minX,guideStart:Math.min(t.minY,i.minY),guideEnd:Math.max(t.maxY,i.maxY)}),consider({axis:"x",type:"edge",delta:i.maxX-t.maxX,guideValue:i.maxX,guideStart:Math.min(t.minY,i.minY),guideEnd:Math.max(t.maxY,i.maxY)}),consider({axis:"y",type:"edge",delta:i.minY-t.minY,guideValue:i.minY,guideStart:Math.min(t.minX,i.minX),guideEnd:Math.max(t.maxX,i.maxX)}),consider({axis:"y",type:"edge",delta:i.maxY-t.minY,guideValue:i.maxY,guideStart:Math.min(t.minX,i.minX),guideEnd:Math.max(t.maxX,i.maxX)}),consider({axis:"y",type:"edge",delta:i.minY-t.maxY,guideValue:i.minY,guideStart:Math.min(t.minX,i.minX),guideEnd:Math.max(t.maxX,i.maxX)}),consider({axis:"y",type:"edge",delta:i.maxY-t.maxY,guideValue:i.maxY,guideStart:Math.min(t.minX,i.minX),guideEnd:Math.max(t.maxX,i.maxX)})),n.center&&(consider({axis:"x",type:"center",delta:i.centerX-t.centerX,guideValue:i.centerX,guideStart:Math.min(t.minY,i.minY),guideEnd:Math.max(t.maxY,i.maxY)}),consider({axis:"y",type:"center",delta:i.centerY-t.centerY,guideValue:i.centerY,guideStart:Math.min(t.minX,i.minX),guideEnd:Math.max(t.maxX,i.maxX)}));if(n.spacing)for(let i=0;i<e.length;i++)for(let s=i+1;s<e.length;s++){const n=e[i],o=e[s],r=Math.min(n.centerX,o.centerX),a=Math.max(n.centerX,o.centerX);if(t.centerX>r&&t.centerX<a){const e=(n.centerX+o.centerX)/2;consider({axis:"x",type:"spacing",delta:e-t.centerX,guideValue:e,guideStart:Math.min(t.minY,n.minY,o.minY),guideEnd:Math.max(t.maxY,n.maxY,o.maxY)})}const h=Math.min(n.centerY,o.centerY),l=Math.max(n.centerY,o.centerY);if(t.centerY>h&&t.centerY<l){const e=(n.centerY+o.centerY)/2;consider({axis:"y",type:"spacing",delta:e-t.centerY,guideValue:e,guideStart:Math.min(t.minX,n.minX,o.minX),guideEnd:Math.max(t.maxX,n.maxX,o.maxX)})}}return o.x=o.x&&Math.abs(o.x.delta)<=i?o.x:null,o.y=o.y&&Math.abs(o.y.delta)<=s?o.y:null,o}(n,this.cachedTargets,this.engagedX?r:o,this.engagedY?r:o,this.options);if(a.x||a.y){const t=this.intentLeft+(a.x?Math.round(a.x.delta):0),e=this.intentTop+(a.y?Math.round(a.y.delta):0);this.active.setState({left:t,top:e}),this.engagedX=!!a.x,this.engagedY=!!a.y,this.__updateGuides(a)}else this.engagedX=!1,this.engagedY=!1,this.__hideGuides()}__onMouseUp(){this.__detach()}__detach(){this.active&&this.active.off("mousemove",this.__onDrag,this),this.active=null,this.intentLeft=0,this.intentTop=0,this.cachedTargets=[],this.engagedX=!1,this.engagedY=!1,this.__hideGuides()}__boxOf(t){const e=t.getMaxBoundingBox(!0);if(!e)return null;const i=e.getMinAndMaxPoint();return function toBox(t,e,i,s){return{minX:t,minY:e,maxX:i,maxY:s,centerX:(t+i)/2,centerY:(e+s)/2}}(i.minX,i.minY,i.maxX,i.maxY)}__computeTargets(){const t=this.ice.childNodes,e=[];for(const i of t){if(i===this.active)continue;if(!this.__isAlignmentParticipant(i))continue;const t=this.__boxOf(i);t&&e.push(t)}return e}__isAlignmentParticipant(t){return!(!(t&&t.state&&t.state.interactive&&t.state.draggable)||t.isLine||t.isControlPanel||t.parentNode&&t.parentNode.isControlPanel)}__ensureGuides(){const t=_objectSpread2({},this.options.guideStyle);this.guideX||(this.guideX=new F({left:0,top:0,width:1,height:1,display:!1,zIndex:this.options.guideZIndex,origin:"top-left",stroke:!1,style:t}),this.ice.addTool(this.guideX)),this.guideY||(this.guideY=new F({left:0,top:0,width:1,height:1,display:!1,zIndex:this.options.guideZIndex,origin:"top-left",stroke:!1,style:t}),this.ice.addTool(this.guideY))}__updateGuides(t){const e=this.options.guideWidth/(this.ice.viewport?this.ice.viewport.scale:1),[i,s]=this.ice.screenToWorld(0,0),[n,o]=this.ice.screenToWorld(this.ice.canvasWidth,this.ice.canvasHeight);t.x&&this.guideX?this.guideX.setState({display:!0,left:t.x.guideValue-e/2,top:s,width:e,height:o-s}):this.guideX&&this.guideX.setState({display:!1}),t.y&&this.guideY?this.guideY.setState({display:!0,left:i,top:t.y.guideValue-e/2,width:n-i,height:e}):this.guideY&&this.guideY.setState({display:!1})}__hideGuides(){this.guideX&&this.guideX.setState({display:!1}),this.guideY&&this.guideY.setState({display:!1})}};const G=[["pointerdown","ICE_POINTERDOWN"],["pointermove","ICE_POINTERMOVE"],["pointerup","ICE_POINTERUP"],["pointercancel","ICE_POINTERCANCEL"]],K=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dblclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],q=[["click","ICE_CLICK"],["dblclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],U=[["touchstart","ICE_TOUCHSTART"],["touchmove","ICE_TOUCHMOVE"],["touchend","ICE_TOUCHEND"],["touchcancel","ICE_TOUCHCANCEL"]],J=[["wheel","ICE_WHEEL"]],Q=[["keydown","ICE_KEYDOWN"],["keyup","ICE_KEYUP"]],Z=["ICE_MOUSEMOVE","ICE_POINTERMOVE","ICE_TOUCHMOVE"];function buildDomEventList(t){const e=[];return t?e.push(...G,...q):e.push(...K,...U),e.push(...J,...Q),e}function isTouchEvent(t){return!!t&&"string"==typeof t.type&&0===t.type.indexOf("touch")}function normalizeInput(t,e,i){const s=function resolveClientPoint(t){if(!t)return null;if(isTouchEvent(t)){const e=(t.touches&&t.touches.length?t.touches:t.changedTouches)||null,i=e&&e[0];return i&&"number"==typeof i.clientX?{clientX:i.clientX,clientY:i.clientY}:null}return"number"==typeof t.clientX&&"number"==typeof t.clientY?{clientX:t.clientX,clientY:t.clientY}:null}(t);if(!s)return null;const n=e&&"number"==typeof e.left?e.left:0,o=e&&"number"==typeof e.top?e.top:0,r=s.clientX-n,a=s.clientY-o;let h=Number(t.movementX),l=Number(t.movementY);isFinite(h)&&isFinite(l)||(i?(h=r-i.x,l=a-i.y):(h=0,l=0));const c=isTouchEvent(t);return{x:r,y:a,clientX:s.clientX,clientY:s.clientY,movementX:h,movementY:l,pointerType:t.pointerType||(c?"touch":"mouse"),pointerId:"number"==typeof t.pointerId?t.pointerId:-1,button:"number"==typeof t.button?t.button:0,buttons:"number"==typeof t.buttons?t.buttons:0,isPrimary:!1!==t.isPrimary,isTouch:c,shiftKey:!!t.shiftKey,ctrlKey:!!t.ctrlKey,altKey:!!t.altKey,metaKey:!!t.metaKey}}function applyNormalizedInput(t,e){t&&e&&(t.offsetX=e.x,t.offsetY=e.y,t.clientX=e.clientX,t.clientY=e.clientY,t.movementX=e.movementX,t.movementY=e.movementY,t.pointerType=e.pointerType,t.pointerId=e.pointerId,t.isTouchInput=e.isTouch,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.altKey=e.altKey,t.metaKey=e.metaKey)}function toLegacyMouseName(t){switch(t){case"pointerdown":case"touchstart":return"mousedown";case"pointermove":case"touchmove":return"mousemove";case"pointerup":case"touchend":case"pointercancel":case"touchcancel":return"mouseup";default:return null}}const tt={sm:5,md:13,lg:26};function stylePaintPad(t){const e=t&&t.style||{};let i=2;const s=Number(e.lineWidth)||0,n=Number(t.lineBorderWidth)||0,o=Math.ceil(Math.max(s,n));o>0&&(i+=o);const r=Number(e.shadowBlur);return r>0?i+=r+Math.max(Math.abs(Number(e.shadowOffsetX)||0),Math.abs(Number(e.shadowOffsetY)||0)):"string"==typeof e.shadow&&tt[e.shadow]&&(i+=tt[e.shadow]),i}function boxArea(t){return function boxWidth(t){return t[2]-t[0]}(t)*function boxHeight(t){return t[3]-t[1]}(t)}function unionBoxes(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[2]>t[2]&&(t[2]=e[2]),e[3]>t[3]&&(t[3]=e[3]),t}function intersects(t,e){return!(t[0]>e[2]||t[2]<e[0]||t[1]>e[3]||t[3]<e[1])}function isFiniteBox(t){return isFinite(t[0])&&isFinite(t[1])&&isFinite(t[2])&&isFinite(t[3])}function integerAlign(t){return t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3]),t}function mergeBox(t,e){return[Math.min(t[0],e[0]),Math.min(t[1],e[1]),Math.max(t[2],e[2]),Math.max(t[3],e[3])]}function isWorthMerging(t,e){const i=boxArea(t)+boxArea(e);return i<=0||boxArea(mergeBox(t,e))<=2*i}function mapBoxToRender(t,e,i){const s=i||[0,0,0,0];return s[0]=Math.floor(t[0]*e.scale+e.tx),s[1]=Math.floor(t[1]*e.scale+e.ty),s[2]=Math.ceil(t[2]*e.scale+e.tx),s[3]=Math.ceil(t[3]*e.scale+e.ty),s}const et=/(rgba|hsla)\(|transparent|#[0-9a-fA-F]{8}|opacity/i;function isOpaqueDrawing(t){const e=t&&t.style||{};if(t&&void 0!==t.opacity&&1!==t.opacity)return!1;if(void 0!==e.globalAlpha&&1!==e.globalAlpha)return!1;if(e.globalCompositeOperation&&"source-over"!==e.globalCompositeOperation)return!1;if(e.shadow||(Number(e.shadowBlur)||0)>0)return!1;for(const t of["fillStyle","strokeStyle"]){const i=e[t];if("string"==typeof i&&et.test(i))return!1}return!0}var it=class DOMEventDispatcher{constructor(t){_defineProperty$1(this,"selectionCandidates",[]),_defineProperty$1(this,"_stopped",!1),_defineProperty$1(this,"__lastInput",null),_defineProperty$1(this,"focusedComponent",null),this.ice=t}start(){let t=null;const e=buildDomEventList("function"==typeof I.PointerEvent);for(let i=0;i<e.length;i++){const s=e[i],n=s[0],o=s[1],r=toLegacyMouseName(n);this.ice.evtBus.on(o,e=>{if(this._stopped)return;const i=e.originalEvent||e;this.__handlePointerCapture(o,i);const s=normalizeInput(i,this.__resolveCanvasRect(n),this.__lastInput);s&&(applyNormalizedInput(e,s),this.__lastInput=s);const a=-1!==Z.indexOf(o),h=-1!==o.indexOf("KEY"),l="ICE_WHEEL"===o;
|
|
28
|
+
//! 移动类事件触发频率极高,不执行 findTargetComponent();
|
|
29
|
+
//! 键盘事件必须先选中组件再派发才有意义,同样不做命中检测。
|
|
30
|
+
a||h||l||(t=this.findTargetComponent(e));let c=t;l?c=null:h&&this.focusedComponent&&(c=this.focusedComponent),this.__dispatch(n,e,c),r&&r!==n&&this.__dispatch(r,e,c)})}return this}__handlePointerCapture(t,e){const i=this.ice.canvasEl;if(!i||"function"!=typeof i.setPointerCapture)return;const s=e&&e.pointerId;if("number"==typeof s)try{if("ICE_POINTERDOWN"===t){const t=e&&e.target;if(t&&t!==i&&(!i.contains||!i.contains(t)))return;i.setPointerCapture(s)}else"ICE_POINTERUP"!==t&&"ICE_POINTERCANCEL"!==t||"function"==typeof i.releasePointerCapture&&i.hasPointerCapture&&i.hasPointerCapture(s)&&i.releasePointerCapture(s)}catch(t){}}__dispatch(t,e,i){i&&(e.target=i,i.trigger(t,e)),this.ice.evtBus.trigger(t,e,{component:i})}__resolveCanvasRect(t){const e="pointermove"===t||"mousemove"===t||"touchmove"===t,i=this.ice;return!e&&i&&"function"==typeof i.updateCanvasBoundingRect&&i.updateCanvasBoundingRect(),i&&"function"==typeof i.getInputRect?i.getInputRect():i&&i.canvasBoundingClientRect||null}set stopped(t){this._stopped=t}get stopped(){return this._stopped}findTargetComponent(t){if(this._stopped)return null;const{offsetX:e,offsetY:i}=t;if("number"!=typeof e||"number"!=typeof i)return null;const[s,n]=this.ice.screenToWorld(e,i);return hitTestComponents(this.ice,s,n,1)}};const st={evtBuses:[],__handlers:null,__hasPointerEvent:!1,start:function(){if(!I||!I.addEventListener||st.__handlers)return;const t="function"==typeof I.PointerEvent;st.__hasPointerEvent=t;const e=buildDomEventList(t),i=[];for(let t=0;t<e.length;t++){const s=e[t],handler=t=>{for(let e=0;e<st.evtBuses.length;e++)st.evtBuses[e].trigger(s[1],t)},n="wheel"===s[0]||"touchmove"===s[0]?{passive:!1}:void 0;n&&"function"==typeof I.addEventListener?I.addEventListener(s[0],handler,n):I.addEventListener(s[0],handler),i.push({name:s[0],handler:handler})}st.__handlers=i},stop:function(){if(st.__handlers&&I&&I.removeEventListener)for(let t=0;t<st.__handlers.length;t++){const e=st.__handlers[t];I.removeEventListener(e.name,e.handler)}st.__handlers=null},registerEvtBus:function(t){st.evtBuses.includes(t)||st.evtBuses.push(t)},delEvtBus:function(t){st.evtBuses.includes(t)&&(st.evtBuses.splice(st.evtBuses.indexOf(t),1),0===st.evtBuses.length&&st.stop())}};var nt=st,ot=class EventBus extends N{constructor(){super()}};class GeoLine{constructor(t,e){this.startPoint=t,this.endPoint=e}contains(t,e){const i=Math.hypot(this.endPoint.x-this.startPoint.x,this.endPoint.y-this.startPoint.y),s=Math.hypot(t-this.startPoint.x,e-this.startPoint.y),n=Math.hypot(t-this.endPoint.x,e-this.endPoint.y);return s+n>=i-3&&s+n<=i+3}}class GeoPoint{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.x=t,this.y=e}static load(t){return new GeoPoint(Number(t.x),Number(t.y))}static cloneArray(t){const e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}equals(t){return this.x==t.x&&this.y==t.y}clone(){return new GeoPoint(this.x,this.y)}}class ICEDotPath extends j{constructor(t){super(_objectSpread2({dots:[],closePath:!0},t)),_defineProperty$1(this,"__dotsShiftX",0),_defineProperty$1(this,"__dotsShiftY",0)}calcComponentParams(){if(!this.paramsDirty)return{width:this.state.width,height:this.state.height};this.calcDots();const t=this.calc4VertexPoints(),e=Math.abs(t[1][0]-t[0][0]),i=Math.abs(t[2][1]-t[0][1]);return this.state.width=e,this.state.height=i,{width:this.state.width,height:this.state.height}}containsLocalPoint(t,e){const i=this.state.dots;return!i||i.length<3?super.containsLocalPoint(t,e):GeoUtil.pointInPolygon(t,e,i)}calcLocalOrigin(){const t=super.calcLocalOrigin(),e=-t[0]-this.__dotsShiftX,i=-t[1]-this.__dotsShiftY;if(0!==e||0!==i){const s=[1,0,0,1,e,i];for(let t=0;t<this.state.dots.length;t++)this.state.dots[t]=transformMat2d([],this.state.dots[t],s);this.__dotsShiftX=-t[0],this.__dotsShiftY=-t[1]}return t}createPathObject(){this.ensureDots(),this.path2D=I.createPath2D(),this.path2D.moveTo(this.state.dots[0][0],this.state.dots[0][1]);for(let t=1;t<this.state.dots.length;t++){const e=this.state.dots[t];this.path2D.lineTo(e[0],e[1])}return this.path2D}calcDots(){return this.__dotsShiftX=0,this.__dotsShiftY=0,this.__calcDots()}__calcDots(){return this.state.dots=[],this.state.dots}ensureDots(){this.state.dots&&0!==this.state.dots.length||this.calcDots()}calc4VertexPoints(){this.ensureDots();let t=this.state.dots[0][0],e=this.state.dots[0][1],i=this.state.dots[0][0],s=this.state.dots[0][1];for(let n=1;n<this.state.dots.length;n++){const o=this.state.dots[n];o[0]<t&&(t=o[0]),o[0]>i&&(i=o[0]),o[1]<e&&(e=o[1]),o[1]>s&&(s=o[1])}return[[t,e],[i,e],[t,s],[i,s]]}getTransformedDots(){const t=this.state.composedMatrix,e=this.state.dots,i=[];for(let s=0;s<e.length;s++){const n=transformMat2d([],e[s],t);i.push(n)}return i}}var rt=class ICEImage extends z{constructor(){super(_objectSpread2({width:100,height:100,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALkAAAC2CAYAAACF+yyJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAtoSURBVHhe7Z3tj15FHYb9VxUVo7zFUBWC8YXoF9++GENMRAWRKAkxGj8pihpjFBVF1CBlKaUU+wK0pYVqt12fn+6xs7PXnDPzO3O2Z+a5r+T6ss995nm2vXf3vM68570vXNuTsmdVctm9KrnsXpVcdq9KLrtXJZfdq5LL7lXJZfeq5LJ7VXLZvSq57F6VXHavSi67VyWX3auSy+5VyWX3quSye1Vy2b0quexelVx2r0ouu1cll92rksvuVcll96rksntVctm9KrnsXpVcdq9KLrtXJZfdq5LL7lXJZfeq5LJ7VfIjcIy7j/M2sp4q+YKWQNvLOqrkC+nhodO7OJacp0q+gHO4/2UVvbYqeWXH+O2lG3sf29nd++Eb1/e/wtC40q9KXtGfX+Dy3v4PzpspKCt9quQVJSgXS1BO+lTJK0pQLvab/zz8F+CjL3FWlquSV/KBE7v79bwJ5VISlJPlquSV/AXsj1MuJUE5Wa5KXsmfvKWSr1WVvJJ2BiWGciljLm/2figny1XJK0pQLvbS4d15zEmfKnlFicfPXsdsKEE56VMlr+hdx7mwqV2P75/ji0dvboahvPSpkle2BjSu9KuSL+AcaDw5T5V8IT3QOHK+KvmCni/oOm0v66iSO/zz5Rv71cwr56Nn+ADzmUs3MB8bQq/LcVVyhzHvg0wsQbnYmCfPTZ+SlAdVyQv92mm4crPhzokHkgnKhaagrEyrkjtM8eAr6UfXCMoNpqCsHFcld5rC7g3PzVPOTPHZkR8imbbpkqeg7BKm+NXFw0Un4swH4CavgTuOaH6Wd/gYGbOt2GTJc8k5IJxrileuHjxzQoSv37uTHutWfh8x9zU4m0BTJd959+apu1z+tdmExgoN+euVvNN6oSnCe1aI4bUvneKDWWPI5PrhFw++F2VC6dG7HGistdpMyc/9u7zgA/bfSGMOxlBmyhT2qVOv29efSNykZYTj5xrz2Jn0KcdvOQs+QGOu0SZKbn+u5/LAyJ/ZGO/uQSnPvp3+waXxc4x57nL6L9Ncnh0Ze002UfIUlDVTUNYkKJdjDWjcHD938vBuD+XMFJQ1U1B2ba6+5HZWgaBsKPFwhdN7Oc6BxsuVoJxJUC6UuJi4V35Nrr7kBOVIYk6uRA80TonEnBxJUG5NquQbbZLNGMqVWgJtX2rMcNA7lTMoR9JRBOXWZHMlt4d+KUc+VTBNRIydzaFcqTnQdqXeVjBbAEE5ki5YUW5NNlfy+CLLmN876y+5QTmPYyc/Ke+RoJxJUC5lDGXWpHZX9iUo55WgnFeCciZBOfL5K4d/ZCm3JlXyfR+BBxso55WgnFeCciZBOZKg3Jpcfcl/nJiwnrKhqWt5x3byLwr98kK9BxQIynmNscn+KWemoGxo6uIVZdfk6ktupqCseW1sJ3gf2o6gnEeCch4vwPCUy4G2M/8OuykGZddmEyW3ZUjG+PSJ3f9etr+eUe6Y8H2I8PU5EpTzSISv0370FF8+tbv38c1fA/oBCgnfZ602UXJzSexGJXsPe7A4Jv4cXgnKeSTs6zXu+Rkj/hxrtZmSm15yt6Xc11+vc/80QTmPMXb7Qg60bS7xZ1izTZXcLLmn/Orm/zrc1vubLRzDK0G5Un9zsXxXxB7GDsewSUlLCLdtweZKPjh2f/m7Ublj/zhyiytBY5RKUK7UEuy7pjEGfwZXiENomxZstuQ1zIW2LfE1ezwpAeVLzIW23Ra3uuSDOdB2U9rzkDn8yfnwQQ73ahU5/SYv4Y3NJjQO6eGDI4vahqYmOBpjm5dM3KqSp66elnL3yPQQNaBxB2twttIdlq3YfcmXJHyfF96ZPpgdzvb84HzeD1s4/pJ8pvNJi7or+e8Lz5wQdrXPxqIFaGNy/zbEn9PM4W8ZVyvte7bxPhRNR+Hh7YL79Vuxq5J7ic+nx6ZmlcqBxoudA403+LuJ2yHGoPFadWtL/qnNb2kaY8wShlsFch2bIo6gMcYsvRBmD5zQOC26NSWvdbD1/oky2k1itF2uT8Py5SHfrVS+qYNw2qZVuyq5FSDkngVPmxGU80pQrpYhdqsyZVq1uwPPo5KgnFeCcnJaldwpQTmvBOXktCq5U4JyXgnKyWlVcqcE5bwSlJPTquROCcp5JSgnp1XJnRKU80pQTk6rkjslKOeVoJycViV3SlDOK0E5Oa1K7pSgnFeCcnJaldwpQTmvBOXktF2VPL6sP/Zww1wJynklKFfLkKm7Mluzq5KPUesGram7Be3mVtou119PTDGhG7TK3ZqSx3xy4VttHx1ZWpC05ztLoDHG1K22nehl6mkYPTTRtt0deP6hwuNvX3z1f7/l7bf9FLmTjMaf08zBVoiewiZLsvFqPP4WriLdi92VPPQoJ7zMeZB5WAJdDzIfrV2XPLbWlBR3aUqKptyqkseWcqagHB40udAybnXJB3Og7ab8ROY0cXaASNtPmXM4oGni9Js8C9q2xFOa8POW2mzJbdchhZ3yo20GS8/A0BilEpQrtQT7rmmMQVsIbAzapgWbK/lLmoT/gJ5J+L/62sGzKY/B8o5jhNu2YFMl95K7LeVaXE7lG6/nlZa2zSX+DGu2mZIvyTDbFV0hjD+HV4JyHgn7+lFeJ1izTZQ8Z4lDuzqpJQ5vEr6ec9U05guv7u7d//Lu3lsTPyfh+6zVJkqegrLmyDHp/6HtCMp5JCjn8SgWq039oFB2ba6+5LWXHS9ZjrvlZceP7XDOTEHZ0NRZKcquydWXnKAcSVDOfATOMFDOK0E5rwTlTIJyJEG5NamS70tQzitBOa8E5UyCcuRzlw//Nqfcmmyu5Ceu5l8Ctxv/YyhnEpTzOHZCj/IeCcqZBOVSxlBmTTZX8pLlPmjxVcqZMbYYLuVKzYG2K5XmTaecSVCOLHmftajdlY12qiyGcqWWQNuXGmM7Fjk5g3IkHXpSbk2q5AW5Ej3QOCUSc3IkQbk1ufqS33Hc9w9LfDuxjg9BuVznQOPlSlDOJCgXStg5esquydWX3ExBWTMFZU2CcjnWgMbN8fMn83e7UlDWTEHZtdlEyUtXRiPGpqCIsXs+KDdlKc+PXG6n8XOMsVN+lDPnYldBady12UTJTVvX3kvqAGwwhjJTphjem7CvP3EufYIxHD/XmO+MzP9iN6bNgcZco82U3Bx7wibF1AMUZshfRn7zpUxxJXhvYnjtK6fSj8kNmVzvjI5hKBP6sLPoNNZabarkg7l4dztKTHEyumhFhK8f20kX/VZ+HzH23Cptv2abLPlgCsouYQqbzzAnG2duHzn2+MiLB7NLaWt4Ekfxg7aUTZf8VpoitQ9MUM5M4VkqXarkLlM8ODITFUG5wRSUleOq5IWmJvaxAz7KDxKUC01BWZlWJXcYcxtkYgnKxcY8ea7egxzbokruMLynml6PtbnKiWcyZ84KodfluCr5gp5P73EcgraXdVTJF9IDjSPnq5Iv4BxoPDlPlbyyNaBxpV+VvKK2pCJxaZeL+zg8g2q8uRmG8tKnSl5RImdJQoJy0qdKXlGCcrEX4foS5aRPlbySdHMV5VLGlMxKIMdVySv504LpL0iCcrJclbyStEoD5VISlJPlquSVpIVtKZeSoJwsVyWvKEG5WHrWcpuXJKytSl5RgnKxBOWkT5W8ok8nVk+zNe8pb6agrPSpkld2DLu11hYB+NHE8uc0rvSrki/gHO5r8Gn4tauSL6SHh06r4Euoki9oCbS9rKNKfgSOcY9OFS6uSi67VyWX3auSy+5VyWX3quSye1Vy2b0quexelVx2r0ouu1cll92rksvuVcll96rksntVctm9KrnsXpVcdq9KLrtXJZfdq5LL7lXJZfeq5LJ7VXLZvSq57F6VXHavSi67VyWX3auSy+5VyWX3quSye1Vy2b0quezca3v/AeMnvtkH1pHJAAAAAElFTkSuQmCC",clipType:"none",sx:0,sy:0,sw:0,sh:0},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}))}doRender(){if(this.state.src){const{loaded:t,image:e}=this.ice.imageCache.setImage(this.state.src);if(t){const t=this.ctx,i=this.state.clipType||"none",s=0-this.state.localOrigin[0],n=0-this.state.localOrigin[1],{sx:o,sy:r,sw:a,sh:h}=this.state,l=a>0&&h>0;"circle"===i&&(t.save(),t.beginPath(),t.arc(0,0,Math.min(this.state.width,this.state.height)/2,0,2*Math.PI),t.closePath(),t.clip()),l?t.drawImage(e,o,r,a,h,s,n,this.state.width,this.state.height):t.drawImage(e,s,n,this.state.width,this.state.height),"circle"===i&&t.restore()}}super.doRender()}};class ICEPolyLine extends ICEDotPath{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(ICEPolyLine.arrangeParam(t)),_defineProperty$1(this,"isLine",!0),_defineProperty$1(this,"__polyBoxScratch",[0,0,0,0]),_defineProperty$1(this,"__arrowFaceIndexes",[])}containsLocalPoint(t,e){const i=this.state.dots;if(!i||i.length<2)return super.containsLocalPoint(t,e);const s=Math.max(4,(this.state.lineWidth||1)/2+3);return GeoUtil.distanceToPolyline(i,t,e)<=s}static arrangeParam(t){let e=merge$1({},{lineType:"solid",lineWidth:1,arrow:"none",arrowLength:15,arrowAngel:toRadian(30),arrowStyle:"filled",points:[],showMinBoundingBox:!1,showMaxBoundingBox:!1,links:{},routeType:"straight",routeOffset:20,curveType:"straight",label:"",labelStyle:{fontSize:14,fillStyle:"#000000",backgroundColor:"#ffffff"},style:{lineJoin:"round"}},t,{linkable:!1,closePath:!1,fill:!1});const i=e.points.length;return i<2&&(0===i?(e.points.push([0,0]),e.points.push([10,10])):1===i&&e.points.push([10,10])),"dashed"!==e.lineType||e.lineDash&&0!==e.lineDash.length||(e.lineDash=[4*e.lineWidth,4*e.lineWidth]),e=_objectSpread2(_objectSpread2({},e),{left:e.points[0][0],top:e.points[0][1],transform:{translate:[0,0],scale:[1,1],skew:[0,0],rotate:0}}),e.style.lineWidth<1&&(e.style.lineWidth=1),e}initEvents(){super.initEvents(),this.once(o,this.afterAddHandler,this)}afterAddHandler(t){this.evtBus.once(h,this.syncConnections,this)}syncConnections(){if(!this.ice)return;this.removeLink("start"),this.removeLink("end");const t=this.state.links;t&&(t.start&&t.start.id&&t.start.position&&this.createLink(t.start.id,t.start.position),t.end&&t.end.id&&t.end.position&&this.createLink(t.end.id,t.end.position)),this.paramsDirty=!0,this.dirty=!0,this.ice.dirty=!0}createLink(t,e){const i=this.ice.findComponent(t);i&&i.on(m,this.followComponent,this),i&&i.on(p,this.followComponent,this),i&&i.on(g,this.followComponent,this),i&&this.followComponent(),this.state.draggable=!1}removeLink(t,e,i){if(!this.state.links||!this.state.links[t])return;const s=this.state.links[t].id,n=this.state.links[t].position;if(e||(e=s),i||(i=n),s===e&&n===i){const t=this.ice.findComponent(s);t&&t.off(m,this.followComponent,this),t&&t.off(p,this.followComponent,this),t&&t.off(g,this.followComponent,this)}let o=!0;this.state.links.start&&this.state.links.start.id&&(o=!1),this.state.links.end&&this.state.links.end.id&&(o=!1),this.state.draggable=o}getLinkFromId(){return this.state.links.start.id}getLinkToId(){return this.state.links.end.id}followComponent(t){for(const t in this.state.links){if(!this.state.links[t]||!this.state.links[t].id||!this.state.links[t].position)continue;const e=this.state.links[t].id,i=this.state.links[t].position,s=this.ice.findComponent(e);if(!s)continue;const n=s.getMinBoundingBox(!0);let o=[0,0];switch(i){case"T":o=n.tc;break;case"R":o=n.rc;break;case"B":o=n.bc;break;case"L":o=n.lc;break;case"C":o=n.center}switch(t){case"start":this.setState({startPoint:[...o]});break;case"end":this.setState({endPoint:[...o]})}}}calcLocalOrigin(){const t=[0,0];return this.state.localOrigin=t,t}__calcDots(){const t=this.state.left,e=this.state.top;this.state.dots=[];for(let i=0;i<this.state.points.length;i++){const s=this.state.points[i],n=s[0]-t,o=s[1]-e;this.state.dots.push([n,o])}return this.calcArrowPoints(),this.state.dots}calcArrowPoints(){if(this.__arrowFaceIndexes.length=0,"start"===this.state.arrow||"both"===this.state.arrow){const t=[...this.state.dots[0]];let e=[[...this.state.dots[0]],[...this.state.dots[1]]];e=this.doCalcArrowPoints(e),this.state.dots.unshift(...e),this.state.dots.unshift([...t]),this.__arrowFaceIndexes.push(0)}if("end"===this.state.arrow||"both"===this.state.arrow){const t=this.state.dots.length,e=[...this.state.dots[t-1]];let i=[[...this.state.dots[t-1]],[...this.state.dots[t-2]]];i=this.doCalcArrowPoints(i),this.state.dots.push(...i),this.state.dots.push([...e]),this.__arrowFaceIndexes.push(this.state.dots.length-4)}}doCalcArrowPoints(t){const e=t[0],i=t[1];i[0]=i[0]-e[0],i[1]=i[1]-e[1];const s=Math.hypot(i[0],i[1]);if(0===s)return[[e[0],e[1]],[e[0],e[1]]];const n=i[0]/s,o=i[1]/s,r=Math.cos(this.state.arrowAngel),a=Math.sin(this.state.arrowAngel);let h=this.state.arrowLength*(n*r-o*a),l=this.state.arrowLength*(o*r+n*a),c=this.state.arrowLength*(n*r+o*a),d=this.state.arrowLength*(o*r-n*a);return h+=e[0],l+=e[1],c+=e[0],d+=e[1],[[h,l],[c,d]]}addDot(t,e){this.state.points.splice(e,0,t),this.state.dots.splice(e,0,[t[0],t[1]])}rmDot(t){return!(this.state.points.length<3||(this.state.points.splice(t,1),this.state.dots.splice(t,1),0))}calcComponentParams(){if(!this.paramsDirty)return{width:this.state.width,height:this.state.height};this.calcDots();const t=this.calc4VertexPoints();let e=1/0,i=1/0,s=-1/0,n=-1/0;for(let o=0;o<t.length;o++){const r=t[o];r[0]<e&&(e=r[0]),r[0]>s&&(s=r[0]),r[1]<i&&(i=r[1]),r[1]>n&&(n=r[1])}return this.state.width=Math.abs(s-e),this.state.height=Math.abs(n-i),{width:this.state.width,height:this.state.height}}isDotsOnSameLine(){const t=this.state.points.length,e=round(this.state.points[0][0],2),i=round(this.state.points[0][1],2);let s=0;const n=[round(this.state.points[t-1][0],2)-e,round(this.state.points[t-1][1],2)-i];for(let o=0;o<t;o++){const t=this.state.points[o];0===cross([],n,[t[0]-e,t[1]-i])[2]&&s++}return s===t}calc4VertexPoints(){return this.isDotsOnSameLine()?this.splitEndpointsTo4Points():super.calc4VertexPoints()}splitEndpointsTo4Points(){const t=this.state.points.length,e=this.state.points[t-1][0]-this.state.points[0][0],i=this.state.points[t-1][1]-this.state.points[0][1],s=this.getRotateAngle(),n=this.state.style.lineWidth||1;let o=Math.cos(s*Math.PI/180)*n/2,r=Math.sin(s*Math.PI/180)*n/2;return o=round(o,3),r=round(r,3),[[0+o,0+r],[0-o,0-r],[e+o,i+r],[e-o,i-r]]}__localBox(){const t=this.__polyBoxScratch;this.ensureDots();const e=this.state.dots;if(!e||0===e.length)return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t;const i=this.calc4VertexPoints();let s=1/0,n=1/0,o=-1/0,r=-1/0;for(let t=0;t<i.length;t++){const e=i[t];e[0]<s&&(s=e[0]),e[0]>o&&(o=e[0]),e[1]<n&&(n=e[1]),e[1]>r&&(r=e[1])}const a=this.__arrowFaceIndexes;for(let t=0;t<a.length;t++){const i=a[t];for(let t=0;t<3;t++){const a=e[i+t];a&&(a[0]<s&&(s=a[0]),a[0]>o&&(o=a[0]),a[1]<n&&(n=a[1]),a[1]>r&&(r=a[1]))}}const h=this.__measureLabelBoxForBounds();return h&&(h.x-h.halfW<s&&(s=h.x-h.halfW),h.x+h.halfW>o&&(o=h.x+h.halfW),h.y-h.halfH<n&&(n=h.y-h.halfH),h.y+h.halfH>r&&(r=h.y+h.halfH)),t[0]=s,t[1]=n,t[2]=o,t[3]=r,t}setState(t){if(isNil$1(t.width)||delete t.width,isNil$1(t.height)||delete t.height,isNil$1(t.transform)||delete t.transform,!isNil$1(t.left)){const e=t.left-this.state.points[0][0];for(let t=0;t<this.state.points.length;t++)this.state.points[t][0]+=e}if(!isNil$1(t.top)){const e=t.top-this.state.points[0][1];for(let t=0;t<this.state.points.length;t++)this.state.points[t][1]+=e}if(isNil$1(t.startPoint)||(this.state.points[0]=[...t.startPoint],this.state.left=this.state.points[0][0],this.state.top=this.state.points[0][1]),!isNil$1(t.endPoint)){const e=this.state.points.length;this.state.points[e-1]=[...t.endPoint]}isNil$1(t.startPoint)&&isNil$1(t.endPoint)||this.recalculateRoute(),isNil$1(t.links)||(merge$1(this.state.links,t.links),this.syncConnections()),super.setState(t)}static dirVector(t){switch(t){case"T":return[0,-1];case"B":return[0,1];case"L":return[-1,0];case"R":return[1,0];default:return[0,0]}}recalculateRoute(){if("orthogonal"!==this.state.routeType)return;const t=this.state.points[0],e=this.state.points[this.state.points.length-1],i=this.state.routeOffset||20,s=ICEPolyLine.dirVector(this.state.links&&this.state.links.start&&this.state.links.start.position),n=ICEPolyLine.dirVector(this.state.links&&this.state.links.end&&this.state.links.end.position),o=[t[0]+s[0]*i,t[1]+s[1]*i],r=[e[0]+n[0]*i,e[1]+n[1]*i],a=[t];0===s[0]&&0===s[1]||a.push(o),o[0]!==r[0]&&o[1]!==r[1]&&a.push([r[0],o[1]]),0===n[0]&&0===n[1]||a.push(r),a.push(e),this.state.points=a,this.paramsDirty=!0,this.dirty=!0}createPathObject(){this.ensureDots();const t=this.state.curveType||"straight",e=this.state.dots;if(this.path2D=I.createPath2D(),!e||0===e.length)return this.path2D;if(this.path2D.moveTo(e[0][0],e[0][1]),"quadratic"===t&&e.length>=3)this.path2D.quadraticCurveTo(e[1][0],e[1][1],e[2][0],e[2][1]);else if("cubic"===t&&e.length>=4)this.path2D.bezierCurveTo(e[1][0],e[1][1],e[2][0],e[2][1],e[3][0],e[3][1]);else for(let t=1;t<e.length;t++)this.path2D.lineTo(e[t][0],e[t][1]);return this.path2D}doRender(){const t=this.__arrowFaceIndexes.length>0&&"hollow"!==this.state.arrowStyle&&!1!==this.state.stroke,e=t?this.ctx.strokeStyle:null;super.doRender(),this.applyActiveTransform(),t&&this.drawArrowFills(e),this.drawLabel()}drawArrowFills(t){const e=this.__arrowFaceIndexes,i=this.state.dots;if(!i||0===e.length)return;const s=this.ctx;s.save(),s.beginPath();for(let t=0;t<e.length;t++){const n=e[t],o=i[n],r=i[n+1],a=i[n+2];o&&r&&a&&(s.moveTo(o[0],o[1]),s.lineTo(r[0],r[1]),s.lineTo(a[0],a[1]),s.closePath())}s.fillStyle=t||this.state.style.strokeStyle||"#000000",s.fill(),s.restore()}__labelMetrics(){const t=this.state.label;if(!t)return null;const e=(this.state.labelStyle||{}).fontSize||14,i=this.getLabelPosition();let s=0;const n=this.ctx;return n&&"function"==typeof n.measureText?(n.font="".concat(e,"px Arial"),s=n.measureText(t).width):s=t.length*e,{x:i[0],y:i[1],halfW:s/2+4,halfH:e/2+4}}__measureLabelBoxForBounds(){const t=this.ctx,e=!!t&&"font"in t,i=e?t.font:void 0,s=this.__labelMetrics();return e&&(t.font=i),s}drawLabel(){const t=this.state.label;if(!t)return;const e=this.ctx,i=this.state.labelStyle||{};e.save();const s=this.__labelMetrics();s?(e.textAlign="center",e.textBaseline="middle",e.fillStyle=i.backgroundColor||"#ffffff",e.fillRect(s.x-s.halfW,s.y-s.halfH,2*s.halfW,2*s.halfH),e.fillStyle=i.fillStyle||"#000000",e.fillText(t,s.x,s.y),e.restore()):e.restore()}getLabelPosition(){const t=this.state.points,e=t.length,i=this.state.left,s=this.state.top;if(0===e)return[0,0];if(1===e)return[t[0][0]-i,t[0][1]-s];let n,o;if(2===e)n=(t[0][0]+t[1][0])/2,o=(t[0][1]+t[1][1])/2;else{const i=t[Math.floor(e/2)];n=i[0],o=i[1]}return[n-i,o-s]}getRotateAngle(){if(this.isDotsOnSameLine()){const t=0,e=0,i=this.state.points.length,s=this.state.points[i-1][0]-this.state.points[0][0],n=this.state.points[i-1][1]-this.state.points[0][1];let o=GeoUtil.calcRotateAngle(s,n,t,e);return o+=90,o}return super.getRotateAngle()}containsPoint(t,e){const i=this.getLines();for(let s=0;s<i.length;s++){const n=i[s],o=n.o[0],r=n.o[1],a=n.d[0],h=n.d[1],l=Math.hypot(a-o,h-r),c=Math.hypot(o-t,r-e),d=Math.hypot(a-t,h-e);if(c+d>=l-3&&c+d<=l+3)return!0}return!1}getLines(){const t=[],e=this.getTransformedDots();if(!e||e.length<2)return t;for(let i=0;i<e.length-1;i++){const s={o:[e[i][0],e[i][1]],d:[e[i+1][0],e[i+1][1]]};t.push(s)}return t}destory(){this.evtBus&&this.evtBus.off(h,this.syncConnections,this),this.removeLink("start"),this.removeLink("end"),super.destory()}}var at=ICEPolyLine;class ICEBezier extends at{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t=ICEBezier.arrangeParam(t),super(t)}static arrangeParam(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e="cubic"===t.curveType?"cubic":"quadratic",i=t.points&&t.points.length?t.points:ICEBezier.buildDefaultPoints(t,e);return _objectSpread2(_objectSpread2({},t),{},{curveType:e,points:i})}static buildDefaultPoints(t,e){const i=t.startPoint||[0,0],s=t.endPoint||[10,10];return"cubic"===e?[i,t.controlPoint1||[5,-5],t.controlPoint2||[5,5],s]:[i,t.controlPoint||[5,-5],s]}}var ht=class ICELinkSlot extends V{constructor(){super(_objectSpread2({linkable:!1,draggable:!1,position:"T"},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})),_defineProperty$1(this,"__onHostRemoved",()=>{this._hostComponent=null,this.setState({display:!1})})}keyboardEvtHandler(t){}destory(){this.hostComponent=null,super.destory()}updatePosition(){const t=this._hostComponent.getMinBoundingBox(!0);let e=0,i=0;switch(this.state.position){case"T":e=t.tc[0]-this.state.radius,i=t.tc[1]-this.state.radius;break;case"R":e=t.rc[0]-this.state.radius,i=t.rc[1]-this.state.radius;break;case"B":e=t.bc[0]-this.state.radius,i=t.bc[1]-this.state.radius;break;case"L":e=t.lc[0]-this.state.radius,i=t.lc[1]-this.state.radius;break;case"C":e=t.center[0]-this.state.radius,i=t.center[1]-this.state.radius}this.state.left===e&&this.state.top===i||this.setState({left:e,top:i})}set hostComponent(t){const e=this._hostComponent;e&&(e.off(s,this.updatePosition,this),e.off(r,this.__onHostRemoved,this)),this._hostComponent=t,t&&(t.on(s,this.updatePosition,this),t.on(r,this.__onHostRemoved,this),this.setState({display:!0}))}get hostComponent(){return this._hostComponent}};class ICEVisioLink extends at{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t=ICEVisioLink.arrangeParam(t),super(t)}static arrangeParam(t){return isNil$1(t.startPoint)&&(t.startPoint=[0,0]),isNil$1(t.endPoint)&&(t.endPoint=[10,10]),t.points=[[...t.startPoint],[...t.endPoint]],"bezier"===(t=_objectSpread2({escapeDistance:30,linkShape:"visio"},t)).linkShape&&(t.curveType="straight"),t}__calcDots(){if("bezier"===this.state.linkShape)return this.__calcBezierDots();const t=this.interpolate(),{left:e,top:i}=this.state,s=t[0][2];this.state.points=[],this.state.dots=[];for(let t=0;t<s.length;t++){const n=s[t];this.state.points.push([n.x,n.y]),this.state.dots.push([n.x-e,n.y-i])}return this.calcArrowPoints(),this.state.dots}__calcBezierDots(){const t=this.state.points,e=[...t[0]],i=[...t[t.length-1]],{left:s,top:n}=this.state,o=this.buildBezierPoints(e,i);return this.state.points=o.map(t=>[...t]),this.state.dots=o.map(t=>[t[0]-s,t[1]-n]),this.state.curveType="straight",this.calcArrowPoints(),this.state.dots}buildBezierPoints(t,e){const i=e[0]-t[0],s=e[1]-t[1],n=Math.hypot(i,s);if(n<1e-6)return[[...t],[...e]];const o=[i/n,s/n],r=Math.max(.45*n,24),a=this.slotDirection("start",o),h=this.slotDirection("end",o),l=[t[0]+a[0]*r,t[1]+a[1]*r],c=[e[0]+h[0]*r,e[1]+h[1]*r],d=Math.min(24,Math.max(8,Math.round(n/12))),u=[];for(let i=0;i<=d;i++){const s=i/d,n=1-s,o=n*n*n*t[0]+3*n*n*s*l[0]+3*n*s*s*c[0]+s*s*s*e[0],r=n*n*n*t[1]+3*n*n*s*l[1]+3*n*s*s*c[1]+s*s*s*e[1];u.push([round(o,2),round(r,2)])}return u.filter((t,e)=>0===e||t[0]!==u[e-1][0]||t[1]!==u[e-1][1])}slotDirection(t,e){const i=this.state.links&&this.state.links[t],s=at.dirVector(i&&i.position);return 0!==s[0]||0!==s[1]?s:"start"===t?e:[-e[0],-e[1]]}recalculateRoute(){"bezier"!==this.state.linkShape&&super.recalculateRoute()}interpolate(){const t=this.state.points.length,e=this.state.points[0][0],i=this.state.points[0][1],s=this.state.points[t-1][0],n=this.state.points[t-1][1],o=new GeoPoint(e,i),r=new GeoPoint(s,n),a=[];let h,l,c=null,d=null,u=[],p=new D,f=new D;if(this.ice&&this.state.links&&this.state.links.start&&this.state.links.start.id&&(h=this.ice.findComponent(this.state.links.start.id)),h){p=h.getMinBoundingBox(),a[0]=new GeoPoint(o.x,p.tl[1]-this.state.escapeDistance),a[1]=new GeoPoint(p.tr[0]+this.state.escapeDistance,o.y),a[2]=new GeoPoint(o.x,p.br[1]+this.state.escapeDistance),a[3]=new GeoPoint(p.tl[0]-this.state.escapeDistance,o.y),c=a[0];for(let t=1;t<a.length;t++)this.distance(o,a[t])<this.distance(o,c)&&(c=a[t])}if(this.ice&&this.state.links&&this.state.links.end&&this.state.links.end.id&&(l=this.ice.findComponent(this.state.links.end.id)),l){f=l.getMinBoundingBox(),a[0]=new GeoPoint(r.x,f.tl[1]-this.state.escapeDistance),a[1]=new GeoPoint(f.tr[0]+this.state.escapeDistance,r.y),a[2]=new GeoPoint(r.x,f.br[1]+this.state.escapeDistance),a[3]=new GeoPoint(f.tl[0]-this.state.escapeDistance,r.y),d=a[0];for(let t=1;t<a.length;t++)this.distance(r,a[t])<this.distance(r,d)&&(d=a[t])}let g=0;const y=[o];c&&(y.push(c),g=1),d&&y.push(d),y.push(r);const m=GeoPoint.cloneArray(y);u.push(["s0","s0",m]);const _=GeoPoint.cloneArray(y),v=GeoPoint.cloneArray(_);v.splice(g+1,0,new GeoPoint(v[g].x,v[g+1].y)),u.push(["s1","s1_1",v]);const x=GeoPoint.cloneArray(_);x.splice(g+1,0,new GeoPoint(x[g+1].x,x[g].y)),u.push(["s1","s1_2",x]);const b=GeoPoint.cloneArray(_),C=new GeoPoint((b[g].x+b[g+1].x)/2,b[g].y),w=new GeoPoint((b[g].x+b[g+1].x)/2,b[g+1].y);b.splice(g+1,0,C,w),u.push(["s2","s2_1",b]);const S=GeoPoint.cloneArray(_),P=new GeoPoint(S[g].x,(S[g].y+S[g+1].y)/2),E=new GeoPoint(S[g+1].x,(S[g].y+S[g+1].y)/2);S.splice(g+1,0,P,E),u.push(["s2","s2_2",S]);const M=GeoPoint.cloneArray(_),k=[M[g].x+20,M[g+1].x+20];p&&k.push(p.br[0]+20),f&&k.push(f.br[0]+20);const I=this.max(k),B=new GeoPoint(I,M[g].y),T=new GeoPoint(I,M[g+1].y);M.splice(g+1,0,B,T),u.push(["s2","s2_3",M]);const O=GeoPoint.cloneArray(_),N=[O[g].y-20,O[g+1].y-20];p&&N.push(p.tl[1]-20),f&&N.push(f.tl[1]-20);const $=this.min(N),A=new GeoPoint(O[g].x,$),L=new GeoPoint(O[g+1].x,$);O.splice(g+1,0,A,L),u.push(["s2","s2_4",O]);const R=GeoPoint.cloneArray(_),z=[R[g].x-20,R[g+1].x-20];p&&z.push(p.tl[0]-20),f&&z.push(f.tl[0]-20);const j=this.min(z),F=new GeoPoint(j,R[g].y),X=new GeoPoint(j,R[g+1].y);R.splice(g+1,0,F,X),u.push(["s2","s2_5",R]);const H=GeoPoint.cloneArray(_),V=[H[g].y+20,H[g+1].y+20];p&&V.push(p.tl[1]+p.height+20),f&&V.push(f.tl[1]+f.height+20);const W=this.max(V),Y=new GeoPoint(H[g].x,W),G=new GeoPoint(H[g+1].x,W);H.splice(g+1,0,Y,G),u.push(["s2","s2_6",H]);const K=[];for(let t=0;t<u.length;t++){const e=u[t][2];this.orthogonalPath(e)&&K.push(u[t])}if(u=K,!o.equals(r)){const t=[];for(let e=0;e<u.length;e++){const i=u[e][2];this.forwardPath(i)&&t.push(u[e])}u=t,u.length}const q=[];for(let t=0;t<u.length;t++){let e=!1,i=u[t][2].slice();(f||p)&&(i=i.slice(1,i.length-1)),p&&(e=e||this.polylineIntersectsRectangle(i,p)),f&&(e=e||this.polylineIntersectsRectangle(i,f)),e||q.push(u[t])}0!=q.length&&(u=q),u.length;const U=u[0][2].length,J=[];for(let t=0;t<u.length;t++)u[t][2].length==U&&J.push(u[t]);u=J;let Q=0;for(let t=0;t<u.length;t++)this.scorePath(u[Q][2])<this.scorePath(u[t][2])&&(Q=t);return u=[u[Q]],u}orthogonalPath(t){if(t.length<=1)return!0;for(let e=0;e<t.length-1;e++)if(t[e].x!=t[e+1].x&&t[e].y!=t[e+1].y)return!1;return!0}lineIntersectsLine(t,e){if(t.startPoint.x==t.endPoint.x&&e.startPoint.x==e.endPoint.x)return t.startPoint.x==e.startPoint.x&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));if(t.startPoint.x==t.endPoint.x||e.startPoint.x==e.endPoint.x){if(t.startPoint.x==t.endPoint.x){const i=t;t=e,e=i}const i=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),s=t.startPoint.y-i*t.startPoint.x,n=e.startPoint.x,o=i*n+s;return t.contains(n,o)&&e.contains(n,o)}{const i=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),s=t.startPoint.y-i*t.startPoint.x,n=(e.endPoint.y-e.startPoint.y)/(e.endPoint.x-e.startPoint.x),o=e.startPoint.y-n*e.startPoint.x;if(i==n)return s==o&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));{const r=(o-s)/(i-n),a=i*r+s;return t.contains(r,a)&&e.contains(r,a)}}}polylineIntersectsRectangle(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s=[];s.push(new GeoLine(new GeoPoint(e.x1,e.y1),new GeoPoint(e.x2,e.y1))),s.push(new GeoLine(new GeoPoint(e.x2,e.y1),new GeoPoint(e.x2,e.y2))),s.push(new GeoLine(new GeoPoint(e.x2,e.y2),new GeoPoint(e.x1,e.y2))),s.push(new GeoLine(new GeoPoint(e.x1,e.y2),new GeoPoint(e.x1,e.y1)));for(let e=0;e<t.length-1;e++){const i=new GeoLine(t[e],t[e+1]);for(let t=0;t<s.length;t++)if(this.lineIntersectsLine(i,s[t]))return!0}if(i){const e=new GeoLine(t[t.length-1],t[0]);for(let t=0;t<s.length;t++)if(this.lineIntersectsLine(e,s[t]))return!0}return!1}scorePath(t){if(t.length<=2)return-1;let e=0;for(let i=1;i<t.length-1;i++)if(t[i-1].x==t[i].x&&t[i].x==t[i+1].x){if(this.signum(t[i+1].y-t[i].y)!=this.signum(t[i].y-t[i-1].y))return-1;e++}else if(t[i-1].y==t[i].y&&t[i].y==t[i+1].y){if(this.signum(t[i+1].x-t[i].x)!=this.signum(t[i].x-t[i-1].x))return-1;e++}else e--;return e}signum(t){return t>0?1:t<0?-1:0}forwardPath(t){if(t.length<=2)return!0;for(let e=0;e<t.length-2;e++)if(t[e].x==t[e+1].x&&t[e+1].x==t[e+2].x){if(0!=this.signum(t[e+1].y-t[e].y)&&this.signum(t[e+1].y-t[e].y)==-1*this.signum(t[e+2].y-t[e+1].y))return!1}else if(t[e].y==t[e+1].y&&t[e+1].y==t[e+2].y&&0!=this.signum(t[e+1].x-t[e].x)&&this.signum(t[e+1].x-t[e].x)==-1*this.signum(t[e+2].x-t[e+1].x))return!1;return!0}distance(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}max(t){if(0==t.lenght)return NaN;{let e=t[0];for(let i=0;i<t.length;i++)e<t[i]&&(e=t[i]);return e}}min(t){if(0==t.lenght)return NaN;{let e=t[0];for(let i=0;i<t.length;i++)e>t[i]&&(e=t[i]);return e}}addDot(t,e){throw new Error("Can NOT add dot to ICEVisioLink mannually.")}rmDot(t){throw new Error("Can NOT remove dot from ICEVisioLink mannually.")}}var lt=class ICEIsogon extends ICEDotPath{constructor(){const t=_objectSpread2({radius:10,edges:3,startAngle:90},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});t.edges=Math.floor(t.edges>=3?t.edges:3),t.width=2*t.radius,t.height=2*t.radius,super(t)}__calcDots(){this.state.dots=[];const t=2*Math.PI/this.state.edges,e=this.state.radius;for(let i=0;i<this.state.edges;i++){const s=t*i-toRadian(this.state.startAngle),n=Math.floor(e*Math.cos(s)+e),o=Math.floor(e*Math.sin(s)+e);this.state.dots.push([n,o])}return this.state.dots}calcComponentParams(){return this.paramsDirty?(this.calcDots(),this.state.width=2*this.state.radius,this.state.height=2*this.state.radius,{width:this.state.width,height:this.state.height}):{width:this.state.width,height:this.state.height}}setState(t){isNil$1(t.radius)?isNil$1(t.width)?isNil$1(t.height)||(t.radius=t.height/2):t.radius=t.width/2:(t.width=2*t.radius,t.height=2*t.radius),super.setState(t)}},ct=class ICERose extends ICEDotPath{constructor(){const t=_objectSpread2({radius:50,leafNum:2,pointNumber:100},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});t.leafNum=Math.floor(t.leafNum>=2?t.leafNum:2),t.width=2*t.radius,t.height=2*t.radius,super(t)}__calcDots(){const t=this.state.radius,e=this.state.leafNum;this.state.dots=[];const i=Math.PI/this.state.pointNumber;let s=0,n=0,o=0;for(;s=t+t*Math.sin(e*o)*Math.cos(o),n=t+t*Math.sin(e*o)*Math.sin(o),this.state.dots.push([s,n]),o+=i,!(o>=2*Math.PI););return this.state.dots}calcComponentParams(){return this.paramsDirty?(this.calcDots(),this.state.width=2*this.state.radius,this.state.height=2*this.state.radius,{width:this.state.width,height:this.state.height}):{width:this.state.width,height:this.state.height}}setState(t){isNil$1(t.radius)?isNil$1(t.width)?isNil$1(t.height)||(t.radius=t.height/2,t.width=t.height):(t.radius=t.width/2,t.height=t.width):(t.width=2*t.radius,t.height=2*t.radius),super.setState(t)}},dt=class ICEStar extends ICEDotPath{constructor(){const t=_objectSpread2({outerRadius:50,innerRadius:20,startAngle:90,spikes:5},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});t.spikes=Math.floor(t.spikes>=1?t.spikes:1),t.width=2*t.outerRadius,t.height=2*t.outerRadius,super(t)}__calcDots(){this.state.dots=[];let t=toRadian(this.state.startAngle);const e=Math.PI/this.state.spikes,i=this.state.outerRadius,s=this.state.innerRadius;let n,o;for(let r=0;r<this.state.spikes;r++)n=Math.cos(t)*i+i,o=Math.sin(t)*i+i,this.state.dots.push([n,o]),t+=e,n=Math.cos(t)*s+i,o=Math.sin(t)*s+i,this.state.dots.push([n,o]),t+=e;return this.state.dots}calcComponentParams(){return this.paramsDirty?(this.calcDots(),this.state.width=2*this.state.outerRadius,this.state.height=2*this.state.outerRadius,{width:this.state.width,height:this.state.height}):{width:this.state.width,height:this.state.height}}setState(t){isNil$1(t.outerRadius)?isNil$1(t.width)?isNil$1(t.height)||(t.outerRadius=t.height/2):t.outerRadius=t.width/2:(t.width=2*t.outerRadius,t.height=2*t.outerRadius),super.setState(t)}};const ut="__ICE_UTILS_TEXT_MEASURE_DIV__";class ICEText extends z{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(ICEText.arrangeParam(t)),_defineProperty$1(this,"__originalDraggable",!0),_defineProperty$1(this,"__editInput",null),this.measureText()}static arrangeParam(t){const e=merge$1({text:"",left:0,top:0,width:10,height:10,editing:!1,caretIndex:0,wrap:!1,maxLines:0,ellipsis:"…",lines:null,transformable:!1,style:{fontWeight:"bold",fontSize:32,fontFamily:"Arial",lineWidth:1,textBaseline:"bottom",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}},t);return e.style=_objectSpread2(_objectSpread2({},e.style),{},{font:"".concat(e.style.fontWeight," ").concat(e.style.fontSize,"px ").concat(e.style.fontFamily)}),e}initEvents(){super.initEvents(),this.on("dblclick",this.startEditing,this)}startEditing(){this.__originalDraggable=this.state.draggable,this.setState({editing:!0,caretIndex:this.state.text.length,draggable:!1}),this.ice&&this.ice.controlPanelManager&&this.ice.controlPanelManager.transformControlPanel.disable(),this.ice&&this.ice.evtBus&&this.ice.evtBus.on("mousedown",this.__globalMouseDownHandler,this),this.__mountEditInput()}stopEditing(){this.ice&&this.ice.evtBus&&this.ice.evtBus.off("mousedown",this.__globalMouseDownHandler,this),this.__unmountEditInput(),this.setState({editing:!1,draggable:this.__originalDraggable})}__mountEditInput(){const t=this.root&&this.root.document;if(!t||!t.body)return;const e=this.getMinBoundingBox(!0),i=this.ice&&this.ice.canvasEl?this.ice.canvasEl.getBoundingClientRect():{left:0,top:0},{paddingTop:s,paddingRight:n,paddingBottom:o,paddingLeft:r}=this.state.style,a=Math.max(this.state.width-r-n,1),h=Math.max(this.state.height-s-o,this.state.style.fontSize),l=t.createElement("input");l.type="text",l.value=this.state.text,l.style.position="absolute",l.style.left=i.left+e.tl[0]+"px",l.style.top=i.top+e.tl[1]+"px",l.style.width=a+"px",l.style.height=h+"px",l.style.font=this.state.style.font,l.style.paddingTop=s+"px",l.style.paddingRight=n+"px",l.style.paddingBottom=o+"px",l.style.paddingLeft=r+"px",l.style.boxSizing="content-box",l.style.color="transparent",l.style.caretColor=this.state.style.fillStyle||"#000000",l.style.background="transparent",l.style.border="none",l.style.outline="none",l.style.margin="0",l.style.zIndex="9999",t.body.appendChild(l),l.focus(),l.setSelectionRange(l.value.length,l.value.length),l.addEventListener("input",()=>{this.setText(l.value)}),l.addEventListener("compositionend",()=>{this.setText(l.value)}),l.addEventListener("keydown",t=>{"Enter"!==t.key&&"Escape"!==t.key||t.isComposing||this.stopEditing()}),l.addEventListener("blur",()=>{this.stopEditing()}),this.__editInput=l}__unmountEditInput(){this.__editInput&&this.__editInput.parentNode&&this.__editInput.parentNode.removeChild(this.__editInput),this.__editInput=null}__globalMouseDownHandler(t){(t&&t.param&&t.param.component)!==this&&this.stopEditing()}setText(t){const e=Math.max(0,Math.min(this.state.caretIndex,t.length));return this.setState({text:t,caretIndex:e}),this}getText(){return this.state.text}keyboardEvtHandler(t){if(this.__editInput)return;if(!this.state.editing)return void super.keyboardEvtHandler(t);if("keydown"!==t.type)return;const e=t.key,i=this.state.text,s=this.state.caretIndex;"Enter"!==e&&"Escape"!==e?"Backspace"!==e?"Delete"!==e?"ArrowLeft"!==e?"ArrowRight"!==e?"Home"!==e?"End"!==e?e&&1===e.length&&this.setState({text:i.slice(0,s)+e+i.slice(s),caretIndex:s+1}):this.setState({caretIndex:i.length}):this.setState({caretIndex:0}):this.setState({caretIndex:Math.min(i.length,s+1)}):this.setState({caretIndex:Math.max(0,s-1)}):s<i.length&&this.setState({text:i.slice(0,s)+i.slice(s+1)}):s>0&&this.setState({text:i.slice(0,s-1)+i.slice(s),caretIndex:s-1}):this.stopEditing()}renderCaret(){if(this.__editInput)return;const{paddingTop:t,paddingBottom:e,paddingLeft:i}=this.state.style,s=this.state.text.slice(0,this.state.caretIndex);let n=0-this.state.localOrigin[0]+i;"function"==typeof this.ctx.measureText&&(n+=this.ctx.measureText(s).width);const o=0-this.state.localOrigin[1]+t,r=0-this.state.localOrigin[1]+this.state.height-e;this.ctx.save(),this.ctx.strokeStyle=this.state.style.fillStyle||"#000000",this.ctx.lineWidth=1,this.ctx.beginPath(),this.ctx.moveTo(n,o),this.ctx.lineTo(n,r),this.ctx.stroke(),this.ctx.restore()}calcComponentParams(){return this.paramsDirty?this.measureText():{width:this.state.width,height:this.state.height}}measureText(t){this.state.lines=this.__computeWrappedLines();const e=this.__measureByCanvas();return e?(this.__applyMeasuredSize(e),{width:this.state.width,height:this.state.height}):this.__measureByDOM()}__computeWrappedLines(){var t;if(!this.state.wrap||this.state.editing)return null;const e=Number(this.state.width);if(!(e>0))return null;const i=this.ctx;if(!i||"function"!=typeof i.measureText)return null;const s=this.__measureFn(),n=this.__wrapText(e,s);return this.__truncateLines(n,e,Number(this.state.maxLines)||0,String(null!==(t=this.state.ellipsis)&&void 0!==t?t:"…"),s)}__measureFn(){const t=this.ctx;this.state.style.font&&t&&"function"==typeof t.measureText&&(t.font=this.state.style.font);const e=Number(this.state.style.fontSize)||12;return i=>{if(t&&"function"==typeof t.measureText){const e=t.measureText(i);return e&&e.width||0}return i.length*e}}__graphemes(t){const e=this.root&&this.root.Intl;if(e&&"function"==typeof e.Segmenter)try{const i=new e.Segmenter(void 0,{granularity:"grapheme"}),s=[];for(const e of i.segment(t))s.push(e.segment);return s}catch(t){}return Array.from(t)}__wrapText(t,e){var i;const s=[],n=String(null!==(i=this.state.text)&&void 0!==i?i:"").split("\n");for(let i=0;i<n.length;i++){const o=this.__graphemes(n[i]);let r="";for(let i=0;i<o.length;i++){const n=r+o[i];""!==r&&e(n)>t?(s.push(r),r=o[i]):r=n}s.push(r)}return s}__truncateLines(t,e,i,s,n){if(!(i>0)||t.length<=i)return t;const o=t.slice(0,i),r=this.__graphemes(o[i-1]);for(;r.length>0&&n(r.join("")+s)>e;)r.pop();return o[i-1]=r.join("")+s,o}__measureByCanvas(){var t;if(!this.ctx||"function"!=typeof this.ctx.measureText)return null;this.state.style.font&&(this.ctx.font=this.state.style.font);const e=this.state.lines||String(null!==(t=this.state.text)&&void 0!==t?t:"").split("\n");let i=0,s=0,n=0;for(const t of e){const e=this.ctx.measureText(t);i=Math.max(i,e.width||0);const o=e.actualBoundingBoxAscent,r=e.actualBoundingBoxDescent;if("number"!=typeof o||"number"!=typeof r)return null;s=Math.max(s,o),n=Math.max(n,r)}return{textWidth:i,textHeight:(s+n)*e.length}}__applyMeasuredSize(t){const{paddingTop:e,paddingBottom:i,paddingLeft:s,paddingRight:n}=this.state.style,o=t.textWidth+s+n,r=t.textHeight+e+i;10===this.props.width&&(this.state.width=o),10===this.props.height&&(this.state.height=r),this.state.textHeight=t.textHeight}__measureByDOM(){let t;try{if(t=this.root.document.getElementById(ut),!t){t=this.root.document.createElement("div"),t.setAttribute("id",ut);const e={visibility:"hidden",position:"absolute",top:"0",left:"0",padding:"0",margin:"0",border:"none",fontFamily:this.state.style.fontFamily,fontWeight:this.state.style.fontWeight,fontSize:this.state.style.fontSize+"px",lineHeight:"1",whiteSpace:"pre"};for(const i in e)t.style[i]=e[i];t.contenteditable=!1,this.root.document.body.appendChild(t)}t.textContent=this.state.text;const{paddingTop:e,paddingBottom:i,paddingLeft:s,paddingRight:n}=this.state.style,o={width:t.offsetWidth+s+n,height:t.offsetHeight+e+i};return 10===this.props.width&&(this.state.width=o.width),10===this.props.height&&(this.state.height=o.height),this.state.textHeight=t.offsetHeight,{width:this.state.width,height:this.state.height}}catch(t){return{width:this.state.width,height:this.state.height}}}doRender(){var t;this.dirty&&this.measureText();const{paddingTop:e,paddingBottom:i,paddingLeft:s,paddingRight:n,textAlign:o,textBaseline:r}=this.state.style,a=this.state.lines||String(null!==(t=this.state.text)&&void 0!==t?t:"").split("\n"),h=(this.state.textHeight||this.state.style.fontSize)/a.length,l="center"===o||"right"===o||"end"===o,c=l?this.__measureFn():null;l&&(this.ctx.textAlign="left");for(let t=0;t<a.length;t++){let i=0-this.state.localOrigin[0]+s;if(l){const e=c&&c(a[t])||0;i="center"===o?-e/2:this.state.localOrigin[0]-n-e}let d=0-this.state.localOrigin[1]+e+(t+1)*h;"middle"===r&&(d=(t-(a.length-1)/2)*h),this.state.stroke&&this.ctx.strokeText(a[t],i,d,this.state.width),this.state.fill&&this.ctx.fillText(a[t],i,d,this.state.width)}this.state.editing&&this.renderCaret(),super.doRender()}}var pt=ICEText,ft=class ICELayoutManager{getPreferredSize(t){return[0,0]}},gt={ICERect:F,ICECircle:V,ICEEllipse:H,ICEStar:dt,ICEIsogon:lt,ICERose:ct,ICEText:pt,ICEImage:rt,ICEGroup:X,ICEVisioLink:ICEVisioLink,ICEPolyLine:at,ICEBezier:ICEBezier};const yt={evtBuses:[],stopped:!1,frameCallback:function(){for(let t=0;t<yt.evtBuses.length;t++){if(yt.stopped)return;yt.evtBuses[t].trigger(e)}yt.stopped||I.requestFrame(yt.frameCallback)},start:function(){yt.stopped=!1,I.requestFrame(yt.frameCallback)},stop:function(){yt.stopped=!0},registerEvtBus:function(t){yt.evtBuses.includes(t)||yt.evtBuses.push(t)},delEvtBus:function(t){yt.evtBuses.includes(t)&&yt.evtBuses.splice(yt.evtBuses.indexOf(t),1)}};var mt=yt;class ICELinkSlotManager{constructor(t){_defineProperty$1(this,"slotRadius",10),this.ice=t}start(){return this.createLinkSlots(),this.ice.evtBus.on(c,this.hookMouseMoveHandler,this),this.ice.evtBus.on(d,this.hookMouseUpHandler,this),this.ice.evtBus.on("mouseup",this.globalMouseUpHandler,this),this}stop(){return this.ice.evtBus.off(c,this.hookMouseMoveHandler,this),this.ice.evtBus.off(d,this.hookMouseUpHandler,this),this.ice.evtBus.off("mouseup",this.globalMouseUpHandler,this),this}hookMouseMoveHandler(t){const e=t.target,i=e.getMaxBoundingBox(),s=flattenTree([],this.ice.childNodes);s.sort((t,e)=>t.state.zIndex-e.state.zIndex),this.collision=null;for(let t=0;t<s.length;t++){const e=s[t];e&&e.state.linkable&&isEffectivelyVisible(e)&&(e.getMaxBoundingBox().isIntersect(i)&&(this.collision=e))}if(!this.collision){for(let t=0;t<this.ice._linkSlots.length;t++)this.ice._linkSlots[t].setState({display:!1,style:{fillStyle:"#3ce92c"}});return void e.setState({style:{fillStyle:"#3ce92c"}})}let n=!1;for(let t=0;t<this.ice._linkSlots.length;t++){const s=this.ice._linkSlots[t];s.hostComponent!==this.collision&&(s.hostComponent=this.collision),s.setState({display:!0,style:{fillStyle:"#3ce92c"}}),e.setState({style:{fillStyle:"#3ce92c"}}),s.getMaxBoundingBox().isIntersect(i)&&(n=!0,s.setState({style:{fillStyle:"#fffb00"}}))}n&&e.setState({style:{fillStyle:"#fffb00"}})}hookMouseUpHandler(t){const e=t.target,i=e.state.position,s=e.parentNode.targetComponent,n=e.getMaxBoundingBox();let o=!1;if(this.collision)for(let t=0;t<this.ice._linkSlots.length;t++){const e=this.ice._linkSlots[t];if(e.setState({display:!1,style:{fillStyle:"#3ce92c"}}),e.getMaxBoundingBox().isIntersect(n)){o=!0;const t={};t[i]={id:e.hostComponent.state.id,position:e.state.position},s&&s.setState({links:t});break}}if(o)e.setState({display:!1,style:{fillStyle:"#3ce92c"}});else{const t={};t[i]=null,s&&s.setState({links:t})}this.collision=null}globalMouseUpHandler(t){for(let t=0;t<this.ice._linkSlots.length;t++)this.ice._linkSlots[t].setState({display:!1,style:{fillStyle:"#3ce92c"}})}createLinkSlots(){if(this.ice._linkSlots&&this.ice._linkSlots.length)return;const t=new ht({zIndex:10000010,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"T",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}});this.ice.addTool(t);const e=new ht({zIndex:10000011,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"R",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}});this.ice.addTool(e);const i=new ht({zIndex:10000012,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"B",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}});this.ice.addTool(i);const s=new ht({zIndex:10000013,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"L",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}});this.ice.addTool(s);const n=new ht({zIndex:10000014,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"C",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}});this.ice.addTool(n),this.ice._linkSlots=[t,e,i,s,n]}}const _t=["linearMatrix","composedMatrix","localOrigin","absoluteOrigin","dots","textHeight","lines"];class Serializer{constructor(t){this.ice=t}toJSONString(){return JSON.stringify(this.toJSONObject())}toJSONObject(){const t={version:1,createTime:(new Date).toLocaleString(),lastModifyTime:(new Date).toLocaleString(),childNodes:[]};for(let e=0;e<this.ice.childNodes.length;e++){const i=this.ice.childNodes[e];this.encodeRecursively(i,t)}return t}encodeRecursively(t,e){const i=this.ice.getTypeId(t.constructor)||t.constructor.name,s={state:this.pickSerializableState(t.state),type:i,childNodes:[]};if(e.childNodes.push(s),t.childNodes&&t.childNodes.length)for(let e=0;e<t.childNodes.length;e++)this.encodeRecursively(t.childNodes[e],s)}pickSerializableState(t){const e={};for(const i in t)-1===_t.indexOf(i)&&(e[i]=t[i]);return e}}const vt=[];class Deserializer{constructor(t){_defineProperty$1(this,"_unknownTypes",[]),this.ice=t}get unknownTypes(){return this._unknownTypes}fromJSONObject(t){this._unknownTypes=[];const e=t&&t.version?t.version:1;this.migrate(t,e);const i=t&&t.childNodes||[];for(let t=0;t<i.length;t++)this.decodeRecursively(this.ice,i[t])}fromJSONString(t){const e=JSON.parse(t);this.fromJSONObject(e)}migrate(t,e){if(e>1)throw new Error("不支持的反序列化版本:".concat(e,"(当前支持到 ").concat(1,")"));for(let i=0;i<vt.length;i++){const s=vt[i];e<s.to&&(s.run(t),e=s.to)}t.version=e}decodeRecursively(t,e){if(!e||!e.type)return null;const i=this.ice.getType(e.type);if("function"!=typeof i)return-1===this._unknownTypes.indexOf(e.type)&&this._unknownTypes.push(e.type),null;const s=new i(e.state);t.addChild(s);const n=e.childNodes;if(n&&n.length)for(let t=0;t<n.length;t++)this.decodeRecursively(s,n[t]);return s}}class PluginHost{constructor(t){_defineProperty$1(this,"plugins",[]),_defineProperty$1(this,"renderHooks",[]),_defineProperty$1(this,"tools",[]),this.ice=t}get names(){return this.plugins.map(t=>t.name)}has(t){return this.plugins.some(e=>e.name===t)}hasRenderHooks(){return this.renderHooks.length>0}use(t){if(!t||!t.name)throw new Error("ICE.use(plugin):插件必须提供非空的 name。");if(this.has(t.name))return!1;if(t.components)for(const e in t.components){const i=t.components[e];"function"==typeof i&&this.ice.registerType(e,i)}if("function"==typeof t.render&&this.renderHooks.push({pluginName:t.name,hook:t.render}),t.tools)for(let e=0;e<t.tools.length;e++){const i=t.tools[e];i&&i.id&&this.tools.push(_objectSpread2(_objectSpread2({},i),{},{pluginName:t.name,instance:null,attached:!1}))}return this.plugins.push(t),"function"==typeof t.setup&&t.setup(this.ice),!0}unuse(t){const e=this.plugins.findIndex(e=>e.name===t);if(-1===e)return!1;const i=this.plugins[e];for(let e=this.tools.length-1;e>=0;e--)this.tools[e].pluginName===t&&(this.detachTool(this.tools[e]),this.tools.splice(e,1));for(let e=this.renderHooks.length-1;e>=0;e--)this.renderHooks[e].pluginName===t&&this.renderHooks.splice(e,1);return this.plugins.splice(e,1),"function"==typeof i.teardown&&i.teardown(this.ice),!0}invokeRenderHooks(t){for(let e=0;e<this.renderHooks.length;e++)this.renderHooks[e].hook(t)}syncTools(t){let e=!1;for(let i=0;i<this.tools.length;i++){const s=this.tools[i];let n=!1;try{n=!!t&&!!s.match(t,this.ice)}catch(t){n=!1}n?(s.instance||(s.instance=s.create()),!s.attached&&s.instance&&(this.ice.addTool(s.instance),s.attached=!0),"function"==typeof s.onTargetChange&&s.onTargetChange(s.instance,t),s.exclusive&&(e=!0)):this.detachTool(s)}return e}detachAllTools(){for(let t=0;t<this.tools.length;t++)this.detachTool(this.tools[t])}detachTool(t){t.attached&&t.instance&&(this.ice.removeTool(t.instance),t.attached=!1)}clear(){this.detachAllTools(),this.plugins=[],this.renderHooks=[],this.tools=[]}}function resolveRole(t){return t.isControlPanel?"tool":t.isLine?"link":"function"==typeof t.measureText?"text":Array.isArray(t.childNodes)?"container":t.state&&t.state.src?"image":"graphic"}function resolveLabel(t){const e=t.state||{};return"string"==typeof e.ariaLabel&&e.ariaLabel?e.ariaLabel:"string"==typeof e.text&&e.text?e.text:"string"==typeof e.title&&e.title?e.title:t.props&&t.props.id||String(e.id||"")}function resolveBox(t,e){if("function"!=typeof e.__paintWorldBox)return null;const i=e.state&&e.state.composedMatrix;if(!i||i.length<6)return null;const s=e.__paintWorldBox([0,0,0,0]);if(!(isFinite(s[0])&&isFinite(s[1])&&isFinite(s[2])&&isFinite(s[3])))return null;const[n,o]=t.worldToScreen(s[0],s[1]),[r,a]=t.worldToScreen(s[2],s[3]);return{x:Math.min(n,r),y:Math.min(o,a),width:Math.abs(r-n),height:Math.abs(a-o)}}function buildAccessibilityTree(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=[],s=t&&t.selectionList||[];let n=0;const walk=(o,r,a)=>{if(!o||!o.length)return;const h=o.slice().sort((t,e)=>(t.state.zIndex||0)-(e.state.zIndex||0));for(let o=0;o<h.length;o++){const l=h[o],c=l.state||{},d=isEffectivelyVisible(l),u=!1!==c.interactive,p=resolveBox(t,l),f=(e.includeHidden||d)&&!!p,g=!e.filter||e.filter(l);f&&g&&i.push({id:l.props&&l.props.id||String(c.id||""),role:resolveRole(l),label:resolveLabel(l),box:p,visible:d,interactive:u,focusable:d&&u,tabIndex:n++,selected:-1!==s.indexOf(l),level:r,parentId:a}),l.childNodes&&l.childNodes.length&&walk(l.childNodes,r+1,l.props&&l.props.id||null)}};return walk(t&&t.childNodes||[],1,null),e.includeTools&&walk(t&&t.toolNodes||[],1,null),i}var xt=class CanvasRenderer extends N{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),_defineProperty$1(this,"stopped",!1),_defineProperty$1(this,"renderMode","dirty-rect"),_defineProperty$1(this,"__forceFullRender",!1),_defineProperty$1(this,"componentQueue",[]),_defineProperty$1(this,"toolsQueue",[]),_defineProperty$1(this,"__queueDirty",!0),_defineProperty$1(this,"__zSnap",[]),_defineProperty$1(this,"__snap",new WeakMap),_defineProperty$1(this,"__primed",!1),_defineProperty$1(this,"__lastFrameCulled",0),this.ice=t,this.cache=new class ObjectCache{constructor(t){_defineProperty$1(this,"map",new WeakMap),_defineProperty$1(this,"__bytes",0),_defineProperty$1(this,"__vp",null),_defineProperty$1(this,"__vpChanged",!1),this.ice=t}__rvp(){return this.ice&&"function"==typeof this.ice.getRenderViewport?this.ice.getRenderViewport():this.ice&&this.ice.viewport||{scale:1,tx:0,ty:0}}beginFrame(){const t=this.__rvp(),e=this.__vp;this.__vpChanged=!!e&&(e.scale!==t.scale||e.tx!==t.tx||e.ty!==t.ty),e?(e.scale=t.scale,e.tx=t.tx,e.ty=t.ty):this.__vp={scale:t.scale,tx:t.tx,ty:t.ty}}__sameViewport(t,e,i,s){return t.rs===e&&t.ox===i&&t.oy===s}isCachable(t){if(this.__vpChanged)return!1;if("function"==typeof t.hasClippingAncestor&&t.hasClippingAncestor())return!1;if("function"==typeof t.measureText)return!t.state.editing&&isEffectivelyVisible(t);if(t.isLine){if(t.state.lineDashFlow)return!1;if(!isEffectivelyVisible(t))return!1;const e=this.__rvp().scale;if(!(e>0))return!1;const i="function"==typeof t.__localBox?t.__localBox():null,s=i?i[2]-i[0]:Number(t.state.width)||0,n=i?i[3]-i[1]:Number(t.state.height)||0,o=Math.max(0,s)*Math.max(0,n)*e*e;return!(o>2e6||!this.map.has(t)&&this.__bytes+4*o>33554432)}if("function"==typeof t.calcDots&&!t.isLine){const e=Number(t.state.width)||0,i=Number(t.state.height)||0;return isEffectivelyVisible(t)&&!t.state.lineDashFlow&&e*i>=4e4}return!isOpaqueDrawing(t.state)&&"function"==typeof t.createPathObject&&!t.childNodes&&!t.isLine&&isEffectivelyVisible(t)}has(t){return this.map.has(t)}contentKey(t){const e=t.state;if("function"==typeof t.measureText){const t=e.style||{};return[e.text,t.fontWeight,t.fontSize,t.fontFamily,t.font,t.textAlign,t.textBaseline,t.paddingTop,t.paddingBottom,t.paddingLeft,t.paddingRight,e.fill,e.stroke,JSON.stringify(e.lineDash),e.lineDashOffset,e.lineDashFlow,e.lineBorder,e.lineBorderWidth,e.lineBorderColor,this.__styleKey(e)].join("|")}return"function"==typeof t.calcDots?[JSON.stringify(e.dots),e.closePath,e.fill,e.stroke,JSON.stringify(e.lineDash),e.lineDashOffset,e.lineDashFlow,e.lineBorder,e.lineBorderWidth,e.lineBorderColor,this.__styleKey(e)].join("|"):[e.width,e.height,e.radius,e.radiusX,e.radiusY,e.closePath,e.fill,e.stroke,JSON.stringify(e.lineDash),e.lineDashOffset,e.lineDashFlow,e.lineBorder,e.lineBorderWidth,e.lineBorderColor,this.__styleKey(e)].join("|")}__styleKey(t){const e=t.style||{};return[e.fillStyle,e.strokeStyle,e.lineWidth,e.globalAlpha,e.globalCompositeOperation,e.shadow,e.shadowColor,e.shadowBlur,e.shadowOffsetX,e.shadowOffsetY].join("|")}linearKey(t){const e=t.state.composedMatrix;return!e||e.length<6?"":"".concat(e[0],",").concat(e[1],",").concat(e[2],",").concat(e[3])}render(t){if(!this.isCachable(t))return!1;const e=this.__rvp(),i=e.scale,s=e.tx,n=e.ty;let o=this.map.get(t);if(!t.dirty&&o&&this.__sameViewport(o,i,s,n))return this.draw(o),!0;"function"==typeof t.calcDots&&t.refreshParams(),t.composeMatrix();const r=this.linearKey(t),a=this.contentKey(t);let h=!o||o.contentKey!==a||o.linearKey!==r||!this.__sameViewport(o,i,s,n);if(h||(h=!this.refreshPosition(t,o)),h){const e=o||null;e&&(this.__bytes=Math.max(0,this.__bytes-e.pw*e.ph*4)),o=this.build(t,a,r,i,s,n),this.__bytes+=o.pw*o.ph*4}return this.map.set(t,o),this.draw(o),t.dirty=!1,!0}__paintBox(t){const e=t.getMaxBoundingBox().getMinAndMaxPoint(),i=stylePaintPad(t.state);return{minX:e.minX-i,minY:e.minY-i,maxX:e.maxX+i,maxY:e.maxY+i}}build(t,e,i,s,n,o){t.refreshParams(),t.composeMatrix();const r=this.__paintBox(t),a=Math.floor(r.minX*s+n)-1,h=Math.floor(r.minY*s+o)-1,l=Math.max(1,Math.ceil(r.maxX*s+n)-a+1),c=Math.max(1,Math.ceil(r.maxY*s+o)-h+1),{canvas:d,ctx:u}=I.createOffscreenCanvas(l,c),p=[s,0,0,s,n-a,o-h];return t.renderTo(u,p),{canvas:d,ctx:u,pw:l,ph:c,dx:a,dy:h,dx0:a,dy0:h,buildMinX:r.minX,buildMinY:r.minY,rs:s,ox:n,oy:o,contentKey:e,linearKey:i}}refreshPosition(t,e){const i=this.__paintBox(t),s=e.rs,n=s*(i.minX-e.buildMinX),o=s*(i.minY-e.buildMinY);if(Math.abs(n-Math.round(n))>1e-6)return!1;if(Math.abs(o-Math.round(o))>1e-6)return!1;const r=e.dx0+Math.round(n),a=e.dy0+Math.round(o);return!(i.minX*s+e.ox<r||i.minY*s+e.oy<a||i.maxX*s+e.ox>r+e.pw||i.maxY*s+e.oy>a+e.ph||(e.dx=r,e.dy=a,0))}draw(t){const e=this.ice.ctx;e.save(),e.setTransform(1,0,0,1,0,0),e.drawImage(t.canvas,t.dx,t.dy),e.restore()}invalidate(t){const e=this.map.get(t);e&&(this.__bytes=Math.max(0,this.__bytes-e.pw*e.ph*4)),this.map.delete(t)}clear(){this.map=new WeakMap,this.__bytes=0}}(t),"full"!==e.renderMode&&"dirty-rect"!==e.renderMode||(this.renderMode=e.renderMode)}markQueueDirty(){this.__queueDirty=!0}setRenderMode(t){this.renderMode=t}getRenderMode(){return this.renderMode}start(){return this.stopped=!1,this.ice.evtBus.on(e,this.frameEvtHandler,this),this}stop(){return this.stopped=!0,this.ice.evtBus.off(e,this.frameEvtHandler,this),this}frameEvtHandler(t){if(this.ice.dirty){if(this.refreshQueue(),this.cache.beginFrame(),"dirty-rect"===this.renderMode&&!this.__forceFullRender){const t=this.__collect();if(t)return void this.__renderDirtyRect(t)}this.doRenderFull()}}refreshQueue(){if(this.__queueDirty)this.__rebuildQueue();else if(this.__zOrderChanged()){const compareZ=(t,e)=>t.state.zIndex-e.state.zIndex;this.componentQueue.sort(compareZ),this.toolsQueue.sort(compareZ),this.__snapshotZ()}}__rebuildQueue(){const compareZ=(t,e)=>t.state.zIndex-e.state.zIndex;this.componentQueue=flattenTree([],this.ice.childNodes),this.componentQueue.sort(compareZ),this.toolsQueue=flattenTree([],this.ice.toolNodes),this.toolsQueue.sort(compareZ),this.__queueDirty=!1,this.__snapshotZ(),this.__snap=new WeakMap,this.__primed=!1}__snapshotZ(){const t=this.componentQueue.length+this.toolsQueue.length;this.__zSnap.length!==t&&(this.__zSnap=new Array(t));let e=0;for(let t=0;t<this.componentQueue.length;t++)this.__zSnap[e++]=this.componentQueue[t].state.zIndex;for(let t=0;t<this.toolsQueue.length;t++)this.__zSnap[e++]=this.toolsQueue[t].state.zIndex}__zOrderChanged(){const t=this.componentQueue.length+this.toolsQueue.length;if(this.__zSnap.length!==t)return!0;let e=0;for(let t=0;t<this.componentQueue.length;t++)if(this.__zSnap[e++]!==this.componentQueue[t].state.zIndex)return!0;for(let t=0;t<this.toolsQueue.length;t++)if(this.__zSnap[e++]!==this.toolsQueue[t].state.zIndex)return!0;return!1}doRenderFull(){this.ice.ctx.setTransform(1,0,0,1,0,0),this.ice.ctx.clearRect(0,0,this.ice.canvasWidth,this.ice.canvasHeight);const t=this.__visibleWorldRect();let e=0;for(let i=0;i<this.componentQueue.length;i++){const s=this.componentQueue[i];if(t&&s.isEffectivelyVisible()&&!s.dirty){const i=this.__snap.get(s);if(i&&!intersects(i,t)){e++;continue}}this.__ensureContext(s),this.__renderComponent(s),s.isEffectivelyVisible()&&this.__capture(s)}this.__lastFrameCulled=e;for(let t=0;t<this.toolsQueue.length;t++){const e=this.toolsQueue[t];this.__ensureContext(e),e.render(),e.isEffectivelyVisible()&&this.__capture(e)}this.__invokePluginRender(null),this.__finalizeHidden(this.componentQueue),this.__finalizeHidden(this.toolsQueue),this.__primed=!0,this.ice.dirty=!1,this.ice.evtBus.trigger(h)}__collect(){if(!this.__primed)return null;const t=this.ice.ctx,e=this.ice.canvasWidth||0,i=this.ice.canvasHeight||0;if(!e||!i)return null;if(!t||"function"!=typeof t.save||"function"!=typeof t.clip||"function"!=typeof t.restore)return null;const s=this.__preCount(this.componentQueue);if(0===s.dirty)return null;if(s.visible>0&&s.dirty/s.visible>.2)return null;const n=[];if(!this.__collectDirtyBoxes(n,this.componentQueue))return null;if(!this.__collectDirtyBoxes(n,this.toolsQueue))return null;const o=function coalesceRegions(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6;const i=[];for(let e=0;e<t.length;e++){const s=t[e];if(!isFiniteBox(s))continue;let n=!1;for(let t=0;t<i.length;t++)if(intersects(i[t],s)&&isWorthMerging(i[t],s)){i[t]=mergeBox(i[t],s),n=!0;break}n||i.push([s[0],s[1],s[2],s[3]])}let s=!0;for(;s;){s=!1;for(let t=0;t<i.length&&!s;t++)for(let e=t+1;e<i.length;e++)if(intersects(i[t],i[e])&&isWorthMerging(i[t],i[e])){i[t]=mergeBox(i[t],i[e]),i.splice(e,1),s=!0;break}}for(;i.length>e;){let t=0,e=1,s=1/0;for(let n=0;n<i.length;n++)for(let o=n+1;o<i.length;o++){const r=boxArea(mergeBox(i[n],i[o]))-boxArea(i[n])-boxArea(i[o]);isWorthMerging(i[n],i[o])&&r<s&&(s=r,t=n,e=o)}if(s===1/0){if(i.length>24)return[i.reduce((t,e)=>mergeBox(t,e),[1/0,1/0,-1/0,-1/0])];break}i[t]=mergeBox(i[t],i[e]),i.splice(e,1)}return i}(n,6);if(!o.length)return null;const r=this.__renderViewport(),a=[];for(let t=0;t<o.length;t++)integerAlign(o[t]),a.push(mapBoxToRender(o[t],r));if(function regionsAreaRatio(t,e,i){if(!e||!i)return 1;let s=0;for(let e=0;e<t.length;e++)s+=boxArea(t[e]);return s/(e*i)}(a,e,i)>.35)return null;if(this.__riskyIntersectsRegions(o,this.componentQueue))return null;if(this.__riskyIntersectsRegions(o,this.toolsQueue))return null;const h=[1/0,1/0,-1/0,-1/0];for(let t=0;t<o.length;t++)unionBoxes(h,o[t]);return{regions:o,renderRegions:a,bounding:h}}__renderViewport(){return"function"==typeof this.ice.getRenderViewport?this.ice.getRenderViewport():this.ice.viewport}__preCount(t){let e=0,i=0,s=!1;for(let n=0;n<t.length;n++){const o=t[n];o.isEffectivelyVisible()?(e++,o.dirty&&i++):this.__snap.has(o)&&(s=!0)}return{visible:e,dirty:i,hiddenErase:s}}__collectDirtyBoxes(t,e){for(let i=0;i<e.length;i++){const s=e[i];if(!s.isEffectivelyVisible()){const e=this.__snap.get(s);e&&t.push([e[0],e[1],e[2],e[3]]);continue}if(!s.dirty)continue;s.__paramsDirtyAtCollect=s.paramsDirty;const n=this.__freshBox(s);if(!n)return!1;const o=this.__snap.get(s);t.push(o?mergeBox(o,n):n)}return!0}__riskyIntersectsRegions(t,e){for(let i=0;i<e.length;i++){const s=e[i];if(!s.isEffectivelyVisible())continue;if(!this.__isDotPath(s)&&!this.__isText(s)&&isOpaqueDrawing(s.state))continue;if(s.dirty){if(!this.__isText(s))continue;if(!s.__paramsDirtyAtCollect&&this.cache.isCachable(s)&&this.cache.has(s))continue;return!0}if(this.cache.isCachable(s)&&this.cache.has(s))continue;const n=this.__snap.get(s);if(!n)return!0;for(let e=0;e<t.length;e++)if(intersects(n,t[e]))return!0}return!1}__renderDirtyRect(t){const e=this.ice.ctx,i=t.regions,s=t.renderRegions;for(let t=0;t<i.length;t++){const n=i[t],o=s[t],r=o[0],a=o[1],h=o[2]-o[0],l=o[3]-o[1];if(!(h<=0||l<=0)){e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(r,a,h,l),e.beginPath(),e.rect(r,a,h,l),e.clip();for(let t=0;t<this.componentQueue.length;t++){const e=this.componentQueue[t];if(!e.isEffectivelyVisible())continue;const i=this.__snap.get(e);(e.dirty||i&&intersects(i,n))&&(this.__ensureContext(e),this.__renderComponent(e),this.__capture(e))}for(let t=0;t<this.toolsQueue.length;t++){const e=this.toolsQueue[t];e.isEffectivelyVisible()&&(this.__ensureContext(e),e.render(),this.__capture(e))}this.__invokePluginRender(n),e.restore()}}this.__finalizeHidden(this.componentQueue),this.__finalizeHidden(this.toolsQueue),this.ice.dirty=!1,this.ice.evtBus.trigger(h)}__invokePluginRender(t){const e=this.ice&&this.ice.plugins;if(!e||"function"!=typeof e.hasRenderHooks||!e.hasRenderHooks())return;const i=this.ice.ctx,s=this.__renderViewport();i.setTransform(s.scale,0,0,s.scale,s.tx,s.ty),e.invokeRenderHooks({ctx:i,mode:this.renderMode,region:t,width:this.ice.canvasWidth,height:this.ice.canvasHeight})}__ensureContext(t){t.ctx===this.ice.ctx&&t.ice===this.ice||(t.root=this.ice.root,t.ctx=this.ice.ctx,t.evtBus=this.ice.evtBus,t.ice=this.ice)}getWorldBox(t){return this.__snap.get(t)||null}__visibleWorldRect(){const t=this.ice.canvasWidth||0,e=this.ice.canvasHeight||0;if(!t||!e)return null;const[i,s]=this.ice.screenToWorld(0,0),[n,o]=this.ice.screenToWorld(t,e),r=[Math.min(i,n),Math.min(s,o),Math.max(i,n),Math.max(s,o)];return isFiniteBox(r)?r:null}__renderComponent(t){this.cache.render(t)||t.render()}__isDotPath(t){return"function"==typeof t.calcDots}__isText(t){return"function"==typeof t.measureText}__freshBox(t){try{"function"==typeof t.refreshParams&&t.refreshParams();const e=t.getMaxBoundingBox(!0).getMinAndMaxPoint(),i=stylePaintPad(t.state),s=[e.minX-i,e.minY-i,e.maxX+i,e.maxY+i];return isFiniteBox(s)?s:null}catch(t){return null}}__capture(t){let e=this.__snap.get(t);e||(e=new Float64Array(4),this.__snap.set(t,e)),t.__paintWorldBox(e);const i=stylePaintPad(t.state);e[0]-=i,e[1]-=i,e[2]+=i,e[3]+=i}__finalizeHidden(t){for(let e=0;e<t.length;e++){const i=t[e];!i.isEffectivelyVisible()&&i.dirty&&(i.dirty=!1,this.__snap.delete(i))}}};class ImageCache{constructor(t){_defineProperty$1(this,"imageCache",new Map),this.ice=t}setImage(t){let e=this.imageCache.get(t);return e||(e=I.createImage(),e.onload=()=>{this.ice.dirty=!0},e.onerror=()=>{},e.src=t,this.imageCache.size>ImageCache.CACHE_SIZE&&this.imageCache.delete(this.imageCache.keys().next().value),this.imageCache.set(t,e)),{loaded:this.loaded(e),image:e}}loaded(t){return t.complete&&t.naturalWidth>0}}_defineProperty$1(ImageCache,"CACHE_SIZE",100);var bt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var Ct=function isNil(t){return null==t};var wt=function listCacheClear$1(){this.__data__=[],this.size=0};var St=function eq$4(t,e){return t===e||t!=t&&e!=e},Pt=St;var Et=function assocIndexOf$4(t,e){for(var i=t.length;i--;)if(Pt(t[i][0],e))return i;return-1},Mt=Et,kt=Array.prototype.splice;var It=Et;var Bt=Et;var Tt=Et;var Ot=wt,Nt=function listCacheDelete$1(t){var e=this.__data__,i=Mt(e,t);return!(i<0)&&(i==e.length-1?e.pop():kt.call(e,i,1),--this.size,!0)},Dt=function listCacheGet$1(t){var e=this.__data__,i=It(e,t);return i<0?void 0:e[i][1]},$t=function listCacheHas$1(t){return Bt(this.__data__,t)>-1},At=function listCacheSet$1(t,e){var i=this.__data__,s=Tt(i,t);return s<0?(++this.size,i.push([t,e])):i[s][1]=e,this};function ListCache$4(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var s=t[e];this.set(s[0],s[1])}}ListCache$4.prototype.clear=Ot,ListCache$4.prototype.delete=Nt,ListCache$4.prototype.get=Dt,ListCache$4.prototype.has=$t,ListCache$4.prototype.set=At;var Lt=ListCache$4,Rt=Lt;var zt=function stackClear$1(){this.__data__=new Rt,this.size=0};var jt=function stackDelete$1(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i};var Ft=function stackGet$1(t){return this.__data__.get(t)};var Xt=function stackHas$1(t){return this.__data__.has(t)},Ht="object"==typeof bt&&bt&&bt.Object===Object&&bt,Vt=Ht,Wt="object"==typeof self&&self&&self.Object===Object&&self,Yt=Vt||Wt||Function("return this")(),Gt=Yt.Symbol,Kt=Gt,qt=Object.prototype,Ut=qt.hasOwnProperty,Jt=qt.toString,Qt=Kt?Kt.toStringTag:void 0;var Zt=function getRawTag$1(t){var e=Ut.call(t,Qt),i=t[Qt];try{t[Qt]=void 0;var s=!0}catch(t){}var n=Jt.call(t);return s&&(e?t[Qt]=i:delete t[Qt]),n},te=Object.prototype.toString;var ee=Zt,ie=function objectToString$1(t){return te.call(t)},se=Gt?Gt.toStringTag:void 0;var ne=function baseGetTag$4(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":se&&se in Object(t)?ee(t):ie(t)};var oe=function isObject$7(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},re=ne,ae=oe;var he,le=function isFunction$3(t){if(!ae(t))return!1;var e=re(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},ce=Yt["__core-js_shared__"],de=(he=/[^.]+$/.exec(ce&&ce.keys&&ce.keys.IE_PROTO||""))?"Symbol(src)_1."+he:"";var ue=function isMasked$1(t){return!!de&&de in t},pe=Function.prototype.toString;var fe=le,ge=ue,ye=oe,me=function toSource$1(t){if(null!=t){try{return pe.call(t)}catch(t){}try{return t+""}catch(t){}}return""},_e=/^\[object .+?Constructor\]$/,ve=Function.prototype,xe=Object.prototype,be=ve.toString,Ce=xe.hasOwnProperty,we=RegExp("^"+be.call(Ce).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Se=function baseIsNative$1(t){return!(!ye(t)||ge(t))&&(fe(t)?we:_e).test(me(t))},Pe=function getValue$1(t,e){return null==t?void 0:t[e]};var Ee=function getNative$3(t,e){var i=Pe(t,e);return Se(i)?i:void 0},Me=Ee(Yt,"Map"),ke=Ee(Object,"create"),Ie=ke;var Be=function hashClear$1(){this.__data__=Ie?Ie(null):{},this.size=0};var Te=function hashDelete$1(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Oe=ke,Ne=Object.prototype.hasOwnProperty;var De=function hashGet$1(t){var e=this.__data__;if(Oe){var i=e[t];return"__lodash_hash_undefined__"===i?void 0:i}return Ne.call(e,t)?e[t]:void 0},$e=ke,Ae=Object.prototype.hasOwnProperty;var Le=ke;var Re=Be,ze=Te,je=De,Fe=function hashHas$1(t){var e=this.__data__;return $e?void 0!==e[t]:Ae.call(e,t)},Xe=function hashSet$1(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Le&&void 0===e?"__lodash_hash_undefined__":e,this};function Hash$1(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var s=t[e];this.set(s[0],s[1])}}Hash$1.prototype.clear=Re,Hash$1.prototype.delete=ze,Hash$1.prototype.get=je,Hash$1.prototype.has=Fe,Hash$1.prototype.set=Xe;var He=Hash$1,Ve=Lt,We=Me;var Ye=function isKeyable$1(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Ge=function getMapData$4(t,e){var i=t.__data__;return Ye(e)?i["string"==typeof e?"string":"hash"]:i.map},Ke=Ge;var qe=Ge;var Ue=Ge;var Je=Ge;var Qe=function mapCacheClear$1(){this.size=0,this.__data__={hash:new He,map:new(We||Ve),string:new He}},Ze=function mapCacheDelete$1(t){var e=Ke(this,t).delete(t);return this.size-=e?1:0,e},ti=function mapCacheGet$1(t){return qe(this,t).get(t)},ei=function mapCacheHas$1(t){return Ue(this,t).has(t)},ii=function mapCacheSet$1(t,e){var i=Je(this,t),s=i.size;return i.set(t,e),this.size+=i.size==s?0:1,this};function MapCache$1(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var s=t[e];this.set(s[0],s[1])}}MapCache$1.prototype.clear=Qe,MapCache$1.prototype.delete=Ze,MapCache$1.prototype.get=ti,MapCache$1.prototype.has=ei,MapCache$1.prototype.set=ii;var si=Lt,ni=Me,oi=MapCache$1;var ri=Lt,ai=zt,hi=jt,li=Ft,ci=Xt,di=function stackSet$1(t,e){var i=this.__data__;if(i instanceof si){var s=i.__data__;if(!ni||s.length<199)return s.push([t,e]),this.size=++i.size,this;i=this.__data__=new oi(s)}return i.set(t,e),this.size=i.size,this};function Stack$1(t){var e=this.__data__=new ri(t);this.size=e.size}Stack$1.prototype.clear=ai,Stack$1.prototype.delete=hi,Stack$1.prototype.get=li,Stack$1.prototype.has=ci,Stack$1.prototype.set=di;var ui=Stack$1,pi=Ee,fi=function(){try{var t=pi(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),gi=fi;var yi=function baseAssignValue$3(t,e,i){"__proto__"==e&&gi?gi(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i},mi=yi,_i=St;var vi=function assignMergeValue$2(t,e,i){(void 0!==i&&!_i(t[e],i)||void 0===i&&!(e in t))&&mi(t,e,i)};var xi=function createBaseFor$1(t){return function(e,i,s){for(var n=-1,o=Object(e),r=s(e),a=r.length;a--;){var h=r[t?a:++n];if(!1===i(o[h],h,o))break}return e}}(),bi={exports:{}};!function(t,e){var i=Yt,s=e&&!e.nodeType&&e,n=s&&t&&!t.nodeType&&t,o=n&&n.exports===s?i.Buffer:void 0,r=o?o.allocUnsafe:void 0;t.exports=function cloneBuffer(t,e){if(e)return t.slice();var i=t.length,s=r?r(i):new t.constructor(i);return t.copy(s),s}}(bi,bi.exports);var Ci=Yt.Uint8Array;var wi=function cloneArrayBuffer$1(t){var e=new t.constructor(t.byteLength);return new Ci(e).set(new Ci(t)),e};var Si=function cloneTypedArray$1(t,e){var i=e?wi(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)};var Pi=function copyArray$1(t,e){var i=-1,s=t.length;for(e||(e=Array(s));++i<s;)e[i]=t[i];return e},Ei=oe,Mi=Object.create,ki=function(){function object(){}return function(t){if(!Ei(t))return{};if(Mi)return Mi(t);object.prototype=t;var e=new object;return object.prototype=void 0,e}}();var Ii=function overArg$1(t,e){return function(i){return t(e(i))}}(Object.getPrototypeOf,Object),Bi=Object.prototype;var Ti=function isPrototype$2(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Bi)},Oi=ki,Ni=Ii,Di=Ti;var $i=function initCloneObject$1(t){return"function"!=typeof t.constructor||Di(t)?{}:Oi(Ni(t))};var Ai=function isObjectLike$5(t){return null!=t&&"object"==typeof t},Li=ne,Ri=Ai;var zi=function baseIsArguments$1(t){return Ri(t)&&"[object Arguments]"==Li(t)},ji=Ai,Fi=Object.prototype,Xi=Fi.hasOwnProperty,Hi=Fi.propertyIsEnumerable,Vi=zi(function(){return arguments}())?zi:function(t){return ji(t)&&Xi.call(t,"callee")&&!Hi.call(t,"callee")},Wi=Array.isArray;var Yi=function isLength$2(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Gi=le,Ki=Yi;var qi=function isArrayLike$3(t){return null!=t&&Ki(t.length)&&!Gi(t)},Ui=qi,Ji=Ai;var Qi=function isArrayLikeObject$1(t){return Ji(t)&&Ui(t)},Zi={exports:{}};var ts=function stubFalse(){return!1};!function(t,e){var i=Yt,s=ts,n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,r=o&&o.exports===n?i.Buffer:void 0,a=(r?r.isBuffer:void 0)||s;t.exports=a}(Zi,Zi.exports);var es=ne,is=Ii,ss=Ai,ns=Function.prototype,os=Object.prototype,rs=ns.toString,as=os.hasOwnProperty,hs=rs.call(Object);var ls=function isPlainObject$1(t){if(!ss(t)||"[object Object]"!=es(t))return!1;var e=is(t);if(null===e)return!0;var i=as.call(e,"constructor")&&e.constructor;return"function"==typeof i&&i instanceof i&&rs.call(i)==hs},cs=ne,ds=Yi,us=Ai,ps={};ps["[object Float32Array]"]=ps["[object Float64Array]"]=ps["[object Int8Array]"]=ps["[object Int16Array]"]=ps["[object Int32Array]"]=ps["[object Uint8Array]"]=ps["[object Uint8ClampedArray]"]=ps["[object Uint16Array]"]=ps["[object Uint32Array]"]=!0,ps["[object Arguments]"]=ps["[object Array]"]=ps["[object ArrayBuffer]"]=ps["[object Boolean]"]=ps["[object DataView]"]=ps["[object Date]"]=ps["[object Error]"]=ps["[object Function]"]=ps["[object Map]"]=ps["[object Number]"]=ps["[object Object]"]=ps["[object RegExp]"]=ps["[object Set]"]=ps["[object String]"]=ps["[object WeakMap]"]=!1;var fs=function baseIsTypedArray$1(t){return us(t)&&ds(t.length)&&!!ps[cs(t)]};var gs=function baseUnary$1(t){return function(e){return t(e)}},ys={exports:{}};!function(t,e){var i=Ht,s=e&&!e.nodeType&&e,n=s&&t&&!t.nodeType&&t,o=n&&n.exports===s&&i.process,r=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=r}(ys,ys.exports);var ms=fs,_s=gs,vs=ys.exports,xs=vs&&vs.isTypedArray,bs=xs?_s(xs):ms;var Cs=function safeGet$2(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},ws=yi,Ss=St,Ps=Object.prototype.hasOwnProperty;var Es=function assignValue$1(t,e,i){var s=t[e];Ps.call(t,e)&&Ss(s,i)&&(void 0!==i||e in t)||ws(t,e,i)},Ms=yi;var ks=function copyObject$1(t,e,i,s){var n=!i;i||(i={});for(var o=-1,r=e.length;++o<r;){var a=e[o],h=s?s(i[a],t[a],a,i,t):void 0;void 0===h&&(h=t[a]),n?Ms(i,a,h):Es(i,a,h)}return i};var Is=/^(?:0|[1-9]\d*)$/;var Bs=function isIndex$2(t,e){var i=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&Is.test(t))&&t>-1&&t%1==0&&t<e},Ts=function baseTimes$1(t,e){for(var i=-1,s=Array(t);++i<t;)s[i]=e(i);return s},Os=Vi,Ns=Wi,Ds=Zi.exports,$s=Bs,As=bs,Ls=Object.prototype.hasOwnProperty;var Rs=function arrayLikeKeys$1(t,e){var i=Ns(t),s=!i&&Os(t),n=!i&&!s&&Ds(t),o=!i&&!s&&!n&&As(t),r=i||s||n||o,a=r?Ts(t.length,String):[],h=a.length;for(var l in t)!e&&!Ls.call(t,l)||r&&("length"==l||n&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||$s(l,h))||a.push(l);return a};var zs=oe,js=Ti,Fs=function nativeKeysIn$1(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e},Xs=Object.prototype.hasOwnProperty;var Hs=Rs,Vs=function baseKeysIn$1(t){if(!zs(t))return Fs(t);var e=js(t),i=[];for(var s in t)("constructor"!=s||!e&&Xs.call(t,s))&&i.push(s);return i},Ws=qi;var Ys=function keysIn$2(t){return Ws(t)?Hs(t,!0):Vs(t)},Gs=ks,Ks=Ys;var qs=vi,Us=bi.exports,Js=Si,Qs=Pi,Zs=$i,tn=Vi,en=Wi,sn=Qi,nn=Zi.exports,on=le,rn=oe,an=ls,hn=bs,ln=Cs,cn=function toPlainObject$1(t){return Gs(t,Ks(t))};var dn=ui,un=vi,pn=xi,fn=function baseMergeDeep$1(t,e,i,s,n,o,r){var a=ln(t,i),h=ln(e,i),l=r.get(h);if(l)qs(t,i,l);else{var c=o?o(a,h,i+"",t,e,r):void 0,d=void 0===c;if(d){var u=en(h),p=!u&&nn(h),f=!u&&!p&&hn(h);c=h,u||p||f?en(a)?c=a:sn(a)?c=Qs(a):p?(d=!1,c=Us(h,!0)):f?(d=!1,c=Js(h,!0)):c=[]:an(h)||tn(h)?(c=a,tn(a)?c=cn(a):rn(a)&&!on(a)||(c=Zs(h))):d=!1}d&&(r.set(h,c),n(c,h,s,o,r),r.delete(h)),qs(t,i,c)}},gn=oe,yn=Ys,mn=Cs;var _n=function baseMerge$1(t,e,i,s,n){t!==e&&pn(e,(function(o,r){if(n||(n=new dn),gn(o))fn(t,e,r,i,baseMerge$1,s,n);else{var a=s?s(mn(t,r),o,r+"",t,e,n):void 0;void 0===a&&(a=o),un(t,r,a)}}),yn)};var vn=function identity$2(t){return t};var xn=function apply$1(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)},bn=Math.max;var Cn=function overRest$1(t,e,i){return e=bn(void 0===e?t.length-1:e,0),function(){for(var s=arguments,n=-1,o=bn(s.length-e,0),r=Array(o);++n<o;)r[n]=s[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=s[n];return a[e]=i(r),xn(t,this,a)}};var wn=function constant$1(t){return function(){return t}},Sn=fi,Pn=Sn?function(t,e){return Sn(t,"toString",{configurable:!0,enumerable:!1,value:wn(e),writable:!0})}:vn,En=Date.now;var Mn=function shortOut$1(t){var e=0,i=0;return function(){var s=En(),n=16-(s-i);if(i=s,n>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Pn),kn=vn,In=Cn,Bn=Mn;var Tn=St,On=qi,Nn=Bs,Dn=oe;var $n=function baseRest$1(t,e){return Bn(In(t,e,kn),t+"")},An=function isIterateeCall$1(t,e,i){if(!Dn(i))return!1;var s=typeof e;return!!("number"==s?On(i)&&Nn(e,i.length):"string"==s&&e in i)&&Tn(i[e],t)};var Ln=_n,Rn=function createAssigner$1(t){return $n((function(e,i){var s=-1,n=i.length,o=n>1?i[n-1]:void 0,r=n>2?i[2]:void 0;for(o=t.length>3&&"function"==typeof o?(n--,o):void 0,r&&An(i[0],i[1],r)&&(o=n<3?void 0:o,n=1),e=Object(e);++s<n;){var a=i[s];a&&t(e,a,s,o)}return e}))}((function(t,e,i){Ln(t,e,i)}));class Entity extends X{static typeId="Entity";entityFieldsComponent=[];constructor(t){super(Entity.arrangeParam(t)),this.syncEntityNameAndFields()}static arrangeParam(t){const e=Rn({entityName:"Entity Name",fields:[],style:{strokeStyle:"#334155",fillStyle:"#ffffff",radius:8,lineWidth:1.5},headerStyle:{textColor:"#0f172a",backgroundColor:"#f1f5f9",fontSize:18,fontWeight:"bold",paddingTop:12,paddingLeft:14,paddingRight:14,paddingBottom:12},fieldStyle:{textColor:"#334155",fontSize:16,fontWeight:"normal",paddingTop:9,paddingLeft:14,paddingRight:14},dividerStyle:{strokeStyle:"#cbd5e1",fillStyle:"#cbd5e1",lineWidth:1}},t,{transformable:!1});return Ct(e.entityName)&&(e.entityName="Entity Name"),Ct(e.fields)&&(e.fields=[]),e}syncEntityNameAndFields(){if(this.entityNameComponent&&(this.removeChild(this.entityNameComponent),this.entityNameComponent=null),this.headerBackgroundComponent&&(this.removeChild(this.headerBackgroundComponent),this.headerBackgroundComponent=null),this.deviderLine&&(this.removeChild(this.deviderLine),this.deviderLine=null),this.entityFieldsComponent.length&&(this.removeChildren(this.entityFieldsComponent),this.entityFieldsComponent.length=0),this.state.entityName){if(this.entityNameComponent=new pt({left:0,top:0,text:this.state.entityName,style:{strokeStyle:this.state.headerStyle.textColor,fillStyle:this.state.headerStyle.textColor,fontSize:this.state.headerStyle.fontSize,fontWeight:this.state.headerStyle.fontWeight,paddingTop:this.state.headerStyle.paddingTop,paddingLeft:this.state.headerStyle.paddingLeft,paddingRight:this.state.headerStyle.paddingRight,paddingBottom:this.state.headerStyle.paddingBottom},interactive:!1,stroke:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}),this.state.headerStyle.backgroundColor&&"none"!==this.state.headerStyle.backgroundColor){const t=this.state.style.lineWidth||1.5,e=t/2;this.headerBackgroundComponent=new F({left:e,top:e,width:Math.max(this.state.width-t,0),height:Math.max(this.entityNameComponent.state.height-e,0),zIndex:this.entityNameComponent.state.zIndex-1,origin:"top-left",style:{fillStyle:this.state.headerStyle.backgroundColor,radius:Math.max((this.state.style.radius||0)-e,0),lineWidth:0},interactive:!1,stroke:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}),this.addChild(this.headerBackgroundComponent)}this.addChild(this.entityNameComponent),this.deviderLine=new at({left:0,top:0,points:[[0,0],[this.state.width,0]],style:{strokeStyle:this.state.dividerStyle.strokeStyle,fillStyle:this.state.dividerStyle.fillStyle,lineWidth:this.state.dividerStyle.lineWidth},interactive:!1}),this.addChild(this.deviderLine)}if(!Ct(this.state.fields)){const t=this.state.fields.length;for(let e=0;e<t;e++){const i=this.state.fields[e],s=this.fieldDisplay(i),n=new pt({left:0,top:0,text:s.text,style:{strokeStyle:this.state.fieldStyle.textColor,fillStyle:this.state.fieldStyle.textColor,fontSize:this.state.fieldStyle.fontSize,fontWeight:this.state.fieldStyle.fontWeight,paddingTop:this.state.fieldStyle.paddingTop,paddingLeft:this.state.fieldStyle.paddingLeft,paddingRight:this.state.fieldStyle.paddingRight,paddingBottom:e===t-1?12:0},interactive:!1,stroke:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1});this.entityFieldsComponent.push(n)}this.addChildren(this.entityFieldsComponent)}}fieldDisplay(t){const e=[];t.primary&&e.push("PK"),t.foreignKey&&e.push("FK");const i=[];t.unique&&i.push("UQ"),t.autoIncrement&&i.push("AI"),!1===t.nullable&&i.push("NN");const s=e.length?e.join(" ")+" ":"",n=t.type?`${t.type}${t.length?`(${t.length})`:""}`:"",o=i.length?" "+i.join(" "):"",r=void 0!==t.default?" = "+t.default:"",a=t.comment?" // "+t.comment:"";return{text:`${s}${t.name}${n?" "+n:""}${o}${r}${a}`}}calcComponentParams(){let t=this.state.width,e=0,i=0,s=0;this.entityNameComponent&&(s=this.entityNameComponent.state.height,e=s,t=Math.max(t,this.entityNameComponent.state.width),e+=this.deviderLine.state.height,i=e);for(let i=0;i<this.entityFieldsComponent.length;i++){const s=this.entityFieldsComponent[i];s.state.left=0,s.state.top=e,e+=s.state.height,t=Math.max(t,s.state.width)}if(this.deviderLine&&(this.deviderLine.state.points=[[0,i],[t,i]]),this.headerBackgroundComponent){const e=this.state.style.lineWidth||1.5,i=e/2;this.headerBackgroundComponent.state.left=i,this.headerBackgroundComponent.state.top=i,this.headerBackgroundComponent.state.width=Math.max(t-e,0),this.headerBackgroundComponent.state.height=Math.max(s-i,0)}const n=t,o=Math.max(e,this.state.height);return this.state.width=n,this.state.height=o,{width:n,height:o}}toEntityObject(){const t={name:this.state.entityName,columns:{}};return this.state.fields.forEach(e=>{const i={};void 0!==e.type&&(i.type=e.type),void 0!==e.length&&(i.length=e.length),e.primary&&(i.primary=!0),e.generated&&(i.generated=!0),e.autoIncrement&&(i.generated=!0,i.strategy="increment"),!1===e.nullable&&(i.nullable=!1),e.unique&&(i.unique=!0),void 0!==e.default&&(i.default=e.default),void 0!==e.comment&&(i.comment=e.comment),e.index&&(i.index=!0),t.columns[e.name]=i}),t}setState(t){const e=!Ct(t.fields)||!Ct(t.entityName);super.setState(t),e&&this.syncEntityNameAndFields()}addField(t){const e=[...this.state.fields||[],t];return this.setFields(e),this}removeField(t){const e=(this.state.fields||[]).filter(e=>e.name!==t);return this.setFields(e),this}setFields(t){return this.setState({fields:t}),this}}class Relation extends ICEVisioLink{static typeId="Relation";constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=Relation.normalizeLinks(t||{}),i=e.relationType||"one-to-one",s=Relation.composeLabel(e,i);super({title:"Relation",relationType:i,referencedColumnName:"id",sourceField:"id",targetField:"id",arrow:e.arrow||Relation.defaultArrow(i),...e,label:s,labelStyle:{fontSize:14,fillStyle:"#334155",backgroundColor:"#ffffff",...e.labelStyle||{}}})}static defaultArrow(t){switch(t){case"one-to-many":return"end";case"many-to-one":return"start";case"many-to-many":case"one-to-one":default:return"none"}}static normalizeLinks(t){if(!t||!t.links)return t||{};const e={top:"T",right:"R",bottom:"B",left:"L",center:"C"},i={...t.links};return i.start&&e[i.start.position]&&(i.start={...i.start,position:e[i.start.position]}),i.end&&e[i.end.position]&&(i.end={...i.end,position:e[i.end.position]}),{...t,links:i}}static cardinalityLabel(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i={"one-to-many":["1","N"],"many-to-one":["N","1"],"many-to-many":["N","N"],"one-to-one":["1","1"]},[s,n]=i[t]||i["one-to-one"];return`${e.sourceCardinality||s} : ${e.targetCardinality||n}`}static composeLabel(t,e){return t.label?t.label:Relation.buildLabel(t,e)}static buildLabel(t,e){const i=[];t.onDelete&&i.push("ON DELETE "+t.onDelete),t.onUpdate&&i.push("ON UPDATE "+t.onUpdate);const s=Relation.cardinalityLabel(e,t);return i.length?`${s} (${i.join(", ")})`:s}toEntityObject(){const{title:t,relationType:e,referencedColumnName:i,sourceField:s,targetField:n,nullable:o,onDelete:r,onUpdate:a,joinTableName:h,fromKey:l,toKey:c}=this.state;let d,u,p,f,g,y;this.state.links&&this.state.links.start&&this.state.links.start.id&&(p=this.state.links.start.id,d=this.ice.findComponent(p),f=d.state.entityName),this.state.links&&this.state.links.end&&this.state.links.end.id&&(g=this.state.links.end.id,u=this.ice.findComponent(g),y=u.state.entityName);return{title:t,fromId:p,fromName:f,toId:g,toName:y,relationType:e,referencedColumnName:i,sourceField:s,targetField:n,nullable:!1!==o&&void 0,onDelete:r,onUpdate:a,joinTableName:h,fromKey:l,toKey:c}}}function typeIdOf(t){const e=t&&t.constructor;return e&&"string"==typeof e.typeId?e.typeId:void 0}function isEntity(t){return typeIdOf(t)===Entity.typeId}function isRelation(t){return typeIdOf(t)===Relation.typeId}function validateProjectSnapshot(t){const e=[];return!t||"object"!=typeof t||Array.isArray(t)?{valid:!1,errors:["root must be an object"]}:(void 0!==t.schemaVersion&&"number"!=typeof t.schemaVersion&&e.push("schemaVersion must be a number when present"),Array.isArray(t.entities)?t.entities.forEach((t,i)=>{validateNode(t,`entities[${i}]`,Entity.typeId,e)}):e.push("entities must be an array"),void 0===t.relations||Array.isArray(t.relations)?Array.isArray(t.relations)&&t.relations.forEach((t,i)=>{validateNode(t,`relations[${i}]`,Relation.typeId,e)}):e.push("relations must be an array when present"),{valid:0===e.length,errors:e})}function validateNode(t,e,i,s){if(!t||"object"!=typeof t||Array.isArray(t))return void s.push(e+" must be an object");"string"!=typeof t.id&&s.push(e+".id must be a string"),void 0!==t.typeId&&"string"!=typeof t.typeId&&s.push(e+".typeId must be a string when present");const n=void 0===t.typeId?i:t.typeId;n===Entity.typeId?function validateEntityShape(t,e,i){"string"!=typeof t.entityName&&i.push(e+".entityName must be a string");if(void 0!==t.fields&&!Array.isArray(t.fields))return void i.push(e+".fields must be an array when present");if(!Array.isArray(t.fields))return;t.fields.forEach((t,s)=>{!t||"object"!=typeof t||Array.isArray(t)?i.push(`${e}.fields[${s}] must be an object`):void 0!==t.name&&"string"!=typeof t.name&&i.push(`${e}.fields[${s}].name must be a string when present`)})}(t,e,s):n===Relation.typeId&&function validateRelationShape(t,e,i){if(void 0===t.links)return;if(!t.links||"object"!=typeof t.links||Array.isArray(t.links))return void i.push(e+".links must be an object when present");["start","end"].forEach(s=>{const n=t.links[s];void 0!==n&&(n&&"object"==typeof n&&!Array.isArray(n)?(void 0!==n.id&&"string"!=typeof n.id&&i.push(`${e}.links.${s}.id must be a string when present`),void 0!==n.position&&"string"!=typeof n.position&&i.push(`${e}.links.${s}.position must be a string when present`)):i.push(`${e}.links.${s} must be an object when present`))})}(t,e,s)}function validateSchema(t){const e=[],i=t.filter(isEntity),s=t.filter(isRelation),n=new Map;return i.forEach(t=>{const i=(t.state.entityName||"").trim();if(!i)return void e.push({level:"error",message:"存在未命名的 Entity",componentId:t.state.id});n.has(i)||n.set(i,[]),n.get(i).push(t);const s=t.state.fields||[];0===s.length&&e.push({level:"warning",message:`Entity "${i}" 没有任何字段`,componentId:t.state.id});const o=new Set;s.forEach(s=>{const n=(s.name||"").trim();n?o.has(n)?e.push({level:"error",message:`Entity "${i}" 存在重复字段 "${n}"`,componentId:t.state.id}):o.add(n):e.push({level:"error",message:`Entity "${i}" 存在未命名字段`,componentId:t.state.id}),s.type||e.push({level:"warning",message:`Entity "${i}" 的字段 "${n||"(未命名)"}" 未设置类型`,componentId:t.state.id})})}),n.forEach((t,i)=>{t.length>1&&e.push({level:"error",message:`存在重复的 Entity 名称 "${i}"`})}),s.forEach(t=>{const s=t.state.links||{},n=s.start&&s.start.id,o=s.end&&s.end.id,r=t.state.relationType;if(!n||!o)return void e.push({level:"error",message:"存在没有完整起点/终点的 Relation",componentId:t.state.id});const a=i.some(t=>t.state.id===n),h=i.some(t=>t.state.id===o);a&&h||e.push({level:"error",message:"Relation 连接到了不存在的 Entity",componentId:t.state.id}),r?"many-to-many"!==r||t.state.joinTableName||e.push({level:"warning",message:"many-to-many 关系建议设置 joinTableName",componentId:t.state.id}):e.push({level:"error",message:"Relation 未设置关系类型",componentId:t.state.id})}),e}function toWords(t){return function convertToString(t){const e=t||"";return"string"==typeof e?e:String(e)}(t).match(/[A-Z\xC0-\xD6\xD8-\xDE]?[a-z\xDF-\xF6\xF8-\xFF]+|[A-Z\xC0-\xD6\xD8-\xDE]+(?![a-z\xDF-\xF6\xF8-\xFF])|\d+/g)||[]}function toCamelCase(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i="";for(let s=0,n=t.length;s<n;s++){let n=t[s].toLowerCase();(e||0!==s)&&(n=n.substr(0,1).toUpperCase()+n.substr(1)),i+=n}return i}function camelCase(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return toCamelCase(toWords(t),e)}var zn=[],jn=[],Fn={},Xn={},Hn={};function sanitizeRule(t){return"string"==typeof t?new RegExp("^"+t+"$","i"):t}function restoreCase(t,e){return t===e?e:t===t.toLowerCase()?e.toLowerCase():t===t.toUpperCase()?e.toUpperCase():t[0]===t[0].toUpperCase()?e.charAt(0).toUpperCase()+e.substr(1).toLowerCase():e.toLowerCase()}function interpolate(t,e){return t.replace(/\$(\d{1,2})/g,(function(t,i){return e[i]||""}))}function replace(t,e){return t.replace(e[0],(function(i,s){var n=interpolate(e[1],arguments);return restoreCase(""===i?t[s-1]:i,n)}))}function sanitizeWord(t,e,i){if(!t.length||Fn.hasOwnProperty(t))return e;for(var s=i.length;s--;){var n=i[s];if(n[0].test(e))return replace(e,n)}return e}function replaceWord(t,e,i){return function(s){var n=s.toLowerCase();return e.hasOwnProperty(n)?restoreCase(s,n):t.hasOwnProperty(n)?restoreCase(s,t[n]):sanitizeWord(n,s,i)}}function checkWord(t,e,i){return function(s){var n=s.toLowerCase();return!!e.hasOwnProperty(n)||!t.hasOwnProperty(n)&&sanitizeWord(n,n,i)===n}}function pluralize(t,e,i){return(i?e+" ":"")+(1===e?pluralize.singular(t):pluralize.plural(t))}pluralize.plural=replaceWord(Hn,Xn,zn),pluralize.isPlural=checkWord(Hn,Xn,zn),pluralize.singular=replaceWord(Xn,Hn,jn),pluralize.isSingular=checkWord(Xn,Hn,jn),pluralize.addPluralRule=function(t,e){zn.push([sanitizeRule(t),e])},pluralize.addSingularRule=function(t,e){jn.push([sanitizeRule(t),e])},pluralize.addUncountableRule=function(t){"string"!=typeof t?(pluralize.addPluralRule(t,"$0"),pluralize.addSingularRule(t,"$0")):Fn[t.toLowerCase()]=!0},pluralize.addIrregularRule=function(t,e){e=e.toLowerCase(),t=t.toLowerCase(),Hn[t]=e,Xn[e]=t},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach((function(t){return pluralize.addIrregularRule(t[0],t[1])})),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach((function(t){return pluralize.addPluralRule(t[0],t[1])})),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach((function(t){return pluralize.addSingularRule(t[0],t[1])})),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(pluralize.addUncountableRule);const Vn={number:"int",int:"int",integer:"int",smallint:"smallint",bigint:"bigint",float:"float",double:"double",real:"real",decimal:"decimal",numeric:"numeric",string:"varchar",varchar:"varchar",char:"char",text:"text",boolean:"boolean",bool:"boolean",date:"date",datetime:"datetime",timestamp:"timestamp",time:"time",json:"json",jsonb:"jsonb",uuid:"uuid",enum:"enum",blob:"blob",binary:"blob","simple-array":"simple-array","simple-json":"simple-json"},Wn=["varchar","char","nvarchar","nchar","text","uuid"];function normalizeColumn(t){const e={},i=function mapColumnType(t){if(null==t||""===t)return;const e=String(t).toLowerCase();return Vn[e]||String(t)}(t.type);if(void 0!==i&&(e.type=i),void 0!==t.length&&null!==t.length&&""!==t.length){const s=String(t.length).trim();if("decimal"===i||"numeric"===i){const[t,i]=s.split(",").map(t=>t.trim());t&&(e.precision=Number(t)),i&&(e.scale=Number(i))}else i&&Wn.indexOf(i)>=0&&(e.length=t.length)}return t.primary&&(e.primary=!0),t.generated&&(e.generated=!0),t.autoIncrement&&(e.generated=!0,e.strategy="increment"),void 0!==t.strategy&&(e.strategy=t.strategy),!1===t.nullable&&(e.nullable=!1),t.unique&&(e.unique=!0),void 0!==t.default&&(e.default=t.default),void 0!==t.comment&&(e.comment=t.comment),t.index&&(e.index=!0),e}function normalizeColumns(t){const e={};return Object.keys(t||{}).forEach(i=>{e[i]=normalizeColumn(t[i])}),e}function buildJoinColumn(t,e){return{name:t||e||"id",referencedColumnName:e||"id"}}function toSchemaObject(t){const e=[...t],i=[],s={};for(let t=0;t<e.length;t++){const n=e[t];if(isRelation(n))i.push(n);else if(isEntity(n)){const t=n.toEntityObject();t.columns=normalizeColumns(t.columns),s[n.state.id]=t}}for(let t=0;t<i.length;t++){const e=i[t],{fromId:n,fromName:o,toId:r,toName:a,relationType:h,referencedColumnName:l,sourceField:c,targetField:d,nullable:u,onDelete:p,onUpdate:f,joinTableName:g,fromKey:y,toKey:m}=e.toEntityObject(),_=s[n],v=s[r];if(!_||!v)continue;_.relations||(_.relations={}),v.relations||(v.relations={});const x=y||camelCase(a),b=m||camelCase(o),C={};!1===u&&(C.nullable=!1),p&&(C.onDelete=p),f&&(C.onUpdate=f),"one-to-one"===h?(v.relations[b]={type:h,target:o,joinColumn:buildJoinColumn(d||l,c||l),...C},_.relations[x]={type:h,target:a,inverseSide:b}):"one-to-many"===h?(_.relations[x]={type:h,target:a,inverseSide:b},v.relations[b]={type:"many-to-one",target:o,joinColumn:buildJoinColumn(d||l,c||l),...C}):"many-to-one"===h?(_.relations[x]={type:h,target:a,joinColumn:buildJoinColumn(c||l,d||l),...C},v.relations[b]={type:"one-to-many",target:o,inverseSide:x}):"many-to-many"===h&&(_.relations[""+pluralize(x)]={type:h,target:a,joinTable:!g||{name:g}},v.relations[""+pluralize(b)]={type:h,target:o,inverseSide:""+pluralize(x)})}const n=[];for(const t in s)n.push(s[t]);return n}function toSchemaString(t){return JSON.stringify(toSchemaObject(t))}t.AlignmentGuideManager=Y,t.AnimationManager=E,t.CanvasRenderer=xt,t.DARK_THEME=b,t.DEFAULT_THEME=x,t.DOMEventDispatcher=it,t.DOMEventInterceptor=nt,t.Entity=Entity,t.EntityDesigner=class EntityDesigner{selectedId=null;__changeListeners=[];__mousedownHandler=t=>this.__handleMouseDown(t);__undoStack=[];__redoStack=[];__historyEnabled=!0;__maxHistory=100;constructor(t){this.ice=t,this.ice.registerType(Entity.typeId,Entity),this.ice.registerType(Relation.typeId,Relation),this.ice.evtBus.on("mousedown",this.__mousedownHandler,this)}get entities(){return this.ice.childNodes.filter(t=>isEntity(t))}get relations(){return this.ice.childNodes.filter(t=>isRelation(t))}get selected(){return this.selectedId?this.ice.findComponent(this.selectedId):null}select(t){return this.selectedId=t,this}createEntity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.captureHistory();const e=this.entities.length,i=new Entity({left:120+e%4*220,top:120+260*Math.floor(e/4),entityName:"NewEntity",fields:[],...t});return this.ice.addChild(i),this.select(i.state.id),this.__emitChange(),i}createRelation(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.captureHistory();const e=t.links||{start:{id:t.sourceId||t.fromId,position:t.startPosition||"R"},end:{id:t.targetId||t.toId,position:t.endPosition||"L"}},i=t.sourceId||t.fromId||e.start&&e.start.id,s=t.targetId||t.toId||e.end&&e.end.id,n=e.start&&e.start.position||t.startPosition||"R",o=e.end&&e.end.position||t.endPosition||"L",r=i?this.ice.findComponent(i):null,a=s?this.ice.findComponent(s):null,h=r?this.__slotPoint(r,n):null,l=a?this.__slotPoint(a,o):null,c=new Relation({relationType:t.relationType||"one-to-many",sourceField:t.sourceField||"id",targetField:t.targetField||"id",links:e,startPoint:h||[0,0],endPoint:l||[10,10],...t});return this.ice.addChild(c),this.select(c.state.id),this.__emitChange(),c}updateEntity(t,e){const i=this.ice.findComponent(t);return isEntity(i)&&(this.captureHistory(),i.setState(e),this.__emitChange()),i}updateRelation(t,e){const i=this.ice.findComponent(t);if(isRelation(i)){this.captureHistory();const t={...i.state,...e},s=Relation.buildLabel(t,t.relationType||"one-to-one");i.setState({...e,label:s}),this.__emitChange()}return i}removeComponent(t){const e=this.ice.findComponent(t);if(e){if(this.captureHistory(),isEntity(e)){this.relations.filter(e=>{const i=e.state.links||{};return i.start&&i.start.id===t||i.end&&i.end.id===t}).forEach(t=>this.ice.removeChild(t))}this.ice.removeChild(e),this.selectedId===t&&(this.selectedId=null),this.__emitChange()}}toSchemaObject(){return toSchemaObject(this.ice.childNodes)}toSchemaString(){return toSchemaString(this.ice.childNodes)}validate(){return validateSchema(this.ice.childNodes)}serializeProject(){const t={version:1,schemaVersion:1,entities:this.entities.map(t=>this.__entitySnapshot(t)),relations:this.relations.map(t=>this.__relationSnapshot(t))};return JSON.stringify(t)}loadProject(t){if(!t)return{loaded:!1,entities:0,relations:0,unknownTypes:[],skipped:[]};const e=this.__parseProject(t);if(!e)return{loaded:!1,entities:0,relations:0,unknownTypes:[],skipped:[]};this.captureHistory();const i=this.__applySnapshot(e);return this.__emitChange(),i}__componentBaseSnapshot(t){return{display:t.display,zIndex:t.zIndex,transform:t.transform,origin:t.origin,originX:t.originX,originY:t.originY,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineDashFlow:t.lineDashFlow,lineDashFlowSpeed:t.lineDashFlowSpeed,lineBorder:t.lineBorder,lineBorderWidth:t.lineBorderWidth,lineBorderColor:t.lineBorderColor,fill:t.fill,stroke:t.stroke,linkable:t.linkable,transformable:t.transformable,animations:t.animations}}__entitySnapshot(t){const e=t.state||{};return{id:e.id,typeId:Entity.typeId,left:e.left,top:e.top,width:e.width,height:e.height,entityName:e.entityName,fields:e.fields,style:e.style,headerStyle:e.headerStyle,fieldStyle:e.fieldStyle,dividerStyle:e.dividerStyle,draggable:e.draggable,interactive:e.interactive,showMinBoundingBox:e.showMinBoundingBox,showMaxBoundingBox:e.showMaxBoundingBox,...this.__componentBaseSnapshot(e)}}__slotPoint(t,e){const i=t.getMinBoundingBox(!0),s=i.center[0],n=i.center[1];switch(e){case"T":return[s,i.tl[1]];case"B":return[s,i.br[1]];case"L":return[i.tl[0],n];case"R":return[i.tr[0],n];case"C":default:return[s,n]}}__relationSnapshot(t){const e=t.state||{};return{id:e.id,typeId:Relation.typeId,left:e.left,top:e.top,width:e.width,height:e.height,relationType:e.relationType,referencedColumnName:e.referencedColumnName,sourceField:e.sourceField,targetField:e.targetField,nullable:e.nullable,onDelete:e.onDelete,onUpdate:e.onUpdate,joinTableName:e.joinTableName,fromKey:e.fromKey,toKey:e.toKey,sourceCardinality:e.sourceCardinality,targetCardinality:e.targetCardinality,label:e.label,labelStyle:e.labelStyle,style:e.style,arrow:e.arrow,lineType:e.lineType,escapeDistance:e.escapeDistance,routeType:e.routeType,routeOffset:e.routeOffset,curveType:e.curveType,linkShape:e.linkShape,lineDash:e.lineDash,lineWidth:e.lineWidth,arrowLength:e.arrowLength,arrowAngel:e.arrowAngel,arrowStyle:e.arrowStyle,startPoint:e.startPoint,endPoint:e.endPoint,links:e.links,draggable:e.draggable,interactive:e.interactive,showMinBoundingBox:e.showMinBoundingBox,showMaxBoundingBox:e.showMaxBoundingBox,...this.__componentBaseSnapshot(e)}}__parseProject(t){const e=JSON.parse(t);if(!e||!Array.isArray(e.entities))return null;if(void 0!==e.schemaVersion&&1!==e.schemaVersion)throw new Error("Unsupported project schemaVersion: "+e.schemaVersion);const i=validateProjectSnapshot(e);if(!i.valid)throw new Error("Invalid project snapshot:\n"+i.errors.join("\n"));return e}__applyProject(t){const e=this.__parseProject(t);e&&this.__applySnapshot(e)}__resolveTypeId(t,e){return t&&"string"==typeof t.typeId&&t.typeId?t.typeId:"entities"===e?Entity.typeId:Relation.typeId}__resolveComponentClass(t){const e=this.ice;if("function"==typeof e.getType){const i=e.getType(t);if("function"==typeof i)return i}else if(e.typeMapping&&"function"==typeof e.typeMapping[t])return e.typeMapping[t];return t===Entity.typeId?Entity:t===Relation.typeId?Relation:null}__recordUnknownType(t,e,i,s,n){-1===t.unknownTypes.indexOf(s)&&t.unknownTypes.push(s);const o=n&&"string"==typeof n.id?n.id:void 0;t.skipped.push(void 0===o?{bucket:e,index:i,typeId:s}:{bucket:e,index:i,typeId:s,id:o})}__applySnapshot(t){const e=this.ice.renderer;e&&e.stop();const i={loaded:!0,entities:0,relations:0,unknownTypes:[],skipped:[]};try{this.ice.clearAll(),this.ice.ctx&&"function"==typeof this.ice.ctx.clearRect&&(this.ice.ctx.setTransform(1,0,0,1,0,0),this.ice.ctx.clearRect(0,0,this.ice.canvasWidth||0,this.ice.canvasHeight||0));const createNode=(t,e,s)=>{const n=this.__resolveTypeId(t,e),o=this.__resolveComponentClass(n);if("function"!=typeof o)return this.__recordUnknownType(i,e,s,n,t),null;const r=new o(t);return this.ice.addChild(r),r},collect=(t,e,s)=>{const n=createNode(t,e,s);isEntity(n)?i.entities+=1:isRelation(n)&&(i.relations+=1)};t.entities.forEach((t,e)=>collect(t,"entities",e)),(t.relations||[]).forEach((t,e)=>collect(t,"relations",e)),this.selectedId=null}finally{if(e){const t=e.getRenderMode();e.setRenderMode("full"),e.start(),this.ice.dirty=!0,setTimeout(()=>{e.setRenderMode(t)},50)}}return i}__applyHistorySnapshot(t){this.__historyEnabled=!1;try{this.__applyProject(t),this.selectedId=null}finally{this.__historyEnabled=!0}}canUndo(){return this.__undoStack.length>0}canRedo(){return this.__redoStack.length>0}captureHistory(){this.__historyEnabled&&(this.__undoStack.push(this.serializeProject()),this.__undoStack.length>this.__maxHistory&&this.__undoStack.shift(),this.__redoStack.length=0)}undo(){if(!this.canUndo())return;const t=this.serializeProject(),e=this.__undoStack.pop();try{this.__applyHistorySnapshot(e)}catch(t){throw this.__undoStack.push(e),t}this.__redoStack.push(t),this.__emitChange()}redo(){if(!this.canRedo())return;const t=this.serializeProject(),e=this.__redoStack.pop();try{this.__applyHistorySnapshot(e)}catch(t){throw this.__redoStack.push(e),t}this.__undoStack.push(t),this.__emitChange()}subscribe(t){return"function"!=typeof t?()=>{}:(this.__changeListeners.push(t),()=>{const e=this.__changeListeners.indexOf(t);-1!==e&&this.__changeListeners.splice(e,1)})}__emitChange(){if(!this.__changeListeners.length)return;const t=this.serializeProject();this.__changeListeners.slice().forEach(e=>e(t))}dispose(){this.ice.evtBus.off("mousedown",this.__mousedownHandler,this)}__handleMouseDown(t){const e=t&&t.param&&t.param.component;if(!e)return;let i=e;for(;i.parentNode;)i=i.parentNode;(isEntity(i)||isRelation(i))&&this.select(i.state.id)}},t.EventBus=ot,t.GeoLine=GeoLine,t.GeoPoint=GeoPoint,t.GeoUtil=GeoUtil,t.ICE=class ICE{constructor(){_defineProperty$1(this,"childNodes",[]),_defineProperty$1(this,"toolNodes",[]),_defineProperty$1(this,"__childSet",new WeakSet),_defineProperty$1(this,"__toolSet",new WeakSet),_defineProperty$1(this,"canvasWidth",0),_defineProperty$1(this,"canvasHeight",0),_defineProperty$1(this,"viewport",{scale:1,tx:0,ty:0}),_defineProperty$1(this,"dpr",1),_defineProperty$1(this,"__renderVp",null),_defineProperty$1(this,"__contentBox",null),_defineProperty$1(this,"selectionList",[]),_defineProperty$1(this,"plugins",new PluginHost(this)),_defineProperty$1(this,"theme",getTheme()),_defineProperty$1(this,"typeMapping",{}),_defineProperty$1(this,"__typeIdMapping",null),_defineProperty$1(this,"__dirty",!0),_defineProperty$1(this,"__initialized",!1)}__resolveCanvasEl(t){return t&&"function"==typeof t.getContext?t:t&&t.canvas&&"function"==typeof t.canvas.getContext?t.canvas:null}init(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t)throw new Error("ICE.init() failed...");const i=this.__resolveCanvasEl(t);if(this.__initialized){if(i&&i===this.canvasEl)return this;throw new Error("同一个 ICE 实例已经绑定到其它 canvas,如需重新初始化请先调用 destroy()。")}for(const t in gt)this.typeMapping[t]=gt[t];return this.__typeIdMapping=null,this.root=I,isString(t)?this.canvasEl=this.root.document.getElementById(t):i&&(this.canvasEl=i),e&&"number"==typeof e.dpr&&e.dpr>0&&(this.dpr=e.dpr),this.canvasEl?(this.canvasEl.oncontextmenu=function(t){t.preventDefault(),t.stopPropagation()},this.canvasWidth=this.canvasEl.width,this.canvasHeight=this.canvasEl.height,this.canvasBoundingClientRect=this.canvasEl.getBoundingClientRect(),this.__contentBox=this.__readContentBox(this.canvasBoundingClientRect),this.ctx=this.canvasEl.getContext("2d"),this.canvasEl.style&&(this.canvasEl.style.touchAction="none"),1!==this.dpr&&this.__applyDevicePixelRatio()):this.ctx=t,this.evtBus=new ot,mt.registerEvtBus(this.evtBus),mt.start(),nt.registerEvtBus(this.evtBus),nt.start(),this.eventDispatcher=new it(this).start(),this.animationManager=new E(this).start(),this.controlPanelManager=new W(this).start(),this.renderer=new xt(this,e).start(),this.alignmentGuide=new Y(this),this.linkSlotManager=new ICELinkSlotManager(this).start(),this.serializer=new Serializer(this),this.deserializer=new Deserializer(this),this.imageCache=new ImageCache(this),this.__initialized=!0,this}destroy(){if(!this.__initialized)return;const t=[this.renderer,this.animationManager,this.controlPanelManager,this.linkSlotManager];for(let e=0;e<t.length;e++){const i=t[e];i&&"function"==typeof i.stop&&i.stop()}this.eventDispatcher&&(this.eventDispatcher.stopped=!0),this.canvasEl&&this.canvasEl.oncontextmenu&&(this.canvasEl.oncontextmenu=null),this.evtBus&&(mt.delEvtBus(this.evtBus),nt.delEvtBus(this.evtBus)),0===mt.evtBuses.length&&mt.stop(),this.plugins&&this.plugins.clear(),this.clearAll(),this.renderer=null,this.animationManager=null,this.controlPanelManager=null,this.linkSlotManager=null,this.eventDispatcher=null,this.alignmentGuide=null,this.serializer=null,this.deserializer=null,this.imageCache=null,this.ctx=null,this.canvasEl=null,this.canvasBoundingClientRect=null,this.dpr=1,this.__renderVp=null,this.__contentBox=null,this.__initialized=!1}addTool(t){this.__toolSet.has(t)||(this.evtBus.trigger(n,null,{component:t}),t.trigger(n),t.ice=this,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.__toolSet.add(t),this.dirty=!0,this.renderer&&this.renderer.markQueueDirty(),t&&"function"==typeof t.__reapplyPreset&&t.__reapplyPreset(this.theme),this.evtBus.trigger(o,null,{component:t}),t.trigger(o))}removeTool(t){if(!this.__toolSet.has(t))return;this.evtBus.trigger(r,null,{component:t}),t.trigger(r);const e=this.toolNodes.indexOf(t);-1!==e&&this.toolNodes.splice(e,1),this.__toolSet.delete(t),this.evtBus.trigger(a,null,{component:t}),t.trigger(a),this.dirty=!0,this.renderer&&this.renderer.markQueueDirty(),t.destory()}addChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.__childSet.has(t))return;this.evtBus.trigger(n,null,{component:t}),t.trigger(n),t.ice=this,t.ctx=this.ctx,t.evtBus=this.evtBus,t.parentNode=null,this.childNodes.push(t),this.__childSet.add(t);let i=!1;const s=t.props.animations;if(s)for(const t in s){i=!0;break}i&&this.animationManager.add(t),this.dirty=e,this.renderer&&this.renderer.markQueueDirty(),t&&"function"==typeof t.__reapplyPreset&&t.__reapplyPreset(this.theme),this.evtBus.trigger(o,null,{component:t}),t.trigger(o)}addChildren(t){for(let e=0;e<t.length;e++)this.addChild(t[e],!1);this.dirty=!0}removeChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.__childSet.has(t))return;this.evtBus.trigger(r,null,{component:t}),t.trigger(r);const i=this.childNodes.indexOf(t);-1!==i&&this.childNodes.splice(i,1),this.__childSet.delete(t),this.evtBus.trigger(a,null,{component:t}),t.trigger(a),this.dirty=e,this.renderer&&this.renderer.markQueueDirty(),t.destory()}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e],!1);this.dirty=!0}clearAll(){this.removeChildren([...this.childNodes])}findComponent(t){if(t)return this.childNodes.filter(e=>e.props.id===t)[0]||this.__findComponentInTree(this.childNodes,t)}__findComponentInTree(t,e){for(let i=0;i<t.length;i++){const s=t[i];if(s.props&&s.props.id===e)return s;if(s.childNodes&&s.childNodes.length){const t=this.__findComponentInTree(s.childNodes,e);if(t)return t}}}set dirty(t){this.__dirty=t}get dirty(){return this.__dirty}registerType(t,e){this.typeMapping[t]=e,this.__typeIdMapping=null}getTypeId(t){if(!t)return;let e=this.__typeIdMapping;if(!e){e=new Map;for(const t in this.typeMapping){const i=this.typeMapping[t];"function"!=typeof i||e.has(i)||e.set(i,t)}this.__typeIdMapping=e}return e.get(t)}use(t){return this.plugins.use(t)}unuse(t){return this.plugins.unuse(t)}getPlugins(){return this.plugins.names}setSelection(t){return this.selectionList=null==t?[]:Array.isArray(t)?t:[t],!!this.plugins&&this.plugins.syncTools(this.selectionList[0]||null)}getAccessibilityTree(t){return buildAccessibilityTree(this,t)}setFocusedComponent(t){let e=t;return"string"==typeof t&&(e=flattenAllComponents(this).filter(e=>e.props&&e.props.id===t)[0]||null),this.eventDispatcher&&(this.eventDispatcher.focusedComponent=e||null),this}getFocusedComponent(){return this.eventDispatcher?this.eventDispatcher.focusedComponent:null}getType(t){return this.typeMapping[t]}loadFont(t,e){return I.loadFont(t,e)}setTheme(t){return this.theme=resolveTheme(t,this.theme),this.__reapplyPresets(),this}setViewport(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=Number(t);return this.viewport={scale:s>0?s:1,tx:Number(e)||0,ty:Number(i)||0},this.dirty=!0,this.renderer&&this.renderer.markQueueDirty(),this}screenToWorld(t,e){const i=this.viewport;return[(t-i.tx)/i.scale,(e-i.ty)/i.scale]}worldToScreen(t,e){const i=this.viewport;return[t*i.scale+i.tx,e*i.scale+i.ty]}getRenderViewport(){const t=this.viewport;if(1===this.dpr)return t;let e=this.__renderVp;return e||(e=this.__renderVp={scale:1,tx:0,ty:0,__d:1,__s:1,__tx:0,__ty:0}),e.__d===this.dpr&&e.__s===t.scale&&e.__tx===t.tx&&e.__ty===t.ty||(e.__d=this.dpr,e.__s=t.scale,e.__tx=t.tx,e.__ty=t.ty,e.scale=t.scale*this.dpr,e.tx=t.tx*this.dpr,e.ty=t.ty*this.dpr),e}__applyDevicePixelRatio(){const t=this.canvasEl;if(!t)return;const e=this.__readContentBox("function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():null),i=e.width||t.width,s=e.height||t.height;t.width=Math.round(i*this.dpr),t.height=Math.round(s*this.dpr),t.style&&(t.style.width=i+"px",t.style.height=s+"px"),this.canvasWidth=t.width,this.canvasHeight=t.height,this.updateCanvasBoundingRect()}updateCanvasBoundingRect(){return this.canvasEl&&"function"==typeof this.canvasEl.getBoundingClientRect&&(this.canvasBoundingClientRect=this.canvasEl.getBoundingClientRect(),this.__contentBox=this.__readContentBox(this.canvasBoundingClientRect)),this.canvasBoundingClientRect}__readContentBox(t){const e=this.canvasEl;let i=0,s=0,n=0,o=0,r=0,a=0,h=0,l=0;const c=this.root&&"function"==typeof this.root.getComputedStyle&&e?this.root.getComputedStyle(e):null;if(c){const num=t=>{const e=parseFloat(t);return isFinite(e)?e:0};i=num(c.borderLeftWidth),s=num(c.borderRightWidth),n=num(c.borderTopWidth),o=num(c.borderBottomWidth),r=num(c.paddingLeft),a=num(c.paddingRight),h=num(c.paddingTop),l=num(c.paddingBottom)}const d=t&&t.left||0,u=t&&t.top||0,p=t&&t.width||0,f=t&&t.height||0;return{left:d+i+r,top:u+n+h,width:Math.max(0,p-i-s-r-a),height:Math.max(0,f-n-o-h-l)}}getInputRect(){return this.__contentBox||this.updateCanvasBoundingRect(),this.__contentBox||this.canvasBoundingClientRect||{left:0,top:0,width:0,height:0}}zoomAt(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.05,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:20;const o=Number(i);if(!isFinite(o)||o<=0)return this;const[r,a]=this.screenToWorld(t,e),h=this.viewport.scale,l=Math.min(s,n),c=Math.max(s,n),d=Math.min(c,Math.max(l,h*o));return d===h?this:this.setViewport(d,t-r*d,e-a*d)}hitTest(t,e){const[i,s]=this.screenToWorld(t,e);return hitTestComponents(this,i,s,1)}registerTheme(t,e){return registerTheme(t,e),this}getTheme(){return this.theme}__reapplyPresets(){const t=flattenAllComponents(this);for(const e of t)"function"==typeof e.__reapplyPreset&&e.__reapplyPreset(this.theme)}createLinearGradient(t,e,i,s){return this.ctx.createLinearGradient(t,e,i,s)}createRadialGradient(t,e,i,s,n,o){return this.ctx.createRadialGradient(t,e,i,s,n,o)}createConicGradient(t,e,i){return"function"==typeof this.ctx.createConicGradient?this.ctx.createConicGradient(t,e,i):null}createPattern(t,e){return this.ctx.createPattern(t,e)}getImageData(t,e,i,s){return this.ctx.getImageData(t,e,i,s)}putImageData(t,e,i){this.ctx.putImageData(t,e,i)}createImageData(t,e){return this.ctx.createImageData(t,e)}toDataURL(t,e){return this.canvasEl.toDataURL(t,e)}toBlob(t,e,i){this.canvasEl.toBlob(t,e,i)}toJSONString(){return this.serializer.toJSONString()}toJSONObject(){return this.serializer.toJSONObject()}fromJSONObject(t){mt.stop(),this.renderer.stop(),this.eventDispatcher.stopped=!0,this.animationManager.stop(),this.controlPanelManager.stop(),this.linkSlotManager.stop(),this.clearAll(),this.deserializer.fromJSONObject(t),mt.start(),this.renderer.start(),this.animationManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(()=>{this.eventDispatcher.stopped=!1},300)}fromJSONString(t){const e=JSON.parse(t);this.fromJSONObject(e)}},t.ICEBezier=ICEBezier,t.ICEBorderLayout=class ICEBorderLayout extends ft{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.gap=t.gap||5}layoutContainer(t){const e=t.childNodes,i=t.state.width,s=t.state.height;let n=null,o=null,r=null,a=null,h=null;e.forEach(t=>{const e=t.state.layoutConstraint||"center";"north"===e?n=t:"south"===e?o=t:"east"===e?r=t:"west"===e?a=t:h=t});let l=0,c=s,d=0,u=i;n&&(n.setState({left:0,top:0,width:i}),l=n.state.height+this.gap),o&&(o.setState({left:0,top:s-o.state.height,width:i}),c=s-o.state.height-this.gap),r&&(r.setState({left:i-r.state.width,top:l,height:c-l}),u=i-r.state.width-this.gap),a&&(a.setState({left:0,top:l,height:c-l}),d=a.state.width+this.gap),h&&h.setState({left:d,top:l,width:u-d,height:c-l})}},t.ICEBoundingBox=D,t.ICEBoxLayout=class ICEBoxLayout extends ft{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.axis=t.axis||"x",this.gap=t.gap||5}layoutContainer(t){let e=0;for(const i of t.childNodes)"x"===this.axis?(i.setState({left:e,top:0}),e+=i.state.width+this.gap):(i.setState({left:0,top:e}),e+=i.state.height+this.gap)}},t.ICECardLayout=class ICECardLayout extends ft{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),_defineProperty$1(this,"currentIndex",0),_defineProperty$1(this,"container",null),this.currentIndex=t.currentIndex||0}layoutContainer(t){this.container=t,t.childNodes.forEach((t,e)=>{t.setState({display:e===this.currentIndex,left:0,top:0})})}show(t){this.currentIndex=t,this.container&&this.layoutContainer(this.container)}next(){this.show(this.currentIndex+1)}previous(){this.show(this.currentIndex-1)}},t.ICECircle=V,t.ICEComponent=z,t.ICEControlPanel=ICEControlPanel,t.ICEControlPanelManager=W,t.ICEDotPath=ICEDotPath,t.ICEEllipse=H,t.ICEEventTarget=N,t.ICEFlowLayout=class ICEFlowLayout extends ft{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.gap=t.gap||10,this.align=t.align||"left"}layoutContainer(t){const e=t.childNodes,i=t.state.width,s=this.gap,n=[[]];let o=0;for(const t of e){const e=t.state.width;o>0&&o+s+e>i&&(n.push([]),o=0),n[n.length-1].push(t),o+=o>0?s+e:e}let r=0;for(const t of n){let e=0,n=0;for(const i of t)e+=i.state.width,n=Math.max(n,i.state.height);e+=s*(t.length-1);let o=0;"center"===this.align?o=(i-e)/2:"right"===this.align&&(o=i-e);for(const e of t)e.setState({left:o,top:r}),o+=e.state.width+s;r+=n+s}}},t.ICEGridLayout=class ICEGridLayout extends ft{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.cols=t.cols||2,this.gapX=t.gapX||10,this.gapY=t.gapY||10}layoutContainer(t){const e=t.childNodes;let i=0,s=0,n=0,o=0;for(const t of e)t.setState({left:i,top:s}),i+=t.state.width+this.gapX,n=Math.max(n,t.state.height),o++,o>=this.cols&&(o=0,i=0,s+=n+this.gapY,n=0)}},t.ICEGroup=X,t.ICEImage=rt,t.ICEIsogon=lt,t.ICELayeredLayout=class ICELayeredLayout extends ft{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.gapX=t.gapX||80,this.gapY=t.gapY||40}layoutContainer(t){const e=t.childNodes||[],i=[],s=[];for(const t of e)if(t.isLine){const e=t.getLinkFromId?t.getLinkFromId():null,i=t.getLinkToId?t.getLinkToId():null;s.push({from:e,to:i,component:t})}else i.push({id:t.props.id,component:t,rank:0,order:0,barycenter:0});if(0===i.length)return;const n={};i.forEach(t=>n[t.id]=t);const o=s.filter(t=>t.from&&t.to&&n[t.from]&&n[t.to]);this.assignRanks(i,o),this.assignOrders(i,o,n),this.assignCoords(i,o,n)}assignRanks(t,e){const i={},visit=(t,s)=>{if(void 0!==i[t])return i[t];if(s.has(t))return 0;s.add(t);const n=e.filter(e=>e.to===t).map(t=>t.from);let o=-1;for(const t of n)o=Math.max(o,visit(t,s));return i[t]=o+1,s.delete(t),i[t]};t.forEach(t=>{t.rank=visit(t.id,new Set)})}assignOrders(t,e,i){const s={};t.forEach(t=>{(s[t.rank]=s[t.rank]||[]).push(t)});const n=Object.keys(s).map(Number).sort((t,e)=>t-e);n.forEach(t=>s[t].forEach((t,e)=>t.order=e));for(let t=0;t<4;t++)for(const t of n){const n=s[t];n.forEach(t=>{const s=e.filter(e=>e.from===t.id).map(t=>i[t.to]);t.barycenter=s.length?s.reduce((t,e)=>t+e.order,0)/s.length:t.order}),n.sort((t,e)=>t.barycenter-e.barycenter),n.forEach((t,e)=>t.order=e)}}assignCoords(t,e,i){const s={};t.forEach(t=>{(s[t.rank]=s[t.rank]||[]).push(t)});const n=Object.keys(s).map(Number).sort((t,e)=>t-e),o=this.gapX,r=this.gapY;let a=0;n.forEach(t=>{const e=s[t],i=Math.max(...e.map(t=>t.component.state.width));let n=0;e.forEach(t=>{t.component.setState({left:a,top:n}),n+=t.component.state.height+r}),a+=i+o});for(const t of e){const e=i[t.from].component,s=i[t.to].component,n=e.state.left+e.state.width,o=e.state.top+e.state.height/2,r=s.state.left,a=s.state.top+s.state.height/2;t.component.setState({startPoint:[n,o],endPoint:[r,a]})}}},t.ICELayoutManager=ft,t.ICELinkHook=ICELinkHook,t.ICELinkSlot=ht,t.ICEOverlayLayout=class ICEOverlayLayout extends ft{layoutContainer(t){for(const e of t.childNodes)e.setState({left:0,top:0})}},t.ICEPath=j,t.ICEPolyLine=at,t.ICERect=F,t.ICERose=ct,t.ICEStar=dt,t.ICEText=pt,t.ICETheme=P,t.ICEVisioLink=ICEVisioLink,t.LineControlPanel=LineControlPanel,t.PROJECT_SCHEMA_VERSION=1,t.PluginHost=PluginHost,t.Relation=Relation,t.ResizeControl=ResizeControl,t.RotateControl=RotateControl,t.STYLE_PRESETS=S,t.TransformControlPanel=TransformControlPanel,t.baseTokens=v,t.buildAccessibilityTree=buildAccessibilityTree,t.getTheme=getTheme,t.registerTheme=registerTheme,t.setTheme=setTheme,t.toSchemaObject=toSchemaObject,t.toSchemaString=toSchemaString,t.validateProjectSnapshot=validateProjectSnapshot,t.validateSchema=validateSchema,Object.defineProperty(t,"__esModule",{value:!0})}));
|