ice-render 0.0.18 → 0.0.19
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/dist/index.cjs.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -22,4 +22,4 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ICE={})}(this,function(g){"use strict";function e(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)),n}function i(i){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?e(Object(n),!0).forEach(function(t){o(i,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(n,t))})}return i}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(t,e,i){return e&&s(t.prototype,e),i&&s(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function o(t,e,i){e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i}function a(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&&l(t,e)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(i){var n=function(){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(){var t,e=h(i);return function c(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 u(t)}(this,n?(t=h(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function v(){return(v="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=function d(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}(t,e);if(n)return(n=Object.getOwnPropertyDescriptor(n,e)).get?n.get.call(arguments.length<3?t:i):n.value}).apply(this,arguments)}function p(t){return function(t){if(Array.isArray(t))return y(t)}(t)||function(){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}()||function(t){if(t){if("string"==typeof t)return y(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(e="Object"===e&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?y(t,void 0):void 0}}(t)||function(){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 y(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function K(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Y&&Y in Object(t)?G(t):U.call(t)}function M(t){return null!=t&&"object"==typeof t}function Q(t){return"string"==typeof t||!$(t)&&tt(t)&&"[object String]"==Z(t)}function S(t){return void 0===t}var m="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},m="object"==typeof m&&m&&m.Object===Object&&m,b="object"==typeof self&&self&&self.Object===Object&&self,b=m||b||Function("return this")(),V=b.Symbol,q=Object.prototype,W=q.hasOwnProperty,J=q.toString,F=V?V.toStringTag:void 0,U=Object.prototype.toString,G=function(t){var e=W.call(t,F),i=t[F];try{var n=!(t[F]=void 0)}catch(t){}var s=J.call(t);return n&&(e?t[F]=i:delete t[F]),s},Y=V?V.toStringTag:void 0,q=Array.isArray,Z=K,$=q,tt=M,et="ICE_FRAME_EVENT",it="BEFORE_RENDER",nt="AFTER_RENDER",st="BEFORE_ADD",ot="AFTER_ADD",rt="BEFORE_REMOVE",at="ROUND_FINISH",ct="HOOK_MOUSEDOWN",dt="HOOK_MOUSEMOVE",pt="HOOK_MOUSEUP",vt="BEFORE_RESIZE",k="AFTER_RESIZE",yt="AFTER_ROTATE",w="AFTER_MOVE",gt={linear:function(t,e,i,n){return t+(e-t)/i*(Date.now()-n)},easeInQuad:function(t,e,i,n){n=Date.now()-n;return t+(e-t)/i*(n/i)*n},easeOutQuad:function(t,e,i,n){n=Date.now()-n;return-(e-t)*(n/=i)*(n-2)+t},easeInOutQuad:function(t,e,i,n){n=Date.now()-n,e-=t;return(n/=i/2)<1?e/2*n*n+t:-e/2*(--n*(n-2)-1)+t},easeInQuart:function(t,e,i,n){n=Date.now()-n;return(e-t)*(n/=i)*n*n*n+t},easeOutQuart:function(t,e,i,n){return-(e-t)*((e=(Date.now()-n)/i-1)*e*e*e-1)+t},easeInOutQuart:function(t,e,i,n){n=Date.now()-n,e-=t;return(n/=i/2)<1?e/2*n*n*n*n+t:-e/2*((n-=2)*n*n*n-2)+t},easeInCubic:function(t,e,i,n){n=Date.now()-n;return(e-t)*(n/=i)*n*n+t},easeOutCubic:function(t,e,i,n){return(e-t)*((e=(Date.now()-n)/i-1)*e*e+1)+t},easeInOutCubic:function(t,e,i,n){n=Date.now()-n,e-=t;return(n/=i/2)<1?e/2*n*n*n+t:e/2*((n-=2)*n*n+2)+t}},mt=(r(t,[{key:"start",value:function(){return this.ice.evtBus.on(et,this.frameEventHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off(et,this.frameEventHandler,this),this}},{key:"frameEventHandler",value:function(t){for(var e=p(this.animationMap.values()),i=0;i<e.length;i++){var n=e[i];n.state.interactive=!1,this.tween(n),n.state.interactive=!0}}},{key:"tween",value:function(t){var e,n={},s=t.props.animations,o=1;for(e in s){var r=s[e];if(r.finished){if(++o===Object.keys(s).length){this.remove(t);break}}else{var a=r.from,h=r.to,l=r.duration,a=(S(r.startTime)&&(r.startTime=Date.now()),S(r.easing)&&(r.easing="linear"),gt[r.easing](a,h,l,r.startTime));h<a&&(a=h,r.finished=!0),n[e]=Math.floor(a)}}return t.setState(i({},n)),t}},{key:"add",value:function(t){this.animationMap.set(t.props.id,t)}},{key:"remove",value:function(t){Q(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}}]),t),bt="undefined"!=typeof Float32Array?Float32Array:Array,kt=Math.PI/180;function t(e){n(this,t),o(this,"animationMap",new Map),this.ice=e}function ht(t){return t*kt}function lt(t,e){var i=e[0],n=e[1],s=e[2],o=e[3],r=e[4],e=e[5],a=i*o-n*s;return a?(t[0]=o*(a=1/a),t[1]=-n*a,t[2]=-s*a,t[3]=i*a,t[4]=(s*e-o*r)*a,t[5]=(n*r-i*e)*a,t):null}function ut(t,e,i){var n=e[0],s=e[1],o=e[2],r=e[3],a=e[4],e=e[5],h=i[0],l=i[1],u=i[2],c=i[3],f=i[4],i=i[5];return t[0]=n*h+o*l,t[1]=s*h+r*l,t[2]=n*u+o*c,t[3]=s*u+r*c,t[4]=n*f+o*i+a,t[5]=s*f+r*i+e,t}function ft(t,e,i){var n=e[0],e=e[1];return t[0]=i[0]*n+i[2]*e+i[4],t[1]=i[1]*n+i[3]*e+i[5],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),x=new bt(2),bt!=Float32Array&&(x[0]=0,x[1]=0);function ma(t,e){return t===e||t!=t&&e!=e}function oa(t,e){for(var i=t.length;i--;)if(wt(t[i][0],e))return i;return-1}var wt=ma,xt=oa,Ct=Array.prototype.splice,Pt=oa,Mt=oa,St=oa;function Ot(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Ot.prototype.clear=function(){this.__data__=[],this.size=0},Ot.prototype.delete=function(t){var e=this.__data__,t=xt(e,t);return!(t<0||(t==e.length-1?e.pop():Ct.call(e,t,1),--this.size,0))},Ot.prototype.get=function(t){var e=this.__data__,t=Pt(e,t);return t<0?void 0:e[t][1]},Ot.prototype.has=function(t){return-1<Mt(this.__data__,t)},Ot.prototype.set=function(t,e){var i=this.__data__,n=St(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this};function Fa(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ja(t){return!!Bt(t)&&("[object Function]"==(t=_t(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function Oa(t){if(null!=t){try{return At.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function _a(t,e){return e=e,t=null==(t=t)?void 0:t[e],!zt(e=t)||jt(e)||!(Nt(e)?Lt:Tt).test(Dt(e))?void 0:t}function m0(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t}function n0(t){var e,i=this.__data__;return Xt?"__lodash_hash_undefined__"===(e=i[t])?void 0:e:Ht.call(i,t)?i[t]:void 0}var x=Ot,Et=x,_t=K,Bt=Fa,C=b["__core-js_shared__"],It=(C=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"",At=Function.prototype.toString,Nt=Ja,jt=function(t){return!!It&&It in t},zt=Fa,Dt=Oa,Tt=/^\[object .+?Constructor\]$/,C=Function.prototype,P=Object.prototype,C=C.toString,P=P.hasOwnProperty,Lt=RegExp("^"+C.call(P).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),C=_a(b,"Map"),P=_a(Object,"create"),Rt=P,Xt=P,Ht=Object.prototype.hasOwnProperty,Vt=P,qt=Object.prototype.hasOwnProperty,Wt=P;function be(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}be.prototype.clear=function(){this.__data__=Rt?Rt(null):{},this.size=0},be.prototype.delete=m0,be.prototype.get=n0,be.prototype.has=function(t){var e=this.__data__;return Vt?void 0!==e[t]:qt.call(e,t)},be.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Wt&&void 0===e?"__lodash_hash_undefined__":e,this};function u0(t,e){var i,n,t=t.__data__;return("string"==(n=typeof(i=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?t["string"==typeof e?"string":"hash"]:t.map}var Jt=be,Ft=x,Kt=C,Ut=u0,Gt=u0,Qt=u0,Yt=u0;function je(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}je.prototype.clear=function(){this.size=0,this.__data__={hash:new Jt,map:new(Kt||Ft),string:new Jt}},je.prototype.delete=function(t){t=Ut(this,t).delete(t);return this.size-=t?1:0,t},je.prototype.get=function(t){return Gt(this,t).get(t)},je.prototype.has=function(t){return Qt(this,t).has(t)},je.prototype.set=function(t,e){var i=Yt(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this};function J0(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t}function K0(t){return this.__data__.get(t)}function L0(t){return this.__data__.has(t)}var Zt=x,$t=C,te=je,ee=x;function We(t){t=this.__data__=new ee(t);this.size=t.size}We.prototype.clear=function(){this.__data__=new Et,this.size=0},We.prototype.delete=J0,We.prototype.get=K0,We.prototype.has=L0,We.prototype.set=function(t,e){var i=this.__data__;if(i instanceof Zt){var n=i.__data__;if(!$t||n.length<199)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new te(n)}return i.set(t,e),this.size=i.size,this};function R0(t,e,i){"__proto__"==e&&re?re(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}function U0(t,e,i){(void 0===i||he(t[e],i))&&(void 0!==i||e in t)||ae(t,e,i)}function V0(t,e,i){for(var n=-1,s=Object(t),o=i(t),r=o.length;r--;){var a=o[++n];if(!1===e(s[a],a,s))break}return t}function cb(e,i){return function(t){return e(i(t))}}function fb(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||de)}function mb(t){return me(t)&&"[object Arguments]"==ge(t)}function sb(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991}function vb(t){return null!=t&&Pe(t.length)&&!Ce(t)}function Rb(t){return De(t)&&ze(t.length)&&!!A[Ne(t)]}function Wb(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function c1(t,e){var i=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&He.test(t))&&-1<t&&t%1==0&&t<e}function s1(t){if(ti(t))return $e(t,!0);var e=t;if(!Ge(e))return Ye(e);var i,n=Qe(e),s=[];for(i in e)("constructor"!=i||!n&&Ze.call(e,i))&&s.push(i);return s}function S1(t){return t}var ie,ne,se,P=We,oe=_a,x=function(){try{var t=oe(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),re=x,ae=R0,he=ma,le={exports:{}},ue=(O=(O=(_=le).exports)&&!O.nodeType&&O,E=(E=O&&_&&!_.nodeType&&_)&&E.exports===O?b.Buffer:void 0,ie=E?E.allocUnsafe:void 0,_.exports=function(t,e){if(e)return t.slice();e=t.length,e=ie?ie(e):new t.constructor(e);return t.copy(e),e},b.Uint8Array),ce=Fa,fe=Object.create,O=function(){function t(){}return function(e){if(!ce(e))return{};if(fe)return fe(e);t.prototype=e;e=new t;return t.prototype=void 0,e}}(),E=cb(Object.getPrototypeOf,Object),de=Object.prototype,pe=O,ve=E,ye=fb,ge=K,me=M,ke=M,_=Object.prototype,we=_.hasOwnProperty,xe=_.propertyIsEnumerable,O=mb(function(){return arguments}())?mb:function(t){return ke(t)&&we.call(t,"callee")&&!xe.call(t,"callee")},Ce=Ja,Pe=sb,Me=vb,Se=M,_={exports:{}},Oe=(N=(N=(I=_).exports)&&!N.nodeType&&N,B=(B=N&&I&&!I.nodeType&&I)&&B.exports===N?b.Buffer:void 0,N=(B?B.isBuffer:void 0)||function(){return!1},I.exports=N,K),Ee=E,_e=M,B=Function.prototype,I=Object.prototype,Be=B.toString,Ie=I.hasOwnProperty,Ae=Be.call(Object),Ne=K,ze=sb,De=M,A={},N=(A["[object Float32Array]"]=A["[object Float64Array]"]=A["[object Int8Array]"]=A["[object Int16Array]"]=A["[object Int32Array]"]=A["[object Uint8Array]"]=A["[object Uint8ClampedArray]"]=A["[object Uint16Array]"]=A["[object Uint32Array]"]=!0,A["[object Arguments]"]=A["[object Array]"]=A["[object ArrayBuffer]"]=A["[object Boolean]"]=A["[object DataView]"]=A["[object Date]"]=A["[object Error]"]=A["[object Function]"]=A["[object Map]"]=A["[object Number]"]=A["[object Object]"]=A["[object RegExp]"]=A["[object Set]"]=A["[object String]"]=A["[object WeakMap]"]=!1,{exports:{}}),I=(B=(B=(E=N).exports)&&!B.nodeType&&B,ne=B&&E&&!E.nodeType&&E,se=ne&&ne.exports===B&&m.process,B=function(){try{return ne&&ne.require&&ne.require("util").types||se&&se.binding&&se.binding("util")}catch(t){}}(),E.exports=B,function(e){return function(t){return e(t)}}),m=N.exports,E=m&&m.isTypedArray,B=E?I(E):Rb,Te=R0,Le=ma,Re=Object.prototype.hasOwnProperty,Xe=R0,He=/^(?:0|[1-9]\d*)$/,Ve=O,qe=q,Je=_.exports,Fe=c1,Ke=B,Ue=Object.prototype.hasOwnProperty,Ge=Fa,Qe=fb,Ye=function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e},Ze=Object.prototype.hasOwnProperty,$e=function(t,e){var i,n=qe(t),s=!n&&Ve(t),o=!n&&!s&&Je(t),r=!n&&!s&&!o&&Ke(t),a=n||s||o||r,h=a?function(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n}(t.length,String):[],l=h.length;for(i in t)!e&&!Ue.call(t,i)||a&&("length"==i||o&&("offset"==i||"parent"==i)||r&&("buffer"==i||"byteLength"==i||"byteOffset"==i)||Fe(i,l))||h.push(i);return h},ti=vb,ei=function(t,e,i,n){var s=!i;i=i||{};for(var o,r,a=-1,h=e.length;++a<h;){var l=e[a],u=n?n(i[l],t[l],l,i,t):void 0;void 0===u&&(u=t[l]),s?Xe(i,l,u):(u=u,r=void 0,r=(o=i)[l=l],Re.call(o,l)&&Le(r,u)&&(void 0!==u||l in o)||Te(o,l,u))}return i},ii=s1,ni=U0,si=le.exports,oi=function(t,e){var i,e=e?(e=t.buffer,i=new e.constructor(e.byteLength),new ue(i).set(new ue(e)),i):t.buffer;return new t.constructor(e,t.byteOffset,t.length)},ri=function(t,e){var i=-1,n=t.length;for(e=e||Array(n);++i<n;)e[i]=t[i];return e},ai=function(t){return"function"!=typeof t.constructor||ye(t)?{}:pe(ve(t))},hi=O,li=q,ui=function(t){return Se(t)&&Me(t)},ci=_.exports,fi=Ja,di=Fa,pi=function(t){if(!_e(t)||"[object Object]"!=Oe(t))return!1;t=Ee(t);if(null===t)return!0;t=Ie.call(t,"constructor")&&t.constructor;return"function"==typeof t&&t instanceof t&&Be.call(t)==Ae},vi=B,yi=Wb,gi=function(t){return ei(t,ii(t))},mi=P,bi=U0,ki=V0,wi=Fa,xi=s1,Ci=Wb,Pi=Math.max,Mi=x,Si=Date.now;Oi=Mi?function(t,e){return Mi(t,"toString",{configurable:!0,enumerable:!1,value:(i=e,function(){return i}),writable:!0});var i}:S1,_i=Ei=0;var Oi,Ei,_i,Bi,Ii=ma,Ai=vb,Ni=c1,ji=Fa,zi=function t(y,g,m,b,k){y!==g&&ki(g,function(e,i){var n,s,o,r,a,h,l,u,c,f,d,p,v;k=k||new mi,wi(e)?(s=g,r=m,a=t,h=b,l=k,d=yi(n=y,o=i),p=yi(s,o),(v=l.get(p))?ni(n,o,v):((s=void 0===(v=h?h(d,p,o+"",n,s,l):void 0))&&(c=!(u=li(p))&&ci(p),f=!u&&!c&&vi(p),v=p,u||c||f?v=li(d)?d:ui(d)?ri(d):c?si(p,!(s=!1)):f?oi(p,!(s=!1)):[]:pi(p)||hi(p)?hi(v=d)?v=gi(d):di(d)&&!fi(d)||(v=ai(p)):s=!1),s&&(l.set(p,v),a(v,p,r,h,l),l.delete(p)),ni(n,o,v))):(u=b?b(Ci(y,i),e,i+"",y,g,k):void 0,bi(y,i,u=void 0===u?e:u))},xi)},Di=(Bi=function(t,e,i){zi(t,e,i)},function(){var t=Si(),e=16-(t-_i);if(_i=t,0<e){if(800<=++Ei)return arguments[0]}else Ei=0;return Oi.apply(void 0,arguments)}(function(h,l,u){return l=Pi(void 0===l?h.length-1:l,0),function(){for(var t=arguments,e=-1,i=Pi(t.length-l,0),n=Array(i);++e<i;)n[e]=t[l+e];for(var e=-1,s=Array(l+1);++e<l;)s[e]=t[e];s[l]=u(n);var o=h,r=this,a=s;switch(a.length){case 0:return o.call(r);case 1:return o.call(r,a[0]);case 2:return o.call(r,a[0],a[1]);case 3:return o.call(r,a[0],a[1],a[2])}return o.apply(r,a)}}(N=function(t,e){var i=-1,n=e.length,s=1<n?e[n-1]:void 0,o=2<n?e[2]:void 0,s=3<Bi.length&&"function"==typeof s?(n--,s):void 0;for(o&&function(t,e,i){if(!ji(i))return!1;var n=typeof e;return!!("number"==n?Ai(i)&&Ni(e,i.length):"string"==n&&e in i)&&Ii(i[e],t)}(e[0],e[1],o)&&(s=n<3?void 0:s,n=1),t=Object(t);++i<n;){var r=e[i];r&&Bi(t,r,i)}return t},z,S1),N+"")),j=function(){function t(){var e,i,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};for(e in n(this,t),s)this[e]=s[e];for(i in o)this[i]=o[i]}return r(t,[{key:"composedPath",value:function(){throw new Error("Method not implemented.")}},{key:"initEvent",value:function(t,e,i){throw new Error("Method not implemented.")}},{key:"preventDefault",value:function(){throw new Error("Method not implemented.")}},{key:"stopImmediatePropagation",value:function(){throw new Error("Method not implemented.")}},{key:"stopPropagation",value:function(){throw new Error("Method not implemented.")}}]),t}(),m=cb(Object.keys,Object),Ti=fb,Li=m,Ri=Object.prototype.hasOwnProperty,I=_a(b,"DataView"),E=C,le=_a(b,"Promise"),P=_a(b,"Set"),x=_a(b,"WeakMap"),Xi=K,Hi=Oa,Vi=Hi(I),qi=Hi(E),Wi=Hi(le),Ji=Hi(P),Fi=Hi(x),z=Xi,Ki=((I&&"[object DataView]"!=z(new I(new ArrayBuffer(1)))||E&&"[object Map]"!=z(new E)||le&&"[object Promise]"!=z(le.resolve())||P&&"[object Set]"!=z(new P)||x&&"[object WeakMap]"!=z(new x))&&(z=function(t){var e=Xi(t),t="[object Object]"==e?t.constructor:void 0,t=t?Hi(t):"";if(t)switch(t){case Vi:return"[object DataView]";case qi:return"[object Map]";case Wi:return"[object Promise]";case Ji:return"[object Set]";case Fi:return"[object WeakMap]"}return e}),function(t){if(!Ti(t))return Li(t);var e,i=[];for(e in Object(t))Ri.call(t,e)&&"constructor"!=e&&i.push(e);return i}),Ui=z,Gi=O,Qi=q,Yi=vb,Zi=_.exports,$i=fb,tn=B,en=Object.prototype.hasOwnProperty,N=null,D=((N=window||global||{}).requestFrame=N.requestAnimationFrame||N.webkitRequestAnimationFrame||N.mozRequestAnimationFrame||N.oRequestAnimationFrame||N.msRequestAnimationFrame,N),T=function(){function t(){n(this,t),o(this,"listeners",{}),o(this,"suspendedEventNames",[])}return r(t,[{key:"on",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:D;this.listeners[t]||(this.listeners[t]=[]),this.off(t,e,i),this.listeners[t].push({callback:e,scope:i})}},{key:"off",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:D;if(n=this.listeners[t])for(var n=p(n),s=0;s<n.length;s++){var o=n[s];if(o.callback===e&&o.scope===i)return void this.listeners[t].splice(s,1)}}},{key:"once",value:function(e,i){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:D,o=this;o.on(e,function s(t){o.off(e,s,n),i.call(n,t)},n)}},{key:"trigger",value:function(t){var e,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(function(t){if(null==t)return!0;if(Yi(t)&&(Qi(t)||"string"==typeof t||"function"==typeof t.splice||Zi(t)||tn(t)||Gi(t)))return!t.length;var e,i=Ui(t);if("[object Map]"==i||"[object Set]"==i)return!t.size;if($i(t))return!Ki(t).length;for(e in t)if(en.call(t,e))return!1;return!0}(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;n?((e=new j(n)).originalEvent=n.originalEvent||n,e.param=i({},s)):e=new j({type:t,timeStamp:Date.now(),param:i({},s)});for(var o=this.listeners[t],r=0;r<o.length;r++){var a=o[r];a.callback.call(a.scope,e)}return!0}},{key:"suspend",value:function(t){t&&!this.suspendedEventNames.includes(t)&&this.suspendedEventNames.push(t)}},{key:"resume",value:function(e){this.suspendedEventNames.splice(this.suspendedEventNames.findIndex(function(t){return t===e}),1)}},{key:"purgeEvents",value:function(){this.listeners={},this.suspendedEventNames=[]}},{key:"hasListener",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:D;if(!this.listeners[t])return!1;var n=this.listeners[t];if(!n)return!1;for(var s=0;s<n.length;s++){var o=n[s];if(o.callback===e&&o.scope===i)return!0}return!1}}]),t}(),nn=(T.prototype.addEventListener=T.prototype.on,T.prototype.removeEventListener=T.prototype.off,T.prototype.dispatchEvent=T.prototype.trigger,function(){function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[0,0,0,0,0,0,0,0,0,0];n(this,t),o(this,"tl",[0,0]),o(this,"tr",[0,0]),o(this,"bl",[0,0]),o(this,"br",[0,0]),o(this,"tc",[0,0]),o(this,"rc",[0,0]),o(this,"bc",[0,0]),o(this,"lc",[0,0]),o(this,"center",[0,0]),this.tl=[e[0],e[1]],this.tr=[e[2],e[3]],this.bl=[e[4],e[5]],this.br=[e[6],e[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=[e[8],e[9]]}return r(t,[{key:"containsPoint",value:function(t){var e=this.getMinAndMaxPoint(),i=e.minX,n=e.minY,s=e.maxX,e=e.maxY;if(t[0]<i||t[0]>s||t[1]<n||t[1]>e)return!1;for(var o=0,r=this.getBoundingLines(),a=0;a<r.length;a++){var h,l=r[a];t[1]>l.o[1]&&t[1]>l.d[1]||t[1]<l.o[1]&&t[1]<l.d[1]||(l.o[0]===l.d[0]&&l.o[0]>=t[0]?l.o[0]:(h=(l.d[1]-l.o[1])/(l.d[0]-l.o[0]),l.o[0]+(t[1]-l.o[1])/h))>t[0]&&o++}return 0!==o&&o%2==1}},{key:"getBoundingLines",value:function(){return[{o:p(this.tl),d:p(this.tr)},{o:p(this.tr),d:p(this.br)},{o:p(this.br),d:p(this.bl)},{o:p(this.bl),d:p(this.tl)}]}},{key:"getMinAndMaxPoint",value:function(){for(var t=this.tl[0],e=this.tl[1],i=this.tl[0],n=this.tl[1],s=[this.tr,this.bl,this.br],o=0;o<s.length;o++){var r=s[o];r[0]<t&&(t=r[0]),r[0]>i&&(i=r[0]),r[1]<e&&(e=r[1]),r[1]>n&&(n=r[1])}return{minX:t,minY:e,maxX:i,maxY:n}}},{key:"containsBox",value:function(t){return!1}},{key:"isIntersect",value:function(t){var e=this.tl[0],i=this.br[0],n=this.tl[1],s=this.br[1],o=t.tl[0],r=t.br[0],a=t.tl[1],t=t.br[1];return!(r<e||t<n||i<o||s<a)}},{key:"transform",value:function(e){var i=ft([],this.tl,e),n=ft([],this.tr,e),s=ft([],this.bl,e),o=ft([],this.br,e),e=ft([],this.center,e);return new t([].concat(p(i),p(n),p(s),p(o),p(e)))}},{key:"union",value:function(t){return null}},{key:"width",get:function(){var t=this.br[0]-this.bl[0],e=this.br[1]-this.bl[1];return Math.hypot(t,e)}},{key:"height",get:function(){var t=this.br[0]-this.tr[0],e=this.br[1]-this.tr[1];return Math.hypot(t,e)}},{key:"left",get:function(){return this.tl[0]},set:function(t){throw new Error("Can not set left to ICEBoundingBox directly.")}},{key:"top",get:function(){return this.tl[1]},set:function(t){throw new Error("Can not set top to ICEBoundingBox directly.")}},{key:"centerX",get:function(){return this.center[0]}},{key:"centerY",get:function(){return this.center[1]}},{key:"centerPoint",get:function(){return this.center}}],[{key:"fromDimension",value:function(e,i,n,s){return new t([].concat([e,i],[e+n,i],[e,i+s],[e+n,i+s],[e+n/2,i+s/2]))}}]),t}()),sn=function(){function t(){n(this,t)}return r(t,null,[{key:"calcRotateAngleFromMatrix",value:function(t){var e=0,i=t[0],t=t[1],n=Math.hypot(i,t),t=t/n,e=Math.acos(i/n);return t<0&&(e+=Math.PI/2),e*(180/Math.PI)}},{key:"calcScaleFromMatrix",value:function(t){var e=t[0],i=t[1],n=t[2],t=t[3];return[Math.hypot(e,i)/e,Math.hypot(n,t)/t]}}]),t}();function Gs(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function Ys(t,e,i,n){for(var s=0<arguments.length&&void 0!==t?t:[],o=1<arguments.length&&void 0!==e?e:[],r=2<arguments.length&&void 0!==i?i:1,a=3<arguments.length&&void 0!==n?n:null,h=0;h<o.length;h++){var l=o[h];l._level=r,l._pid=a,s.push(l),Ys(s,l.childNodes||[],r+1,l.id)}return s}function Xc(t){return null==t}function f2(t){return"symbol"==typeof t||bn(t)&&"[object Symbol]"==mn(t)}function n2(t){if("number"==typeof t)return t;if(wn(t))return NaN;var e;if(kn(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=kn(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=(e=t)&&e.slice(0,yn(e)+1).replace(gn,"");var i=Cn.test(t);return i||Pn.test(t)?Mn(t.slice(2),i?2:8):xn.test(t)?NaN:+t}function w2(t){if("string"==typeof t)return t;if(En(t))return On(t,w2)+"";if(_n(t))return Bn?Bn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function z2(t){return null==t?"":w2(t)}var on,rn=function(){a(s,T);var h=f(s);function s(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return n(this,s),o(u(t=h.call(this)),"__typeName","ICEComponent"),o(u(t),"__dirty",!0),o(u(t),"props",{id:"ICE_"+function $s(){if(D.crypto)return D.crypto.randomUUID();var i=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(i+16*Math.random())%16|0;return i=Math.floor(i/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:s.instanceCounter++,display:!0,draggable:!0,transformable:!0,interactive:!0,linkable:!0,showMinBoundingBox:!1,showMaxBoundingBox:!1}),o(u(t),"state",i({},t.props)),t.props=Di(t.props,e),t.state=JSON.parse(JSON.stringify(t.props)),t.initEvents(),t}return r(s,[{key:"initEvents",value:function(){}},{key:"render",value:function(){this.trigger(it),this.state.display&&(this.calcComponentParams(),this.applyStyleToCtx(),this.applyTransformToCtx(),this.doRender(),this.trigger(nt),this.dirty=!1)}},{key:"applyStyleToCtx",value:function(){var t,e=i(i({},this.props.style),this.state.style);for(t in e)this.ctx[t]=e[t]}},{key:"calcComponentParams",value:function(){return{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function(){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(){var t=Gs(this,"state.transform.translate.0")+this.state.left,e=Gs(this,"state.transform.translate.1")+this.state.top,i=p(this.calcLocalOrigin());return i[0]+=t,i[1]+=e,this.parentNode&&(i=ft([],i,[1,0,0,1,-this.parentNode.state.localOrigin[0],-this.parentNode.state.localOrigin[1]]),i=ft([],i,this.parentNode.state.composedMatrix)),this.state.absoluteOrigin=i}},{key:"calcLinearMatrix",value:function(){h=new bt(6),bt!=Float32Array&&(h[1]=0,h[2]=0,h[4]=0,h[5]=0),h[0]=1,h[3]=1;var t,e,i,n,s,o,r,a,h,l=Gs(this,"state.transform.skew.0"),u=Gs(this,"state.transform.skew.1");return t=[],e=[],l=h=function(t,e,i,n){i=Math.tan(i),n=Math.tan(n);return t[0]=e[0],t[1]=e[1]+i,t[2]=e[2]+n,t[3]=e[3],t[4]=e[4],t[5]=e[5],t}([],h,l*kt,u*kt),u=ht(Gs(this,"state.transform.rotate")),i=l[0],n=l[1],s=l[2],o=l[3],r=l[4],l=l[5],a=Math.sin(u),u=Math.cos(u),e[0]=i*u+s*a,e[1]=n*u+o*a,e[2]=i*-a+s*u,e[3]=n*-a+o*u,e[4]=r,e[5]=l,i=h=e,s=[Gs(this,"state.transform.scale.0"),Gs(this,"state.transform.scale.1")],n=i[0],a=i[1],o=i[2],u=i[3],r=i[4],i=i[5],l=s[0],s=s[1],t[0]=n*l,t[1]=a*l,t[2]=o*s,t[3]=u*s,t[4]=r,t[5]=i,h=t,this.state.linearMatrix=h}},{key:"calcAbsoluteLinearMatrix",value:function(){for(var t=this,e=t.calcLinearMatrix();t.parentNode;)e=ut([],t.parentNode.state.linearMatrix,e),t=t.parentNode;return this.state.absoluteLinearMatrix=e}},{key:"composeMatrix",value:function(){var t=this.calcAbsoluteOrigin(),t=ut([],[1,0,0,1,t[0],t[1]],this.calcAbsoluteLinearMatrix());return this.state.composedMatrix=t}},{key:"applyTransformToCtx",value:function(){var t,e=this.dirty?this.composeMatrix():this.state.composedMatrix;(t=this.ctx).setTransform.apply(t,p(e))}},{key:"doRender",value:function(){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(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=this.state.localOrigin[0],i=this.state.localOrigin[1],n=this.state.width,s=this.state.height,e=new nn([0-e,0-i,0-e+n,0-i,0-e,0-i+s,0-e+n,0-i+s,0,0]),n=t?this.composeMatrix():this.state.composedMatrix;return e.transform(n)}},{key:"getMaxBoundingBox",value:function(){var t=this.getMinBoundingBox(0<arguments.length&&void 0!==arguments[0]&&arguments[0]),e=t.getMinAndMaxPoint(),i=e.minX,n=e.minY,s=e.maxX,e=e.maxY,t=t.centerPoint;return new nn([i,n,s,n,i,e,s,e,t[0],t[1]])}},{key:"setState",value:function(t){Di(this.state,t),this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"dirty",get:function(){return this.__dirty},set:function(t){this.__dirty=t}},{key:"setPosition",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new j;this.trigger("BEFORE_MOVE",i(i({},n),{},{left:t,top:e})),this.setState({left:t,top:e}),this.trigger(w,i(i({},n),{},{left:t,top:e}))}},{key:"moveGlobalPosition",value:function(t,e){var n,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new j;this.parentNode&&(t=(n=ft([],[t,e],lt([],this.parentNode.state.absoluteLinearMatrix)))[0],e=n[1]),this.setPosition(this.state.left+t,this.state.top+e,i(i({},s),{},{tx:t,ty:e}))}},{key:"setGlobalPosition",value:function(t,e){var n,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new j;this.parentNode&&(t=(n=ft([],[t,e],lt([],this.parentNode.state.absoluteLinearMatrix)))[0],e=n[1]),this.setPosition(t,e,i(i({},s),{},{left:t,top:e}))}},{key:"setGlobalRotate",value:function(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteLinearMatrix,t-=sn.calcRotateAngleFromMatrix(e)),this.setState({transform:{rotate:t}})}},{key:"localToGlobal",value:function(t,e){t=[t,e];return ft([],t,this.state.composedMatrix)}},{key:"globalToLocal",value:function(t,e){t=[t,e];return ft([],t,lt([],this.state.composedMatrix))}},{key:"getRotateAngle",value:function(){return this.state.transform.rotate}},{key:"getLocalLeftTop",value:function(){var t=this.getMinBoundingBox(!0),e=t.width,i=t.height;return{left:t.centerX-t.width/2,top:t.centerY-t.height/2,width:e,height:i}}},{key:"containsPoint",value:function(t,e){return this.getMinBoundingBox().containsPoint([t,e])}},{key:"destory",value:function(){this.trigger(rt,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}]),s}(),an=(o(rn,"instanceCounter",0),function(){a(s,rn);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return n(this,s),o(u(t=e.call(this,i({closePath:!0},t))),"path2D",new Path2D),t}return r(s,[{key:"doRender",value:function(){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),v(h(s.prototype),"doRender",this).call(this)}}]),s}()),hn=function(){a(s,an);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return n(this,s),e.call(this,i({width:10,height:10},t))}return r(s,[{key:"createPathObject",value:function(){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}}]),s}(),ln=function(){a(i,hn);var e=f(i);function i(t){return n(this,i),o(u(t=e.call(this,t)),"parentNode",null),o(u(t),"childNodes",[]),t}return r(i,[{key:"addChild",value:function(t){t.trigger(st),(t.parentNode=this).childNodes.push(t),t.trigger(ot)}},{key:"addChildren",value:function(t){for(var e=0;e<t.length;e++){var i=t[e];this.addChild(i)}}},{key:"removeChild",value:function(t){t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1)}},{key:"removeChildren",value:function(t){for(var e=0;e<t.length;e++){var i=t[e];this.removeChild(i)}}},{key:"destory",value:function(){this.removeChildren(this.childNodes),v(h(i.prototype),"destory",this).call(this)}}]),i}(),un=function(){a(s,ln);var e=f(s);function s(t){return n(this,s),o(u(t=e.call(this,i(i({},t),{},{linkable:!1}))),"__typeName","ICEControlPanel"),t}return r(s,[{key:"doRender",value:function(){v(h(s.prototype),"doRender",this).call(this),this.setControlPositions()}},{key:"moveGlobalPosition",value:function(t,e,i){v(h(s.prototype),"moveGlobalPosition",this).call(this,t,e,i),this._targetComponent&&this._targetComponent.moveGlobalPosition(t,e,i)}}]),s}(),cn=function(){a(s,an);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(n(this,s),i({radiusX:20,radiusY:10,rotation:0,startAngle:0,endAngle:2*Math.PI,counterclockwise:!0},t));return t.width=2*t.radiusX,t.height=2*t.radiusY,e.call(this,t)}return r(s,[{key:"createPathObject",value:function(){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(t){Xc(t.radiusX)?Xc(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,Xc(t.radiusY)?Xc(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,v(h(s.prototype),"setState",this).call(this,t)}}]),s}(),fn=function(){a(s,cn);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(n(this,s),i({radius:10},t));return t.radiusX=t.radius,t.radiusY=t.radius,e.call(this,t)}return r(s)}(),dn=function(){a(s,fn);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return n(this,s),e.call(this,i({linkable:!1},t))}return r(s,[{key:"initEvents",value:function(){v(h(s.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(w,this.resizeEvtHandler,this)}},{key:"mosueDownHandler",value:function(t){this.evtBus.trigger(ct,new j({target:this}))}},{key:"mosueMoveHandler",value:function(t){this.evtBus.trigger(dt,new j({target:this}))}},{key:"mosueUpHandler",value:function(t){this.evtBus.trigger(pt,new j({target:this}))}},{key:"resizeEvtHandler",value:function(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(vt,new j(t,{position:e})),this.parentNode.trigger(k,new j(t,{position:e})))}}]),s}(),pn=function(){a(s,un);var e=f(s);function s(t){return n(this,s),o(u(t=e.call(this,i(i({},t),{},{zIndex:10000010,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"controlSize",16),t.initControls(),t}return r(s,[{key:"initControls",value:function(){var t=this.state.width,e=this.state.height,i=this.controlSize/2;this.startControl=new dn({zIndex:10000011,display:!1,left:-i,top:-i,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"start"}),this.addChild(this.startControl),this.endControl=new dn({zIndex:10000012,display:!1,left:t-i,top:e-i,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"end"}),this.addChild(this.endControl)}},{key:"initEvents",value:function(){this.on(k,this.resizeEvtHandler,this)}},{key:"enable",value:function(){this.setState({display:!0}),this.resume(k),this.showHooks()}},{key:"disable",value:function(){this.setState({display:!1}),this.suspend(k),this.hideHooks()}},{key:"setControlPositions",value:function(){}},{key:"resizeEvtHandler",value:function(t){if(this.targetComponent){var e=t.position,i=t.movementX,n=t.movementY,t=this.targetComponent.state,s=t.points.length,o=t.points[0][0],r=t.points[0][1],a=t.points[s-1][0],h=t.points[s-1][1],s=ft([],[i,n],lt([],t.absoluteLinearMatrix)),i=s[0],n=s[1];switch(e){case"start":o+=i,r+=n;break;case"end":a+=i,h+=n}this.targetComponent.setState({startPoint:[o,r],endPoint:[a,h]})}}},{key:"updatePosition",value:function(){var t,e,i;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,i=this.targetComponent.state.points.length,e=this.targetComponent.state.points[0],i=this.targetComponent.state.points[i-1],e=[e[0],e[1]],i=[i[0],i[1]],this.startControl.setState({left:e[0]-t,top:e[1]-t}),this.endControl.setState({left:i[0]-t,top:i[1]-t}))}},{key:"targetComponent",get:function(){return this._targetComponent},set:function(t){var e=this;this._targetComponent&&this._targetComponent.off(w,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(w,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(rt,function(){e.targetComponent=null,e.disable()},this),this.updatePosition()}},{key:"showHooks",value:function(){this.startControl.setState({display:!0}),this.endControl.setState({display:!0})}},{key:"hideHooks",value:function(){this.startControl.setState({display:!1}),this.endControl.setState({display:!1})}}]),s}(),vn=/\s/,yn=function(t){for(var e=t.length;e--&&vn.test(t.charAt(e)););return e},gn=/^\s+/,mn=K,bn=M,kn=Fa,wn=f2,xn=/^[-+]0x[0-9a-f]+$/i,Cn=/^0b[01]+$/i,Pn=/^0o[0-7]+$/i,Mn=parseInt,Sn=n2,On=function(t,e){for(var i=-1,n=null==t?0:t.length,s=Array(n);++i<n;)s[i]=e(t[i],i,t);return s},En=q,_n=f2,m=V?V.prototype:void 0,Bn=m?m.toString:void 0,In=function(t){var t=(t=t)?(t=Sn(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0,e=t%1;return t==t?e?t-e:t:0},An=n2,Nn=b.isFinite,jn=Math.min,L=(on=Math.round,function(t,e){var i,n;return t=An(t),(e=null==e?0:jn(In(e),292))&&Nn(t)?(i=(z2(t)+"e").split("e"),n=on(i[0]+"e"+(+i[1]+e)),+((i=(z2(n)+"e").split("e"))[0]+"e"+(+i[1]-e))):on(t)}),zn=function(){a(s,hn);var e=f(s);function s(t){return n(this,s),e.call(this,i(i({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}return r(s,[{key:"initEvents",value:function(){v(h(s.prototype),"initEvents",this).call(this),this.on(w,this.resizeEvtHandler,this)}},{key:"resizeEvtHandler",value:function(t){if(this.parentNode){var e=t.quadrant,i=t.movementX,n=t.movementY,s=this.parentNode.state,o=s.left,r=s.top,a=s.width,h=s.height,s=ft([],[i,n],lt([],s.absoluteLinearMatrix)),i=s[0],n=s[1];switch(e){case 1:o-=i,r+=n,a+=2*i,h-=2*n;break;case 2:o+=i,r+=n,a-=2*i,h-=2*n;break;case 3:o+=i,r-=n,a-=2*i,h+=2*n;break;case 4:o-=i,r-=n,a+=2*i,h+=2*n;break;case 5:r+=n,h-=2*n;break;case 6:r-=n,h+=2*n;break;case 7:o+=i,a-=2*i;break;case 8:o-=i,a+=2*i}s={top:r,left:o,width:Math.abs(a),height:Math.abs(h)};this.parentNode.trigger(vt,new j(t,{quadrant:e})),this.parentNode.setState(s),this.parentNode.trigger(k,new j(t,{quadrant:e}))}}},{key:"moveGlobalPosition",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new j,n=0<t?1:-1,s=0<e?1:-1,o=this.parentNode.state,r=o.localOrigin,a=o.width,h=o.height,o=ft([],[t,e],lt([],o.absoluteLinearMatrix)),o=(t=o[0],e=o[1],this.state),l=o.left,u=o.top,o=o.quadrant,c=this.state.width/2,f=0;"x"===this.state.direction?f=0<(l=0===L(l+=t)?.5*n:l)+c-r[0]?8:7:"y"===this.state.direction?f=0<(u=0===L(u+=e)?.5*s:u)+c-r[1]?6:5:"xy"===this.state.direction&&(s=-h/2/(s=0===L(s=-a/2)?.5*n:s),0===L(a=a/2)&&(a=.5*n),u+=e=2===o||4==o?s*(l+c-r[0]+t)-(u+c-r[1]):-h/2/a*(l+c-r[0]+t)-(u+c-r[1]),f=0<(l+=t)+c-r[0]?0<u+c-r[1]?4:1:0<u+c-r[1]?3:2),o!==f&&this.parentNode.toggleControlQuadrant(this,f),this.setPosition(l,u,new j(i,{left:l,top:u,tx:t,ty:e,quadrant:f}))}}]),s}(),Dn=function(){function t(){throw n(this,t),new Error("GeoUtil is a static util class.")}return r(t,null,[{key:"calcRotateAngle",value:function(t,e,i,n){t-=i,i=e-n,e=Math.hypot(t,i);return((i/e<0?-1:1)*Math.acos(t/e)*180/Math.PI+360)%360}}]),t}(),Tn=function(){a(s,fn);var e=f(s);function s(t){return n(this,s),e.call(this,i(i({},t),{},{linkable:!1}))}return r(s,[{key:"initEvents",value:function(){v(h(s.prototype),"initEvents",this).call(this),this.on(w,this.rotateEvtHandler,this)}},{key:"rotateEvtHandler",value:function(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteOrigin,t={transform:{rotate:Dn.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger("BEFORE_ROTATE",new j(t)),this.parentNode.setState(t),this.parentNode.trigger(yt,new j(t)))}}]),s}(),Ln=function(){a(s,un);var e=f(s);function s(t){return n(this,s),o(u(t=e.call(this,i(i({},t),{},{zIndex:10000001,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"rotateControlSize",8),o(u(t),"rotateControlffsetY",60),o(u(t),"resizeControlInstanceCache",[]),o(u(t),"resizeControlSize",16),t.initControls(),t}return r(s,[{key:"initControls",value:function(){var t=this.state.width,e=this.state.height,i=t/2,n=e/2,s=this.resizeControlSize/2,o=[{direction:"xy",quadrant:2,position:[-s,-s]},{direction:"y",quadrant:5,position:[i-s,-s]},{direction:"xy",quadrant:1,position:[t-s,-s]},{direction:"x",quadrant:8,position:[t-s,n-s]},{direction:"xy",quadrant:4,position:[t-s,e-s]},{direction:"y",quadrant:6,position:[i-s,e-s]},{direction:"xy",quadrant:3,position:[-s,e-s]},{direction:"x",quadrant:7,position:[-s,n-s]}];this.resizeControlInstanceCache=[];for(var r=0;r<o.length;r++){var a=o[r],a=new zn({zIndex:10000002,display:!1,left:a.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,i=-this.rotateControlffsetY;this.rotateControlInstance=new Tn({zIndex:10000003,display:!1,left:t,top:i,radius:this.rotateControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1}}),this.addChild(this.rotateControlInstance)}},{key:"initEvents",value:function(){v(h(s.prototype),"initEvents",this).call(this),this.on(k,this.resizeEvtHandler,this),this.on(yt,this.rotateEvtHandler,this)}},{key:"enable",value:function(){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(k),this.resume(yt)}},{key:"disable",value:function(){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(k),this.suspend(yt)}},{key:"setControlPositions",value:function(){for(var t=this.state.width,e=this.state.height,i=t/2,n=e/2,s=this.resizeControlSize/2,o=0;o<this.resizeControlInstanceCache.length;o++){var r=this.resizeControlInstanceCache[o],a=[0,0];switch(r.state.quadrant){case 1:a=[t-s,-s];break;case 2:a=[-s,-s];break;case 3:a=[-s,e-s];break;case 4:a=[t-s,e-s];break;case 5:a=[i-s,-s];break;case 6:a=[i-s,e-s];break;case 7:a=[-s,n-s];break;case 8:a=[t-s,n-s]}r.setState({left:a[0],top:a[1]})}var h=this.state.width/2-this.rotateControlSize,l=-this.rotateControlffsetY;this.rotateControlInstance.setState({left:h,top:l})}},{key:"rotateEvtHandler",value:function(t){var e;this.targetComponent&&(e=this.state.transform.rotate,this.targetComponent.setGlobalRotate(e),this.targetComponent.trigger(yt))}},{key:"resizeEvtHandler",value:function(t){if(this.targetComponent){var e=t.quadrant,i=t.movementX,n=t.movementY,t=this.targetComponent.state,s=t.left,o=t.top,r=t.width,a=t.height,t=ft([],[i,n],lt([],t.absoluteLinearMatrix)),i=t[0],n=t[1];switch(e){case 1:s-=i,o+=n,r+=2*i,a-=2*n;break;case 2:s+=i,o+=n,r-=2*i,a-=2*n;break;case 3:s+=i,o-=n,r-=2*i,a+=2*n;break;case 4:s-=i,o-=n,r+=2*i,a+=2*n;break;case 5:o+=n,a-=2*n;break;case 6:o-=n,a+=2*n;break;case 7:s+=i,r-=2*i;break;case 8:s-=i,r+=2*i}this.targetComponent.setState({left:s,top:o,width:Math.abs(r),height:Math.abs(a)}),this.targetComponent.trigger(k)}}},{key:"updatePanel",value:function(){var t,e,i,n,s;this.targetComponent&&(t=this.targetComponent.getRotateAngle(),e=(s=this.targetComponent.getLocalLeftTop()).left,i=s.top,n=s.width,s=s.height,this.setState({left:e,top:i,width:n,height:s,transform:{rotate:t}}))}},{key:"targetComponent",get:function(){return this._targetComponent},set:function(t){var e=this;this._targetComponent&&this._targetComponent.off(w,this.updatePanel,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(w,this.updatePanel,this),this._targetComponent&&this._targetComponent.once(rt,function(){e.targetComponent=null,e.disable()},this),this.updatePanel()}},{key:"toggleControlQuadrant",value:function(t,e){for(var i=0;i<this.resizeControlInstanceCache.length;i++){var n=this.resizeControlInstanceCache[i];if(n.state.quadrant===e){var s=0;switch(e){case 1:s=3;break;case 2:s=4;break;case 3:s=1;break;case 4:s=2;break;case 5:s=6;break;case 6:s=5;break;case 7:s=8;break;case 8:s=7}n.setState({quadrant:s})}}t.setState({quadrant:e})}}]),s}(),Rn=function(){function t(e){n(this,t),this.ice=e,this.transformControlPanel=new Ln({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 pn({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 r(t,[{key:"start",value:function(){return this.ice.evtBus.on("mousedown",this.mouseDownHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off("mousedown",this.mouseDownHandler,this),this}},{key:"mouseDownHandler",value:function(t){t=t.target;if(!t.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()))}}]),t}(),Xn=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dbclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],Hn=function(){function t(e){n(this,t),o(this,"selectionCandidates",[]),o(this,"_stopped",!1),this.ice=e}return r(t,[{key:"start",value:function(){for(var n=this,s=null,t=0;t<Xn.length;t++)!function(t){var t=Xn[t],e=t[1],i=t[0];n.ice.evtBus.on(e,function(t){n._stopped||((s="ICE_MOUSEMOVE"!==e?n.findTargetComponent(t):s)&&(t.target=s).trigger(i,t),n.ice.evtBus.trigger(i,t))})}(t);return this}},{key:"stopped",get:function(){return this._stopped},set:function(t){this._stopped=t}},{key:"findTargetComponent",value:function(t){if(this._stopped)return null;var e=t.offsetX,i=t.offsetY,t=Ys([],this.ice.toolNodes),n=Ys([],this.ice.childNodes),s=[].concat(p(t),p(n));s.sort(function(t,e){return t.state.zIndex-e.state.zIndex});for(var o=0;o<s.length;o++){var r=s[o],a=r.state,h=a.interactive,a=a.display;r.containsPoint(e,i)&&h&&a&&this.selectionCandidates.push(r)}t=this.selectionCandidates.pop();return this.selectionCandidates=[],t}}]),t}(),Vn=function(){a(i,T);var t=f(i);function i(){return n(this,i),t.call(this)}return r(i)}(),qn=function(){function t(e,i){n(this,t),this.startPoint=e,this.endPoint=i}return r(t,[{key:"contains",value:function(t,e){var i=Math.hypot(this.endPoint.x-this.startPoint.x,this.endPoint.y-this.startPoint.y),n=Math.hypot(t-this.startPoint.x,e-this.startPoint.y),t=Math.hypot(t-this.endPoint.x,e-this.endPoint.y);return i-3<=n+t&&n+t<=i+3}}]),t}(),R=function(){function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;n(this,t),this.x=e,this.y=i}return r(t,[{key:"equals",value:function(t){return this.x==t.x&&this.y==t.y}},{key:"clone",value:function(){return new t(this.x,this.y)}}],[{key:"load",value:function(e){return new t(Number(e.x),Number(e.y))}},{key:"cloneArray",value:function(t){for(var e=[],i=0;i<t.length;i++)e.push(t[i].clone());return e}}]),t}(),Wn=function(){a(s,an);var e=f(s);function s(t){return n(this,s),e.call(this,i({dots:[],closePath:!0},t))}return r(s,[{key:"calcComponentParams",value:function(){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(){for(var t=v(h(s.prototype),"calcLocalOrigin",this).call(this),e=0;e<this.state.dots.length;e++){var i=ft([],this.state.dots[e],[1,0,0,1,-t[0],-t[1]]);this.state.dots[e]=i}return t}},{key:"createPathObject",value:function(){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(){return this.state.dots=[],this.state.dots}},{key:"calc4VertexPoints",value:function(){for(var t=this.state.dots[0][0],e=this.state.dots[0][1],i=this.state.dots[0][0],n=this.state.dots[0][1],s=1;s<this.state.dots.length;s++){var o=this.state.dots[s];o[0]<t&&(t=o[0]),o[0]>i&&(i=o[0]),o[1]<e&&(e=o[1]),o[1]>n&&(n=o[1])}return[[t,e],[i,e],[t,n],[i,n]]}},{key:"getTransformedDots",value:function(){for(var t=this.state.composedMatrix,e=this.state.dots,i=[],n=0;n<e.length;n++){var s=ft([],e[n],t);i.push(s)}return i}}]),s}(),C=function(){a(s,rn);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return n(this,s),e.call(this,i({width:100,height:100,src:"data:image/png;base64,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"},t))}return r(s,[{key:"doRender",value:function(){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)),v(h(s.prototype),"doRender",this).call(this)}}]),s}(),I=r(function t(){n(this,t)}),Jn=function(){a(s,Wn);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(n(this,s),s.arrangeParam(t));return o(u(t=e.call(this,t)),"__typeName","ICEPolyLine"),o(u(t),"links",{start:{},end:{}}),t}return r(s,[{key:"initEvents",value:function(){v(h(s.prototype),"initEvents",this).call(this),this.once(ot,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function(t){this.evtBus.once(at,this.makeConnection,this)}},{key:"makeConnection",value:function(){var t,e,i=this.state.links;i&&(i.start&&(t=i.start.id,e=i.start.position,t&&e&&(t=this.ice.findComponent(t),this.setLink("start",t,e))),i.end&&(t=i.end.id,e=i.end.position,t&&e&&(i=this.ice.findComponent(t),this.setLink("end",i,e)))),this.ice.dirty=!0}},{key:"setLink",value:function(t,e,n){this.removeLink(t,e,n),this.links[t]={component:e,position:n},e.on(w,this.followComponent,this),e.on(k,this.followComponent,this),e.on(yt,this.followComponent,this),e.once(nt,this.followComponent,this),this.followComponent();var s,o={};for(s in this.links){var r=this.links[s];r.component&&r.position&&(o[s]={id:r.component.props.id,position:r.position})}this.setState({links:i({},o),draggable:!1})}},{key:"removeLink",value:function(t,e,i){var n=this.links[t].component,s=this.links[t].position;n===e&&s===i&&(n&&n.off(w,this.followComponent,this),n&&n.off(k,this.followComponent,this),n&&n.off(yt,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(t){for(var e in this.links){var i=this.links[e].position,n=this.links[e].component;if(i&&n){var s=n.getMinBoundingBox(),o=[0,0];switch(i){case"T":o=s.tc;break;case"R":o=s.rc;break;case"B":o=s.bc;break;case"L":o=s.lc}switch(e){case"start":this.setState({startPoint:p(o)});break;case"end":this.setState({endPoint:p(o)})}}}}},{key:"calcLocalOrigin",value:function(){var t=[0,0];return this.state.localOrigin=t}},{key:"calcDots",value:function(){var t=this.state.left,e=this.state.top;this.state.dots=[];for(var i=0;i<this.state.points.length;i++){var n=this.state.points[i],s=n[0]-t,n=n[1]-e;this.state.dots.push([s,n])}return this.calcArrowPoints(),this.state.dots}},{key:"calcArrowPoints",value:function(){var t,e,i;"start"!==this.state.arrowPosition&&"both"!==this.state.arrowPosition||(i=p(this.state.dots[0]),e=[p(this.state.dots[0]),p(this.state.dots[1])],e=this.doCalcArrowPoints(e),(t=this.state.dots).unshift.apply(t,p(e)),this.state.dots.unshift(p(i))),"end"!==this.state.arrowPosition&&"both"!==this.state.arrowPosition||(t=this.state.dots.length,e=p(this.state.dots[t-1]),i=[p(this.state.dots[t-1]),p(this.state.dots[t-2])],i=this.doCalcArrowPoints(i),(t=this.state.dots).push.apply(t,p(i)),this.state.dots.push(p(e)))}},{key:"doCalcArrowPoints",value:function(t){var e=t[0],t=t[1],i=(t[0]=t[0]-e[0],t[1]=t[1]-e[1],t[0]/Math.hypot.apply(Math,p(t))),t=t[1]/Math.hypot.apply(Math,p(t)),n=Math.cos(this.state.arrowAngel),s=Math.sin(this.state.arrowAngel),o=this.state.arrowLength*(i*n-t*s),r=this.state.arrowLength*(t*n+i*s),a=this.state.arrowLength*(i*n+t*s),t=this.state.arrowLength*(t*n-i*s);return[[o+=e[0],r+=e[1]],[a+=e[0],t+=e[1]]]}},{key:"addDot",value:function(t,e){this.state.points.splice(e,0,t),this.state.dots.splice(e,0,[t[0],t[1]])}},{key:"rmDot",value:function(t){return!(this.state.points.length<3||(this.state.points.splice(t,1),this.state.dots.splice(t,1),0))}},{key:"calcComponentParams",value:function(){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]),i=this.state.style.lineWidth;return this.isDotsOnSameLine()||(i=Math.abs(t[2][1]-t[0][1])),this.state.width=e,this.state.height=i,{width:this.state.width,height:this.state.height}}},{key:"isDotsOnSameLine",value:function(){for(var t=this.state.points.length,e=L(this.state.points[0][0],2),i=L(this.state.points[0][1],2),n=0,s=[L(this.state.points[t-1][0],2)-e,L(this.state.points[t-1][1],2)-i],o=0;o<t;o++){var r=this.state.points[o];0===function ct(t,e,i){return e=e[0]*i[1]-e[1]*i[0],t[0]=t[1]=0,t[2]=e,t}([],s,[r[0]-e,r[1]-i])[2]&&n++}return n===t}},{key:"calc4VertexPoints",value:function(){return this.isDotsOnSameLine()?this.splitEndpointsTo4Points():v(h(s.prototype),"calc4VertexPoints",this).call(this)}},{key:"splitEndpointsTo4Points",value:function(){var t=this.state.points.length,e=this.state.points[t-1][0]-this.state.points[0][0],t=this.state.points[t-1][1]-this.state.points[0][1],i=this.getRotateAngle(),n=this.state.height,s=Math.cos(i*Math.PI/180)*n/2,i=Math.sin(i*Math.PI/180)*n/2;return[[0+(s=L(s,3)),0+(i=L(i,3))],[0-s,0-i],[e+s,t+i],[e-s,t-i]]}},{key:"getMinBoundingBox",value:function(){var t=this.state.localOrigin[0],e=this.state.localOrigin[1],i=this.calc4VertexPoints(),t=new nn([i[0][0]-t,i[0][1]-e,i[1][0]-t,i[1][1]-e,i[2][0]-t,i[2][1]-e,i[3][0]-t,i[3][1]-e,0,0]);return t.transform(this.state.composedMatrix)}},{key:"setState",value:function(t){if(Xc(t.width)||delete t.width,Xc(t.height)||delete t.height,Xc(t.transform)||delete t.transform,!Xc(t.left))for(var e=t.left-this.state.points[0][0],i=0;i<this.state.points.length;i++)this.state.points[i][0]+=e;if(!Xc(t.top))for(var n=t.top-this.state.points[0][1],o=0;o<this.state.points.length;o++)this.state.points[o][1]+=n;var r;Xc(t.startPoint)||(this.state.points[0]=p(t.startPoint),this.state.left=this.state.points[0][0],this.state.top=this.state.points[0][1]),Xc(t.endPoint)||(r=this.state.points.length,this.state.points[r-1]=p(t.endPoint)),v(h(s.prototype),"setState",this).call(this,t)}},{key:"getRotateAngle",value:function(){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],Dn.calcRotateAngle(t,e,0,0)+90):v(h(s.prototype),"getRotateAngle",this).call(this)}},{key:"containsPoint",value:function(t,e){for(var i=this.getLines(),n=0;n<i.length;n++){var s=i[n],o=s.o[0],r=s.o[1],a=s.d[0],s=s.d[1],h=Math.hypot(a-o,s-r),o=Math.hypot(o-t,r-e),r=Math.hypot(a-t,s-e);if(h-3<=o+r&&o+r<=h+3)return!0}return!1}},{key:"getLines",value:function(){var t=[],e=this.getTransformedDots();if(!e||e.length<2)return t;for(var i=0;i<e.length-1;i++){var n={o:[e[i][0],e[i][1]],d:[e[i+1][0],e[i+1][1]]};t.push(n)}return t}}],[{key:"arrangeParam",value:function(t){var e=Di({},{lineType:"solid",lineWidth:1,arrowPosition:"both",arrowLength:15,arrowAngel:30*kt,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=i(i({},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}}]),s}(),Fn=function(){a(s,fn);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return n(this,s),e.call(this,i({linkable:!1,draggable:!1,position:"T"},t))}return r(s,[{key:"initEvents",value:function(){v(h(s.prototype),"initEvents",this).call(this),this.once(it,this.beforeRenderHandler,this),this.once(rt,this.beforeRemoveHandler,this)}},{key:"beforeRenderHandler",value:function(t){this.evtBus.on(ct,this.hookMouseDownHandler,this),this.evtBus.on(dt,this.hookMouseMoveHandler,this),this.evtBus.on(pt,this.hookMouseUpHandler,this),this.evtBus.on("mouseup",this.globalMouseUpHandler,this)}},{key:"beforeRemoveHandler",value:function(t){this.evtBus.off(ct,this.hookMouseDownHandler,this),this.evtBus.off(dt,this.hookMouseMoveHandler,this),this.evtBus.off(pt,this.hookMouseUpHandler,this),this.evtBus.off("mouseup",this.globalMouseUpHandler,this),this._hostComponent=null}},{key:"globalMouseUpHandler",value:function(){this.setState({display:!1})}},{key:"hookMouseDownHandler",value:function(t){console.log("linkslot, hook mousedown event..."),this._hostComponent&&this.setState({display:!0})}},{key:"hookMouseMoveHandler",value:function(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(t){var e,i;this._hostComponent&&(e=(t=t.target).parentNode.targetComponent,i=t.state.position,this.isIntersectWithHook(t)?e&&e.setLink(i,this._hostComponent,this.props.position):e&&e.removeLink(i,this._hostComponent,this.props.position),this.setState({display:!1,style:{fillStyle:"#3ce92c"}}),t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"isIntersectWithHook",value:function(t){var e=this.getMaxBoundingBox(),t=t.getMaxBoundingBox();return!!e.isIntersect(t)}},{key:"updatePosition",value:function(){console.log("link slot update position ...");var t=this._hostComponent.getMinBoundingBox(),e=0,i=0;switch(this.state.position){case"T":e=t.tc[0]-this.state.radius,i=t.tc[1]-this.state.radius;break;case"R":e=t.rc[0]-this.state.radius,i=t.rc[1]-this.state.radius;break;case"B":e=t.bc[0]-this.state.radius,i=t.bc[1]-this.state.radius;break;case"L":e=t.lc[0]-this.state.radius,i=t.lc[1]-this.state.radius}this.setState({left:e,top:i})}},{key:"hostComponent",get:function(){return this._hostComponent},set:function(t){var e=this;this._hostComponent&&this._hostComponent.off(nt,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(nt,this.updatePosition,this),this._hostComponent&&this._hostComponent.once(rt,function(){e._hostComponent=null,e.setState({display:!1})},this),this._hostComponent&&this.setState({display:!0})}}]),s}(),E=function(){a(s,Jn);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return n(this,s),t=s.arrangeParam(t),e.call(this,t)}return r(s,[{key:"calcDots",value:function(){var t=this.interpolate(),e=this.state,i=e.left,n=e.top,s=t[0][2];this.state.points=[],this.state.dots=[];for(var o=0;o<s.length;o++){var r=s[o];this.state.points.push([r.x,r.y]),this.state.dots.push([r.x-i,r.y-n])}return this.calcArrowPoints(),this.state.dots}},{key:"interpolate",value:function(){var t=this.state.points.length,e=this.state.points[0][0],i=this.state.points[0][1],n=this.state.points[t-1][0],t=this.state.points[t-1][1],s=new R(e,i),o=new R(n,t),r=[],a=null,h=null,l=[],u=new nn,c=new nn,e=this.links.start.component;if(e){u=e.getMinBoundingBox(),r[0]=new R(s.x,u.tl[1]-this.state.escapeDistance),r[1]=new R(u.tr[0]+this.state.escapeDistance,s.y),r[2]=new R(s.x,u.br[1]+this.state.escapeDistance),r[3]=new R(u.tl[0]-this.state.escapeDistance,s.y);for(var a=r[0],f=1;f<r.length;f++)this.distance(s,r[f])<this.distance(s,a)&&(a=r[f])}i=this.links.end.component;if(i){c=i.getMinBoundingBox(),r[0]=new R(o.x,c.tl[1]-this.state.escapeDistance),r[1]=new R(c.tr[0]+this.state.escapeDistance,o.y),r[2]=new R(o.x,c.br[1]+this.state.escapeDistance),r[3]=new R(c.tl[0]-this.state.escapeDistance,o.y);for(var h=r[0],d=1;d<r.length;d++)this.distance(o,r[d])<this.distance(o,h)&&(h=r[d])}var n=0,t=[s],e=(a&&(t.push(a),n=1),h&&t.push(h),t.push(o),R.cloneArray(t)),i=(l.push(["s0","s0",e]),R.cloneArray(t)),e=R.cloneArray(i),t=(e.splice(n+1,0,new R(e[n].x,e[n+1].y)),l.push(["s1","s1_1",e]),R.cloneArray(i)),e=(t.splice(n+1,0,new R(t[n+1].x,t[n].y)),l.push(["s1","s1_2",t]),R.cloneArray(i)),t=new R((e[n].x+e[n+1].x)/2,e[n].y),p=new R((e[n].x+e[n+1].x)/2,e[n+1].y),t=(e.splice(n+1,0,t,p),l.push(["s2","s2_1",e]),R.cloneArray(i)),p=new R(t[n].x,(t[n].y+t[n+1].y)/2),e=new R(t[n+1].x,(t[n].y+t[n+1].y)/2),p=(t.splice(n+1,0,p,e),l.push(["s2","s2_2",t]),R.cloneArray(i)),e=[p[n].x+20,p[n+1].x+20],t=(u&&e.push(u.br[0]+20),c&&e.push(c.br[0]+20),this.max(e)),e=new R(t,p[n].y),t=new R(t,p[n+1].y),e=(p.splice(n+1,0,e,t),l.push(["s2","s2_3",p]),R.cloneArray(i)),t=[e[n].y-20,e[n+1].y-20],p=(u&&t.push(u.tl[1]-20),c&&t.push(c.tl[1]-20),this.min(t)),t=new R(e[n].x,p),p=new R(e[n+1].x,p),t=(e.splice(n+1,0,t,p),l.push(["s2","s2_4",e]),R.cloneArray(i)),p=[t[n].x-20,t[n+1].x-20],e=(u&&p.push(u.tl[0]-20),c&&p.push(c.tl[0]-20),this.min(p)),p=new R(e,t[n].y),e=new R(e,t[n+1].y),p=(t.splice(n+1,0,p,e),l.push(["s2","s2_5",t]),R.cloneArray(i)),e=[p[n].y+20,p[n+1].y+20],t=(u&&e.push(u.tl[1]+u.height+20),c&&e.push(c.tl[1]+c.height+20),this.max(e)),i=new R(p[n].x,t),e=new R(p[n+1].x,t);p.splice(n+1,0,i,e),l.push(["s2","s2_6",p]);for(var v=[],y=0;y<l.length;y++){var g=l[y][2];this.orthogonalPath(g)&&v.push(l[y])}if(l=v,!s.equals(o)){for(var m=[],b=0;b<l.length;b++){var k=l[b][2];this.forwardPath(k)&&m.push(l[b])}(l=m).length}for(var w=[],x=0;x<l.length;x++){var C=!1,P=l[x][2].slice();(c||u)&&(P=P.slice(1,P.length-1)),u&&(C=C||this.polylineIntersectsRectangle(P,u)),(C=c?C||this.polylineIntersectsRectangle(P,c):C)||w.push(l[x])}(l=0!=w.length?w:l).length;for(var M=l[0][2].length,S=[],O=0;O<l.length;O++)l[O][2].length==M&&S.push(l[O]);for(var l=S,E=0,_=0;_<l.length;_++)this.scorePath(l[E][2])<this.scorePath(l[_][2])&&(E=_);return[l[E]]}},{key:"orthogonalPath",value:function(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(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&&(s=t,t=e,e=s),s=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),i=t.startPoint.y-s*t.startPoint.x,n=e.startPoint.x,t.contains(n,s=s*n+i)&&e.contains(n,s);var i=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),n=t.startPoint.y-i*t.startPoint.x,s=(e.endPoint.y-e.startPoint.y)/(e.endPoint.x-e.startPoint.x),o=e.startPoint.y-s*e.startPoint.x;if(i==s)return n==o&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));o=(o-n)/(i-s),s=i*o+n;return t.contains(o,s)&&e.contains(o,s)}},{key:"polylineIntersectsRectangle",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]&&arguments[2],n=[];n.push(new qn(new R(e.x1,e.y1),new R(e.x2,e.y1))),n.push(new qn(new R(e.x2,e.y1),new R(e.x2,e.y2))),n.push(new qn(new R(e.x2,e.y2),new R(e.x1,e.y2))),n.push(new qn(new R(e.x1,e.y2),new R(e.x1,e.y1)));for(var s=0;s<t.length-1;s++)for(var o=new qn(t[s],t[s+1]),r=0;r<n.length;r++)if(this.lineIntersectsLine(o,n[r]))return!0;if(i)for(var a=new qn(t[t.length-1],t[0]),h=0;h<n.length;h++)if(this.lineIntersectsLine(a,n[h]))return!0;return!1}},{key:"scorePath",value:function(t){if(t.length<=2)return-1;for(var e=0,i=1;i<t.length-1;i++)if(t[i-1].x==t[i].x&&t[i].x==t[i+1].x){if(this.signum(t[i+1].y-t[i].y)!=this.signum(t[i].y-t[i-1].y))return-1;e++}else if(t[i-1].y==t[i].y&&t[i].y==t[i+1].y){if(this.signum(t[i+1].x-t[i].x)!=this.signum(t[i].x-t[i-1].x))return-1;e++}else e--;return e}},{key:"signum",value:function(t){return 0<t?1:t<0?-1:0}},{key:"forwardPath",value:function(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(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}},{key:"max",value:function(t){if(0==t.lenght)return NaN;for(var e=t[0],i=0;i<t.length;i++)e<t[i]&&(e=t[i]);return e}},{key:"min",value:function(t){if(0==t.lenght)return NaN;for(var e=t[0],i=0;i<t.length;i++)e>t[i]&&(e=t[i]);return e}},{key:"addDot",value:function(t,e){throw new Error("Can NOT add dot to ICEVisioLink mannually.")}},{key:"rmDot",value:function(t){throw new Error("Can NOT remove dot from ICEVisioLink mannually.")}}],[{key:"arrangeParam",value:function(t){return Xc(t.startPoint)&&(t.startPoint=[0,0]),Xc(t.endPoint)&&(t.endPoint=[10,10]),t.points=[p(t.startPoint),p(t.endPoint)],i({escapeDistance:30},t)}}]),s}(),le=function(){a(s,Wn);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(n(this,s),i({radius:10,edges:3,startAngle:90},t));return 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 r(s,[{key:"calcDots",value:function(){this.state.dots=[];for(var t=2*Math.PI/this.state.edges,e=this.state.radius,i=0;i<this.state.edges;i++){var n=t*i-ht(this.state.startAngle),s=Math.floor(e*Math.cos(n)+e),n=Math.floor(e*Math.sin(n)+e);this.state.dots.push([s,n])}return this.state.dots}},{key:"calcComponentParams",value:function(){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(t){Xc(t.radius)?Xc(t.width)?Xc(t.height)||(t.radius=t.height/2):t.radius=t.width/2:(t.width=2*t.radius,t.height=2*t.radius),v(h(s.prototype),"setState",this).call(this,t)}}]),s}(),P=function(){a(s,Wn);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(n(this,s),i({radius:50,leafNum:2,pointNumber:100},t));return t.leafNum=Math.floor(2<=t.leafNum?t.leafNum:2),t.width=2*t.radius,t.height=2*t.radius,e.call(this,t)}return r(s,[{key:"calcDots",value:function(){var t=this.state.radius,e=this.state.leafNum;this.state.dots=[];for(var i,n,s=Math.PI/this.state.pointNumber,o=0;i=t+t*Math.sin(e*o)*Math.cos(o),n=t+t*Math.sin(e*o)*Math.sin(o),this.state.dots.push([i,n]),!((o+=s)>=2*Math.PI););return this.state.dots}},{key:"calcComponentParams",value:function(){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(t){Xc(t.radius)?Xc(t.width)?Xc(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),v(h(s.prototype),"setState",this).call(this,t)}}]),s}(),x=function(){a(s,Wn);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(n(this,s),i({outerRadius:50,innerRadius:20,startAngle:90,spikes:5},t));return 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 r(s,[{key:"calcDots",value:function(){this.state.dots=[];for(var t,e,i=ht(this.state.startAngle),n=Math.PI/this.state.spikes,s=this.state.outerRadius,o=this.state.innerRadius,r=0;r<this.state.spikes;r++)t=Math.cos(i)*s+s,e=Math.sin(i)*s+s,this.state.dots.push([t,e]),i+=n,t=Math.cos(i)*o+s,e=Math.sin(i)*o+s,this.state.dots.push([t,e]),i+=n;return this.state.dots}},{key:"calcComponentParams",value:function(){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(t){Xc(t.outerRadius)?Xc(t.width)?Xc(t.height)||(t.outerRadius=t.height/2):t.outerRadius=t.width/2:(t.width=2*t.outerRadius,t.height=2*t.outerRadius),v(h(s.prototype),"setState",this).call(this,t)}}]),s}(),z=function(){a(s,rn);var e=f(s);function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(n(this,s),Di({text:"",left:0,top:0,width:10,height:10,style:{fontWeight:"bold",fontSize:32,fontFamily:"Arial",lineWidth:1}},t));return t.style=i(i({},t.style),{},{font:"".concat(t.style.fontWeight," ").concat(t.style.fontSize,"px ").concat(t.style.fontFamily),textBaseline:"bottom"}),e.call(this,t)}return r(s,[{key:"initEvents",value:function(){this.on(ot,this.measureText,this)}},{key:"measureText",value:function(t){try{var e,i=this.root.document.createElement("div"),n={padding:"0",margin:"0",border:"none",position:"absolute",top:"0",left:"0",fontFamily:this.state.style.fontFamily,fontWeight:this.state.style.fontWeight,fontSize:this.state.style.fontSize+"px"};for(e in n)i.style[e]=n[e];i.contenteditable=!1,i.innerHTML=this.state.text,this.root.document.body.appendChild(i);var s={width:i.offsetWidth,height:i.offsetHeight};this.props.width=s.width,this.props.height=s.height,this.state.width=s.width,this.state.height=s.height}finally{this.root.document.body.removeChild(i)}}},{key:"doRender",value:function(){this.state.stroke&&this.ctx.strokeText(this.state.text,0-this.state.localOrigin[0],0-this.state.localOrigin[1]+this.state.height,this.state.width),this.state.fill&&this.ctx.fillText(this.state.text,0-this.state.localOrigin[0],0-this.state.localOrigin[1]+this.state.height,this.state.width),v(h(s.prototype),"doRender",this).call(this)}}]),s}(),Kn={ICERect:hn,ICECircle:fn,ICEEllipse:cn,ICEStar:x,ICEIsogon:le,ICEText:z,ICEImage:C,ICEGroup:ln,ICEVisioLink:E,ICEPolyLine:Jn},Un=function(){function t(e){n(this,t),this.ice=e}return r(t,[{key:"start",value:function(){return this.ice.evtBus.on("mousedown",this.mouseDownHandler,this),this}},{key:"stop",value:function(){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(t){t=t.target;t.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(t){var e=t.movementX,i=t.movementY;return this.currentObj.moveGlobalPosition(e,i,t),!0}},{key:"mouseUpHandler",value:function(t){this.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this)}}]),t}(),X={evtBuses:[],start:function(){if(D&&D.addEventListener)for(var t=0;t<X.evtBuses.length;t++)!function(t){for(var i=X.evtBuses[t],e=0;e<Xn.length;e++)!function(t){var e=Xn[t];D.addEventListener(e[0],function(t){i.trigger(e[1],t)})}(e)}(t)},regitserEvtBus:function(t){X.evtBuses.includes(t)||X.evtBuses.push(t)},delEvtBus:function(t){X.evtBuses.includes(t)&&X.evtBuses.splice(X.evtBuses.indexOf(t),1)}},H={evtBuses:[],stopped:!1,frameCallback:function(){for(var t=0;t<H.evtBuses.length;t++){if(H.stopped)return;H.evtBuses[t].trigger(et)}H.stopped||D.requestFrame(H.frameCallback)},start:function(){H.stopped=!1,D.requestFrame(H.frameCallback)},stop:function(){H.stopped=!0},pause:function(){},resume:function(){},regitserEvtBus:function(t){H.evtBuses.includes(t)||H.evtBuses.push(t)},delEvtBus:function(t){H.evtBuses.includes(t)&&H.evtBuses.splice(H.evtBuses.indexOf(t),1)}},Gn=function(){function t(e){n(this,t),o(this,"slotRadius",10),this.ice=e}return r(t,[{key:"start",value:function(){return this.createLinkSlots(),this.ice.evtBus.on(dt,this.hookMouseMoveHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off(dt,this.hookMouseMoveHandler,this),this}},{key:"hookMouseMoveHandler",value:function(t){for(var e=t.target.getMaxBoundingBox(),i=p(this.ice.childNodes),n=0;n<i.length;n++){var s=i[n];if(s&&s.state.linkable&&s.getMaxBoundingBox().isIntersect(e)){for(var o=0;o<this.ice._linkSlots.length;o++)this.ice._linkSlots[o].hostComponent=s;return}}}},{key:"createLinkSlots",value:function(){var t,e,i,n;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new Fn({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 Fn({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"R",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(e),i=new Fn({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"B",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(i),n=new Fn({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"L",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(n),this.ice._linkSlots=[t,e,i,n])}}]),t}(),Qn=function(){function t(e){n(this,t),this.ice=e}return r(t,[{key:"fromJSON",value:function(t){for(var e=JSON.parse(t).childNodes,i=0;i<e.length;i++)this.decodeRecursively(this.ice,e[i])}},{key:"decodeRecursively",value:function(t,e){var i=new(this.ice.getType(e.type))(e.state),n=(t.addChild(i),e.childNodes);if(n&&n.length)for(var s=0;s<n.length;s++)this.decodeRecursively(i,n[s])}}]),t}(),Yn=function(){function t(e){n(this,t),this.ice=e}return r(t,[{key:"toJSON",value:function(){for(var t={createTime:(new Date).toLocaleString(),lastModifyTime:(new Date).toLocaleString(),childNodes:[]},e=0;e<this.ice.childNodes.length;e++){var i=this.ice.childNodes[e];this.encodeRecursively(i,t)}return console.log(t),JSON.stringify(t)}},{key:"encodeRecursively",value:function(t,e){var i={state:t.state,type:t.constructor.name,childNodes:[]};if(e.childNodes.push(i),t.childNodes&&t.childNodes.length)for(var n=0;n<t.childNodes.length;n++)this.encodeRecursively(t.childNodes[n],i)}}]),t}(),Zn=function(){a(i,T);var s=f(i);function i(t){var e;return n(this,i),o(u(e=s.call(this)),"stopped",!1),o(u(e),"componentQueue",[]),o(u(e),"toolsQueue",[]),e.ice=t,e}return r(i,[{key:"start",value:function(){return this.stopped=!1,this.ice.evtBus.on(et,this.frameEvtHandler,this),this}},{key:"stop",value:function(){return this.stopped=!0,this.ice.evtBus.off(et,this.frameEvtHandler,this),this}},{key:"frameEvtHandler",value:function(t){this.ice.dirty?this.doRender():console.log("没有需要渲染的组件...")}},{key:"refreshQueue",value:function(){this.componentQueue=Ys([],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=Ys([],this.ice.toolNodes),console.log("Tool Queue length> ".concat(this.ice.toolNodes.length))}},{key:"doRender",value:function(){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 i=this.componentQueue[e];i.root=this.ice.root,i.ctx=this.ice.ctx,i.evtBus=this.ice.evtBus,i.ice=this.ice,i.render()}for(var n=0;n<this.toolsQueue.length;n++){var s=this.toolsQueue[n];s.root=this.ice.root,s.ctx=this.ice.ctx,s.evtBus=this.ice.evtBus,s.ice=this.ice,s.render()}console.log("Render time ".concat(Date.now()-t," ms.")),this.ice.dirty=!1,this.ice.evtBus.trigger(at)}}]),i}(),$n=function(){function t(e){n(this,t),o(this,"imageCache",new Map),this.ice=e}return r(t,[{key:"setImage",value:function(e){var i=this,n=this.imageCache.get(e);return n||((n=new Image).onload=function(){i.ice.dirty=!0},n.onerror=function(){console.error("ImageCache: 图片加载失败:",e)},n.src=e,this.imageCache.size>t.CACHE_SIZE&&this.imageCache.delete(this.imageCache.keys().next().value),this.imageCache.set(e,n)),{loaded:this.loaded(n),image:n}}},{key:"loaded",value:function(t){return t.complete&&0<t.naturalWidth}}]),t}(),O=(o($n,"CACHE_SIZE",100),function(){function t(){n(this,t),o(this,"childNodes",[]),o(this,"toolNodes",[]),o(this,"canvasWidth",0),o(this,"canvasHeight",0),o(this,"selectionList",[]),o(this,"typeMapping",{}),o(this,"__dirty",!0),o(this,"_lastUpdateTime",Date.now())}return r(t,[{key:"init",value:function(t){if(!t)throw new Error("ICE.init() failed...");if(this.ctx===t)throw new Error("同一个 canvas 实例只能 init 一次...");for(var e in Kn)this.typeMapping[e]=Kn[e];return this.root=D,Q(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 Vn,H.regitserEvtBus(this.evtBus),H.start(),X.regitserEvtBus(this.evtBus),X.start(),this.eventBridge=new Hn(this).start(),this.animationManager=new mt(this).start(),this.ddManager=new Un(this).start(),this.controlPanelManager=new Rn(this).start(),this.renderer=new Zn(this).start(),this.linkSlotManager=new Gn(this).start(),this.serializer=new Yn(this),this.deserializer=new Qn(this),this.imageCache=new $n(this),this}},{key:"addTool",value:function(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(st,null,{component:t}),t.trigger(st),t.ice=this,t.root=this.root,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(ot,null,{component:t}),t.trigger(ot))}},{key:"removeTool",value:function(t){this.evtBus.trigger(rt,null,{component:t}),t.destory(),this.toolNodes.splice(this.toolNodes.indexOf(t),1),this.dirty=!0}},{key:"addChild",value:function(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(st,null,{component:t}),t.trigger(st),t.ice=this,t.root=this.root,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(ot,null,{component:t}),t.trigger(ot))}},{key:"addChildren",value:function(t){for(var e=0;e<t.length;e++)this.addChild(t[e],!1);this.dirty=!0}},{key:"removeChild",value:function(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];this.evtBus.trigger(rt,null,{component:t}),t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1),this.dirty=e}},{key:"removeChildren",value:function(t){for(var e=0;e<t.length;e++)this.removeChild(t[e],!1);this.dirty=!0}},{key:"clearAll",value:function(){this.removeChildren(p(this.childNodes))}},{key:"findComponent",value:function(e){return this.childNodes.filter(function(t){return t.props.id===e})[0]}},{key:"dirty",get:function(){return this.__dirty},set:function(t){this.__dirty=t}},{key:"registerType",value:function(t,e){this.typeMapping[t]=e}},{key:"getType",value:function(t){return this.typeMapping[t]}},{key:"toJSON",value:function(){return this.serializer.toJSON()}},{key:"fromJSON",value:function(t){var e=this,i=Date.now(),t=(H.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),H.start(),this.renderer.start(),this.animationManager.start(),this.ddManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(function(){e.eventBridge.stopped=!1},300),Date.now());console.log("fromJSON> ".concat(t-i," ms"))}}]),t}());g.AnimationManager=mt,g.CanvasRenderer=Zn,g.DOMEventBridge=Hn,g.EventBus=Vn,g.GeoLine=qn,g.GeoPoint=R,g.GeoUtil=Dn,g.ICE=O,g.ICEBezier=I,g.ICEBoundingBox=nn,g.ICECircle=fn,g.ICEComponent=rn,g.ICEControlPanel=un,g.ICEControlPanelManager=Rn,g.ICEDotPath=Wn,g.ICEEllipse=cn,g.ICEEventTarget=T,g.ICEGroup=ln,g.ICEImage=C,g.ICEIsogon=le,g.ICELinkHook=dn,g.ICELinkSlot=Fn,g.ICEMatrix=sn,g.ICEPath=an,g.ICEPolyLine=Jn,g.ICERect=hn,g.ICERose=P,g.ICEStar=x,g.ICEText=z,g.ICEVisioLink=E,g.LineControlPanel=pn,g.ResizeControl=zn,g.RotateControl=Tn,g.TransformControlPanel=Ln,Object.defineProperty(g,"__esModule",{value:!0})});
|
|
25
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ICE={})}(this,function(e){"use strict";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&&_setPrototypeOf(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,e){return t.__proto__=e,t})(t,e)}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 r(t){return S.call(t)}function t(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(B&&B in Object(t)?M:r)(t)}function v(t){return null!=t&&"object"==typeof t}function z(t){return"string"==typeof t||!L(t)&&T(t)&&"[object String]"==j(t)}function A(t){return void 0===t}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n="object"==typeof n&&n&&n.Object===Object&&n,i="object"==typeof self&&self&&self.Object===Object&&self,i=n||i||Function("return this")(),s=i.Symbol,o=Object.prototype,x=o.hasOwnProperty,w=o.toString,I=s?s.toStringTag:void 0,S=Object.prototype.toString,M=function getRawTag$1(t){var e=x.call(t,I),n=t[I];try{var i=!(t[I]=void 0)}catch(t){}var s=w.call(t);return i&&(e?t[I]=n:delete t[I]),s},B=s?s.toStringTag:void 0,o=Array.isArray,j=t,L=o,T=v,R="ICE_FRAME_EVENT",D="BEFORE_RENDER",N="AFTER_RENDER",H="BEFORE_ADD",V="AFTER_ADD",F="BEFORE_REMOVE",q="ROUND_FINISH",X="HOOK_MOUSEDOWN",J="HOOK_MOUSEMOVE",$="HOOK_MOUSEUP",U="BEFORE_RESIZE",h="AFTER_RESIZE",G="AFTER_ROTATE",a="AFTER_MOVE",K={linear:function linear(t,e,n,i){return t+(e-t)/n*(Date.now()-i)},easeInQuad:function easeInQuad(t,e,n,i){i=Date.now()-i;return t+(e-t)/n*(i/n)*i},easeOutQuad:function easeOutQuad(t,e,n,i){i=Date.now()-i;return-(e-t)*(i/=n)*(i-2)+t},easeInOutQuad:function easeInOutQuad(t,e,n,i){i=Date.now()-i,e-=t;return(i/=n/2)<1?e/2*i*i+t:-e/2*(--i*(i-2)-1)+t},easeInQuart:function easeInQuart(t,e,n,i){i=Date.now()-i;return(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){i=Date.now()-i,e-=t;return(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){i=Date.now()-i;return(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){i=Date.now()-i,e-=t;return(i/=n/2)<1?e/2*i*i*i+t:e/2*((i-=2)*i*i+2)+t}},Q=(_createClass(AnimationManager,[{key:"start",value:function start(){return this.ice.evtBus.on(R,this.frameEventHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(R,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,s=1;for(e in i){var o=i[e];if(o.finished){if(++s===Object.keys(i).length){this.remove(t);break}}else{var r=o.from,a=o.to,l=o.duration,r=(A(o.startTime)&&(o.startTime=Date.now()),A(o.easing)&&(o.easing="linear"),K[o.easing](r,a,l,o.startTime));a<r&&(r=a,o.finished=!0),n[e]=Math.floor(r)}}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){z(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}}]),AnimationManager),Z="undefined"!=typeof Float32Array?Float32Array:Array,tt=Math.PI/180;function AnimationManager(t){_classCallCheck(this,AnimationManager),_defineProperty$1(this,"animationMap",new Map),this.ice=t}function toRadian(t){return t*tt}function invert(t,e){var n=e[0],i=e[1],s=e[2],o=e[3],r=e[4],e=e[5],a=n*o-i*s;return a?(t[0]=o*(a=1/a),t[1]=-i*a,t[2]=-s*a,t[3]=n*a,t[4]=(s*e-o*r)*a,t[5]=(i*r-n*e)*a,t):null}function multiply(t,e,n){var i=e[0],s=e[1],o=e[2],r=e[3],a=e[4],e=e[5],l=n[0],h=n[1],c=n[2],u=n[3],d=n[4],n=n[5];return t[0]=i*l+o*h,t[1]=s*l+r*h,t[2]=i*c+o*u,t[3]=s*c+r*u,t[4]=i*d+o*n+a,t[5]=s*d+r*n+e,t}function transformMat2d(t,e,n){var i=e[0],e=e[1];return 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 Z(2);Z!=Float32Array&&(t[0]=0,t[1]=0)}();function W(t,e){return t===e||t!=t&&e!=e}function Y(t,e){for(var n=t.length;n--;)if(et(t[n][0],e))return n;return-1}function da(t){var e=this.__data__;return!((t=nt(e,t))<0||(t==e.length-1?e.pop():it.call(e,t,1),--this.size,0))}function ea(t){var e=this.__data__;return(t=st(e,t))<0?void 0:e[t][1]}function fa(t){return-1<ot(this.__data__,t)}function ga(t,e){var n=this.__data__,i=rt(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}var et=W,nt=Y,it=Array.prototype.splice,st=Y,ot=Y,rt=Y;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=da,ListCache$4.prototype.get=ea,ListCache$4.prototype.has=fa,ListCache$4.prototype.set=ga;function ja(){this.__data__=new at,this.size=0}function ka(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t}function la(t){return this.__data__.get(t)}function ma(t){return this.__data__.has(t)}function na(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ra(t){return!!ht(t)&&("[object Function]"==(t=lt(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function wa(t){if(null!=t){try{return ut.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ha(t){return!(!ft(t)||pt(t))&&(dt(t)?gt:vt).test(yt(t))}function Ia(t,e){return null==t?void 0:t[e]}function Ja(t,e){return t=Ia(t,e),Ha(t)?t:void 0}function Wa(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t}function Xa(t){var e,n=this.__data__;return mt?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:bt.call(n,t)?n[t]:void 0}function Ya(t){var e=this.__data__;return _t?void 0!==e[t]:kt.call(e,t)}function Za(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Pt&&void 0===e?"__lodash_hash_undefined__":e,this}var l=ListCache$4,at=l,lt=t,ht=na,c=i["__core-js_shared__"],ct=(c=/[^.]+$/.exec(c&&c.keys&&c.keys.IE_PROTO||""))?"Symbol(src)_1."+c:"",ut=Function.prototype.toString,dt=ra,pt=function isMasked$1(t){return!!ct&&ct in t},ft=na,yt=wa,vt=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,c=c.toString,u=u.hasOwnProperty,gt=RegExp("^"+c.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),c=Ja(i,"Map"),u=Ja(Object,"create"),Ct=u,mt=u,bt=Object.prototype.hasOwnProperty,_t=u,kt=Object.prototype.hasOwnProperty,Pt=u;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__=Ct?Ct(null):{},this.size=0},Hash$1.prototype.delete=Wa,Hash$1.prototype.get=Xa,Hash$1.prototype.has=Ya,Hash$1.prototype.set=Za;function b0(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function c0(t,e){return t=t.__data__,b0(e)?t["string"==typeof e?"string":"hash"]:t.map}function i0(t){return t=It(this,t).delete(t),this.size-=t?1:0,t}function j0(t){return St(this,t).get(t)}function k0(t){return Mt(this,t).has(t)}function l0(t,e){var n=Ot(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}var Et=Hash$1,xt=l,wt=c,It=c0,St=c0,Mt=c0,Ot=c0;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 Et,map:new(wt||xt),string:new Et}},MapCache$1.prototype.delete=i0,MapCache$1.prototype.get=j0,MapCache$1.prototype.has=k0,MapCache$1.prototype.set=l0;function u0(t,e){var n=this.__data__;if(n instanceof Bt){var i=n.__data__;if(!At||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}var Bt=l,At=c,jt=MapCache$1,Lt=l,u=ka,l=la,Tt=ma;function Stack$1(t){t=this.__data__=new Lt(t);this.size=t.size}Stack$1.prototype.clear=ja,Stack$1.prototype.delete=u,Stack$1.prototype.get=l,Stack$1.prototype.has=Tt,Stack$1.prototype.set=u0;function z0(t,e,n){"__proto__"==e&&Dt?Dt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function C0(t,e,n){(void 0===n||Ht(t[e],n))&&(void 0!==n||e in t)||Nt(t,e,n)}function G0(t){var e=new t.constructor(t.byteLength);return new Ft(e).set(new Ft(t)),e}function H0(t,e){return e=e?G0(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.length)}function I0(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e}var zt,u=Stack$1,Rt=Ja,l=function(){try{var t=Rt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Dt=l,Nt=z0,Ht=W,Tt=function createBaseFor$1(l){return function(t,e,n){for(var i=-1,s=Object(t),o=n(t),r=o.length;r--;){var a=o[l?r:++i];if(!1===e(s[a],a,s))break}return t}}(),Vt={exports:{}},Ft=(d=(d=(f=Vt).exports)&&!d.nodeType&&d,p=(p=d&&f&&!f.nodeType&&f)&&p.exports===d?i.Buffer:void 0,zt=p?p.allocUnsafe:void 0,f.exports=function cloneBuffer(t,e){if(e)return t.slice();e=t.length,e=zt?zt(e):new t.constructor(e);return t.copy(e),e},i.Uint8Array),qt=na,Xt=Object.create;function object(){}function M0(e,n){return function(t){return e(n(t))}}function P0(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||$t)}function T0(t){return"function"!=typeof t.constructor||Kt(t)?{}:Ut(Gt(t))}function W0(t){return Zt(t)&&"[object Arguments]"==Qt(t)}function ab(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991}function db(t){return null!=t&&ie(t.length)&&!ne(t)}function gb(t){return oe(t)&&se(t)}function rb(t){return!(!le(t)||"[object Object]"!=re(t))&&(null===(t=ae(t))||"function"==typeof(t=ce.call(t,"constructor")&&t.constructor)&&t instanceof t&&he.call(t)==ue)}function wb(t){return fe(t)&&pe(t.length)&&!!C[de(t)]}function xb(e){return function(t){return e(t)}}function Eb(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function Ib(t,e,n){var i=t[e];ge.call(t,e)&&ve(i,n)&&(void 0!==n||e in t)||ye(t,e,n)}function Mb(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&me.test(t))&&-1<t&&t%1==0&&t<e}function Nb(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}function $b(t){if(!we(t))return Se(t);var e,n=Ie(t),i=[];for(e in t)("constructor"!=e||!n&&Me.call(t,e))&&i.push(e);return i}function a1(t){return Be(t)?Oe(t,!0):$b(t)}function v1(t,e,n,i,s,o,r){var a,l,h,c=$e(t,n),u=$e(e,n),d=r.get(u);d?Le(t,n,d):((e=void 0===(d=o?o(c,u,n+"",t,e,r):void 0))&&(l=!(a=He(u))&&Fe(u),h=!a&&!l&&Je(u),d=u,a||l||h?d=He(c)?c:Ve(c)?Re(c):l?Te(u,!(e=!1)):h?ze(u,!(e=!1)):[]:We(u)||Ne(u)?Ne(d=c)?d=Ue(c):Xe(c)&&!qe(c)||(d=De(u)):e=!1),e&&(r.set(u,d),s(d,u,i,o,r),r.delete(u)),Le(t,n,d))}function A1(t){return t}function B1(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 E1(t){return function(){return t}}function Q1(t,e){return ln(an(t,e,rn),t+"")}function R1(t,e,n){if(!dn(n))return!1;var i=typeof e;return!!("number"==i?cn(n)&&un(e,n.length):"string"==i&&e in n)&&hn(n[e],t)}var Wt,Jt,d=M0(Object.getPrototypeOf,Object),$t=Object.prototype,Ut=function(t){if(!qt(t))return{};if(Xt)return Xt(t);object.prototype=t;t=new object;return object.prototype=void 0,t},Gt=d,Kt=P0,Qt=t,Zt=v,Yt=v,p=Object.prototype,te=p.hasOwnProperty,ee=p.propertyIsEnumerable,f=W0(function(){return arguments}())?W0:function(t){return Yt(t)&&te.call(t,"callee")&&!ee.call(t,"callee")},ne=ra,ie=ab,se=db,oe=v,p={exports:{}},re=(m=(m=(g=p).exports)&&!m.nodeType&&m,y=(y=m&&g&&!g.nodeType&&g)&&y.exports===m?i.Buffer:void 0,m=(y?y.isBuffer:void 0)||function stubFalse(){return!1},g.exports=m,t),ae=d,le=v,y=Function.prototype,g=Object.prototype,he=y.toString,ce=g.hasOwnProperty,ue=he.call(Object),de=t,pe=ab,fe=v,C={},m=(C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0,C["[object Arguments]"]=C["[object Array]"]=C["[object ArrayBuffer]"]=C["[object Boolean]"]=C["[object DataView]"]=C["[object Date]"]=C["[object Error]"]=C["[object Function]"]=C["[object Map]"]=C["[object Number]"]=C["[object Object]"]=C["[object RegExp]"]=C["[object Set]"]=C["[object String]"]=C["[object WeakMap]"]=!1,{exports:{}}),g=(y=(y=(d=m).exports)&&!y.nodeType&&y,Wt=y&&d&&!d.nodeType&&d,Jt=Wt&&Wt.exports===y&&n.process,y=function(){try{return Wt&&Wt.require&&Wt.require("util").types||Jt&&Jt.binding&&Jt.binding("util")}catch(t){}}(),d.exports=y,wb),n=xb,d=m.exports,y=d&&d.isTypedArray,m=y?n(y):g,ye=z0,ve=W,ge=Object.prototype.hasOwnProperty,Ce=z0,me=/^(?:0|[1-9]\d*)$/,be=f,_e=o,ke=p.exports,Pe=Mb,Ee=m,xe=Object.prototype.hasOwnProperty,we=na,Ie=P0,Se=function nativeKeysIn$1(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Me=Object.prototype.hasOwnProperty,Oe=function arrayLikeKeys$1(t,e){var n,i=_e(t),s=!i&&be(t),o=!i&&!s&&ke(t),r=!i&&!s&&!o&&Ee(t),a=i||s||o||r,l=a?Nb(t.length,String):[],h=l.length;for(n in t)!e&&!xe.call(t,n)||a&&("length"==n||o&&("offset"==n||"parent"==n)||r&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||Pe(n,h))||l.push(n);return l},Be=db,Ae=function copyObject$1(t,e,n,i){var s=!n;n=n||{};for(var o=-1,r=e.length;++o<r;){var a=e[o],l=i?i(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),(s?Ce:Ib)(n,a,l)}return n},je=a1,Le=C0,Te=Vt.exports,ze=H0,Re=I0,De=T0,Ne=f,He=o,Ve=gb,Fe=p.exports,qe=ra,Xe=na,We=rb,Je=m,$e=Eb,Ue=function toPlainObject$1(t){return Ae(t,je(t))},Ge=u,Ke=C0,Qe=Tt,Ze=na,Ye=a1,tn=Eb,en=Math.max,nn=l,sn=Date.now,d=function shortOut$1(n){var i=0,s=0;return function(){var t=sn(),e=16-(t-s);if(s=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(nn?function(t,e){return nn(t,"toString",{configurable:!0,enumerable:!1,value:E1(e),writable:!0})}:A1),rn=A1,an=function overRest$1(o,r,a){return r=en(void 0===r?o.length-1:r,0),function(){for(var t=arguments,e=-1,n=en(t.length-r,0),i=Array(n);++e<n;)i[e]=t[r+e];for(var e=-1,s=Array(r+1);++e<r;)s[e]=t[e];return s[r]=a(i),B1(o,this,s)}},ln=d,hn=W,cn=db,un=Mb,dn=na,pn=function baseMerge$1(i,s,o,r,a){i!==s&&Qe(s,function(t,e){var n;a=a||new Ge,Ze(t)?v1(i,s,e,o,baseMerge$1,r,a):(n=r?r(tn(i,e),t,e+"",i,s,a):void 0,Ke(i,e,n=void 0===n?t:n))},Ye)},fn=function createAssigner$1(a){return Q1(function(t,e){var n=-1,i=e.length,s=1<i?e[i-1]:void 0,o=2<i?e[2]:void 0,s=3<a.length&&"function"==typeof s?(i--,s):void 0;for(o&&R1(e[0],e[1],o)&&(s=i<3?void 0:s,i=1),t=Object(t);++n<i;){var r=e[n];r&&a(t,r,n,s)}return t})}(function(t,e,n){pn(t,e,n)}),b=(_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),n=M0(Object.keys,Object),yn=P0,vn=n,gn=Object.prototype.hasOwnProperty;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 Z1(t){if(!yn(t))return vn(t);var e,n=[];for(e in Object(t))gn.call(t,e)&&"constructor"!=e&&n.push(e);return n}function uc(t){if(null==t)return!0;if(Mn(t)&&(Sn(t)||"string"==typeof t||"function"==typeof t.splice||On(t)||An(t)||In(t)))return!t.length;var e,n=wn(t);if("[object Map]"==n||"[object Set]"==n)return!t.size;if(Bn(t))return!xn(t).length;for(e in t)if(jn.call(t,e))return!1;return!0}var y=Ja(i,"DataView"),g=c,Vt=Ja(i,"Promise"),u=Ja(i,"Set"),Tt=Ja(i,"WeakMap"),Cn=t,mn=wa,bn=mn(y),_n=mn(g),kn=mn(Vt),Pn=mn(u),En=mn(Tt),l=Cn,xn=((y&&"[object DataView]"!=l(new y(new ArrayBuffer(1)))||g&&"[object Map]"!=l(new g)||Vt&&"[object Promise]"!=l(Vt.resolve())||u&&"[object Set]"!=l(new u)||Tt&&"[object WeakMap]"!=l(new Tt))&&(l=function(t){var e=Cn(t),t="[object Object]"==e?t.constructor:void 0,t=t?mn(t):"";if(t)switch(t){case bn:return"[object DataView]";case _n:return"[object Map]";case kn:return"[object Promise]";case Pn:return"[object Set]";case En:return"[object WeakMap]"}return e}),Z1),wn=l,In=f,Sn=o,Mn=db,On=p.exports,Bn=P0,An=m,jn=Object.prototype.hasOwnProperty,d=null,_=((d=window||global||{}).requestFrame=d.requestAnimationFrame||d.webkitRequestAnimationFrame||d.mozRequestAnimationFrame||d.oRequestAnimationFrame||d.msRequestAnimationFrame,d),n=(_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),s=0;s<i.length;s++){var o=i[s];if(o.callback===e&&o.scope===n)return void this.listeners[t].splice(s,1)}}},{key:"once",value:function once(e,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_,s=this;s.on(e,function callback(t){s.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(uc(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;n?((e=new b(n)).originalEvent=n.originalEvent||n,e.param=_objectSpread2({},i)):e=new b({type:t,timeStamp:Date.now(),param:_objectSpread2({},i)});for(var s=this.listeners[t],o=0;o<s.length;o++){var r=s[o];r.callback.call(r.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 s=0;s<i.length;s++){var o=i[s];if(o.callback===e&&o.scope===n)return!0}return!1}}]),ICEEventTarget);function ICEEventTarget(){_classCallCheck(this,ICEEventTarget),_defineProperty$1(this,"listeners",{}),_defineProperty$1(this,"suspendedEventNames",[])}n.prototype.addEventListener=n.prototype.on,n.prototype.removeEventListener=n.prototype.off,n.prototype.dispatchEvent=n.prototype.trigger;_createClass(ICEBoundingBox,[{key:"containsPoint",value:function containsPoint(t){var e=this.getMinAndMaxPoint(),n=e.minX,i=e.minY,s=e.maxX,e=e.maxY;if(t[0]<n||t[0]>s||t[1]<i||t[1]>e)return!1;for(var o=0,r=this.getBoundingLines(),a=0;a<r.length;a++){var l,h=r[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],s=[this.tr,this.bl,this.br],o=0;o<s.length;o++){var r=s[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{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],s=this.br[1],o=t.tl[0],r=t.br[0],a=t.tl[1],t=t.br[1];return!(r<e||t<i||n<o||s<a)}},{key:"transform",value:function transform(t){var e=transformMat2d([],this.tl,t),n=transformMat2d([],this.tr,t),i=transformMat2d([],this.bl,t),s=transformMat2d([],this.br,t),t=transformMat2d([],this.center,t);return new ICEBoundingBox([].concat(_toConsumableArray(e),_toConsumableArray(n),_toConsumableArray(i),_toConsumableArray(s),_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]))}}]);var Ln=ICEBoundingBox,Tn=(_createClass(ICEMatrix,null,[{key:"calcRotateAngleFromMatrix",value:function calcRotateAngleFromMatrix(t){var e=0,n=t[0],t=t[1],i=Math.hypot(n,t),t=t/i,e=Math.acos(n/i);return 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],t=t[3];return[Math.hypot(e,n)/e,Math.hypot(i,t)/t]}}]),ICEMatrix);function ICEMatrix(){_classCallCheck(this,ICEMatrix)}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 getVal(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function flattenTree(t,e,n,i){for(var s=0<arguments.length&&void 0!==t?t:[],o=1<arguments.length&&void 0!==e?e:[],r=2<arguments.length&&void 0!==n?n:1,a=3<arguments.length&&void 0!==i?i:null,l=0;l<o.length;l++){var h=o[l];h._level=r,h._pid=a,s.push(h),flattenTree(s,h.childNodes||[],r+1,h.id)}return s}_inherits(ICEComponent,n),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(N),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 Z(6);return Z!=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],s=e[1],o=e[2],r=e[3],a=e[4],e=e[5],l=n[0],n=n[1];return t[0]=i*l,t[1]=s*l,t[2]=o*n,t[3]=r*n,t[4]=a,t[5]=e,t}([],function rotate(t,e,n){var i=e[0],s=e[1],o=e[2],r=e[3],a=e[4],e=e[5],l=Math.sin(n),n=Math.cos(n);return t[0]=i*n+o*l,t[1]=s*n+r*l,t[2]=i*-l+o*n,t[3]=s*-l+r*n,t[4]=a,t[5]=e,t}([],function skew(t,e,n,i){n=Math.tan(n),i=Math.tan(i);return 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*tt,n*tt),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=this.calcAbsoluteOrigin(),t=multiply([],[1,0,0,1,t[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,s=this.state.height,e=new Ln([0-e,0-n,0-e+i,0-n,0-e,0-n+s,0-e+i,0-n+s,0,0]),i=t?this.composeMatrix():this.state.composedMatrix;return e.transform(i)}},{key:"getMaxBoundingBox",value:function getMaxBoundingBox(){var t=this.getMinBoundingBox(0<arguments.length&&void 0!==arguments[0]&&arguments[0]),e=t.getMinAndMaxPoint(),n=e.minX,i=e.minY,s=e.maxX,e=e.maxY,t=t.centerPoint;return new Ln([n,i,s,i,n,e,s,e,t[0],t[1]])}},{key:"setState",value:function setState(t){fn(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 b;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 b;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 b;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-=Tn.calcRotateAngleFromMatrix(e)),this.setState({transform:{rotate:t}})}},{key:"localToGlobal",value:function localToGlobal(t,e){t=[t,e];return transformMat2d([],t,this.state.composedMatrix)}},{key:"globalToLocal",value:function globalToLocal(t,e){t=[t,e];return transformMat2d([],t,invert([],this.state.composedMatrix))}},{key:"getRotateAngle",value:function getRotateAngle(){return this.state.transform.rotate}},{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,c=ICEComponent;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=fn(t.props,e),t.state=JSON.parse(JSON.stringify(t.props)),t.initEvents(),t}_defineProperty$1(c,"instanceCounter",0);_inherits(ICEPath,c),Hn=_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)}}]);var Rn,Dn,Nn,Hn,y=ICEPath,g=(_inherits(ICERect,y),Nn=_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),Vt=(_inherits(ICEGroup,g),Dn=_createSuper(ICEGroup),_createClass(ICEGroup,[{key:"addChild",value:function addChild(t){t.trigger(H),(t.parentNode=this).childNodes.push(t),t.trigger(V)}},{key:"addChildren",value:function addChildren(t){for(var e=0;e<t.length;e++){var n=t[e];this.addChild(n)}}},{key:"removeChild",value:function removeChild(t){t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1)}},{key:"removeChildren",value:function removeChildren(t){for(var e=0;e<t.length;e++){var n=t[e];this.removeChild(n)}}},{key:"destory",value:function destory(){this.removeChildren(this.childNodes),_get(_getPrototypeOf(ICEGroup.prototype),"destory",this).call(this)}}]),ICEGroup),u=(_inherits(ICEControlPanel,Vt),Rn=_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);function ICEControlPanel(t){return _classCallCheck(this,ICEControlPanel),_defineProperty$1(_assertThisInitialized(t=Rn.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))),"__typeName","ICEControlPanel"),t}function ICEGroup(t){return _classCallCheck(this,ICEGroup),_defineProperty$1(_assertThisInitialized(t=Dn.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),Nn.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=Hn.call(this,_objectSpread2({closePath:!0},t))),"path2D",new Path2D),t}function Fc(t){return null==t}_inherits(ICEEllipse,y),Xn=_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){Fc(t.radiusX)?Fc(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,Fc(t.radiusY)?Fc(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,_get(_getPrototypeOf(ICEEllipse.prototype),"setState",this).call(this,t)}}]);var Vn,Fn,qn,Xn,Tt=ICEEllipse,l=(_inherits(ICECircle,Tt),qn=_createSuper(ICECircle),_createClass(ICECircle)),Wn=(_inherits(ICELinkHook,l),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(X,new b({target:this}))}},{key:"mosueMoveHandler",value:function mosueMoveHandler(t){this.evtBus.trigger(J,new b({target:this}))}},{key:"mosueUpHandler",value:function mosueUpHandler(t){this.evtBus.trigger($,new b({target:this}))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(U,new b(t,{position:e})),this.parentNode.trigger(h,new b(t,{position:e})))}}]),ICELinkHook),Jn=(_inherits(LineControlPanel,u),Vn=_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 Wn({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 Wn({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,t=this.targetComponent.state,s=t.points.length,o=t.points[0][0],r=t.points[0][1],a=t.points[s-1][0],l=t.points[s-1][1],s=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)),n=s[0],i=s[1];switch(e){case"start":o+=n,r+=i;break;case"end":a+=n,l+=i}this.targetComponent.setState({startPoint:[o,r],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),$n=/\s/;function LineControlPanel(t){return _classCallCheck(this,LineControlPanel),_defineProperty$1(_assertThisInitialized(t=Vn.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]:{},t=(_classCallCheck(this,ICECircle),_objectSpread2({radius:10},t));return t.radiusX=t.radius,t.radiusY=t.radius,qn.call(this,t)}function ICEEllipse(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEEllipse),_objectSpread2({radiusX:20,radiusY:10,rotation:0,startAngle:0,endAngle:2*Math.PI,counterclockwise:!0},t));return t.width=2*t.radiusX,t.height=2*t.radiusY,Xn.call(this,t)}function Pc(t){return"symbol"==typeof t||ui(t)&&"[object Symbol]"==ci(t)}function Qc(t){return t&&t.slice(0,li(t)+1).replace(hi,"")}function Xc(t){if("number"==typeof t)return t;if(pi(t))return NaN;if(di(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=di(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=Qc(t);var e=yi.test(t);return e||vi.test(t)?gi(t.slice(2),e?2:8):fi.test(t)?NaN:+t}function Zc(t){return t?(t=Ci(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function e2(t){if("string"==typeof t)return t;if(bi(t))return mi(t,e2)+"";if(_i(t))return ki?ki.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function h2(t){return null==t?"":e2(t)}var Un,Gn,Kn,Qn,Zn,Yn,ti,ei,ni,ii,si,oi,ri,ai,li=function trimmedEndIndex$1(t){for(var e=t.length;e--&&$n.test(t.charAt(e)););return e},hi=/^\s+/,ci=t,ui=v,di=na,pi=Pc,fi=/^[-+]0x[0-9a-f]+$/i,yi=/^0b[01]+$/i,vi=/^0o[0-7]+$/i,gi=parseInt,Ci=Xc,mi=function arrayMap$1(t,e){for(var n=-1,i=null==t?0:t.length,s=Array(i);++n<i;)s[n]=e(t[n],n,t);return s},bi=o,_i=Pc,f=s?s.prototype:void 0,ki=f?f.toString:void 0,Pi=function toInteger$1(t){var t=Zc(t),e=t%1;return t==t?e?t-e:t:0},Ei=Xc,xi=i.isFinite,wi=Math.min,k=function createRound$1(t){var s=Math[t];return function(t,e){var n,i;return t=Ei(t),(e=null==e?0:wi(Pi(e),292))&&xi(t)?(n=(h2(t)+"e").split("e"),i=s(n[0]+"e"+(+n[1]+e)),+((n=(h2(i)+"e").split("e"))[0]+"e"+(+n[1]-e))):s(t)}}("round"),Ii=(_inherits(ResizeControl,g),ai=_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=t.quadrant,n=t.movementX,i=t.movementY,s=this.parentNode.state,o=s.left,r=s.top,a=s.width,l=s.height,s=transformMat2d([],[n,i],invert([],s.absoluteLinearMatrix)),n=s[0],i=s[1];switch(e){case 1:o-=n,r+=i,a+=2*n,l-=2*i;break;case 2:o+=n,r+=i,a-=2*n,l-=2*i;break;case 3:o+=n,r-=i,a-=2*n,l+=2*i;break;case 4:o-=n,r-=i,a+=2*n,l+=2*i;break;case 5:r+=i,l-=2*i;break;case 6:r-=i,l+=2*i;break;case 7:o+=n,a-=2*n;break;case 8:o-=n,a+=2*n}s={top:r,left:o,width:Math.abs(a),height:Math.abs(l)};this.parentNode.trigger(U,new b(t,{quadrant:e})),this.parentNode.setState(s),this.parentNode.trigger(h,new b(t,{quadrant:e}))}}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new b,i=0<t?1:-1,s=0<e?1:-1,o=this.parentNode.state,r=o.localOrigin,a=o.width,l=o.height,o=transformMat2d([],[t,e],invert([],o.absoluteLinearMatrix)),o=(t=o[0],e=o[1],this.state),h=o.left,c=o.top,o=o.quadrant,u=this.state.width/2,d=0;"x"===this.state.direction?d=0<(h=0===k(h+=t)?.5*i:h)+u-r[0]?8:7:"y"===this.state.direction?d=0<(c=0===k(c+=e)?.5*s:c)+u-r[1]?6:5:"xy"===this.state.direction&&(s=-l/2/(s=0===k(s=-a/2)?.5*i:s),0===k(a=a/2)&&(a=.5*i),c+=e=2===o||4==o?s*(h+u-r[0]+t)-(c+u-r[1]):-l/2/a*(h+u-r[0]+t)-(c+u-r[1]),d=0<(h+=t)+u-r[0]?0<c+u-r[1]?4:1:0<c+u-r[1]?3:2),o!==d&&this.parentNode.toggleControlQuadrant(this,d),this.setPosition(h,c,new b(n,{left:h,top:c,tx:t,ty:e,quadrant:d}))}}]),ResizeControl),Si=(_createClass(GeoUtil,null,[{key:"calcRotateAngle",value:function calcRotateAngle(t,e,n,i){t-=n,n=e-i,e=Math.hypot(t,n);return((n/e<0?-1:1)*Math.acos(t/e)*180/Math.PI+360)%360}}]),GeoUtil),Mi=(_inherits(RotateControl,l),ri=_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:Si.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger("BEFORE_ROTATE",new b(t)),this.parentNode.setState(t),this.parentNode.trigger(G,new b(t)))}}]),RotateControl),Oi=(_inherits(TransformControlPanel,u),oi=_createSuper(TransformControlPanel),_createClass(TransformControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=t/2,i=e/2,s=this.resizeControlSize/2,o=[{direction:"xy",quadrant:2,position:[-s,-s]},{direction:"y",quadrant:5,position:[n-s,-s]},{direction:"xy",quadrant:1,position:[t-s,-s]},{direction:"x",quadrant:8,position:[t-s,i-s]},{direction:"xy",quadrant:4,position:[t-s,e-s]},{direction:"y",quadrant:6,position:[n-s,e-s]},{direction:"xy",quadrant:3,position:[-s,e-s]},{direction:"x",quadrant:7,position:[-s,i-s]}];this.resizeControlInstanceCache=[];for(var r=0;r<o.length;r++){var a=o[r],a=new Ii({zIndex:10000002,display:!1,left:a.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,s=this.resizeControlSize/2,o=0;o<this.resizeControlInstanceCache.length;o++){var r=this.resizeControlInstanceCache[o],a=[0,0];switch(r.state.quadrant){case 1:a=[t-s,-s];break;case 2:a=[-s,-s];break;case 3:a=[-s,e-s];break;case 4:a=[t-s,e-s];break;case 5:a=[n-s,-s];break;case 6:a=[n-s,e-s];break;case 7:a=[-s,i-s];break;case 8:a=[t-s,i-s]}r.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,t=this.targetComponent.state,s=t.left,o=t.top,r=t.width,a=t.height,t=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)),n=t[0],i=t[1];switch(e){case 1:s-=n,o+=i,r+=2*n,a-=2*i;break;case 2:s+=n,o+=i,r-=2*n,a-=2*i;break;case 3:s+=n,o-=i,r-=2*n,a+=2*i;break;case 4:s-=n,o-=i,r+=2*n,a+=2*i;break;case 5:o+=i,a-=2*i;break;case 6:o-=i,a+=2*i;break;case 7:s+=n,r-=2*n;break;case 8:s-=n,r+=2*n}this.targetComponent.setState({left:s,top:o,width:Math.abs(r),height:Math.abs(a)}),this.targetComponent.trigger(h)}}},{key:"updatePanel",value:function updatePanel(){var t,e,n,i,s;this.targetComponent&&(t=this.targetComponent.getRotateAngle(),e=(s=this.targetComponent.getLocalLeftTop()).left,n=s.top,i=s.width,s=s.height,this.setState({left:e,top:n,width:i,height:s,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 s=0;switch(e){case 1:s=3;break;case 2:s=4;break;case 3:s=1;break;case 4:s=2;break;case 5:s=6;break;case 6:s=5;break;case 7:s=8;break;case 8:s=7}i.setState({quadrant:s})}}t.setState({quadrant:e})}}]),TransformControlPanel),Bi=(_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){t=t.target;if(!t.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),Ai=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dbclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],ji=(_createClass(DOMEventBridge,[{key:"start",value:function start(){for(var i=this,s=null,t=function _loop(t){var t=Ai[t],e=t[1],n=t[0];i.ice.evtBus.on(e,function(t){i._stopped||((s="ICE_MOUSEMOVE"!==e?i.findTargetComponent(t):s)&&(t.target=s).trigger(n,t),i.ice.evtBus.trigger(n,t))})},e=0;e<Ai.length;e++)t(e);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,t=flattenTree([],this.ice.toolNodes),i=flattenTree([],this.ice.childNodes),s=[].concat(_toConsumableArray(t),_toConsumableArray(i));s.sort(function(t,e){return t.state.zIndex-e.state.zIndex});for(var o=0;o<s.length;o++){var r=s[o],a=r.state,l=a.interactive,a=a.display;r.containsPoint(e,n)&&l&&a&&this.selectionCandidates.push(r)}t=this.selectionCandidates.pop();return this.selectionCandidates=[],t}}]),DOMEventBridge),Li=(_inherits(EventBus,n),si=_createSuper(EventBus),_createClass(EventBus)),Ti=(_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),t=Math.hypot(t-this.endPoint.x,e-this.endPoint.y);return n-3<=i+t&&i+t<=n+3}}]),GeoLine),O=(_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),p=(_inherits(ICEDotPath,y),ii=_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],s=1;s<this.state.dots.length;s++){var o=this.state.dots[s];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 s=transformMat2d([],e[i],t);n.push(s)}return n}}]),ICEDotPath),m=(_inherits(ICEImage,c),ni=_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),d=_createClass(function ICEBezier(){_classCallCheck(this,ICEBezier)}),o=(_inherits(ICEPolyLine,p),ei=_createSuper(ICEPolyLine),_createClass(ICEPolyLine,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEPolyLine.prototype),"initEvents",this).call(this),this.once(V,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function afterAddHandler(t){this.evtBus.once(q,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(N,this.followComponent,this),this.followComponent();var i,s={};for(i in this.links){var o=this.links[i];o.component&&o.position&&(s[i]={id:o.component.props.id,position:o.position})}this.setState({links:_objectSpread2({},s),draggable:!1})}},{key:"removeLink",value:function removeLink(t,e,n){var i=this.links[t].component,s=this.links[t].position;i===e&&s===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 s=i.getMinBoundingBox(),o=[0,0];switch(n){case"T":o=s.tc;break;case"R":o=s.rc;break;case"B":o=s.bc;break;case"L":o=s.lc}switch(e){case"start":this.setState({startPoint:_toConsumableArray(o)});break;case"end":this.setState({endPoint:_toConsumableArray(o)})}}}}},{key:"calcLocalOrigin",value:function calcLocalOrigin(){var t=[0,0];return this.state.localOrigin=t}},{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=this.state.points[n],s=i[0]-t,i=i[1]-e;this.state.dots.push([s,i])}return this.calcArrowPoints(),this.state.dots}},{key:"calcArrowPoints",value:function calcArrowPoints(){var t,e,n;"start"!==this.state.arrowPosition&&"both"!==this.state.arrowPosition||(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.arrowPosition&&"both"!==this.state.arrowPosition||(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],t=t[1],n=(t[0]=t[0]-e[0],t[1]=t[1]-e[1],t[0]/Math.hypot.apply(Math,_toConsumableArray(t))),t=t[1]/Math.hypot.apply(Math,_toConsumableArray(t)),i=Math.cos(this.state.arrowAngel),s=Math.sin(this.state.arrowAngel),o=this.state.arrowLength*(n*i-t*s),r=this.state.arrowLength*(t*i+n*s),a=this.state.arrowLength*(n*i+t*s),t=this.state.arrowLength*(t*i-n*s);return[[o+=e[0],r+=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=k(this.state.points[0][0],2),i=k(this.state.points[0][1],2),s=0,o=[k(this.state.points[e-1][0],2)-n,k(this.state.points[e-1][1],2)-i],r=0;r<e;r++){var a=this.state.points[r],a=[a[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])&&s++}return s===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],t=this.state.points[t-1][1]-this.state.points[0][1],n=this.getRotateAngle(),i=this.state.height,s=Math.cos(n*Math.PI/180)*i/2,n=Math.sin(n*Math.PI/180)*i/2;return[[0+(s=k(s,3)),0+(n=k(n,3))],[0-s,0-n],[e+s,t+n],[e-s,t-n]]}},{key:"getMinBoundingBox",value:function getMinBoundingBox(){var t=this.state.localOrigin[0],e=this.state.localOrigin[1],n=this.calc4VertexPoints(),t=new Ln([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]);return t.transform(this.state.composedMatrix)}},{key:"setState",value:function setState(t){if(Fc(t.width)||delete t.width,Fc(t.height)||delete t.height,Fc(t.transform)||delete t.transform,!Fc(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(!Fc(t.top))for(var i=t.top-this.state.points[0][1],s=0;s<this.state.points.length;s++)this.state.points[s][1]+=i;var o;Fc(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]),Fc(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],Si.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 s=n[i],o=s.o[0],r=s.o[1],a=s.d[0],s=s.d[1],l=Math.hypot(a-o,s-r),o=Math.hypot(o-t,r-e),r=Math.hypot(a-t,s-e);if(l-3<=o+r&&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=fn({},{lineType:"solid",lineWidth:1,arrowPosition:"both",arrowLength:15,arrowAngel:30*tt,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),zi=(_inherits(ICELinkSlot,l),ti=_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(X,this.hookMouseDownHandler,this),this.evtBus.on(J,this.hookMouseMoveHandler,this),this.evtBus.on($,this.hookMouseUpHandler,this),this.evtBus.on("mouseup",this.globalMouseUpHandler,this)}},{key:"beforeRemoveHandler",value:function beforeRemoveHandler(t){this.evtBus.off(X,this.hookMouseDownHandler,this),this.evtBus.off(J,this.hookMouseMoveHandler,this),this.evtBus.off($,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(),t=t.getMaxBoundingBox();return!!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(N,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(N,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),s=(_inherits(ICEVisioLink,o),Yn=_createSuper(ICEVisioLink),_createClass(ICEVisioLink,[{key:"calcDots",value:function calcDots(){var t=this.interpolate(),e=this.state,n=e.left,i=e.top,s=t[0][2];this.state.points=[],this.state.dots=[];for(var o=0;o<s.length;o++){var r=s[o];this.state.points.push([r.x,r.y]),this.state.dots.push([r.x-n,r.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],t=this.state.points[t-1][1],s=new O(e,n),o=new O(i,t),r=[],a=null,l=null,h=[],c=new Ln,u=new Ln,e=this.links.start.component;if(e){c=e.getMinBoundingBox(),r[0]=new O(s.x,c.tl[1]-this.state.escapeDistance),r[1]=new O(c.tr[0]+this.state.escapeDistance,s.y),r[2]=new O(s.x,c.br[1]+this.state.escapeDistance),r[3]=new O(c.tl[0]-this.state.escapeDistance,s.y);for(var a=r[0],d=1;d<r.length;d++)this.distance(s,r[d])<this.distance(s,a)&&(a=r[d])}n=this.links.end.component;if(n){u=n.getMinBoundingBox(),r[0]=new O(o.x,u.tl[1]-this.state.escapeDistance),r[1]=new O(u.tr[0]+this.state.escapeDistance,o.y),r[2]=new O(o.x,u.br[1]+this.state.escapeDistance),r[3]=new O(u.tl[0]-this.state.escapeDistance,o.y);for(var l=r[0],p=1;p<r.length;p++)this.distance(o,r[p])<this.distance(o,l)&&(l=r[p])}var i=0,t=[s],e=(a&&(t.push(a),i=1),l&&t.push(l),t.push(o),O.cloneArray(t)),n=(h.push(["s0","s0",e]),O.cloneArray(t)),e=O.cloneArray(n),t=(e.splice(i+1,0,new O(e[i].x,e[i+1].y)),h.push(["s1","s1_1",e]),O.cloneArray(n)),e=(t.splice(i+1,0,new O(t[i+1].x,t[i].y)),h.push(["s1","s1_2",t]),O.cloneArray(n)),t=new O((e[i].x+e[i+1].x)/2,e[i].y),f=new O((e[i].x+e[i+1].x)/2,e[i+1].y),t=(e.splice(i+1,0,t,f),h.push(["s2","s2_1",e]),O.cloneArray(n)),f=new O(t[i].x,(t[i].y+t[i+1].y)/2),e=new O(t[i+1].x,(t[i].y+t[i+1].y)/2),f=(t.splice(i+1,0,f,e),h.push(["s2","s2_2",t]),O.cloneArray(n)),e=[f[i].x+20,f[i+1].x+20],t=(c&&e.push(c.br[0]+20),u&&e.push(u.br[0]+20),this.max(e)),e=new O(t,f[i].y),t=new O(t,f[i+1].y),e=(f.splice(i+1,0,e,t),h.push(["s2","s2_3",f]),O.cloneArray(n)),t=[e[i].y-20,e[i+1].y-20],f=(c&&t.push(c.tl[1]-20),u&&t.push(u.tl[1]-20),this.min(t)),t=new O(e[i].x,f),f=new O(e[i+1].x,f),t=(e.splice(i+1,0,t,f),h.push(["s2","s2_4",e]),O.cloneArray(n)),f=[t[i].x-20,t[i+1].x-20],e=(c&&f.push(c.tl[0]-20),u&&f.push(u.tl[0]-20),this.min(f)),f=new O(e,t[i].y),e=new O(e,t[i+1].y),f=(t.splice(i+1,0,f,e),h.push(["s2","s2_5",t]),O.cloneArray(n)),e=[f[i].y+20,f[i+1].y+20],t=(c&&e.push(c.tl[1]+c.height+20),u&&e.push(u.tl[1]+u.height+20),this.max(e)),n=new O(f[i].x,t),e=new O(f[i+1].x,t);f.splice(i+1,0,n,e),h.push(["s2","s2_6",f]);for(var y=[],v=0;v<h.length;v++){var g=h[v][2];this.orthogonalPath(g)&&y.push(h[v])}if(h=y,!s.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,E=h[k][2].slice();(u||c)&&(E=E.slice(1,E.length-1)),c&&(P=P||this.polylineIntersectsRectangle(E,c)),(P=u?P||this.polylineIntersectsRectangle(E,u):P)||_.push(h[k])}(h=0!=_.length?_:h).length;for(var x=h[0][2].length,w=[],I=0;I<h.length;I++)h[I][2].length==x&&w.push(h[I]);for(var h=w,S=0,M=0;M<h.length;M++)this.scorePath(h[S][2])<this.scorePath(h[M][2])&&(S=M);return[h[S]]}},{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&&(s=t,t=e,e=s),s=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),n=t.startPoint.y-s*t.startPoint.x,i=e.startPoint.x,t.contains(i,s=s*i+n)&&e.contains(i,s);var n=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),i=t.startPoint.y-n*t.startPoint.x,s=(e.endPoint.y-e.startPoint.y)/(e.endPoint.x-e.startPoint.x),o=e.startPoint.y-s*e.startPoint.x;if(n==s)return i==o&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));o=(o-i)/(n-s),s=n*o+i;return t.contains(o,s)&&e.contains(o,s)}},{key:"polylineIntersectsRectangle",value:function polylineIntersectsRectangle(t,e){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=[];i.push(new Ti(new O(e.x1,e.y1),new O(e.x2,e.y1))),i.push(new Ti(new O(e.x2,e.y1),new O(e.x2,e.y2))),i.push(new Ti(new O(e.x2,e.y2),new O(e.x1,e.y2))),i.push(new Ti(new O(e.x1,e.y2),new O(e.x1,e.y1)));for(var s=0;s<t.length-1;s++)for(var o=new Ti(t[s],t[s+1]),r=0;r<i.length;r++)if(this.lineIntersectsLine(o,i[r]))return!0;if(n)for(var a=new Ti(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 Fc(t.startPoint)&&(t.startPoint=[0,0]),Fc(t.endPoint)&&(t.endPoint=[10,10]),t.points=[_toConsumableArray(t.startPoint),_toConsumableArray(t.endPoint)],_objectSpread2({escapeDistance:30},t)}}]),ICEVisioLink),f=(_inherits(ICEIsogon,p),Zn=_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),s=Math.floor(e*Math.cos(i)+e),i=Math.floor(e*Math.sin(i)+e);this.state.dots.push([s,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){Fc(t.radius)?Fc(t.width)?Fc(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),i=(_inherits(ICERose,p),Qn=_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,s=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+=s)>=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){Fc(t.radius)?Fc(t.width)?Fc(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)}}]),ICERose),Ri=(_inherits(ICEStar,p),Kn=_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,s=this.state.outerRadius,o=this.state.innerRadius,r=0;r<this.state.spikes;r++)t=Math.cos(n)*s+s,e=Math.sin(n)*s+s,this.state.dots.push([t,e]),n+=i,t=Math.cos(n)*o+s,e=Math.sin(n)*o+s,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){Fc(t.outerRadius)?Fc(t.width)?Fc(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),Di=(_inherits(ICEText,c),Gn=_createSuper(ICEText),_createClass(ICEText,[{key:"initEvents",value:function initEvents(){this.on(V,this.measureText,this)}},{key:"measureText",value:function measureText(t){try{var e,n=this.root.document.createElement("div"),i={padding:"0",margin:"0",border:"none",position:"absolute",top:"0",left:"0",fontFamily:this.state.style.fontFamily,fontWeight:this.state.style.fontWeight,fontSize:this.state.style.fontSize+"px"};for(e in i)n.style[e]=i[e];n.contenteditable=!1,n.innerHTML=this.state.text,this.root.document.body.appendChild(n);var s={width:n.offsetWidth,height:n.offsetHeight};this.props.width=s.width,this.props.height=s.height,this.state.width=s.width,this.state.height=s.height}finally{this.root.document.body.removeChild(n)}}},{key:"doRender",value:function doRender(){this.state.stroke&&this.ctx.strokeText(this.state.text,0-this.state.localOrigin[0],0-this.state.localOrigin[1]+this.state.height,this.state.width),this.state.fill&&this.ctx.fillText(this.state.text,0-this.state.localOrigin[0],0-this.state.localOrigin[1]+this.state.height,this.state.width),_get(_getPrototypeOf(ICEText.prototype),"doRender",this).call(this)}}]),ICEText),Ni={ICERect:g,ICECircle:l,ICEEllipse:Tt,ICEStar:Ri,ICEIsogon:f,ICEText:Di,ICEImage:m,ICEGroup:Vt,ICEVisioLink:s,ICEPolyLine:o},Hi=(_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;t.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),P={evtBuses:[],start:function start(){if(_&&_.addEventListener)for(var t=function _loop(t){for(var n=P.evtBuses[t],e=function _loop2(t){var e=Ai[t];_.addEventListener(e[0],function(t){n.trigger(e[1],t)})},i=0;i<Ai.length;i++)e(i)},e=0;e<P.evtBuses.length;e++)t(e)},regitserEvtBus:function regitserEvtBus(t){P.evtBuses.includes(t)||P.evtBuses.push(t)},delEvtBus:function delEvtBus(t){P.evtBuses.includes(t)&&P.evtBuses.splice(P.evtBuses.indexOf(t),1)}},E={evtBuses:[],stopped:!1,frameCallback:function frameCallback(){for(var t=0;t<E.evtBuses.length;t++){if(E.stopped)return;E.evtBuses[t].trigger(R)}E.stopped||_.requestFrame(E.frameCallback)},start:function start(){E.stopped=!1,_.requestFrame(E.frameCallback)},stop:function stop(){E.stopped=!0},pause:function pause(){},resume:function resume(){},regitserEvtBus:function regitserEvtBus(t){E.evtBuses.includes(t)||E.evtBuses.push(t)},delEvtBus:function delEvtBus(t){E.evtBuses.includes(t)&&E.evtBuses.splice(E.evtBuses.indexOf(t),1)}},Vi=(_createClass(ICELinkSlotManager,[{key:"start",value:function start(){return this.createLinkSlots(),this.ice.evtBus.on(J,this.hookMouseMoveHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(J,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 s=n[i];if(s&&s.state.linkable&&s.getMaxBoundingBox().isIntersect(e)){for(var o=0;o<this.ice._linkSlots.length;o++)this.ice._linkSlots[o].hostComponent=s;return}}}},{key:"createLinkSlots",value:function createLinkSlots(){var t,e,n,i;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new zi({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 zi({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 zi({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 zi({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),Fi=(_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 s=0;s<i.length;s++)this.decodeRecursively(n,i[s])}}]),Deserializer),qi=(_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),Xi=(_inherits(CanvasRenderer,n),Un=_createSuper(CanvasRenderer),_createClass(CanvasRenderer,[{key:"start",value:function start(){return this.stopped=!1,this.ice.evtBus.on(R,this.frameEvtHandler,this),this}},{key:"stop",value:function stop(){return this.stopped=!0,this.ice.evtBus.off(R,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 s=this.toolsQueue[i];s.root=this.ice.root,s.ctx=this.ice.ctx,s.evtBus=this.ice.evtBus,s.ice=this.ice,s.render()}console.log("Render time ".concat(Date.now()-t," ms.")),this.ice.dirty=!1,this.ice.evtBus.trigger(q)}}]),CanvasRenderer),Wi=(_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=Un.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]:{},t=(_classCallCheck(this,ICEText),fn({text:"",left:0,top:0,width:10,height:10,style:{fontWeight:"bold",fontSize:32,fontFamily:"Arial",lineWidth:1}},t));return t.style=_objectSpread2(_objectSpread2({},t.style),{},{font:"".concat(t.style.fontWeight," ").concat(t.style.fontSize,"px ").concat(t.style.fontFamily),textBaseline:"bottom"}),Gn.call(this,t)}function ICEStar(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEStar),_objectSpread2({outerRadius:50,innerRadius:20,startAngle:90,spikes:5},t));return t.spikes=Math.floor(1<=t.spikes?t.spikes:1),t.width=2*t.outerRadius,t.height=2*t.outerRadius,Kn.call(this,t)}function ICERose(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICERose),_objectSpread2({radius:50,leafNum:2,pointNumber:100},t));return t.leafNum=Math.floor(2<=t.leafNum?t.leafNum:2),t.width=2*t.radius,t.height=2*t.radius,Qn.call(this,t)}function ICEIsogon(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEIsogon),_objectSpread2({radius:10,edges:3,startAngle:90},t));return t.edges=Math.floor(3<=t.edges?t.edges:3),t.width=2*t.radius,t.height=2*t.radius,Zn.call(this,t)}function ICEVisioLink(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEVisioLink),t=ICEVisioLink.arrangeParam(t),Yn.call(this,t)}function ICELinkSlot(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkSlot),ti.call(this,_objectSpread2({linkable:!1,draggable:!1,position:"T"},t))}function ICEPolyLine(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEPolyLine),ICEPolyLine.arrangeParam(t));return _defineProperty$1(_assertThisInitialized(t=ei.call(this,t)),"__typeName","ICEPolyLine"),_defineProperty$1(_assertThisInitialized(t),"links",{start:{},end:{}}),t}function ICEImage(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEImage),ni.call(this,_objectSpread2({width:100,height:100,src:"data:image/png;base64,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"},t))}function ICEDotPath(t){return _classCallCheck(this,ICEDotPath),ii.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),si.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 Oi({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 Jn({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=oi.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),ri.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))}function GeoUtil(){throw _classCallCheck(this,GeoUtil),new Error("GeoUtil is a static util class.")}function ResizeControl(t){return _classCallCheck(this,ResizeControl),ai.call(this,_objectSpread2(_objectSpread2({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}_defineProperty$1(Wi,"CACHE_SIZE",100);_createClass(ICE,[{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 Ni)this.typeMapping[e]=Ni[e];return this.root=_,z(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 Li,E.regitserEvtBus(this.evtBus),E.start(),P.regitserEvtBus(this.evtBus),P.start(),this.eventBridge=new ji(this).start(),this.animationManager=new Q(this).start(),this.ddManager=new Hi(this).start(),this.controlPanelManager=new Bi(this).start(),this.renderer=new Xi(this).start(),this.linkSlotManager=new Vi(this).start(),this.serializer=new qi(this),this.deserializer=new Fi(this),this.imageCache=new Wi(this),this}},{key:"addTool",value:function addTool(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(H,null,{component:t}),t.trigger(H),t.ice=this,t.root=this.root,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(V,null,{component:t}),t.trigger(V))}},{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(H,null,{component:t}),t.trigger(H),t.ice=this,t.root=this.root,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(V,null,{component:t}),t.trigger(V))}},{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(),t=(E.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),E.start(),this.renderer.start(),this.animationManager.start(),this.ddManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(function(){e.eventBridge.stopped=!1},300),Date.now());console.log("fromJSON> ".concat(t-n," ms"))}}]);var Ji=ICE;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())}e.AnimationManager=Q,e.CanvasRenderer=Xi,e.DOMEventBridge=ji,e.EventBus=Li,e.GeoLine=Ti,e.GeoPoint=O,e.GeoUtil=Si,e.ICE=Ji,e.ICEBezier=d,e.ICEBoundingBox=Ln,e.ICECircle=l,e.ICEComponent=c,e.ICEControlPanel=u,e.ICEControlPanelManager=Bi,e.ICEDotPath=p,e.ICEEllipse=Tt,e.ICEEventTarget=n,e.ICEGroup=Vt,e.ICEImage=m,e.ICEIsogon=f,e.ICELinkHook=Wn,e.ICELinkSlot=zi,e.ICEMatrix=Tn,e.ICEPath=y,e.ICEPolyLine=o,e.ICERect=g,e.ICERose=i,e.ICEStar=Ri,e.ICEText=Di,e.ICEVisioLink=s,e.LineControlPanel=Jn,e.ResizeControl=Ii,e.RotateControl=Mi,e.TransformControlPanel=Oi,Object.defineProperty(e,"__esModule",{value:!0})});
|
package/package.json
CHANGED