ice-entity-designer 0.0.5

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 大漠穷秋
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ <p align="center">
2
+ <img width="150" src="./tests/assets/ice-render.png">
3
+ </p>
4
+
5
+ <h1 align="center">ice entity designer</h1>
6
+
7
+ ## 简介
8
+ Entity Designer based on ice-render.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2022 大漠穷秋
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ "use strict";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){return e&&_defineProperties$1(t.prototype,e),n&&_defineProperties$1(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}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 _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)}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 _possibleConstructorReturn$1(this,i?(t=_getPrototypeOf$1(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _superPropBase$1(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf$1(t)););return t}function _get$1(){return(_get$1="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,e,n){var i=_superPropBase$1(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 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){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}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 _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)}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 _possibleConstructorReturn(this,i?(t=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _superPropBase(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}function _get(){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,e,n){var i=_superPropBase(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}Object.defineProperty(exports,"__esModule",{value:!0});var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e="object"==typeof t&&t&&t.Object===Object&&t,n=e,i="object"==typeof self&&self&&self.Object===Object&&self,r=n||i||Function("return this")(),o=r.Symbol,s=o,a=Object.prototype,l=a.hasOwnProperty,h=a.toString,c=s?s.toStringTag:void 0,u=Object.prototype.toString,d=function getRawTag$1(t){var e=l.call(t,c),n=t[c];try{var i=!(t[c]=void 0)}catch(t){}var r=h.call(t);return i&&(e?t[c]=n:delete t[c]),r},f=function objectToString$1(t){return u.call(t)},p=o?o.toStringTag:void 0,y=function baseGetTag$7(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(p&&p in Object(t)?d:f)(t)},v=Array.isArray,g=function isObjectLike$7(t){return null!=t&&"object"==typeof t},C=y,m=v,b=g,_=function isString(t){return"string"==typeof t||!m(t)&&b(t)&&"[object String]"==C(t)},k=function isUndefined(t){return void 0===t},P="ICE_FRAME_EVENT",w="BEFORE_RENDER",x="AFTER_RENDER",E="BEFORE_ADD",S="AFTER_ADD",I="BEFORE_REMOVE",O="ROUND_FINISH",M="HOOK_MOUSEDOWN",$="HOOK_MOUSEMOVE",j="HOOK_MOUSEUP",A="BEFORE_RESIZE",B="AFTER_RESIZE",T="AFTER_ROTATE",L="BEFORE_MOVE",R="AFTER_MOVE",z={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}},N=function(){function AnimationManager(t){_classCallCheck(this,AnimationManager),_defineProperty$1(this,"animationMap",new Map),this.ice=t}return _createClass(AnimationManager,[{key:"start",value:function start(){return this.ice.evtBus.on(P,this.frameEventHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(P,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<(k(o.startTime)&&(o.startTime=Date.now()),k(o.easing)&&(o.easing="linear"),s=z[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){_(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}}]),AnimationManager}(),D=function eq$4(t,e){return t===e||t!=t&&e!=e},H=D,V=function assocIndexOf$4(t,e){for(var n=t.length;n--;)if(H(t[n][0],e))return n;return-1},q=V,F=Array.prototype.splice,U=V,X=V,G=V,W=function listCacheClear$1(){this.__data__=[],this.size=0};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=W,ListCache$4$1.prototype.delete=function listCacheDelete$1(t){var e=this.__data__;return!((t=q(e,t))<0||(t==e.length-1?e.pop():F.call(e,t,1),--this.size,0))},ListCache$4$1.prototype.get=function listCacheGet$1(t){var e=this.__data__;return(t=U(e,t))<0?void 0:e[t][1]},ListCache$4$1.prototype.has=function listCacheHas$1(t){return-1<X(this.__data__,t)},ListCache$4$1.prototype.set=function listCacheSet$1(t,e){var n=this.__data__,i=G(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this};var J,K=ListCache$4$1,Q=K,Z=function isObject$8(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Y=y,tt=Z,et=function isFunction$3(t){return!!tt(t)&&("[object Function]"==(t=Y(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)},nt=r["__core-js_shared__"],it=(J=/[^.]+$/.exec(nt&&nt.keys&&nt.keys.IE_PROTO||""))?"Symbol(src)_1."+J:"",rt=Function.prototype.toString,ot=function toSource$2(t){if(null!=t){try{return rt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},st=et,at=function isMasked$1(t){return!!it&&it in t},lt=Z,ht=ot,ct=/^\[object .+?Constructor\]$/,ut=Function.prototype,dt=Object.prototype,ft=ut.toString,pt=dt.hasOwnProperty,yt=RegExp("^"+ft.call(pt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),vt=function getNative$7(t,e){return function baseIsNative$1(t){return lt(t)&&!at(t)&&(st(t)?yt:ct).test(ht(t))}(t=function getValue$1(t,e){return null==t?void 0:t[e]}(t,e))?t:void 0},gt=vt(r,"Map"),Ct=vt(Object,"create"),mt=Ct,bt=Ct,_t=Object.prototype.hasOwnProperty,kt=Ct,Pt=Object.prototype.hasOwnProperty,wt=Ct,xt=function hashClear$1(){this.__data__=mt?mt(null):{},this.size=0},Et=function hashDelete$1(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},St=function hashGet$1(t){var e,n=this.__data__;return bt?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:_t.call(n,t)?n[t]:void 0};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=xt,Hash$1$1.prototype.delete=Et,Hash$1$1.prototype.get=St,Hash$1$1.prototype.has=function hashHas$1(t){var e=this.__data__;return kt?void 0!==e[t]:Pt.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]=wt&&void 0===e?"__lodash_hash_undefined__":e,this};var It=Hash$1$1,Ot=K,Mt=gt,$t=function getMapData$4(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},jt=$t,At=$t,Bt=$t,Tt=$t;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 It,map:new(Mt||Ot),string:new It}},MapCache$1$1.prototype.delete=function mapCacheDelete$1(t){return t=jt(this,t).delete(t),this.size-=t?1:0,t},MapCache$1$1.prototype.get=function mapCacheGet$1(t){return At(this,t).get(t)},MapCache$1$1.prototype.has=function mapCacheHas$1(t){return Bt(this,t).has(t)},MapCache$1$1.prototype.set=function mapCacheSet$1(t,e){var n=Tt(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};var Lt=K,Rt=gt,zt=MapCache$1$1,Nt=K,Dt=function stackClear$1(){this.__data__=new Q,this.size=0},Ht=function stackDelete$1(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},Vt=function stackGet$1(t){return this.__data__.get(t)},qt=function stackHas$1(t){return this.__data__.has(t)};function Stack$1$1(t){t=this.__data__=new Nt(t),this.size=t.size}Stack$1$1.prototype.clear=Dt,Stack$1$1.prototype.delete=Ht,Stack$1$1.prototype.get=Vt,Stack$1$1.prototype.has=qt,Stack$1$1.prototype.set=function stackSet$1(t,e){var n=this.__data__;if(n instanceof Lt){var i=n.__data__;if(!Rt||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new zt(i)}return n.set(t,e),this.size=n.size,this};var Ft=Stack$1$1,Ut=vt,Xt=function(){try{var t=Ut(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Gt=Xt,Wt=function baseAssignValue$3(t,e,n){"__proto__"==e&&Gt?Gt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},Jt=Wt,Kt=D,Qt=function assignMergeValue$2(t,e,n){(void 0===n||Kt(t[e],n))&&(void 0!==n||e in t)||Jt(t,e,n)},Zt=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}}(),Yt={exports:{}},te=(function(t,e){var n,i=(n=(n=(e=e&&!e.nodeType&&e)&&t&&!t.nodeType&&t)&&n.exports===e?r.Buffer:void 0)?n.allocUnsafe:void 0;t.exports=function cloneBuffer(t,e){return e?t.slice():(e=t.length,e=i?i(e):new t.constructor(e),t.copy(e),e)}}(Yt,Yt.exports),r.Uint8Array),ee=Z,ne=Object.create,ie=function(){function object(){}return function(t){return ee(t)?ne?ne(t):(object.prototype=t,t=new object,object.prototype=void 0,t):{}}}(),re=function overArg$2(e,n){return function(t){return e(n(t))}},oe=re(Object.getPrototypeOf,Object),se=Object.prototype,ae=function isPrototype$4(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||se)},le=ie,he=oe,ce=ae,ue=y,de=g,fe=function baseIsArguments$1(t){return de(t)&&"[object Arguments]"==ue(t)},pe=g,ye=Object.prototype,ve=ye.hasOwnProperty,ge=ye.propertyIsEnumerable,Ce=fe(function(){return arguments}())?fe:function(t){return pe(t)&&ve.call(t,"callee")&&!ge.call(t,"callee")},me=function isLength$2(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991},be=et,_e=me,ke=function isArrayLike$4(t){return null!=t&&_e(t.length)&&!be(t)},Pe=ke,we=g,xe={exports:{}},Ee=function stubFalse(){return!1},Se=(function(t,e){var n;e=((n=(n=(e=e&&!e.nodeType&&e)&&t&&!t.nodeType&&t)&&n.exports===e?r.Buffer:void 0)?n.isBuffer:void 0)||Ee,t.exports=e}(xe,xe.exports),y),Ie=oe,Oe=g,Me=Function.prototype,$e=Object.prototype,je=Me.toString,Ae=$e.hasOwnProperty,Be=je.call(Object),Te=y,Le=me,Re=g,ze={},Ne=(ze["[object Float32Array]"]=ze["[object Float64Array]"]=ze["[object Int8Array]"]=ze["[object Int16Array]"]=ze["[object Int32Array]"]=ze["[object Uint8Array]"]=ze["[object Uint8ClampedArray]"]=ze["[object Uint16Array]"]=ze["[object Uint32Array]"]=!0,ze["[object Arguments]"]=ze["[object Array]"]=ze["[object ArrayBuffer]"]=ze["[object Boolean]"]=ze["[object DataView]"]=ze["[object Date]"]=ze["[object Error]"]=ze["[object Function]"]=ze["[object Map]"]=ze["[object Number]"]=ze["[object Object]"]=ze["[object RegExp]"]=ze["[object Set]"]=ze["[object String]"]=ze["[object WeakMap]"]=!1,function baseIsTypedArray$1(t){return Re(t)&&Le(t.length)&&!!ze[Te(t)]}),De={exports:{}},He=(function(t,n){var i=(n=n&&!n.nodeType&&n)&&t&&!t.nodeType&&t,r=i&&i.exports===n&&e.process;n=function(){try{return i&&i.require&&i.require("util").types||r&&r.binding&&r.binding("util")}catch(t){}}(),t.exports=n}(De,De.exports),Ne),Ve=function baseUnary$1(e){return function(t){return e(t)}},qe=De.exports,Fe=qe&&qe.isTypedArray,Ue=Fe?Ve(Fe):He,Xe=function safeGet$2(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Ge=Wt,We=D,Je=Object.prototype.hasOwnProperty,Ke=function assignValue$1(t,e,n){var i=t[e];Je.call(t,e)&&We(i,n)&&(void 0!==n||e in t)||Ge(t,e,n)},Qe=Wt,Ze=/^(?:0|[1-9]\d*)$/,Ye=function isIndex$2(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Ze.test(t))&&-1<t&&t%1==0&&t<e},tn=Ce,en=v,nn=xe.exports,rn=Ye,sn=Ue,an=Object.prototype.hasOwnProperty,ln=Z,hn=ae,cn=Object.prototype.hasOwnProperty,un=function arrayLikeKeys$1(t,e){var n,i=en(t),r=!i&&tn(t),o=!i&&!r&&nn(t),s=!i&&!r&&!o&&sn(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):[],h=l.length;for(n in t)!e&&!an.call(t,n)||a&&("length"==n||o&&("offset"==n||"parent"==n)||s&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||rn(n,h))||l.push(n);return l},dn=function baseKeysIn$1(t){if(!ln(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=hn(t),i=[];for(e in t)("constructor"!=e||!n&&cn.call(t,e))&&i.push(e);return i},fn=ke,pn=function keysIn$2(t){return fn(t)?un(t,!0):dn(t)},yn=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?Qe:Ke)(n,a,l)}return n},vn=pn,gn=Qt,Cn=Yt.exports,mn=function cloneTypedArray$1(t,e){return e=e?function cloneArrayBuffer$1(t){var e=new t.constructor(t.byteLength);return new te(e).set(new te(t)),e}(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.length)},bn=function copyArray$1(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e},_n=function initCloneObject$1(t){return"function"!=typeof t.constructor||ce(t)?{}:le(he(t))},kn=Ce,Pn=v,wn=function isArrayLikeObject$1(t){return we(t)&&Pe(t)},xn=xe.exports,En=et,Sn=Z,In=function isPlainObject$1(t){return!(!Oe(t)||"[object Object]"!=Se(t))&&(null===(t=Ie(t))||"function"==typeof(t=Ae.call(t,"constructor")&&t.constructor)&&t instanceof t&&je.call(t)==Be)},On=Ue,Mn=Xe,$n=Ft,jn=Qt,An=Zt,Bn=function baseMergeDeep$1(t,e,n,i,r,o,s){var a,l,h,c=Mn(t,n),u=Mn(e,n),d=s.get(u);d||((e=void 0===(d=o?o(c,u,n+"",t,e,s):void 0))&&(l=!(a=Pn(u))&&xn(u),h=!a&&!l&&On(u),d=u,a||l||h?d=Pn(c)?c:wn(c)?bn(c):l?Cn(u,!(e=!1)):h?mn(u,!(e=!1)):[]:In(u)||kn(u)?kn(d=c)?d=function toPlainObject$1(t){return yn(t,vn(t))}(c):Sn(c)&&!En(c)||(d=_n(u)):e=!1),e&&(s.set(u,d),r(d,u,i,o,s),s.delete(u))),gn(t,n,d)},Tn=Z,Ln=pn,Rn=Xe,zn=function identity$2(t){return t},Nn=function apply$1(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)},Dn=Math.max,Hn=function constant$1(t){return function(){return t}},Vn=Xt,qn=Vn?function(t,e){return Vn(t,"toString",{configurable:!0,enumerable:!1,value:Hn(e),writable:!0})}:zn,Fn=Date.now,Un=function shortOut$1(n){var i=0,r=0;return function(){var t=Fn(),e=16-(t-r);if(r=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(qn),Xn=zn,Gn=function overRest$1(o,s,a){return s=Dn(void 0===s?o.length-1:s,0),function(){for(var t=arguments,e=-1,n=Dn(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),Nn(o,this,r)}},Wn=Un,Jn=D,Kn=ke,Qn=Ye,Zn=Z,Yn=function baseMerge$1(i,r,o,s,a){i!==r&&An(r,function(t,e){var n;a=a||new $n,Tn(t)?Bn(i,r,e,o,baseMerge$1,s,a):(n=s?s(Rn(i,e),t,e+"",i,r,a):void 0,jn(i,e,n=void 0===n?t:n))},Ln)},ti=function createAssigner$1(a){return function baseRest$1(t,e){return Wn(Gn(t,e,Xn),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(Zn(n))return i=typeof e,("number"==i?Kn(n)&&Qn(e,n.length):"string"==i&&e in n)&&Jn(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){Yn(t,e,n)}),ei="undefined"!=typeof Float32Array?Float32Array:Array,ni=Math.PI/180;function toRadian(t){return t*ni}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]),h=n[1],c=n[2],u=n[3],d=n[4];return n=n[5],t[0]=i*l+o*h,t[1]=r*l+s*h,t[2]=i*c+o*u,t[3]=r*c+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 ei(2);ei!=Float32Array&&(t[0]=0,t[1]=0)}();var ii=null,ri=((ii=window||global||{}).requestFrame=ii.requestAnimationFrame||ii.webkitRequestAnimationFrame||ii.mozRequestAnimationFrame||ii.oRequestAnimationFrame||ii.msRequestAnimationFrame,ii),oi=function(){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]}return _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}(),si=re(Object.keys,Object),ai=ae,li=si,hi=Object.prototype.hasOwnProperty,ci=vt(r,"DataView"),ui=gt,di=vt(r,"Promise"),fi=vt(r,"Set"),pi=vt(r,"WeakMap"),yi=y,vi=ot,gi=vi(ci),Ci=vi(ui),mi=vi(di),bi=vi(fi),_i=vi(pi),ki=yi,Pi=((ci&&"[object DataView]"!=ki(new ci(new ArrayBuffer(1)))||ui&&"[object Map]"!=ki(new ui)||di&&"[object Promise]"!=ki(di.resolve())||fi&&"[object Set]"!=ki(new fi)||pi&&"[object WeakMap]"!=ki(new pi))&&(ki=function(t){var e=yi(t);if(t=(t="[object Object]"==e?t.constructor:void 0)?vi(t):"")switch(t){case gi:return"[object DataView]";case Ci:return"[object Map]";case mi:return"[object Promise]";case bi:return"[object Set]";case _i:return"[object WeakMap]"}return e}),function baseKeys$1(t){if(!ai(t))return li(t);var e,n=[];for(e in Object(t))hi.call(t,e)&&"constructor"!=e&&n.push(e);return n}),wi=ki,xi=Ce,Ei=v,Si=ke,Ii=xe.exports,Oi=ae,Mi=Ue,$i=Object.prototype.hasOwnProperty,ji=function isEmpty(t){if(null==t)return!0;if(Si(t)&&(Ei(t)||"string"==typeof t||"function"==typeof t.splice||Ii(t)||Mi(t)||xi(t)))return!t.length;var e,n=wi(t);if("[object Map]"==n||"[object Set]"==n)return!t.size;if(Oi(t))return!Pi(t).length;for(e in t)if($i.call(t,e))return!1;return!0},Ai=function(){function ICEEventTarget(){_classCallCheck(this,ICEEventTarget),_defineProperty$1(this,"listeners",{}),_defineProperty$1(this,"suspendedEventNames",[])}return _createClass(ICEEventTarget,[{key:"on",value:function on(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:ri;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]:ri;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]:ri,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(ji(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;n?((e=new oi(n)).originalEvent=n.originalEvent||n,e.param=_objectSpread2({},i)):e=new oi({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]:ri;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}(),Bi=(Ai.prototype.addEventListener=Ai.prototype.on,Ai.prototype.removeEventListener=Ai.prototype.off,Ai.prototype.dispatchEvent=Ai.prototype.trigger,function(){function GeoUtil(){throw _classCallCheck(this,GeoUtil),new Error("GeoUtil is a static util class.")}return _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}()),Ti=function(){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]]}return _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,h=s[a];t[1]>h.o[1]&&t[1]>h.d[1]||t[1]<h.o[1]&&t[1]<h.d[1]||(h.o[0]===h.d[0]&&h.o[0]>=t[0]?h.o[0]:(l=(h.d[1]-h.o[1])/(h.d[0]-h.o[0]),h.o[0]+(t[1]-h.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 getVal(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function flattenTree(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,r=0;r<e.length;r++){var o=e[r];o._level=n,o._pid=i,t.push(o),flattenTree(t,o.childNodes||[],n+1,o.id)}return t}function uuid(){if(ri.crypto)return ri.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)})}var Li=function(){_inherits(ICEComponent,Ai);var n=_createSuper(ICEComponent);function ICEComponent(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEComponent),_defineProperty$1(_assertThisInitialized(t=n.call(this)),"__typeName","ICEComponent"),_defineProperty$1(_assertThisInitialized(t),"__dirty",!0),_defineProperty$1(_assertThisInitialized(t),"props",{id:"ICE_"+uuid(),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",_objectSpread2({},t.props)),t.props=ti(t.props,e),t.state=JSON.parse(JSON.stringify(t.props)),t.root=ri,t.initEvents(),t}return _createClass(ICEComponent,[{key:"initEvents",value:function initEvents(){}},{key:"render",value:function render(){this.trigger(w),this.state.display&&(this.calcComponentParams(),this.applyStyleToCtx(),this.applyTransformToCtx(),this.doRender(),this.trigger(x),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 ei(6);return ei!=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,toRadian(e),toRadian(n)),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 Ti([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 Ti([t,e,n,e,t,i,n,i,r[0],r[1]])}},{key:"setState",value:function setState(t){ti(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 oi;this.trigger(L,_objectSpread2(_objectSpread2({},n),{},{left:t,top:e})),this.setState({left:t,top:e}),this.trigger(R,_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 oi;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 oi;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-=Bi.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 Bi.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(I,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}]),ICEComponent}(),Ri=(_defineProperty$1(Li,"instanceCounter",0),function(){_inherits(ICEPath,Li);var e=_createSuper(ICEPath);function ICEPath(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEPath),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2({closePath:!0},t))),"path2D",new Path2D),t}return _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}()),zi=function(){_inherits(ICERect,Ri);var e=_createSuper(ICERect);function ICERect(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICERect),e.call(this,_objectSpread2({width:10,height:10},t))}return _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}(),Ni=function(){_inherits(ICEGroup,zi);var e=_createSuper(ICEGroup);function ICEGroup(t){return _classCallCheck(this,ICEGroup),_defineProperty$1(_assertThisInitialized(t=e.call(this,t)),"parentNode",null),_defineProperty$1(_assertThisInitialized(t),"childNodes",[]),t}return _createClass(ICEGroup,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEGroup.prototype),"initEvents",this).call(this),this.once(S,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(E),t.ice=this.ice,t.ctx=this.ice.ctx,t.evtBus=this.ice.evtBus,t.trigger(S)}},{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){ti(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}(),Di=function(){_inherits(ICEControlPanel,Ni);var e=_createSuper(ICEControlPanel);function ICEControlPanel(t){return _classCallCheck(this,ICEControlPanel),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))),"__typeName","ICEControlPanel"),t}return _createClass(ICEControlPanel,[{key:"doRender",value:function doRender(){_get(_getPrototypeOf(ICEControlPanel.prototype),"doRender",this).call(this),this.setControlPositions()}},{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}(),Hi=function isNil(t){return null==t},Vi=function(){_inherits(ICEEllipse,Ri);var e=_createSuper(ICEEllipse);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,e.call(this,t)}return _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){Hi(t.radiusX)?Hi(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,Hi(t.radiusY)?Hi(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,_get(_getPrototypeOf(ICEEllipse.prototype),"setState",this).call(this,t)}}]),ICEEllipse}(),qi=function(){_inherits(ICECircle,Vi);var e=_createSuper(ICECircle);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,e.call(this,t)}return _createClass(ICECircle)}(),Fi=function(){_inherits(ICELinkHook,qi);var e=_createSuper(ICELinkHook);function ICELinkHook(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkHook),e.call(this,_objectSpread2({linkable:!1},t))}return _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(R,this.resizeEvtHandler,this)}},{key:"mosueDownHandler",value:function mosueDownHandler(t){this.evtBus.trigger(M,new oi({target:this}))}},{key:"mosueMoveHandler",value:function mosueMoveHandler(t){this.evtBus.trigger($,new oi({target:this}))}},{key:"mosueUpHandler",value:function mosueUpHandler(t){this.evtBus.trigger(j,new oi({target:this}))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(A,new oi(t,{position:e})),this.parentNode.trigger(B,new oi(t,{position:e})))}}]),ICELinkHook}(),Ui=function(){_inherits(LineControlPanel,Di);var e=_createSuper(LineControlPanel);function LineControlPanel(t){return _classCallCheck(this,LineControlPanel),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2(_objectSpread2({},t),{},{zIndex:10000010,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"controlSize",16),t.initControls(),t}return _createClass(LineControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=this.controlSize/2;this.startControl=new Fi({zIndex:10000011,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 Fi({zIndex:10000012,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(B,this.resizeEvtHandler,this)}},{key:"enable",value:function enable(){this.setState({display:!0}),this.resume(B),this.showHooks()}},{key:"disable",value:function disable(){this.setState({display:!1}),this.suspend(B),this.hideHooks()}},{key:"setControlPositions",value:function setControlPositions(){}},{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(R,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(R,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(I,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}(),Xi=/\s/,Gi=/^\s+/,Wi=y,Ji=g,Ki=function isSymbol$2(t){return"symbol"==typeof t||Ji(t)&&"[object Symbol]"==Wi(t)},Qi=function baseTrim$1(t){return t&&t.slice(0,function trimmedEndIndex$1(t){for(var e=t.length;e--&&Xi.test(t.charAt(e)););return e}(t)+1).replace(Gi,"")},Zi=Z,Yi=Ki,tr=/^[-+]0x[0-9a-f]+$/i,er=/^0b[01]+$/i,nr=/^0o[0-7]+$/i,ir=parseInt,rr=function toNumber$2(t){if("number"==typeof t)return t;if(Yi(t))return NaN;if(Zi(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=Zi(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=Qi(t);var e=er.test(t);return e||nr.test(t)?ir(t.slice(2),e?2:8):tr.test(t)?NaN:+t},or=rr,sr=v,ar=Ki,lr=o?o.prototype:void 0,hr=lr?lr.toString:void 0,cr=function baseToString$1(t){if("string"==typeof t)return t;if(sr(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,baseToString$1)+"";if(ar(t))return hr?hr.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},ur=function toInteger$1(t){var e=(t=function toFinite$1(t){return t?(t=or(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},dr=rr,fr=function toString$1(t){return null==t?"":cr(t)},pr=r.isFinite,yr=Math.min,vr=function createRound$1(t){var r=Math[t];return function(t,e){var n,i;return t=dr(t),(e=null==e?0:yr(ur(e),292))&&pr(t)?(n=(fr(t)+"e").split("e"),i=r(n[0]+"e"+(+n[1]+e)),+((n=(fr(i)+"e").split("e"))[0]+"e"+(+n[1]-e))):r(t)}}("round"),gr=function(){_inherits(ResizeControl,zi);var e=_createSuper(ResizeControl);function ResizeControl(t){return _classCallCheck(this,ResizeControl),e.call(this,_objectSpread2(_objectSpread2({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}return _createClass(ResizeControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ResizeControl.prototype),"initEvents",this).call(this),this.on(R,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(A,new oi(t,{quadrant:n})),this.parentNode.setState(e),this.parentNode.trigger(B,new oi(t,{quadrant:n}))}}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new oi,i=0<t?1:-1,r=0<e?1:-1,o=(c=this.parentNode.state).localOrigin,s=c.width,a=c.height,l=(t=(c=transformMat2d([],[t,e],invert([],c.absoluteLinearMatrix)))[0],e=c[1],(c=this.state).left),h=c.top,c=c.quadrant,u=this.state.width/2,d=0;"x"===this.state.direction?d=0<(l=0===vr(l+=t)?.5*i:l)+u-o[0]?8:7:"y"===this.state.direction?d=0<(h=0===vr(h+=e)?.5*r:h)+u-o[1]?6:5:"xy"===this.state.direction&&(r=-a/2/(0===vr(r=-s/2)?.5*i:r),0===vr(s/=2)&&(s=.5*i),h+=e=2===c||4==c?r*(l+u-o[0]+t)-(h+u-o[1]):-a/2/s*(l+u-o[0]+t)-(h+u-o[1]),d=0<(l+=t)+u-o[0]?0<h+u-o[1]?4:1:0<h+u-o[1]?3:2),c!==d&&this.parentNode.toggleControlQuadrant(this,d),this.setPosition(l,h,new oi(n,{left:l,top:h,tx:t,ty:e,quadrant:d}))}}]),ResizeControl}(),Cr=function(){_inherits(RotateControl,qi);var e=_createSuper(RotateControl);function RotateControl(t){return _classCallCheck(this,RotateControl),e.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))}return _createClass(RotateControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(RotateControl.prototype),"initEvents",this).call(this),this.on(R,this.rotateEvtHandler,this)}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteOrigin,t={transform:{rotate:Bi.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger("BEFORE_ROTATE",new oi(t)),this.parentNode.setState(t),this.parentNode.trigger(T,new oi(t)))}}]),RotateControl}(),mr=function(){_inherits(TransformControlPanel,Di);var e=_createSuper(TransformControlPanel);function TransformControlPanel(t){return _classCallCheck(this,TransformControlPanel),_defineProperty$1(_assertThisInitialized(t=e.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}return _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 gr({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 Cr({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(B,this.resizeEvtHandler,this),this.on(T,this.rotateEvtHandler,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(B),this.resume(T)}},{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(B),this.suspend(T)}},{key:"setControlPositions",value:function setControlPositions(){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,h=-this.rotateControlffsetY;this.rotateControlInstance.setState({left:l,top:h})}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.targetComponent&&(e=this.state.transform.rotate,this.targetComponent.setGlobalRotate(e),this.targetComponent.trigger(T))}},{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(B)}}},{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(R,this.updatePanel,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(R,this.updatePanel,this),this._targetComponent&&this._targetComponent.once(I,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}(),br=function(){function ICEControlPanelManager(t){_classCallCheck(this,ICEControlPanelManager),this.ice=t,this.transformControlPanel=new mr({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 Ui({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()}return _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&&("ICEControlPanel"===t.__typeName||t.parentNode&&"ICEControlPanel"===t.parentNode.__typeName)||(this.ice.selectionList=[t],this.lineControlPanel.disable(),this.transformControlPanel.disable(),"ICEPolyLine"===t.__typeName?(this.lineControlPanel.targetComponent=t,this.lineControlPanel.enable()):(this.transformControlPanel.targetComponent=t,this.transformControlPanel.enable()))}}]),ICEControlPanelManager}(),_r=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dbclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],kr=function(){function DOMEventBridge(t){_classCallCheck(this,DOMEventBridge),_defineProperty$1(this,"selectionCandidates",[]),_defineProperty$1(this,"_stopped",!1),this.ice=t}return _createClass(DOMEventBridge,[{key:"start",value:function start(){for(var i=this,r=null,t=0;t<_r.length;t++)!function H8(t){var e=(t=_r[t])[1],n=t[0];i.ice.evtBus.on(e,function(t){i._stopped||((r="ICE_MOUSEMOVE"!==e?i.findTargetComponent(t):r)&&(t.target=r).trigger(n,t),i.ice.evtBus.trigger(n,t))})}(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.toolNodes),flattenTree([],this.ice.childNodes)),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}}]),DOMEventBridge}(),Pr=function(){_inherits(EventBus,Ai);var t=_createSuper(EventBus);function EventBus(){return _classCallCheck(this,EventBus),t.call(this)}return _createClass(EventBus)}(),wr=function(){function GeoLine(t,e){_classCallCheck(this,GeoLine),this.startPoint=t,this.endPoint=e}return _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}(),xr=function(){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}return _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}(),Er=function(){_inherits(ICEDotPath,Ri);var e=_createSuper(ICEDotPath);function ICEDotPath(t){return _classCallCheck(this,ICEDotPath),e.call(this,_objectSpread2({dots:[],closePath:!0},t))}return _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}(),Sr="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",Ir=function(){_inherits(ICEImage,Li);var e=_createSuper(ICEImage);function ICEImage(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEImage),e.call(this,_objectSpread2({width:100,height:100,src:Sr},t))}return _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}(),Or=(_createClass(function ICEBezier(){_classCallCheck(this,ICEBezier)}),function(){_inherits(ICEPolyLine,Er);var e=_createSuper(ICEPolyLine);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=e.call(this,t)),"__typeName","ICEPolyLine"),_defineProperty$1(_assertThisInitialized(t),"links",{start:{},end:{}}),t}return _createClass(ICEPolyLine,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEPolyLine.prototype),"initEvents",this).call(this),this.once(S,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function afterAddHandler(t){this.evtBus.once(O,this.makeConnection,this)}},{key:"makeConnection",value:function makeConnection(){var t,e,n=this.state.links;n&&(n.start&&(t=n.start.id,e=n.start.position,t&&e&&(t=this.ice.findComponent(t),this.setLink("start",t,e))),n.end&&(t=n.end.id,e=n.end.position,t&&e&&(n=this.ice.findComponent(t),this.setLink("end",n,e)))),this.ice.dirty=!0}},{key:"setLink",value:function setLink(t,e,n){this.removeLink(t,e,n),this.links[t]={component:e,position:n},e.on(R,this.followComponent,this),e.on(B,this.followComponent,this),e.on(T,this.followComponent,this),e.once(x,this.followComponent,this),this.followComponent();var i,r={};for(i in this.links){var o=this.links[i];o.component&&o.position&&(r[i]={id:o.component.props.id,position:o.position})}this.setState({links:_objectSpread2({},r),draggable:!1})}},{key:"removeLink",value:function removeLink(t,e,n){var i=this.links[t].component,r=this.links[t].position;i===e&&r===n&&(i&&i.off(R,this.followComponent,this),i&&i.off(B,this.followComponent,this),i&&i.off(T,this.followComponent,this),this.links[t]={},this.state.links[t]={}),this.links.start.component||this.links.end.component||this.setState({draggable:!0})}},{key:"followComponent",value:function followComponent(t){for(var e in this.links){var n=this.links[e].position,i=this.links[e].component;if(n&&i){var r=i.getMinBoundingBox(),o=[0,0];switch(n){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=vr(this.state.points[0][0],2),i=vr(this.state.points[0][1],2),r=0,o=[vr(this.state.points[e-1][0],2)-n,vr(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=vr(r,3)),0+(n=vr(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 Ti([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(Hi(t.width)||delete t.width,Hi(t.height)||delete t.height,Hi(t.transform)||delete t.transform,!Hi(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(!Hi(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;Hi(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]),Hi(t.endPoint)||(o=this.state.points.length,this.state.points[o-1]=_toConsumableArray(t.endPoint)),_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],Bi.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:"arrangeParam",value:function arrangeParam(t){var e=ti({},{lineType:"solid",lineWidth:1,arrow:"none",arrowLength:15,arrowAngel:toRadian(30),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}()),Mr=function(){_inherits(ICELinkSlot,qi);var e=_createSuper(ICELinkSlot);function ICELinkSlot(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkSlot),e.call(this,_objectSpread2({linkable:!1,draggable:!1,position:"T"},t))}return _createClass(ICELinkSlot,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICELinkSlot.prototype),"initEvents",this).call(this),this.once(w,this.beforeRenderHandler,this),this.once(I,this.beforeRemoveHandler,this)}},{key:"beforeRenderHandler",value:function beforeRenderHandler(t){this.evtBus.on(M,this.hookMouseDownHandler,this),this.evtBus.on($,this.hookMouseMoveHandler,this),this.evtBus.on(j,this.hookMouseUpHandler,this),this.evtBus.on("mouseup",this.globalMouseUpHandler,this)}},{key:"beforeRemoveHandler",value:function beforeRemoveHandler(t){this.evtBus.off(M,this.hookMouseDownHandler,this),this.evtBus.off($,this.hookMouseMoveHandler,this),this.evtBus.off(j,this.hookMouseUpHandler,this),this.evtBus.off("mouseup",this.globalMouseUpHandler,this),this._hostComponent=null}},{key:"globalMouseUpHandler",value:function globalMouseUpHandler(){this.setState({display:!1})}},{key:"hookMouseDownHandler",value:function hookMouseDownHandler(t){console.log("linkslot, hook mousedown event..."),this._hostComponent&&this.setState({display:!0})}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){t=t.target,this.isIntersectWithHook(t)?(this.setState({style:{fillStyle:"#fffb00"}}),t._currentAboveSlot=this,t.setState({style:{fillStyle:"#fffb00"}})):(this.setState({style:{fillStyle:"#3ce92c"}}),t._currentAboveSlot===this&&t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"hookMouseUpHandler",value:function hookMouseUpHandler(t){var e,n;this._hostComponent&&(e=(t=t.target).parentNode.targetComponent,n=t.state.position,this.isIntersectWithHook(t)?e&&e.setLink(n,this._hostComponent,this.props.position):e&&e.removeLink(n,this._hostComponent,this.props.position),this.setState({display:!1,style:{fillStyle:"#3ce92c"}}),t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"isIntersectWithHook",value:function isIntersectWithHook(t){var e=this.getMaxBoundingBox();return t=t.getMaxBoundingBox(),!!e.isIntersect(t)}},{key:"updatePosition",value:function updatePosition(){console.log("link slot update position ...");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(x,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(x,this.updatePosition,this),this._hostComponent&&this._hostComponent.once(I,function(){e._hostComponent=null,e.setState({display:!1})},this),this._hostComponent&&this.setState({display:!0})}}]),ICELinkSlot}(),$r=function(){_inherits(ICEVisioLink,Or);var e=_createSuper(ICEVisioLink);function ICEVisioLink(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEVisioLink),t=ICEVisioLink.arrangeParam(t),e.call(this,t)}return _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 xr(e,n)),o=new xr(i,t),s=[],a=null,l=null,h=[],c=new Ti,u=new Ti;if(e=this.links.start.component){c=e.getMinBoundingBox(),s[0]=new xr(r.x,c.tl[1]-this.state.escapeDistance),s[1]=new xr(c.tr[0]+this.state.escapeDistance,r.y),s[2]=new xr(r.x,c.br[1]+this.state.escapeDistance),s[3]=new xr(c.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(n=this.links.end.component){u=n.getMinBoundingBox(),s[0]=new xr(o.x,u.tl[1]-this.state.escapeDistance),s[1]=new xr(u.tr[0]+this.state.escapeDistance,o.y),s[2]=new xr(o.x,u.br[1]+this.state.escapeDistance),s[3]=new xr(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])}i=0,t=[r],a&&(t.push(a),i=1),l&&t.push(l),t.push(o),e=xr.cloneArray(t),h.push(["s0","s0",e]),n=xr.cloneArray(t),(e=xr.cloneArray(n)).splice(i+1,0,new xr(e[i].x,e[i+1].y)),h.push(["s1","s1_1",e]),(t=xr.cloneArray(n)).splice(i+1,0,new xr(t[i+1].x,t[i].y)),h.push(["s1","s1_2",t]);var e=xr.cloneArray(n),t=new xr((e[i].x+e[i+1].x)/2,e[i].y),p=new xr((e[i].x+e[i+1].x)/2,e[i+1].y);e.splice(i+1,0,t,p),h.push(["s2","s2_1",e]),t=xr.cloneArray(n),p=new xr(t[i].x,(t[i].y+t[i+1].y)/2),e=new xr(t[i+1].x,(t[i].y+t[i+1].y)/2),e=[(t.splice(i+1,0,p,e),h.push(["s2","s2_2",t]),(p=xr.cloneArray(n))[i].x+20),p[i+1].x+20],c&&e.push(c.br[0]+20),u&&e.push(u.br[0]+20),t=this.max(e),e=new xr(t,p[i].y),t=new xr(t,p[i+1].y),t=[(p.splice(i+1,0,e,t),h.push(["s2","s2_3",p]),(e=xr.cloneArray(n))[i].y-20),e[i+1].y-20],c&&t.push(c.tl[1]-20),u&&t.push(u.tl[1]-20),p=this.min(t),t=new xr(e[i].x,p),p=new xr(e[i+1].x,p),p=[(e.splice(i+1,0,t,p),h.push(["s2","s2_4",e]),(t=xr.cloneArray(n))[i].x-20),t[i+1].x-20],c&&p.push(c.tl[0]-20),u&&p.push(u.tl[0]-20),e=this.min(p),p=new xr(e,t[i].y),e=new xr(e,t[i+1].y),e=[(t.splice(i+1,0,p,e),h.push(["s2","s2_5",t]),(p=xr.cloneArray(n))[i].y+20),p[i+1].y+20],c&&e.push(c.tl[1]+c.height+20),u&&e.push(u.tl[1]+u.height+20),t=this.max(e),n=new xr(p[i].x,t),e=new xr(p[i+1].x,t),p.splice(i+1,0,n,e),h.push(["s2","s2_6",p]);for(var y=[],v=0;v<h.length;v++){var g=h[v][2];this.orthogonalPath(g)&&y.push(h[v])}if(h=y,!r.equals(o)){for(var C=[],m=0;m<h.length;m++){var b=h[m][2];this.forwardPath(b)&&C.push(h[m])}(h=C).length}for(var _=[],k=0;k<h.length;k++){var P=!1,x=h[k][2].slice();(u||c)&&(x=x.slice(1,x.length-1)),c&&(P=P||this.polylineIntersectsRectangle(x,c)),(P=u?P||this.polylineIntersectsRectangle(x,u):P)||_.push(h[k])}(h=0!=_.length?_:h).length;for(var w=h[0][2].length,E=[],S=0;S<h.length;S++)h[S][2].length==w&&E.push(h[S]);for(var h=E,I=0,O=0;O<h.length;O++)this.scorePath(h[I][2])<this.scorePath(h[O][2])&&(I=O);return[h[I]]}},{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 wr(new xr(e.x1,e.y1),new xr(e.x2,e.y1))),i.push(new wr(new xr(e.x2,e.y1),new xr(e.x2,e.y2))),i.push(new wr(new xr(e.x2,e.y2),new xr(e.x1,e.y2))),i.push(new wr(new xr(e.x1,e.y2),new xr(e.x1,e.y1)));for(var r=0;r<t.length-1;r++)for(var o=new wr(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 wr(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 Hi(t.startPoint)&&(t.startPoint=[0,0]),Hi(t.endPoint)&&(t.endPoint=[10,10]),t.points=[_toConsumableArray(t.startPoint),_toConsumableArray(t.endPoint)],_objectSpread2({escapeDistance:30},t)}}]),ICEVisioLink}(),jr=function(){_inherits(ICEIsogon,Er);var e=_createSuper(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,e.call(this,t)}return _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){Hi(t.radius)?Hi(t.width)?Hi(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}(),Ar=(!function(){_inherits(ICERose,Er);var e=_createSuper(ICERose);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,e.call(this,t)}_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){Hi(t.radius)?Hi(t.width)?Hi(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)}}])}(),function(){_inherits(ICEStar,Er);var e=_createSuper(ICEStar);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,e.call(this,t)}return _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){Hi(t.outerRadius)?Hi(t.width)?Hi(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)}}]),ICEStar}()),Br="__ICE_UTILS_TEXT_MEASURE_DIV__",Tr=function(){_inherits(ICEText,Li);var e=_createSuper(ICEText);function ICEText(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEText),(t=ti({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=e.call(this,t)).measureText(),t}return _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(Br))){(e=this.root.document.createElement("div")).setAttribute("id",Br);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,h={width:e.offsetWidth+a+l,height:e.offsetHeight+o+s};return this.props.width=h.width,this.props.height=h.height,this.state.width=h.width,this.state.height=h.height,{width:this.state.width,height:this.state.height}}catch(t){console.error(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)}}]),ICEText}(),Lr={ICERect:zi,ICECircle:qi,ICEEllipse:Vi,ICEStar:Ar,ICEIsogon:jr,ICEText:Tr,ICEImage:Ir,ICEGroup:Ni,ICEVisioLink:$r,ICEPolyLine:Or},Rr=function(){function DDManager(t){_classCallCheck(this,DDManager),this.ice=t}return _createClass(DDManager,[{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.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this),this}},{key:"mouseDownHandler",value:function mouseDownHandler(t){(t=t.target).ice?t.state.interactive&&t.state.draggable&&(this.currentObj=t,this.ice.evtBus.on("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.on("mouseup",this.mouseUpHandler,this)):console.warn("DDManager: 点击在 canvas 画布上,没有点击任何图形。")}},{key:"mouseMoveHandler",value:function mouseMoveHandler(t){var e=t.movementX,n=t.movementY;return this.currentObj.moveGlobalPosition(e,n,t),!0}},{key:"mouseUpHandler",value:function mouseUpHandler(t){this.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this)}}]),DDManager}(),zr={evtBuses:[],start:function start(){if(ri&&ri.addEventListener){function Ep(t){for(var n=zr.evtBuses[t],e=0;e<_r.length;e++)!function Ip(t){var e=_r[t];ri.addEventListener(e[0],function(t){n.trigger(e[1],t)})}(e)}for(var t=0;t<zr.evtBuses.length;t++)Ep(t)}},regitserEvtBus:function regitserEvtBus(t){zr.evtBuses.includes(t)||zr.evtBuses.push(t)},delEvtBus:function delEvtBus(t){zr.evtBuses.includes(t)&&zr.evtBuses.splice(zr.evtBuses.indexOf(t),1)}},Nr={evtBuses:[],stopped:!1,frameCallback:function frameCallback(){for(var t=0;t<Nr.evtBuses.length;t++){if(Nr.stopped)return;Nr.evtBuses[t].trigger(P)}Nr.stopped||ri.requestFrame(Nr.frameCallback)},start:function start(){Nr.stopped=!1,ri.requestFrame(Nr.frameCallback)},stop:function stop(){Nr.stopped=!0},pause:function pause(){},resume:function resume(){},regitserEvtBus:function regitserEvtBus(t){Nr.evtBuses.includes(t)||Nr.evtBuses.push(t)},delEvtBus:function delEvtBus(t){Nr.evtBuses.includes(t)&&Nr.evtBuses.splice(Nr.evtBuses.indexOf(t),1)}},Dr=function(){function ICELinkSlotManager(t){_classCallCheck(this,ICELinkSlotManager),_defineProperty$1(this,"slotRadius",10),this.ice=t}return _createClass(ICELinkSlotManager,[{key:"start",value:function start(){return this.createLinkSlots(),this.ice.evtBus.on($,this.hookMouseMoveHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off($,this.hookMouseMoveHandler,this),this}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){for(var e=t.target.getMaxBoundingBox(),n=_toConsumableArray(this.ice.childNodes),i=0;i<n.length;i++){var r=n[i];if(r&&r.state.linkable&&r.getMaxBoundingBox().isIntersect(e)){for(var o=0;o<this.ice._linkSlots.length;o++)this.ice._linkSlots[o].hostComponent=r;return}}}},{key:"createLinkSlots",value:function createLinkSlots(){var t,e,n,i;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new Mr({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"T",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(t),e=new Mr({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"R",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(e),n=new Mr({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"B",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(n),i=new Mr({zIndex:1e7,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}(),Hr=function(){function Deserializer(t){_classCallCheck(this,Deserializer),this.ice=t}return _createClass(Deserializer,[{key:"fromJSON",value:function fromJSON(t){for(var e=JSON.parse(t).childNodes,n=0;n<e.length;n++)this.decodeRecursively(this.ice,e[n])}},{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}(),Vr=function(){function Serializer(t){_classCallCheck(this,Serializer),this.ice=t}return _createClass(Serializer,[{key:"toJSON",value:function toJSON(){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 console.log(t),JSON.stringify(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}(),qr=function(){_inherits(CanvasRenderer,Ai);var n=_createSuper(CanvasRenderer);function CanvasRenderer(t){var e;return _classCallCheck(this,CanvasRenderer),_defineProperty$1(_assertThisInitialized(e=n.call(this)),"stopped",!1),_defineProperty$1(_assertThisInitialized(e),"componentQueue",[]),_defineProperty$1(_assertThisInitialized(e),"toolsQueue",[]),e.ice=t,e}return _createClass(CanvasRenderer,[{key:"start",value:function start(){return this.stopped=!1,this.ice.evtBus.on(P,this.frameEvtHandler,this),this}},{key:"stop",value:function stop(){return this.stopped=!0,this.ice.evtBus.off(P,this.frameEvtHandler,this),this}},{key:"frameEvtHandler",value:function frameEvtHandler(t){this.ice.dirty?this.doRender():console.log("没有需要渲染的组件...")}},{key:"refreshQueue",value:function refreshQueue(){this.componentQueue=flattenTree([],this.ice.childNodes),this.componentQueue.sort(function(t,e){return t.state.zIndex-e.state.zIndex}),console.log("Component Queue length> ".concat(this.componentQueue.length)),this.toolsQueue=flattenTree([],this.ice.toolNodes),console.log("Tool Queue length> ".concat(this.ice.toolNodes.length))}},{key:"doRender",value:function doRender(){var t=Date.now();this.refreshQueue(),this.ice.ctx.clearRect(0,0,this.ice.canvasWidth,this.ice.canvasHeight);for(var e=0;e<this.componentQueue.length;e++){var n=this.componentQueue[e];n.root=this.ice.root,n.ctx=this.ice.ctx,n.evtBus=this.ice.evtBus,n.ice=this.ice,n.render()}for(var i=0;i<this.toolsQueue.length;i++){var r=this.toolsQueue[i];r.root=this.ice.root,r.ctx=this.ice.ctx,r.evtBus=this.ice.evtBus,r.ice=this.ice,r.render()}console.log("Render time ".concat(Date.now()-t," ms.")),this.ice.dirty=!1,this.ice.evtBus.trigger(O)}}]),CanvasRenderer}(),Fr=function(){function ImageCache(t){_classCallCheck(this,ImageCache),_defineProperty$1(this,"imageCache",new Map),this.ice=t}return _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(){console.error("ImageCache: 图片加载失败:",t)},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}(),Ur=(_defineProperty$1(Fr,"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 Lr)this.typeMapping[e]=Lr[e];return this.root=ri,_(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 Pr,Nr.regitserEvtBus(this.evtBus),Nr.start(),zr.regitserEvtBus(this.evtBus),zr.start(),this.eventBridge=new kr(this).start(),this.animationManager=new N(this).start(),this.ddManager=new Rr(this).start(),this.controlPanelManager=new br(this).start(),this.renderer=new qr(this).start(),this.linkSlotManager=new Dr(this).start(),this.serializer=new Vr(this),this.deserializer=new Hr(this),this.imageCache=new Fr(this),this}},{key:"addTool",value:function addTool(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(E,null,{component:t}),t.trigger(E),t.ice=this,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(S,null,{component:t}),t.trigger(S))}},{key:"removeTool",value:function removeTool(t){this.evtBus.trigger(I,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(E,null,{component:t}),t.trigger(E),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(S,null,{component:t}),t.trigger(S))}},{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(I,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:"toJSON",value:function toJSON(){return this.serializer.toJSON()}},{key:"fromJSON",value:function fromJSON(t){var e=this,n=Date.now();Nr.stop(),this.renderer.stop(),this.eventBridge.stopped=!0,this.animationManager.stop(),this.ddManager.stop(),this.controlPanelManager.stop(),this.linkSlotManager.stop(),this.clearAll(),this.deserializer.fromJSON(t),Nr.start(),this.renderer.start(),this.animationManager.start(),this.ddManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(function(){e.eventBridge.stopped=!1},300),t=Date.now(),console.log("fromJSON> ".concat(t-n," ms"))}}]),"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}),Xr=function isNil(t){return null==t},Gr=function listCacheClear$1(){this.__data__=[],this.size=0},Wr=function eq$4(t,e){return t===e||t!=t&&e!=e},Jr=Wr,Kr=function assocIndexOf$4(t,e){for(var n=t.length;n--;)if(Jr(t[n][0],e))return n;return-1},Qr=Kr,Zr=Array.prototype.splice,Yr=Kr,to=Kr,eo=Kr,no=Gr,io=function listCacheDelete$1(t){var e=this.__data__,t=Qr(e,t);return!(t<0||(t==e.length-1?e.pop():Zr.call(e,t,1),--this.size,0))},ro=function listCacheGet$1(t){var e=this.__data__,t=Yr(e,t);return t<0?void 0:e[t][1]},oo=function listCacheHas$1(t){return-1<to(this.__data__,t)},so=function listCacheSet$1(t,e){var n=this.__data__,i=eo(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this};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=no,ListCache$4.prototype.delete=io,ListCache$4.prototype.get=ro,ListCache$4.prototype.has=oo,ListCache$4.prototype.set=so;var Ao,ao=ListCache$4,lo=ao,ho=function stackClear$1(){this.__data__=new lo,this.size=0},co=function stackDelete$1(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t},uo=function stackGet$1(t){return this.__data__.get(t)},fo=function stackHas$1(t){return this.__data__.has(t)},po="object"==typeof Ur&&Ur&&Ur.Object===Object&&Ur,yo=po,vo="object"==typeof self&&self&&self.Object===Object&&self,go=yo||vo||Function("return this")(),Co=go.Symbol,mo=Co,bo=Object.prototype,_o=bo.hasOwnProperty,ko=bo.toString,Po=mo?mo.toStringTag:void 0,wo=function getRawTag$1(t){var e=_o.call(t,Po),n=t[Po];try{var i=!(t[Po]=void 0)}catch(t){}var r=ko.call(t);return i&&(e?t[Po]=n:delete t[Po]),r},xo=Object.prototype.toString,Eo=wo,So=function objectToString$1(t){return xo.call(t)},Io=Co?Co.toStringTag:void 0,Oo=function baseGetTag$4(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(Io&&Io in Object(t)?Eo:So)(t)},Mo=function isObject$7(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},$o=Oo,jo=Mo,Bo=function isFunction$3(t){if(!jo(t))return!1;t=$o(t);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},To=go["__core-js_shared__"],Lo=(Ao=/[^.]+$/.exec(To&&To.keys&&To.keys.IE_PROTO||""))?"Symbol(src)_1."+Ao:"",Ro=function isMasked$1(t){return!!Lo&&Lo in t},zo=Function.prototype.toString,No=Bo,Do=Ro,Ho=Mo,Vo=function toSource$1(t){if(null!=t){try{return zo.call(t)}catch(t){}try{return t+""}catch(t){}}return""},qo=/^\[object .+?Constructor\]$/,Fo=Function.prototype,Uo=Object.prototype,Xo=Fo.toString,Go=Uo.hasOwnProperty,Wo=RegExp("^"+Xo.call(Go).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Jo=function baseIsNative$1(t){return!(!Ho(t)||Do(t))&&(No(t)?Wo:qo).test(Vo(t))},Ko=function getValue$1(t,e){return null==t?void 0:t[e]},Qo=function getNative$3(t,e){t=Ko(t,e);return Jo(t)?t:void 0},Zo=Qo(go,"Map"),Yo=Qo(Object,"create"),ts=Yo,es=function hashClear$1(){this.__data__=ts?ts(null):{},this.size=0},ns=function hashDelete$1(t){t=this.has(t)&&delete this.__data__[t];return this.size-=t?1:0,t},is=Yo,rs=Object.prototype.hasOwnProperty,os=function hashGet$1(t){var e,n=this.__data__;return is?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:rs.call(n,t)?n[t]:void 0},ss=Yo,as=Object.prototype.hasOwnProperty,ls=Yo,hs=es,cs=ns,us=os,ds=function hashHas$1(t){var e=this.__data__;return ss?void 0!==e[t]:as.call(e,t)},fs=function hashSet$1(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ls&&void 0===e?"__lodash_hash_undefined__":e,this};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=hs,Hash$1.prototype.delete=cs,Hash$1.prototype.get=us,Hash$1.prototype.has=ds,Hash$1.prototype.set=fs;var ps=Hash$1,ys=ao,vs=Zo,gs=function isKeyable$1(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t},Cs=function getMapData$4(t,e){t=t.__data__;return gs(e)?t["string"==typeof e?"string":"hash"]:t.map},ms=Cs,bs=Cs,_s=Cs,ks=Cs,Ps=function mapCacheClear$1(){this.size=0,this.__data__={hash:new ps,map:new(vs||ys),string:new ps}},ws=function mapCacheDelete$1(t){t=ms(this,t).delete(t);return this.size-=t?1:0,t},xs=function mapCacheGet$1(t){return bs(this,t).get(t)},Es=function mapCacheHas$1(t){return _s(this,t).has(t)},Ss=function mapCacheSet$1(t,e){var n=ks(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};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=Ps,MapCache$1.prototype.delete=ws,MapCache$1.prototype.get=xs,MapCache$1.prototype.has=Es,MapCache$1.prototype.set=Ss;var Is=ao,Os=Zo,Ms=MapCache$1,$s=ao,js=ho,As=co,Bs=uo,Ts=fo,Ls=function stackSet$1(t,e){var n=this.__data__;if(n instanceof Is){var i=n.__data__;if(!Os||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new Ms(i)}return n.set(t,e),this.size=n.size,this};function Stack$1(t){t=this.__data__=new $s(t);this.size=t.size}Stack$1.prototype.clear=js,Stack$1.prototype.delete=As,Stack$1.prototype.get=Bs,Stack$1.prototype.has=Ts,Stack$1.prototype.set=Ls;var Rs=Stack$1,zs=Qo,Ns=function(){try{var t=zs(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Ds=Ns,Hs=function baseAssignValue$3(t,e,n){"__proto__"==e&&Ds?Ds(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},Vs=Hs,qs=Wr,Fs=function assignMergeValue$2(t,e,n){(void 0===n||qs(t[e],n))&&(void 0!==n||e in t)||Vs(t,e,n)},Us=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}}(),Xs={exports:{}},Gs=(!function(t,e){var e=e&&!e.nodeType&&e,n=e&&t&&!t.nodeType&&t,n=n&&n.exports===e?go.Buffer:void 0,i=n?n.allocUnsafe:void 0;t.exports=function cloneBuffer(t,e){if(e)return t.slice();e=t.length,e=i?i(e):new t.constructor(e);return t.copy(e),e}}(Xs,Xs.exports),go.Uint8Array),Ws=function cloneArrayBuffer$1(t){var e=new t.constructor(t.byteLength);return new Gs(e).set(new Gs(t)),e},Js=function cloneTypedArray$1(t,e){e=e?Ws(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)},Ks=function copyArray$1(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e},Qs=Mo,Zs=Object.create,Ys=function(){function object(){}return function(t){if(!Qs(t))return{};if(Zs)return Zs(t);object.prototype=t;t=new object;return object.prototype=void 0,t}}(),ta=function overArg$1(e,n){return function(t){return e(n(t))}}(Object.getPrototypeOf,Object),ea=Object.prototype,na=function isPrototype$2(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||ea)},ia=Ys,ra=ta,oa=na,sa=function initCloneObject$1(t){return"function"!=typeof t.constructor||oa(t)?{}:ia(ra(t))},aa=function isObjectLike$5(t){return null!=t&&"object"==typeof t},la=Oo,ha=aa,ca=function baseIsArguments$1(t){return ha(t)&&"[object Arguments]"==la(t)},ua=aa,da=Object.prototype,fa=da.hasOwnProperty,pa=da.propertyIsEnumerable,ya=ca(function(){return arguments}())?ca:function(t){return ua(t)&&fa.call(t,"callee")&&!pa.call(t,"callee")},va=Array.isArray,ga=function isLength$2(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991},Ca=Bo,ma=ga,ba=function isArrayLike$3(t){return null!=t&&ma(t.length)&&!Ca(t)},_a=ba,ka=aa,Pa=function isArrayLikeObject$1(t){return ka(t)&&_a(t)},wa={exports:{}},xa=function stubFalse(){return!1},Ea=(!function(t,e){var e=e&&!e.nodeType&&e,n=e&&t&&!t.nodeType&&t,n=n&&n.exports===e?go.Buffer:void 0,e=(n?n.isBuffer:void 0)||xa;t.exports=e}(wa,wa.exports),Oo),Sa=ta,Ia=aa,Oa=Function.prototype,Ma=Object.prototype,$a=Oa.toString,ja=Ma.hasOwnProperty,Aa=$a.call(Object),Ba=function isPlainObject$1(t){if(!Ia(t)||"[object Object]"!=Ea(t))return!1;t=Sa(t);if(null===t)return!0;t=ja.call(t,"constructor")&&t.constructor;return"function"==typeof t&&t instanceof t&&$a.call(t)==Aa},Ta=Oo,La=ga,Ra=aa,za={},Na=(za["[object Float32Array]"]=za["[object Float64Array]"]=za["[object Int8Array]"]=za["[object Int16Array]"]=za["[object Int32Array]"]=za["[object Uint8Array]"]=za["[object Uint8ClampedArray]"]=za["[object Uint16Array]"]=za["[object Uint32Array]"]=!0,za["[object Arguments]"]=za["[object Array]"]=za["[object ArrayBuffer]"]=za["[object Boolean]"]=za["[object DataView]"]=za["[object Date]"]=za["[object Error]"]=za["[object Function]"]=za["[object Map]"]=za["[object Number]"]=za["[object Object]"]=za["[object RegExp]"]=za["[object Set]"]=za["[object String]"]=za["[object WeakMap]"]=!1,function baseIsTypedArray$1(t){return Ra(t)&&La(t.length)&&!!za[Ta(t)]}),Da=function baseUnary$1(e){return function(t){return e(t)}},Ha={exports:{}},Va=(!function(t,e){var e=e&&!e.nodeType&&e,n=e&&t&&!t.nodeType&&t,i=n&&n.exports===e&&po.process,e=function(){try{return n&&n.require&&n.require("util").types||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=e}(Ha,Ha.exports),Na),qa=Da,Fa=Ha.exports,Ua=Fa&&Fa.isTypedArray,Xa=Ua?qa(Ua):Va,Ga=function safeGet$2(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Wa=Hs,Ja=Wr,Ka=Object.prototype.hasOwnProperty,Qa=function assignValue$1(t,e,n){var i=t[e];Ka.call(t,e)&&Ja(i,n)&&(void 0!==n||e in t)||Wa(t,e,n)},Za=Hs,Ya=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?Za:Qa)(n,a,l)}return n},tl=/^(?:0|[1-9]\d*)$/,el=function isIndex$2(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&tl.test(t))&&-1<t&&t%1==0&&t<e},nl=function baseTimes$1(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i},il=ya,rl=va,ol=wa.exports,sl=el,al=Xa,ll=Object.prototype.hasOwnProperty,hl=function arrayLikeKeys$1(t,e){var n,i=rl(t),r=!i&&il(t),o=!i&&!r&&ol(t),s=!i&&!r&&!o&&al(t),a=i||r||o||s,l=a?nl(t.length,String):[],h=l.length;for(n in t)!e&&!ll.call(t,n)||a&&("length"==n||o&&("offset"==n||"parent"==n)||s&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||sl(n,h))||l.push(n);return l},cl=Mo,ul=na,dl=function nativeKeysIn$1(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},fl=Object.prototype.hasOwnProperty,pl=hl,yl=function baseKeysIn$1(t){if(!cl(t))return dl(t);var e,n=ul(t),i=[];for(e in t)("constructor"!=e||!n&&fl.call(t,e))&&i.push(e);return i},vl=ba,gl=function keysIn$2(t){return vl(t)?pl(t,!0):yl(t)},Cl=Ya,ml=gl,bl=Fs,_l=Xs.exports,kl=Js,Pl=Ks,wl=sa,xl=ya,El=va,Sl=Pa,Il=wa.exports,Ol=Bo,Ml=Mo,$l=Ba,jl=Xa,Al=Ga,Bl=function toPlainObject$1(t){return Cl(t,ml(t))},Tl=Rs,Ll=Fs,Rl=Us,zl=function baseMergeDeep$1(t,e,n,i,r,o,s){var a,l,h,c=Al(t,n),u=Al(e,n),d=s.get(u);d?bl(t,n,d):((e=void 0===(d=o?o(c,u,n+"",t,e,s):void 0))&&(l=!(a=El(u))&&Il(u),h=!a&&!l&&jl(u),d=u,a||l||h?d=El(c)?c:Sl(c)?Pl(c):l?_l(u,!(e=!1)):h?kl(u,!(e=!1)):[]:$l(u)||xl(u)?xl(d=c)?d=Bl(c):Ml(c)&&!Ol(c)||(d=wl(u)):e=!1),e&&(s.set(u,d),r(d,u,i,o,s),s.delete(u)),bl(t,n,d))},Nl=Mo,Dl=gl,Hl=Ga,Vl=function baseMerge$1(i,r,o,s,a){i!==r&&Rl(r,function(t,e){var n;a=a||new Tl,Nl(t)?zl(i,r,e,o,baseMerge$1,s,a):(n=s?s(Hl(i,e),t,e+"",i,r,a):void 0,Ll(i,e,n=void 0===n?t:n))},Dl)},ql=function identity$2(t){return t},Fl=function apply$1(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)},Ul=Math.max,Xl=function overRest$1(o,s,a){return s=Ul(void 0===s?o.length-1:s,0),function(){for(var t=arguments,e=-1,n=Ul(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),Fl(o,this,r)}},Gl=function constant$1(t){return function(){return t}},Wl=Ns,Jl=Wl?function(t,e){return Wl(t,"toString",{configurable:!0,enumerable:!1,value:Gl(e),writable:!0})}:ql,Kl=Date.now,Ql=function shortOut$1(n){var i=0,r=0;return function(){var t=Kl(),e=16-(t-r);if(r=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(Jl),Zl=ql,Yl=Xl,th=Ql,eh=Wr,nh=ba,ih=el,rh=Mo,oh=function baseRest$1(t,e){return th(Yl(t,e,Zl),t+"")},sh=function isIterateeCall$1(t,e,n){if(!rh(n))return!1;var i=typeof e;return!!("number"==i?nh(n)&&ih(e,n.length):"string"==i&&e in n)&&eh(n[e],t)},ah=Vl,lh=function createAssigner$1(a){return oh(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&&sh(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){ah(t,e,n)}),hh=function(){!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)}(Entity,Ni);var e=_createSuper$1(Entity);function Entity(t){_classCallCheck$1(this,Entity);var t=Entity.arrangeParam(t);return function _defineProperty$2(t,e,n){e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}(_assertThisInitialized$1(t=e.call(this,t)),"entityFieldsComponent",[]),t}return _createClass$1(Entity,[{key:"doRender",value:function doRender(){this.dirty&&this.syncEntityNameAndFields(),this.doLayout(),_get$1(_getPrototypeOf$1(Entity.prototype),"doRender",this).call(this)}},{key:"syncEntityNameAndFields",value:function syncEntityNameAndFields(){if(this.state.entityName&&(this.entityNameComponent||(this.entityNameComponent=new Tr({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||(this.deviderLine=new Or({left:0,top:0,points:[[0,0],[this.state.width,0]],style:{strokeStyle:"#333",fillStyle:"#333",lineWidth:2},interactive:!1}),this.addChild(this.deviderLine))),!Xr(this.state.fields)&&!this.entityFieldsComponent.length){for(var t=this.state.fields.length,e=0;e<t;e++){var n=this.state.fields[e],n=new Tr({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:"doLayout",value:function doLayout(){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]]}),this.setState({height:Math.max(e,this.state.height),width:t})}}],[{key:"arrangeParam",value:function arrangeParam(t){t=lh({entityName:"Entity Name",fields:[],style:{strokeStyle:"#000",fillStyle:"#00eeff"}},t,{transformable:!1});return Xr(t.entityName)&&(t.entityName="Entity Name"),Xr(t.fields)&&(t.fields=[]),t}}]),Entity}(),ch=_createClass$1(function Relation(){_classCallCheck$1(this,Relation)});exports.Entity=hh,exports.Relation=ch;
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2022 大漠穷秋
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ 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){return e&&_defineProperties$1(t.prototype,e),n&&_defineProperties$1(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}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 _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)}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 _possibleConstructorReturn$1(this,i?(t=_getPrototypeOf$1(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _superPropBase$1(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf$1(t)););return t}function _get$1(){return(_get$1="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,e,n){var i=_superPropBase$1(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 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){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}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 _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)}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 _possibleConstructorReturn(this,i?(t=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _superPropBase(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}function _get(){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,e,n){var i=_superPropBase(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}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e="object"==typeof t&&t&&t.Object===Object&&t,n=e,i="object"==typeof self&&self&&self.Object===Object&&self,r=n||i||Function("return this")(),o=r.Symbol,s=o,a=Object.prototype,l=a.hasOwnProperty,h=a.toString,c=s?s.toStringTag:void 0,u=Object.prototype.toString,d=function getRawTag$1(t){var e=l.call(t,c),n=t[c];try{var i=!(t[c]=void 0)}catch(t){}var r=h.call(t);return i&&(e?t[c]=n:delete t[c]),r},f=function objectToString$1(t){return u.call(t)},p=o?o.toStringTag:void 0,y=function baseGetTag$7(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(p&&p in Object(t)?d:f)(t)},v=Array.isArray,g=function isObjectLike$7(t){return null!=t&&"object"==typeof t},C=y,m=v,b=g,_=function isString(t){return"string"==typeof t||!m(t)&&b(t)&&"[object String]"==C(t)},k=function isUndefined(t){return void 0===t},P="ICE_FRAME_EVENT",w="BEFORE_RENDER",x="AFTER_RENDER",E="BEFORE_ADD",S="AFTER_ADD",I="BEFORE_REMOVE",O="ROUND_FINISH",M="HOOK_MOUSEDOWN",$="HOOK_MOUSEMOVE",j="HOOK_MOUSEUP",A="BEFORE_RESIZE",B="AFTER_RESIZE",T="AFTER_ROTATE",L="BEFORE_MOVE",R="AFTER_MOVE",z={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}},N=function(){function AnimationManager(t){_classCallCheck(this,AnimationManager),_defineProperty$1(this,"animationMap",new Map),this.ice=t}return _createClass(AnimationManager,[{key:"start",value:function start(){return this.ice.evtBus.on(P,this.frameEventHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(P,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<(k(o.startTime)&&(o.startTime=Date.now()),k(o.easing)&&(o.easing="linear"),s=z[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){_(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}}]),AnimationManager}(),D=function eq$4(t,e){return t===e||t!=t&&e!=e},H=D,V=function assocIndexOf$4(t,e){for(var n=t.length;n--;)if(H(t[n][0],e))return n;return-1},q=V,F=Array.prototype.splice,U=V,X=V,G=V,W=function listCacheClear$1(){this.__data__=[],this.size=0};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=W,ListCache$4$1.prototype.delete=function listCacheDelete$1(t){var e=this.__data__;return!((t=q(e,t))<0||(t==e.length-1?e.pop():F.call(e,t,1),--this.size,0))},ListCache$4$1.prototype.get=function listCacheGet$1(t){var e=this.__data__;return(t=U(e,t))<0?void 0:e[t][1]},ListCache$4$1.prototype.has=function listCacheHas$1(t){return-1<X(this.__data__,t)},ListCache$4$1.prototype.set=function listCacheSet$1(t,e){var n=this.__data__,i=G(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this};var J,K=ListCache$4$1,Q=K,Z=function isObject$8(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Y=y,tt=Z,et=function isFunction$3(t){return!!tt(t)&&("[object Function]"==(t=Y(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)},nt=r["__core-js_shared__"],it=(J=/[^.]+$/.exec(nt&&nt.keys&&nt.keys.IE_PROTO||""))?"Symbol(src)_1."+J:"",rt=Function.prototype.toString,ot=function toSource$2(t){if(null!=t){try{return rt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},st=et,at=function isMasked$1(t){return!!it&&it in t},lt=Z,ht=ot,ct=/^\[object .+?Constructor\]$/,ut=Function.prototype,dt=Object.prototype,ft=ut.toString,pt=dt.hasOwnProperty,yt=RegExp("^"+ft.call(pt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),vt=function getNative$7(t,e){return function baseIsNative$1(t){return lt(t)&&!at(t)&&(st(t)?yt:ct).test(ht(t))}(t=function getValue$1(t,e){return null==t?void 0:t[e]}(t,e))?t:void 0},gt=vt(r,"Map"),Ct=vt(Object,"create"),mt=Ct,bt=Ct,_t=Object.prototype.hasOwnProperty,kt=Ct,Pt=Object.prototype.hasOwnProperty,wt=Ct,xt=function hashClear$1(){this.__data__=mt?mt(null):{},this.size=0},Et=function hashDelete$1(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},St=function hashGet$1(t){var e,n=this.__data__;return bt?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:_t.call(n,t)?n[t]:void 0};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=xt,Hash$1$1.prototype.delete=Et,Hash$1$1.prototype.get=St,Hash$1$1.prototype.has=function hashHas$1(t){var e=this.__data__;return kt?void 0!==e[t]:Pt.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]=wt&&void 0===e?"__lodash_hash_undefined__":e,this};var It=Hash$1$1,Ot=K,Mt=gt,$t=function getMapData$4(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},jt=$t,At=$t,Bt=$t,Tt=$t;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 It,map:new(Mt||Ot),string:new It}},MapCache$1$1.prototype.delete=function mapCacheDelete$1(t){return t=jt(this,t).delete(t),this.size-=t?1:0,t},MapCache$1$1.prototype.get=function mapCacheGet$1(t){return At(this,t).get(t)},MapCache$1$1.prototype.has=function mapCacheHas$1(t){return Bt(this,t).has(t)},MapCache$1$1.prototype.set=function mapCacheSet$1(t,e){var n=Tt(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};var Lt=K,Rt=gt,zt=MapCache$1$1,Nt=K,Dt=function stackClear$1(){this.__data__=new Q,this.size=0},Ht=function stackDelete$1(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},Vt=function stackGet$1(t){return this.__data__.get(t)},qt=function stackHas$1(t){return this.__data__.has(t)};function Stack$1$1(t){t=this.__data__=new Nt(t),this.size=t.size}Stack$1$1.prototype.clear=Dt,Stack$1$1.prototype.delete=Ht,Stack$1$1.prototype.get=Vt,Stack$1$1.prototype.has=qt,Stack$1$1.prototype.set=function stackSet$1(t,e){var n=this.__data__;if(n instanceof Lt){var i=n.__data__;if(!Rt||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new zt(i)}return n.set(t,e),this.size=n.size,this};var Ft=Stack$1$1,Ut=vt,Xt=function(){try{var t=Ut(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Gt=Xt,Wt=function baseAssignValue$3(t,e,n){"__proto__"==e&&Gt?Gt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},Jt=Wt,Kt=D,Qt=function assignMergeValue$2(t,e,n){(void 0===n||Kt(t[e],n))&&(void 0!==n||e in t)||Jt(t,e,n)},Zt=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}}(),Yt={exports:{}},te=(function(t,e){var n,i=(n=(n=(e=e&&!e.nodeType&&e)&&t&&!t.nodeType&&t)&&n.exports===e?r.Buffer:void 0)?n.allocUnsafe:void 0;t.exports=function cloneBuffer(t,e){return e?t.slice():(e=t.length,e=i?i(e):new t.constructor(e),t.copy(e),e)}}(Yt,Yt.exports),r.Uint8Array),ee=Z,ne=Object.create,ie=function(){function object(){}return function(t){return ee(t)?ne?ne(t):(object.prototype=t,t=new object,object.prototype=void 0,t):{}}}(),re=function overArg$2(e,n){return function(t){return e(n(t))}},oe=re(Object.getPrototypeOf,Object),se=Object.prototype,ae=function isPrototype$4(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||se)},le=ie,he=oe,ce=ae,ue=y,de=g,fe=function baseIsArguments$1(t){return de(t)&&"[object Arguments]"==ue(t)},pe=g,ye=Object.prototype,ve=ye.hasOwnProperty,ge=ye.propertyIsEnumerable,Ce=fe(function(){return arguments}())?fe:function(t){return pe(t)&&ve.call(t,"callee")&&!ge.call(t,"callee")},me=function isLength$2(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991},be=et,_e=me,ke=function isArrayLike$4(t){return null!=t&&_e(t.length)&&!be(t)},Pe=ke,we=g,xe={exports:{}},Ee=function stubFalse(){return!1},Se=(function(t,e){var n;e=((n=(n=(e=e&&!e.nodeType&&e)&&t&&!t.nodeType&&t)&&n.exports===e?r.Buffer:void 0)?n.isBuffer:void 0)||Ee,t.exports=e}(xe,xe.exports),y),Ie=oe,Oe=g,Me=Function.prototype,$e=Object.prototype,je=Me.toString,Ae=$e.hasOwnProperty,Be=je.call(Object),Te=y,Le=me,Re=g,ze={},Ne=(ze["[object Float32Array]"]=ze["[object Float64Array]"]=ze["[object Int8Array]"]=ze["[object Int16Array]"]=ze["[object Int32Array]"]=ze["[object Uint8Array]"]=ze["[object Uint8ClampedArray]"]=ze["[object Uint16Array]"]=ze["[object Uint32Array]"]=!0,ze["[object Arguments]"]=ze["[object Array]"]=ze["[object ArrayBuffer]"]=ze["[object Boolean]"]=ze["[object DataView]"]=ze["[object Date]"]=ze["[object Error]"]=ze["[object Function]"]=ze["[object Map]"]=ze["[object Number]"]=ze["[object Object]"]=ze["[object RegExp]"]=ze["[object Set]"]=ze["[object String]"]=ze["[object WeakMap]"]=!1,function baseIsTypedArray$1(t){return Re(t)&&Le(t.length)&&!!ze[Te(t)]}),De={exports:{}},He=(function(t,n){var i=(n=n&&!n.nodeType&&n)&&t&&!t.nodeType&&t,r=i&&i.exports===n&&e.process;n=function(){try{return i&&i.require&&i.require("util").types||r&&r.binding&&r.binding("util")}catch(t){}}(),t.exports=n}(De,De.exports),Ne),Ve=function baseUnary$1(e){return function(t){return e(t)}},qe=De.exports,Fe=qe&&qe.isTypedArray,Ue=Fe?Ve(Fe):He,Xe=function safeGet$2(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Ge=Wt,We=D,Je=Object.prototype.hasOwnProperty,Ke=function assignValue$1(t,e,n){var i=t[e];Je.call(t,e)&&We(i,n)&&(void 0!==n||e in t)||Ge(t,e,n)},Qe=Wt,Ze=/^(?:0|[1-9]\d*)$/,Ye=function isIndex$2(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Ze.test(t))&&-1<t&&t%1==0&&t<e},tn=Ce,en=v,nn=xe.exports,rn=Ye,sn=Ue,an=Object.prototype.hasOwnProperty,ln=Z,hn=ae,cn=Object.prototype.hasOwnProperty,un=function arrayLikeKeys$1(t,e){var n,i=en(t),r=!i&&tn(t),o=!i&&!r&&nn(t),s=!i&&!r&&!o&&sn(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):[],h=l.length;for(n in t)!e&&!an.call(t,n)||a&&("length"==n||o&&("offset"==n||"parent"==n)||s&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||rn(n,h))||l.push(n);return l},dn=function baseKeysIn$1(t){if(!ln(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=hn(t),i=[];for(e in t)("constructor"!=e||!n&&cn.call(t,e))&&i.push(e);return i},fn=ke,pn=function keysIn$2(t){return fn(t)?un(t,!0):dn(t)},yn=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?Qe:Ke)(n,a,l)}return n},vn=pn,gn=Qt,Cn=Yt.exports,mn=function cloneTypedArray$1(t,e){return e=e?function cloneArrayBuffer$1(t){var e=new t.constructor(t.byteLength);return new te(e).set(new te(t)),e}(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.length)},bn=function copyArray$1(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e},_n=function initCloneObject$1(t){return"function"!=typeof t.constructor||ce(t)?{}:le(he(t))},kn=Ce,Pn=v,wn=function isArrayLikeObject$1(t){return we(t)&&Pe(t)},xn=xe.exports,En=et,Sn=Z,In=function isPlainObject$1(t){return!(!Oe(t)||"[object Object]"!=Se(t))&&(null===(t=Ie(t))||"function"==typeof(t=Ae.call(t,"constructor")&&t.constructor)&&t instanceof t&&je.call(t)==Be)},On=Ue,Mn=Xe,$n=Ft,jn=Qt,An=Zt,Bn=function baseMergeDeep$1(t,e,n,i,r,o,s){var a,l,h,c=Mn(t,n),u=Mn(e,n),d=s.get(u);d||((e=void 0===(d=o?o(c,u,n+"",t,e,s):void 0))&&(l=!(a=Pn(u))&&xn(u),h=!a&&!l&&On(u),d=u,a||l||h?d=Pn(c)?c:wn(c)?bn(c):l?Cn(u,!(e=!1)):h?mn(u,!(e=!1)):[]:In(u)||kn(u)?kn(d=c)?d=function toPlainObject$1(t){return yn(t,vn(t))}(c):Sn(c)&&!En(c)||(d=_n(u)):e=!1),e&&(s.set(u,d),r(d,u,i,o,s),s.delete(u))),gn(t,n,d)},Tn=Z,Ln=pn,Rn=Xe,zn=function identity$2(t){return t},Nn=function apply$1(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)},Dn=Math.max,Hn=function constant$1(t){return function(){return t}},Vn=Xt,qn=Vn?function(t,e){return Vn(t,"toString",{configurable:!0,enumerable:!1,value:Hn(e),writable:!0})}:zn,Fn=Date.now,Un=function shortOut$1(n){var i=0,r=0;return function(){var t=Fn(),e=16-(t-r);if(r=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(qn),Xn=zn,Gn=function overRest$1(o,s,a){return s=Dn(void 0===s?o.length-1:s,0),function(){for(var t=arguments,e=-1,n=Dn(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),Nn(o,this,r)}},Wn=Un,Jn=D,Kn=ke,Qn=Ye,Zn=Z,Yn=function baseMerge$1(i,r,o,s,a){i!==r&&An(r,function(t,e){var n;a=a||new $n,Tn(t)?Bn(i,r,e,o,baseMerge$1,s,a):(n=s?s(Rn(i,e),t,e+"",i,r,a):void 0,jn(i,e,n=void 0===n?t:n))},Ln)},ti=function createAssigner$1(a){return function baseRest$1(t,e){return Wn(Gn(t,e,Xn),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(Zn(n))return i=typeof e,("number"==i?Kn(n)&&Qn(e,n.length):"string"==i&&e in n)&&Jn(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){Yn(t,e,n)}),ei="undefined"!=typeof Float32Array?Float32Array:Array,ni=Math.PI/180;function toRadian(t){return t*ni}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]),h=n[1],c=n[2],u=n[3],d=n[4];return n=n[5],t[0]=i*l+o*h,t[1]=r*l+s*h,t[2]=i*c+o*u,t[3]=r*c+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 ei(2);ei!=Float32Array&&(t[0]=0,t[1]=0)}();var ii=null,ri=((ii=window||global||{}).requestFrame=ii.requestAnimationFrame||ii.webkitRequestAnimationFrame||ii.mozRequestAnimationFrame||ii.oRequestAnimationFrame||ii.msRequestAnimationFrame,ii),oi=function(){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]}return _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}(),si=re(Object.keys,Object),ai=ae,li=si,hi=Object.prototype.hasOwnProperty,ci=vt(r,"DataView"),ui=gt,di=vt(r,"Promise"),fi=vt(r,"Set"),pi=vt(r,"WeakMap"),yi=y,vi=ot,gi=vi(ci),Ci=vi(ui),mi=vi(di),bi=vi(fi),_i=vi(pi),ki=yi,Pi=((ci&&"[object DataView]"!=ki(new ci(new ArrayBuffer(1)))||ui&&"[object Map]"!=ki(new ui)||di&&"[object Promise]"!=ki(di.resolve())||fi&&"[object Set]"!=ki(new fi)||pi&&"[object WeakMap]"!=ki(new pi))&&(ki=function(t){var e=yi(t);if(t=(t="[object Object]"==e?t.constructor:void 0)?vi(t):"")switch(t){case gi:return"[object DataView]";case Ci:return"[object Map]";case mi:return"[object Promise]";case bi:return"[object Set]";case _i:return"[object WeakMap]"}return e}),function baseKeys$1(t){if(!ai(t))return li(t);var e,n=[];for(e in Object(t))hi.call(t,e)&&"constructor"!=e&&n.push(e);return n}),wi=ki,xi=Ce,Ei=v,Si=ke,Ii=xe.exports,Oi=ae,Mi=Ue,$i=Object.prototype.hasOwnProperty,ji=function isEmpty(t){if(null==t)return!0;if(Si(t)&&(Ei(t)||"string"==typeof t||"function"==typeof t.splice||Ii(t)||Mi(t)||xi(t)))return!t.length;var e,n=wi(t);if("[object Map]"==n||"[object Set]"==n)return!t.size;if(Oi(t))return!Pi(t).length;for(e in t)if($i.call(t,e))return!1;return!0},Ai=function(){function ICEEventTarget(){_classCallCheck(this,ICEEventTarget),_defineProperty$1(this,"listeners",{}),_defineProperty$1(this,"suspendedEventNames",[])}return _createClass(ICEEventTarget,[{key:"on",value:function on(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:ri;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]:ri;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]:ri,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(ji(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;n?((e=new oi(n)).originalEvent=n.originalEvent||n,e.param=_objectSpread2({},i)):e=new oi({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]:ri;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}(),Bi=(Ai.prototype.addEventListener=Ai.prototype.on,Ai.prototype.removeEventListener=Ai.prototype.off,Ai.prototype.dispatchEvent=Ai.prototype.trigger,function(){function GeoUtil(){throw _classCallCheck(this,GeoUtil),new Error("GeoUtil is a static util class.")}return _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}()),Ti=function(){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]]}return _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,h=s[a];t[1]>h.o[1]&&t[1]>h.d[1]||t[1]<h.o[1]&&t[1]<h.d[1]||(h.o[0]===h.d[0]&&h.o[0]>=t[0]?h.o[0]:(l=(h.d[1]-h.o[1])/(h.d[0]-h.o[0]),h.o[0]+(t[1]-h.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 getVal(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function flattenTree(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,r=0;r<e.length;r++){var o=e[r];o._level=n,o._pid=i,t.push(o),flattenTree(t,o.childNodes||[],n+1,o.id)}return t}function uuid(){if(ri.crypto)return ri.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)})}var Li=function(){_inherits(ICEComponent,Ai);var n=_createSuper(ICEComponent);function ICEComponent(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEComponent),_defineProperty$1(_assertThisInitialized(t=n.call(this)),"__typeName","ICEComponent"),_defineProperty$1(_assertThisInitialized(t),"__dirty",!0),_defineProperty$1(_assertThisInitialized(t),"props",{id:"ICE_"+uuid(),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",_objectSpread2({},t.props)),t.props=ti(t.props,e),t.state=JSON.parse(JSON.stringify(t.props)),t.root=ri,t.initEvents(),t}return _createClass(ICEComponent,[{key:"initEvents",value:function initEvents(){}},{key:"render",value:function render(){this.trigger(w),this.state.display&&(this.calcComponentParams(),this.applyStyleToCtx(),this.applyTransformToCtx(),this.doRender(),this.trigger(x),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 ei(6);return ei!=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,toRadian(e),toRadian(n)),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 Ti([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 Ti([t,e,n,e,t,i,n,i,r[0],r[1]])}},{key:"setState",value:function setState(t){ti(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 oi;this.trigger(L,_objectSpread2(_objectSpread2({},n),{},{left:t,top:e})),this.setState({left:t,top:e}),this.trigger(R,_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 oi;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 oi;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-=Bi.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 Bi.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(I,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}]),ICEComponent}(),Ri=(_defineProperty$1(Li,"instanceCounter",0),function(){_inherits(ICEPath,Li);var e=_createSuper(ICEPath);function ICEPath(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEPath),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2({closePath:!0},t))),"path2D",new Path2D),t}return _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}()),zi=function(){_inherits(ICERect,Ri);var e=_createSuper(ICERect);function ICERect(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICERect),e.call(this,_objectSpread2({width:10,height:10},t))}return _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}(),Ni=function(){_inherits(ICEGroup,zi);var e=_createSuper(ICEGroup);function ICEGroup(t){return _classCallCheck(this,ICEGroup),_defineProperty$1(_assertThisInitialized(t=e.call(this,t)),"parentNode",null),_defineProperty$1(_assertThisInitialized(t),"childNodes",[]),t}return _createClass(ICEGroup,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEGroup.prototype),"initEvents",this).call(this),this.once(S,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(E),t.ice=this.ice,t.ctx=this.ice.ctx,t.evtBus=this.ice.evtBus,t.trigger(S)}},{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){ti(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}(),Di=function(){_inherits(ICEControlPanel,Ni);var e=_createSuper(ICEControlPanel);function ICEControlPanel(t){return _classCallCheck(this,ICEControlPanel),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))),"__typeName","ICEControlPanel"),t}return _createClass(ICEControlPanel,[{key:"doRender",value:function doRender(){_get(_getPrototypeOf(ICEControlPanel.prototype),"doRender",this).call(this),this.setControlPositions()}},{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}(),Hi=function isNil(t){return null==t},Vi=function(){_inherits(ICEEllipse,Ri);var e=_createSuper(ICEEllipse);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,e.call(this,t)}return _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){Hi(t.radiusX)?Hi(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,Hi(t.radiusY)?Hi(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,_get(_getPrototypeOf(ICEEllipse.prototype),"setState",this).call(this,t)}}]),ICEEllipse}(),qi=function(){_inherits(ICECircle,Vi);var e=_createSuper(ICECircle);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,e.call(this,t)}return _createClass(ICECircle)}(),Fi=function(){_inherits(ICELinkHook,qi);var e=_createSuper(ICELinkHook);function ICELinkHook(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkHook),e.call(this,_objectSpread2({linkable:!1},t))}return _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(R,this.resizeEvtHandler,this)}},{key:"mosueDownHandler",value:function mosueDownHandler(t){this.evtBus.trigger(M,new oi({target:this}))}},{key:"mosueMoveHandler",value:function mosueMoveHandler(t){this.evtBus.trigger($,new oi({target:this}))}},{key:"mosueUpHandler",value:function mosueUpHandler(t){this.evtBus.trigger(j,new oi({target:this}))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(A,new oi(t,{position:e})),this.parentNode.trigger(B,new oi(t,{position:e})))}}]),ICELinkHook}(),Ui=function(){_inherits(LineControlPanel,Di);var e=_createSuper(LineControlPanel);function LineControlPanel(t){return _classCallCheck(this,LineControlPanel),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2(_objectSpread2({},t),{},{zIndex:10000010,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"controlSize",16),t.initControls(),t}return _createClass(LineControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=this.controlSize/2;this.startControl=new Fi({zIndex:10000011,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 Fi({zIndex:10000012,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(B,this.resizeEvtHandler,this)}},{key:"enable",value:function enable(){this.setState({display:!0}),this.resume(B),this.showHooks()}},{key:"disable",value:function disable(){this.setState({display:!1}),this.suspend(B),this.hideHooks()}},{key:"setControlPositions",value:function setControlPositions(){}},{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(R,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(R,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(I,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}(),Xi=/\s/,Gi=/^\s+/,Wi=y,Ji=g,Ki=function isSymbol$2(t){return"symbol"==typeof t||Ji(t)&&"[object Symbol]"==Wi(t)},Qi=function baseTrim$1(t){return t&&t.slice(0,function trimmedEndIndex$1(t){for(var e=t.length;e--&&Xi.test(t.charAt(e)););return e}(t)+1).replace(Gi,"")},Zi=Z,Yi=Ki,tr=/^[-+]0x[0-9a-f]+$/i,er=/^0b[01]+$/i,nr=/^0o[0-7]+$/i,ir=parseInt,rr=function toNumber$2(t){if("number"==typeof t)return t;if(Yi(t))return NaN;if(Zi(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=Zi(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=Qi(t);var e=er.test(t);return e||nr.test(t)?ir(t.slice(2),e?2:8):tr.test(t)?NaN:+t},or=rr,sr=v,ar=Ki,lr=o?o.prototype:void 0,hr=lr?lr.toString:void 0,cr=function baseToString$1(t){if("string"==typeof t)return t;if(sr(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,baseToString$1)+"";if(ar(t))return hr?hr.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},ur=function toInteger$1(t){var e=(t=function toFinite$1(t){return t?(t=or(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},dr=rr,fr=function toString$1(t){return null==t?"":cr(t)},pr=r.isFinite,yr=Math.min,vr=function createRound$1(t){var r=Math[t];return function(t,e){var n,i;return t=dr(t),(e=null==e?0:yr(ur(e),292))&&pr(t)?(n=(fr(t)+"e").split("e"),i=r(n[0]+"e"+(+n[1]+e)),+((n=(fr(i)+"e").split("e"))[0]+"e"+(+n[1]-e))):r(t)}}("round"),gr=function(){_inherits(ResizeControl,zi);var e=_createSuper(ResizeControl);function ResizeControl(t){return _classCallCheck(this,ResizeControl),e.call(this,_objectSpread2(_objectSpread2({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}return _createClass(ResizeControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ResizeControl.prototype),"initEvents",this).call(this),this.on(R,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(A,new oi(t,{quadrant:n})),this.parentNode.setState(e),this.parentNode.trigger(B,new oi(t,{quadrant:n}))}}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new oi,i=0<t?1:-1,r=0<e?1:-1,o=(c=this.parentNode.state).localOrigin,s=c.width,a=c.height,l=(t=(c=transformMat2d([],[t,e],invert([],c.absoluteLinearMatrix)))[0],e=c[1],(c=this.state).left),h=c.top,c=c.quadrant,u=this.state.width/2,d=0;"x"===this.state.direction?d=0<(l=0===vr(l+=t)?.5*i:l)+u-o[0]?8:7:"y"===this.state.direction?d=0<(h=0===vr(h+=e)?.5*r:h)+u-o[1]?6:5:"xy"===this.state.direction&&(r=-a/2/(0===vr(r=-s/2)?.5*i:r),0===vr(s/=2)&&(s=.5*i),h+=e=2===c||4==c?r*(l+u-o[0]+t)-(h+u-o[1]):-a/2/s*(l+u-o[0]+t)-(h+u-o[1]),d=0<(l+=t)+u-o[0]?0<h+u-o[1]?4:1:0<h+u-o[1]?3:2),c!==d&&this.parentNode.toggleControlQuadrant(this,d),this.setPosition(l,h,new oi(n,{left:l,top:h,tx:t,ty:e,quadrant:d}))}}]),ResizeControl}(),Cr=function(){_inherits(RotateControl,qi);var e=_createSuper(RotateControl);function RotateControl(t){return _classCallCheck(this,RotateControl),e.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))}return _createClass(RotateControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(RotateControl.prototype),"initEvents",this).call(this),this.on(R,this.rotateEvtHandler,this)}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteOrigin,t={transform:{rotate:Bi.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger("BEFORE_ROTATE",new oi(t)),this.parentNode.setState(t),this.parentNode.trigger(T,new oi(t)))}}]),RotateControl}(),mr=function(){_inherits(TransformControlPanel,Di);var e=_createSuper(TransformControlPanel);function TransformControlPanel(t){return _classCallCheck(this,TransformControlPanel),_defineProperty$1(_assertThisInitialized(t=e.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}return _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 gr({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 Cr({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(B,this.resizeEvtHandler,this),this.on(T,this.rotateEvtHandler,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(B),this.resume(T)}},{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(B),this.suspend(T)}},{key:"setControlPositions",value:function setControlPositions(){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,h=-this.rotateControlffsetY;this.rotateControlInstance.setState({left:l,top:h})}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.targetComponent&&(e=this.state.transform.rotate,this.targetComponent.setGlobalRotate(e),this.targetComponent.trigger(T))}},{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(B)}}},{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(R,this.updatePanel,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(R,this.updatePanel,this),this._targetComponent&&this._targetComponent.once(I,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}(),br=function(){function ICEControlPanelManager(t){_classCallCheck(this,ICEControlPanelManager),this.ice=t,this.transformControlPanel=new mr({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 Ui({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()}return _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&&("ICEControlPanel"===t.__typeName||t.parentNode&&"ICEControlPanel"===t.parentNode.__typeName)||(this.ice.selectionList=[t],this.lineControlPanel.disable(),this.transformControlPanel.disable(),"ICEPolyLine"===t.__typeName?(this.lineControlPanel.targetComponent=t,this.lineControlPanel.enable()):(this.transformControlPanel.targetComponent=t,this.transformControlPanel.enable()))}}]),ICEControlPanelManager}(),_r=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dbclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],kr=function(){function DOMEventBridge(t){_classCallCheck(this,DOMEventBridge),_defineProperty$1(this,"selectionCandidates",[]),_defineProperty$1(this,"_stopped",!1),this.ice=t}return _createClass(DOMEventBridge,[{key:"start",value:function start(){for(var i=this,r=null,t=0;t<_r.length;t++)!function H8(t){var e=(t=_r[t])[1],n=t[0];i.ice.evtBus.on(e,function(t){i._stopped||((r="ICE_MOUSEMOVE"!==e?i.findTargetComponent(t):r)&&(t.target=r).trigger(n,t),i.ice.evtBus.trigger(n,t))})}(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.toolNodes),flattenTree([],this.ice.childNodes)),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}}]),DOMEventBridge}(),Pr=function(){_inherits(EventBus,Ai);var t=_createSuper(EventBus);function EventBus(){return _classCallCheck(this,EventBus),t.call(this)}return _createClass(EventBus)}(),wr=function(){function GeoLine(t,e){_classCallCheck(this,GeoLine),this.startPoint=t,this.endPoint=e}return _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}(),xr=function(){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}return _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}(),Er=function(){_inherits(ICEDotPath,Ri);var e=_createSuper(ICEDotPath);function ICEDotPath(t){return _classCallCheck(this,ICEDotPath),e.call(this,_objectSpread2({dots:[],closePath:!0},t))}return _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}(),Sr="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",Ir=function(){_inherits(ICEImage,Li);var e=_createSuper(ICEImage);function ICEImage(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEImage),e.call(this,_objectSpread2({width:100,height:100,src:Sr},t))}return _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}(),Or=(_createClass(function ICEBezier(){_classCallCheck(this,ICEBezier)}),function(){_inherits(ICEPolyLine,Er);var e=_createSuper(ICEPolyLine);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=e.call(this,t)),"__typeName","ICEPolyLine"),_defineProperty$1(_assertThisInitialized(t),"links",{start:{},end:{}}),t}return _createClass(ICEPolyLine,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEPolyLine.prototype),"initEvents",this).call(this),this.once(S,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function afterAddHandler(t){this.evtBus.once(O,this.makeConnection,this)}},{key:"makeConnection",value:function makeConnection(){var t,e,n=this.state.links;n&&(n.start&&(t=n.start.id,e=n.start.position,t&&e&&(t=this.ice.findComponent(t),this.setLink("start",t,e))),n.end&&(t=n.end.id,e=n.end.position,t&&e&&(n=this.ice.findComponent(t),this.setLink("end",n,e)))),this.ice.dirty=!0}},{key:"setLink",value:function setLink(t,e,n){this.removeLink(t,e,n),this.links[t]={component:e,position:n},e.on(R,this.followComponent,this),e.on(B,this.followComponent,this),e.on(T,this.followComponent,this),e.once(x,this.followComponent,this),this.followComponent();var i,r={};for(i in this.links){var o=this.links[i];o.component&&o.position&&(r[i]={id:o.component.props.id,position:o.position})}this.setState({links:_objectSpread2({},r),draggable:!1})}},{key:"removeLink",value:function removeLink(t,e,n){var i=this.links[t].component,r=this.links[t].position;i===e&&r===n&&(i&&i.off(R,this.followComponent,this),i&&i.off(B,this.followComponent,this),i&&i.off(T,this.followComponent,this),this.links[t]={},this.state.links[t]={}),this.links.start.component||this.links.end.component||this.setState({draggable:!0})}},{key:"followComponent",value:function followComponent(t){for(var e in this.links){var n=this.links[e].position,i=this.links[e].component;if(n&&i){var r=i.getMinBoundingBox(),o=[0,0];switch(n){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=vr(this.state.points[0][0],2),i=vr(this.state.points[0][1],2),r=0,o=[vr(this.state.points[e-1][0],2)-n,vr(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=vr(r,3)),0+(n=vr(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 Ti([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(Hi(t.width)||delete t.width,Hi(t.height)||delete t.height,Hi(t.transform)||delete t.transform,!Hi(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(!Hi(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;Hi(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]),Hi(t.endPoint)||(o=this.state.points.length,this.state.points[o-1]=_toConsumableArray(t.endPoint)),_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],Bi.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:"arrangeParam",value:function arrangeParam(t){var e=ti({},{lineType:"solid",lineWidth:1,arrow:"none",arrowLength:15,arrowAngel:toRadian(30),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}()),Mr=function(){_inherits(ICELinkSlot,qi);var e=_createSuper(ICELinkSlot);function ICELinkSlot(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkSlot),e.call(this,_objectSpread2({linkable:!1,draggable:!1,position:"T"},t))}return _createClass(ICELinkSlot,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICELinkSlot.prototype),"initEvents",this).call(this),this.once(w,this.beforeRenderHandler,this),this.once(I,this.beforeRemoveHandler,this)}},{key:"beforeRenderHandler",value:function beforeRenderHandler(t){this.evtBus.on(M,this.hookMouseDownHandler,this),this.evtBus.on($,this.hookMouseMoveHandler,this),this.evtBus.on(j,this.hookMouseUpHandler,this),this.evtBus.on("mouseup",this.globalMouseUpHandler,this)}},{key:"beforeRemoveHandler",value:function beforeRemoveHandler(t){this.evtBus.off(M,this.hookMouseDownHandler,this),this.evtBus.off($,this.hookMouseMoveHandler,this),this.evtBus.off(j,this.hookMouseUpHandler,this),this.evtBus.off("mouseup",this.globalMouseUpHandler,this),this._hostComponent=null}},{key:"globalMouseUpHandler",value:function globalMouseUpHandler(){this.setState({display:!1})}},{key:"hookMouseDownHandler",value:function hookMouseDownHandler(t){console.log("linkslot, hook mousedown event..."),this._hostComponent&&this.setState({display:!0})}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){t=t.target,this.isIntersectWithHook(t)?(this.setState({style:{fillStyle:"#fffb00"}}),t._currentAboveSlot=this,t.setState({style:{fillStyle:"#fffb00"}})):(this.setState({style:{fillStyle:"#3ce92c"}}),t._currentAboveSlot===this&&t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"hookMouseUpHandler",value:function hookMouseUpHandler(t){var e,n;this._hostComponent&&(e=(t=t.target).parentNode.targetComponent,n=t.state.position,this.isIntersectWithHook(t)?e&&e.setLink(n,this._hostComponent,this.props.position):e&&e.removeLink(n,this._hostComponent,this.props.position),this.setState({display:!1,style:{fillStyle:"#3ce92c"}}),t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"isIntersectWithHook",value:function isIntersectWithHook(t){var e=this.getMaxBoundingBox();return t=t.getMaxBoundingBox(),!!e.isIntersect(t)}},{key:"updatePosition",value:function updatePosition(){console.log("link slot update position ...");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(x,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(x,this.updatePosition,this),this._hostComponent&&this._hostComponent.once(I,function(){e._hostComponent=null,e.setState({display:!1})},this),this._hostComponent&&this.setState({display:!0})}}]),ICELinkSlot}(),$r=function(){_inherits(ICEVisioLink,Or);var e=_createSuper(ICEVisioLink);function ICEVisioLink(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEVisioLink),t=ICEVisioLink.arrangeParam(t),e.call(this,t)}return _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 xr(e,n)),o=new xr(i,t),s=[],a=null,l=null,h=[],c=new Ti,u=new Ti;if(e=this.links.start.component){c=e.getMinBoundingBox(),s[0]=new xr(r.x,c.tl[1]-this.state.escapeDistance),s[1]=new xr(c.tr[0]+this.state.escapeDistance,r.y),s[2]=new xr(r.x,c.br[1]+this.state.escapeDistance),s[3]=new xr(c.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(n=this.links.end.component){u=n.getMinBoundingBox(),s[0]=new xr(o.x,u.tl[1]-this.state.escapeDistance),s[1]=new xr(u.tr[0]+this.state.escapeDistance,o.y),s[2]=new xr(o.x,u.br[1]+this.state.escapeDistance),s[3]=new xr(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])}i=0,t=[r],a&&(t.push(a),i=1),l&&t.push(l),t.push(o),e=xr.cloneArray(t),h.push(["s0","s0",e]),n=xr.cloneArray(t),(e=xr.cloneArray(n)).splice(i+1,0,new xr(e[i].x,e[i+1].y)),h.push(["s1","s1_1",e]),(t=xr.cloneArray(n)).splice(i+1,0,new xr(t[i+1].x,t[i].y)),h.push(["s1","s1_2",t]);var e=xr.cloneArray(n),t=new xr((e[i].x+e[i+1].x)/2,e[i].y),p=new xr((e[i].x+e[i+1].x)/2,e[i+1].y);e.splice(i+1,0,t,p),h.push(["s2","s2_1",e]),t=xr.cloneArray(n),p=new xr(t[i].x,(t[i].y+t[i+1].y)/2),e=new xr(t[i+1].x,(t[i].y+t[i+1].y)/2),e=[(t.splice(i+1,0,p,e),h.push(["s2","s2_2",t]),(p=xr.cloneArray(n))[i].x+20),p[i+1].x+20],c&&e.push(c.br[0]+20),u&&e.push(u.br[0]+20),t=this.max(e),e=new xr(t,p[i].y),t=new xr(t,p[i+1].y),t=[(p.splice(i+1,0,e,t),h.push(["s2","s2_3",p]),(e=xr.cloneArray(n))[i].y-20),e[i+1].y-20],c&&t.push(c.tl[1]-20),u&&t.push(u.tl[1]-20),p=this.min(t),t=new xr(e[i].x,p),p=new xr(e[i+1].x,p),p=[(e.splice(i+1,0,t,p),h.push(["s2","s2_4",e]),(t=xr.cloneArray(n))[i].x-20),t[i+1].x-20],c&&p.push(c.tl[0]-20),u&&p.push(u.tl[0]-20),e=this.min(p),p=new xr(e,t[i].y),e=new xr(e,t[i+1].y),e=[(t.splice(i+1,0,p,e),h.push(["s2","s2_5",t]),(p=xr.cloneArray(n))[i].y+20),p[i+1].y+20],c&&e.push(c.tl[1]+c.height+20),u&&e.push(u.tl[1]+u.height+20),t=this.max(e),n=new xr(p[i].x,t),e=new xr(p[i+1].x,t),p.splice(i+1,0,n,e),h.push(["s2","s2_6",p]);for(var y=[],v=0;v<h.length;v++){var g=h[v][2];this.orthogonalPath(g)&&y.push(h[v])}if(h=y,!r.equals(o)){for(var C=[],m=0;m<h.length;m++){var b=h[m][2];this.forwardPath(b)&&C.push(h[m])}(h=C).length}for(var _=[],k=0;k<h.length;k++){var P=!1,x=h[k][2].slice();(u||c)&&(x=x.slice(1,x.length-1)),c&&(P=P||this.polylineIntersectsRectangle(x,c)),(P=u?P||this.polylineIntersectsRectangle(x,u):P)||_.push(h[k])}(h=0!=_.length?_:h).length;for(var w=h[0][2].length,E=[],S=0;S<h.length;S++)h[S][2].length==w&&E.push(h[S]);for(var h=E,I=0,O=0;O<h.length;O++)this.scorePath(h[I][2])<this.scorePath(h[O][2])&&(I=O);return[h[I]]}},{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 wr(new xr(e.x1,e.y1),new xr(e.x2,e.y1))),i.push(new wr(new xr(e.x2,e.y1),new xr(e.x2,e.y2))),i.push(new wr(new xr(e.x2,e.y2),new xr(e.x1,e.y2))),i.push(new wr(new xr(e.x1,e.y2),new xr(e.x1,e.y1)));for(var r=0;r<t.length-1;r++)for(var o=new wr(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 wr(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 Hi(t.startPoint)&&(t.startPoint=[0,0]),Hi(t.endPoint)&&(t.endPoint=[10,10]),t.points=[_toConsumableArray(t.startPoint),_toConsumableArray(t.endPoint)],_objectSpread2({escapeDistance:30},t)}}]),ICEVisioLink}(),jr=function(){_inherits(ICEIsogon,Er);var e=_createSuper(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,e.call(this,t)}return _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){Hi(t.radius)?Hi(t.width)?Hi(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}(),Ar=(!function(){_inherits(ICERose,Er);var e=_createSuper(ICERose);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,e.call(this,t)}_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){Hi(t.radius)?Hi(t.width)?Hi(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)}}])}(),function(){_inherits(ICEStar,Er);var e=_createSuper(ICEStar);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,e.call(this,t)}return _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){Hi(t.outerRadius)?Hi(t.width)?Hi(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)}}]),ICEStar}()),Br="__ICE_UTILS_TEXT_MEASURE_DIV__",Tr=function(){_inherits(ICEText,Li);var e=_createSuper(ICEText);function ICEText(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEText),(t=ti({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=e.call(this,t)).measureText(),t}return _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(Br))){(e=this.root.document.createElement("div")).setAttribute("id",Br);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,h={width:e.offsetWidth+a+l,height:e.offsetHeight+o+s};return this.props.width=h.width,this.props.height=h.height,this.state.width=h.width,this.state.height=h.height,{width:this.state.width,height:this.state.height}}catch(t){console.error(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)}}]),ICEText}(),Lr={ICERect:zi,ICECircle:qi,ICEEllipse:Vi,ICEStar:Ar,ICEIsogon:jr,ICEText:Tr,ICEImage:Ir,ICEGroup:Ni,ICEVisioLink:$r,ICEPolyLine:Or},Rr=function(){function DDManager(t){_classCallCheck(this,DDManager),this.ice=t}return _createClass(DDManager,[{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.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this),this}},{key:"mouseDownHandler",value:function mouseDownHandler(t){(t=t.target).ice?t.state.interactive&&t.state.draggable&&(this.currentObj=t,this.ice.evtBus.on("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.on("mouseup",this.mouseUpHandler,this)):console.warn("DDManager: 点击在 canvas 画布上,没有点击任何图形。")}},{key:"mouseMoveHandler",value:function mouseMoveHandler(t){var e=t.movementX,n=t.movementY;return this.currentObj.moveGlobalPosition(e,n,t),!0}},{key:"mouseUpHandler",value:function mouseUpHandler(t){this.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this)}}]),DDManager}(),zr={evtBuses:[],start:function start(){if(ri&&ri.addEventListener){function Ep(t){for(var n=zr.evtBuses[t],e=0;e<_r.length;e++)!function Ip(t){var e=_r[t];ri.addEventListener(e[0],function(t){n.trigger(e[1],t)})}(e)}for(var t=0;t<zr.evtBuses.length;t++)Ep(t)}},regitserEvtBus:function regitserEvtBus(t){zr.evtBuses.includes(t)||zr.evtBuses.push(t)},delEvtBus:function delEvtBus(t){zr.evtBuses.includes(t)&&zr.evtBuses.splice(zr.evtBuses.indexOf(t),1)}},Nr={evtBuses:[],stopped:!1,frameCallback:function frameCallback(){for(var t=0;t<Nr.evtBuses.length;t++){if(Nr.stopped)return;Nr.evtBuses[t].trigger(P)}Nr.stopped||ri.requestFrame(Nr.frameCallback)},start:function start(){Nr.stopped=!1,ri.requestFrame(Nr.frameCallback)},stop:function stop(){Nr.stopped=!0},pause:function pause(){},resume:function resume(){},regitserEvtBus:function regitserEvtBus(t){Nr.evtBuses.includes(t)||Nr.evtBuses.push(t)},delEvtBus:function delEvtBus(t){Nr.evtBuses.includes(t)&&Nr.evtBuses.splice(Nr.evtBuses.indexOf(t),1)}},Dr=function(){function ICELinkSlotManager(t){_classCallCheck(this,ICELinkSlotManager),_defineProperty$1(this,"slotRadius",10),this.ice=t}return _createClass(ICELinkSlotManager,[{key:"start",value:function start(){return this.createLinkSlots(),this.ice.evtBus.on($,this.hookMouseMoveHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off($,this.hookMouseMoveHandler,this),this}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){for(var e=t.target.getMaxBoundingBox(),n=_toConsumableArray(this.ice.childNodes),i=0;i<n.length;i++){var r=n[i];if(r&&r.state.linkable&&r.getMaxBoundingBox().isIntersect(e)){for(var o=0;o<this.ice._linkSlots.length;o++)this.ice._linkSlots[o].hostComponent=r;return}}}},{key:"createLinkSlots",value:function createLinkSlots(){var t,e,n,i;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new Mr({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"T",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(t),e=new Mr({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"R",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(e),n=new Mr({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"B",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(n),i=new Mr({zIndex:1e7,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}(),Hr=function(){function Deserializer(t){_classCallCheck(this,Deserializer),this.ice=t}return _createClass(Deserializer,[{key:"fromJSON",value:function fromJSON(t){for(var e=JSON.parse(t).childNodes,n=0;n<e.length;n++)this.decodeRecursively(this.ice,e[n])}},{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}(),Vr=function(){function Serializer(t){_classCallCheck(this,Serializer),this.ice=t}return _createClass(Serializer,[{key:"toJSON",value:function toJSON(){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 console.log(t),JSON.stringify(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}(),qr=function(){_inherits(CanvasRenderer,Ai);var n=_createSuper(CanvasRenderer);function CanvasRenderer(t){var e;return _classCallCheck(this,CanvasRenderer),_defineProperty$1(_assertThisInitialized(e=n.call(this)),"stopped",!1),_defineProperty$1(_assertThisInitialized(e),"componentQueue",[]),_defineProperty$1(_assertThisInitialized(e),"toolsQueue",[]),e.ice=t,e}return _createClass(CanvasRenderer,[{key:"start",value:function start(){return this.stopped=!1,this.ice.evtBus.on(P,this.frameEvtHandler,this),this}},{key:"stop",value:function stop(){return this.stopped=!0,this.ice.evtBus.off(P,this.frameEvtHandler,this),this}},{key:"frameEvtHandler",value:function frameEvtHandler(t){this.ice.dirty?this.doRender():console.log("没有需要渲染的组件...")}},{key:"refreshQueue",value:function refreshQueue(){this.componentQueue=flattenTree([],this.ice.childNodes),this.componentQueue.sort(function(t,e){return t.state.zIndex-e.state.zIndex}),console.log("Component Queue length> ".concat(this.componentQueue.length)),this.toolsQueue=flattenTree([],this.ice.toolNodes),console.log("Tool Queue length> ".concat(this.ice.toolNodes.length))}},{key:"doRender",value:function doRender(){var t=Date.now();this.refreshQueue(),this.ice.ctx.clearRect(0,0,this.ice.canvasWidth,this.ice.canvasHeight);for(var e=0;e<this.componentQueue.length;e++){var n=this.componentQueue[e];n.root=this.ice.root,n.ctx=this.ice.ctx,n.evtBus=this.ice.evtBus,n.ice=this.ice,n.render()}for(var i=0;i<this.toolsQueue.length;i++){var r=this.toolsQueue[i];r.root=this.ice.root,r.ctx=this.ice.ctx,r.evtBus=this.ice.evtBus,r.ice=this.ice,r.render()}console.log("Render time ".concat(Date.now()-t," ms.")),this.ice.dirty=!1,this.ice.evtBus.trigger(O)}}]),CanvasRenderer}(),Fr=function(){function ImageCache(t){_classCallCheck(this,ImageCache),_defineProperty$1(this,"imageCache",new Map),this.ice=t}return _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(){console.error("ImageCache: 图片加载失败:",t)},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}(),Ur=(_defineProperty$1(Fr,"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 Lr)this.typeMapping[e]=Lr[e];return this.root=ri,_(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 Pr,Nr.regitserEvtBus(this.evtBus),Nr.start(),zr.regitserEvtBus(this.evtBus),zr.start(),this.eventBridge=new kr(this).start(),this.animationManager=new N(this).start(),this.ddManager=new Rr(this).start(),this.controlPanelManager=new br(this).start(),this.renderer=new qr(this).start(),this.linkSlotManager=new Dr(this).start(),this.serializer=new Vr(this),this.deserializer=new Hr(this),this.imageCache=new Fr(this),this}},{key:"addTool",value:function addTool(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(E,null,{component:t}),t.trigger(E),t.ice=this,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(S,null,{component:t}),t.trigger(S))}},{key:"removeTool",value:function removeTool(t){this.evtBus.trigger(I,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(E,null,{component:t}),t.trigger(E),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(S,null,{component:t}),t.trigger(S))}},{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(I,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:"toJSON",value:function toJSON(){return this.serializer.toJSON()}},{key:"fromJSON",value:function fromJSON(t){var e=this,n=Date.now();Nr.stop(),this.renderer.stop(),this.eventBridge.stopped=!0,this.animationManager.stop(),this.ddManager.stop(),this.controlPanelManager.stop(),this.linkSlotManager.stop(),this.clearAll(),this.deserializer.fromJSON(t),Nr.start(),this.renderer.start(),this.animationManager.start(),this.ddManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(function(){e.eventBridge.stopped=!1},300),t=Date.now(),console.log("fromJSON> ".concat(t-n," ms"))}}]),"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}),Xr=function isNil(t){return null==t},Gr=function listCacheClear$1(){this.__data__=[],this.size=0},Wr=function eq$4(t,e){return t===e||t!=t&&e!=e},Jr=Wr,Kr=function assocIndexOf$4(t,e){for(var n=t.length;n--;)if(Jr(t[n][0],e))return n;return-1},Qr=Kr,Zr=Array.prototype.splice,Yr=Kr,to=Kr,eo=Kr,no=Gr,io=function listCacheDelete$1(t){var e=this.__data__,t=Qr(e,t);return!(t<0||(t==e.length-1?e.pop():Zr.call(e,t,1),--this.size,0))},ro=function listCacheGet$1(t){var e=this.__data__,t=Yr(e,t);return t<0?void 0:e[t][1]},oo=function listCacheHas$1(t){return-1<to(this.__data__,t)},so=function listCacheSet$1(t,e){var n=this.__data__,i=eo(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this};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=no,ListCache$4.prototype.delete=io,ListCache$4.prototype.get=ro,ListCache$4.prototype.has=oo,ListCache$4.prototype.set=so;var Ao,ao=ListCache$4,lo=ao,ho=function stackClear$1(){this.__data__=new lo,this.size=0},co=function stackDelete$1(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t},uo=function stackGet$1(t){return this.__data__.get(t)},fo=function stackHas$1(t){return this.__data__.has(t)},po="object"==typeof Ur&&Ur&&Ur.Object===Object&&Ur,yo=po,vo="object"==typeof self&&self&&self.Object===Object&&self,go=yo||vo||Function("return this")(),Co=go.Symbol,mo=Co,bo=Object.prototype,_o=bo.hasOwnProperty,ko=bo.toString,Po=mo?mo.toStringTag:void 0,wo=function getRawTag$1(t){var e=_o.call(t,Po),n=t[Po];try{var i=!(t[Po]=void 0)}catch(t){}var r=ko.call(t);return i&&(e?t[Po]=n:delete t[Po]),r},xo=Object.prototype.toString,Eo=wo,So=function objectToString$1(t){return xo.call(t)},Io=Co?Co.toStringTag:void 0,Oo=function baseGetTag$4(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(Io&&Io in Object(t)?Eo:So)(t)},Mo=function isObject$7(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},$o=Oo,jo=Mo,Bo=function isFunction$3(t){if(!jo(t))return!1;t=$o(t);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},To=go["__core-js_shared__"],Lo=(Ao=/[^.]+$/.exec(To&&To.keys&&To.keys.IE_PROTO||""))?"Symbol(src)_1."+Ao:"",Ro=function isMasked$1(t){return!!Lo&&Lo in t},zo=Function.prototype.toString,No=Bo,Do=Ro,Ho=Mo,Vo=function toSource$1(t){if(null!=t){try{return zo.call(t)}catch(t){}try{return t+""}catch(t){}}return""},qo=/^\[object .+?Constructor\]$/,Fo=Function.prototype,Uo=Object.prototype,Xo=Fo.toString,Go=Uo.hasOwnProperty,Wo=RegExp("^"+Xo.call(Go).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Jo=function baseIsNative$1(t){return!(!Ho(t)||Do(t))&&(No(t)?Wo:qo).test(Vo(t))},Ko=function getValue$1(t,e){return null==t?void 0:t[e]},Qo=function getNative$3(t,e){t=Ko(t,e);return Jo(t)?t:void 0},Zo=Qo(go,"Map"),Yo=Qo(Object,"create"),ts=Yo,es=function hashClear$1(){this.__data__=ts?ts(null):{},this.size=0},ns=function hashDelete$1(t){t=this.has(t)&&delete this.__data__[t];return this.size-=t?1:0,t},is=Yo,rs=Object.prototype.hasOwnProperty,os=function hashGet$1(t){var e,n=this.__data__;return is?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:rs.call(n,t)?n[t]:void 0},ss=Yo,as=Object.prototype.hasOwnProperty,ls=Yo,hs=es,cs=ns,us=os,ds=function hashHas$1(t){var e=this.__data__;return ss?void 0!==e[t]:as.call(e,t)},fs=function hashSet$1(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ls&&void 0===e?"__lodash_hash_undefined__":e,this};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=hs,Hash$1.prototype.delete=cs,Hash$1.prototype.get=us,Hash$1.prototype.has=ds,Hash$1.prototype.set=fs;var ps=Hash$1,ys=ao,vs=Zo,gs=function isKeyable$1(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t},Cs=function getMapData$4(t,e){t=t.__data__;return gs(e)?t["string"==typeof e?"string":"hash"]:t.map},ms=Cs,bs=Cs,_s=Cs,ks=Cs,Ps=function mapCacheClear$1(){this.size=0,this.__data__={hash:new ps,map:new(vs||ys),string:new ps}},ws=function mapCacheDelete$1(t){t=ms(this,t).delete(t);return this.size-=t?1:0,t},xs=function mapCacheGet$1(t){return bs(this,t).get(t)},Es=function mapCacheHas$1(t){return _s(this,t).has(t)},Ss=function mapCacheSet$1(t,e){var n=ks(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};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=Ps,MapCache$1.prototype.delete=ws,MapCache$1.prototype.get=xs,MapCache$1.prototype.has=Es,MapCache$1.prototype.set=Ss;var Is=ao,Os=Zo,Ms=MapCache$1,$s=ao,js=ho,As=co,Bs=uo,Ts=fo,Ls=function stackSet$1(t,e){var n=this.__data__;if(n instanceof Is){var i=n.__data__;if(!Os||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new Ms(i)}return n.set(t,e),this.size=n.size,this};function Stack$1(t){t=this.__data__=new $s(t);this.size=t.size}Stack$1.prototype.clear=js,Stack$1.prototype.delete=As,Stack$1.prototype.get=Bs,Stack$1.prototype.has=Ts,Stack$1.prototype.set=Ls;var Rs=Stack$1,zs=Qo,Ns=function(){try{var t=zs(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Ds=Ns,Hs=function baseAssignValue$3(t,e,n){"__proto__"==e&&Ds?Ds(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},Vs=Hs,qs=Wr,Fs=function assignMergeValue$2(t,e,n){(void 0===n||qs(t[e],n))&&(void 0!==n||e in t)||Vs(t,e,n)},Us=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}}(),Xs={exports:{}},Gs=(!function(t,e){var e=e&&!e.nodeType&&e,n=e&&t&&!t.nodeType&&t,n=n&&n.exports===e?go.Buffer:void 0,i=n?n.allocUnsafe:void 0;t.exports=function cloneBuffer(t,e){if(e)return t.slice();e=t.length,e=i?i(e):new t.constructor(e);return t.copy(e),e}}(Xs,Xs.exports),go.Uint8Array),Ws=function cloneArrayBuffer$1(t){var e=new t.constructor(t.byteLength);return new Gs(e).set(new Gs(t)),e},Js=function cloneTypedArray$1(t,e){e=e?Ws(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)},Ks=function copyArray$1(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e},Qs=Mo,Zs=Object.create,Ys=function(){function object(){}return function(t){if(!Qs(t))return{};if(Zs)return Zs(t);object.prototype=t;t=new object;return object.prototype=void 0,t}}(),ta=function overArg$1(e,n){return function(t){return e(n(t))}}(Object.getPrototypeOf,Object),ea=Object.prototype,na=function isPrototype$2(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||ea)},ia=Ys,ra=ta,oa=na,sa=function initCloneObject$1(t){return"function"!=typeof t.constructor||oa(t)?{}:ia(ra(t))},aa=function isObjectLike$5(t){return null!=t&&"object"==typeof t},la=Oo,ha=aa,ca=function baseIsArguments$1(t){return ha(t)&&"[object Arguments]"==la(t)},ua=aa,da=Object.prototype,fa=da.hasOwnProperty,pa=da.propertyIsEnumerable,ya=ca(function(){return arguments}())?ca:function(t){return ua(t)&&fa.call(t,"callee")&&!pa.call(t,"callee")},va=Array.isArray,ga=function isLength$2(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991},Ca=Bo,ma=ga,ba=function isArrayLike$3(t){return null!=t&&ma(t.length)&&!Ca(t)},_a=ba,ka=aa,Pa=function isArrayLikeObject$1(t){return ka(t)&&_a(t)},wa={exports:{}},xa=function stubFalse(){return!1},Ea=(!function(t,e){var e=e&&!e.nodeType&&e,n=e&&t&&!t.nodeType&&t,n=n&&n.exports===e?go.Buffer:void 0,e=(n?n.isBuffer:void 0)||xa;t.exports=e}(wa,wa.exports),Oo),Sa=ta,Ia=aa,Oa=Function.prototype,Ma=Object.prototype,$a=Oa.toString,ja=Ma.hasOwnProperty,Aa=$a.call(Object),Ba=function isPlainObject$1(t){if(!Ia(t)||"[object Object]"!=Ea(t))return!1;t=Sa(t);if(null===t)return!0;t=ja.call(t,"constructor")&&t.constructor;return"function"==typeof t&&t instanceof t&&$a.call(t)==Aa},Ta=Oo,La=ga,Ra=aa,za={},Na=(za["[object Float32Array]"]=za["[object Float64Array]"]=za["[object Int8Array]"]=za["[object Int16Array]"]=za["[object Int32Array]"]=za["[object Uint8Array]"]=za["[object Uint8ClampedArray]"]=za["[object Uint16Array]"]=za["[object Uint32Array]"]=!0,za["[object Arguments]"]=za["[object Array]"]=za["[object ArrayBuffer]"]=za["[object Boolean]"]=za["[object DataView]"]=za["[object Date]"]=za["[object Error]"]=za["[object Function]"]=za["[object Map]"]=za["[object Number]"]=za["[object Object]"]=za["[object RegExp]"]=za["[object Set]"]=za["[object String]"]=za["[object WeakMap]"]=!1,function baseIsTypedArray$1(t){return Ra(t)&&La(t.length)&&!!za[Ta(t)]}),Da=function baseUnary$1(e){return function(t){return e(t)}},Ha={exports:{}},Va=(!function(t,e){var e=e&&!e.nodeType&&e,n=e&&t&&!t.nodeType&&t,i=n&&n.exports===e&&po.process,e=function(){try{return n&&n.require&&n.require("util").types||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=e}(Ha,Ha.exports),Na),qa=Da,Fa=Ha.exports,Ua=Fa&&Fa.isTypedArray,Xa=Ua?qa(Ua):Va,Ga=function safeGet$2(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Wa=Hs,Ja=Wr,Ka=Object.prototype.hasOwnProperty,Qa=function assignValue$1(t,e,n){var i=t[e];Ka.call(t,e)&&Ja(i,n)&&(void 0!==n||e in t)||Wa(t,e,n)},Za=Hs,Ya=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?Za:Qa)(n,a,l)}return n},tl=/^(?:0|[1-9]\d*)$/,el=function isIndex$2(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&tl.test(t))&&-1<t&&t%1==0&&t<e},nl=function baseTimes$1(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i},il=ya,rl=va,ol=wa.exports,sl=el,al=Xa,ll=Object.prototype.hasOwnProperty,hl=function arrayLikeKeys$1(t,e){var n,i=rl(t),r=!i&&il(t),o=!i&&!r&&ol(t),s=!i&&!r&&!o&&al(t),a=i||r||o||s,l=a?nl(t.length,String):[],h=l.length;for(n in t)!e&&!ll.call(t,n)||a&&("length"==n||o&&("offset"==n||"parent"==n)||s&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||sl(n,h))||l.push(n);return l},cl=Mo,ul=na,dl=function nativeKeysIn$1(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},fl=Object.prototype.hasOwnProperty,pl=hl,yl=function baseKeysIn$1(t){if(!cl(t))return dl(t);var e,n=ul(t),i=[];for(e in t)("constructor"!=e||!n&&fl.call(t,e))&&i.push(e);return i},vl=ba,gl=function keysIn$2(t){return vl(t)?pl(t,!0):yl(t)},Cl=Ya,ml=gl,bl=Fs,_l=Xs.exports,kl=Js,Pl=Ks,wl=sa,xl=ya,El=va,Sl=Pa,Il=wa.exports,Ol=Bo,Ml=Mo,$l=Ba,jl=Xa,Al=Ga,Bl=function toPlainObject$1(t){return Cl(t,ml(t))},Tl=Rs,Ll=Fs,Rl=Us,zl=function baseMergeDeep$1(t,e,n,i,r,o,s){var a,l,h,c=Al(t,n),u=Al(e,n),d=s.get(u);d?bl(t,n,d):((e=void 0===(d=o?o(c,u,n+"",t,e,s):void 0))&&(l=!(a=El(u))&&Il(u),h=!a&&!l&&jl(u),d=u,a||l||h?d=El(c)?c:Sl(c)?Pl(c):l?_l(u,!(e=!1)):h?kl(u,!(e=!1)):[]:$l(u)||xl(u)?xl(d=c)?d=Bl(c):Ml(c)&&!Ol(c)||(d=wl(u)):e=!1),e&&(s.set(u,d),r(d,u,i,o,s),s.delete(u)),bl(t,n,d))},Nl=Mo,Dl=gl,Hl=Ga,Vl=function baseMerge$1(i,r,o,s,a){i!==r&&Rl(r,function(t,e){var n;a=a||new Tl,Nl(t)?zl(i,r,e,o,baseMerge$1,s,a):(n=s?s(Hl(i,e),t,e+"",i,r,a):void 0,Ll(i,e,n=void 0===n?t:n))},Dl)},ql=function identity$2(t){return t},Fl=function apply$1(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)},Ul=Math.max,Xl=function overRest$1(o,s,a){return s=Ul(void 0===s?o.length-1:s,0),function(){for(var t=arguments,e=-1,n=Ul(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),Fl(o,this,r)}},Gl=function constant$1(t){return function(){return t}},Wl=Ns,Jl=Wl?function(t,e){return Wl(t,"toString",{configurable:!0,enumerable:!1,value:Gl(e),writable:!0})}:ql,Kl=Date.now,Ql=function shortOut$1(n){var i=0,r=0;return function(){var t=Kl(),e=16-(t-r);if(r=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(Jl),Zl=ql,Yl=Xl,th=Ql,eh=Wr,nh=ba,ih=el,rh=Mo,oh=function baseRest$1(t,e){return th(Yl(t,e,Zl),t+"")},sh=function isIterateeCall$1(t,e,n){if(!rh(n))return!1;var i=typeof e;return!!("number"==i?nh(n)&&ih(e,n.length):"string"==i&&e in n)&&eh(n[e],t)},ah=Vl,lh=function createAssigner$1(a){return oh(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&&sh(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){ah(t,e,n)}),hh=function(){!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)}(Entity,Ni);var e=_createSuper$1(Entity);function Entity(t){_classCallCheck$1(this,Entity);var t=Entity.arrangeParam(t);return function _defineProperty$2(t,e,n){e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}(_assertThisInitialized$1(t=e.call(this,t)),"entityFieldsComponent",[]),t}return _createClass$1(Entity,[{key:"doRender",value:function doRender(){this.dirty&&this.syncEntityNameAndFields(),this.doLayout(),_get$1(_getPrototypeOf$1(Entity.prototype),"doRender",this).call(this)}},{key:"syncEntityNameAndFields",value:function syncEntityNameAndFields(){if(this.state.entityName&&(this.entityNameComponent||(this.entityNameComponent=new Tr({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||(this.deviderLine=new Or({left:0,top:0,points:[[0,0],[this.state.width,0]],style:{strokeStyle:"#333",fillStyle:"#333",lineWidth:2},interactive:!1}),this.addChild(this.deviderLine))),!Xr(this.state.fields)&&!this.entityFieldsComponent.length){for(var t=this.state.fields.length,e=0;e<t;e++){var n=this.state.fields[e],n=new Tr({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:"doLayout",value:function doLayout(){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]]}),this.setState({height:Math.max(e,this.state.height),width:t})}}],[{key:"arrangeParam",value:function arrangeParam(t){t=lh({entityName:"Entity Name",fields:[],style:{strokeStyle:"#000",fillStyle:"#00eeff"}},t,{transformable:!1});return Xr(t.entityName)&&(t.entityName="Entity Name"),Xr(t.fields)&&(t.fields=[]),t}}]),Entity}(),ch=_createClass$1(function Relation(){_classCallCheck$1(this,Relation)});export{hh as Entity,ch as Relation};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2022 大漠穷秋
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
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(E){"use strict";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){return e&&_defineProperties$1(t.prototype,e),n&&_defineProperties$1(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}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 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=S.call(t,O),n=t[O];try{var i=!(t[O]=void 0)}catch(t){}var o=I.call(t);return i&&(e?t[O]=n:delete t[O]),o}function q(t){return j.call(t)}function s(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(B&&B 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)&&"[object String]"==A(t)}function z(t){return void 0===t}function R(t,e){return t===e||t!=t&&e!=e}function T(t,e){for(var n=t.length;n--;)if(tt(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,S=i.hasOwnProperty,I=i.toString,O=n?n.toStringTag:void 0,j=Object.prototype.toString,B=n?n.toStringTag:void 0,i=Array.isArray,A=s,L=i,$=u,N="ICE_FRAME_EVENT",D="BEFORE_RENDER",H="AFTER_RENDER",V="BEFORE_ADD",X="AFTER_ADD",F="BEFORE_REMOVE",U="ROUND_FINISH",W="HOOK_MOUSEDOWN",Q="HOOK_MOUSEMOVE",J="HOOK_MOUSEUP",K="BEFORE_RESIZE",h="AFTER_RESIZE",G="AFTER_ROTATE",a="AFTER_MOVE",Z={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}},Y=(_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,o=1;for(e in i){var r=i[e];if(r.finished){if(++o===Object.keys(i).length){this.remove(t);break}}else{var s=r.from,a=r.to,l=r.duration;a<(z(r.startTime)&&(r.startTime=Date.now()),z(r.easing)&&(r.easing="linear"),s=Z[r.easing](s,a,l,r.startTime))&&(s=a,r.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),tt=R,et=T,nt=Array.prototype.splice,it=T,ot=T,rt=T;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=et(e,t))<0||(t==e.length-1?e.pop():nt.call(e,t,1),--this.size,0))},ListCache$4$1.prototype.get=function listCacheGet$1(t){var e=this.__data__;return(t=it(e,t))<0?void 0:e[t][1]},ListCache$4$1.prototype.has=function listCacheHas$1(t){return-1<ot(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 ba(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ea(t){return!!lt(t)&&("[object Function]"==(t=at(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function ia(t){if(null!=t){try{return ct.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function ka(t){return!!ht&&ht in t}function ta(t,e){return function baseIsNative$1(t){return dt(t)&&!ka(t)&&(ut(t)?yt:ft).test(pt(t))}(t=function getValue$1(t,e){return null==t?void 0:t[e]}(t,e))?t:void 0}function Da(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t}function Ea(t){var e,n=this.__data__;return vt?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:Ct.call(n,t)?n[t]:void 0}var o=ListCache$4$1,st=o,at=s,lt=ba,r=e["__core-js_shared__"],ht=(r=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",ct=Function.prototype.toString,ut=ea,dt=ba,pt=ia,ft=/^\[object .+?Constructor\]$/,r=Function.prototype,l=Object.prototype,r=r.toString,l=l.hasOwnProperty,yt=RegExp("^"+r.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),r=ta(e,"Map"),l=ta(Object,"create"),gt=l,vt=l,Ct=Object.prototype.hasOwnProperty,mt=l,bt=Object.prototype.hasOwnProperty,_t=l;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__=gt?gt(null):{},this.size=0},Hash$1$1.prototype.delete=Da,Hash$1$1.prototype.get=Ea,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]=_t&&void 0===e?"__lodash_hash_undefined__":e,this};function Ia(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 kt=Hash$1$1,Pt=o,wt=r,xt=Ia,Et=Ia,St=Ia,It=Ia;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 kt,map:new(wt||Pt),string:new kt}},MapCache$1$1.prototype.delete=function mapCacheDelete$1(t){return t=xt(this,t).delete(t),this.size-=t?1:0,t},MapCache$1$1.prototype.get=function mapCacheGet$1(t){return Et(this,t).get(t)},MapCache$1$1.prototype.has=function mapCacheHas$1(t){return St(this,t).has(t)},MapCache$1$1.prototype.set=function mapCacheSet$1(t,e){var n=It(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};function Sa(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t}function Ta(t){return this.__data__.get(t)}function Ua(t){return this.__data__.has(t)}var Ot=o,Mt=r,jt=MapCache$1$1,Bt=o;function Stack$1$1(t){t=this.__data__=new Bt(t),this.size=t.size}Stack$1$1.prototype.clear=function stackClear$1(){this.__data__=new st,this.size=0},Stack$1$1.prototype.delete=Sa,Stack$1$1.prototype.get=Ta,Stack$1$1.prototype.has=Ua,Stack$1$1.prototype.set=function stackSet$1(t,e){var n=this.__data__;if(n instanceof Ot){var i=n.__data__;if(!Mt||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new jt(i)}return n.set(t,e),this.size=n.size,this};function Za(t,e,n){"__proto__"==e&&Rt?Rt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function a0(t,e,n){(void 0===n||Nt(t[e],n))&&(void 0!==n||e in t)||zt(t,e,n)}function h0(e,n){return function(t){return e(n(t))}}function k0(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||qt)}function q0(t){return Jt(t)&&"[object Arguments]"==Qt(t)}function w0(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991}function z0(t){return null!=t&&te(t.length)&&!Yt(t)}function Q0(t){return fe(t)&&de(t.length)&&!!m[ue(t)]}function X0(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function cb(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&_e.test(t))&&-1<t&&t%1==0&&t<e}function mb(t,e){var n,i=Pe(t),o=!i&&ke(t),r=!i&&!o&&we(t),s=!i&&!o&&!r&&Ee(t),a=i||o||r||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):[],h=l.length;for(n in t)!e&&!Ie.call(t,n)||a&&("length"==n||r&&("offset"==n||"parent"==n)||s&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||xe(n,h))||l.push(n);return l}function nb(t){if(!Oe(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=je(t),i=[];for(e in t)("constructor"!=e||!n&&Be.call(t,e))&&i.push(e);return i}function pb(t){return Ae(t)?mb(t,!0):nb(t)}function Jb(t,e,n,i,o,r,s){var a,l,h,c=Ge(t,n),u=Ge(e,n),d=s.get(u);d||((e=void 0===(d=r?r(c,u,n+"",t,e,s):void 0))&&(l=!(a=qe(u))&&Ue(u),h=!a&&!l&&Ke(u),d=u,a||l||h?d=qe(c)?c:Fe(c)?De(c):l?ze(u,!(e=!1)):h?Ne(u,!(e=!1)):[]:Je(u)||Xe(u)?Xe(d=c)?d=function toPlainObject$1(t){return Te(t,Le(t))}(c):Qe(c)&&!We(c)||(d=He(u)):e=!1),e&&(s.set(u,d),o(d,u,i,r,s),s.delete(u))),$e(t,n,d)}function Nb(t){return t}function Ob(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 Qb(t){return function(){return t}}function Wb(r,s,a){return s=sn(void 0===s?r.length-1:s,0),function(){for(var t=arguments,e=-1,n=sn(t.length-s,0),i=Array(n);++e<n;)i[e]=t[s+e];for(var e=-1,o=Array(s+1);++e<s;)o[e]=t[e];return o[s]=a(i),Ob(r,this,o)}}function a1(i,o,r,s,a){i!==o&&tn(o,function(t,e){var n;a=a||new Ze,en(t)?Jb(i,o,e,r,a1,s,a):(n=s?s(rn(i,e),t,e+"",i,o,a):void 0,Ye(i,e,n=void 0===n?t:n))},nn)}var At,Tt,Lt,l=Stack$1$1,$t=ta,o=function(){try{var t=$t(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Rt=o,zt=Za,Nt=R,c=function createBaseFor$1(l){return function(t,e,n){for(var i=-1,o=Object(t),r=n(t),s=r.length;s--;){var a=r[l?s:++i];if(!1===e(o[a],a,o))break}return t}}(),Dt={exports:{}},Ht=(Lt=(f=(f=(d=(d=(g=Dt).exports)&&!d.nodeType&&d)&&g&&!g.nodeType&&g)&&f.exports===d?e.Buffer:void 0)?f.allocUnsafe:void 0,g.exports=function cloneBuffer(t,e){return e?t.slice():(e=t.length,e=Lt?Lt(e):new t.constructor(e),t.copy(e),e)},e.Uint8Array),Vt=ba,Xt=Object.create,d=h0(Object.getPrototypeOf,Object),qt=Object.prototype,Ft=function(t){return Vt(t)?Xt?Xt(t):(object.prototype=t,t=new object,object.prototype=void 0,t):{}},Ut=d,Wt=k0,Qt=s,Jt=u,Kt=u,f=Object.prototype,Gt=f.hasOwnProperty,Zt=f.propertyIsEnumerable,g=q0(function(){return arguments}())?q0:function(t){return Kt(t)&&Gt.call(t,"callee")&&!Zt.call(t,"callee")},Yt=ea,te=w0,ee=z0,ne=u,f={exports:{}},ie=(b=((v=(v=(b=(b=(C=f).exports)&&!b.nodeType&&b)&&C&&!C.nodeType&&C)&&v.exports===b?e.Buffer:void 0)?v.isBuffer:void 0)||function stubFalse(){return!1},C.exports=b,s),oe=d,se=u,v=Function.prototype,C=Object.prototype,ae=v.toString,le=C.hasOwnProperty,he=ae.call(Object),ue=s,de=w0,fe=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:{}}),C=(At=(v=(v=(d=b).exports)&&!v.nodeType&&v)&&d&&!d.nodeType&&d,Tt=At&&At.exports===v&&t.process,v=function(){try{return At&&At.require&&At.require("util").types||Tt&&Tt.binding&&Tt.binding("util")}catch(t){}}(),d.exports=v,Q0),t=b.exports,d=t&&t.isTypedArray,v=d?function baseUnary$1(e){return function(t){return e(t)}}(d):C,ye=Za,ge=R,ve=Object.prototype.hasOwnProperty,Ce=function assignValue$1(t,e,n){var i=t[e];ve.call(t,e)&&ge(i,n)&&(void 0!==n||e in t)||ye(t,e,n)},me=Za,_e=/^(?:0|[1-9]\d*)$/,ke=g,Pe=i,we=f.exports,xe=cb,Ee=v,Ie=Object.prototype.hasOwnProperty,Oe=ba,je=k0,Be=Object.prototype.hasOwnProperty,Ae=z0,Te=function copyObject$1(t,e,n,i){var o=!n;n=n||{};for(var r=-1,s=e.length;++r<s;){var a=e[r],l=i?i(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),(o?me:Ce)(n,a,l)}return n},Le=pb,$e=a0,ze=Dt.exports,Ne=function cloneTypedArray$1(t,e){return e=e?function cloneArrayBuffer$1(t){var e=new t.constructor(t.byteLength);return new Ht(e).set(new Ht(t)),e}(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.length)},De=function copyArray$1(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e},He=function initCloneObject$1(t){return"function"!=typeof t.constructor||Wt(t)?{}:Ft(Ut(t))},Xe=g,qe=i,Fe=function isArrayLikeObject$1(t){return ne(t)&&ee(t)},Ue=f.exports,We=ea,Qe=ba,Je=function isPlainObject$1(t){return!(!se(t)||"[object Object]"!=ie(t))&&(null===(t=oe(t))||"function"==typeof(t=le.call(t,"constructor")&&t.constructor)&&t instanceof t&&ae.call(t)==he)},Ke=v,Ge=X0,Ze=l,Ye=a0,tn=c,en=ba,nn=pb,rn=X0,sn=Math.max,an=o,ln=Date.now,b=function shortOut$1(n){var i=0,o=0;return function(){var t=ln(),e=16-(t-o);if(o=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(an?function(t,e){return an(t,"toString",{configurable:!0,enumerable:!1,value:Qb(e),writable:!0})}:Nb),hn=Nb,cn=b,un=R,dn=z0,pn=cb,fn=ba,yn=function createAssigner$1(a){return function baseRest$1(t,e){return cn(Wb(t,e,hn),t+"")}(function(t,e){var n=-1,i=e.length,o=1<i?e[i-1]:void 0,r=2<i?e[2]:void 0,o=3<a.length&&"function"==typeof o?(i--,o):void 0;for(r&&function isIterateeCall$1(t,e,n){var i;if(fn(n))return i=typeof e,("number"==i?dn(n)&&pn(e,n.length):"string"==i&&e in n)&&un(n[e],t)}(e[0],e[1],r)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var s=e[n];s&&a(t,s,n,o)}return t})}(function(t,e,n){a1(t,e,n)}),gn="undefined"!=typeof Float32Array?Float32Array:Array,vn=Math.PI/180;function object(){}function toRadian(t){return t*vn}function invert(t,e){var n=e[0],i=e[1],o=e[2],r=e[3],s=e[4],a=(e=e[5],n*r-i*o);return a?(t[0]=r*(a=1/a),t[1]=-i*a,t[2]=-o*a,t[3]=n*a,t[4]=(o*e-r*s)*a,t[5]=(i*s-n*e)*a,t):null}function multiply(t,e,n){var i=e[0],o=e[1],r=e[2],s=e[3],a=e[4],l=(e=e[5],n[0]),h=n[1],c=n[2],u=n[3],d=n[4];return n=n[5],t[0]=i*l+r*h,t[1]=o*l+s*h,t[2]=i*c+r*u,t[3]=o*c+s*u,t[4]=i*d+r*n+a,t[5]=o*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 gn(2);gn!=Float32Array&&(t[0]=0,t[1]=0)}();function y1(t){if(!Cn(t))return mn(t);var e,n=[];for(e in Object(t))bn.call(t,e)&&"constructor"!=e&&n.push(e);return n}function H1(t){if(null==t)return!0;if(jn(t)&&(Mn(t)||"string"==typeof t||"function"==typeof t.splice||Bn(t)||Tn(t)||On(t)))return!t.length;var e,n=In(t);if("[object Map]"==n||"[object Set]"==n)return!t.size;if(An(t))return!y1(t).length;for(e in t)if(Ln.call(t,e))return!1;return!0}var t=null,_=((t=window||global||{}).requestFrame=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame,t),k=(_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),d=h0(Object.keys,Object),Cn=k0,mn=d,bn=Object.prototype.hasOwnProperty,C=ta(e,"DataView"),Dt=r,l=ta(e,"Promise"),c=ta(e,"Set"),o=ta(e,"WeakMap"),_n=s,kn=ia,Pn=kn(C),wn=kn(Dt),xn=kn(l),En=kn(c),Sn=kn(o),b=_n,In=((C&&"[object DataView]"!=b(new C(new ArrayBuffer(1)))||Dt&&"[object Map]"!=b(new Dt)||l&&"[object Promise]"!=b(l.resolve())||c&&"[object Set]"!=b(new c)||o&&"[object WeakMap]"!=b(new o))&&(b=function(t){var e=_n(t);if(t=(t="[object Object]"==e?t.constructor:void 0)?kn(t):"")switch(t){case Pn:return"[object DataView]";case wn:return"[object Map]";case xn:return"[object Promise]";case En:return"[object Set]";case Sn:return"[object WeakMap]"}return e}),b),On=g,Mn=i,jn=z0,Bn=f.exports,An=k0,Tn=v,Ln=Object.prototype.hasOwnProperty,t=(_createClass(ICEEventTarget,[{key:"on",value:function on(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_;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]:_;if(i=this.listeners[t])for(var i=_toConsumableArray(i),o=0;o<i.length;o++){var r=i[o];if(r.callback===e&&r.scope===n)return void this.listeners[t].splice(o,1)}}},{key:"once",value:function once(e,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_,o=this;o.on(e,function callback(t){o.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(H1(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;n?((e=new k(n)).originalEvent=n.originalEvent||n,e.param=_objectSpread2({},i)):e=new k({type:t,timeStamp:Date.now(),param:_objectSpread2({},i)});for(var o=this.listeners[t],r=0;r<o.length;r++){var s=o[r];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]:_;if(!this.listeners[t])return!1;var i=this.listeners[t];if(!i)return!1;for(var o=0;o<i.length;o++){var r=i[o];if(r.callback===e&&r.scope===n)return!0}return!1}}]),ICEEventTarget),$n=(t.prototype.addEventListener=t.prototype.on,t.prototype.removeEventListener=t.prototype.off,t.prototype.dispatchEvent=t.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),Rn=(_createClass(ICEBoundingBox,[{key:"containsPoint",value:function containsPoint(t){var e=(o=this.getMinAndMaxPoint()).minX,n=o.minY,i=o.maxX,o=o.maxY;if(t[0]<e||t[0]>i||t[1]<n||t[1]>o)return!1;for(var r=0,s=this.getBoundingLines(),a=0;a<s.length;a++){var l,h=s[a];t[1]>h.o[1]&&t[1]>h.d[1]||t[1]<h.o[1]&&t[1]<h.d[1]||(h.o[0]===h.d[0]&&h.o[0]>=t[0]?h.o[0]:(l=(h.d[1]-h.o[1])/(h.d[0]-h.o[0]),h.o[0]+(t[1]-h.o[1])/l))>t[0]&&r++}return 0!==r&&r%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],o=[this.tr,this.bl,this.br],r=0;r<o.length;r++){var s=o[r];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],o=this.br[1],r=t.tl[0],s=t.br[0],a=t.tl[1];return t=t.br[1],!(s<e||t<i||n<r||o<a)}},{key:"transform",value:function transform(t){var e=transformMat2d([],this.tl,t),n=transformMat2d([],this.tr,t),i=transformMat2d([],this.bl,t),o=transformMat2d([],this.br,t);return t=transformMat2d([],this.center,t),new ICEBoundingBox([].concat(_toConsumableArray(e),_toConsumableArray(n),_toConsumableArray(i),_toConsumableArray(o),_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 o=0<arguments.length&&void 0!==t?t:[],r=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<r.length;l++){var h=r[l];h._level=s,h._pid=a,o.push(h),flattenTree(o,h.childNodes||[],s+1,h.id)}return o}function Q1(t){return null==t}function Z1(t){return"symbol"==typeof t||oi(t)&&"[object Symbol]"==ii(t)}function $1(t){return t&&t.slice(0,function trimmedEndIndex$1(t){for(var e=t.length;e--&&ei.test(t.charAt(e)););return e}(t)+1).replace(ni,"")}function fc(t){if("number"==typeof t)return t;if(si(t))return NaN;if(ri(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=ri(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=$1(t);var e=li.test(t);return e||hi.test(t)?ci(t.slice(2),e?2:8):ai.test(t)?NaN:+t}function lc(t){if("string"==typeof t)return t;if(di(t))return function arrayMap$1(t,e){for(var n=-1,i=null==t?0:t.length,o=Array(i);++n<i;)o[n]=e(t[n],n,t);return o}(t,lc)+"";if(pi(t))return fi?fi.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function mc(t){var e=(t=function toFinite$1(t){return t?(t=ui(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 oc(t){return null==t?"":lc(t)}_inherits(ICEComponent,t),Zn=_createSuper(ICEComponent),_createClass(ICEComponent,[{key:"initEvents",value:function initEvents(){}},{key:"render",value:function render(){this.trigger(D),this.state.display&&(this.calcComponentParams(),this.applyStyleToCtx(),this.applyTransformToCtx(),this.doRender(),this.trigger(H),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 gn(6);return gn!=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],o=e[1],r=e[2],s=e[3],a=e[4],l=(e=e[5],n[0]);return n=n[1],t[0]=i*l,t[1]=o*l,t[2]=r*n,t[3]=s*n,t[4]=a,t[5]=e,t}([],function rotate(t,e,n){var i=e[0],o=e[1],r=e[2],s=e[3],a=e[4],l=(e=e[5],Math.sin(n));return n=Math.cos(n),t[0]=i*n+r*l,t[1]=o*n+s*l,t[2]=i*-l+r*n,t[3]=o*-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*vn,n*vn),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,o=this.state.height,e=new Rn([0-e,0-n,0-e+i,0-n,0-e,0-n+o,0-e+i,0-n+o,0,0]),i=t?this.composeMatrix():this.state.composedMatrix;return e.transform(i)}},{key:"getMaxBoundingBox",value:function getMaxBoundingBox(){var t=(i=(o=this.getMinBoundingBox(0<arguments.length&&void 0!==arguments[0]&&arguments[0])).getMinAndMaxPoint()).minX,e=i.minY,n=i.maxX,i=i.maxY,o=o.centerPoint;return new Rn([t,e,n,e,t,i,n,i,o[0],o[1]])}},{key:"setState",value:function setState(t){yn(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 k;this.trigger("BEFORE_MOVE",_objectSpread2(_objectSpread2({},n),{},{left:t,top:e})),this.setState({left:t,top:e}),this.trigger(a,_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 k;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 k;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-=$n.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 $n.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(F,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}]);var zn,Nn,Dn,Hn,Vn,Xn,qn,Fn,Un,Wn,Qn,Jn,Kn,Gn,Zn,d=ICEComponent,r=(_defineProperty$1(d,"instanceCounter",0),_inherits(ICEPath,d),Gn=_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),C=(_inherits(ICERect,r),Kn=_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),Dt=(_inherits(ICEGroup,C),Jn=_createSuper(ICEGroup),_createClass(ICEGroup,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEGroup.prototype),"initEvents",this).call(this),this.once(X,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(V),t.ice=this.ice,t.ctx=this.ice.ctx,t.evtBus=this.ice.evtBus,t.trigger(X)}},{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){yn(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),l=(_inherits(ICEControlPanel,Dt),Qn=_createSuper(ICEControlPanel),_createClass(ICEControlPanel,[{key:"doRender",value:function doRender(){_get(_getPrototypeOf(ICEControlPanel.prototype),"doRender",this).call(this),this.setControlPositions()}},{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),c=(_inherits(ICEEllipse,r),Wn=_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){Q1(t.radiusX)?Q1(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,Q1(t.radiusY)?Q1(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,_get(_getPrototypeOf(ICEEllipse.prototype),"setState",this).call(this,t)}}]),ICEEllipse),o=(_inherits(ICECircle,c),Un=_createSuper(ICECircle),_createClass(ICECircle)),Yn=(_inherits(ICELinkHook,o),Fn=_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(a,this.resizeEvtHandler,this)}},{key:"mosueDownHandler",value:function mosueDownHandler(t){this.evtBus.trigger(W,new k({target:this}))}},{key:"mosueMoveHandler",value:function mosueMoveHandler(t){this.evtBus.trigger(Q,new k({target:this}))}},{key:"mosueUpHandler",value:function mosueUpHandler(t){this.evtBus.trigger(J,new k({target:this}))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(K,new k(t,{position:e})),this.parentNode.trigger(h,new k(t,{position:e})))}}]),ICELinkHook),ti=(_inherits(LineControlPanel,l),qn=_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 Yn({zIndex:10000011,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 Yn({zIndex:10000012,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(h,this.resizeEvtHandler,this)}},{key:"enable",value:function enable(){this.setState({display:!0}),this.resume(h),this.showHooks()}},{key:"disable",value:function disable(){this.setState({display:!1}),this.suspend(h),this.hideHooks()}},{key:"setControlPositions",value:function setControlPositions(){}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.targetComponent){var e=t.position,n=t.movementX,i=t.movementY,o=(t=this.targetComponent.state).points.length,r=t.points[0][0],s=t.points[0][1],a=t.points[o-1][0],l=t.points[o-1][1],n=(o=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)))[0],i=o[1];switch(e){case"start":r+=n,s+=i;break;case"end":a+=n,l+=i}this.targetComponent.setState({startPoint:[r,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(a,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(a,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(F,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),ei=/\s/,ni=/^\s+/,ii=s,oi=u,ri=ba,si=Z1,ai=/^[-+]0x[0-9a-f]+$/i,li=/^0b[01]+$/i,hi=/^0o[0-7]+$/i,ci=parseInt,ui=fc,di=i,pi=Z1,b=n?n.prototype:void 0,fi=b?b.toString:void 0,yi=fc,gi=e.isFinite,vi=Math.min,P=function createRound$1(t){var o=Math[t];return function(t,e){var n,i;return t=yi(t),(e=null==e?0:vi(mc(e),292))&&gi(t)?(n=(oc(t)+"e").split("e"),i=o(n[0]+"e"+(+n[1]+e)),+((n=(oc(i)+"e").split("e"))[0]+"e"+(+n[1]-e))):o(t)}}("round"),Ci=(_inherits(ResizeControl,C),Xn=_createSuper(ResizeControl),_createClass(ResizeControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ResizeControl.prototype),"initEvents",this).call(this),this.on(a,this.resizeEvtHandler,this)}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.parentNode){var e,n=t.quadrant,i=t.movementX,o=t.movementY,r=(e=this.parentNode.state).left,s=e.top,a=e.width,l=e.height,i=(e=transformMat2d([],[i,o],invert([],e.absoluteLinearMatrix)))[0],o=e[1];switch(n){case 1:r-=i,s+=o,a+=2*i,l-=2*o;break;case 2:r+=i,s+=o,a-=2*i,l-=2*o;break;case 3:r+=i,s-=o,a-=2*i,l+=2*o;break;case 4:r-=i,s-=o,a+=2*i,l+=2*o;break;case 5:s+=o,l-=2*o;break;case 6:s-=o,l+=2*o;break;case 7:r+=i,a-=2*i;break;case 8:r-=i,a+=2*i}e={top:s,left:r,width:Math.abs(a),height:Math.abs(l)},this.parentNode.trigger(K,new k(t,{quadrant:n})),this.parentNode.setState(e),this.parentNode.trigger(h,new k(t,{quadrant:n}))}}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new k,i=0<t?1:-1,o=0<e?1:-1,r=(c=this.parentNode.state).localOrigin,s=c.width,a=c.height,l=(t=(c=transformMat2d([],[t,e],invert([],c.absoluteLinearMatrix)))[0],e=c[1],(c=this.state).left),h=c.top,c=c.quadrant,u=this.state.width/2,d=0;"x"===this.state.direction?d=0<(l=0===P(l+=t)?.5*i:l)+u-r[0]?8:7:"y"===this.state.direction?d=0<(h=0===P(h+=e)?.5*o:h)+u-r[1]?6:5:"xy"===this.state.direction&&(o=-a/2/(0===P(o=-s/2)?.5*i:o),0===P(s/=2)&&(s=.5*i),h+=e=2===c||4==c?o*(l+u-r[0]+t)-(h+u-r[1]):-a/2/s*(l+u-r[0]+t)-(h+u-r[1]),d=0<(l+=t)+u-r[0]?0<h+u-r[1]?4:1:0<h+u-r[1]?3:2),c!==d&&this.parentNode.toggleControlQuadrant(this,d),this.setPosition(l,h,new k(n,{left:l,top:h,tx:t,ty:e,quadrant:d}))}}]),ResizeControl),mi=(_inherits(RotateControl,o),Vn=_createSuper(RotateControl),_createClass(RotateControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(RotateControl.prototype),"initEvents",this).call(this),this.on(a,this.rotateEvtHandler,this)}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteOrigin,t={transform:{rotate:$n.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger("BEFORE_ROTATE",new k(t)),this.parentNode.setState(t),this.parentNode.trigger(G,new k(t)))}}]),RotateControl),bi=(_inherits(TransformControlPanel,l),Hn=_createSuper(TransformControlPanel),_createClass(TransformControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=t/2,i=e/2,o=this.resizeControlSize/2,r=[{direction:"xy",quadrant:2,position:[-o,-o]},{direction:"y",quadrant:5,position:[n-o,-o]},{direction:"xy",quadrant:1,position:[t-o,-o]},{direction:"x",quadrant:8,position:[t-o,i-o]},{direction:"xy",quadrant:4,position:[t-o,e-o]},{direction:"y",quadrant:6,position:[n-o,e-o]},{direction:"xy",quadrant:3,position:[-o,e-o]},{direction:"x",quadrant:7,position:[-o,i-o]}];this.resizeControlInstanceCache=[];for(var s=0;s<r.length;s++){var a=new Ci({zIndex:10000002,display:!1,left:(a=r[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 mi({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(h,this.resizeEvtHandler,this),this.on(G,this.rotateEvtHandler,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(h),this.resume(G)}},{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(h),this.suspend(G)}},{key:"setControlPositions",value:function setControlPositions(){for(var t=this.state.width,e=this.state.height,n=t/2,i=e/2,o=this.resizeControlSize/2,r=0;r<this.resizeControlInstanceCache.length;r++){var s=this.resizeControlInstanceCache[r],a=[0,0];switch(s.state.quadrant){case 1:a=[t-o,-o];break;case 2:a=[-o,-o];break;case 3:a=[-o,e-o];break;case 4:a=[t-o,e-o];break;case 5:a=[n-o,-o];break;case 6:a=[n-o,e-o];break;case 7:a=[-o,i-o];break;case 8:a=[t-o,i-o]}s.setState({left:a[0],top:a[1]})}var l=this.state.width/2-this.rotateControlSize,h=-this.rotateControlffsetY;this.rotateControlInstance.setState({left:l,top:h})}},{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,o=(t=this.targetComponent.state).left,r=t.top,s=t.width,a=t.height,n=(t=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)))[0],i=t[1];switch(e){case 1:o-=n,r+=i,s+=2*n,a-=2*i;break;case 2:o+=n,r+=i,s-=2*n,a-=2*i;break;case 3:o+=n,r-=i,s-=2*n,a+=2*i;break;case 4:o-=n,r-=i,s+=2*n,a+=2*i;break;case 5:r+=i,a-=2*i;break;case 6:r-=i,a+=2*i;break;case 7:o+=n,s-=2*n;break;case 8:o-=n,s+=2*n}this.targetComponent.setState({left:o,top:r,width:Math.abs(s),height:Math.abs(a)}),this.targetComponent.trigger(h)}}},{key:"updatePanel",value:function updatePanel(){var t,e,n,i,o;this.targetComponent&&(t=this.targetComponent.getRotateAngle(),e=(o=this.targetComponent.getLocalLeftTop()).left,n=o.top,i=o.width,o=o.height,this.setState({left:e,top:n,width:i,height:o,transform:{rotate:t}}))}},{key:"targetComponent",get:function get(){return this._targetComponent},set:function set(t){var e=this;this._targetComponent&&this._targetComponent.off(a,this.updatePanel,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(a,this.updatePanel,this),this._targetComponent&&this._targetComponent.once(F,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 o=0;switch(e){case 1:o=3;break;case 2:o=4;break;case 3:o=1;break;case 4:o=2;break;case 5:o=6;break;case 6:o=5;break;case 7:o=8;break;case 8:o=7}i.setState({quadrant:o})}}t.setState({quadrant:e})}}]),TransformControlPanel),_i=(_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&&("ICEControlPanel"===t.__typeName||t.parentNode&&"ICEControlPanel"===t.parentNode.__typeName)||(this.ice.selectionList=[t],this.lineControlPanel.disable(),this.transformControlPanel.disable(),"ICEPolyLine"===t.__typeName?(this.lineControlPanel.targetComponent=t,this.lineControlPanel.enable()):(this.transformControlPanel.targetComponent=t,this.transformControlPanel.enable()))}}]),ICEControlPanelManager),ki=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dbclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],Pi=(_createClass(DOMEventBridge,[{key:"start",value:function start(){for(var i=this,o=null,t=0;t<ki.length;t++)!function H8(t){var e=(t=ki[t])[1],n=t[0];i.ice.evtBus.on(e,function(t){i._stopped||((o="ICE_MOUSEMOVE"!==e?i.findTargetComponent(t):o)&&(t.target=o).trigger(n,t),i.ice.evtBus.trigger(n,t))})}(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.toolNodes),flattenTree([],this.ice.childNodes)),o=[].concat(_toConsumableArray(t),_toConsumableArray(i));o.sort(function(t,e){return t.state.zIndex-e.state.zIndex});for(var r=0;r<o.length;r++){var s=o[r],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}}]),DOMEventBridge),wi=(_inherits(EventBus,t),Dn=_createSuper(EventBus),_createClass(EventBus)),xi=(_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),M=(_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),g=(_inherits(ICEDotPath,r),Nn=_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],o=1;o<this.state.dots.length;o++){var r=this.state.dots[o];r[0]<t&&(t=r[0]),r[0]>n&&(n=r[0]),r[1]<e&&(e=r[1]),r[1]>i&&(i=r[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 o=transformMat2d([],e[i],t);n.push(o)}return n}}]),ICEDotPath),f=(_inherits(ICEImage,d),zn=_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),zn.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),Nn.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),Dn.call(this)}function DOMEventBridge(t){_classCallCheck(this,DOMEventBridge),_defineProperty$1(this,"selectionCandidates",[]),_defineProperty$1(this,"_stopped",!1),this.ice=t}function ICEControlPanelManager(t){_classCallCheck(this,ICEControlPanelManager),this.ice=t,this.transformControlPanel=new bi({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 ti({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=Hn.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),Vn.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))}function ResizeControl(t){return _classCallCheck(this,ResizeControl),Xn.call(this,_objectSpread2(_objectSpread2({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}function LineControlPanel(t){return _classCallCheck(this,LineControlPanel),_defineProperty$1(_assertThisInitialized(t=qn.call(this,_objectSpread2(_objectSpread2({},t),{},{zIndex:10000010,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),Fn.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,Un.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,Wn.call(this,t)}function ICEControlPanel(t){return _classCallCheck(this,ICEControlPanel),_defineProperty$1(_assertThisInitialized(t=Qn.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))),"__typeName","ICEControlPanel"),t}function ICEGroup(t){return _classCallCheck(this,ICEGroup),_defineProperty$1(_assertThisInitialized(t=Jn.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),Kn.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=Gn.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=Zn.call(this)),"__typeName","ICEComponent"),_defineProperty$1(_assertThisInitialized(t),"__dirty",!0),_defineProperty$1(_assertThisInitialized(t),"props",{id:"ICE_"+function uuid(){if(_.crypto)return _.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",_objectSpread2({},t.props)),t.props=yn(t.props,e),t.state=JSON.parse(JSON.stringify(t.props)),t.root=_,t.initEvents(),t}_createClass(function ICEBezier(){_classCallCheck(this,ICEBezier)});_inherits(ICEPolyLine,g),Oi=_createSuper(ICEPolyLine),_createClass(ICEPolyLine,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEPolyLine.prototype),"initEvents",this).call(this),this.once(X,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function afterAddHandler(t){this.evtBus.once(U,this.makeConnection,this)}},{key:"makeConnection",value:function makeConnection(){var t,e,n=this.state.links;n&&(n.start&&(t=n.start.id,e=n.start.position,t&&e&&(t=this.ice.findComponent(t),this.setLink("start",t,e))),n.end&&(t=n.end.id,e=n.end.position,t&&e&&(n=this.ice.findComponent(t),this.setLink("end",n,e)))),this.ice.dirty=!0}},{key:"setLink",value:function setLink(t,e,n){this.removeLink(t,e,n),this.links[t]={component:e,position:n},e.on(a,this.followComponent,this),e.on(h,this.followComponent,this),e.on(G,this.followComponent,this),e.once(H,this.followComponent,this),this.followComponent();var i,o={};for(i in this.links){var r=this.links[i];r.component&&r.position&&(o[i]={id:r.component.props.id,position:r.position})}this.setState({links:_objectSpread2({},o),draggable:!1})}},{key:"removeLink",value:function removeLink(t,e,n){var i=this.links[t].component,o=this.links[t].position;i===e&&o===n&&(i&&i.off(a,this.followComponent,this),i&&i.off(h,this.followComponent,this),i&&i.off(G,this.followComponent,this),this.links[t]={},this.state.links[t]={}),this.links.start.component||this.links.end.component||this.setState({draggable:!0})}},{key:"followComponent",value:function followComponent(t){for(var e in this.links){var n=this.links[e].position,i=this.links[e].component;if(n&&i){var o=i.getMinBoundingBox(),r=[0,0];switch(n){case"T":r=o.tc;break;case"R":r=o.rc;break;case"B":r=o.bc;break;case"L":r=o.lc}switch(e){case"start":this.setState({startPoint:_toConsumableArray(r)});break;case"end":this.setState({endPoint:_toConsumableArray(r)})}}}}},{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=(o=this.state.points[n])[0]-t,o=o[1]-e;this.state.dots.push([i,o])}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)),o=Math.sin(this.state.arrowAngel),r=this.state.arrowLength*(n*i-t*o),s=this.state.arrowLength*(t*i+n*o),a=this.state.arrowLength*(n*i+t*o);return t=this.state.arrowLength*(t*i-n*o),[[r+=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=P(this.state.points[0][0],2),i=P(this.state.points[0][1],2),o=0,r=[P(this.state.points[e-1][0],2)-n,P(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=r[0]*a[1]-r[1]*a[0],(t=[])[0]=t[1]=0,t[2]=a,t[2])&&o++}return o===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,o=Math.cos(n*Math.PI/180)*i/2,n=Math.sin(n*Math.PI/180)*i/2;return[[0+(o=P(o,3)),0+(n=P(n,3))],[0-o,0-n],[e+o,t+n],[e-o,t-n]]}},{key:"getMinBoundingBox",value:function getMinBoundingBox(){var t=this.state.localOrigin[0],e=this.state.localOrigin[1],n=this.calc4VertexPoints();return(t=new Rn([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(Q1(t.width)||delete t.width,Q1(t.height)||delete t.height,Q1(t.transform)||delete t.transform,!Q1(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(!Q1(t.top))for(var i=t.top-this.state.points[0][1],o=0;o<this.state.points.length;o++)this.state.points[o][1]+=i;var r;Q1(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]),Q1(t.endPoint)||(r=this.state.points.length,this.state.points[r-1]=_toConsumableArray(t.endPoint)),_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],$n.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 o=(a=n[i]).o[0],r=a.o[1],s=a.d[0],a=a.d[1],l=Math.hypot(s-o,a-r);if(l-3<=(o=Math.hypot(o-t,r-e))+(r=Math.hypot(s-t,a-e))&&o+r<=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:"arrangeParam",value:function arrangeParam(t){var e=yn({},{lineType:"solid",lineWidth:1,arrow:"none",arrowLength:15,arrowAngel:30*vn,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}}]);var Ei,Si,Ii,Oi,Mi,ji=ICEPolyLine,Bi=(_inherits(ICELinkSlot,o),Ii=_createSuper(ICELinkSlot),_createClass(ICELinkSlot,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICELinkSlot.prototype),"initEvents",this).call(this),this.once(D,this.beforeRenderHandler,this),this.once(F,this.beforeRemoveHandler,this)}},{key:"beforeRenderHandler",value:function beforeRenderHandler(t){this.evtBus.on(W,this.hookMouseDownHandler,this),this.evtBus.on(Q,this.hookMouseMoveHandler,this),this.evtBus.on(J,this.hookMouseUpHandler,this),this.evtBus.on("mouseup",this.globalMouseUpHandler,this)}},{key:"beforeRemoveHandler",value:function beforeRemoveHandler(t){this.evtBus.off(W,this.hookMouseDownHandler,this),this.evtBus.off(Q,this.hookMouseMoveHandler,this),this.evtBus.off(J,this.hookMouseUpHandler,this),this.evtBus.off("mouseup",this.globalMouseUpHandler,this),this._hostComponent=null}},{key:"globalMouseUpHandler",value:function globalMouseUpHandler(){this.setState({display:!1})}},{key:"hookMouseDownHandler",value:function hookMouseDownHandler(t){console.log("linkslot, hook mousedown event..."),this._hostComponent&&this.setState({display:!0})}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){t=t.target,this.isIntersectWithHook(t)?(this.setState({style:{fillStyle:"#fffb00"}}),t._currentAboveSlot=this,t.setState({style:{fillStyle:"#fffb00"}})):(this.setState({style:{fillStyle:"#3ce92c"}}),t._currentAboveSlot===this&&t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"hookMouseUpHandler",value:function hookMouseUpHandler(t){var e,n;this._hostComponent&&(e=(t=t.target).parentNode.targetComponent,n=t.state.position,this.isIntersectWithHook(t)?e&&e.setLink(n,this._hostComponent,this.props.position):e&&e.removeLink(n,this._hostComponent,this.props.position),this.setState({display:!1,style:{fillStyle:"#3ce92c"}}),t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"isIntersectWithHook",value:function isIntersectWithHook(t){var e=this.getMaxBoundingBox();return t=t.getMaxBoundingBox(),!!e.isIntersect(t)}},{key:"updatePosition",value:function updatePosition(){console.log("link slot update position ...");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(H,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(H,this.updatePosition,this),this._hostComponent&&this._hostComponent.once(F,function(){e._hostComponent=null,e.setState({display:!1})},this),this._hostComponent&&this.setState({display:!0})}}]),ICELinkSlot),v=(_inherits(ICEVisioLink,ji),Si=_createSuper(ICEVisioLink),_createClass(ICEVisioLink,[{key:"calcDots",value:function calcDots(){var t=this.interpolate(),e=this.state,n=e.left,i=e.top,o=t[0][2];this.state.points=[],this.state.dots=[];for(var r=0;r<o.length;r++){var s=o[r];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],o=(t=this.state.points[t-1][1],new M(e,n)),r=new M(i,t),s=[],a=null,l=null,h=[],c=new Rn,u=new Rn;if(e=this.links.start.component){c=e.getMinBoundingBox(),s[0]=new M(o.x,c.tl[1]-this.state.escapeDistance),s[1]=new M(c.tr[0]+this.state.escapeDistance,o.y),s[2]=new M(o.x,c.br[1]+this.state.escapeDistance),s[3]=new M(c.tl[0]-this.state.escapeDistance,o.y);for(var a=s[0],d=1;d<s.length;d++)this.distance(o,s[d])<this.distance(o,a)&&(a=s[d])}if(n=this.links.end.component){u=n.getMinBoundingBox(),s[0]=new M(r.x,u.tl[1]-this.state.escapeDistance),s[1]=new M(u.tr[0]+this.state.escapeDistance,r.y),s[2]=new M(r.x,u.br[1]+this.state.escapeDistance),s[3]=new M(u.tl[0]-this.state.escapeDistance,r.y);for(var l=s[0],p=1;p<s.length;p++)this.distance(r,s[p])<this.distance(r,l)&&(l=s[p])}i=0,t=[o],a&&(t.push(a),i=1),l&&t.push(l),t.push(r),e=M.cloneArray(t),h.push(["s0","s0",e]),n=M.cloneArray(t),(e=M.cloneArray(n)).splice(i+1,0,new M(e[i].x,e[i+1].y)),h.push(["s1","s1_1",e]),(t=M.cloneArray(n)).splice(i+1,0,new M(t[i+1].x,t[i].y)),h.push(["s1","s1_2",t]);var e=M.cloneArray(n),t=new M((e[i].x+e[i+1].x)/2,e[i].y),f=new M((e[i].x+e[i+1].x)/2,e[i+1].y);e.splice(i+1,0,t,f),h.push(["s2","s2_1",e]),t=M.cloneArray(n),f=new M(t[i].x,(t[i].y+t[i+1].y)/2),e=new M(t[i+1].x,(t[i].y+t[i+1].y)/2),e=[(t.splice(i+1,0,f,e),h.push(["s2","s2_2",t]),(f=M.cloneArray(n))[i].x+20),f[i+1].x+20],c&&e.push(c.br[0]+20),u&&e.push(u.br[0]+20),t=this.max(e),e=new M(t,f[i].y),t=new M(t,f[i+1].y),t=[(f.splice(i+1,0,e,t),h.push(["s2","s2_3",f]),(e=M.cloneArray(n))[i].y-20),e[i+1].y-20],c&&t.push(c.tl[1]-20),u&&t.push(u.tl[1]-20),f=this.min(t),t=new M(e[i].x,f),f=new M(e[i+1].x,f),f=[(e.splice(i+1,0,t,f),h.push(["s2","s2_4",e]),(t=M.cloneArray(n))[i].x-20),t[i+1].x-20],c&&f.push(c.tl[0]-20),u&&f.push(u.tl[0]-20),e=this.min(f),f=new M(e,t[i].y),e=new M(e,t[i+1].y),e=[(t.splice(i+1,0,f,e),h.push(["s2","s2_5",t]),(f=M.cloneArray(n))[i].y+20),f[i+1].y+20],c&&e.push(c.tl[1]+c.height+20),u&&e.push(u.tl[1]+u.height+20),t=this.max(e),n=new M(f[i].x,t),e=new M(f[i+1].x,t),f.splice(i+1,0,n,e),h.push(["s2","s2_6",f]);for(var y=[],g=0;g<h.length;g++){var v=h[g][2];this.orthogonalPath(v)&&y.push(h[g])}if(h=y,!o.equals(r)){for(var C=[],m=0;m<h.length;m++){var b=h[m][2];this.forwardPath(b)&&C.push(h[m])}(h=C).length}for(var _=[],k=0;k<h.length;k++){var P=!1,w=h[k][2].slice();(u||c)&&(w=w.slice(1,w.length-1)),c&&(P=P||this.polylineIntersectsRectangle(w,c)),(P=u?P||this.polylineIntersectsRectangle(w,u):P)||_.push(h[k])}(h=0!=_.length?_:h).length;for(var x=h[0][2].length,E=[],S=0;S<h.length;S++)h[S][2].length==x&&E.push(h[S]);for(var h=E,I=0,O=0;O<h.length;O++)this.scorePath(h[I][2])<this.scorePath(h[O][2])&&(I=O);return[h[I]]}},{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&&(o=t,t=e,e=o),o=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),n=t.startPoint.y-o*t.startPoint.x,i=e.startPoint.x,t.contains(i,o=o*i+n)&&e.contains(i,o);var n=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),i=t.startPoint.y-n*t.startPoint.x,o=(e.endPoint.y-e.startPoint.y)/(e.endPoint.x-e.startPoint.x),r=e.startPoint.y-o*e.startPoint.x;return n==o?i==r&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y)):(o=n*(r=(r-i)/(n-o))+i,t.contains(r,o)&&e.contains(r,o))}},{key:"polylineIntersectsRectangle",value:function polylineIntersectsRectangle(t,e){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=[];i.push(new xi(new M(e.x1,e.y1),new M(e.x2,e.y1))),i.push(new xi(new M(e.x2,e.y1),new M(e.x2,e.y2))),i.push(new xi(new M(e.x2,e.y2),new M(e.x1,e.y2))),i.push(new xi(new M(e.x1,e.y2),new M(e.x1,e.y1)));for(var o=0;o<t.length-1;o++)for(var r=new xi(t[o],t[o+1]),s=0;s<i.length;s++)if(this.lineIntersectsLine(r,i[s]))return!0;if(n)for(var a=new xi(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 Q1(t.startPoint)&&(t.startPoint=[0,0]),Q1(t.endPoint)&&(t.endPoint=[10,10]),t.points=[_toConsumableArray(t.startPoint),_toConsumableArray(t.endPoint)],_objectSpread2({escapeDistance:30},t)}}]),ICEVisioLink),i=(_inherits(ICEIsogon,g),Ei=_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),o=Math.floor(e*Math.cos(i)+e),i=Math.floor(e*Math.sin(i)+e);this.state.dots.push([o,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){Q1(t.radius)?Q1(t.width)?Q1(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,Ei.call(this,t)}function ICEVisioLink(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEVisioLink),t=ICEVisioLink.arrangeParam(t),Si.call(this,t)}function ICELinkSlot(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkSlot),Ii.call(this,_objectSpread2({linkable:!1,draggable:!1,position:"T"},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=Oi.call(this,t)),"__typeName","ICEPolyLine"),_defineProperty$1(_assertThisInitialized(t),"links",{start:{},end:{}}),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,Mi.call(this,t)}_inherits(ICERose,g),Mi=_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,o=Math.PI/this.state.pointNumber,r=0;n=t+t*Math.sin(e*r)*Math.cos(r),i=t+t*Math.sin(e*r)*Math.sin(r),this.state.dots.push([n,i]),!((r+=o)>=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){Q1(t.radius)?Q1(t.width)?Q1(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,g),Li=_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,o=this.state.outerRadius,r=this.state.innerRadius,s=0;s<this.state.spikes;s++)t=Math.cos(n)*o+o,e=Math.sin(n)*o+o,this.state.dots.push([t,e]),n+=i,t=Math.cos(n)*r+o,e=Math.sin(n)*r+o,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){Q1(t.outerRadius)?Q1(t.width)?Q1(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 Ai,Ti,Li,n=ICEStar,$i="__ICE_UTILS_TEXT_MEASURE_DIV__",Ri=(_inherits(ICEText,d),Ti=_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($i))){(e=this.root.document.createElement("div")).setAttribute("id",$i);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 o=this.state.style,r=o.paddingTop,s=o.paddingBottom,a=o.paddingLeft,l=o.paddingRight,h={width:e.offsetWidth+a+l,height:e.offsetHeight+r+s};return this.props.width=h.width,this.props.height=h.height,this.state.width=h.width,this.state.height=h.height,{width:this.state.width,height:this.state.height}}catch(t){console.error(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)}}]),ICEText),zi={ICERect:C,ICECircle:o,ICEEllipse:c,ICEStar:n,ICEIsogon:i,ICEText:Ri,ICEImage:f,ICEGroup:Dt,ICEVisioLink:v,ICEPolyLine:ji},Ni=(_createClass(DDManager,[{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.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this),this}},{key:"mouseDownHandler",value:function mouseDownHandler(t){(t=t.target).ice?t.state.interactive&&t.state.draggable&&(this.currentObj=t,this.ice.evtBus.on("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.on("mouseup",this.mouseUpHandler,this)):console.warn("DDManager: 点击在 canvas 画布上,没有点击任何图形。")}},{key:"mouseMoveHandler",value:function mouseMoveHandler(t){var e=t.movementX,n=t.movementY;return this.currentObj.moveGlobalPosition(e,n,t),!0}},{key:"mouseUpHandler",value:function mouseUpHandler(t){this.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this)}}]),DDManager),Di={evtBuses:[],start:function start(){if(_&&_.addEventListener){function Ep(t){for(var n=Di.evtBuses[t],e=0;e<ki.length;e++)!function Ip(t){var e=ki[t];_.addEventListener(e[0],function(t){n.trigger(e[1],t)})}(e)}for(var t=0;t<Di.evtBuses.length;t++)Ep(t)}},regitserEvtBus:function regitserEvtBus(t){Di.evtBuses.includes(t)||Di.evtBuses.push(t)},delEvtBus:function delEvtBus(t){Di.evtBuses.includes(t)&&Di.evtBuses.splice(Di.evtBuses.indexOf(t),1)}},w={evtBuses:[],stopped:!1,frameCallback:function frameCallback(){for(var t=0;t<w.evtBuses.length;t++){if(w.stopped)return;w.evtBuses[t].trigger(N)}w.stopped||_.requestFrame(w.frameCallback)},start:function start(){w.stopped=!1,_.requestFrame(w.frameCallback)},stop:function stop(){w.stopped=!0},pause:function pause(){},resume:function resume(){},regitserEvtBus:function regitserEvtBus(t){w.evtBuses.includes(t)||w.evtBuses.push(t)},delEvtBus:function delEvtBus(t){w.evtBuses.includes(t)&&w.evtBuses.splice(w.evtBuses.indexOf(t),1)}},Hi=(_createClass(ICELinkSlotManager,[{key:"start",value:function start(){return this.createLinkSlots(),this.ice.evtBus.on(Q,this.hookMouseMoveHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(Q,this.hookMouseMoveHandler,this),this}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){for(var e=t.target.getMaxBoundingBox(),n=_toConsumableArray(this.ice.childNodes),i=0;i<n.length;i++){var o=n[i];if(o&&o.state.linkable&&o.getMaxBoundingBox().isIntersect(e)){for(var r=0;r<this.ice._linkSlots.length;r++)this.ice._linkSlots[r].hostComponent=o;return}}}},{key:"createLinkSlots",value:function createLinkSlots(){var t,e,n,i;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new Bi({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"T",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(t),e=new Bi({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"R",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(e),n=new Bi({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"B",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(n),i=new Bi({zIndex:1e7,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),Vi=(_createClass(Deserializer,[{key:"fromJSON",value:function fromJSON(t){for(var e=JSON.parse(t).childNodes,n=0;n<e.length;n++)this.decodeRecursively(this.ice,e[n])}},{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 o=0;o<i.length;o++)this.decodeRecursively(n,i[o])}}]),Deserializer),Xi=(_createClass(Serializer,[{key:"toJSON",value:function toJSON(){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 console.log(t),JSON.stringify(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),qi=(_inherits(CanvasRenderer,t),Ai=_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():console.log("没有需要渲染的组件...")}},{key:"refreshQueue",value:function refreshQueue(){this.componentQueue=flattenTree([],this.ice.childNodes),this.componentQueue.sort(function(t,e){return t.state.zIndex-e.state.zIndex}),console.log("Component Queue length> ".concat(this.componentQueue.length)),this.toolsQueue=flattenTree([],this.ice.toolNodes),console.log("Tool Queue length> ".concat(this.ice.toolNodes.length))}},{key:"doRender",value:function doRender(){var t=Date.now();this.refreshQueue(),this.ice.ctx.clearRect(0,0,this.ice.canvasWidth,this.ice.canvasHeight);for(var e=0;e<this.componentQueue.length;e++){var n=this.componentQueue[e];n.root=this.ice.root,n.ctx=this.ice.ctx,n.evtBus=this.ice.evtBus,n.ice=this.ice,n.render()}for(var i=0;i<this.toolsQueue.length;i++){var o=this.toolsQueue[i];o.root=this.ice.root,o.ctx=this.ice.ctx,o.evtBus=this.ice.evtBus,o.ice=this.ice,o.render()}console.log("Render time ".concat(Date.now()-t," ms.")),this.ice.dirty=!1,this.ice.evtBus.trigger(U)}}]),CanvasRenderer),Fi=(_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(){console.error("ImageCache: 图片加载失败:",t)},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=Ai.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 DDManager(t){_classCallCheck(this,DDManager),this.ice=t}function ICEText(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEText),(t=yn({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=Ti.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,Li.call(this,t)}_defineProperty$1(Fi,"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 zi)this.typeMapping[e]=zi[e];return this.root=_,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 wi,w.regitserEvtBus(this.evtBus),w.start(),Di.regitserEvtBus(this.evtBus),Di.start(),this.eventBridge=new Pi(this).start(),this.animationManager=new Y(this).start(),this.ddManager=new Ni(this).start(),this.controlPanelManager=new _i(this).start(),this.renderer=new qi(this).start(),this.linkSlotManager=new Hi(this).start(),this.serializer=new Xi(this),this.deserializer=new Vi(this),this.imageCache=new Fi(this),this}},{key:"addTool",value:function addTool(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(V,null,{component:t}),t.trigger(V),t.ice=this,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(X,null,{component:t}),t.trigger(X))}},{key:"removeTool",value:function removeTool(t){this.evtBus.trigger(F,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(V,null,{component:t}),t.trigger(V),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(X,null,{component:t}),t.trigger(X))}},{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(F,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:"toJSON",value:function toJSON(){return this.serializer.toJSON()}},{key:"fromJSON",value:function fromJSON(t){var e=this,n=Date.now();w.stop(),this.renderer.stop(),this.eventBridge.stopped=!0,this.animationManager.stop(),this.ddManager.stop(),this.controlPanelManager.stop(),this.linkSlotManager.stop(),this.clearAll(),this.deserializer.fromJSON(t),w.start(),this.renderer.start(),this.animationManager.start(),this.ddManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(function(){e.eventBridge.stopped=!1},300),t=Date.now(),console.log("fromJSON> ".concat(t-n," ms"))}}]);function Vc(t){return null==t}function Xc(t,e){return t===e||t!=t&&e!=e}function Zc(t,e){for(var n=t.length;n--;)if(Ui(t[n][0],e))return n;return-1}function e2(t){var e=this.__data__;return!((t=Wi(e,t))<0||(t==e.length-1?e.pop():Qi.call(e,t,1),--this.size,0))}function f2(t){var e=this.__data__;return(t=Ji(e,t))<0?void 0:e[t][1]}function g2(t){return-1<Ki(this.__data__,t)}function h2(t,e){var n=this.__data__,i=Gi(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}var b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ui=Xc,Wi=Zc,Qi=Array.prototype.splice,Ji=Zc,Ki=Zc,Gi=Zc;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=e2,ListCache$4.prototype.get=f2,ListCache$4.prototype.has=g2,ListCache$4.prototype.set=h2;function k2(){this.__data__=new Zi,this.size=0}function l2(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t}function m2(t){return this.__data__.get(t)}function n2(t){return this.__data__.has(t)}function B2(t){return no.call(t)}function D2(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(oo&&oo in Object(t)?io:B2)(t)}function E2(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function I2(t){return!!so(t)&&("[object Function]"==(t=ro(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function X2(t){return!(!uo(t)||co(t))&&(ho(t)?yo:fo).test(po(t))}function Y2(t,e){return null==t?void 0:t[e]}function Z2(t,e){return t=Y2(t,e),X2(t)?t:void 0}function kd(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t}function ld(t){var e,n=this.__data__;return vo?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:Co.call(n,t)?n[t]:void 0}function md(t){var e=this.__data__;return mo?void 0!==e[t]:bo.call(e,t)}function nd(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=_o&&void 0===e?"__lodash_hash_undefined__":e,this}var e=ListCache$4,Zi=e,l="object"==typeof b&&b&&b.Object===Object&&b,r="object"==typeof self&&self&&self.Object===Object&&self,g=l||r||Function("return this")(),d=g.Symbol,C=Object.prototype,Yi=C.hasOwnProperty,to=C.toString,eo=d?d.toStringTag:void 0,no=Object.prototype.toString,io=function getRawTag$1(t){var e=Yi.call(t,eo),n=t[eo];try{var i=!(t[eo]=void 0)}catch(t){}var o=to.call(t);return i&&(e?t[eo]=n:delete t[eo]),o},oo=d?d.toStringTag:void 0,ro=D2,so=E2,o=g["__core-js_shared__"],ao=(c=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+c:"",lo=Function.prototype.toString,ho=I2,co=function isMasked$1(t){return!!ao&&ao in t},uo=E2,po=function toSource$1(t){if(null!=t){try{return lo.call(t)}catch(t){}try{return t+""}catch(t){}}return""},fo=/^\[object .+?Constructor\]$/,n=Function.prototype,i=Object.prototype,f=n.toString,v=i.hasOwnProperty,yo=RegExp("^"+f.call(v).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),t=Z2(g,"Map"),b=Z2(Object,"create"),go=b,vo=b,Co=Object.prototype.hasOwnProperty,mo=b,bo=Object.prototype.hasOwnProperty,_o=b;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__=go?go(null):{},this.size=0},Hash$1.prototype.delete=kd,Hash$1.prototype.get=ld,Hash$1.prototype.has=md,Hash$1.prototype.set=nd;function rd(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function sd(t,e){return t=t.__data__,rd(e)?t["string"==typeof e?"string":"hash"]:t.map}function yd(t){return t=xo(this,t).delete(t),this.size-=t?1:0,t}function zd(t){return Eo(this,t).get(t)}function Ad(t){return So(this,t).has(t)}function Bd(t,e){var n=Io(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}var ko=Hash$1,Po=e,wo=t,xo=sd,Eo=sd,So=sd,Io=sd;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 ko,map:new(wo||Po),string:new ko}},MapCache$1.prototype.delete=yd,MapCache$1.prototype.get=zd,MapCache$1.prototype.has=Ad,MapCache$1.prototype.set=Bd;function Kd(t,e){var n=this.__data__;if(n instanceof Oo){var i=n.__data__;if(!Mo||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new jo(i)}return n.set(t,e),this.size=n.size,this}var Oo=e,Mo=t,jo=MapCache$1,Bo=e,r=l2,C=m2,d=n2;function Stack$1(t){t=this.__data__=new Bo(t);this.size=t.size}Stack$1.prototype.clear=k2,Stack$1.prototype.delete=r,Stack$1.prototype.get=C,Stack$1.prototype.has=d,Stack$1.prototype.set=Kd;function Pd(t,e,n){"__proto__"==e&&zo?zo(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Sd(t,e,n){(void 0===n||Do(t[e],n))&&(void 0!==n||e in t)||No(t,e,n)}function Wd(t){var e=new t.constructor(t.byteLength);return new Ho(e).set(new Ho(t)),e}function Xd(t,e){return e=e?Wd(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.length)}function Yd(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e}function c3(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||qo)}function g3(t){return"function"!=typeof t.constructor||Wo(t)?{}:Fo(Uo(t))}function h3(t){return null!=t&&"object"==typeof t}function k3(t){return Jo(t)&&"[object Arguments]"==Qo(t)}function r3(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991}function u3(t){return null!=t&&tr(t.length)&&!Yo(t)}function x3(t){return nr(t)&&er(t)}function I3(t){return!(!rr(t)||"[object Object]"!=ir(t))&&(null===(t=or(t))||"function"==typeof(t=ar.call(t,"constructor")&&t.constructor)&&t instanceof t&&sr.call(t)==lr)}function N3(t){return ur(t)&&cr(t.length)&&!!x[hr(t)]}function O3(e){return function(t){return e(t)}}function V3(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function Z3(t,e,n){var i=t[e];fr.call(t,e)&&pr(i,n)&&(void 0!==n||e in t)||dr(t,e,n)}function be(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&gr.test(t))&&-1<t&&t%1==0&&t<e}function ce(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}function pe(t){if(!Pr(t))return xr(t);var e,n=wr(t),i=[];for(e in t)("constructor"!=e||!n&&Er.call(t,e))&&i.push(e);return i}function re(t){return Ir(t)?Sr(t,!0):pe(t)}function Me(t,e,n,i,o,r,s){var a,l,h,c=qr(t,n),u=qr(e,n),d=s.get(u);d?jr(t,n,d):((e=void 0===(d=r?r(c,u,n+"",t,e,s):void 0))&&(l=!(a=Rr(u))&&Nr(u),h=!a&&!l&&Xr(u),d=u,a||l||h?d=Rr(c)?c:zr(c)?Tr(c):l?Br(u,!(e=!1)):h?Ar(u,!(e=!1)):[]:Vr(u)||$r(u)?$r(d=c)?d=Fr(c):Hr(c)&&!Dr(c)||(d=Lr(u)):e=!1),e&&(s.set(u,d),o(d,u,i,r,s),s.delete(u)),jr(t,n,d))}function Re(t){return t}function Se(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 Ve(t){return function(){return t}}function f4(t,e){return is(ns(t,e,es),t+"")}function g4(t,e,n){if(!as(n))return!1;var i=typeof e;return!!("number"==i?rs(n)&&ss(e,n.length):"string"==i&&e in n)&&os(n[e],t)}var Ao,To,Lo,$o,o=Stack$1,Ro=Z2,c=function(){try{var t=Ro(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),zo=c,No=Pd,Do=Xc,n=function createBaseFor$1(l){return function(t,e,n){for(var i=-1,o=Object(t),r=n(t),s=r.length;s--;){var a=r[l?s:++i];if(!1===e(o[a],a,o))break}return t}}(),i={exports:{}},Ho=(v=(v=(f=i).exports)&&!v.nodeType&&v,b=(b=v&&f&&!f.nodeType&&f)&&b.exports===v?g.Buffer:void 0,Ao=b?b.allocUnsafe:void 0,f.exports=function cloneBuffer(t,e){if(e)return t.slice();e=t.length,e=Ao?Ao(e):new t.constructor(e);return t.copy(e),e},g.Uint8Array),Vo=E2,Xo=Object.create,t=function(){function object(){}return function(t){if(!Vo(t))return{};if(Xo)return Xo(t);object.prototype=t;t=new object;return object.prototype=void 0,t}}(),e=function overArg$1(e,n){return function(t){return e(n(t))}}(Object.getPrototypeOf,Object),qo=Object.prototype,Fo=t,Uo=e,Wo=c3,Qo=D2,Jo=h3,Ko=h3,r=Object.prototype,Go=r.hasOwnProperty,Zo=r.propertyIsEnumerable,C=k3(function(){return arguments}())?k3:function(t){return Ko(t)&&Go.call(t,"callee")&&!Zo.call(t,"callee")},d=Array.isArray,Yo=I2,tr=r3,er=u3,nr=h3,v={exports:{}},ir=(f=(f=(b=v).exports)&&!f.nodeType&&f,t=(t=f&&b&&!b.nodeType&&b)&&t.exports===f?g.Buffer:void 0,f=(t?t.isBuffer:void 0)||function stubFalse(){return!1},b.exports=f,D2),or=e,rr=h3,r=Function.prototype,g=Object.prototype,sr=r.toString,ar=g.hasOwnProperty,lr=sr.call(Object),hr=D2,cr=r3,ur=h3,x={},t=(x["[object Float32Array]"]=x["[object Float64Array]"]=x["[object Int8Array]"]=x["[object Int16Array]"]=x["[object Int32Array]"]=x["[object Uint8Array]"]=x["[object Uint8ClampedArray]"]=x["[object Uint16Array]"]=x["[object Uint32Array]"]=!0,x["[object Arguments]"]=x["[object Array]"]=x["[object ArrayBuffer]"]=x["[object Boolean]"]=x["[object DataView]"]=x["[object Date]"]=x["[object Error]"]=x["[object Function]"]=x["[object Map]"]=x["[object Number]"]=x["[object Object]"]=x["[object RegExp]"]=x["[object Set]"]=x["[object String]"]=x["[object WeakMap]"]=!1,{exports:{}}),e=(f=(f=(b=t).exports)&&!f.nodeType&&f,To=f&&b&&!b.nodeType&&b,Lo=To&&To.exports===f&&l.process,f=function(){try{return To&&To.require&&To.require("util").types||Lo&&Lo.binding&&Lo.binding("util")}catch(t){}}(),b.exports=f,N3),r=O3,g=t.exports,l=g&&g.isTypedArray,b=l?r(l):e,dr=Pd,pr=Xc,fr=Object.prototype.hasOwnProperty,yr=Pd,gr=/^(?:0|[1-9]\d*)$/,vr=C,Cr=d,mr=v.exports,br=be,_r=b,kr=Object.prototype.hasOwnProperty,Pr=E2,wr=c3,xr=function nativeKeysIn$1(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Er=Object.prototype.hasOwnProperty,Sr=function arrayLikeKeys$1(t,e){var n,i=Cr(t),o=!i&&vr(t),r=!i&&!o&&mr(t),s=!i&&!o&&!r&&_r(t),a=i||o||r||s,l=a?ce(t.length,String):[],h=l.length;for(n in t)!e&&!kr.call(t,n)||a&&("length"==n||r&&("offset"==n||"parent"==n)||s&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||br(n,h))||l.push(n);return l},Ir=u3,Or=function copyObject$1(t,e,n,i){var o=!n;n=n||{};for(var r=-1,s=e.length;++r<s;){var a=e[r],l=i?i(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),(o?yr:Z3)(n,a,l)}return n},Mr=re,jr=Sd,Br=i.exports,Ar=Xd,Tr=Yd,Lr=g3,$r=C,Rr=d,zr=x3,Nr=v.exports,Dr=I2,Hr=E2,Vr=I3,Xr=b,qr=V3,Fr=function toPlainObject$1(t){return Or(t,Mr(t))},Ur=o,Wr=Sd,Qr=n,Jr=E2,Kr=re,Gr=V3,Zr=Math.max,Yr=c,ts=Date.now,f=function shortOut$1(n){var i=0,o=0;return function(){var t=ts(),e=16-(t-o);if(o=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(Yr?function(t,e){return Yr(t,"toString",{configurable:!0,enumerable:!1,value:Ve(e),writable:!0})}:Re),es=Re,ns=function overRest$1(r,s,a){return s=Zr(void 0===s?r.length-1:s,0),function(){for(var t=arguments,e=-1,n=Zr(t.length-s,0),i=Array(n);++e<n;)i[e]=t[s+e];for(var e=-1,o=Array(s+1);++e<s;)o[e]=t[e];return o[s]=a(i),Se(r,this,o)}},is=f,os=Xc,rs=u3,ss=be,as=E2,ls=function baseMerge$1(i,o,r,s,a){i!==o&&Qr(o,function(t,e){var n;a=a||new Ur,Jr(t)?Me(i,o,e,r,baseMerge$1,s,a):(n=s?s(Gr(i,e),t,e+"",i,o,a):void 0,Wr(i,e,n=void 0===n?t:n))},Kr)},hs=function createAssigner$1(a){return f4(function(t,e){var n=-1,i=e.length,o=1<i?e[i-1]:void 0,r=2<i?e[2]:void 0,o=3<a.length&&"function"==typeof o?(i--,o):void 0;for(r&&g4(e[0],e[1],r)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var s=e[n];s&&a(t,s,n,o)}return t})}(function(t,e,n){ls(t,e,n)}),t=(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)}(Entity,Dt),$o=_createSuper$1(Entity),_createClass$1(Entity,[{key:"doRender",value:function doRender(){this.dirty&&this.syncEntityNameAndFields(),this.doLayout(),_get$1(_getPrototypeOf$1(Entity.prototype),"doRender",this).call(this)}},{key:"syncEntityNameAndFields",value:function syncEntityNameAndFields(){if(this.state.entityName&&(this.entityNameComponent||(this.entityNameComponent=new Ri({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||(this.deviderLine=new ji({left:0,top:0,points:[[0,0],[this.state.width,0]],style:{strokeStyle:"#333",fillStyle:"#333",lineWidth:2},interactive:!1}),this.addChild(this.deviderLine))),!Vc(this.state.fields)&&!this.entityFieldsComponent.length){for(var t=this.state.fields.length,e=0;e<t;e++){var n=this.state.fields[e],n=new Ri({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:"doLayout",value:function doLayout(){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 o=this.entityFieldsComponent[i];o.setState({left:0,top:e}),e+=o.state.height,t=Math.max(t,o.state.width)}this.deviderLine&&this.deviderLine.setState({points:[[0,n],[t,n]]}),this.setState({height:Math.max(e,this.state.height),width:t})}}],[{key:"arrangeParam",value:function arrangeParam(t){t=hs({entityName:"Entity Name",fields:[],style:{strokeStyle:"#000",fillStyle:"#00eeff"}},t,{transformable:!1});return Vc(t.entityName)&&(t.entityName="Entity Name"),Vc(t.fields)&&(t.fields=[]),t}}]),Entity),g=_createClass$1(function Relation(){_classCallCheck$1(this,Relation)});function Entity(t){_classCallCheck$1(this,Entity);var t=Entity.arrangeParam(t);return function _defineProperty$2(t,e,n){e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}(_assertThisInitialized$1(t=$o.call(this,t)),"entityFieldsComponent",[]),t}E.Entity=t,E.Relation=g,Object.defineProperty(E,"__esModule",{value:!0})});
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { ICEGroup, ICEPolyLine, ICEText } from 'ice-render';
9
+ /**
10
+ * @class Entity 实体
11
+ * @author 大漠穷秋<damoqiongqiu@126.com>
12
+ */
13
+ export default class Entity extends ICEGroup {
14
+ protected entityNameComponent: ICEText;
15
+ protected deviderLine: ICEPolyLine;
16
+ protected entityFieldsComponent: Array<ICEText>;
17
+ constructor(props: any);
18
+ protected static arrangeParam(props: any): any;
19
+ protected doRender(): void;
20
+ protected syncEntityNameAndFields(): void;
21
+ /**
22
+ * @method doLayout 布局
23
+ *
24
+ * 重新计算位置和尺寸
25
+ *
26
+ * @author 大漠穷秋<damoqiongqiu@126.com>
27
+ */
28
+ protected doLayout(): void;
29
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ /**
9
+ * @class Relation 关系
10
+ * @author 大漠穷秋<damoqiongqiu@126.com>
11
+ */
12
+ export default class Relation {
13
+ constructor();
14
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ export { default as Entity } from './Entity';
9
+ export { default as Relation } from './Relation';
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "author": "大漠穷秋",
3
+ "name": "ice-entity-designer",
4
+ "version": "0.0.5",
5
+ "description": "An entity designer based on ice-render.",
6
+ "repository": "https://gitee.com/ice-render/ice-entity-designer",
7
+ "browser": "dist/index.umd.js",
8
+ "main": "dist/index.cjs.js",
9
+ "module": "dist/index.js",
10
+ "types": "dist/types/index.d.ts",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "scripts": {
15
+ "start": "rollup -c -w --environment NODE_ENV:development",
16
+ "build": "npm run clean && npm run build:types && npm run build:js",
17
+ "build:js": "rollup -c --environment NODE_ENV:production",
18
+ "build:types": "tsc --emitDeclarationOnly",
19
+ "clean": "rimraf dist",
20
+ "pretty": "prettier src/**/* --write",
21
+ "types:check": "tsc --noEmit",
22
+ "types:watch": "npm run types:check -- --watch"
23
+ },
24
+ "dependencies": {
25
+ "ice-render": "^0.0.33",
26
+ "lodash": "4.17.21"
27
+ },
28
+ "devDependencies": {
29
+ "@babel/core": "7.17.8",
30
+ "@babel/plugin-proposal-class-properties": "7.16.7",
31
+ "@babel/plugin-proposal-decorators": "7.17.8",
32
+ "@babel/preset-env": "7.16.11",
33
+ "@babel/preset-typescript": "7.9.0",
34
+ "@commitlint/cli": "8.3.5",
35
+ "@commitlint/config-conventional": "8.3.4",
36
+ "@rollup/plugin-commonjs": "21.0.2",
37
+ "@rollup/plugin-json": "4.1.0",
38
+ "@rollup/plugin-node-resolve": "13.1.3",
39
+ "@types/jest": "25.2.1",
40
+ "@types/lodash": "4.14.180",
41
+ "@typescript-eslint/eslint-plugin": "2.29.0",
42
+ "@typescript-eslint/parser": "2.29.0",
43
+ "eslint": "6.8.0",
44
+ "eslint-config-prettier": "6.11.0",
45
+ "eslint-plugin-jest": "23.8.2",
46
+ "eslint-plugin-prettier": "3.1.3",
47
+ "husky": "4.2.5",
48
+ "jest": "25.4.0",
49
+ "lint-staged": "10.1.7",
50
+ "rimraf": "3.0.2",
51
+ "rollup": "2.70.1",
52
+ "rollup-plugin-babel": "4.4.0",
53
+ "rollup-plugin-license": "2.3.0",
54
+ "rollup-plugin-terser": "5.3.0",
55
+ "rollup-plugin-uglify": "6.0.4",
56
+ "rollup-plugin-visualizer": "5.5.0",
57
+ "typescript": "4.6.2"
58
+ },
59
+ "commitlint": {
60
+ "extends": [
61
+ "@commitlint/config-conventional"
62
+ ]
63
+ },
64
+ "lint-staged": {
65
+ "*.{js,jsx,ts,tsx}": [
66
+ "eslint --fix",
67
+ "git add"
68
+ ],
69
+ "*.{json,md,yml}": [
70
+ "prettier --write",
71
+ "git add"
72
+ ]
73
+ },
74
+ "keywords": [
75
+ "canvas",
76
+ "graphic"
77
+ ],
78
+ "browserslist": {
79
+ "production": [
80
+ ">0.2%",
81
+ "not dead",
82
+ "not op_mini all"
83
+ ],
84
+ "development": [
85
+ "last 1 chrome version",
86
+ "last 1 firefox version",
87
+ "last 1 safari version"
88
+ ]
89
+ },
90
+ "engines": {
91
+ "npm": ">=6.4.1",
92
+ "node": ">=10.13.0"
93
+ },
94
+ "license": "MIT"
95
+ }