From 4039910ef70a378ff848f94de8cdbe993a310c58 Mon Sep 17 00:00:00 2001 From: dingyongliang Date: Wed, 13 Nov 2024 10:51:26 +0800 Subject: [PATCH] + [misc] add g6. --- www/js/zui3/graph/g6.min.js | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 www/js/zui3/graph/g6.min.js diff --git a/www/js/zui3/graph/g6.min.js b/www/js/zui3/graph/g6.min.js new file mode 100644 index 0000000000..4a0d20e478 --- /dev/null +++ b/www/js/zui3/graph/g6.min.js @@ -0,0 +1,4 @@ +/*! antvis/G6 4.8.21 - MIT | https://github.com/antvis/G6.git */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.G6=e():t.G6=e()}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=212)}([function(t,e,n){"use strict";n.r(e),n.d(e,"contains",(function(){return i})),n.d(e,"includes",(function(){return i})),n.d(e,"difference",(function(){return a})),n.d(e,"find",(function(){return x})),n.d(e,"findIndex",(function(){return w})),n.d(e,"firstValue",(function(){return _})),n.d(e,"flatten",(function(){return E})),n.d(e,"flattenDeep",(function(){return S})),n.d(e,"getRange",(function(){return k})),n.d(e,"pull",(function(){return I})),n.d(e,"pullAt",(function(){return N})),n.d(e,"reduce",(function(){return P})),n.d(e,"remove",(function(){return D})),n.d(e,"sortBy",(function(){return R})),n.d(e,"union",(function(){return F})),n.d(e,"uniq",(function(){return B})),n.d(e,"valuesOfKey",(function(){return z})),n.d(e,"head",(function(){return G})),n.d(e,"last",(function(){return Y})),n.d(e,"startsWith",(function(){return U})),n.d(e,"endsWith",(function(){return X})),n.d(e,"filter",(function(){return o})),n.d(e,"every",(function(){return W})),n.d(e,"some",(function(){return V})),n.d(e,"group",(function(){return K})),n.d(e,"groupBy",(function(){return q})),n.d(e,"groupToMap",(function(){return Z})),n.d(e,"getWrapBehavior",(function(){return Q})),n.d(e,"wrapBehavior",(function(){return $})),n.d(e,"number2color",(function(){return tt})),n.d(e,"parseRadius",(function(){return et})),n.d(e,"clamp",(function(){return nt})),n.d(e,"fixedBase",(function(){return rt})),n.d(e,"isDecimal",(function(){return ot})),n.d(e,"isEven",(function(){return at})),n.d(e,"isInteger",(function(){return st})),n.d(e,"isNegative",(function(){return ut})),n.d(e,"isNumberEqual",(function(){return ct})),n.d(e,"isOdd",(function(){return lt})),n.d(e,"isPositive",(function(){return ft})),n.d(e,"max",(function(){return M})),n.d(e,"maxBy",(function(){return ht})),n.d(e,"min",(function(){return O})),n.d(e,"minBy",(function(){return dt})),n.d(e,"mod",(function(){return pt})),n.d(e,"toDegree",(function(){return vt})),n.d(e,"toInteger",(function(){return yt})),n.d(e,"toRadian",(function(){return bt})),n.d(e,"forIn",(function(){return xt})),n.d(e,"has",(function(){return wt})),n.d(e,"hasKey",(function(){return _t})),n.d(e,"hasValue",(function(){return St})),n.d(e,"keys",(function(){return g})),n.d(e,"isMatch",(function(){return v})),n.d(e,"values",(function(){return Et})),n.d(e,"lowerCase",(function(){return Ot})),n.d(e,"lowerFirst",(function(){return kt})),n.d(e,"substitute",(function(){return At})),n.d(e,"upperCase",(function(){return Ct})),n.d(e,"upperFirst",(function(){return jt})),n.d(e,"getType",(function(){return Tt})),n.d(e,"isArguments",(function(){return Nt})),n.d(e,"isArray",(function(){return f})),n.d(e,"isArrayLike",(function(){return r})),n.d(e,"isBoolean",(function(){return Pt})),n.d(e,"isDate",(function(){return Dt})),n.d(e,"isError",(function(){return Lt})),n.d(e,"isFunction",(function(){return c})),n.d(e,"isFinite",(function(){return Rt})),n.d(e,"isNil",(function(){return l})),n.d(e,"isNull",(function(){return Bt})),n.d(e,"isNumber",(function(){return it})),n.d(e,"isObject",(function(){return d})),n.d(e,"isObjectLike",(function(){return m})),n.d(e,"isPlainObject",(function(){return b})),n.d(e,"isPrototype",(function(){return zt})),n.d(e,"isRegExp",(function(){return Gt})),n.d(e,"isString",(function(){return L})),n.d(e,"isType",(function(){return u})),n.d(e,"isUndefined",(function(){return Yt})),n.d(e,"isElement",(function(){return Ut})),n.d(e,"requestAnimationFrame",(function(){return Xt})),n.d(e,"clearAnimationFrame",(function(){return Wt})),n.d(e,"augment",(function(){return qt})),n.d(e,"clone",(function(){return Kt})),n.d(e,"debounce",(function(){return Qt})),n.d(e,"memoize",(function(){return $t})),n.d(e,"deepMix",(function(){return te})),n.d(e,"each",(function(){return p})),n.d(e,"extend",(function(){return ee})),n.d(e,"indexOf",(function(){return ne})),n.d(e,"isEmpty",(function(){return ie})),n.d(e,"isEqual",(function(){return oe})),n.d(e,"isEqualWith",(function(){return ae})),n.d(e,"map",(function(){return se})),n.d(e,"mapValues",(function(){return ce})),n.d(e,"mix",(function(){return Ht})),n.d(e,"assign",(function(){return Ht})),n.d(e,"get",(function(){return le})),n.d(e,"set",(function(){return fe})),n.d(e,"pick",(function(){return de})),n.d(e,"omit",(function(){return pe})),n.d(e,"throttle",(function(){return ge})),n.d(e,"toArray",(function(){return ve})),n.d(e,"toString",(function(){return Mt})),n.d(e,"uniqueId",(function(){return me})),n.d(e,"noop",(function(){return be})),n.d(e,"identity",(function(){return xe})),n.d(e,"size",(function(){return we})),n.d(e,"measureTextWidth",(function(){return Se})),n.d(e,"getEllipsisText",(function(){return Me})),n.d(e,"Cache",(function(){return Oe}));var r=function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)},i=function(t,e){return!!r(t)&&t.indexOf(e)>-1},o=function(t,e){if(!r(t))return t;for(var n=[],i=0;i-1;)C.call(t,o,1);return t},T=Array.prototype.splice,N=function(t,e){if(!r(t))return[];for(var n=t?e.length:0,i=n-1;n--;){var o=void 0,a=e[n];n!==i&&a===o||(o=a,T.call(t,a,1))}return t},P=function(t,e,n){if(!f(t)&&!b(t))return t;var r=n;return p(t,(function(t,n){r=e(r,t,n)})),r},D=function(t,e){var n=[];if(!r(t))return n;for(var i=-1,o=[],a=t.length;++ie[i])return 1;if(t[i]n?n:t},rt=function(t,e){var n=e.toString(),r=n.indexOf(".");if(-1===r)return Math.round(t);var i=n.substr(r+1).length;return i>20&&(i=20),parseFloat(t.toFixed(i))},it=function(t){return u(t,"Number")},ot=function(t){return it(t)&&t%1!=0},at=function(t){return it(t)&&t%2==0},st=Number.isInteger?Number.isInteger:function(t){return it(t)&&t%1==0},ut=function(t){return it(t)&&t<0};function ct(t,e,n){return void 0===n&&(n=1e-5),Math.abs(t-e)0},ht=function(t,e){if(f(t)){for(var n,r=-1/0,i=0;ir&&(n=o,r=a)}return n}},dt=function(t,e){if(f(t)){for(var n,r=1/0,i=0;ie?(r&&(clearTimeout(r),r=null),s=c,a=t.apply(i,o),r||(i=o=null)):r||!1===n.trailing||(r=setTimeout(u,l)),a};return c.cancel=function(){clearTimeout(r),s=0,r=i=o=null},c},ve=function(t){return r(t)?Array.prototype.slice.call(t):[]},ye={},me=function(t){return ye[t=t||"g"]?ye[t]+=1:ye[t]=1,t+ye[t]},be=function(){},xe=function(t){return t};function we(t){return l(t)?0:r(t)?t.length:Object.keys(t).length}var _e,Ee=n(1),Se=$t((function(t,e){void 0===e&&(e={});var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return _e||(_e=document.createElement("canvas").getContext("2d")),_e.font=[o,a,i,n+"px",r].join(" "),_e.measureText(L(t)?t:"").width}),(function(t,e){return void 0===e&&(e={}),Object(Ee.__spreadArrays)([t],Et(e)).join("")})),Me=function(t,e,n,r){void 0===r&&(r="...");var i,o,a=Se(r,n),s=L(t)?t:Mt(t),u=e,c=[];if(Se(t,n)<=e)return t;for(;i=s.substr(0,16),!((o=Se(i,n))+a>u&&o>u);)if(c.push(i),u-=o,!(s=s.substr(16)))return c.join("");for(;i=s.substr(0,1),!((o=Se(i,n))+a>u);)if(c.push(i),u-=o,!(s=s.substr(1)))return c.join("");return""+c.join("")+r},Oe=function(){function t(){this.map={}}return t.prototype.has=function(t){return void 0!==this.map[t]},t.prototype.get=function(t,e){var n=this.map[t];return void 0===n?e:n},t.prototype.set=function(t,e){this.map[t]=e},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(t){delete this.map[t]},t.prototype.size=function(){return Object.keys(this.map).length},t}()},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}n.r(e),n.d(e,"__extends",(function(){return o})),n.d(e,"__assign",(function(){return a})),n.d(e,"__rest",(function(){return s})),n.d(e,"__decorate",(function(){return u})),n.d(e,"__param",(function(){return c})),n.d(e,"__esDecorate",(function(){return l})),n.d(e,"__runInitializers",(function(){return f})),n.d(e,"__propKey",(function(){return h})),n.d(e,"__setFunctionName",(function(){return d})),n.d(e,"__metadata",(function(){return p})),n.d(e,"__awaiter",(function(){return g})),n.d(e,"__generator",(function(){return v})),n.d(e,"__createBinding",(function(){return y})),n.d(e,"__exportStar",(function(){return m})),n.d(e,"__values",(function(){return b})),n.d(e,"__read",(function(){return x})),n.d(e,"__spread",(function(){return w})),n.d(e,"__spreadArrays",(function(){return _})),n.d(e,"__spreadArray",(function(){return E})),n.d(e,"__await",(function(){return S})),n.d(e,"__asyncGenerator",(function(){return M})),n.d(e,"__asyncDelegator",(function(){return O})),n.d(e,"__asyncValues",(function(){return k})),n.d(e,"__makeTemplateObject",(function(){return A})),n.d(e,"__importStar",(function(){return j})),n.d(e,"__importDefault",(function(){return I})),n.d(e,"__classPrivateFieldGet",(function(){return T})),n.d(e,"__classPrivateFieldSet",(function(){return N})),n.d(e,"__classPrivateFieldIn",(function(){return P})),n.d(e,"__addDisposableResource",(function(){return D})),n.d(e,"__disposeResources",(function(){return R}));var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var a=function(){return(a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0;u--)(o=t[u])&&(s=(a<3?o(s):a>3?o(e,n,s):o(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s}function c(t,e){return function(n,r){e(n,r,t)}}function l(t,e,n,i,o,a){function s(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var u,c=i.kind,l="getter"===c?"get":"setter"===c?"set":"value",f=!e&&t?i.static?t:t.prototype:null,h=e||(f?Object.getOwnPropertyDescriptor(f,i.name):{}),d=!1,p=n.length-1;p>=0;p--){var g={};for(var v in i)g[v]="access"===v?{}:i[v];for(var v in i.access)g.access[v]=i.access[v];g.addInitializer=function(t){if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(t||null))};var y=(0,n[p])("accessor"===c?{get:h.get,set:h.set}:h[l],g);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!==r(y))throw new TypeError("Object expected");(u=s(y.get))&&(h.get=u),(u=s(y.set))&&(h.set=u),(u=s(y.init))&&o.unshift(u)}else(u=s(y))&&("field"===c?o.unshift(u):h[l]=u)}f&&Object.defineProperty(f,i.name,h),d=!0}function f(t,e,n){for(var r=arguments.length>2,i=0;i0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function w(){for(var t=[],e=0;e1||s(t,e)}))})}function s(t,e){try{(n=i[t](e)).value instanceof S?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(t){l(o[0][3],t)}var n}function u(t){s("next",t)}function c(t){s("throw",t)}function l(t,e){t(e),o.shift(),o.length&&s(o[0][0],o[0][1])}}function O(t){var e,n;return e={},r("next"),r("throw",(function(t){throw t})),r("return"),e[Symbol.iterator]=function(){return this},e;function r(r,i){e[r]=t[r]?function(e){return(n=!n)?{value:S(t[r](e)),done:!1}:i?i(e):e}:i}}function k(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=b(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,i,(e=t[n](e)).done,e.value)}))}}}function A(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var C=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};function j(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&y(e,t,n);return C(e,t),e}function I(t){return t&&t.__esModule?t:{default:t}}function T(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function N(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n}function P(t,e){if(null===e||"object"!==r(e)&&"function"!=typeof e)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof t?e===t:t.has(e)}function D(t,e,n){if(null!=e){if("object"!==r(e)&&"function"!=typeof e)throw new TypeError("Object expected.");var i;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=e[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=e[Symbol.dispose]}if("function"!=typeof i)throw new TypeError("Object not disposable.");t.stack.push({value:e,dispose:i,async:n})}else n&&t.stack.push({async:!0});return e}var L="function"==typeof SuppressedError?SuppressedError:function(t,e,n){var r=new Error(n);return r.name="SuppressedError",r.error=t,r.suppressed=e,r};function R(t){function e(e){t.error=t.hasError?new L(e,t.error,"An error was suppressed during disposal."):e,t.hasError=!0}return function n(){for(;t.stack.length;){var r=t.stack.pop();try{var i=r.dispose&&r.dispose.call(r.value);if(r.async)return Promise.resolve(i).then(n,(function(t){return e(t),n()}))}catch(t){e(t)}}if(t.hasError)throw t.error}()}e.default={__extends:o,__assign:a,__rest:s,__decorate:u,__param:c,__metadata:p,__awaiter:g,__generator:v,__createBinding:y,__exportStar:m,__values:b,__read:x,__spread:w,__spreadArrays:_,__spreadArray:E,__await:S,__asyncGenerator:M,__asyncDelegator:O,__asyncValues:k,__makeTemplateObject:A,__importStar:j,__importDefault:I,__classPrivateFieldGet:T,__classPrivateFieldSet:N,__classPrivateFieldIn:P,__addDisposableResource:D,__disposeResources:R}},function(t,e,n){"use strict";n.r(e),n.d(e,"EPSILON",(function(){return r})),n.d(e,"ARRAY_TYPE",(function(){return i})),n.d(e,"RANDOM",(function(){return o})),n.d(e,"setMatrixArrayType",(function(){return a})),n.d(e,"toRadian",(function(){return u})),n.d(e,"equals",(function(){return c}));var r=1e-6,i="undefined"!=typeof Float32Array?Float32Array:Array,o=Math.random;function a(t){i=t}var s=Math.PI/180;function u(t){return t*s}function c(t,e){return Math.abs(t-e)<=r*Math.max(1,Math.abs(t),Math.abs(e))}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)})},function(t,e,n){var r=n(97);t.exports=function(t,e,n){return(e=r(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";n.d(e,"b",(function(){return i.mat3})),n.d(e,"c",(function(){return i.vec2})),n.d(e,"d",(function(){return i.vec3})),n.d(e,"a",(function(){return r}));var r={};n.r(r),n.d(r,"leftTranslate",(function(){return o})),n.d(r,"leftRotate",(function(){return a})),n.d(r,"leftScale",(function(){return s})),n.d(r,"transform",(function(){return u})),n.d(r,"direction",(function(){return c})),n.d(r,"angleTo",(function(){return l})),n.d(r,"vertical",(function(){return f}));var i=n(8);function o(t,e,n){var r=[0,0,0,0,0,0,0,0,0];return i.mat3.fromTranslation(r,n),i.mat3.multiply(t,r,e)}function a(t,e,n){var r=[0,0,0,0,0,0,0,0,0];return i.mat3.fromRotation(r,n),i.mat3.multiply(t,r,e)}function s(t,e,n){var r=[0,0,0,0,0,0,0,0,0];return i.mat3.fromScaling(r,n),i.mat3.multiply(t,r,e)}function u(t,e){for(var n,r,u,c=t?[].concat(t):[1,0,0,0,1,0,0,0,1],l=0,f=e.length;l=0;return n?o?2*Math.PI-r:r:o?r:2*Math.PI-r}function f(t,e,n){return n?(t[0]=e[1],t[1]=-1*e[0]):(t[0]=-1*e[1],t[1]=e[0]),t}},function(t,e,n){"use strict";n.d(e,"d",(function(){return i})),n.d(e,"b",(function(){return o})),n.d(e,"e",(function(){return a})),n.d(e,"f",(function(){return s})),n.d(e,"l",(function(){return u})),n.d(e,"j",(function(){return c}));var r=n(0);function i(){return window?window.devicePixelRatio:1}function o(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function a(t,e,n,r,i,o){return i>=t&&i<=t+n&&o>=e&&o<=e+r}function s(t,e){return!(e.minX>t.maxX||e.maxXt.maxY||e.maxY0?(n[0]=2*(s*a+f*r+u*o-c*i)/h,n[1]=2*(u*a+f*i+c*r-s*o)/h,n[2]=2*(c*a+f*o+s*i-u*r)/h):(n[0]=2*(s*a+f*r+u*o-c*i),n[1]=2*(u*a+f*i+c*r-s*o),n[2]=2*(c*a+f*o+s*i-u*r)),ce(t,e,n),t}function fe(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function he(t,e){var n=e[0],r=e[1],i=e[2],o=e[4],a=e[5],s=e[6],u=e[8],c=e[9],l=e[10];return t[0]=Math.hypot(n,r,i),t[1]=Math.hypot(o,a,s),t[2]=Math.hypot(u,c,l),t}function de(t,e){var n=new l.ARRAY_TYPE(3);he(n,e);var r=1/n[0],i=1/n[1],o=1/n[2],a=e[0]*r,s=e[1]*i,u=e[2]*o,c=e[4]*r,f=e[5]*i,h=e[6]*o,d=e[8]*r,p=e[9]*i,g=e[10]*o,v=a+f+g,y=0;return v>0?(y=2*Math.sqrt(v+1),t[3]=.25*y,t[0]=(h-p)/y,t[1]=(d-u)/y,t[2]=(s-c)/y):a>f&&a>g?(y=2*Math.sqrt(1+a-f-g),t[3]=(h-p)/y,t[0]=.25*y,t[1]=(s+c)/y,t[2]=(d+u)/y):f>g?(y=2*Math.sqrt(1+f-a-g),t[3]=(d-u)/y,t[0]=(s+c)/y,t[1]=.25*y,t[2]=(h+p)/y):(y=2*Math.sqrt(1+g-a-f),t[3]=(s-c)/y,t[0]=(d+u)/y,t[1]=(h+p)/y,t[2]=.25*y),t}function pe(t,e,n,r){var i=e[0],o=e[1],a=e[2],s=e[3],u=i+i,c=o+o,l=a+a,f=i*u,h=i*c,d=i*l,p=o*c,g=o*l,v=a*l,y=s*u,m=s*c,b=s*l,x=r[0],w=r[1],_=r[2];return t[0]=(1-(p+v))*x,t[1]=(h+b)*x,t[2]=(d-m)*x,t[3]=0,t[4]=(h-b)*w,t[5]=(1-(f+v))*w,t[6]=(g+y)*w,t[7]=0,t[8]=(d+m)*_,t[9]=(g-y)*_,t[10]=(1-(f+p))*_,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function ge(t,e,n,r,i){var o=e[0],a=e[1],s=e[2],u=e[3],c=o+o,l=a+a,f=s+s,h=o*c,d=o*l,p=o*f,g=a*l,v=a*f,y=s*f,m=u*c,b=u*l,x=u*f,w=r[0],_=r[1],E=r[2],S=i[0],M=i[1],O=i[2],k=(1-(g+y))*w,A=(d+x)*w,C=(p-b)*w,j=(d-x)*_,I=(1-(h+y))*_,T=(v+m)*_,N=(p+b)*E,P=(v-m)*E,D=(1-(h+g))*E;return t[0]=k,t[1]=A,t[2]=C,t[3]=0,t[4]=j,t[5]=I,t[6]=T,t[7]=0,t[8]=N,t[9]=P,t[10]=D,t[11]=0,t[12]=n[0]+S-(k*S+j*M+N*O),t[13]=n[1]+M-(A*S+I*M+P*O),t[14]=n[2]+O-(C*S+T*M+D*O),t[15]=1,t}function ve(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n+n,s=r+r,u=i+i,c=n*a,l=r*a,f=r*s,h=i*a,d=i*s,p=i*u,g=o*a,v=o*s,y=o*u;return t[0]=1-f-p,t[1]=l+y,t[2]=h-v,t[3]=0,t[4]=l-y,t[5]=1-c-p,t[6]=d+g,t[7]=0,t[8]=h+v,t[9]=d-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ye(t,e,n,r,i,o,a){var s=1/(n-e),u=1/(i-r),c=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*u,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(i+r)*u,t[10]=(a+o)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*c,t[15]=0,t}function me(t,e,n,r,i){var o,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(r-i),t[10]=(i+r)*o,t[14]=2*i*r*o):(t[10]=-1,t[14]=-2*r),t}var be=me;function xe(t,e,n,r,i){var o,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(r-i),t[10]=i*o,t[14]=i*r*o):(t[10]=-1,t[14]=-r),t}function we(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),u=2/(a+s),c=2/(i+o);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(a-s)*u*.5,t[9]=(i-o)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t}function _e(t,e,n,r,i,o,a){var s=1/(e-n),u=1/(r-i),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*u,t[14]=(a+o)*c,t[15]=1,t}var Ee=_e;function Se(t,e,n,r,i,o,a){var s=1/(e-n),u=1/(r-i),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=c,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*u,t[14]=o*c,t[15]=1,t}function Me(t,e,n,r){var i,o,a,s,u,c,f,h,d,p,g=e[0],v=e[1],y=e[2],m=r[0],b=r[1],x=r[2],w=n[0],_=n[1],E=n[2];return Math.abs(g-w)0&&(l*=d=1/Math.sqrt(d),f*=d,h*=d);var p=u*h-c*f,g=c*l-s*h,v=s*f-u*l;return(d=p*p+g*g+v*v)>0&&(p*=d=1/Math.sqrt(d),g*=d,v*=d),t[0]=p,t[1]=g,t[2]=v,t[3]=0,t[4]=f*v-h*g,t[5]=h*p-l*v,t[6]=l*g-f*p,t[7]=0,t[8]=l,t[9]=f,t[10]=h,t[11]=0,t[12]=i,t[13]=o,t[14]=a,t[15]=1,t}function ke(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function Ae(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function Ce(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t}function je(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}function Ie(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t}function Te(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t}function Ne(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function Pe(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],c=t[7],f=t[8],h=t[9],d=t[10],p=t[11],g=t[12],v=t[13],y=t[14],m=t[15],b=e[0],x=e[1],w=e[2],_=e[3],E=e[4],S=e[5],M=e[6],O=e[7],k=e[8],A=e[9],C=e[10],j=e[11],I=e[12],T=e[13],N=e[14],P=e[15];return Math.abs(n-b)<=l.EPSILON*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=l.EPSILON*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(i-w)<=l.EPSILON*Math.max(1,Math.abs(i),Math.abs(w))&&Math.abs(o-_)<=l.EPSILON*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(a-E)<=l.EPSILON*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(s-S)<=l.EPSILON*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(u-M)<=l.EPSILON*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(c-O)<=l.EPSILON*Math.max(1,Math.abs(c),Math.abs(O))&&Math.abs(f-k)<=l.EPSILON*Math.max(1,Math.abs(f),Math.abs(k))&&Math.abs(h-A)<=l.EPSILON*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(d-C)<=l.EPSILON*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(p-j)<=l.EPSILON*Math.max(1,Math.abs(p),Math.abs(j))&&Math.abs(g-I)<=l.EPSILON*Math.max(1,Math.abs(g),Math.abs(I))&&Math.abs(v-T)<=l.EPSILON*Math.max(1,Math.abs(v),Math.abs(T))&&Math.abs(y-N)<=l.EPSILON*Math.max(1,Math.abs(y),Math.abs(N))&&Math.abs(m-P)<=l.EPSILON*Math.max(1,Math.abs(m),Math.abs(P))}var De=Kt,Le=je,Re=n(24);function Be(){var t=new l.ARRAY_TYPE(4);return l.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Fe(t){var e=new l.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function ze(t,e,n,r){var i=new l.ARRAY_TYPE(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i}function Ge(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Ye(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function Ue(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function Xe(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function We(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function Ve(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function He(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function qe(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function Ze(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t}function Ke(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t}function Qe(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function $e(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function Je(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t}function tn(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.hypot(n,r,i,o)}function en(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return n*n+r*r+i*i+o*o}function nn(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.hypot(e,n,r,i)}function rn(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}function on(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function an(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function sn(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=i*a,t[3]=o*a,t}function un(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function cn(t,e,n,r){var i=n[0]*r[1]-n[1]*r[0],o=n[0]*r[2]-n[2]*r[0],a=n[0]*r[3]-n[3]*r[0],s=n[1]*r[2]-n[2]*r[1],u=n[1]*r[3]-n[3]*r[1],c=n[2]*r[3]-n[3]*r[2],l=e[0],f=e[1],h=e[2],d=e[3];return t[0]=f*c-h*u+d*s,t[1]=-l*c+h*a-d*o,t[2]=l*u-f*a+d*i,t[3]=-l*s+f*o-h*i,t}function ln(t,e,n,r){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=a+r*(n[2]-a),t[3]=s+r*(n[3]-s),t}function fn(t,e){var n,r,i,o,a,s;e=e||1;do{a=(n=2*l.RANDOM()-1)*n+(r=2*l.RANDOM()-1)*r}while(a>=1);do{s=(i=2*l.RANDOM()-1)*i+(o=2*l.RANDOM()-1)*o}while(s>=1);var u=Math.sqrt((1-a)/s);return t[0]=e*n,t[1]=e*r,t[2]=e*i*u,t[3]=e*o*u,t}function hn(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*a,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*a,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*a,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*a,t}function dn(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],s=n[1],u=n[2],c=n[3],l=c*r+s*o-u*i,f=c*i+u*r-a*o,h=c*o+a*i-s*r,d=-a*r-s*i-u*o;return t[0]=l*c+d*-a+f*-u-h*-s,t[1]=f*c+d*-s+h*-a-l*-u,t[2]=h*c+d*-u+l*-s-f*-a,t[3]=e[3],t}function pn(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function gn(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function vn(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function yn(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=e[0],s=e[1],u=e[2],c=e[3];return Math.abs(n-a)<=l.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=l.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-u)<=l.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(o-c)<=l.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))}var mn,bn=Xe,xn=We,wn=Ve,_n=tn,En=en,Sn=nn,Mn=rn,On=(mn=Be(),function(t,e,n,r,i,o){var a,s;for(e||(e=4),n||(n=0),s=r?Math.min(r*e+n,t.length):t.length,a=n;al.EPSILON?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),n}function In(t,e){var n=ar(t,e);return Math.acos(2*n*n-1)}function Tn(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=n[0],u=n[1],c=n[2],l=n[3];return t[0]=r*l+a*s+i*c-o*u,t[1]=i*l+a*u+o*s-r*c,t[2]=o*l+a*c+r*u-i*s,t[3]=a*l-r*s-i*u-o*c,t}function Nn(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(n),u=Math.cos(n);return t[0]=r*u+a*s,t[1]=i*u+o*s,t[2]=o*u-i*s,t[3]=a*u-r*s,t}function Pn(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(n),u=Math.cos(n);return t[0]=r*u-o*s,t[1]=i*u+a*s,t[2]=o*u+r*s,t[3]=a*u-i*s,t}function Dn(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(n),u=Math.cos(n);return t[0]=r*u+i*s,t[1]=i*u-r*s,t[2]=o*u+a*s,t[3]=a*u-o*s,t}function Ln(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t}function Rn(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=Math.sqrt(n*n+r*r+i*i),s=Math.exp(o),u=a>0?s*Math.sin(a)/a:0;return t[0]=n*u,t[1]=r*u,t[2]=i*u,t[3]=s*Math.cos(a),t}function Bn(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=Math.sqrt(n*n+r*r+i*i),s=a>0?Math.atan2(a,o)/a:0;return t[0]=n*s,t[1]=r*s,t[2]=i*s,t[3]=.5*Math.log(n*n+r*r+i*i+o*o),t}function Fn(t,e,n){return Bn(t,e),or(t,t,n),Rn(t,t),t}function zn(t,e,n,r){var i,o,a,s,u,c=e[0],f=e[1],h=e[2],d=e[3],p=n[0],g=n[1],v=n[2],y=n[3];return(o=c*p+f*g+h*v+d*y)<0&&(o=-o,p=-p,g=-g,v=-v,y=-y),1-o>l.EPSILON?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-r)*i)/a,u=Math.sin(r*i)/a):(s=1-r,u=r),t[0]=s*c+u*p,t[1]=s*f+u*g,t[2]=s*h+u*v,t[3]=s*d+u*y,t}function Gn(t){var e=l.RANDOM(),n=l.RANDOM(),r=l.RANDOM(),i=Math.sqrt(1-e),o=Math.sqrt(e);return t[0]=i*Math.sin(2*Math.PI*n),t[1]=i*Math.cos(2*Math.PI*n),t[2]=o*Math.sin(2*Math.PI*r),t[3]=o*Math.cos(2*Math.PI*r),t}function Yn(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o,s=a?1/a:0;return t[0]=-n*s,t[1]=-r*s,t[2]=-i*s,t[3]=o*s,t}function Un(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function Xn(t,e){var n,r=e[0]+e[4]+e[8];if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,a=(i+2)%3;n=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*a+a]+1),t[i]=.5*n,n=.5/n,t[3]=(e[3*o+a]-e[3*a+o])*n,t[o]=(e[3*o+i]+e[3*i+o])*n,t[a]=(e[3*a+i]+e[3*i+a])*n}return t}function Wn(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var o=Math.sin(e),a=Math.cos(e),s=Math.sin(n),u=Math.cos(n),c=Math.sin(r),l=Math.cos(r);return t[0]=o*u*l-a*s*c,t[1]=a*s*l+o*u*c,t[2]=a*u*c-o*s*l,t[3]=a*u*l+o*s*c,t}function Vn(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var Hn,qn,Zn,Kn,Qn,$n,Jn=Fe,tr=ze,er=Ge,nr=Ye,rr=Ue,ir=Tn,or=$e,ar=un,sr=ln,ur=nn,cr=ur,lr=rn,fr=lr,hr=sn,dr=vn,pr=yn,gr=(Hn=Re.create(),qn=Re.fromValues(1,0,0),Zn=Re.fromValues(0,1,0),function(t,e,n){var r=Re.dot(e,n);return r<-.999999?(Re.cross(Hn,qn,e),Re.len(Hn)<1e-6&&Re.cross(Hn,Zn,e),Re.normalize(Hn,Hn),Cn(t,Hn,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(Re.cross(Hn,e,n),t[0]=Hn[0],t[1]=Hn[1],t[2]=Hn[2],t[3]=1+r,hr(t,t))}),vr=(Kn=kn(),Qn=kn(),function(t,e,n,r,i,o){return zn(Kn,e,i,o),zn(Qn,n,r,o),zn(t,Kn,Qn,2*o*(1-o)),t}),yr=($n=ut(),function(t,e,n,r){return $n[0]=n[0],$n[3]=n[1],$n[6]=n[2],$n[1]=r[0],$n[4]=r[1],$n[7]=r[2],$n[2]=-e[0],$n[5]=-e[1],$n[8]=-e[2],hr(t,Xn(t,$n))});function mr(){var t=new l.ARRAY_TYPE(8);return l.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t}function br(t){var e=new l.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function xr(t,e,n,r,i,o,a,s){var u=new l.ARRAY_TYPE(8);return u[0]=t,u[1]=e,u[2]=n,u[3]=r,u[4]=i,u[5]=o,u[6]=a,u[7]=s,u}function wr(t,e,n,r,i,o,a){var s=new l.ARRAY_TYPE(8);s[0]=t,s[1]=e,s[2]=n,s[3]=r;var u=.5*i,c=.5*o,f=.5*a;return s[4]=u*r+c*n-f*e,s[5]=c*r+f*t-u*n,s[6]=f*r+u*e-c*t,s[7]=-u*t-c*e-f*n,s}function _r(t,e,n){var r=.5*n[0],i=.5*n[1],o=.5*n[2],a=e[0],s=e[1],u=e[2],c=e[3];return t[0]=a,t[1]=s,t[2]=u,t[3]=c,t[4]=r*c+i*u-o*s,t[5]=i*c+o*a-r*u,t[6]=o*c+r*s-i*a,t[7]=-r*a-i*s-o*u,t}function Er(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t}function Sr(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function Mr(t,e){var n=kn();de(n,e);var r=new l.ARRAY_TYPE(3);return fe(r,e),_r(t,n,r),t}function Or(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function kr(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function Ar(t,e,n,r,i,o,a,s,u){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=u,t}var Cr=er;function jr(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t}var Ir=er;function Tr(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t}function Nr(t,e){var n=e[4],r=e[5],i=e[6],o=e[7],a=-e[0],s=-e[1],u=-e[2],c=e[3];return t[0]=2*(n*c+o*a+r*u-i*s),t[1]=2*(r*c+o*s+i*a-n*u),t[2]=2*(i*c+o*u+n*s-r*a),t}function Pr(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=.5*n[0],u=.5*n[1],c=.5*n[2],l=e[4],f=e[5],h=e[6],d=e[7];return t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=a*s+i*c-o*u+l,t[5]=a*u+o*s-r*c+f,t[6]=a*c+r*u-i*s+h,t[7]=-r*s-i*u-o*c+d,t}function Dr(t,e,n){var r=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],f=s*a+l*r+u*o-c*i,h=u*a+l*i+c*r-s*o,d=c*a+l*o+s*i-u*r,p=l*a-s*r-u*i-c*o;return Nn(t,e,n),r=t[0],i=t[1],o=t[2],a=t[3],t[4]=f*a+p*r+h*o-d*i,t[5]=h*a+p*i+d*r-f*o,t[6]=d*a+p*o+f*i-h*r,t[7]=p*a-f*r-h*i-d*o,t}function Lr(t,e,n){var r=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],f=s*a+l*r+u*o-c*i,h=u*a+l*i+c*r-s*o,d=c*a+l*o+s*i-u*r,p=l*a-s*r-u*i-c*o;return Pn(t,e,n),r=t[0],i=t[1],o=t[2],a=t[3],t[4]=f*a+p*r+h*o-d*i,t[5]=h*a+p*i+d*r-f*o,t[6]=d*a+p*o+f*i-h*r,t[7]=p*a-f*r-h*i-d*o,t}function Rr(t,e,n){var r=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],f=s*a+l*r+u*o-c*i,h=u*a+l*i+c*r-s*o,d=c*a+l*o+s*i-u*r,p=l*a-s*r-u*i-c*o;return Dn(t,e,n),r=t[0],i=t[1],o=t[2],a=t[3],t[4]=f*a+p*r+h*o-d*i,t[5]=h*a+p*i+d*r-f*o,t[6]=d*a+p*o+f*i-h*r,t[7]=p*a-f*r-h*i-d*o,t}function Br(t,e,n){var r=n[0],i=n[1],o=n[2],a=n[3],s=e[0],u=e[1],c=e[2],l=e[3];return t[0]=s*a+l*r+u*o-c*i,t[1]=u*a+l*i+c*r-s*o,t[2]=c*a+l*o+s*i-u*r,t[3]=l*a-s*r-u*i-c*o,s=e[4],u=e[5],c=e[6],l=e[7],t[4]=s*a+l*r+u*o-c*i,t[5]=u*a+l*i+c*r-s*o,t[6]=c*a+l*o+s*i-u*r,t[7]=l*a-s*r-u*i-c*o,t}function Fr(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=n[0],u=n[1],c=n[2],l=n[3];return t[0]=r*l+a*s+i*c-o*u,t[1]=i*l+a*u+o*s-r*c,t[2]=o*l+a*c+r*u-i*s,t[3]=a*l-r*s-i*u-o*c,s=n[4],u=n[5],c=n[6],l=n[7],t[4]=r*l+a*s+i*c-o*u,t[5]=i*l+a*u+o*s-r*c,t[6]=o*l+a*c+r*u-i*s,t[7]=a*l-r*s-i*u-o*c,t}function zr(t,e,n,r){if(Math.abs(r)0){n=Math.sqrt(n);var r=e[0]/n,i=e[1]/n,o=e[2]/n,a=e[3]/n,s=e[4],u=e[5],c=e[6],l=e[7],f=r*s+i*u+o*c+a*l;t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=(s-r*f)/n,t[5]=(u-i*f)/n,t[6]=(c-o*f)/n,t[7]=(l-a*f)/n}return t}function ti(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"}function ei(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]}function ni(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],c=t[7],f=e[0],h=e[1],d=e[2],p=e[3],g=e[4],v=e[5],y=e[6],m=e[7];return Math.abs(n-f)<=l.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(r-h)<=l.EPSILON*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(i-d)<=l.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(o-p)<=l.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(a-g)<=l.EPSILON*Math.max(1,Math.abs(a),Math.abs(g))&&Math.abs(s-v)<=l.EPSILON*Math.max(1,Math.abs(s),Math.abs(v))&&Math.abs(u-y)<=l.EPSILON*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(c-m)<=l.EPSILON*Math.max(1,Math.abs(c),Math.abs(m))}var ri=n(39)},function(t,e,n){"use strict";n.d(e,"j",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"g",(function(){return a})),n.d(e,"b",(function(){return s}));var r=n(0);function i(t,e){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}n.d(e,"e",(function(){return r.isNil})),n.d(e,"d",(function(){return r.isFunction})),n.d(e,"h",(function(){return r.isString})),n.d(e,"f",(function(){return r.isObject})),n.d(e,"i",(function(){return r.mix})),n.d(e,"a",(function(){return r.each})),n.d(e,"k",(function(){return r.upperFirst}));var o="undefined"!=typeof window&&void 0!==window.document;function a(t,e){if(t.isCanvas())return!0;for(var n=e.getParent(),r=!1;n;){if(n===t){r=!0;break}n=n.getParent()}return r}function s(t){return t.cfg.visible&&t.cfg.capture}},function(t,e,n){"use strict";n.d(e,"e",(function(){return y})),n.d(e,"b",(function(){return E})),n.d(e,"a",(function(){return j})),n.d(e,"c",(function(){return f})),n.d(e,"d",(function(){return L})),n.d(e,"f",(function(){return r}));var r={};n.r(r),n.d(r,"distance",(function(){return o})),n.d(r,"isNumberEqual",(function(){return a})),n.d(r,"getBBoxByArray",(function(){return s})),n.d(r,"getBBoxRange",(function(){return u})),n.d(r,"piMod",(function(){return c}));var i=n(0);function o(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function a(t,e){return Math.abs(t-e)<.001}function s(t,e){var n=Object(i.min)(t),r=Object(i.min)(e);return{x:n,y:r,width:Object(i.max)(t)-n,height:Object(i.max)(e)-r}}function u(t,e,n,r){return{minX:Object(i.min)([t,n]),maxX:Object(i.max)([t,n]),minY:Object(i.min)([e,r]),maxY:Object(i.max)([e,r])}}function c(t){return(t+2*Math.PI)%(2*Math.PI)}var l=n(39),f={box:function(t,e,n,r){return s([t,n],[e,r])},length:function(t,e,n,r){return o(t,e,n,r)},pointAt:function(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}},pointDistance:function(t,e,n,r,i,a){var s=(n-t)*(i-t)+(r-e)*(a-e);return s<0?o(t,e,i,a):s>(n-t)*(n-t)+(r-e)*(r-e)?o(n,r,i,a):this.pointToLine(t,e,n,r,i,a)},pointToLine:function(t,e,n,r,i,o){var a=[n-t,r-e];if(l.exactEquals(a,[0,0]))return Math.sqrt((i-t)*(i-t)+(o-e)*(o-e));var s=[-a[1],a[0]];l.normalize(s,s);var u=[i-t,o-e];return Math.abs(l.dot(u,s))},tangentAngle:function(t,e,n,r){return Math.atan2(r-e,n-t)}};function h(t,e,n,r,i,a){var s,u=1/0,c=[n,r],l=20;a&&a>200&&(l=a/10);for(var f=1/l,h=f/10,d=0;d<=l;d++){var p=d*f,g=[i.apply(null,t.concat([p])),i.apply(null,e.concat([p]))];(b=o(c[0],c[1],g[0],g[1]))=0&&b=0?[i]:[]}function g(t,e,n,r){return 2*(1-r)*(e-t)+2*r*(n-e)}function v(t,e,n,r,i,o,a){var s=d(t,n,i,a),u=d(e,r,o,a),c=f.pointAt(t,e,n,r,a),l=f.pointAt(n,r,i,o,a);return[[t,e,c.x,c.y,s,u],[s,u,l.x,l.y,i,o]]}var y={box:function(t,e,n,r,i,o){var a=p(t,n,i)[0],u=p(e,r,o)[0],c=[t,i],l=[e,o];return void 0!==a&&c.push(d(t,n,i,a)),void 0!==u&&l.push(d(e,r,o,u)),s(c,l)},length:function(t,e,n,r,i,a){return function t(e,n,r,i,a,s,u){if(0===u)return(o(e,n,r,i)+o(r,i,a,s)+o(e,n,a,s))/2;var c=v(e,n,r,i,a,s,.5),l=c[0],f=c[1];return l.push(u-1),f.push(u-1),t.apply(null,l)+t.apply(null,f)}(t,e,n,r,i,a,3)},nearestPoint:function(t,e,n,r,i,o,a,s){return h([t,n,i],[e,r,o],a,s,d)},pointDistance:function(t,e,n,r,i,a,s,u){var c=this.nearestPoint(t,e,n,r,i,a,s,u);return o(c.x,c.y,s,u)},interpolationAt:d,pointAt:function(t,e,n,r,i,o,a){return{x:d(t,n,i,a),y:d(e,r,o,a)}},divide:function(t,e,n,r,i,o,a){return v(t,e,n,r,i,o,a)},tangentAngle:function(t,e,n,r,i,o,a){var s=g(t,n,i,a),u=g(e,r,o,a);return c(Math.atan2(u,s))}};function m(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function b(t,e,n,r,i){var o=1-i;return 3*(o*o*(e-t)+2*o*i*(n-e)+i*i*(r-n))}function x(t,e,n,r){var i,o,s,u=-3*t+9*e-9*n+3*r,c=6*t-12*e+6*n,l=3*e-3*t,f=[];if(a(u,0))a(c,0)||(i=-l/c)>=0&&i<=1&&f.push(i);else{var h=c*c-4*u*l;a(h,0)?f.push(-c/(2*u)):h>0&&(o=(-c-(s=Math.sqrt(h)))/(2*u),(i=(-c+s)/(2*u))>=0&&i<=1&&f.push(i),o>=0&&o<=1&&f.push(o))}return f}function w(t,e,n,r,i,o,a,s,u){var c=m(t,n,i,a,u),l=m(e,r,o,s,u),h=f.pointAt(t,e,n,r,u),d=f.pointAt(n,r,i,o,u),p=f.pointAt(i,o,a,s,u),g=f.pointAt(h.x,h.y,d.x,d.y,u),v=f.pointAt(d.x,d.y,p.x,p.y,u);return[[t,e,h.x,h.y,g.x,g.y,c,l],[c,l,v.x,v.y,p.x,p.y,a,s]]}function _(t,e,n,r,i,a,s,u,c){if(0===c)return function(t,e){for(var n=0,r=t.length,i=0;i0?n:-1*n}var M=function(t,e,n,r,i,o){var a=n,s=r;if(0===a||0===s)return{x:t,y:e};for(var u,c,l=i-t,f=o-e,h=Math.abs(l),d=Math.abs(f),p=a*a,g=s*s,v=Math.PI/4,y=0;y<4;y++){u=a*Math.cos(v),c=s*Math.sin(v);var m=(p-g)*Math.pow(Math.cos(v),3)/a,b=(g-p)*Math.pow(Math.sin(v),3)/s,x=u-m,w=c-b,_=h-m,E=d-b,M=Math.hypot(w,x),O=Math.hypot(E,_);v+=M*Math.asin((x*E-w*_)/(M*O))/Math.sqrt(p+g-u*u-c*c),v=Math.min(Math.PI/2,Math.max(0,v))}return{x:t+S(u,l),y:e+S(c,f)}};function O(t,e,n,r,i,o){return n*Math.cos(i)*Math.cos(o)-r*Math.sin(i)*Math.sin(o)+t}function k(t,e,n,r,i,o){return n*Math.sin(i)*Math.cos(o)+r*Math.cos(i)*Math.sin(o)+e}function A(t,e,n){return{x:t*Math.cos(n),y:e*Math.sin(n)}}function C(t,e,n){var r=Math.cos(n),i=Math.sin(n);return[t*r-e*i,t*i+e*r]}var j={box:function(t,e,n,r,i,o,a){for(var s=function(t,e,n){return Math.atan(-e/t*Math.tan(n))}(n,r,i),u=1/0,c=-1/0,l=[o,a],f=2*-Math.PI;f<=2*Math.PI;f+=Math.PI){var h=s+f;oc&&(c=d)}var p=function(t,e,n){return Math.atan(e/(t*Math.tan(n)))}(n,r,i),g=1/0,v=-1/0,y=[o,a];for(f=2*-Math.PI;f<=2*Math.PI;f+=Math.PI){var m=p+f;ov&&(v=b)}return{x:u,y:g,width:c-u,height:v-g}},length:function(t,e,n,r,i,o,a){},nearestPoint:function(t,e,n,r,i,o,a,s,u){var c=C(s-t,u-e,-i),l=c[0],f=c[1],h=M(0,0,n,r,l,f),d=function(t,e,n,r){return(Math.atan2(r*t,n*e)+2*Math.PI)%(2*Math.PI)}(n,r,h.x,h.y);da&&(h=A(n,r,a));var p=C(h.x,h.y,i);return{x:p[0]+t,y:p[1]+e}},pointDistance:function(t,e,n,r,i,a,s,u,c){var l=this.nearestPoint(t,e,n,r,u,c);return o(l.x,l.y,u,c)},pointAt:function(t,e,n,r,i,o,a,s){var u=(a-o)*s+o;return{x:O(t,0,n,r,i,u),y:k(0,e,n,r,i,u)}},tangentAngle:function(t,e,n,r,i,o,a,s){var u=(a-o)*s+o,l=function(t,e,n,r,i,o,a,s){return-1*n*Math.cos(i)*Math.sin(s)-r*Math.sin(i)*Math.cos(s)}(0,0,n,r,i,0,0,u),f=function(t,e,n,r,i,o,a,s){return-1*n*Math.sin(i)*Math.sin(s)+r*Math.cos(i)*Math.cos(s)}(0,0,n,r,i,0,0,u);return c(Math.atan2(f,l))}};function I(t){for(var e=0,n=[],r=0;r1||e<0||t.length<2)return null;var n=I(t),r=n.segments,i=n.totalLength;if(0===i)return{x:t[0][0],y:t[0][1]};for(var o=0,a=null,s=0;s=o&&e<=o+h){var d=(e-o)/h;a=f.pointAt(c[0],c[1],l[0],l[1],d);break}o+=h}return a}function P(t,e){if(e>1||e<0||t.length<2)return 0;for(var n=I(t),r=n.segments,i=n.totalLength,o=0,a=0,s=0;s=o&&e<=o+f){a=Math.atan2(l[1]-c[1],l[0]-c[0]);break}o+=f}return a}function D(t,e,n){for(var r=1/0,i=0;ie)n.insertBefore(t,i);else if(o_?w:_,A=w>_?1:w/_,C=w>_?_/w:1;e.translate(b,x),e.rotate(M),e.scale(A,C),e.arc(0,0,k,E,S,1-O),e.scale(1/A,1/C),e.rotate(-M),e.translate(-b,-x)}break;case"Z":e.closePath()}if("Z"===p)c=l;else{var j=d.length;c=[d[j-2],d[j-1]]}}}}function v(t,e){var n=t.get("canvas");n&&("remove"===e&&(t._cacheCanvasBBox=t.get("cacheCanvasBBox")),t.get("hasChanged")||(t.set("hasChanged",!0),t.cfg.parent&&t.cfg.parent.get("hasChanged")||(n.refreshElement(t,e,n),n.get("autoDraw")&&n.draw())))}function y(t){if(!t.length)return null;var e=[],n=[],i=[],o=[];return Object(r.each)(t,(function(t){var r=function(t){var e;if(t.destroyed)e=t._cacheCanvasBBox;else{var n=t.get("cacheCanvasBBox"),r=n&&!(!n.width||!n.height),i=t.getCanvasBBox(),o=i&&!(!i.width||!i.height);r&&o?e=Object(a.l)(n,i):r?e=n:o&&(e=i)}return e}(t);r&&(e.push(r.minX),n.push(r.minY),i.push(r.maxX),o.push(r.maxY))})),{minX:Object(r.min)(e),minY:Object(r.min)(n),maxX:Object(r.max)(i),maxY:Object(r.max)(o)}}function m(t,e){return t&&e&&Object(a.f)(t,e)?{minX:Math.max(t.minX,e.minX),minY:Math.max(t.minY,e.minY),maxX:Math.min(t.maxX,e.maxX),maxY:Math.min(t.maxY,e.maxY)}:null}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=n(194)();t.exports=i;try{regeneratorRuntime=i}catch(t){"object"===("undefined"==typeof globalThis?"undefined":r(globalThis))?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Base=void 0;var r=function(){function t(){this.nodes=[],this.edges=[],this.combos=[],this.comboEdges=[],this.hiddenNodes=[],this.hiddenEdges=[],this.hiddenCombos=[],this.vedges=[],this.positions=[],this.destroyed=!1,this.onLayoutEnd=function(){}}return t.prototype.layout=function(t){return this.init(t),this.execute(!0)},t.prototype.init=function(t){this.nodes=t.nodes||[],this.edges=t.edges||[],this.combos=t.combos||[],this.comboEdges=t.comboEdges||[],this.hiddenNodes=t.hiddenNodes||[],this.hiddenEdges=t.hiddenEdges||[],this.hiddenCombos=t.hiddenCombos||[],this.vedges=t.vedges||[]},t.prototype.execute=function(t){},t.prototype.executeWithWorker=function(){},t.prototype.getDefaultCfg=function(){return{}},t.prototype.updateCfg=function(t){t&&Object.assign(this,t)},t.prototype.getType=function(){return"base"},t.prototype.destroy=function(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0},t}();e.Base=r},function(t,e,n){"use strict";n.d(e,"c",(function(){return h})),n.d(e,"b",(function(){return d})),n.d(e,"a",(function(){return p}));var r=n(1),i=n(29);function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var a=Math.sin,s=Math.cos,u=Math.atan2,c=Math.PI;function l(t,e,n,r,o,l,f){var h=e.stroke,d=e.lineWidth,p=u(r-l,n-o),g=new i.Path({type:"path",canvas:t.get("canvas"),isArrowShape:!0,attrs:{path:"M"+10*s(c/6)+","+10*a(c/6)+" L0,0 L"+10*s(c/6)+",-"+10*a(c/6),stroke:h,lineWidth:d}});g.translate(o,l),g.rotateAtPoint(o,l,p),t.set(f?"startArrowShape":"endArrowShape",g)}function f(t,e,n,o,c,l,f){var h=e.startArrow,d=e.endArrow,p=e.stroke,g=e.lineWidth,v=f?h:d,y=v.d,m=v.fill,b=v.stroke,x=v.lineWidth,w=Object(r.__rest)(v,["d","fill","stroke","lineWidth"]),_=u(o-l,n-c);y&&(c-=s(_)*y,l-=a(_)*y);var E=new i.Path({type:"path",canvas:t.get("canvas"),isArrowShape:!0,attrs:Object(r.__assign)(Object(r.__assign)({},w),{stroke:b||p,lineWidth:x||g,fill:m})});E.translate(c,l),E.rotateAtPoint(c,l,_),t.set(f?"startArrowShape":"endArrowShape",E)}function h(t,e,n,r,i){var o=u(r-e,n-t);return{dx:s(o)*i,dy:a(o)*i}}function d(t,e,n,r,i,a){"object"===o(e.startArrow)?f(t,e,n,r,i,a,!0):e.startArrow?l(t,e,n,r,i,a,!0):t.set("startArrowShape",null)}function p(t,e,n,r,i,a){"object"===o(e.endArrow)?f(t,e,n,r,i,a,!1):e.endArrow?l(t,e,n,r,i,a,!1):t.set("startArrowShape",null)}},function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){return a}));var r=n(12);function i(t,e){var n=t.cfg.el,r=t.attr(),i={dx:r.shadowOffsetX,dy:r.shadowOffsetY,blur:r.shadowBlur,color:r.shadowColor};if(i.dx||i.dy||i.blur||i.color){var o=e.find("filter",i);o||(o=e.addShadow(i)),n.setAttribute("filter","url(#"+o+")")}else n.removeAttribute("filter")}function o(t){var e=t.attr().matrix;if(e){for(var n=t.cfg.el,r=[],i=0;i<9;i+=3)r.push(e[i]+","+e[i+1]);-1===(r=r.join(",")).indexOf("NaN")?n.setAttribute("transform","matrix("+r+")"):console.warn("invalid matrix:",e)}}function a(t,e){var n=t.getClip(),i=t.get("el");if(n){if(n&&!i.hasAttribute("clip-path")){Object(r.a)(n),n.createPath(e);var o=e.addClip(n);i.setAttribute("clip-path","url(#"+o+")")}}else i.removeAttribute("clip-path")}},function(t,e,n){"use strict";n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return h})),n.d(e,"c",(function(){return g})),n.d(e,"d",(function(){return _}));var r=n(0),i=/[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/gi,o=/[^\s\,]+/gi;var a=function(t){var e=t||[];return Object(r.isArray)(e)?e:Object(r.isString)(e)?(e=e.match(i),Object(r.each)(e,(function(t,n){if((t=t.match(o))[0].length>1){var i=t[0].charAt(0);t.splice(1,0,t[0].substr(1)),t[0]=i}Object(r.each)(t,(function(e,n){isNaN(e)||(t[n]=+e)})),e[n]=t})),e):void 0},s=n(8);var u=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=[[0,0],[1,1]]);for(var r=!!e,i=[],o=0,a=t.length;o2&&(n.push([r].concat(o.splice(0,2))),a="l",r="m"===r?"l":"L"),"o"===a&&1===o.length&&n.push([r,o[0]]),"r"===a)n.push([r].concat(o));else for(;o.length>=e[a]&&(n.push([r].concat(o.splice(0,e[a]))),e[a]););return""})),n}var d=/[a-z]/;function p(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}function g(t){var e=h(t);if(!e||!e.length)return[["M",0,0]];for(var n=!1,r=0;r=0){n=!0;break}}if(!n)return e;var o=[],a=0,s=0,u=0,c=0,l=0,f=e[0];"M"!==f[0]&&"m"!==f[0]||(u=a=+f[1],c=s=+f[2],l++,o[0]=["M",a,s]);r=l;for(var g=e.length;r1&&(n*=Math.sqrt(p),i*=Math.sqrt(p));var g=n*n*(d*d)+i*i*(h*h),v=g?Math.sqrt((n*n*(i*i)-g)/g):1;a===s&&(v*=-1),isNaN(v)&&(v=0);var x=i?v*n*d/i:0,w=n?v*-i*h/n:0,_=(u+l)/2+Math.cos(o)*x-Math.sin(o)*w,E=(c+f)/2+Math.sin(o)*x+Math.cos(o)*w,S=[(h-x)/n,(d-w)/i],M=[(-1*h-x)/n,(-1*d-w)/i],O=m([1,0],S),k=m(S,M);return y(S,M)<=-1&&(k=Math.PI),y(S,M)>=1&&(k=0),0===s&&k>0&&(k-=2*Math.PI),1===s&&k<0&&(k+=2*Math.PI),{cx:_,cy:E,rx:b(t,[l,f])?0:n,ry:b(t,[l,f])?0:i,startAngle:O,endAngle:O+k,xRotation:o,arcFlag:a,sweepFlag:s}}function w(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}function _(t){for(var e=[],n=null,r=null,i=null,o=0,s=(t=a(t)).length,u=0;u0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function k(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function A(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],s=n[1],u=n[2];return t[0]=i*u-o*s,t[1]=o*a-r*u,t[2]=r*s-i*a,t}function C(t,e,n,r){var i=e[0],o=e[1],a=e[2];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=a+r*(n[2]-a),t}function j(t,e,n,r,i,o){var a=o*o,s=a*(2*o-3)+1,u=a*(o-2)+o,c=a*(o-1),l=a*(3-2*o);return t[0]=e[0]*s+n[0]*u+r[0]*c+i[0]*l,t[1]=e[1]*s+n[1]*u+r[1]*c+i[1]*l,t[2]=e[2]*s+n[2]*u+r[2]*c+i[2]*l,t}function I(t,e,n,r,i,o){var a=1-o,s=a*a,u=o*o,c=s*a,l=3*o*s,f=3*u*a,h=u*o;return t[0]=e[0]*c+n[0]*l+r[0]*f+i[0]*h,t[1]=e[1]*c+n[1]*l+r[1]*f+i[1]*h,t[2]=e[2]*c+n[2]*l+r[2]*f+i[2]*h,t}function T(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI,i=2*r.RANDOM()-1,o=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*o,t[1]=Math.sin(n)*o,t[2]=i*e,t}function N(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[3]*r+n[7]*i+n[11]*o+n[15];return a=a||1,t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/a,t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/a,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/a,t}function P(t,e,n){var r=e[0],i=e[1],o=e[2];return t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8],t}function D(t,e,n){var r=n[0],i=n[1],o=n[2],a=n[3],s=e[0],u=e[1],c=e[2],l=i*c-o*u,f=o*s-r*c,h=r*u-i*s,d=i*h-o*f,p=o*l-r*h,g=r*f-i*l,v=2*a;return l*=v,f*=v,h*=v,d*=2,p*=2,g*=2,t[0]=s+l+d,t[1]=u+f+p,t[2]=c+h+g,t}function L(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0],o[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),o[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t}function R(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),o[1]=i[1],o[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t}function B(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),o[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),o[2]=i[2],t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t}function F(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],a=e[1],s=e[2],u=Math.sqrt(n*n+r*r+i*i)*Math.sqrt(o*o+a*a+s*s),c=u&&k(t,e)/u;return Math.acos(Math.min(Math.max(c,-1),1))}function z(t){return t[0]=0,t[1]=0,t[2]=0,t}function G(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function Y(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function U(t,e){var n=t[0],i=t[1],o=t[2],a=e[0],s=e[1],u=e[2];return Math.abs(n-a)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-s)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(o-u)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))}var X,W=f,V=h,H=d,q=w,Z=_,K=a,Q=E,$=(X=i(),function(t,e,n,r,i,o){var a,s;for(e||(e=3),n||(n=0),s=r?Math.min(r*e+n,t.length):t.length,a=n;aMath.abs(a)*c?(s<0&&(c=-c),n=c*a/s,r=c):(a<0&&(u=-u),n=u,r=u*s/a),{x:i+n,y:o+r}):{x:0,y:0}};e.buildLayerMatrix=function(t){for(var n=[],r=(0,e.maxRank)(t)+1,i=0;ie)&&(e=i)})),e||(e=0),e};e.partition=function(t,e){var n={lhs:[],rhs:[]};return null==t||t.forEach((function(t){e(t)?n.lhs.push(t):n.rhs.push(t)})),n};e.time=function(t,e){var n=Date.now();try{return e()}finally{console.log("".concat(t," time: ").concat(Date.now()-n,"ms"))}};e.notime=function(t,e){return e()};e.minBy=function(t,e){return t.reduce((function(t,n){return e(t)>e(n)?n:t}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueId=e.getOutEdgesNodeId=e.getNeighbors=e.getEdgesByNodeId=void 0;e.getNeighbors=function(t,e,n){void 0===e&&(e=[]);var r=e.filter((function(e){return e.source===t||e.target===t}));if("target"===n){return r.filter((function(e){return e.source===t})).map((function(t){return t.target}))}if("source"===n){return r.filter((function(e){return e.target===t})).map((function(t){return t.source}))}return r.map((function(e){return e.source===t?e.target:e.source}))};e.getOutEdgesNodeId=function(t,e){return e.filter((function(e){return e.source===t}))};e.getEdgesByNodeId=function(t,e){return e.filter((function(e){return e.source===t||e.target===t}))};e.uniqueId=function(t){void 0===t&&(t=0);var e="".concat(Math.random()).split(".")[1].substr(0,5),n="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(t,"-").concat(e).concat(n)}},function(t,e,n){"use strict";n.r(e),n.d(e,"catmullRomToBezier",(function(){return u})),n.d(e,"fillPath",(function(){return j})),n.d(e,"fillPathByDiff",(function(){return N})),n.d(e,"formatPath",(function(){return L})),n.d(e,"intersection",(function(){return k})),n.d(e,"parsePathArray",(function(){return v})),n.d(e,"parsePathString",(function(){return s})),n.d(e,"pathToAbsolute",(function(){return l})),n.d(e,"pathToCurve",(function(){return p})),n.d(e,"rectPath",(function(){return _}));var r=n(0),i="\t\n\v\f\r 聽釟€釥庘€€鈥佲€傗€冣€勨€呪€嗏€団€堚€夆€娾€仧銆€\u2028\u2029",o=new RegExp("([a-z])["+i+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+i+"]*,?["+i+"]*)+)","ig"),a=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+i+"]*,?["+i+"]*","ig"),s=function(t){if(!t)return null;if(Object(r.isArray)(t))return t;var e={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},n=[];return String(t).replace(o,(function(r,i,o){var s=[],u=i.toLowerCase();if(o.replace(a,(function(t,e){e&&s.push(+e)})),"m"===u&&s.length>2&&(n.push([i].concat(s.splice(0,2))),u="l",i="m"===i?"l":"L"),"o"===u&&1===s.length&&n.push([i,s[0]]),"r"===u)n.push([i].concat(s));else for(;s.length>=e[u]&&(n.push([i].concat(s.splice(0,e[u]))),e[u]););return t})),n},u=function(t,e){for(var n=[],r=0,i=t.length;i-2*!e>r;r+=2){var o=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?i-4===r?o[3]={x:+t[0],y:+t[1]}:i-2===r&&(o[2]={x:+t[0],y:+t[1]},o[3]={x:+t[2],y:+t[3]}):o[0]={x:+t[i-2],y:+t[i-1]}:i-4===r?o[3]=o[2]:r||(o[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-o[0].x+6*o[1].x+o[2].x)/6,(-o[0].y+6*o[1].y+o[2].y)/6,(o[1].x+6*o[2].x-o[3].x)/6,(o[1].y+6*o[2].y-o[3].y)/6,o[2].x,o[2].y])}return n},c=function(t,e,n,r,i){var o=[];if(null===i&&null===r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!==i){var a=Math.PI/180,s=t+n*Math.cos(-r*a),u=t+n*Math.cos(-i*a);o=[["M",s,e+n*Math.sin(-r*a)],["A",n,n,0,+(i-r>180),0,u,e+n*Math.sin(-i*a)]]}else o=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return o},l=function(t){if(!(t=s(t))||!t.length)return[["M",0,0]];var e,n,r=[],i=0,o=0,a=0,l=0,f=0;"M"===t[0][0]&&(a=i=+t[0][1],l=o=+t[0][2],f++,r[0]=["M",i,o]);for(var h=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase(),d=void 0,p=void 0,g=f,v=t.length;g1&&(r*=_=Math.sqrt(_),i*=_);var E=r*r,S=i*i,M=(a===s?-1:1)*Math.sqrt(Math.abs((E*S-E*w*w-S*x*x)/(E*w*w+S*x*x)));p=M*r*w/i+(e+u)/2,g=M*-i*x/r+(n+c)/2,h=Math.asin(((n-g)/i).toFixed(9)),d=Math.asin(((c-g)/i).toFixed(9)),h=ed&&(h-=2*Math.PI),!s&&d>h&&(d-=2*Math.PI)}var O=d-h;if(Math.abs(O)>v){var k=d,A=u,C=c;d=h+v*(s&&d>h?1:-1),m=t(u=p+r*Math.cos(d),c=g+i*Math.sin(d),r,i,o,0,s,A,C,[d,k,p,g])}O=d-h;var j=Math.cos(h),I=Math.sin(h),T=Math.cos(d),N=Math.sin(d),P=Math.tan(O/4),D=4/3*r*P,L=4/3*i*P,R=[e,n],B=[e+D*I,n-L*j],F=[u+D*N,c-L*T],z=[u,c];if(B[0]=2*R[0]-B[0],B[1]=2*R[1]-B[1],l)return[B,F,z].concat(m);for(var G=[],Y=0,U=(m=[B,F,z].concat(m).join().split(",")).length;Y7){t[e].shift();for(var o=t[e];o.length;)s[e]="A",i&&(u[e]="A"),t.splice(e++,0,["C"].concat(o.splice(0,6)));t.splice(e,1),n=Math.max(r.length,i&&i.length||0)}},y=function(t,e,o,a,s){t&&e&&"M"===t[s][0]&&"M"!==e[s][0]&&(e.splice(s,0,["M",a.x,a.y]),o.bx=0,o.by=0,o.x=t[s][1],o.y=t[s][2],n=Math.max(r.length,i&&i.length||0))};n=Math.max(r.length,i&&i.length||0);for(var m=0;m1?1:u<0?0:u)/2,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,d=0;d<12;d++){var p=c*l[d]+c,g=y(p,t,n,i,a),v=y(p,e,r,o,s),m=g*g+v*v;h+=f[d]*Math.sqrt(m)}return c*h},b=function(t,e,n,r,i,o,a,s){for(var u,c,l,f,h=[],d=[[],[]],p=0;p<2;++p)if(0===p?(c=6*t-12*n+6*i,u=-3*t+9*n-9*i+3*a,l=3*n-3*t):(c=6*e-12*r+6*o,u=-3*e+9*r-9*o+3*s,l=3*r-3*e),Math.abs(u)<1e-12){if(Math.abs(c)<1e-12)continue;(f=-l/c)>0&&f<1&&h.push(f)}else{var g=c*c-4*l*u,v=Math.sqrt(g);if(!(g<0)){var y=(-c+v)/(2*u);y>0&&y<1&&h.push(y);var m=(-c-v)/(2*u);m>0&&m<1&&h.push(m)}}for(var b,x=h.length,w=x;x--;)b=1-(f=h[x]),d[0][x]=b*b*b*t+3*b*b*f*n+3*b*f*f*i+f*f*f*a,d[1][x]=b*b*b*e+3*b*b*f*r+3*b*f*f*o+f*f*f*s;return d[0][w]=t,d[1][w]=e,d[0][w+1]=a,d[1][w+1]=s,d[0].length=d[1].length=w+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}},x=function(t,e,n,r,i,o,a,s){if(!(Math.max(t,n)Math.max(i,a)||Math.max(e,r)Math.max(o,s))){var u=(t-n)*(o-s)-(e-r)*(i-a);if(u){var c=((t*r-e*n)*(i-a)-(t-n)*(i*s-o*a))/u,l=((t*r-e*n)*(o-s)-(e-r)*(i*s-o*a))/u,f=+c.toFixed(2),h=+l.toFixed(2);if(!(f<+Math.min(t,n).toFixed(2)||f>+Math.max(t,n).toFixed(2)||f<+Math.min(i,a).toFixed(2)||f>+Math.max(i,a).toFixed(2)||h<+Math.min(e,r).toFixed(2)||h>+Math.max(e,r).toFixed(2)||h<+Math.min(o,s).toFixed(2)||h>+Math.max(o,s).toFixed(2)))return{x:c,y:l}}}},w=function(t,e,n){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height},_=function(t,e,n,r,i){if(i)return[["M",+t+ +i,e],["l",n-2*i,0],["a",i,i,0,0,1,i,i],["l",0,r-2*i],["a",i,i,0,0,1,-i,i],["l",2*i-n,0],["a",i,i,0,0,1,-i,-i],["l",0,2*i-r],["a",i,i,0,0,1,i,-i],["z"]];var o=[["M",t,e],["l",n,0],["l",0,r],["l",-n,0],["z"]];return o.parsePathArray=v,o},E=function(t,e,n,r){return null===t&&(t=e=n=r=0),null===e&&(e=t.y,n=t.width,r=t.height,t=t.x),{x:t,y:e,width:n,w:n,height:r,h:r,x2:t+n,y2:e+r,cx:t+n/2,cy:e+r/2,r1:Math.min(n,r)/2,r2:Math.max(n,r)/2,r0:Math.sqrt(n*n+r*r)/2,path:_(t,e,n,r),vb:[t,e,n,r].join(" ")}},S=function(t,e,n,i,o,a,s,u){Object(r.isArray)(t)||(t=[t,e,n,i,o,a,s,u]);var c=b.apply(null,t);return E(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)},M=function(t,e,n,r,i,o,a,s,u){var c=1-u,l=Math.pow(c,3),f=Math.pow(c,2),h=u*u,d=h*u,p=t+2*u*(n-t)+h*(i-2*n+t),g=e+2*u*(r-e)+h*(o-2*r+e),v=n+2*u*(i-n)+h*(a-2*i+n),y=r+2*u*(o-r)+h*(s-2*o+r);return{x:l*t+3*f*u*n+3*c*u*u*i+d*a,y:l*e+3*f*u*r+3*c*u*u*o+d*s,m:{x:p,y:g},n:{x:v,y:y},start:{x:c*t+u*n,y:c*e+u*r},end:{x:c*i+u*a,y:c*o+u*s},alpha:90-180*Math.atan2(p-v,g-y)/Math.PI}},O=function(t,e,n){if(!function(t,e){return t=E(t),e=E(e),w(e,t.x,t.y)||w(e,t.x2,t.y)||w(e,t.x,t.y2)||w(e,t.x2,t.y2)||w(t,e.x,e.y)||w(t,e.x2,e.y)||w(t,e.x,e.y2)||w(t,e.x2,e.y2)||(t.xe.x||e.xt.x)&&(t.ye.y||e.yt.y)}(S(t),S(e)))return n?0:[];for(var r=~~(m.apply(0,t)/8),i=~~(m.apply(0,e)/8),o=[],a=[],s={},u=n?0:[],c=0;c=0&&_<=1&&O>=0&&O<=1&&(n?u+=1:u.push({x:b.x,y:b.y,t1:_,t2:O}))}}return u},k=function(t,e){return function(t,e,n){var r,i,o,a,s,u,c,l,f,h;t=p(t),e=p(e);for(var d=n?0:[],g=0,v=t.length;g=3&&(3===t.length&&e.push("Q"),e=e.concat(t[1])),2===t.length&&e.push("L"),e=e.concat(t[t.length-1])}))}(t,e,n));else{var i=[].concat(t);"M"===i[0]&&(i[0]="L");for(var o=0;o<=n-1;o++)r.push(i)}return r},j=function(t,e){if(1===t.length)return t;var n=t.length-1,r=e.length-1,i=n/r,o=[];if(1===t.length&&"M"===t[0][0]){for(var a=0;a=0;u--)a=o[u].index,"add"===o[u].type?t.splice(a,0,[].concat(t[a])):t.splice(a,1)}var f=i-(r=t.length);if(r0)){t[r]=e[r];break}n=P(n,t[r-1],1)}t[r]=["Q"].concat(n.reduce((function(t,e){return t.concat(e)}),[]));break;case"T":t[r]=["T"].concat(n[0]);break;case"C":if(n.length<3){if(!(r>0)){t[r]=e[r];break}n=P(n,t[r-1],2)}t[r]=["C"].concat(n.reduce((function(t,e){return t.concat(e)}),[]));break;case"S":if(n.length<2){if(!(r>0)){t[r]=e[r];break}n=P(n,t[r-1],1)}t[r]=["S"].concat(n.reduce((function(t,e){return t.concat(e)}),[]));break;default:t[r]=e[r]}return t}},function(t,e,n){"use strict";n.r(e),n.d(e,"Base",(function(){return c})),n.d(e,"Circle",(function(){return l})),n.d(e,"Ellipse",(function(){return h})),n.d(e,"Image",(function(){return p})),n.d(e,"Line",(function(){return m})),n.d(e,"Marker",(function(){return _})),n.d(e,"Path",(function(){return N})),n.d(e,"Polygon",(function(){return D})),n.d(e,"Polyline",(function(){return L})),n.d(e,"Rect",(function(){return B})),n.d(e,"Text",(function(){return F}));var r={};n.r(r),n.d(r,"Base",(function(){return c})),n.d(r,"Circle",(function(){return l})),n.d(r,"Ellipse",(function(){return h})),n.d(r,"Image",(function(){return p})),n.d(r,"Line",(function(){return m})),n.d(r,"Marker",(function(){return _})),n.d(r,"Path",(function(){return N})),n.d(r,"Polygon",(function(){return D})),n.d(r,"Polyline",(function(){return L})),n.d(r,"Rect",(function(){return B})),n.d(r,"Text",(function(){return F}));var i=n(1),o=n(11),a=n(5),s=n(16),u=n(36),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.getShapeBase=function(){return r},e.prototype.getGroupBase=function(){return u.a},e.prototype.onCanvasChange=function(t){Object(s.h)(this,t)},e.prototype.calculateBBox=function(){var t=this.get("type"),e=this.getHitLineWidth(),n=Object(o.getBBoxMethod)(t)(this),r=e/2,i=n.x-r,a=n.y-r,s=n.x+n.width+r,u=n.y+n.height+r;return{x:i,minX:i,y:a,minY:a,width:n.width+e,height:n.height+e,maxX:s,maxY:u}},e.prototype.isFill=function(){return!!this.attrs.fill||this.isClipShape()},e.prototype.isStroke=function(){return!!this.attrs.stroke},e.prototype._applyClip=function(t,e){e&&(t.save(),Object(s.a)(t,e),e.createPath(t),t.restore(),t.clip(),e._afterDraw())},e.prototype.draw=function(t,e){var n=this.cfg.clipShape;if(e){if(!1===this.cfg.refresh)return void this.set("hasChanged",!1);var r=this.getCanvasBBox();if(!Object(a.f)(e,r))return this.set("hasChanged",!1),void(this.cfg.isInView&&this._afterDraw())}t.save(),Object(s.a)(t,this),this._applyClip(t,n),this.drawPath(t),t.restore(),this._afterDraw()},e.prototype.getCanvasViewBox=function(){var t=this.cfg.canvas;return t?t.getViewRange():null},e.prototype.cacheCanvasBBox=function(){var t=this.getCanvasViewBox();if(t){var e=this.getCanvasBBox(),n=Object(a.f)(e,t);this.set("isInView",n),n?this.set("cacheCanvasBBox",e):this.set("cacheCanvasBBox",null)}},e.prototype._afterDraw=function(){this.cacheCanvasBBox(),this.set("hasChanged",!1),this.set("refresh",null)},e.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("isInView",null),this.set("hasChanged",!1)},e.prototype.drawPath=function(t){this.createPath(t),this.strokeAndFill(t),this.afterDrawPath(t)},e.prototype.fill=function(t){t.fill()},e.prototype.stroke=function(t){t.stroke()},e.prototype.strokeAndFill=function(t){var e=this.attrs,n=e.lineWidth,r=e.opacity,i=e.strokeOpacity,o=e.fillOpacity;this.isFill()&&(Object(a.i)(o)||1===o?this.fill(t):(t.globalAlpha=o,this.fill(t),t.globalAlpha=r)),this.isStroke()&&n>0&&(Object(a.i)(i)||1===i||(t.globalAlpha=i),this.stroke(t)),this.afterDrawPath(t)},e.prototype.createPath=function(t){},e.prototype.afterDrawPath=function(t){},e.prototype.isInShape=function(t,e){var n=this.isStroke(),r=this.isFill(),i=this.getHitLineWidth();return this.isInStrokeOrPath(t,e,n,r,i)},e.prototype.isInStrokeOrPath=function(t,e,n,r,i){return!1},e.prototype.getHitLineWidth=function(){if(!this.isStroke())return 0;var t=this.attrs;return t.lineWidth+t.lineAppendWidth},e}(o.AbstractShape),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{x:0,y:0,r:0})},e.prototype.isInStrokeOrPath=function(t,e,n,r,i){var o=this.attr(),s=o.x,u=o.y,c=o.r,l=i/2,f=Object(a.b)(s,u,t,e);return r&&n?f<=c+l:r?f<=c:!!n&&(f>=c-l&&f<=c+l)},e.prototype.createPath=function(t){var e=this.attr(),n=e.x,r=e.y,i=e.r;t.beginPath(),t.arc(n,r,i,0,2*Math.PI,!1),t.closePath()},e}(c);function f(t,e,n,r){return t/(n*n)+e/(r*r)}var h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{x:0,y:0,rx:0,ry:0})},e.prototype.isInStrokeOrPath=function(t,e,n,r,i){var o=this.attr(),a=i/2,s=o.x,u=o.y,c=o.rx,l=o.ry,h=(t-s)*(t-s),d=(e-u)*(e-u);return r&&n?f(h,d,c+a,l+a)<=1:r?f(h,d,c,l)<=1:!!n&&(f(h,d,c-a,l-a)>=1&&f(h,d,c+a,l+a)<=1)},e.prototype.createPath=function(t){var e=this.attr(),n=e.x,r=e.y,i=e.rx,o=e.ry;if(t.beginPath(),t.ellipse)t.ellipse(n,r,i,o,0,0,2*Math.PI,!1);else{var a=i>o?i:o,s=i>o?1:i/o,u=i>o?o/i:1;t.save(),t.translate(n,r),t.scale(s,u),t.arc(0,0,a,0,2*Math.PI),t.restore(),t.closePath()}},e}(c);function d(t){return t instanceof HTMLElement&&Object(a.k)(t.nodeName)&&"CANVAS"===t.nodeName.toUpperCase()}var p=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{x:0,y:0,width:0,height:0})},e.prototype.initAttrs=function(t){this._setImage(t.img)},e.prototype.isStroke=function(){return!1},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._afterLoading=function(){if(!0===this.get("toDraw")){var t=this.get("canvas");t?t.draw():this.createPath(this.get("context"))}},e.prototype._setImage=function(t){var e=this,n=this.attrs;if(Object(a.k)(t)){var r=new Image;r.onload=function(){if(e.destroyed)return!1;e.attr("img",r),e.set("loading",!1),e._afterLoading();var t=e.get("callback");t&&t.call(e)},r.crossOrigin="Anonymous",r.src=t,this.set("loading",!0)}else t instanceof Image?(n.width||(n.width=t.width),n.height||(n.height=t.height)):d(t)&&(n.width||(n.width=Number(t.getAttribute("width"))),n.height||(n.height,Number(t.getAttribute("height"))))},e.prototype.onAttrChange=function(e,n,r){t.prototype.onAttrChange.call(this,e,n,r),"img"===e&&this._setImage(n)},e.prototype.createPath=function(t){if(this.get("loading"))return this.set("toDraw",!0),void this.set("context",t);var e=this.attr(),n=e.x,r=e.y,i=e.width,o=e.height,s=e.sx,u=e.sy,c=e.swidth,l=e.sheight,f=e.img;(f instanceof Image||d(f))&&(Object(a.i)(s)||Object(a.i)(u)||Object(a.i)(c)||Object(a.i)(l)?t.drawImage(f,n,r,i,o):t.drawImage(f,s,u,c,l,n,r,i,o))},e}(c),g=n(10);function v(t,e,n,r,i,o,a){var s=Math.min(t,n),u=Math.max(t,n),c=Math.min(e,r),l=Math.max(e,r),f=i/2;return o>=s-f&&o<=u+f&&a>=c-f&&a<=l+f&&g.c.pointToLine(t,e,n,r,o,a)<=i/2}var y=n(19),m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this.setArrow()},e.prototype.onAttrChange=function(e,n,r){t.prototype.onAttrChange.call(this,e,n,r),this.setArrow()},e.prototype.setArrow=function(){var t=this.attr(),e=t.x1,n=t.y1,r=t.x2,i=t.y2,o=t.startArrow,a=t.endArrow;o&&y.b(this,t,r,i,e,n),a&&y.a(this,t,e,n,r,i)},e.prototype.isInStrokeOrPath=function(t,e,n,r,i){if(!n||!i)return!1;var o=this.attr();return v(o.x1,o.y1,o.x2,o.y2,i,t,e)},e.prototype.createPath=function(t){var e=this.attr(),n=e.x1,r=e.y1,i=e.x2,o=e.y2,a=e.startArrow,s=e.endArrow,u={dx:0,dy:0},c={dx:0,dy:0};a&&a.d&&(u=y.c(n,r,i,o,e.startArrow.d)),s&&s.d&&(c=y.c(n,r,i,o,e.endArrow.d)),t.beginPath(),t.moveTo(n+u.dx,r+u.dy),t.lineTo(i-c.dx,o-c.dy)},e.prototype.afterDrawPath=function(t){var e=this.get("startArrowShape"),n=this.get("endArrowShape");e&&e.draw(t),n&&n.draw(t)},e.prototype.getTotalLength=function(){var t=this.attr(),e=t.x1,n=t.y1,r=t.x2,i=t.y2;return g.c.length(e,n,r,i)},e.prototype.getPoint=function(t){var e=this.attr(),n=e.x1,r=e.y1,i=e.x2,o=e.y2;return g.c.pointAt(n,r,i,o,t)},e}(c),b=n(0),x=n(21),w={circle:function(t,e,n){return[["M",t-n,e],["A",n,n,0,1,0,t+n,e],["A",n,n,0,1,0,t-n,e]]},square:function(t,e,n){return[["M",t-n,e-n],["L",t+n,e-n],["L",t+n,e+n],["L",t-n,e+n],["Z"]]},diamond:function(t,e,n){return[["M",t-n,e],["L",t,e-n],["L",t+n,e],["L",t,e+n],["Z"]]},triangle:function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e+r],["L",t,e-r],["L",t+n,e+r],["Z"]]},"triangle-down":function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e-r],["L",t+n,e-r],["L",t,e+r],["Z"]]}},_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(i.__extends)(e,t),e.prototype.initAttrs=function(t){this._resetParamsCache()},e.prototype._resetParamsCache=function(){this.set("paramsCache",{})},e.prototype.onAttrChange=function(e,n,r){t.prototype.onAttrChange.call(this,e,n,r),-1!==["symbol","x","y","r","radius"].indexOf(e)&&this._resetParamsCache()},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._getR=function(t){return Object(b.isNil)(t.r)?t.radius:t.r},e.prototype._getPath=function(){var t,n,r=this.attr(),i=r.x,o=r.y,s=r.symbol||"circle",u=this._getR(r);if(Object(a.h)(s))n=(t=s)(i,o,u),n=Object(x.c)(n);else{if(!(t=e.Symbols[s]))return console.warn(s+" marker is not supported."),null;n=t(i,o,u)}return n},e.prototype.createPath=function(t){var e=this._getPath(),n=this.get("paramsCache");Object(s.e)(this,t,{path:e},n)},e.Symbols=w,e}(c);function E(t,e,n){var r=Object(o.getOffScreenContext)();return t.createPath(r),r.isPointInPath(e,n)}function S(t){return Math.abs(t)<1e-6?0:t<0?-1:1}function M(t,e,n){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1])}function O(t,e,n){var r=!1,i=t.length;if(i<=2)return!1;for(var o=0;o0!=S(s[1]-n)>0&&S(e-(n-a[1])*(a[0]-s[0])/(a[1]-s[1])-a[0])<0&&(r=!r)}return r}var k=n(4),A=n(24);function C(t,e,n,r,i,o,s,u){var c=(Math.atan2(u-e,s-t)+2*Math.PI)%(2*Math.PI);if(ci)return!1;var l={x:t+n*Math.cos(c),y:e+n*Math.sin(c)};return Object(a.b)(l.x,l.y,s,u)<=o/2}var j=k.a.transform;var I=Object(i.__assign)({hasArc:function(t){for(var e=!1,n=t.length,r=0;r0&&r.push(i),{polygons:n,polylines:r}},isPointInStroke:function(t,e,n,r,i){for(var o=!1,s=e/2,u=0;ux?b:x,O=j(null,[["t",-y,-m],["r",-E],["s",1/(b>x?1:b/x),1/(b>x?x/b:1)]]);A.transformMat3(S,S,O),o=C(0,0,M,w,_,e,S[0],S[1])}if(o)break}}return o}},o.PathUtil);function T(t,e,n){for(var r=!1,i=0;i=r[0]&&t<=r[1]&&(e=(t-r[0])/(r[1]-r[0]),n=i)}));var o=i[n];if(Object(b.isNil)(o)||Object(b.isNil)(n))return null;var a=o.length,s=i[n+1];return g.b.pointAt(o[a-2],o[a-1],s[1],s[2],s[3],s[4],s[5],s[6],e)},e.prototype._calculateCurve=function(){var t=this.attr().path;this.set("curve",I.pathToCurve(t))},e.prototype._setTcache=function(){var t,e,n,r,i=0,o=0,a=[],s=this.get("curve");s&&(Object(b.each)(s,(function(t,e){n=s[e+1],r=t.length,n&&(i+=g.b.length(t[r-2],t[r-1],n[1],n[2],n[3],n[4],n[5],n[6])||0)})),this.set("totalLength",i),0!==i?(Object(b.each)(s,(function(u,c){n=s[c+1],r=u.length,n&&((t=[])[0]=o/i,e=g.b.length(u[r-2],u[r-1],n[1],n[2],n[3],n[4],n[5],n[6]),o+=e||0,t[1]=o/i,a.push(t))})),this.set("tCache",a)):this.set("tCache",[]))},e.prototype.getStartTangent=function(){var t,e=this.getSegments();if(e.length>1){var n=e[0].currentPoint,r=e[1].currentPoint,i=e[1].startTangent;t=[],i?(t.push([n[0]-i[0],n[1]-i[1]]),t.push([n[0],n[1]])):(t.push([r[0],r[1]]),t.push([n[0],n[1]]))}return t},e.prototype.getEndTangent=function(){var t,e=this.getSegments(),n=e.length;if(n>1){var r=e[n-2].currentPoint,i=e[n-1].currentPoint,o=e[n-1].endTangent;t=[],o?(t.push([i[0]-o[0],i[1]-o[1]]),t.push([i[0],i[1]])):(t.push([r[0],r[1]]),t.push([i[0],i[1]]))}return t},e}(c);function P(t,e,n,r,i){var o=t.length;if(o<2)return!1;for(var a=0;a=r[0]&&t<=r[1]&&(e=(t-r[0])/(r[1]-r[0]),n=i)})),g.c.pointAt(r[n][0],r[n][1],r[n+1][0],r[n+1][1],e)},e.prototype._setTcache=function(){var t=this.attr().points;if(t&&0!==t.length){var e=this.getTotalLength();if(!(e<=0)){var n,r,i=0,o=[];Object(b.each)(t,(function(a,s){t[s+1]&&((n=[])[0]=i/e,r=g.c.length(a[0],a[1],t[s+1][0],t[s+1][1]),i+=r,n[1]=i/e,o.push(n))})),this.set("tCache",o)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,e=[];return e.push([t[1][0],t[1][1]]),e.push([t[0][0],t[0][1]]),e},e.prototype.getEndTangent=function(){var t=this.attr().points,e=t.length-1,n=[];return n.push([t[e-1][0],t[e-1][1]]),n.push([t[e][0],t[e][1]]),n},e}(c),R=n(56);var B=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.isInStrokeOrPath=function(t,e,n,r,i){var o=this.attr(),s=o.x,u=o.y,c=o.width,l=o.height,f=o.radius;if(f){var h=!1;return n&&(h=function(t,e,n,r,i,o,a,s){return v(t+i,e,t+n-i,e,o,a,s)||v(t+n,e+i,t+n,e+r-i,o,a,s)||v(t+n-i,e+r,t+i,e+r,o,a,s)||v(t,e+r-i,t,e+i,o,a,s)||C(t+n-i,e+i,i,1.5*Math.PI,2*Math.PI,o,a,s)||C(t+n-i,e+r-i,i,0,.5*Math.PI,o,a,s)||C(t+i,e+r-i,i,.5*Math.PI,Math.PI,o,a,s)||C(t+i,e+i,i,Math.PI,1.5*Math.PI,o,a,s)}(s,u,c,l,f,i,t,e)),!h&&r&&(h=E(this,t,e)),h}var d=i/2;return r&&n?Object(a.e)(s-d,u-d,c+d,l+d,t,e):r?Object(a.e)(s,u,c,l,t,e):n?function(t,e,n,r,i,o,s){var u=i/2;return Object(a.e)(t-u,e-u,n,i,o,s)||Object(a.e)(t+n-u,e-u,i,r,o,s)||Object(a.e)(t+u,e+r-u,n,i,o,s)||Object(a.e)(t-u,e+u,i,r,o,s)}(s,u,c,l,i,t,e):void 0},e.prototype.createPath=function(t){var e=this.attr(),n=e.x,r=e.y,i=e.width,o=e.height,a=e.radius;if(t.beginPath(),0===a)t.rect(n,r,i,o);else{var s=Object(R.a)(a),u=s[0],c=s[1],l=s[2],f=s[3];t.moveTo(n+u,r),t.lineTo(n+i-c,r),0!==c&&t.arc(n+i-c,r+c,c,-Math.PI/2,0),t.lineTo(n+i,r+o-l),0!==l&&t.arc(n+i-l,r+o-l,l,0,Math.PI/2),t.lineTo(n+f,r+o),0!==f&&t.arc(n+f,r+o-f,f,Math.PI/2,Math.PI),t.lineTo(n,r+u),0!==u&&t.arc(n+u,r+u,u,Math.PI,1.5*Math.PI),t.closePath()}},e}(c),F=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},e.prototype.isOnlyHitBox=function(){return!0},e.prototype.initAttrs=function(t){this._assembleFont(),t.text&&this._setText(t.text)},e.prototype._assembleFont=function(){var t=this.attrs;t.font=Object(o.assembleFont)(t)},e.prototype._setText=function(t){var e=null;Object(a.k)(t)&&-1!==t.indexOf("\n")&&(e=t.split("\n")),this.set("textArr",e)},e.prototype.onAttrChange=function(e,n,r){t.prototype.onAttrChange.call(this,e,n,r),e.startsWith("font")&&this._assembleFont(),"text"===e&&this._setText(n)},e.prototype._getSpaceingY=function(){var t=this.attrs,e=t.lineHeight,n=1*t.fontSize;return e?e-n:.14*n},e.prototype._drawTextArr=function(t,e,n){var r,i=this.attrs,s=i.textBaseline,u=i.x,c=i.y,l=1*i.fontSize,f=this._getSpaceingY(),h=Object(o.getTextHeight)(i.text,i.fontSize,i.lineHeight);Object(a.c)(e,(function(e,i){r=c+i*(f+l)-h+l,"middle"===s&&(r+=h-l-(h-l)/2),"top"===s&&(r+=h-l),Object(a.i)(e)||(n?t.fillText(e,u,r):t.strokeText(e,u,r))}))},e.prototype._drawText=function(t,e){var n=this.attr(),r=n.x,i=n.y,o=this.get("textArr");if(o)this._drawTextArr(t,o,e);else{var s=n.text;Object(a.i)(s)||(e?t.fillText(s,r,i):t.strokeText(s,r,i))}},e.prototype.strokeAndFill=function(t){var e=this.attrs,n=e.lineWidth,r=e.opacity,i=e.strokeOpacity,o=e.fillOpacity;this.isStroke()&&n>0&&(Object(a.i)(i)||1===i||(t.globalAlpha=r),this.stroke(t)),this.isFill()&&(Object(a.i)(o)||1===o?this.fill(t):(t.globalAlpha=o,this.fill(t),t.globalAlpha=r)),this.afterDrawPath(t)},e.prototype.fill=function(t){this._drawText(t,!0)},e.prototype.stroke=function(t){this._drawText(t,!1)},e}(c)},function(t,e){var n=[],r=[];function i(t,e){if(e=e||{},void 0===t)throw new Error("insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).");var i,o=!0===e.prepend?"prepend":"append",a=void 0!==e.container?e.container:document.querySelector("head"),s=n.indexOf(a);return-1===s&&(s=n.push(a)-1,r[s]={}),void 0!==r[s]&&void 0!==r[s][o]?i=r[s][o]:(i=r[s][o]=function(){var t=document.createElement("style");return t.setAttribute("type","text/css"),t}(),"prepend"===o?a.insertBefore(i,a.childNodes[0]):a.appendChild(i)),65279===t.charCodeAt(0)&&(t=t.substr(1,t.length)),i.styleSheet?i.styleSheet.cssText+=t:i.textContent+=t,i}t.exports=i,t.exports.insertCss=i},function(t,e,n){"use strict";n(38),n(11);var r=n(113);n.d(e,"Canvas",(function(){return r.a}));n(37)},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return a})),n.d(e,"a",(function(){return s}));var r=n(9),i=n(50);function o(t,e,n){var i=1;return Object(r.h)(t)&&(i=t.split("\n").length),i>1?e*i+function(t,e){return e?e-t:.14*t}(e,n)*(i-1):e}function a(t,e){var n=Object(i.a)(),o=0;if(Object(r.e)(t)||""===t)return o;if(n.save(),n.font=e,Object(r.h)(t)&&t.includes("\n")){var a=t.split("\n");Object(r.a)(a,(function(t){var e=n.measureText(t).width;o0&&(e?"stroke"in n?this._setColor(t,"stroke",o):"strokeStyle"in n&&this._setColor(t,"stroke",a):this._setColor(t,"stroke",o||a),u&&f.setAttribute(c.b.strokeOpacity,u),l&&f.setAttribute(c.b.lineWidth,l))},e.prototype._setColor=function(t,e,n){var r=this.get("el");if(n)if(n=n.trim(),/^[r,R,L,l]{1}[\s]*\(/.test(n))(i=t.find("gradient",n))||(i=t.addGradient(n)),r.setAttribute(c.b[e],"url(#"+i+")");else if(/^[p,P]{1}[\s]*\(/.test(n)){var i;(i=t.find("pattern",n))||(i=t.addPattern(n)),r.setAttribute(c.b[e],"url(#"+i+")")}else r.setAttribute(c.b[e],n);else r.setAttribute(c.b[e],"none")},e.prototype.shadow=function(t,e){var n=this.attr(),r=e||n,i=r.shadowOffsetX,o=r.shadowOffsetY,s=r.shadowBlur,u=r.shadowColor;(i||o||s||u)&&Object(a.b)(this,t)},e.prototype.transform=function(t){var e=this.attr();(t||e).matrix&&Object(a.c)(this)},e.prototype.isInShape=function(t,e){return this.isPointInPath(t,e)},e.prototype.isPointInPath=function(t,e){var n=this.get("el"),r=this.get("canvas").get("el").getBoundingClientRect(),i=t+r.left,o=e+r.top,a=document.elementFromPoint(i,o);return!(!a||!a.isEqualNode(n))},e.prototype.getHitLineWidth=function(){var t=this.attrs,e=t.lineWidth,n=t.lineAppendWidth;return this.isStroke()?e+n:0},e}(o.AbstractShape),h=n(0),d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="circle",e.canFill=!0,e.canStroke=!0,e}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{x:0,y:0,r:0})},e.prototype.createPath=function(t,e){var n=this.attr(),r=this.get("el");Object(h.each)(e||n,(function(t,e){"x"===e||"y"===e?r.setAttribute("c"+e,t):c.b[e]&&r.setAttribute(c.b[e],t)}))},e}(f),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="dom",e.canFill=!1,e.canStroke=!1,e}return Object(i.__extends)(e,t),e.prototype.createPath=function(t,e){var n=this.attr(),r=this.get("el");if(Object(h.each)(e||n,(function(t,e){c.b[e]&&r.setAttribute(c.b[e],t)})),"function"==typeof n.html){var i=n.html.call(this,n);if(i instanceof Element||i instanceof HTMLDocument){for(var o=r.childNodes,a=o.length-1;a>=0;a--)r.removeChild(o[a]);r.appendChild(i)}else r.innerHTML=i}else r.innerHTML=n.html},e}(f),g=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="ellipse",e.canFill=!0,e.canStroke=!0,e}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{x:0,y:0,rx:0,ry:0})},e.prototype.createPath=function(t,e){var n=this.attr(),r=this.get("el");Object(h.each)(e||n,(function(t,e){"x"===e||"y"===e?r.setAttribute("c"+e,t):c.b[e]&&r.setAttribute(c.b[e],t)}))},e}(f),v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="image",e.canFill=!1,e.canStroke=!1,e}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{x:0,y:0,width:0,height:0})},e.prototype.createPath=function(t,e){var n=this,r=this.attr(),i=this.get("el");Object(h.each)(e||r,(function(t,e){"img"===e?n._setImage(r.img):c.b[e]&&i.setAttribute(c.b[e],t)}))},e.prototype.setAttr=function(t,e){this.attrs[t]=e,"img"===t&&this._setImage(e)},e.prototype._setImage=function(t){var e=this.attr(),n=this.get("el");if(Object(h.isString)(t))n.setAttribute("href",t);else if(t instanceof window.Image)e.width||(n.setAttribute("width",t.width),this.attr("width",t.width)),e.height||(n.setAttribute("height",t.height),this.attr("height",t.height)),n.setAttribute("href",t.src);else if(t instanceof HTMLElement&&Object(h.isString)(t.nodeName)&&"CANVAS"===t.nodeName.toUpperCase())n.setAttribute("href",t.toDataURL());else if(t instanceof ImageData){var r=document.createElement("canvas");r.setAttribute("width",""+t.width),r.setAttribute("height",""+t.height),r.getContext("2d").putImageData(t,0,0),e.width||(n.setAttribute("width",""+t.width),this.attr("width",t.width)),e.height||(n.setAttribute("height",""+t.height),this.attr("height",t.height)),n.setAttribute("href",r.toDataURL())}},e}(f),y=n(10),m=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="line",e.canFill=!1,e.canStroke=!0,e}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,e){var n=this.attr(),r=this.get("el");Object(h.each)(e||n,(function(e,i){if("startArrow"===i||"endArrow"===i)if(e){var o=Object(h.isObject)(e)?t.addArrow(n,c.b[i]):t.getDefaultArrow(n,c.b[i]);r.setAttribute(c.b[i],"url(#"+o+")")}else r.removeAttribute(c.b[i]);else c.b[i]&&r.setAttribute(c.b[i],e)}))},e.prototype.getTotalLength=function(){var t=this.attr(),e=t.x1,n=t.y1,r=t.x2,i=t.y2;return y.c.length(e,n,r,i)},e.prototype.getPoint=function(t){var e=this.attr(),n=e.x1,r=e.y1,i=e.x2,o=e.y2;return y.c.pointAt(n,r,i,o,t)},e}(f),b={circle:function(t,e,n){return[["M",t,e],["m",-n,0],["a",n,n,0,1,0,2*n,0],["a",n,n,0,1,0,2*-n,0]]},square:function(t,e,n){return[["M",t-n,e-n],["L",t+n,e-n],["L",t+n,e+n],["L",t-n,e+n],["Z"]]},diamond:function(t,e,n){return[["M",t-n,e],["L",t,e-n],["L",t+n,e],["L",t,e+n],["Z"]]},triangle:function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e+r],["L",t,e-r],["L",t+n,e+r],["z"]]},triangleDown:function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e-r],["L",t+n,e-r],["L",t,e+r],["Z"]]}},x={get:function(t){return b[t]},register:function(t,e){b[t]=e},remove:function(t){delete b[t]},getAll:function(){return b}},w=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="marker",e.canFill=!0,e.canStroke=!0,e}return Object(i.__extends)(e,t),e.prototype.createPath=function(t){this.get("el").setAttribute("d",this._assembleMarker())},e.prototype._assembleMarker=function(){var t=this._getPath();return Object(h.isArray)(t)?t.map((function(t){return t.join(" ")})).join(""):t},e.prototype._getPath=function(){var t,e=this.attr(),n=e.x,r=e.y,i=e.r||e.radius,o=e.symbol||"circle";return(t=Object(h.isFunction)(o)?o:x.get(o))?t(n,r,i):(console.warn(t+" symbol is not exist."),null)},e.symbolsFactory=x,e}(f),_=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="path",e.canFill=!0,e.canStroke=!0,e}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,e){var n=this,r=this.attr(),i=this.get("el");Object(h.each)(e||r,(function(e,o){if("path"===o&&Object(h.isArray)(e))i.setAttribute("d",n._formatPath(e));else if("startArrow"===o||"endArrow"===o)if(e){var a=Object(h.isObject)(e)?t.addArrow(r,c.b[o]):t.getDefaultArrow(r,c.b[o]);i.setAttribute(c.b[o],"url(#"+a+")")}else i.removeAttribute(c.b[o]);else c.b[o]&&i.setAttribute(c.b[o],e)}))},e.prototype._formatPath=function(t){var e=t.map((function(t){return t.join(" ")})).join("");return~e.indexOf("NaN")?"":e},e.prototype.getTotalLength=function(){var t=this.get("el");return t?t.getTotalLength():null},e.prototype.getPoint=function(t){var e=this.get("el"),n=this.getTotalLength();if(0===n)return null;var r=e?e.getPointAtLength(t*n):null;return r?{x:r.x,y:r.y}:null},e}(f),E=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="polygon",e.canFill=!0,e.canStroke=!0,e}return Object(i.__extends)(e,t),e.prototype.createPath=function(t,e){var n=this.attr(),r=this.get("el");Object(h.each)(e||n,(function(t,e){"points"===e&&Object(h.isArray)(t)&&t.length>=2?r.setAttribute("points",t.map((function(t){return t[0]+","+t[1]})).join(" ")):c.b[e]&&r.setAttribute(c.b[e],t)}))},e}(f),S=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="polyline",e.canFill=!0,e.canStroke=!0,e}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{startArrow:!1,endArrow:!1})},e.prototype.onAttrChange=function(e,n,r){t.prototype.onAttrChange.call(this,e,n,r),-1!==["points"].indexOf(e)&&this._resetCache()},e.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},e.prototype.createPath=function(t,e){var n=this.attr(),r=this.get("el");Object(h.each)(e||n,(function(t,e){"points"===e&&Object(h.isArray)(t)&&t.length>=2?r.setAttribute("points",t.map((function(t){return t[0]+","+t[1]})).join(" ")):c.b[e]&&r.setAttribute(c.b[e],t)}))},e.prototype.getTotalLength=function(){var t=this.attr().points,e=this.get("totalLength");return Object(h.isNil)(e)?(this.set("totalLength",y.d.length(t)),this.get("totalLength")):e},e.prototype.getPoint=function(t){var e,n,r=this.attr().points,i=this.get("tCache");return i||(this._setTcache(),i=this.get("tCache")),Object(h.each)(i,(function(r,i){t>=r[0]&&t<=r[1]&&(e=(t-r[0])/(r[1]-r[0]),n=i)})),y.c.pointAt(r[n][0],r[n][1],r[n+1][0],r[n+1][1],e)},e.prototype._setTcache=function(){var t=this.attr().points;if(t&&0!==t.length){var e=this.getTotalLength();if(!(e<=0)){var n,r,i=0,o=[];Object(h.each)(t,(function(a,s){t[s+1]&&((n=[])[0]=i/e,r=y.c.length(a[0],a[1],t[s+1][0],t[s+1][1]),i+=r,n[1]=i/e,o.push(n))})),this.set("tCache",o)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,e=[];return e.push([t[1][0],t[1][1]]),e.push([t[0][0],t[0][1]]),e},e.prototype.getEndTangent=function(){var t=this.attr().points,e=t.length-1,n=[];return n.push([t[e-1][0],t[e-1][1]]),n.push([t[e][0],t[e][1]]),n},e}(f);var M=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="rect",e.canFill=!0,e.canStroke=!0,e}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.createPath=function(t,e){var n=this,r=this.attr(),i=this.get("el"),o=!1,a=["x","y","width","height","radius"];Object(h.each)(e||r,(function(t,e){-1===a.indexOf(e)||o?-1===a.indexOf(e)&&c.b[e]&&i.setAttribute(c.b[e],t):(i.setAttribute("d",n._assembleRect(r)),o=!0)}))},e.prototype._assembleRect=function(t){var e=t.x,n=t.y,r=t.width,i=t.height,o=t.radius;if(!o)return"M "+e+","+n+" l "+r+",0 l 0,"+i+" l"+-r+" 0 z";var a=function(t){var e=0,n=0,r=0,i=0;return Object(h.isArray)(t)?1===t.length?e=n=r=i=t[0]:2===t.length?(e=r=t[0],n=i=t[1]):3===t.length?(e=t[0],n=i=t[1],r=t[2]):(e=t[0],n=t[1],r=t[2],i=t[3]):e=n=r=i=t,{r1:e,r2:n,r3:r,r4:i}}(o);return Object(h.isArray)(o)?1===o.length?a.r1=a.r2=a.r3=a.r4=o[0]:2===o.length?(a.r1=a.r3=o[0],a.r2=a.r4=o[1]):3===o.length?(a.r1=o[0],a.r2=a.r4=o[1],a.r3=o[2]):(a.r1=o[0],a.r2=o[1],a.r3=o[2],a.r4=o[3]):a.r1=a.r2=a.r3=a.r4=o,[["M "+(e+a.r1)+","+n],["l "+(r-a.r1-a.r2)+",0"],["a "+a.r2+","+a.r2+",0,0,1,"+a.r2+","+a.r2],["l 0,"+(i-a.r2-a.r3)],["a "+a.r3+","+a.r3+",0,0,1,"+-a.r3+","+a.r3],["l "+(a.r3+a.r4-r)+",0"],["a "+a.r4+","+a.r4+",0,0,1,"+-a.r4+","+-a.r4],["l 0,"+(a.r4+a.r1-i)],["a "+a.r1+","+a.r1+",0,0,1,"+a.r1+","+-a.r1],["z"]].join(" ")},e}(f),O=n(55),k={top:"before-edge",middle:"central",bottom:"after-edge",alphabetic:"baseline",hanging:"hanging"},A={top:"text-before-edge",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",hanging:"hanging"},C={left:"left",start:"left",center:"middle",right:"end",end:"end"},j=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="text",e.canFill=!0,e.canStroke=!0,e}return Object(i.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return Object(i.__assign)(Object(i.__assign)({},e),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},e.prototype.createPath=function(t,e){var n=this,r=this.attr(),i=this.get("el");this._setFont(),Object(h.each)(e||r,(function(t,e){"text"===e?n._setText(""+t):"matrix"===e&&t?Object(a.c)(n):c.b[e]&&i.setAttribute(c.b[e],t)})),i.setAttribute("paint-order","stroke"),i.setAttribute("style","stroke-linecap:butt; stroke-linejoin:miter;")},e.prototype._setFont=function(){var t=this.get("el"),e=this.attr(),n=e.textBaseline,r=e.textAlign,i=Object(O.a)();i&&"firefox"===i.name?t.setAttribute("dominant-baseline",A[n]||"alphabetic"):t.setAttribute("alignment-baseline",k[n]||"baseline"),t.setAttribute("text-anchor",C[r]||"left")},e.prototype._setText=function(t){var e=this.get("el"),n=this.attr(),r=n.x,i=n.textBaseline,o=void 0===i?"bottom":i;if(t)if(~t.indexOf("\n")){var a=t.split("\n"),s=a.length-1,u="";Object(h.each)(a,(function(t,e){0===e?"alphabetic"===o?u+=''+t+"":"top"===o?u+=''+t+"":"middle"===o?u+=''+t+"":"bottom"===o?u+=''+t+"":"hanging"===o&&(u+=''+t+""):u+=''+t+""})),e.innerHTML=u}else e.innerHTML=t;else e.innerHTML=""},e}(f)},function(t,e,n){"use strict";n.r(e),n.d(e,"create",(function(){return i})),n.d(e,"clone",(function(){return o})),n.d(e,"fromValues",(function(){return a})),n.d(e,"copy",(function(){return s})),n.d(e,"set",(function(){return u})),n.d(e,"add",(function(){return c})),n.d(e,"subtract",(function(){return l})),n.d(e,"multiply",(function(){return f})),n.d(e,"divide",(function(){return h})),n.d(e,"ceil",(function(){return d})),n.d(e,"floor",(function(){return p})),n.d(e,"min",(function(){return g})),n.d(e,"max",(function(){return v})),n.d(e,"round",(function(){return y})),n.d(e,"scale",(function(){return m})),n.d(e,"scaleAndAdd",(function(){return b})),n.d(e,"distance",(function(){return x})),n.d(e,"squaredDistance",(function(){return w})),n.d(e,"length",(function(){return _})),n.d(e,"squaredLength",(function(){return E})),n.d(e,"negate",(function(){return S})),n.d(e,"inverse",(function(){return M})),n.d(e,"normalize",(function(){return O})),n.d(e,"dot",(function(){return k})),n.d(e,"cross",(function(){return A})),n.d(e,"lerp",(function(){return C})),n.d(e,"random",(function(){return j})),n.d(e,"transformMat2",(function(){return I})),n.d(e,"transformMat2d",(function(){return T})),n.d(e,"transformMat3",(function(){return N})),n.d(e,"transformMat4",(function(){return P})),n.d(e,"rotate",(function(){return D})),n.d(e,"angle",(function(){return L})),n.d(e,"zero",(function(){return R})),n.d(e,"str",(function(){return B})),n.d(e,"exactEquals",(function(){return F})),n.d(e,"equals",(function(){return z})),n.d(e,"len",(function(){return Y})),n.d(e,"sub",(function(){return U})),n.d(e,"mul",(function(){return X})),n.d(e,"div",(function(){return W})),n.d(e,"dist",(function(){return V})),n.d(e,"sqrDist",(function(){return H})),n.d(e,"sqrLen",(function(){return q})),n.d(e,"forEach",(function(){return Z}));var r=n(2);function i(){var t=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function o(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e}function a(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n}function s(t,e){return t[0]=e[0],t[1]=e[1],t}function u(t,e,n){return t[0]=e,t[1]=n,t}function c(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function l(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function f(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function h(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function d(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function p(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function g(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}function v(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}function y(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function m(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}function b(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t}function x(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.hypot(n,r)}function w(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function _(t){var e=t[0],n=t[1];return Math.hypot(e,n)}function E(t){var e=t[0],n=t[1];return e*e+n*n}function S(t,e){return t[0]=-e[0],t[1]=-e[1],t}function M(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function O(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t}function k(t,e){return t[0]*e[0]+t[1]*e[1]}function A(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t}function C(t,e,n,r){var i=e[0],o=e[1];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t}function j(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t}function I(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t}function T(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t}function N(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t}function P(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t}function D(t,e,n,r){var i=e[0]-n[0],o=e[1]-n[1],a=Math.sin(r),s=Math.cos(r);return t[0]=i*s-o*a+n[0],t[1]=i*a+o*s+n[1],t}function L(t,e){var n=t[0],r=t[1],i=e[0],o=e[1],a=Math.sqrt(n*n+r*r)*Math.sqrt(i*i+o*o),s=a&&(n*i+r*o)/a;return Math.acos(Math.min(Math.max(s,-1),1))}function R(t){return t[0]=0,t[1]=0,t}function B(t){return"vec2("+t[0]+", "+t[1]+")"}function F(t,e){return t[0]===e[0]&&t[1]===e[1]}function z(t,e){var n=t[0],i=t[1],o=e[0],a=e[1];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-a)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))}var G,Y=_,U=l,X=f,W=h,V=x,H=w,q=E,Z=(G=i(),function(t,e,n,r,i,o){var a,s;for(e||(e=2),n||(n=0),s=r?Math.min(r*e+n,t.length):t.length,a=n;a-1}},function(t,e,n){"use strict";e.a=function(t){return"object"===a(t)&&null!==t}},function(t,e,n){"use strict";var r=n(8),i=n(2),o=Object.values?function(t){return Object.values(t)}:function(t){var e=[];return Object(r.a)(t,(function(n,r){Object(i.a)(t)&&"prototype"===r||e.push(n)})),e};e.a=o},function(t,e,n){"use strict";function r(t,e){for(var n in e)e.hasOwnProperty(n)&&"constructor"!==n&&void 0!==e[n]&&(t[n]=e[n])}e.a=function(t,e,n,i){return e&&r(t,e),n&&r(t,n),i&&r(t,i),t}},function(t,e,n){var r=n(35),i=["LR","RL","TB","BT","H","V"],o=["LR","RL","H"],a=i[0];t.exports=function(t,e,n){var s=e.direction||a;if(e.isHorizontal=function(t){return o.indexOf(t)>-1}(s),s&&-1===i.indexOf(s))throw new TypeError("Invalid direction: "+s);if(s===i[0])n(t,e);else if(s===i[1])n(t,e),t.right2left();else if(s===i[2])n(t,e);else if(s===i[3])n(t,e),t.bottom2top();else if(s===i[4]||s===i[5]){var u=r(t,e),c=u.left,l=u.right;n(c,e),n(l,e),e.isHorizontal?c.right2left():c.bottom2top(),l.translate(c.x-l.x,c.y-l.y),t.x=c.x,t.y=l.y;var f=t.getBoundingBox();e.isHorizontal?f.top<0&&t.translate(0,-f.top):f.left<0&&t.translate(-f.left,0)}var h=e.fixedRoot;return void 0===h&&(h=!0),h&&t.translate(-(t.x+t.width/2+t.hgap),-(t.y+t.height/2+t.vgap)),t}},function(t,e,n){var r=n(6),i={getId:function(t){return t.id||t.name},getPreH:function(t){return t.preH||0},getPreV:function(t){return t.preV||0},getHGap:function(t){return t.hgap||18},getVGap:function(t){return t.vgap||18},getChildren:function(t){return t.children},getHeight:function(t){return t.height||36},getWidth:function(t){var e=t.label||" ";return t.width||18*e.split("").length}};function o(t,e){var n=this;if(n.vgap=n.hgap=0,t instanceof o)return t;n.data=t;var r=e.getHGap(t),i=e.getVGap(t);return n.preH=e.getPreH(t),n.preV=e.getPreV(t),n.width=e.getWidth(t),n.height=e.getHeight(t),n.width+=n.preH,n.height+=n.preV,n.id=e.getId(t),n.x=n.y=0,n.depth=0,n.children||(n.children=[]),n.addGap(r,i),n}r.assign(o.prototype,{isRoot:function(){return 0===this.depth},isLeaf:function(){return 0===this.children.length},addGap:function(t,e){this.hgap+=t,this.vgap+=e,this.width+=2*t,this.height+=2*e},eachNode:function(t){for(var e,n=[this];e=n.shift();)t(e),n=e.children.concat(n)},DFTraverse:function(t){this.eachNode(t)},BFTraverse:function(t){for(var e,n=[this];e=n.shift();)t(e),n=n.concat(e.children)},getBoundingBox:function(){var t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode((function(e){t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)})),t},translate:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.eachNode((function(n){n.x+=t,n.y+=e,n.x+=n.preH,n.y+=n.preV}))},right2left:function(){var t=this.getBoundingBox();this.eachNode((function(e){e.x=e.x-2*(e.x-t.left)-e.width})),this.translate(t.width,0)},bottom2top:function(){var t=this.getBoundingBox();this.eachNode((function(e){e.y=e.y-2*(e.y-t.top)-e.height})),this.translate(0,t.height)}}),t.exports=function(t,e,n){void 0===e&&(e={});var a,s=new o(t,e=r.assign({},i,e)),u=[s];if(!n&&!t.collapsed)for(;a=u.shift();)if(!a.data.collapsed){var c=e.getChildren(a.data),l=c?c.length:0;if(a.children=new Array(l),c&&l)for(var f=0;f-1;)i.call(t,s,1);return t}},function(t,e,n){"use strict";var r=n(1),i=n(24);e.a=function(t,e){var n=[];if(!Object(r.a)(t))return n;for(var o=-1,a=[],s=t.length;++oe[r])return 1;if(t[r]n?n:t}},function(t,e,n){"use strict";e.a=function(t,e){var n=e.toString(),r=n.indexOf(".");if(-1===r)return Math.round(t);var i=n.substr(r+1).length;return i>20&&(i=20),parseFloat(t.toFixed(i))}},function(t,e,n){"use strict";var r=n(5);e.a=function(t){return Object(r.a)(t)&&t%1!=0}},function(t,e,n){"use strict";var r=n(5);e.a=function(t){return Object(r.a)(t)&&t%2==0}},function(t,e,n){"use strict";var r=n(5),i=Number.isInteger?Number.isInteger:function(t){return Object(r.a)(t)&&t%1==0};e.a=i},function(t,e,n){"use strict";var r=n(5);e.a=function(t){return Object(r.a)(t)&&t<0}},function(t,e,n){"use strict";e.a=function(t,e,n){return void 0===n&&(n=1e-5),Math.abs(t-e)0}},function(t,e,n){"use strict";var r=n(0),i=n(2);e.a=function(t,e){if(Object(r.a)(t)){for(var n,o=-1/0,a=0;ao&&(n=s,o=u)}return n}}},function(t,e,n){"use strict";var r=n(0),i=n(2);e.a=function(t,e){if(Object(r.a)(t)){for(var n,o=1/0,a=0;ae?(r&&(clearTimeout(r),r=null),s=c,a=t.apply(i,o),r||(i=o=null)):r||!1===n.trailing||(r=setTimeout(u,l)),a};return c.cancel=function(){clearTimeout(r),s=0,r=i=o=null},c}},function(t,e,n){"use strict";var r=n(1);e.a=function(t){return Object(r.a)(t)?Array.prototype.slice.call(t):[]}},function(t,e,n){"use strict";var r={};e.a=function(t){return r[t=t||"g"]?r[t]+=1:r[t]=1,t+r[t]}},function(t,e,n){"use strict";e.a=function(){}},function(t,e,n){"use strict";e.a=function(t){return t}},function(t,e,n){"use strict";e.a=function(t){return Object(r.a)(t)?0:Object(i.a)(t)?t.length:Object.keys(t).length};var r=n(7),i=n(1)},function(t,e,n){"use strict";e.a=function(){for(var t=0,e=0,n=arguments.length;ef&&u>f);)if(h.push(s),f-=u,!(l=l.substr(16)))return h.join("");for(;s=l.substr(0,1),!((u=Object(o.a)(s,n))+c>f);)if(h.push(s),f-=u,!(l=l.substr(1)))return h.join("");return""+h.join("")+a}},function(t,e,n){"use strict";var r=function(){function t(){this.map={}}return t.prototype.has=function(t){return void 0!==this.map[t]},t.prototype.get=function(t,e){var n=this.map[t];return void 0===n?e:n},t.prototype.set=function(t,e){this.map[t]=e},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(t){delete this.map[t]},t.prototype.size=function(){return Object.keys(this.map).length},t}();e.a=r},function(t,e){function n(t,e,n,r){void 0===r&&(r=[]);var i=this;i.w=t||0,i.h=e||0,i.y=n||0,i.x=0,i.c=r||[],i.cs=r.length,i.prelim=0,i.mod=0,i.shift=0,i.change=0,i.tl=null,i.tr=null,i.el=null,i.er=null,i.msel=0,i.mser=0}function r(t,e){var n=function t(e,n){var r=n?e.y:e.x;return e.children.forEach((function(e){r=Math.min(t(e,n),r)})),r}(t,e);!function t(e,n,r){r?e.y+=n:e.x+=n,e.children.forEach((function(e){t(e,n,r)}))}(t,-n,e)}n.fromNode=function(t,e){if(!t)return null;var r=[];return t.children.forEach((function(t){r.push(n.fromNode(t,e))})),e?new n(t.height,t.width,t.x,r):new n(t.width,t.height,t.y,r)},t.exports=function(t,e){void 0===e&&(e={});var i=e.isHorizontal;function o(t){0===t.cs?(t.el=t,t.er=t,t.msel=t.mser=0):(t.el=t.c[0].el,t.msel=t.c[0].msel,t.er=t.c[t.cs-1].er,t.mser=t.c[t.cs-1].mser)}function a(t,e,n){for(var r=t.c[e-1],i=r.mod,o=t.c[e],a=o.mod;null!==r&&null!==o;){l(r)>n.low&&(n=n.nxt);var f=i+r.prelim+r.w-(a+o.prelim);f>0&&(a+=f,s(t,e,n.index,f));var h=l(r),d=l(o);h<=d&&null!==(r=c(r))&&(i+=r.mod),h>=d&&null!==(o=u(o))&&(a+=o.mod)}!r&&o?function(t,e,n,r){var i=t.c[0].el;i.tl=n;var o=r-n.mod-t.c[0].msel;i.mod+=o,i.prelim-=o,t.c[0].el=t.c[e].el,t.c[0].msel=t.c[e].msel}(t,e,o,a):r&&!o&&function(t,e,n,r){var i=t.c[e].er;i.tr=n;var o=r-n.mod-t.c[e].mser;i.mod+=o,i.prelim-=o,t.c[e].er=t.c[e-1].er,t.c[e].mser=t.c[e-1].mser}(t,e,r,i)}function s(t,e,n,r){t.c[e].mod+=r,t.c[e].msel+=r,t.c[e].mser+=r,function(t,e,n,r){if(n!==e-1){var i=e-n;t.c[n+1].shift+=r/i,t.c[e].shift-=r/i,t.c[e].change-=r-r/i}}(t,e,n,r)}function u(t){return 0===t.cs?t.tl:t.c[0]}function c(t){return 0===t.cs?t.tr:t.c[t.cs-1]}function l(t){return t.y+t.h}function f(t,e,n){for(;null!==n&&t>=n.low;)n=n.nxt;return{low:t,index:e,nxt:n}}!function t(e,n,r){void 0===r&&(r=0),n?(e.x=r,r+=e.width):(e.y=r,r+=e.height),e.children.forEach((function(e){t(e,n,r)}))}(t,i);var h=n.fromNode(t,i);return function t(e){if(0!==e.cs){t(e.c[0]);for(var n=f(l(e.c[0].el),0,null),r=1;ra&&(a=e.depth);var n=e.children,r=n.length,o=new i(e.height,[]);return n.forEach((function(e,n){var i=t(e);o.children.push(i),0===n&&(o.leftChild=i),n===r-1&&(o.rightChild=i)})),o.originNode=e,o.isLeaf=e.isLeaf(),o}(t);return function t(e){if(e.isLeaf||0===e.children.length)e.drawingDepth=a;else{var n=e.children.map((function(e){return t(e)})),r=Math.min.apply(null,n);e.drawingDepth=r-1}return e.drawingDepth}(s),function t(r){r.x=r.drawingDepth*e.rankSep,r.isLeaf?(r.y=0,n&&(r.y=n.y+n.height+e.nodeSep,r.originNode.parent!==n.originNode.parent&&(r.y+=e.subTreeSep)),n=r):(r.children.forEach((function(e){t(e)})),r.y=(r.leftChild.y+r.rightChild.y)/2)}(s),function t(e,n,r){r?(n.x=e.x,n.y=e.y):(n.x=e.y,n.y=e.x),e.children.forEach((function(e,i){t(e,n.children[i],r)}))}(s,t,e.isHorizontal),t}},function(t,e,n){function r(t,e){return(r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var i=n(11),o=n(123),a=n(35),s=n(6),u=["LR","RL","H"],c=u[0],l=function(t){var e,n;function i(){return t.apply(this,arguments)||this}return n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,r(e,n),i.prototype.execute=function(){var t=this.options,e=this.rootNode;t.isHorizontal=!0;var n=t.indent,r=void 0===n?20:n,i=t.dropCap,s=void 0===i||i,l=t.direction,f=void 0===l?c:l,h=t.align;if(f&&-1===u.indexOf(f))throw new TypeError("Invalid direction: "+f);if(f===u[0])o(e,r,s,h);else if(f===u[1])o(e,r,s,h),e.right2left();else if(f===u[2]){var d=a(e,t),p=d.left,g=d.right;o(p,r,s,h),p.right2left(),o(g,r,s,h);var v=p.getBoundingBox();g.translate(v.width,0),e.x=g.x-e.width/2}return e},i}(i),f={};t.exports=function(t,e){return e=s.assign({},f,e),new l(t,e).execute()}},function(t,e,n){var r=n(6);t.exports=function(t,e,n,i){var o=null;t.eachNode((function(t){!function(t,e,n,i,o){var a="function"==typeof n?n(t):n*t.depth;if(!i)try{if(t.id===t.parent.children[0].id)return t.x+=a,void(t.y=e?e.y:0)}catch(t){}if(t.x+=a,e){if(t.y=e.y+r.getHeight(e,t,o),e.parent&&t.parent.id!==e.parent.id){var s=e.parent,u=s.y+r.getHeight(s,t,o);t.y=u>t.y?u:t.y}}else t.y=0}(t,o,e,n,i),o=t}))}},function(t,e,n){function r(t,e){return(r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var i=n(11),o=n(125),a=n(17),s=n(6),u=function(t){var e,n;function i(){return t.apply(this,arguments)||this}return n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,r(e,n),i.prototype.execute=function(){return a(this.rootNode,this.options,o)},i}(i),c={};t.exports=function(t,e){return e=s.assign({},c,e),new u(t,e).execute()}},function(t,e,n){var r=n(6),i={getSubTreeSep:function(){return 0}};t.exports=function(t,e){void 0===e&&(e={}),e=r.assign({},i,e),t.parent={x:0,width:0,height:0,y:0},t.BFTraverse((function(t){t.x=t.parent.x+t.parent.width})),t.parent=null,function t(e,n){var r=0;return e.children.length?e.children.forEach((function(e){r+=t(e,n)})):r=e.height,e._subTreeSep=n.getSubTreeSep(e.data),e.totalHeight=Math.max(e.height,r)+2*e._subTreeSep,e.totalHeight}(t,e),t.startY=0,t.y=t.totalHeight/2-t.height/2,t.eachNode((function(t){var e=t.children,n=e.length;if(n){var r=e[0];if(r.startY=t.startY+t._subTreeSep,1===n)r.y=t.y+t.height/2-r.height/2;else{r.y=r.startY+r.totalHeight/2-r.height/2;for(var i=1;ie.height)e.y=i.y+a/2-e.height/2;else if(1!==n.length||e.height>s){var u=e.y+(e.height-a)/2-i.y;n.forEach((function(t){t.translate(0,u)}))}else e.y=(i.y+i.height/2+o.y+o.height/2)/2-e.height/2}}(t)}}])},"object"===a(e)&&"object"===a(t)?t.exports=o():(r=[],void 0===(i="function"==typeof(n=o)?n.apply(e,r):n)||(t.exports=i))}).call(this,n(100)(t))},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=n(146),o=n(150),a=[].slice,s=["keyword","gray","hex"],u={};Object.keys(o).forEach((function(t){u[a.call(o[t].labels).sort().join("")]=t}));var c={};function l(t,e){if(!(this instanceof l))return new l(t,e);if(e&&e in s&&(e=null),e&&!(e in o))throw new Error("Unknown model: "+e);var n,r;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof l)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"==typeof t){var f=i.get(t);if(null===f)throw new Error("Unable to parse color from string: "+t);this.model=f.model,r=o[this.model].channels,this.color=f.value.slice(0,r),this.valpha="number"==typeof f.value[r]?f.value[r]:1}else if(t.length){this.model=e||"rgb",r=o[this.model].channels;var h=a.call(t,0,r);this.color=p(h,r),this.valpha="number"==typeof t[r]?t[r]:1}else if("number"==typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var d=Object.keys(t);"alpha"in t&&(d.splice(d.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);var g=d.sort().join("");if(!(g in u))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=u[g];var v=o[this.model].labels,y=[];for(n=0;nn?(e+.05)/(n+.05):(n+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten:function(t){var e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken:function(t){var e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate:function(t){var e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate:function(t){var e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten:function(t){var e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken:function(t){var e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale:function(){var t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return l.rgb(e,e,e)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var e=this.hsl(),n=e.color[0];return n=(n=(n+t)%360)<0?360+n:n,e.color[0]=n,e},mix:function(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+r(t));var n=t.rgb(),i=this.rgb(),o=void 0===e?.5:e,a=2*o-1,s=n.alpha()-i.alpha(),u=((a*s==-1?a:(a+s)/(1+a*s))+1)/2,c=1-u;return l.rgb(u*n.red()+c*i.red(),u*n.green()+c*i.green(),u*n.blue()+c*i.blue(),n.alpha()*o+i.alpha()*(1-o))}},Object.keys(o).forEach((function(t){if(-1===s.indexOf(t)){var e=o[t].channels;l.prototype[t]=function(){if(this.model===t)return new l(this);if(arguments.length)return new l(arguments,t);var n="number"==typeof arguments[e]?e:this.valpha;return new l(d(o[this.model][t].raw(this.color)).concat(n),t)},l[t]=function(n){return"number"==typeof n&&(n=p(a.call(arguments),e)),new l(n,t)}}})),t.exports=l},function(t,e){function n(e){return t.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(5);function i(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function o(t,e){return i(t)*i(e)?(t[0]*e[0]+t[1]*e[1])/(i(t)*i(e)):1}function a(t,e){return(t[0]*e[1]1&&(n*=Math.sqrt(v),i*=Math.sqrt(v));var y=n*n*(g*g)+i*i*(p*p),m=y?Math.sqrt((n*n*(i*i)-y)/y):1;u===c&&(m*=-1),isNaN(m)&&(m=0);var b=i?m*n*g/i:0,x=n?m*-i*p/n:0,w=(l+h)/2+Math.cos(s)*b-Math.sin(s)*x,_=(f+d)/2+Math.sin(s)*b+Math.cos(s)*x,E=[(p-b)/n,(g-x)/i],S=[(-1*p-b)/n,(-1*g-x)/i],M=a([1,0],E),O=a(E,S);return o(E,S)<=-1&&(O=Math.PI),o(E,S)>=1&&(O=0),0===c&&O>0&&(O-=2*Math.PI),1===c&&O<0&&(O+=2*Math.PI),{cx:w,cy:_,rx:Object(r.j)(t,[h,d])?0:n,ry:Object(r.j)(t,[h,d])?0:i,startAngle:M,endAngle:M+O,xRotation:s,arcFlag:u,sweepFlag:c}}},function(t,e,n){var r,i,o;function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}o=function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}var e=/^\s+/,n=/\s+$/;function r(i,o){if(o=o||{},(i=i||"")instanceof r)return i;if(!(this instanceof r))return new r(i,o);var a=function(r){var i,o,a,s={r:0,g:0,b:0},u=1,c=null,l=null,f=null,h=!1,d=!1;return"string"==typeof r&&(r=function(t){t=t.replace(e,"").replace(n,"").toLowerCase();var r,i=!1;if(x[t])t=x[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};return(r=N.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=N.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=N.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=N.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=N.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=N.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=N.hex8.exec(t))?{r:M(r[1]),g:M(r[2]),b:M(r[3]),a:C(r[4]),format:i?"name":"hex8"}:(r=N.hex6.exec(t))?{r:M(r[1]),g:M(r[2]),b:M(r[3]),format:i?"name":"hex"}:(r=N.hex4.exec(t))?{r:M(r[1]+""+r[1]),g:M(r[2]+""+r[2]),b:M(r[3]+""+r[3]),a:C(r[4]+""+r[4]),format:i?"name":"hex8"}:!!(r=N.hex3.exec(t))&&{r:M(r[1]+""+r[1]),g:M(r[2]+""+r[2]),b:M(r[3]+""+r[3]),format:i?"name":"hex"}}(r)),"object"==t(r)&&(P(r.r)&&P(r.g)&&P(r.b)?(i=r.r,o=r.g,a=r.b,s={r:255*E(i,255),g:255*E(o,255),b:255*E(a,255)},h=!0,d="%"===String(r.r).substr(-1)?"prgb":"rgb"):P(r.h)&&P(r.s)&&P(r.v)?(c=k(r.s),l=k(r.v),s=function(t,e,n){t=6*E(t,360),e=E(e,100),n=E(n,100);var r=Math.floor(t),i=t-r,o=n*(1-e),a=n*(1-i*e),s=n*(1-(1-i)*e),u=r%6;return{r:255*[n,a,o,o,s,n][u],g:255*[s,n,n,a,o,o][u],b:255*[o,o,s,n,n,a][u]}}(r.h,c,l),h=!0,d="hsv"):P(r.h)&&P(r.s)&&P(r.l)&&(c=k(r.s),f=k(r.l),s=function(t,e,n){var r,i,o;function a(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}if(t=E(t,360),e=E(e,100),n=E(n,100),0===e)r=i=o=n;else{var s=n<.5?n*(1+e):n+e-n*e,u=2*n-s;r=a(u,s,t+1/3),i=a(u,s,t),o=a(u,s,t-1/3)}return{r:255*r,g:255*i,b:255*o}}(r.h,c,f),h=!0,d="hsl"),r.hasOwnProperty("a")&&(u=r.a)),u=_(u),{ok:h,format:r.format||d,r:Math.min(255,Math.max(s.r,0)),g:Math.min(255,Math.max(s.g,0)),b:Math.min(255,Math.max(s.b,0)),a:u}}(i);this._originalInput=i,this._r=a.r,this._g=a.g,this._b=a.b,this._a=a.a,this._roundA=Math.round(100*this._a)/100,this._format=o.format||a.format,this._gradientType=o.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=a.ok}function i(t,e,n){t=E(t,255),e=E(e,255),n=E(n,255);var r,i,o=Math.max(t,e,n),a=Math.min(t,e,n),s=(o+a)/2;if(o==a)r=i=0;else{var u=o-a;switch(i=s>.5?u/(2-o-a):u/(o+a),o){case t:r=(e-n)/u+(e>1)+720)%360;--e;)i.h=(i.h+o)%360,a.push(r(i));return a}function b(t,e){e=e||6;for(var n=r(t).toHsv(),i=n.h,o=n.s,a=n.v,s=[],u=1/e;e--;)s.push(r({h:i,s:o,v:a})),a=(a+u)%1;return s}r.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,n,r=this.toRgb();return t=r.r/255,e=r.g/255,n=r.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))},setAlpha:function(t){return this._a=_(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=o(this._r,this._g,this._b),e=Math.round(360*t.h),n=Math.round(100*t.s),r=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=i(this._r,this._g,this._b),e=Math.round(360*t.h),n=Math.round(100*t.s),r=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return a(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,n,r,i){var o=[O(Math.round(t).toString(16)),O(Math.round(e).toString(16)),O(Math.round(n).toString(16)),O(A(r))];return i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*E(this._r,255))+"%",g:Math.round(100*E(this._g,255))+"%",b:Math.round(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*E(this._r,255))+"%, "+Math.round(100*E(this._g,255))+"%, "+Math.round(100*E(this._b,255))+"%)":"rgba("+Math.round(100*E(this._r,255))+"%, "+Math.round(100*E(this._g,255))+"%, "+Math.round(100*E(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(w[a(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+s(this._r,this._g,this._b,this._a),n=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var o=r(t);n="#"+s(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return r(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(h,arguments)},darken:function(){return this._applyModification(d,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(c,arguments)},greyscale:function(){return this._applyModification(l,arguments)},spin:function(){return this._applyModification(p,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(g,arguments)},monochromatic:function(){return this._applyCombination(b,arguments)},splitcomplement:function(){return this._applyCombination(y,arguments)},triad:function(){return this._applyCombination(v,[3])},tetrad:function(){return this._applyCombination(v,[4])}},r.fromRatio=function(e,n){if("object"==t(e)){var i={};for(var o in e)e.hasOwnProperty(o)&&(i[o]="a"===o?e[o]:k(e[o]));e=i}return r(e,n)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},r.mix=function(t,e,n){n=0===n?0:n||50;var i=r(t).toRgb(),o=r(e).toRgb(),a=n/100;return r({r:(o.r-i.r)*a+i.r,g:(o.g-i.g)*a+i.g,b:(o.b-i.b)*a+i.b,a:(o.a-i.a)*a+i.a})},r.readability=function(t,e){var n=r(t),i=r(e);return(Math.max(n.getLuminance(),i.getLuminance())+.05)/(Math.min(n.getLuminance(),i.getLuminance())+.05)},r.isReadable=function(t,e,n){var i,o,a,s,u,c=r.readability(t,e);switch(o=!1,(a=n,s=((a=a||{level:"AA",size:"small"}).level||"AA").toUpperCase(),u=(a.size||"small").toLowerCase(),"AA"!==s&&"AAA"!==s&&(s="AA"),"small"!==u&&"large"!==u&&(u="small"),i={level:s,size:u}).level+i.size){case"AAsmall":case"AAAlarge":o=c>=4.5;break;case"AAlarge":o=c>=3;break;case"AAAsmall":o=c>=7}return o},r.mostReadable=function(t,e,n){var i,o,a,s,u=null,c=0;o=(n=n||{}).includeFallbackColors,a=n.level,s=n.size;for(var l=0;lc&&(c=i,u=r(e[l]));return r.isReadable(t,u,{level:a,size:s})||!o?u:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var x=r.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},w=r.hexNames=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}(x);function _(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function E(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var n=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function S(t){return Math.min(1,Math.max(0,t))}function M(t){return parseInt(t,16)}function O(t){return 1==t.length?"0"+t:""+t}function k(t){return t<=1&&(t=100*t+"%"),t}function A(t){return Math.round(255*parseFloat(t)).toString(16)}function C(t){return M(t)/255}var j,I,T,N=(I="[\\s|\\(]+("+(j="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+j+")[,|\\s]+("+j+")\\s*\\)?",T="[\\s|\\(]+("+j+")[,|\\s]+("+j+")[,|\\s]+("+j+")[,|\\s]+("+j+")\\s*\\)?",{CSS_UNIT:new RegExp(j),rgb:new RegExp("rgb"+I),rgba:new RegExp("rgba"+T),hsl:new RegExp("hsl"+I),hsla:new RegExp("hsla"+T),hsv:new RegExp("hsv"+I),hsva:new RegExp("hsva"+T),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function P(t){return!!N.CSS_UNIT.exec(t)}return r},"object"===a(e)&&void 0!==t?t.exports=o():void 0===(i="function"==typeof(r=o)?r.call(e,n,e,t):r)||(t.exports=i)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function(t,e){var n=t.nodes,r=t.edges,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach((function(t,e){o[t.id]=e;i.push([])})),r&&r.forEach((function(t){var n=t.source,r=t.target,a=o[n],s=o[r];!a&&0!==a||!s&&0!==s||(i[a][s]=1,e||(i[s][a]=1))})),i};e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FORCE_LAYOUT_TYPE_MAP=e.LAYOUT_MESSAGE=void 0,e.LAYOUT_MESSAGE={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"},e.FORCE_LAYOUT_TYPE_MAP={gForce:!0,force2:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0}},function(t,e,n){"use strict";n.r(e),n.d(e,"Graph",(function(){return E})),n.d(e,"GraphWithEvent",(function(){return N})),n.d(e,"algorithm",(function(){return r})),n.d(e,"comparision",(function(){return o})),n.d(e,"essence",(function(){return i})),n.d(e,"generate",(function(){return s}));var r={};n.r(r),n.d(r,"components",(function(){return B})),n.d(r,"dfs",(function(){return F})),n.d(r,"dijkstra",(function(){return X})),n.d(r,"dijkstraAll",(function(){return W})),n.d(r,"findCycles",(function(){return H})),n.d(r,"tarjan",(function(){return V})),n.d(r,"isAcyclic",(function(){return ot})),n.d(r,"postorder",(function(){return at})),n.d(r,"preorder",(function(){return st})),n.d(r,"prim",(function(){return R})),n.d(r,"topsort",(function(){return it})),n.d(r,"floydWarshall",(function(){return ct}));var i={};n.r(i),n.d(i,"isGraph",(function(){return wt})),n.d(i,"isSimpleGraph",(function(){return _t})),n.d(i,"isNullGraph",(function(){return Et})),n.d(i,"hasSelfLoop",(function(){return St}));var o={};n.r(o),n.d(o,"containAllSameEdges",(function(){return vt})),n.d(o,"containAllSameNodes",(function(){return gt})),n.d(o,"containSameEdges",(function(){return ft})),n.d(o,"containSameNodes",(function(){return lt})),n.d(o,"isGraphComplement",(function(){return Mt})),n.d(o,"isGraphOptionSame",(function(){return pt})),n.d(o,"getSameEdges",(function(){return dt})),n.d(o,"getSameNodes",(function(){return ht})),n.d(o,"isGraphSame",(function(){return yt})),n.d(o,"isGraphContainsAnother",(function(){return mt}));var a,s={};function u(t,e){var n=t.get(e)||0;t.set(e,n+1)}function c(t,e){var n=t.get(e);void 0!==n&&((n-=1)>0?t.set(e,n):t.delete(e))}function l(t,e,n,r){var i=String(e),o=String(n);if(!t&&i>o){var s=i;i=o,o=s}return i+a.EDGE_KEY_DELIM+o+a.EDGE_KEY_DELIM+(void 0===r?a.DEFAULT_EDGE_NAME:r)}function f(t,e,n,r){var i=String(e),o=String(n),a={v:e,w:n};if(!t&&i>o){var s=a.v;a.v=a.w,a.w=s}return void 0!==r&&(a.name=r),a}function h(t,e){return l(t,e.v,e.w,e.name)}function d(t){return"function"==typeof t}n.r(s),n.d(s,"getGraphComplement",(function(){return Ot})),function(t){t.DEFAULT_EDGE_NAME="\0",t.GRAPH_NODE="\0",t.EDGE_KEY_DELIM=""}(a||(a={}));var p=function(t){return t.nodes().map((function(e){var n={id:e,value:t.node(e),parent:t.parent(e)};return void 0===n.value&&delete n.value,void 0===n.parent&&delete n.parent,n}))},g=function(t){return t.edges().map((function(e){var n=t.edge(e),r={v:e.v,w:e.w,value:n,name:e.name};return void 0===r.name&&delete r.name,void 0===r.value&&delete r.value,r}))},v=function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:p(t),edges:g(t),value:t.graph()};return void 0===e.value&&delete e.value,e};function y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function m(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};x(this,t),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=a.GRAPH_NODE,this.label=void 0,this.nodeCountNum=0,this.edgeCountNum=0,this.defaultNodeLabelFn=function(){},this.defaultEdgeLabelFn=function(){},this.parentMap=void 0,this.childrenMap=void 0,this.nodesLabelMap=new Map,this.inEdgesMap=new Map,this.outEdgesMap=new Map,this.predecessorsMap=new Map,this.successorsMap=new Map,this.edgesMap=new Map,this.edgesLabelsMap=new Map,this.isDirected=function(){return e.directed},this.isMultigraph=function(){return e.multigraph},this.isCompound=function(){return e.compound},this.setGraph=function(t){return e.label=t,e},this.graph=function(){return e.label},this.setDefaultNodeLabel=function(t){return d(t)?e.defaultNodeLabelFn=t:e.defaultNodeLabelFn=function(){return t},e},this.nodeCount=function(){return e.nodeCountNum},this.node=function(t){return e.nodesLabelMap.get(t)},this.nodes=function(){return Array.from(e.nodesLabelMap.keys())},this.sources=function(){return e.nodes().filter((function(t){var n;return!(null===(n=e.inEdgesMap.get(t))||void 0===n?void 0:n.size)}))},this.sinks=function(){return e.nodes().filter((function(t){var n;return!(null===(n=e.outEdgesMap.get(t))||void 0===n?void 0:n.size)}))},this.setNodes=function(t,n){return t.map((function(t){return e.setNode(t,n)})),e},this.hasNode=function(t){return e.nodesLabelMap.has(t)},this.checkCompound=function(){if(!e.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(t){if(e.isCompound()){var n,r=null===(n=e.parentMap)||void 0===n?void 0:n.get(t);if(r!==e.GRAPH_NODE)return r}},this.removeFromParentsChildList=function(t){var n=e.parentMap.get(t);e.childrenMap.get(n).delete(t)},this.setParent=function(t,n){var r,i;e.checkCompound();for(var o=void 0===n?e.GRAPH_NODE:n,a=e.parent(o);a;){if(t===a)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");a=e.parent(a)}n&&e.setNode(n),e.setNode(t),e.removeFromParentsChildList(t),null===(r=e.parentMap)||void 0===r||r.set(t,o);var s=e.childrenMap.get(o);return s.set(t,!0),null===(i=e.childrenMap)||void 0===i||i.set(o,s),e},this.children=function(t){var n=void 0===t?e.GRAPH_NODE:t;if(e.isCompound()){var r,i=null===(r=e.childrenMap)||void 0===r?void 0:r.get(n);return i?Array.from(i.keys()):void 0}return n===e.GRAPH_NODE?e.nodes():t&&e.hasNode(t)?[]:void 0},this.predecessors=function(t){var n=e.predecessorsMap.get(t);return n?Array.from(n.keys()):void 0},this.successors=function(t){var n=e.successorsMap.get(t);return n?Array.from(n.keys()):void 0},this.neighbors=function(t){var n;if(e.hasNode(t))return Array.from(new Set(null===(n=e.predecessors(t))||void 0===n?void 0:n.concat(e.successors(t))))},this.isLeaf=function(t){var n,r;return e.isDirected()?!(null===(r=e.successors(t))||void 0===r?void 0:r.length):!(null===(n=e.neighbors(t))||void 0===n?void 0:n.length)},this.filterNodes=function(n){var r=e.directed,i=e.multigraph,o=e.compound,a=new t({directed:r,multigraph:i,compound:o});if(a.setGraph(e.graph()),e.nodes().forEach((function(t){n(t)&&a.setNode(t,e.node(t))})),e.edges().forEach((function(t){a.hasNode(t.v)&&a.hasNode(t.w)&&a.setEdgeObj(t,e.edge(t))})),o){a.nodes().forEach((function(t){a.setParent(t,function(t){for(var n=e.parent(t);void 0!==n&&!a.hasNode(n);)n=e.parent(n);return n}(t))}))}return a},this.setDefaultEdgeLabel=function(t){return d(t)?e.defaultEdgeLabelFn=t:e.defaultEdgeLabelFn=function(){return t},e},this.edgeCount=function(){return e.edgeCountNum},this.setEdgeObj=function(t,n){return e.setEdge(t.v,t.w,n,t.name)},this.setPath=function(t,n){return t.reduce((function(t,r){return e.setEdge(t,r,n),r})),e},this.edgeFromArgs=function(t,n,r){return e.edge({v:t,w:n,name:r})},this.edge=function(t){return e.edgesLabelsMap.get(h(e.isDirected(),t))},this.hasEdge=function(t,n,r){return e.edgesLabelsMap.has(h(e.isDirected(),{v:t,w:n,name:r}))},this.removeEdgeObj=function(t){var n=t.v,r=t.w,i=t.name;return e.removeEdge(n,r,i)},this.edges=function(){return Array.from(e.edgesMap.values())},this.inEdges=function(t,n){var r=e.inEdgesMap.get(t);if(r)return Array.from(r.values()).filter((function(t){return!n||t.v===n}))},this.outEdges=function(t,n){var r=e.outEdgesMap.get(t);if(r)return Array.from(r.values()).filter((function(t){return!n||t.w===n}))},this.nodeEdges=function(t,n){var r;if(e.hasNode(t))return null===(r=e.inEdges(t,n))||void 0===r?void 0:r.concat(e.outEdges(t,n))},this.toJSON=function(){return v(e)},this.nodeInDegree=function(t){var n=e.inEdgesMap.get(t);return n?n.size:0},this.nodeOutDegree=function(t){var n=e.outEdgesMap.get(t);return n?n.size:0},this.nodeDegree=function(t){return e.nodeInDegree(t)+e.nodeOutDegree(t)},this.source=function(t){return t.v},this.target=function(t){return t.w};var r=m(m({},_),n);this.compound=r.compound,this.directed=r.directed,this.multigraph=r.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}var e,n,r;return e=t,(n=[{key:"setNode",value:function(t,e){var n,r=this.nodesLabelMap,i=this.defaultNodeLabelFn,o=this.isCompound,a=this.parentMap,s=this.childrenMap,u=this.inEdgesMap,c=this.outEdgesMap,l=this.predecessorsMap,f=this.successorsMap;return r.has(t)?(void 0!==e&&r.set(t,e),this):(r.set(t,e||i(t)),o()&&(null==a||a.set(t,this.GRAPH_NODE),null==s||s.set(t,new Map),(null==s?void 0:s.has(this.GRAPH_NODE))||null==s||s.set(this.GRAPH_NODE,new Map),null==s||null===(n=s.get(this.GRAPH_NODE))||void 0===n||n.set(t,!0)),[u,c,l,f].forEach((function(e){return e.set(t,new Map)})),this.nodeCountNum+=1,this)}},{key:"removeNode",value:function(t){var e=this;if(this.hasNode(t)){var n,r,i,o=function(t){e.removeEdge(t.v,t.w,t.name)},a=this.inEdgesMap,s=this.outEdgesMap,u=this.predecessorsMap,c=this.successorsMap,l=this.nodesLabelMap;this.isCompound()&&(this.removeFromParentsChildList(t),null===(n=this.parentMap)||void 0===n||n.delete(t),null===(r=this.children(t))||void 0===r||r.forEach((function(t){return e.setParent(t)})),null===(i=this.childrenMap)||void 0===i||i.delete(t));var f=a.get(t),h=s.get(t);Array.from(f.values()).forEach((function(t){return o(t)})),Array.from(h.values()).forEach((function(t){return o(t)})),l.delete(t),a.delete(t),s.delete(t),u.delete(t),c.delete(t),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(t,e,n,r){var i,o,a=f(this.isDirected(),t,e,r),s=h(this.isDirected(),a),c=a.v,l=a.w;if(this.edgesLabelsMap.has(s))return this.edgesLabelsMap.set(s,n),this;if(void 0!==r&&!this.isMultigraph())throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(l),this.edgesLabelsMap.set(s,n||this.defaultEdgeLabelFn(c,l,r)),Object.freeze(a),this.edgesMap.set(s,a);var d=this.predecessorsMap.get(l),p=this.successorsMap.get(c);return u(d,c),u(p,l),null===(i=this.inEdgesMap.get(l))||void 0===i||i.set(s,a),null===(o=this.outEdgesMap.get(c))||void 0===o||o.set(s,a),this.edgeCountNum+=1,this}},{key:"removeEdge",value:function(t,e,n){var r=l(this.isDirected(),t,e,n);if(this.edgesMap.get(r)){var i=f(this.isDirected(),t,e,n),o=i.v,a=i.w;this.edgesLabelsMap.delete(r),this.edgesMap.delete(r);var s=this.predecessorsMap.get(a),u=this.successorsMap.get(o);c(s,o),c(u,a),this.inEdgesMap.get(a).delete(r),this.outEdgesMap.get(o).delete(r),this.edgeCountNum-=1}return this}}])&&w(e.prototype,n),r&&w(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function S(t){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function M(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function O(t,e){for(var n=0;n-1&&this.eventPool[t].splice(n,1)}}},{key:"emitEvent",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r>1])||void 0===a?void 0:a.priority)e.arr[r].priority)throw new Error("New priority is greater than current priority.Key: ".concat(t," Old: + ").concat(e.arr[r].priority," New: ").concat(n));e.arr[r].priority=n,e.innerDecrease(r)}})),R=function(t,e){var n,r=new E,i=new Map,o=new L;function a(t){var r=t.v===n?t.w:t.v,a=o.priority(r);if(void 0!==a){var s=e(t);s0;){var u;if(n=o.removeMin(),i.has(n))r.setEdge(n,i.get(n));else{if(s)throw new Error("Input graph is not connected: "+t.graph());s=!0}null===(u=t.nodeEdges(n))||void 0===u||u.forEach(a)}return r},B=function(t){var e=new Set,n=[];return t.nodes().forEach((function(r){for(var i=[],o=[r];o.length>0;){var a,s,u=o.pop();if(!e.has(u))e.add(u),i.push(u),null===(a=t.successors(u))||void 0===a||a.forEach((function(t){return o.push(t)})),null===(s=t.predecessors(u))||void 0===s||s.forEach((function(t){return o.push(t)}))}i.length&&n.push(i)})),n},F=function(t,e,n){var r=Array.isArray(e)?e:[e],i=function(e){return t.isDirected()?t.successors(e):t.neighbors(e)},o=[],a=[];return r.forEach((function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);!function t(e,n,r,i,o,a){i.includes(n)||(i.push(n),r||a.push(n),o(n).forEach((function(n){return t(e,n,r,i,o,a)})),r&&a.push(n))}(t,e,"post"===n,a,i,o)})),o};function z(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&(i=s.removeMin(),!(o=a.get(i))||o.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(u);var c={};return Array.from(a.entries()).forEach((function(t){var e=z(t,2),n=e[0],r=e[1];return c[String(n)]=r,c})),c},X=function(t,e,n,r){return U(t,e,n||Y,r||function(e){return t.outEdges(e)})},W=function(t,e,n){var r={};return t.nodes().forEach((function(i){return r[String(i)]=X(t,i,e,n),r})),r},V=function(t){var e=0,n=[],r=new Map,i=[];return t.nodes().forEach((function(o){r.has(o)||function o(a){var s,u={onStack:!0,lowlink:e,index:e};if(r.set(a,u),e+=1,n.push(a),null===(s=t.successors(a))||void 0===s||s.forEach((function(t){var e;if(r.has(t)){if(null===(e=r.get(t))||void 0===e?void 0:e.onStack){var n=r.get(t);u.lowlink=Math.min(u.lowlink,n.index)}}else{o(t);var i=r.get(t);u.lowlink=Math.min(u.lowlink,i.lowlink)}})),u.lowlink===u.index){var c,l=[];do{c=n.pop(),r.get(c).onStack=!1,l.push(c)}while(a!==c);i.push(l)}}(o)})),i},H=function(t){return V(t).filter((function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))};function q(t){return(q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Z(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n0)}));return i.length>0?Object(o.a)(i,(function(i){var o=i.getBBox(),a=o.minX,s=o.maxX,u=o.minY,c=o.maxY;ae&&(e=s),ur&&(r=c)})):(t=0,e=0,n=0,r=0),{x:t,y:n,minX:t,minY:n,maxX:e,maxY:r,width:e-t,height:r-n}},e.prototype.getCanvasBBox=function(){var t=1/0,e=-1/0,n=1/0,r=-1/0,i=this.getChildren().filter((function(t){return t.get("visible")&&(!t.isGroup()||t.isGroup()&&t.getChildren().length>0)}));return i.length>0?Object(o.a)(i,(function(i){var o=i.getCanvasBBox(),a=o.minX,s=o.maxX,u=o.minY,c=o.maxY;ae&&(e=s),ur&&(r=c)})):(t=0,e=0,n=0,r=0),{x:t,y:n,minX:t,minY:n,maxX:e,maxY:r,width:e-t,height:r-n}},e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.children=[],e},e.prototype.onAttrChange=function(e,n,r){if(t.prototype.onAttrChange.call(this,e,n,r),"matrix"===e){var i=this.getTotalMatrix();this._applyChildrenMarix(i)}},e.prototype.applyMatrix=function(e){var n=this.getTotalMatrix();t.prototype.applyMatrix.call(this,e);var r=this.getTotalMatrix();r!==n&&this._applyChildrenMarix(r)},e.prototype._applyChildrenMarix=function(t){var e=this.getChildren();Object(o.a)(e,(function(e){e.applyMatrix(t)}))},e.prototype.addShape=function(){for(var t=[],e=0;e=0;a--){var s=t[a];if(Object(o.b)(s)&&(s.isGroup()?i=s.getShape(e,n,r):s.isHit(e,n)&&(i=s)),i)break}return i},e.prototype.add=function(t){var e=this.getCanvas(),n=this.getChildren(),r=this.get("timeline"),i=t.getParent();i&&function(t,e,n){void 0===n&&(n=!0),n?e.destroy():(e.set("parent",null),e.set("canvas",null)),Object(o.j)(t.getChildren(),e)}(i,t,!1),t.set("parent",this),e&&function t(e,n){if(e.set("canvas",n),e.isGroup()){var r=e.get("children");r.length&&r.forEach((function(e){t(e,n)}))}}(t,e),r&&function t(e,n){if(e.set("timeline",n),e.isGroup()){var r=e.get("children");r.length&&r.forEach((function(e){t(e,n)}))}}(t,r),n.push(t),t.onCanvasChange("add"),this._applyElementMatrix(t)},e.prototype._applyElementMatrix=function(t){var e=this.getTotalMatrix();e&&t.applyMatrix(e)},e.prototype.getChildren=function(){return this.get("children")},e.prototype.sort=function(){var t,e=this.getChildren();Object(o.a)(e,(function(t,e){return t._INDEX=e,t})),e.sort((t=function(t,e){return t.get("zIndex")-e.get("zIndex")},function(e,n){var r=t(e,n);return 0===r?e._INDEX-n._INDEX:r})),this.onCanvasChange("sort")},e.prototype.clear=function(){if(this.set("clearing",!0),!this.destroyed){for(var t=this.getChildren(),e=t.length-1;e>=0;e--)t[e].destroy();this.set("children",[]),this.onCanvasChange("clear"),this.set("clearing",!1)}},e.prototype.destroy=function(){this.get("destroyed")||(this.clear(),t.prototype.destroy.call(this))},e.prototype.getFirst=function(){return this.getChildByIndex(0)},e.prototype.getLast=function(){var t=this.getChildren();return this.getChildByIndex(t.length-1)},e.prototype.getChildByIndex=function(t){return this.getChildren()[t]},e.prototype.getCount=function(){return this.getChildren().length},e.prototype.contain=function(t){return this.getChildren().indexOf(t)>-1},e.prototype.removeChild=function(t,e){void 0===e&&(e=!0),this.contain(t)&&t.remove(e)},e.prototype.findAll=function(t){var e=[],n=this.getChildren();return Object(o.a)(n,(function(n){t(n)&&e.push(n),n.isGroup()&&(e=e.concat(n.findAll(t)))})),e},e.prototype.find=function(t){var e=null,n=this.getChildren();return Object(o.a)(n,(function(n){if(t(n)?e=n:n.isGroup()&&(e=n.find(t)),e)return!1})),e},e.prototype.findById=function(t){return this.find((function(e){return e.get("id")===t}))},e.prototype.findByClassName=function(t){return this.find((function(e){return e.get("className")===t}))},e.prototype.findAllByName=function(t){return this.findAll((function(e){return e.get("name")===t}))},e}(i.a);e.a=s},function(t,e,n){"use strict";var r=n(1),i=n(0),o=n(4),a=n(9),s=n(22),u=n(49),c=o.a.transform,l=["zIndex","capture","visible","type"],f=["repeat"];function h(t,e){var n={},r=e.attrs;for(var i in t)n[i]=r[i];return n}function d(t,e){var n={},r=e.attr();return Object(i.each)(t,(function(t,e){-1!==f.indexOf(e)||Object(i.isEqual)(r[e],t)||(n[e]=t)})),n}function p(t,e){if(e.onFrame)return t;var n=e.startTime,r=e.delay,o=e.duration,a=Object.prototype.hasOwnProperty;return Object(i.each)(t,(function(t){n+rt.delay&&Object(i.each)(e.toAttrs,(function(e,n){a.call(t.toAttrs,n)&&(delete t.toAttrs[n],delete t.fromAttrs[n])}))})),t}var g=function(t){function e(e){var n=t.call(this,e)||this;n.attrs={};var r=n.getDefaultAttrs();return Object(i.mix)(r,e.attrs),n.attrs=r,n.initAttrs(r),n.initAnimate(),n}return Object(r.__extends)(e,t),e.prototype.getDefaultCfg=function(){return{visible:!0,capture:!0,zIndex:0}},e.prototype.getDefaultAttrs=function(){return{matrix:this.getDefaultMatrix(),opacity:1}},e.prototype.onCanvasChange=function(t){},e.prototype.initAttrs=function(t){},e.prototype.initAnimate=function(){this.set("animable",!0),this.set("animating",!1)},e.prototype.isGroup=function(){return!1},e.prototype.getParent=function(){return this.get("parent")},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.attr=function(){for(var t,e=[],n=0;n0?r=p(r,_):n.addAnimator(this),r.push(_),this.set("animations",r),this.set("_pause",{isPaused:!1})}},e.prototype.stopAnimate=function(t){var e=this;void 0===t&&(t=!0);var n=this.get("animations");Object(i.each)(n,(function(n){t&&(n.onFrame?e.attr(n.onFrame(1)):e.attr(n.toAttrs)),n.callback&&n.callback()})),this.set("animating",!1),this.set("animations",[])},e.prototype.pauseAnimate=function(){var t=this.get("timeline"),e=this.get("animations"),n=t.getTime();return Object(i.each)(e,(function(t){t._paused=!0,t._pauseTime=n,t.pauseCallback&&t.pauseCallback()})),this.set("_pause",{isPaused:!0,pauseTime:n}),this},e.prototype.resumeAnimate=function(){var t=this.get("timeline").getTime(),e=this.get("animations"),n=this.get("_pause").pauseTime;return Object(i.each)(e,(function(e){e.startTime=e.startTime+(t-n),e._paused=!1,e._pauseTime=null,e.resumeCallback&&e.resumeCallback()})),this.set("_pause",{isPaused:!1}),this.set("animations",e),this},e.prototype.emitDelegation=function(t,e){var n,r=this,o=e.propagationPath;this.getEvents();"mouseenter"===t?n=e.fromShape:"mouseleave"===t&&(n=e.toShape);for(var s=function(t){var s=o[t],c=s.get("name");if(c){if((s.isGroup()||s.isCanvas&&s.isCanvas())&&n&&Object(a.g)(s,n))return"break";Object(i.isArray)(c)?Object(i.each)(c,(function(t){r.emitDelegateEvent(s,t,e)})):u.emitDelegateEvent(s,c,e)}},u=this,c=0;c=0&&s<.5*Math.PI?(r={x:l.minX,y:l.minY},o={x:l.maxX,y:l.maxY}):.5*Math.PI<=s&&sh[e.id]+s?(h[a]=h[e.id]+s,d[a]=[e.id]):h[a]===h[e.id]+s&&d[a].push(e.id)}))},v=0;ve[r][o]+e[o][i]&&(e[r][i]=e[r][o]+e[o][i]);return e};e.getAdjMatrix=function(t,n){var r=t.nodes,i=t.edges,o=[],a={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach((function(t,e){a[t.id]=e;o.push([])})),null==i||i.forEach((function(t){var r=(0,e.getEdgeTerminal)(t,"source"),i=(0,e.getEdgeTerminal)(t,"target"),s=a[r],u=a[i];void 0!==s&&void 0!==u&&(o[s][u]=1,n||(o[u][s]=1))})),o};e.scaleMatrix=function(t,e){var n=[];return t.forEach((function(t){var r=[];t.forEach((function(t){r.push(t*e)})),n.push(r)})),n};e.traverseTreeUp=function(t,e){"function"==typeof e&&function t(e,n){if(e&&e.children)for(var r=e.children.length-1;r>=0;r--)if(!t(e.children[r],n))return;return!!n(e)}(t,e)};e.getLayoutBBox=function(t){var e=1/0,n=1/0,o=-1/0,a=-1/0;return t.forEach((function(t){var s=t.size;(0,r.isArray)(s)?1===s.length&&(s=[s[0],s[0]]):(0,i.isNumber)(s)?s=[s,s]:(void 0===s||isNaN(s))&&(s=[30,30]);var u=[s[0]/2,s[1]/2],c=t.x-u[0],l=t.x+u[0],f=t.y-u[1],h=t.y+u[1];e>c&&(e=c),n>f&&(n=f),oe.x&&(N=e.x),P>e.y&&(P=e.y)})),w.edges().forEach((function(t){var e;null===(e=w.edge(t).points)||void 0===e||e.forEach((function(t){N>t.x&&(N=t.x),P>t.y&&(P=t.y)}))})),T[0]=p[0]-N,T[1]=p[1]-P}var D="LR"===h||"RL"===h;if(g){var L=this.focusNode,R=this.ranksep,B=this.getRadialPos,F=(0,s.isString)(L)?L:null==L?void 0:L.id,z=F?null===(r=w.node(F))||void 0===r?void 0:r._rank:0,G=[],Y=D?"y":"x",U=D?"height":"width",X=1/0,W=-1/0;w.nodes().forEach((function(t){var e=w.node(t);if(o.nodeMap[t]){var n=k(o.nodeMap[t]);if(0===z)G[e._rank]||(G[e._rank]={nodes:[],totalWidth:0,maxSize:-1/0}),G[e._rank].nodes.push(t),G[e._rank].totalWidth+=2*n+e[U],G[e._rank].maxSizeW&&(W=s)}}));var V=R||50,H={},q=(W-X)/.9,Z=[.5*(X+W-q),.5*(X+W+q)],K=function(t,e,n,r){void 0===n&&(n=-1/0),void 0===r&&(r=[0,1]);var i=n;return t.forEach((function(t){var n=w.node(t);H[t]=e;var a=B(n[Y],Z,q,e,r),s=a.x,u=a.y;if(o.nodeMap[t]){o.nodeMap[t].x=s+T[0],o.nodeMap[t].y=u+T[1],o.nodeMap[t]._order=n._order;var c=O(o.nodeMap[t]);i=i}))}:function(t,e,n){var r=Math.max(e.x,n.x),i=Math.min(e.x,n.x);return t.filter((function(t){return t.x<=r&&t.x>=i}))};w.edges().forEach((function(t){var e,n=w.edge(t),r=x.findIndex((function(e){var n=(0,s.getEdgeTerminal)(e,"source"),r=(0,s.getEdgeTerminal)(e,"target");return n===t.v&&r===t.w}));if(!(r<=-1)&&o.edgeLabelSpace&&o.controlPoints&&"loop"!==x[r].type){null===(e=null==n?void 0:n.points)||void 0===e||e.forEach((function(t){t.x+=T[0],t.y+=T[1]}));var i=o.nodeMap[t.v],a=o.nodeMap[t.w];x[r].controlPoints=f(null==n?void 0:n.points,i,a,tt,D,et,nt)}}))}return o.onLayoutEnd&&o.onLayoutEnd(),{nodes:u,edges:x}}},e.prototype.getRadialPos=function(t,e,n,r,i){void 0===i&&(i=[0,1]);var o=(t-e[0])/n,a=2*(o=o*(i[1]-i[0])+i[0])*Math.PI;return{x:Math.cos(a)*r,y:Math.sin(a)*r}},e.prototype.getType=function(){return"dagre"},e}(u.Base);e.DagreLayout=l;var f=function(t,e,n,r,i,o,a){var s=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&n){var u=e.x,c=e.y,l=n.x,f=n.y;if(i&&(u=e.y,c=e.x,l=n.y,f=n.x),f!==c&&u!==l){var h=r.indexOf(c),d=r[h+1];if(d){var p=s[0],g=i?{x:(c+d)/2,y:(null==p?void 0:p.y)||l}:{x:(null==p?void 0:p.x)||l,y:(c+d)/2};p&&!o(p,g)||s.unshift(g)}var v=r.indexOf(f),y=Math.abs(v-h);if(1===y)(s=a(s,e,n)).length||s.push(i?{x:(c+f)/2,y:u}:{x:u,y:(c+f)/2});else if(y>1){var m=r[v-1];if(m){var b=s[s.length-1],x=i?{x:(f+m)/2,y:(null==b?void 0:b.y)||l}:{x:(null==b?void 0:b.x)||u,y:(f+m)/2};b&&!o(b,x)||s.push(x)}}}}return s}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.slack=e.longestPathWithLayer=e.longestPath=void 0;var r=function(t){var e,n={};null===(e=t.sources())||void 0===e||e.forEach((function(e){return function e(r){var i,o,a=t.node(r);return a?n[r]?a.rank:(n[r]=!0,null===(i=t.outEdges(r))||void 0===i||i.forEach((function(n){var r=e(n.w)-t.edge(n).minlen;r&&(void 0===o||rd+l||ip+l||of.index){var h=d-s.x-s.vx,y=p-s.y-s.vy,m=h*h+y*y;mt.r&&(t.r=t[e].r)}function d(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function m(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(null,t),e=e._next;--S}()}finally{S=0,function(){var t,e,n=_,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:_=e);E=t,B(r)}(),A=0}}function R(){var t=j.now(),e=t-k;e>1e3&&(C-=e,k=t)}function B(t){S||(M&&(M=clearTimeout(M)),t-A>24?(t<1/0&&(M=setTimeout(L,t-j.now()-C)),O&&(O=clearInterval(O))):(O||(k=j.now(),O=setInterval(R,1e3)),S=1,I(L)))}P.prototype=D.prototype={constructor:P,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?T():+n)+(null==e?0:+e),this._next||E===this||(E?E._next=this:_=this,E=this),this._call=t,this._time=n,B()},stop:function(){this._call&&(this._call=null,this._time=1/0,B())}};var F=4294967296;function z(t){return t.x}function G(t){return t.y}var Y=Math.PI*(3-Math.sqrt(5)),U=function(t){var e,n,r=1,i=.001,o=1-Math.pow(i,1/300),a=0,s=.6,u=new Map,c=D(h),l=x("tick","end"),f=(n=1,function(){return(n=(1664525*n+1013904223)%F)/F});function h(){d(),l.call("tick",e),r1?(null==n?u.delete(t):u.set(t,g(n)),e):u.get(t)},find:function(e,n,r){var i,o,a,s,u,c=0,l=t.length;for(null==r?r=1/0:r*=r,c=0;c1?(l.on(t,n),e):l.on(t)}}},X=function(){var t,e,n,r,s,u=o(-30),c=1,l=1/0,f=.81;function h(n){var o,a=t.length,s=Object(i.a)(t,z,G).visitAfter(p);for(r=n,o=0;o=l)){(t.data!==e||t.next)&&(0===h&&(g+=(h=a(n))*h),0===d&&(g+=(d=a(n))*d),gMath.PI/2?Math.PI-c:c,l=l>Math.PI/2?Math.PI-l:l,{xExtra:Math.cos(u/2-c)*(e/2*(1/Math.sin(u/2)))-e/2||0,yExtra:Math.cos(l-u/2)*(e/2*(1/Math.sin(u/2)))-e/2||0}}i("rect",a),i("image",a),i("circle",s),i("marker",s),i("polyline",(function(t){for(var e=t.attr().points,n=[],r=[],i=0;i=0;return n?o?2*Math.PI-i:i:o?i:2*Math.PI-i},e.vertical=function(t,e,n){return n?(t[0]=e[1],t[1]=-1*e[0]):(t[0]=-1*e[1],t[1]=e[0]),t}},function(t,e){},function(t,e){},function(t,e,n){"use strict";var r=n(1),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(r.__extends)(e,t),e.prototype.isGroup=function(){return!0},e.prototype.isEntityGroup=function(){return!1},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),n=this.getChildren(),r=0;r=t&&n.minY<=e&&n.maxY>=e},e.prototype.afterAttrsChange=function(e){t.prototype.afterAttrsChange.call(this,e),this.clearCacheBBox()},e.prototype.getBBox=function(){var t=this.cfg.bbox;return t||(t=this.calculateBBox(),this.set("bbox",t)),t},e.prototype.getCanvasBBox=function(){var t=this.cfg.canvasBBox;return t||(t=this.calculateCanvasBBox(),this.set("canvasBBox",t)),t},e.prototype.applyMatrix=function(e){t.prototype.applyMatrix.call(this,e),this.set("canvasBBox",null)},e.prototype.calculateCanvasBBox=function(){var t=this.getBBox(),e=this.getTotalMatrix(),n=t.minX,r=t.minY,i=t.maxX,a=t.maxY;if(e){var s=Object(o.c)(e,[t.minX,t.minY]),u=Object(o.c)(e,[t.maxX,t.minY]),c=Object(o.c)(e,[t.minX,t.maxY]),l=Object(o.c)(e,[t.maxX,t.maxY]);n=Math.min(s[0],u[0],c[0],l[0]),i=Math.max(s[0],u[0],c[0],l[0]),r=Math.min(s[1],u[1],c[1],l[1]),a=Math.max(s[1],u[1],c[1],l[1])}var f=this.attrs;if(f.shadowColor){var h=f.shadowBlur,d=void 0===h?0:h,p=f.shadowOffsetX,g=void 0===p?0:p,v=f.shadowOffsetY,y=void 0===v?0:v,m=n-d+g,b=i+d+g,x=r-d+y,w=a+d+y;n=Math.min(n,m),i=Math.max(i,b),r=Math.min(r,x),a=Math.max(a,w)}return{x:n,y:r,minX:n,minY:r,maxX:i,maxY:a,width:i-n,height:a-r}},e.prototype.clearCacheBBox=function(){this.set("bbox",null),this.set("canvasBBox",null)},e.prototype.isClipShape=function(){return this.get("isClipShape")},e.prototype.isInShape=function(t,e){return!1},e.prototype.isOnlyHitBox=function(){return!1},e.prototype.isHit=function(t,e){var n=this.get("startArrowShape"),r=this.get("endArrowShape"),i=[t,e,1],o=(i=this.invertFromMatrix(i))[0],a=i[1],s=this._isInBBox(o,a);if(this.isOnlyHitBox())return s;if(s&&!this.isClipped(o,a)){if(this.isInShape(o,a))return!0;if(n&&n.isHit(o,a))return!0;if(r&&r.isHit(o,a))return!0}return!1},e}(i.a);e.a=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){return e?o(t):i(t)},e.detectStrongConnectComponents=e.detectConnectedComponents=void 0;var r=n(27),i=function(t){for(var e=t.nodes,n=void 0===e?[]:e,i=t.edges,o=void 0===i?[]:i,a=[],s={},u=[],c=function t(e){u.push(e),s[e.id]=!0;for(var i=(0,r.getNeighbors)(e.id,o),a=function(e){var r=i[e];if(!s[r]){var o=n.filter((function(t){return t.id===r}));o.length>0&&t(o[0])}},c=0;c0;)h.push(u.pop());a.push(h)}}return a};e.detectConnectedComponents=i;var o=function(t){for(var e=t.nodes,n=void 0===e?[]:e,i=t.edges,o=void 0===i?[]:i,a=[],s={},u={},c={},l=[],f=0,h=function t(e){u[e.id]=f,c[e.id]=f,f+=1,a.push(e),s[e.id]=!0;for(var i=(0,r.getNeighbors)(e.id,o,"target").filter((function(t){return n.map((function(t){return t.id})).indexOf(t)>-1})),h=function(r){var o=i[r];if(u[o]||0===u[o])s[o]&&(c[e.id]=Math.min(c[e.id],u[o]));else{var a=n.filter((function(t){return t.id===o}));a.length>0&&t(a[0]),c[e.id]=Math.min(c[e.id],c[o])}},d=0;d0;){var g=a.pop();if(s[g.id]=!1,p.push(g),g===e)break}p.length>0&&l.push(p)}},d=0,p=n;dr[a][u]+r[u][s]&&(r[a][s]=r[a][u]+r[u][s]);return r};e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(0),i=function(){function t(t){this.arr=t}return t.prototype.getArr=function(){return this.arr||[]},t.prototype.add=function(e){var n,r=e.arr;if(!(null===(n=this.arr)||void 0===n?void 0:n.length))return new t(r);if(!(null==r?void 0:r.length))return new t(this.arr);if(this.arr.length===r.length){var i=[];for(var o in this.arr)i[o]=this.arr[o]+r[o];return new t(i)}},t.prototype.subtract=function(e){var n,r=e.arr;if(!(null===(n=this.arr)||void 0===n?void 0:n.length))return new t(r);if(!(null==r?void 0:r.length))return new t(this.arr);if(this.arr.length===r.length){var i=[];for(var o in this.arr)i[o]=this.arr[o]-r[o];return new t(i)}},t.prototype.avg=function(e){var n=[];if(0!==e)for(var r in this.arr)n[r]=this.arr[r]/e;return new t(n)},t.prototype.negate=function(){var e=[];for(var n in this.arr)e[n]=-this.arr[n];return new t(e)},t.prototype.squareEuclideanDistance=function(t){var e,n=t.arr;if(!(null===(e=this.arr)||void 0===e?void 0:e.length)||!(null==n?void 0:n.length))return 0;if(this.arr.length===n.length){var r=0;for(var i in this.arr)r+=Math.pow(this.arr[i]-t.arr[i],2);return r}},t.prototype.euclideanDistance=function(t){var e,n=t.arr;if(!(null===(e=this.arr)||void 0===e?void 0:e.length)||!(null==n?void 0:n.length))return 0;if(this.arr.length===n.length){var r=0;for(var i in this.arr)r+=Math.pow(this.arr[i]-t.arr[i],2);return Math.sqrt(r)}console.error("The two vectors are unequal in length.")},t.prototype.normalize=function(){var e=[],n=(0,r.clone)(this.arr);n.sort((function(t,e){return t-e}));var i=n[n.length-1],o=n[0];for(var a in this.arr)e[a]=(this.arr[a]-o)/(i-o);return new t(e)},t.prototype.norm2=function(){var t;if(!(null===(t=this.arr)||void 0===t?void 0:t.length))return 0;var e=0;for(var n in this.arr)e+=Math.pow(this.arr[n],2);return Math.sqrt(e)},t.prototype.dot=function(t){var e,n=t.arr;if(!(null===(e=this.arr)||void 0===e?void 0:e.length)||!(null==n?void 0:n.length))return 0;if(this.arr.length===n.length){var r=0;for(var i in this.arr)r+=this.arr[i]*t.arr[i];return r}console.error("The two vectors are unequal in length.")},t.prototype.equal=function(t){var e,n=t.arr;if((null===(e=this.arr)||void 0===e?void 0:e.length)!==(null==n?void 0:n.length))return!1;for(var r in this.arr)if(this.arr[r]!==n[r])return!1;return!0},t}();e.default=i},function(t,e,n){var r=n(151),i={};for(var o in r)r.hasOwnProperty(o)&&(i[r[o]]=o);var a=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var s in a)if(a.hasOwnProperty(s)){if(!("channels"in a[s]))throw new Error("missing channels property: "+s);if(!("labels"in a[s]))throw new Error("missing channel labels property: "+s);if(a[s].labels.length!==a[s].channels)throw new Error("channel and label counts mismatch: "+s);var u=a[s].channels,c=a[s].labels;delete a[s].channels,delete a[s].labels,Object.defineProperty(a[s],"channels",{value:u}),Object.defineProperty(a[s],"labels",{value:c})}a.rgb.hsl=function(t){var e,n,r=t[0]/255,i=t[1]/255,o=t[2]/255,a=Math.min(r,i,o),s=Math.max(r,i,o),u=s-a;return s===a?e=0:r===s?e=(i-o)/u:i===s?e=2+(o-r)/u:o===s&&(e=4+(r-i)/u),(e=Math.min(60*e,360))<0&&(e+=360),n=(a+s)/2,[e,100*(s===a?0:n<=.5?u/(s+a):u/(2-s-a)),100*n]},a.rgb.hsv=function(t){var e,n,r,i,o,a=t[0]/255,s=t[1]/255,u=t[2]/255,c=Math.max(a,s,u),l=c-Math.min(a,s,u),f=function(t){return(c-t)/6/l+.5};return 0===l?i=o=0:(o=l/c,e=f(a),n=f(s),r=f(u),a===c?i=r-n:s===c?i=1/3+e-r:u===c&&(i=2/3+n-e),i<0?i+=1:i>1&&(i-=1)),[360*i,100*o,100*c]},a.rgb.hwb=function(t){var e=t[0],n=t[1],r=t[2];return[a.rgb.hsl(t)[0],100*(1/255*Math.min(e,Math.min(n,r))),100*(r=1-1/255*Math.max(e,Math.max(n,r)))]},a.rgb.cmyk=function(t){var e,n=t[0]/255,r=t[1]/255,i=t[2]/255;return[100*((1-n-(e=Math.min(1-n,1-r,1-i)))/(1-e)||0),100*((1-r-e)/(1-e)||0),100*((1-i-e)/(1-e)||0),100*e]},a.rgb.keyword=function(t){var e=i[t];if(e)return e;var n,o,a,s=1/0;for(var u in r)if(r.hasOwnProperty(u)){var c=r[u],l=(o=t,a=c,Math.pow(o[0]-a[0],2)+Math.pow(o[1]-a[1],2)+Math.pow(o[2]-a[2],2));l.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)),100*(.2126*e+.7152*n+.0722*r),100*(.0193*e+.1192*n+.9505*r)]},a.rgb.lab=function(t){var e=a.rgb.xyz(t),n=e[0],r=e[1],i=e[2];return r/=100,i/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(n-r),200*(r-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},a.hsl.rgb=function(t){var e,n,r,i,o,a=t[0]/360,s=t[1]/100,u=t[2]/100;if(0===s)return[o=255*u,o,o];e=2*u-(n=u<.5?u*(1+s):u+s-u*s),i=[0,0,0];for(var c=0;c<3;c++)(r=a+1/3*-(c-1))<0&&r++,r>1&&r--,o=6*r<1?e+6*(n-e)*r:2*r<1?n:3*r<2?e+(n-e)*(2/3-r)*6:e,i[c]=255*o;return i},a.hsl.hsv=function(t){var e=t[0],n=t[1]/100,r=t[2]/100,i=n,o=Math.max(r,.01);return n*=(r*=2)<=1?r:2-r,i*=o<=1?o:2-o,[e,100*(0===r?2*i/(o+i):2*n/(r+n)),100*((r+n)/2)]},a.hsv.rgb=function(t){var e=t[0]/60,n=t[1]/100,r=t[2]/100,i=Math.floor(e)%6,o=e-Math.floor(e),a=255*r*(1-n),s=255*r*(1-n*o),u=255*r*(1-n*(1-o));switch(r*=255,i){case 0:return[r,u,a];case 1:return[s,r,a];case 2:return[a,r,u];case 3:return[a,s,r];case 4:return[u,a,r];case 5:return[r,a,s]}},a.hsv.hsl=function(t){var e,n,r,i=t[0],o=t[1]/100,a=t[2]/100,s=Math.max(a,.01);return r=(2-o)*a,n=o*s,[i,100*(n=(n/=(e=(2-o)*s)<=1?e:2-e)||0),100*(r/=2)]},a.hwb.rgb=function(t){var e,n,r,i,o,a,s,u=t[0]/360,c=t[1]/100,l=t[2]/100,f=c+l;switch(f>1&&(c/=f,l/=f),r=6*u-(e=Math.floor(6*u)),0!=(1&e)&&(r=1-r),i=c+r*((n=1-l)-c),e){default:case 6:case 0:o=n,a=i,s=c;break;case 1:o=i,a=n,s=c;break;case 2:o=c,a=n,s=i;break;case 3:o=c,a=i,s=n;break;case 4:o=i,a=c,s=n;break;case 5:o=n,a=c,s=i}return[255*o,255*a,255*s]},a.cmyk.rgb=function(t){var e=t[0]/100,n=t[1]/100,r=t[2]/100,i=t[3]/100;return[255*(1-Math.min(1,e*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i))]},a.xyz.rgb=function(t){var e,n,r,i=t[0]/100,o=t[1]/100,a=t[2]/100;return n=-.9689*i+1.8758*o+.0415*a,r=.0557*i+-.204*o+1.057*a,e=(e=3.2406*i+-1.5372*o+-.4986*a)>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,[255*(e=Math.min(Math.max(0,e),1)),255*(n=Math.min(Math.max(0,n),1)),255*(r=Math.min(Math.max(0,r),1))]},a.xyz.lab=function(t){var e=t[0],n=t[1],r=t[2];return n/=100,r/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(e-n),200*(n-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},a.lab.xyz=function(t){var e,n,r,i=t[0];e=t[1]/500+(n=(i+16)/116),r=n-t[2]/200;var o=Math.pow(n,3),a=Math.pow(e,3),s=Math.pow(r,3);return n=o>.008856?o:(n-16/116)/7.787,e=a>.008856?a:(e-16/116)/7.787,r=s>.008856?s:(r-16/116)/7.787,[e*=95.047,n*=100,r*=108.883]},a.lab.lch=function(t){var e,n=t[0],r=t[1],i=t[2];return(e=360*Math.atan2(i,r)/2/Math.PI)<0&&(e+=360),[n,Math.sqrt(r*r+i*i),e]},a.lch.lab=function(t){var e,n=t[0],r=t[1];return e=t[2]/360*2*Math.PI,[n,r*Math.cos(e),r*Math.sin(e)]},a.rgb.ansi16=function(t){var e=t[0],n=t[1],r=t[2],i=1 in arguments?arguments[1]:a.rgb.hsv(t)[2];if(0===(i=Math.round(i/50)))return 30;var o=30+(Math.round(r/255)<<2|Math.round(n/255)<<1|Math.round(e/255));return 2===i&&(o+=60),o},a.hsv.ansi16=function(t){return a.rgb.ansi16(a.hsv.rgb(t),t[2])},a.rgb.ansi256=function(t){var e=t[0],n=t[1],r=t[2];return e===n&&n===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},a.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),[e=e/10.5*255,e,e];var n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},a.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}var n;return t-=16,[Math.floor(t/36)/5*255,Math.floor((n=t%36)/6)/5*255,n%6/5*255]},a.rgb.hex=function(t){var e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},a.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var n=e[0];3===e[0].length&&(n=n.split("").map((function(t){return t+t})).join(""));var r=parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},a.rgb.hcg=function(t){var e,n=t[0]/255,r=t[1]/255,i=t[2]/255,o=Math.max(Math.max(n,r),i),a=Math.min(Math.min(n,r),i),s=o-a;return e=s<=0?0:o===n?(r-i)/s%6:o===r?2+(i-n)/s:4+(n-r)/s+4,e/=6,[360*(e%=1),100*s,100*(s<1?a/(1-s):0)]},a.hsl.hcg=function(t){var e=t[1]/100,n=t[2]/100,r=1,i=0;return(r=n<.5?2*e*n:2*e*(1-n))<1&&(i=(n-.5*r)/(1-r)),[t[0],100*r,100*i]},a.hsv.hcg=function(t){var e=t[1]/100,n=t[2]/100,r=e*n,i=0;return r<1&&(i=(n-r)/(1-r)),[t[0],100*r,100*i]},a.hcg.rgb=function(t){var e=t[0]/360,n=t[1]/100,r=t[2]/100;if(0===n)return[255*r,255*r,255*r];var i,o=[0,0,0],a=e%1*6,s=a%1,u=1-s;switch(Math.floor(a)){case 0:o[0]=1,o[1]=s,o[2]=0;break;case 1:o[0]=u,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=s;break;case 3:o[0]=0,o[1]=u,o[2]=1;break;case 4:o[0]=s,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=u}return i=(1-n)*r,[255*(n*o[0]+i),255*(n*o[1]+i),255*(n*o[2]+i)]},a.hcg.hsv=function(t){var e=t[1]/100,n=e+t[2]/100*(1-e),r=0;return n>0&&(r=e/n),[t[0],100*r,100*n]},a.hcg.hsl=function(t){var e=t[1]/100,n=t[2]/100*(1-e)+.5*e,r=0;return n>0&&n<.5?r=e/(2*n):n>=.5&&n<1&&(r=e/(2*(1-n))),[t[0],100*r,100*n]},a.hcg.hwb=function(t){var e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},a.hwb.hcg=function(t){var e=t[1]/100,n=1-t[2]/100,r=n-e,i=0;return r<1&&(i=(n-r)/(1-r)),[t[0],100*r,100*i]},a.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},a.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},a.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},a.gray.hsl=a.gray.hsv=function(t){return[0,0,t[0]]},a.gray.hwb=function(t){return[0,100,t[0]]},a.gray.cmyk=function(t){return[0,0,0,t[0]]},a.gray.lab=function(t){return[t[0],0,0]},a.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},a.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}},function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.getLayoutByName=e.unRegisterLayout=e.registerLayout=void 0;var o=n(18),a=n(15),s=new Map;e.registerLayout=function(t,e){if(s.get(t)&&console.warn("The layout with the name ".concat(t," exists already, it will be overridden")),(0,a.isObject)(e)){var n=function(t){function n(n){var r,i,o=r=t.call(this)||this,a={},s=Object.assign({},o.getDefaultCfg(),(null===(i=e.getDefaultCfg)||void 0===i?void 0:i.call(e))||{});return Object.assign(a,s,e,n),Object.keys(a).forEach((function(t){var e=a[t];o[t]=e})),r}return i(n,t),n}(o.Base);s.set(t,n)}else s.set(t,e);return s.get(t)};e.unRegisterLayout=function(t){s.has(t)&&s.delete(t)};e.getLayoutByName=function(t){return s.has(t)?s.get(t):null}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isArray=void 0,e.isArray=Array.isArray},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;nt.cells)((x=t.small())-1)*(b=t.large())>=t.cells?t.small(x-1):(b-1)*x>=t.cells&&t.large(b-1);else for(;t.cols*t.rows=t.cells?t.large(b+1):t.small(x+1)}if(t.cellWidth=s/t.cols,t.cellHeight=u/t.rows,c&&(t.cellWidth=0,t.cellHeight=0),f||h){var w=(0,o.getFuncByUnknownType)(10,h),_=(0,o.getFuncByUnknownType)(30,d,!1);p.forEach((function(e){e.x&&e.y||(e.x=0,e.y=0);var n,r,i=_(e)||30;(0,o.isArray)(i)?(n=i[0],r=i[1]):(n=i,r=i);var a=void 0!==w?w(e):l,s=n+a,u=r+a;t.cellWidth=Math.max(t.cellWidth,s),t.cellHeight=Math.max(t.cellHeight,u)}))}t.cellUsed={},t.row=0,t.col=0,t.id2manPos={};for(var E=0;E=t&&(this.col=0,this.row++)},e.prototype.getPos=function(t){var e,n,r=this.begin,i=this.cellWidth,o=this.cellHeight,a=this.id2manPos[t.id];if(a)e=a.col*i+i/2+r[0],n=a.row*o+o/2+r[1];else{for(;this.used(this.row,this.col);)this.moveToNextCell();e=this.col*i+i/2+r[0],n=this.row*o+o/2+r[1],this.use(this.row,this.col),this.moveToNextCell()}t.x=e,t.y=n},e.prototype.getType=function(){return"grid"},e}(n(18).Base);e.GridLayout=a},function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.RandomLayout=void 0;var o=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(e),n}return i(e,t),e.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.center;return t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),e&&e.forEach((function(e){e.x=.9*(Math.random()-.5)*t.width+n[0],e.y=.9*(Math.random()-.5)*t.height+n[1]})),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:this.edges}},e.prototype.getType=function(){return"random"},e}(n(18).Base);e.RandomLayout=o},function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.GForceLayout=void 0;var o=n(18),a=n(15),s=function(t,e){return t?(0,a.isNumber)(t)?function(e){return t}:t:function(t){return e||1}},u=function(t){function e(e){var n=t.call(this)||this;return n.maxIteration=500,n.workerEnabled=!1,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=1e3,n.minMovement=.5,n.interval=.02,n.factor=1,n.linkDistance=1,n.gravity=10,n.preventOverlap=!0,n.collideStrength=1,n.tick=function(){},n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.animate=!0,n.updateCfg(e),n}return i(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t,e,n=this,r=n.nodes;if(void 0!==n.timeInterval&&"undefined"!=typeof window&&window.clearInterval(n.timeInterval),r&&0!==r.length){n.width||"undefined"==typeof window||(n.width=window.innerWidth),n.height||"undefined"==typeof window||(n.height=window.innerHeight),n.center||(n.center=[n.width/2,n.height/2]);var i=n.center;if(1===r.length)return r[0].x=i[0],r[0].y=i[1],void(null===(e=n.onLayoutEnd)||void 0===e||e.call(n));var o={},u={};r.forEach((function(t,e){(0,a.isNumber)(t.x)||(t.x=Math.random()*n.width),(0,a.isNumber)(t.y)||(t.y=Math.random()*n.height),o[t.id]=t,u[t.id]=e})),n.nodeMap=o,n.nodeIdxMap=u,n.linkDistance=s(n.linkDistance,1),n.nodeStrength=s(n.nodeStrength,1),n.edgeStrength=s(n.edgeStrength,1);var c,l=n.nodeSize;if(n.preventOverlap){var f,h=n.nodeSpacing;f=(0,a.isNumber)(h)?function(){return h}:(0,a.isFunction)(h)?h:function(){return 0},c=l?(0,a.isArray)(l)?function(t){return Math.max(l[0],l[1])+f(t)}:function(t){return l+f(t)}:function(t){return t.size?(0,a.isArray)(t.size)?Math.max(t.size[0],t.size[1])+f(t):(0,a.isObject)(t.size)?Math.max(t.size.width,t.size.height)+f(t):t.size+f(t):10+f(t)}}n.nodeSize=c;var d=n.edges;n.degrees=(0,a.getDegree)(r.length,n.nodeIdxMap,d),n.getMass||(n.getMass=function(t){return t.mass||n.degrees[n.nodeIdxMap[t.id]].all||1}),n.run()}else null===(t=n.onLayoutEnd)||void 0===t||t.call(n)},e.prototype.run=function(){var t,e=this,n=e.maxIteration,r=e.nodes,i=e.workerEnabled,o=e.minMovement,a=e.animate;if(r)if(i||!a){for(var s=0;s=n&&(null===(i=e.onLayoutEnd)||void 0===i||i.call(e),window.clearInterval(e.timeInterval))}}),0)}},e.prototype.reachMoveThreshold=function(t,e,n){var r=0;return t.forEach((function(t,n){var i=t.x-e[n].x,o=t.y-e[n].y;r+=Math.sqrt(i*i+o*o)})),(r/=t.length)=h)){var d=a.x-e.x,p=a.y-e.y;0===d&&0===p&&(d=.01*Math.random(),p=.01*Math.random());var g=d*d+p*p,v=Math.sqrt(g),y=(v+.1)*i,m=d/v,b=p/v,x=.5*(u(a)+u(e))*r/(y*y),w=n?n(e):1;if(t[2*l]+=m*x,t[2*l+1]+=b*x,t[2*h]-=m*x,t[2*h+1]-=b*x,o&&(c(a)+c(e))/2>v){var _=s*(u(a)+u(e))*.5/g;t[2*l]+=m*_/f,t[2*l+1]+=b*_/f,t[2*h]-=m*_/w,t[2*h+1]-=b*_/w}}}))}))},e.prototype.calAttractive=function(t,e){var n=this.nodeMap,r=this.nodeIdxMap,i=this.linkDistance,o=this.edgeStrength,s=this.nodeSize,u=this.getMass;e.forEach((function(e,c){var l=(0,a.getEdgeTerminal)(e,"source"),f=(0,a.getEdgeTerminal)(e,"target"),h=n[l],d=n[f],p=d.x-h.x,g=d.y-h.y;0===p&&0===g&&(p=.01*Math.random(),g=.01*Math.random());var v=Math.sqrt(p*p+g*g),y=p/v,m=g/v,b=((i(e,h,d)||1+(s(h)+s(d)||0)/2)-v)*o(e),x=r[l],w=r[f],_=u?u(h):1,E=u?u(d):1;t[2*x]-=y*b/_,t[2*x+1]-=m*b/_,t[2*w]+=y*b/E,t[2*w+1]+=m*b/E}))},e.prototype.calGravity=function(t,e){for(var n=this.center,r=this.gravity,i=this.degrees,o=e.length,s=0;si.maxSpeed){var c=i.maxSpeed/u;a*=c,s*=c}e[2*r]=a,e[2*r+1]=s}))},e.prototype.updatePosition=function(t,e,n){n.forEach((function(n,r){if((0,a.isNumber)(n.fx)&&(0,a.isNumber)(n.fy))return n.x=n.fx,void(n.y=n.fy);var i=t[2*r]*e,o=t[2*r+1]*e;n.x+=i,n.y+=o}))},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){this.stop(),this.tick=null,this.nodes=null,this.edges=null,this.destroyed=!0},e.prototype.getType=function(){return"gForce"},e}(o.Base);e.GForceLayout=u},function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n1&&(o=(0,s.getAvgNodePosition)(c))}else o=void 0;return{x:null==o?void 0:o.x,y:null==o?void 0:o.y}}}}if(r){t||(t=this.getSameTypeLeafMap());var d=Array.from(new Set(a.map((function(t,e){return t[i]})))).filter((function(t){return void 0!==t})),p={};d.forEach((function(t){var e=a.filter((function(e){return e[i]===t})).map((function(t){return u[t.id]}));p[t]=(0,s.getAvgNodePosition)(e)})),f={single:function(t){return l(t)},leaf:function(t){return l(t)},others:function(t){return l(t)},center:function(t,e,n){var r=p[t[i]];return{x:null==r?void 0:r.x,y:null==r?void 0:r.y}}}}this.centripetalOptions=o(o({},this.centripetalOptions),f);var g=this.centripetalOptions,v=g.leaf,y=g.single,m=g.others;v&&"function"!=typeof v&&(this.centripetalOptions.leaf=function(){return v}),y&&"function"!=typeof y&&(this.centripetalOptions.single=function(){return y}),m&&"function"!=typeof m&&(this.centripetalOptions.others=function(){return m})},e.prototype.updateCfg=function(t){t&&Object.assign(this,t)},e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t=this;t.stop();var e=t.nodes,n=t.edges,r=t.defSpringLen;if(t.judgingDistance=0,e&&0!==e.length){t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var i=t.center;if(1===e.length)return e[0].x=i[0],e[0].y=i[1],void t.onLayoutEnd([o({},e[0])]);t.degreesMap=(0,s.getDegreeMap)(e,n),t.propsGetMass?t.getMass=t.propsGetMass:t.getMass=function(e){var n=1;(0,s.isNumber)(e.mass)&&(n=e.mass);var r=t.degreesMap[e.id].all;return!r||r<5?n:5*r*n};var a,u=t.nodeSize;if(t.preventOverlap){var l,f=t.nodeSpacing;l=(0,s.isNumber)(f)?function(){return f}:(0,s.isFunction)(f)?f:function(){return 0},a=u?(0,s.isArray)(u)?function(t){return Math.max(u[0],u[1])+l(t)}:function(t){return u+l(t)}:function(t){return t.size?(0,s.isArray)(t.size)?Math.max(t.size[0],t.size[1])+l(t):(0,s.isObject)(t.size)?Math.max(t.size.width,t.size.height)+l(t):t.size+l(t):10+l(t)}}t.nodeSize=a,t.linkDistance=c(t.linkDistance,1),t.nodeStrength=c(t.nodeStrength,1),t.edgeStrength=c(t.edgeStrength,1);var h={},d={};e.forEach((function(e,r){(0,s.isNumber)(e.x)||(e.x=Math.random()*t.width),(0,s.isNumber)(e.y)||(e.y=Math.random()*t.height);var i=t.degreesMap[e.id];h[e.id]=o(o({},e),{data:o(o({},e.data),{size:t.nodeSize(e)||30,layout:{inDegree:i.in,outDegree:i.out,degree:i.all,tDegree:i.in,sDegree:i.out,force:{mass:t.getMass(e),nodeStrength:t.nodeStrength(e,n)}}})}),d[e.id]=r})),t.nodeMap=h,t.nodeIdxMap=d,t.edgeInfos=[],null==n||n.forEach((function(e){var n=h[e.source],i=h[e.target];n&&i?t.edgeInfos.push({edgeStrength:t.edgeStrength(e),linkDistance:r?r(o(o({},e),{source:n,target:i}),n,i):t.linkDistance(e,n,i)||1+(u(n)+u(n)||0)/2}):elf.edgeInfos.push({})})),this.getCentripetalOptions(),t.onLayoutEnd=t.onLayoutEnd||function(){},t.run()}else t.onLayoutEnd([])},e.prototype.run=function(){var t=this,e=t.maxIteration,n=t.nodes,r=t.edges,i=t.workerEnabled,o=t.minMovement,a=t.animate,s=t.nodeMap,u=t.height;if(t.currentMinY=0,t.currentMaxY=u,n){var c=[];if(n.forEach((function(t,e){c[2*e]=0,c[2*e+1]=0})),this.defSideCoe&&"function"==typeof this.defSideCoe){var l={};r.forEach((function(t){var e=t.source,n=t.target;l[e]=l[e]||[],l[e].push(t),l[n]=l[n]||[],l[n].push(t)})),this.relatedEdges=l}var f=e;if(i||!a){for(var h=0;(t.judgingDistance>o||h<1)&&h=f||t.judgingDistanceo){var l=o/c;s*=l,u*=l}e[2*a]=s,e[2*a+1]=u}))},e.prototype.updatePosition=function(t,e){var n=this,r=n.nodes,i=n.distanceThresholdMode,o=n.nodeMap;if(null==r?void 0:r.length){var a=0;"max"===i?n.judgingDistance=-1/0:"min"===i&&(n.judgingDistance=1/0);var u=1/0,c=-1/0;r.forEach((function(r,l){var f=o[r.id];if((0,s.isNumber)(r.fx)&&(0,s.isNumber)(r.fy))return r.x=r.fx,r.y=r.fy,f.x=r.x,void(f.y=r.y);var h=t[2*l]*e,d=t[2*l+1]*e;r.x+=h,r.y+=d,f.x=r.x,f.y=r.y,r.yc&&(c=r.y);var p=Math.sqrt(h*h+d*d);switch(i){case"max":n.judgingDistancep&&(n.judgingDistance=p);break;default:a+=p}})),this.currentMinY=u,this.currentMaxY=c,i&&"mean"!==i||(n.judgingDistance=a/r.length)}else this.judgingDistance=0},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){this.stop(),this.tick=null,this.nodes=null,this.edges=null,this.destroyed=!0},e.prototype.getType=function(){return"force2"},e.prototype.getSameTypeLeafMap=function(){var t=this,e=t.nodeClusterBy,n=t.nodes,r=t.edges,i=t.nodeMap,o=t.degreesMap;if(null==n?void 0:n.length){var a={};return n.forEach((function(t,n){1===o[t.id].all&&(a[t.id]=(0,s.getCoreNodeAndRelativeLeafNodes)("leaf",t,r,e,o,i))})),a}},e}(a.Base);e.Force2Layout=l},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(156),e)},function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.CircularLayout=void 0;var o=n(18),a=n(15);function s(t,e){var n=t.degree,r=e.degree;return nr?1:0}var u=function(t){function e(e){var n=t.call(this)||this;return n.radius=null,n.nodeSize=void 0,n.startRadius=null,n.endRadius=null,n.startAngle=0,n.endAngle=2*Math.PI,n.clockwise=!0,n.divisions=1,n.ordering=null,n.angleRatio=1,n.nodes=[],n.edges=[],n.nodeMap={},n.degrees=[],n.width=300,n.height=300,n.updateCfg(e),n}return i(e,t),e.prototype.getDefaultCfg=function(){return{radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1}},e.prototype.execute=function(){var t,e=this.nodes,n=this.edges,r=e.length;if(0!==r){this.width||"undefined"==typeof window||(this.width=window.innerWidth),this.height||"undefined"==typeof window||(this.height=window.innerHeight),this.center||(this.center=[this.width/2,this.height/2]);var i=this.center;if(1===r)return e[0].x=i[0],e[0].y=i[1],void(this.onLayoutEnd&&this.onLayoutEnd());var o=this.radius,s=this.startRadius,u=this.endRadius,c=this.divisions,l=this.startAngle,f=this.endAngle,h=this.angleRatio,d=this.ordering,p=this.clockwise,g=this.nodeSpacing,v=this.nodeSize,y=(f-l)/r,m={};e.forEach((function(t,e){m[t.id]=e})),this.nodeMap=m;var b=(0,a.getDegree)(e.length,m,n);if(this.degrees=b,g){var x=(0,a.getFuncByUnknownType)(10,g),w=(0,a.getFuncByUnknownType)(10,v),_=-1/0;e.forEach((function(t){var e=w(t);_this.width?this.width/2:this.height/2;var S=y*h,M=[];M="topology"===d?this.topologyOrdering():"topology-directed"===d?this.topologyOrdering(!0):"degree"===d?this.degreeOrdering():e;for(var O=Math.ceil(r/c),k=0;kt.x&&(i=t.x),o>t.y&&(o=t.y)})),e.forEach((function(t){t.points.forEach((function(t){i>t.x&&(i=t.x),o>t.y&&(o=t.y)}))})),r[0]=n[0]-i,r[1]=n[1]-o}return r},e.prototype.updateNodePosition=function(t,e){var n=this.combos,r=this.nodes,i=this.edges,o=this.anchorPoint,a=this.graphSettings,s=this.getBegin(t,e);t.forEach((function(t){var c,l=t.x,f=t.y,h=t.id,d=t.type,p=t.coreBox;if(d===u.HierarchyNodeType.META&&h!==u.ROOT_NAME){var g=n.findIndex((function(t){return t.id===h})),v=null===(c=null==a?void 0:a.subScene)||void 0===c?void 0:c.meta;n[g].offsetX=l+s[0],n[g].offsetY=f+s[1],n[g].fixSize=[p.width,p.height],n[g].fixCollapseSize=[p.width,p.height],t.expanded?n[g].padding=[null==v?void 0:v.paddingTop,null==v?void 0:v.paddingRight,null==v?void 0:v.paddingBottom,null==v?void 0:v.paddingLeft]:n[g].padding=[0,0,0,0]}else if(d===u.HierarchyNodeType.OP){g=r.findIndex((function(t){return t.id===h}));if(r[g].x=l+s[0],r[g].y=f+s[1],o){var y=[],m=e.filter((function(t){return t.v===h})),b=e.filter((function(t){return t.w===h}));m.length>0&&m.forEach((function(e){var n=e.points[0],r=(n.x-l)/t.width+.5,o=(n.y-f)/t.height+.5;y.push([r,o]),e.baseEdgeList.forEach((function(t){var e=i.find((function(e){return e.source===t.v&&e.target===t.w}));e&&(e.sourceAnchor=y.length-1)}))})),b.length>0&&b.forEach((function(e){var n=e.points[e.points.length-1],r=(n.x-l)/t.width+.5,o=(n.y-f)/t.height+.5;y.push([r,o]),e.baseEdgeList.forEach((function(t){var e=i.find((function(e){return e.source===t.v&&e.target===t.w}));e&&(e.targetAnchor=y.length-1)}))})),r[g].anchorPoints=y.length>0?y:r[g].anchorPoints||[]}}}))},e.prototype.updateEdgePosition=function(t,e){var n=this,r=n.combos,i=n.edges,s=n.controlPoints,c=this.getBegin(t,e);s&&(r.forEach((function(t){t.inEdges=[],t.outEdges=[]})),i.forEach((function(e){var i,s,l,f,h=t.find((function(t){return t.id===e.source})),d=t.find((function(t){return t.id===e.target})),p=[],g=[];if(h&&d)g=(0,u.getEdges)(null==h?void 0:h.id,null==d?void 0:d.id,t);else if(!h||!d){var v=n.getNodePath(e.source),y=n.getNodePath(e.target),m=v.reverse().slice(h?0:1).find((function(e){return t.find((function(t){return t.id===e}))})),b=y.reverse().slice(d?0:1).find((function(e){return t.find((function(t){return t.id===e}))}));h=t.find((function(t){return t.id===m})),d=t.find((function(t){return t.id===b})),g=(0,u.getEdges)(null==h?void 0:h.id,null==d?void 0:d.id,t,{v:e.source,w:e.target})}if(p=(p=g.reduce((function(t,e){return a(a([],t,!0),e.points.map((function(t){return o(o({},t),{x:t.x+c[0],y:t.y+c[1]})})),!0)}),[])).slice(1,-1),e.controlPoints=p,(null==d?void 0:d.type)===u.NodeType.META){var x=r.findIndex((function(t){return t.id===(null==d?void 0:d.id)}));if(!r[x]||(null===(i=r[x].inEdges)||void 0===i?void 0:i.some((function(t){return t.source===h.id&&t.target===d.id}))))return;null===(s=r[x].inEdges)||void 0===s||s.push({source:h.id,target:d.id,controlPoints:p})}if((null==h?void 0:h.type)===u.NodeType.META){x=r.findIndex((function(t){return t.id===(null==h?void 0:h.id)}));if(!r[x]||(null===(l=r[x].outEdges)||void 0===l?void 0:l.some((function(t){return t.source===h.id&&t.target===d.id}))))return;null===(f=r[x].outEdges)||void 0===f||f.push({source:h.id,target:d.id,controlPoints:p})}})))},e.prototype.getType=function(){return"dagreCompound"},e.prototype.getDataByOrder=function(t){return t.every((function(t){return void 0!==t.layoutOrder}))||t.forEach((function(t,e){t.layoutOrder=e})),t.sort((function(t,e){return t.layoutOrder-e.layoutOrder}))},e}(s.Base);e.DagreCompoundLayout=l},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":n(window))&&(r=window)}t.exports=r},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(183),e)},function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.ConcentricLayout=void 0;var o=n(15),a=function(t){function e(e){var n=t.call(this)||this;return n.nodeSize=30,n.minNodeSpacing=10,n.nodeSpacing=10,n.preventOverlap=!1,n.equidistant=!1,n.startAngle=1.5*Math.PI,n.clockwise=!0,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.onLayoutEnd=function(){},n.updateCfg(e),n}return i(e,t),e.prototype.getDefaultCfg=function(){return{nodeSize:30,minNodeSpacing:10,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"}},e.prototype.execute=function(){var t,e,n=this,r=n.nodes,i=n.edges,a=r.length;if(0!==a){n.width||"undefined"==typeof window||(n.width=window.innerWidth),n.height||"undefined"==typeof window||(n.height=window.innerHeight),n.center||(n.center=[n.width/2,n.height/2]);var s=n.center;if(1===a)return r[0].x=s[0],r[0].y=s[1],void(null===(e=n.onLayoutEnd)||void 0===e||e.call(n));var u,c=n.nodeSize,l=n.nodeSpacing,f=[],h=0;u=(0,o.isArray)(c)?Math.max(c[0],c[1]):c,(0,o.isArray)(l)?h=Math.max(l[0],l[1]):(0,o.isNumber)(l)&&(h=l),r.forEach((function(t){f.push(t);var e=u;(0,o.isArray)(t.size)?e=Math.max(t.size[0],t.size[1]):(0,o.isNumber)(t.size)?e=t.size:(0,o.isObject)(t.size)&&(e=Math.max(t.size.width,t.size.height)),u=Math.max(u,e),(0,o.isFunction)(l)&&(h=Math.max(l(t),h))})),n.clockwise=void 0!==n.counterclockwise?!n.counterclockwise:n.clockwise;var d={},p={};if(f.forEach((function(t,e){d[t.id]=t,p[t.id]=e})),!("degree"!==n.sortBy&&(0,o.isString)(n.sortBy)&&void 0!==f[0][n.sortBy]||(n.sortBy="degree",(0,o.isNumber)(r[0].degree)))){var g=(0,o.getDegree)(r.length,p,i);f.forEach((function(t,e){t.degree=g[e].all}))}f.sort((function(t,e){return e[n.sortBy]-t[n.sortBy]})),n.maxValueNode=f[0],n.maxLevelDiff=n.maxLevelDiff||n.maxValueNode[n.sortBy]/4;var v=[[]],y=v[0];f.forEach((function(t){if(y.length>0){var e=Math.abs(y[0][n.sortBy]-t[n.sortBy]);n.maxLevelDiff&&e>=n.maxLevelDiff&&(y=[],v.push(y))}y.push(t)}));var m=u+(h||n.minNodeSpacing);if(!n.preventOverlap){var b=v.length>0&&v[0].length>1,x=(Math.min(n.width,n.height)/2-m)/(v.length+(b?1:0));m=Math.min(m,x)}var w=0;if(v.forEach((function(t){var e=n.sweep;void 0===e&&(e=2*Math.PI-2*Math.PI/t.length);var r=t.dTheta=e/Math.max(1,t.length-1);if(t.length>1&&n.preventOverlap){var i=Math.cos(r)-Math.cos(0),o=Math.sin(r)-Math.sin(0),a=Math.sqrt(m*m/(i*i+o*o));w=Math.max(a,w)}t.r=w,w+=m})),n.equidistant){for(var _=0,E=0,S=0;S=i&&(null===(t=e.onLayoutEnd)||void 0===t||t.call(e),window.clearInterval(e.timeInterval))}),0)}return{nodes:n,edges:r}}},e.prototype.runOneStep=function(t){var e,n=this.nodes;if(n){var r=this.edges,i=this.center,o=this.gravity,s=this.speed,u=this.clustering,c=this.height*this.width,l=Math.sqrt(c)/10,f=c/(n.length+1),h=Math.sqrt(f),d=[];if(n.forEach((function(t,e){d[e]={x:0,y:0}})),this.applyCalculate(n,r,d,h,f),u){for(var p in t)t[p].cx=0,t[p].cy=0,t[p].count=0;for(var p in n.forEach((function(e){var n=t[e.cluster];(0,a.isNumber)(e.x)&&(n.cx+=e.x),(0,a.isNumber)(e.y)&&(n.cy+=e.y),n.count++})),t)t[p].cx/=t[p].count,t[p].cy/=t[p].count;var g=this.clusterGravity||o;n.forEach((function(e,n){if((0,a.isNumber)(e.x)&&(0,a.isNumber)(e.y)){var r=t[e.cluster],i=Math.sqrt((e.x-r.cx)*(e.x-r.cx)+(e.y-r.cy)*(e.y-r.cy)),o=h*g;d[n].x-=o*(e.x-r.cx)/i,d[n].y-=o*(e.y-r.cy)/i}}))}n.forEach((function(t,e){if((0,a.isNumber)(t.x)&&(0,a.isNumber)(t.y)){var n=.01*h*o;d[e].x-=n*(t.x-i[0]),d[e].y-=n*(t.y-i[1])}})),n.forEach((function(t,e){if((0,a.isNumber)(t.fx)&&(0,a.isNumber)(t.fy))return t.x=t.fx,void(t.y=t.fy);if((0,a.isNumber)(t.x)&&(0,a.isNumber)(t.y)){var n=Math.sqrt(d[e].x*d[e].x+d[e].y*d[e].y);if(n>0){var r=Math.min(l*(s/800),n);t.x+=d[e].x/n*r,t.y+=d[e].y/n*r}}})),null===(e=this.tick)||void 0===e||e.call(this)}},e.prototype.applyCalculate=function(t,e,n,r,i){this.calRepulsive(t,n,i),e&&this.calAttractive(e,n,r)},e.prototype.calRepulsive=function(t,e,n){t.forEach((function(r,i){e[i]={x:0,y:0},t.forEach((function(t,o){if(i!==o&&(0,a.isNumber)(r.x)&&(0,a.isNumber)(t.x)&&(0,a.isNumber)(r.y)&&(0,a.isNumber)(t.y)){var s=r.x-t.x,u=r.y-t.y,c=s*s+u*u;if(0===c){c=1;var l=i>o?1:-1;s=.01*l,u=.01*l}var f=n/c;e[i].x+=s*f,e[i].y+=u*f}}))}))},e.prototype.calAttractive=function(t,e,n){var r=this;t.forEach((function(t){var i=(0,a.getEdgeTerminal)(t,"source"),o=(0,a.getEdgeTerminal)(t,"target");if(i&&o){var s=r.nodeIdxMap[i],u=r.nodeIdxMap[o];if(s!==u){var c=r.nodeMap[i],l=r.nodeMap[o];if((0,a.isNumber)(l.x)&&(0,a.isNumber)(c.x)&&(0,a.isNumber)(l.y)&&(0,a.isNumber)(c.y)){var f=l.x-c.x,h=l.y-c.y,d=Math.sqrt(f*f+h*h),p=d*d/n;e[u].x-=f/d*p,e[u].y-=h/d*p,e[s].x+=f/d*p,e[s].y+=h/d*p}}}}))},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){this.stop(),this.tick=null,this.nodes=null,this.edges=null,this.destroyed=!0},e.prototype.getType=function(){return"fruchterman"},e}(o.Base);e.FruchtermanLayout=s},function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]v[1]?v[0]:v[1])/2;p=function(t){return m}}else{var b=v/2;p=function(t){return b}}else p=function(t){return t.size?(0,a.isArray)(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])/2:(0,a.isObject)(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)/2:t.size/2:10};this.nodeSize=p;var x,w=this.comboSpacing;x=(0,a.isNumber)(w)?function(){return w}:(0,a.isFunction)(w)?w:function(){return 0},this.comboSpacing=x;var _,E=this.comboPadding;_=(0,a.isNumber)(E)?function(){return E}:(0,a.isArray)(E)?function(){return Math.max.apply(null,E)}:(0,a.isFunction)(E)?E:function(){return 0},this.comboPadding=_;var S,M=this.linkDistance;M||(M=10),S=(0,a.isNumber)(M)?function(t){return M}:M,this.linkDistance=S;var O,k=this.edgeStrength;k||(k=1),O=(0,a.isNumber)(k)?function(t){return k}:k,this.edgeStrength=O;var A,C=this.nodeStrength;C||(C=30),A=(0,a.isNumber)(C)?function(t){return C}:C,this.nodeStrength=A},e.prototype.initPos=function(t){this.nodes.forEach((function(e,n){var r=e.comboId,i=t[r];r&&i?(e.x=i.cx+100/(n+1),e.y=i.cy+100/(n+1)):(e.x=100/(n+1),e.y=100/(n+1))}))},e.prototype.getComboMap=function(){var t=this,e=t.nodeMap,n=t.comboTrees,r=t.oriComboMap,i={};return(n||[]).forEach((function(n){var o=[];(0,a.traverseTreeUp)(n,(function(n){if("node"===n.itemType)return!0;if(!r[n.id])return!0;if(void 0===i[n.id]){var s={id:n.id,name:n.id,cx:0,cy:0,count:0,depth:t.oriComboMap[n.id].depth||0,children:[]};i[n.id]=s}var u=n.children;u&&u.forEach((function(t){if(!i[t.id]&&!e[t.id])return!0;o.push(t)}));var c=i[n.id];if(c.cx=0,c.cy=0,0===o.length){c.empty=!0;var l=r[n.id];c.cx=l.x,c.cy=l.y}return o.forEach((function(t){if(c.count++,"node"!==t.itemType){var n=i[t.id];return(0,a.isNumber)(n.cx)&&(c.cx+=n.cx),void((0,a.isNumber)(n.cy)&&(c.cy+=n.cy))}var r=e[t.id];r&&((0,a.isNumber)(r.x)&&(c.cx+=r.x),(0,a.isNumber)(r.y)&&(c.cy+=r.y))})),c.cx/=c.count||1,c.cy/=c.count||1,c.children=o,!0}))})),i},e.prototype.applyComboCenterForce=function(t){var e=this.gravity,n=this.comboGravity||e,r=this.alpha,i=this.comboTrees,o=this.indexMap,s=this.nodeMap,u=this.comboMap;(i||[]).forEach((function(e){(0,a.traverseTreeUp)(e,(function(e){if("node"===e.itemType)return!0;if(!u[e.id])return!0;var i=u[e.id],c=(i.depth+1)/10*.5,l=i.cx,f=i.cy;return i.cx=0,i.cy=0,i.children.forEach((function(e){if("node"!==e.itemType){var h=u[e.id];return h&&(0,a.isNumber)(h.cx)&&(i.cx+=h.cx),void(h&&(0,a.isNumber)(h.cy)&&(i.cy+=h.cy))}var d=s[e.id],p=d.x-l||.005,g=d.y-f||.005,v=Math.sqrt(p*p+g*g),y=o[d.id],m=n*r/v*c;t[y].x-=p*m,t[y].y-=g*m,(0,a.isNumber)(d.x)&&(i.cx+=d.x),(0,a.isNumber)(d.y)&&(i.cy+=d.y)})),i.cx/=i.count||1,i.cy/=i.count||1,!0}))}))},e.prototype.applyCalculate=function(t){var e=this.comboMap,n=this.nodes,r={};n.forEach((function(t,e){n.forEach((function(n,i){if(!(eo&&(c.minX=o),c.minY>a&&(c.minY=a),c.maxX1&&a.forEach((function(n,s){if("node"===n.itemType)return!1;var u=e[n.id];u&&a.forEach((function(a,c){if(s<=c)return!1;if("node"===a.itemType)return!1;var l=e[a.id];if(!l)return!1;var f=u.cx-l.cx||.005,h=u.cy-l.cy||.005,d=f*f+h*h,p=u.r||1,g=l.r||1,v=p+g,y=g*g,m=p*p;if(di)){var y=e["".concat(d.id,"-").concat(n.id)],m=y.vx,b=y.vy,x=Math.log(Math.abs(n.depth-d.depth)/10)+1||1;x=x<1?1:x,n.comboId!==d.comboId&&(x+=1);var w=x?Math.pow(f,x):1,_=o(n)*a/g*w;if(t[p].x+=m*_,t[p].y+=b*_,p=0;E--)_(E);return{nodes:e,edges:n,combos:r,comboEdges:i}},e.prototype.getInnerGraphs=function(t){var e=this.comboTrees,n=this.nodeSize,r=this.edges,i=this.comboPadding,a=this.spacing,s={},l=this.innerLayout||new c.ConcentricLayout({type:"concentric",sortBy:"id"});return l.center=[0,0],l.preventOverlap=!0,l.nodeSpacing=a,(e||[]).forEach((function(e){(0,u.traverseTreeUp)(e,(function(e){var a,c=(null==i?void 0:i(e))||10;if((0,u.isArray)(c)&&(c=Math.max.apply(Math,c)),null===(a=e.children)||void 0===a?void 0:a.length){var f=e.children.map((function(e){if("combo"===e.itemType)return s[e.id];var n=t[e.id]||{};return o(o({},n),e)})),h=f.map((function(t){return t.id})),d={nodes:f,edges:r.filter((function(t){return h.includes(t.source)&&h.includes(t.target)}))},p=1/0;f.forEach((function(t){var e;t.size||(t.size=(null===(e=s[t.id])||void 0===e?void 0:e.size)||(null==n?void 0:n(t))||[30,30]),(0,u.isNumber)(t.size)&&(t.size=[t.size,t.size]),p>t.size[0]&&(p=t.size[0]),p>t.size[1]&&(p=t.size[1])})),l.layout(d);var g=(0,u.getLayoutBBox)(f),v=g.minX,y=g.minY,m=g.maxX,b=g.maxY,x={x:(m+v)/2,y:(b+y)/2};d.nodes.forEach((function(t){t.x-=x.x,t.y-=x.y}));var w=Math.max(m-v,p)+2*c,_=Math.max(b-y,p)+2*c;s[e.id]={id:e.id,nodes:f,size:[w,_]}}else if("combo"===e.itemType){var E=c?[2*c,2*c]:[30,30];s[e.id]={id:e.id,nodes:[],size:E}}return!0}))})),s},e.prototype.initVals=function(){var t,e,n=this.nodeSize,r=this.spacing;if(e=(0,u.isNumber)(r)?function(){return r}:(0,u.isFunction)(r)?r:function(){return 0},this.spacing=e,n)if((0,u.isFunction)(n))t=function(t){var r=n(t),i=e(t);return(0,u.isArray)(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+i)/2:((r||10)+i)/2};else if((0,u.isArray)(n)){var i=(n[0]>n[1]?n[0]:n[1])/2;t=function(t){return i+e(t)/2}}else{var o=n/2;t=function(t){return o+e(t)/2}}else t=function(t){var n=e(t);return t.size?(0,u.isArray)(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2:(0,u.isObject)(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+n)/2:(t.size+n)/2:10+n/2};this.nodeSize=t;var a,s=this.comboPadding;a=(0,u.isNumber)(s)?function(){return s}:(0,u.isArray)(s)?function(){return Math.max.apply(null,s)}:(0,u.isFunction)(s)?s:function(){return 0},this.comboPadding=a},e.prototype.getType=function(){return"comboCombined"},e}(s.Base);e.ComboCombinedLayout=l},function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ForceAtlas2Layout=void 0;var a=n(18),s=n(15),u=o(n(203)),c=o(n(204)),l=o(n(205)),f=function(t){function e(e){var n=t.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.kr=5,n.kg=1,n.mode="normal",n.preventOverlap=!1,n.dissuadeHubs=!1,n.barnesHut=void 0,n.maxIteration=0,n.ks=.1,n.ksmax=10,n.tao=.1,n.onLayoutEnd=function(){},n.prune=void 0,n.updateCfg(e),n}return i(e,t),e.prototype.getDefaultCfg=function(){return{}},e.prototype.execute=function(){var t=this.nodes,e=this.onLayoutEnd,n=this.prune,r=this.maxIteration;this.width||"undefined"==typeof window||(this.width=window.innerWidth),this.height||"undefined"==typeof window||(this.height=window.innerHeight);for(var i=[],o=t.length,a=0;a250&&(this.barnesHut=!0),void 0===this.prune&&o>100&&(this.prune=!0),0!==this.maxIteration||this.prune?0===this.maxIteration&&n&&(r=100,o<=200&&o>100?r=500:o>200&&(r=950),this.maxIteration=r):(r=250,o<=200&&o>100?r=1e3:o>200&&(r=1200),this.maxIteration=r),this.kr||(this.kr=50,o>100&&o<=500?this.kr=20:o>500&&(this.kr=1)),this.kg||(this.kg=20,o>100&&o<=500?this.kg=10:o>500&&(this.kg=1)),this.nodes=this.updateNodesByForces(i),e()},e.prototype.updateNodesByForces=function(t){for(var e=this.edges,n=this.maxIteration,r=this.nodes,i=e.filter((function(t){return(0,s.getEdgeTerminal)(t,"source")!==(0,s.getEdgeTerminal)(t,"target")})),o=r.length,a=i.length,u=[],c={},l={},f=[],h=0;h0;){for(y=0;y50||!c)?this.getOptRepGraForces(p,v,i):this.getRepGraForces(d,50,p,100,o,i);var b=this.updatePos(p,g,h,i);a=b.nodes,h=b.sg,d--,this.tick&&this.tick()}return a},e.prototype.getAttrForces=function(t,e,n,r,i,o,a,s){for(var u=this.nodes,c=this.preventOverlap,l=this.dissuadeHubs,f=this.mode,h=this.prune,d=0;d0&&(x=b,w=b),s[2*r[p.id]]+=x*m[0],s[2*r[v.id]]-=w*m[0],s[2*r[p.id]+1]+=x*m[1],s[2*r[v.id]+1]-=w*m[1]}}return s},e.prototype.getRepGraForces=function(t,e,n,r,i,o){for(var a=this.nodes,s=this.preventOverlap,u=this.kr,c=this.kg,l=this.center,f=this.prune,h=a.length,d=0;d0&&(y=u*(o[d]+1)*(o[p]+1)/v),n[2*d]-=y*g[0],n[2*p]+=y*g[0],n[2*d+1]-=y*g[1],n[2*p+1]+=y*g[1]}var m=[a[d].x-l[0],a[d].y-l[1]],b=Math.hypot(m[0],m[1]);m[0]=m[0]/b,m[1]=m[1]/b;var x=c*(o[d]+1);n[2*d]-=x*m[0],n[2*d+1]-=x*m[1]}return n},e.prototype.getOptRepGraForces=function(t,e,n){for(var r=this.nodes,i=this.kg,o=this.center,a=this.prune,s=r.length,u=9e10,f=-9e10,h=9e10,d=-9e10,p=0;p=f&&(f=r[p].x),r[p].x<=u&&(u=r[p].x),r[p].y>=d&&(d=r[p].y),r[p].y<=h&&(h=r[p].y));var g={xmid:(f+u)/2,ymid:(d+h)/2,length:Math.max(f-u,d-h),massCenter:o,mass:s},v=new c.default(g),y=new l.default(v);for(p=0;p1.5*x?1.5*x:n);for(g=0;gE?E:w)*t[2*g],M=w*t[2*g+1];i[g].x+=S,i[g].y+=M}return{nodes:i,sg:n}},e}(a.Base);e.ForceAtlas2Layout=f},function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ERLayout=void 0;var a=n(18),s=o(n(206)),u=function(t){function e(e){var n=t.call(this)||this;return n.width=300,n.height=300,n.nodeMinGap=50,n.onLayoutEnd=function(){},e&&n.updateCfg(e),n}return i(e,t),e.prototype.getDefaultCfg=function(){return{width:300,height:300,nodeMinGap:50}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.edges;return null==e||e.forEach((function(t){t.size||(t.size=[50,50])})),(0,s.default)({nodes:e,edges:n},{width:this.width,height:this.height,nodeMinGap:this.nodeMinGap}).then((function(){t.onLayoutEnd&&t.onLayoutEnd()}))},e.prototype.getType=function(){return"er"},e}(a.Base);e.ERLayout=u},function(t,e,n){"use strict";function r(t){return[parseInt(t.substr(1,2),16),parseInt(t.substr(3,2),16),parseInt(t.substr(5,2),16)]}function i(t){var e=Math.round(t).toString(16);return 1===e.length?"0"+e:e}function o(t){return"#"+i(t[0])+i(t[1])+i(t[2])}n.r(e),n.d(e,"rgb2arr",(function(){return r})),n.d(e,"gradient",(function(){return l})),n.d(e,"toRGB",(function(){return u})),n.d(e,"toCSSGradient",(function(){return p})),n.d(e,"transform",(function(){return b})),n.d(e,"direction",(function(){return x})),n.d(e,"angleTo",(function(){return w})),n.d(e,"vertical",(function(){return _})),n.d(e,"path2String",(function(){return E})),n.d(e,"path2Curve",(function(){return q})),n.d(e,"path2Absolute",(function(){return z})),n.d(e,"clonePath",(function(){return Z})),n.d(e,"normalizePath",(function(){return Y})),n.d(e,"reverseCurve",(function(){return K})),n.d(e,"arcToCubic",(function(){return X})),n.d(e,"getPathBBox",(function(){return st})),n.d(e,"getTotalLength",(function(){return ut})),n.d(e,"getPathBBoxTotalLength",(function(){return ct})),n.d(e,"getRotatedCurve",(function(){return lt})),n.d(e,"getPathArea",(function(){return ft})),n.d(e,"getDrawDirection",(function(){return ht})),n.d(e,"getPointAtLength",(function(){return dt})),n.d(e,"isPointInStroke",(function(){return gt})),n.d(e,"distanceSquareRoot",(function(){return Q})),n.d(e,"equalizeSegments",(function(){return yt})),n.d(e,"contains",(function(){return bt})),n.d(e,"includes",(function(){return bt})),n.d(e,"difference",(function(){return wt})),n.d(e,"find",(function(){return Dt})),n.d(e,"findIndex",(function(){return Lt})),n.d(e,"firstValue",(function(){return Rt})),n.d(e,"flatten",(function(){return Bt})),n.d(e,"flattenDeep",(function(){return Ft})),n.d(e,"getRange",(function(){return Yt})),n.d(e,"pull",(function(){return Vt})),n.d(e,"pullAt",(function(){return qt})),n.d(e,"reduce",(function(){return Zt})),n.d(e,"remove",(function(){return Kt})),n.d(e,"sortBy",(function(){return $t})),n.d(e,"union",(function(){return te})),n.d(e,"uniq",(function(){return Jt})),n.d(e,"valuesOfKey",(function(){return ee})),n.d(e,"head",(function(){return ne})),n.d(e,"last",(function(){return re})),n.d(e,"startsWith",(function(){return ie})),n.d(e,"endsWith",(function(){return oe})),n.d(e,"filter",(function(){return xt})),n.d(e,"every",(function(){return ae})),n.d(e,"some",(function(){return se})),n.d(e,"group",(function(){return fe})),n.d(e,"groupBy",(function(){return ce})),n.d(e,"groupToMap",(function(){return le})),n.d(e,"getWrapBehavior",(function(){return he})),n.d(e,"wrapBehavior",(function(){return de})),n.d(e,"number2color",(function(){return ge})),n.d(e,"parseRadius",(function(){return ve})),n.d(e,"clamp",(function(){return ye})),n.d(e,"fixedBase",(function(){return me})),n.d(e,"isDecimal",(function(){return xe})),n.d(e,"isEven",(function(){return we})),n.d(e,"isInteger",(function(){return _e})),n.d(e,"isNegative",(function(){return Ee})),n.d(e,"isNumberEqual",(function(){return Se})),n.d(e,"isOdd",(function(){return Me})),n.d(e,"isPositive",(function(){return Oe})),n.d(e,"max",(function(){return zt})),n.d(e,"maxBy",(function(){return ke})),n.d(e,"min",(function(){return Gt})),n.d(e,"minBy",(function(){return Ae})),n.d(e,"mod",(function(){return Ce})),n.d(e,"toDegree",(function(){return Ie})),n.d(e,"toInteger",(function(){return Te})),n.d(e,"toRadian",(function(){return Pe})),n.d(e,"forIn",(function(){return De})),n.d(e,"has",(function(){return Le})),n.d(e,"hasKey",(function(){return Re})),n.d(e,"hasValue",(function(){return Fe})),n.d(e,"keys",(function(){return jt})),n.d(e,"isMatch",(function(){return It})),n.d(e,"values",(function(){return Be})),n.d(e,"lowerCase",(function(){return Ge})),n.d(e,"lowerFirst",(function(){return Ye})),n.d(e,"substitute",(function(){return Ue})),n.d(e,"upperCase",(function(){return Xe})),n.d(e,"upperFirst",(function(){return We})),n.d(e,"getType",(function(){return He})),n.d(e,"isArguments",(function(){return qe})),n.d(e,"isArray",(function(){return Ot})),n.d(e,"isArrayLike",(function(){return mt})),n.d(e,"isBoolean",(function(){return Ze})),n.d(e,"isDate",(function(){return Ke})),n.d(e,"isError",(function(){return Qe})),n.d(e,"isFunction",(function(){return _t})),n.d(e,"isFinite",(function(){return $e})),n.d(e,"isNil",(function(){return Et})),n.d(e,"isNull",(function(){return Je})),n.d(e,"isNumber",(function(){return be})),n.d(e,"isObject",(function(){return At})),n.d(e,"isObjectLike",(function(){return Nt})),n.d(e,"isPlainObject",(function(){return Pt})),n.d(e,"isPrototype",(function(){return en})),n.d(e,"isRegExp",(function(){return nn})),n.d(e,"isString",(function(){return Qt})),n.d(e,"isType",(function(){return Mt})),n.d(e,"isUndefined",(function(){return rn})),n.d(e,"isElement",(function(){return on})),n.d(e,"requestAnimationFrame",(function(){return an})),n.d(e,"clearAnimationFrame",(function(){return sn})),n.d(e,"augment",(function(){return ln})),n.d(e,"clone",(function(){return hn})),n.d(e,"debounce",(function(){return dn})),n.d(e,"memoize",(function(){return pn})),n.d(e,"deepMix",(function(){return yn})),n.d(e,"each",(function(){return Ct})),n.d(e,"extend",(function(){return mn})),n.d(e,"indexOf",(function(){return bn})),n.d(e,"isEmpty",(function(){return wn})),n.d(e,"isEqual",(function(){return _n})),n.d(e,"isEqualWith",(function(){return En})),n.d(e,"map",(function(){return Sn})),n.d(e,"mapValues",(function(){return On})),n.d(e,"mix",(function(){return cn})),n.d(e,"assign",(function(){return cn})),n.d(e,"get",(function(){return kn})),n.d(e,"set",(function(){return An})),n.d(e,"pick",(function(){return jn})),n.d(e,"omit",(function(){return In})),n.d(e,"throttle",(function(){return Tn})),n.d(e,"toArray",(function(){return Nn})),n.d(e,"toString",(function(){return ze})),n.d(e,"uniqueId",(function(){return Dn})),n.d(e,"noop",(function(){return Ln})),n.d(e,"identity",(function(){return Rn})),n.d(e,"size",(function(){return Bn})),n.d(e,"Cache",(function(){return Fn})),n.d(e,"isPointInPolygon",(function(){return Yn})),n.d(e,"isPolygonsIntersect",(function(){return Hn}));var a,s=/rgba?\(([\s.,0-9]+)\)/;function u(t){if("#"===t[0]&&7===t.length)return t;var e;a||((e=document.createElement("i")).title="Web Colour Picker",e.style.display="none",document.body.appendChild(e),a=e),a.style.color=t;var n=document.defaultView.getComputedStyle(a,"").getPropertyValue("color");return n=o(s.exec(n)[1].split(/\s*,\s*/).map((function(t){return Number(t)})))}function c(t,e,n,r){return t[r]+(e[r]-t[r])*n}function l(t){var e=("string"==typeof t?t.split("-"):t).map((function(t){return r(-1===t.indexOf("#")?u(t):t)}));return function(t){return function(t,e){var n=isNaN(Number(e))||e<0?0:e>1?1:Number(e),r=t.length-1,i=Math.floor(r*n),a=r*n-i,s=t[i],u=i===r?s:t[i+1];return o([c(s,u,a,0),c(s,u,a,1),c(s,u,a,2)])}(e,t)}}var f=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,h=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,d=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function p(t){if(/^[r,R,L,l]{1}[\s]*\(/.test(t)){var e,n=void 0;if("l"===t[0]){var r=+(i=f.exec(t))[1]+90;n=i[2],e="linear-gradient("+r+"deg, "}else if("r"===t[0]){var i;e="radial-gradient(",n=(i=h.exec(t))[4]}var o=n.match(d);return o.forEach((function(t,n){var r=t.split(":");e+=r[1]+" "+100*Number(r[0])+"%",n!==o.length-1&&(e+=", ")})),e+=")"}return t}var g=n(8);function v(t,e,n){var r=[0,0,0,0,0,0,0,0,0];return g.mat3.fromRotation(r,n),g.mat3.multiply(t,r,e)}function y(t,e,n){var r=[0,0,0,0,0,0,0,0,0];return g.mat3.fromScaling(r,n),g.mat3.multiply(t,r,e)}function m(t,e,n){return g.mat3.multiply(t,n,e)}function b(t,e){for(var n,r,i,o,a=t?[].concat(t):[1,0,0,0,1,0,0,0,1],s=0,u=e.length;s=0;return n?i?2*Math.PI-r:r:i?r:2*Math.PI-r}function _(t,e,n){return n?(t[0]=e[1],t[1]=-1*e[0]):(t[0]=-1*e[1],t[1]=e[0]),t}function E(t,e){return void 0===e&&(e="off"),function(t,e){if("off"===e)return[].concat(t);var n="number"==typeof e&&e>=1?Math.pow(10,e):1;return t.map((function(t){var r=t.slice(1).map(Number).map((function(t){return e?Math.round(t*n)/n:Math.round(t)}));return[t[0]].concat(r)}))}(t,e).map((function(t){return t[0]+t.slice(1).join(" ")})).join("")}var S=n(1),M={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function O(t,e,n){if(t[n].length>7){t[n].shift();for(var r=t[n],i=n;r.length;)e[n]="A",t.splice(i+=1,0,["C"].concat(r.splice(0,6)));t.splice(n,1)}}var k={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function A(t){return Array.isArray(t)&&t.every((function(t){var e=t[0].toLowerCase();return k[e]===t.length-1&&"achlmqstvz".includes(e)}))}function C(t){return A(t)&&t.every((function(t){var e=t[0];return e===e.toUpperCase()}))}function j(t){return C(t)&&t.every((function(t){var e=t[0];return"ACLMQZ".includes(e)}))}function I(t){for(var e=t.pathValue[t.segmentStart],n=e.toLowerCase(),r=t.data;r.length>=k[n]&&("m"===n&&r.length>2?(t.segments.push([e].concat(r.splice(0,2))),n="l",e="m"===e?"l":"L"):t.segments.push([e].concat(r.splice(0,k[n]))),k[n]););}function T(t){var e=t.index,n=t.pathValue,r=n.charCodeAt(e);return 48===r?(t.param=0,void(t.index+=1)):49===r?(t.param=1,void(t.index+=1)):void(t.err='[path-util]: invalid Arc flag "'+n[e]+'", expecting 0 or 1 at index '+e)}function N(t){return t>=48&&t<=57||43===t||45===t||46===t}function P(t){return t>=48&&t<=57}function D(t){var e,n=t.max,r=t.pathValue,i=t.index,o=i,a=!1,s=!1,u=!1,c=!1;if(o>=n)t.err="[path-util]: Invalid path value at index "+o+', "pathValue" is missing param';else if(43!==(e=r.charCodeAt(o))&&45!==e||(o+=1,e=r.charCodeAt(o)),P(e)||46===e){if(46!==e){if(a=48===e,o+=1,e=r.charCodeAt(o),a&&o=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e));)t.index+=1}function R(t){var e=t.max,n=t.pathValue,r=t.index,i=n.charCodeAt(r),o=k[n[r].toLowerCase()];if(t.segmentStart=r,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(i))if(t.index+=1,L(t),t.data=[],o){for(;;){for(var a=o;a>0;a-=1){if(97!=(32|i)||3!==a&&4!==a?D(t):T(t),t.err.length)return;t.data.push(t.param),L(t),t.index=t.max)break;if(!N(n.charCodeAt(t.index)))break}I(t)}else I(t);else t.err='[path-util]: Invalid path value "'+n[r]+'" is not a path command'}var B=function(t){this.pathValue=t,this.segments=[],this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""};function F(t){if(A(t))return[].concat(t);var e=new B(t);for(L(e);e.index1&&(y*=O=Math.sqrt(O),m*=O);var k=y*y,A=m*m,C=(o===a?-1:1)*Math.sqrt(Math.abs((k*A-k*M*M-A*S*S)/(k*M*M+A*S*S)));d=C*y*M/m+(g+b)/2,p=C*-m*S/y+(v+x)/2,f=Math.asin(((v-p)/m*Math.pow(10,9)>>0)/Math.pow(10,9)),h=Math.asin(((x-p)/m*Math.pow(10,9)>>0)/Math.pow(10,9)),f=gh&&(f-=2*Math.PI),!a&&h>f&&(h-=2*Math.PI)}var j=h-f;if(Math.abs(j)>w){var I=h,T=b,N=x;h=f+w*(a&&h>f?1:-1),E=X(b=d+y*Math.cos(h),x=p+m*Math.sin(h),y,m,i,0,a,T,N,[h,I,d,p])}j=h-f;var P=Math.cos(f),D=Math.sin(f),L=Math.cos(h),R=Math.sin(h),B=Math.tan(j/4),F=4/3*y*B,z=4/3*m*B,G=[g,v],Y=[g+F*D,v-z*P],W=[b+F*R,x-z*L],V=[b,x];if(Y[0]=2*G[0]-Y[0],Y[1]=2*G[1]-Y[1],c)return Y.concat(W,V,E);for(var H=[],q=0,Z=(E=Y.concat(W,V,E)).length;q=o)a={x:n,y:r};else{var s=W([t,e],[n,r],i/o);a={x:s[0],y:s[1]}}return{length:o,point:a,min:{x:Math.min(t,n),y:Math.min(e,r)},max:{x:Math.max(t,n),y:Math.max(e,r)}}}function J(t,e){var n=t.x,r=t.y,i=e.x,o=e.y,a=n*i+r*o,s=Math.sqrt((Math.pow(n,2)+Math.pow(r,2))*(Math.pow(i,2)+Math.pow(o,2)));return(n*o-r*i<0?-1:1)*Math.acos(a/s)}function tt(t,e,n,r,i,o,a,s,u,c){var l=Math.abs,f=Math.sin,h=Math.cos,d=Math.sqrt,p=Math.PI,g=l(n),v=l(r),y=(i%360+360)%360*(p/180);if(t===s&&e===u)return{x:t,y:e};if(0===g||0===v)return $(t,e,s,u,c).point;var m=(t-s)/2,b=(e-u)/2,x={x:h(y)*m+f(y)*b,y:-f(y)*m+h(y)*b},w=Math.pow(x.x,2)/Math.pow(g,2)+Math.pow(x.y,2)/Math.pow(v,2);w>1&&(g*=d(w),v*=d(w));var _=(Math.pow(g,2)*Math.pow(v,2)-Math.pow(g,2)*Math.pow(x.y,2)-Math.pow(v,2)*Math.pow(x.x,2))/(Math.pow(g,2)*Math.pow(x.y,2)+Math.pow(v,2)*Math.pow(x.x,2)),E=(o!==a?1:-1)*d(_=_<0?0:_),S=E*(g*x.y/v),M=E*(-v*x.x/g),O=h(y)*S-f(y)*M+(t+s)/2,k=f(y)*S+h(y)*M+(e+u)/2,A={x:(x.x-S)/g,y:(x.y-M)/v},C=J({x:1,y:0},A),j=J(A,{x:(-x.x-S)/g,y:(-x.y-M)/v});!a&&j>0?j-=2*p:a&&j<0&&(j+=2*p);var I=C+(j%=2*p)*c,T=g*h(I),N=v*f(I);return{x:h(y)*T-f(y)*N+O,y:f(y)*T+h(y)*N+k}}function et(t,e,n,r,i,o,a,s,u,c,l){var f,h=l.bbox,d=void 0===h||h,p=l.length,g=void 0===p||p,v=l.sampleSize,y=void 0===v?30:v,m="number"==typeof c,b=t,x=e,w=0,_=[b,x,w],E=[b,x],S={x:0,y:0},M=[{x:b,y:x}];m&&c<=0&&(S={x:b,y:x});for(var O=0;O<=y;O+=1){if(b=(f=tt(t,e,n,r,i,o,a,s,u,O/y)).x,x=f.y,d&&M.push({x:b,y:x}),g&&(w+=Q(E,[b,x])),E=[b,x],m&&w>=c&&c>_[2]){var k=(w-c)/(w-_[2]);S={x:E[0]*(1-k)+_[0]*k,y:E[1]*(1-k)+_[1]*k}}_=[b,x,w]}return m&&c>=w&&(S={x:s,y:u}),{length:w,point:S,min:{x:Math.min.apply(null,M.map((function(t){return t.x}))),y:Math.min.apply(null,M.map((function(t){return t.y})))},max:{x:Math.max.apply(null,M.map((function(t){return t.x}))),y:Math.max.apply(null,M.map((function(t){return t.y})))}}}function nt(t,e,n,r,i,o,a,s,u){var c=1-u;return{x:Math.pow(c,3)*t+3*Math.pow(c,2)*u*n+3*c*Math.pow(u,2)*i+Math.pow(u,3)*a,y:Math.pow(c,3)*e+3*Math.pow(c,2)*u*r+3*c*Math.pow(u,2)*o+Math.pow(u,3)*s}}function rt(t,e,n,r,i,o,a,s,u,c){var l,f=c.bbox,h=void 0===f||f,d=c.length,p=void 0===d||d,g=c.sampleSize,v=void 0===g?10:g,y="number"==typeof u,m=t,b=e,x=0,w=[m,b,x],_=[m,b],E={x:0,y:0},S=[{x:m,y:b}];y&&u<=0&&(E={x:m,y:b});for(var M=0;M<=v;M+=1){if(m=(l=nt(t,e,n,r,i,o,a,s,M/v)).x,b=l.y,h&&S.push({x:m,y:b}),p&&(x+=Q(_,[m,b])),_=[m,b],y&&x>=u&&u>w[2]){var O=(x-u)/(x-w[2]);E={x:_[0]*(1-O)+w[0]*O,y:_[1]*(1-O)+w[1]*O}}w=[m,b,x]}return y&&u>=x&&(E={x:a,y:s}),{length:x,point:E,min:{x:Math.min.apply(null,S.map((function(t){return t.x}))),y:Math.min.apply(null,S.map((function(t){return t.y})))},max:{x:Math.max.apply(null,S.map((function(t){return t.x}))),y:Math.max.apply(null,S.map((function(t){return t.y})))}}}function it(t,e,n,r,i,o,a){var s=1-a;return{x:Math.pow(s,2)*t+2*s*a*n+Math.pow(a,2)*i,y:Math.pow(s,2)*e+2*s*a*r+Math.pow(a,2)*o}}function ot(t,e,n,r,i,o,a,s){var u,c=s.bbox,l=void 0===c||c,f=s.length,h=void 0===f||f,d=s.sampleSize,p=void 0===d?10:d,g="number"==typeof a,v=t,y=e,m=0,b=[v,y,m],x=[v,y],w={x:0,y:0},_=[{x:v,y:y}];g&&a<=0&&(w={x:v,y:y});for(var E=0;E<=p;E+=1){if(v=(u=it(t,e,n,r,i,o,E/p)).x,y=u.y,l&&_.push({x:v,y:y}),h&&(m+=Q(x,[v,y])),x=[v,y],g&&m>=a&&a>b[2]){var S=(m-a)/(m-b[2]);w={x:x[0]*(1-S)+b[0]*S,y:x[1]*(1-S)+b[1]*S}}b=[v,y,m]}return g&&a>=m&&(w={x:i,y:o}),{length:m,point:w,min:{x:Math.min.apply(null,_.map((function(t){return t.x}))),y:Math.min.apply(null,_.map((function(t){return t.y})))},max:{x:Math.max.apply(null,_.map((function(t){return t.x}))),y:Math.max.apply(null,_.map((function(t){return t.y})))}}}function at(t,e,n){for(var r,i,o,a,s,u,c,l,f,h=Y(t),d="number"==typeof e,p=[],g=0,v=0,y=0,m=0,b=[],x=[],w=0,_={x:0,y:0},E=_,S=_,M=_,O=0,k=0,A=h.length;k=e&&(M=S),x.push(E),b.push(_),O+=w,g=(u="Z"!==l?f.slice(-2):[y,m])[0],v=u[1];return d&&e>=O&&(M={x:g,y:v}),{length:O,point:M,min:{x:Math.min.apply(null,b.map((function(t){return t.x}))),y:Math.min.apply(null,b.map((function(t){return t.y})))},max:{x:Math.max.apply(null,x.map((function(t){return t.x}))),y:Math.max.apply(null,x.map((function(t){return t.y})))}}}function st(t,e){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var n=at(t,void 0,Object(S.__assign)(Object(S.__assign)({},e),{length:!1})),r=n.min,i=r.x,o=r.y,a=n.max,s=a.x,u=a.y,c=s-i,l=u-o;return{width:c,height:l,x:i,y:o,x2:s,y2:u,cx:i+c/2,cy:o+l/2,cz:Math.max(c,l)+Math.min(c,l)/2}}function ut(t,e){return at(t,void 0,Object(S.__assign)(Object(S.__assign)({},e),{bbox:!1,length:!0})).length}function ct(t,e){if(!t)return{length:0,x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var n=at(t,void 0,Object(S.__assign)(Object(S.__assign)({},e),{bbox:!0,length:!0})),r=n.length,i=n.min,o=i.x,a=i.y,s=n.max,u=s.x,c=s.y,l=u-o,f=c-a;return{length:r,width:l,height:f,x:o,y:a,x2:u,y2:c,cx:o+l/2,cy:a+f/2,cz:Math.max(l,f)+Math.min(l,f)/2}}function lt(t,e){var n=t.length-1,r=[],i=0,o=function(t){var e=t.length,n=e-1;return t.map((function(r,i){return t.map((function(r,o){var a,s=i+o;return 0===o||t[s]&&"M"===t[s][0]?(a=t[s],["M"].concat(a.slice(-2))):(s>=e&&(s-=n),t[s])}))}))}(t);return o.forEach((function(o,a){t.slice(1).forEach((function(r,o){i+=Q(t[(a+o)%n].slice(-2),e[o%n].slice(-2))})),r[a]=i,i=0})),o[r.indexOf(Math.min.apply(null,r))]}function ft(t){var e=0,n=0,r=0;return q(t).map((function(t){var i;switch(t[0]){case"M":return e=t[1],n=t[2],0;default:var o=t.slice(1),a=o[0],s=o[1],u=o[2],c=o[3],l=o[4],f=o[5];return r=function(t,e,n,r,i,o,a,s){return 3*((s-e)*(n+i)-(a-t)*(r+o)+r*(t-i)-n*(e-o)+s*(i+t/3)-a*(o+e/3))/20}(e,n,a,s,u,c,l,f),i=t.slice(-2),e=i[0],n=i[1],r}})).reduce((function(t,e){return t+e}),0)}function ht(t){return ft(t)>=0}function dt(t,e,n){return at(t,e,Object(S.__assign)(Object(S.__assign)({},n),{bbox:!1,length:!0})).point}function pt(t,e){for(var n,r,i,o,a=F(t),s=Y(a),u=ut(a),c=function(t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},l=8,f=0,h=0,d=1/0,p=0;p<=u;p+=l)(f=c(n=dt(s,p))).5;)y=c(i=dt(s,g=h-l)),m=c(o=dt(s,v=h+l)),g>=0&&y=i)return s=i-(a=ut(r=n.slice(0,-1))),{segment:n[o],index:o,length:s,lengthAtSegment:a};for(var f=[];o>0;)u=r[o],s=i-(a=ut(r=r.slice(0,-1))),i=a,f.push({segment:u,index:o,length:s,lengthAtSegment:a}),o-=1;return f.find((function(t){return t.lengthAtSegment<=e}))}(a,h);return{closest:r,distance:Math.sqrt(d),segment:b}}function gt(t,e){var n=pt(t,e).distance;return Math.abs(n)<.001}function vt(t){return t.map((function(t,e,n){var r=e&&n[e-1].slice(-2).concat(t.slice(1)),i=e?rt(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],{bbox:!1}).length:0;return{s:t,ss:e?i?function(t,e){void 0===e&&(e=.5);var n=t.slice(0,2),r=t.slice(2,4),i=t.slice(4,6),o=t.slice(6,8),a=W(n,r,e),s=W(r,i,e),u=W(i,o,e),c=W(a,s,e),l=W(s,u,e),f=W(c,l,e);return[["C"].concat(a,c,f),["C"].concat(l,u,o)]}(r):[t,t]:[t],l:i}}))}function yt(t,e,n){var r=vt(t),i=vt(e),o=r.length,a=i.length,s=r.filter((function(t){return t.l})).length,u=i.filter((function(t){return t.l})).length,c=r.filter((function(t){return t.l})).reduce((function(t,e){return t+e.l}),0)/s||0,l=i.filter((function(t){return t.l})).reduce((function(t,e){return t+e.l}),0)/u||0,f=n||Math.max(o,a),h=[c,l],d=[f-o,f-a],p=0,g=[r,i].map((function(t,e){return t.l===f?t.map((function(t){return t.s})):t.map((function(t,n){return p=n&&d[e]&&t.l>=h[e],d[e]-=p?1:0,p?t.ss:[t.s]})).flat()}));return g[0].length===g[1].length?g:yt(g[0],g[1],f)}var mt=function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)},bt=function(t,e){return!!mt(t)&&t.indexOf(e)>-1},xt=function(t,e){if(!mt(t))return t;for(var n=[],r=0;r-1;)Xt.call(t,o,1);return t},Ht=Array.prototype.splice,qt=function(t,e){if(!mt(t))return[];for(var n=t?e.length:0,r=n-1;n--;){var i=void 0,o=e[n];n!==r&&o===i||(i=o,Ht.call(t,o,1))}return t},Zt=function(t,e,n){if(!Ot(t)&&!Pt(t))return t;var r=n;return Ct(t,(function(t,n){r=e(r,t,n)})),r},Kt=function(t,e){var n=[];if(!mt(t))return n;for(var r=-1,i=[],o=t.length;++re[i])return 1;if(t[i]n?n:t},me=function(t,e){var n=e.toString(),r=n.indexOf(".");if(-1===r)return Math.round(t);var i=n.substr(r+1).length;return i>20&&(i=20),parseFloat(t.toFixed(i))},be=function(t){return Mt(t,"Number")},xe=function(t){return be(t)&&t%1!=0},we=function(t){return be(t)&&t%2==0},_e=Number.isInteger?Number.isInteger:function(t){return be(t)&&t%1==0},Ee=function(t){return be(t)&&t<0};function Se(t,e,n){return void 0===n&&(n=1e-5),Math.abs(t-e)0},ke=function(t,e){if(Ot(t)){for(var n,r=-1/0,i=0;ir&&(n=o,r=a)}return n}},Ae=function(t,e){if(Ot(t)){for(var n,r=1/0,i=0;ie?(r&&(clearTimeout(r),r=null),s=c,a=t.apply(i,o),r||(i=o=null)):r||!1===n.trailing||(r=setTimeout(u,l)),a};return c.cancel=function(){clearTimeout(r),s=0,r=i=o=null},c},Nn=function(t){return mt(t)?Array.prototype.slice.call(t):[]},Pn={},Dn=function(t){return Pn[t=t||"g"]?Pn[t]+=1:Pn[t]=1,t+Pn[t]},Ln=function(){},Rn=function(t){return t};function Bn(t){return Et(t)?0:mt(t)?t.length:Object.keys(t).length}var Fn=function(){function t(){this.map={}}return t.prototype.has=function(t){return void 0!==this.map[t]},t.prototype.get=function(t,e){var n=this.map[t];return void 0===n?e:n},t.prototype.set=function(t,e){this.map[t]=e},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(t){delete this.map[t]},t.prototype.size=function(){return Object.keys(this.map).length},t}();function zn(t){return Math.abs(t)<1e-6?0:t<0?-1:1}function Gn(t,e,n){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1])}function Yn(t,e,n){var r=!1,i=t.length;if(i<=2)return!1;for(var o=0;o0!=zn(s[1]-n)>0&&zn(e-(n-a[1])*(a[0]-s[0])/(a[1]-s[1])-a[0])<0&&(r=!r)}return r}var Un=function(t,e,n){return t>=e&&t<=n};function Xn(t){for(var e=[],n=t.length,r=0;r1){var a=t[0],s=t[n-1];e.push({from:{x:s[0],y:s[1]},to:{x:a[0],y:a[1]}})}return e}function Wn(t,e){var n=!1;return t.forEach((function(t){if(function(t,e,n,r){var i=n.x-t.x,o=n.y-t.y,a=e.x-t.x,s=e.y-t.y,u=r.x-n.x,c=r.y-n.y,l=a*c-s*u,f=null;if(l*l>.001*(a*a+s*s)*(u*u+c*c)){var h=(i*c-o*u)/l,d=(i*s-o*a)/l;Un(h,0,1)&&Un(d,0,1)&&(f={x:t.x+h*a,y:t.y+h*s})}return f}(t.from,t.to,e.from,e.to))return n=!0,!1})),n}function Vn(t){var e=t.map((function(t){return t[0]})),n=t.map((function(t){return t[1]}));return{minX:Math.min.apply(null,e),maxX:Math.max.apply(null,e),minY:Math.min.apply(null,n),maxY:Math.max.apply(null,n)}}function Hn(t,e){if(t.length<2||e.length<2)return!1;var n,r,i=Vn(t),o=Vn(e);if(n=i,(r=o).minX>n.maxX||r.maxXn.maxY||r.maxY1&&void 0!==arguments[1]?arguments[1]:{};if(!i(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,o=e.toIndex,a=void 0===o?t.length:o;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=r||a>t.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[r],u=r+1;us&&(s=t[u]);return s}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!i(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,o=e.toIndex,a=void 0===o?t.length:o;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=r||a>t.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[r],u=r+1;u1&&void 0!==arguments[1]?arguments[1]:{};if(!i(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==n.output){if(!i(n.output))throw new TypeError("output option must be an array if specified");e=n.output}else e=new Array(t.length);var r=a(t),s=o(t);if(r===s)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var u=n.min,c=void 0===u?n.autoMinMax?r:0:u,l=n.max,f=void 0===l?n.autoMinMax?s:1:l;if(c>=f)throw new RangeError("min option must be smaller than max option");for(var h=(f-c)/(s-r),d=0;d1&&void 0!==arguments[1]?arguments[1]:{},n=e.maxRows,r=void 0===n?15:n,i=e.maxColumns,o=void 0===i?10:i,a=e.maxNumSize,s=void 0===a?8:a,l=e.padMinus,h=void 0===l?"auto":l;return"".concat(t.constructor.name," {\n").concat(u,"[\n").concat(c).concat(f(t,r,o,s,h),"\n").concat(u,"]\n").concat(u,"rows: ").concat(t.rows,"\n").concat(u,"columns: ").concat(t.columns,"\n}")}function f(t,e,n,r,i){var o=t.rows,a=t.columns,s=Math.min(o,e),u=Math.min(a,n),l=[];if("auto"===i){i=!1;t:for(var f=0;f=0&&n?" ".concat(d(t,e-1)):d(t,e)).padEnd(e)}function d(t,e){var n=t.toString();if(n.length<=e)return n;var r=t.toFixed(e);if(r.length>e&&(r=t.toFixed(Math.max(0,e-(r.length-e)))),r.length<=e&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;var i=t.toExponential(e);return i.length>e&&(i=t.toExponential(Math.max(0,e-(i.length-e)))),i.slice(0)}function p(t,e,n){var r=n?t.rows:t.rows-1;if(e<0||e>r)throw new RangeError("Row index out of range")}function g(t,e,n){var r=n?t.columns:t.columns-1;if(e<0||e>r)throw new RangeError("Column index out of range")}function v(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function y(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function m(t,e){if(!i(e))throw new TypeError("row indices must be an array");for(var n=0;n=t.rows)throw new RangeError("row indices are out of range")}function b(t,e){if(!i(e))throw new TypeError("column indices must be an array");for(var n=0;n=t.columns)throw new RangeError("column indices are out of range")}function x(t,e,n,r,i){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(_("startRow",e),_("endRow",n),_("startColumn",r),_("endColumn",i),e>n||r>i||e<0||e>=t.rows||n<0||n>=t.rows||r<0||r>=t.columns||i<0||i>=t.columns)throw new RangeError("Submatrix indices are out of range")}function w(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=0;rn?(i=!0,n=e):(r=!1,i=!0);t++}return r}},{key:"isReducedEchelonForm",value:function(){for(var t=0,e=0,n=-1,r=!0,i=!1;tn?(i=!0,n=e):(r=!1,i=!0);for(var o=e+1;ot.get(r,n)&&(r=i);if(0===t.get(r,n))n++;else{t.swapRows(e,r);for(var o=t.get(e,n),a=n;a=0;)if(0===t.maxRow(r))r--;else{for(var i=0,o=!1;i0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==z(t))throw new TypeError("options must be an object");var e=t.rows,n=void 0===e?1:e,r=t.columns,i=void 0===r?1:r;if(!Number.isInteger(n)||n<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(i)||i<=0)throw new TypeError("columns must be a positive integer");for(var o=new q(this.rows*n,this.columns*i),a=0;ae[n]&&(e[n]=this.get(n,r));return e;case"column":for(var i=new Array(this.columns).fill(Number.NEGATIVE_INFINITY),o=0;oi[a]&&(i[a]=this.get(o,a));return i;case void 0:for(var s=this.get(0,0),u=0;us&&(s=this.get(u,c));return s;default:throw new Error("invalid option: ".concat(t))}}},{key:"maxIndex",value:function(){E(this);for(var t=this.get(0,0),e=[0,0],n=0;nt&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}},{key:"min",value:function(t){if(this.isEmpty())return NaN;switch(t){case"row":for(var e=new Array(this.rows).fill(Number.POSITIVE_INFINITY),n=0;ne&&(e=this.get(t,n));return e}},{key:"maxRowIndex",value:function(t){p(this,t),E(this);for(var e=this.get(t,0),n=[t,0],r=1;re&&(e=this.get(t,r),n[1]=r);return n}},{key:"minRow",value:function(t){if(p(this,t),this.isEmpty())return NaN;for(var e=this.get(t,0),n=1;ne&&(e=this.get(n,t));return e}},{key:"maxColumnIndex",value:function(t){g(this,t),E(this);for(var e=this.get(0,t),n=[0,t],r=1;re&&(e=this.get(r,t),n[0]=r);return n}},{key:"minColumn",value:function(t){if(g(this,t),this.isEmpty())return NaN;for(var e=this.get(0,t),n=1;n0&&void 0!==arguments[0]?arguments[0]:"frobenius",e=0;if("max"===t)return this.max();if("frobenius"===t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==z(t))throw new TypeError("options must be an object");var e=t.min,n=void 0===e?0:e,r=t.max,i=void 0===r?1:r;if(!Number.isFinite(n))throw new TypeError("min must be a number");if(!Number.isFinite(i))throw new TypeError("max must be a number");if(n>=i)throw new RangeError("min must be smaller than max");for(var o=new q(this.rows,this.columns),a=0;a0&&s(u,{min:n,max:i,output:u}),o.setRow(a,u)}return o}},{key:"scaleColumns",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==z(t))throw new TypeError("options must be an object");var e=t.min,n=void 0===e?0:e,r=t.max,i=void 0===r?1:r;if(!Number.isFinite(n))throw new TypeError("min must be a number");if(!Number.isFinite(i))throw new TypeError("max must be a number");if(n>=i)throw new RangeError("min must be smaller than max");for(var o=new q(this.rows,this.columns),a=0;a0&&void 0!==arguments[0]?arguments[0]:W,e=0;e0&&void 0!==arguments[0]?arguments[0]:W,e=0;en||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");for(var r=new q(t.length,n-e+1),i=0;i=this.rows)throw new RangeError("Row index out of range: ".concat(t[i]));r.set(i,o-e,this.get(t[i],o))}return r}},{key:"subMatrixColumn",value:function(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");for(var r=new q(n-e+1,t.length),i=0;i=this.columns)throw new RangeError("Column index out of range: ".concat(t[i]));r.set(o-e,i,this.get(o,t[i]))}return r}},{key:"setSubMatrix",value:function(t,e,n){if((t=q.checkMatrix(t)).isEmpty())return this;x(this,e,e+t.rows-1,n,n+t.columns-1);for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{};if("object"===z(t)&&(e=t,t=void 0),"object"!==z(e))throw new TypeError("options must be an object");var n=e,r=n.unbiased,o=void 0===r||r,a=n.mean,s=void 0===a?this.mean(t):a;if("boolean"!=typeof o)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!i(s))throw new TypeError("mean must be an array");return S(this,o,s);case"column":if(!i(s))throw new TypeError("mean must be an array");return M(this,o,s);case void 0:if("number"!=typeof s)throw new TypeError("mean must be a number");return O(this,o,s);default:throw new Error("invalid option: ".concat(t))}}},{key:"standardDeviation",value:function(t,e){"object"===z(t)&&(e=t,t=void 0);var n=this.variance(t,e);if(void 0===t)return Math.sqrt(n);for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{};if("object"===z(t)&&(e=t,t=void 0),"object"!==z(e))throw new TypeError("options must be an object");var n=e,r=n.center,o=void 0===r?this.mean(t):r;switch(t){case"row":if(!i(o))throw new TypeError("center must be an array");return k(this,o),this;case"column":if(!i(o))throw new TypeError("center must be an array");return A(this,o),this;case void 0:if("number"!=typeof o)throw new TypeError("center must be a number");return C(this,o),this;default:throw new Error("invalid option: ".concat(t))}}},{key:"scale",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"===z(t)&&(e=t,t=void 0),"object"!==z(e))throw new TypeError("options must be an object");var n=e.scale;switch(t){case"row":if(void 0===n)n=j(this);else if(!i(n))throw new TypeError("scale must be an array");return I(this,n),this;case"column":if(void 0===n)n=T(this);else if(!i(n))throw new TypeError("scale must be an array");return N(this,n),this;case void 0:if(void 0===n)n=P(this);else if("number"!=typeof n)throw new TypeError("scale must be a number");return D(this,n),this;default:throw new Error("invalid option: ".concat(t))}}},{key:"toString",value:function(t){return l(this,t)}}],[{key:"from1DArray",value:function(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");for(var r=new q(t,e),i=0;i2&&void 0!==arguments[2]?arguments[2]:{};if("object"!==z(n))throw new TypeError("options must be an object");for(var r=n.random,i=void 0===r?Math.random:r,o=new q(t,e),a=0;a2&&void 0!==arguments[2]?arguments[2]:{};if("object"!==z(n))throw new TypeError("options must be an object");var r=n.min,i=void 0===r?0:r,o=n.max,a=void 0===o?1e3:o,s=n.random,u=void 0===s?Math.random:s;if(!Number.isInteger(i))throw new TypeError("min must be an integer");if(!Number.isInteger(a))throw new TypeError("max must be an integer");if(i>=a)throw new RangeError("min must be smaller than max");for(var c=a-i,l=new q(t,e),f=0;f=0){if(o.data=[],!(Number.isInteger(r)&&r>=0))throw new TypeError("nColumns must be a positive integer");for(var a=0;a>t);return this},V.prototype.signPropagatingRightShiftM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var e=0;e>t.get(e,n));return this},V.signPropagatingRightShift=function(t,e){return new H(t).signPropagatingRightShift(e)},V.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},V.prototype.rightShiftS=function(t){for(var e=0;e>>t);return this},V.prototype.rightShiftM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var e=0;e>>t.get(e,n));return this},V.rightShift=function(t,e){return new H(t).rightShift(e)},V.prototype.zeroFillRightShift=V.prototype.rightShift,V.prototype.zeroFillRightShiftS=V.prototype.rightShiftS,V.prototype.zeroFillRightShiftM=V.prototype.rightShiftM,V.zeroFillRightShift=V.rightShift,V.prototype.not=function(){for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:{};he(this,o);var r=n.rows,a=void 0===r?1:r;if(t.length%a!=0)throw new Error("the data length is not divisible by the number of rows");return(e=i.call(this)).rows=a,e.columns=t.length/a,e.data=t,e}return e=o,(n=[{key:"set",value:function(t,e,n){var r=this._calculateIndex(t,e);return this.data[r]=n,this}},{key:"get",value:function(t,e){var n=this._calculateIndex(t,e);return this.data[n]}},{key:"_calculateIndex",value:function(t,e){return t*this.columns+e}}])&&de(e.prototype,n),r&&de(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(X);function be(t){return(be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function xe(t,e){for(var n=0;nMath.abs(c[o])&&(o=n);if(o!==r){for(i=0;i=0;i--){for(r=0;ro?r.set(i,o,t.get(i,o)):i===o?r.set(i,o,1):r.set(i,o,0);return r}},{key:"upperTriangularMatrix",get:function(){for(var t=this.LU,e=t.rows,n=t.columns,r=new q(e,n),i=0;iMath.abs(e)?(n=e/t,Math.abs(t)*Math.sqrt(1+n*n)):0!==e?(n=t/e,Math.abs(e)*Math.sqrt(1+n*n)):0}function Ie(t){return(Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Te(t,e){for(var n=0;n=0;o--){for(i=0;i=0;n--){for(t=0;t1&&void 0!==arguments[1]?arguments[1]:{};if(De(this,t),(e=Me.checkMatrix(e)).isEmpty())throw new Error("Matrix must be non-empty");var r,i=e.rows,o=e.columns,a=n.computeLeftSingularVectors,s=void 0===a||a,u=n.computeRightSingularVectors,c=void 0===u||u,l=n.autoTranspose,f=void 0!==l&&l,h=Boolean(s),d=Boolean(c),p=!1;if(i=0;Z--)if(0!==m[Z]){for(var K=Z+1;K=0;rt--){if(rt0;){var ft=void 0,ht=void 0;for(ft=W-2;ft>=-1&&-1!==ft;ft--){var dt=Number.MIN_VALUE+lt*Math.abs(m[ft]+Math.abs(m[ft+1]));if(Math.abs(w[ft])<=dt||Number.isNaN(w[ft])){w[ft]=0;break}}if(ft===W-2)ht=4;else{var pt=void 0;for(pt=W-1;pt>=ft&&pt!==ft;pt--){var gt=(pt!==W?Math.abs(w[pt]):0)+(pt!==ft+1?Math.abs(w[pt-1]):0);if(Math.abs(m[pt])<=lt*gt){m[pt]=0;break}}pt===ft?ht=3:pt===W-1?ht=1:(ht=2,ft=pt)}switch(ft++,ht){case 1:var vt=w[W-2];w[W-2]=0;for(var yt=W-2;yt>=ft;yt--){var mt=je(m[yt],vt),bt=m[yt]/mt,xt=vt/mt;if(m[yt]=mt,yt!==ft&&(vt=-xt*w[yt-1],w[yt-1]=bt*w[yt-1]),d)for(var wt=0;wt=m[ft+1]);){var Vt=m[ft];if(m[ft]=m[ft+1],m[ft+1]=Vt,d&&fte&&i.set(o,a,t.get(o,a)/this.s[a]);for(var s=this.U,u=s.rows,c=s.columns,l=new q(n,u),f=0;ft&&e++;return e}},{key:"diagonal",get:function(){return Array.from(this.s)}},{key:"threshold",get:function(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}},{key:"leftSingularVectors",get:function(){return this.U}},{key:"rightSingularVectors",get:function(){return this.V}},{key:"diagonalMatrix",get:function(){return q.diag(this.s)}}])&&Le(e.prototype,n),r&&Le(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Be(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t=Me.checkMatrix(t),e?new Re(t).inverse():Fe(t,q.eye(t.rows))}function Fe(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t=Me.checkMatrix(t),e=Me.checkMatrix(e),n?new Re(t).solve(e):t.isSquare()?new Ce(t).solve(e):new Ne(t).solve(e)}function ze(t){var e,n,r,i,o,a;if((t=q.checkMatrix(t)).isSquare())return 0===t.columns?1:2===t.columns?(e=t.get(0,0),n=t.get(0,1),r=t.get(1,0),e*t.get(1,1)-n*r):3===t.columns?(i=new Kt(t,[1,2],[1,2]),o=new Kt(t,[1,2],[0,2]),a=new Kt(t,[1,2],[0,1]),e=t.get(0,0),n=t.get(0,1),r=t.get(0,2),e*ze(i)-n*ze(o)+r*ze(a)):new Ce(t).determinant;throw Error("determinant can only be calculated for a square matrix")}function Ge(t,e){for(var n=[],r=0;r3&&void 0!==arguments[3]?arguments[3]:1e-9,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1e-9;if(t>i)return new Array(e.rows+1).fill(0);for(var o=e.addRow(n,[0]),a=0;a1&&void 0!==arguments[1]?arguments[1]:{},n=e.thresholdValue,r=void 0===n?1e-9:n,i=e.thresholdError,o=void 0===i?1e-9:i,a=(t=q.checkMatrix(t)).rows,s=new q(a,a),u=0;u1&&void 0!==arguments[1]?arguments[1]:Number.EPSILON;if((t=q.checkMatrix(t)).isEmpty())return t.transpose();for(var n=new Re(t,{autoTranspose:!0}),r=n.leftSingularVectors,i=n.rightSingularVectors,o=n.diagonal,a=0;ae?o[a]=1/o[a]:o[a]=0;return i.mmul(q.diag(o).mmul(r.transpose()))}function We(t){return(We="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ve(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=new q(t);var r=!1;if("object"!==We(e)||q.isMatrix(e)||i(e)?e=new q(e):(n=e,e=t,r=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");var o=n,a=o.center,s=void 0===a||a;s&&(t=t.center("column"),r||(e=e.center("column")));for(var u=t.transpose().mmul(e),c=0;c1&&void 0!==arguments[1]?arguments[1]:t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=new q(t);var r=!1;if("object"!==He(e)||q.isMatrix(e)||i(e)?e=new q(e):(n=e,e=t,r=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");var o=n,a=o.center,s=void 0===a||a,u=o.scale,c=void 0===u||u;s&&(t.center("column"),r||e.center("column")),c&&(t.scale("column"),r||e.scale("column"));for(var l=t.standardDeviation("column",{unbiased:!0}),f=r?l:e.standardDeviation("column",{unbiased:!0}),h=t.transpose().mmul(e),d=0;d1&&void 0!==arguments[1]?arguments[1]:{};Ke(this,t);var r=n.assumeSymmetric,i=void 0!==r&&r;if(!(e=Me.checkMatrix(e)).isSquare())throw new Error("Matrix is not a square matrix");if(e.isEmpty())throw new Error("Matrix must be non-empty");var o,a,s=e.columns,u=new q(s,s),c=new Float64Array(s),l=new Float64Array(s),f=e;if(!!i||e.isSymmetric()){for(o=0;o0?o.set(t,t+1,r[t]):r[t]<0&&o.set(t,t-1,r[t])}return o}}])&&Qe(e.prototype,n),r&&Qe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Je(t,e,n,r){var i,o,a,s,u,c,l,f;for(u=0;u0;s--){for(f=0,a=0,c=0;c0&&(o=-o),e[s]=f*o,a-=i*o,n[s-1]=i-o,u=0;uc){0;do{for(1,i=n[c],h=je(f=(n[c+1]-i)/(2*e[c]),1),f<0&&(h=-h),n[c]=e[c]/(f+h),n[c+1]=e[c]*(f+h),d=n[c+1],o=i-n[c],a=c+2;a=c;a--)for(v=g,g=p,b=m,i=p*e[a],o=p*f,h=je(f,e[a]),e[a+1]=m*h,m=e[a]/h,f=(p=f/h)*n[a]-m*i,n[a+1]=o+m*(p*i+m*n[a]),u=0;u_*w)}n[c]=n[c]+x,e[c]=0}for(a=0;a=c;s--)n[s]=e.get(s,c-1)/l,a+=n[s]*n[s];for(o=Math.sqrt(a),n[c]>0&&(o=-o),a-=n[c]*o,n[c]=n[c]-o,u=c;u=c;s--)i+=n[s]*e.get(s,u);for(i/=a,s=c;s<=f;s++)e.set(s,u,e.get(s,u)-i*n[s])}for(s=0;s<=f;s++){for(i=0,u=f;u>=c;u--)i+=n[u]*e.get(s,u);for(i/=a,u=c;u<=f;u++)e.set(s,u,e.get(s,u)-i*n[u])}n[c]=l*n[c],e.set(c,c-1,l*o)}}for(s=0;s=1;c--)if(0!==e.get(c,c-1)){for(s=c+1;s<=f;s++)n[s]=e.get(s,c-1);for(u=c;u<=f;u++){for(o=0,s=c;s<=f;s++)o+=n[s]*r.get(s,u);for(o=o/n[c]/e.get(c,c-1),s=c;s<=f;s++)r.set(s,u,r.get(s,u)+o*n[s])}}}function nn(t,e,n,r,i){var o,a,s,u,c,l,f,h,d,p,g,v,y,m,b,x=t-1,w=t-1,_=Number.EPSILON,E=0,S=0,M=0,O=0,k=0,A=0,C=0,j=0;for(o=0;ow)&&(n[o]=i.get(o,o),e[o]=0),a=Math.max(o-1,0);a=0;){for(u=x;u>0&&(0===(A=Math.abs(i.get(u-1,u-1))+Math.abs(i.get(u,u)))&&(A=S),!(Math.abs(i.get(u,u-1))<_*A));)u--;if(u===x)i.set(x,x,i.get(x,x)+E),n[x]=i.get(x,x),e[x]=0,x--,j=0;else if(u===x-1){if(f=i.get(x,x-1)*i.get(x-1,x),O=(M=(i.get(x-1,x-1)-i.get(x,x))/2)*M+f,C=Math.sqrt(Math.abs(O)),i.set(x,x,i.get(x,x)+E),i.set(x-1,x-1,i.get(x-1,x-1)+E),h=i.get(x,x),O>=0){for(C=M>=0?M+C:M-C,n[x-1]=h+C,n[x]=n[x-1],0!==C&&(n[x]=h-f/C),e[x-1]=0,e[x]=0,M=(h=i.get(x,x-1))/(A=Math.abs(h)+Math.abs(C)),O=C/A,M/=k=Math.sqrt(M*M+O*O),O/=k,a=x-1;a0){for(A=Math.sqrt(A),d=u&&(M=((k=h-(C=i.get(c,c)))*(A=d-C)-f)/i.get(c+1,c)+i.get(c,c+1),O=i.get(c+1,c+1)-C-k-A,k=i.get(c+2,c+1),M/=A=Math.abs(M)+Math.abs(O)+Math.abs(k),O/=A,k/=A,c!==u)&&!(Math.abs(i.get(c,c-1))*(Math.abs(O)+Math.abs(k))<_*(Math.abs(M)*(Math.abs(i.get(c-1,c-1))+Math.abs(C)+Math.abs(i.get(c+1,c+1)))));)c--;for(o=c+2;o<=x;o++)i.set(o,o-2,0),o>c+2&&i.set(o,o-3,0);for(s=c;s<=x-1&&(m=s!==x-1,s!==c&&(M=i.get(s,s-1),O=i.get(s+1,s-1),k=m?i.get(s+2,s-1):0,0!==(h=Math.abs(M)+Math.abs(O)+Math.abs(k))&&(M/=h,O/=h,k/=h)),0!==h);s++)if(A=Math.sqrt(M*M+O*O+k*k),M<0&&(A=-A),0!==A){for(s!==c?i.set(s,s-1,-A*h):u!==c&&i.set(s,s-1,-i.get(s,s-1)),h=(M+=A)/A,d=O/A,C=k/A,O/=M,k/=M,a=s;a=0;x--)if(M=n[x],0===(O=e[x]))for(u=x,i.set(x,x,1),o=x-1;o>=0;o--){for(f=i.get(o,o)-M,k=0,a=u;a<=x;a++)k+=i.get(o,a)*i.get(a,x);if(e[o]<0)C=f,A=k;else if(u=o,0===e[o]?i.set(o,x,0!==f?-k/f:-k/(_*S)):(h=i.get(o,o+1),d=i.get(o+1,o),l=(h*A-C*k)/(O=(n[o]-M)*(n[o]-M)+e[o]*e[o]),i.set(o,x,l),i.set(o+1,x,Math.abs(h)>Math.abs(C)?(-k-f*l)/h:(-A-d*l)/C)),_*(l=Math.abs(i.get(o,x)))*l>1)for(a=o;a<=x;a++)i.set(a,x,i.get(a,x)/l)}else if(O<0)for(u=x-1,Math.abs(i.get(x,x-1))>Math.abs(i.get(x-1,x))?(i.set(x-1,x-1,O/i.get(x,x-1)),i.set(x-1,x,-(i.get(x,x)-M)/i.get(x,x-1))):(b=rn(0,-i.get(x-1,x),i.get(x-1,x-1)-M,O),i.set(x-1,x-1,b[0]),i.set(x-1,x,b[1])),i.set(x,x-1,0),i.set(x,x,1),o=x-2;o>=0;o--){for(p=0,g=0,a=u;a<=x;a++)p+=i.get(o,a)*i.get(a,x-1),g+=i.get(o,a)*i.get(a,x);if(f=i.get(o,o)-M,e[o]<0)C=f,k=p,A=g;else if(u=o,0===e[o]?(b=rn(-p,-g,f,O),i.set(o,x-1,b[0]),i.set(o,x,b[1])):(h=i.get(o,o+1),d=i.get(o+1,o),v=(n[o]-M)*(n[o]-M)+e[o]*e[o]-O*O,y=2*(n[o]-M)*O,0===v&&0===y&&(v=_*S*(Math.abs(f)+Math.abs(O)+Math.abs(h)+Math.abs(d)+Math.abs(C))),b=rn(h*k-C*p+O*g,h*A-C*g-O*p,v,y),i.set(o,x-1,b[0]),i.set(o,x,b[1]),Math.abs(h)>Math.abs(C)+Math.abs(O)?(i.set(o+1,x-1,(-p-f*i.get(o,x-1)+O*i.get(o,x))/h),i.set(o+1,x,(-g-f*i.get(o,x)-O*i.get(o,x-1))/h)):(b=rn(-k-d*i.get(o,x-1),-A-d*i.get(o,x),C,O),i.set(o+1,x-1,b[0]),i.set(o+1,x,b[1]))),_*(l=Math.max(Math.abs(i.get(o,x-1)),Math.abs(i.get(o,x))))*l>1)for(a=o;a<=x;a++)i.set(a,x-1,i.get(a,x-1)/l),i.set(a,x,i.get(a,x)/l)}for(o=0;ow)for(a=o;a=0;a--)for(o=0;o<=w;o++){for(C=0,s=0;s<=Math.min(a,w);s++)C+=r.get(o,s)*i.get(s,a);r.set(o,a,C)}}}function rn(t,e,n,r){var i,o;return Math.abs(n)>Math.abs(r)?[(t+(i=r/n)*e)/(o=n+i*r),(e-i*t)/o]:[((i=n/r)*t+e)/(o=r+i*n),(i*e-t)/o]}function on(t){return(on="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function an(t,e){for(var n=0;n0,s.set(r,r,Math.sqrt(Math.max(c,0))),i=r+1;i=0;o--)for(i=0;i1&&void 0!==arguments[1]?arguments[1]:{};fn(this,t),e=Me.checkMatrix(e);var r,o=n.Y,a=n.scaleScores,s=void 0!==a&&a,u=n.maxIterations,c=void 0===u?1e3:u,l=n.terminationCriteria,f=void 0===l?1e-10:l;if(o){if((o=i(o)&&"number"==typeof o[0]?q.columnVector(o):Me.checkMatrix(o)).rows!==e.rows)throw new Error("Y should have the same number of rows as X");r=o.getColumnVector(0)}else r=e.getColumnVector(0);for(var h,d,p,g,v=1,y=0;yf;y++)p=(p=e.transpose().mmul(r).div(r.transpose().mmul(r).get(0,0))).div(p.norm()),h=e.mmul(p).div(p.transpose().mmul(p).get(0,0)),y>0&&(v=h.clone().sub(g).pow(2).sum()),g=h.clone(),o?(d=(d=o.transpose().mmul(h).div(h.transpose().mmul(h).get(0,0))).div(d.norm()),r=o.mmul(d).div(d.transpose().mmul(d).get(0,0))):r=h;if(o){var m=e.transpose().mmul(h).div(h.transpose().mmul(h).get(0,0));m=m.div(m.norm());var b=e.clone().sub(h.clone().mmul(m.transpose())),x=r.transpose().mmul(h).div(h.transpose().mmul(h).get(0,0)),w=o.clone().sub(h.clone().mulS(x.get(0,0)).mmul(d.transpose()));this.t=h,this.p=m.transpose(),this.w=p.transpose(),this.q=d,this.u=r,this.s=h.transpose().mmul(h),this.xResidual=b,this.yResidual=w,this.betas=x}else this.w=p.transpose(),this.s=h.transpose().mmul(h).sqrt(),this.t=s?h.clone().div(this.s.get(0,0)):h,this.xResidual=e.sub(h.mmul(p.transpose()))}))},function(t,e,n){"use strict";n.r(e),n.d(e,"World",(function(){return At})),n.d(e,"Kernel",(function(){return W}));var r=n(25),i=n.n(r),o=n(3),a=n.n(o),s=n(13),u=n.n(s),c=n(14),l=n.n(c),f=n(34),h=n.n(f),d=n(116),p=n.n(d),g=n(117),v=n.n(g),y=n(17),m=n.n(y),b=1;function x(){return b++}var w,_;(_=w||(w={}))[_.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",_[_.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",_[_.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",_[_.POINTS=0]="POINTS",_[_.LINES=1]="LINES",_[_.LINE_LOOP=2]="LINE_LOOP",_[_.LINE_STRIP=3]="LINE_STRIP",_[_.TRIANGLES=4]="TRIANGLES",_[_.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",_[_.TRIANGLE_FAN=6]="TRIANGLE_FAN",_[_.ZERO=0]="ZERO",_[_.ONE=1]="ONE",_[_.SRC_COLOR=768]="SRC_COLOR",_[_.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",_[_.SRC_ALPHA=770]="SRC_ALPHA",_[_.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",_[_.DST_ALPHA=772]="DST_ALPHA",_[_.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",_[_.DST_COLOR=774]="DST_COLOR",_[_.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",_[_.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",_[_.FUNC_ADD=32774]="FUNC_ADD",_[_.BLEND_EQUATION=32777]="BLEND_EQUATION",_[_.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",_[_.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",_[_.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",_[_.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",_[_.MAX_EXT=32776]="MAX_EXT",_[_.MIN_EXT=32775]="MIN_EXT",_[_.BLEND_DST_RGB=32968]="BLEND_DST_RGB",_[_.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",_[_.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",_[_.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",_[_.CONSTANT_COLOR=32769]="CONSTANT_COLOR",_[_.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",_[_.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",_[_.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",_[_.BLEND_COLOR=32773]="BLEND_COLOR",_[_.ARRAY_BUFFER=34962]="ARRAY_BUFFER",_[_.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",_[_.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",_[_.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",_[_.STREAM_DRAW=35040]="STREAM_DRAW",_[_.STATIC_DRAW=35044]="STATIC_DRAW",_[_.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",_[_.BUFFER_SIZE=34660]="BUFFER_SIZE",_[_.BUFFER_USAGE=34661]="BUFFER_USAGE",_[_.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",_[_.FRONT=1028]="FRONT",_[_.BACK=1029]="BACK",_[_.FRONT_AND_BACK=1032]="FRONT_AND_BACK",_[_.CULL_FACE=2884]="CULL_FACE",_[_.BLEND=3042]="BLEND",_[_.DITHER=3024]="DITHER",_[_.STENCIL_TEST=2960]="STENCIL_TEST",_[_.DEPTH_TEST=2929]="DEPTH_TEST",_[_.SCISSOR_TEST=3089]="SCISSOR_TEST",_[_.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",_[_.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",_[_.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",_[_.NO_ERROR=0]="NO_ERROR",_[_.INVALID_ENUM=1280]="INVALID_ENUM",_[_.INVALID_VALUE=1281]="INVALID_VALUE",_[_.INVALID_OPERATION=1282]="INVALID_OPERATION",_[_.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",_[_.CW=2304]="CW",_[_.CCW=2305]="CCW",_[_.LINE_WIDTH=2849]="LINE_WIDTH",_[_.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",_[_.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",_[_.CULL_FACE_MODE=2885]="CULL_FACE_MODE",_[_.FRONT_FACE=2886]="FRONT_FACE",_[_.DEPTH_RANGE=2928]="DEPTH_RANGE",_[_.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",_[_.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",_[_.DEPTH_FUNC=2932]="DEPTH_FUNC",_[_.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",_[_.STENCIL_FUNC=2962]="STENCIL_FUNC",_[_.STENCIL_FAIL=2964]="STENCIL_FAIL",_[_.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",_[_.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",_[_.STENCIL_REF=2967]="STENCIL_REF",_[_.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",_[_.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",_[_.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",_[_.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",_[_.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",_[_.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",_[_.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",_[_.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",_[_.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",_[_.VIEWPORT=2978]="VIEWPORT",_[_.SCISSOR_BOX=3088]="SCISSOR_BOX",_[_.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",_[_.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",_[_.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",_[_.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",_[_.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",_[_.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",_[_.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",_[_.RED_BITS=3410]="RED_BITS",_[_.GREEN_BITS=3411]="GREEN_BITS",_[_.BLUE_BITS=3412]="BLUE_BITS",_[_.ALPHA_BITS=3413]="ALPHA_BITS",_[_.DEPTH_BITS=3414]="DEPTH_BITS",_[_.STENCIL_BITS=3415]="STENCIL_BITS",_[_.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",_[_.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",_[_.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",_[_.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",_[_.SAMPLES=32937]="SAMPLES",_[_.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",_[_.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",_[_.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",_[_.DONT_CARE=4352]="DONT_CARE",_[_.FASTEST=4353]="FASTEST",_[_.NICEST=4354]="NICEST",_[_.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",_[_.BYTE=5120]="BYTE",_[_.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",_[_.SHORT=5122]="SHORT",_[_.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",_[_.INT=5124]="INT",_[_.UNSIGNED_INT=5125]="UNSIGNED_INT",_[_.FLOAT=5126]="FLOAT",_[_.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",_[_.ALPHA=6406]="ALPHA",_[_.RGB=6407]="RGB",_[_.RGBA=6408]="RGBA",_[_.LUMINANCE=6409]="LUMINANCE",_[_.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",_[_.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",_[_.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",_[_.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",_[_.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",_[_.VERTEX_SHADER=35633]="VERTEX_SHADER",_[_.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",_[_.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",_[_.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",_[_.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",_[_.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",_[_.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",_[_.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",_[_.SHADER_TYPE=35663]="SHADER_TYPE",_[_.DELETE_STATUS=35712]="DELETE_STATUS",_[_.LINK_STATUS=35714]="LINK_STATUS",_[_.VALIDATE_STATUS=35715]="VALIDATE_STATUS",_[_.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",_[_.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",_[_.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",_[_.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",_[_.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",_[_.NEVER=512]="NEVER",_[_.LESS=513]="LESS",_[_.EQUAL=514]="EQUAL",_[_.LEQUAL=515]="LEQUAL",_[_.GREATER=516]="GREATER",_[_.NOTEQUAL=517]="NOTEQUAL",_[_.GEQUAL=518]="GEQUAL",_[_.ALWAYS=519]="ALWAYS",_[_.KEEP=7680]="KEEP",_[_.REPLACE=7681]="REPLACE",_[_.INCR=7682]="INCR",_[_.DECR=7683]="DECR",_[_.INVERT=5386]="INVERT",_[_.INCR_WRAP=34055]="INCR_WRAP",_[_.DECR_WRAP=34056]="DECR_WRAP",_[_.VENDOR=7936]="VENDOR",_[_.RENDERER=7937]="RENDERER",_[_.VERSION=7938]="VERSION",_[_.NEAREST=9728]="NEAREST",_[_.LINEAR=9729]="LINEAR",_[_.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",_[_.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",_[_.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",_[_.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",_[_.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",_[_.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",_[_.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",_[_.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",_[_.TEXTURE_2D=3553]="TEXTURE_2D",_[_.TEXTURE=5890]="TEXTURE",_[_.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",_[_.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",_[_.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",_[_.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",_[_.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",_[_.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",_[_.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",_[_.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",_[_.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",_[_.TEXTURE0=33984]="TEXTURE0",_[_.TEXTURE1=33985]="TEXTURE1",_[_.TEXTURE2=33986]="TEXTURE2",_[_.TEXTURE3=33987]="TEXTURE3",_[_.TEXTURE4=33988]="TEXTURE4",_[_.TEXTURE5=33989]="TEXTURE5",_[_.TEXTURE6=33990]="TEXTURE6",_[_.TEXTURE7=33991]="TEXTURE7",_[_.TEXTURE8=33992]="TEXTURE8",_[_.TEXTURE9=33993]="TEXTURE9",_[_.TEXTURE10=33994]="TEXTURE10",_[_.TEXTURE11=33995]="TEXTURE11",_[_.TEXTURE12=33996]="TEXTURE12",_[_.TEXTURE13=33997]="TEXTURE13",_[_.TEXTURE14=33998]="TEXTURE14",_[_.TEXTURE15=33999]="TEXTURE15",_[_.TEXTURE16=34e3]="TEXTURE16",_[_.TEXTURE17=34001]="TEXTURE17",_[_.TEXTURE18=34002]="TEXTURE18",_[_.TEXTURE19=34003]="TEXTURE19",_[_.TEXTURE20=34004]="TEXTURE20",_[_.TEXTURE21=34005]="TEXTURE21",_[_.TEXTURE22=34006]="TEXTURE22",_[_.TEXTURE23=34007]="TEXTURE23",_[_.TEXTURE24=34008]="TEXTURE24",_[_.TEXTURE25=34009]="TEXTURE25",_[_.TEXTURE26=34010]="TEXTURE26",_[_.TEXTURE27=34011]="TEXTURE27",_[_.TEXTURE28=34012]="TEXTURE28",_[_.TEXTURE29=34013]="TEXTURE29",_[_.TEXTURE30=34014]="TEXTURE30",_[_.TEXTURE31=34015]="TEXTURE31",_[_.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",_[_.REPEAT=10497]="REPEAT",_[_.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",_[_.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",_[_.FLOAT_VEC2=35664]="FLOAT_VEC2",_[_.FLOAT_VEC3=35665]="FLOAT_VEC3",_[_.FLOAT_VEC4=35666]="FLOAT_VEC4",_[_.INT_VEC2=35667]="INT_VEC2",_[_.INT_VEC3=35668]="INT_VEC3",_[_.INT_VEC4=35669]="INT_VEC4",_[_.BOOL=35670]="BOOL",_[_.BOOL_VEC2=35671]="BOOL_VEC2",_[_.BOOL_VEC3=35672]="BOOL_VEC3",_[_.BOOL_VEC4=35673]="BOOL_VEC4",_[_.FLOAT_MAT2=35674]="FLOAT_MAT2",_[_.FLOAT_MAT3=35675]="FLOAT_MAT3",_[_.FLOAT_MAT4=35676]="FLOAT_MAT4",_[_.SAMPLER_2D=35678]="SAMPLER_2D",_[_.SAMPLER_CUBE=35680]="SAMPLER_CUBE",_[_.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",_[_.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",_[_.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",_[_.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",_[_.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",_[_.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",_[_.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",_[_.COMPILE_STATUS=35713]="COMPILE_STATUS",_[_.LOW_FLOAT=36336]="LOW_FLOAT",_[_.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",_[_.HIGH_FLOAT=36338]="HIGH_FLOAT",_[_.LOW_INT=36339]="LOW_INT",_[_.MEDIUM_INT=36340]="MEDIUM_INT",_[_.HIGH_INT=36341]="HIGH_INT",_[_.FRAMEBUFFER=36160]="FRAMEBUFFER",_[_.RENDERBUFFER=36161]="RENDERBUFFER",_[_.RGBA4=32854]="RGBA4",_[_.RGB5_A1=32855]="RGB5_A1",_[_.RGB565=36194]="RGB565",_[_.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",_[_.STENCIL_INDEX=6401]="STENCIL_INDEX",_[_.STENCIL_INDEX8=36168]="STENCIL_INDEX8",_[_.DEPTH_STENCIL=34041]="DEPTH_STENCIL",_[_.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",_[_.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",_[_.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",_[_.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",_[_.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",_[_.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",_[_.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",_[_.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",_[_.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",_[_.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",_[_.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",_[_.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",_[_.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",_[_.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",_[_.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",_[_.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",_[_.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",_[_.NONE=0]="NONE",_[_.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",_[_.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",_[_.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",_[_.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",_[_.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",_[_.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",_[_.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",_[_.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",_[_.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",_[_.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",_[_.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",_[_.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",_[_.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",_[_.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",_[_.COPY_SRC=1]="COPY_SRC",_[_.COPY_DST=2]="COPY_DST",_[_.SAMPLED=4]="SAMPLED",_[_.STORAGE=8]="STORAGE",_[_.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT";var E,S,M,O,k=function(){function t(){u()(this,t),this.config=void 0}return l()(t,[{key:"get",value:function(){return this.config}},{key:"set",value:function(t){this.config=t}}]),t}();"undefined"!=typeof navigator&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);!function(t){t.Void="Void",t.Boolean="Boolean",t.Float="Float",t.Uint32="Uint32",t.Int32="Int32",t.Vector="Vector",t.Vector2Float="vec2",t.Vector3Float="vec3",t.Vector4Float="vec4",t.Vector2Boolean="vec2",t.Vector3Boolean="vec3",t.Vector4Boolean="vec4",t.Vector2Uint="vec2",t.Vector3Uint="vec3",t.Vector4Uint="vec4",t.Vector2Int="vec2",t.Vector3Int="vec3",t.Vector4Int="vec4",t.Matrix="Matrix",t.Matrix3x3Float="mat3x3",t.Matrix4x4Float="mat4x4",t.Struct="Struct",t.FloatArray="Float[]",t.Vector4FloatArray="vec4[]"}(E||(E={})),function(t){t.Program="Program",t.Identifier="Identifier",t.VariableDeclaration="VariableDeclaration",t.BlockStatement="BlockStatement",t.ReturnStatement="ReturnStatement",t.FunctionDeclaration="FunctionDeclaration",t.VariableDeclarator="VariableDeclarator",t.AssignmentExpression="AssignmentExpression",t.LogicalExpression="LogicalExpression",t.BinaryExpression="BinaryExpression",t.ArrayExpression="ArrayExpression",t.UnaryExpression="UnaryExpression",t.UpdateExpression="UpdateExpression",t.FunctionExpression="FunctionExpression",t.MemberExpression="MemberExpression",t.ConditionalExpression="ConditionalExpression",t.ExpressionStatement="ExpressionStatement",t.CallExpression="CallExpression",t.NumThreadStatement="NumThreadStatement",t.StorageStatement="StorageStatement",t.DoWhileStatement="DoWhileStatement",t.WhileStatement="WhileStatement",t.ForStatement="ForStatement",t.BreakStatement="BreakStatement",t.ContinueStatement="ContinueStatement",t.IfStatement="IfStatement",t.ImportedFunctionStatement="ImportedFunctionStatement"}(S||(S={})),function(t){t.Input="Input",t.Output="Output",t.Uniform="Uniform",t.Workgroup="Workgroup",t.UniformConstant="UniformConstant",t.Image="Image",t.StorageBuffer="StorageBuffer",t.Private="Private",t.Function="Function"}(M||(M={})),function(t){t.GLSL100="GLSL100",t.GLSL450="GLSL450",t.WGSL="WGSL"}(O||(O={}));function A(){if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function C(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function j(t){for(var e=1;e0&&void 0!==i[0]?i[0]:1,!this.dirty){t.next=6;break}return this.compiledBundle.context&&(e>1?this.compiledBundle.context.maxIteration=e:this.compiledBundle.context.maxIteration++),t.next=5,this.compile();case 5:this.dirty=!1;case 6:for(this.engine.beginFrame(),this.engine.clear({}),this.compiledBundle.context&&this.compiledBundle.context.uniforms.filter((function(t){return t.isReferer})).forEach((function(t){var e=t.data,n=t.name;r.model.confirmInput(e.model,n)})),n=0;n16)throw new Error("invalid data type ".concat(n));i[e]=function(){return t.data}}}));var o=this.getOuputDataTexture(),a=o.textureWidth,s=o.texelCount;i.u_OutputTextureSize=[a,a],i.u_OutputTexelCount=s,this.context.output.textureSize=[a,a];var c={attributes:{a_Position:[[-1,1,0],[-1,-1,0],[1,1,0],[1,-1,0]],a_TexCoord:[[0,1],[0,0],[1,1],[1,0]]},frag:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n#endif\n".concat(this.context.shader),uniforms:i,vert:"attribute vec3 a_Position;\nattribute vec2 a_TexCoord;\n\nvarying vec2 v_TexCoord;\n\nvoid main() {\n gl_Position = vec4(a_Position, 1.0);\n v_TexCoord = a_TexCoord;\n}",primitive:"triangle strip",count:4};this.computeCommand=this.reGl(c)}var e;return l()(t,[{key:"run",value:function(){var t=this;this.context.maxIteration>1&&this.context.needPingpong&&(this.compiledPingpong=!0),(this.compiledPingpong||this.dynamicPingpong)&&this.swap(),this.texFBO=this.reGl.framebuffer({color:this.getOuputDataTexture().texture}),this.texFBO.use((function(){t.computeCommand()}))}},{key:"readData",value:(e=i()(m.a.mark((function t(){var e,n,r,i,o,a,s,u,c=this;return m.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.reGl({framebuffer:this.texFBO})((function(){e=c.reGl.read()})),!e){t.next=6;break}if(n=this.getOuputDataTexture(),r=n.originalDataLength,i=n.elementsPerTexel,o=n.typedArrayConstructor,a=void 0===o?Float32Array:o,s=[],4!==i)for(u=0;u0&&void 0!==arguments[0]?arguments[0]:{},n=new t;return n.setConfig(e),n.setEngine(new kt),n}}]),t}()},function(t,e,n){"use strict";var r=n(1),i=n(55),o=n(53),a=n(9),s=n(0);function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var c,l,f=0,h=0,d=0,p=0,g=0,v=0,y="object"===("undefined"==typeof performance?"undefined":u(performance))&&performance.now?performance:Date,m="object"===("undefined"==typeof window?"undefined":u(window))&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function b(){return g||(m(x),g=y.now()+v)}function x(){g=0}function w(){this._call=this._time=this._next=null}function _(t,e,n){var r=new w;return r.restart(t,e,n),r}function E(){g=(p=y.now())+v,f=h=0;try{!function(){b(),++f;for(var t,e=c;e;)(t=g-e._time)>=0&&e._call.call(null,t),e=e._next;--f}()}finally{f=0,function(){var t,e,n=c,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:c=e);l=t,M(r)}(),g=0}}function S(){var t=y.now(),e=t-p;e>1e3&&(v-=e,p=t)}function M(t){f||(h&&(h=clearTimeout(h)),t-g>24?(t<1/0&&(h=setTimeout(E,t-y.now()-v)),d&&(d=clearInterval(d))):(d||(p=y.now(),d=setInterval(S,1e3)),f=1,m(E)))}w.prototype=_.prototype={constructor:w,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?b():+n)+(null==e?0:+e),this._next||l===this||(l?l._next=this:c=this,l=this),this._call=t,this._time=n,M()},stop:function(){this._call&&(this._call=null,this._time=1/0,M())}};var O=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t};function k(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function A(){}var C="\\s*([+-]?\\d+)\\s*",j="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",I="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",T=/^#([0-9a-f]{3,8})$/,N=new RegExp("^rgb\\(".concat(C,",").concat(C,",").concat(C,"\\)$")),P=new RegExp("^rgb\\(".concat(I,",").concat(I,",").concat(I,"\\)$")),D=new RegExp("^rgba\\(".concat(C,",").concat(C,",").concat(C,",").concat(j,"\\)$")),L=new RegExp("^rgba\\(".concat(I,",").concat(I,",").concat(I,",").concat(j,"\\)$")),R=new RegExp("^hsl\\(".concat(j,",").concat(I,",").concat(I,"\\)$")),B=new RegExp("^hsla\\(".concat(j,",").concat(I,",").concat(I,",").concat(j,"\\)$")),F={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function z(){return this.rgb().formatHex()}function G(){return this.rgb().formatRgb()}function Y(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=T.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?U(e):3===n?new H(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?X(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?X(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=N.exec(t))?new H(e[1],e[2],e[3],1):(e=P.exec(t))?new H(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=D.exec(t))?X(e[1],e[2],e[3],e[4]):(e=L.exec(t))?X(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=R.exec(t))?J(e[1],e[2]/100,e[3]/100,1):(e=B.exec(t))?J(e[1],e[2]/100,e[3]/100,e[4]):F.hasOwnProperty(t)?U(F[t]):"transparent"===t?new H(NaN,NaN,NaN,0):null}function U(t){return new H(t>>16&255,t>>8&255,255&t,1)}function X(t,e,n,r){return r<=0&&(t=e=n=NaN),new H(t,e,n,r)}function W(t){return t instanceof A||(t=Y(t)),t?new H((t=t.rgb()).r,t.g,t.b,t.opacity):new H}function V(t,e,n,r){return 1===arguments.length?W(t):new H(t,e,n,null==r?1:r)}function H(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function q(){return"#".concat($(this.r)).concat($(this.g)).concat($(this.b))}function Z(){var t=K(this.opacity);return"".concat(1===t?"rgb(":"rgba(").concat(Q(this.r),", ").concat(Q(this.g),", ").concat(Q(this.b)).concat(1===t?")":", ".concat(t,")"))}function K(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Q(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function $(t){return((t=Q(t))<16?"0":"")+t.toString(16)}function J(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new et(t,e,n,r)}function tt(t){if(t instanceof et)return new et(t.h,t.s,t.l,t.opacity);if(t instanceof A||(t=Y(t)),!t)return new et;if(t instanceof et)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&u<1?0:a,new et(a,s,u,t.opacity)}function et(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function nt(t){return(t=(t||0)%360)<0?t+360:t}function rt(t){return Math.max(0,Math.min(1,t||0))}function it(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function ot(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}O(A,Y,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:z,formatHex:z,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return tt(this).formatHsl()},formatRgb:G,toString:G}),O(H,V,k(A,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new H(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new H(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},clamp:function(){return new H(Q(this.r),Q(this.g),Q(this.b),K(this.opacity))},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:q,formatHex:q,formatHex8:function(){return"#".concat($(this.r)).concat($(this.g)).concat($(this.b)).concat($(255*(isNaN(this.opacity)?1:this.opacity)))},formatRgb:Z,toString:Z})),O(et,(function(t,e,n,r){return 1===arguments.length?tt(t):new et(t,e,n,null==r?1:r)}),k(A,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new et(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new et(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new H(it(t>=240?t-240:t+120,i,r),it(t,i,r),it(t<120?t+240:t-120,i,r),this.opacity)},clamp:function(){return new et(nt(this.h),rt(this.s),rt(this.l),K(this.opacity))},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=K(this.opacity);return"".concat(1===t?"hsl(":"hsla(").concat(nt(this.h),", ").concat(100*rt(this.s),"%, ").concat(100*rt(this.l),"%").concat(1===t?")":", ".concat(t,")"))}}));var at=function(t){return function(){return t}};function st(t,e){return function(n){return t+n*e}}function ut(t){return 1==(t=+t)?ct:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):at(isNaN(e)?n:e)}}function ct(t,e){var n=e-t;return n?st(t,n):at(isNaN(t)?e:t)}var lt=function t(e){var n=ut(e);function r(t,e){var r=n((t=V(t)).r,(e=V(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=ct(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function ft(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=ro&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:vt(n,r)})),o=xt.lastIndex;return od.length?(h=Mt.parsePathString(o[f]),d=Mt.parsePathString(i[f]),d=Mt.fillPathByDiff(d,h),d=Mt.formatPath(d,h),e.fromAttrs.path=d,e.toAttrs.path=h):e.pathFormatted||(h=Mt.parsePathString(o[f]),d=Mt.parsePathString(i[f]),d=Mt.formatPath(d,h),e.fromAttrs.path=d,e.toAttrs.path=h,e.pathFormatted=!0),r[f]=[];for(var p=0;p0){for(var o=r.animators.length-1;o>=0;o--)if((t=r.animators[o]).destroyed)r.removeAnimator(o);else{if(!t.isAnimatePaused())for(var a=(e=t.get("animations")).length-1;a>=0;a--)n=e[a],kt(t,n,i)&&(e.splice(a,1),!1,n.callback&&n.callback());0===e.length&&r.removeAnimator(o)}r.canvas.get("autoDraw")||r.canvas.draw()}}))},t.prototype.addAnimator=function(t){this.animators.push(t)},t.prototype.removeAnimator=function(t){this.animators.splice(t,1)},t.prototype.isAnimating=function(){return!!this.animators.length},t.prototype.stop=function(){this.timer&&this.timer.stop()},t.prototype.stopAllAnimations=function(t){void 0===t&&(t=!0),this.animators.forEach((function(e){e.stopAnimate(t)})),this.animators=[],this.canvas.draw()},t.prototype.getTime=function(){return this.current},t}(),Ct=n(48),jt=["mousedown","mouseup","dblclick","mouseout","mouseover","mousemove","mouseleave","mouseenter","touchstart","touchmove","touchend","dragenter","dragover","dragleave","drop","contextmenu","mousewheel"];function It(t,e,n){n.name=e,n.target=t,n.currentTarget=t,n.delegateTarget=t,t.emit(e,n)}function Tt(t,e,n){if(n.bubbles){var r=void 0,i=!1;if("mouseenter"===e?(r=n.fromShape,i=!0):"mouseleave"===e&&(i=!0,r=n.toShape),t.isCanvas()&&i)return;if(r&&Object(a.g)(t,r))return void(n.bubbles=!1);n.name=e,n.currentTarget=t,n.delegateTarget=t,t.emit(e,n)}}var Nt=function(){function t(t){var e=this;this.draggingShape=null,this.dragging=!1,this.currentShape=null,this.mousedownShape=null,this.mousedownPoint=null,this._eventCallback=function(t){var n=t.type;e._triggerEvent(n,t)},this._onDocumentMove=function(t){if(e.canvas.get("el")!==t.target&&(e.dragging||e.currentShape)){var n=e._getPointInfo(t);e.dragging&&e._emitEvent("drag",t,n,e.draggingShape)}},this._onDocumentMouseUp=function(t){if(e.canvas.get("el")!==t.target&&e.dragging){var n=e._getPointInfo(t);e.draggingShape&&e._emitEvent("drop",t,n,null),e._emitEvent("dragend",t,n,e.draggingShape),e._afterDrag(e.draggingShape,n,t)}},this.canvas=t.canvas}return t.prototype.init=function(){this._bindEvents()},t.prototype._bindEvents=function(){var t=this,e=this.canvas.get("el");Object(a.a)(jt,(function(n){e.addEventListener(n,t._eventCallback)})),document&&(document.addEventListener("mousemove",this._onDocumentMove),document.addEventListener("mouseup",this._onDocumentMouseUp))},t.prototype._clearEvents=function(){var t=this,e=this.canvas.get("el");Object(a.a)(jt,(function(n){e.removeEventListener(n,t._eventCallback)})),document&&(document.removeEventListener("mousemove",this._onDocumentMove),document.removeEventListener("mouseup",this._onDocumentMouseUp))},t.prototype._getEventObj=function(t,e,n,r,i,o){var a=new Ct.a(t,e);return a.fromShape=i,a.toShape=o,a.x=n.x,a.y=n.y,a.clientX=n.clientX,a.clientY=n.clientY,a.propagationPath.push(r),a},t.prototype._getShape=function(t,e){return this.canvas.getShape(t.x,t.y,e)},t.prototype._getPointInfo=function(t){var e=this.canvas,n=e.getClientByEvent(t),r=e.getPointByEvent(t);return{x:r.x,y:r.y,clientX:n.x,clientY:n.y}},t.prototype._triggerEvent=function(t,e){var n=this._getPointInfo(e),r=this._getShape(n,e),i=this["_on"+t],o=!1;if(i)i.call(this,n,r,e);else{var a=this.currentShape;"mouseenter"===t||"dragenter"===t||"mouseover"===t?(this._emitEvent(t,e,n,null,null,r),r&&this._emitEvent(t,e,n,r,null,r),"mouseenter"===t&&this.draggingShape&&this._emitEvent("dragenter",e,n,null)):"mouseleave"===t||"dragleave"===t||"mouseout"===t?(o=!0,a&&this._emitEvent(t,e,n,a,a,null),this._emitEvent(t,e,n,null,a,null),"mouseleave"===t&&this.draggingShape&&this._emitEvent("dragleave",e,n,null)):this._emitEvent(t,e,n,r,null,null)}if(o||(this.currentShape=r),r&&!r.get("destroyed")){var s=this.canvas;s.get("el").style.cursor=r.attr("cursor")||s.get("cursor")}},t.prototype._onmousedown=function(t,e,n){0===n.button&&(this.mousedownShape=e,this.mousedownPoint=t,this.mousedownTimeStamp=n.timeStamp),this._emitEvent("mousedown",n,t,e,null,null)},t.prototype._emitMouseoverEvents=function(t,e,n,r){var i=this.canvas.get("el");n!==r&&(n&&(this._emitEvent("mouseout",t,e,n,n,r),this._emitEvent("mouseleave",t,e,n,n,r),r&&!r.get("destroyed")||(i.style.cursor=this.canvas.get("cursor"))),r&&(this._emitEvent("mouseover",t,e,r,n,r),this._emitEvent("mouseenter",t,e,r,n,r)))},t.prototype._emitDragoverEvents=function(t,e,n,r,i){r?(r!==n&&(n&&this._emitEvent("dragleave",t,e,n,n,r),this._emitEvent("dragenter",t,e,r,n,r)),i||this._emitEvent("dragover",t,e,r)):n&&this._emitEvent("dragleave",t,e,n,n,r),i&&this._emitEvent("dragover",t,e,r)},t.prototype._afterDrag=function(t,e,n){t&&(t.set("capture",!0),this.draggingShape=null),this.dragging=!1;var r=this._getShape(e,n);r!==t&&this._emitMouseoverEvents(n,e,t,r),this.currentShape=r},t.prototype._onmouseup=function(t,e,n){if(0===n.button){var r=this.draggingShape;this.dragging?(r&&this._emitEvent("drop",n,t,e),this._emitEvent("dragend",n,t,r),this._afterDrag(r,t,n)):(this._emitEvent("mouseup",n,t,e),e===this.mousedownShape&&this._emitEvent("click",n,t,e),this.mousedownShape=null,this.mousedownPoint=null)}},t.prototype._ondragover=function(t,e,n){n.preventDefault();var r=this.currentShape;this._emitDragoverEvents(n,t,r,e,!0)},t.prototype._onmousemove=function(t,e,n){var r=this.canvas,i=this.currentShape,o=this.draggingShape;if(this.dragging)o&&this._emitDragoverEvents(n,t,i,e,!1),this._emitEvent("drag",n,t,o);else{var a=this.mousedownPoint;if(a){var s=this.mousedownShape,u=n.timeStamp-this.mousedownTimeStamp,c=a.clientX-t.clientX,l=a.clientY-t.clientY;u>120||c*c+l*l>40?s&&s.get("draggable")?((o=this.mousedownShape).set("capture",!1),this.draggingShape=o,this.dragging=!0,this._emitEvent("dragstart",n,t,o),this.mousedownShape=null,this.mousedownPoint=null):!s&&r.get("draggable")?(this.dragging=!0,this._emitEvent("dragstart",n,t,null),this.mousedownShape=null,this.mousedownPoint=null):(this._emitMouseoverEvents(n,t,i,e),this._emitEvent("mousemove",n,t,e)):(this._emitMouseoverEvents(n,t,i,e),this._emitEvent("mousemove",n,t,e))}else this._emitMouseoverEvents(n,t,i,e),this._emitEvent("mousemove",n,t,e)}},t.prototype._emitEvent=function(t,e,n,r,i,o){var a=this._getEventObj(t,e,n,r,i,o);if(r){a.shape=r,It(r,t,a);for(var s=r.getParent();s;)s.emitDelegation(t,a),a.propagationStopped||Tt(s,t,a),a.propagationPath.push(s),s=s.getParent()}else{It(this.canvas,t,a)}},t.prototype.destroy=function(){this._clearEvents(),this.canvas=null,this.currentShape=null,this.draggingShape=null,this.mousedownPoint=null,this.mousedownShape=null,this.mousedownTimeStamp=null},t}(),Pt=Object(i.a)(),Dt=Pt&&"firefox"===Pt.name,Lt=function(t){function e(e){var n=t.call(this,e)||this;return n.initContainer(),n.initDom(),n.initEvents(),n.initTimeline(),n}return Object(r.__extends)(e,t),e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.cursor="default",e.supportCSSTransform=!1,e},e.prototype.initContainer=function(){var t=this.get("container");Object(a.h)(t)&&(t=document.getElementById(t),this.set("container",t))},e.prototype.initDom=function(){var t=this.createDom();this.set("el",t),this.get("container").appendChild(t),this.setDOMSize(this.get("width"),this.get("height"))},e.prototype.initEvents=function(){var t=new Nt({canvas:this});t.init(),this.set("eventController",t)},e.prototype.initTimeline=function(){var t=new At(this);this.set("timeline",t)},e.prototype.setDOMSize=function(t,e){var n=this.get("el");a.c&&(n.style.width=t+"px",n.style.height=e+"px")},e.prototype.changeSize=function(t,e){this.setDOMSize(t,e),this.set("width",t),this.set("height",e),this.onCanvasChange("changeSize")},e.prototype.getRenderer=function(){return this.get("renderer")},e.prototype.getCursor=function(){return this.get("cursor")},e.prototype.setCursor=function(t){this.set("cursor",t);var e=this.get("el");a.c&&e&&(e.style.cursor=t)},e.prototype.getPointByEvent=function(t){if(this.get("supportCSSTransform")){if(Dt&&!Object(a.e)(t.layerX)&&t.layerX!==t.offsetX)return{x:t.layerX,y:t.layerY};if(!Object(a.e)(t.offsetX))return{x:t.offsetX,y:t.offsetY}}var e=this.getClientByEvent(t),n=e.x,r=e.y;return this.getPointByClient(n,r)},e.prototype.getClientByEvent=function(t){var e=t;return t.touches&&(e="touchend"===t.type?t.changedTouches[0]:t.touches[0]),{x:e.clientX,y:e.clientY}},e.prototype.getPointByClient=function(t,e){var n=this.get("el").getBoundingClientRect();return{x:t-n.left,y:e-n.top}},e.prototype.getClientByPoint=function(t,e){var n=this.get("el").getBoundingClientRect();return{x:t+n.left,y:e+n.top}},e.prototype.draw=function(){},e.prototype.removeDom=function(){var t=this.get("el");t.parentNode.removeChild(t)},e.prototype.clearEvents=function(){this.get("eventController").destroy()},e.prototype.isCanvas=function(){return!0},e.prototype.getParent=function(){return null},e.prototype.destroy=function(){var e=this.get("timeline");this.get("destroyed")||(this.clear(),e&&e.stop(),this.clearEvents(),this.removeDom(),t.prototype.destroy.call(this))},e}(o.a);e.a=Lt},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));function r(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,u,c,l,f,h,d=t._root,p={data:r},g=t._x0,v=t._y0,y=t._x1,m=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((c=e>=(o=(g+y)/2))?g=o:y=o,(l=n>=(a=(v+m)/2))?v=a:m=a,i=d,!(d=d[f=l<<1|c]))return i[f]=p,t;if(s=+t._x.call(null,d.data),u=+t._y.call(null,d.data),e===s&&n===u)return p.next=d,i?i[f]=p:t._root=p,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(c=e>=(o=(g+y)/2))?g=o:y=o,(l=n>=(a=(v+m)/2))?v=a:m=a}while((f=l<<1|c)==(h=(u>=a)<<1|s>=o));return i[h]=d,i[f]=p,t}var i=function(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i};function o(t){return t[0]}function a(t){return t[1]}function s(t,e,n){var r=new u(null==e?o:e,null==n?a:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function u(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function c(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var l=s.prototype=u.prototype;l.copy=function(){var t,e,n=new u(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=c(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=c(e));return n},l.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return r(this.cover(e,n),e,n,t)},l.addAll=function(t){var e,n,i,o,a=t.length,s=new Array(a),u=new Array(a),c=1/0,l=1/0,f=-1/0,h=-1/0;for(n=0;nf&&(f=i),oh&&(h=o));if(c>f||l>h)return this;for(this.cover(c,l).cover(f,h),n=0;nt||t>=i||r>e||e>=o;)switch(s=(ed||(a=c.y0)>p||(s=c.x1)=m)<<1|t>=y)&&(c=g[g.length-1],g[g.length-1]=g[g.length-1-l],g[g.length-1-l]=c)}else{var b=t-+this._x.call(null,v.data),x=e-+this._y.call(null,v.data),w=b*b+x*x;if(w=(s=(p+v)/2))?p=s:v=s,(l=a>=(u=(g+y)/2))?g=u:y=u,e=d,!(d=d[f=l<<1|c]))return this;if(!d.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,h=f)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[f]=i:delete e[f],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},l.removeAll=function(t){for(var e=0,n=t.length;e'})),n}var v=function(){function t(t){this.cfg={};var e=null,n=Object(f.uniqueId)("gradient_");return"l"===t.toLowerCase()[0]?function(t,e){var n,r,i=h.exec(t),o=Object(f.mod)(Object(f.toRadian)(parseFloat(i[1])),2*Math.PI),a=i[2];o>=0&&o<.5*Math.PI?(n={x:0,y:0},r={x:1,y:1}):.5*Math.PI<=o&&o';e.innerHTML=n},t}(),x=function(){function t(t,e){this.cfg={};var n=Object(u.b)("marker"),r=Object(f.uniqueId)("marker_");n.setAttribute("id",r);var i=Object(u.b)("path");i.setAttribute("stroke",t.stroke||"none"),i.setAttribute("fill",t.fill||"none"),n.appendChild(i),n.setAttribute("overflow","visible"),n.setAttribute("orient","auto-start-reverse"),this.el=n,this.child=i,this.id=r;var o=t["marker-start"===e?"startArrow":"endArrow"];return this.stroke=t.stroke||"#000",!0===o?this._setDefaultPath(e,i):(this.cfg=o,this._setMarker(t.lineWidth,i)),this}return t.prototype.match=function(){return!1},t.prototype._setDefaultPath=function(t,e){var n=this.el;e.setAttribute("d","M0,0 L"+10*Math.cos(Math.PI/6)+",5 L0,10"),n.setAttribute("refX",""+10*Math.cos(Math.PI/6)),n.setAttribute("refY","5")},t.prototype._setMarker=function(t,e){var n=this.el,r=this.cfg.path,i=this.cfg.d;Object(f.isArray)(r)&&(r=r.map((function(t){return t.join(" ")})).join("")),e.setAttribute("d",r),n.appendChild(e),i&&n.setAttribute("refX",""+i/t)},t.prototype.update=function(t){var e=this.child;e.attr?e.attr("fill",t):e.setAttribute("fill",t)},t}(),w=function(){function t(t){this.type="clip",this.cfg={};var e=Object(u.b)("clipPath");this.el=e,this.id=Object(f.uniqueId)("clip_"),e.id=this.id;var n=t.cfg.el;return e.appendChild(n),this.cfg=t,this}return t.prototype.match=function(){return!1},t.prototype.remove=function(){var t=this.el;t.parentNode.removeChild(t)},t}(),_=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,E=function(){function t(t){this.cfg={};var e=Object(u.b)("pattern");e.setAttribute("patternUnits","userSpaceOnUse");var n=Object(u.b)("image");e.appendChild(n);var r=Object(f.uniqueId)("pattern_");e.id=r,this.el=e,this.id=r,this.cfg=t;var i=_.exec(t)[2];n.setAttribute("href",i);var o=new Image;function a(){e.setAttribute("width",""+o.width),e.setAttribute("height",""+o.height)}return i.match(/^data:/i)||(o.crossOrigin="Anonymous"),o.src=i,o.complete?a():(o.onload=a,o.src=o.src),this}return t.prototype.match=function(t,e){return this.cfg===e},t}(),S=function(){function t(t){var e=Object(u.b)("defs"),n=Object(f.uniqueId)("defs_");e.id=n,t.appendChild(e),this.children=[],this.defaultArrow={},this.el=e,this.canvas=t}return t.prototype.find=function(t,e){for(var n=this.children,r=null,i=0;i=u.minX&&e<=u.maxX&&n>=u.minY&&n<=u.maxY}var s=n(29),u=n(36),c=n(5),l=n(16),f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(r.__extends)(e,t),e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.renderer="canvas",e.autoDraw=!0,e.localRefresh=!0,e.refreshElements=[],e.clipView=!0,e.quickHit=!1,e},e.prototype.onCanvasChange=function(t){"attr"!==t&&"sort"!==t&&"changeSize"!==t||(this.set("refreshElements",[this]),this.draw())},e.prototype.getShapeBase=function(){return s},e.prototype.getGroupBase=function(){return u.a},e.prototype.getPixelRatio=function(){var t=this.get("pixelRatio")||Object(c.d)();return t>=1?Math.ceil(t):1},e.prototype.getViewRange=function(){return{minX:0,minY:0,maxX:this.cfg.width,maxY:this.cfg.height}},e.prototype.createDom=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return this.set("context",e),t},e.prototype.setDOMSize=function(e,n){t.prototype.setDOMSize.call(this,e,n);var r=this.get("context"),i=this.get("el"),o=this.getPixelRatio();i.width=o*e,i.height=o*n,o>1&&r.scale(o,o)},e.prototype.clear=function(){t.prototype.clear.call(this),this._clearFrame();var e=this.get("context"),n=this.get("el");e.clearRect(0,0,n.width,n.height)},e.prototype.getShape=function(e,n){return this.get("quickHit")?function t(e,n,r){if(!a(e,n,r))return null;for(var i=null,s=e.getChildren(),u=s.length-1;u>=0;u--){var c=s[u];if(c.isGroup())i=t(c,n,r);else if(a(c,n,r)){var l=c,f=o(c,n,r),h=f[0],d=f[1];l.isInShape(h,d)&&(i=c)}if(i)break}return i}(this,e,n):t.prototype.getShape.call(this,e,n,null)},e.prototype._getRefreshRegion=function(){var t,e=this.get("refreshElements"),n=this.getViewRange();e.length&&e[0]===this?t=n:(t=Object(l.f)(e))&&(t.minX=Math.floor(t.minX),t.minY=Math.floor(t.minY),t.maxX=Math.ceil(t.maxX),t.maxY=Math.ceil(t.maxY),t.maxY+=1,this.get("clipView")&&(t=Object(l.g)(t,n)));return t},e.prototype.refreshElement=function(t){this.get("refreshElements").push(t)},e.prototype._clearFrame=function(){var t=this.get("drawFrame");t&&(Object(c.a)(t),this.set("drawFrame",null),this.set("refreshElements",[]))},e.prototype.draw=function(){var t=this.get("drawFrame");this.get("autoDraw")&&t||this._startDraw()},e.prototype._drawAll=function(){var t=this.get("context"),e=this.get("el"),n=this.getChildren();t.clearRect(0,0,e.width,e.height),Object(l.a)(t,this),Object(l.d)(t,n),this.set("refreshElements",[])},e.prototype._drawRegion=function(){var t=this.get("context"),e=this.get("refreshElements"),n=this.getChildren(),r=this._getRefreshRegion();r?(t.clearRect(r.minX,r.minY,r.maxX-r.minX,r.maxY-r.minY),t.save(),t.beginPath(),t.rect(r.minX,r.minY,r.maxX-r.minX,r.maxY-r.minY),t.clip(),Object(l.a)(t,this),Object(l.b)(this,n,r),Object(l.d)(t,n,r),t.restore()):e.length&&Object(l.c)(e),Object(c.c)(e,(function(t){t.get("hasChanged")&&t.set("hasChanged",!1)})),this.set("refreshElements",[])},e.prototype._startDraw=function(){var t=this,e=this.get("drawFrame");e||(e=Object(c.n)((function(){t.get("localRefresh")?t._drawRegion():t._drawAll(),t.set("drawFrame",null)})),this.set("drawFrame",e))},e.prototype.skipDraw=function(){},e.prototype.removeDom=function(){var t=this.get("el");t.width=0,t.height=0,t.parentNode.removeChild(t)},e}(i.AbstractCanvas);e.a=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"GADDIAsync",{enumerable:!0,get:function(){return r.GADDIAsync}}),Object.defineProperty(e,"connectedComponentAsync",{enumerable:!0,get:function(){return r.connectedComponentAsync}}),e.default=void 0,Object.defineProperty(e,"detectAllCyclesAsync",{enumerable:!0,get:function(){return r.detectAllCyclesAsync}}),Object.defineProperty(e,"detectAllDirectedCycleAsync",{enumerable:!0,get:function(){return r.detectAllDirectedCycleAsync}}),Object.defineProperty(e,"detectAllUndirectedCycleAsync",{enumerable:!0,get:function(){return r.detectAllUndirectedCycleAsync}}),Object.defineProperty(e,"detectCycleAsync",{enumerable:!0,get:function(){return r.detectCycleAsync}}),e.detectDirectedCycleAsync=void 0,Object.defineProperty(e,"dijkstraAsync",{enumerable:!0,get:function(){return r.dijkstraAsync}}),Object.defineProperty(e,"findAllPathAsync",{enumerable:!0,get:function(){return r.findAllPathAsync}}),Object.defineProperty(e,"findShortestPathAsync",{enumerable:!0,get:function(){return r.findShortestPathAsync}}),Object.defineProperty(e,"floydWarshallAsync",{enumerable:!0,get:function(){return r.floydWarshallAsync}}),Object.defineProperty(e,"getAdjMatrixAsync",{enumerable:!0,get:function(){return r.getAdjMatrixAsync}}),Object.defineProperty(e,"getDegreeAsync",{enumerable:!0,get:function(){return r.getDegreeAsync}}),Object.defineProperty(e,"getInDegreeAsync",{enumerable:!0,get:function(){return r.getInDegreeAsync}}),Object.defineProperty(e,"getNeighborsAsync",{enumerable:!0,get:function(){return r.getNeighborsAsync}}),Object.defineProperty(e,"getOutDegreeAsync",{enumerable:!0,get:function(){return r.getOutDegreeAsync}}),Object.defineProperty(e,"labelPropagationAsync",{enumerable:!0,get:function(){return r.labelPropagationAsync}}),Object.defineProperty(e,"louvainAsync",{enumerable:!0,get:function(){return r.louvainAsync}}),Object.defineProperty(e,"minimumSpanningTreeAsync",{enumerable:!0,get:function(){return r.minimumSpanningTreeAsync}}),Object.defineProperty(e,"pageRankAsync",{enumerable:!0,get:function(){return r.pageRankAsync}});var r=n(124),i=r.detectCycleAsync;e.detectDirectedCycleAsync=i;var o={getAdjMatrixAsync:r.getAdjMatrixAsync,connectedComponentAsync:r.connectedComponentAsync,getDegreeAsync:r.getDegreeAsync,getInDegreeAsync:r.getInDegreeAsync,getOutDegreeAsync:r.getOutDegreeAsync,detectCycleAsync:r.detectCycleAsync,detectDirectedCycleAsync:i,detectAllCyclesAsync:r.detectAllCyclesAsync,detectAllDirectedCycleAsync:r.detectAllDirectedCycleAsync,detectAllUndirectedCycleAsync:r.detectAllUndirectedCycleAsync,dijkstraAsync:r.dijkstraAsync,findAllPathAsync:r.findAllPathAsync,findShortestPathAsync:r.findShortestPathAsync,floydWarshallAsync:r.floydWarshallAsync,labelPropagationAsync:r.labelPropagationAsync,louvainAsync:r.louvainAsync,minimumSpanningTreeAsync:r.minimumSpanningTreeAsync,pageRankAsync:r.pageRankAsync,getNeighborsAsync:r.getNeighborsAsync,GADDIAsync:r.GADDIAsync};e.default=o},function(t,e,n){var r=n(64),i=n(65);t.exports=function(t){return"number"==typeof t||i(t)&&"[object Number]"==r(t)}},function(t,e){var n=Array.isArray;t.exports=n},function(t,e,n){var r,i,o;function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}o=function(){"use strict";var t=function(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array||t instanceof Uint8ClampedArray},e=function(t,e){for(var n=Object.keys(e),r=0;r=0&&(0|t)===t||n("invalid parameter type, ("+t+")"+i(e)+". must be a nonnegative integer")},oneOf:s,shaderError:function(t,e,n,i,o){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var a=t.getShaderInfoLog(e),s=i===t.FRAGMENT_SHADER?"fragment":"vertex";m(n,"string",s+" shader source must be a string",o);var u=g(n,o),l=function(t){var e=[];return t.split("\n").forEach((function(t){if(!(t.length<5)){var n=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(t);n?e.push(new h(0|n[1],0|n[2],n[3].trim())):t.length>0&&e.push(new h("unknown",0,t))}})),e}(a);!function(t,e){e.forEach((function(e){var n=t[e.file];if(n){var r=n.index[e.line];if(r)return r.errors.push(e),void(n.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)}))}(u,l),Object.keys(u).forEach((function(t){var e=u[t];if(e.hasErrors){var n=[""],r=[""];i("file number "+t+": "+e.name+"\n","color:red;text-decoration:underline;font-weight:bold"),e.lines.forEach((function(t){if(t.errors.length>0){i(c(t.number,4)+"| ","background-color:yellow; font-weight:bold"),i(t.line+"\n","color:red; background-color:yellow; font-weight:bold");var e=0;t.errors.forEach((function(n){var r=n.message,o=/^\s*'(.*)'\s*:\s*(.*)$/.exec(r);if(o){var a=o[1];switch(r=o[2],a){case"assign":a="="}e=Math.max(t.line.indexOf(a,e),0)}else e=0;i(c("| ",6)),i(c("^^^",e+3)+"\n","font-weight:bold"),i(c("| ",6)),i(r+"\n","font-weight:bold")})),i(c("| ",6)+"\n")}else i(c(t.number,4)+"| "),i(t.line+"\n","color:red")})),"undefined"==typeof document||window.chrome?console.log(n.join("")):(r[0]=n.join("%c"),console.log.apply(console,r))}function i(t,e){n.push(t),r.push(e||"")}})),r.raise("Error compiling "+s+" shader, "+u[0].name)}},linkError:function(t,e,n,i,o){if(!t.getProgramParameter(e,t.LINK_STATUS)){var a=t.getProgramInfoLog(e),s=g(n,o),u='Error linking program with vertex shader, "'+g(i,o)[0].name+'", and fragment shader "'+s[0].name+'"';"undefined"!=typeof document?console.log("%c"+u+"\n%c"+a,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(u+"\n"+a),r.raise(u)}},callSite:p,saveCommandRef:v,saveDrawInfo:function(t,e,n,r){function i(t){return t?r.id(t):0}function o(t,e){Object.keys(e).forEach((function(e){t[r.id(e)]=!0}))}v(t),t._fragId=i(t.static.frag),t._vertId=i(t.static.vert);var a=t._uniformSet={};o(a,e.static),o(a,e.dynamic);var s=t._attributeSet={};o(s,n.static),o(s,n.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic},framebufferFormat:function(t,e,n){t.texture?s(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):s(t.renderbuffer._renderbuffer.format,n,"unsupported renderbuffer format for attachment")},guessCommand:d,texture2D:function(t,e,n){var i,o=e.width,a=e.height,s=e.channels;r(o>0&&o<=n.maxTextureSize&&a>0&&a<=n.maxTextureSize,"invalid texture shape"),33071===t.wrapS&&33071===t.wrapT||r(w(o)&&w(a),"incompatible wrap mode for texture, both width and height must be power of 2"),1===e.mipmask?1!==o&&1!==a&&r(9984!==t.minFilter&&9986!==t.minFilter&&9985!==t.minFilter&&9987!==t.minFilter,"min filter requires mipmap"):(r(w(o)&&w(a),"texture must be a square power of 2 to support mipmapping"),r(e.mipmask===(o<<1)-1,"missing or incomplete mipmap data")),5126===e.type&&(n.extensions.indexOf("oes_texture_float_linear")<0&&r(9728===t.minFilter&&9728===t.magFilter,"filter not supported, must enable oes_texture_float_linear"),r(!t.genMipmaps,"mipmap generation not supported with float textures"));var u=e.images;for(i=0;i<16;++i)if(u[i]){var c=o>>i,l=a>>i;r(e.mipmask&1<0&&o<=i.maxTextureSize&&a>0&&a<=i.maxTextureSize,"invalid texture shape"),r(o===a,"cube map must be square"),r(33071===e.wrapS&&33071===e.wrapT,"wrap mode not supported by cube map");for(var u=0;u>f,p=a>>f;r(c.mipmask&1<1&&n===r&&('"'===n||"'"===n))return['"'+M(e.substr(1,e.length-2))+'"'];var i=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(e);if(i)return t(e.substr(0,i.index)).concat(t(i[1])).concat(t(e.substr(i.index+i[0].length)));var o=e.split(".");if(1===o.length)return['"'+M(e)+'"'];for(var a=[],s=0;s0,"invalid pixel ratio"))):_.raise("invalid arguments to regl"),n&&("canvas"===n.nodeName.toLowerCase()?i=n:r=n),!o){if(!i){_("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var v=function(t,n,r){var i,o=document.createElement("canvas");function a(){var n=window.innerWidth,i=window.innerHeight;if(t!==document.body){var a=t.getBoundingClientRect();n=a.right-a.left,i=a.bottom-a.top}o.width=r*n,o.height=r*i,e(o.style,{width:n+"px",height:i+"px"})}return e(o.style,{border:0,margin:0,padding:0,top:0,left:0}),t.appendChild(o),t===document.body&&(o.style.position="absolute",e(t.style,{margin:0,padding:0})),t!==document.body&&"function"==typeof ResizeObserver?(i=new ResizeObserver((function(){setTimeout(a)}))).observe(t):window.addEventListener("resize",a,!1),a(),{canvas:o,onDestroy:function(){i?i.disconnect():window.removeEventListener("resize",a),t.removeChild(o)}}}(r||document.body,0,h);if(!v)return null;i=v.canvas,g=v.onDestroy}void 0===c.premultipliedAlpha&&(c.premultipliedAlpha=!0),o=function(t,e){function n(n){try{return t.getContext(n,e)}catch(t){return null}}return n("webgl")||n("experimental-webgl")||n("webgl-experimental")}(i,c)}return o?{gl:o,canvas:i,container:r,extensions:l,optionalExtensions:f,pixelRatio:h,profile:d,onDone:p,onDestroy:g}:(g(),p("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function N(t,e){for(var n=Array(t),r=0;r65535)<<4,e|=n=((t>>>=e)>255)<<3,e|=n=((t>>>=n)>15)<<2,(e|=n=((t>>>=n)>3)<<1)|(t>>>=n)>>1}function D(){var t=N(8,(function(){return[]}));function e(e){var n=function(t){for(var e=16;e<=1<<28;e*=16)if(t<=e)return e;return 0}(e),r=t[P(n)>>2];return r.length>0?r.pop():new ArrayBuffer(n)}function n(e){t[P(e.byteLength)>>2].push(e)}return{alloc:e,free:n,allocType:function(t,n){var r=null;switch(t){case 5120:r=new Int8Array(e(n),0,n);break;case 5121:r=new Uint8Array(e(n),0,n);break;case 5122:r=new Int16Array(e(2*n),0,n);break;case 5123:r=new Uint16Array(e(2*n),0,n);break;case 5124:r=new Int32Array(e(4*n),0,n);break;case 5125:r=new Uint32Array(e(4*n),0,n);break;case 5126:r=new Float32Array(e(4*n),0,n);break;default:return null}return r.length!==n?r.subarray(0,n):r},freeType:function(t){n(t.buffer)}}}var L=D();function R(e){return!!e&&"object"===a(e)&&Array.isArray(e.shape)&&Array.isArray(e.stride)&&"number"==typeof e.offset&&e.shape.length===e.stride.length&&(Array.isArray(e.data)||t(e.data))}L.zero=D();var B=function(t){return Object.keys(t).map((function(e){return t[e]}))},F={shape:function(t){for(var e=[],n=t;n.length;n=n[0])e.push(n.length);return e},flatten:function(t,e,n,r){var i=1;if(e.length)for(var o=0;o>>31<<15,o=(r<<1>>>24)-127,a=r>>13&1023;if(o<-24)e[n]=i;else if(o<-14){var s=-14-o;e[n]=i+(a+1024>>s)}else e[n]=o>15?i+31744:i+(o+15<<10)+a}return e}function tt(e){return Array.isArray(e)||t(e)}var et=function(t){return!(t&t-1||!t)},nt=[9984,9986,9985,9987],rt=[0,6409,6410,6407,6408],it={};function ot(t){return"[object "+t+"]"}it[6409]=it[6406]=it[6402]=1,it[34041]=it[6410]=2,it[6407]=it[35904]=3,it[6408]=it[35906]=4;var at=ot("HTMLCanvasElement"),st=ot("OffscreenCanvas"),ut=ot("CanvasRenderingContext2D"),ct=ot("ImageBitmap"),lt=ot("HTMLImageElement"),ft=ot("HTMLVideoElement"),ht=Object.keys(G).concat([at,st,ut,ct,lt,ft]),dt=[];dt[5121]=1,dt[5126]=4,dt[36193]=2,dt[5123]=2,dt[5125]=4;var pt=[];function gt(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function vt(t){return!!Array.isArray(t)&&!(0===t.length||!tt(t[0]))}function yt(t){return Object.prototype.toString.call(t)}function mt(t){return yt(t)===at}function bt(t){return yt(t)===st}function xt(t){if(!t)return!1;var e=yt(t);return ht.indexOf(e)>=0||gt(t)||vt(t)||R(t)}function wt(t){return 0|G[Object.prototype.toString.call(t)]}function _t(t,e){return L.allocType(36193===t.type?5126:t.type,e)}function Et(t,e){36193===t.type?(t.data=J(e),L.freeType(e)):t.data=e}function St(t,e,n,r,i,o){var a;if(a=void 0!==pt[t]?pt[t]:it[t]*dt[e],o&&(a*=6),i){for(var s=0,u=n;u>=1;)s+=a*u*u,u/=2;return s}return a*n*r}function Mt(n,r,i,o,s,u,c){var l={"don't care":4352,"dont care":4352,nice:4354,fast:4353},f={repeat:10497,clamp:33071,mirror:33648},h={nearest:9728,linear:9729},d=e({mipmap:9987,"nearest mipmap nearest":9984,"linear mipmap nearest":9985,"nearest mipmap linear":9986,"linear mipmap linear":9987},h),p={none:0,browser:37444},g={uint8:5121,rgba4:32819,rgb565:33635,"rgb5 a1":32820},v={alpha:6406,luminance:6409,"luminance alpha":6410,rgb:6407,rgba:6408,rgba4:32854,"rgb5 a1":32855,rgb565:36194},y={};r.ext_srgb&&(v.srgb=35904,v.srgba=35906),r.oes_texture_float&&(g.float32=g.float=5126),r.oes_texture_half_float&&(g.float16=g["half float"]=36193),r.webgl_depth_texture&&(e(v,{depth:6402,"depth stencil":34041}),e(g,{uint16:5123,uint32:5125,"depth stencil":34042})),r.webgl_compressed_texture_s3tc&&e(y,{"rgb s3tc dxt1":33776,"rgba s3tc dxt1":33777,"rgba s3tc dxt3":33778,"rgba s3tc dxt5":33779}),r.webgl_compressed_texture_atc&&e(y,{"rgb atc":35986,"rgba atc explicit alpha":35987,"rgba atc interpolated alpha":34798}),r.webgl_compressed_texture_pvrtc&&e(y,{"rgb pvrtc 4bppv1":35840,"rgb pvrtc 2bppv1":35841,"rgba pvrtc 4bppv1":35842,"rgba pvrtc 2bppv1":35843}),r.webgl_compressed_texture_etc1&&(y["rgb etc1"]=36196);var m=Array.prototype.slice.call(n.getParameter(34467));Object.keys(y).forEach((function(t){var e=y[t];m.indexOf(e)>=0&&(v[t]=e)}));var b=Object.keys(v);i.textureFormats=b;var x=[];Object.keys(v).forEach((function(t){var e=v[t];x[e]=t}));var w=[];Object.keys(g).forEach((function(t){var e=g[t];w[e]=t}));var E=[];Object.keys(h).forEach((function(t){E[h[t]]=t}));var S=[];Object.keys(d).forEach((function(t){var e=d[t];S[e]=t}));var M=[];Object.keys(f).forEach((function(t){M[f[t]]=t}));var O=b.reduce((function(t,e){var n=v[e];return 6409===n||6406===n||6409===n||6410===n||6402===n||34041===n||r.ext_srgb&&(35904===n||35906===n)?t[n]=n:32855===n||e.indexOf("rgba")>=0?t[n]=6408:t[n]=6407,t}),{});function k(){this.internalformat=6408,this.format=6408,this.type=5121,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=37444,this.width=0,this.height=0,this.channels=0}function A(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function C(t,e){if("object"===a(e)&&e){if("premultiplyAlpha"in e&&(_.type(e.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=e.premultiplyAlpha),"flipY"in e&&(_.type(e.flipY,"boolean","invalid texture flip"),t.flipY=e.flipY),"alignment"in e&&(_.oneOf(e.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=e.alignment),"colorSpace"in e&&(_.parameter(e.colorSpace,p,"invalid colorSpace"),t.colorSpace=p[e.colorSpace]),"type"in e){var n=e.type;_(r.oes_texture_float||!("float"===n||"float32"===n),"you must enable the OES_texture_float extension in order to use floating point textures."),_(r.oes_texture_half_float||!("half float"===n||"float16"===n),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),_(r.webgl_depth_texture||!("uint16"===n||"uint32"===n||"depth stencil"===n),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),_.parameter(n,g,"invalid texture type"),t.type=g[n]}var o=t.width,s=t.height,u=t.channels,c=!1;"shape"in e?(_(Array.isArray(e.shape)&&e.shape.length>=2,"shape must be an array"),o=e.shape[0],s=e.shape[1],3===e.shape.length&&(u=e.shape[2],_(u>0&&u<=4,"invalid number of channels"),c=!0),_(o>=0&&o<=i.maxTextureSize,"invalid width"),_(s>=0&&s<=i.maxTextureSize,"invalid height")):("radius"in e&&(o=s=e.radius,_(o>=0&&o<=i.maxTextureSize,"invalid radius")),"width"in e&&(o=e.width,_(o>=0&&o<=i.maxTextureSize,"invalid width")),"height"in e&&(s=e.height,_(s>=0&&s<=i.maxTextureSize,"invalid height")),"channels"in e&&(u=e.channels,_(u>0&&u<=4,"invalid number of channels"),c=!0)),t.width=0|o,t.height=0|s,t.channels=0|u;var l=!1;if("format"in e){var f=e.format;_(r.webgl_depth_texture||!("depth"===f||"depth stencil"===f),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),_.parameter(f,v,"invalid texture format");var h=t.internalformat=v[f];t.format=O[h],f in g&&("type"in e||(t.type=g[f])),f in y&&(t.compressed=!0),l=!0}!c&&l?t.channels=it[t.format]:c&&!l?t.channels!==rt[t.format]&&(t.format=t.internalformat=rt[t.channels]):l&&c&&_(t.channels===it[t.format],"number of channels inconsistent with specified format")}}function j(t){n.pixelStorei(37440,t.flipY),n.pixelStorei(37441,t.premultiplyAlpha),n.pixelStorei(37443,t.colorSpace),n.pixelStorei(3317,t.unpackAlignment)}function I(){k.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function T(e,n){var r=null;if(xt(n)?r=n:n&&(_.type(n,"object","invalid pixel data type"),C(e,n),"x"in n&&(e.xOffset=0|n.x),"y"in n&&(e.yOffset=0|n.y),xt(n.data)&&(r=n.data)),_(!e.compressed||r instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),n.copy){_(!r,"can not specify copy and data field for the same texture");var o=s.viewportWidth,a=s.viewportHeight;e.width=e.width||o-e.xOffset,e.height=e.height||a-e.yOffset,e.needsCopy=!0,_(e.xOffset>=0&&e.xOffset=0&&e.yOffset0&&e.width<=o&&e.height>0&&e.height<=a,"copy texture read out of bounds")}else if(r){if(t(r))e.channels=e.channels||4,e.data=r,"type"in n||5121!==e.type||(e.type=wt(r));else if(gt(r))e.channels=e.channels||4,function(t,e){var n=e.length;switch(t.type){case 5121:case 5123:case 5125:case 5126:var r=L.allocType(t.type,n);r.set(e),t.data=r;break;case 36193:t.data=J(e);break;default:_.raise("unsupported texture type, must specify a typed array")}}(e,r),e.alignment=1,e.needsFree=!0;else if(R(r)){var u=r.data;Array.isArray(u)||5121!==e.type||(e.type=wt(u));var c,l,f,h,d,p,g=r.shape,v=r.stride;3===g.length?(f=g[2],p=v[2]):(_(2===g.length,"invalid ndarray pixel data, must be 2 or 3D"),f=1,p=1),c=g[0],l=g[1],h=v[0],d=v[1],e.alignment=1,e.width=c,e.height=l,e.channels=f,e.format=e.internalformat=rt[f],e.needsFree=!0,function(t,e,n,r,i,o){for(var a=t.width,s=t.height,u=t.channels,c=_t(t,a*s*u),l=0,f=0;f=0,"oes_texture_float extension not enabled"):36193===e.type&&_(i.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function N(t,e,r){var i=t.element,a=t.data,s=t.internalformat,u=t.format,c=t.type,l=t.width,f=t.height;j(t),i?n.texImage2D(e,r,u,u,c,i):t.compressed?n.compressedTexImage2D(e,r,s,l,f,0,a):t.needsCopy?(o(),n.copyTexImage2D(e,r,u,t.xOffset,t.yOffset,l,f,0)):n.texImage2D(e,r,u,l,f,0,u,c,a||null)}function P(t,e,r,i,a){var s=t.element,u=t.data,c=t.internalformat,l=t.format,f=t.type,h=t.width,d=t.height;j(t),s?n.texSubImage2D(e,a,r,i,l,f,s):t.compressed?n.compressedTexSubImage2D(e,a,r,i,c,h,d,u):t.needsCopy?(o(),n.copyTexSubImage2D(e,a,r,i,t.xOffset,t.yOffset,h,d)):n.texSubImage2D(e,a,r,i,h,d,l,f,u)}var D=[];function z(){return D.pop()||new I}function G(t){t.needsFree&&L.freeType(t.data),I.call(t),D.push(t)}function Y(){k.call(this),this.genMipmaps=!1,this.mipmapHint=4352,this.mipmask=0,this.images=Array(16)}function U(t,e,n){var r=t.images[0]=z();t.mipmask=1,r.width=t.width=e,r.height=t.height=n,r.channels=t.channels=4}function X(t,e){var n=null;if(xt(e))A(n=t.images[0]=z(),t),T(n,e),t.mipmask=1;else if(C(t,e),Array.isArray(e.mipmap))for(var r=e.mipmap,i=0;i>=i,n.height>>=i,T(n,r[i]),t.mipmask|=1<=0&&!("faces"in e)&&(t.genMipmaps=!0)}if("mag"in e){var r=e.mag;_.parameter(r,h),t.magFilter=h[r]}var o=t.wrapS,s=t.wrapT;if("wrap"in e){var u=e.wrap;"string"==typeof u?(_.parameter(u,f),o=s=f[u]):Array.isArray(u)&&(_.parameter(u[0],f),_.parameter(u[1],f),o=f[u[0]],s=f[u[1]])}else{if("wrapS"in e){var c=e.wrapS;_.parameter(c,f),o=f[c]}if("wrapT"in e){var p=e.wrapT;_.parameter(p,f),s=f[p]}}if(t.wrapS=o,t.wrapT=s,"anisotropic"in e){var g=e.anisotropic;_("number"==typeof g&&g>=1&&g<=i.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var v=!1;switch(a(e.mipmap)){case"string":_.parameter(e.mipmap,l,"invalid mipmap hint"),t.mipmapHint=l[e.mipmap],t.genMipmaps=!0,v=!0;break;case"boolean":v=t.genMipmaps=e.mipmap;break;case"object":_(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,v=!0;break;default:_.raise("invalid mipmap type")}v&&!("min"in e)&&(t.minFilter=9984)}}function Q(t,e){n.texParameteri(e,10241,t.minFilter),n.texParameteri(e,10240,t.magFilter),n.texParameteri(e,10242,t.wrapS),n.texParameteri(e,10243,t.wrapT),r.ext_texture_filter_anisotropic&&n.texParameteri(e,34046,t.anisotropic),t.genMipmaps&&(n.hint(33170,t.mipmapHint),n.generateMipmap(e))}var $=0,ot={},at=i.maxTextureUnits,st=Array(at).map((function(){return null}));function ht(t){k.call(this),this.mipmask=0,this.internalformat=6408,this.id=$++,this.refCount=1,this.target=t,this.texture=n.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new Z,c.profile&&(this.stats={size:0})}function dt(t){n.activeTexture(33984),n.bindTexture(t.target,t.texture)}function pt(){var t=st[0];t?n.bindTexture(t.target,t.texture):n.bindTexture(3553,null)}function Mt(t){var e=t.texture;_(e,"must not double destroy texture");var r=t.unit,i=t.target;r>=0&&(n.activeTexture(33984+r),n.bindTexture(i,null),st[r]=null),n.deleteTexture(e),t.texture=null,t.params=null,t.pixels=null,t.refCount=0,delete ot[t.id],u.textureCount--}return e(ht.prototype,{bind:function(){this.bindCount+=1;var t=this.unit;if(t<0){for(var e=0;e0)continue;r.unit=-1}st[e]=this,t=e;break}t>=at&&_.raise("insufficient number of texture units"),c.profile&&u.maxTextureUnits>u)-a,c.height=c.height||(r.height>>u)-s,_(r.type===c.type&&r.format===c.format&&r.internalformat===c.internalformat,"incompatible format for texture.subimage"),_(a>=0&&s>=0&&a+c.width<=r.width&&s+c.height<=r.height,"texture.subimage write out of bounds"),_(r.mipmask&1<>s;++s){var u=i>>s,l=a>>s;if(!u||!l)break;n.texImage2D(3553,s,r.format,u,l,0,r.format,r.type,null)}return pt(),c.profile&&(r.stats.size=St(r.internalformat,r.type,i,a,!1,!1)),o},o._reglType="texture2d",o._texture=r,c.profile&&(o.stats=r.stats),o.destroy=function(){r.decRef()},o},createCube:function(t,e,r,o,s,l){var f=new ht(34067);ot[f.id]=f,u.cubeCount++;var h=new Array(6);function d(t,e,n,r,o,s){var u,l=f.texInfo;for(Z.call(l),u=0;u<6;++u)h[u]=H();if("number"!=typeof t&&t)if("object"===a(t))if(e)X(h[0],t),X(h[1],e),X(h[2],n),X(h[3],r),X(h[4],o),X(h[5],s);else if(K(l,t),C(f,t),"faces"in t){var p=t.faces;for(_(Array.isArray(p)&&6===p.length,"cube faces must be a length 6 array"),u=0;u<6;++u)_("object"===a(p[u])&&!!p[u],"invalid input for cube map face"),A(h[u],f),X(h[u],p[u])}else for(u=0;u<6;++u)X(h[u],t);else _.raise("invalid arguments to cube map");else{var g=0|t||1;for(u=0;u<6;++u)U(h[u],g,g)}for(A(f,h[0]),i.npotTextureCube||_(et(f.width)&&et(f.height),"your browser does not support non power or two texture dimensions"),l.genMipmaps?f.mipmask=(h[0].width<<1)-1:f.mipmask=h[0].mipmask,_.textureCube(f,l,h,i),f.internalformat=h[0].internalformat,d.width=h[0].width,d.height=h[0].height,dt(f),u=0;u<6;++u)W(h[u],34069+u);for(Q(l,34067),pt(),c.profile&&(f.stats.size=St(f.internalformat,f.type,d.width,d.height,l.genMipmaps,!0)),d.format=x[f.internalformat],d.type=w[f.type],d.mag=E[l.magFilter],d.min=S[l.minFilter],d.wrapS=M[l.wrapS],d.wrapT=M[l.wrapT],u=0;u<6;++u)q(h[u]);return d}return d(t,e,r,o,s,l),d.subimage=function(t,e,n,r,i){_(!!e,"must specify image data"),_("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var o=0|n,a=0|r,s=0|i,u=z();return A(u,f),u.width=0,u.height=0,T(u,e),u.width=u.width||(f.width>>s)-o,u.height=u.height||(f.height>>s)-a,_(f.type===u.type&&f.format===u.format&&f.internalformat===u.internalformat,"incompatible format for texture.subimage"),_(o>=0&&a>=0&&o+u.width<=f.width&&a+u.height<=f.height,"texture.subimage write out of bounds"),_(f.mipmask&1<>i;++i)n.texImage2D(34069+r,i,f.format,e>>i,e>>i,0,f.format,f.type,null);return pt(),c.profile&&(f.stats.size=St(f.internalformat,f.type,d.width,d.height,!1,!0)),d}},d._reglType="textureCube",d._texture=f,c.profile&&(d.stats=f.stats),d.destroy=function(){f.decRef()},d},clear:function(){for(var t=0;t>e,t.height>>e,0,t.internalformat,t.type,null);else for(var r=0;r<6;++r)n.texImage2D(34069+r,e,t.internalformat,t.width>>e,t.height>>e,0,t.internalformat,t.type,null);Q(t.texInfo,t.target)}))},refresh:function(){for(var t=0;t=0&&l=0&&f0&&h+l<=i.framebufferWidth,"invalid width for read pixels"),_(d>0&&d+f<=i.framebufferHeight,"invalid height for read pixels"),r();var g=h*d*4;return p||(5121===c?p=new Uint8Array(g):5126===c&&(p=p||new Float32Array(g))),_.isTypedArray(p,"data buffer for regl.read() must be a typedarray"),_(p.byteLength>=g,"data buffer for regl.read() too small"),e.pixelStorei(3333,4),e.readPixels(l,f,h,d,6408,c,p),p}return function(t){return t&&"framebuffer"in t?function(t){var e;return n.setFBO({framebuffer:t.framebuffer},(function(){e=u(t)})),e}(t):u(t)}}function Dt(t){return Array.prototype.slice.call(t)}function Lt(t){return Dt(t).join("")}Tt[36053]="complete",Tt[36054]="incomplete attachment",Tt[36057]="incomplete dimensions",Tt[36055]="incomplete, missing attachment",Tt[36061]="unsupported";var Rt="xyzw".split(""),Bt="profile",Ft="framebuffer",zt="vert",Gt="frag",Yt="elements",Ut="primitive",Xt="count",Wt="offset",Vt="instances",Ht="vao",qt=Ft+"Width",Zt=Ft+"Height",Kt=["blend.func","blend.equation","stencil.func","stencil.opFront","stencil.opBack","sample.coverage","viewport","scissor.box","polygonOffset.offset"],Qt={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},$t=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],Jt={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},te={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},ee={frag:35632,vert:35633},ne={cw:2304,ccw:2305};function re(e){return Array.isArray(e)||t(e)||R(e)}function ie(t){return t.sort((function(t,e){return"viewport"===t?-1:"viewport"===e?1:t=1,r>=2,e)}if(4===n){var i=t.data;return new oe(i.thisDep,i.contextDep,i.propDep,e)}if(5===n)return new oe(!1,!1,!1,e);if(6===n){for(var o=!1,a=!1,s=!1,u=0;u=1&&(a=!0),l>=2&&(s=!0)}else 4===c.type&&(o=o||c.data.thisDep,a=a||c.data.contextDep,s=s||c.data.propDep)}return new oe(o,a,s,e)}return new oe(3===n,2===n,1===n,e)}var ce=new oe(!1,!1,!1,(function(){}));function le(t,n,r,i,o,s,u,c,l,f,h,d,p,g,v){var y=f.Record,m={add:32774,subtract:32778,"reverse subtract":32779};r.ext_blend_minmax&&(m.min=32775,m.max=32776);var b=r.angle_instanced_arrays,x=r.webgl_draw_buffers,w={dirty:!0,profile:v.profile},E={},S=[],M={},O={};function A(t){return t.replace(".","_")}function C(t,e,n){var r=A(t);S.push(t),E[r]=w[r]=!!n,M[r]=e}function j(t,e,n){var r=A(t);S.push(t),Array.isArray(n)?(w[r]=n.slice(),E[r]=n.slice()):w[r]=E[r]=n,O[r]=e}C("dither",3024),C("blend.enable",3042),j("blend.color","blendColor",[0,0,0,0]),j("blend.equation","blendEquationSeparate",[32774,32774]),j("blend.func","blendFuncSeparate",[1,0,1,0]),C("depth.enable",2929,!0),j("depth.func","depthFunc",513),j("depth.range","depthRange",[0,1]),j("depth.mask","depthMask",!0),j("colorMask","colorMask",[!0,!0,!0,!0]),C("cull.enable",2884),j("cull.face","cullFace",1029),j("frontFace","frontFace",2305),j("lineWidth","lineWidth",1),C("polygonOffset.enable",32823),j("polygonOffset.offset","polygonOffset",[0,0]),C("sample.alpha",32926),C("sample.enable",32928),j("sample.coverage","sampleCoverage",[1,!1]),C("stencil.enable",2960),j("stencil.mask","stencilMask",-1),j("stencil.func","stencilFunc",[519,0,-1]),j("stencil.opFront","stencilOpSeparate",[1028,7680,7680,7680]),j("stencil.opBack","stencilOpSeparate",[1029,7680,7680,7680]),C("scissor.enable",3089),j("scissor.box","scissor",[0,0,t.drawingBufferWidth,t.drawingBufferHeight]),j("viewport","viewport",[0,0,t.drawingBufferWidth,t.drawingBufferHeight]);var I={gl:t,context:p,strings:n,next:E,current:w,draw:d,elements:s,buffer:o,shader:h,attributes:f.state,vao:f,uniforms:l,framebuffer:c,extensions:r,timer:g,isBufferArgs:re},T={primTypes:K,compareFuncs:Jt,blendFuncs:Qt,blendEquations:m,stencilOps:te,glTypes:Y,orientationType:ne};_.optional((function(){I.isArrayLike=tt})),x&&(T.backBuffer=[1029],T.drawBuffer=N(i.maxDrawbuffers,(function(t){return 0===t?[0]:N(t,(function(t){return 36064+t}))})));var P=0;function D(){var t=function(){var t=0,n=[],r=[];function i(){var n=[],r=[];return e((function(){n.push.apply(n,Dt(arguments))}),{def:function(){var e="v"+t++;return r.push(e),arguments.length>0&&(n.push(e,"="),n.push.apply(n,Dt(arguments)),n.push(";")),e},toString:function(){return Lt([r.length>0?"var "+r.join(",")+";":"",Lt(n)])}})}function o(){var t=i(),n=i(),r=t.toString,o=n.toString;function a(e,r){n(e,r,"=",t.def(e,r),";")}return e((function(){t.apply(t,Dt(arguments))}),{def:t.def,entry:t,exit:n,save:a,set:function(e,n,r){a(e,n),t(e,n,"=",r,";")},toString:function(){return r()+o()}})}var a=i(),s={};return{global:a,link:function(e){for(var i=0;i=0,'unknown parameter "'+e+'"',d.commandStr)}))}e(p),e(g)}));var v=function(t,e){var n=t.static;if("string"==typeof n[Gt]&&"string"==typeof n[zt]){if(Object.keys(e.dynamic).length>0)return null;var r=e.static,i=Object.keys(r);if(i.length>0&&"number"==typeof r[i[0]]){for(var o=[],a=0;a=0,"invalid "+t,n.commandStr)):u=!1,"height"in o?(s=0|o.height,_.command(s>=0,"invalid "+t,n.commandStr)):u=!1,new oe(!u&&e&&e.thisDep,!u&&e&&e.contextDep,!u&&e&&e.propDep,(function(t,e){var n=t.shared.context,r=a;"width"in o||(r=e.def(n,".",qt,"-",c));var i=s;return"height"in o||(i=e.def(n,".",Zt,"-",l)),[c,l,r,i]}))}if(t in i){var f=i[t],h=ue(f,(function(e,n){var r=e.invoke(n,f);_.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid "+t)}));var i=e.shared.context,o=n.def(r,".x|0"),a=n.def(r,".y|0"),s=n.def('"width" in ',r,"?",r,".width|0:","(",i,".",qt,"-",o,")"),u=n.def('"height" in ',r,"?",r,".height|0:","(",i,".",Zt,"-",a,")");return _.optional((function(){e.assert(n,s+">=0&&"+u+">=0","invalid "+t)})),[o,a,s,u]}));return e&&(h.thisDep=h.thisDep||e.thisDep,h.contextDep=h.contextDep||e.contextDep,h.propDep=h.propDep||e.propDep),h}return e?new oe(e.thisDep,e.contextDep,e.propDep,(function(t,e){var n=t.shared.context;return[0,0,e.def(n,".",qt),e.def(n,".",Zt)]})):null}var a=o("viewport");if(a){var s=a;a=new oe(a.thisDep,a.contextDep,a.propDep,(function(t,e){var n=s.append(t,e),r=t.shared.context;return e.set(r,".viewportWidth",n[2]),e.set(r,".viewportHeight",n[3]),n}))}return{viewport:a,scissor_box:o("scissor.box")}}(t,x,d),E=function(t,e){var n=t.static,r=t.dynamic,i=function(){if(Yt in n){var t=n[Yt];re(t)?t=s.getElements(s.create(t,!0)):t&&(t=s.getElements(t),_.command(t,"invalid elements",e.commandStr));var i=se((function(e,n){if(t){var r=e.link(t);return e.ELEMENTS=r,r}return e.ELEMENTS=null,null}));return i.value=t,i}if(Yt in r){var o=r[Yt];return ue(o,(function(t,e){var n=t.shared,r=n.isBufferArgs,i=n.elements,a=t.invoke(e,o),s=e.def("null"),u=e.def(r,"(",a,")"),c=t.cond(u).then(s,"=",i,".createStream(",a,");").else(s,"=",i,".getElements(",a,");");return _.optional((function(){t.assert(c.else,"!"+a+"||"+s,"invalid elements")})),e.entry(c),e.exit(t.cond(u).then(i,".destroyStream(",s,");")),t.ELEMENTS=s,s}))}return null}();function o(t,o){if(t in n){var a=0|n[t];return _.command(!o||a>=0,"invalid "+t,e.commandStr),se((function(t,e){return o&&(t.OFFSET=a),a}))}if(t in r){var s=r[t];return ue(s,(function(e,n){var r=e.invoke(n,s);return o&&(e.OFFSET=r,_.optional((function(){e.assert(n,r+">=0","invalid "+t)}))),r}))}return o&&i?se((function(t,e){return t.OFFSET="0",0})):null}var a=o(Wt,!0);return{elements:i,primitive:function(){if(Ut in n){var t=n[Ut];return _.commandParameter(t,K,"invalid primitve",e.commandStr),se((function(e,n){return K[t]}))}if(Ut in r){var o=r[Ut];return ue(o,(function(t,e){var n=t.constants.primTypes,r=t.invoke(e,o);return _.optional((function(){t.assert(e,r+" in "+n,"invalid primitive, must be one of "+Object.keys(K))})),e.def(n,"[",r,"]")}))}return i?ae(i)?i.value?se((function(t,e){return e.def(t.ELEMENTS,".primType")})):se((function(){return 4})):new oe(i.thisDep,i.contextDep,i.propDep,(function(t,e){var n=t.ELEMENTS;return e.def(n,"?",n,".primType:",4)})):null}(),count:function(){if(Xt in n){var t=0|n[Xt];return _.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),se((function(){return t}))}if(Xt in r){var o=r[Xt];return ue(o,(function(t,e){var n=t.invoke(e,o);return _.optional((function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")})),n}))}if(i){if(ae(i)){if(i)return a?new oe(a.thisDep,a.contextDep,a.propDep,(function(t,e){var n=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return _.optional((function(){t.assert(e,n+">=0","invalid vertex offset/element buffer too small")})),n})):se((function(t,e){return e.def(t.ELEMENTS,".vertCount")}));var s=se((function(){return-1}));return _.optional((function(){s.MISSING=!0})),s}var u=new oe(i.thisDep||a.thisDep,i.contextDep||a.contextDep,i.propDep||a.propDep,(function(t,e){var n=t.ELEMENTS;return t.OFFSET?e.def(n,"?",n,".vertCount-",t.OFFSET,":-1"):e.def(n,"?",n,".vertCount:-1")}));return _.optional((function(){u.DYNAMIC=!0})),u}return null}(),instances:o(Vt,!1),offset:a}}(t,d),M=function(t,e){var n=t.static,r=t.dynamic,o={};return S.forEach((function(t){var s=A(t);function u(e,i){if(t in n){var a=e(n[t]);o[s]=se((function(){return a}))}else if(t in r){var u=r[t];o[s]=ue(u,(function(t,e){return i(t,e,t.invoke(e,u))}))}}switch(t){case"cull.enable":case"blend.enable":case"dither":case"stencil.enable":case"depth.enable":case"scissor.enable":case"polygonOffset.enable":case"sample.alpha":case"sample.enable":case"depth.mask":return u((function(n){return _.commandType(n,"boolean",t,e.commandStr),n}),(function(e,n,r){return _.optional((function(){e.assert(n,"typeof "+r+'==="boolean"',"invalid flag "+t,e.commandStr)})),r}));case"depth.func":return u((function(n){return _.commandParameter(n,Jt,"invalid "+t,e.commandStr),Jt[n]}),(function(e,n,r){var i=e.constants.compareFuncs;return _.optional((function(){e.assert(n,r+" in "+i,"invalid "+t+", must be one of "+Object.keys(Jt))})),n.def(i,"[",r,"]")}));case"depth.range":return u((function(t){return _.command(tt(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t}),(function(t,e,n){return _.optional((function(){t.assert(e,t.shared.isArrayLike+"("+n+")&&"+n+".length===2&&typeof "+n+'[0]==="number"&&typeof '+n+'[1]==="number"&&'+n+"[0]<="+n+"[1]","depth range must be a 2d array")})),[e.def("+",n,"[0]"),e.def("+",n,"[1]")]}));case"blend.func":return u((function(t){_.commandType(t,"object","blend.func",e.commandStr);var n="srcRGB"in t?t.srcRGB:t.src,r="srcAlpha"in t?t.srcAlpha:t.src,i="dstRGB"in t?t.dstRGB:t.dst,o="dstAlpha"in t?t.dstAlpha:t.dst;return _.commandParameter(n,Qt,s+".srcRGB",e.commandStr),_.commandParameter(r,Qt,s+".srcAlpha",e.commandStr),_.commandParameter(i,Qt,s+".dstRGB",e.commandStr),_.commandParameter(o,Qt,s+".dstAlpha",e.commandStr),_.command(-1===$t.indexOf(n+", "+i),"unallowed blending combination (srcRGB, dstRGB) = ("+n+", "+i+")",e.commandStr),[Qt[n],Qt[i],Qt[r],Qt[o]]}),(function(e,n,r){var i=e.constants.blendFuncs;function o(o,a){var s=n.def('"',o,a,'" in ',r,"?",r,".",o,a,":",r,".",o);return _.optional((function(){e.assert(n,s+" in "+i,"invalid "+t+"."+o+a+", must be one of "+Object.keys(Qt))})),s}_.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid blend func, must be an object")}));var a=o("src","RGB"),s=o("dst","RGB");_.optional((function(){var t=e.constants.invalidBlendCombinations;e.assert(n,t+".indexOf("+a+'+", "+'+s+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")}));var u=n.def(i,"[",a,"]"),c=n.def(i,"[",o("src","Alpha"),"]");return[u,n.def(i,"[",s,"]"),c,n.def(i,"[",o("dst","Alpha"),"]")]}));case"blend.equation":return u((function(n){return"string"==typeof n?(_.commandParameter(n,m,"invalid "+t,e.commandStr),[m[n],m[n]]):"object"===a(n)?(_.commandParameter(n.rgb,m,t+".rgb",e.commandStr),_.commandParameter(n.alpha,m,t+".alpha",e.commandStr),[m[n.rgb],m[n.alpha]]):void _.commandRaise("invalid blend.equation",e.commandStr)}),(function(e,n,r){var i=e.constants.blendEquations,o=n.def(),a=n.def(),s=e.cond("typeof ",r,'==="string"');return _.optional((function(){function n(t,n,r){e.assert(t,r+" in "+i,"invalid "+n+", must be one of "+Object.keys(m))}n(s.then,t,r),e.assert(s.else,r+"&&typeof "+r+'==="object"',"invalid "+t),n(s.else,t+".rgb",r+".rgb"),n(s.else,t+".alpha",r+".alpha")})),s.then(o,"=",a,"=",i,"[",r,"];"),s.else(o,"=",i,"[",r,".rgb];",a,"=",i,"[",r,".alpha];"),n(s),[o,a]}));case"blend.color":return u((function(t){return _.command(tt(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),N(4,(function(e){return+t[e]}))}),(function(t,e,n){return _.optional((function(){t.assert(e,t.shared.isArrayLike+"("+n+")&&"+n+".length===4","blend.color must be a 4d array")})),N(4,(function(t){return e.def("+",n,"[",t,"]")}))}));case"stencil.mask":return u((function(t){return _.commandType(t,"number",s,e.commandStr),0|t}),(function(t,e,n){return _.optional((function(){t.assert(e,"typeof "+n+'==="number"',"invalid stencil.mask")})),e.def(n,"|0")}));case"stencil.func":return u((function(n){_.commandType(n,"object",s,e.commandStr);var r=n.cmp||"keep",i=n.ref||0,o="mask"in n?n.mask:-1;return _.commandParameter(r,Jt,t+".cmp",e.commandStr),_.commandType(i,"number",t+".ref",e.commandStr),_.commandType(o,"number",t+".mask",e.commandStr),[Jt[r],i,o]}),(function(t,e,n){var r=t.constants.compareFuncs;return _.optional((function(){function i(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}i(n+"&&typeof ",n,'==="object"'),i('!("cmp" in ',n,")||(",n,".cmp in ",r,")")})),[e.def('"cmp" in ',n,"?",r,"[",n,".cmp]",":",7680),e.def(n,".ref|0"),e.def('"mask" in ',n,"?",n,".mask|0:-1")]}));case"stencil.opFront":case"stencil.opBack":return u((function(n){_.commandType(n,"object",s,e.commandStr);var r=n.fail||"keep",i=n.zfail||"keep",o=n.zpass||"keep";return _.commandParameter(r,te,t+".fail",e.commandStr),_.commandParameter(i,te,t+".zfail",e.commandStr),_.commandParameter(o,te,t+".zpass",e.commandStr),["stencil.opBack"===t?1029:1028,te[r],te[i],te[o]]}),(function(e,n,r){var i=e.constants.stencilOps;function o(o){return _.optional((function(){e.assert(n,'!("'+o+'" in '+r+")||("+r+"."+o+" in "+i+")","invalid "+t+"."+o+", must be one of "+Object.keys(te))})),n.def('"',o,'" in ',r,"?",i,"[",r,".",o,"]:",7680)}return _.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid "+t)})),["stencil.opBack"===t?1029:1028,o("fail"),o("zfail"),o("zpass")]}));case"polygonOffset.offset":return u((function(t){_.commandType(t,"object",s,e.commandStr);var n=0|t.factor,r=0|t.units;return _.commandType(n,"number",s+".factor",e.commandStr),_.commandType(r,"number",s+".units",e.commandStr),[n,r]}),(function(e,n,r){return _.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid "+t)})),[n.def(r,".factor|0"),n.def(r,".units|0")]}));case"cull.face":return u((function(t){var n=0;return"front"===t?n=1028:"back"===t&&(n=1029),_.command(!!n,s,e.commandStr),n}),(function(t,e,n){return _.optional((function(){t.assert(e,n+'==="front"||'+n+'==="back"',"invalid cull.face")})),e.def(n,'==="front"?',1028,":",1029)}));case"lineWidth":return u((function(t){return _.command("number"==typeof t&&t>=i.lineWidthDims[0]&&t<=i.lineWidthDims[1],"invalid line width, must be a positive number between "+i.lineWidthDims[0]+" and "+i.lineWidthDims[1],e.commandStr),t}),(function(t,e,n){return _.optional((function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">="+i.lineWidthDims[0]+"&&"+n+"<="+i.lineWidthDims[1],"invalid line width")})),n}));case"frontFace":return u((function(t){return _.commandParameter(t,ne,s,e.commandStr),ne[t]}),(function(t,e,n){return _.optional((function(){t.assert(e,n+'==="cw"||'+n+'==="ccw"',"invalid frontFace, must be one of cw,ccw")})),e.def(n+'==="cw"?2304:2305')}));case"colorMask":return u((function(t){return _.command(tt(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map((function(t){return!!t}))}),(function(t,e,n){return _.optional((function(){t.assert(e,t.shared.isArrayLike+"("+n+")&&"+n+".length===4","invalid color.mask")})),N(4,(function(t){return"!!"+n+"["+t+"]"}))}));case"sample.coverage":return u((function(t){_.command("object"===a(t)&&t,s,e.commandStr);var n="value"in t?t.value:1,r=!!t.invert;return _.command("number"==typeof n&&n>=0&&n<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[n,r]}),(function(t,e,n){return _.optional((function(){t.assert(e,n+"&&typeof "+n+'==="object"',"invalid sample.coverage")})),[e.def('"value" in ',n,"?+",n,".value:1"),e.def("!!",n,".invert")]}))}})),o}(t,d),O=function(t,e,r){var i=t.static,o=t.dynamic;function a(t){if(t in i){var e=n.id(i[t]);_.optional((function(){h.shader(ee[t],e,_.guessCommand())}));var r=se((function(){return e}));return r.id=e,r}if(t in o){var a=o[t];return ue(a,(function(e,n){var r=e.invoke(n,a),i=n.def(e.shared.strings,".id(",r,")");return _.optional((function(){n(e.shared.shader,".shader(",ee[t],",",i,",",e.command,");")})),i}))}return null}var s,u=a(Gt),c=a(zt),l=null;return ae(u)&&ae(c)?(l=h.program(c.id,u.id,null,r),s=se((function(t,e){return t.link(l)}))):s=new oe(u&&u.thisDep||c&&c.thisDep,u&&u.contextDep||c&&c.contextDep,u&&u.propDep||c&&c.propDep,(function(t,e){var n,r=t.shared.shader;n=u?u.append(t,e):e.def(r,".",Gt);var i=r+".program("+(c?c.append(t,e):e.def(r,".",zt))+","+n;return _.optional((function(){i+=","+t.command})),e.def(i+")")})),{frag:u,vert:c,progVar:s,program:l}}(t,0,v);function k(t){var e=w[t];e&&(M[t]=e)}k("viewport"),k(A("scissor.box"));var C=Object.keys(M).length>0,j={framebuffer:x,draw:E,shader:O,state:M,dirty:C,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(j.profile=function(t){var e,n=t.static,r=t.dynamic;if(Bt in n){var i=!!n[Bt];(e=se((function(t,e){return i}))).enable=i}else if(Bt in r){var o=r[Bt];e=ue(o,(function(t,e){return t.invoke(e,o)}))}return e}(t),j.uniforms=function(t,e){var n=t.static,r=t.dynamic,i={};return Object.keys(n).forEach((function(t){var r,o=n[t];if("number"==typeof o||"boolean"==typeof o)r=se((function(){return o}));else if("function"==typeof o){var a=o._reglType;"texture2d"===a||"textureCube"===a?r=se((function(t){return t.link(o)})):"framebuffer"===a||"framebufferCube"===a?(_.command(o.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),r=se((function(t){return t.link(o.color[0])}))):_.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else tt(o)?r=se((function(e){return e.global.def("[",N(o.length,(function(n){return _.command("number"==typeof o[n]||"boolean"==typeof o[n],"invalid uniform "+t,e.commandStr),o[n]})),"]")})):_.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);r.value=o,i[t]=r})),Object.keys(r).forEach((function(t){var e=r[t];i[t]=ue(e,(function(t,n){return t.invoke(n,e)}))})),i}(u,d),j.drawVAO=j.scopeVAO=function(t,e){var n=t.static,r=t.dynamic;if(Ht in n){var i=n[Ht];return null!==i&&null===f.getVAO(i)&&(i=f.createVAO(i)),se((function(t){return t.link(f.getVAO(i))}))}if(Ht in r){var o=r[Ht];return ue(o,(function(t,e){var n=t.invoke(e,o);return e.def(t.shared.vao+".getVAO("+n+")")}))}return null}(t),!j.drawVAO&&O.program&&!v&&r.angle_instanced_arrays){var I=!0,T=O.program.attributes.map((function(t){var n=e.static[t];return I=I&&!!n,n}));if(I&&T.length>0){var P=f.getVAO(f.createVAO(T));j.drawVAO=new oe(null,null,null,(function(t,e){return t.link(P)})),j.useVAO=!0}}return v?j.useVAO=!0:j.attributes=function(t,e){var r=t.static,i=t.dynamic,s={};return Object.keys(r).forEach((function(t){var i=r[t],u=n.id(t),c=new y;if(re(i))c.state=1,c.buffer=o.getBuffer(o.create(i,34962,!1,!0)),c.type=0;else{var l=o.getBuffer(i);if(l)c.state=1,c.buffer=l,c.type=0;else if(_.command("object"===a(i)&&i,"invalid data for attribute "+t,e.commandStr),"constant"in i){var f=i.constant;c.buffer="null",c.state=2,"number"==typeof f?c.x=f:(_.command(tt(f)&&f.length>0&&f.length<=4,"invalid constant for attribute "+t,e.commandStr),Rt.forEach((function(t,e){e=0,'invalid offset for attribute "'+t+'"',e.commandStr);var d=0|i.stride;_.command(d>=0&&d<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',e.commandStr);var p=0|i.size;_.command(!("size"in i)||p>0&&p<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',e.commandStr);var g=!!i.normalized,v=0;"type"in i&&(_.commandParameter(i.type,Y,"invalid type for attribute "+t,e.commandStr),v=Y[i.type]);var m=0|i.divisor;"divisor"in i&&(_.command(0===m||b,'cannot specify divisor for attribute "'+t+'", instancing not supported',e.commandStr),_.command(m>=0,'invalid divisor for attribute "'+t+'"',e.commandStr)),_.optional((function(){var n=e.commandStr,r=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(i).forEach((function(e){_.command(r.indexOf(e)>=0,'unknown parameter "'+e+'" for attribute pointer "'+t+'" (valid parameters are '+r+")",n)}))})),c.buffer=l,c.state=1,c.size=p,c.normalized=g,c.type=v||l.dtype,c.offset=h,c.stride=d,c.divisor=m}}s[t]=se((function(t,e){var n=t.attribCache;if(u in n)return n[u];var r={isStream:!1};return Object.keys(c).forEach((function(t){r[t]=c[t]})),c.buffer&&(r.buffer=t.link(c.buffer),r.type=r.type||r.buffer+".dtype"),n[u]=r,r}))})),Object.keys(i).forEach((function(t){var e=i[t];s[t]=ue(e,(function(n,r){var i=n.invoke(r,e),o=n.shared,a=n.constants,s=o.isBufferArgs,u=o.buffer;_.optional((function(){n.assert(r,i+"&&(typeof "+i+'==="object"||typeof '+i+'==="function")&&('+s+"("+i+")||"+u+".getBuffer("+i+")||"+u+".getBuffer("+i+".buffer)||"+s+"("+i+'.buffer)||("constant" in '+i+"&&(typeof "+i+'.constant==="number"||'+o.isArrayLike+"("+i+".constant))))",'invalid dynamic attribute "'+t+'"')}));var c={isStream:r.def(!1)},l=new y;l.state=1,Object.keys(l).forEach((function(t){c[t]=r.def(""+l[t])}));var f=c.buffer,h=c.type;function d(t){r(c[t],"=",i,".",t,"|0;")}return r("if(",s,"(",i,")){",c.isStream,"=true;",f,"=",u,".createStream(",34962,",",i,");",h,"=",f,".dtype;","}else{",f,"=",u,".getBuffer(",i,");","if(",f,"){",h,"=",f,".dtype;",'}else if("constant" in ',i,"){",c.state,"=",2,";","if(typeof "+i+'.constant === "number"){',c[Rt[0]],"=",i,".constant;",Rt.slice(1).map((function(t){return c[t]})).join("="),"=0;","}else{",Rt.map((function(t,e){return c[t]+"="+i+".constant.length>"+e+"?"+i+".constant["+e+"]:0;"})).join(""),"}}else{","if(",s,"(",i,".buffer)){",f,"=",u,".createStream(",34962,",",i,".buffer);","}else{",f,"=",u,".getBuffer(",i,".buffer);","}",h,'="type" in ',i,"?",a.glTypes,"[",i,".type]:",f,".dtype;",c.normalized,"=!!",i,".normalized;"),d("size"),d("offset"),d("stride"),d("divisor"),r("}}"),r.exit("if(",c.isStream,"){",u,".destroyStream(",f,");","}"),c}))})),s}(e,d),j.context=function(t){var e=t.static,n=t.dynamic,r={};return Object.keys(e).forEach((function(t){var n=e[t];r[t]=se((function(t,e){return"number"==typeof n||"boolean"==typeof n?""+n:t.link(n)}))})),Object.keys(n).forEach((function(t){var e=n[t];r[t]=ue(e,(function(t,n){return t.invoke(n,e)}))})),r}(l),j}function R(t,e,n){var r=t.shared.context,i=t.scope();Object.keys(n).forEach((function(o){e.save(r,"."+o);var a=n[o].append(t,e);Array.isArray(a)?i(r,".",o,"=[",a.join(),"];"):i(r,".",o,"=",a,";")})),e(i)}function B(t,e,n,r){var i,o=t.shared,a=o.gl,s=o.framebuffer;x&&(i=e.def(o.extensions,".webgl_draw_buffers"));var u,c=t.constants,l=c.drawBuffer,f=c.backBuffer;u=n?n.append(t,e):e.def(s,".next"),r||e("if(",u,"!==",s,".cur){"),e("if(",u,"){",a,".bindFramebuffer(",36160,",",u,".framebuffer);"),x&&e(i,".drawBuffersWEBGL(",l,"[",u,".colorAttachments.length]);"),e("}else{",a,".bindFramebuffer(",36160,",null);"),x&&e(i,".drawBuffersWEBGL(",f,");"),e("}",s,".cur=",u,";"),r||e("}")}function F(t,e,n){var r=t.shared,i=r.gl,o=t.current,a=t.next,s=r.current,u=r.next,c=t.cond(s,".dirty");S.forEach((function(e){var r,l,f=A(e);if(!(f in n.state))if(f in a){r=a[f],l=o[f];var h=N(w[f].length,(function(t){return c.def(r,"[",t,"]")}));c(t.cond(h.map((function(t,e){return t+"!=="+l+"["+e+"]"})).join("||")).then(i,".",O[f],"(",h,");",h.map((function(t,e){return l+"["+e+"]="+t})).join(";"),";"))}else{r=c.def(u,".",f);var d=t.cond(r,"!==",s,".",f);c(d),f in M?d(t.cond(r).then(i,".enable(",M[f],");").else(i,".disable(",M[f],");"),s,".",f,"=",r,";"):d(i,".",O[f],"(",r,");",s,".",f,"=",r,";")}})),0===Object.keys(n.state).length&&c(s,".dirty=false;"),e(c)}function z(t,e,n,r){var i=t.shared,o=t.current,a=i.current,s=i.gl;ie(Object.keys(n)).forEach((function(i){var u=n[i];if(!r||r(u)){var c=u.append(t,e);if(M[i]){var l=M[i];ae(u)?e(s,c?".enable(":".disable(",l,");"):e(t.cond(c).then(s,".enable(",l,");").else(s,".disable(",l,");")),e(a,".",i,"=",c,";")}else if(tt(c)){var f=o[i];e(s,".",O[i],"(",c,");",c.map((function(t,e){return f+"["+e+"]="+t})).join(";"),";")}else e(s,".",O[i],"(",c,");",a,".",i,"=",c,";")}}))}function G(t,e){b&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function U(t,e,n,r,i){var o,a,s,u=t.shared,c=t.stats,l=u.current,f=u.timer,h=n.profile;function d(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function p(t){t(o=e.def(),"=",d(),";"),"string"==typeof i?t(c,".count+=",i,";"):t(c,".count++;"),g&&(r?t(a=e.def(),"=",f,".getNumPendingQueries();"):t(f,".beginQuery(",c,");"))}function v(t){t(c,".cpuTime+=",d(),"-",o,";"),g&&(r?t(f,".pushScopeStats(",a,",",f,".getNumPendingQueries(),",c,");"):t(f,".endQuery();"))}function y(t){var n=e.def(l,".profile");e(l,".profile=",t,";"),e.exit(l,".profile=",n,";")}if(h){if(ae(h))return void(h.enable?(p(e),v(e.exit),y("true")):y("false"));y(s=h.append(t,e))}else s=e.def(l,".profile");var m=t.block();p(m),e("if(",s,"){",m,"}");var b=t.block();v(b),e.exit("if(",s,"){",b,"}")}function X(t,e,n,r,i){var o=t.shared;r.forEach((function(r){var a,s=r.name,u=n.attributes[s];if(u){if(!i(u))return;a=u.append(t,e)}else{if(!i(ce))return;var c=t.scopeAttrib(s);_.optional((function(){t.assert(e,c+".state","missing attribute "+s)})),a={},Object.keys(new y).forEach((function(t){a[t]=e.def(c,".",t)}))}!function(n,r,i){var a=o.gl,s=e.def(n,".location"),u=e.def(o.attributes,"[",s,"]"),c=i.state,l=i.buffer,f=[i.x,i.y,i.z,i.w],h=["buffer","normalized","offset","stride"];function d(){e("if(!",u,".buffer){",a,".enableVertexAttribArray(",s,");}");var n,o=i.type;if(n=i.size?e.def(i.size,"||",r):r,e("if(",u,".type!==",o,"||",u,".size!==",n,"||",h.map((function(t){return u+"."+t+"!=="+i[t]})).join("||"),"){",a,".bindBuffer(",34962,",",l,".buffer);",a,".vertexAttribPointer(",[s,n,o,i.normalized,i.stride,i.offset],");",u,".type=",o,";",u,".size=",n,";",h.map((function(t){return u+"."+t+"="+i[t]+";"})).join(""),"}"),b){var c=i.divisor;e("if(",u,".divisor!==",c,"){",t.instancing,".vertexAttribDivisorANGLE(",[s,c],");",u,".divisor=",c,";}")}}function p(){e("if(",u,".buffer){",a,".disableVertexAttribArray(",s,");",u,".buffer=null;","}if(",Rt.map((function(t,e){return u+"."+t+"!=="+f[e]})).join("||"),"){",a,".vertexAttrib4f(",s,",",f,");",Rt.map((function(t,e){return u+"."+t+"="+f[e]+";"})).join(""),"}")}1===c?d():2===c?p():(e("if(",c,"===",1,"){"),d(),e("}else{"),p(),e("}"))}(t.link(r),function(t){switch(t){case 35664:case 35667:case 35671:return 2;case 35665:case 35668:case 35672:return 3;case 35666:case 35669:case 35673:return 4;default:return 1}}(r.info.type),a)}))}function W(t,e,r,i,o){for(var a,s=t.shared,u=s.gl,c=0;c1?e(N(x,(function(t){return Array.isArray(l)?l[t]:l+"["+t+"]"}))):(_(!Array.isArray(l),"uniform value must not be an array"),e(l));e(");")}}function V(t,e,n,r){var i=t.shared,o=i.gl,a=i.draw,s=r.draw,u=function(){var i,u=s.elements,c=e;return u?((u.contextDep&&r.contextDynamic||u.propDep)&&(c=n),i=u.append(t,c)):i=c.def(a,".",Yt),i&&c("if("+i+")"+o+".bindBuffer(34963,"+i+".buffer.buffer);"),i}();function c(i){var o=s[i];return o?o.contextDep&&r.contextDynamic||o.propDep?o.append(t,n):o.append(t,e):e.def(a,".",i)}var l,f,h=c(Ut),d=c(Wt),p=function(){var i,o=s.count,u=e;return o?((o.contextDep&&r.contextDynamic||o.propDep)&&(u=n),i=o.append(t,u),_.optional((function(){o.MISSING&&t.assert(e,"false","missing vertex count"),o.DYNAMIC&&t.assert(u,i+">=0","missing vertex count")}))):(i=u.def(a,".",Xt),_.optional((function(){t.assert(u,i+">=0","missing vertex count")}))),i}();if("number"==typeof p){if(0===p)return}else n("if(",p,"){"),n.exit("}");b&&(l=c(Vt),f=t.instancing);var g=u+".type",v=s.elements&&ae(s.elements);function y(){function t(){n(f,".drawElementsInstancedANGLE(",[h,p,g,d+"<<(("+g+"-5121)>>1)",l],");")}function e(){n(f,".drawArraysInstancedANGLE(",[h,d,p,l],");")}u?v?t():(n("if(",u,"){"),t(),n("}else{"),e(),n("}")):e()}function m(){function t(){n(o+".drawElements("+[h,p,g,d+"<<(("+g+"-5121)>>1)"]+");")}function e(){n(o+".drawArrays("+[h,d,p]+");")}u?v?t():(n("if(",u,"){"),t(),n("}else{"),e(),n("}")):e()}b&&("number"!=typeof l||l>=0)?"string"==typeof l?(n("if(",l,">0){"),y(),n("}else if(",l,"<0){"),m(),n("}")):y():m()}function H(t,e,n,r,i){var o=D(),a=o.proc("body",i);return _.optional((function(){o.commandStr=e.commandStr,o.command=o.link(e.commandStr)})),b&&(o.instancing=a.def(o.shared.extensions,".angle_instanced_arrays")),t(o,a,n,r),o.compile().body}function q(t,e,n,r){G(t,e),n.useVAO?n.drawVAO?e(t.shared.vao,".setVAO(",n.drawVAO.append(t,e),");"):e(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(e(t.shared.vao,".setVAO(null);"),X(t,e,n,r.attributes,(function(){return!0}))),W(t,e,n,r.uniforms,(function(){return!0})),V(t,e,e,n)}function Z(t,e,n,r){function i(){return!0}t.batchId="a1",G(t,e),X(t,e,n,r.attributes,i),W(t,e,n,r.uniforms,i),V(t,e,e,n)}function Q(t,e,n,r){G(t,e);var i=n.contextDep,o=e.def(),a=e.def();t.shared.props=a,t.batchId=o;var s=t.scope(),u=t.scope();function c(t){return t.contextDep&&i||t.propDep}function l(t){return!c(t)}if(e(s.entry,"for(",o,"=0;",o,"<","a1",";++",o,"){",a,"=","a0","[",o,"];",u,"}",s.exit),n.needsContext&&R(t,u,n.context),n.needsFramebuffer&&B(t,u,n.framebuffer),z(t,u,n.state,c),n.profile&&c(n.profile)&&U(t,u,n,!1,!0),r)n.useVAO?n.drawVAO?c(n.drawVAO)?u(t.shared.vao,".setVAO(",n.drawVAO.append(t,u),");"):s(t.shared.vao,".setVAO(",n.drawVAO.append(t,s),");"):s(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(s(t.shared.vao,".setVAO(null);"),X(t,s,n,r.attributes,l),X(t,u,n,r.attributes,c)),W(t,s,n,r.uniforms,l),W(t,u,n,r.uniforms,c),V(t,s,u,n);else{var f=t.global.def("{}"),h=n.shader.progVar.append(t,u),d=u.def(h,".id"),p=u.def(f,"[",d,"]");u(t.shared.gl,".useProgram(",h,".program);","if(!",p,"){",p,"=",f,"[",d,"]=",t.link((function(e){return H(Z,t,n,e,2)})),"(",h,");}",p,".call(this,a0[",o,"],",o,");")}}function $(t,e,n){var r=e.static[n];if(r&&function(t){if("object"===a(t)&&!tt(t)){for(var e=Object.keys(t),n=0;n0&&n(t.shared.current,".dirty=true;")}(s,u),function(t,e){var r=t.proc("scope",3);t.batchId="a2";var i=t.shared,o=i.current;function a(n){var o=e.shader[n];o&&r.set(i.shader,"."+n,o.append(t,r))}R(t,r,e.context),e.framebuffer&&e.framebuffer.append(t,r),ie(Object.keys(e.state)).forEach((function(n){var o=e.state[n].append(t,r);tt(o)?o.forEach((function(e,i){r.set(t.next[n],"["+i+"]",e)})):r.set(i.next,"."+n,o)})),U(t,r,e,!0,!0),[Yt,Wt,Xt,Vt,Ut].forEach((function(n){var o=e.draw[n];o&&r.set(i.draw,"."+n,""+o.append(t,r))})),Object.keys(e.uniforms).forEach((function(o){var a=e.uniforms[o].append(t,r);Array.isArray(a)&&(a="["+a.join()+"]"),r.set(i.uniforms,"["+n.id(o)+"]",a)})),Object.keys(e.attributes).forEach((function(n){var i=e.attributes[n].append(t,r),o=t.scopeAttrib(n);Object.keys(new y).forEach((function(t){r.set(o,"."+t,i[t])}))})),e.scopeVAO&&r.set(i.vao,".targetVAO",e.scopeVAO.append(t,r)),a(zt),a(Gt),Object.keys(e.state).length>0&&(r(o,".dirty=true;"),r.exit(o,".dirty=true;")),r("a1(",t.shared.context,",a0,",t.batchId,");")}(s,u),function(t,e){var n=t.proc("batch",2);t.batchId="0",G(t,n);var r=!1,i=!0;Object.keys(e.context).forEach((function(t){r=r||e.context[t].propDep})),r||(R(t,n,e.context),i=!1);var o=e.framebuffer,a=!1;function s(t){return t.contextDep&&r||t.propDep}o?(o.propDep?r=a=!0:o.contextDep&&r&&(a=!0),a||B(t,n,o)):B(t,n,null),e.state.viewport&&e.state.viewport.propDep&&(r=!0),F(t,n,e),z(t,n,e.state,(function(t){return!s(t)})),e.profile&&s(e.profile)||U(t,n,e,!1,"a1"),e.contextDep=r,e.needsContext=i,e.needsFramebuffer=a;var u=e.shader.progVar;if(u.contextDep&&r||u.propDep)Q(t,n,e,null);else{var c=u.append(t,n);if(n(t.shared.gl,".useProgram(",c,".program);"),e.shader.program)Q(t,n,e,e.shader.program);else{n(t.shared.vao,".setVAO(null);");var l=t.global.def("{}"),f=n.def(c,".id"),h=n.def(l,"[",f,"]");n(t.cond(h).then(h,".call(this,a0,a1);").else(h,"=",l,"[",f,"]=",t.link((function(n){return H(Q,t,e,n,2)})),"(",c,");",h,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}(s,u),e(s.compile(),{destroy:function(){u.shader.program.destroy()}})}}}var fe=function(t,e){if(!e.ext_disjoint_timer_query)return null;var n=[];function r(t){n.push(t)}var i=[];function o(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var a=[];function s(t){a.push(t)}var u=[];function c(t,e,n){var r=a.pop()||new o;r.startQueryIndex=t,r.endQueryIndex=e,r.sum=0,r.stats=n,u.push(r)}var l=[],f=[];return{beginQuery:function(t){var r=n.pop()||e.ext_disjoint_timer_query.createQueryEXT();e.ext_disjoint_timer_query.beginQueryEXT(35007,r),i.push(r),c(i.length-1,i.length,t)},endQuery:function(){e.ext_disjoint_timer_query.endQueryEXT(35007)},pushScopeStats:c,update:function(){var t,n,o=i.length;if(0!==o){f.length=Math.max(f.length,o+1),l.length=Math.max(l.length,o+1),l[0]=0,f[0]=0;var a=0;for(t=0,n=0;n0)if(Array.isArray(n[0])){s=W(n);for(var l=1,f=1;f0)if("number"==typeof e[0]){var o=L.allocType(h.dtype,e.length);q(o,e),p(o,i),L.freeType(o)}else if(Array.isArray(e[0])||t(e[0])){r=W(e);var a=X(e,r,h.dtype);p(a,i),L.freeType(a)}else _.raise("invalid buffer data")}else if(R(e)){r=e.shape;var s=e.stride,u=0,c=0,l=0,f=0;1===r.length?(u=r[0],c=1,l=s[0],f=0):2===r.length?(u=r[0],c=r[1],l=s[0],f=s[1]):_.raise("invalid shape");var g=Array.isArray(e.data)?h.dtype:H(e.data),v=L.allocType(g,u*c);Z(v,e.data,u,c,l,f,e.offset),p(v,i),L.freeType(v)}else _.raise("invalid data for buffer subdata");return d},r.profile&&(d.stats=h.stats),d.destroy=function(){f(h)},d},createStream:function(t,e){var n=u.pop();return n||(n=new s(t)),n.bind(),l(n,e,35040,0,1,!1),n},destroyStream:function(t){u.push(t)},clear:function(){B(a).forEach(f),u.forEach(f)},getBuffer:function(t){return t&&t._buffer instanceof s?t._buffer:null},restore:function(){B(a).forEach((function(t){t.buffer=e.createBuffer(),e.bindBuffer(t.type,t.buffer),e.bufferData(t.type,t.persistentData||t.byteLength,t.usage)}))},_initBuffer:l}}(i,h,r,(function(t){return w.destroyBuffer(t)})),w=function(e,n,r,i,o){for(var a=r.maxAttributes,s=new Array(a),u=0;u0,"must specify at least one attribute");var i={},u=r.attributes;u.length=e.length;for(var c=0;c=d.byteLength?l.subdata(d):(l.destroy(),r.buffers[c]=null)),r.buffers[c]||(l=r.buffers[c]=o.create(f,34962,!1,!0)),h.buffer=o.getBuffer(l),h.size=0|h.buffer.dimension,h.normalized=!1,h.type=h.buffer.dtype,h.offset=0,h.stride=0,h.divisor=0,h.state=1,i[c]=1):o.getBuffer(f)?(h.buffer=o.getBuffer(f),h.size=0|h.buffer.dimension,h.normalized=!1,h.type=h.buffer.dtype,h.offset=0,h.stride=0,h.divisor=0,h.state=1):o.getBuffer(f.buffer)?(h.buffer=o.getBuffer(f.buffer),h.size=0|(+f.size||h.buffer.dimension),h.normalized=!!f.normalized||!1,"type"in f?(_.parameter(f.type,Y,"invalid buffer type"),h.type=Y[f.type]):h.type=h.buffer.dtype,h.offset=0|(f.offset||0),h.stride=0|(f.stride||0),h.divisor=0|(f.divisor||0),h.state=1,_(h.size>=1&&h.size<=4,"size must be between 1 and 4"),_(h.offset>=0,"invalid offset"),_(h.stride>=0&&h.stride<=255,"stride must be between 0 and 255"),_(h.divisor>=0,"divisor must be positive"),_(!h.divisor||!!n.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in f?(_(c>0,"first attribute must not be a constant"),h.x=+f.x||0,h.y=+f.y||0,h.z=+f.z||0,h.w=+f.w||0,h.state=2):_(!1,"invalid attribute spec for location "+c)}for(var p=0;p>=1:5125===f&&(d>>=2)),i.vertCount=d;var p=s;if(s<0){p=4;var g=i.buffer.dimension;1===g&&(p=0),2===g&&(p=1),3===g&&(p=4)}i.primType=p}function f(t){i.elementsCount--,_(null!==t.buffer,"must not double destroy elements"),delete o[t.id],t.buffer.destroy(),t.buffer=null}return{create:function(e,n){var o=r.create(null,34963,!0),a=new u(o._buffer);function c(e){if(e)if("number"==typeof e)o(e),a.primType=4,a.vertCount=0|e,a.type=5121;else{var n=null,r=35044,i=-1,u=-1,f=0,h=0;Array.isArray(e)||t(e)||R(e)?n=e:(_.type(e,"object","invalid arguments for elements"),"data"in e&&(n=e.data,_(Array.isArray(n)||t(n)||R(n),"invalid data for element buffer")),"usage"in e&&(_.parameter(e.usage,U,"invalid element buffer usage"),r=U[e.usage]),"primitive"in e&&(_.parameter(e.primitive,K,"invalid element buffer primitive"),i=K[e.primitive]),"count"in e&&(_("number"==typeof e.count&&e.count>=0,"invalid vertex count for elements"),u=0|e.count),"type"in e&&(_.parameter(e.type,s,"invalid buffer type"),h=s[e.type]),"length"in e?f=0|e.length:(f=u,5123===h||5122===h?f*=2:5125!==h&&5124!==h||(f*=4))),l(a,n,r,i,u,f,h)}else o(),a.primType=4,a.vertCount=0,a.type=5121;return c}return i.elementsCount++,c(e),c._reglType="elements",c._elements=a,c.subdata=function(t,e){return o.subdata(t,e),c},c.destroy=function(){f(a)},c},createStream:function(t){var e=c.pop();return e||(e=new u(r.create(null,34963,!0,!1)._buffer)),l(e,t,35040,-1,-1,0,0),e},destroyStream:function(t){c.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof u?t._elements:null},clear:function(){B(o).forEach(f)}}}(i,d,x,h),S=function(t,n,r,i){var o={},a={};function s(t,e,n,r){this.name=t,this.id=e,this.location=n,this.info=r}function u(t,e){for(var n=0;n1)for(var y=0;yt&&(t=e.stats.uniformsCount)})),t},r.getMaxAttributesCount=function(){var t=0;return f.forEach((function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)})),t}),{clear:function(){var e=t.deleteShader.bind(t);B(o).forEach(e),o={},B(a).forEach(e),a={},f.forEach((function(e){t.deleteProgram(e.program)})),f.length=0,l={},r.shaderCount=0},program:function(n,i,s,u){_.command(n>=0,"missing vertex shader",s),_.command(i>=0,"missing fragment shader",s);var c=l[i];c||(c=l[i]={});var h=c[n];if(h&&(h.refCount++,!u))return h;var g=new d(i,n);return r.shaderCount++,p(g,s,u),h||(c[n]=g),f.push(g),e(g,{destroy:function(){if(g.refCount--,g.refCount<=0){t.deleteProgram(g.program);var e=f.indexOf(g);f.splice(e,1),r.shaderCount--}c[g.vertId].refCount<=0&&(t.deleteShader(a[g.vertId]),delete a[g.vertId],delete l[g.fragId][g.vertId]),Object.keys(l[g.fragId]).length||(t.deleteShader(o[g.fragId]),delete o[g.fragId],delete l[g.fragId])}})},restore:function(){o={},a={};for(var t=0;t=2,"invalid renderbuffer shape"),u=0|p[0],c=0|p[1]}else"radius"in d&&(u=c=0|d.radius),"width"in d&&(u=0|d.width),"height"in d&&(c=0|d.height);"format"in d&&(_.parameter(d.format,o,"invalid renderbuffer format"),l=o[d.format])}else"number"==typeof e?(u=0|e,c="number"==typeof r?0|r:u):e?_.raise("invalid arguments to renderbuffer constructor"):u=c=1;if(_(u>0&&c>0&&u<=n.maxRenderbufferSize&&c<=n.maxRenderbufferSize,"invalid renderbuffer size"),u!==f.width||c!==f.height||l!==f.format)return h.width=f.width=u,h.height=f.height=c,f.format=l,t.bindRenderbuffer(36161,f.renderbuffer),t.renderbufferStorage(36161,l,u,c),_(0===t.getError(),"invalid render buffer format"),i.profile&&(f.stats.size=kt(f.format,f.width,f.height)),h.format=s[f.format],h}return c[f.id]=f,r.renderbufferCount++,h(e,u),h.resize=function(e,r){var o=0|e,a=0|r||o;return o===f.width&&a===f.height||(_(o>0&&a>0&&o<=n.maxRenderbufferSize&&a<=n.maxRenderbufferSize,"invalid renderbuffer size"),h.width=f.width=o,h.height=f.height=a,t.bindRenderbuffer(36161,f.renderbuffer),t.renderbufferStorage(36161,f.format,o,a),_(0===t.getError(),"invalid render buffer format"),i.profile&&(f.stats.size=kt(f.format,f.width,f.height))),h},h._reglType="renderbuffer",h._renderbuffer=f,i.profile&&(h.stats=f.stats),h.destroy=function(){f.decRef()},h},clear:function(){B(c).forEach(f)},restore:function(){B(c).forEach((function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,e.renderbuffer),t.renderbufferStorage(36161,e.format,e.width,e.height)})),t.bindRenderbuffer(36161,null)}}}(i,d,b,h,r),j=function(t,n,r,i,o,s){var u={cur:null,next:null,dirty:!1,setFBO:null},c=["rgba"],l=["rgba4","rgb565","rgb5 a1"];n.ext_srgb&&l.push("srgba"),n.ext_color_buffer_half_float&&l.push("rgba16f","rgb16f"),n.webgl_color_buffer_float&&l.push("rgba32f");var f=["uint8"];function h(t,e,n){this.target=t,this.texture=e,this.renderbuffer=n;var r=0,i=0;e?(r=e.width,i=e.height):n&&(r=n.width,i=n.height),this.width=r,this.height=i}function d(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function p(t,e,n){if(t)if(t.texture){var r=t.texture._texture,i=Math.max(1,r.width),o=Math.max(1,r.height);_(i===e&&o===n,"inconsistent width/height for supplied texture"),r.refCount+=1}else{var a=t.renderbuffer._renderbuffer;_(a.width===e&&a.height===n,"inconsistent width/height for renderbuffer"),a.refCount+=1}}function g(e,n){n&&(n.texture?t.framebufferTexture2D(36160,e,n.target,n.texture._texture.texture,0):t.framebufferRenderbuffer(36160,e,36161,n.renderbuffer._renderbuffer.renderbuffer))}function v(t){var e=3553,n=null,r=null,i=t;"object"===a(t)&&(i=t.data,"target"in t&&(e=0|t.target)),_.type(i,"function","invalid attachment data");var o=i._reglType;return"texture2d"===o?(n=i,_(3553===e)):"textureCube"===o?(n=i,_(e>=34069&&e<34075,"invalid cube map target")):"renderbuffer"===o?(r=i,e=36161):_.raise("invalid regl object for attachment"),new h(e,n,r)}function y(t,e,n,r,a){if(n){var s=i.create2D({width:t,height:e,format:r,type:a});return s._texture.refCount=0,new h(3553,s,null)}var u=o.create({width:t,height:e,format:r});return u._renderbuffer.refCount=0,new h(36161,null,u)}function m(t){return t&&(t.texture||t.renderbuffer)}function b(t,e,n){t&&(t.texture?t.texture.resize(e,n):t.renderbuffer&&t.renderbuffer.resize(e,n),t.width=e,t.height=n)}n.oes_texture_half_float&&f.push("half float","float16"),n.oes_texture_float&&f.push("float","float32");var x=0,w={};function E(){this.id=x++,w[this.id]=this,this.framebuffer=t.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function S(t){t.colorAttachments.forEach(d),d(t.depthAttachment),d(t.stencilAttachment),d(t.depthStencilAttachment)}function M(e){var n=e.framebuffer;_(n,"must not double destroy framebuffer"),t.deleteFramebuffer(n),e.framebuffer=null,s.framebufferCount--,delete w[e.id]}function O(e){var n;t.bindFramebuffer(36160,e.framebuffer);var i=e.colorAttachments;for(n=0;n=2,"invalid shape for framebuffer"),s=T[0],h=T[1]}else"radius"in I&&(s=h=I.radius),"width"in I&&(s=I.width),"height"in I&&(h=I.height);("color"in I||"colors"in I)&&(b=I.color||I.colors,Array.isArray(b)&&_(1===b.length||n.webgl_draw_buffers,"multiple render targets not supported")),b||("colorCount"in I&&(M=0|I.colorCount,_(M>0,"invalid color buffer count")),"colorTexture"in I&&(x=!!I.colorTexture,w="rgba4"),"colorType"in I&&(E=I.colorType,x?(_(n.oes_texture_float||!("float"===E||"float32"===E),"you must enable OES_texture_float in order to use floating point framebuffer objects"),_(n.oes_texture_half_float||!("half float"===E||"float16"===E),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===E||"float16"===E?(_(n.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),w="rgba16f"):"float"!==E&&"float32"!==E||(_(n.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),w="rgba32f"),_.oneOf(E,f,"invalid color type")),"colorFormat"in I&&(w=I.colorFormat,c.indexOf(w)>=0?x=!0:l.indexOf(w)>=0?x=!1:x?_.oneOf(I.colorFormat,c,"invalid color format for texture"):_.oneOf(I.colorFormat,l,"invalid color format for renderbuffer"))),("depthTexture"in I||"depthStencilTexture"in I)&&(j=!(!I.depthTexture&&!I.depthStencilTexture),_(!j||n.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in I&&("boolean"==typeof I.depth?d=I.depth:(k=I.depth,g=!1)),"stencil"in I&&("boolean"==typeof I.stencil?g=I.stencil:(A=I.stencil,d=!1)),"depthStencil"in I&&("boolean"==typeof I.depthStencil?d=g=I.depthStencil:(C=I.depthStencil,d=!1,g=!1))}else s=h=1;var N=null,P=null,D=null,L=null;if(Array.isArray(b))N=b.map(v);else if(b)N=[v(b)];else for(N=new Array(M),i=0;i=0||N[i].renderbuffer&&It.indexOf(N[i].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+i+" is invalid"),N[i]&&N[i].texture){var B=Ct[N[i].texture._texture.format]*jt[N[i].texture._texture.type];null===R?R=B:_(R===B,"all color attachments much have the same number of bits per pixel.")}return p(P,s,h),_(!P||P.texture&&6402===P.texture._texture.format||P.renderbuffer&&33189===P.renderbuffer._renderbuffer.format,"invalid depth attachment for framebuffer object"),p(D,s,h),_(!D||D.renderbuffer&&36168===D.renderbuffer._renderbuffer.format,"invalid stencil attachment for framebuffer object"),p(L,s,h),_(!L||L.texture&&34041===L.texture._texture.format||L.renderbuffer&&34041===L.renderbuffer._renderbuffer.format,"invalid depth-stencil attachment for framebuffer object"),S(o),o.width=s,o.height=h,o.colorAttachments=N,o.depthAttachment=P,o.stencilAttachment=D,o.depthStencilAttachment=L,a.color=N.map(m),a.depth=m(P),a.stencil=m(D),a.depthStencil=m(L),a.width=o.width,a.height=o.height,O(o),a}return s.framebufferCount++,a(t,i),e(a,{resize:function(t,e){_(u.next!==o,"can not resize a framebuffer which is currently in use");var n=Math.max(0|t,1),r=Math.max(0|e||n,1);if(n===o.width&&r===o.height)return a;for(var i=o.colorAttachments,s=0;s=2,"invalid shape for framebuffer"),_(m[0]===m[1],"cube framebuffer must be square"),h=m[0]}else"radius"in y&&(h=0|y.radius),"width"in y?(h=0|y.width,"height"in y&&_(y.height===h,"must be square")):"height"in y&&(h=0|y.height);("color"in y||"colors"in y)&&(d=y.color||y.colors,Array.isArray(d)&&_(1===d.length||n.webgl_draw_buffers,"multiple render targets not supported")),d||("colorCount"in y&&(v=0|y.colorCount,_(v>0,"invalid color buffer count")),"colorType"in y&&(_.oneOf(y.colorType,f,"invalid color type"),g=y.colorType),"colorFormat"in y&&(p=y.colorFormat,_.oneOf(y.colorFormat,c,"invalid color format for texture"))),"depth"in y&&(l.depth=y.depth),"stencil"in y&&(l.stencil=y.stencil),"depthStencil"in y&&(l.depthStencil=y.depthStencil)}else h=1;if(d)if(Array.isArray(d))for(s=[],r=0;r0&&(l.depth=o[0].depth,l.stencil=o[0].stencil,l.depthStencil=o[0].depthStencil),o[r]?o[r](l):o[r]=k(l)}return e(a,{width:h,height:h,color:s})}return a(t),e(a,{faces:o,resize:function(t){var e,n=0|t;if(_(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===a.width)return a;var i=a.color;for(e=0;e=0;--t){var e=F[t];e&&e(m,null,0)}i.flush(),p&&p.update()}function tt(){!$&&F.length>0&&($=A.next(J))}function et(){$&&(A.cancel(J),$=null)}function nt(t){t.preventDefault(),s=!0,et(),z.forEach((function(t){t()}))}function rt(t){i.getError(),s=!1,u.restore(),S.restore(),x.restore(),M.restore(),O.restore(),j.restore(),w.restore(),p&&p.restore(),I.procs.refresh(),tt(),G.forEach((function(t){t()}))}function it(t){function n(t,e){var n={},r={};return Object.keys(t).forEach((function(i){var o=t[i];if(k.isDynamic(o))r[i]=k.unbox(o,i);else{if(e&&Array.isArray(o))for(var a=0;a0)return f.call(this,function(t){for(;d.length=0,"cannot cancel a frame twice"),F[e]=function t(){var e=he(F,t);F[e]=F[F.length-1],F.length-=1,F.length<=0&&et()}}}}function ut(){var t=P.viewport,e=P.scissor_box;t[0]=t[1]=e[0]=e[1]=0,m.viewportWidth=m.framebufferWidth=m.drawingBufferWidth=t[2]=e[2]=i.drawingBufferWidth,m.viewportHeight=m.framebufferHeight=m.drawingBufferHeight=t[3]=e[3]=i.drawingBufferHeight}function ct(){m.tick+=1,m.time=ft(),ut(),I.procs.poll()}function lt(){M.refresh(),ut(),I.procs.refresh(),p&&p.update()}function ft(){return(C()-g)/1e3}lt();var ht=e(it,{clear:function(t){if(_("object"===a(t)&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var n=0;n<6;++n)ot(e({framebuffer:t.framebuffer.faces[n]},t),at);else ot(t,at);else at(0,t)},prop:k.define.bind(null,1),context:k.define.bind(null,2),this:k.define.bind(null,3),draw:it({}),buffer:function(t){return x.create(t,34962,!1,!1)},elements:function(t){return E.create(t,!1)},texture:M.create2D,cube:M.createCube,renderbuffer:O.create,framebuffer:j.create,framebufferCube:j.createCube,vao:w.createVAO,attributes:o,frame:st,on:function(t,e){var n;switch(_.type(e,"function","listener callback must be a function"),t){case"frame":return st(e);case"lost":n=z;break;case"restore":n=G;break;case"destroy":n=Q;break;default:_.raise("invalid event, must be one of frame,lost,restore,destroy")}return n.push(e),{cancel:function(){for(var t=0;t=0},read:N,destroy:function(){F.length=0,et(),D&&(D.removeEventListener("webglcontextlost",nt),D.removeEventListener("webglcontextrestored",rt)),S.clear(),j.clear(),O.clear(),M.clear(),E.clear(),x.clear(),w.clear(),p&&p.clear(),Q.forEach((function(t){t()}))},_gl:i,_refresh:lt,poll:function(){ct(),p&&p.update()},now:ft,stats:h});return r.onDone(null,ht),ht}},"object"===a(e)&&void 0!==t?t.exports=o():void 0===(i="function"==typeof(r=o)?r.call(e,n,e,t):r)||(t.exports=i)},function(t,e,n){var r=n(195),i=n(196),o=n(197),a=n(198);t.exports=function(t){return r(t)||i(t)||o(t)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=n(64),i=n(199),o=n(65),a=Function.prototype,s=Object.prototype,u=a.toString,c=s.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!o(t)||"[object Object]"!=r(t))return!1;var e=i(t);if(null===e)return!0;var n=c.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&u.call(n)==l}},,,function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],l=!1,f=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!l){var t=s(h);l=!0;for(var e=c.length;e;){for(u=c,c=[];++f1)for(var n=1;n0;)for(var v=d.pop(),y=v.id,m=(0,s.getNeighbors)(y,t.edges),b=function(r){var i,a=m[r],s=t.nodes.find((function(t){return t.id===a}));if(a===y)o.push(((i={})[a]=v,i));else if(a in g){if(!g[y].has(s)){for(var u=!0,c=[s,v],l=p[y];g[a].size&&!g[a].has(l)&&(c.push(l),l!==p[l.id]);)l=p[l.id];if(c.push(l),e&&n?(u=!1,c.findIndex((function(t){return e.indexOf(t.id)>-1}))>-1&&(u=!0)):e&&!n&&c.findIndex((function(t){return e.indexOf(t.id)>-1}))>-1&&(u=!1),u){for(var f={},h=1;h-1)return f;r.push(a),i.add(a);for(var h=l[a.id],d=0;d0;){var n=e.pop();i.has(n)&&(i.delete(n),o[n.id].forEach((function(t){e.push(t)})),o[n.id].clear())}}(a);else for(d=0;d-1}));y-1?g[v.id].push(l[b]):u.push(((i={})[v.id]=v,i))}}return{component:p,adjList:g,minIdx:a}},b=0;b=b})),w=(0,a.detectStrongConnectComponents)({nodes:x,edges:t.edges}).filter((function(t){return t.length>1}));if(0===w.length)break;var _=m(w),E=_.minIdx,S=_.adjList,M=_.component;if(!(M.length>1))break;M.forEach((function(t){o[t.id]=new Set}));var O=c[E];if(e&&n&&-1===e.indexOf(O.id))return u;f(O,O,S),b=E+1}return u};e.detectAllDirectedCycle=l;e.detectAllCycles=function(t,e,n,r){return void 0===r&&(r=!0),e?l(t,n,r):c(t,n,r)};var f=function(t){var e=null,n=t.nodes,r={},i={},a={},s={};(void 0===n?[]:n).forEach((function(t){i[t.id]=t}));for(var u={enter:function(t){var n=t.current,o=t.previous;if(a[n]){e={};for(var s=n,u=o;u!==n;)e[s]=u,s=u,u=r[u];e[s]=u}else a[n]=n,delete i[n],r[n]=o},leave:function(t){var e=t.current;s[e]=e,delete a[e]},allowTraversal:function(t){var n=t.next;return!e&&!s[n]}};Object.keys(i).length;){var c=Object.keys(i)[0];(0,o.default)(t,c,u)}return e};e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.findShortestPath=e.findAllPath=void 0;var r,i=(r=n(58))&&r.__esModule?r:{default:r},o=n(27);e.findShortestPath=function(t,e,n,r,o){var a=(0,i.default)(t,e,r,o),s=a.length,u=a.path,c=a.allPath;return{length:s[n],path:u[n],allPath:c[n]}};e.findAllPath=function(t,e,n,r){var i;if(e===n)return[[e]];var a=t.edges,s=void 0===a?[]:a,u=[e],c=((i={})[e]=!0,i),l=[],f=[],h=r?(0,o.getNeighbors)(e,s,"target"):(0,o.getNeighbors)(e,s);for(l.push(h);u.length>0&&l.length>0;){var d=l[l.length-1];if(d.length){var p=d.shift();if(p&&(u.push(p),c[p]=!0,h=r?(0,o.getNeighbors)(p,s,"target"):(0,o.getNeighbors)(p,s),l.push(h.filter((function(t){return!c[t]})))),u[u.length-1]===n){var g=u.map((function(t){return t}));f.push(g);v=u.pop();c[v]=!1,l.pop()}}else{var v=u.pop();c[v]=!1,l.pop()}}return f}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r,i=(r=n(45))&&r.__esModule?r:{default:r},o=n(27);var a=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n="weight"),void 0===r&&(r=1e3);var a=t.nodes,s=void 0===a?[]:a,u=t.edges,c=void 0===u?[]:u,l={},f={};s.forEach((function(t,e){var n=(0,o.uniqueId)();t.clusterId=n,l[n]={id:n,nodes:[t]},f[t.id]={node:t,idx:e}}));var h=(0,i.default)(t,e),d=[],p={};h.forEach((function(t,e){var n=0,r=s[e].id;p[r]={},t.forEach((function(t,e){if(t){n+=t;var i=s[e].id;p[r][i]=t}})),d.push(n)}));for(var g=0,v=function(){var t=!1;if(s.forEach((function(e){var n={};Object.keys(p[e.id]).forEach((function(t){var r=p[e.id][t],i=f[t].node.clusterId;n[i]||(n[i]=0),n[i]+=r}));var r=-1/0,i=[];if(Object.keys(n).forEach((function(t){r=0&&i.splice(o,1),i&&i.length){t=!0;var a=l[e.clusterId],s=a.nodes.indexOf(e);a.nodes.splice(s,1);var u=Math.floor(Math.random()*i.length),c=l[i[u]];c.nodes.push(e),e.clusterId=c.id}}})),!t)return"break";g++};g0&&C>j&&C-jj&&(T=v.map((function(t){return{node:t,clusterId:t.clusterId}})),N=(0,r.clone)(E),j=C),P||I>100)break;I++,Object.keys(E).forEach((function(t){var e=0;m.forEach((function(r){var i=r.source,o=r.target,a=S[i].node.clusterId,s=S[o].node.clusterId;(a===t&&s!==t||s===t&&a!==t)&&(e+=r[n]||1)})),E[t].sumTot=e})),v.forEach((function(t,e){var r,i=E[t.clusterId],o=0,a=O[e]/(2*A),s=0,c=i.nodes;c.forEach((function(t){var n=S[t.id].idx;s+=M[e][n]||0}));var f=s-i.sumTot*a,h=c.filter((function(e){return e.id!==t.id})),d=[];h.forEach((function(t,e){d[e]=b[t.originIndex]}));var g=l(h,b)*p,v=k[t.id];if(Object.keys(v).forEach((function(n){var i=S[n].node.clusterId;if(i!==t.clusterId){var s=E[i],c=s.nodes;if(c&&c.length){var h=0;c.forEach((function(t){var n=S[t.id].idx;h+=M[e][n]||0}));var d=h-s.sumTot*a,v=c.concat([t]),y=[];v.forEach((function(t,e){y[e]=b[t.originIndex]}));var m=l(v,b)*p,x=d-f;u&&(x=d+m-(f+g)),x>o&&(o=x,r=s)}}})),o>0){r.nodes.push(t);var y=t.clusterId;t.clusterId=r.id;var x=i.nodes.indexOf(t);i.nodes.splice(x,1);var w=0,_=0;m.forEach((function(t){var e=t.source,i=t.target,o=S[e].node.clusterId,a=S[i].node.clusterId;(o===r.id&&a!==r.id||a===r.id&&o!==r.id)&&(w+=t[n]||1),(o===y&&a!==y||a===y&&o!==y)&&(_+=t[n]||1)})),r.sumTot=w,i.sumTot=_}}))}var D={},L=0;Object.keys(N).forEach((function(t){var e=N[t];if(e.nodes&&e.nodes.length){var n=String(L+1);n!==t&&(e.id=n,e.nodes=e.nodes.map((function(t){return{id:t.id,clusterId:n}})),N[n]=e,D[t]=n,delete N[t],L++)}else delete N[t]})),T.forEach((function(t){var e=t.node,n=t.clusterId;e&&(e.clusterId=n,e.clusterId&&D[e.clusterId]&&(e.clusterId=D[e.clusterId]))}));var R=[],B={};m.forEach((function(t){var e=t.source,r=t.target,i=t[n]||1,o=S[e].node.clusterId,a=S[r].node.clusterId;if(o&&a){var s="".concat(o,"---").concat(a);if(B[s])B[s].weight+=i,B[s].count++;else{var u={source:o,target:a,weight:i,count:1};B[s]=u,R.push(u)}}}));var F=[];return Object.keys(N).forEach((function(t){F.push(N[t])})),{clusters:F,clusterEdges:R}};e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getPropertyWeight=e.getAllSortProperties=e.getAllProperties=e.default=void 0;var r=n(136),i=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=100);var n={};t.forEach((function(t){t.properties&&Object.keys(t.properties).forEach((function(e){"id"===e||!"".concat(t.properties[e]).match(r.secondReg)&&!"".concat(t.properties[e]).match(r.dateReg)&&isNaN(Number(t.properties[e]))?n.hasOwnProperty(e)&&delete n[e]:n.hasOwnProperty(e)?n[e]+=1:n[e]=1}))}));var i=Object.keys(n).sort((function(t,e){return n[e]-n[t]}));return i.length0;){var l=u.shift(),f=l.source,h=l.target;c.connected(f,h)||(n.push(l),c.union(f,h))}return n},c=function(t,e,n){return n?{prim:s,kruskal:u}[n](t,e):u(t,e)};e.default=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function(){function t(t){this.count=t.length,this.parent={};for(var e=0,n=t;e0&&(this.list[0]=e,this.moveDown(0)),t},t.prototype.insert=function(t){if(null!==t){this.list.push(t);var e=this.list.length-1;return this.moveUp(e),!0}return!1},t.prototype.moveUp=function(t){for(var e=this.getParent(t);t&&t>0&&this.compareFn(this.list[e],this.list[t])>0;){var n=this.list[e];this.list[e]=this.list[t],this.list[t]=n,t=e,e=this.getParent(t)}},t.prototype.moveDown=function(t){var e,n=t,r=this.getLeft(t),i=this.getRight(t),o=this.list.length;null!==r&&r0?n=r:null!==i&&i0&&(n=i),t!==n&&(e=[this.list[n],this.list[t]],this.list[t]=e[0],this.list[n]=e[1],this.moveDown(n))},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r,i=(r=n(74))&&r.__esModule?r:{default:r},o=n(27);var a=function(t,e,n){"number"!=typeof e&&(e=1e-6),"number"!=typeof n&&(n=.85);for(var r,a=1,s=0,u=1e3,c=t.nodes,l=void 0===c?[]:c,f=t.edges,h=void 0===f?[]:f,d=l.length,p={},g={},v=0;v0&&a>e;){s=0;for(v=0;v0&&(r+=g[w]/_)}p[m]=n*r,s+=p[m]}}s=(1-s)/d,a=0;for(v=0;ve&&(s=e);var r=n[t.id].inDegree;u>r&&(u=r);var i=n[t.id].outDegree;c>i&&(c=i)})),t[e]={degree:s,inDegree:u,outDegree:c}),{minPatternNodeLabelDegree:s,minPatternNodeLabelInDegree:u,minPatternNodeLabelOutDegree:c}},m=function(t,e,n,s,u,m,b){var x;if(void 0===n&&(n=!1),void 0===m&&(m="cluster"),void 0===b&&(b="cluster"),t&&t.nodes){var w=t.nodes.length;if(w){var _=(0,i.default)(t,n),E=(0,i.default)(e,n),S=g(t.nodes,_,n),M=g(e.nodes,E,n),O=d(t.nodes,m),k=O.nodeMap,A=O.nodeLabelMap,C=d(e.nodes,m),j=C.nodeMap,I=C.nodeLabelMap;p(t.edges,b,k);var T=p(e.edges,b,j).edgeLabelMap,N=[];null==E||E.forEach((function(t){N=N.concat(t)})),u||(u=Math.max.apply(Math,(0,r.__spreadArray)((0,r.__spreadArray)([],N,!1),[2],!1))),s||(s=u);var P=c(t,_,m,s),D=c(e,E,m,s),L=function(t,e,n,r,i){var o=Math.ceil(n/e),a={},s=0;return r.forEach((function(t,r){for(var u=0,c=0,l=t.nodeIdxs,f=t.neighborNum-1;u2*e)););if(d<2*e&&(a["".concat(r,"-").concat(h)]={start:r,end:h,distance:i[r][h]},u++,++s>=n))return a;if(++c>2*e)break}uq&&(q=n.length,V=n,H=e,W=t)}));var Z={},K={},Q={},$={},J={},tt={};Object.keys(I).forEach((function(r,i){J[r]=[],n&&(tt[r]=[]);var o=-1/0,a=I[r],s={};a.forEach((function(t){var e=M["".concat(W.id,"-").concat(t.id)];if(e&&J[r].push(e),oJ[r][c]){s=!0;break}if(s)return V.splice(e,1),"continue";var l={};i.neighbors.forEach((function(t){var e=S["".concat(n.id,"-").concat(t.id)];l["".concat(n.id,"-").concat(t.id)]={start:k[n.id].idx,end:k[t.id].idx,distance:e}})),R=f(l,P,t,R);var d=[];Object.keys(l).forEach((function(t){if(X[t])d.push(X[t]);else{var e=R[t];X[t]=h(e,U,m,b),d.push(X[t])}})),d=d.sort((function(t,e){return e-t}));var p=!1;for(c=0;c=0;l--)c(l)}));var et=[];null==V||V.forEach((function(r){for(var i=k[r.id].idx,o=l(t.nodes,_[i],i,m,u).neighbors,a=!1,s=o.length-1;s>=0;s--){if(o.length+1J[f][p])o.splice(s,1);else{if(n){var g="".concat(c.id,"-").concat(r.id),x=S[g];if(p=tt[f].length-1,x>tt[f][p]){o.splice(s,1);continue}}var w=X[h]?X[h]:v(t,r,c,k,d,P,U,m,b,X,R),E="".concat(W.id,"-").concat(f);if(w<$[E][$[E].length-1])o.splice(s,1);else{var M=y(Z,f,j,I),O=M.minPatternNodeLabelDegree;M.minPatternNodeLabelInDegree,M.minPatternNodeLabelOutDegree;k[c.id].degree=0;d--){if("break"===x(d))break}if(v)return et.splice(r,1),"continue";i.edges=c;var w=(0,a.default)(i,i.nodes[0].id,!1).length;if(Object.keys(w).reverse().forEach((function(t){if(t!==i.nodes[0].id&&!v){if(w[t]===1/0){var e=u[t].node[m];if(s[e]--,s[e]rt[r][rt[r].length-1]){e=u[t].node[m];if(s[e]--,s[e]=0;S--){var M=i.nodes[S],O=u[M.id].degree,A=u[M.id].inDegree,C=u[M.id].outDegree,N=M[m],P=y(Z,N,j,I),D=P.minPatternNodeLabelDegree,L=P.minPatternNodeLabelInDegree,R=P.minPatternNodeLabelOutDegree;if(n?O=0;B--){var F=c[B];if(!u[F.source]||!u[F.target]){c.splice(B,1);var z=F[b];if(l[z]--,u[F.source]&&(u[F.source].degree--,u[F.source].outDegree--),u[F.target]&&(u[F.target].degree--,u[F.target].inDegree--),T[z]&&l[z]=0;ot--){if("break"===it(ot))break}var at=et.length,st=function(t){var e=et[t],n={};e.edges.forEach((function(t){var e="".concat(t.source,"-").concat(t.target,"-").concat(t.label);n[e]?n[e]++:n[e]=1}));for(var r=function(t){var e=et[t],r={};e.edges.forEach((function(t){var e="".concat(t.source,"-").concat(t.target,"-").concat(t.label);r[e]?r[e]++:r[e]=1}));var i=!0;Object.keys(r).length!==Object.keys(n).length?i=!1:Object.keys(n).forEach((function(t){r[t]!==n[t]&&(i=!1)})),i&&et.splice(t,1)},i=at-1;i>t;i--)r(i);at=et.length};for(ot=0;ot<=at-1;ot++)st(ot);return et}}};e.default=m},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(0),i=n(145),o=function(){function t(t,e,n,r,o){this.fromNode=t,this.toNode=e,this.nodeEdgeNodeLabel={nodeLabel1:n||i.VACANT_NODE_LABEL,edgeLabel:r||i.VACANT_EDGE_LABEL,nodeLabel2:o||i.VACANT_NODE_LABEL}}return t.prototype.equalTo=function(t){return this.fromNode===t.formNode&&this.toNode===t.toNode&&this.nodeEdgeNodeLabel===t.nodeEdgeNodeLabel},t.prototype.notEqualTo=function(t){return!this.equalTo(t)},t}(),a=function(){function t(){this.rmpath=[],this.dfsEdgeList=[]}return t.prototype.equalTo=function(t){var e=this.dfsEdgeList.length;if(e!==t.length)return!1;for(var n=0;n=0;e--){var n=this.dfsEdgeList[e],r=n.fromNode,i=n.toNode;rf||r.hasNode(o[l.to])||(e.labely;b--){if("break"===m(b))break}if(g){var x=t.findMinLabel(p);c.dfsEdgeList.push(new o(d,v,i.VACANT_NODE_LABEL,x.edgeLabel,i.VACANT_NODE_LABEL));var w=c.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[w]===c.dfsEdgeList[w]&&a(p[x.edgeLabel].projected)}var _={};g=!1;var E=0;l.forEach((function(e){var n=new s(e),i=t.findForwardPureEdges(r,n.edges[f[0]],h,n);i.length>0&&(g=!0,E=d,i.forEach((function(t){var n="".concat(t.label,"-").concat(u[t.to].label);_[n]||(_[n]={projected:[],edgeLabel:t.label,nodeLabel2:u[t.to].label}),_[n].projected.push({graphId:r.id,edge:t,preNode:e})})))}));var S=f.length,M=function(e){if(g)return"break";var n=f[e];l.forEach((function(e){var i=new s(e),o=t.findForwardRmpathEdges(r,i.edges[n],h,i);o.length>0&&(g=!0,E=c.dfsEdgeList[n].fromNode,o.forEach((function(t){var n="".concat(t.label,"-").concat(u[t.to].label);_[n]||(_[n]={projected:[],edgeLabel:t.label,nodeLabel2:u[t.to].label}),_[n].projected.push({graphId:r.id,edge:t,preNode:e})})))}))};for(b=0;b=0;h--){var d=e.findBackwardEdge(i,f.edges[r[h]],f.edges[r[0]],f);if(d){var p="".concat(e.dfsCode.dfsEdgeList[r[h]].fromNode,"-").concat(d.label);l[p]||(l[p]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[r[h]].fromNode,edgeLabel:d.label}),l[p].projected.push({graphId:t.graphId,edge:d,preNode:t})}}if(!(n>=e.maxNodeNum)){e.findForwardPureEdges(i,f.edges[r[0]],u,f).forEach((function(e){var n="".concat(a,"-").concat(e.label,"-").concat(o[e.to].label);c[n]||(c[n]={projected:[],fromNodeId:a,edgeLabel:e.label,nodeLabel2:o[e.to].label}),c[n].projected.push({graphId:t.graphId,edge:e,preNode:t})}));var g=function(n){e.findForwardRmpathEdges(i,f.edges[r[n]],u,f).forEach((function(i){var a="".concat(e.dfsCode.dfsEdgeList[r[n]].fromNode,"-").concat(i.label,"-").concat(o[i.to].label);c[a]||(c[a]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[r[n]].fromNode,edgeLabel:i.label,nodeLabel2:o[i.to].label}),c[a].projected.push({graphId:t.graphId,edge:i,preNode:t})}))};for(h=0;hi){var a=i;i=r,r=a}var l=t.label,f="".concat(n,"-").concat(r,"-").concat(l,"-").concat(i),h="".concat(r,"-").concat(l,"-").concat(i);if(!o[h]){var d=o[h]||0;d++,o[h]=d}s[f]={graphId:n,nodeLabel1:r,edgeLabel:l,nodeLabel2:i}}))}))})),Object.keys(i).forEach((function(t){if(!(i[t]=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},u.to.keyword=function(t){return a[t.slice(0,3)]}},function(t,e,n){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},function(t,e,n){"use strict";var r=n(149),i=Array.prototype.concat,o=Array.prototype.slice,a=t.exports=function(t){for(var e=[],n=0,a=t.length;n=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=n(78),o=n(152),a={};Object.keys(i).forEach((function(t){a[t]={},Object.defineProperty(a[t],"channels",{value:i[t].channels}),Object.defineProperty(a[t],"labels",{value:i[t].labels});var e=o(t);Object.keys(e).forEach((function(n){var i=e[n];a[t][n]=function(t){var e=function(e){if(null==e)return e;arguments.length>1&&(e=Array.prototype.slice.call(arguments));var n=t(e);if("object"===r(n))for(var i=n.length,o=0;o1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(i)}))})),t.exports=a},function(t,e,n){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},function(t,e,n){var r=n(78);function i(t){var e=function(){for(var t={},e=Object.keys(r),n=e.length,i=0;ie.size[1]?e.size[0]:e.size[1]:(0,r.isObject)(e.size)?e.size.width>e.size.height?e.size.width:e.size.height:e.size:t}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.forceNBody=void 0;var r=n(61);function i(t){var e=0,n=0,r=0;if(t.length){for(var i=0;i<4;i++){(o=t[i])&&o.weight&&(e+=o.weight,n+=o.x*o.weight,r+=o.y*o.weight)}t.x=n/e,t.y=r/e,t.weight=e}else{var o=t;t.x=o.data.x,t.y=o.data.y,t.weight=o.data.weight}}e.forceNBody=function(t,e,n,o,a){var s=n/o,u=t.map((function(t,n){var r=e[t.id],i=r.data,o=r.x,a=r.y,u=r.size,c=i.layout.force.nodeStrength;return{x:o,y:a,size:u,index:n,vx:0,vy:0,weight:s*c}})),c=(0,r.quadtree)(u,(function(t){return t.x}),(function(t){return t.y})).visitAfter(i);return u.forEach((function(t){!function(t,e){e.visit((function(e,n,r,i,o){return function(t,e,n,r,i,o){var a=o.x-t.x||.1,s=o.y-t.y||.1,u=r-e,c=a*a+s*s,l=Math.sqrt(c)*c;if(u*u*.81-1||(e[r]=t[r])})),e})),this.ticking=!1},e.prototype.execute=function(t){var e=this,n=e.nodes,r=e.edges;if(!e.ticking){var i=e.forceSimulation,o=e.alphaMin,a=e.alphaDecay,s=e.alpha;if(i){if(t)if(e.clustering&&e.clusterForce&&(e.clusterForce.nodes(n),e.clusterForce.links(r)),i.nodes(n),r&&e.edgeForce)e.edgeForce.links(r);else if(r&&!e.edgeForce){h=c.forceLink().id((function(t){return t.id})).links(r);e.edgeStrength&&h.strength(e.edgeStrength),e.linkDistance&&h.distance(e.linkDistance),e.edgeForce=h,i.force("link",h)}e.preventOverlap&&e.overlapProcess(i),i.alpha(s).restart(),this.ticking=!0}else try{var u=c.forceManyBody();if(e.nodeStrength&&u.strength(e.nodeStrength),i=c.forceSimulation().nodes(n),e.clustering){var f=(0,l.default)();f.centerX(e.center[0]).centerY(e.center[1]).template("force").strength(e.clusterFociStrength),r&&f.links(r),n&&f.nodes(n),f.forceLinkDistance(e.clusterEdgeDistance).forceLinkStrength(e.clusterEdgeStrength).forceCharge(e.clusterNodeStrength).forceNodeSize(e.clusterNodeSize),e.clusterForce=f,i.force("group",f)}if(i.force("center",c.forceCenter(e.center[0],e.center[1])).force("charge",u).alpha(s).alphaDecay(a).alphaMin(o),e.preventOverlap&&e.overlapProcess(i),r){var h=c.forceLink().id((function(t){return t.id})).links(r);e.edgeStrength&&h.strength(e.edgeStrength),e.linkDistance&&h.distance(e.linkDistance),e.edgeForce=h,i.force("link",h)}if(e.workerEnabled&&!g()&&(e.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),e.workerEnabled){i.stop();for(var p=function(t){var e=t.alphaMin(),n=t.alphaTarget(),r=t.alpha(),i=Math.log((e-n)/(r-n))/Math.log(1-t.alphaDecay());return Math.ceil(i)}(i),v=1;v<=p;v++)i.tick(),postMessage({nodes:n,currentTick:v,totalTicks:p,type:d.LAYOUT_MESSAGE.TICK},void 0);e.ticking=!1}else i.on("tick",(function(){e.tick()})).on("end",(function(){e.ticking=!1,e.onLayoutEnd&&e.onLayoutEnd()})),e.ticking=!0;e.forceSimulation=i,e.ticking=!0}catch(t){e.ticking=!1,console.warn(t)}}},e.prototype.overlapProcess=function(t){var e,n,r=this.nodeSize,i=this.nodeSpacing,o=this.collideStrength;if(n=(0,f.isNumber)(i)?function(){return i}:(0,f.isFunction)(i)?i:function(){return 0},r)if((0,f.isFunction)(r))e=function(t){return r(t)+n(t)};else if((0,f.isArray)(r)){var a=(r[0]>r[1]?r[0]:r[1])/2;e=function(t){return a+n(t)}}else if((0,f.isNumber)(r)){var s=r/2;e=function(t){return s+n(t)}}else e=function(){return 10};else e=function(t){return t.size?(0,f.isArray)(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])/2+n(t):(0,f.isObject)(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)/2+n(t):t.size/2+n(t):10+n(t)};t.force("collisionForce",c.forceCollide(e).strength(o))},e.prototype.updateCfg=function(t){this.ticking&&(this.forceSimulation.stop(),this.ticking=!1),this.forceSimulation=null,Object.assign(this,t)},e.prototype.destroy=function(){this.ticking&&(this.forceSimulation.stop(),this.ticking=!1),this.nodes=null,this.edges=null,this.destroyed=!0},e}(h.Base);function g(){return"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope}e.ForceLayout=p},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0});var a=o(n(66)),s=n(15);e.default=function(){function t(t){return function(){return t}}var e,n=function(t){return t.cluster},r=t(1),i=t(-1),o=t(100),u=t(.1),c=[0,0],l=[],f={},h=[],d=100,p=100,g={none:{x:0,y:0}},v=[],y="force",m=!0,b=.1;function x(t){if(!m)return x;e.tick(),_();for(var r=0,i=l.length,o=void 0,a=t*b;r0;--s)if(r=e[s].dequeue()){i=i.concat(h(t,e,n,r,!0));break}}return i},h=function(t,e,n,r,i){var o,a,s=[];return null===(o=t.inEdges(r.v))||void 0===o||o.forEach((function(r){var o=t.edge(r),a=t.node(r.v);i&&s.push({v:r.v,w:r.w,in:0,out:0}),void 0===a.out&&(a.out=0),a.out-=o,p(e,n,a)})),null===(a=t.outEdges(r.v))||void 0===a||a.forEach((function(r){var i=t.edge(r),o=r.w,a=t.node(o);void 0===a.in&&(a.in=0),a.in-=i,p(e,n,a)})),t.removeNode(r.v),i?s:void 0},d=function(t,e){var n=new c,r=0,i=0;t.nodes().forEach((function(t){n.setNode(t,{v:t,in:0,out:0})})),t.edges().forEach((function(t){var o=n.edge(t)||0,a=(null==e?void 0:e(t))||1,s=o+a;n.setEdge(t.v,t.w,s),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)}));for(var o=[],a=i+r+3,s=0;su.lim&&(c=u,l=!0);var f=e.edges().filter((function(e){return l===d(t,t.node(e.v),c)&&l!==d(t,t.node(e.w),c)}));return(0,o.minBy)(f,(function(t){return(0,i.slack)(e,t)}))};e.exchangeEdges=function(t,n,r,i){var o=r.v,a=r.w;t.removeEdge(o,a),t.setEdge(i.v,i.w,{}),(0,e.initLowLimValues)(t),(0,e.initCutValues)(t,n),f(t,n)};var f=function(t,e){var n=t.nodes().find((function(t){var n;return!(null===(n=e.node(t))||void 0===n?void 0:n.parent)})),r=s(t,n);null==(r=null==r?void 0:r.slice(1))||r.forEach((function(n){var r=t.node(n).parent,i=e.edgeFromArgs(n,r),o=!1;i||(i=e.edgeFromArgs(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)}))},h=function(t,e,n){return t.hasEdge(e,n)},d=function(t,e,n){return n.low<=e.lim&&e.lim<=n.lim};e.default=function(t){var n=(0,o.simplify)(t);(0,i.longestPath)(n);var a,s,u=(0,r.feasibleTree)(n);for((0,e.initLowLimValues)(u),(0,e.initCutValues)(u,n);a=(0,e.leaveEdge)(u);)s=(0,e.enterEdge)(u,n,a),(0,e.exchangeEdges)(u,n,a,s)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function(t){var e,n=function(t){var e,n={},r=0;return null===(e=t.children())||void 0===e||e.forEach((function e(i){var o,a=r;null===(o=t.children(i))||void 0===o||o.forEach(e),n[i]={low:a,lim:r++}})),n}(t);null===(e=t.graph().dummyChains)||void 0===e||e.forEach((function(e){var r,i,o=e,a=t.node(o),s=a.edgeObj;if(s)for(var u=function(t,e,n,r){var i,o,a=[],s=[],u=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>u||c>e[i].lim));for(o=i,i=r;i&&i!==o;)s.push(i),i=t.parent(i);return{lca:o,path:a.concat(s.reverse())}}(t,n,s.v,s.w),c=u.path,l=u.lca,f=0,h=c[f],d=!0;o!==s.w;){if(a=t.node(o),d){for(;h!==l&&(null===(r=t.node(h))||void 0===r?void 0:r.maxRank)-1;s--)a.push(s);var u=h(t,r,"inEdges"),l=h(t,a,"outEdges"),g=(0,i.default)(t);p(t,g);for(var v,y=Number.POSITIVE_INFINITY,m=(s=0,0);m<4;++s,++m){d(s%2?u:l,s%4>=2,!1,e),g=(0,f.buildLayerMatrix)(t),(b=(0,o.default)(t,g))=2,!0,e),g=(0,f.buildLayerMatrix)(t),(b=(0,o.default)(t,g))0;)e%2&&(n+=u[e+1]),u[e=e-1>>1]+=t.weight;c+=t.weight*n}})),c};e.default=function(t,e){for(var n=0,r=1;r<(null==e?void 0:e.length);r+=1)n+=i(t,e[r-1],e[r]);return n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(35),i=function(t){for(var e;t.hasNode(e="_root".concat(Math.random())););return e};e.default=function(t,e,n){var o=i(t),a=new r.Graph({compound:!0}).setGraph({root:o}).setDefaultNodeLabel((function(e){return t.node(e)}));return t.nodes().forEach((function(r){var i,s=t.node(r),u=t.parent(r);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(a.setNode(r),a.setParent(r,u||o),null===(i=t[n](r))||void 0===i||i.forEach((function(e){var n=e.v===r?e.w:e.v,i=a.edgeFromArgs(n,r),o=void 0!==i?i.weight:0;a.setEdge(n,r,{weight:t.edge(e).weight+o})})),s.hasOwnProperty("minRank")&&a.setNode(r,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))})),a}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function(t,e,n){var r,i={};null==n||n.forEach((function(n){for(var o,a,s=t.parent(n);s;){if((o=t.parent(s))?(a=i[o],i[o]=s):(a=r,r=s),a&&a!==s)return void e.setEdge(a,s);s=o}}))}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(176)),o=r(n(177)),a=r(n(178)),s=function(t,e){null==t||t.forEach((function(t){var n,r=null===(n=t.vs)||void 0===n?void 0:n.map((function(t){return e[t]?e[t].vs:t}));t.vs=r.flat()}))},u=function(t,e){void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)};e.default=function t(e,n,r,c,l,f){var h,d,p,g,v=e.children(n),y=e.node(n),m=y?y.borderLeft:void 0,b=y?y.borderRight:void 0,x={};m&&(v=null==v?void 0:v.filter((function(t){return t!==m&&t!==b})));var w=(0,i.default)(e,v||[]);null==w||w.forEach((function(n){var i;if(null===(i=e.children(n.v))||void 0===i?void 0:i.length){var o=t(e,n.v,r,c,f);x[n.v]=o,o.hasOwnProperty("barycenter")&&u(n,o)}}));var _=(0,o.default)(w,r);s(_,x),null===(h=_.filter((function(t){return t.vs.length>0})))||void 0===h||h.forEach((function(t){var n=e.node(t.vs[0]);n&&(t.fixorder=n.fixorder,t.order=n.order)}));var E=(0,a.default)(_,c,l,f);if(m&&(E.vs=[m,E.vs,b].flat(),null===(d=e.predecessors(m))||void 0===d?void 0:d.length)){var S=e.node((null===(p=e.predecessors(m))||void 0===p?void 0:p[0])||""),M=e.node((null===(g=e.predecessors(b))||void 0===g?void 0:g[0])||"");E.hasOwnProperty("barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+S.order+M.order)/(E.weight+2),E.weight+=2}return E}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function(t,e){return e.map((function(e){var n=t.inEdges(e);if(!(null==n?void 0:n.length))return{v:e};var r={sum:0,weight:0};return null==n||n.forEach((function(e){var n=t.edge(e),i=t.node(e.v);r.sum+=n.weight*i.order,r.weight+=n.weight})),{v:e,barycenter:r.sum/r.weight,weight:r.weight}}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){for(var e,n,r=[],o=function(){var o=t.pop();r.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((function(t){return(e=o,function(t){t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&i(e,t)})(t);var e})),null===(n=o.out)||void 0===n||n.forEach((function(e){return(n=o,function(e){e.in.push(n),0==--e.indegree&&t.push(e)})(e);var n}))};null==t?void 0:t.length;)o();var a=r.filter((function(t){return!t.merged})),s=["vs","i","barycenter","weight"];return a.map((function(t){var e={};return null==s||s.forEach((function(n){void 0!==t[n]&&(e[n]=t[n])})),e}))},i=function(t,e){var n,r=0,i=0;t.weight&&(r+=t.barycenter*t.weight,i+=t.weight),e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),t.vs=null===(n=e.vs)||void 0===n?void 0:n.concat(t.vs),t.barycenter=r/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0};e.default=function(t,e){var n,i,o,a={};null==t||t.forEach((function(t,e){a[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};var n=a[t.v];void 0!==t.barycenter&&(n.barycenter=t.barycenter,n.weight=t.weight)})),null===(n=e.edges())||void 0===n||n.forEach((function(t){var e=a[t.v],n=a[t.w];void 0!==e&&void 0!==n&&(n.indegree++,e.out.push(a[t.w]))}));var s=null===(o=(i=Object.values(a)).filter)||void 0===o?void 0:o.call(i,(function(t){return!t.indegree}));return r(s)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(26),i=function(t,e,n){for(var r,i=n;e.length&&(r=e[e.length-1]).i<=i;)e.pop(),null==t||t.push(r.vs),i++;return i},o=function(t,e){return function(n,r){if(void 0!==n.fixorder&&void 0!==r.fixorder)return n.fixorder-r.fixorder;if(n.barycenterr.barycenter)return 1;if(e&&void 0!==n.order&&void 0!==r.order){if(n.orderr.order)return 1}return t?r.i-n.i:n.i-r.i}};e.default=function(t,e,n,a){var s=(0,r.partition)(t,(function(t){var e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return a?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})),u=s.lhs,c=s.rhs.sort((function(t,e){return-t.i- -e.i})),l=[],f=0,h=0,d=0;null==u||u.sort(o(!!e,!!n)),d=i(l,c,d),null==u||u.forEach((function(t){var e;d+=null===(e=t.vs)||void 0===e?void 0:e.length,l.push(t.vs),f+=t.barycenter*t.weight,h+=t.weight,d=i(l,c,d)}));var p={vs:l.flat()};return h&&(p.barycenter=f/h,p.weight=h),p}},function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;is)&&(0,e.addConflict)(r,n,l)})))}function o(t,e){var n=function(t){return JSON.stringify(t.slice(1))}(t);e.get(n)||(i.apply(void 0,t),e.set(n,!0))}return(null==n?void 0:n.length)&&n.reduce((function(e,n){var r,i=-1,a=0,s=new Map;return null==n||n.forEach((function(u,c){var l;if("border"===(null===(l=t.node(u))||void 0===l?void 0:l.dummy)){var f=t.predecessors(u)||[];f.length&&(r=t.node(f[0]).order,o([n,a,c,i,r],s),a=c,i=r)}o([n,a,n.length,r,e.length],s)})),n})),r};e.findOtherInnerSegmentNode=function(t,e){var n,r;if(null===(n=t.node(e))||void 0===n?void 0:n.dummy)return null===(r=t.predecessors(e))||void 0===r?void 0:r.find((function(e){return t.node(e).dummy}))};e.addConflict=function(t,e,n){var r=e,i=n;if(r>i){var o=r;r=i,i=o}var a=t[r];a||(t[r]=a={}),a[i]=!0};e.hasConflict=function(t,e,n){var r=e;r>n&&(r=n);return!!t[r]};e.verticalAlignment=function(t,n,r,i){var o={},a={},s={};return null==n||n.forEach((function(t){null==t||t.forEach((function(t,e){o[t]=t,a[t]=t,s[t]=e}))})),null==n||n.forEach((function(t){var n=-1;null==t||t.forEach((function(t){var u=i(t);if(u.length)for(var c=((u=u.sort((function(t,e){return s[t]-s[e]}))).length-1)/2,l=Math.floor(c),f=Math.ceil(c);l<=f;++l){var h=u[l];a[t]===t&&n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function i(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||l(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 o(t,e){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=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 n,r=u(t);if(e){var i=u(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){if(e&&("object"===g(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(t,e)||l(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){if(t){if("string"==typeof t)return f(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(t,e):void 0}}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v,a=JSON.parse(JSON.stringify(o)),s=(null===(t=null==i?void 0:i.graph)||void 0===t?void 0:t.meta)||{},u=(null===(e=null==i?void 0:i.subScene)||void 0===e?void 0:e.meta)||{},c=(null===(n=null==i?void 0:i.nodeSize)||void 0===n?void 0:n.meta)||{},l=(null===(r=null==i?void 0:i.nodeSize)||void 0===r?void 0:r.node)||{},f=a.nodeSize.bridge;return{graph:{meta:Object.assign(a.graph.meta,s)},subScene:{meta:Object.assign(a.subScene.meta,u)},nodeSize:{meta:Object.assign(a.nodeSize.meta,c),node:Object.assign(a.nodeSize.node,l),bridge:f}}}function m(t){return"鈼�".concat(t,"鈼�")}var b,x,w,_,E=m("ROOT"),S=m("BRIDGE_GRAPH");!function(t){t[t.META=0]="META",t[t.NODE=1]="NODE",t[t.BRIDGE=2]="BRIDGE"}(b||(b={})),function(t){t[t.INCLUDE=0]="INCLUDE",t[t.EXCLUDE=1]="EXCLUDE",t[t.UNSPECIFIED=2]="UNSPECIFIED"}(x||(x={})),function(t){t[t.META=0]="META",t[t.CORE=1]="CORE",t[t.BRIDGE=2]="BRIDGE"}(w||(w={})),function(t){t[t.META=0]="META",t[t.OP=1]="OP",t[t.SERIES=2]="SERIES"}(_||(_={}));var M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{};function O(t,e){return t(e={exports:{}},e.exports),e.exports}var k=function(t,e){return t===e||t!=t&&e!=e},A=function(t,e){for(var n=t.length;n--;)if(k(t[n][0],e))return n;return-1},C=Array.prototype.splice;function j(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1},j.prototype.set=function(t,e){var n=this.__data__,r=A(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var I,T=j,N="object"==g(M)&&M&&M.Object===Object&&M,P="object"==("undefined"==typeof self?"undefined":g(self))&&self&&self.Object===Object&&self,D=N||P||Function("return this")(),L=D.Symbol,R=Object.prototype,B=R.hasOwnProperty,F=R.toString,z=L?L.toStringTag:void 0,G=Object.prototype.toString,Y=L?L.toStringTag:void 0,U=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Y&&Y in Object(t)?function(t){var e=B.call(t,z),n=t[z];try{t[z]=void 0;var r=!0}catch(t){}var i=F.call(t);return r&&(e?t[z]=n:delete t[z]),i}(t):function(t){return G.call(t)}(t)},X=function(t){var e=g(t);return null!=t&&("object"==e||"function"==e)},W=function(t){if(!X(t))return!1;var e=U(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},V=D["__core-js_shared__"],H=(I=/[^.]+$/.exec(V&&V.keys&&V.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"",q=Function.prototype.toString,Z=function(t){if(null!=t){try{return q.call(t)}catch(t){}try{return t+""}catch(t){}}return""},K=/^\[object .+?Constructor\]$/,Q=Function.prototype,$=Object.prototype,J=Q.toString,tt=$.hasOwnProperty,et=RegExp("^"+J.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=function(t){return!(!X(t)||function(t){return!!H&&H in t}(t))&&(W(t)?et:K).test(Z(t))},rt=function(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return nt(n)?n:void 0},it=rt(D,"Map"),ot=rt(Object,"create"),at=Object.prototype.hasOwnProperty,st=Object.prototype.hasOwnProperty;function ut(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991},Nt={};Nt["[object Float32Array]"]=Nt["[object Float64Array]"]=Nt["[object Int8Array]"]=Nt["[object Int16Array]"]=Nt["[object Int32Array]"]=Nt["[object Uint8Array]"]=Nt["[object Uint8ClampedArray]"]=Nt["[object Uint16Array]"]=Nt["[object Uint32Array]"]=!0,Nt["[object Arguments]"]=Nt["[object Array]"]=Nt["[object ArrayBuffer]"]=Nt["[object Boolean]"]=Nt["[object DataView]"]=Nt["[object Date]"]=Nt["[object Error]"]=Nt["[object Function]"]=Nt["[object Map]"]=Nt["[object Number]"]=Nt["[object Object]"]=Nt["[object RegExp]"]=Nt["[object Set]"]=Nt["[object String]"]=Nt["[object WeakMap]"]=!1;var Pt=function(t){return function(e){return t(e)}},Dt=O((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,i=r&&r.exports===n&&N.process,o=function(){try{return r&&r.require&&r.require("util").types||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=o})),Lt=Dt&&Dt.isTypedArray,Rt=Lt?Pt(Lt):function(t){return wt(t)&&Tt(t.length)&&!!Nt[U(t)]},Bt=Object.prototype.hasOwnProperty,Ft=function(t,e){var n=kt(t),r=!n&&Ot(t),i=!n&&!r&&Ct(t),o=!n&&!r&&!i&&Rt(t),a=n||r||i||o,s=a?function(t,e){for(var n=-1,r=Array(t);++ns))return!1;var c=o.get(t),l=o.get(e);if(c&&l)return c==e&&l==t;var f=-1,h=!0,d=2&n?new qe:void 0;for(o.set(t,e),o.set(e,t);++f0&&r(u)?n>1?t(u,n-1,r,i,o):ie(o,u):i||(o[o.length]=u)}return o},sr=function(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)},ur=Math.max,cr=function(t,e,n){return e=ur(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=ur(r.length-e,0),a=Array(o);++i0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(lr),dr=function(t,e){return hr(cr(t,e,Ye),t+"")},pr=function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o-1},yr=function(t,e,n){for(var r=-1,i=null==t?0:t.length;++r=200){var c=e?null:mr(t);if(c)return Je(c);a=!1,i=Ke,u=new qe}else u=e?[]:s;t:for(;++ro){var a=i;i=o,o=a}return i+""+o+""+(_r.isUndefined(r)?"\0":r)}function Ar(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return r&&(s.name=r),s}function Cr(t,e){return kr(t,e.v,e.w,e.name)}Sr.prototype._nodeCount=0,Sr.prototype._edgeCount=0,Sr.prototype.isDirected=function(){return this._isDirected},Sr.prototype.isMultigraph=function(){return this._isMultigraph},Sr.prototype.isCompound=function(){return this._isCompound},Sr.prototype.setGraph=function(t){return this._label=t,this},Sr.prototype.graph=function(){return this._label},Sr.prototype.setDefaultNodeLabel=function(t){return _r.isFunction(t)||(t=_r.constant(t)),this._defaultNodeLabelFn=t,this},Sr.prototype.nodeCount=function(){return this._nodeCount},Sr.prototype.nodes=function(){return _r.keys(this._nodes)},Sr.prototype.sources=function(){var t=this;return _r.filter(this.nodes(),(function(e){return _r.isEmpty(t._in[e])}))},Sr.prototype.sinks=function(){var t=this;return _r.filter(this.nodes(),(function(e){return _r.isEmpty(t._out[e])}))},Sr.prototype.setNodes=function(t,e){var n=arguments,r=this;return _r.each(t,(function(t){n.length>1?r.setNode(t,e):r.setNode(t)})),this},Sr.prototype.setNode=function(t,e){return _r.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},Sr.prototype.node=function(t){return this._nodes[t]},Sr.prototype.hasNode=function(t){return _r.has(this._nodes,t)},Sr.prototype.removeNode=function(t){var e=this;if(_r.has(this._nodes,t)){var n=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],_r.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),_r.each(_r.keys(this._in[t]),n),delete this._in[t],delete this._preds[t],_r.each(_r.keys(this._out[t]),n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},Sr.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(_r.isUndefined(e))e="\0";else{for(var n=e+="";!_r.isUndefined(n);n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},Sr.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},Sr.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if("\0"!==e)return e}},Sr.prototype.children=function(t){if(_r.isUndefined(t)&&(t="\0"),this._isCompound){var e=this._children[t];if(e)return _r.keys(e)}else{if("\0"===t)return this.nodes();if(this.hasNode(t))return[]}},Sr.prototype.predecessors=function(t){var e=this._preds[t];if(e)return _r.keys(e)},Sr.prototype.successors=function(t){var e=this._sucs[t];if(e)return _r.keys(e)},Sr.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return _r.union(e,this.successors(t))},Sr.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},Sr.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var n=this;_r.each(this._nodes,(function(n,r){t(r)&&e.setNode(r,n)})),_r.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,n.edge(t))}));var r={};return this._isCompound&&_r.each(e.nodes(),(function(t){e.setParent(t,function t(i){var o=n.parent(i);return void 0===o||e.hasNode(o)?(r[i]=o,o):o in r?r[o]:t(o)}(t))})),e},Sr.prototype.setDefaultEdgeLabel=function(t){return _r.isFunction(t)||(t=_r.constant(t)),this._defaultEdgeLabelFn=t,this},Sr.prototype.edgeCount=function(){return this._edgeCount},Sr.prototype.edges=function(){return _r.values(this._edgeObjs)},Sr.prototype.setPath=function(t,e){var n=this,r=arguments;return _r.reduce(t,(function(t,i){return r.length>1?n.setEdge(t,i,e):n.setEdge(t,i),i})),this},Sr.prototype.setEdge=function(){var t,e,n,r,i=!1,o=arguments[0];"object"==g(o)&&null!==o&&"v"in o?(t=o.v,e=o.w,n=o.name,2===arguments.length&&(r=arguments[1],i=!0)):(t=o,e=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),t=""+t,e=""+e,_r.isUndefined(n)||(n=""+n);var a=kr(this._isDirected,t,e,n);if(_r.has(this._edgeLabels,a))return i&&(this._edgeLabels[a]=r),this;if(!_r.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=i?r:this._defaultEdgeLabelFn(t,e,n);var s=Ar(this._isDirected,t,e,n);return t=s.v,e=s.w,Object.freeze(s),this._edgeObjs[a]=s,Mr(this._preds[e],t),Mr(this._sucs[t],e),this._in[e][a]=s,this._out[t][a]=s,this._edgeCount++,this},Sr.prototype.edge=function(t,e,n){var r=1===arguments.length?Cr(this._isDirected,arguments[0]):kr(this._isDirected,t,e,n);return this._edgeLabels[r]},Sr.prototype.hasEdge=function(t,e,n){var r=1===arguments.length?Cr(this._isDirected,arguments[0]):kr(this._isDirected,t,e,n);return _r.has(this._edgeLabels,r)},Sr.prototype.removeEdge=function(t,e,n){var r=1===arguments.length?Cr(this._isDirected,arguments[0]):kr(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],Or(this._preds[e],t),Or(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this},Sr.prototype.inEdges=function(t,e){var n=this._in[t];if(n){var r=_r.values(n);return e?_r.filter(r,(function(t){return t.v===e})):r}},Sr.prototype.outEdges=function(t,e){var n=this._out[t];if(n){var r=_r.values(n);return e?_r.filter(r,(function(t){return t.w===e})):r}},Sr.prototype.nodeEdges=function(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))};var jr={Graph:Er,version:"2.1.8"},Ir={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:Tr(t),edges:Nr(t)};return _r.isUndefined(t.graph())||(e.value=_r.clone(t.graph())),e},read:function(t){var e=new Er(t.options).setGraph(t.value);return _r.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),_r.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}};function Tr(t){return _r.map(t.nodes(),(function(e){var n=t.node(e),r=t.parent(e),i={v:e};return _r.isUndefined(n)||(i.value=n),_r.isUndefined(r)||(i.parent=r),i}))}function Nr(t){return _r.map(t.edges(),(function(e){var n=t.edge(e),r={v:e.v,w:e.w};return _r.isUndefined(e.name)||(r.name=e.name),_r.isUndefined(n)||(r.value=n),r}))}var Pr=Dr;function Dr(){this._arr=[],this._keyIndices={}}Dr.prototype.size=function(){return this._arr.length},Dr.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},Dr.prototype.has=function(t){return _r.has(this._keyIndices,t)},Dr.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},Dr.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},Dr.prototype.add=function(t,e){var n=this._keyIndices;if(t=String(t),!_r.has(n,t)){var r=this._arr,i=r.length;return n[t]=i,r.push({key:t,priority:e}),this._decrease(i),!0}return!1},Dr.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},Dr.prototype.decrease=function(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)},Dr.prototype._heapify=function(t){var e=this._arr,n=2*t,r=n+1,i=t;n>1].priority0&&(i=s.removeMin(),(o=a[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(u);return a}(t,String(e),n||Rr,r||function(e){return t.outEdges(e)})},Rr=_r.constant(1),Br=function(t){var e=0,n=[],r={},i=[];function o(a){var s=r[a]={onStack:!0,lowlink:e,index:e++};if(n.push(a),t.successors(a).forEach((function(t){_r.has(r,t)?r[t].onStack&&(s.lowlink=Math.min(s.lowlink,r[t].index)):(o(t),s.lowlink=Math.min(s.lowlink,r[t].lowlink))})),s.lowlink===s.index){var u,c=[];do{u=n.pop(),r[u].onStack=!1,c.push(u)}while(a!==u);i.push(c)}}return t.nodes().forEach((function(t){_r.has(r,t)||o(t)})),i},Fr=_r.constant(1),zr=Gr;function Gr(t){var e={},n={},r=[];if(_r.each(t.sinks(),(function i(o){if(_r.has(n,o))throw new Yr;_r.has(e,o)||(n[o]=!0,e[o]=!0,_r.each(t.predecessors(o),i),delete n[o],r.push(o))})),_r.size(e)!==t.nodeCount())throw new Yr;return r}function Yr(){}Gr.CycleException=Yr,Yr.prototype=new Error;var Ur=function(t,e,n){_r.isArray(e)||(e=[e]);var r=(t.isDirected()?t.successors:t.neighbors).bind(t),i=[],o={};return _r.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);!function t(e,n,r,i,o,a){_r.has(i,n)||(i[n]=!0,r||a.push(n),_r.each(o(n),(function(n){t(e,n,r,i,o,a)})),r&&a.push(n))}(t,e,"post"===n,o,r,i)})),i};var Xr,Wr={Graph:jr.Graph,json:Ir,alg:{components:function(t){var e,n={},r=[];function i(r){_r.has(n,r)||(n[r]=!0,e.push(r),_r.each(t.successors(r),i),_r.each(t.predecessors(r),i))}return _r.each(t.nodes(),(function(t){e=[],i(t),e.length&&r.push(e)})),r},dijkstra:Lr,dijkstraAll:function(t,e,n){return _r.transform(t.nodes(),(function(r,i){r[i]=Lr(t,i,e,n)}),{})},findCycles:function(t){return _r.filter(Br(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))},floydWarshall:function(t,e,n){return function(t,e,n){var r={},i=t.nodes();return i.forEach((function(t){r[t]={},r[t][t]={distance:0},i.forEach((function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})})),n(t).forEach((function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}}))})),i.forEach((function(t){var e=r[t];i.forEach((function(n){var o=r[n];i.forEach((function(n){var r=o[t],i=e[n],a=o[n],s=r.distance+i.distance;s0;){if(n=o.removeMin(),_r.has(i,n))r.setEdge(n,i[n]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(n).forEach(a)}return r},tarjan:Br,topsort:zr},version:jr.version};try{Xr=Wr}catch(v){}Xr||(Xr=window.graphlib);var Vr,Hr=Xr,qr=function(t,e,n){if(!X(n))return!1;var r=g(e);return!!("number"==r?Vt(n)&&It(e,n.length):"string"==r&&e in n)&&k(n[e],t)},Zr=Object.prototype,Kr=Zr.hasOwnProperty,Qr=dr((function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&qr(e[0],e[1],i)&&(r=1);++n-1?i[o?e[a]:a]:void 0}}((function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:function(t){var e=ri(t),n=e%1;return e==e?n?e-n:e:0}(n);return i<0&&(i=ii(r+i,0)),pr(t,Pn(e),i)})),ai=function(t){return null!=t&&t.length?ar(t,1):[]},si=function(t,e,n){for(var r=-1,i=t.length;++re},ci=function(t,e,n){(void 0!==n&&!k(t[e],n)||void 0===n&&!(e in t))&&yt(t,e,n)},li=Function.prototype,fi=Object.prototype,hi=li.toString,di=fi.hasOwnProperty,pi=hi.call(Object),gi=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},vi=function(t,e,n,r,i,o,a){var s=gi(t,n),u=gi(e,n),c=a.get(u);if(c)ci(t,n,c);else{var l=o?o(s,u,n+"",t,e,a):void 0,f=void 0===l;if(f){var h=kt(u),d=!h&&Ct(u),p=!h&&!d&&Rt(u);l=u,h||d||p?kt(s)?l=s:br(s)?l=$t(s):d?(f=!1,l=Qt(u,!0)):p?(f=!1,l=ke(u,!0)):l=[]:function(t){if(!wt(t)||"[object Object]"!=U(t))return!1;var e=oe(t);if(null===e)return!0;var n=di.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&hi.call(n)==pi}(u)||Ot(u)?(l=s,Ot(s)?l=function(t){return xt(t,Kt(t))}(s):X(s)&&!W(s)||(l=Ie(u))):f=!1}f&&(a.set(u,l),i(l,u,r,o,a),a.delete(u)),ci(t,n,l)}},yi=function(t){return dr((function(e,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,a&&qr(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++re||o&&a&&u&&!s&&!c||r&&a&&u||!n&&u||!i)return 1;if(!r&&!o&&!c&&t=s?u:u*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))},ki=dr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&qr(t,e[0],e[1])?e=[]:n>2&&qr(e[0],e[1],e[2])&&(e=[e[0]]),Oi(t,ar(e,1),[])})),Ai=0;try{Vr={cloneDeep:function(t){return Re(t,5)},constant:Be,defaults:Qr,each:We,filter:Dn,find:oi,flatten:ai,forEach:Xe,forIn:function(t,e){return null==t?t:Fe(t,Ue(e),Kt)},has:Bn,isUndefined:zn,last:function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0},map:Yn,mapValues:function(t,e){var n={};return e=Pn(e),ze(t,(function(t,r,i){yt(n,r,e(t,r,i))})),n},max:function(t){return t&&t.length?si(t,Ye,ui):void 0},merge:yi,min:function(t){return t&&t.length?si(t,Ye,mi):void 0},minBy:function(t,e){return t&&t.length?si(t,Pn(e),mi):void 0},now:function(){return D.Date.now()},pick:wi,range:Si,reduce:Wn,sortBy:ki,uniqueId:function(t){var e=++Ai;return Sn(t)+e},values:wr,zipObject:function(t,e){return function(t,e,n){for(var r=-1,i=t.length,o=e.length,a={};++r0;--s)if(r=e[s].dequeue()){i=i.concat(Li(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return Ci.flatten(Ci.map(r,(function(e){return t.outEdges(e.v,e.w)})),!0)}(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],n={},r={};return Ci.forEach(t.nodes(),(function i(o){Ci.has(r,o)||(r[o]=!0,n[o]=!0,Ci.forEach(t.outEdges(o),(function(t){Ci.has(n,t.w)?e.push(t):i(t.w)})),delete n[o])})),e}(t);Ci.forEach(e,(function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,Ci.uniqueId("rev"))}))},Fi=function(t){Ci.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))},zi=Hr.Graph,Gi={addDummyNode:Yi,simplify:function(t){var e=(new zi).setGraph(t.graph());return Ci.forEach(t.nodes(),(function(n){e.setNode(n,t.node(n))})),Ci.forEach(t.edges(),(function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),e},asNonCompoundGraph:function(t){var e=new zi({multigraph:t.isMultigraph()}).setGraph(t.graph());return Ci.forEach(t.nodes(),(function(n){t.children(n).length||e.setNode(n,t.node(n))})),Ci.forEach(t.edges(),(function(n){e.setEdge(n,t.edge(n))})),e},successorWeights:function(t){var e=Ci.map(t.nodes(),(function(e){var n={};return Ci.forEach(t.outEdges(e),(function(e){n[e.w]=(n[e.w]||0)+t.edge(e).weight})),n}));return Ci.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=Ci.map(t.nodes(),(function(e){var n={};return Ci.forEach(t.inEdges(e),(function(e){n[e.v]=(n[e.v]||0)+t.edge(e).weight})),n}));return Ci.zipObject(t.nodes(),e)},intersectRect:function(t,e){var n,r,i=t.x,o=t.y,a=e.x-i,s=e.y-o,u=t.width/2,c=t.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*u>Math.abs(a)*c?(s<0&&(c=-c),n=c*a/s,r=c):(a<0&&(u=-u),n=u,r=u*s/a),{x:i+n,y:o+r}},buildLayerMatrix:function(t){var e=Ci.map(Ci.range(Ui(t)+1),(function(){return[]}));return Ci.forEach(t.nodes(),(function(n){var r=t.node(n),i=r.rank;Ci.isUndefined(i)||(e[i][r.order]=n)})),e},normalizeRanks:function(t){var e=Ci.min(Ci.map(t.nodes(),(function(e){return t.node(e).rank})));Ci.forEach(t.nodes(),(function(n){var r=t.node(n);Ci.has(r,"rank")&&(r.rank-=e)}))},removeEmptyRanks:function(t){var e=Ci.min(Ci.map(t.nodes(),(function(e){return t.node(e).rank}))),n=[];Ci.forEach(t.nodes(),(function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)}));var r=0,i=t.graph().nodeRankFactor;Ci.forEach(n,(function(e,n){Ci.isUndefined(e)&&n%i!=0?--r:r&&Ci.forEach(e,(function(e){t.node(e).rank+=r}))}))},addBorderNode:function(t,e,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),Yi(t,"border",i,e)},maxRank:Ui,partition:function(t,e){var n={lhs:[],rhs:[]};return Ci.forEach(t,(function(t){e(t)?n.lhs.push(t):n.rhs.push(t)})),n},time:function(t,e){var n=Ci.now();try{return e()}finally{console.log(t+" time: "+(Ci.now()-n)+"ms")}},notime:function(t,e){return e()}};function Yi(t,e,n,r){var i;do{i=Ci.uniqueId(r)}while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i}function Ui(t){return Ci.max(Ci.map(t.nodes(),(function(e){var n=t.node(e).rank;if(!Ci.isUndefined(n))return n})))}var Xi=function(t){t.graph().dummyChains=[],Ci.forEach(t.edges(),(function(e){!function(t,e){var n,r,i,o=e.v,a=t.node(o).rank,s=e.w,u=t.node(s).rank,c=e.name,l=t.edge(e),f=l.labelRank;if(u!==a+1){for(t.removeEdge(e),i=0,++a;aa.lim&&(s=a,u=!0);var c=Ci.filter(e.edges(),(function(e){return u===go(t,t.node(e.v),s)&&u!==go(t,t.node(e.w),s)}));return Ci.minBy(c,(function(t){return to(e,t)}))}function po(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),co(t),so(t,e),function(t,e){var n=Ci.find(t.nodes(),(function(t){return!e.node(t).parent})),r=no(t,n);r=r.slice(1),Ci.forEach(r,(function(n){var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)}))}(t,e)}function go(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}ao.initLowLimValues=co,ao.initCutValues=so,ao.calcCutValue=uo,ao.leaveEdge=fo,ao.enterEdge=ho,ao.exchangeEdges=po;var vo=Vi,yo=vo;function mo(t){oo(t)}var bo=function(t){var e=Gi.addDummyNode(t,"root",{},"_root"),n=function(t){var e={};function n(r,i){var o=t.children(r);o&&o.length&&Ci.forEach(o,(function(t){n(t,i+1)})),e[r]=i}return Ci.forEach(t.children(),(function(t){n(t,1)})),e}(t),r=Ci.max(Ci.values(n))-1,i=2*r+1;t.graph().nestingRoot=e,Ci.forEach(t.edges(),(function(e){t.edge(e).minlen*=i}));var o=function(t){return Ci.reduce(t.edges(),(function(e,n){return e+t.edge(n).weight}),0)}(t)+1;Ci.forEach(t.children(),(function(a){!function t(e,n,r,i,o,a,s){var u=e.children(s);if(u.length){var c=Gi.addBorderNode(e,"_bt"),l=Gi.addBorderNode(e,"_bb"),f=e.node(s);e.setParent(c,s),f.borderTop=c,e.setParent(l,s),f.borderBottom=l,Ci.forEach(u,(function(u){t(e,n,r,i,o,a,u);var f=e.node(u),h=f.borderTop?f.borderTop:u,d=f.borderBottom?f.borderBottom:u,p=f.borderTop?i:2*i,g=h!==d?1:o-a[s]+1;e.setEdge(c,h,{weight:p,minlen:g,nestingEdge:!0}),e.setEdge(d,l,{weight:p,minlen:g,nestingEdge:!0})})),e.parent(s)||e.setEdge(n,c,{weight:0,minlen:o+a[s]})}else s!==n&&e.setEdge(n,s,{weight:0,minlen:r})}(t,e,i,o,r,n,a)})),t.graph().nodeRankFactor=i},xo=function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,Ci.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))};function wo(t,e,n,r,i,o){var a={width:0,height:0,rank:o,borderType:e},s=i[e][o-1],u=Gi.addDummyNode(t,"border",a,n);i[e][o]=u,t.setParent(u,r),s&&t.setEdge(s,u,{weight:1})}var _o=function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||So(t)},Eo=function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){Ci.forEach(t.nodes(),(function(e){Oo(t.node(e))})),Ci.forEach(t.edges(),(function(e){var n=t.edge(e);Ci.forEach(n.points,Oo),Ci.has(n,"y")&&Oo(n)}))}(t),"lr"!==e&&"rl"!==e||(function(t){Ci.forEach(t.nodes(),(function(e){ko(t.node(e))})),Ci.forEach(t.edges(),(function(e){var n=t.edge(e);Ci.forEach(n.points,ko),Ci.has(n,"x")&&ko(n)}))}(t),So(t))};function So(t){Ci.forEach(t.nodes(),(function(e){Mo(t.node(e))})),Ci.forEach(t.edges(),(function(e){Mo(t.edge(e))}))}function Mo(t){var e=t.width;t.width=t.height,t.height=e}function Oo(t){t.y=-t.y}function ko(t){var e=t.x;t.x=t.y,t.y=e}var Ao=function(t,e){for(var n=0,r=1;r0;)e%2&&(n+=s[e+1]),s[e=e-1>>1]+=t.weight;u+=t.weight*n}))),u}function jo(t,e,n){for(var r;e.length&&(r=Ci.last(e)).i<=n;)e.pop(),t.push(r.vs),n++;return n}var Io=function t(e,n,r,i){var o=e.children(n),a=e.node(n),s=a?a.borderLeft:void 0,u=a?a.borderRight:void 0,c={};s&&(o=Ci.filter(o,(function(t){return t!==s&&t!==u})));var l=function(t,e){return Ci.map(e,(function(e){var n=t.inEdges(e);if(n.length){var r=Ci.reduce(n,(function(e,n){var r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}}),{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}}))}(e,o);Ci.forEach(l,(function(n){if(e.children(n.v).length){var o=t(e,n.v,r,i);c[n.v]=o,Ci.has(o,"barycenter")&&(a=n,s=o,Ci.isUndefined(a.barycenter)?(a.barycenter=s.barycenter,a.weight=s.weight):(a.barycenter=(a.barycenter*a.weight+s.barycenter*s.weight)/(a.weight+s.weight),a.weight+=s.weight))}var a,s}));var f=function(t,e){var n={};return Ci.forEach(t,(function(t,e){var r=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};Ci.isUndefined(t.barycenter)||(r.barycenter=t.barycenter,r.weight=t.weight)})),Ci.forEach(e.edges(),(function(t){var e=n[t.v],r=n[t.w];Ci.isUndefined(e)||Ci.isUndefined(r)||(r.indegree++,e.out.push(n[t.w]))})),function(t){var e=[];function n(t){return function(e){e.merged||(Ci.isUndefined(e.barycenter)||Ci.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&function(t,e){var n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function r(e){return function(n){n.in.push(e),0==--n.indegree&&t.push(n)}}for(;t.length;){var i=t.pop();e.push(i),Ci.forEach(i.in.reverse(),n(i)),Ci.forEach(i.out,r(i))}return Ci.map(Ci.filter(e,(function(t){return!t.merged})),(function(t){return Ci.pick(t,["vs","i","barycenter","weight"])}))}(Ci.filter(n,(function(t){return!t.indegree})))}(l,r);!function(t,e){Ci.forEach(t,(function(t){t.vs=Ci.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(f,c);var h=function(t,e){var n,r=Gi.partition(t,(function(t){return Ci.has(t,"barycenter")})),i=r.lhs,o=Ci.sortBy(r.rhs,(function(t){return-t.i})),a=[],s=0,u=0,c=0;i.sort((n=!!e,function(t,e){return t.barycentere.barycenter?1:n?e.i-t.i:t.i-e.i})),c=jo(a,o,c),Ci.forEach(i,(function(t){c+=t.vs.length,a.push(t.vs),s+=t.barycenter*t.weight,u+=t.weight,c=jo(a,o,c)}));var l={vs:Ci.flatten(a,!0)};return u&&(l.barycenter=s/u,l.weight=u),l}(f,i);if(s&&(h.vs=Ci.flatten([s,h.vs,u],!0),e.predecessors(s).length)){var d=e.node(e.predecessors(s)[0]),p=e.node(e.predecessors(u)[0]);Ci.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+d.order+p.order)/(h.weight+2),h.weight+=2}return h},To=Hr.Graph,No=Hr.Graph,Po=function(t){var e=Gi.maxRank(t),n=Do(t,Ci.range(1,e+1),"inEdges"),r=Do(t,Ci.range(e-1,-1,-1),"outEdges"),i=function(t){var e={},n=Ci.filter(t.nodes(),(function(e){return!t.children(e).length})),r=Ci.max(Ci.map(n,(function(e){return t.node(e).rank}))),i=Ci.map(Ci.range(r+1),(function(){return[]}));var o=Ci.sortBy(n,(function(e){return t.node(e).rank}));return Ci.forEach(o,(function n(r){if(!Ci.has(e,r)){e[r]=!0;var o=t.node(r);i[o.rank].push(r),Ci.forEach(t.successors(r),n)}})),i}(t);Ro(t,i);for(var o,a=Number.POSITIVE_INFINITY,s=0,u=0;u<4;++s,++u){Lo(s%2?n:r,s%4>=2),i=Gi.buildLayerMatrix(t);var c=Ao(t,i);cn){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function zo(t,e,n){if(e>n){var r=e;e=n,n=r}return Ci.has(t[e],n)}var Go=function(t){var e,n=Gi.buildLayerMatrix(t),r=Ci.merge(function(t,e){var n={};return Ci.reduce(e,(function(e,r){var i=0,o=0,a=e.length,s=Ci.last(r);return Ci.forEach(r,(function(e,u){var c=function(t,e){if(t.node(e).dummy)return Ci.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),l=c?t.node(c).order:a;(c||e===s)&&(Ci.forEach(r.slice(o,u+1),(function(e){Ci.forEach(t.predecessors(e),(function(r){var o=t.node(r),a=o.order;!(aa)&&Fo(n,e,s)}))}))}return Ci.reduce(e,(function(e,n){var i,o=-1,a=0;return Ci.forEach(n,(function(s,u){if("border"===t.node(s).dummy){var c=t.predecessors(s);c.length&&(i=t.node(c[0]).order,r(n,a,u,o,i),a=u,o=i)}r(n,a,n.length,i,e.length)})),n})),n}(t,n)),i={};Ci.forEach(["u","d"],(function(o){e="u"===o?n:Ci.values(n).reverse(),Ci.forEach(["l","r"],(function(n){"r"===n&&(e=Ci.map(e,(function(t){return Ci.values(t).reverse()})));var a=("u"===o?t.predecessors:t.successors).bind(t),s=function(t,e,n,r){var i={},o={},a={};return Ci.forEach(e,(function(t){Ci.forEach(t,(function(t,e){i[t]=t,o[t]=t,a[t]=e}))})),Ci.forEach(e,(function(t){var e=-1;Ci.forEach(t,(function(t){var s=r(t);if(s.length)for(var u=((s=Ci.sortBy(s,(function(t){return a[t]}))).length-1)/2,c=Math.floor(u),l=Math.ceil(u);c<=l;++c){var f=s[c];o[t]===t&&eu||c>e[i].lim));for(o=i,i=r;(i=t.parent(i))!==o;)s.push(i);return{path:a.concat(s.reverse()),lca:o}}(t,e,i.v,i.w),a=o.path,s=o.lca,u=0,c=a[u],l=!0;n!==i.w;){if(r=t.node(n),l){for(;(c=a[u])!==s&&t.node(c).maxRank1&&void 0!==arguments[1]?arguments[1]:{};p(this,t),this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=x.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=b.META,this.path=[],this.name=e,this.metaGraph=ha(e,w.META,n)}return d(t,[{key:"getFirstChild",value:function(){return this.metaGraph.node(this.metaGraph.nodes()[0])}},{key:"getChildren",value:function(){var t=this;return this.metaGraph.nodes().map((function(e){return t.metaGraph.node(e)}))}},{key:"leaves",value:function(){for(var t,e=[],n=[this];n.length;){var r=n.shift();r.isGroupNode?(t=r.metaGraph).nodes().forEach((function(e){return n.push(t.node(e))})):e.push(r.name)}return e}}]),t}(),ca=function(){function t(e,n){p(this,t),this.v=e,this.w=n,this.baseEdgeList=[],this.inbound=null,this.name=null}return d(t,[{key:"addBaseEdge",value:function(t,e){this.baseEdgeList.push(t)}}]),t}();function la(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new ua(t,e)}function fa(t,e){return new ca(t,e)}function ha(t,e,n){var r=n||{},i=new ia.Graph(r);return i.setGraph({name:t,rankdir:r.rankdir,type:e,align:r.align}),i}var da=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};p(this,t),this.graphOptions=e,this.index={},this.graphOptions.compound=!0,this.root=la(E,this.graphOptions),this.index[E]=this.root}return d(t,[{key:"getNodeMap",value:function(){return this.index}},{key:"node",value:function(t){return this.index[t]}},{key:"setNode",value:function(t,e){this.index[t]=e}},{key:"getBridgeGraph",value:function(t){var e=this,n=this.index[t];if(!n)throw Error("Could not find node in hierarchy: "+t);if(!("metaGraph"in n))return null;var r=n;if(r.bridgeGraph)return r.bridgeGraph;var i=ha(S,w.BRIDGE,this.graphOptions);if(r.bridgeGraph=i,!n.parentNode||!("metaGraph"in n.parentNode))return i;var o=n.parentNode;return[o.metaGraph,this.getBridgeGraph(o.name)].forEach((function(n){n.edges().filter((function(e){return e.v===t||e.w===t})).forEach((function(r){var o=r.w===t;n.edge(r).baseEdgeList.forEach((function(n){var a=c(o?[n.w,r.v]:[n.v,r.w],2),s=a[0],u=a[1],l=e.getChildName(t,s),f={v:o?u:l,w:o?l:u},h=i.edge(f);h||((h=fa(f.v,f.w)).inbound=o,i.setEdge(f.v,f.w,h)),h.addBaseEdge(n,e)}))}))})),i}},{key:"getChildName",value:function(t,e){for(var n=this.index[e];n;){if(n.parentNode&&n.parentNode.name===t)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+e)}},{key:"getPredecessors",value:function(t){var e=this.index[t];if(!e)throw Error("Could not find node with name: "+t);return this.getOneWayEdges(e,!0)}},{key:"getSuccessors",value:function(t){var e=this.index[t];if(!e)throw Error("Could not find node with name: "+t);return this.getOneWayEdges(e,!1)}},{key:"getOneWayEdges",value:function(t,e){var n=[];if(!t.parentNode||!t.parentNode.isGroupNode)return n;var r=t.parentNode,i=r.metaGraph,o=this.getBridgeGraph(r.name);return pa(i,t,e,n),pa(o,t,e,n),n}}]),t}();function pa(t,e,n,r){(n?t.inEdges(e.name):t.outEdges(e.name)).forEach((function(e){var n=t.edge(e);r.push(n)}))}var ga=function(){function t(e){p(this,t),this.hierarchy=e,this.index={},this.hasSubHierarchy={},this.root=new ma(this.hierarchy.root,this.hierarchy.graphOptions),this.index[e.root.name]=this.root,this.buildSubHierarchy(e.root.name),this.root.expanded=!0}return d(t,[{key:"getRenderInfoNodes",value:function(){return Object.values(this.index)}},{key:"getSubHierarchy",value:function(){return this.hasSubHierarchy}},{key:"buildSubHierarchy",value:function(t){var e=this;if(!(t in this.hasSubHierarchy)){this.hasSubHierarchy[t]=!0;var n=this.index[t];if(n.node.type===b.META){var r=n,i=r.node.metaGraph,o=r.coreGraph;i.nodes().forEach((function(t){var n=e.getOrCreateRenderNodeByName(t);o.setNode(t,n)})),i.edges().forEach((function(t){var e=i.edge(t),n=new ya(e);o.setEdge(t.v,t.w,n)}));var a=r.node.parentNode;if(a){var s=this.getRenderNodeByName(a.name),u=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r1&&void 0!==arguments[1]&&arguments[1];if(t.coreBox.width=t.width,t.coreBox.height=t.height,!e){var n="".concat(t.displayName).length,r=3;t.width=Math.max(t.coreBox.width,n*r)}}(t,e&&(0===t.node.type&&!!(null===(i=null===(r=null==e?void 0:e.nodeSize)||void 0===r?void 0:r.meta)||void 0===i?void 0:i.width)||1===t.node.type&&(!!(null===(a=null===(o=null==e?void 0:e.nodeSize)||void 0===o?void 0:o.node)||void 0===a?void 0:a.width)||!!f.width)||2===t.node.type&&!!(null===(u=null===(s=null==e?void 0:e.nodeSize)||void 0===s?void 0:s.bridge)||void 0===u?void 0:u.width)))}}))}(t,e),t.node.type===b.META&&function(t,e){var n=y(e),r=n.subScene.meta;Object.assign(t,r);var i=n.graph.meta,o={nodesep:i.nodeSep,ranksep:i.rankSep,edgesep:i.edgeSep,align:i.align};Object.assign(t.coreBox,function(t,e){var n=e.ranksep,r=e.nodesep,i=e.edgesep,o=e.align;Object.assign(t.graph(),{ranksep:n,nodesep:r,edgesep:i,align:o});var a=[];if(t.nodes().forEach((function(e){t.node(e).node.type!==b.BRIDGE&&a.push(e)})),!a.length)return{width:0,height:0};oa(t);var s=1/0,u=1/0,c=-1/0,l=-1/0;return a.forEach((function(e){var n=t.node(e),r=.5*n.width,i=n.x-r,o=n.x+r;s=ic?o:c;var a=.5*n.height,f=n.y-a,h=n.y+a;u=fl?h:l})),t.edges().forEach((function(e){var n=t.edge(e),r=t.node(n.metaEdge.v),i=t.node(n.metaEdge.w);if(3===n.points.length&&function(t){for(var e=xa(t[0],t[1]),n=1;n1)return!1;e=r}return!0}(n.points)){if(null!=r){var o=r.expanded?r.x:wa(r);n.points[0].x=o}if(null!=i){var a=i.expanded?i.x:wa(i);n.points[2].x=a}n.points=[n.points[0],n.points[1]]}var f=n.points[n.points.length-2];null!=i&&(n.points[n.points.length-1]=_a(f,i));var h=n.points[1];null!=r&&(n.points[0]=_a(h,r)),n.points.forEach((function(t){s=t.xc?t.x:c,u=t.yl?t.y:l}))})),t.nodes().forEach((function(e){var n=t.node(e);n.x-=s,n.y-=u})),t.edges().forEach((function(e){t.edge(e).points.forEach((function(t){t.x-=s,t.y-=u}))})),{width:c-s,height:l-u}}(t.coreGraph,o));var a=0;t.coreGraph.nodeCount()>0&&a++;var s=a<=1?0:a;t.coreBox.width+=s+s,t.coreBox.height=r.labelHeight+t.coreBox.height,t.width=t.coreBox.width+r.paddingLeft+r.paddingRight,t.height=t.paddingTop+t.coreBox.height+t.paddingBottom}(t,e)}function xa(t,e){var n=e.x-t.x,r=e.y-t.y;return 180*Math.atan(r/n)/Math.PI}function wa(t){return t.expanded?t.x:t.x-t.width/2+0+t.coreBox.width/2}function _a(t,e){var n,r,i=e.expanded?e.x:wa(e),o=e.y,a=t.x-i,s=t.y-o,u=e.expanded?e.width:e.coreBox.width,c=e.expanded?e.height:e.coreBox.height;return Math.abs(s)*u/2>Math.abs(a)*c/2?(s<0&&(c=-c),n=0===s?0:c/2*a/s,r=c/2):(a<0&&(u=-u),n=u/2,r=0===a?0:u/2*s/a),{x:i+n,y:o+r}}function Ea(t,e,n){var o,a,s,u,l=t.nodes.filter((function(t,e,n){return n.findIndex((function(e){return e.id===t.id}))!==e})).map((function(t){return t.id}));if(l.length)throw new Error("Duplicated ids found: ".concat(l.join(", ")));var f=function(t){var e={nodes:[]},n=t.compound,r=Object.keys(n||{}),o=new Map,a=function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(o.has(e))return o.get(e);for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:[];if(0===Object.keys(e).length)return i(new Set(o));var a,s=new Map(Object.keys(e).map((function(t){return[t,e[t]]}))),u={},l=r(s);try{for(l.s();!(a=l.n()).done;){var f=c(a.value,2),h=f[0],d=f[1];n(h,s)?u[h]=d:o=o.concat(h,d)}}catch(t){l.e(t)}finally{l.f()}return t(u,o)}(t).filter((function(t){return e.includes(t)}))}(t.compound||{},(null==e?void 0:e.expanded)||[]),d=function(t,e){return function(t){return new ga(t)}(function(t,e){var n=e.rankDirection,r=e.align,i=new da({rankdir:n,align:r});return function(t,e){Object.keys(e.nodes).forEach((function(n){var r=e.nodes[n],i=r.path,o=t.root;o.depth=Math.max(i.length,o.depth);for(var a=0;a1&&void 0!==arguments[1]&&arguments[1],n=JSON.parse(JSON.stringify(t)),r={nodes:[n],edges:i(n.edges)};return n.nodes.forEach((function t(e){(0===e.type||1===e.type)&&r.nodes.push(e),0===e.type&&(r.edges=r.edges.concat(e.edges)),Array.isArray(e.nodes)&&e.nodes.forEach(t)})),e&&r.nodes.forEach((function(t){var e=r.nodes.find((function(e){return e.id===t.parentNodeName}));if(e){var n=e.x-e.width/2+e.paddingLeft,i=e.y-e.height/2+e.labelHeight+e.paddingTop;e.id!==E&&(t.x+=n,t.y+=i),0===t.type&&t.edges.forEach((function(e){e.points.forEach((function(e){e.x+=t.x-t.width/2+t.paddingLeft,e.y+=t.y-t.height/2+t.labelHeight+t.paddingTop}))}))}})),r}function Ma(t,e,n,r){var o,a,s=[],u=(null===(o=n.find((function(e){return e.id===t})))||void 0===o?void 0:o.path)||[],c=(null===(a=n.find((function(t){return t.id===e})))||void 0===a?void 0:a.path)||[],l=[E].concat(i(u)).slice(0,u.length).reverse(),f=[E].concat(i(c)).slice(0,c.length);return l.forEach((function(i){var o=n.find((function(t){return t.id===i}));s=s.concat(o.edges.filter((function(n){return n.baseEdgeList.some((function(n){return n.v===((null==r?void 0:r.v)||t)&&n.w===((null==r?void 0:r.w)||e)}))})))})),f.filter((function(t){return!l.includes(t)})).forEach((function(i){var o=n.find((function(t){return t.id===i}));s=s.concat(o.edges.filter((function(n){return n.baseEdgeList.some((function(n){return n.v===((null==r?void 0:r.v)||t)&&n.w===((null==r?void 0:r.w)||e)}))})))})),s}function Oa(t){var e,n=t.coreGraph.nodes().map((function(e){return t.coreGraph.node(e)}));return Object.assign(Object.assign({},ka(t)),{expanded:t.expanded,nodes:t.expanded?(e=n,e.map((function(t){return t.node.type===b.META?Oa(t):ka(t)}))):[],edges:t.expanded?Aa(t):[]})}function ka(t){return{id:t.node.name,name:t.node.name,type:t.node.type,cardinality:t.node.cardinality,attr:t.attr,parentNodeName:t.node.parentNode?t.node.parentNode.name:null,coreBox:Object.assign({},t.coreBox),x:t.x,y:t.y,width:t.width,height:t.height,radius:t.radius,labelHeight:t.labelHeight,labelOffset:t.labelOffset,outboxWidth:t.outboxWidth,paddingLeft:t.paddingLeft,paddingTop:t.paddingTop,paddingRight:t.paddingRight,paddingBottom:t.paddingBottom,path:t.node.path}}function Aa(t){return t.coreGraph.edges().map((function(e){return{renderInfoEdge:t.coreGraph.edge(e),edge:e}})).filter((function(t){return t.renderInfoEdge.metaEdge})).map((function(e){var n=e.edge,r=e.renderInfoEdge,i=function(t,e){var n=e.points.map((function(t){return Object.assign({},t)}));if(e.adjoiningMetaEdge){var r=e.adjoiningMetaEdge.points,i=e.metaEdge.inbound,o=i?r[r.length-1]:r[0],a=n[i?0:n.length-1],s=t.x-t.width/2,u=t.y-t.height/2,c=o.x-s,l=o.y-u,f=-t.paddingLeft,h=-(t.paddingTop+t.labelHeight);a.x=c+f,a.y=l+h}return n}(t,r);return{adjoiningEdge:r.adjoiningMetaEdge?{w:r.adjoiningMetaEdge.metaEdge.w,v:r.adjoiningMetaEdge.metaEdge.v}:null,inbound:r.metaEdge.inbound,w:n.w,v:n.v,points:i,weight:r.weight,baseEdgeList:r.metaEdge.baseEdgeList,parentNodeName:t.node.name}}))}}.call(this,n(91))},function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.RadialLayout=void 0;var a=n(15),s=n(18),u=o(n(184)),c=o(n(185));function l(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var f=function(t){function e(e){var n=t.call(this)||this;return n.maxIteration=1e3,n.focusNode=null,n.unitRadius=null,n.linkDistance=50,n.preventOverlap=!1,n.strictRadial=!0,n.maxPreventOverlapIteration=200,n.sortStrength=10,n.nodes=[],n.edges=[],n.updateCfg(e),n}return i(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,strictRadial:!0,maxPreventOverlapIteration:200,sortBy:void 0,sortStrength:10}},e.prototype.execute=function(){var t=this,e=t.nodes,n=t.edges||[];if(e&&0!==e.length){t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var r=t.center;if(1===e.length)return e[0].x=r[0],e[0].y=r[1],void(t.onLayoutEnd&&t.onLayoutEnd());var i=t.linkDistance,o=null;if((0,a.isString)(t.focusNode)){for(var s=!1,l=0;lr[0]?r[0]:b-r[0],_=x-r[1]>r[1]?r[1]:x-r[1];0===w&&(w=b/2),0===_&&(_=x/2);var E=_>w?w:_,S=Math.max.apply(Math,m),M=[];m.forEach((function(e,n){t.unitRadius||(t.unitRadius=E/S),M[n]=e*t.unitRadius})),t.radii=M;var O=t.eIdealDisMatrix();t.eIdealDistances=O;var k=function(t){for(var e=t.length,n=t[0].length,r=[],i=0;iI[1]?I[0]:I[1])+N(t)}:function(t){return I+N(t)}:function(t){return t.size?(0,a.isArray)(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])+N(t):(0,a.isObject)(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)+N(t):t.size+N(t):10+N(t)};var D={nodes:e,nodeSizeFunc:C,adjMatrix:g,positions:A,radii:M,height:x,width:b,strictRadial:T,focusID:p,iterations:t.maxPreventOverlapIteration||200,k:A.length/4.5},L=new c.default(D);A=L.layout()}return A.forEach((function(t,n){e[n].x=t[0]+r[0],e[n].y=t[1]+r[1]})),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:n}}t.onLayoutEnd&&t.onLayoutEnd()},e.prototype.run=function(){for(var t=this.maxIteration,e=this.positions||[],n=this.weights||[],r=this.eIdealDistances||[],i=this.radii||[],o=0;o<=t;o++){var a=o/t;this.oneIteration(a,e,i,r,n)}},e.prototype.oneIteration=function(t,e,n,r,i){var o=1-t,a=this.focusIndex;e.forEach((function(s,u){var c=l(s,[0,0]),f=0===c?0:1/c;if(u!==a){var h=0,d=0,p=0;e.forEach((function(t,e){if(u!==e){var n=l(s,t),o=0===n?0:1/n,a=r[e][u];p+=i[u][e],h+=i[u][e]*(t[0]+a*(s[0]-t[0])*o),d+=i[u][e]*(t[1]+a*(s[1]-t[1])*o)}}));var g=0===n[u]?0:1/n[u];p*=o,p+=t*g*g,h*=o,h+=t*g*s[0]*f,s[0]=h/p,d*=o,d+=t*g*s[1]*f,s[1]=d/p}}))},e.prototype.eIdealDisMatrix=function(){var t=this,e=t.nodes;if(!e)return[];var n=t.distances,r=t.linkDistance,i=t.radii||[],o=t.unitRadius||50,s=[];return n&&n.forEach((function(n,u){var c=[];n.forEach((function(n,s){if(u===s)c.push(0);else if(i[u]===i[s])if("data"===t.sortBy)c.push(n*(Math.abs(u-s)*t.sortStrength)/(i[u]/o));else if(t.sortBy){var l=e[u][t.sortBy]||0,f=e[s][t.sortBy]||0;(0,a.isString)(l)&&(l=l.charCodeAt(0)),(0,a.isString)(f)&&(f=f.charCodeAt(0)),c.push(n*(Math.abs(l-f)*t.sortStrength)/(i[u]/o))}else c.push(n*r/(i[u]/o));else{var h=(r+o)/2;c.push(n*h)}})),s.push(c)})),s},e.prototype.handleInfinity=function(t,e,n){for(var r=t.length,i=0;in?t[e][r]:n);return n},e.prototype.getType=function(){return"radial"},e}(s.Base);e.RadialLayout=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(109),i=function(){function t(t){this.distances=t.distances,this.dimension=t.dimension||2,this.linkDistance=t.linkDistance}return t.prototype.layout=function(){var t=this.dimension,e=this.distances,n=this.linkDistance;try{var i=r.Matrix.mul(r.Matrix.pow(e,2),-.5),o=i.mean("row"),a=i.mean("column"),s=i.mean();i.add(s).subRowVector(o).subColumnVector(a);var u=new r.SingularValueDecomposition(i),c=r.Matrix.sqrt(u.diagonalMatrix).diagonal();return u.leftSingularVectors.toJSON().map((function(e){return r.Matrix.mul([e],[c]).toJSON()[0].splice(0,t)}))}catch(t){for(var l=[],f=0;fu?1:-1;c=.01*h,l=.01*h}if(fMath.PI/2&&(l-=Math.PI/2,s*=-1,u*=-1);var f=Math.cos(l)*c;e.x=s*f,e.y=u*f}));var a=this.radii;t.forEach((function(s,u){if(u!==i){var c=Math.sqrt(e[u].x*e[u].x+e[u].y*e[u].y);if(c>0&&u!==i){var l=Math.min(o*(n/800),c);if(s[0]+=e[u].x/c*l,s[1]+=e[u].y/c*l,r){var f=s[0]-t[i][0],h=s[1]-t[i][1],d=Math.sqrt(f*f+h*h);f=f/d*a[u],h=h/d*a[u],s[0]=t[i][0]+f,s[1]=t[i][1]+h}}}}))},t}();e.default=r},function(t,e,n){var r=n(42).default;t.exports=function(t,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=n(64),i=n(191),o=n(65),a={};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,t.exports=function(t){return o(t)&&i(t.length)&&!!a[r(t)]}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=n(99),o="object"==("undefined"==typeof self?"undefined":r(self))&&self&&self.Object===Object&&self,a=i||o||Function("return this")();t.exports=a},function(t,e,n){var r=n(98),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=r?r.toStringTag:void 0;t.exports=function(t){var e=o.call(t,s),n=t[s];try{t[s]=void 0;var r=!0}catch(t){}var i=a.call(t);return r&&(e?t[s]=n:delete t[s]),i}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,n){(function(t){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=n(99),o="object"==r(e)&&e&&!e.nodeType&&e,a=o&&"object"==r(t)&&t&&!t.nodeType&&t,s=a&&a.exports===o&&i.process,u=function(){try{var t=a&&a.require&&a.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=u}).call(this,n(100)(t))},function(t,e,n){var r=n(42).default;function i(){"use strict"; +/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t.exports=i=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,n){t[e]=n.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function f(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof g?e:g,o=Object.create(i.prototype),s=new A(r||[]);return a(o,"_invoke",{value:S(t,n,s)}),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p={};function g(){}function v(){}function y(){}var m={};f(m,u,(function(){return this}));var b=Object.getPrototypeOf,x=b&&b(b(C([])));x&&x!==n&&o.call(x,u)&&(m=x);var w=y.prototype=g.prototype=Object.create(m);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){var n;a(this,"_invoke",{value:function(i,a){function s(){return new e((function(n,s){!function n(i,a,s,u){var c=d(t[i],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==r(f)&&o.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,s,u)}),(function(t){n("throw",t,s,u)})):e.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,u)}))}u(c.arg)}(i,a,n,s)}))}return n=n?n.then(s,s):s()}})}function S(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return j()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=M(a,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function M(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,M(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=d(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,p;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:C(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=n(101);t.exports=function(t){if(Array.isArray(t))return r(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=n(101);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=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.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=n(200)(Object.getPrototypeOf,Object);t.exports=r},function(t,e){t.exports=function(t,e){return function(n){return t(e(n))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.clusterBundle=e.clusterCode=e.fruchtermanBundle=e.fruchtermanCode=void 0,e.fruchtermanCode="\nimport { globalInvocationID } from 'g-webgpu';\nconst MAX_EDGE_PER_VERTEX;\nconst VERTEX_COUNT;\n@numthreads(1, 1, 1)\nclass Fruchterman {\n @in @out\n u_Data: vec4[];\n @in\n u_K: float;\n @in\n u_K2: float;\n \n @in\n u_Center: vec2;\n @in\n u_Gravity: float;\n @in\n u_ClusterGravity: float;\n @in\n u_Speed: float;\n @in\n u_MaxDisplace: float;\n @in\n u_Clustering: float;\n @in\n u_AttributeArray: vec4[];\n @in\n u_ClusterCenters: vec4[];\n calcRepulsive(i: int, currentNode: vec4): vec2 {\n let dx = 0, dy = 0;\n for (let j = 0; j < VERTEX_COUNT; j++) {\n if (i != j) {\n const nextNode = this.u_Data[j];\n const xDist = currentNode[0] - nextNode[0];\n const yDist = currentNode[1] - nextNode[1];\n const dist = (xDist * xDist + yDist * yDist) + 0.01;\n let param = this.u_K2 / dist;\n \n if (dist > 0.0) {\n dx += param * xDist;\n dy += param * yDist;\n if (xDist == 0 && yDist == 0) {\n const sign = i < j ? 1 : -1;\n dx += param * sign;\n dy += param * sign;\n }\n }\n }\n }\n return [dx, dy];\n }\n calcGravity(currentNode: vec4, nodeAttributes: vec4): vec2 { // \n let dx = 0, dy = 0;\n const vx = currentNode[0] - this.u_Center[0];\n const vy = currentNode[1] - this.u_Center[1];\n const gf = 0.01 * this.u_K * this.u_Gravity;\n dx = gf * vx;\n dy = gf * vy;\n if (this.u_Clustering == 1) {\n const clusterIdx = int(nodeAttributes[0]);\n const center = this.u_ClusterCenters[clusterIdx];\n const cvx = currentNode[0] - center[0];\n const cvy = currentNode[1] - center[1];\n const dist = sqrt(cvx * cvx + cvy * cvy) + 0.01;\n const parma = this.u_K * this.u_ClusterGravity / dist;\n dx += parma * cvx;\n dy += parma * cvy;\n }\n return [dx, dy];\n }\n calcAttractive(i: int, currentNode: vec4): vec2 {\n let dx = 0, dy = 0;\n const arr_offset = int(floor(currentNode[2] + 0.5));\n const length = int(floor(currentNode[3] + 0.5));\n const node_buffer: vec4;\n for (let p = 0; p < MAX_EDGE_PER_VERTEX; p++) {\n if (p >= length) break;\n const arr_idx = arr_offset + p;\n // when arr_idx % 4 == 0 update currentNodedx_buffer\n const buf_offset = arr_idx - arr_idx / 4 * 4;\n if (p == 0 || buf_offset == 0) {\n node_buffer = this.u_Data[int(arr_idx / 4)];\n }\n const float_j = buf_offset == 0 ? node_buffer[0] :\n buf_offset == 1 ? node_buffer[1] :\n buf_offset == 2 ? node_buffer[2] :\n node_buffer[3];\n const nextNode = this.u_Data[int(float_j)];\n const xDist = currentNode[0] - nextNode[0];\n const yDist = currentNode[1] - nextNode[1];\n const dist = sqrt(xDist * xDist + yDist * yDist) + 0.01;\n let attractiveF = dist / this.u_K;\n \n if (dist > 0.0) {\n dx -= xDist * attractiveF;\n dy -= yDist * attractiveF;\n if (xDist == 0 && yDist == 0) {\n const sign = i < int(float_j) ? 1 : -1;\n dx -= sign * attractiveF;\n dy -= sign * attractiveF;\n }\n }\n }\n return [dx, dy];\n }\n @main\n compute() {\n const i = globalInvocationID.x;\n const currentNode = this.u_Data[i];\n let dx = 0, dy = 0;\n if (i >= VERTEX_COUNT) {\n this.u_Data[i] = currentNode;\n return;\n }\n\n // [gravity, fx, fy, 0]\n const nodeAttributes = this.u_AttributeArray[i];\n\n if (nodeAttributes[1] != 0 && nodeAttributes[2] != 0) {\n // the node is fixed\n this.u_Data[i] = [\n nodeAttributes[1],\n nodeAttributes[2],\n currentNode[2],\n currentNode[3]\n ];\n return;\n }\n\n // repulsive\n const repulsive = this.calcRepulsive(i, currentNode);\n dx += repulsive[0];\n dy += repulsive[1];\n // attractive\n const attractive = this.calcAttractive(i, currentNode);\n dx += attractive[0];\n dy += attractive[1];\n // gravity\n const gravity = this.calcGravity(currentNode, nodeAttributes);\n dx -= gravity[0];\n dy -= gravity[1];\n // speed\n dx *= this.u_Speed;\n dy *= this.u_Speed;\n\n // move\n const distLength = sqrt(dx * dx + dy * dy);\n if (distLength > 0.0) {\n const limitedDist = min(this.u_MaxDisplace * this.u_Speed, distLength);\n this.u_Data[i] = [\n currentNode[0] + dx / distLength * limitedDist,\n currentNode[1] + dy / distLength * limitedDist,\n currentNode[2],\n currentNode[3]\n ];\n }\n }\n}\n",e.fruchtermanBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_K;\\nuniform float u_K2;\\nuniform vec2 u_Center;\\nuniform float u_Gravity;\\nuniform float u_ClusterGravity;\\nuniform float u_Speed;\\nuniform float u_MaxDisplace;\\nuniform float u_Clustering;\\nuniform sampler2D u_AttributeArray;\\nuniform vec2 u_AttributeArraySize;\\nvec4 getDatau_AttributeArray(vec2 address2D) {\\n return vec4(texture2D(u_AttributeArray, address2D).rgba);\\n}\\nvec4 getDatau_AttributeArray(float address1D) {\\n return getDatau_AttributeArray(addrTranslation_1Dto2D(address1D, u_AttributeArraySize));\\n}\\nvec4 getDatau_AttributeArray(int address1D) {\\n return getDatau_AttributeArray(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - u_Center.x;\\nfloat vy = currentNode.y - u_Center.y;\\nfloat gf = (0.01 * u_K) * u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = getDatau_ClusterCenters(clusterIdx);\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (u_K * u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes = getDatau_AttributeArray(i);\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w));\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= u_Speed;\\ndy *= u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(u_MaxDisplace * u_Speed, distLength);\\ngl_FragColor = vec4(vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_K","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_K2","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Center","type":"vec2","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Gravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterGravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Speed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_MaxDisplace","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Clustering","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AttributeArray","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',e.clusterCode="\nimport { globalInvocationID } from 'g-webgpu';\nconst VERTEX_COUNT;\nconst CLUSTER_COUNT;\n@numthreads(1, 1, 1)\nclass CalcCenter {\n @in\n u_Data: vec4[];\n @in\n u_NodeAttributes: vec4[]; // [[clusterIdx, 0, 0, 0], ...]\n @in @out\n u_ClusterCenters: vec4[]; // [[cx, cy, nodeCount, clusterIdx], ...]\n @main\n compute() {\n const i = globalInvocationID.x;\n const center = this.u_ClusterCenters[i];\n let sumx = 0;\n let sumy = 0;\n let count = 0;\n for (let j = 0; j < VERTEX_COUNT; j++) {\n const attributes = this.u_NodeAttributes[j];\n const clusterIdx = int(attributes[0]);\n const vertex = this.u_Data[j];\n if (clusterIdx == i) {\n sumx += vertex.x;\n sumy += vertex.y;\n count += 1;\n }\n }\n this.u_ClusterCenters[i] = [\n sumx / count,\n sumy / count,\n count,\n i\n ];\n }\n}\n",e.clusterBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributes;\\nuniform vec2 u_NodeAttributesSize;\\nvec4 getDatau_NodeAttributes(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributes, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributes(float address1D) {\\n return getDatau_NodeAttributes(addrTranslation_1Dto2D(address1D, u_NodeAttributesSize));\\n}\\nvec4 getDatau_NodeAttributes(int address1D) {\\n return getDatau_NodeAttributes(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 center = getDatau_ClusterCenters(i);\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = getDatau_NodeAttributes(j);\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = getDatau_Data(j);\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngl_FragColor = vec4(vec4(sumx / count, sumy / count, count, i));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"CLUSTER_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.aveMovementBundle=e.aveMovementCode=e.gForceBundle=e.gForceCode=void 0,e.gForceCode="\nimport { globalInvocationID } from 'g-webgpu';\n\nconst MAX_EDGE_PER_VERTEX;\nconst VERTEX_COUNT;\nconst SHIFT_20 = 1048576;\n\n@numthreads(1, 1, 1)\nclass GGForce {\n @in @out\n u_Data: vec4[];\n\n @in\n u_damping: float;\n \n @in\n u_maxSpeed: float;\n\n @in\n u_minMovement: float;\n\n @in\n u_AveMovement: vec4[];\n\n @in\n u_coulombDisScale: float;\n\n @in\n u_factor: float;\n\n @in\n u_NodeAttributeArray1: vec4[];\n\n @in\n u_NodeAttributeArray2: vec4[];\n\n @in\n u_interval: float;\n\n unpack_float(packedValue: float): ivec2 {\n const packedIntValue = int(packedValue);\n const v0 = packedIntValue / SHIFT_20;\n return [v0, packedIntValue - v0 * SHIFT_20];\n }\n\n calcRepulsive(i: int, currentNode: vec4): vec2 {\n let ax = 0, ay = 0;\n for (let j: int = 0; j < VERTEX_COUNT; j++) {\n if (i != j) {\n const nextNode = this.u_Data[j];\n const vx = currentNode[0] - nextNode[0];\n const vy = currentNode[1] - nextNode[1];\n const dist = sqrt(vx * vx + vy * vy) + 0.01;\n const n_dist = (dist + 0.1) * this.u_coulombDisScale;\n const direx = vx / dist;\n const direy = vy / dist;\n const attributesi = this.u_NodeAttributeArray1[i];\n const attributesj = this.u_NodeAttributeArray1[j];\n const massi = attributesi[0];\n const nodeStrengthi = attributesi[2];\n const nodeStrengthj = attributesj[2];\n const nodeStrength = (nodeStrengthi + nodeStrengthj) / 2;\n // const param = nodeStrength * this.u_factor / (n_dist * n_dist * massi);\n const param = nodeStrength * this.u_factor / (n_dist * n_dist);\n ax += direx * param;\n ay += direy * param;\n }\n }\n return [ax, ay];\n }\n\n calcGravity(i: int, currentNode: vec4, attributes2: vec4): vec2 {\n // note: attributes2 = [centerX, centerY, gravity, 0]\n\n const vx = currentNode[0] - attributes2[0];\n const vy = currentNode[1] - attributes2[1];\n \n const ax = vx * attributes2[2];\n const ay = vy * attributes2[2];\n \n return [ax, ay];\n }\n\n calcAttractive(i: int, currentNode: vec4, attributes1: vec4): vec2 {\n // note: attributes1 = [mass, degree, nodeSterngth, 0]\n\n const mass = attributes1[0];\n let ax = 0, ay = 0;\n // const arr_offset = int(floor(currentNode[2] + 0.5));\n // const length = int(floor(currentNode[3] + 0.5));\n\n const compressed = this.unpack_float(currentNode[2]);\n const length = compressed[0];\n const arr_offset = compressed[1];\n\n const node_buffer: vec4;\n for (let p: int = 0; p < MAX_EDGE_PER_VERTEX; p++) {\n if (p >= length) break;\n const arr_idx = arr_offset + 4 * p; // i 鑺傜偣鐨勭 p 鏉¤竟寮€濮嬬殑灏忔牸瀛愪綅缃甛n const buf_offset = arr_idx - arr_idx / 4 * 4;\n if (p == 0 || buf_offset == 0) {\n node_buffer = this.u_Data[int(arr_idx / 4)]; // 澶ф牸瀛愶紝澶ф牸瀛愪綅缃�=灏忎釜瀛愪綅缃� / 4锛孿n }\n\n let float_j: float = node_buffer[0];\n\n const nextNode = this.u_Data[int(float_j)];\n const vx = nextNode[0] - currentNode[0];\n const vy = nextNode[1] - currentNode[1];\n const dist = sqrt(vx * vx + vy * vy) + 0.01;\n const direx = vx / dist;\n const direy = vy / dist;\n const edgeLength = node_buffer[1];\n const edgeStrength = node_buffer[2];\n const diff: float = edgeLength - dist;//edgeLength\n // const param = diff * this.u_stiffness / mass; //\n const param = diff * edgeStrength / mass; // \n ax -= direx * param;\n ay -= direy * param;\n }\n return [ax, ay];\n }\n\n @main\n compute() {\n const i = globalInvocationID.x;\n const currentNode = this.u_Data[i];\n const movement = u_AveMovement[0];\n let ax = 0, ay = 0;\n\n if (i >= VERTEX_COUNT || movement.x < u_minMovement) {\n this.u_Data[i] = currentNode;\n return;\n }\n\n // 姣忎釜鑺傜偣灞炴€у崰涓や釜鏁扮粍涓悇涓€鏍糪n // [mass, degree, nodeStrength, fx]\n const nodeAttributes1 = this.u_NodeAttributeArray1[i];\n // [centerX, centerY, centerGravity, fy]\n const nodeAttributes2 = this.u_NodeAttributeArray2[i];\n\n // repulsive\n const repulsive = this.calcRepulsive(i, currentNode);\n ax += repulsive[0];\n ay += repulsive[1];\n\n // attractive\n const attractive = this.calcAttractive(i, currentNode, nodeAttributes1);\n ax += attractive[0];\n ay += attractive[1];\n\n // gravity\n const gravity = this.calcGravity(i, currentNode, nodeAttributes2);\n ax -= gravity[0];\n ay -= gravity[1];\n\n // speed\n const param = this.u_interval * this.u_damping;\n let vx = ax * param;\n let vy = ay * param;\n const vlength = sqrt(vx * vx + vy * vy) + 0.0001;\n if (vlength > this.u_maxSpeed) {\n const param2 = this.u_maxSpeed / vlength;\n vx = param2 * vx;\n vy = param2 * vy;\n }\n\n // move\n if (nodeAttributes1[3] != 0 && nodeAttributes2[3] != 0) {\n this.u_Data[i] = [\n nodeAttributes1[3],\n nodeAttributes2[3],\n currentNode[2],\n 0\n ];\n } else {\n const distx = vx * this.u_interval;\n const disty = vy * this.u_interval;\n const distLength = sqrt(distx * distx + disty * disty);\n this.u_Data[i] = [\n currentNode[0] + distx,\n currentNode[1] + disty,\n currentNode[2],\n distLength\n ];\n }\n \n // the avarage move distance\n // need to share memory\n \n }\n}\n",e.gForceBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_damping;\\nuniform float u_maxSpeed;\\nuniform float u_minMovement;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nuniform float u_coulombDisScale;\\nuniform float u_factor;\\nuniform sampler2D u_NodeAttributeArray1;\\nuniform vec2 u_NodeAttributeArray1Size;\\nvec4 getDatau_NodeAttributeArray1(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray1, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray1(float address1D) {\\n return getDatau_NodeAttributeArray1(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray1Size));\\n}\\nvec4 getDatau_NodeAttributeArray1(int address1D) {\\n return getDatau_NodeAttributeArray1(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributeArray2;\\nuniform vec2 u_NodeAttributeArray2Size;\\nvec4 getDatau_NodeAttributeArray2(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray2, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray2(float address1D) {\\n return getDatau_NodeAttributeArray2(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray2Size));\\n}\\nvec4 getDatau_NodeAttributeArray2(int address1D) {\\n return getDatau_NodeAttributeArray2(float(address1D));\\n}\\nuniform float u_interval;\\nivec2 unpack_float(float packedValue) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = getDatau_NodeAttributeArray1(i);\\nvec4 attributesj = getDatau_NodeAttributeArray1(j);\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nvec4 movement = getDatau_AveMovement(0.0);\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < u_minMovement)) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes1 = getDatau_NodeAttributeArray1(i);\\nvec4 nodeAttributes2 = getDatau_NodeAttributeArray2(i);\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = u_interval * u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > u_maxSpeed) {float param2 = u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0));}else {float distx = vx * u_interval;\\nfloat disty = vy * u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\ngl_FragColor = vec4(vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"SHIFT_20","type":"Float","value":1048576,"runtime":false}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_damping","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_maxSpeed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_minMovement","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_coulombDisScale","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_factor","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray1","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray2","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_interval","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',e.aveMovementCode="\nconst VERTEX_COUNT;\n@numthreads(1, 1, 1)\nclass CalcAveMovement {\n @in\n u_Data: vec4[];\n @in\n u_iter: float;\n @in @out\n u_AveMovement: vec4[];\n @main\n compute() {\n let movement = 0;\n for (let j: int = 0; j < VERTEX_COUNT; j++) {\n const vertex = this.u_Data[j];\n movement += vertex[3];\n }\n movement = movement / float(VERTEX_COUNT);\n this.u_AveMovement[0] = [movement, 0, 0, 0];\n }\n}\n",e.aveMovementBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_iter;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = getDatau_Data(j);\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngl_FragColor = vec4(vec4(movement, 0.0, 0.0, 0.0));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_iter","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}return t.prototype.distanceTo=function(t){var e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)},t.prototype.setPos=function(t,e){this.rx=t,this.ry=e},t.prototype.resetForce=function(){this.fx=0,this.fy=0},t.prototype.addForce=function(t){var e=t.rx-this.rx,n=t.ry-this.ry,r=Math.hypot(e,n);r=r<1e-4?1e-4:r;var i=this.g*(this.degree+1)*(t.degree+1)/r;this.fx+=i*e/r,this.fy+=i*n/r},t.prototype.in=function(t){return t.contains(this.rx,this.ry)},t.prototype.add=function(e){var n=this.mass+e.mass;return new t({rx:(this.rx*this.mass+e.rx*e.mass)/n,ry:(this.ry*this.mass+e.ry*e.mass)/n,mass:n,degree:this.degree+e.degree})},t}();e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}return t.prototype.getLength=function(){return this.length},t.prototype.contains=function(t,e){var n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n},t.prototype.NW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.NE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.SW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t.prototype.SE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t}();e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}return t.prototype.insert=function(e){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new t(this.quad.NW()),this.NE=new t(this.quad.NE()),this.SW=new t(this.quad.SW()),this.SE=new t(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e)):this.body=e},t.prototype._putBody=function(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))},t.prototype._isExternal=function(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE},t.prototype.updateForce=function(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)1){var e=r({},t);delete e.size,s.push(e)}}));var h=[];i.forEach((function(t){var e=s.find((function(e){return e.id===t.source})),n=s.find((function(e){return e.id===t.target}));e&&n&&h.push(t)}));var d=new f.DagreLayout({type:"dagre",ranksep:e.nodeMinGap,nodesep:e.nodeMinGap}).layout({nodes:s,edges:h}).nodes;n.forEach((function(t){var e=(d||[]).find((function(e){return e.id===t.id}));t.x=(null==e?void 0:e.x)||o/2,t.y=(null==e?void 0:e.y)||a/2}));var p=JSON.parse(JSON.stringify(n)),g=JSON.parse(JSON.stringify(i)),v=u.forceSimulation().nodes(p).force("link",u.forceLink(g).id((function(t){return t.id})).distance((function(t){return h.find((function(e){return e.source===t.source&&e.target===t.target}))?30:20}))).force("charge",u.forceManyBody()).force("center",u.forceCenter(o/2,a/2)).force("x",u.forceX(o/2)).force("y",u.forceY(a/2)).alpha(.3).alphaDecay(.08).alphaMin(.001);return new Promise((function(t){v.on("end",(function(){n.forEach((function(t){var e=p.find((function(e){return e.id===t.id}));e&&(t.x=e.x,t.y=e.y)}));var r=Math.min.apply(Math,n.map((function(t){return t.x}))),s=Math.max.apply(Math,n.map((function(t){return t.x}))),u=Math.min.apply(Math,n.map((function(t){return t.y}))),f=Math.max.apply(Math,n.map((function(t){return t.y}))),h=o/(s-r),d=a/(f-u);n.forEach((function(t){void 0!==t.x&&h<1&&(t.x=(t.x-r)*h),void 0!==t.y&&d<1&&(t.y=(t.y-u)*d)})),n.forEach((function(t){t.sizeTemp=t.size,t.size=[10,10]})),(0,l.default)(n,i),n.forEach((function(t){t.size=t.sizeTemp||[],delete t.sizeTemp})),(0,c.default)({nodes:n,edges:i},e),t()}))}))}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(208));e.default=function(t,e){if(!t.nodes||0===t.nodes.length)return t;var n=e.width,r=e.height,o=e.nodeMinGap,a=1e4,s=1e4;t.nodes.forEach((function(t){var e=t.size[0]||50,n=t.size[1]||50;a=Math.min(e,a),s=Math.min(n,s)}));var u=new i.default;u.init(n,r,{CELL_H:s,CELL_W:a}),t.nodes.forEach((function(t){var e=u.occupyNearest(t);e&&(e.node={id:t.id,size:t.size},t.x=e.x,t.y=e.y,t.dx=e.dx,t.dy=e.dy)}));for(var c=0;ca){for(var p=v=Math.ceil((l.size[0]+o)/a)-1,g=0;g-1)||u.cells[h+g+1][d].node)break;p--}u.insertColumn(h,p)}if(l.size[1]+o>s){var v;for(p=v=Math.ceil((l.size[1]+o)/s)-1,g=0;g-1)||u.cells[h][d+g+1].node)break;p--}u.insertRow(d,p)}}for(c=0;ct;n--)for(i=0;i=t&&(this.additionColumn[i]+=e);for(n=0;nt;n--)this.cells[i][n+e]=r(r({},this.cells[i][n]),{dx:i,dy:n+e,x:i*this.CELL_W,y:(n+e)*this.CELL_H}),this.cells[i][n]={dx:i,dy:n,x:i*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(n=0;n=t&&(this.additionRow[n]+=e);for(i=0;ia?e:t,u=o>a?t:e,c=s.x-s.size[0]/2,l=s.y-s.size[1]/2,f=s.x+s.size[0]/2,h=s.y+s.size[1]/2,d=u.x-u.size[0]/2,p=u.y-u.size[1]/2,g=u.x+u.size[0]/2,v=u.y+u.size[1]/2,y=s.x,m=s.y,b=u.x,x=u.y,w=0,_=0;if(f>=d&&g>=c&&h>=p&&v>=l){0===(_=Math.sqrt(Math.pow(b-y,2)+Math.pow(x-m,2)))&&(_=1e-7),w=10/_*100+((fd?c:d))*((hp?l:p)),w*=1e7}else{var E=!1,S=function(t,e,n){var i=t.x-t.size[0]/2,o=t.y-t.size[1]/2,a=t.x+t.size[0]/2,s=t.y+t.size[1]/2,u=e.x-e.size[0]/2,c=e.y-e.size[1]/2,l=e.x+e.size[0]/2,f=e.y+e.size[1]/2,h=t.x,d=t.y,p=e.x,g=e.y,v=p-h,y=Math.atan2(v,g-d),m=0,b=0,x=0,w=0;y>r?(b=o-f,m=u-a,x=parseFloat(b?(b/Math.cos(y)).toFixed(2):m.toFixed(2)),w=parseFloat(m?(m/Math.sin(y)).toFixed(2):b.toFixed(2))):x=w=0(m=u-a)?parseFloat(b?(b/Math.cos(y)).toFixed(2):m.toFixed(2)):parseFloat(m?(m/Math.sin(y)).toFixed(2):b.toFixed(2)):y<-r?(b=o-f)>(m=-(l-i))?parseFloat(b?(b/Math.cos(y)).toFixed(2):m.toFixed(2)):parseFloat(m?(m/Math.sin(y)).toFixed(2):b.toFixed(2)):(b=c-s)>(m=Math.abs(v)>(a-i)/2?i-l:v)?parseFloat(b?(b/Math.cos(y)).toFixed(2):m.toFixed(2)):parseFloat(m&&0!==y?(m/Math.sin(y)).toFixed(2):b.toFixed(2));var _=parseFloat(y.toFixed(2)),E=n;return n&&(E=1.1780972450961724<_&&_<1.9634954084936207),{distance:Math.abs(x1200||r.y>800)&&(e+=1e12);for(var i=n+1;i70&&l<110,d=f>70&&f<110;if((l<30||l>150)&&!(f<30||f>150)||l*f<0){s=!1;break}if(h&&!d||l*f<0){s=!1;break}if((c.x-t.x)*(c.x-e.x)<0){s=!1;break}if((c.y-t.y)*(c.y-e.y)<0){s=!1;break}}return s}function c(t,e){for(var n=!1,r=[10,-10,0,0],i=[0,0,10,-10],a=0;a.1?(f=d,n=!0):(c.x-=r[h],c.y-=i[h])}}return o>.1&&(o*=.5),n?s(t):0}function l(t,e){var n=0;(t.x<0||t.y<0||t.x+t.size[0]+20>1200||t.y+t.size[1]+20>800)&&(n+=1e12);for(var r=0;r0&&!(++u>=50);){var l=c(t,e);0!==l&&(a=l),o=a-n,n=a,0===o?--r:r=20}return t.forEach((function(t){t.x=t.x-t.size[0]/2,t.y=t.y-t.size[1]/2})),{nodes:t,edges:e}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Layouts=e.Layout=void 0;var r=n(79),i=n(83),o=n(84),a=n(86),s=n(85),u=n(87),c=n(88),l=n(62),f=n(92),h=n(93),d=n(94),p=n(95),g=n(96),v=n(103),y=n(104),m=n(105),b=n(106),x=n(107),w=n(90),_=n(15),E=function(){function t(t){var e=(0,r.getLayoutByName)(t.type);this.layoutInstance=new e(t)}return t.prototype.layout=function(t){return this.layoutInstance.layout(t)},t.prototype.updateCfg=function(t){this.layoutInstance.updateCfg(t)},t.prototype.init=function(t){this.correctLayers(t.nodes),this.layoutInstance.init(t)},t.prototype.correctLayers=function(t){if(null==t?void 0:t.length){var e=1/0,n=[];if(t.forEach((function(t){(0,_.isString)(t.layer)&&(t.layer=parseInt(t.layer,10)),void 0===t.layer||isNaN(t.layer)||(n.push(t),t.layer-1})),f=function(i){var o=r[i];if(s[o]||0===s[o])a[o]&&(u[e.id]=Math.min(u[e.id],s[o]));else{var c=n.filter((function(t){return t.id===o}));c.length>0&&t(c[0]),u[e.id]=Math.min(u[e.id],u[o])}},h=0;h0;){var p=o.pop();if(a[p.id]=!1,d.push(p),p===e)break}d.length>0&&c.push(d)}},h=0,d=n;h0&&t(o[0])}},u=0;u0;)f.push(s.pop());o.push(f)}}return o}(t)}var N=function(t){var e={},n=t.nodes,r=void 0===n?[]:n,i=t.edges,o=void 0===i?[]:i;return r.forEach((function(t){e[t.id]={degree:0,inDegree:0,outDegree:0}})),o.forEach((function(t){e[t.source].degree++,e[t.source].outDegree++,e[t.target].degree++,e[t.target].inDegree++})),e},P=N,D=function(t,e){return N(t)[e]?N(t)[e].inDegree:0},L=function(t,e){return N(t)[e]?N(t)[e].outDegree:0};function R(t,e,n,r){void 0===r&&(r=!0),function t(e,n,r,i,o){void 0===o&&(o=!0),i.enter({current:n,previous:r});var a=e.edges;k(n,void 0===a?[]:a,o?"target":void 0).forEach((function(a){i.allowTraversal({previous:r,current:n,next:a})&&t(e,a,n,i,o)})),i.leave({current:n,previous:r})}(t,e,"",function(t){void 0===t&&(t={});var e,n=t,r=function(){},i=(e={},function(t){var n=t.next;return!e[n]&&(e[n]=!0,!0)});return n.allowTraversal=t.allowTraversal||i,n.enter=t.enter||r,n.leave=t.leave||r,n}(n),r)}var B=function(t,e,n){var r,i;void 0===n&&(n=!0);for(var o=[],a=0,s=T(t,!1);a0;)for(var p=f.pop(),g=p.id,v=k(g,t.edges),y=function(r){var i,a=v[r],s=t.nodes.find((function(t){return t.id===a}));if(a===g)o.push(((i={})[a]=p,i));else if(a in d){if(!d[g].has(s)){for(var u=!0,c=[s,p],l=h[g];d[a].size&&!d[a].has(l)&&(c.push(l),l!==h[l.id]);)l=h[l.id];if(c.push(l),e&&n?(u=!1,c.findIndex((function(t){return e.indexOf(t.id)>-1}))>-1&&(u=!0)):e&&!n&&c.findIndex((function(t){return e.indexOf(t.id)>-1}))>-1&&(u=!1),u){for(var y={},m=1;m-1)return f;r.push(u),i.add(u);for(var h=l[u.id],d=0;d0;){var n=e.pop();i.has(n)&&(i.delete(n),o[n.id].forEach((function(t){e.push(t)})),o[n.id].clear())}}(u);else for(d=0;d-1}));v-1?p[g.id].push(u[m]):a.push(((i={})[g.id]=g,i))}}return{component:d,adjList:p,minIdx:s}},y=0;y=y})),b=I({nodes:m,edges:t.edges}).filter((function(t){return t.length>1}));if(0===b.length)break;var x=v(b),w=x.minIdx,_=x.adjList,E=x.component;if(!(E.length>1))break;E.forEach((function(t){o[t.id]=new Set}));var S=s[w];if(e&&n&&-1===e.indexOf(S.id))return a;c(S,S,_),y=w+1}return a},z=function(t,e,n,r){return void 0===r&&(r=!0),e?F(t,n,r):B(t,n,r)},G=function(t){var e=null,n=t.nodes,r={},i={},o={},a={};(void 0===n?[]:n).forEach((function(t){i[t.id]=t}));for(var s={enter:function(t){var n=t.current,a=t.previous;if(o[n]){e={};for(var s=n,u=a;u!==n;)e[s]=u,s=u,u=r[u];e[s]=u}else o[n]=n,delete i[n],r[n]=a},leave:function(t){var e=t.current;a[e]=e,delete o[e]},allowTraversal:function(t){var n=t.next;return!e&&!a[n]}};Object.keys(i).length;){R(t,Object.keys(i)[0],s)}return e},Y=function(t,e,n,r){var i=t.nodes,o=void 0===i?[]:i,a=t.edges,s=void 0===a?[]:a,u=[],c={},l={},f={};o.forEach((function(t,n){var r=t.id;u.push(r),l[r]=1/0,r===e&&(l[r]=0)}));for(var h=o.length,d=function(t){var e=function(t,e,n){for(var r,i=1/0,o=0;ol[e.id]+s?(l[a]=l[e.id]+s,f[a]=[e.id]):l[a]===l[e.id]+s&&f[a].push(e.id)}))},p=0;p0&&c.length>0;){var h=c[c.length-1];if(h.length){var d=h.shift();if(d&&(s.push(d),u[d]=!0,f=r?k(d,a,"target"):k(d,a),c.push(f.filter((function(t){return!u[t]})))),s[s.length-1]===n){var p=s.map((function(t){return t}));l.push(p);g=s.pop();u[g]=!1,c.pop()}}else{var g=s.pop();u[g]=!1,c.pop()}}return l},H=function(t,e){for(var n=_(t,e),r=[],i=n.length,o=0;or[o][s]+r[s][a]&&(r[o][a]=r[o][s]+r[s][a]);return r},q=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n="weight"),void 0===r&&(r=1e3);var i=t.nodes,o=void 0===i?[]:i,a=t.edges,s=void 0===a?[]:a,u={},c={};o.forEach((function(t,e){var n=C();t.clusterId=n,u[n]={id:n,nodes:[t]},c[t.id]={node:t,idx:e}}));var l=_(t,e),f=[],h={};l.forEach((function(t,e){var n=0,r=o[e].id;h[r]={},t.forEach((function(t,e){if(t){n+=t;var i=o[e].id;h[r][i]=t}})),f.push(n)}));for(var d=0,p=function(){var t=!1;if(o.forEach((function(e){var n={};Object.keys(h[e.id]).forEach((function(t){var r=h[e.id][t],i=c[t].node.clusterId;n[i]||(n[i]=0),n[i]+=r}));var r=-1/0,i=[];if(Object.keys(n).forEach((function(t){r=0&&i.splice(o,1),i&&i.length){t=!0;var a=u[e.clusterId],s=a.nodes.indexOf(e);a.nodes.splice(s,1);var l=Math.floor(Math.random()*i.length),f=u[i[l]];f.nodes.push(e),e.clusterId=f.id}}})),!t)return"break";d++};d0&&M>O&&M-OO&&(A=l.map((function(t){return{node:t,clusterId:t.clusterId}})),C=Object(v.clone)(m),O=M),j||k>100)break;k++,Object.keys(m).forEach((function(t){var e=0;h.forEach((function(r){var i=r.source,o=r.target,a=b[i].node.clusterId,s=b[o].node.clusterId;(a===t&&s!==t||s===t&&a!==t)&&(e+=r[n]||1)})),m[t].sumTot=e})),l.forEach((function(t,e){var r,o=m[t.clusterId],a=0,s=w[e]/(2*S),c=0,l=o.nodes;l.forEach((function(t){var n=b[t.id].idx;c+=x[e][n]||0}));var f=c-o.sumTot*s,p=l.filter((function(e){return e.id!==t.id})),g=[];p.forEach((function(t,e){g[e]=d[t.originIndex]}));var v=et(p,d)*u,y=E[t.id];if(Object.keys(y).forEach((function(n){var o=b[n].node.clusterId;if(o!==t.clusterId){var c=m[o],l=c.nodes;if(l&&l.length){var h=0;l.forEach((function(t){var n=b[t.id].idx;h+=x[e][n]||0}));var p=h-c.sumTot*s,g=l.concat([t]),y=[];g.forEach((function(t,e){y[e]=d[t.originIndex]}));var w=et(g,d)*u,_=p-f;i&&(_=p+w-(f+v)),_>a&&(a=_,r=c)}}})),a>0){r.nodes.push(t);var _=t.clusterId;t.clusterId=r.id;var M=o.nodes.indexOf(t);o.nodes.splice(M,1);var O=0,k=0;h.forEach((function(t){var e=t.source,i=t.target,o=b[e].node.clusterId,a=b[i].node.clusterId;(o===r.id&&a!==r.id||a===r.id&&o!==r.id)&&(O+=t[n]||1),(o===_&&a!==_||a===_&&o!==_)&&(k+=t[n]||1)})),r.sumTot=O,o.sumTot=k}}))}var I={},T=0;Object.keys(C).forEach((function(t){var e=C[t];if(e.nodes&&e.nodes.length){var n=String(T+1);n!==t&&(e.id=n,e.nodes=e.nodes.map((function(t){return{id:t.id,clusterId:n}})),C[n]=e,I[t]=n,delete C[t],T++)}else delete C[t]})),A.forEach((function(t){var e=t.node,n=t.clusterId;e&&(e.clusterId=n,e.clusterId&&I[e.clusterId]&&(e.clusterId=I[e.clusterId]))}));var N=[],P={};h.forEach((function(t){var e=t.source,r=t.target,i=t[n]||1,o=b[e].node.clusterId,a=b[r].node.clusterId;if(o&&a){var s="".concat(o,"---").concat(a);if(P[s])P[s].weight+=i,P[s].count++;else{var u={source:o,target:a,weight:i,count:1};P[s]=u,N.push(u)}}}));var D=[];return Object.keys(C).forEach((function(t){D.push(C[t])})),{clusters:D,clusterEdges:N}},rt=function(t,e,n,r,i,o,a,s){return void 0===e&&(e=!1),void 0===n&&(n="weight"),void 0===r&&(r=1e-4),void 0===i&&(i=void 0),void 0===o&&(o=[]),void 0===a&&(a=["id"]),void 0===s&&(s=1),nt(t,e,n,r,!0,i,o,a,s)},it=function(t,e){var n;void 0===e&&(e=1);for(var r=Object(v.clone)(t),i=r.nodes,o=void 0===i?[]:i,a=r.edges,s=void 0===a?[]:a,u=function(){var t=P({nodes:o,edges:s}),r=Object.keys(t);r.sort((function(e,n){var r,i;return(null===(r=t[e])||void 0===r?void 0:r.degree)-(null===(i=t[n])||void 0===i?void 0:i.degree)}));var i=r[0];if(!o.length||(null===(n=t[i])||void 0===n?void 0:n.degree)>=e)return"break";var a=o.findIndex((function(t){return t.id===i}));o.splice(a,1),s=s.filter((function(t){return!(t.source===i||t.target===i)}))};;){if("break"===u())break}return{nodes:o,edges:s}},ot=function(t,e,n){var r=[];switch(t){case X.EuclideanDistance:r=e[n];break;default:r=[]}return r},at=function(t,e,n,r,i,o){void 0===e&&(e=3),void 0===n&&(n=void 0),void 0===r&&(r=[]),void 0===i&&(i=["id"]),void 0===o&&(o=X.EuclideanDistance);var a=t.nodes,s=void 0===a?[]:a,u=t.edges,c=void 0===u?[]:u,l={clusters:[{id:"0",nodes:s}],clusterEdges:[]};if(o===X.EuclideanDistance&&!s.every((function(t){return t.hasOwnProperty(n)})))return l;var f=[],h=[];if(o===X.EuclideanDistance&&(f=K(s,n),h=$(f,r,i)),!h.length)return l;for(var d=Object(v.uniq)(h.map((function(t){return t.join("")}))),p=Math.min(e,s.length,d.length),g=0;gw&&!y.find((function(e){return Object(v.isEqual)(e,ot(o,h,s[t].originIndex))}))&&(w=i,_=t)}},S=0;S=0;j--)b[Number(s[g].clusterId)][j].id===s[g].id&&b[Number(s[g].clusterId)].splice(j,1);s[g].clusterId=String(O),b[O].push(s[g])}}var I=!1;for(g=0;g=1e3)break}var D=[],L={};return c.forEach((function(t){var e,n,r=t.source,i=t.target,o=null===(e=s.find((function(t){return t.id===r})))||void 0===e?void 0:e.clusterId,a=null===(n=s.find((function(t){return t.id===i})))||void 0===n?void 0:n.clusterId,u="".concat(o,"---").concat(a);if(L[u])L[u].count++;else{var c={source:o,target:a,count:1};L[u]=c,D.push(c)}})),{clusters:b,clusterEdges:D}},st=function(t,e){var n=new Z(e),r=n.norm2(),i=new Z(t),o=i.norm2(),a=n.dot(i),s=r*o,u=s?a/s:0;return u},ut=function(t,e,n,r,i){void 0===t&&(t=[]),void 0===n&&(n=void 0),void 0===r&&(r=[]),void 0===i&&(i=[]);var o=Object(v.clone)(t.filter((function(t){return t.id!==e.id}))),a=t.findIndex((function(t){return t.id===e.id})),s=K(t,n),u=$(s,r,i),c=u[a],l=[];return o.forEach((function(t,n){if(t.id!==e.id){var r=u[n],i=st(r,c);l.push(i),t.cosineSimilarity=i}})),o.sort((function(t,e){return e.cosineSimilarity-t.cosineSimilarity})),{allCosineSimilarity:l,similarNodes:o}},ct=function(){function t(t){this.count=t.length,this.parent={};for(var e=0,n=t;e0&&(this.list[0]=e,this.moveDown(0)),t},t.prototype.insert=function(t){if(null!==t){this.list.push(t);var e=this.list.length-1;return this.moveUp(e),!0}return!1},t.prototype.moveUp=function(t){for(var e=this.getParent(t);t&&t>0&&this.compareFn(this.list[e],this.list[t])>0;){var n=this.list[e];this.list[e]=this.list[t],this.list[t]=n,t=e,e=this.getParent(t)}},t.prototype.moveDown=function(t){var e,n=t,r=this.getLeft(t),i=this.getRight(t),o=this.list.length;null!==r&&r0?n=r:null!==i&&i0&&(n=i),t!==n&&(e=[this.list[n],this.list[t]],this.list[t]=e[0],this.list[n]=e[1],this.moveDown(n))},t}(),ht=function(t,e){var n=[],r=t.nodes,i=void 0===r?[]:r,o=t.edges,a=void 0===o?[]:o;if(0===i.length)return n;var s=i[0],u=new Set;u.add(s);var c=new ft((function(t,n){return e?t.weight-n.weight:0}));for(A(s.id,a).forEach((function(t){c.insert(t)}));!c.isEmpty();){var l=c.delMin(),f=l.source,h=l.target;u.has(f)&&u.has(h)||(n.push(l),u.has(f)||(u.add(f),A(f,a).forEach((function(t){c.insert(t)}))),u.has(h)||(u.add(h),A(h,a).forEach((function(t){c.insert(t)}))))}return n},dt=function(t,e){var n=[],r=t.nodes,i=void 0===r?[]:r,o=t.edges,a=void 0===o?[]:o;if(0===i.length)return n;var s=a.map((function(t){return t}));e&&s.sort((function(t,e){return t.weight-e.weight}));for(var u=new ct(i.map((function(t){return t.id})));s.length>0;){var c=s.shift(),l=c.source,f=c.target;u.connected(l,f)||(n.push(c),u.union(l,f))}return n},pt=function(t,e,n){return n?{prim:ht,kruskal:dt}[n](t,e):dt(t,e)},gt=function(t,e,n){"number"!=typeof e&&(e=1e-6),"number"!=typeof n&&(n=.85);for(var r,i=1,o=0,a=1e3,s=t.nodes,u=void 0===s?[]:s,c=t.edges,l=void 0===c?[]:c,f=u.length,h={},d={},p=0;p0&&i>e;){o=0;for(p=0;p0&&(r+=d[b]/x)}h[v]=n*r,o+=h[v]}}o=(1-o)/f,i=0;for(p=0;p=0;e--){var n=this.dfsEdgeList[e],r=n.fromNode,i=n.toNode;rf||r.hasNode(o[l.to])||(e.labelp;v--){if("break"===g(v))break}if(h){var y=t.findMinLabel(f);o.dfsEdgeList.push(new bt(l,d,"-1",y.edgeLabel,"-1"));var m=o.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[m]===o.dfsEdgeList[m]&&a(f[y.edgeLabel].projected)}var b={};h=!1;var x=0;s.forEach((function(e){var n=new wt(e),o=t.findForwardPureEdges(r,n.edges[u[0]],c,n);o.length>0&&(h=!0,x=l,o.forEach((function(t){var n="".concat(t.label,"-").concat(i[t.to].label);b[n]||(b[n]={projected:[],edgeLabel:t.label,nodeLabel2:i[t.to].label}),b[n].projected.push({graphId:r.id,edge:t,preNode:e})})))}));var w=u.length,_=function(e){if(h)return"break";var n=u[e];s.forEach((function(e){var a=new wt(e),s=t.findForwardRmpathEdges(r,a.edges[n],c,a);s.length>0&&(h=!0,x=o.dfsEdgeList[n].fromNode,s.forEach((function(t){var n="".concat(t.label,"-").concat(i[t.to].label);b[n]||(b[n]={projected:[],edgeLabel:t.label,nodeLabel2:i[t.to].label}),b[n].projected.push({graphId:r.id,edge:t,preNode:e})})))}))};for(v=0;v=0;f--){var h=e.findBackwardEdge(u,l.edges[r[f]],l.edges[r[0]],l);if(h){var d="".concat(e.dfsCode.dfsEdgeList[r[f]].fromNode,"-").concat(h.label);s[d]||(s[d]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[r[f]].fromNode,edgeLabel:h.label}),s[d].projected.push({graphId:t.graphId,edge:h,preNode:t})}}if(!(n>=e.maxNodeNum)){e.findForwardPureEdges(u,l.edges[r[0]],o,l).forEach((function(e){var n="".concat(i,"-").concat(e.label,"-").concat(c[e.to].label);a[n]||(a[n]={projected:[],fromNodeId:i,edgeLabel:e.label,nodeLabel2:c[e.to].label}),a[n].projected.push({graphId:t.graphId,edge:e,preNode:t})}));var p=function(n){e.findForwardRmpathEdges(u,l.edges[r[n]],o,l).forEach((function(i){var o="".concat(e.dfsCode.dfsEdgeList[r[n]].fromNode,"-").concat(i.label,"-").concat(c[i.to].label);a[o]||(a[o]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[r[n]].fromNode,edgeLabel:i.label,nodeLabel2:c[i.to].label}),a[o].projected.push({graphId:t.graphId,edge:i,preNode:t})}))};for(f=0;fi){var a=i;i=r,r=a}var l=t.label,f="".concat(n,"-").concat(r,"-").concat(l,"-").concat(i),h="".concat(r,"-").concat(l,"-").concat(i);if(!o[h]){var d=o[h]||0;d++,o[h]=d}s[f]={graphId:n,nodeLabel1:r,edgeLabel:l,nodeLabel2:i}}))}))})),Object.keys(i).forEach((function(t){if(!(i[t]e&&(s=e);var r=n[t.id].inDegree;u>r&&(u=r);var i=n[t.id].outDegree;c>i&&(c=i)})),t[e]={degree:s,inDegree:u,outDegree:c}),{minPatternNodeLabelDegree:s,minPatternNodeLabelInDegree:u,minPatternNodeLabelOutDegree:c}},Nt=function(t,e,n,r,i,o,a){var s;if(void 0===n&&(n=!1),void 0===o&&(o="cluster"),void 0===a&&(a="cluster"),t&&t.nodes){var u=t.nodes.length;if(u){var c=H(t,n),l=H(e,n),f=jt(t.nodes,c,n),h=jt(e.nodes,l,n),d=At(t.nodes,o),p=d.nodeMap,v=d.nodeLabelMap,y=At(e.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;Ct(t.edges,a,p);var x=Ct(e.edges,a,m).edgeLabelMap,w=[];null==l||l.forEach((function(t){w=w.concat(t)})),i||(i=Math.max.apply(Math,Object(g.__spreadArray)(Object(g.__spreadArray)([],w,!1),[2],!1))),r||(r=i);var _=St(t,c,o,r),E=St(e,l,o,r),S=function(t,e,n,r,i){var o=Math.ceil(n/e),a={},s=0;return r.forEach((function(t,r){for(var u=0,c=0,l=t.nodeIdxs,f=t.neighborNum-1;u2*e)););if(d<2*e&&(a["".concat(r,"-").concat(h)]={start:r,end:h,distance:i[r][h]},u++,++s>=n))return a;if(++c>2*e)break}uD&&(D=n.length,N=n,P=e,T=t)}));var L={},R={},B={},F={},z={},G={};Object.keys(b).forEach((function(r,i){z[r]=[],n&&(G[r]=[]);var s=-1/0,u=b[r],c={};u.forEach((function(t){var e=h["".concat(T.id,"-").concat(t.id)];if(e&&z[r].push(e),sz[r][h]){c=!0;break}if(c)return N.splice(e,1),"continue";var d={};i.neighbors.forEach((function(t){var e=f["".concat(n.id,"-").concat(t.id)];d["".concat(n.id,"-").concat(t.id)]={start:p[n.id].idx,end:p[t.id].idx,distance:e}})),M=Ot(d,_,t,M);var g=[];Object.keys(d).forEach((function(t){if(I[t])g.push(I[t]);else{var e=M[t];I[t]=kt(e,j,o,a),g.push(I[t])}})),g=g.sort((function(t,e){return e-t}));var v=!1;for(h=0;h=0;g--)d(g)}));var U=[];null==N||N.forEach((function(r){for(var s=p[r.id].idx,u=Mt(t.nodes,c[s],s,o,i).neighbors,l=!1,h=u.length-1;h>=0;h--){if(u.length+1z[g][x])u.splice(h,1);else{if(n){var w="".concat(d.id,"-").concat(r.id),E=f[w];if(x=G[g].length-1,E>G[g][x]){u.splice(h,1);continue}}var S=I[v]?I[v]:It(t,r,d,p,y,_,j,o,a,I,M),O="".concat(T.id,"-").concat(g);if(S=0;g--){if("break"===_(g))break}if(w)return U.splice(r,1),"continue";i.edges=l;var E=Y(i,i.nodes[0].id,!1).length;if(Object.keys(E).reverse().forEach((function(t){if(t!==i.nodes[0].id&&!w){if(E[t]===1/0){var e=c[t].node[o];if(u[e]--,u[e]W[r][W[r].length-1]){e=c[t].node[o];if(u[e]--,u[e]=0;O--){var k=i.nodes[O],A=c[k.id].degree,C=c[k.id].inDegree,j=c[k.id].outDegree,I=k[o],N=Tt(L,I,m,b),P=N.minPatternNodeLabelDegree,D=N.minPatternNodeLabelInDegree,R=N.minPatternNodeLabelOutDegree;if(n?A=0;B--){var F=l[B];if(!c[F.source]||!c[F.target]){l.splice(B,1);var z=F[a];if(f[z]--,c[F.source]&&(c[F.source].degree--,c[F.source].outDegree--),c[F.target]&&(c[F.target].degree--,c[F.target].inDegree--),x[z]&&f[z]=0;q--){if("break"===V(q))break}var Z=U.length,K=function(t){var e=U[t],n={};e.edges.forEach((function(t){var e="".concat(t.source,"-").concat(t.target,"-").concat(t.label);n[e]?n[e]++:n[e]=1}));for(var r=function(t){var e=U[t],r={};e.edges.forEach((function(t){var e="".concat(t.source,"-").concat(t.target,"-").concat(t.label);r[e]?r[e]++:r[e]=1}));var i=!0;Object.keys(r).length!==Object.keys(n).length?i=!1:Object.keys(n).forEach((function(t){r[t]!==n[t]&&(i=!1)})),i&&U.splice(t,1)},i=Z-1;i>t;i--)r(i);Z=U.length};for(q=0;q<=Z-1;q++)K(q);return U}}},Pt=function(){function t(t){void 0===t&&(t=10),this.linkedList=new M,this.maxStep=t}return Object.defineProperty(t.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},t.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},t.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},t.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},t.prototype.toArray=function(){return this.linkedList.toArray().map((function(t){return t.value}))},t.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},t}(),Dt=G,Lt={getAdjMatrix:_,breadthFirstSearch:j,connectedComponent:T,getDegree:P,getInDegree:D,getOutDegree:L,detectCycle:G,detectDirectedCycle:Dt,detectAllCycles:z,detectAllDirectedCycle:F,detectAllUndirectedCycle:B,depthFirstSearch:R,dijkstra:Y,findAllPath:V,findShortestPath:W,floydWarshall:H,labelPropagation:q,louvain:nt,iLouvain:rt,kCore:it,kMeans:at,cosineSimilarity:st,nodesCosineSimilarity:ut,minimumSpanningTree:pt,pageRank:gt,getNeighbors:k,Stack:Pt,GADDI:Nt},Rt=w.a.transform,Bt=function(t){return function(e,n){return e[t]-n[t]}},Ft=function(t,e,n){return t>=e&&t<=n},zt=function(t,e,n,r){var i=n.x-t.x,o=n.y-t.y,a=e.x-t.x,s=e.y-t.y,u=r.x-n.x,c=r.y-n.y,l=a*c-s*u,f=1/l;if(l*l>1e-4*(a*a+s*s)*(u*u+c*c)){var h=(i*c-o*u)*f,d=(i*s-o*a)*f;return Ft(h,0,1)&&Ft(d,0,1)?{x:t.x+h*a,y:t.y+h*s}:null}return null},Gt=function(t,e){var n=t.x,r=t.y,i=t.width,o=t.height,a=[],s={x:n+i/2,y:r+o/2};a.push({x:n,y:r}),a.push({x:n+i,y:r}),a.push({x:n+i,y:r+o}),a.push({x:n,y:r+o}),a.push({x:n,y:r});for(var u=null,c=1;ce[r][o]+e[o][i]&&(e[r][i]=e[r][o]+e[o][i]);return e},Kt=function(t,e){var n=t.nodes,r=t.edges,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach((function(t,e){o[t.id]=e;i.push([])})),r&&r.forEach((function(t){var n=t.source,r=t.target,a=o[n],s=o[r];i[a][s]=1,e||(i[s][a]=1)})),i},Qt=function(t,e){t.translate(e.x,e.y)},$t=function(t,e,n,r){void 0===r&&(r={duration:500});var i=t.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]);var o=t.getCanvasBBox(),a=e.x-o.minX,s=e.y-o.minY;if(n){var u=a*i[0],c=s*i[4],l=0,f=0,h=0,d=0;t.animate((function(t){return i=Rt(i,[["t",(h=u*t)-l,(d=c*t)-f]]),l=h,f=d,{matrix:i}}),r)}else{var p=Rt(i,[["t",a,s]]);t.setMatrix(p)}},Jt=function(t,e){var n=t.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var r=e;Object(v.isArray)(e)||(r=[e,e]),Object(v.isArray)(e)&&1===e.length&&(r=[e[0],e[0]]),n=Rt(n,[["s",r[0],r[1]]]),t.setMatrix(n)},te=function(t,e){var n=t.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]),n=Rt(n,[["r",e]]),t.setMatrix(n)},ee=function(t,e,n){for(var r=[],i=0;i0!=o(u[1]-n)>0&&o(e-(n-s[1])*(s[0]-u[0])/(s[1]-u[1])-s[0])<0&&(r=!r)}return r},ie=function(t,e){return!(e.minX>t.maxX||e.maxXt.maxY||e.maxY1){var a=t[0],s=t[n-1];e.push({from:{x:s[0],y:s[1]},to:{x:a[0],y:a[1]}})}return e};if(t.length<2||e.length<2)return!1;var i=n(t),o=n(e);if(!ie(i,o))return!1;var a=!1;if(Object(v.each)(e,(function(e){if(re(t,e[0],e[1]))return a=!0,!1})),a)return!0;if(Object(v.each)(t,(function(t){if(re(e,t[0],t[1]))return a=!0,!1})),a)return!0;var s=r(t),u=r(e),c=!1;return Object(v.each)(u,(function(t){if(function(t,e){var n=!1;return Object(v.each)(t,(function(t){if(zt(t.from,t.to,e.from,e.to))return n=!0,!1})),n}(s,t))return c=!0,!1})),c},ae=function(){function t(t,e,n,r){this.x1=t,this.y1=e,this.x2=n,this.y2=r}return t.prototype.getBBox=function(){var t=Math.min(this.x1,this.x2),e=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),r=Math.max(this.y1,this.y2);return{x:t,y:e,minX:t,minY:e,maxX:n,maxY:r,width:n-t,height:r-e}},t}(),se=function(t,e){return{top:[t.minX,t.minY,t.maxX,t.minY],left:[t.minX,t.minY,t.minX,t.maxY],bottom:[t.minX,t.maxY,t.maxX,t.maxY],right:[t.maxX,t.minY,t.maxX,t.maxY]}[e]},ue=function(t,e){var n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){var o=n/i,a=r/i;if(o>=0&&o<=1&&a>=0&&a<=1)return o}return Number.POSITIVE_INFINITY},ce=function(t,e){for(var n=["top","left","bottom","right"],r=t.getBBox(),i=0,o=[],a=0;a<4;a++){var s=se(r,n[a]),u=s[0],c=s[1],l=s[2],f=s[3];o[a]=zt({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:u,y:c},{x:l,y:f}),o[a]&&(i+=1)}return[o,i]},le=function(t,e){for(var n=["top","left","bottom","right"],r=t.getBBox(),i=Number.POSITIVE_INFINITY,o=0,a=0;a<4;a++){var s=se(r,n[a]),u=s[0],c=s[1],l=s[2],f=s[3],h=ue(e,new ae(u,c,l,f));(h=Math.abs(h-.5))>=0&&h<=1&&(o+=1,i=h0){for(var r=0,i=t;re.x+e.width,i=t.y>e.y+e.height,o=t.y":.604998779296875,"/":.5,"?":.53699951171875},je=Math.PI,Ie=Math.sin,Te=Math.cos,Ne=Ie(je/8),Pe=Te(je/8),De=function(t,e){var n=t.getBBox(),r={x:n.minX,y:n.minY},i={x:n.maxX,y:n.maxY};if(e){var o=e.getMatrix();o||(o=[1,0,0,0,1,0,0,0,1]),r=Xt(r,o),i=Xt(i,o)}var a=r.x,s=r.y,u=i.x,c=i.y;return{x:a,y:s,minX:a,minY:s,maxX:u,maxY:c,width:u-a,height:c-s}},Le=function(t){var e=t.sourceNode||t.targetNode,n=e.get("group").getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var r=e.getKeyShape(),i=r.getBBox(),o=t.loopCfg||{},a=o.dist||2*Math.max(i.width,i.height),s=o.position||Ae.defaultLoopPosition,u=[(i.minX+i.maxX)/2+n[6],(i.minY+i.maxY)/2+n[7]],c=[t.startPoint.x,t.startPoint.y],l=[t.endPoint.x,t.endPoint.y],f=i.height/2,h=i.width/2,d=f,p=f,g=d*Ne,v=d*Pe,y=p*Ne,m=p*Pe,b=r.get("type"),x=Math.min(f/2,h/2),_=Math.min(f,h),E=(null==o?void 0:o.pointPadding)?Math.min(_,null==o?void 0:o.pointPadding):x;if(c[0]===l[0]&&c[1]===l[1]){switch(s){case"top":"circle"===b?(c=[u[0]-g,u[1]-v],l=[u[0]+y,u[1]-m]):(c=[u[0]-E,u[1]-f],l=[u[0]+E,u[1]-f]);break;case"top-right":d=f,p=h,"circle"===b?(c=[u[0]+(g=d*Ne),u[1]-(v=d*Pe)],l=[u[0]+(m=p*Pe),u[1]-(y=p*Ne)]):(c=[u[0]+h-E,u[1]-f],l=[u[0]+h,u[1]-f+E]);break;case"right":d=h,p=h,"circle"===b?(c=[u[0]+(v=d*Pe),u[1]-(g=d*Ne)],l=[u[0]+(m=p*Pe),u[1]+(y=p*Ne)]):(c=[u[0]+h,u[1]-E],l=[u[0]+h,u[1]+E]);break;case"bottom-right":d=h,p=f,"circle"===b?(c=[u[0]+(v=d*Pe),u[1]+(g=d*Ne)],l=[u[0]+(y=p*Ne),u[1]+(m=p*Pe)]):(c=[u[0]+h,u[1]+f-E],l=[u[0]+h-E,u[1]+f]);break;case"bottom":d=f,p=f,"circle"===b?(c=[u[0]+(g=d*Ne),u[1]+(v=d*Pe)],l=[u[0]-(y=p*Ne),u[1]+(m=p*Pe)]):(c=[u[0]-E,u[1]+f],l=[u[0]+E,u[1]+f]);break;case"bottom-left":d=f,p=h,"circle"===b?(c=[u[0]-(g=d*Ne),u[1]+(v=d*Pe)],l=[u[0]-(m=p*Pe),u[1]+(y=p*Ne)]):(c=[u[0]-h,u[1]+f-E],l=[u[0]-h+E,u[1]+f]);break;case"left":d=h,p=h,"circle"===b?(c=[u[0]-(v=d*Pe),u[1]+(g=d*Ne)],l=[u[0]-(m=p*Pe),u[1]-(y=p*Ne)]):(c=[u[0]-h,u[1]-E],l=[u[0]-h,u[1]+E]);break;case"top-left":d=h,p=f,"circle"===b?(c=[u[0]-(v=d*Pe),u[1]-(g=d*Ne)],l=[u[0]-(y=p*Ne),u[1]-(m=p*Pe)]):(c=[u[0]-h+E,u[1]-f],l=[u[0]-h,u[1]-f+E]);break;default:c=[u[0]-(g=(d=h)*Ne),u[1]-(v=d*Pe)],l=[u[0]+(y=(p=h)*Ne),u[1]-(m=p*Pe)]}if(!1===o.clockwise){var S=[c[0],c[1]];c=[l[0],l[1]],l=[S[0],S[1]]}}var M=[c[0]-u[0],c[1]-u[1]],O=(d+a)/d,k=(p+a)/p;!1===o.clockwise&&(O=(p+a)/p,k=(d+a)/d);var A=w.c.scale([0,0],M,O),C=[u[0]+A[0],u[1]+A[1]],j=[l[0]-u[0],l[1]-u[1]],I=w.c.scale([0,0],j,k),T=[u[0]+I[0],u[1]+I[1]];return t.startPoint={x:c[0],y:c[1]},t.endPoint={x:l[0],y:l[1]},t.controlPoints=[{x:C[0],y:C[1]},{x:T[0],y:T[1]}],t},Re=function(t,e,n,r,i){var o=[],a=null==t?void 0:t.getPoint(e);if(!a)return{x:0,y:0,angle:0};if(e<1e-4)o=t.getStartTangent().reverse();else if(e>.9999)o=t.getEndTangent();else{var s=null==t?void 0:t.getPoint(e+1e-4);o.push([a.x,a.y]),o.push([s.x,s.y])}var u=Math.atan2(o[1][1]-o[0][1],o[1][0]-o[0][0]);if(u<0&&(u+=2*je),n&&(a.x+=Te(u)*n,a.y+=Ie(u)*n),r){var c=u-je/2;u>.5*je&&u<1.5*je&&(c-=je),a.x+=Te(c)*r,a.y+=Ie(c)*r}var l={x:a.x,y:a.y,angle:u};return i?(u>.5*je&&u<1.5*je&&(u-=je),Object(g.__assign)({rotate:u},l)):l},Be=function(t,e){"function"==typeof e&&function t(e,n,r,i){if(!1===i(e,n,r))return!1;if(e&&e.children)for(var o=e.children.length-1;o>=0;o--)if(!t(e.children[o],e,o,i))return!1;return!0}(t,null,-1,e)},Fe=function(t,e){"function"==typeof e&&function t(e,n,r,i){if(e&&e.children)for(var o=e.children.length-1;o>=0;o--)if(!t(e.children[o],e,o,i))return;return!1!==i(e,n,r)}(t,null,-1,e)},ze=function(t,e){return e*(Ce[t]||1)},Ge=function(t,e){var n=0,r=new RegExp("[涓€-榫+");return t.split("").forEach((function(t){r.test(t)?n+=e:n+=ze(t,e)})),[n,e]},Ye=function(t,e){return"number"!=typeof e||e<=0||e>=t.length?t:t.substring(0,e)+"..."},Ue=function(t,e){var n=[],r={},i={};t.forEach((function(t){i[t.id]=t})),t.forEach((function(t,e){var o=Object(v.clone)(t);o.itemType="combo",o.children=void 0,o.parentId===o.id?(console.warn("The parentId for combo ".concat(o.id," can not be the same as the combo's id")),delete o.parentId):o.parentId&&!i[o.parentId]&&(console.warn("The parent combo for combo ".concat(o.id," does not exist!")),delete o.parentId);var a=r[o.id];if(a){if(o.children=a.children,r[o.id]=o,!(a=o).parentId)return void n.push(a);var s=r[a.parentId];if(s)s.children?s.children.push(o):s.children=[o];else{var u={id:a.parentId,children:[a]};r[a.parentId]=u,r[o.id]=o}}else if(Object(v.isString)(t.parentId)){var c=r[t.parentId];if(c)c.children?c.children.push(o):c.children=[o],r[o.id]=o;else{var l={id:t.parentId,children:[o]};r[l.id]=l,r[o.id]=o}}else n.push(o),r[o.id]=o}));var o={};(e||[]).forEach((function(t){o[t.id]=t;var e=r[t.comboId];if(e){var n={id:t.id,comboId:t.comboId};e.children?e.children.push(n):e.children=[n],n.itemType="node",r[t.id]=n}}));var a=0;return n.forEach((function(t){t.depth=a+10,Be(t,(function(t){var e,n=r[t.id].itemType;e="node"===n?r[t.comboId]:r[t.parentId],t.depth=e&&"node"===n?a+1:a+10,a-1&&o.splice(c,1),s||(i={id:e,itemType:"node",comboId:n},a[e]={children:void 0}),e){var l=!1;if(n){var f=0;(t||[]).forEach((function(t){l||Be(t,(function(t){return n!==t.id||(l=!0,t.children?t.children.push(i):t.children=[i],f=t.depth,"node"===i.itemType?i.depth=f+2:i.depth=f+1,!1)}))}))}else n&&l||"node"===i.itemType||t.push(i);var h=i.depth;Be(i,(function(t){return"node"===t.itemType?h+=2:h+=1,t.depth=h,!0}))}return t},We=function(t,e,n){var r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,x:void 0,y:void 0,width:void 0,height:void 0,centerX:void 0,centerY:void 0};if(!t||0===t.length){var i=(null==n?void 0:n.getModel())||{},o=i.x,a=i.y,s=i.fixSize,u=i.collapsed,c=i.fixCollapseSize,l=u?c:s,f=Object(v.isArray)(l)?l:[l,l],h=f[0],d=f[1],p=[h/2,d/2];return{minX:o-p[0],minY:a-p[1],maxX:o+p[0],maxY:a+p[1],x:o,y:a,width:h,height:d}}return t.forEach((function(t){var n=e.findById(t.id);if(n&&n.isVisible()){n.set("bboxCanvasCache",void 0);var i=n.getCanvasBBox();i.x&&r.minX>i.minX&&(r.minX=i.minX),i.y&&r.minY>i.minY&&(r.minY=i.minY),i.x&&r.maxXn&&(n=c),l>i&&(i=l)}return{x:Math.floor(e),y:Math.floor(r),width:Math.ceil(n)-Math.floor(e),height:Math.ceil(i)-Math.floor(r),minX:e,minY:r,maxX:n,maxY:i}},on=function(t,e,n,r,i){void 0===e&&(e=15),void 0===n&&(n="quadratic"),void 0===r&&(r=void 0),void 0===i&&(i=void 0);for(var o=t.length,a=2*e,s=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],u={},c=[],l={},f=0;fr.get("optimizeThreshold")){var a=1/0,s=1/0,u=-1/0,c=-1/0;o.forEach((function(t){var e=t.getModel(),n=e.x,r=e.y;a>n&&(a=n),s>r&&(s=r),ud&&(p=d,console.warn("fitview failed, ratio out of range, ratio: %f",a,"graph maxzoom has been used instead"));var g=Object(an.transform)(f,[["t",-i.x,-i.y],["s",p,p],["t",i.x,i.y]]),v=qe({animateCfg:n,callback:function(){t.setMatrix(g),u.emit("viewportchange",{action:"translate",matrix:f}),u.emit("viewportchange",{action:"zoom",matrix:g})}});t.stopAnimate(),t.setMatrix(e),t.animate((function(t){return{matrix:me(e,g,t)}}),v)}else{var y=qe({animateCfg:n,callback:function(){u.emit("viewportchange",{action:"translate",matrix:f})}});t.animate((function(t){return{matrix:me(e,f,t)}}),y)}}},t.prototype.fitView=function(t,e){var n,r=this.graph,i=this.getFormatPadding(),o=r.get("width"),a=r.get("height"),s=r.get("group"),u=s.getMatrix()||[1,0,0,0,1,0,0,0,1];s.resetMatrix();var c=r.getNodes();if(c.length>r.get("optimizeThreshold")){var l=1/0,f=1/0,h=-1/0,d=-1/0;c.forEach((function(t){var e=t.getModel(),n=e.x,r=e.y;l>n&&(l=n),f>r&&(f=r),hy&&(m=y),t)this.animatedFitView(s,u,e,n,p,g,m,!0);else{var b=p.x-g.x,x=p.y-g.y;if(nn(b)||nn(x))return;r.translate(b,x),r.zoom(m,p)||console.warn("zoom failed, ratio out of range, ratio: %f",m)}}},t.prototype.fitViewByRules=function(t,e,n){var r,i=t.onlyOutOfViewPort,o=void 0!==i&&i,a=t.direction,s=void 0===a?"both":a,u=t.ratioRule,c=void 0===u?"min":u,l=this.graph,f=this.getFormatPadding(),h=l.get("width"),d=l.get("height"),p=l.get("group"),g=p.getMatrix()||[1,0,0,0,1,0,0,0,1];p.resetMatrix();var v=l.getNodes();if(v.length>l.get("optimizeThreshold")){var y=1/0,m=1/0,b=-1/0,x=-1/0;v.forEach((function(t){var e=t.getModel(),n=e.x,r=e.y;y>n&&(y=n),m>r&&(m=r),bl.maxX&&(l.maxX=d.maxX),d.maxY>l.maxY&&(l.maxY=d.maxY)}if(l.x=l.minX,l.y=l.minY,l.width=l.maxX-l.minX,l.height=l.maxY-l.minY,0!==l.width&&0!==l.height){var p=this.getViewCenter(),g={x:l.x+l.width/2,y:l.y+l.height/2},v=(a-o[1]-o[3])/l.width,y=(s-o[0]-o[2])/l.height,m=v;v>y&&(m=y),n?this.animatedFitView(u,c,r,l,p,g,m,e):(i.translate(p.x-g.x,p.y-g.y),e&&!i.zoom(m,p)&&console.warn("zoom failed, ratio out of range, ratio: %f",m))}}},t.prototype.changeSize=function(t,e){var n=this.graph;if(!Object(v.isNumber)(t)||!Object(v.isNumber)(e))throw Error("invalid canvas width & height, please make sure width & height type is number");n.set({width:t,height:e}),n.get("canvas").changeSize(t,e),n.get("plugins").forEach((function(t){t.get("gridContainer")&&t.positionInit()}))},t.prototype.destroy=function(){this.graph=null,this.destroyed=!1},t}();function un(t){return(un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function cn(t){if("string"!=typeof t)return t;var e=function(t){if("string"!=typeof t)return t;try{return JSON.parse(t.trim())}catch(e){return t.trim()}},n=e(t);if("string"!=typeof n)return n;for(var r=function(t){return t[t.length-1]},i=t.trim(),o=[],a=[],s=function(){for(var t=[],e=0;er.width&&(r.width=l.width+l.x),l.height+l.y>r.height&&(r.height=l.height+l.y)}}}return t.bbox=function(t,e,n){var r,i,o=t.attrs,a=void 0===o?{}:o,s={x:e.x||0,y:e.y||0,width:n.width||0,height:n.height||0};switch(t.type){case"maker":case"circle":a.r&&(i=2*a.r,r=2*a.r);break;case"text":a.text&&(i=Ge(a.text,a.fontSize||12)[0],r=16,s.y+=r,s.height=r,s.width=i,t.attrs=Object(g.__assign)({fontSize:12,fill:"#000"},a));break;default:a.width&&(i=a.width),a.height&&(r=a.height)}return r>=0&&(s.height=r),i>=0&&(s.width=i),a.marginTop&&(s.y+=a.marginTop),a.marginLeft&&(s.x+=a.marginLeft),s}(t,e,r),t.attrs=Object(g.__assign)(Object(g.__assign)({},t.attrs),t.bbox),t}function fn(t){var e={},n=function(e){var n=function(t){return function(e){for(var n=t.length,r=[],i=0,o="";i0||(null===(i=n.children)||void 0===i?void 0:i.length)>0)for(var l=Math.max(null===(o=e.children)||void 0===o?void 0:o.length,null===(a=n.children)||void 0===a?void 0:a.length),f=n.children||[],h=e.children||[],d=0;d-1)return;n.push(i)}else s>-1&&n.splice(s,1)}else if(Object(v.isString)(e)){var u=n.filter((function(t){return t.includes(o)}));u.length>0&&this.clearStates(u),(a=a.filter((function(t){return!t.includes(o)}))).push(i),this.set("states",a)}if(r){var c=this.get("model").type;r.setState(c,t,e,this)}},t.prototype.clearStates=function(t){var e=this,n=e.getStates(),r=e.get("shapeFactory"),i=e.get("model").type;t||(t=n),Object(v.isString)(t)&&(t=[t]);var o=n.filter((function(e){return-1===t.indexOf(e)}));e.set("states",o),t.forEach((function(t){r.setState(i,t,!1,e)}))},t.prototype.setOptimize=function(t){this.optimize=t},t.prototype.getContainer=function(){return this.get("group")},t.prototype.getKeyShape=function(){return this.get("keyShape")},t.prototype.getModel=function(){return this.get("model")},t.prototype.getType=function(){return this.get("type")},t.prototype.getID=function(){return this.get("id")},t.prototype.isItem=function(){return!0},t.prototype.getStates=function(){return this.get("states")},t.prototype.hasState=function(t){return this.getStates().indexOf(t)>=0},t.prototype.refresh=function(t){var e=this.get("model");this.updatePosition(e),this.updateShape(t),this.afterUpdate(),this.clearCache()},t.prototype.getUpdateType=function(t){},t.prototype.update=function(t,e){void 0===e&&(e=void 0);var n=this.get("model");if("move"===e)this.updatePosition(t);else{var r=n.visible,i=t.visible;r!==i&&void 0!==i&&this.changeVisibility(i);var o={x:n.x,y:n.y};t.x=isNaN(+t.x)?n.x:+t.x,t.y=isNaN(+t.y)?n.y:+t.y;var a=this.get("styles");if(t.stateStyles){var s=t.stateStyles;Object(v.mix)(a,s),delete t.stateStyles}Object.assign(n,t),o.x===t.x&&o.y===t.y||this.updatePosition(t),this.updateShape(e)}this.afterUpdate(),this.clearCache()},t.prototype.updateShape=function(t){var e=this.get("shapeFactory"),n=this.get("model"),r=n.type;if(e.shouldUpdate(r)&&r===this.get("currentShape")){var i=this.getShapeCfg(n,t);e.baseUpdate(r,i,this,t),"move"!==t&&this.setOriginStyle()}else this.draw();this.restoreStates(e,r)},t.prototype.updatePosition=function(t){var e=this.get("model"),n=isNaN(+t.x)?+e.x:+t.x,r=isNaN(+t.y)?+e.y:+t.y,i=this.get("group");if(isNaN(n)||isNaN(r))return!1;e.x=n,e.y=r;var o=i.getMatrix();return(!o||o[6]!==n||o[7]!==r)&&(i.resetMatrix(),Qt(i,{x:n,y:r}),this.clearCache(),!0)},t.prototype.getBBox=function(){var t=this.get("bboxCache");return t||(t=this.calculateBBox(),this.set("bboxCache",t)),t},t.prototype.getCanvasBBox=function(){var t=this.get("bboxCanvasCache");return t||(t=this.calculateCanvasBBox(),this.set("bboxCanvasCache",t)),t},t.prototype.toFront=function(){this.get("group").toFront()},t.prototype.toBack=function(){this.get("group").toBack()},t.prototype.show=function(){this.changeVisibility(!0)},t.prototype.hide=function(){this.changeVisibility(!1)},t.prototype.changeVisibility=function(t){var e=this.get("group");t?e.show():e.hide(),this.set("visible",t)},t.prototype.isVisible=function(){return this.get("visible")},t.prototype.enableCapture=function(t){var e=this.get("group");e&&e.set("capture",t)},t.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),e=this.get("group");t&&e.stopAnimate(),e.shapeMap={},this.clearCache(),e.remove(),this._cfg=null,this.destroyed=!0}},t}(),bn={source:"start",target:"end"},xn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(g.__extends)(e,t),e.prototype.getDefaultCfg=function(){return{type:"edge",sourceNode:null,targetNode:null,startPoint:null,endPoint:null,linkCenter:!1}},e.prototype.setEnd=function(t,e){var n=bn[t]+"Point",r=t+"Node",i=this.get(r);i&&!i.destroyed&&i.removeEdge(this),Object(v.isPlainObject)(e)?(this.set(n,e),this.set(r,null)):e&&(e.addEdge(this),this.set(r,e),this.set(n,null))},e.prototype.getLinkPoint=function(t,e,n){var r=bn[t]+"Point",i=t+"Node",o=this.get(r);if(!o){var a=this.get(i),s=t+"Anchor",u=this.getPrePoint(t,n),c=e[s];Object(v.isNil)(c)||(o=a.getLinkPointByAnchor(c)),o=o||a.getLinkPoint(u),Object(v.isNil)(o.index)||this.set("".concat(t,"AnchorIndex"),o.index)}return o},e.prototype.getPrePoint=function(t,e){if(e&&e.length)return e["source"===t?0:e.length-1];var n="source"===t?"target":"source";return this.getEndPoint(n)},e.prototype.getEndPoint=function(t){var e=t+"Node",n=bn[t]+"Point",r=this.get(e);return r&&!r.destroyed?r.get("model"):this.get(n)},e.prototype.getControlPointsByCenter=function(t){var e=this.getEndPoint("source"),n=this.getEndPoint("target"),r=this.get("shapeFactory"),i=t.type;return r.getControlPoints(i,{startPoint:e,endPoint:n})},e.prototype.getEndCenter=function(t){var e=t+"Node",n=bn[t]+"Point",r=this.get(e);if(r){var i=r.getBBox();return{x:i.centerX,y:i.centerY}}return this.get(n)},e.prototype.init=function(){t.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},e.prototype.getShapeCfg=function(e,n){var r=this.get("linkCenter"),i=(null==n?void 0:n.includes("move"))?e:t.prototype.getShapeCfg.call(this,e);if(r)i.startPoint=this.getEndCenter("source"),i.endPoint=this.getEndCenter("target");else{var o=i.controlPoints||this.getControlPointsByCenter(i);i.startPoint=this.getLinkPoint("source",e,o),i.endPoint=this.getLinkPoint("target",e,o)}return i.sourceNode=this.get("sourceNode"),i.targetNode=this.get("targetNode"),i},e.prototype.getModel=function(){var t=this.get("model"),e=this.get("source".concat("Node")),n=this.get("target".concat("Node"));return e?delete t["source".concat("Node")]:t.source=this.get("start".concat("Point")),n?delete t["target".concat("Node")]:t.target=this.get("end".concat("Point")),Object(v.isString)(t.source)||Object(v.isPlainObject)(t.source)||(t.source=t.source.getID()),Object(v.isString)(t.target)||Object(v.isPlainObject)(t.target)||(t.target=t.target.getID()),t},e.prototype.setSource=function(t){this.setEnd("source",t),this.set("source",t)},e.prototype.setTarget=function(t){this.setEnd("target",t),this.set("target",t)},e.prototype.getSource=function(){return this.get("source")},e.prototype.getTarget=function(){return this.get("target")},e.prototype.updatePosition=function(){return!1},e.prototype.update=function(t,e){void 0===e&&(e=void 0);var n=this.get("model"),r=n.visible,i=t.visible;r!==i&&void 0!==i&&this.changeVisibility(i);var o=this.get("source"),a=this.get("target");if(o&&!o.destroyed&&a&&!a.destroyed){var s=this.get("styles");if(t.stateStyles){var u=t.stateStyles;Object(v.mix)(s,u),delete t.stateStyles}Object.assign(n,t),this.updateShape(e),this.afterUpdate(),this.clearCache()}},e.prototype.destroy=function(){var e=this.get("source".concat("Node")),n=this.get("target".concat("Node"));e&&!e.destroyed&&e.removeEdge(this),n&&!n.destroyed&&n.removeEdge(this),t.prototype.destroy.call(this)},e}(mn),wn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(g.__extends)(e,t),e.prototype.getNearestPoint=function(t,e){for(var n=0,r=t[0],i=Ht(t[0],e),o=0;o-1&&e.splice(n,1)},e.prototype.clearCache=function(){this.set("bboxCache",null),this.set("anchorPointsCache",null)},e.prototype.getUpdateType=function(t){var e,n,r,i,o;if(t){var a=!Object(v.isNil)(t.x),s=!Object(v.isNil)(t.y),u=Object.keys(t);return 1===u.length&&(a||s)||2===u.length&&a&&s?"move":Object(v.isNumber)(t.x)||Object(v.isNumber)(t.y)||t.type||t.anchorPoints||t.size||(null==t?void 0:t.style)&&((null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.r)||(null===(n=null==t?void 0:t.style)||void 0===n?void 0:n.width)||(null===(r=null==t?void 0:t.style)||void 0===r?void 0:r.height)||(null===(i=null==t?void 0:t.style)||void 0===i?void 0:i.rx)||(null===(o=null==t?void 0:t.style)||void 0===o?void 0:o.ry))?"bbox|label":u.includes("label")||u.includes("labelCfg")?"style|label":"style"}},e.prototype.setState=function(e,n){var r=this;this.optimize?t.prototype.setState.call(this,e,n):this.runWithBBoxAffected((function(){return t.prototype.setState.call(r,e,n)}))},e.prototype.clearStates=function(e){var n=this;this.optimize?t.prototype.clearStates.call(this,e):this.runWithBBoxAffected((function(){return t.prototype.clearStates.call(n,e)}))},e.prototype.runWithBBoxAffected=function(t){var e=["r","width","height","rx","ry","lineWidth"],n=this.getKeyShape().attr(),r={};Object.keys(this.getKeyShape().attr()).forEach((function(t){e.includes(t)&&(r[t]=n[t])})),t();for(var i=this.getKeyShape().attr(),o=0;o-1&&(e.splice(n,1),!0)}},e.prototype.removeNode=function(t){if(t){var e=this.getNodes(),n=e.indexOf(t);return n>-1&&(e.splice(n,1),!0)}},e.prototype.getUpdateType=function(t){},e.prototype.getBBox=function(){return this.set("bboxCanvasCache",null),this.calculateCanvasBBox()},e.prototype.clearCache=function(){this.set("bboxCache",null),this.set("bboxCanvasCache",null),this.set("anchorPointsCache",null)},e.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),e=this.get("group");t&&e.stopAnimate(),e.shapeMap={},this.clearCache(),this.set("sizeCache",null),this.set("bbox",null),e.remove(),this._cfg=null,this.destroyed=!0}},e}(wn),En=function(){function t(t){var e=this;this.edgeToBeUpdateMap={},this.throttleRefresh=Object(v.throttle)((function(t){var n=e.graph;if(n&&!n.get("destroyed")){var r=e.edgeToBeUpdateMap;if(r){var i=Object.values(r);i.length&&(i.forEach((function(t){var e=t.edge;if(e&&!e.destroyed){var n=e.getSource(),r=e.getTarget();n&&!n.destroyed&&r&&!r.destroyed&&e.refresh(t.updateType)}})),e.edgeToBeUpdateMap={})}}}),16,{trailing:!0,leading:!0}),this.graph=t,this.destroyed=!1}return t.prototype.addItem=function(t,e){var n=this.graph,r="vedge"===t?"edge":t,i=n.get("".concat(r,"Group"))||n.get("group"),o=Object(v.upperFirst)(r),a=null,s=n.get(r+Object(v.upperFirst)("stateStyles"))||{},u=n.get("default"+o);e.stateStyles&&(s=e.stateStyles),u&&Object(v.each)(u,(function(t,n){Object(v.isObject)(t)&&!Object(v.isArray)(t)?e[n]=Object(v.deepMix)({},t,e[n]):Object(v.isArray)(t)?e[n]=e[n]||Object(v.clone)(u[n]):e[n]=e[n]||u[n]}));var c=n.get(r+"Mapper");if(c){var l=c(e);l.stateStyles&&(s=l.stateStyles,delete l.stateStyles),Object(v.each)(l,(function(t,n){Object(v.isObject)(t)&&!Object(v.isArray)(t)?e[n]=Object(v.deepMix)({},e[n],t):e[n]=l[n]||e[n]}))}if(n.emit("beforeadditem",{type:t,model:e}),"edge"===t||"vedge"===t){var f=void 0,h=void 0;if(f=e.source,h=e.target,f&&Object(v.isString)(f)&&(f=n.findById(f)),h&&Object(v.isString)(h)&&(h=n.findById(h)),!f||!h)return void console.warn("The source or target node of edge ".concat(e.id," does not exist!"));f.getType&&"combo"===f.getType()&&(e.isComboEdge=!0),h.getType&&"combo"===h.getType()&&(e.isComboEdge=!0),a=new xn({model:e,source:f,target:h,styles:s,linkCenter:n.get("linkCenter"),group:i.addGroup()})}else if("node"===t)a=new wn({model:e,styles:s,group:i.addGroup()});else if("combo"===t){var d=e.children,p=We(d,n),g=void 0,y=void 0;if(isNaN(p.x)?isNaN(e.x)&&(g=100*Math.random()):g=p.x,isNaN(p.y)?isNaN(e.y)&&(y=100*Math.random()):y=p.y,isNaN(e.x)||isNaN(e.y))e.x=g,e.y=y;else{var m=e.x-g,b=e.y-y;this.updateComboSucceeds(e.id,m,b,d)}var x=i.addGroup();x.setZIndex(e.depth),a=new _n({model:e,styles:s,animate:n.get("animate"),bbox:e.collapsed?We([],n):p,group:x}),e.collapsed||"circle"!==a.getKeyShape().get("type")||(p.width=Math.hypot(p.height,p.width),p.height=p.width,a.set("bbox",p),a.refresh());var w=a.getModel();(d||[]).forEach((function(t){var e=n.findById(t.id);a.addChild(e),t.depth=w.depth+2}))}if(a)return a.setOptimize(n.getNodes().length>n.get("optimizeThreshold")),n.get("".concat(t,"s")).push(a),n.get("itemMap")[a.get("id")]=a,n.emit("afteradditem",{item:a,model:e}),a},t.prototype.updateItem=function(t,e){var n,r,i=this,o=this.graph;if(Object(v.isString)(t)&&(t=o.findById(t)),t&&!t.destroyed){var a="";t.getType&&(a=t.getType());var s=o.get(a+"Mapper"),u=t.getModel(),c=u.x,l=u.y,f=t.getUpdateType(e);if(s){var h=s(Object(v.deepMix)({},u,e)),d=Object(v.deepMix)({},u,h,e);h.stateStyles&&(t.set("styles",d.stateStyles),delete d.stateStyles),Object(v.each)(d,(function(t,n){e[n]=t}))}else Object(v.each)(e,(function(t,n){u[n]&&Object(v.isObject)(t)&&!Object(v.isArray)(t)&&(e[n]=Object(g.__assign)(Object(g.__assign)({},u[n]),e[n]))}));if(o.emit("beforeupdateitem",{item:t,cfg:e}),"edge"===a){if(e.source){var p=e.source;Object(v.isString)(p)&&(p=o.findById(p)),t.setSource(p)}if(e.target){var y=e.target;Object(v.isString)(y)&&(y=o.findById(y)),t.setTarget(y)}t.update(e)}else if("node"===a){t.update(e,f);var m=t.getEdges();"move"===f?Object(v.each)(m,(function(t){i.edgeToBeUpdateMap[t.getID()]={edge:t,updateType:f},i.throttleRefresh()})):(null==f?void 0:f.includes("bbox"))&&Object(v.each)(m,(function(t){t.refresh(f)}))}else if("combo"===a){if(t.update(e,f),!isNaN(e.x)||!isNaN(e.y)){var b=e.x-c||0,x=e.y-l||0;this.updateComboSucceeds(u.id,b,x)}var w=t.getEdges();if(((null==f?void 0:f.includes("bbox"))||"move"===f)&&"combo"===a){var _=t.get("shapeFactory"),E=u.type||"circle";(void 0===u.animate||void 0===e.animate?null===(r=null===(n=_[E])||void 0===n?void 0:n.options)||void 0===r?void 0:r.animate:u.animate||e.animate)?setTimeout((function(){if(t&&!t.destroyed){var e=t.getKeyShape();e&&!e.destroyed&&Object(v.each)(w,(function(t){t&&!t.destroyed&&t.refresh()}))}}),201):Object(v.each)(w,(function(t){t.refresh()}))}}t.setOptimize(o.getNodes().length>o.get("optimizeThreshold")),o.emit("afterupdateitem",{item:t,cfg:e})}},t.prototype.updateCombo=function(t,e,n){var r,i,o=this,a=this.graph;if(Object(v.isString)(t)&&(t=a.findById(t)),t&&!t.destroyed){var s=t.getModel(),u=We(e,a,t),c=u.x,l=u.y;t.set("bbox",u);var f=c,h=l;n?(f=isNaN(s.x)?c:s.x,h=isNaN(s.y)?l:s.y):(f=isNaN(c)?s.x:c,h=isNaN(l)?s.y:l),t.update({x:f,y:h});var d=t.get("shapeFactory"),p=s.type||"circle";(void 0===s.animate?null===(i=null===(r=d[p])||void 0===r?void 0:r.options)||void 0===i?void 0:i.animate:s.animate)?setTimeout((function(){if(t&&!t.destroyed){var e=t.getKeyShape();e&&!e.destroyed&&(t.getShapeCfg(s),o.updateComboEdges(t))}}),201):this.updateComboEdges(t)}},t.prototype.updateComboEdges=function(t){for(var e,n,r=t.getEdges()||[],i=0;i-1&&o.splice(a,1),"edge"===i){var s=n.get("v".concat(i,"s")),u=s.indexOf(t);u>-1&&s.splice(u,1)}var c=t.get("id");delete n.get("itemMap")[c];var l=n.get("comboTrees"),f=t.get("id");if("node"===i){var h=t.getModel().comboId;if(l&&h){var d=l,p=!1;l.forEach((function(t){p||Be(t,(function(t){if(t.id===f&&d){var e=d.indexOf(t);return d.splice(e,1),p=!0,!1}return d=t.children,!0}))}))}for(var g=(x=t.getEdges()).length-1;g>=0;g--)n.removeItem(x[g],!1);h&&n.updateCombo(h)}else if("combo"===i){var y,m=t.getModel().parentId,b=!1;(l||[]).forEach((function(t){b||Be(t,(function(t){return t.id!==f||(y=t,b=!0,!1)}))})),y.removed=!0,y&&y.children&&y.children.forEach((function(t){e.removeItem(t.id)}));var x;for(g=(x=t.getEdges()).length;g>=0;g--)n.removeItem(x[g],!1);m&&n.updateCombo(m)}t.destroy(),n.emit("afterremoveitem",{item:r,type:i})}},t.prototype.setItemState=function(t,e,n){var r=this.graph,i=e;Object(v.isString)(n)&&(i="".concat(e,":").concat(n)),t.hasState(i)===n&&n||Object(v.isString)(n)&&t.hasState(i)||(r.emit("beforeitemstatechange",{item:t,state:i,enabled:n}),t.setState(e,n),r.autoPaint(),r.emit("afteritemstatechange",{item:t,state:i,enabled:n}))},t.prototype.priorityState=function(t,e){var n=this.graph,r=t;Object(v.isString)(t)&&(r=n.findById(t)),this.setItemState(r,e,!1),this.setItemState(r,e,!0)},t.prototype.clearItemStates=function(t,e){var n=this.graph;Object(v.isString)(t)&&(t=n.findById(t)),n.emit("beforeitemstatesclear",{item:t,states:e}),t.clearStates(e),n.emit("afteritemstatesclear",{item:t,states:e})},t.prototype.refreshItem=function(t){var e=this.graph;Object(v.isString)(t)&&(t=e.findById(t)),e.emit("beforeitemrefresh",{item:t}),t.refresh(),e.emit("afteritemrefresh",{item:t})},t.prototype.addCombos=function(t,e){var n=this,r=this.graph;(t||[]).forEach((function(t){Fe(t,(function(t){var r;return e.forEach((function(e){e.id===t.id&&(e.children=t.children,e.depth=t.depth,r=e)})),r&&n.addItem("combo",r),!0}))}));var i=r.get("comboGroup");i&&i.sort()},t.prototype.changeItemVisibility=function(t,e){var n=this,r=this.graph;if(Object(v.isString)(t)&&(t=r.findById(t)),t){if(r.emit("beforeitemvisibilitychange",{item:t,visible:e}),t.changeVisibility(e),t.getType&&"node"===t.getType()){var i=t.getEdges();Object(v.each)(i,(function(t){(!e||t.get("source").isVisible()&&t.get("target").isVisible())&&n.changeItemVisibility(t,e)}))}else if(t.getType&&"combo"===t.getType()){var o=r.get("comboTrees"),a=t.get("id"),s=[],u=!1;(o||[]).forEach((function(t){u||t.children&&0!==t.children.length&&Be(t,(function(t){return t.id!==a||(s=t.children,u=!0,!1)}))})),s&&(!e||e&&!t.getModel().collapsed)&&s.forEach((function(t){var i=r.findById(t.id);n.changeItemVisibility(i,e)}));i=t.getEdges();Object(v.each)(i,(function(t){(!e||t.get("source").isVisible()&&t.get("target").isVisible())&&n.changeItemVisibility(t,e)}))}return r.emit("afteritemvisibilitychange",{item:t,visible:e}),t}console.warn("The item to be shown or hidden does not exist!")},t.prototype.destroy=function(){this.graph=null,this.destroyed=!0},t}(),Sn=function(){function t(t){this.graph=t,this.destroyed=!1}return t.prototype.updateState=function(t,e,n){var r=this.graph.get("states"),i=e;Object(v.isString)(n)&&(i="".concat(e,":").concat(n)),r[i]||(r[i]=[]),n?r[i].push(t):r[i]=r[i].filter((function(e){return e!==t})),this.graph.set("states",r),this.graph.emit("graphstatechange",{states:r})},t.prototype.updateStates=function(t,e,n){var r=this.graph.get("states");(Object(v.isString)(e)?[e]:e).forEach((function(e){var i=e;r[i]||(r[i]=[]),Object(v.isString)(n)&&(i="".concat(e,":").concat(n)),n?r[i].push(t):r[i]=r[i].filter((function(e){return e!==t}))})),this.graph.set("states",r),this.graph.emit("graphstatechange",{states:e})},t.prototype.destroy=function(){this.graph=null,this.destroyed=!0},t}(),Mn=n(21),On=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,(function(t,n){if("\\"===t.charAt(0))return t.slice(1);var r=e[n];return 0===r&&(r="0"),r||""})):t},kn=function(t){var e=[];if(t.length<2)throw new Error("point length must largn than 2, now it's ".concat(t.length));for(var n=0,r=t;n0?s-1:o-1,c=w.c.normalize([0,0],w.c.add([0,0],a[u].v,w.c.scale([0,0],a[s].v,-1)));a[s].p=w.c.add([0,0],a[s].p,w.c.scale([0,0],c,e))}return a.map((function(t){var e=t.p;return{x:e[0],y:e[1]}}))}var Rn=function(t,e){for(var n=[],r=0;r<5;r++){var i=Math.cos((18+72*r)/180*Math.PI)*t,o=Math.sin((18+72*r)/180*Math.PI)*t,a=Math.cos((54+72*r)/180*Math.PI)*e,s=Math.sin((54+72*r)/180*Math.PI)*e;0===r?n.push(["M",i,-o]):n.push(["L",i,-o]),n.push(["L",a,-s])}return n.push(["Z"]),n},Bn=function(t,e,n){return(t.y-n.y)*(e.x-n.x)-(t.x-n.x)*(e.y-n.y)},Fn=function(t){var e=t.map((function(t){return{x:t.getModel().x,y:t.getModel().y}}));e.sort((function(t,e){return t.x===e.x?t.y-e.y:t.x-e.x}));for(var n={},r=e.length-1;r>=0;r--){var i=e[r],o=i.x,a=i.y;n["".concat(o,"-").concat(a)]&&e.splice(r,1),n["".concat(o,"-").concat(a)]=!0}if(1===e.length)return e;var s=[];for(r=0;r=2&&Bn(s[s.length-2],s[s.length-1],e[r])<=0;)s.pop();s.push(e[r])}var u=[];for(r=e.length-1;r>=0;r--){for(;u.length>=2&&Bn(u[u.length-2],u[u.length-1],e[r])<=0;)u.pop();u.push(e[r])}return u.pop(),s.pop(),s.concat(u)},zn={maxRoutingIterations:100,maxMarchingIterations:100,pixelGroupSize:2,edgeR0:10,edgeR1:10,nodeR0:5,nodeR1:10,morphBuffer:5,threshold:.001,skip:16,nodeInfluenceFactor:1,edgeInfluenceFactor:1,negativeNodeInfluenceFactor:-.5};function Gn(t,e,n){var r=!1,i=function(t,n){return e.cells[t+n*e.width]},o=function(t,e){var r=0;return i(t-1,e-1)>=n&&(r+=1),i(t,e-1)>n&&(r+=2),i(t-1,e)>n&&(r+=4),i(t,e)>n&&(r+=8),r},a=function(n,r){for(var i,a,s=n,u=r,c=0;c-1){if(t[0].x===s&&t[0].y===u)return!0}else t.push({x:s,y:u});var l=o(s,u);switch(l){case-1:return console.warn("Marched out of bounds"),!0;case 0:case 3:case 2:case 7:s++;break;case 12:case 14:case 4:s--;break;case 6:0===i&&(-1===a?s-=1:s+=1);break;case 1:case 13:case 5:u--;break;case 9:1===i&&(0===a?u-=1:u+=1);break;case 10:case 8:case 11:u++;break;default:return console.warn("Marching squares invalid state: ".concat(l)),!0}}};this.march=function(){for(var t=0;tn&&15!==o(t,s)&&(r=a(t,s));return r}}var Yn=function(t,e){var n=Number.POSITIVE_INFINITY,r=null;return t.forEach((function(t){var i=le(t,e);i>=0&&i0?t+1:t}),0);s*Math.pow(c+1,2)0;){var r=t.pop();if(0===t.length){n.push(r);break}var i=t.pop(),o=new ae(r.x1,r.y1,i.x2,i.y2);Yn(e,o)?(n.push(r),t.push(i)):t.push(o)}return n}(function(t,e,n,r){var i=[],o=[];o.push(t);for(var a=!0,s=0,u=function(t,e){var n=!1;return e.forEach((function(e){n||(pe(t,{x:e.x1,y:e.y1})||pe(t,{x:e.x2,y:e.y2}))&&(n=!0)})),n},c=function(t,e){for(var n=0,r=e;n=1;)h=Vn(n,l/=1.5,f,s),d=u(h,o)||u(h,i),p=c(h,e);!h||d||s&&p||(o.push(new ae(t.x1,t.y1,h.x,h.y)),o.push(new ae(h.x,h.y,t.x2,t.y2)),a=!0)};h(!0),a||h(!1)}}a||i.push(t),s+=1};!a&&o.length;)l()}for(;o.length;)i.push(o.pop());return i}(new ae(t.getModel().x,t.getModel().y,o.getModel().x,o.getModel().y),e,r,i))}var Xn=function(t,e,n){var r=Object.assign(zn,n),i=fe(t.map((function(t){return{x:t.getModel().x,y:t.getModel().y}})));t=t.sort((function(t,e){return he({x:t.getModel().x,y:t.getModel().y},i)-he({x:e.getModel().x,y:e.getModel().y},i)}));var o=[],a=[];t.forEach((function(t){Un(t,e,o,r.maxRoutingIterations,r.morphBuffer).forEach((function(t){a.push(t)})),o.push(t)}));for(var s,u,c,l,f,h=function(t,e,n){var r={minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,width:0,height:0,x:0,y:0},i=[];t.forEach((function(t){i.push(t.getBBox())})),e.forEach((function(t){i.push(t.getBBox())}));for(var o=0,a=i;or.maxX?s.maxX:r.maxX)+n,r.maxY=(s.maxY>r.maxY?s.maxY:r.maxY)+n}return r.width=r.maxX-r.minX,r.height=r.maxY-r.minY,r.x=r.minX,r.y=r.minY,r}(t,a,r.nodeR0),d=(s=h.width,u=h.height,c=r.pixelGroupSize,l=Math.ceil(s/c),f=Math.ceil(u/c),{cells:new Float32Array(Math.max(0,l*f)).fill(0),width:l,height:f}),p=[],g=[],v=0;v1)for(m=Math.floor(y.length/r.skip);m<3&&r.skip>1;)r.skip-=1,m=Math.floor(y.length/r.skip);for(var b=0,x=0;x0))break;r.nonMemberInfluenceFactor*=.8}}return g};function Wn(t,e,n,r,i,o){function a(t,e){var n=Math.floor((t-e)/o.pixelGroupSize);return n<0?0:n}function s(t,e){return t*o.pixelGroupSize+e}var u=(o.nodeR0-o.nodeR1)*(o.nodeR0-o.nodeR1),c=(o.edgeR0-o.edgeR1)*(o.edgeR0-o.edgeR1),l=function(t,e){return[Math.min(a(t.minX,e+r.minX),i.width),Math.min(a(t.minY,e+r.minY),i.height),Math.min(a(t.maxX,-e+r.minX),i.width),Math.min(a(t.maxY,-e+r.minY),i.height)]},f=function(t,e){for(var n=t.getBBox(),a=l(n,o.nodeR1),u=a[0],c=a[1],f=a[2],h=a[3],d=c;du.y?r?c.topLeft:c.bottomRight:r?c.topRight:c.bottomLeft:a.ys.x?r?c.topLeft:c.bottomRight:r?c.bottomLeft:c.topRight:o.x0?this.cfg.padding+t:10+t,this.cfg.bubbleCfg={nodeR0:this.padding-t,nodeR1:this.padding-t,morphBuffer:this.padding-t}},t.prototype.setType=function(){this.type=this.cfg.type,this.members.length<3&&(this.type="round-convex"),"round-convex"!==this.type&&"smooth-convex"!==this.type&&"bubble"!==this.type&&(console.warn("The hull type should be either round-convex, smooth-convex or bubble, round-convex is used by default."),this.type="round-convex")},t.prototype.calcPath=function(t,e){var n,r,i;switch(this.type){case"round-convex":i=Dn((n=Fn(t)).map((function(t){return[t.x,t.y]})),this.padding),r=Object(Mn.b)(i);break;case"smooth-convex":2===(n=Fn(t)).length?(i=Dn(n.map((function(t){return[t.x,t.y]})),this.padding),r=Object(Mn.b)(i)):n.length>2&&(i=Ln(n.map((function(t){return[t.x,t.y]})),this.padding),r=In(i));break;case"bubble":r=(n=Xn(t,e,this.cfg.bubbleCfg)).length>=2&&In(n)}return r},t.prototype.render=function(){this.group.addShape("path",{attrs:Object(g.__assign)({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},t.prototype.addMember=function(t){if(t){Object(v.isString)(t)&&(t=this.graph.findById(t)),this.members.push(t);var e=this.nonMembers.indexOf(t);return e>-1&&this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},t.prototype.addNonMember=function(t){if(t){Object(v.isString)(t)&&(t=this.graph.findById(t)),this.nonMembers.push(t);var e=this.members.indexOf(t);return e>-1&&this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},t.prototype.removeMember=function(t){if(t){Object(v.isString)(t)&&(t=this.graph.findById(t));var e=this.members.indexOf(t);return e>-1&&(this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0)}},t.prototype.removeNonMember=function(t){if(t){Object(v.isString)(t)&&(t=this.graph.findById(t));var e=this.nonMembers.indexOf(t);return e>-1&&(this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0)}},t.prototype.updateData=function(t,e){var n=this;this.group.findById(this.id).remove(),t&&(this.members=t.map((function(t){return Object(v.isString)(t)?n.graph.findById(t):t}))),e&&(this.nonMembers=e.map((function(t){return Object(v.isString)(t)?n.graph.findById(t):t}))),this.path=this.calcPath(this.members,this.nonMembers),this.render()},t.prototype.updateStyle=function(t){this.group.findById(this.id).attr(Object(g.__assign)({},t))},t.prototype.updateCfg=function(t){var e=this;this.cfg=Object(v.deepMix)(this.cfg,t),this.id=this.cfg.id,this.group=this.cfg.group,t.members&&(this.members=this.cfg.members.map((function(t){return Object(v.isString)(t)?e.graph.findById(t):t}))),t.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map((function(t){return Object(v.isString)(t)?e.graph.findById(t):t}))),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},t.prototype.contain=function(t){var e,n,r=this,i=(e=Object(v.isString)(t)?this.graph.findById(t):t).getKeyShape();if("path"===e.get("type"))n=jn(i.attr("path"));else{var o=i.getCanvasBBox();n=[[o.minX,o.minY],[o.maxX,o.minY],[o.maxX,o.maxY],[o.minX,o.maxY]]}return n=n.map((function(t){var e=r.graph.getPointByCanvas(t[0],t[1]);return[e.x,e.y]})),oe(n,jn(this.path))},t.prototype.destroy=function(){this.group.remove(),this.cfg=null},t}(),qn=w.a.transform,Zn=function(t){function e(e){var n=t.call(this)||this;return n.sortCombos=Object(v.debounce)((function(){var t=n.get("comboSorted");if(n&&!n.destroyed&&!t){n.set("comboSorted",!0);var e=[],r={};(n.get("comboTrees")||[]).forEach((function(t){Be(t,(function(t){return e[t.depth]?e[t.depth].push(t.id):e[t.depth]=[t.id],r[t.id]=t.depth,!0}))})),(n.getEdges().concat(n.get("vedges"))||[]).forEach((function(t){var n=t.getModel(),i=r[n.source]||0,o=r[n.target]||0,a=Math.max(i,o);e[a]?e[a].push(n.id):e[a]=[n.id]})),e.forEach((function(t){if(t&&t.length)for(var e=t.length-1;e>=0;e--){var r=n.findById(t[e]);r&&r.toFront()}}))}}),500,!1),n.cfg=Object(v.deepMix)(n.getDefaultCfg(),e),n.init(),n.animating=!1,n.destroyed=!1,n.cfg.enabledStack&&(n.undoStack=new Pt(n.cfg.maxStep),n.redoStack=new Pt(n.cfg.maxStep)),n}return Object(g.__extends)(e,t),e.prototype.init=function(){this.initCanvas();var t=new sn(this),e=new Ke(this),n=new En(this),r=new Sn(this);this.set({viewController:t,modeController:e,itemController:n,stateController:r}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},e.prototype.initGroups=function(){var t=this.get("canvas");if(t){var e=(t.get("el")||{}).id,n=void 0===e?"g6":e,r=t.addGroup({id:"".concat(n,"-root"),className:Ae.rootContainerClassName});if(this.get("groupByTypes")){var i=r.addGroup({id:"".concat(n,"-edge"),className:Ae.edgeContainerClassName}),o=r.addGroup({id:"".concat(n,"-node"),className:Ae.nodeContainerClassName}),a=r.addGroup({id:"".concat(n,"-combo"),className:Ae.comboContainerClassName});a.toBack(),this.set({nodeGroup:o,edgeGroup:i,comboGroup:a})}var s=r.addGroup({id:"".concat(n,"-delegate"),className:Ae.delegateContainerClassName});this.set({delegateGroup:s}),this.set("group",r)}},e.prototype.getDefaultCfg=function(){return{container:void 0,width:void 0,height:void 0,renderer:"canvas",modes:{},plugins:[],data:{},fitViewPadding:10,minZoom:.02,maxZoom:10,event:!0,groupByTypes:!0,directed:!1,autoPaint:!0,nodes:[],edges:[],combos:[],vedges:[],itemMap:{},linkCenter:!1,defaultNode:{},defaultEdge:{},nodeStateStyles:{},edgeStateStyles:{},states:{},animate:!1,animateCfg:{onFrame:void 0,duration:500,easing:"easeLinear"},callback:void 0,enabledStack:!1,maxStep:10,tooltips:[],optimizeThreshold:1e3}},e.prototype.set=function(t,e){return Object(v.isPlainObject)(t)?this.cfg=Object(g.__assign)(Object(g.__assign)({},this.cfg),t):this.cfg[t]=e,"enabledStack"!==t||!e||this.undoStack||this.redoStack||(this.undoStack=new Pt(this.cfg.maxStep),this.redoStack=new Pt(this.cfg.maxStep)),this},e.prototype.get=function(t){var e;return null===(e=this.cfg)||void 0===e?void 0:e[t]},e.prototype.getGroup=function(){return this.get("group")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.getMinZoom=function(){return this.get("minZoom")},e.prototype.setMinZoom=function(t){return this.set("minZoom",t)},e.prototype.getMaxZoom=function(){return this.get("maxZoom")},e.prototype.setMaxZoom=function(t){return this.set("maxZoom",t)},e.prototype.getWidth=function(){return this.get("width")},e.prototype.getHeight=function(){return this.get("height")},e.prototype.clearItemStates=function(t,e){Object(v.isString)(t)&&(t=this.findById(t));var n=this.get("itemController");e||(e=t.get("states")),n.clearItemStates(t,e),this.get("stateController").updateStates(t,e,!1)},e.prototype.node=function(t){"function"==typeof t&&this.set("nodeMapper",t)},e.prototype.edge=function(t){"function"==typeof t&&this.set("edgeMapper",t)},e.prototype.combo=function(t){"function"==typeof t&&this.set("comboMapper",t)},e.prototype.findById=function(t){return this.get("itemMap")[t]},e.prototype.find=function(t,e){var n,r=this.get("".concat(t,"s"));return Object(v.each)(r,(function(t,r){if(e(t,r))return n=t})),n},e.prototype.findAll=function(t,e){var n=[];return Object(v.each)(this.get("".concat(t,"s")),(function(t,r){e(t,r)&&n.push(t)})),n},e.prototype.findAllByState=function(t,e,n){return n?this.findAll(t,(function(t){return t.hasState(e)&&n(t)})):this.findAll(t,(function(t){return t.hasState(e)}))},e.prototype.translate=function(t,e,n,r){var i=this,o=this.get("group"),a=Object(v.clone)(o.getMatrix());if(a||(a=[1,0,0,0,1,0,0,0,1]),n){var s=qe({animateCfg:r,callback:function(){return i.emit("viewportchange",{action:"translate",matrix:o.getMatrix()})}});$t(o,{x:o.getCanvasBBox().x+t,y:o.getCanvasBBox().y+e},n,s||{duration:500,easing:"easeCubic"})}else a=qn(a,[["t",t,e]]),o.setMatrix(a),this.emit("viewportchange",{action:"translate",matrix:a}),this.autoPaint()},e.prototype.moveTo=function(t,e,n,r){var i=this.get("group");$t(i,{x:t,y:e},n,r||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:i.getMatrix()})},e.prototype.fitView=function(t,e,n,r){t&&this.set("fitViewPadding",t);var i=this.get("viewController");e?i.fitViewByRules(e,n,r):i.fitView(n,r),this.autoPaint()},e.prototype.fitCenter=function(t,e){this.get("viewController").fitCenter(t,e),this.autoPaint()},e.prototype.addBehaviors=function(t,e){return this.get("modeController").manipulateBehaviors(t,e,!0),this},e.prototype.removeBehaviors=function(t,e){return this.get("modeController").manipulateBehaviors(t,e,!1),this},e.prototype.updateBehavior=function(t,e,n){return this.get("modeController").updateBehavior(t,e,n),this},e.prototype.zoom=function(t,e,n,r){var i=this,o=this.get("group"),a=Object(v.clone)(o.getMatrix())||[1,0,0,0,1,0,0,0,1],s=this.get("minZoom"),u=this.get("maxZoom"),c=this.getZoom()||1,l=c*t,f=t,h=!1;if(s&&lu&&(f=u/c,h=!0),a=qn(a,e?[["t",-e.x,-e.y],["s",f,f],["t",e.x,e.y]]:[["s",f,f]]),n){var d=Object(v.clone)(o.getMatrix());d||(d=[1,0,0,0,1,0,0,0,1]);var p=d[0],g=p*f,y=qe({animateCfg:r,callback:function(){return i.emit("viewportchange",{action:"zoom",matrix:o.getMatrix()})}});o.animate((function(t){if(1===t)d=a;else{var n=ye(p,g,t)/d[0];d=qn(d,e?[["t",-e.x,-e.y],["s",n,n],["t",e.x,e.y]]:[["s",n,n]])}return{matrix:d}}),y)}else o.setMatrix(a),this.emit("viewportchange",{action:"zoom",matrix:a}),this.autoPaint();return!h},e.prototype.zoomTo=function(t,e,n,r){var i=t/this.getZoom();return this.zoom(i,e,n,r)},e.prototype.focusItem=function(t,e,n){var r=this.get("viewController"),i=!1;e?i=!0:void 0===e&&(i=this.get("animate"));var o={};n?o=n:void 0===n&&(o=this.get("animateCfg")),r.focus(t,i,o),this.autoPaint()},e.prototype.focusItems=function(t,e,n,r){this.get("viewController").focusItems(t,e,n,r)},e.prototype.autoPaint=function(){this.get("autoPaint")&&this.paint()},e.prototype.paint=function(){this.emit("beforepaint"),this.get("canvas").draw(),this.emit("afterpaint")},e.prototype.getPointByClient=function(t,e){return this.get("viewController").getPointByClient(t,e)},e.prototype.getClientByPoint=function(t,e){return this.get("viewController").getClientByPoint(t,e)},e.prototype.getPointByCanvas=function(t,e){return this.get("viewController").getPointByCanvas(t,e)},e.prototype.getCanvasByPoint=function(t,e){return this.get("viewController").getCanvasByPoint(t,e)},e.prototype.getGraphCenterPoint=function(){var t=this.get("group").getCanvasBBox();return{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}},e.prototype.getViewPortCenterPoint=function(){return this.getPointByCanvas(this.get("width")/2,this.get("height")/2)},e.prototype.showItem=function(t,e){void 0===e&&(e=!0);var n=this.get("itemController").changeItemVisibility(t,!0);if(e&&this.get("enabledStack")){var r=n.getID(),i={},o={};switch(n.getType()){case"node":i.nodes=[{id:r,visible:!1}],o.nodes=[{id:r,visible:!0}];break;case"edge":i.nodes=[{id:r,visible:!1}],o.edges=[{id:r,visible:!0}];break;case"combo":i.nodes=[{id:r,visible:!1}],o.combos=[{id:r,visible:!0}]}this.pushStack("visible",{before:i,after:o})}},e.prototype.hideItem=function(t,e){void 0===e&&(e=!0);var n=this.get("itemController").changeItemVisibility(t,!1);if(e&&this.get("enabledStack")){var r=n.getID(),i={},o={};switch(n.getType()){case"node":i.nodes=[{id:r,visible:!0}],o.nodes=[{id:r,visible:!1}];break;case"edge":i.nodes=[{id:r,visible:!0}],o.edges=[{id:r,visible:!1}];break;case"combo":i.nodes=[{id:r,visible:!0}],o.combos=[{id:r,visible:!1}]}this.pushStack("visible",{before:i,after:o})}},e.prototype.refreshItem=function(t){this.get("itemController").refreshItem(t)},e.prototype.setAutoPaint=function(t){this.set("autoPaint",t),this.get("canvas").set("autoDraw",t)},e.prototype.remove=function(t,e){void 0===e&&(e=!0),this.removeItem(t,e)},e.prototype.removeItem=function(t,e){void 0===e&&(e=!0);var n=t;if(Object(v.isString)(t)&&(n=this.findById(t)),!n&&Object(v.isString)(t))console.warn("The item ".concat(t," to be removed does not exist!"));else if(n){var r="";if(n.getType&&(r=n.getType()),e&&this.get("enabledStack")){var i=Object(g.__assign)(Object(g.__assign)({},n.getModel()),{itemType:r}),o={};switch(r){case"node":o.nodes=[i],o.edges=[];for(var a=n.getEdges(),s=a.length-1;s>=0;s--)o.edges.push(Object(g.__assign)(Object(g.__assign)({},a[s].getModel()),{itemType:"edge"}));break;case"edge":o.edges=[i];break;case"combo":o.combos=[i]}this.pushStack("delete",{before:o,after:{}})}if("node"===r)n.getModel().comboId&&this.updateComboTree(n,void 0,!1);if(this.get("itemController").removeItem(n),"combo"===r){var u=Xe(this.get("comboTrees"));this.set("comboTrees",u)}}},e.prototype.innerAddItem=function(t,e,n){if(!function(t,e){if("node"===t||"combo"===t){if(e.id&&!Object(v.isString)(e.id))return console.warn("G6 Warning Tips: missing 'id' property, or the 'id' %c".concat(e.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1}else if(!("edge"!==t||e.source&&e.target))return console.warn("G6 Warning Tips: missing 'source' or 'target' for the edge."),!1;return!0}(t,e))return!1;if(!e.id||!this.findById(e.id)){var r,i=this.get("comboTrees")||[];if("combo"===t){var o=this.get("itemMap"),a=!1;if(i.forEach((function(i){a||Fe(i,(function(i){if(e.parentId===i.id){a=!0;var s=Object(g.__assign)({id:e.id,depth:i.depth+2},e);i.children?i.children.push(s):i.children=[s],e.depth=s.depth,r=n.addItem(t,e)}var u=o[i.id];return a&&u&&u.getType&&"combo"===u.getType()&&n.updateCombo(u,i.children),!0}))})),!a){var s=Object(g.__assign)({id:e.id,depth:0},e);e.depth=s.depth,i.push(s),r=n.addItem(t,e)}this.set("comboTrees",i),e.collapsed&&(this.collapseCombo(r,!1),this.updateCombo(r))}else if("node"===t&&Object(v.isString)(e.comboId)&&i){var u;(u=this.findById(e.comboId))&&u.getType&&"combo"!==u.getType()&&console.warn("'".concat(e.comboId,"' is not a id of a combo in the graph, the node will be added without combo.")),r=n.addItem(t,e);var c=this.get("itemMap"),l=!1,f=!1;i.forEach((function(t){f||l||Fe(t,(function(t){if(t.id===e.id)return f=!0,!1;if(e.comboId===t.id&&!f){l=!0;var r=Object(v.clone)(e);r.itemType="node",t.children?t.children.push(r):t.children=[r],r.depth=t.depth+1}return l&&c[t.id].getType&&"combo"===c[t.id].getType()&&n.updateCombo(c[t.id],t.children),!0}))}))}else r=n.addItem(t,e);if("node"===t&&e.comboId||"combo"===t&&e.parentId)(u=this.findById(e.comboId||e.parentId))&&u.getType&&"combo"===u.getType()&&u.addChild(r);return r}console.warn("This item exists already. Be sure the id %c".concat(e.id,"%c is unique."),"font-size: 20px; color: red;","")},e.prototype.addItem=function(t,e,n,r){void 0===n&&(n=!0),void 0===r&&(r=!0);var i=this.get("comboSorted");this.set("comboSorted",i&&!r);var o=this.get("itemController"),a=this.innerAddItem(t,e,o);if(!1===a||!0===a)return a;var s=this.get("combos");if(s&&s.length>0&&this.sortCombos(),this.autoPaint(),n&&this.get("enabledStack")){var u=Object(g.__assign)(Object(g.__assign)({},a.getModel()),{itemType:t}),c={};switch(t){case"node":c.nodes=[u];break;case"edge":c.edges=[u];break;case"combo":c.combos=[u]}this.pushStack("add",{before:{},after:c})}return a},e.prototype.addItems=function(t,e,n){void 0===t&&(t=[]),void 0===e&&(e=!0),void 0===n&&(n=!0);var r=this.get("comboSorted");this.set("comboSorted",r&&!n);for(var i=this.get("itemController"),o=[],a=0;a0&&this.sortCombos()}if(this.autoPaint(),e&&this.get("enabledStack")){var c={nodes:[],edges:[],combos:[]};for(a=0;a=0;d--)h[d].destroyed&&h.splice(d,1);l&&(i.addCombos(l),this.get("groupByTypes")||this.sortCombos()),this.diffItems("edge",c,o.edges),Object(v.each)(u,(function(t,e){(!t.getType||"node"!==t.getType()&&"combo"!==t.getType())&&c.edges.indexOf(t)<0&&(delete u[e],i.remove(t,!1))})),(this.get("comboTrees")||[]).forEach((function(t){Fe(t,(function(t){return"combo"===r.findById(t.id).getType()&&t.collapsed&&r.collapseCombo(t.id,!1),!0}))})),this.set({nodes:c.nodes,edges:c.edges});var p=(this.get("layout")||{}).relayoutAtChangeData,g=void 0===p||p,y=this.get("layoutController");return g&&y&&(y.changeData((function(){setTimeout((function(){var t;null===(t=i.getCombos())||void 0===t||t.forEach((function(t){t.set("animate",!0)}))}),0)})),i.get("animate")&&!y.getLayoutType()?(i.positionsAnimate(),null===(n=i.getCombos())||void 0===n||n.forEach((function(t){return t.set("animate",!0)}))):i.autoPaint()),setTimeout((function(){a.set("localRefresh",s)}),16),this.set("data",o),this.emit("afterchangedata"),this},e.prototype.addCombos=function(t){var e=this.get("comboTrees");this.get("itemController").addCombos(e,t)},e.prototype.createCombo=function(t,e,n){var r=this;void 0===n&&(n=!0);var i=this.get("itemController");this.set("comboSorted",!1);var o,a="";if(t){if(Object(v.isString)(t))a=t,o={id:t};else{if(!(a=t.id))return void console.warn("Create combo failed. Please assign a unique string id for the adding combo.");o=t}var s=n&&this.get("enabledStack"),u={nodes:[],combos:[]};s&&e.forEach((function(t){var e=r.findById(t),n=e.getType();if("node"===n||"combo"===n){var i=e.getModel();u["".concat(n,"s")].push({id:t,parentId:"node"===n?i.comboId:i.parentId})}}));var c=this.get("comboTrees"),l=new Set(e),f=new Map;c&&(c.forEach((function(t){Fe(t,(function(t,e,n){if(l.has(t.id)){if(e){var o=r.findById(e.id),a=r.findById(t.id);e.children.splice(n,1),o.removeChild(a),i.updateCombo(o,e.children)}"combo"===t.itemType&&f.set(t.id,t)}return!0}))})),c=c.filter((function(t){return!l.has(t.id)})),this.set("comboTrees",c));var h={nodes:[],combos:[]},d=e.map((function(t){var e=r.findById(t),n=e.getModel(),i="";e.getType&&(i=e.getType());var o=f.get(t)||{id:e.getID(),itemType:i};return"combo"===i?(o.parentId=a,n.parentId=a):"node"===i&&(o.comboId=a,n.comboId=a),s&&h["".concat(i,"s")].push({id:n.id,parentId:a}),o}));o.children=d,this.addItem("combo",o,!1),this.set("comboSorted",!1),c&&(c.forEach((function(t){Be(t,(function(t){return t.id!==a||(t.itemType="combo",t.children=d,!1)}))})),this.sortCombos()),s&&(h.combos.push(o),this.pushStack("createCombo",{before:u,after:h}));var p=this.findById(a);!p.getModel().parentId&&p.getChildren().combos.length&&this.updateComboTree(p,void 0,!1),setTimeout((function(){p.set("animate",!0)}),0)}},e.prototype.uncombo=function(t,e){var n,r,i=this;void 0===e&&(e=!0);var o=t;if(Object(v.isString)(t)&&(o=this.findById(t)),!o||o.getType&&"combo"!==o.getType())console.warn("The item is not a combo!");else{var a=o.getModel(),s=o.getModel().parentId,u=this.get("comboTrees");u||(u=[]);var c,l=this.get("itemMap"),f=o.get("id"),h=[],d=this.get("combos"),p=this.findById(s),g=e&&this.get("enabledStack"),y={};if(g&&((y=Object(v.clone)(a)).children=[]),u.forEach((function(t){c||Fe(t,(function(t){var e;if(t.id===f){c=t,o.getEdges().map((function(t){return t.getID()})).forEach((function(t){i.removeItem(t,!1)}));var n=d.indexOf(o);d.splice(n,1),delete l[f];var r=Object(v.clone)(o.getModel());o.destroy(),i.emit("afterremoveitem",{item:r,type:"combo"})}return!s||!c||t.id!==s||(p.removeCombo(o),-1!==(n=(h=t.children).indexOf(c))&&h.splice(n,1),null===(e=c.children)||void 0===e||e.forEach((function(t){var e=i.findById(t.id),n=e.getModel();e.getType&&"combo"===e.getType()?(t.parentId=s,delete t.comboId,n.parentId=s,delete n.comboId):e.getType&&"node"===e.getType()&&(t.comboId=s,n.comboId=s),p.addChild(e),h.push(t)})),i.updateCombo(p),!1)}))})),!s&&c){var m=u.indexOf(c);u.splice(m,1),null===(n=c.children)||void 0===n||n.forEach((function(t){t.parentId=void 0;var e=i.findById(t.id).getModel();delete e.parentId,delete e.comboId,"node"!==t.itemType&&u.push(t)}))}if(g){var b={nodes:[],combos:[]},x={nodes:[],combos:[]};null===(r=c.children)||void 0===r||r.forEach((function(t){var e=i.findById(t.id).getType();"node"!==e&&"combo"!==e||(b["".concat(e,"s")].push({id:t.id,parentId:f}),x["".concat(e,"s")].push({id:t.id,parentId:s}))})),b.combos.push(y),this.pushStack("uncombo",{before:b,after:x})}}},e.prototype.updateCombos=function(t){var e=this;void 0===t&&(t=!1);var n=this.get("comboTrees"),r=this.get("itemController"),i=this.get("itemMap");(n||[]).forEach((function(n){Fe(n,(function(n){var o;if(!n)return!0;var a=i[n.id];if("combo"===(null===(o=null==a?void 0:a.getType)||void 0===o?void 0:o.call(a))){var s=Object(g.__spreadArray)([],a.getStates(),!0);Object(v.each)(s,(function(t){return e.setItemState(a,t,!1)})),r.updateCombo(a,n.children,t),Object(v.each)(s,(function(t){return e.setItemState(a,t,!0)}))}return!0}))})),this.sortCombos()},e.prototype.updateCombo=function(t){var e,n=this,r=t;if(Object(v.isString)(t)&&(r=this.findById(t)),!r||r.getType&&"combo"!==r.getType())console.warn("The item to be updated is not a combo!");else{e=r.get("id");var i=this.get("comboTrees"),o=this.get("itemController"),a=this.get("itemMap");(i||[]).forEach((function(t){Fe(t,(function(t){if(!t)return!0;var r=a[t.id];if(e===t.id&&r&&r.getType&&"combo"===r.getType()){var i=Object(g.__spreadArray)([],r.getStates(),!0);Object(v.each)(i,(function(t){r.getStateStyle(t)&&n.setItemState(r,t,!1)})),o.updateCombo(r,t.children),Object(v.each)(i,(function(t){r.getStateStyle(t)&&n.setItemState(r,t,!0)})),e&&(e=t.parentId)}return!0}))}))}},e.prototype.updateComboTree=function(t,e,n){void 0===n&&(n=!0);var r;this.set("comboSorted",!1);var i,o=(r=Object(v.isString)(t)?this.findById(t):t).getModel(),a=o.comboId||o.parentId,s="";if(r.getType&&(s=r.getType()),e&&"combo"===s){var u,c=this.get("comboTrees"),l=!0;if((c||[]).forEach((function(t){u||Be(t,(function(t){if(!u)return t.id===r.getID()&&(u=t),!0}))})),Be(u,(function(t){return t.id!==e||(l=!1,!1)})),!l)return void console.warn("Failed to update the combo tree! The parentId points to a descendant of the combo!")}if(n&&this.get("enabledStack")){var f={},h={};"combo"===s?(f.combos=[{id:o.id,parentId:o.parentId}],h.combos=[{id:o.id,parentId:e}]):"node"===s&&(f.nodes=[{id:o.id,parentId:o.comboId}],h.nodes=[{id:o.id,parentId:e}]),this.pushStack("updateComboTree",{before:f,after:h})}if(o.parentId||o.comboId){var d=this.findById(o.parentId||o.comboId);d&&d.removeChild(r)}("combo"===s?o.parentId=e:"node"===s&&(o.comboId=e),e)&&((i=this.findById(e))&&i.addChild(r));a&&((i=this.findById(a))&&i.removeChild(r));var p=Xe(this.get("comboTrees"),o.id,e);this.set("comboTrees",p),this.updateCombos()},e.prototype.save=function(){var t=[],e=[],n=[];return Object(v.each)(this.get("nodes"),(function(e){t.push(e.getModel())})),Object(v.each)(this.get("edges"),(function(t){e.push(t.getModel())})),Object(v.each)(this.get("combos"),(function(t){n.push(t.getModel())})),{nodes:t,edges:e,combos:n}},e.prototype.changeSize=function(t,e){return this.get("viewController").changeSize(t,e),this},e.prototype.refresh=function(){if(this.emit("beforegraphrefresh"),this.get("animate"))this.positionsAnimate();else{var t=this.get("nodes"),e=this.get("edges"),n=this.get("edges");Object(v.each)(t,(function(t){t.refresh()})),Object(v.each)(e,(function(t){t.refresh()})),Object(v.each)(n,(function(t){t.refresh()}))}this.emit("aftergraphrefresh"),this.autoPaint()},e.prototype.getNodes=function(){return this.get("nodes")},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getCombos=function(){return this.get("combos")},e.prototype.getComboChildren=function(t){if(Object(v.isString)(t)&&(t=this.findById(t)),t&&(!t.getType||"combo"===t.getType()))return t.getChildren();console.warn("The combo does not exist!")},e.prototype.positionsAnimate=function(t){var e=this;e.emit("beforeanimate");var n=e.get("animateCfg"),r=n.onFrame,i=t?e.getNodes().concat(e.getCombos()):e.getNodes(),o=i.map((function(t){var e=t.getModel();return{id:e.id,x:e.x,y:e.y}}));e.stopAnimate();var a=e.get("canvas");e.animating=!0,setTimeout((function(){a.animate((function(n){Object(v.each)(o,(function(t){var i=e.findById(t.id);if(i&&!i.destroyed){var o=i.get("originAttrs"),a=i.get("model"),s=i.getContainer().getMatrix();if(null==o&&(s&&(o={x:s[6],y:s[7]}),i.set("originAttrs",o||0)),r){var u=r(i,n,t,o||{x:0,y:0});i.set("model",Object.assign(a,u))}else o?(a.x=o.x+(t.x-o.x)*n,a.y=o.y+(t.y-o.y)*n):(a.x=t.x,a.y=t.y)}})),e.refreshPositions(t)}),{duration:n.duration,easing:n.easing,callback:function(){Object(v.each)(i,(function(t){t.set("originAttrs",null)})),n.callback&&n.callback(),e.emit("afteranimate"),e.animating=!1}})}),0)},e.prototype.refreshPositions=function(t){this.emit("beforegraphrefreshposition");var e,n=this.get("nodes"),r=this.get("edges"),i=this.get("vedges"),o=this.get("combos"),a={},s=function(t){Object(v.each)(t,(function(t){e=t.getModel();var n=t.get("originAttrs");if(!n||e.x!==n.x||e.y!==n.y){var r=t.updatePosition({x:e.x,y:e.y});a[e.id]=r,e.comboId&&(a[e.comboId]=a[e.comboId]||r),e.parentId&&(a[e.parentId]=a[e.parentId]||r)}}))};s(o),s(n),o&&0!==o.length&&(t?(s(o),this.updateCombos()):this.updateCombos()),Object(v.each)(r,(function(t){var e=t.getSource().getModel(),n=t.getTarget();if(!Object(v.isPlainObject)(n)){var r=n.getModel();(a[e.id]||a[r.id]||t.getModel().isComboEdge)&&t.refresh()}})),Object(v.each)(i,(function(t){t.refresh()})),this.emit("aftergraphrefreshposition"),this.autoPaint()},e.prototype.stopAnimate=function(){var t=this.get("canvas").cfg.timeline;t&&t.stopAllAnimations()},e.prototype.isAnimating=function(){return this.animating},e.prototype.getZoom=function(){var t=this.get("group").getMatrix();return t?t[0]:1},e.prototype.getCurrentMode=function(){return this.get("modeController").getMode()},e.prototype.setMode=function(t){return this.get("modeController").setMode(t),this},e.prototype.clear=function(t){var e;return void 0===t&&(t=!1),null===(e=this.get("canvas"))||void 0===e||e.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],vedges:[],groups:[],combos:[],comboTrees:[]}),t||this.emit("afterrender"),this},e.prototype.updateLayout=function(t,e,n,r){var i=this;void 0===t&&(t={}),void 0===r&&(r=!0);var o=this.get("layoutController");if(Object(v.isString)(t)&&(t={type:t}),e){var a=n;a||(a="begin"===e?{x:0,y:0}:{x:this.getWidth()/2,y:this.getHeight()/2}),a=this.getPointByCanvas(a.x,a.y);var s=["force","gForce","fruchterman","force2"];s.includes(t.type)||!t.type&&s.includes(null==o?void 0:o.layoutType)?t.center=[a.x,a.y]:this.once("afterlayout",(function(t){var n=i.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];a.x=a.x*n[0]+n[6],a.y=a.y*n[0]+n[7];var r=i.getGroup().getCanvasBBox(),o=r.minX,s=r.maxX,u=r.minY,c={x:(o+s)/2,y:(u+r.maxY)/2};"begin"===e&&(c.x=o,c.y=u),i.translate(a.x-c.x,a.y-c.y)}))}var u=Object(g.__assign)({},this.get("layout")),c={};Object.assign(c,u,t),t.pipes&&!t.type?delete c.type:!t.pipes&&c.type&&delete c.pipes,this.set("layout",c),o&&(o.isLayoutTypeSame(c)&&c.gpuEnabled===u.gpuEnabled?o.updateLayoutCfg(c):o.changeLayout(c),r&&this.get("enabledStack")&&this.pushStack("layout",{before:u,after:c}))},e.prototype.destroyLayout=function(){var t=this.get("layoutController");null==t||t.destroyLayout()},e.prototype.layout=function(){var t,e=this.get("layoutController"),n=this.get("layout");n&&e&&(n.workerEnabled?e.layout():(null===(t=e.layoutMethods)||void 0===t?void 0:t.length)?e.relayout(!0):e.layout())},e.prototype.collapseCombo=function(t,e){var n=this;if(void 0===e&&(e=!0),!this.destroyed)if(Object(v.isString)(t)&&(t=this.findById(t)),t){this.emit("beforecollapseexpandcombo",{action:"collapse",item:t});var r=t.getModel();this.get("itemController").collapseCombo(t,e),r.collapsed=!0;var i=this.getEdges().concat(this.get("vedges")),o=[],a=this.get("comboTrees"),s=!1;(a||[]).forEach((function(t){s||Be(t,(function(t){if(s&&t.depth<=r.depth)return!1;if(r.id===t.id&&(s=!0),s){var e=n.findById(t.id);e&&e.getType&&"combo"===e.getType()&&(o=(o=o.concat(e.getNodes())).concat(e.getCombos()))}return!0}))}));var u={};i.forEach((function(t){var e=t.getModel(),i=e.isVEdge,a=e.size,s=void 0===a?1:a;if(!t.isVisible()||i){var c,l=t.getSource(),f=t.getTarget(),h=null;if(l.getModel().id===r.id||o.includes(l)&&!o.includes(f)?(h=f,c=!1):(f.getModel().id===r.id||!o.includes(l)&&o.includes(f))&&(h=l,c=!0),h){if(i)return void n.removeItem(t,!1);for(var d=h.getModel();!h.isVisible();){var p=d.parentId,g=d.comboId,v=p||g;if(!(h=n.findById(v))||!v)return;d=h.getModel()}var y=d.id,m=c?{source:y,target:r.id,size:s,isVEdge:!0}:{source:r.id,target:y,size:s,isVEdge:!0},b="".concat(m.source,"-").concat(m.target);if(u[b])return void(u[b].size+=s);u[b]=m}}})),this.addItems(Object.values(u).map((function(t){return{type:"vedge",model:t}})),!1),this.emit("aftercollapseexpandcombo",{action:"collapse",item:t})}else console.warn("The combo to be collapsed does not exist!")},e.prototype.expandCombo=function(t,e){var n=this;if(void 0===e&&(e=!0),Object(v.isString)(t)&&(t=this.findById(t)),!t||t.getType&&"combo"!==t.getType())console.warn("The combo to be collapsed does not exist!");else{this.emit("beforecollapseexpandcombo",{action:"expand",item:t});var r=t.getModel();this.get("itemController").expandCombo(t,e),r.collapsed=!1;var i=this.getEdges().concat(this.get("vedges")),o=[],a=this.get("comboTrees"),s=!1;(a||[]).forEach((function(t){s||Be(t,(function(t){if(s&&t.depth<=r.depth)return!1;if(r.id===t.id&&(s=!0),s){var e=n.findById(t.id);e&&e.getType&&"combo"===e.getType()&&(o=(o=o.concat(e.getNodes())).concat(e.getCombos()))}return!0}))}));var u={};i.forEach((function(t){if(!t.isVisible()||t.getModel().isVEdge){var e,i=t.getSource(),a=t.getTarget(),s=i.get("id"),c=a.get("id"),l=null;if(s===r.id||o.includes(i)&&!o.includes(a)?(l=a,e=!1):c===r.id||!o.includes(i)&&o.includes(a)?(l=i,e=!0):o.includes(i)&&o.includes(a)&&i.isVisible()&&a.isVisible()&&t.show(),l){var f=t.getModel(),h=f.isVEdge,d=f.size,p=void 0===d?1:d;if(h)return void n.removeItem(t,!1);for(var g=l.getModel();!l.isVisible();){var v=g.parentId,y=g.comboId,m=v||y;if(!(l=n.findById(m))||!m)return;g=l.getModel()}for(var b=g.id,x=e?a:i,w=x.getModel();!x.isVisible();){var _=w.parentId,E=w.comboId,S=_||E;if(!(x=n.findById(S))||!S)return;if(w.comboId===r.id||w.parentId===r.id)break;w=x.getModel()}var M=w.id;if(b){var O=e?{source:b,target:M,isVEdge:!0,size:p}:{source:M,target:b,isVEdge:!0,size:p},k="".concat(O.source,"-").concat(O.target);if(u[k])return void(u[k].size+=p);u[k]=O}}}})),this.addItems(Object.values(u).map((function(t){return{type:"vedge",model:t}})),!1),this.emit("aftercollapseexpandcombo",{action:"expand",item:t})}},e.prototype.collapseExpandCombo=function(t,e){if(void 0===e&&(e=!0),Object(v.isString)(t)&&(t=this.findById(t)),t&&(!t.getType||"combo"===t.getType())){for(var n=t.getModel(),r=this.findById(n.parentId);r;){var i=r.getModel();if(i.collapsed)return console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),void(r=void 0);r=this.findById(i.parentId)}n.collapsed?this.expandCombo(t,e):this.collapseCombo(t,e),this.updateCombo(t)}},e.prototype.getNeighbors=function(t,e){var n=t;return Object(v.isString)(t)&&(n=this.findById(t)),n.getNeighbors(e)},e.prototype.getNodeDegree=function(t,e,n){void 0===e&&(e=void 0),void 0===n&&(n=!1);var r=t;Object(v.isString)(t)&&(r=this.findById(t));var i=this.get("degrees");i&&!n||(i=P(this.save()),this.set("degrees",i));var o=i[r.getID()],a=0;if(!o)return 0;switch(e){case"in":a=o.inDegree;break;case"out":a=o.outDegree;break;case"all":a=o;break;default:a=o.degree}return a},e.prototype.getUndoStack=function(){return this.undoStack},e.prototype.getRedoStack=function(){return this.redoStack},e.prototype.getStackData=function(){return this.get("enabledStack")?{undoStack:this.undoStack.toArray(),redoStack:this.redoStack.toArray()}:null},e.prototype.clearStack=function(){this.get("enabledStack")&&(this.undoStack.clear(),this.redoStack.clear(),this.emit("stackchange",{undoStack:this.undoStack,redoStack:this.redoStack}))},e.prototype.pushStack=function(t,e,n){if(void 0===t&&(t="update"),void 0===n&&(n="undo"),this.get("enabledStack")){var r=e?Object(v.clone)(e):{before:{},after:Object(v.clone)(this.save())};"redo"===n?this.redoStack.push({action:t,data:r}):this.undoStack.push({action:t,data:r}),this.emit("stackchange",{action:t,stackType:n,undoStack:this.undoStack,redoStack:this.redoStack})}else console.warn("璇峰厛鍚敤 undo & redo 鍔熻兘锛屽湪瀹炰緥鍖� Graph 鏃跺€欓厤缃� enabledStack: true !")},e.prototype.getAdjMatrix=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=this.get("directed"));var n=this.get("adjMatrix");return n&&t||(n=_(this.save(),e),this.set("adjMatrix",n)),n},e.prototype.getShortestPathMatrix=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=this.get("directed"));var n=this.get("adjMatrix"),r=this.get("shortestPathMatrix");return n&&t||(n=_(this.save(),e),this.set("adjMatrix",n)),r&&t||(r=H(this.save(),e),this.set("shortestPathMatrix",r)),r},e.prototype.on=function(e,n,r){return t.prototype.on.call(this,e,n,r)},e.prototype.destroy=function(){var t,e,n,r,i;this.emit("beforedestroy"),this.clear(),this.clearStack(),null===(t=this.get("itemController"))||void 0===t||t.destroy(),null===(e=this.get("modeController"))||void 0===e||e.destroy(),null===(n=this.get("viewController"))||void 0===n||n.destroy(),null===(r=this.get("stateController"))||void 0===r||r.destroy(),null===(i=this.get("canvas"))||void 0===i||i.destroy(),this.cfg=null,this.destroyed=!0,this.redoStack=null,this.undoStack=null,this.emit("afterdestroy")},e.prototype.createHull=function(t){if(t.members&&!(t.members.length<1)){var e=this.get("hullGroup"),n=this.get("hullMap");if(n||(n={},this.set("hullMap",n)),e&&!e.get("destroyed")||((e=this.get("group").addGroup({id:"hullGroup"})).toBack(),this.set("hullGroup",e)),n[t.id])return console.warn("Existed hull id."),n[t.id];var r=e.addGroup({id:"".concat(t.id,"-container")}),i=new Hn(this,Object(g.__assign)(Object(g.__assign)({},t),{group:r}));return n[i.id]=i,i}console.warn("Create hull failed! The members is empty.")},e.prototype.getHulls=function(){return this.get("hullMap")},e.prototype.getHullById=function(t){return this.get("hullMap")[t]},e.prototype.removeHull=function(t){var e,n;n=Object(v.isString)(t)?this.getHullById(t):t,null===(e=this.get("hullMap"))||void 0===e||delete e[n.id],n.destroy()},e.prototype.removeHulls=function(){var t=this.getHulls();t&&Object.keys(t).length&&(Object.keys(t).forEach((function(e){t[e].destroy()})),this.set("hullMap",{}))},e}(x.a);function Kn(t){return(Kn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Qn=w.a.transform,$n=["startArrow","endArrow"],Jn={lineWidth:1,stroke:void 0,fill:void 0,lineAppendWidth:1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,x:0,y:0,r:10,width:20,height:20,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},tr={edge:{lineWidth:1,stroke:"#000",lineDash:void 0,startArrow:!1,endArrow:!1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},node:Jn,combo:Jn},er={options:{labelCfg:{style:{fontFamily:Ae.windowFontFamily}},descriptionCfg:{style:{fontFamily:Ae.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(t){return{}},getOptions:function(t,e){return"move"===e||(null==e?void 0:e.includes("bbox"))?t:Object(v.deepMix)({},this.options,this.getCustomConfig(t)||{},t)},draw:function(t,e){e.shapeMap={},this.mergeStyle=this.getOptions(t);var n=this.drawShape(t,e);if(n.set("className",this.itemType+"-shape"),e.shapeMap[this.itemType+"-shape"]=n,t.label){var r=this.drawLabel(t,e);r.set("className",this.itemType+"-label"),e.shapeMap[this.itemType+"-label"]=r}return n},afterDraw:function(t,e,n){},drawShape:function(t,e){return null},drawLabel:function(t,e){var n=(this.mergeStyle||this.getOptions(t)||{}).labelCfg||{},r=this.getLabelStyle(t,n,e),i=r.rotate;delete r.rotate;var o=e.addShape("text",{attrs:r,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(e.shapeMap["text-shape"]=o,!isNaN(i)&&""!==i){var a=o.getBBox(),s=[1,0,0,0,1,0,0,0,1];if(r.rotateCenter)switch(r.rotateCenter){case"center":s=Qn(s,[["t",-a.width/2,-a.height/2],["r",i],["t",a.width/2,a.height/2]]);break;case"lefttop":s=Qn(s,[["t",-r.x,-r.y],["r",i],["t",r.x,r.y]]);break;case"leftcenter":s=Qn(s,[["t",-r.x,-r.y-a.height/2],["r",i],["t",r.x,r.y+a.height/2]]);break;default:s=Qn(s,[["t",-a.width/2,-a.height/2],["r",i],["t",a.width/2,a.height/2]])}else s=Qn(s,[["t",-r.x,-r.y-a.height/2],["r",i],["t",r.x,r.y+a.height/2]]);o.setMatrix(s)}if(r.background){var u=this.drawLabelBg(t,e,o),c=this.itemType+"-label-bg";u.set("classname",c),e.shapeMap[c]=u,o.toFront()}return o},drawLabelBg:function(t,e,n){var r=this.options.labelCfg,i=Object(v.mix)({},r,t.labelCfg),o=this.getLabelBgStyleByPosition(n,i),a=e.addShape("rect",{name:"text-bg-shape",attrs:o,labelRelated:!0});return e.shapeMap["text-bg-shape"]=a,a},getLabelStyleByPosition:function(t,e,n){return{text:t.label}},getLabelBgStyleByPosition:function(t,e){return{}},getLabelStyle:function(t,e,n){var r=this.getLabelStyleByPosition(t,e,n),i="".concat(this.itemType,"Label"),o=Ae[i]?Ae[i].style:null;return Object(g.__assign)(Object(g.__assign)(Object(g.__assign)({},o),r),e.style)},getShapeStyle:function(t){return t.style},update:function(t,e,n){this.updateShapeStyle(t,e,n),this.updateLabel(t,e,n)},updateShapeStyle:function(t,e,n){var r,i=e.getContainer(),o=e.getKeyShape(),a=Object(v.mix)({},o.attr(),t.style),s=function(t){var e,n=a[t];if(Object(v.isPlainObject)(n)){var s=(null===(r=i.shapeMap)||void 0===r?void 0:r[t])||i.find((function(e){return e.get("name")===t}));null==s||s.attr(n)}else o.attr(((e={})[t]=n,e))};for(var u in a)s(u)},updateLabel:function(t,e,n){var r,i,o=e.getContainer(),a=(this.mergeStyle||this.getOptions({},n)||{}).labelCfg,s=void 0===a?{}:a,u=this.itemType+"-label",c=o.shapeMap[u]||o.find((function(t){return t.get("className")===u})),l=this.itemType+"-label-bg",f=o.shapeMap[l]||o.find((function(t){return t.get("className")===l}));if(c&&void 0===t.label&&(o.removeChild(c),delete o.shapeMap[u],f&&(o.removeChild(f),delete o.shapeMap[l])),t.label||""===t.label)if(c){(!n||"bbox|label"===n||"edge"===this.itemType&&"style"!==n)&&(s=Object(v.deepMix)(s,t.labelCfg));var h=this.getLabelStyleByPosition(t,s,o),d=null===(r=t.labelCfg)||void 0===r?void 0:r.style,p=Object(g.__assign)(Object(g.__assign)({},h),d),y=p.rotate;if(delete p.rotate,isNaN(y)||""===y)1!==(null===(i=c.getMatrix())||void 0===i?void 0:i[4])&&c.resetMatrix(),c.attr(p);else{var m=[1,0,0,0,1,0,0,0,1];m=Qn(m,[["t",-p.x,-p.y],["r",y],["t",p.x,p.y]]),p.matrix=m,c.attr(p)}if(f)if(p.background){var b=this.getLabelBgStyleByPosition(c,s);f.attr(b)}else o.removeChild(f);else p.background&&((f=this.drawLabelBg(t,o,c)).set("classname",l),o.shapeMap[l]=f,c.toFront())}else{var x=this.drawLabel(t,o);x.set("className",u),o.shapeMap[u]=x}},afterUpdate:function(t,e){},setState:function(t,e,n){var r,i,o,a=n.get("keyShape");if(a&&!a.destroyed){var s=n.getType(),u=Object(v.isBoolean)(e)?t:"".concat(t,":").concat(e),c=this.getStateStyle(u,n),l=n.getStateStyle(u);if(l||c){var f=Object(v.mix)({},l||c),h=n.getContainer(),d={x:1,y:1,cx:1,cy:1,matrix:1};if("combo"===s&&(d.r=1,d.width=1,d.height=1),e){var p=function(t){var e,n=f[t];if(Object(v.isPlainObject)(n)&&!$n.includes(t)){var r=(null===(o=h.shapeMap)||void 0===o?void 0:o[t])||h.find((function(e){return e.get("name")===t}));null==r||r.attr(n)}else a.attr(((e={})[t]=n,e))};for(var g in f)p(g)}else{var y=He(n.getCurrentStatesStyle()),m=n.getModel(),b=Object(v.mix)({},m.style,He(n.getOriginStyle())),x=a.get("name"),w=a.attr(),_={};Object.keys(w).forEach((function(t){if("img"!==t){var e=w[t];e&&"object"===Kn(e)?_[t]=Object(v.clone)(e):_[t]=e}}));var E={},S=function(t){var e=f[t];if(Object(v.isPlainObject)(e)&&!$n.includes(t)){var n=h.shapeMap[t]||h.find((function(e){return e.get("name")===t}));if(n){var r=He(n.attr());Object(v.each)(e,(function(e,i){if(t===x&&_[i]&&!d[i]){delete _[i];var o=b[t][i]||tr[s][i];a.attr(i,o)}else if(r[i]||0===r[i]){delete r[i];var u=b[t][i]||tr[s][i];n.attr(i,u)}})),E[t]=r}}else if(_[t]&&!d[t]){delete _[t];var i=b[t]||(b[x]?b[x][t]:void 0)||tr[s][t];a.attr(t,i)}};for(var M in f)S(M);for(var g in x?E[x]=_:Object(v.mix)(E,_),y)if(!d[g]){var O=y[g];Object(v.isPlainObject)(O)&&!$n.includes(g)||(x?(Object(v.mix)(b[x],((i={})[g]=O,i)),delete b[g]):Object(v.mix)(b,((r={})[g]=O,r)),delete y[g])}var k={};Object(v.deepMix)(k,b,E,y);var A=!1,C=function(t){var e,n,r=k[t];if(Object(v.isPlainObject)(r)&&!$n.includes(t)){var i=h.shapeMap[t]||h.find((function(e){return e.get("name")===t}));i&&(("text"===i.get("type")||i.get("labelRelated"))&&(delete r.x,delete r.y,delete r.matrix),t===x&&("combo"===s&&(delete r.r,delete r.width,delete r.height),A=!0),i.attr(r))}else if(!A){var o=r||tr[s][t];"combo"===s?x||a.attr(((e={})[t]=o,e)):a.attr(((n={})[t]=o,n))}};for(var j in k)C(j)}}}},getStateStyle:function(t,e){var n=e.getModel(),r=e.getType(),i=this.getOptions(n),o=i.stateStyles,a=i.style,s=void 0===a?{}:a,u=n.stateStyles?n.stateStyles[t]:o&&o[t];return"combo"===r?Object(v.clone)(u):Object(v.mix)({},s,u)},getControlPoints:function(t){return t.controlPoints},getAnchorPoints:function(t){var e,n;return(null==t?void 0:t.anchorPoints)||(null===(e=this.getCustomConfig(t))||void 0===e?void 0:e.anchorPoints)||(null===(n=this.options)||void 0===n?void 0:n.anchorPoints)}},nr={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:Ae.nodeLabel.offset,getSize:function(t){var e,n=(null===(e=this.mergeStyle)||void 0===e?void 0:e.size)||t.size||this.getOptions({}).size||Ae.defaultNode.size;return Object(v.isArray)(n)&&1===n.length&&(n=[n[0],n[0]]),Object(v.isArray)(n)||(n=[n,n]),n},getLabelStyleByPosition:function(t,e){var n=e.maxLength,r=t.label;n&&(r=Ye(r,n));var i=e.position||this.labelPosition;if("center"===i)return{x:0,y:0,text:r,textBaseline:"middle",textAlign:"center"};var o=e.offset;Object(v.isNil)(o)&&(o=this.offset);var a,s=this.getSize(t);switch(i){case"top":a={x:0,y:-s[1]/2-o,textBaseline:"bottom",textAlign:"center"};break;case"bottom":a={x:0,y:s[1]/2+o,textBaseline:"top",textAlign:"center"};break;case"left":a={x:-s[0]/2-o,y:0,textBaseline:"middle",textAlign:"right"};break;default:a={x:s[0]/2+o,y:0,textBaseline:"middle",textAlign:"left"}}return a.text=r,a},getLabelBgStyleByPosition:function(t,e){var n;if(!t)return{};var r=null===(n=e.style)||void 0===n?void 0:n.background;if(!r)return{};var i=t.getBBox(),o=Je(r.padding),a=i.width+o[1]+o[3],s=i.height+o[0]+o[2];return Object(g.__assign)(Object(g.__assign)({x:i.minX-o[3],y:i.minY-o[0]},r),{width:a,height:s})},drawShape:function(t,e){var n=this.shapeType,r=this.getShapeStyle(t),i=e.addShape(n,{attrs:r,draggable:!0,name:"node-shape"});return e.shapeMap["node-shape"]=i,i},updateLinkPoints:function(t,e){var n,r=(this.mergeStyle||this.getOptions(t)).linkPoints,i=e.shapeMap["link-point-left"]||e.find((function(t){return"link-point-left"===t.get("className")})),o=e.shapeMap["link-point-right"]||e.find((function(t){return"link-point-right"===t.get("className")})),a=e.shapeMap["link-point-top"]||e.find((function(t){return"link-point-top"===t.get("className")})),s=e.shapeMap["link-point-bottom"]||e.find((function(t){return"link-point-bottom"===t.get("className")}));i&&(n=i.attr()),o&&!n&&(n=o.attr()),a&&!n&&(n=a.attr()),s&&!n&&(n=s.attr()),n||(n=r);var u=Object(v.mix)({},n,t.linkPoints),c=u.fill,l=u.stroke,f=u.lineWidth,h=u.size/2;h||(h=u.r);var d=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},p=d.left,y=d.right,m=d.top,b=d.bottom,x=this.getSize(t),w=x[0],_=x[1],E={r:h,fill:c,stroke:l,lineWidth:f};if(i)p||void 0===p?i.attr(Object(g.__assign)(Object(g.__assign)({},E),{x:-w/2,y:0})):(i.remove(),delete e.shapeMap["link-point-left"]);else if(p){var S="link-point-left";e.shapeMap[S]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},E),{x:-w/2,y:0}),className:S,name:S,isAnchorPoint:!0})}if(o)y||void 0===y||(o.remove(),delete e.shapeMap["link-point-right"]),o.attr(Object(g.__assign)(Object(g.__assign)({},E),{x:w/2,y:0}));else if(y){var M="link-point-right";e.shapeMap[M]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},E),{x:w/2,y:0}),className:M,name:M,isAnchorPoint:!0})}if(a)m||void 0===m||(a.remove(),delete e.shapeMap["link-point-top"]),a.attr(Object(g.__assign)(Object(g.__assign)({},E),{x:0,y:-_/2}));else if(m){var O="link-point-top";e.shapeMap[O]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},E),{x:0,y:-_/2}),className:O,name:O,isAnchorPoint:!0})}if(s)b||void 0===b?s.attr(Object(g.__assign)(Object(g.__assign)({},E),{x:0,y:_/2})):(s.remove(),delete e.shapeMap["link-point-bottom"]);else if(b){var k="link-point-bottom";e.shapeMap[k]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},E),{x:0,y:_/2}),className:k,name:k,isAnchorPoint:!0})}},updateShape:function(t,e,n,r,i){e.get("keyShape").attr(Object(g.__assign)({},n)),this.updateLabel(t,e,i),r&&this.updateIcon(t,e)},updateIcon:function(t,e){var n=this,r=e.getContainer(),i=(this.mergeStyle||this.getOptions(t)).icon,o=t.icon?t.icon:{show:void 0,text:void 0},a=o.show,s=o.text,u=r.shapeMap["".concat(this.type,"-icon")]||r.find((function(t){return t.get("name")==="".concat(n.type,"-icon")}));if(u)if(a||void 0===a){var c=Object(v.mix)({},u.attr(),i),l=c.width,f=void 0===l?20:l,h=c.height,d=void 0===h?20:h;("iconfont"===c.fontFamily||c.hasOwnProperty("text"))&&(f=0,d=0),u.attr(Object(g.__assign)(Object(g.__assign)({},c),{x:-f/2,y:-d/2}))}else u.remove(),delete r.shapeMap["".concat(this.type,"-icon")];else if(a){var p="".concat(this.type,"-icon");if(s)r.shapeMap[p]=r.addShape("text",{attrs:Object(g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:p,name:p});else{f=i.width,d=i.height;r.shapeMap[p]=r.addShape("image",{attrs:Object(g.__assign)(Object(g.__assign)({},i),{x:-f/2,y:-d/2}),className:p,name:p})}var y=r.shapeMap["node-label"]||r.find((function(t){return"node-label"===t.get("name")}));y&&y.toFront()}}},rr=Object(g.__assign)(Object(g.__assign)({},er),nr);yn.registerNode("single-node",rr);var ir={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:Ae.defaultEdge.size,style:{x:0,y:0,stroke:Ae.defaultEdge.style.stroke,lineAppendWidth:Ae.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:Ae.edgeLabel.style.fill,fontSize:Ae.edgeLabel.style.fontSize,fontFamily:Ae.windowFontFamily}},stateStyles:Object(g.__assign)({},Ae.edgeStateStyles)},getPath:function(t){var e=[];return Object(v.each)(t,(function(t,n){0===n?e.push(["M",t.x,t.y]):e.push(["L",t.x,t.y])})),e},getShapeStyle:function(t){var e=this.options.style,n={stroke:t.color},r=Object(v.mix)({},e,n,t.style),i=t.size||Ae.defaultEdge.size,o=(t=this.getPathPoints(t)).startPoint,a=t.endPoint,s=this.getControlPoints(t),u=[o];s&&(u=u.concat(s)),u.push(a);var c=this.getPath(u);return Object(v.mix)({},Ae.defaultEdge.style,{stroke:Ae.defaultEdge.color,lineWidth:i,path:c},r)},updateShapeStyle:function(t,e,n){var r,i=e.getContainer(),o=(null===(r=e.getKeyShape)||void 0===r?void 0:r.call(e))||i.shapeMap["edge-shape"],a=t.size,s=(t=this.getPathPoints(t)).startPoint,u=t.endPoint,c=this.getControlPoints(t),l=[s];c&&(l=l.concat(c)),l.push(u);var f=o.attr(),h=t.style||{};void 0===h.stroke&&(h.stroke=t.color);var d=t.sourceNode,p=t.targetNode,y={radius:h.radius};c||(y={source:d,target:p,offset:h.offset,radius:h.radius});var m=this.getPath(l,y),b={};"move"===n?b={path:m}:(f.endArrow&&!1===h.endArrow&&(t.style.endArrow={path:""}),f.startArrow&&!1===h.startArrow&&(t.style.startArrow={path:""}),void 0===(b=Object(g.__assign)({},t.style)).lineWidth&&(b.lineWdith=(Object(v.isNumber)(a)?a:null==a?void 0:a[0])||f.lineWidth),void 0===b.path&&(b.path=m),void 0===b.stroke&&(b.stroke=f.stroke||t.color)),o&&o.attr(b)},getLabelStyleByPosition:function(t,e,n){var r,i=e.position||this.labelPosition,o={},a=null==n?void 0:n.shapeMap["edge-shape"];r="start"===i?0:"end"===i?1:.5;var s,u=e.refX||this.refX,c=e.refY||this.refY;if(t.startPoint.x===t.endPoint.x&&t.startPoint.y===t.endPoint.y)return o.x=t.startPoint.x+u,o.y=t.startPoint.y+c,o.text=t.label,o;s=Object(v.isNil)(e.autoRotate)?this.labelAutoRotate:e.autoRotate;var l=Re(a,r,u,c,s);return o.x=l.x,o.y=l.y,o.rotate=l.rotate,o.textAlign=this._getTextAlign(i,l.angle),o.text=t.label,o},getLabelBgStyleByPosition:function(t,e){if(!t)return{};var n=t.getBBox(),r=e.style&&e.style.background;if(!r)return{};var i=r.padding,o=n.width+i[1]+i[3],a=n.height+i[0]+i[2],s=Object(g.__assign)(Object(g.__assign)({},r),{width:o,height:a,x:n.minX-i[3],y:n.minY-i[0],matrix:[1,0,0,0,1,0,0,0,1]});return(Object(v.isNil)(e.autoRotate)?this.labelAutoRotate:e.autoRotate)&&(s.matrix=t.attr("matrix")||[1,0,0,0,1,0,0,0,1]),s},_getTextAlign:function(t,e){var n="center";return e?(e%=2*Math.PI,"center"!==t&&(n=e>=0&&e<=Math.PI/2||e>=1.5*Math.PI&&e<2*Math.PI?t:function(t){var e=t;return"start"===t?e="end":"end"===t&&(e="start"),e}(t)),n):t},getControlPoints:function(t){return t.controlPoints},getPathPoints:function(t){return t},drawShape:function(t,e){var n=this.getShapeStyle(t),r=e.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return e.shapeMap["edge-shape"]=r,r},drawLabel:function(t,e){var n=this.options.labelCfg,r=Object(v.deepMix)({},n,t.labelCfg),i=this.getLabelStyle(t,r,e),o=i.rotate;delete i.rotate;var a=e.addShape("text",{attrs:i,name:"text-shape",labelRelated:!0,draggable:!0});if(e.shapeMap["text-shape"]=a,isNaN(o)||""===o||a.rotateAtStart(o),i.background){var s=this.drawLabelBg(t,e,a,i,o),u=this.itemType+"-label-bg";s.set("classname",u),e.shapeMap[u]=s,a.toFront()}return a},drawLabelBg:function(t,e,n,r,i){var o=this.options.labelCfg,a=Object(v.deepMix)({},o,t.labelCfg),s=this.getLabelBgStyleByPosition(n,a),u=e.addShape("rect",{name:"text-bg-shape",attrs:s,labelRelated:!0});return e.shapeMap["text-bg-shape"]=u,u}},or=Object(g.__assign)(Object(g.__assign)({},er),ir);yn.registerEdge("single-edge",or),yn.registerEdge("line",{getControlPoints:function(){}},"single-edge"),yn.registerEdge("spline",{getPath:function(t){return kn(t)}},"single-edge"),yn.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(t){var e,n,r=t.startPoint,i=t.endPoint,o=(r.x+i.x)/2,a=(r.y+i.y)/2;if(void 0!==t.controlPoints){if(n=t.controlPoints[0],e=Vt(r,n,i),r.x<=i.x&&r.y>i.y?this.clockwise=e.x>n.x?0:1:r.x<=i.x&&r.yn.x?1:0:r.x>i.x&&r.y<=i.y?this.clockwise=e.y=60&&Math.round(t.h)<=240?n?Math.round(t.h)-2*e:Math.round(t.h)+2*e:n?Math.round(t.h)+2*e:Math.round(t.h)-2*e)<0?r+=360:r>=360&&(r-=360),r}function Ir(t,e,n){return 0===t.h&&0===t.s?t.s:((r=n?t.s-.16*e:4===e?t.s+.16:t.s+.05*e)>1&&(r=1),n&&5===e&&r>.1&&(r=.1),r<.06&&(r=.06),Number(r.toFixed(2)));var r}function Tr(t,e,n){var r;return(r=n?t.v+.05*e:t.v-.15*e)>1&&(r=1),Number(r.toFixed(2))}function Nr(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=Ar()(t),i=5;i>0;i-=1){var o=r.toHsv(),a=Ar()({h:jr(o,i,!0),s:Ir(o,i,!0),v:Tr(o,i,!0)}).toHexString();n.push(a)}n.push(r.toHexString());for(var s=1;s<=4;s+=1){var u=r.toHsv(),c=Ar()({h:jr(u,s),s:Ir(u,s),v:Tr(u,s)}).toHexString();n.push(c)}return"dark"===e.theme?Cr.map((function(t){var r=t.index,i=t.opacity;return Ar.a.mix(e.backgroundColor||"#141414",n[r],100*i).toHexString()})):n}var Pr={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1890FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Dr={},Lr={};Object.keys(Pr).forEach((function(t){Dr[t]=Nr(Pr[t]),Dr[t].primary=Dr[t][5],Lr[t]=Nr(Pr[t],{theme:"dark",backgroundColor:"#141414"}),Lr[t].primary=Lr[t][5]}));Dr.red,Dr.volcano,Dr.gold,Dr.orange,Dr.yellow,Dr.lime,Dr.green,Dr.cyan,Dr.blue,Dr.geekblue,Dr.purple,Dr.magenta,Dr.grey;var Rr,Br,Fr,zr,Gr=function(t,e,n){var r=Or()(t),i=Or()(e);return Or()([(1-n)*r.red()+n*i.red(),(1-n)*r.green()+n*i.green(),(1-n)*r.blue()+n*i.blue()]).rgb()},Yr=function(t,e,n,r){return void 0===e&&(e="#fff"),void 0===n&&(n="default"),void 0===r&&(r="rgb(150, 150, 150)"),"default"===n?function(t,e,n){void 0===e&&(e="#fff"),void 0===n&&(n="rgb(150, 150, 150)");var r=Gr(e,t,.05).rgb().toString(),i=Gr(e,t,.1).rgb().toString(),o=Gr(e,t,.2).rgb().toString(),a=Gr(e,t,.4).rgb().toString(),s=Gr(e,n,.02).rgb().toString(),u=Gr(e,n,.05).rgb().toString(),c=Gr(e,n,.1).rgb().toString(),l=Gr(e,n,.2).rgb().toString(),f=Gr(e,n,.3).rgb().toString(),h=Nr(t,{theme:"default",backgroundColor:e}),d=Or()(t).hex().toLowerCase(),p=h.indexOf(d),g=t;return-1!==p&&(g=h[p+1]),{mainStroke:t,mainFill:i,activeStroke:t,activeFill:r,inactiveStroke:a,inactiveFill:r,selectedStroke:t,selectedFill:e,highlightStroke:g,highlightFill:o,disableStroke:f,disableFill:u,edgeMainStroke:f,edgeActiveStroke:t,edgeInactiveStroke:l,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:c,comboMainStroke:f,comboMainFill:s,comboActiveStroke:t,comboActiveFill:r,comboInactiveStroke:f,comboInactiveFill:s,comboSelectedStroke:t,comboSelectedFill:s,comboHighlightStroke:g,comboHighlightFill:s,comboDisableStroke:l,comboDisableFill:u}}(t,e,"rgb(150, 150, 150)"):function(t,e,n){void 0===e&&(e="#fff"),void 0===n&&(n="#777");var r=Gr(e,t,.2).rgb().toString(),i=Gr(e,t,.3).rgb().toString(),o=Gr(e,t,.6).rgb().toString(),a=Gr(e,t,.8).rgb().toString(),s=Gr(e,n,.2).rgb().toString(),u=Gr(e,n,.25).rgb().toString(),c=Gr(e,n,.3).rgb().toString(),l=Gr(e,n,.4).rgb().toString(),f=Gr(e,n,.5).rgb().toString(),h=Nr(t,{theme:"dark",backgroundColor:e}),d=Or()(t).hex().toLowerCase(),p=h.indexOf(d),g=t;return-1!==p&&(g=h[p+1]),{mainStroke:a,mainFill:r,activeStroke:t,activeFill:i,inactiveStroke:a,inactiveFill:r,selectedStroke:t,selectedFill:r,highlightStroke:t,highlightFill:o,disableStroke:f,disableFill:u,edgeMainStroke:n,edgeActiveStroke:t,edgeInactiveStroke:n,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:c,comboMainStroke:l,comboMainFill:u,comboActiveStroke:t,comboActiveFill:s,comboInactiveStroke:l,comboInactiveFill:u,comboSelectedStroke:t,comboSelectedFill:s,comboHighlightStroke:g,comboHighlightFill:u,comboDisableStroke:l,comboDisableFill:s}}(t,e,"#777")},Ur=function(t,e,n,r){void 0===e&&(e="#fff"),void 0===n&&(n="default"),void 0===r&&(r="rgb(150, 150, 150)");var i=[];return t.forEach((function(t){i.push(Yr(t,e,n,r))})),i},Xr=Yr("rgb(95, 149, 255)","rgb(255, 255, 255)"),Wr={version:"0.8.21",rootContainerClassName:"root-container",nodeContainerClassName:"node-container",edgeContainerClassName:"edge-container",comboContainerClassName:"combo-container",delegateContainerClassName:"delegate-container",defaultLoopPosition:"top",nodeLabel:{style:{fill:"#000",fontSize:12,textAlign:"center",textBaseline:"middle"},offset:4},defaultNode:{type:"circle",style:{lineWidth:1,stroke:Xr.mainStroke,fill:Xr.mainFill},size:20,color:Xr.mainStroke,linkPoints:{size:8,lineWidth:1,fill:Xr.activeFill,stroke:Xr.activeStroke}},nodeStateStyles:{active:{fill:Xr.activeFill,stroke:Xr.activeStroke,lineWidth:2,shadowColor:Xr.mainStroke,shadowBlur:10},selected:{fill:Xr.selectedFill,stroke:Xr.selectedStroke,lineWidth:4,shadowColor:Xr.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:Xr.highlightFill,stroke:Xr.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:Xr.inactiveFill,stroke:Xr.inactiveStroke,lineWidth:1},disable:{fill:Xr.disableFill,stroke:Xr.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:"rgb(0, 0, 0)",textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:Xr.edgeMainStroke,lineAppendWidth:2},color:Xr.edgeMainStroke},edgeStateStyles:{active:{stroke:Xr.edgeActiveStroke,lineWidth:1},selected:{stroke:Xr.edgeSelectedStroke,lineWidth:2,shadowColor:Xr.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Xr.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:Xr.edgeInactiveStroke,lineWidth:1},disable:{stroke:Xr.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:"rgb(0, 0, 0)",textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:Xr.comboMainFill,lineWidth:1,stroke:Xr.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:Xr.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:Xr.comboActiveStroke,lineWidth:1,fill:Xr.comboActiveFill},selected:{stroke:Xr.comboSelectedStroke,lineWidth:2,fill:Xr.comboSelectedFill,shadowColor:Xr.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Xr.comboHighlightStroke,lineWidth:2,fill:Xr.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:Xr.comboInactiveStroke,fill:Xr.comboInactiveFill,lineWidth:1},disable:{stroke:Xr.comboDisableStroke,fill:Xr.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},textWaterMarkerConfig:{width:150,height:100,compatible:!1,text:{x:0,y:60,lineHeight:20,rotate:20,fontSize:14,fontFamily:"Microsoft YaHei",fill:"rgba(0, 0, 0, 0.1)",baseline:"Middle"}},imageWaterMarkerConfig:{width:150,height:130,compatible:!1,image:{x:0,y:0,width:30,height:20,rotate:0}},waterMarkerImage:"https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg"};function Vr(t,e,n){if(t){if("function"==typeof t.addEventListener)return t.addEventListener(e,n,!1),{remove:function(){t.removeEventListener(e,n,!1)}};if("function"==typeof t.attachEvent)return t.attachEvent("on"+e,n),{remove:function(){t.detachEvent("on"+e,n)}}}}function Hr(t){Rr||(Rr=document.createElement("table"),Br=document.createElement("tr"),Fr=/^\s*<(\w+|!)[^>]*>/,zr={tr:document.createElement("tbody"),tbody:Rr,thead:Rr,tfoot:Rr,td:Br,th:Br,"*":document.createElement("div")});var e=Fr.test(t)&&RegExp.$1;e&&e in zr||(e="*");var n=zr[e];t="string"==typeof t?t.replace(/(^\s*)|(\s*$)/g,""):t,n.innerHTML=""+t;var r=n.childNodes[0];return r&&n.contains(r)&&n.removeChild(r),r}function qr(t,e){if(t)for(var n in e)e.hasOwnProperty(n)&&(t.style[n]=e[n]);return t}var Zr=pr.cloneEvent,Kr=pr.isViewportChanged,Qr=function(t){function e(e){var n=t.call(this,e)||this;return n.extendEvents=[],n.dragging=!1,n.mousedown=!1,n.preItem=null,n.destroy(),n.graph=e,n.destroyed=!1,n.initEvents(),n}return Object(g.__extends)(e,t),e.prototype.initEvents=function(){var t=this.graph,e=this.extendEvents,n=void 0===e?[]:e,r=t.get("canvas"),i=r.get("el"),o=Object(v.wrapBehavior)(this,"onCanvasEvents"),a=Object(v.wrapBehavior)(this,"onExtendEvents"),s=Object(v.wrapBehavior)(this,"onWheelEvent");r.off("*").on("*",o),this.canvasHandler=o,n.push(Vr(i,"wheel",s)),"undefined"!=typeof window&&(n.push(Vr(window,"keydown",a)),n.push(Vr(window,"keyup",a)),n.push(Vr(window,"focus",a))),this.resetHandler&&t.off("afterchangedata",this.resetHandler),this.resetHandler=Object(v.wrapBehavior)(this,"resetStatus"),t.on("afterchangedata",this.resetHandler)},e.getItemRoot=function(t){for(;t&&!t.get("item");)t=t.get("parent");return t},e.prototype.onCanvasEvents=function(t){var n=this,r=this.graph,i=r.get("canvas"),o=t.target,a=t.type;switch(a){case"drag":this.onCanvasEvents(Object.assign({},t,{type:"mousemove"}));break;case"dragend":this.onCanvasEvents(Object.assign({},t,{type:"mouseup"}));break;case"mousedown":this.mousedown=!0;break;case"dragend":case"mouseup":setTimeout((function(){return n.mousedown=!1}));break;case"click":if(!this.mousedown)return}t.canvasX=t.x,t.canvasY=t.y;var s={x:t.canvasX,y:t.canvasY},u=r.get("group").getMatrix();if(u||(u=[1,0,0,0,1,0,0,0,1]),Kr(u)&&(s=r.getPointByClient(t.clientX,t.clientY)),t.x=s.x,t.y=s.y,t.currentTarget=r,o===i)return"mousemove"!==a&&"mouseleave"!==a||this.handleMouseMove(t,"canvas"),t.target=i,t.item=null,r.emit(a,t),void r.emit("canvas:".concat(a),t);var c=e.getItemRoot(o);if(c){var l=c.get("item");if(!l.destroyed){var f=l.getType();if(t.target=o,t.item=l,t.canvasX===t.x&&t.canvasY===t.y){var h=r.getCanvasByPoint(t.x,t.y);t.canvasX=h.x,t.canvasY=h.y}t.name&&!t.name.includes(":")?(r.emit("".concat(f,":").concat(a),t),r.emit(a,t)):t.name&&r.emit(t.name,t),"dragstart"===a&&(this.dragging=!0),"dragend"===a&&(this.dragging=!1),"mousemove"===a&&this.handleMouseMove(t,f)}}else r.emit(a,t)},e.prototype.onExtendEvents=function(t){this.graph.emit(t.type,t)},e.prototype.onWheelEvent=function(t){Object(v.isNil)(t.wheelDelta)&&(t.wheelDelta=-t.detail),this.graph.emit("wheel",t)},e.prototype.handleMouseMove=function(t,e){var n=this.graph,r=this.preItem,i=n.get("canvas"),o=t.target===i?null:t.item;t=Zr(t),r&&r!==o&&!r.destroyed&&(t.item=r,this.emitCustomEvent(r.getType(),"mouseleave",t),this.dragging&&this.emitCustomEvent(r.getType(),"dragleave",t)),o&&r!==o&&(t.item=o,this.emitCustomEvent(e,"mouseenter",t),this.dragging&&this.emitCustomEvent(e,"dragenter",t)),this.preItem=o},e.prototype.emitCustomEvent=function(t,e,n){n.type=e,this.graph.emit("".concat(t,":").concat(e),n)},e.prototype.resetStatus=function(){this.mousedown=!1,this.dragging=!1,this.preItem=null},e.prototype.destroy=function(){var t=this.graph,e=this.canvasHandler,n=this.extendEvents;t.get("canvas").off("*",e),Object(v.each)(n,(function(t){t.remove()})),this.resetStatus(),this.extendEvents.length=0,this.canvasHandler=null,this.resetHandler=null,this.destroyed=!0},e}(vr),$r=n(7),Jr=n(40),ti=n.n(Jr),ei=pr.traverseTree,ni=function(t,e){return t?Object(v.isNumber)(t)?function(e){return t}:t:function(t){return e||1}},ri=function(t,e){var n=[],r=[],i={},o=0;for(o=0;o=0&&(o="x",i="y");var a=0;ei(t,(function(t){return a++,t.x>r.x&&(r.x=t.x),t.xr.y&&(r.y=t.y),t.yWebGL.
','Find out how to get it here.'].join("\n"):['Your browser does not seem to support WebGL.
','Find out how to get it here.'].join("\n")),t},addGetWebGLMessage:function(e){var n=void 0!==(e=e||{}).parent?e.parent:document.body,r=void 0!==e.id?e.id:"oldie",i=t().getWebGLErrorMessage();i.id=r,n.appendChild(i)}}},li=function(){var t=navigator.userAgent.toLowerCase();return t.indexOf("firefox")>-1?"firefox":t.indexOf("safari")>-1?"safari":t.indexOf("opr")>-1?"opera":t.indexOf("chrome")>-1?"chrome":t.indexOf("trident")>-1?"ie 11":t.indexOf("ie")>-1?"ie":"unknown"},fi=Object(g.__assign)(Object(g.__assign)(Object(g.__assign)(Object(g.__assign)(Object(g.__assign)({},pr),l),f),h),d),hi=fi.radialLayout,di=function(){function t(t){this.type=t.type,this.radial=t.radial,this.config=t}return t.prototype.init=function(t){var e=this;this.data=t,this.radial?this.layoutMethod=function(t){var n=ti.a[e.type](t,e.config);return hi(n),n}:this.layoutMethod=function(t){return ti.a[e.type](t,e.config)}},t.prototype.execute=function(){return this.layoutMethod(this.data,this.config)},t.prototype.layout=function(t){return this.init(t),this.execute()},t}();Object($r.registerLayout)("grid",$r.GridLayout),Object($r.registerLayout)("random",$r.RandomLayout),Object($r.registerLayout)("force",$r.ForceLayout),Object($r.registerLayout)("circular",$r.CircularLayout),Object($r.registerLayout)("dagre",$r.DagreLayout),Object($r.registerLayout)("dagreCompound",$r.DagreCompoundLayout),Object($r.registerLayout)("radial",$r.RadialLayout),Object($r.registerLayout)("concentric",$r.ConcentricLayout),Object($r.registerLayout)("mds",$r.MDSLayout),Object($r.registerLayout)("fruchterman",$r.FruchtermanLayout),Object($r.registerLayout)("fruchterman-gpu",$r.FruchtermanGPULayout),Object($r.registerLayout)("gForce",$r.GForceLayout),Object($r.registerLayout)("force2",$r.Force2Layout),Object($r.registerLayout)("gForce-gpu",$r.GForceGPULayout),Object($r.registerLayout)("comboForce",$r.ComboForceLayout),Object($r.registerLayout)("comboCombined",$r.ComboCombinedLayout),Object($r.registerLayout)("forceAtlas2",$r.ForceAtlas2Layout);var pi=function(t,e){e.isCustomLayout=!0,$r.Layouts[t]=Object($r.registerLayout)(t,e)},gi=function(t,e){var n=t.toString(),r=new Blob(["importScripts('".concat(e,"');(").concat(n,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(r))},vi=function(t){return void 0===t&&(t="https://unpkg.com/@antv/layout@0.3.23/dist/layout.min.js"),new gi((function(){var t="LAYOUT_RUN",e="LAYOUT_END",n="LAYOUT_ERROR",r="GPU_LAYOUT_RUN";layout.registerLayout("grid",layout.GridLayout),layout.registerLayout("random",layout.RandomLayout),layout.registerLayout("force",layout.ForceLayout),layout.registerLayout("force2",layout.Force2Layout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),layout.registerLayout("dagreCompound",layout.DagreCompoundLayout),layout.registerLayout("radial",layout.RadialLayout),layout.registerLayout("concentric",layout.ConcentricLayout),layout.registerLayout("mds",layout.MDSLayout),layout.registerLayout("fruchterman",layout.FruchtermanLayout),layout.registerLayout("fruchterman-gpu",layout.FruchtermanGPULayout),layout.registerLayout("gForce",layout.GForceLayout),layout.registerLayout("gForce-gpu",layout.GForceGPULayout),layout.registerLayout("comboForce",layout.ComboForceLayout),layout.registerLayout("comboCombined",layout.ComboCombinedLayout),layout.registerLayout("forceAtlas2",layout.ForceAtlas2Layout),onmessage=function(i){(function(e){var n=e.data.type;return n===t||n===r})(i)&&function(i){var o=this;switch(i.data.type){case t:var a,s=i.data,u=s.nodes,c=s.edges,l=s.layoutCfg,f=(v=void 0===l?{}:l).type;if(!(h=layout.getLayoutByName(f))){this.postMessage({type:n,message:"layout ".concat(f," not found")});break}v.onLayoutEnd=function(){o.postMessage({type:e,nodes:u}),null==a||a.destroy()},(a=new h(v)).init({nodes:u,edges:c}),a.execute();break;case r:var h,d=i.data,p=d.nodes,g=(c=d.edges,d.layoutCfg),v=void 0===g?{}:g,y=d.canvas;f=v.type;if(!(h=layout.getLayoutByName(f))){this.postMessage({type:n,message:"layout ".concat(f," not found")});break}if("gpu"!==f.split("-")[1]){this.postMessage({type:n,message:"layout ".concat(f," does not support GPU")});break}var m=new h(v);m.init({nodes:p,edges:c}),m.executeWithWorker(y,this)}}(i)}}),t)},yi="LAYOUT_RUN",mi="LAYOUT_END",bi="LAYOUT_ERROR",xi="LAYOUT_TICK",wi="GPU_LAYOUT_RUN",_i="GPU_LAYOUT_END";function Ei(t){return(Ei="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Si=function(t){return setTimeout(t,16)},Mi=function(t){return clearTimeout(t)},Oi=function(t){return("undefined"!=typeof window&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||Si)(t)},ki=function(t){return("undefined"!=typeof window&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||Mi)(t)},Ai=["fruchterman","gForce"],Ci=["force","grid","circular"],ji=function(t){function e(e){var n=t.call(this,e)||this;return n.graph=e,n.layoutCfg=e.get("layout")||{},n.layoutType=n.getLayoutType(),n.worker=null,n.workerData={},n.initLayout(),n}return Object(g.__extends)(e,t),e.prototype.initLayout=function(){},e.prototype.getWorker=function(){return this.worker||("undefined"==typeof Worker?(console.warn("Web worker is not supported in current browser."),this.worker=null):this.worker=vi(this.layoutCfg.workerScriptURL)),this.worker},e.prototype.stopWorker=function(){var t=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,t.requestId&&(ki(t.requestId),t.requestId=null),t.requestId2&&(ki(t.requestId2),t.requestId2=null))},e.prototype.execLayoutMethod=function(t,e){var n=this;return new Promise((function(r,i){return Object(g.__awaiter)(n,void 0,void 0,(function(){var n,o,a,s,u,c,l,f,h;return Object(g.__generator)(this,(function(d){switch(d.label){case 0:if(!(n=this.graph)||n.get("destroyed"))return[2];o=t.type,t.onLayoutEnd=function(){n.emit("aftersublayout",{type:o}),r()},o&&this.isGPU&&(Ti(o)?o="".concat(o,"-gpu"):console.warn("The '".concat(o,"' layout does not support GPU calculation for now, it will run in CPU."))),pr.isForce(o)?(a=t.onTick,s=t.animate,u=void 0===s&&("force"===o||"force2"===o),f=function(){a&&a(),(s||u)&&n.refreshPositions()},t.tick=f):"comboForce"!==o&&"comboCombined"!==o||(t.comboTrees=n.get("comboTrees")),!1;try{c=new $r.Layouts[o](t),this.layoutMethods[e]&&this.layoutMethods[e].destroy(),this.layoutMethods[e]=c}catch(t){console.warn("The layout method: '".concat(o,"' does not exist! Please specify it first.")),i()}return c.enableTick&&(l=t.onTick,f=function(){l&&l(),n.refreshPositions()},c.tick=f),function(t,e){var n;if(!(null===(n=null==t?void 0:t.nodes)||void 0===n?void 0:n.length))return;t.nodes.forEach((function(t){t.layoutOrder=e}))}(h=this.filterLayoutData(this.data,t),e),c.init(h),n.emit("beforesublayout",{type:o}),[4,c.execute()];case 1:return d.sent(),c.isCustomLayout&&t.onLayoutEnd&&t.onLayoutEnd(),[2]}}))}))}))},e.prototype.updateLayoutMethod=function(t,e){var n=this;return new Promise((function(r,i){return Object(g.__awaiter)(n,void 0,void 0,(function(){var n,i,o,a,s,u,c;return Object(g.__generator)(this,(function(l){switch(l.label){case 0:return n=this.graph,i=null==e?void 0:e.type,e.onLayoutEnd=function(){n.emit("aftersublayout",{type:i}),r()},pr.isForce(i)&&(o=e.onTick,a=e.animate,s=void 0===a&&("force"===i||"force2"===i),u=function(){null==o||o(),(a||s)&&n.refreshPositions()},e.tick=u),c=this.filterLayoutData(this.data,e),t.init(c),t.updateCfg(e),n.emit("beforesublayout",{type:i}),[4,t.execute()];case 1:return l.sent(),t.isCustomLayout&&e.onLayoutEnd&&e.onLayoutEnd(),[2]}}))}))}))},e.prototype.layout=function(t){var e,n=this,r=this.graph;if(r&&!r.get("destroyed")){this.data=this.setDataFromGraph();var i=this.data,o=i.nodes,a=i.hiddenNodes;if(!o)return!1;var s=r.get("width"),u=r.get("height"),c={};Object.assign(c,{width:s,height:u,center:[s/2,u/2]},this.layoutCfg),this.layoutCfg=c;var l=c.type,f=!1;null===(e=this.layoutMethods)||void 0===e||e.forEach((function(t){var e;return f=!!(null===(e=t.nodes)||void 0===e?void 0:e.length)||f}));var h=this.destoryLayoutMethods();r.emit("beforelayout");var d=Promise.resolve();f&&l&&1===(null==h?void 0:h.length)&&h[0]===l?this.tweakInit():d=this.initPositions(c.center,o),this.initPositions(c.center,a).then(),this.isGPU=Ni(c,l);var p=c.onLayoutEnd,v=c.layoutEndFormatted,y=c.adjust;if(v||(c.layoutEndFormatted=!0,c.onAllLayoutEnd=function(){return Object(g.__awaiter)(n,void 0,void 0,(function(){return Object(g.__generator)(this,(function(t){switch(t.label){case 0:return p&&p(o),this.refreshLayout(),y&&c.pipes?[4,this.adjustPipesBox(this.data,y)]:[3,2];case 1:t.sent(),this.refreshLayout(),t.label=2;case 2:return r.emit("afterlayout"),[2]}}))}))}),this.stopWorker(),c.workerEnabled&&this.layoutWithWorker(this.data,t))return!0;var m=!1;return c.type?(m=!0,d=d.then((function(){return Object(g.__awaiter)(n,void 0,void 0,(function(){return Object(g.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.execLayoutMethod(c,0)];case 1:return[2,t.sent()]}}))}))}))):c.pipes&&(m=!0,c.pipes.forEach((function(t,e){d=d.then((function(){return Object(g.__awaiter)(n,void 0,void 0,(function(){return Object(g.__generator)(this,(function(n){switch(n.label){case 0:return[4,this.execLayoutMethod(t,e)];case 1:return[2,n.sent()]}}))}))}))}))),m?d.then((function(){c.onAllLayoutEnd&&c.onAllLayoutEnd(),t&&t()})).catch((function(t){console.warn("graph layout failed,",t)})):(r.refreshPositions(),null==t||t()),!1}},e.prototype.tweakInit=function(){var t=this.data,e=this.graph,n=t.nodes,r=t.edges;if(null==n?void 0:n.length){var i={};n.forEach((function(t){var e=t.x,n=t.y;isNaN(e)||isNaN(n)||(i[t.id]={x:e,y:n},t.mass=t.mass||2)})),r.forEach((function(t){var e=t.source,n=t.target,r=i[e],o=i[n];!r&&o?i[e]={x:o.x+80*(Math.random()-.5),y:o.y+80*(Math.random()-.5)}:!o&&r&&(i[n]={x:r.x+80*(Math.random()-.5),y:r.y+80*(Math.random()-.5)})}));var o=e.get("width"),a=e.get("height");n.forEach((function(t){var e=i[t.id]||{x:o/2+20*(Math.random()-.5),y:a/2+20*(Math.random()-.5)};t.x=e.x,t.y=e.y}))}},e.prototype.initWithPreset=function(t,e){var n=this;return new Promise((function(r,i){return Object(g.__awaiter)(n,void 0,void 0,(function(){var n,i,o,a,s,u,c;return Object(g.__generator)(this,(function(l){switch(l.label){case 0:return i=(n=this).layoutCfg,o=n.data,(null==(a=i.preset)?void 0:a.type)&&$r.Layouts[null==a?void 0:a.type]?(s=Ni(a,a.type),u=s?"".concat(a.type,"-gpu"):a.type,c=new $r.Layouts[u](a),delete i.preset,c.init(o),[4,c.execute()]):(null==e||e(),r(),[2,!1]);case 1:return l.sent(),null==t||t(),r(),[2,!0]}}))}))}))},e.prototype.layoutWithWorker=function(t,e){var n=this,r=this.layoutCfg,i=this.graph,o=this.getWorker(),a=this.workerData;if(!o)return!1;a.requestId=null,a.requestId2=null,a.currentTick=null,a.currentTickData=null,i.emit("beforelayout");var s=Promise.resolve(),u=!1;if(r.type)u=!0,s=s.then((function(){return n.runWebworker(o,t,r)}));else if(r.pipes){u=!0;for(var c=function(e){s=s.then((function(){return n.runWebworker(o,t,e)}))},l=0,f=r.pipes;l'),u=n?n.backgroundColor:void 0,c=n?n.padding:void 0;c?Object(v.isNumber)(c)&&(c=[c,c,c,c]):c=[0,0,0,0];var l=i+c[0]+c[2],f=o+c[1]+c[3],h={container:s,height:l,width:f,quickHit:!0},d="svg"===a?new Sr.Canvas(h):new Er.Canvas(h),p=this.get("group").clone(),g=Object(v.clone)(p.getMatrix());g||(g=[1,0,0,0,1,0,0,0,1]);var y=(r.maxX+r.minX)/2,m=(r.maxY+r.minY)/2;g=Li(g,[["t",-y,-m],["t",o/2+c[3],i/2+c[0]]]),p.resetMatrix(),p.setMatrix(g),d.add(p);var b=d.get("el"),x="";e||(e="image/png"),setTimeout((function(){if("svg"===a){var n=b.cloneNode(!0),r=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),i=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",r);i.replaceChild(n,i.documentElement);var o=(new XMLSerializer).serializeToString(i);x="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(o))}else{var s=void 0,c=b.getContext("2d"),h=void 0;if(u){var d="undefined"!=typeof window?window.devicePixelRatio:1;try{s=c.getImageData(0,0,f*d,l*d),h=c.globalCompositeOperation,c.globalCompositeOperation="destination-over",c.fillStyle=u,c.fillRect(0,0,f,l)}catch(t){console.error("Download image failed. Out of memory at ImageData creation")}}x=b.toDataURL(e),u&&(c.clearRect(0,0,f,l),c.putImageData(s,0,0),c.globalCompositeOperation=h)}t&&t(x)}),16)},e.prototype.downloadFullImage=function(t,e,n){var r=this,i=this.get("group").getCanvasBBox(),o=i.height,a=i.width,s=this.get("renderer"),u=Hr('
'),c=document.querySelector(".g6-graph-watermarker"),l=n?n.backgroundColor:void 0,f=n?n.padding:void 0;f?Object(v.isNumber)(f)&&(f=[f,f,f,f]):f=[0,0,0,0];var h=o+f[0]+f[2],d=a+f[1]+f[3];if(c){var p=this.get("graphWaterMarker").cfg||{},g=p.width,y=p.height;h=Math.ceil(h/y)*y,d=Math.ceil(d/g)*g}var m,b,x={container:u,height:h,width:d},w="svg"===s?new Sr.Canvas(x):new Er.Canvas(x),_=this.get("group"),E=(b=(m=_).clone(),Di(m,b),b),S=Object(v.clone)(E.getMatrix());S||(S=[1,0,0,0,1,0,0,0,1]);var M=(i.maxX+i.minX)/2,O=(i.maxY+i.minY)/2;S=Li(S,[["t",-M,-O],["t",a/2+f[3],o/2+f[0]]]),E.resetMatrix(),E.setMatrix(S),w.add(E);var k=w.get("el");e||(e="image/png"),this.asyncToDataUrl(e,l,(function(n){var i=document.createElement("a"),o=(t||"graph")+("svg"===s?".svg":".".concat(e.split("/")[1]));r.dataURLToImage(n,s,i,o);var a=document.createEvent("MouseEvents");a.initEvent("click",!1,!1),i.dispatchEvent(a)}),d,h,k)},e.prototype.downloadImage=function(t,e,n){var r=this;this.stopAnimate();var i=this.get("canvas").getRenderer();e||(e="image/png");var o=(t||"graph")+("svg"===i?".svg":e.split("/")[1]),a=document.createElement("a");this.asyncToDataUrl(e,n,(function(t){r.dataURLToImage(t,i,a,o);var e=document.createEvent("MouseEvents");e.initEvent("click",!1,!1),a.dispatchEvent(e)}))},e.prototype.dataURLToImage=function(t,e,n,r){if(t&&"data:"!==t){if("undefined"!=typeof window)if(window.Blob&&window.URL&&"svg"!==e){var i=t.split(","),o="";if(i&&i.length>0){var a=i[0].match(/:(.*?);/);a&&a.length>=2&&(o=a[1])}for(var s=atob(i[1]),u=s.length,c=new Uint8Array(u);u--;)c[u]=s.charCodeAt(u);var l=new Blob([c],{type:o});window.navigator.msSaveBlob?window.navigator.msSaveBlob(l,r):n.addEventListener("click",(function(){n.download=r,n.href=window.URL.createObjectURL(l)}))}else n.addEventListener("click",(function(){n.download=r,n.href=t}))}else console.error("Download image failed. The graph is too large or there is invalid attribute values in graph items")},e.prototype.addPlugin=function(t){t.destroyed||(this.get("plugins").push(t),t.initPlugin(this))},e.prototype.removePlugin=function(t){var e=this.get("plugins"),n=e.indexOf(t);n>=0&&(t.destroyPlugin(),e.splice(n,1))},e.prototype.setImageWaterMarker=function(t,e){void 0===t&&(t=Wr.waterMarkerImage);var n=this.get("container");Object(v.isString)(n)&&(n=document.getElementById(n)),n.style.position||(n.style.position="relative");var r=this.get("graphWaterMarker"),i=Object(v.deepMix)({},Wr.imageWaterMarkerConfig,e),o=i.width,a=i.height,s=i.compatible,u=i.image;if(!t){var c=s?n:document.querySelector(".g6-graph-watermarker");return c&&(c.style.cssText=void 0),void(r&&r.clear())}if(r)r.clear();else{var l={container:n,width:o,height:a,capture:!1},f=this.get("pixelRatio");f&&(l.pixelRatio=f,window.devicePixelRatio=f),r=new Er.Canvas(l),this.set("graphWaterMarker",r)}r.get("el").style.display="none";var h=r.get("context"),d=u.rotate,p=u.x,g=u.y;h.rotate(-d*Math.PI/180);var y=new Image;y.crossOrigin="anonymous",y.src=t,y.onload=function(){if(h.drawImage(y,p,g,u.width,u.height),h.rotate(d*Math.PI/180),s)n.style.cssText="background-image: url(".concat(r.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var t=document.querySelector(".g6-graph-watermarker");t||((t=document.createElement("div")).className="g6-graph-watermarker"),t.className="g6-graph-watermarker",r.destroyed||(t.style.cssText="background-image: url(".concat(r.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;"),n.appendChild(t))}}},e.prototype.setTextWaterMarker=function(t,e){var n=this.get("container");Object(v.isString)(n)&&(n=document.getElementById(n)),n.style.position||(n.style.position="relative");var r=this.get("graphWaterMarker"),i=Object(v.deepMix)({},Wr.textWaterMarkerConfig,e),o=i.width,a=i.height,s=i.compatible,u=i.text;if(!(null==t?void 0:t.length)){var c=s?n:document.querySelector(".g6-graph-watermarker");return c&&(c.style.cssText=void 0),void(r&&r.clear())}if(r)r.clear();else{var l={container:n,width:o,height:a,capture:!1},f=this.get("pixelRatio");f&&(l.pixelRatio=f,window.devicePixelRatio=f),r=new Er.Canvas(l),this.set("graphWaterMarker",r)}r.get("el").style.display="none";var h=r.get("context"),d=u.rotate,p=u.fill,g=u.fontFamily,y=u.fontSize,m=u.baseline,b=u.x,x=u.y,w=u.lineHeight;h.rotate(-d*Math.PI/180),h.font="".concat(y,"px ").concat(g),h.fillStyle=p,h.textBaseline=m;for(var _=Object(v.isString)(t)?[t]:t,E=_.length-1;E>=0;E--)h.fillText(_[E],b,x+E*w);if(h.rotate(d*Math.PI/180),s)n.style.cssText="background-image: url(".concat(r.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var S=document.querySelector(".g6-graph-watermarker");S||((S=document.createElement("div")).className="g6-graph-watermarker"),S.style.cssText="background-image: url(".concat(r.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:99;"),n.appendChild(S)}},e.prototype.destroy=function(){var e,n,r,i;Object(v.each)(this.get("plugins"),(function(t){t.destroyPlugin()}));var o=this.get("tooltips");if(o)for(var a=0;a0)for(var c=u.length-1;c>=0;c--){var l=u[c].getModel();-1===e.indexOfChild(t.children||[],l.id)&&(i.innerRemoveChild(l.id,{x:t.x,y:t.y},r),u.splice(c,1))}o.get("originAttrs")&&(a=o.get("originAttrs").x,s=o.get("originAttrs").y);var f=o.getModel();r&&o.set("originAttrs",{x:f.x,y:f.y}),o.set("model",Object.assign(f,t.data)),a===t.x&&s===t.y||o.updatePosition({x:t.x,y:t.y})}else i.innerAddChild(t,n,r)},e.prototype.innerRemoveChild=function(t,e,n){var r=this,i=r.findById(t);if(i)if(Object(v.each)(i.get("children"),(function(t){r.innerRemoveChild(t.getModel().id,e,n)})),n){var o=i.getModel();i.set("to",e),i.set("originAttrs",{x:o.x,y:o.y}),r.get("removeList").push(i)}else r.removeItem(i,!1)},e.prototype.changeData=function(t,e){void 0===e&&(e=!0);var n=this;this.getNodes().map((function(t){return n.clearItemStates(t)})),this.getEdges().map((function(t){return n.clearItemStates(t)})),e&&this.get("enabledStack")&&this.pushStack("changedata",{before:n.get("originData"),after:t||n.get("data")}),t?(n.data(t),n.render(!1)):n.layout(this.get("fitView"))},e.prototype.changeLayout=function(t){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");this.updateLayout(t)},e.prototype.updateLayout=function(t,e,n,r){void 0===r&&(r=!0);if(t){if(r&&this.get("enabledStack")&&this.pushStack("layout",{before:this.get("layout"),after:t}),this.set("layout",t),this.set("layoutMethod",this.getLayout()),this.layout(),e){var i=n;i||(i="begin"===e?{x:0,y:0}:{x:this.getWidth()/2,y:this.getHeight()/2}),i=this.getPointByCanvas(i.x,i.y);var o=this.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];i.x=i.x*o[0]+o[6],i.y=i.y*o[0]+o[7];var a=this.getGroup().getCanvasBBox(),s=a.minX,u=a.maxX,c=a.minY,l={x:(s+u)/2,y:(c+a.maxY)/2};"begin"===e&&(l.x=s,l.y=c),this.translate(i.x-l.x,i.y-l.y)}}else console.warn("layout cannot be null")},e.prototype.refreshLayout=function(t){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");this.layout(t)},e.prototype.layout=function(t){var e=this,n=this.get("data"),r=this.get("layoutMethod"),i=this.get("layout"),o=n;if(null==i?void 0:i.excludeInvisibles){n=Object(v.clone)(this.get("data"));var a={};Fi(n,(function(t){var n=t.children;if(!(null==n?void 0:n.length))return!0;for(var r=n.length-1;r>=0;r--){var i=e.findById(n[r].id);(i?!i.isVisible():!1===n[r].visible)&&(a[t.id]=a[t.id]||[],a[t.id].push({idx:r,child:n.splice(r,1)[0]}))}})),o=r?r(n,this.get("layout")):n,Fi(o,(function(t){var e=a[t.id];if(null==e?void 0:e.length)for(var n=e.length-1;n>=0;n--){var r=e[n],i=r.idx,o=r.child;t.children.splice(i,0,o)}}))}else o=r?r(n,this.get("layout")):n;var s=this.get("animate");(this.emit("beforerefreshlayout",{data:n,layoutData:o}),this.emit("beforelayout"),this.innerUpdateChild(o,void 0,s),t)&&this.get("viewController").fitView();s?this.layoutAnimate(o):(this.refresh(),this.paint()),this.emit("afterrefreshlayout",{data:n,layoutData:o}),this.emit("afterlayout")},e.prototype.addChild=function(t,e,n){void 0===n&&(n=!0);this.emit("beforeaddchild",{model:t,parent:e}),Object(v.isString)(e)||(e=e.get("id"));var r=this.findDataById(e);r&&(r.children||(r.children=[]),r.children.push(t),this.findById(e).refresh(),this.changeData(void 0,n))},e.prototype.updateChildren=function(t,e,n){void 0===n&&(n=!0);var r=this.findById(e);e&&r?(this.findDataById(e).children=t,r.refresh(),this.changeData(void 0,n)):console.warn("Update children failed! There is no node with id '".concat(e,"'"))},e.prototype.updateChild=function(t,n,r){void 0===r&&(r=!0);if(n&&this.findById(n)){var i=this.findDataById(n),o=this.findById(t.id);if(i.children||(i.children=[]),o){var a=e.indexOfChild(i.children,t.id);a>-1&&(i.children[a]=t)}else i.children.push(t);var s=this.findById(n);null==s||s.refresh(),this.changeData(void 0,r)}else this.changeData(t,r)},e.prototype.removeChild=function(t,n){void 0===n&&(n=!0);var r,i=this.findById(t);if((r=i?null==i?void 0:i.get("parent"):this.getNodes().find((function(e){return!!(e.getModel().children||[]).find((function(e){return e.id===t}))})))&&!r.destroyed){var o=r.get("id"),a=this.findDataById(o),s=a&&a.children||[],u=e.indexOfChild(s,t);s.splice(u,1),r.refresh()}this.changeData(void 0,n)},e.prototype.findDataById=function(t,e){var n=this;if(e||(e=n.get("data")),t===e.id)return e;var r=null;return Object(v.each)(e.children||[],(function(e){return e.id===t?(r=e,!1):!(r=n.findDataById(t,e))&&void 0})),r},e.prototype.layoutAnimate=function(t,e){var n=this,r=this.get("animateCfg");n.emit("beforeanimate",{data:t}),n.getEdges().forEach((function(t){var e=t.get("model");e.sourceAnchor||(e.sourceAnchor=t.get("sourceAnchorIndex"))})),this.get("canvas").animate((function(r){Fi(t,(function(i){var o=n.findById(i.id);if(o){var a=o.get("originAttrs"),s=o.get("model");if(a||(a={x:s.x,y:s.y},o.set("originAttrs",a)),e){var u=e(o,r,a,t);o.set("model",Object.assign(s,u))}else s.x=a.x+(i.x-a.x)*r,s.y=a.y+(i.y-a.y)*r}return!0})),Object(v.each)(n.get("removeList"),(function(t){var e=t.getModel(),n=t.get("originAttrs"),i=t.get("to");e.x=n.x+(i.x-n.x)*r,e.y=n.y+(i.y-n.y)*r})),n.refreshPositions()}),{duration:r.duration,easing:r.ease,callback:function(){Object(v.each)(n.getNodes(),(function(t){t.set("originAttrs",null)})),Object(v.each)(n.get("removeList"),(function(t){n.removeItem(t,!1)})),n.set("removeList",[]),r.callback&&r.callback(),n.emit("afteranimate",{data:t})},delay:r.delay})},e.prototype.stopLayoutAnimate=function(){this.get("canvas").stopAnimate(),this.emit("layoutanimateend",{data:this.get("data")}),this.layoutAnimating=!1},e.prototype.isLayoutAnimating=function(){return this.layoutAnimating},e.prototype.render=function(t){void 0===t&&(t=!0);var e=this.get("data");if(!e||!Object(v.isObject)(e)||!Object.keys(e).length)throw new Error("data must be defined first");this.clear(),t&&this.get("enabledStack")&&this.clearStack(),this.emit("beforerender"),this.layout(this.get("fitView")),this.emit("afterrender")},e.prototype.save=function(){return this.get("data")},e.prototype.data=function(e){t.prototype.data.call(this,e),this.set("originData",JSON.parse(JSON.stringify(e)))},e}(Ri),Gi=function(){function t(t){this._cfgs=Object(v.deepMix)(this.getDefaultCfgs(),t),this._events={},this.destroyed=!1}return t.prototype.getDefaultCfgs=function(){return{}},t.prototype.initPlugin=function(t){var e=this;e.set("graph",t);var n=e.getEvents(),r={};Object(v.each)(n,(function(n,i){var o=Object(v.wrapBehavior)(e,n);r[i]=o,t.on(i,o)})),this._events=r,this.init()},t.prototype.getEvents=function(){return{}},t.prototype.get=function(t){var e;return null===(e=this._cfgs)||void 0===e?void 0:e[t]},t.prototype.set=function(t,e){this._cfgs[t]=e},t.prototype.destroy=function(){},t.prototype.destroyPlugin=function(){this.destroy();var t=this.get("graph"),e=this._events;Object(v.each)(e,(function(e,n){t.off(n,e)})),this._events=null,this._cfgs=null,this.destroyed=!0},t}(),Yi=(Pi=function(t,e){return(Pi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Pi(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),Ui="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",Xi=function(t){function e(e){return t.call(this,e)||this}return Yi(e,t),e.prototype.getDefaultCfgs=function(){return{img:Ui,follow:!0}},e.prototype.init=function(){var t=this.get("graph"),e=t.get("container"),n=t.get("canvas").get("el"),r=this.get("img")||Ui;r.includes("url(")||(r='url("'.concat(r,'")'));var i=Hr("
"),o=Hr(""));this.set("container",i),this.set("gridContainer",o),this.positionInit(),i.appendChild(o),e.insertBefore(i,n)},e.prototype.positionInit=function(){var t=this.get("graph"),e=t.get("minZoom"),n=t.get("width"),r=t.get("height");qr(this.get("container"),{width:"".concat(n,"px"),height:"".concat(r,"px")});var i=80*n/e,o=80*r/e;qr(this.get("gridContainer"),{width:"".concat(i,"px"),height:"".concat(o,"px"),left:"-".concat(i/2,"px"),top:"-".concat(o/2,"px")})},e.prototype.getEvents=function(){return{viewportchange:"updateGrid"}},e.prototype.updateGrid=function(t){var e=this.get("gridContainer"),n=t.matrix;n||(n=[1,0,0,0,1,0,0,0,1]);var r=this.get("follow");qr(e,{transform:"matrix(".concat(n[0],", ").concat(n[1],", ").concat(n[3],", ").concat(n[4],", ").concat(r?n[6]:"0",", ").concat(r?n[7]:"0",")")})},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t=this.get("graph").get("container"),e=this.get("container");t.removeChild(e)},e}(Gi),Wi=n(30),Vi=n.n(Wi),Hi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();"undefined"!=typeof document&&Vi()("\n .g6-component-contextmenu {\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n background-color: rgba(255, 255, 255, 0.9);\n padding: 10px 8px;\n box-shadow: rgb(174, 174, 174) 0px 0px 10px;\n }\n .g6-contextmenu-ul {\n padding: 0;\n margin: 0;\n list-style: none;\n }\n\n");var qi=function(t){function e(e){return t.call(this,e)||this}return Hi(e,t),e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,getContent:function(t){return"\n
    \n
  • 鑿滃崟椤�1
  • \n
  • 鑿滃崟椤�2
  • \n
\n "},shouldBegin:function(t){return!0},onHide:function(){return!0},itemTypes:["node","edge","combo"],trigger:"contextmenu"}},e.prototype.getEvents=function(){return"click"===this.get("trigger")?{click:"onMenuShow",touchend:"onMenuShow"}:{contextmenu:"onMenuShow"}},e.prototype.init=function(){var t=this.get("className"),e=Hr("
"));qr(e,{top:"0px",position:"absolute",visibility:"hidden"});var n=this.get("container");n||(n=this.get("graph").get("container")),Object(v.isString)(n)&&(n=document.getElementById(n)),n.appendChild(e),this.set("menu",e)},e.prototype.onMenuShow=function(t){var e=this;t.preventDefault();var n=this.get("itemTypes");if(t.item){if(t.item&&t.item.getType&&-1===n.indexOf(t.item.getType()))return void e.onMenuHide()}else if(-1===n.indexOf("canvas"))return void e.onMenuHide();if(this.get("shouldBegin")(t)){var r=this.get("menu"),i=this.get("getContent"),o=this.get("graph"),a=i(t,o);Object(v.isString)(a)?r.innerHTML=a:r.innerHTML=a.outerHTML,this.removeMenuEventListener();var s=this.get("handleMenuClick");if(s){var u=function(e){s(e.target,t.item,o)};this.set("handleMenuClickWrapper",u),r.addEventListener("click",u)}var c=o.get("width"),l=o.get("height"),f=r.getBoundingClientRect(),h=this.get("offsetX")||0,d=this.get("offsetY")||0,p=o.getContainer().offsetTop,g=o.getContainer().offsetLeft,y=t.canvasX+g+h,m=t.canvasY+p+d;y+f.width>c&&(y=t.canvasX-f.width-h+g),m+f.height>l&&(m=t.canvasY-f.height-d+p),qr(r,{top:"".concat(m,"px"),left:"".concat(y,"px"),visibility:"visible"});var b="click"===this.get("trigger"),x=function(t){b?b=!1:e.onMenuHide()};document.body.addEventListener("click",x),this.set("handler",x)}},e.prototype.removeMenuEventListener=function(){var t=this.get("handleMenuClickWrapper"),e=this.get("handler");t&&(this.get("menu").removeEventListener("click",t),this.set("handleMenuClickWrapper",null));e&&document.body.removeEventListener("click",e)},e.prototype.onMenuHide=function(){var t=this.get("menu");t&&qr(t,{visibility:"hidden"}),this.removeMenuEventListener()},e.prototype.destroy=function(){var t=this.get("menu");if(this.removeMenuEventListener(),t){var e=this.get("container");e||(e=this.get("graph").get("container")),Object(v.isString)(e)&&(e=document.getElementById(e)),e.removeChild(t)}},e}(Gi),Zi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ki=function(){return(Ki=Object.assign||function(t){for(var e,n=1,r=arguments.length;n-1,a=navigator.userAgent.toLowerCase().indexOf("safari")>-1,s=Hr("\n ")),u=0,c=0,l=!1,f=0,h=0,d=0,p=0,g=0,y=0,m=a||o?"mousedown":"dragstart";s.addEventListener(m,(function(i){var o,a;if(i.dataTransfer){var v=new Image;v.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",null===(a=(o=i.dataTransfer).setDragImage)||void 0===a||a.call(o,v,0,0);try{i.dataTransfer.setData("text/html","view-port-minimap")}catch(t){i.dataTransfer.setData("text","view-port-minimap")}}if(e.refresh=!1,i.target===s){var m=s.style;f=parseInt(m.left,10),h=parseInt(m.top,10),d=parseInt(m.width,10),p=parseInt(m.height,10),d>n[0]||p>n[1]||(y=r.getZoom(),g=t.get("ratio"),l=!0,u=i.clientX,c=i.clientY)}}),!1);var b=function(t){if(l&&!Object(v.isNil)(t.clientX)&&!Object(v.isNil)(t.clientY)){var e=u-t.clientX,i=c-t.clientY;(f-e<0||f-e+d>=n[0])&&(e=0),(h-i<0||h-i+p>=n[1])&&(i=0),h-=i,qr(s,{left:"".concat(f-=e,"px"),top:"".concat(h,"px")}),r.translate(e*y/g,i*y/g),u=t.clientX,c=t.clientY}};a||o||s.addEventListener("drag",b,!1);var x=function(){l=!1,e.refresh=!0},w=a||o?"mouseup":"dragend";s.addEventListener(w,x,!1),i.addEventListener("mouseleave",x),i.addEventListener("mouseup",x),(a||o)&&i.addEventListener("mousemove",b,!1),this.set("viewport",s),i.appendChild(s)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),e=this.get("totaldx"),n=this.get("totaldy"),r=this.get("graph"),i=this.get("size"),o=r.get("canvas").get("el"),a=r.get("width")||o.scrollWidth||500,s=r.get("height")||o.scrollHeight||500,u=r.getPointByCanvas(0,0),c=r.getPointByCanvas(a,s),l=this.get("viewport");l||this.initViewport();var f=(c.x-u.x)*t,h=(c.y-u.y)*t,d=u.x*t+e,p=u.y*t+n,g=d+f,v=p+h;d<0&&(f+=d,d=0),g>i[0]&&(f-=g-i[0]),p<0&&(h+=p,p=0),v>i[1]&&(h-=v-i[1]),this.set("ratio",t),qr(l,{left:"".concat(d,"px"),top:"".concat(p,"px"),width:"".concat(f,"px"),height:"".concat(h,"px")})}},e.prototype.updateGraphShapes=function(){var t,e=this._cfgs.graph,n=this.get("canvas"),r=e.get("group");r.destroyed||(n.clear(),this.get("hideEdge")?(t=n.addGroup(),r.get("children").forEach((function(e){e.get("id").includes("-edge")||t.add(e.clone())}))):((t=r.clone()).resetMatrix(),n.add(t)),"svg"===e.get("renderer")&&this.updateVisible(t))},e.prototype.updateVisible=function(t){var e=this;if(t.isGroup()||t.get("visible")){var n=t.get("children");if(!n||!n.length)return;n.forEach((function(t){t.get("visible")||t.hide(),e.updateVisible(t)}))}else t.hide()},e.prototype.updateKeyShapes=function(){var t=this,e=this._cfgs.graph,n=this.get("canvas"),r=n.get("children")[0]||n.addGroup();this.get("hideEdge")||Object(v.each)(e.getEdges(),(function(e){t.updateOneEdgeKeyShape(e,r)})),Object(v.each)(e.getNodes(),(function(e){t.updateOneNodeKeyShape(e,r)}));var i=e.getCombos();if(i&&i.length){var o=r.find((function(t){return"comboGroup"===t.get("name")}))||r.addGroup({name:"comboGroup"});setTimeout((function(){t.destroyed||(Object(v.each)(i,(function(e){t.updateOneComboKeyShape(e,o)})),null==o||o.sort(),null==o||o.toBack(),t.updateCanvas())}),250)}this.clearDestroyedShapes()},e.prototype.updateOneComboKeyShape=function(t,e){if(!this.destroyed){var n=this.get("itemMap")||{},r=n[t.get("id")],i=t.getBBox(),o=t.get("keyShape").clone(),a=o.attr(),s={x:i.centerX,y:i.centerY};r?s=Object.assign(a,s):(r=o,e.add(r));var u=r.get("type");"rect"!==u&&"image"!==u||(s.x=i.minX,s.y=i.minY),r.attr(s),t.isVisible()?r.show():r.hide(),r.exist=!0;var c=t.getModel().depth;isNaN(c)||r.set("zIndex",c),n[t.get("id")]=r,this.set("itemMap",n)}},e.prototype.updateOneNodeKeyShape=function(t,e){var n=this.get("itemMap")||{},r=n[t.get("id")],i=t.getBBox(),o=t.get("keyShape").clone(),a=o.attr(),s={x:i.centerX,y:i.centerY};r?(s=Object.assign(a,s),r.toFront()):(r=o,e.add(r));var u=r.get("type");"rect"!==u&&"image"!==u||(s.x=i.minX,s.y=i.minY),r.attr(s),t.isVisible()?r.show():r.hide(),r.exist=!0;var c=t.getModel().depth;isNaN(c)||r.set("zIndex",c),n[t.get("id")]=r,this.set("itemMap",n)},e.prototype.updateDelegateShapes=function(){var t=this,e=this._cfgs.graph,n=this.get("canvas"),r=n.get("children")[0]||n.addGroup();this.get("hideEdge")||Object(v.each)(e.getEdges(),(function(e){t.updateOneEdgeKeyShape(e,r)})),Object(v.each)(e.getNodes(),(function(e){t.updateOneNodeDelegateShape(e,r)}));var i=e.getCombos();if(i&&i.length){var o=r.find((function(t){return"comboGroup"===t.get("name")}))||r.addGroup({name:"comboGroup"});setTimeout((function(){t.destroyed||(Object(v.each)(i,(function(e){t.updateOneComboKeyShape(e,o)})),null==o||o.sort(),null==o||o.toBack(),t.updateCanvas())}),250)}this.clearDestroyedShapes()},e.prototype.clearDestroyedShapes=function(){var t=this.get("itemMap")||{},e=Object.keys(t);if(e&&0!==e.length)for(var n=e.length-1;n>=0;n--){var r=t[e[n]],i=r.exist;r.exist=!1,i||(r.remove(),delete t[e[n]])}},e.prototype.updateOneEdgeKeyShape=function(t,e){var n=this.get("itemMap")||{},r=n[t.get("id")];if(r){var i=t.get("keyShape").attr("path");r.attr("path",i)}else r=t.get("keyShape").clone(),e.add(r);t.isVisible()?r.show():r.hide(),r.exist=!0,n[t.get("id")]=r,this.set("itemMap",n)},e.prototype.updateOneNodeDelegateShape=function(t,e){var n=this.get("delegateStyle"),r=this.get("itemMap")||{},i=r[t.get("id")],o=t.getBBox();if(i){var a={x:o.minX,y:o.minY,width:o.width,height:o.height};i.attr(a),i.toFront()}else i=e.addShape("rect",{attrs:Ki({x:o.minX,y:o.minY,width:o.width,height:o.height},n),name:"minimap-node-shape"});t.isVisible()?i.show():i.hide(),i.exist=!0,r[t.get("id")]=i,this.set("itemMap",r)},e.prototype.init=function(){this.initContainer(),this.get("graph").on("afterupdateitem",this.handleUpdateCanvas),this.get("graph").on("afteritemstatechange",this.handleUpdateCanvas),this.get("graph").on("afteradditem",this.handleUpdateCanvas),this.get("graph").on("afterremoveitem",this.handleUpdateCanvas),this.get("graph").on("afterrender",this.handleUpdateCanvas),this.get("graph").on("afterlayout",this.handleUpdateCanvas)},e.prototype.initContainer=function(){var t=this.get("graph"),e=this.get("size"),n=this.get("className"),r=this.get("container"),i=Hr("
"));Object(v.isString)(r)&&(r=document.getElementById(r)),r?r.appendChild(i):t.get("container").appendChild(i),this.set("container",i);var o,a=Hr('
');i.appendChild(a),a.addEventListener("dragenter",(function(t){t.preventDefault()})),a.addEventListener("dragover",(function(t){t.preventDefault()})),o="svg"===t.get("renderer")?new Sr.Canvas({container:a,width:e[0],height:e[1]}):new Er.Canvas({container:a,width:e[0],height:e[1]}),this.set("canvas",o),this.updateCanvas()},e.prototype.updateCanvas=function(){if(!this.destroyed&&this.get("refresh")){var t=this.get("graph");if(!t.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var e=this.get("size"),n=this.get("canvas"),r=this.get("type"),i=this.get("padding");if(!n.destroyed){switch(r){case"default":this.updateGraphShapes();break;case"keyShape":this.updateKeyShapes();break;case"delegate":this.updateDelegateShapes()}var o=n.get("children")[0];if(o){o.resetMatrix();var a=o.getCanvasBBox(),s=t.get("canvas").getCanvasBBox(),u=t.getZoom()||1,c=s.width/u,l=s.height/u;Number.isFinite(a.width)&&(c=Qi(a.width,c),l=Qi(a.height,l)),c+=2*i,l+=2*i;var f=Math.min(e[0]/c,e[1]/l),h=[1,0,0,0,1,0,0,0,1],d=0,p=0;Number.isFinite(a.minX)&&(d=-a.minX),Number.isFinite(a.minY)&&(p=-a.minY);var g=(e[0]-(c-2*i)*f)/2,v=(e[1]-(l-2*i)*f)/2;h=$i(h,[["t",d,p],["s",f,f],["t",g,v]]),o.setMatrix(h),this.set("ratio",f),this.set("totaldx",g+d*f),this.set("totaldy",v+p*f),this.set("dx",g),this.set("dy",v),this.updateViewport()}}}}},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t;null===(t=this.get("canvas"))||void 0===t||t.destroy();var e=this.get("container");(null==e?void 0:e.parentNode)&&e.parentNode.removeChild(e)},e}(Gi),to=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function eo(t,e,n){var r=t.x-e.x,i=t.y-e.y;return!n||Math.abs(r)>n||Math.abs(i)>n?Math.sqrt(r*r+i*i):n}function no(t,e){var n=(e.source.y-e.target.y)/(e.source.x-e.target.x),r=(n*n*e.source.x+n*(t.y-e.source.y)+t.x)/(n*n+1);return{x:r,y:n*(r-e.source.x)+e.source.y}}var ro=function(t){function e(e){return t.call(this,e)||this}return to(e,t),e.prototype.getDefaultCfgs=function(){return{edgeBundles:[],edgePoints:[],K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:.6666667,bundleThreshold:.6,eps:1e-6,onLayoutEnd:function(){},onTick:function(){}}},e.prototype.init=function(){var t=this.get("graph"),e=this.get("onTick");this.set("tick",(function(){e&&e(),t.refreshPositions()}))},e.prototype.bundling=function(t){var e=this;if(e.set("data",t),!e.isTicking()){var n=t.edges||[],r=t.nodes||[],i={},o=!1;if(r.forEach((function(t){null!==t.x&&null!==!t.y&&void 0!==t.x&&void 0!==!t.y||(o=!0),i[t.id]=t})),o)throw new Error("please layout the graph or assign x and y for nodes first");e.set("nodeIdMap",i);var a=e.get("divisions"),s=e.get("divRate"),u=e.divideEdges(a);e.set("edgePoints",u);var c=e.getEdgeBundles();e.set("edgeBundles",c);for(var l=e.get("cycles"),f=e.get("iterations"),h=e.get("iterRate"),d=e.get("lambda"),p=0;pl;){var r=l/n,a={x:i[o][e-1].x,y:i[o][e-1].y};a.x+=r*(t.x-i[o][e-1].x),a.y+=r*(t.y-i[o][e-1].y),f.push(a),n-=l,l=c}l-=n}})),f.push({x:u.x,y:u.y}),i[o]=f}})),i},e.prototype.getEdgeLength=function(t){var e=0;return t.forEach((function(n,r){0!==r&&(e+=eo(n,t[r-1]))})),e},e.prototype.getEdgeBundles=function(){var t=this,e=t.get("data").edges||[],n=t.get("bundleThreshold"),r=t.get("nodeIdMap"),i=t.get("edgeBundles");return i||(i=[]),e.forEach((function(t,e){i[e]&&void 0!==i[e]||(i[e]=[])})),e.forEach((function(o,a){var s=r[o.source],u=r[o.target];e.forEach((function(e,o){if(!(o<=a)){var c=r[e.source],l=r[e.target];t.getBundleScore({source:s,target:u},{source:c,target:l})>=n&&(i[a].push(o),i[o].push(a))}}))})),i},e.prototype.getBundleScore=function(t,e){return t.vx=t.target.x-t.source.x,t.vy=t.target.y-t.source.y,e.vx=e.target.x-e.source.x,e.vy=e.target.y-e.source.y,t.length=eo({x:t.source.x,y:t.source.y},{x:t.target.x,y:t.target.y}),e.length=eo({x:e.source.x,y:e.source.y},{x:e.target.x,y:e.target.y}),this.getAngleScore(t,e)*this.getScaleScore(t,e)*this.getPositionScore(t,e)*this.getVisibilityScore(t,e)},e.prototype.getAngleScore=function(t,e){return function(t,e){return t.x*e.x+t.y*e.y}({x:t.vx,y:t.vy},{x:e.vx,y:e.vy})/(t.length*e.length)},e.prototype.getScaleScore=function(t,e){var n=(t.length+e.length)/2;return 2/(n/Math.min(t.length,e.length)+Math.max(t.length,e.length)/n)},e.prototype.getPositionScore=function(t,e){var n=(t.length+e.length)/2;return n/(n+eo({x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2},{x:(e.source.x+e.target.x)/2,y:(e.source.y+e.target.y)/2}))},e.prototype.getVisibilityScore=function(t,e){var n=this.getEdgeVisibility(t,e),r=this.getEdgeVisibility(e,t);return nn||Math.abs(o.y)>n){var s=1/eo(i[r][t],i[e][t]);a.x+=o.x*s,a.y+=o.y*s}})),a},e.prototype.isTicking=function(){return this.get("ticking")},e.prototype.getSimulation=function(){return this.get("forceSimulation")},e.prototype.destroy=function(){this.get("ticking")&&this.getSimulation().stop(),t.prototype.destroy.call(this)},e}(Gi),io=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),oo=function(){return(oo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n(o||n.get("height"))&&e>1||s<(a||.05*n.get("height"))&&e<1)&&(e=1),s*=e,this.set("r",s),this.set("r2",s*s);var u=this.get("d");this.set("molecularParam",(u+1)*s),this.set("delegateCenterDiff",void 0),this.magnify(t,i)}},e.prototype.scaleRByDrag=function(t){if(t){var e,n=this.get("dragPrePos"),r=this.get("graph"),i=r.getPointByClient(t.clientX,t.clientY);e=t.x-n.x<0?.95:1/.95;var o=this.get("maxR"),a=this.get("minR"),s=this.get("r");(s>(o||r.get("height"))&&e>1||s<(a||.05*r.get("height"))&&e<1)&&(e=1),s*=e,this.set("r",s),this.set("r2",s*s);var u=this.get("d");this.set("molecularParam",(u+1)*s),this.magnify(t,i),this.set("dragPrePos",{x:t.x,y:t.y})}},e.prototype.scaleDByWheel=function(t){if(t||t.originalEvent){t.preventDefault&&t.preventDefault();var e=0;e=t.originalEvent.wheelDelta<0?-.1:.1;var n=this.get("d")+e,r=this.get("maxD"),i=this.get("minD");if(ni){this.set("d",n);var o=this.get("r");this.set("molecularParam",(n+1)*o);var a=this.get("delegate"),s=a?{x:a.attr("x"),y:a.attr("y")}:void 0;this.set("delegateCenterDiff",void 0),this.magnify(t,s)}}},e.prototype.scaleDByDrag=function(t){var e=this.get("dragPrePos"),n=t.x-e.x>0?.1:-.1,r=this.get("d")+n,i=this.get("maxD"),o=this.get("minD");if(ro){this.set("d",r);var a=this.get("r");this.set("molecularParam",(r+1)*a),this.magnify(t)}this.set("dragPrePos",{x:t.x,y:t.y})},e.prototype.magnify=function(t,e){this.restoreCache();var n=this.get("graph"),r=this.get("cachedMagnifiedModels"),i=this.get("cachedOriginPositions"),o=this.get("showLabel"),a=this.get("r"),s=this.get("r2"),u=this.get("d"),c=this.get("molecularParam"),l=n.getNodes(),f=l.length,h=e?{x:e.x,y:e.y}:{x:t.x,y:t.y};!this.get("dragging")||"mousemove"!==this.get("trigger")&&"click"!==this.get("trigger")||(h=this.get("cacheCenter"));var d=this.get("delegateCenterDiff");d&&(h.x+=d.x,h.y+=d.y),this.updateDelegate(h,a);for(var p=0;p\n
  • \n \n \n \n
  • \n
  • \n \n \n \n
  • \n
  • \n \n \n \n
  • \n
  • \n \n \n \n
  • \n
  • \n \n \n \n
  • \n
  • \n \n \n \n
  • \n \n '},zoomSensitivity:2}},e.prototype.init=function(){var t=this,e=this.get("graph"),n=this.get("getContent")(e),r=n;Object(v.isString)(n)&&(r=Hr(n));var i=this.get("className");r.setAttribute("class",i||"g6-component-toolbar");var o=this.get("container");o||(o=this.get("graph").get("container")),Object(v.isString)(o)&&(o=document.getElementById(o)),o.appendChild(r),this.set("toolBar",r);var a=this.get("handleClick");r.addEventListener("click",(function(n){var r=function(t){if(!t)return[];if(t.composedPath)return t.composedPath();for(var e=[],n=t.target;n;){if(e.push(n),"HTML"===n.tagName)return e.push(document,window),e;n=n.parentElement}return e}(n).filter((function(t){return"LI"===t.nodeName}));if(0!==r.length){var i=r[0].getAttribute("code");i&&(a?a(i,e):t.handleDefaultOperator(i))}}));var s=this.get("position");s&&qr(r,{top:"".concat(s.y,"px"),left:"".concat(s.x,"px")}),this.bindUndoRedo()},e.prototype.bindUndoRedo=function(){var t=this.get("graph"),e=document.querySelector('.g6-component-toolbar li[code="undo"]'),n=document.querySelector('.g6-component-toolbar li[code="undo"] svg'),r=document.querySelector('.g6-component-toolbar li[code="redo"]'),i=document.querySelector('.g6-component-toolbar li[code="redo"] svg');e&&n&&r&&i&&(e.setAttribute("style","cursor: not-allowed"),n.setAttribute("style","opacity: 0.4"),r.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4"),t.on("stackchange",(function(t){var o=t.undoStack,a=t.redoStack,s=o.length,u=a.length;0===s?(e.setAttribute("style","cursor: not-allowed"),n.setAttribute("style","opacity: 0.4")):(e.removeAttribute("style"),n.removeAttribute("style")),0===u?(r.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4")):(r.removeAttribute("style"),i.removeAttribute("style"))})))},e.prototype.undo=function(){var t=this.get("graph"),e=t.getUndoStack();if(e&&0!==e.length){var n=e.pop();if(n){var r=n.action;t.pushStack(r,Object(v.clone)(n.data),"redo");var i=n.data.before;if("add"===r&&(i=n.data.after),!i)return;switch(r){case"visible":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=t.findById(e.id);e.visible?t.showItem(n,!1):t.hideItem(n,!1)}))}));break;case"render":case"update":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=t.findById(e.id);delete e.id,t.updateItem(n,e,!1),"combo"===n.getType()&&t.updateCombo(n)}))}));break;case"changedata":t.changeData(i,!1);break;case"delete":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=e.itemType;delete e.itemType,t.addItem(n,e,!1)}))}));break;case"add":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.removeItem(e.id,!1)}))}));break;case"updateComboTree":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.updateComboTree(e.id,e.parentId,!1)}))}));break;case"createCombo":var o=n.data.after.combos,a=o[o.length-1];Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.updateComboTree(e.id,e.parentId,!1)}))})),t.removeItem(a.id,!1);break;case"uncombo":var s=i.combos[i.combos.length-1],u=i.nodes.concat(i.combos).map((function(t){return t.id})).filter((function(t){return t!==s.id}));t.createCombo(s,u,!1);break;case"layout":t.updateLayout(i,void 0,void 0,!1)}}}},e.prototype.redo=function(){var t=this.get("graph"),e=t.getRedoStack();if(e&&0!==e.length){var n=e.pop();if(n){var r=n.action,i=n.data.after;if(t.pushStack(r,Object(v.clone)(n.data)),"delete"===r&&(i=n.data.before),!i)return;switch(r){case"visible":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=t.findById(e.id);e.visible?t.showItem(n,!1):t.hideItem(n,!1)}))}));break;case"render":case"update":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=t.findById(e.id);delete e.id,t.updateItem(n,e,!1),"combo"===n.getType()&&t.updateCombo(n)}))}));break;case"changedata":t.changeData(i,!1);break;case"delete":i.edges&&i.edges.forEach((function(e){t.removeItem(e.id,!1)})),i.nodes&&i.nodes.forEach((function(e){t.removeItem(e.id,!1)})),i.combos&&i.combos.forEach((function(e){t.removeItem(e.id,!1)}));break;case"add":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){var n=e.itemType;delete e.itemType,t.addItem(n,e,!1)}))}));break;case"updateComboTree":Object.keys(i).forEach((function(e){var n=i[e];n&&n.forEach((function(e){t.updateComboTree(e.id,e.parentId,!1)}))}));break;case"createCombo":var o=i.combos[i.combos.length-1];t.createCombo(o,o.children.map((function(t){return t.id})),!1);break;case"uncombo":var a=n.data.before.combos,s=a[a.length-1];t.uncombo(s.id,!1);break;case"layout":t.updateLayout(i,void 0,void 0,!1)}}}},e.prototype.zoomOut=function(){var t=this.get("graph"),e=t.getZoom(),n=1/(1-.05*this.get("zoomSensitivity"));n*e>(this.get("maxZoom")||t.get("maxZoom"))||t.zoomTo(e*n)},e.prototype.zoomIn=function(){var t=this.get("graph"),e=t.getZoom(),n=1-.05*this.get("zoomSensitivity");n*e<(this.get("minZoom")||t.get("minZoom"))||t.zoomTo(e*n)},e.prototype.realZoom=function(){this.get("graph").zoomTo(1)},e.prototype.autoZoom=function(){this.get("graph").fitView([20,20])},e.prototype.handleDefaultOperator=function(t){switch(t){case"redo":this.redo();break;case"undo":this.undo();break;case"zoomOut":this.zoomOut();break;case"zoomIn":this.zoomIn();break;case"realZoom":this.realZoom();break;case"autoZoom":this.autoZoom()}},e.prototype.destroy=function(){var t=this.get("toolBar");if(t){var e=this.get("container");e||(e=this.get("graph").get("container")),Object(v.isString)(e)&&(e=document.getElementById(e)),e.removeChild(t)}var n=this.get("handleClick");n&&t.removeEventListener("click",n)},e}(Gi),lo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();"undefined"!=typeof document&&Vi()("\n .g6-component-tooltip {\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n background-color: rgba(255, 255, 255, 0.9);\n padding: 10px 8px;\n box-shadow: rgb(174, 174, 174) 0px 0px 10px;\n }\n .tooltip-type {\n padding: 0;\n margin: 0;\n }\n .tooltip-id {\n color: #531dab;\n }\n");var fo=function(t){function e(e){return t.call(this,e)||this}return lo(e,t),e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,getContent:function(t){return"\n

    绫诲瀷锛�".concat(t.item.getType(),"

    \n ID锛�").concat(t.item.getID(),"\n ")},shouldBegin:function(t){return!0},itemTypes:["node","edge","combo"],trigger:"mouseenter",fixToNode:void 0}},e.prototype.getEvents=function(){return"click"===this.get("trigger")?{"node:click":"onClick","edge:click":"onClick","combo:click":"onClick","canvas:click":"onMouseLeave",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave",drag:"onMouseLeave"}:{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove","edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove","combo:mouseenter":"onMouseEnter","combo:mouseleave":"onMouseLeave","combo:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave","node:drag":"onMouseLeave"}},e.prototype.init=function(){var t=this,e=t.get("className")||"g6-component-tooltip",n=Hr("
    ")),r=t.get("container");r||(r=t.get("graph").get("container")),Object(v.isString)(r)&&(r=document.getElementById(r)),qr(n,{position:"absolute",visibility:"hidden",display:"none"}),r.appendChild(n),"click"!==t.get("trigger")&&(n.addEventListener("mouseenter",(function(t){qr(n,{visibility:"visible",display:"unset"})})),n.addEventListener("mouseleave",(function(e){t.hideTooltip()}))),t.set("tooltip",n)},e.prototype.onClick=function(t){var e=this.get("itemTypes");if(!t.item||!t.item.getType||-1!==e.indexOf(t.item.getType())){var n=t.item,r=this.get("graph");this.currentTarget===n?(this.currentTarget=null,this.hideTooltip(),r.emit("tooltipchange",{item:t.item,action:"hide"})):(this.currentTarget=n,this.showTooltip(t),r.emit("tooltipchange",{item:t.item,action:"show"}))}},e.prototype.onMouseEnter=function(t){var e=this.get("itemTypes");if(!t.item||!t.item.getType||-1!==e.indexOf(t.item.getType())){var n=t.item,r=this.get("graph");this.currentTarget=n,this.showTooltip(t),r.emit("tooltipchange",{item:t.item,action:"show"})}},e.prototype.onMouseMove=function(t){var e=this.get("itemTypes");t.item&&t.item.getType&&-1===e.indexOf(t.item.getType())||this.currentTarget&&t.item===this.currentTarget&&this.showTooltip(t)},e.prototype.onMouseLeave=function(){this.hideTooltip(),this.get("graph").emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null},e.prototype.clearContainer=function(){var t=this.get("tooltip");t&&(t.innerHTML="")},e.prototype.showTooltip=function(t){if(t.item){var e=this.get("itemTypes");if(!t.item.getType||-1!==e.indexOf(t.item.getType())){var n=this.get("tooltip"),r=this.get("getContent")(t);Object(v.isString)(r)?n.innerHTML=r:(this.clearContainer(),n.appendChild(r)),this.updatePosition(t)}}},e.prototype.hideTooltip=function(){var t=this.get("tooltip");t&&qr(t,{visibility:"hidden",display:"none"})},e.prototype.updatePosition=function(t){var e=this.get("shouldBegin"),n=this.get("tooltip");if(e(t)){var r=this.get("graph"),i=r.get("width"),o=r.get("height"),a=this.get("offsetX")||0,s=this.get("offsetY")||0,u=r.getPointByClient(t.clientX,t.clientY),c=this.get("fixToNode"),l=t.item;if(l.getType&&"node"===l.getType()&&c&&Object(v.isArray)(c)&&c.length>=2){var f=l.getBBox();u={x:f.minX+f.width*c[0],y:f.minY+f.height*c[1]}}var h=r.getCanvasByPoint(u.x,u.y),d=h.x,p=h.y,g=r.getContainer(),y={x:d+g.offsetLeft+a,y:p+g.offsetTop+s};qr(n,{visibility:"visible",display:"unset"});var m=n.getBoundingClientRect();d+m.width+a>i&&(y.x-=m.width+a),p+m.height+s>o&&(y.y-=m.height+s,y.y<0&&(y.y=0)),qr(n,{left:"".concat(y.x,"px"),top:"".concat(y.y,"px")})}else qr(n,{visibility:"hidden",display:"none"})},e.prototype.hide=function(){this.onMouseLeave()},e.prototype.destroy=function(){var t=this.get("tooltip");if(t){var e=this.get("container");e||(e=this.get("graph").get("container")),Object(v.isString)(e)&&(e=document.getElementById(e)),e.removeChild(t)}},e}(Gi),ho=function(){function t(t){var e=t.x,n=void 0===e?0:e,r=t.y,i=void 0===r?0:r,o=t.container,a=t.text,s=t.padding,u=void 0===s?[4,4,4,4]:s,c=t.className,l=void 0===c?"g6-component-timebar-tooltip":c,f=t.backgroundColor,h=void 0===f?"#000":f,d=t.textColor,p=void 0===d?"#fff":d,g=t.opacity,v=void 0===g?.8:g,y=t.fontSize,m=void 0===y?12:y;this.container=o,this.className=l,this.backgroundColor=h,this.textColor=p,this.x=n,this.y=i,this.text=a,this.padding=u,this.opacity=v,this.fontSize=m,this.render()}return t.prototype.render=function(){var t=this.className,e=(this.x,this.y,this.backgroundColor),n=this.textColor,r=this.text,i=this.padding,o=this.opacity,a=this.fontSize,s=this.container,u=Hr("
    '));Object(v.isString)(s)&&(s=document.getElementById(s)),s.appendChild(u),this.parentHeight=s.offsetHeight,this.parentWidth=s.offsetWidth,qr(u,{visibility:"hidden",top:0,left:0});var c=Hr("\n
    "));c.innerHTML=r,u.appendChild(c),this.backgroundDOM=c;var l=Hr("
    "));u.appendChild(l),this.arrowDOM=l,this.container=u},t.prototype.show=function(t){var e=t.text,n=t.x;t.y,t.clientX,t.clientY;this.backgroundDOM.innerHTML=e;var r=this.backgroundDOM.offsetWidth,i=this.backgroundDOM.offsetHeight,o=this.arrowDOM.offsetWidth,a=this.arrowDOM.offsetHeight;qr(this.container,{top:"".concat(-i-a,"px"),left:"".concat(n,"px"),visibility:"visible"}),qr(this.backgroundDOM,{marginLeft:"".concat(-r/2,"px")}),qr(this.arrowDOM,{marginLeft:"".concat(-o/2,"px"),top:"".concat(i,"px")});var s=n-r/2,u=n+r/2;s<0?qr(this.backgroundDOM,{marginLeft:"".concat(-r/2-s,"px")}):u>this.parentWidth&&qr(this.backgroundDOM,{marginLeft:"".concat(-r/2-u+this.parentWidth+12,"px")})},t.prototype.hide=function(){qr(this.container,{top:0,left:0,visibility:"hidden"})},t}(),po=function(){return(po=Object.assign||function(t){for(var e,n=1,r=arguments.length;nn&&(o=n,i=e)}))}i=e.originalEvent.deltaY>0?Math.max(0,i-1):Math.min(t.speedAxisY.length-1,i+1);var a=t.speedAxisY[i]-r;n=yo(n,[["t",0,a]]),t.speedPoint.setMatrix(n),t.currentSpeed=t.speedAxisY.length-i,t.speedText.attr("text","".concat(t.currentSpeed,".0X")),t.group.emit("timebarConfigChanged",{speed:t.currentSpeed,type:t.currentType})})),this.toggleGroup&&this.toggleGroup.on("toggle-model:click",(function(e){var n,r,i=e.target.get("isChecked");i?(t.checkedIcon.hide(),t.checkedText.attr("text",(null===(r=t.controllerCfg)||void 0===r?void 0:r.timePointControllerText)||"鍗曚竴鏃堕棿"),t.currentType=Mo):(t.checkedIcon.show(),t.checkedText.attr("text",(null===(n=t.controllerCfg)||void 0===n?void 0:n.timeRangeControllerText)||"鏃堕棿鑼冨洿"),t.currentType=So),e.target.set("isChecked",!i),t.group.emit("timebarConfigChanged",{type:t.currentType,speed:t.currentSpeed})}))},t.prototype.destroy=function(){this.speedGroup.off("speed-rect:click"),this.toggleGroup&&(this.toggleGroup.off("toggle-model:click"),this.toggleGroup.destroy()),this.speedGroup.destroy()},t}(),ko=function(){return(ko=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=x&&r<=w?c:l,a=y.addShape("rect",{attrs:ko({x:i+r*(g+2),y:i,width:g,height:d},o),draggable:!0,name:"tick-rect-".concat(r)}),s=y.addShape("rect",{attrs:{x:i+r*g+2*(2*r-1)/2,y:i,width:0===r||r===p-1?g+1:g+2,height:d,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-".concat(r)});s.toFront();var h,E=a.getBBox(),S=(E.minX+E.maxX)/2;if(m.push({rect:a,pickRect:s,value:e.date,x:S,y:E.minY}),u?(h=u(e),!Object(v.isString)(h)&&h&&(h=e.date)):r%Math.round(p/10)==0&&(h=e.date),h){b.push(h);var M=E.maxY+2*i;y.addShape("line",{attrs:{stroke:"#BFBFBF",x1:S,y1:M,x2:S,y2:M+4},name:"tick-line"});var O=M+4+i,k=y.addShape("text",{attrs:ko({fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:S,y:O,textAlign:"center",text:h,textBaseline:"top",fontSize:10,fontFamily:t.fontFamily||"Arial, sans-serif"},f),capture:!1,name:"tick-label"}),A=k.getBBox();if(A.maxX>n?k.attr("textAlign","right"):A.minX<0&&k.attr("textAlign","left"),Object(v.isNumber)(_)&&10!==b.length){var C=Ao([1,0,0,0,1,0,0,0,1],[["t",-S,-O],["r",_],["t",S-5,O+2]]);k.attr({textAlign:"left",matrix:C})}1===b.length?k.attr({textAlign:"left"}):10===b.length&&k.attr({textAlign:"right"})}})),this.tickRects=m;var E=this.group;this.currentSpeed=1,this.controllerBtnGroup=new Oo(ko({group:E,x:this.x,y:this.y+r+5,width:n,height:40,hideTimeTypeController:!0,speed:this.currentSpeed,fontFamily:this.fontFamily||"Arial, sans-serif"},this.controllerCfg))},t.prototype.initEvent=function(){var t=this,e=this.sliceGroup;e.on("click",(function(e){var n=e.target;if("rect"===n.get("type")&&n.get("name")){var r=parseInt(n.get("name").split("-")[2],10);if(!isNaN(r)){var i=t.tickRects,o=t.unselectedTickStyle;i.forEach((function(t){t.rect.attr(o)}));var a=t.selectedTickStyle;i[r].rect.attr(a),t.startTickRectId=r,t.endTickRectId=r;var s=r/i.length;t.graph.emit("valuechange",{value:[s,s]})}}})),e.on("dragstart",(function(e){var n=t.tickRects,r=t.unselectedTickStyle;n.forEach((function(t){t.rect.attr(r)}));var i=e.target,o=parseInt(i.get("name").split("-")[2],10),a=t.selectedTickStyle;n[o].rect.attr(a),t.startTickRectId=o;var s=o/n.length;t.graph.emit("valuechange",{value:[s,s]}),t.dragging=!0})),e.on("dragover",(function(e){if(t.dragging&&"rect"===e.target.get("type")){for(var n=parseInt(e.target.get("name").split("-")[2],10),r=t.startTickRectId,i=t.tickRects,o=t.selectedTickStyle,a=t.unselectedTickStyle,s=0;s=r&&s<=n?o:a;i[s].rect.attr(u)}var c=i.length;t.endTickRectId=n;var l=r/c,f=n/c;t.graph.emit("valuechange",{value:[l,f]})}})),e.on("drop",(function(e){if(t.dragging&&(t.dragging=!1,"rect"===e.target.get("type"))){var n=t.startTickRectId,r=parseInt(e.target.get("name").split("-")[2],10);if(!(r0?this.endTickRectId++:(e[this.endTickRectId].rect.attr(r),this.endTickRectId--),o!==this.startTickRectId)this.endTickRectIdthis.max?NaN:this.values[r]},e.prototype.getText=function(e){for(var n=[],r=1;r1?t-1:t}this.translateIndexMap&&(this.translateIndexMap=void 0)},e}(Po),Lo=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,Ro="[^\\s]+",Bo=/\[([^]*?)\]/gm;function Fo(t,e){for(var n=[],r=0,i=t.length;r-1?r:null}};function Go(t){for(var e=[],n=1;n3?0:(t-t%10!=10?1:0)*t%10]}},Vo=Go({},Wo),Ho=function(t){return Vo=Go(Vo,t)},qo=function(t){return t.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},Zo=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length0?"-":"+")+Zo(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)},Z:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+Zo(Math.floor(Math.abs(e)/60),2)+":"+Zo(Math.abs(e)%60,2)}},Qo=function(t){return+t-1},$o=[null,"\\d\\d?"],Jo=[null,Ro],ta=["isPm",Ro,function(t,e){var n=t.toLowerCase();return n===e.amPm[0]?0:n===e.amPm[1]?1:null}],ea=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(t){var e=(t+"").match(/([+-]|\d\d)/gi);if(e){var n=60*+e[1]+parseInt(e[2],10);return"+"===e[0]?n:-n}return 0}],na={D:["day","\\d\\d?"],DD:["day","\\d\\d"],Do:["day","\\d\\d?"+Ro,function(t){return parseInt(t,10)}],M:["month","\\d\\d?",Qo],MM:["month","\\d\\d",Qo],YY:["year","\\d\\d",function(t){var e=+(""+(new Date).getFullYear()).substr(0,2);return+(""+(+t>68?e-1:e)+t)}],h:["hour","\\d\\d?",void 0,"isPm"],hh:["hour","\\d\\d",void 0,"isPm"],H:["hour","\\d\\d?"],HH:["hour","\\d\\d"],m:["minute","\\d\\d?"],mm:["minute","\\d\\d"],s:["second","\\d\\d?"],ss:["second","\\d\\d"],YYYY:["year","\\d{4}"],S:["millisecond","\\d",function(t){return 100*+t}],SS:["millisecond","\\d\\d",function(t){return 10*+t}],SSS:["millisecond","\\d{3}"],d:$o,dd:$o,ddd:Jo,dddd:Jo,MMM:["month",Ro,zo("monthNamesShort")],MMMM:["month",Ro,zo("monthNames")],a:ta,A:ta,ZZ:ea,Z:ea},ra={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},ia=function(t){return Go(ra,t)},oa=function(t,e,n){if(void 0===e&&(e=ra.default),void 0===n&&(n={}),"number"==typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date pass to format");var r=[];e=(e=ra[e]||e).replace(Bo,(function(t,e){return r.push(e),"@@@"}));var i=Go(Go({},Vo),n);return(e=e.replace(Lo,(function(e){return Ko[e](t,i)}))).replace(/@@@/g,(function(){return r.shift()}))};function aa(t,e,n){if(void 0===n&&(n={}),"string"!=typeof e)throw new Error("Invalid format in fecha parse");if(e=ra[e]||e,t.length>1e3)return null;var r={year:(new Date).getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},i=[],o=[],a=e.replace(Bo,(function(t,e){return o.push(qo(e)),"@@@"})),s={},u={};a=qo(a).replace(Lo,(function(t){var e=na[t],n=e[0],r=e[1],o=e[3];if(s[n])throw new Error("Invalid format. "+n+" specified twice in format");return s[n]=!0,o&&(u[o]=!0),i.push(e),"("+r+")"})),Object.keys(u).forEach((function(t){if(!s[t])throw new Error("Invalid format. "+t+" is required in specified format")})),a=a.replace(/@@@/g,(function(){return o.shift()}));var c=t.match(new RegExp(a,"i"));if(!c)return null;for(var l,f=Go(Go({},Vo),n),h=1;h11||r.month<0||r.day>31||r.day<1||r.hour>23||r.hour<0||r.minute>59||r.minute<0||r.second>59||r.second<0)return null;return l}var sa={format:oa,parse:aa,defaultI18n:Wo,setGlobalDateI18n:Ho,setGlobalDateMasks:ia};function ua(t,e){return(p.format||sa.format)(t,e)}function ca(t){return Object(v.isString)(t)&&(t=t.indexOf("T")>0?new Date(t).getTime():new Date(t.replace(/-/gi,"/")).getTime()),Object(v.isDate)(t)&&(t=t.getTime()),t}var la=36e5,fa=24*la,ha=31*fa,da=[["HH:mm:ss",1e3],["HH:mm:ss",1e4],["HH:mm:ss",3e4],["HH:mm",6e4],["HH:mm",6e5],["HH:mm",18e5],["HH",la],["HH",6*la],["HH",12*la],["YYYY-MM-DD",fa],["YYYY-MM-DD",4*fa],["YYYY-WW",7*fa],["YYYY-MM",ha],["YYYY-MM",4*ha],["YYYY-MM",6*ha],["YYYY",380*fa]];function pa(t,e,n){var r,i=(r=function(t){return t[1]},function(t,e,n,i){for(var o=Object(v.isNil)(n)?0:n,a=Object(v.isNil)(i)?t.length:i;o>>1;r(t[s])>e?a=s:o=s+1}return o})(da,(e-t)/n)-1,o=da[i];return i<0?o=da[0]:i>=da.length&&(o=Object(v.last)(da)),o}var ga=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="timeCat",e}return Object(g.__extends)(e,t),e.prototype.translate=function(t){t=ca(t);var e=this.values.indexOf(t);return-1===e&&(e=Object(v.isNumber)(t)&&t-1){var r=this.values[n],i=this.formatter;return r=i?i(r,e):ua(r,this.mask)}return t},e.prototype.initCfg=function(){this.tickMethod="time-cat",this.mask="YYYY-MM-DD",this.tickCount=7},e.prototype.setDomain=function(){var e=this.values;Object(v.each)(e,(function(t,n){e[n]=ca(t)})),e.sort((function(t,e){return t-e})),t.prototype.setDomain.call(this)},e}(Do),va=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isContinuous=!0,e}return Object(g.__extends)(e,t),e.prototype.scale=function(t){if(Object(v.isNil)(t))return NaN;var e=this.rangeMin(),n=this.rangeMax();return this.max===this.min?e:e+this.getScalePercent(t)*(n-e)},e.prototype.init=function(){t.prototype.init.call(this);var e=this.ticks,n=Object(v.head)(e),r=Object(v.last)(e);nthis.max&&(this.max=r),Object(v.isNil)(this.minLimit)||(this.min=n),Object(v.isNil)(this.maxLimit)||(this.max=r)},e.prototype.setDomain=function(){var t=Object(v.getRange)(this.values),e=t.min,n=t.max;Object(v.isNil)(this.min)&&(this.min=e),Object(v.isNil)(this.max)&&(this.max=n),this.min>this.max&&(this.min=e,this.max=n)},e.prototype.calculateTicks=function(){var e=this,n=t.prototype.calculateTicks.call(this);return this.nice||(n=Object(v.filter)(n,(function(t){return t>=e.min&&t<=e.max}))),n},e.prototype.getScalePercent=function(t){var e=this.max,n=this.min;return(t-n)/(e-n)},e.prototype.getInvertPercent=function(t){return(t-this.rangeMin())/(this.rangeMax()-this.rangeMin())},e}(Po),ya=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="linear",e.isLinear=!0,e}return Object(g.__extends)(e,t),e.prototype.invert=function(t){var e=this.getInvertPercent(t);return this.min+e*(this.max-this.min)},e.prototype.initCfg=function(){this.tickMethod="wilkinson-extended",this.nice=!1},e}(va);function ma(t,e){var n=Math.E;return e>=0?Math.pow(n,Math.log(e)/t):-1*Math.pow(n,Math.log(-e)/t)}function ba(t,e){return 1===t?1:Math.log(e)/Math.log(t)}function xa(t,e,n){Object(v.isNil)(n)&&(n=Math.max.apply(null,t));var r=n;return Object(v.each)(t,(function(t){t>0&&t1&&(r=1),r}var wa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e}return Object(g.__extends)(e,t),e.prototype.invert=function(t){var e,n=this.base,r=ba(n,this.max),i=this.rangeMin(),o=this.rangeMax()-i,a=this.positiveMin;if(a){if(0===t)return 0;var s=1/(r-(e=ba(n,a/n)))*o;if(t=0?1:-1;return Math.pow(o,n)*a},e.prototype.initCfg=function(){this.tickMethod="pow",this.exponent=2,this.tickCount=5,this.nice=!0},e.prototype.getScalePercent=function(t){var e=this.max,n=this.min;if(e===n)return 0;var r=this.exponent;return(ma(r,t)-ma(r,n))/(ma(r,e)-ma(r,n))},e}(va),Ea=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="time",e}return Object(g.__extends)(e,t),e.prototype.getText=function(t,e){var n=this.translate(t),r=this.formatter;return r?r(n,e):ua(n,this.mask)},e.prototype.scale=function(e){var n=e;return(Object(v.isString)(n)||Object(v.isDate)(n))&&(n=this.translate(n)),t.prototype.scale.call(this,n)},e.prototype.translate=function(t){return ca(t)},e.prototype.initCfg=function(){this.tickMethod="time-pretty",this.mask="YYYY-MM-DD",this.tickCount=7,this.nice=!1},e.prototype.setDomain=function(){var t=this.values,e=this.getConfig("min"),n=this.getConfig("max");if(Object(v.isNil)(e)&&Object(v.isNumber)(e)||(this.min=this.translate(this.min)),Object(v.isNil)(n)&&Object(v.isNumber)(n)||(this.max=this.translate(this.max)),t&&t.length){var r=[],i=1/0,o=i,a=0;Object(v.each)(t,(function(t){var e=ca(t);if(isNaN(e))throw new TypeError("Invalid Time: "+t+" in time scale!");i>e?(o=i,i=e):o>e&&(o=e),a1&&(this.minTickInterval=o-i),Object(v.isNil)(e)&&(this.min=i),Object(v.isNil)(n)&&(this.max=a)}},e}(ya),Sa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="quantize",e}return Object(g.__extends)(e,t),e.prototype.invert=function(t){var e=this.ticks,n=e.length,r=this.getInvertPercent(t),i=Math.floor(r*(n-1));if(i>=n-1)return Object(v.last)(e);if(i<0)return Object(v.head)(e);var o=e[i],a=i/(n-1);return o+(r-a)/((i+1)/(n-1)-a)*(e[i+1]-o)},e.prototype.initCfg=function(){this.tickMethod="r-pretty",this.tickCount=5,this.nice=!0},e.prototype.calculateTicks=function(){var e=t.prototype.calculateTicks.call(this);return this.nice||(Object(v.last)(e)!==this.max&&e.push(this.max),Object(v.head)(e)!==this.min&&e.unshift(this.min)),e},e.prototype.getScalePercent=function(t){var e=this.ticks;if(tObject(v.last)(e))return 1;var n=0;return Object(v.each)(e,(function(e,r){if(!(t>=e))return!1;n=r})),n/(e.length-1)},e}(va),Ma=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="quantile",e}return Object(g.__extends)(e,t),e.prototype.initCfg=function(){this.tickMethod="quantile",this.tickCount=5,this.nice=!0},e}(Sa),Oa={};function ka(t,e){if(function(t){return Oa[t]}(t))throw new Error("type '"+t+"' existed.");Oa[t]=e}var Aa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="identity",e.isIdentity=!0,e}return Object(g.__extends)(e,t),e.prototype.calculateTicks=function(){return this.values},e.prototype.scale=function(t){return this.values[0]!==t&&Object(v.isNumber)(t)?t:this.range[0]},e.prototype.invert=function(t){var e=this.range;return te[1]?NaN:this.values[0]},e}(Po);function Ca(t){var e=t.values,n=t.tickInterval,r=t.tickCount,i=t.showLast;if(Object(v.isNumber)(n)){var o=Object(v.filter)(e,(function(t,e){return e%n==0})),a=Object(v.last)(e);return i&&Object(v.last)(o)!==a&&o.push(a),o}var s=e.length,u=t.min,c=t.max;if(Object(v.isNil)(u)&&(u=0),Object(v.isNil)(c)&&(c=e.length-1),!Object(v.isNumber)(r)||r>=s)return e.slice(u,c+1);if(r<=0||c<=0)return[];for(var l=1===r?s:Math.floor(s/(r-1)),f=[],h=u,d=0;d=c);d++)h=Math.min(u+d*l,c),d===r-1&&i?f.push(e[c]):f.push(e[h]);return f}var ja=Math.sqrt(50),Ia=Math.sqrt(10),Ta=Math.sqrt(2),Na=function(){function t(){this._domain=[0,1]}return t.prototype.domain=function(t){return t?(this._domain=Array.from(t,Number),this):this._domain.slice()},t.prototype.nice=function(t){var e,n;void 0===t&&(t=5);var r,i=this._domain.slice(),o=0,a=this._domain.length-1,s=this._domain[o],u=this._domain[a];return u0?r=Pa(s=Math.floor(s/r)*r,u=Math.ceil(u/r)*r,t):r<0&&(r=Pa(s=Math.ceil(s*r)/r,u=Math.floor(u*r)/r,t)),r>0?(i[o]=Math.floor(s/r)*r,i[a]=Math.ceil(u/r)*r,this.domain(i)):r<0&&(i[o]=Math.ceil(s*r)/r,i[a]=Math.floor(u*r)/r,this.domain(i)),this},t.prototype.ticks=function(t){return void 0===t&&(t=5),function(t,e,n){var r,i,o,a,s=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];(r=e0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(i=Math.ceil(e-t+1));++s=0?(o>=ja?10:o>=Ia?5:o>=Ta?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=ja?10:o>=Ia?5:o>=Ta?2:1)}function Da(t,e,n){return("ceil"===n?Math.ceil(t/e):"floor"===n?Math.floor(t/e):Math.round(t/e))*e}function La(t,e,n){var r=Da(t,n,"floor"),i=Da(e,n,"ceil");r=Object(v.fixedBase)(r,n),i=Object(v.fixedBase)(i,n);for(var o=[],a=Math.max((i-r)/(Math.pow(2,12)-1),n),s=r;s<=i;s+=a){var u=Object(v.fixedBase)(s,a);o.push(u)}return{min:r,max:i,ticks:o}}function Ra(t,e,n){var r,i=t.minLimit,o=t.maxLimit,a=t.min,s=t.max,u=t.tickCount,c=void 0===u?5:u,l=Object(v.isNil)(i)?Object(v.isNil)(e)?a:e:i,f=Object(v.isNil)(o)?Object(v.isNil)(n)?s:n:o;if(l>f&&(f=(r=[l,f])[0],l=r[1]),c<=2)return[l,f];for(var h=(f-l)/(c-1),d=[],p=0;p=0&&(u=1),1-s/(a-1)-n+u}function Ya(t,e,n){var r=Object(v.size)(e);return 1-Object(v.indexOf)(e,t)/(r-1)-n+1}function Ua(t,e,n,r,i,o){var a=(t-1)/(o-i),s=(e-1)/(Math.max(o,r)-Math.min(n,i));return 2-Math.max(a/s,s/a)}function Xa(t,e){return t>=e?2-(t-1)/(e-1):1}function Wa(t,e,n,r){var i=e-t;return 1-.5*(Math.pow(e-r,2)+Math.pow(t-n,2))/Math.pow(.1*i,2)}function Va(t,e,n){var r=e-t;if(n>r){var i=(n-r)/2;return 1-Math.pow(i,2)/Math.pow(.1*r,2)}return 1}function Ha(t,e,n,r,i,o){void 0===n&&(n=5),void 0===r&&(r=!0),void 0===i&&(i=Fa),void 0===o&&(o=[.25,.2,.5,.05]);var a=n<0?0:Math.round(n);if(Number.isNaN(t)||Number.isNaN(e)||"number"!=typeof t||"number"!=typeof e||!a)return{min:0,max:0,ticks:[]};if(e-t<1e-15||1===a)return{min:t,max:e,ticks:[t]};if(e-t>1e148){var s=(e-t)/(_=n||5);return{min:t,max:e,ticks:Array(_).fill(null).map((function(e,n){return Ba(t+s*n)}))}}for(var u={score:-2,lmin:0,lmax:0,lstep:0},c=1;c<1/0;){for(var l=0;lu.score&&(!r||S<=t&&M>=e)&&(u.lmin=S,u.lmax=M,u.lstep=O,u.score=j)}y+=1}d+=1}}c+=1}var I=Ba(u.lmax),T=Ba(u.lmin),N=Ba(u.lstep),P=Math.floor(function(t){return Math.round(1e12*t)/1e12}((I-T)/N))+1,D=new Array(P);D[0]=Ba(T);for(l=1;l1&&(i*=Math.ceil(a)),r&&i31536e6)for(var u=Ka(n),c=Math.ceil(o/31536e6),l=s;l<=u+c;l+=c)a.push(Qa(l));else if(o>ha){var f=Math.ceil(o/ha),h=$a(e),d=function(t,e){var n=Ka(t),r=Ka(e),i=$a(t);return 12*(r-n)+($a(e)-i)%12}(e,n);for(l=0;l<=d+f;l+=f)a.push(Ja(s,l+h))}else if(o>fa){var p=(b=new Date(e)).getFullYear(),g=b.getMonth(),v=b.getDate(),y=Math.ceil(o/fa),m=function(t,e){return Math.ceil((e-t)/fa)}(e,n);for(l=0;lla){p=(b=new Date(e)).getFullYear(),g=b.getMonth(),y=b.getDate();var b,x=b.getHours(),w=Math.ceil(o/la),_=function(t,e){return Math.ceil((e-t)/la)}(e,n);for(l=0;l<=_+w;l+=w)a.push(new Date(p,g,y,x+l).getTime())}else if(o>6e4){var E=function(t,e){return Math.ceil((e-t)/6e4)}(e,n),S=Math.ceil(o/6e4);for(l=0;l<=E+S;l+=S)a.push(e+6e4*l)}else{var M=o;M<1e3&&(M=1e3);var O=1e3*Math.floor(e/1e3),k=Math.ceil((n-e)/1e3),A=Math.ceil(M/1e3);for(l=0;l=512&&console.warn("Notice: current ticks length("+a.length+') >= 512, may cause performance issues, even out of memory. Because of the configure "tickInterval"(in milliseconds, current is '+o+") is too small, increase the value to solve the problem!"),a})),No("log",(function(t){var e,n=t.base,r=t.tickCount,i=t.min,o=t.max,a=t.values,s=ba(n,o);if(i>0)e=Math.floor(ba(n,i));else{var u=xa(a,n,o);e=Math.floor(ba(n,u))}for(var c=s-e,l=Math.ceil(c/r),f=[],h=e;h=0?1:-1;return Math.pow(t,e)*n}))})),No("quantile",(function(t){var e=t.tickCount,n=t.values;if(!n||!n.length)return[];for(var r=n.slice().sort((function(t,e){return t-e})),i=[],o=0;od?(s.show(),c.show(),d=l.minX+l.width+10):(s.hide(),c.hide()),s})),this.controllerBtnGroup=new Oo(ps({group:this.group,x:this.x,y:this.y+n+25,width:e,height:35},this.controllerCfg)),this.updateStartEnd(0),this.updateUI(),o.move(this.x,this.y),this.bindEvents(),this.currentMode===So&&(this.minHandlerShape.hide(),this.foregroundShape.hide(),this.minTextShape.hide())},t.prototype.bindEvents=function(){var t=this,e=this.group.find((function(t){return"minHandlerShape"===t.get("name")}));e&&(e.on("minHandlerShape-handler:mousedown",this.onMouseDown(this.minHandlerShape)),e.on("minHandlerShape-handler:touchstart",this.onMouseDown(this.minHandlerShape)));var n=this.group.find((function(t){return"maxHandlerShape"===t.get("name")}));n&&(n.on("maxHandlerShape-handler:mousedown",this.onMouseDown(this.maxHandlerShape)),n.on("maxHandlerShape-handler:touchstart",this.onMouseDown(this.maxHandlerShape))),this.foregroundShape.on("mousedown",this.onMouseDown(this.foregroundShape)),this.foregroundShape.on("touchstart",this.onMouseDown(this.foregroundShape)),this.group.on("".concat("playPauseBtn",":click"),(function(){t.isPlay=!t.isPlay,t.currentHandler=t.maxHandlerShape,t.changePlayStatus()})),this.group.on("".concat("nextStepBtn",":click"),(function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(.01),t.updateUI()})),this.group.on("".concat("preStepBtn",":click"),(function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(-.01),t.updateUI()})),this.group.on("timebarConfigChanged",(function(e){var n=e.type,r=e.speed;t.currentSpeed=r,t.currentMode=n,n===So?(t.minHandlerShape.hide(),t.foregroundShape.hide(),t.minTextShape.hide()):n===Mo&&(t.minHandlerShape.show(),t.foregroundShape.show(),t.minTextShape.show())}))},t.prototype.adjustTickIndex=function(t){for(var e=0;e1&&(this.start=1),this.end>1&&(this.end=1),this.end<0&&(this.end=0);var e=this.x+this.start*this.width,n=this.x+this.end*this.width;this.foregroundShape.attr("x",e),this.foregroundShape.attr("width",n-e);var r=Object(v.get)(this.handlerStyle,"width",2);this.setText(this.minText,this.maxText);var i=this.dodgeText([e,n]),o=i[0],a=i[1];this.minHandlerShape.setX(e-r/2),Object(v.each)(o,(function(e,n){return t.minTextShape.attr(n,e)})),this.maxHandlerShape.setX(n-r/2),Object(v.each)(a,(function(e,n){return t.maxTextShape.attr(n,e)})),this.currentMode===Mo?this.graph.emit("valuechange",{value:[this.start,this.end].sort()}):this.currentMode===So&&this.graph.emit("valuechange",{value:[this.end,this.end]})},t.prototype.dodgeText=function(t){var e,n,r=Object(v.get)(this.handlerStyle,"width",2),i=this.minTextShape,o=this.maxTextShape,a=t[0],s=t[1],u=!1;a>s&&(a=(e=[s,a])[0],s=e[1],i=(n=[o,i])[0],o=n[1],u=!0);var c=i.getBBox(),l=o.getBBox(),f=null,h=null;return"trend"===this.timeBarType?(f=a-c.widththis.x+this.width?{x:s-r/2-2,textAlign:"right"}:{x:s+r/2+2,textAlign:"left"}):"simple"===this.timeBarType&&(f=i.attr("x")>c.width?{x:a,textAlign:"center"}:{x:a,textAlign:"left"},h=o.attr("x")>this.width-l.width?{x:s,textAlign:"right"}:{x:s,textAlign:"center"}),u?[h,f]:[f,h]},t.prototype.startPlay=function(){var t=this;return"undefined"!=typeof window?window.requestAnimationFrame((function(){var e=t,n=e.ticks,r=e.width,i=t.currentSpeed,o=r/n.length/(1e3*(10-i)/60),a=t.adjustOffsetRange(o/t.width);t.updateStartEnd(a),t.updateUI(),t.isPlay&&(t.playHandler=t.startPlay())})):void 0},t.prototype.changePlayStatus=function(t){void 0===t&&(t=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit("timebarstartplay",null)):this.playHandler&&("undefined"!=typeof window&&window.cancelAnimationFrame(this.playHandler),t&&this.graph.emit("timebarendplay",null))},t.prototype.destory=function(){this.graph.off("valuechange",(function(){}));var t=this.group,e=t.find((function(t){return"minHandlerShape"===t.get("name")}));e&&(e.off("minHandlerShape-handler:mousedown"),e.off("minHandlerShape-handler:touchstart"),e.destroy());var n=t.find((function(t){return"maxHandlerShape"===t.get("name")}));n&&(n.off("maxHandlerShape-handler:mousedown"),n.off("maxHandlerShape-handler:touchstart"),n.destroy()),this.foregroundShape.off("mousedown"),this.foregroundShape.off("touchstart"),this.foregroundShape.destroy(),t.off("".concat("playPauseBtn",":click")),t.off("".concat("nextStepBtn",":click")),t.off("".concat("preStepBtn",":click")),t.off("timebarConfigChanged"),t.destroy(),this.trendComponent&&this.trendComponent.destory()},t}(),Ss=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ms=function(){return(Ms=Object.assign||function(t){for(var e,n=1,r=arguments.length;n")),{position:"relative"}),a)&&this.get("graph").get("container").appendChild(t);this.set("timeBarContainer",t),e="SVG"===n.get("renderer")?new Sr.Canvas({container:t,width:i,height:o}):new Er.Canvas({container:t,width:i,height:o}),this.get("containerCSS")&&qr(t,this.get("containerCSS")),this.set("canvas",e)},e.prototype.init=function(){this.initContainer();var t=this.get("canvas").addGroup({name:"timebar-group"});this.set("timeBarGroup",t),this.renderTrend(),this.initEvent();var e="undefined"!=typeof window&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif";this.set("fontFamily",e)},e.prototype.play=function(){this.togglePlay(!0)},e.prototype.pause=function(){this.togglePlay(!1)},e.prototype.togglePlay=function(t){var e=this.get("timebar");e&&(e.isPlay=!!t,e.changePlayStatus())},e.prototype.renderTrend=function(){var t=this,e=this._cfgs,n=e.width,r=e.x,i=e.y,o=e.padding,a=e.type,s=e.trend,u=e.slider,c=e.controllerCfg,l=e.textStyle,f=e.tick,h=e.backgroundStyle,d=e.foregroundStyle,p=s.data,g=Os(s,["data"]),v=n-2*o,y="trend"===a?26:4,m=this.get("graph"),b=this.get("timeBarGroup"),x=this.get("canvas"),w=null;if("trend"===a||"simple"===a){var _=this.get("getValue");w=new Es(Ms(Ms({graph:m,canvas:x,group:b,type:a,x:r+o,y:"trend"===a?i+o:i+o+15,width:v,height:y,padding:o,backgroundStyle:h,foregroundStyle:d,trendCfg:Ms(Ms({},g),{data:p.map((function(t){return(null==_?void 0:_(t))||t.value}))})},u),{tick:{ticks:p,tickLabelFormatter:f.tickLabelFormatter,tickLabelStyle:f.tickLabelStyle,tickLineStyle:f.tickLineStyle},handlerStyle:Ms(Ms({},u.handlerStyle),{height:u.height||y}),controllerCfg:c,textStyle:l}))}else"tick"===a&&(w=new Io(Ms({graph:m,canvas:x,group:b,x:r+o,y:i+o,width:n,height:42,padding:2,controllerCfg:c},f)));var E=function e(){var n=t.get("timebar");n.draggingHandler=!1,n.isPlay&&(n.isPlay=!1,n.currentHandler=n.maxHandlerShape,n.changePlayStatus()),document.removeEventListener("mouseup",e)};x.on("mousedown",(function(t){"maxHandlerShape-handler"!==t.target.get("name")&&"minHandlerShape-handler"!==t.target.get("name")&&t.target!==w.foregroundShape||document.addEventListener("mouseup",E)})),this.set("timebar",w)},e.prototype.filterData=function(t){var e,n=t.value;if(!n){n=[];var r=this._cfgs.type;r&&"trend"!==r&&"simple"!==r?"tick"===r&&(n[0]=this._cfgs.tick.start,n[1]=this._cfgs.tick.end):(n[0]=this._cfgs.slider.start,n[1]=this._cfgs.slider.end)}var i=null,o=this._cfgs.type;if("trend"===o||"simple"===o?i=this._cfgs.trend.data:"tick"===o&&(i=this._cfgs.tick.data),i&&0!==i.length){var a=this.get("rangeChange"),s=this.get("graph"),u=Math.round(i.length*n[0]),c=Math.round(i.length*n[1]);c=c>=i.length?i.length-1:c,u=u>=i.length?i.length-1:u;var l=null===(e=this._cfgs.tick)||void 0===e?void 0:e.tickLabelFormatter,f=l?l(i[u]):i[u].date,h=l?l(i[c]):i[c].date;if("tick"!==o)this.get("timebar").setText(f,h);if(a)a(s,f,h);else{(!this.cacheGraphData||this.cacheGraphData.nodes&&0===this.cacheGraphData.nodes.length)&&(this.cacheGraphData=s.get("data"));var d=this.get("filterItemTypes"),p=this.get("changeData"),g=this.get("getDate"),v=this.get("shouldIgnore"),y=i[u].date,m=i[c].date;if(p||void 0===p){var b=this.cacheGraphData.nodes,x=this.cacheGraphData.edges,w={},_={};s.getNodes().forEach((function(t){return w[t.getID()]=!0})),s.getEdges().forEach((function(t){return _[t.getID()]=!0})),d.includes("node")&&(null==b||b.forEach((function(t){var e=+((null==g?void 0:g(t))||t.date),n=e>=y&&e<=m||(null==v?void 0:v("node",t,{min:y,max:m})),r=w[t.id];r&&!n?(s.removeItem(t.id),w[t.id]=!1):!r&&n&&(s.addItem("node",t),w[t.id]=!0)})),null==x||x.forEach((function(t){var e=w[t.source]&&w[t.target]||(null==v?void 0:v("edge",t,{min:y,max:m})),n=!!s.findById(t.id);n&&!e?(s.removeItem(t.id),_[t.id]=!1):!n&&e?(s.addItem("edge",t),_[t.id]=!0):n||(_[t.id]=!1)}))),(this.get("filterEdge")||d.includes("edge"))&&(null==x||x.filter((function(t){var e=+((null==g?void 0:g(t))||t.date),n=e>=y&&e<=m||(null==v?void 0:v("edge",t,{min:y,max:m})),r=w[t.source]&&w[t.target],i=n&&r,o=_[t.id];o&&!i?(_[t.id]=!1,s.removeItem(t.id)):!o&&i&&(_[t.id]=!0,s.addItem("edge",t))})))}else d.includes("node")&&s.getNodes().forEach((function(t){var e=t.getModel();if(!(null==v?void 0:v("node",e,{min:y,max:m}))){var n=+((null==g?void 0:g(e))||e.date);nm?s.hideItem(t):s.showItem(t)}})),(this.get("filterEdge")||d.includes("edge"))&&s.getEdges().forEach((function(t){var e=t.getModel();if(!(null==v?void 0:v("edge",e,{min:i[u].date,max:i[c].date}))){var n=+((null==g?void 0:g(e))||e.date);if(ni[c].date)s.hideItem(t);else{var r=t.getSource().isVisible(),o=t.getTarget().isVisible();r&&o&&s.showItem(t)}}}))}}else console.warn("璇烽厤缃� TimeBar 缁勪欢鐨勬暟鎹�")},e.prototype.initEvent=function(){var t=this.get("graph");t.on("afterchangedata",this.changeData),t.on("afterrender",this.afterrenderListener),t.on("valuechange",this.valueChangeListener)},e.prototype.destroy=function(){var e=this.get("graph");e.off("afterchangedata",this.changeData),e.off("afterrender",this.afterrenderListener),e.off("valuechange",this.valueChangeListener);var n=this.get("timebar");n&&n.destory&&n.destory(),t.prototype.destroy.call(this);var r=this.get("timeBarContainer");if(r){var i=this.get("container");i||(i=this.get("graph").get("container")),Object(v.isString)(i)&&(i=document.getElementById(i)),i===r&&(i=i.parentElement),i.removeChild(r)}},e}(Gi),As=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Cs=pr.applyMatrix;var js=function(t){function e(e){return t.call(this,e)||this}return As(e,t),e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",width:200,delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},e.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},e.prototype.disableRefresh=function(){this.set("refresh",!1)},e.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},e.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},e.prototype.initViewport=function(){var t=this,e=this._cfgs,n=e.graph;if(!this.destroyed){var r=this.get("container");Object(v.isString)(r)&&(r=document.getElementById(r));var i=Hr("
    ")),o=0,a=0,s=!1,u=0,c=0,l=0,f=0,h=0,d=0;r.addEventListener("mousedown",(function(r){if(e.refresh=!1,r.target===i){var u=i.style;l=parseInt(u.width,10),f=parseInt(u.height,10);var c=t.get("width"),p=t.get("height");l>c||f>p||(d=n.getZoom(),h=t.get("ratio"),s=!0,o=r.clientX,a=r.clientY)}}),!1),r.addEventListener("mousemove",(function(e){if(s&&!Object(v.isNil)(e.clientX)&&!Object(v.isNil)(e.clientY)){var r=t.get("width"),p=t.get("height"),g=i.style;u=parseInt(g.left,10),c=parseInt(g.top,10),l=parseInt(g.width,10),f=parseInt(g.height,10);var y=o-e.clientX,m=a-e.clientY;u-y<0?y=u:u-y+l>=r&&(y=0),c-m<0?m=c:c-m+f>=p&&(m=0),c-=m,qr(i,{left:"".concat(u-=y,"px"),top:"".concat(c,"px")}),n.translate(y*d/h,m*d/h),o=e.clientX,a=e.clientY}}),!1),r.addEventListener("mouseleave",(function(){s=!1,e.refresh=!0}),!1),r.addEventListener("mouseup",(function(){s=!1,e.refresh=!0}),!1),this.set("viewport",i),r.appendChild(i)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),e=this.get("width"),n=this.get("height"),r=this.get("graph"),i=r.get("width"),o=i/r.get("height"),a=r.getGroup(),s=a.getCanvasBBox(),u=[(s.minX+s.maxX)/2,(s.minY+s.maxY)/2],c=[s.maxX-s.minX,s.maxY-s.minY],l={centerX:u[0],centerY:u[1],width:0,height:0,minX:0,minY:0};s[0]/s[1]>o?(l.width=c[0],l.height=l.width/o):(l.height=c[1],l.width=l.height*o),l.minX=u[0]-l.width/2,l.minY=u[1]-l.height/2;var f=a.getMatrix();f||(f=[1,0,0,0,1,0,0,0,1]);var h=w.b.invert([1,0,0,0,1,0,0,0,1],f),d=Cs({x:l.minX,y:l.minY},h),p=r.getCanvasByPoint(d.x,d.y),g=this.get("viewport");g||this.initViewport();var v=i/l.width,y=v*e,m=v*n,b=e*-p.x/l.width,x=n*-p.y/l.height,_=b+y,E=x+m;b<0&&(y+=b,b=0),_>e&&(y-=_-e),x<0&&(m+=x,x=0),E>n&&(m-=E-n),this.set("ratio",t),qr(g,{left:"".concat(b,"px"),top:"".concat(x,"px"),width:"".concat(y,"px"),height:"".concat(m,"px")})}},e.prototype.init=function(){this.initContainer()},e.prototype.initContainer=function(){var t=this.get("graph"),e=t.get("width"),n=t.get("height")/e,r=this.get("className"),i=this.get("container"),o=this.get("width"),a=this.get("height");o||a||(o=200),o?(a=n*o,this.set("height",a)):(o=1/n*a,this.set("width",o));var s=Hr("
    "));Object(v.isString)(i)&&(i=document.getElementById(i)),i?i.appendChild(s):t.get("container").appendChild(s),this.set("container",s);var u=Hr('
    ');s.appendChild(u);var c=Hr('');u.appendChild(c),this.set("containerDOM",u),this.set("containerSpan",c);var l=Hr(''));this.set("imgDOM",l),this.updateImgSize(),c.appendChild(l),this.updateCanvas()},e.prototype.updateImgSize=function(){var t=this.get("imgDOM"),e=this.get("width"),n=this.get("height");t.onload=function(){var r=function(t,e){var n,r;if(t.naturalWidth)n=t.naturalWidth,r=t.naturalHeight;else{var i=new Image;i.src=t.src,i.onload=function(){e&&e(i.width,i.height)}}return[n,r]}(t);r[0]>r[1]?t.width=e:t.height=n}},e.prototype.updateCanvas=function(){if(this.get("refresh")){var t=this.get("graph");if(!t.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var e=this.get("width")/t.get("canvas").getCanvasBBox().width;this.set("ratio",e),this.updateViewport()}}},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.updateGraphImg=function(t){this.get("imgDOM").remove(),this.set("graphImg",t);var e=Hr(''));this.set("imgDOM",e),e.src=t,this.updateImgSize(),this.get("containerSpan").appendChild(e),this.updateCanvas()},e.prototype.destroy=function(){var t=this.get("container");t.parentNode.removeChild(t)},e}(Gi),Is=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ts=function(){return(Ts=Object.assign||function(t){for(var e,n=1,r=arguments.length;n(i||n.get("height"))&&e>1||a<(o||.05*n.get("height"))&&e<1)&&(e=1),a*=e,this.set("r",a),this.filter(t)}},e.prototype.filter=function(t){var e=this.get("graph"),n=e.getNodes(),r={},i=this.get("r"),o=this.get("type"),a={x:t.x,y:t.y};this.updateDelegate(a,i);var s=this.get("shouldShow"),u=this.get("vShapes");u&&u.forEach((function(t){t.remove(),t.destroy()})),u=[],n.forEach((function(t){var e=t.getModel(),n=e.x,o=e.y;Ns({x:n,y:o},a)
    ");r.appendChild(i),this.set("container",i);var o=this.render();qr(i,this.getContainerPos(o)),this.bindEvents()},e.prototype.getContainerPos=function(t){void 0===t&&(t=[0,0]);var e=this.get("graph"),n=this.get("offsetX"),r=this.get("offsetY"),i=this.get("margin"),o=this.get("position").split("-"),a={top:0,right:1,bottom:2,left:3},s={left:(e.getWidth()-t[0])/2+0,top:(e.getHeight()-t[1])/2+0};return o.forEach((function(n){var r=i[a[n]],o=n;switch(n){case"top":case"left":r+=0;break;case"bottom":r=e.getHeight()-t[1]-r+0,o="top";break;default:r=e.getWidth()-t[0]-r+0,o="left"}s[o]=r})),s.top+=r+e.getContainer().offsetTop,s.left+=n+e.getContainer().offsetLeft,Object.keys(s).forEach((function(t){s[t]="".concat(s[t],"px")})),s},e.prototype.bindEvents=function(){var t=this,e=t.get("filter");if(e&&e.enable){var n=e.trigger||"click";Ys.includes(n)||(console.warn("Trigger for legend filterling must be 'click' or 'mouseenter', 'click' will take effect by default."),n="click");var r=t.get("legendCanvas");"mouseenter"===n?(r.on("node-container:mouseenter",(function(e){return t.filterData(e)})),r.on("node-container:mouseleave",(function(e){t.clearFilter(),t.clearActiveLegend()}))):(r.on("node-container:click",(function(e){return t.filterData(e)})),r.on("click",(function(e){e.target&&e.target.isCanvas&&e.target.isCanvas()&&(t.clearFilter(),t.clearActiveLegend())})))}},e.prototype.changeData=function(t){this.set("data",t);var e=this.render();qr(this.get("container"),this.getContainerPos(e))},e.prototype.activateLegend=function(t){var e=this.get("filter");(null==e?void 0:e.multiple)||this.clearActiveLegend();var n=t.get("parent");n.get("active")?(n.set("active",!1),this.findLegendItemsByState("active").length&&n.set("inactive",!0)):(n.set("inactive",!1),n.set("active",!0)),this.findLegendItemsByState("active").length?this.findLegendItemsByState("active","all",!1).forEach((function(t){t.set("inactive",!0)})):this.clearActiveLegend();var r=(null==e?void 0:e.legendStateStyles)||{},i=(null==r?void 0:r.inactive)||{opacity:.5,"text-shape":{opacity:.5}},o=i["text-shape"]||{};this.findLegendItemsByState("inactive").forEach((function(t){var e=t.get("children"),n=e[0],r=e[1];n.attr(Gs(Gs({},n.get("oriAttrs")),i)),r.attr(Gs(Gs({},r.get("oriAttrs")),o))}));var a=(null==r?void 0:r.active)||{stroke:"#000",lineWidth:2,"text-shape":{fontWeight:"bold"}},s=a["text-shape"]||{};this.findLegendItemsByState("active").forEach((function(t){var e=t.get("children"),n=e[0],r=e[1];n.attr(Gs(Gs({},n.get("oriAttrs")),a)),r.attr(Gs(Gs({},r.get("oriAttrs")),s))}))},e.prototype.findLegendItemsByState=function(t,e,n){void 0===e&&(e="all"),void 0===n&&(n=!0);var r=this.get("legendCanvas").find((function(t){return"root"===t.get("name")})),i=r.find((function(t){return"node-group"===t.get("name")})),o=r.find((function(t){return"edge-group"===t.get("name")}));return"node"===e?i.get("children").filter((function(e){return!!e.get(t)===n})):"edge"===e?o.get("children").filter((function(e){return!!e.get(t)===n})):i.get("children").filter((function(e){return!!e.get(t)===n})).concat(o.get("children").filter((function(e){return!!e.get(t)===n})))},e.prototype.clearActiveLegend=function(){var t=this.get("legendCanvas").find((function(t){return"root"===t.get("name")}));[t.find((function(t){return"node-group"===t.get("name")})),t.find((function(t){return"edge-group"===t.get("name")}))].forEach((function(t){t.get("children").forEach((function(t){t.set("active",!1),t.set("inactive",!1);var e=t.get("children"),n=e[0],r=e[1];n.attr(n.get("oriAttrs")),r.attr(r.get("oriAttrs"))}))}))},e.prototype.filterData=function(t){var e=this.get("filter"),n=null==e?void 0:e.filterFunctions;if(e&&n){var r=this.get("legendCanvas"),i=this.get("graph"),o=e.graphActiveState||"active",a=e.graphInactiveState||"inactive",s=e.multiple;this.clearFilter(),s||this.clearActiveLegend(),this.activateLegend(t.target);var u=r.find((function(t){return"root"===t.get("name")})),c=u.find((function(t){return"node-group"===t.get("name")})),l=u.find((function(t){return"edge-group"===t.get("name")})),f=c.get("children").filter((function(t){return t.get("active")})),h=l.get("children").filter((function(t){return t.get("active")})),d=0,p=["getNodes","getEdges"];p.forEach((function(t){i[t]().forEach((function(e){var r=!1;("getNodes"===t?f:h).forEach((function(t){var i=n[t.get("id")];r=r||i(e.getModel())})),r?(i.setItemState(e,a,!1),i.setItemState(e,o,!0),d++):(i.setItemState(e,o,!1),i.setItemState(e,a,!0))}))})),d||p.forEach((function(t){i[t]().forEach((function(t){i.clearItemStates(t,[a])}))}))}},e.prototype.clearFilter=function(){var t=this.get("graph"),e=this.get("filter");if(e){var n=e.graphActiveState||"active",r=e.graphInactiveState||"inactive";t.getNodes().forEach((function(e){t.clearItemStates(e,[n,r])})),t.getEdges().forEach((function(e){t.clearItemStates(e,[n,r])}))}},e.prototype.render=function(){var t=this;this.processData();var e=this.get("legendCanvas");e?e.clear():e=new Er.Canvas({container:this.get("container"),width:200,height:200});var n=e.addGroup({name:"root"}),r=n.addGroup({name:"node-group"}),i=n.addGroup({name:"edge-group"});this.set("legendCanvas",e);var o=this.get("itemsData"),a=[r,i];["nodes","edges"].forEach((function(e,n){o[e].forEach((function(r){var i,o,s=a[n].addGroup({id:r.id,name:"node-container"}),u=r.type,c=t.getShapeSize(r),l=c.width,f=c.height,h=c.r,d=t.getStyle(e.substr(0,4),r);switch(r.type){case"circle":o={r:h,x:0,y:0};break;case"rect":o={width:l,height:f,x:-l/2,y:-f/2};break;case"ellipse":o={rx:l,ry:f,x:0,y:0},u="ellipse";break;case"line":o={x1:-l/2,y1:0,x2:l/2,y2:0},u="line";break;case"quadratic":o={path:[["M",-l/2,0],["Q",0,l/2,l/2,0]]},u="path";break;case"cubic":o={path:[["M",-l/2,0],["C",-l/6,l/2,l/6,-l/2,l/2,0]]},u="path";break;case"diamond":o={path:[["M",0,-f],["L",l,0],["L",0,f],["L",-l,0],["Z"]]},u="path";break;case"triangle":o={path:[["M",-l,f],["L",0,-f],["L",l,f],["Z"]]},u="path";break;case"star":o={path:pr.getStarPath(3*h,1.2*h)},u="path";break;default:o={r:h,x:0,y:0}}var p=s.addShape(u,{attrs:Gs(Gs({},o),d),name:"".concat(r.type,"-node-keyShape"),oriAttrs:Gs({opacity:1},d)});if(r.label){var g=p.getBBox(),v=(null===(i=r.labelCfg)||void 0===i?void 0:i.style)||{},y=Gs({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},v);s.addShape("text",{attrs:Gs({x:g.maxX+4,y:0,text:r.label},y),className:"legend-label",name:"".concat(r.type,"-node-text"),oriAttrs:y})}}))}));var s,u=this.get("padding"),c=n.find((function(t){return"title-container"===t.get("name")})),l={height:0,maxY:0,width:0};if(this.get("title")){c||(c=n.addGroup({name:"title-container"}));var f={fontSize:20,fontFamily:"Arial",fontWeight:300,textBaseline:"top",textAlign:"center",fill:"#000",x:0,y:u[0]},h=this.get("titleConfig")||{},d=Object.assign(f,h.style||{});s=c.addShape("text",{attrs:Gs({text:this.get("title")},d)}),l=c.getCanvasBBox(),c.setMatrix([1,0,0,0,1,0,h.offsetX,h.offsetY,1])}this.layoutItems();var p=n.getCanvasBBox(),g=r.getCanvasBBox(),v=g.minX<0?Math.abs(g.minX)+u[3]:u[3],y=l.maxYc.max&&(c.max=o[0]),d>l&&(l=d),t.setMatrix([1,0,0,0,1,0,p,g,1])}));var f=c.max-c.min,h={min:0,max:-1/0},d=s.getCanvasBBox();o[0]=0,o[1]="vertical"===r?d.maxX+e:d.maxY+n,u.get("children").forEach((function(t,i){0===i&&(h.min=o[0]);var a=t.get("children")[0],s=t.getCanvasBBox(),u=a.getBBox(),c=u.width,l=u.height,f=0,d=0;"vertical"===r?(f=o[1],d=o[0],o[0]=d+s.height+n,t.setMatrix([1,0,0,0,1,0,0,d+l/2,1])):(f=o[0],d=o[1],o[0]=f+s.width+e,t.setMatrix([1,0,0,0,1,0,f+c/2,0,1])),o[0]>h.max&&(h.max=o[0])}));var p=h.max-h.min;if(i&&""!==i&&"left"!==i){var g=f-p,v="center"===i?Math.abs(g)/2:Math.abs(g);(g<0?s:u).get("children").forEach((function(t){var e=t.getMatrix()||[1,0,0,0,1,0,0,0,1];"vertical"===r?e[7]+=v:e[6]+=v,t.setMatrix(e)}))}},e.prototype.processData=function(){var t=this.get("data"),e={nodes:[],edges:[]};t.nodes&&(t.nodes.sort((function(t,e){return t.order-e.order})),t.nodes.forEach((function(t){var n,r,i,o,a,s=t.size||[(null===(n=t.style)||void 0===n?void 0:n.width)||(null===(r=t.style)||void 0===r?void 0:r.r)||8,(null===(i=t.style)||void 0===i?void 0:i.height)||(null===(o=t.style)||void 0===o?void 0:o.r)||8],u=(null===(a=t.labelCfg)||void 0===a?void 0:a.style)||{};e.nodes.push({id:t.id||Object(v.uniqueId)(),type:t.type||"circle",style:Gs({},t.style),order:t.order,label:t.label,itemType:"node",size:s,labelCfg:{position:"right",style:Gs({fontFamily:"Arial"},u)}})}))),t.edges&&(t.edges.sort((function(t,e){return t.order-e.order})),t.edges.forEach((function(t){var n,r,i=t.type||"line";"cubic-horizontal"===t.type&&(i="cubic");var o=(null===(n=t.labelCfg)||void 0===n?void 0:n.style)||{},a=t.size||[(null===(r=t.style)||void 0===r?void 0:r.width)||8,1];e.edges.push({id:t.id||Object(v.uniqueId)(),type:i,size:a,style:Gs({lineWidth:Object(v.isArray)(a)?a[1]:1},t.style),order:t.order,label:t.label,itemType:"edge",labelCfg:{position:"right",style:Gs({fontFamily:"Arial"},o)}})}))),this.set("itemsData",e)},e.prototype.getContainer=function(){return this.get("container")},e.prototype.formatArray=function(t){var e=this.get(t);if(Object(v.isNumber)(e))this.set(t,[e,e,e,e]);else if(Object(v.isArray)(e))switch(e.length){case 0:this.set(t,[0,0,0,0]);break;case 1:this.set(t,[e[0],e[0],e[0],e[0]]);break;case 2:this.set(t,[e[0],e[1],e[0],e[1]]);break;case 3:this.set(t,[e[0],e[1],e[2],e[1]])}return this.get(t)},e.prototype.getShapeSize=function(t){var e,n,r;return t.size&&(Object(v.isArray)(t.size)?(e=t.size[0],n=t.size[1]||t.size[0],r=t.size[0]/2):Object(v.isNumber)(t.size)&&(e=t.size,n=t.size,r=t.size/2)),t.style&&(t.style.width&&(e=t.style.width),t.style.height&&(n=t.style.height),t.style.r&&(r=t.style.r)),r||(r=5),e||(e=r),n||(n=r),{width:e,height:n,r:r}},e.prototype.getStyle=function(t,e){return Gs(Gs({},"node"===t?{fill:"#ccc",lineWidth:0}:{stroke:"#000",lineWidth:1}),e.style||{})},e.prototype.destroy=function(){var t=this.get("legendCanvas");null==t||t.destroy();var e=this.get("graph").get("container"),n=this.get("container");e.removeChild(n)},e}(Gi),Xs=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ws=function(){return(Ws=Object.assign||function(t){for(var e,n=1,r=arguments.length;n+

    ":"

    -

    ",l=e?"":"

    ".concat(a,"

    "),f=e?"".concat(u,"px"):"".concat(u,"px ").concat(u,"px 0 0");return'
    \n \n

    ").concat(i,"

    \n ").concat(c,"\n ").concat("

    x

    ","\n
    \n ").concat(l,"\n ")}},e.prototype.init=function(){var t=this;if(!t.destroyed){var e=t.get("graph").getContainer(),n=t.get("container");this.get("containerCfg")?(n=this.createContainer(),e.appendChild(n)):n=e,this.set("container",n);var r=e.getBoundingClientRect(),i=new Er.Canvas({container:e,width:r.right-r.left,height:r.bottom-r.top});qr(i.get("el"),{position:"absolute",top:0,left:0,pointerEvents:"none"}),window.addEventListener("resize",Object(v.debounce)((function(){return t.resizeCanvas(t)}),100));var o=i.addGroup({id:"annotation-link-group"});t.set("linkGroup",o),t.set("canvas",i),t.get("getTitle")||t.set("getTitle",(function(t){var e,n=(null===(e=null==t?void 0:t.getModel)||void 0===e?void 0:e.call(t))||{},r=n.label,i=n.id;return r||i||"-"})),t.get("getContent")||t.set("getContent",(function(t){var e,n;if(!t)return"-";var r=(null===(e=t.getModel)||void 0===e?void 0:e.call(t))||{},i=r.label,o=r.id,a=null===(n=t.getType)||void 0===n?void 0:n.call(t),s=a?"".concat(a,": "):"";return"".concat(s).concat(i||o||"")}));var a=t.get("defaultData");a&&this.readData(a)}},e.prototype.createContainer=function(){var t=this;if(!this.destroyed){var e=this.get("containerCfg"),n=this.get("graph"),r=n.getContainer(),i=r.getBoundingClientRect(),o=i.left,a=i.right,s=i.top,u=i.bottom-s,c=a-o,l=e.position,f=void 0===l?"top":l,h=e.offsetX,d=void 0===h?0:h,p=e.offsetY,g=void 0===p?0:p,y=Vs(e,["position","offsetX","offsetY"]),m=e.height,b=void 0===m?"fit-content":m,x=e.width,w=void 0===x?n.getWidth():x;"100%"===b&&(b=u),"100%"===w&&(w=c);var _="unset",E="unset",S={};switch(f){case"right":_="".concat(u,"px"),(S={top:0,right:0}).right+=o+d,S.top+=s+g;break;case"bottom":E="".concat(c,"px"),(S={bottom:0,left:0}).left+=o+d,S.bottom+=s+g;break;case"top":E="".concat(c,"px");case"left":_="".concat(u,"px");default:(S={top:0,left:0}).left+=o+d,S.top+=s+g}Object.keys(S).forEach((function(t){S[t]="".concat(S[t],"px")}));var M=Hr("
    "));return qr(M,Ws(Ws({position:"absolute",display:"top"===f||"bottom"===f?"inline-flex":"unset",width:Object(v.isNumber)(w)?"".concat(w,"px"):w,height:Object(v.isNumber)(b)?"".concat(b,"px"):b,maxHeight:_,maxWidth:E,overflow:"scroll"},S),y)),r.appendChild(M),M.addEventListener("scroll",(function(e){t.updateLinks()})),M}},e.prototype.resizeCanvas=function(t){clearTimeout(t.resizeTimer),t.resizeTimer=setTimeout((function(){if(t&&!t.destroyed){var e=t.get("container").getBoundingClientRect(),n=e.right-e.left,r=e.bottom-e.top;t.get("canvas").changeSize(n,r),t.updateOutsideCards(t)}}),250)},e.prototype.updateOutsideCards=function(t){var e=t||this,n=e.get("cardInfoMap")||{},r=e.get("graph"),i=r.getPointByCanvas(0,0),o=r.getPointByCanvas(r.getWidth(),r.getHeight()),a=r.getClientByPoint(i.x,i.y),s=a.x,u=a.y,c=r.getClientByPoint(o.x,o.y),l=c.x,f=c.y;Object.values(n).forEach((function(t){var e=t.card;if(e){var n=e.style,r=Zs(n.left),i=Zs(n.top),o=e.getBoundingClientRect(),a=o.width,c=o.height,h=r,d=i;r+a>l-s&&(h=l-s-a),r<0&&(h=0),i+c>f-u&&(d=f-u-c),i<0&&(d=0),qr(e,{left:"".concat(h,"px"),top:"".concat(d,"px")})}})),e.updateLinks()},e.prototype.showAnnotation=function(t){if(!this.destroyed){var e=t.item;this.toggleAnnotation(e)}},e.prototype.hideCards=function(){var t=this;if(!t.destroyed){var e=t.get("cardInfoMap")||{};Object.keys(e).forEach((function(e){t.hideCard(e)}))}},e.prototype.toggleAnnotation=function(t,e){var n,r;void 0===e&&(e={});if(!this.destroyed){var i=this.get("cardInfoMap")||{},o=this.get("graph"),a=this.get("container"),s=this.get("containerCfg"),u=Object.assign({},this.get("cardCfg")||{},e),c=u.minHeight,l=u.minWidth,f=u.width,h=u.height,d=u.collapsed,p=void 0!==d&&d,g=u.x,y=u.y,m=u.title,b=u.content,x=u.maxTitleLength,w=u.defaultBegin,_=Vs(u,["minHeight","minWidth","width","height","collapsed","x","y","title","content","maxTitleLength","defaultBegin"]),E=this.get("linkGroup"),S=this.get("rows")||[[]],M=null===(n=t.isCanvas)||void 0===n?void 0:n.call(t),O=M?"canvas-annotation":t.getID(),k=i[O]||{},A=k.card,C=k.link,j=k.x,I=k.y,T=k.title,N=k.content,P=this.get("getTitle"),D=this.get("getContent"),L=this.get("getContentPlaceholder")||function(){return""},R=this.get("getTitlePlaceHolder")||function(){return""},B=L(t),F=R(t),z=Hr(this.getDOMContent(Ws({itemId:O,collapsed:p,title:(null===(r=T||m||(null==P?void 0:P(t)))||void 0===r?void 0:r.substr(0,x))||F,content:N||b||(null==D?void 0:D(t))||B},_))),G=Object(v.isNumber)(c)?"".concat(c,"px"):c;qr(z,{minHeight:p?"unset":G,minWidth:Object(v.isNumber)(l)?"".concat(l,"px"):l,height:h,width:f});var Y,U=!!A;if(U?(null==C||C.remove(!0),a.replaceChild(z,A)):a.appendChild(z),!s){if(Y=a.getBoundingClientRect()||{},void 0!==g&&void 0!==y)j=g,I=y;else if(!U&&!M){var X=Y.top,W=w||{},V=W.left,H=W.right,q=void 0===H?16:H,Z=W.top,K=void 0===Z?8:Z,Q=W.bottom,$=q,J=K;isNaN(V)||($=a.scrollWidth-V),isNaN(Q)||(J=a.scrollHeight-Q);var tt=Object(v.isNumber)(l)?l:100;j=a.scrollWidth-z.scrollWidth-(S.length-1)*tt-$;var et=S[S.length-1],nt=(et[et.length-1]||{}).bbox;I=(null==nt?void 0:nt.bottom)-X||J}qr(z,{position:"absolute",left:"".concat(j,"px"),top:"".concat(I,"px"),cusor:s?"unset":"move"})}this.bindListener(z,O);var rt=z.getBoundingClientRect();if(!M){var it=qs(t,rt,o,this.get("canvas")),ot=this.get("linkStyle");C=E.addShape("path",{attrs:Ws({lineWidth:1,lineDash:[5,5],stroke:"#ccc",path:it},ot)})}if(i[O]=Ws(Ws({},i[O]||{}),{id:O,collapsed:p,card:z,link:C,x:j,y:I,cardBBox:rt,content:N||b,title:T||m,contentPlaceholder:B,titlePlaceholder:F,isCanvas:M}),this.set("cardInfoMap",i),s)this.updateCardPositionsInConatainer(),this.updateLinks();else{var at=!isNaN(g)&&!isNaN(y);if(!U&&!M&&!at){var st=Y.bottom,ut=void 0===st?0:st;X=Y.top;S[S.length-1].push({id:O,bbox:rt}),rt.top>ut-X-rt.height-16&&S.push([]),this.set("rows",S)}}this.updateCardSize(O);var ct=this.get("onAnnotationChange");null==ct||ct(i[O],U?"update":"create")}},e.prototype.updateCardPositionsInConatainer=function(){if(!this.destroyed){var t=this.get("cardInfoMap");if(t){var e=this.get("container"),n=this.get("containerCfg").position,r=e.getBoundingClientRect().width,i=getComputedStyle(e),o=Zs(i.paddingLeft)+Zs(i.paddingRight);r-=o,Object.values(t).forEach((function(t){var e=t.card,i=e.getBoundingClientRect().width;switch(n){case"right":qr(e,{marginLeft:r?"".concat(r-i,"px"):"0px"});break;case"top":case"bottom":qr(e,{marginLeft:"8px"})}}))}}},e.prototype.handleExpandCollapseCard=function(t){if(!this.destroyed){var e=this.get("graph"),n=this.get("cardInfoMap");if(n){var r=n[t].collapsed,i=e.findById(t);if(i)"hide"!==this.get("cardCfg").collapseType||r?this.toggleAnnotation(i,{collapsed:!r}):this.hideCard(t),n[t]=Ws(Ws({},n[t]),{collapsed:!r})}}},e.prototype.hideCard=function(t){if(!this.destroyed){var e=this.get("cardInfoMap");if(e&&e[t]){var n=e[t],r=n.card,i=n.link;qr(r,{display:"none"}),null==i||i.hide(),this.get("onAnnotationChange")(e[t],"hide")}}},e.prototype.removeCard=function(t){if(!this.destroyed){var e=this.get("cardInfoMap");if(e){var n=e[t],r=n.card,i=n.link;this.get("container").removeChild(r),null==i||i.remove(!0),delete e[t],this.get("onAnnotationChange")(n,"remove")}}},e.prototype.bindListener=function(t,e){var n=this;if(!this.destroyed){t.addEventListener("mousemove",(function(t){var r;if("g6-annotation-collapse"===t.target.className?r="collapse":"g6-annotation-expand"===t.target.className?r="expand":"g6-annotation-close"===t.target.className&&(r="close"),r){var i=n.get("cardCfg").onMouseEnterIcon;(void 0===i?function(){}:i)(t,e,r)}})),t.addEventListener("mouseout",(function(t){var r;if("g6-annotation-collapse"===t.target.className?r="collapse":"g6-annotation-expand"===t.target.className?r="expand":"g6-annotation-close"===t.target.className&&(r="close"),r){var i=n.get("cardCfg").onMouseLeaveIcon;(void 0===i?function(){}:i)(t,e,r)}})),t.addEventListener("mouseenter",(function(t){var r=n.get("cardInfoMap");if(r){var i=n.get("graph"),o=i.findById(e);if(o){var a=n.get("itemHighlightState");i.setItemState(o,a,!0)}var s=r[e].link;if(s){var u=n.get("linkHighlightStyle")||{};s.attr(u)}}})),t.addEventListener("mouseleave",(function(t){var r=n.get("cardInfoMap");if(r){var i=n.get("graph"),o=i.findById(e);if(o){var a=n.get("itemHighlightState");i.setItemState(o,a,!1)}var s=r[e].link;if(s){var u=n.get("linkHighlightStyle")||{};Object.keys(u).forEach((function(t){s.attr(t,void 0),s.attr(t,void 0)}));var c=n.get("linkStyle");s.attr(c)}}})),t.addEventListener("click",(function(t){var r=(n.get("cardCfg")||{}).onClickIcon;if("g6-annotation-collapse"===t.target.className||"g6-annotation-expand"===t.target.className)"hide"===n.get("cardCfg").collapseType?n.hideCard(e):n.handleExpandCollapseCard(e),null==r||r(t,e,"g6-annotation-collapse"===t.target.className?"collapse":"expand");else if("g6-annotation-close"===t.target.className){"remove"===n.get("cardCfg").closeType?n.removeCard(e):n.hideCard(e),null==r||r(t,e,"close")}})),this.get("editable")&&t.addEventListener("dblclick",(function(t){var r=n.get("cardInfoMap"),i=(n.get("cardCfg")||{}).maxTitleLength,o=void 0===i?20:i;if(r){var a=t.target,s=a.className;if("g6-annotation-title"===s||"g6-annotation-content"===s){var u="g6-annotation-title"===s?a.getBoundingClientRect():a.parentNode.getBoundingClientRect(),c=u.width,l=u.height,f=getComputedStyle(a),h=Hr("<".concat("g6-annotation-title"===s?"input":"textarea",' class="').concat(s,'-input" type="textarea" style="width:').concat(c,"px; height: ").concat(l,'px; min-width: 16px;"/>')),d=Hr('
    '));d.appendChild(h),a.parentNode.replaceChild(d,a);var p=r[e],g=p.contentPlaceholder,v=p.titlePlaceholder,y=p.content,m=p.title,b=y;"g6-annotation-title"===s?(h.name="title",h.maxLength=o,b=m):h.name="content",b?(h.innerHTML=a.innerHTML,h.value=a.innerHTML):h.placeholder="g6-annotation-title"===s?v:g,h.focus(),h.addEventListener("blur",(function(t){h.value&&(a.innerHTML=h.value,p[h.name||"title"]=h.value),d.parentNode.replaceChild(a,d),n.updateCardSize(e);var r=n.get("onAnnotationChange");null==r||r(p,"update")}))}}}));var r=["g6-annotation-title","g6-annotation-content","g6-annotation-title-input","g6-annotation-content-input"];t.draggable=!0,t.addEventListener("dragstart",(function(e){var i=e.target.className;if(!r.includes(i)){var o=t.style;n.set("dragging",{card:t,x:e.clientX,y:e.clientY,left:Zs(o.left),top:Zs(o.top)})}})),t.addEventListener("drag",(function(t){t.preventDefault();var r=n.get("cardInfoMap");if(r){var i=t.clientX,o=t.clientY,a=n.get("dragging");if(!isNaN(i)&&!isNaN(o)&&a){var s=a.x,u=a.y,c=a.left,l=a.top,f=a.card,h=i-s,d=o-u;c+=h,l+=d;var p=n.get("graph"),g=p.getPointByCanvas(0,0),v=p.getPointByCanvas(p.getWidth(),p.getHeight()),y=p.getClientByPoint(g.x,g.y),m=y.x,b=y.y,x=p.getClientByPoint(v.x,v.y),w=x.x,_=x.y,E=f.getBoundingClientRect();(c>w-m-(E.right-E.left)&&h>0||c<0&&h<0)&&(c-=h),(l>_-b-(E.bottom-E.top)&&d>0||l<0&&d<0)&&(l-=d),qr(f,{left:"".concat(c,"px"),top:"".concat(l,"px"),visibility:"hidden"}),s=i,u=o;var S=(r[e]||{}).link;if(S){var M=p.findById(e);S.attr("path",qs(M,E,p,n.get("canvas")))}n.set("dragging",{x:s,y:u,left:c,top:l,card:f})}}}));t.addEventListener("dragend",(function(t){var r=n.get("cardInfoMap");if(r){var i=n.get("dragging");if(i){var o=i.left,a=i.top,s=i.card;r[e].x=o,r[e].y=a,qr(s,{visibility:"visible"}),n.set("dragging",!1);var u=n.get("rows");null==u||u.forEach((function(t){for(var n=t.length-1;n>=0;n--)t[n].id===e&&t.splice(n,1)}));var c=n.get("onAnnotationChange");null==c||c(r[e],"update")}}}))}},e.prototype.updateCardSize=function(t){var e=this.get("cardInfoMap");if(e){var n=e[t].card,r=n.getBoundingClientRect().width,i=n.getElementsByClassName("g6-annotation-title")[0];if(i){var o=getComputedStyle(i),a=Zs(o.marginLeft),s=i.getBoundingClientRect().width;qr(i,{marginRight:"".concat(r-a-24-16-s,"px")})}}},e.prototype.updateLink=function(t){var e=t.item;if(e){var n=this.get("cardInfoMap");if(n){var r=this.get("canvas"),i=this.get("graph"),o=n[e.getID()]||{},a=o.link,s=o.card;if(a){var u=qs(e,s.getBoundingClientRect(),i,r);a.attr("path",u)}}}},e.prototype.updateLinks=function(){var t=this;if(!this.destroyed){var e=this.get("cardInfoMap");if(e){var n=this.get("graph");Object.values(e).forEach((function(e){var r=e.id,i=n.findById(r);t.updateLink({item:i})}))}}},e.prototype.onGraphDataChange=function(){var t=this,e=this.get("cardInfoMap");if(e){var n=this.get("graph");Object.values(e).forEach((function(e){var r=e.id,i=e.card,o=e.isCanvas;if(i&&!o&&"none"!==i.style.display){var a=n.findById(r);a&&a.isVisible()?t.toggleAnnotation(a):t.hideCard(r)}}))}},e.prototype.onGraphItemVisibilityChange=function(t){var e=t.item,n=t.visible;if(e&&!e.destroyed){var r=this.get("cardInfoMap");if(r){var i=e.getID();r[i]&&(n||this.hideCard(i))}}},e.prototype.saveData=function(t){void 0===t&&(t=!1);var e=this.get("cardInfoMap");if(e){var n=this.get("graph"),r=this.get("getTitle"),i=this.get("getContent"),o=[];return Object.values(e).forEach((function(e){var a=e.title,s=e.content,u=e.x,c=e.y,l=e.id,f=e.collapsed,h=e.card;if(!h||"none"!==h.style.display||t){var d=n.findById(l)||n.get("canvas");o.push({id:l,x:u,y:c,collapsed:f,title:a||(null==r?void 0:r(d)),content:s||(null==i?void 0:i(d)),visible:h&&"none"!==h.style.display})}})),o}},e.prototype.readData=function(t){var e=this,n=this.get("graph");t.forEach((function(t){var r=t.id,i=t.x,o=t.y,a=t.title,s=t.content,u=t.collapsed,c=t.visible,l=n.findById(r);if(l||"canvas-annotation"!==r||(l=n.get("canvas")),!l){var f=e.get("cardInfoMap")||{};return f[r]=t,void e.set("cardInfoMap",f)}e.toggleAnnotation(l,{x:i,y:o,title:a,content:s,collapsed:u}),c||e.hideCard(r)}))},e.prototype.clear=function(){var t=this.get("cardInfoMap");if(t){var e=this.get("container");Object.values(t).forEach((function(t){var n=t.card,r=t.link;e.removeChild(n),null==r||r.remove(!0)})),this.set("cardInfoMap",{})}},e.prototype.destroy=function(){var t;this.clear(),null===(t=this.get("canvas"))||void 0===t||t.destroy();var e=this.get("graph");e&&!e.destroyed&&(this.get("containerCfg")&&e.getContainer().removeChild(this.get("container")),this.destroyed=!0)},e}(Gi),qs=function(t,e,n,r){var i,o;if("edge"===t.getType())o=[t.getKeyShape().getPoint(.5)];else{var a=null===(i=t.getKeyShape)||void 0===i?void 0:i.call(t).getBBox(),s=a.minX,u=a.minY,c=a.maxX,l=a.maxY,f=t.getModel(),h=f.x,d=f.y;o={left:{x:s+=h,y:((u+=d)+(l+=d))/2},right:{x:c+=h,y:(u+l)/2},top:{x:(s+c)/2,y:u},bottom:{x:(s+c)/2,y:l}}}Object.keys(o).forEach((function(t){var e=o[t],i=e.x,a=e.y,s=n.getClientByPoint(i,a);o[t]=r.getPointByClient(s.x,s.y)}));var p=e.top,g=void 0===p?0:p,v=e.left,y=void 0===v?0:v,m=e.right,b=void 0===m?0:m,x=e.bottom,w=void 0===x?0:x,_={left:r.getPointByClient(y,(g+w)/2),right:r.getPointByClient(b,(g+w)/2),top:r.getPointByClient((y+b)/2,g),bottom:r.getPointByClient((y+b)/2,w)};return function(t,e){var n,r,i=1/0;Object.keys(t).forEach((function(o){var a=t[o];Object.keys(e).forEach((function(t){var s=e[t],u=a.x-s.x,c=a.y-s.y,l=u*u+c*c;i>l&&(i=l,n=a,r=s,[o,t])}))}));var o=pr.getControlPoint(n,r,.5,20);return[["M",n.x,n.y],["Q",o.x,o.y,r.x,r.y]]}(o,_)},Zs=function(t){return Number(t.replace(/\s+|px/gi,""))||0},Ks={PluginBase:Gi,Menu:qi,Grid:Xi,Minimap:Ji,Bundling:ro,ToolBar:co,Tooltip:fo,Fisheye:so,TimeBar:ks,ImageMinimap:js,EdgeFilterLens:Ds,SnapLine:Fs,Legend:Us,Annotation:Hs};yr("circle",{options:{size:wr.defaultNode.size,style:{x:0,y:0,stroke:wr.defaultNode.style.stroke,fill:wr.defaultNode.style.fill,lineWidth:wr.defaultNode.style.lineWidth},labelCfg:{style:{fill:wr.nodeLabel.style.fill,fontSize:wr.nodeLabel.style.fontSize,fontFamily:wr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:wr.defaultNode.linkPoints.size,lineWidth:wr.defaultNode.linkPoints.lineWidth,fill:wr.defaultNode.linkPoints.fill,stroke:wr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(g.__assign)({},wr.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=Object(v.deepMix)({},r,t.icon),a="".concat(this.type,"-keyShape"),s=e.addShape("circle",{attrs:i,className:a,name:a,draggable:!0});e.shapeMap[a]=s;var u=o.width,c=o.height,l=o.show,f=o.text;if(l){var h="".concat(this.type,"-icon");e.shapeMap[h]=f?e.addShape("text",{attrs:Object(g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:h,name:h,draggable:!0}):e.addShape("image",{attrs:Object(g.__assign)({x:-u/2,y:-c/2},o),className:h,name:h,draggable:!0})}return this.drawLinkPoints(t,e),s},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints;if(n){var r=n||{},i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(g.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t)[0]/2;if(o){var h="link-point-left";e.shapeMap[h]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:-f,y:0,r:u/2||c||5}),className:h,name:h,isAnchorPoint:!0})}if(a){var d="link-point-right";e.shapeMap[d]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:f,y:0,r:u/2||c||5}),className:d,name:d,isAnchorPoint:!0})}if(i){var p="link-point-top";e.shapeMap[p]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:0,y:-f,r:u/2||c||5}),className:p,name:p,isAnchorPoint:!0})}if(s){var v="link-point-bottom";e.shapeMap[v]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:0,y:f,r:u/2||c||5}),className:v,name:v,isAnchorPoint:!0})}}},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(v.deepMix)({},e,n),i=this.getSize(t)[0]/2;return Object(g.__assign)({x:0,y:0,r:i},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getSize(t),o=Object(g.__assign)({},t.style);void 0===t.style.stroke&&t.color&&(o.stroke=t.color),void 0!==t.style.r||isNaN(i[0])||(o.r=i[0]/2),this.updateShape(t,e,o,!0,n),this.updateLinkPoints(t,r)}},"single-node"),yr("rect",{options:{size:[100,30],style:{radius:0,stroke:wr.defaultNode.style.stroke,fill:wr.defaultNode.style.fill,lineWidth:wr.defaultNode.style.lineWidth},labelCfg:{style:{fill:wr.nodeLabel.style.fill,fontSize:wr.nodeLabel.style.fontSize,fontFamily:wr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:wr.defaultNode.linkPoints.size,lineWidth:wr.defaultNode.linkPoints.lineWidth,fill:wr.defaultNode.linkPoints.fill,stroke:wr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},anchorPoints:[[0,.5],[1,.5]],stateStyles:Object(g.__assign)({},wr.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(t,e){var n=this.getShapeStyle(t),r=e.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return e.shapeMap["".concat(this.type,"-keyShape")]=r,this.drawLinkPoints(t,e),r},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(g.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0],d=f[1];o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:-h/2,y:0,r:u/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:h/2,y:0,r:u/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:0,y:-d/2,r:u/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:0,y:d/2,r:u/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(v.mix)({},e,n),i=this.getSize(t),o=r.width||i[0],a=r.height||i[1];return Object(g.__assign)({x:-o/2,y:-a/2,width:o,height:a},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getSize(t),a=e.get("keyShape");t.size||(o[0]=a.attr("width")||i.width,o[1]=a.attr("height")||i.height);var s={stroke:t.color,x:-o[0]/2,y:-o[1]/2,width:o[0],height:o[1]},u=Object(v.mix)({},i,a.attr(),s);u=Object(v.mix)(u,t.style),this.updateShape(t,e,u,!1,n),this.updateLinkPoints(t,r)}},"single-node"),yr("ellipse",{options:{size:[80,40],style:{x:0,y:0,stroke:wr.defaultNode.style.stroke,fill:wr.defaultNode.style.fill,lineWidth:wr.defaultNode.style.lineWidth},labelCfg:{style:{fill:wr.nodeLabel.style.fill,fontSize:wr.nodeLabel.style.fontSize,fontFamily:wr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:wr.defaultNode.linkPoints.size,lineWidth:wr.defaultNode.linkPoints.lineWidth,fill:wr.defaultNode.linkPoints.fill,stroke:wr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(g.__assign)({},wr.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=e.addShape("ellipse",{attrs:i,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});e.shapeMap["ellipse-keyShape"]=o;var a=r.width,s=r.height,u=r.show,c=r.text;return u&&(e.shapeMap["".concat(this.type,"-icon")]=c?e.addShape("text",{attrs:Object(g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:Object(g.__assign)({x:-a/2,y:-s/2},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),o},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(g.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0]/2,d=f[1]/2;o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:-h,y:0,r:u/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:h,y:0,r:u/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:0,y:-d,r:u/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:0,y:d,r:u/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(v.mix)({},e,n),i=this.getSize(t),o=i[0]/2,a=i[1]/2;return Object(g.__assign)({x:0,y:0,rx:o,ry:a},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getSize(t),a={stroke:t.color,rx:o[0]/2,ry:o[1]/2},s=e.get("keyShape"),u=Object(v.mix)({},i,s.attr(),a);u=Object(v.mix)(u,t.style),this.updateShape(t,e,u,!0,n),this.updateLinkPoints(t,r)}},"single-node"),yr("diamond",{options:{size:[80,80],style:{stroke:wr.defaultNode.style.stroke,fill:wr.defaultNode.style.fill,lineWidth:wr.defaultNode.style.lineWidth},labelCfg:{style:{fill:wr.nodeLabel.style.fill,fontSize:wr.nodeLabel.style.fontSize,fontFamily:wr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:wr.defaultNode.linkPoints.size,lineWidth:wr.defaultNode.linkPoints.lineWidth,fill:wr.defaultNode.linkPoints.fill,stroke:wr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(g.__assign)({},wr.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=e.addShape("path",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=o;var a=r.width,s=r.height,u=r.show,c=r.text;return u&&(e.shapeMap["".concat(this.type,"-icon")]=c?e.addShape("text",{attrs:Object(g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:Object(g.__assign)({x:-a/2,y:-s/2},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),o},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(g.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0],d=f[1];o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:-h/2,y:0,r:u/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:h/2,y:0,r:u/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:0,y:-d/2,r:u/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:0,y:d/2,r:u/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getPath:function(t){var e=this.getSize(t),n=e[0],r=e[1];return[["M",0,-r/2],["L",n/2,0],["L",0,r/2],["L",-n/2,0],["Z"]]},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(v.mix)({},e,n),i=this.getPath(t);return Object(g.__assign)({path:i},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getPath(t),a={stroke:t.color,path:o},s=e.get("keyShape"),u=Object(v.mix)({},i,s.attr(),a);u=Object(v.mix)(u,t.style),this.updateShape(t,e,u,!0,n),this.updateLinkPoints(t,r)}},"single-node"),yr("triangle",{options:{size:40,direction:"up",style:{stroke:wr.defaultNode.style.stroke,fill:wr.defaultNode.style.fill,lineWidth:wr.defaultNode.style.lineWidth},labelCfg:{style:{fill:wr.nodeLabel.style.fill,fontSize:wr.nodeLabel.style.fontSize},offset:15},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:wr.defaultNode.linkPoints.size,lineWidth:wr.defaultNode.linkPoints.lineWidth,fill:wr.defaultNode.linkPoints.fill,stroke:wr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20,offset:6},stateStyles:Object(g.__assign)({},wr.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(t,e){var n=this.mergeStyle||this.getOptions(t),r=n.icon,i=void 0===r?{}:r,o=n.direction,a=this.getShapeStyle(t),s=t.direction||o,u=e.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=u;var c=i.width,l=i.height,f=i.show,h=i.offset,d=i.text;if(f)if(d)e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:Object(g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0});else{var p=-c/2,v=-l/2;"up"!==s&&"down"!==s||(v+=h),"left"!==s&&"right"!==s||(p+=h),e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:Object(g.__assign)({x:p,y:v},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(t,e),u},drawLinkPoints:function(t,e){var n=this.mergeStyle||this.getOptions(t),r=n.linkPoints,i=void 0===r?{}:r,o=n.direction,a=t.direction||o,s=i.top,u=i.left,c=i.right,l=i.bottom,f=i.size,h=i.r,d=Object(g.__rest)(i,["top","left","right","bottom","size","r"]),p=this.getSize(t)[0];if(u){var v=null,y=p*Math.sin(1/3*Math.PI),m=p*Math.sin(1/3*Math.PI);"up"===a?v=[-m,y]:"down"===a?v=[-m,-y]:"left"===a&&(v=[-m,m-y]),v&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},d),{x:v[0],y:v[1],r:f/2||h||5}),className:"link-point-left",name:"link-point-left"}))}if(c){var b=null;y=p*Math.sin(1/3*Math.PI),m=p*Math.sin(1/3*Math.PI);"up"===a?b=[m,y]:"down"===a?b=[m,-y]:"right"===a&&(b=[m,m-y]),b&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},d),{x:b[0],y:b[1],r:f/2||h||5}),className:"link-point-right",name:"link-point-right"}))}if(s){var x=null;y=p*Math.sin(1/3*Math.PI),m=p*Math.sin(1/3*Math.PI);"up"===a?x=[m-y,-y]:"left"===a?x=[m,-y]:"right"===a&&(x=[-m,-y]),x&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},d),{x:x[0],y:x[1],r:f/2||h||5}),className:"link-point-top",name:"link-point-top"}))}if(l){var w=null;y=p*Math.sin(1/3*Math.PI),m=p*Math.sin(1/3*Math.PI);"down"===a?w=[-m+y,y]:"left"===a?w=[m,y]:"right"===a&&(w=[-m,y]),w&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},d),{x:w[0],y:w[1],r:f/2||h||5}),className:"link-point-bottom",name:"link-point-bottom"}))}},getPath:function(t){var e=(this.mergeStyle||this.getOptions(t)).direction,n=t.direction||e,r=this.getSize(t)[0],i=r*Math.sin(1/3*Math.PI),o=r*Math.sin(1/3*Math.PI),a=[["M",-o,i],["L",0,-i],["L",o,i],["Z"]];return"down"===n?a=[["M",-o,-i],["L",o,-i],["L",0,i],["Z"]]:"left"===n?a=[["M",-o,o-i],["L",o,-o],["L",o,o],["Z"]]:"right"===n&&(a=[["M",o,o-i],["L",-o,o],["L",-o,-o],["Z"]]),a},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(v.mix)({},e,n),i=this.getPath(t);return Object(g.__assign)({path:i},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getPath(t),a={stroke:t.color,path:o},s=e.get("keyShape"),u=Object(v.mix)({},i,s.attr(),a);u=Object(v.mix)(u,t.style),this.updateShape(t,e,u,!0,n),this.updateLinkPoints(t,r)},updateLinkPoints:function(t,e){var n=this.getOptions({}),r=n.linkPoints,i=n.direction,o=t.direction||i,a=e.shapeMap["link-point-left"]||e.find((function(t){return"link-point-left"===t.get("className")})),s=e.shapeMap["link-point-right"]||e.find((function(t){return"link-point-right"===t.get("className")})),u=e.shapeMap["link-point-top"]||e.find((function(t){return"link-point-top"===t.get("className")})),c=e.shapeMap["link-point-bottom"]||e.find((function(t){return"link-point-bottom"===t.get("className")})),l=r,f=a||s||u||c;f&&(l=f.attr());var h=Object(v.mix)({},l,t.linkPoints),d=h.fill,p=h.stroke,y=h.lineWidth,m=h.size/2;m||(m=h.r);var b=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},x=b.left,w=b.right,_=b.top,E=b.bottom,S=this.getSize(t)[0],M={r:m,fill:d,stroke:p,lineWidth:y},O=null,k=S*Math.sin(1/3*Math.PI),A=S*Math.sin(1/3*Math.PI);"up"===o?O=[-A,k]:"down"===o?O=[-A,-k]:"left"===o&&(O=[-A,A-k]),O&&(a?x||void 0===x?a.attr(Object(g.__assign)(Object(g.__assign)({},M),{x:O[0],y:O[1]})):(a.remove(),delete e.shapeMap["link-point-left"]):x&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},M),{x:O[0],y:O[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var C=null;"up"===o?C=[A,k]:"down"===o?C=[A,-k]:"right"===o&&(C=[A,A-k]),C&&(s?w||void 0===w?s.attr(Object(g.__assign)(Object(g.__assign)({},M),{x:C[0],y:C[1]})):(s.remove(),delete e.shapeMap["link-point-right"]):w&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},M),{x:C[0],y:C[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var j=null;"up"===o?j=[A-k,-k]:"left"===o?j=[A,-k]:"right"===o&&(j=[-A,-k]),j&&(u?_||void 0===_?u.attr(Object(g.__assign)(Object(g.__assign)({},M),{x:j[0],y:j[1]})):(u.remove(),delete e.shapeMap["link-point-top"]):_&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},M),{x:j[0],y:j[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var I=null;"down"===o?I=[-A+k,k]:"left"===o?I=[A,k]:"right"===o&&(I=[-A,k]),I&&(c?E||void 0===E?c.attr(Object(g.__assign)(Object(g.__assign)({},M),{x:I[0],y:I[1]})):(c.remove(),delete e.shapeMap["link-point-bottom"]):E&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},M),{x:I[0],y:I[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node"),yr("modelRect",{options:{size:[185,70],style:{radius:5,stroke:"#69c0ff",fill:"#ffffff",lineWidth:wr.defaultNode.style.lineWidth,fillOpacity:1},labelCfg:{style:{fill:"#595959",fontSize:14,fontFamily:wr.windowFontFamily},offset:30},descriptionCfg:{style:{fontSize:12,fill:"#bfbfbf",fontFamily:wr.windowFontFamily},paddingTop:0},preRect:{show:!0,width:4,fill:"#40a9ff",radius:2},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:10,lineWidth:1,fill:"#72CC4A",stroke:"#72CC4A"},logoIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/4f81893c-1806-4de4-aff3-9a6b266bc8a2.svg",width:16,height:16,offset:0},stateIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/300a2523-67e0-4cbf-9d4a-67c077b40395.svg",width:16,height:16,offset:-5},anchorPoints:[[0,.5],[1,.5]]},shapeType:"modelRect",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).preRect,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=this.getSize(t),a=o[0],s=o[1],u=e.addShape("rect",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=u;var c=r.show,l=Object(g.__rest)(r,["show"]);return c&&(e.shapeMap["pre-rect"]=e.addShape("rect",{attrs:Object(g.__assign)({x:-a/2,y:-s/2,height:s},l),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(t,e),this.drawStateIcon(t,e),this.drawLinkPoints(t,e),u},drawLogoIcon:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).logoIcon,r=void 0===n?{}:n,i=this.getSize(t)[0];if(r.show){var o=r.width,a=r.height,s=r.x,u=r.y,c=r.offset,l=r.text,f=Object(g.__rest)(r,["width","height","x","y","offset","text"]);e.shapeMap["rect-logo-icon"]=l?e.addShape("text",{attrs:Object(g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},f),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0}):e.addShape("image",{attrs:Object(g.__assign)(Object(g.__assign)({},f),{x:s||-i/2+o+c,y:u||-a/2,width:o,height:a}),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0})}},drawStateIcon:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).stateIcon,r=void 0===n?{}:n,i=this.getSize(t)[0];if(r.show){var o=r.width,a=r.height,s=r.x,u=r.y,c=r.offset,l=r.text,f=Object(g.__rest)(r,["width","height","x","y","offset","text"]);e.shapeMap["rect-state-icon"]=l?e.addShape("text",{attrs:Object(g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},f),className:"rect-state-icon",name:"rect-state-icon",draggable:!0}):e.addShape("image",{attrs:Object(g.__assign)(Object(g.__assign)({},f),{x:s||i/2-o+c,y:u||-a/2,width:o,height:a}),className:"rect-state-icon",name:"rect-state-icon",draggable:!0})}},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.bottom,u=r.size,c=r.r,l=Object(g.__rest)(r,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0],d=f[1];o&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:-h/2,y:0,r:u/2||c||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:h/2,y:0,r:u/2||c||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:0,y:-d/2,r:u/2||c||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},l),{x:0,y:d/2,r:u/2||c||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(t,e){var n=this.getOptions(t),r=n.labelCfg,i=void 0===r?{}:r,o=n.logoIcon,a=void 0===o?{}:o,s=n.descriptionCfg,u=void 0===s?{}:s,c=this.getSize(t)[0],l=null,f=a.show,h=a.width,d=-c/2+i.offset;f&&(d=-c/2+h+i.offset);var p=i.style,y=u.style,m=u.paddingTop;return Object(v.isString)(t.description)?(l=e.addShape("text",{attrs:Object(g.__assign)(Object(g.__assign)({},p),{x:d,y:-5,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=l,e.shapeMap["rect-description"]=e.addShape("text",{attrs:Object(g.__assign)(Object(g.__assign)({},y),{x:d,y:17+(m||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(l=e.addShape("text",{attrs:Object(g.__assign)(Object(g.__assign)({},p),{x:d,y:7,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=l),l},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(v.mix)({},e,n),i=this.getSize(t),o=r.width||i[0],a=r.height||i[1];return Object(g.__assign)({x:-o/2,y:-a/2,width:o,height:a},r)},update:function(t,e){var n=this.mergeStyle||this.getOptions(t),r=n.style,i=void 0===r?{}:r,o=n.labelCfg,a=void 0===o?{}:o,s=n.descriptionCfg,u=void 0===s?{}:s,c=this.getSize(t),l=c[0],f=c[1];e.get("keyShape").attr(Object(g.__assign)(Object(g.__assign)({},i),{x:-l/2,y:-f/2,width:l,height:f}));var h=e.getContainer(),d=h.shapeMap["rect-logo-icon"]||h.find((function(t){return"rect-logo-icon"===t.get("className")})),p=d?d.attr():{},y=Object(v.mix)({},p,t.logoIcon),m=y.width;void 0===m&&(m=this.options.logoIcon.width);var b=t.logoIcon?t.logoIcon.show:void 0,x=a.offset,w=-l/2+m+x;b||void 0===b||(w=-l/2+x);var _=h.shapeMap["node-label"]||h.find((function(t){return"node-label"===t.get("className")})),E=h.shapeMap["rect-description"]||h.find((function(t){return"rect-description"===t.get("className")}));if(t.label)if(_){var S=t.labelCfg?t.labelCfg.style:{},M=Object(v.mix)({},_.attr(),S);t.label&&(M.text=t.label),M.x=w,Object(v.isString)(t.description)&&(M.y=-5),E&&(E.resetMatrix(),E.attr({x:w})),_.resetMatrix(),_.attr(M)}else h.shapeMap["node-label"]=h.addShape("text",{attrs:Object(g.__assign)(Object(g.__assign)({},a.style),{x:w,y:t.description?-5:7,text:t.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});if(Object(v.isString)(t.description)){var O=u.paddingTop;if(E){S=t.descriptionCfg?t.descriptionCfg.style:{};var k=Object(v.mix)({},E.attr(),S);Object(v.isString)(t.description)&&(k.text=t.description),k.x=w,E.resetMatrix(),E.attr(Object(g.__assign)(Object(g.__assign)({},k),{y:17+(O||0)}))}else h.shapeMap["rect-description"]=h.addShape("text",{attrs:Object(g.__assign)(Object(g.__assign)({},u.style),{x:w,y:17+(O||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})}var A=h.shapeMap["pre-rect"]||h.find((function(t){return"pre-rect"===t.get("className")}));if(A&&!A.destroyed){var C=Object(v.mix)({},A.attr(),t.preRect);A.attr(Object(g.__assign)(Object(g.__assign)({},C),{x:-l/2,y:-f/2,height:f}))}if(d&&!d.destroyed)if(b||void 0===b){var j=y.width,I=y.height,T=y.x,N=y.y,P=y.offset,D=Object(g.__rest)(y,["width","height","x","y","offset"]);d.attr(Object(g.__assign)(Object(g.__assign)({},D),{x:T||-l/2+j+P,y:N||-I/2,width:j,height:I}))}else d.remove(),delete h.shapeMap["pre-rect"];else b&&this.drawLogoIcon(t,h);var L=h.shapeMap["rect-state-icon"]||h.find((function(t){return"rect-state-icon"===t.get("className")})),R=L?L.attr():{},B=Object(v.mix)({},R,t.stateIcon);if(L){B.show||void 0===B.show||(L.remove(),delete h.shapeMap["rect-state-icon"]);var F=B.width,z=(I=B.height,T=B.x,N=B.y,B.offset),G=Object(g.__rest)(B,["width","height","x","y","offset"]);L.attr(Object(g.__assign)(Object(g.__assign)({},G),{x:T||l/2-F+z,y:N||-I/2,width:F,height:I}))}else B.show&&this.drawStateIcon(t,h);this.updateLinkPoints(t,h)},getOptions:function(t,e){return"move"===e?t:Object(v.deepMix)({},this.options,this.getCustomConfig(t)||{},t)}},"single-node"),yr("star",{options:{size:60,style:{stroke:wr.defaultNode.style.stroke,fill:wr.defaultNode.style.fill,lineWidth:wr.defaultNode.style.lineWidth},labelCfg:{style:{fill:wr.nodeLabel.style.fill,fontSize:wr.nodeLabel.style.fontSize,fontFamily:wr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:wr.defaultNode.linkPoints.size,lineWidth:wr.defaultNode.linkPoints.lineWidth,fill:wr.defaultNode.linkPoints.fill,stroke:wr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(g.__assign)({},wr.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=e.addShape("path",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=o;var a=r.width,s=r.height,u=r.show,c=r.text;return u&&(e.shapeMap["".concat(this.type,"-icon")]=c?e.addShape("text",{attrs:Object(g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:Object(g.__assign)({x:-a/2,y:-s/2},r),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),o},drawLinkPoints:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).linkPoints,r=void 0===n?{}:n,i=r.top,o=r.left,a=r.right,s=r.leftBottom,u=r.rightBottom,c=r.size,l=r.r,f=Object(g.__rest)(r,["top","left","right","leftBottom","rightBottom","size","r"]),h=this.getSize(t)[0];if(a){var d=Math.cos(.1*Math.PI)*h,p=Math.sin(.1*Math.PI)*h;e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},f),{x:d,y:-p,r:c/2||l||5}),className:"link-point-right",name:"link-point-right"})}if(i){d=Math.cos(.5*Math.PI)*h,p=Math.sin(.5*Math.PI)*h;e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},f),{x:d,y:-p,r:c/2||l||5}),className:"link-point-top",name:"link-point-top"})}if(o){d=Math.cos(.9*Math.PI)*h,p=Math.sin(.9*Math.PI)*h;e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},f),{x:d,y:-p,r:c/2||l||5}),className:"link-point-left",name:"link-point-left"})}if(s){d=Math.cos(1.3*Math.PI)*h,p=Math.sin(1.3*Math.PI)*h;e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},f),{x:d,y:-p,r:c/2||l||5}),className:"link-point-left-bottom",name:"link-point-left-bottom"})}if(u){d=Math.cos(1.7*Math.PI)*h,p=Math.sin(1.7*Math.PI)*h;e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},f),{x:d,y:-p,r:c/2||l||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(t){var e=this.getSize(t)[0],n=3*e/8,r=t.innerR||n;return pr.getStarPath(e,r)},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,n={stroke:t.color},r=Object(v.mix)({},e,n),i=this.getPath(t);return Object(g.__assign)({path:i},r)},update:function(t,e,n){var r=e.getContainer(),i=this.getOptions({}).style,o=this.getPath(t),a={stroke:t.color,path:o},s=e.get("keyShape"),u=Object(v.mix)({},i,s.attr(),a);u=Object(v.mix)(u,t.style),this.updateShape(t,e,u,!0,n),this.updateLinkPoints(t,r)},updateLinkPoints:function(t,e){var n=this.getOptions({}).linkPoints,r=e.shapeMap["link-point-left"]||e.find((function(t){return"link-point-left"===t.get("className")})),i=e.shapeMap["link-point-right"]||e.find((function(t){return"link-point-right"===t.get("className")})),o=e.shapeMap["link-point-top"]||e.find((function(t){return"link-point-top"===t.get("className")})),a=e.shapeMap["link-point-left-bottom"]||e.find((function(t){return"link-point-left-bottom"===t.get("className")})),s=e.shapeMap["link-point-left-bottom"]||e.find((function(t){return"link-point-right-bottom"===t.get("className")})),u=n,c=r||i||o||a||s;c&&(u=c.attr());var l=Object(v.mix)({},u,t.linkPoints),f=l.fill,h=l.stroke,d=l.lineWidth,p=l.size/2;p||(p=l.r);var y=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,leftBottom:void 0,rightBottom:void 0},m=y.left,b=y.right,x=y.top,w=y.leftBottom,_=y.rightBottom,E=this.getSize(t)[0],S={r:p,fill:f,stroke:h,lineWidth:d},M=Math.cos(.1*Math.PI)*E,O=Math.sin(.1*Math.PI)*E;i?b||void 0===b?i.attr(Object(g.__assign)(Object(g.__assign)({},S),{x:M,y:-O})):(i.remove(),delete e.shapeMap["link-point-right"]):b&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},S),{x:M,y:-O}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),M=Math.cos(.5*Math.PI)*E,O=Math.sin(.5*Math.PI)*E,o?x||void 0===x?o.attr(Object(g.__assign)(Object(g.__assign)({},S),{x:M,y:-O})):(o.remove(),delete e.shapeMap["link-point-top"]):x&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},S),{x:M,y:-O}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),M=Math.cos(.9*Math.PI)*E,O=Math.sin(.9*Math.PI)*E,r?m||void 0===m?r.attr(Object(g.__assign)(Object(g.__assign)({},S),{x:M,y:-O})):(r.remove(),delete e.shapeMap["link-point-left"]):m&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},S),{x:M,y:-O}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),M=Math.cos(1.3*Math.PI)*E,O=Math.sin(1.3*Math.PI)*E,a?w||void 0===w?a.attr(Object(g.__assign)(Object(g.__assign)({},S),{x:M,y:-O})):(a.remove(),delete e.shapeMap["link-point-left-bottom"]):w&&(e.shapeMap["link-point-left-bottom"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},S),{x:M,y:-O}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),M=Math.cos(1.7*Math.PI)*E,O=Math.sin(1.7*Math.PI)*E,s?_||void 0===_?s.attr(Object(g.__assign)(Object(g.__assign)({},S),{x:M,y:-O})):(s.remove(),delete e.shapeMap["link-point-right-bottom"]):_&&(e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:Object(g.__assign)(Object(g.__assign)({},S),{x:M,y:-O}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var Qs=pr.defaultSubjectColors;yr("donut",{options:{size:wr.defaultNode.size,style:{x:0,y:0,stroke:wr.defaultNode.style.stroke,fill:wr.defaultNode.style.fill,lineWidth:wr.defaultNode.style.lineWidth},labelCfg:{style:{fill:wr.nodeLabel.style.fill,fontSize:wr.nodeLabel.style.fontSize,fontFamily:wr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:wr.defaultNode.linkPoints.size,lineWidth:wr.defaultNode.linkPoints.lineWidth,fill:wr.defaultNode.linkPoints.fill,stroke:wr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:Object(g.__assign)({},wr.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var n=(this.mergeStyle||this.getOptions(t)).icon,r=void 0===n?{}:n,i=this.getShapeStyle(t),o=Object(v.deepMix)({},r,t.icon),a=e.addShape("circle",{attrs:i,className:"".concat(this.type,"-keyShape"),draggable:!0,name:"".concat(this.type,"-keyShape")});e.shapeMap["".concat(this.type,"-keyShape")]=a;var s=o.width,u=o.height,c=o.show,l=o.text;return c&&(e.shapeMap["".concat(this.type,"-icon")]=l?e.addShape("text",{attrs:Object(g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:Object(g.__assign)({x:-s/2,y:-u/2},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),$s(t,e,a),this.drawLinkPoints(t,e),a},updateShape:function(t,e,n,r,i){var o=e.get("keyShape");o.attr(Object(g.__assign)({},n)),tu(t,e,o),this.updateLabel(t,e,i),r&&this.updateIcon(t,e)}},"circle");var $s=function(t,e,n){var r=t.donutAttrs,i=void 0===r?{}:r,o=t.donutColorMap,a=void 0===o?{}:o,s=Object.keys(i).length;if(i&&s>1){var u=eu(i,a),c=u.configs,l=u.totalValue;if(l){var f=nu(n),h=f.lineWidth,d=f.arcR,p=[d,0],g=0;if(1===s)return void Js(e,{arcR:d,arcBegin:p,beginAngle:g,config:c[0],fanIndex:0,lineWidth:h,totalValue:l,drawWhole:!0});for(var v=0;v.999)n=[o,1e-4],i=1;else{var y=v*Math.PI*2;r=s+y,n=[o*Math.cos(r),-o*Math.sin(r)],i=y>Math.PI?1:0}var m={path:[["M",a[0],a[1]],["A",o,o,0,i,0,n[0],n[1]]],stroke:u.color||(null==g?void 0:g.attr("stroke"))||Qs[c%Qs.length],lineWidth:l};return g?g.attr(m):t.shapeMap["".concat("fan-shape-").concat(c)]=t.addShape("path",{attrs:m,name:"".concat("fan-shape-").concat(c),draggable:!0}),{beginAngle:r,arcBegin:n,shape:t.shapeMap["".concat("fan-shape-").concat(c)],shouldEnd:d||v>.999}},tu=function(t,e,n){var r=t.donutAttrs,i=t.donutColorMap,o=void 0===i?{}:i,a={},s=e.getContainer();if(r){var u=eu(r,o),c=u.configs,l=u.totalValue;if(l)for(var f=nu(n),h=f.lineWidth,d=f.arcR,p=[d,0],g=0,v=0;v=0;r--){var i=t[r];i.id="".concat(i.x,"|||").concat(i.y),n[i.id]||(n[i.id]=i,e.push(i))}return e},ou=function(t){return iu(t)},au=function(t,e){return t.width||t.height?{centerX:t.centerX,centerY:t.centerY,minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e,height:t.height+2*e,width:t.width+2*e}:t},su=function(t,e,n){var r=function(t,e){var n=Math.abs(t.x-e.centerX),r=Math.abs(t.y-e.centerY);return 0===n&&0===r?0:n/e.width>r/e.height}(e,t);if(0===r){var i=t.centerX,o=t.centerY;return n.ye.x?i=t.maxX:n.xt.centerX?t.maxX:t.minX,y:e.y}:{x:e.x,y:e.y>t.centerY?t.maxY:t.minY}},uu=function(t,e){var n=Math.min(t.minX,e.minX),r=Math.min(t.minY,e.minY),i=Math.max(t.maxX,e.maxX),o=Math.max(t.maxY,e.maxY);return{centerX:(n+i)/2,centerY:(r+o)/2,minX:n,minY:r,maxX:i,maxY:o,height:o-r,width:i-n}},cu=function(t){return[{x:t.minX,y:t.minY},{x:t.maxX,y:t.minY},{x:t.maxX,y:t.maxY},{x:t.minX,y:t.maxY}]},lu=function(t,e){var n=t.x,r=t.y;return ne.maxX||re.maxY},fu=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},hu=function(t,e,n,r,i){return fu(t,e)+fu(t,n)+function(t,e){var n=0;return e.forEach((function(e){e&&(t.x===e.x&&(n+=-2),t.y===e.y&&(n+=-2))})),n}(t,[e,n,r,i])},du=function t(e,n,r,i,o){void 0===o&&(o=0),e.unshift(n[i]),r[i]&&r[i]!==i&&o<=100&&t(e,n,r,r[i],o+1)},pu=function(t,e,n,r){var i=n.x-t.x,o=n.y-t.y,a=r.x-t.x,s=r.y-t.y,u=n.x-e.x,c=n.y-e.y,l=r.x-e.x,f=r.y-e.y;return(i*s-o*a)*(u*f-c*l)<=0&&(i*c-o*u)*(a*f-s*l)<=0},gu=function(t,e,n){if(n.width||n.height){var r=cu(n),i=r[0],o=r[1],a=r[2],s=r[3];return pu(t,e,i,o)||pu(t,e,i,s)||pu(t,e,o,a)||pu(t,e,a,s)}return!1},vu=function(t,e,n,r){var i=[];return t.forEach((function(t){if(t!==e&&(t.x===e.x||t.y===e.y)){if(gu(t,e,n)||gu(t,e,r))return;i.push(t)}})),iu(i)},yu=function(t,e){var n=[],r=t[0];return n.push("M".concat(r.x," ").concat(r.y)),t.forEach((function(r,i){var o=t[i+1],a=t[i+2];if(o&&a)if(function(t,e,n){return!(t.x===e.x&&e.x===n.x||t.y===e.y&&e.y===n.y)}(r,o,a)){var s=function(t,e,n,r){var i=fu(t,e),o=fu(n,e);return it.maxX?[]:[{x:e,y:t.minY},{x:e,y:t.maxY}]}(t,e.x).concat(function(t,e){return et.maxY?[]:[{x:t.minX,y:e},{x:t.maxX,y:e}]}(t,e.y))}(t,E).filter((function(t){return lu(t,g)&&lu(t,v)})))})),[{x:y.x,y:m.y},{x:m.x,y:y.y}].forEach((function(t){lu(t,g)&&lu(t,v)&&_.push(t)})),_.unshift(y),_.push(m);var S=function(t,e,n,r,i,o,a){var s,u=[],c=((s={})[e.id]=e,s),l={},f={},h={};f[e.id]=0,h[e.id]=hu(e,n,e);var d=new bu;d.add({id:e.id,value:h[e.id]});var p,g={};for(t.forEach((function(t){g[t.id]=t}));Object.keys(c).length;){var v=d.minId(!1);if(!v)break;if((p=c[v])===n){var y=[];return du(y,g,l,n.id),y}delete c[p.id],d.remove(p.id),u.push(p);var m=vu(t,p,r,i);m.forEach((function(t){if(-1===u.indexOf(t)){var r=t.id;c[r]||(c[r]=t);var i=h[p.id]+fu(p,t);f[r]&&i>=f[r]||(l[r]=p.id,f[r]=i,h[r]=f[r]+hu(t,n,e,o,a)),d.add({id:r,value:h[r]})}}))}return[e,n]}(_=iu(_),y,m,o,a,t,e);return S.unshift(t),S.push(e),ou(S)},bu=function(){function t(){this.arr=[],this.map={},this.arr=[],this.map={}}return t.prototype._innerAdd=function(t,e){for(var n=[0,e-1];n[1]-n[0]>1;){var r=Math.floor((n[0]+n[1])/2);if(this.arr[r].value>t.value)n[1]=r;else{if(!(this.arr[r].value=0;e--)this.map[this.arr[e].id]?t=this.arr[e].id:this.arr.splice(e,1);return t},t.prototype._findFirstId=function(){for(;this.arr.length;){var t=this.arr.shift();if(this.map[t.id])return t.id}},t.prototype.minId=function(t){return t?this._clearAndGetMinId():this._findFirstId()},t}(),xu={offset:20,maxAllowedDirectionChange:Math.PI/2,maximumLoops:2e3,gridSize:10,directions:[{stepX:1,stepY:0},{stepX:-1,stepY:0},{stepX:0,stepY:1},{stepX:0,stepY:-1}],get penalties(){return{0:0,45:this.gridSize/2,90:this.gridSize/2}},distFunc:function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},fallbackRoute:function(t,e,n,r,i){return ou(mu(t,e,n,r,i.offset))}},wu=(Math.PI,function(t,e){var n=Math.round(Math.abs(t/e));return n<0?0:(t<0?-1:1)*n}),_u=function(t,e){var n=e.x-t.x,r=e.y-t.y;return n||r?Math.atan2(r,n):0},Eu=function(t,e){var n=Math.abs(t-e);return n>Math.PI?2*Math.PI-n:n},Su=function(t,e,n){for(var r=1/0,i=0,o=e.length;iu.minX&&e.xu.minY&&e.y0&&A>0;){var I=b.minId((A+1)%30==0);if(!I)break;if(_=d[I],j["".concat(_.x,"|||").concat(_.y)])return ku(_,g,c,e,t,l,s);delete d[_.id],b.remove(_.id),p[_.id]=!0;for(x=0;xo.maxAllowedDirectionChange||u[T])){d[T]||(d[T]=S);var N=a[k];M=o.distFunc(_,S)+(isNaN(N)?s:N),O=y[_.id]+M;var P=y[T];P&&O>=P||(g[T]=_,y[T]=O,m[T]=O+Su(S,h,o.distFunc),b.add({id:T,value:m[T]}))}}A-=1}return o.fallbackRoute(t,e,n,r,o)};mr("polyline",{options:{color:wr.defaultEdge.color,size:wr.defaultEdge.size,style:{radius:0,offset:15,x:0,y:0,stroke:wr.defaultEdge.style.stroke,lineAppendWidth:wr.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:wr.edgeLabel.style.fill,fontSize:wr.edgeLabel.style.fontSize,fontFamily:wr.windowFontFamily}},routeCfg:{obstacles:[],maxAllowedDirectionChange:Math.PI,maximumLoops:500,gridSize:10},stateStyles:Object(g.__assign)({},wr.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(t,e){var n=this.getShapeStyle(t);0===n.radius&&delete n.radius;var r=e.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return e.shapeMap["edge-shape"]=r,r},getShapeStyle:function(t){var e=this.options.style,n={stroke:t.color},r=Object(v.mix)({},e,n,t.style);t=this.getPathPoints(t),this.radius=r.radius,this.offset=r.offset;var i=t.startPoint,o=t.endPoint,a=this.getControlPoints(t),s=[i];a&&(s=s.concat(a)),s.push(o);var u=t.sourceNode,c=t.targetNode,l=r.radius,f=this.options.routeCfg,h=Object(v.mix)({},f,t.routeCfg);h.offset=r.offset;var d=this.getPath(s,u,c,l,h,!Boolean(a));return(Object(v.isArray)(d)&&d.length<=1||Object(v.isString)(d)&&-1===d.indexOf("L"))&&(d="M0 0, L0 0"),(isNaN(i.x)||isNaN(i.y)||isNaN(o.x)||isNaN(o.y))&&(d="M0 0, L0 0"),Object(v.mix)({},wr.defaultEdge.style,r,{lineWidth:t.size,path:d})},updateShapeStyle:function(t,e){var n=e.getContainer();if(e.isVisible()){var r={stroke:t.color},i=n.shapeMap["edge-shape"]||n.find((function(t){return"edge-shape"===t.get("className")}))||e.getKeyShape(),o=t.size,a=(t=this.getPathPoints(t)).startPoint,s=t.endPoint,u=this.getControlPoints(t),c=[a];u&&(c=c.concat(u)),c.push(s);var l=i.attr(),f=Object(v.mix)({},r,l,t.style),h=t.sourceNode,d=t.targetNode,p=f.radius,g=this.options.routeCfg,y=Object(v.mix)({},g,t.routeCfg);y.offset=f.offset;var m=this.getPath(c,h,d,p,y,!Boolean(u));(Object(v.isArray)(m)&&m.length<=1||Object(v.isString)(m)&&-1===m.indexOf("L"))&&(m="M0 0, L0 0"),(isNaN(a.x)||isNaN(a.y)||isNaN(s.x)||isNaN(s.y))&&(m="M0 0, L0 0"),l.endArrow&&!1===f.endArrow&&(t.style.endArrow={path:""}),l.startArrow&&!1===f.startArrow&&(t.style.startArrow={path:""});var b=Object(v.mix)(r,i.attr(),{lineWidth:o,path:m},t.style);i&&i.attr(b)}},getPath:function(t,e,n,r,i,o){var a=i.offset,s=i.obstacles,u=i.simple;if(!a||t.length>2||!1===o){if(r)return yu(t,r);var c=[];return Object(v.each)(t,(function(t,e){0===e?c.push(["M",t.x,t.y]):c.push(["L",t.x,t.y])})),c}!1===u||(null==s?void 0:s.length)||(u=!0);var l=u?mu(t[t.length-1],t[0],n,e,a):Au(t[0],t[t.length-1],e,n,i);return l&&l.length?r?yu(l,r):(l=function(t){if(!(null==t?void 0:t.length))return t;for(var e=t[t.length-1],n={x:e.x,y:e.y},r=[e],i=[e],o=t.length-2;o>=0;o--){var a,s=t[o];if(s.x===n.x?r.push(s):(r=[s],n.x=s.x),s.y===n.y?i.push(s):(i=[s],n.y=s.y),r.length>2)(a=t.indexOf(r[1]))>-1&&t.splice(a,1);else if(i.length>2)(a=t.indexOf(i[1]))>-1&&t.splice(a,1)}return t}(l),pr.pointsToPolygon(l)):"M0 0, L0 0"}},"single-edge");var Cu=fi.cloneEvent,ju=fi.isNaN,Iu=Math.abs,Tu=["shift","ctrl","alt","control"],Nu={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,scalableRange:0,allowDragOnItem:!1}},getEvents:function(){return{mousedown:"onMouseDown",drag:"onDragMove",dragend:"onMouseUp","canvas:click":"onMouseUp",keyup:"onKeyUp",focus:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onMouseUp"}},updateViewport:function(t){var e=this.origin,n=+t.clientX,r=+t.clientY;if(!ju(n)&&!ju(r)){var i=n-e.x,o=r-e.y;"x"===this.get("direction")?o=0:"y"===this.get("direction")&&(i=0),this.origin={x:n,y:r};var a=this.graph.get("width"),s=this.graph.get("height"),u=this.graph.get("canvas").getCanvasBBox(),c=this.scalableRange,l=this.scalableRange;c<1&&c>-1&&(c*=a,l*=s),(u.minX<=a+c&&u.minX+i>a+c||u.maxX+c>=0&&u.maxX+c+i<0)&&(i=0),(u.minY<=s+l&&u.minY+o>s+l||u.maxY+l>=0&&u.maxY+l+o<0)&&(o=0),this.graph.translate(i,o)}},onTouchStart:function(t){var e=t.originalEvent.touches,n=e[0],r=e[1];n&&r||(t.preventDefault(),this.mousedown=!0,this.onDragStart(t))},onMouseDown:function(t){this.mousedown=!0},onDragMove:function(t){this.mousedown&&(this.dragstart?this.onDrag(t):(this.dragstart=!0,this.onDragStart(t)))},onDragStart:function(t){var e=t.originalEvent;if((!e||"touchstart"===t.name||0===e.button)&&("touchstart"===t.name||"undefined"==typeof window||!window.event||window.event.buttons||window.event.button)&&this.shouldBegin(t,this)&&!this.keydown&&this.allowDrag(t)){if(this.origin={x:t.clientX,y:t.clientY},this.dragging=!1,this.enableOptimize){for(var n=this.graph,r=n.getEdges(),i=0,o=r.length;is)for(var h=r.getNodes(),d=0,p=h.length;d-1?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1},allowDrag:function(t){var e,n,r=t.target,i=r&&r.isCanvas&&r.isCanvas();if(Object(v.isBoolean)(this.allowDragOnItem)&&!this.allowDragOnItem&&!i)return!1;if(Object(v.isObject)(this.allowDragOnItem)){var o=this.allowDragOnItem,a=o.node,s=o.edge,u=o.combo,c=null===(n=null===(e=t.item)||void 0===e?void 0:e.getType)||void 0===n?void 0:n.call(e);if(!a&&"node"===c)return!1;if(!s&&"edge"===c)return!1;if(!u&&"combo"===c)return!1}return!0}},Pu={getDefaultCfg:function(){return{updateEdge:!0,delegateStyle:{},enableDelegate:!1,onlyChangeComboSize:!1,comboActiveState:"",selectedState:"selected",enableOptimize:!1,enableDebounce:!1,enableStack:!0}},getEvents:function(){return{"node:mousedown":"onMouseDown",drag:"onDragMove",dragend:"onDragEnd","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave","combo:drop":"onDropCombo","node:drop":"onDropNode","canvas:drop":"onDropCanvas",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onDragEnd",afterchangedata:"onDragEnd"}},validationCombo:function(t){return!(!this.origin||!t||t.destroyed)&&"combo"===t.getType()},onTouchStart:function(t){if(t.item){try{var e=t.originalEvent.touches,n=e[0],r=e[1];if(n&&r)return;t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.mousedown={item:t.item,target:t.target,origin:{x:t.x,y:t.y}},this.dragstart=!0,this.onDragStart(t)}},onTouchMove:function(t){try{var e=t.originalEvent.touches,n=e[0],r=e[1];if(n&&r)return void this.onDragEnd(t);t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.onDrag(t)},onMouseDown:function(t){this.mousedown={item:t.item,target:t.target,origin:{x:t.x,y:t.y}},"undefined"==typeof window||this.windowEventBinded||(this.windowEventBinded=!0,document.body.addEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.addEventListener("mouseup",this.onDragEnd.bind(this)))},onDragMove:function(t){var e,n;"node"===(null===(n=null===(e=t.item)||void 0===e?void 0:e.getType)||void 0===n?void 0:n.call(e))?this.mousedown&&(this.dragstart?this.onDrag(Object(g.__assign)(Object(g.__assign)({},t),this.mousedown)):(this.dragstart=!0,this.onDragStart(t))):this.onDragEnd()},onDragStart:function(t){var e=this;if(this.currentShouldEnd=!0,this.shouldBegin(Object(g.__assign)(Object(g.__assign)({},t),this.mousedown),this)){var n=this.mousedown,r=n.item,i=n.target;if(r&&!r.destroyed&&!r.hasLocked()){if(r.getContainer().set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(r),i)if(i.get("isAnchorPoint"))return;var o=this.graph;this.targets=[],this.targetCombo=null;var a=o.findAllByState("node",this.selectedState),s=r.get("id");if(0===a.filter((function(t){var e=t.get("id");return s===e})).length?this.targets.push(r):a.length>1?a.forEach((function(t){t.hasLocked()||e.targets.push(t)})):this.targets.push(r),this.graph.get("enabledStack")&&this.enableStack){var u=[];this.targets.forEach((function(t){var e=t.getModel(),n=e.x,r=e.y,i=e.id;u.push({x:n,y:r,id:i})})),this.set("beforeDragNodes",u)}this.hidenEdge={},this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach((function(t){t.getEdges().forEach((function(t){t.isVisible()&&(e.hidenEdge[t.getID()]=!0,t.hide())}))})),this.origin=this.mousedown.origin,this.point={},this.originPoint={}}}},onDrag:function(t){var e=this;if(this.mousedown&&this.origin&&this.shouldUpdate(t,this))if(this.get("enableDelegate"))this.updateDelegate(t);else if(this.enableDebounce)this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos});else{var n={};this.targets.map((function(r){e.update(r,t);var i=r.getModel().comboId;i&&(n[i]=e.graph.findById(i))})),this.onlyChangeComboSize&&this.updateParentCombos()}},onDragEnd:function(t){var e,n=this;if(this.mousedown=!1,this.dragstart=!1,"undefined"!=typeof window&&this.windowEventBinded&&(this.windowEventBinded=!1,document.body.removeEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.removeEventListener("mouseup",this.onDragEnd.bind(this))),this.origin){null===(e=this.cachedCaptureItems)||void 0===e||e.forEach((function(t){t.getContainer().set("capture",!0)})),this.cachedCaptureItems=[],this.delegateRect&&(this.delegateRect.remove(),this.delegateRect=null),this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach((function(t){t.getEdges().forEach((function(t){n.hidenEdge[t.getID()]&&t.show(),t.refresh()}))})),this.hidenEdge={};var r=this.graph;if(r.get("enabledStack")&&this.enableStack){var i={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach((function(t){i.before.nodes.push(t)})),this.targets.forEach((function(t){var e=t.getModel(),n=e.x,r=e.y,o=e.id;i.after.nodes.push({x:n,y:r,id:o})})),r.pushStack("update",Object(v.clone)(i))}r.emit("dragnodeend",{items:this.targets,targetItem:null}),this.point={},this.origin=null,this.originPoint={},this.targets.length=0,this.targetCombo=null}},onDropCombo:function(t){var e=t.item;if(this.currentShouldEnd=this.shouldEnd(t,e,this),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd&&this.validationCombo(e)){var n=this.graph;if(this.comboActiveState&&n.setItemState(e,this.comboActiveState,!1),this.targetCombo=e,this.onlyChangeComboSize)n.updateCombos();else{var r=e.getModel();this.targets.map((function(t){t.getModel().comboId!==r.id&&n.updateComboTree(t,r.id)})),n.updateCombo(e)}n.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(t){var e=this.graph;this.currentShouldEnd=this.shouldEnd(t,void 0,this),this.updatePositions(t,!this.currentShouldEnd),this.targets&&0!==this.targets.length&&this.currentShouldEnd&&(this.onlyChangeComboSize?this.updateParentCombos():this.targets.map((function(t){t.getModel().comboId&&e.updateComboTree(t)})))},onDropNode:function(t){if(this.targets&&0!==this.targets.length){var e=t.item,n=this.graph,r=e.getModel().comboId,i=r?n.findById(r):void 0;if(this.currentShouldEnd=this.shouldEnd(t,i,this),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd){if(this.onlyChangeComboSize)this.updateParentCombos();else if(r){var o=n.findById(r);this.comboActiveState&&n.setItemState(o,this.comboActiveState,!1),this.targets.map((function(t){var e=t.getModel();r!==e.comboId&&n.updateComboTree(t,r)})),n.updateCombo(o)}else this.targets.map((function(t){t.getModel().comboId&&n.updateComboTree(t)}));n.emit("dragnodeend",{items:this.targets,targetItem:e})}}},onDragEnter:function(t){var e=t.item;if(this.validationCombo(e)){var n=this.graph;this.comboActiveState&&n.setItemState(e,this.comboActiveState,!0)}},onDragLeave:function(t){var e=t.item;if(this.validationCombo(e)){var n=this.graph;this.comboActiveState&&n.setItemState(e,this.comboActiveState,!1)}},updatePositions:function(t,e){var n=this;this.targets&&0!==this.targets.length&&(this.get("enableDelegate")?this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos}):e||this.targets.map((function(e){return n.update(e,t)})):this.targets.map((function(r){return n.update(r,t,e)})))},update:function(t,e,n){var r=this.origin,i=t.get("model"),o=t.get("id");this.point[o]||(this.point[o]={x:i.x||0,y:i.y||0});var a=e.x-r.x+this.point[o].x,s=e.y-r.y+this.point[o].y;n&&(a+=r.x-e.x,s+=r.y-e.y);var u={x:a,y:s};this.get("updateEdge")?this.graph.updateItem(t,u,!1):t.updatePosition(u)},debounceUpdate:Object(v.debounce)((function(t){var e=t.targets,n=t.graph,r=t.point,i=t.origin,o=t.evt,a=t.updateEdge,s=t.onlyChangeComboSize,u=t.updateParentCombos;e.map((function(t){var e=t.get("model"),s=t.get("id");r[s]||(r[s]={x:e.x||0,y:e.y||0});var u={x:o.x-i.x+r[s].x,y:o.y-i.y+r[s].y};a?n.updateItem(t,u,!1):t.updatePosition(u)})),s&&u(n,e)}),50,!0),updateDelegate:function(t){var e=this.graph;if(this.delegateRect){var n=t.x-this.origin.x+this.originPoint.minX,r=t.y-this.origin.y+this.originPoint.minY;this.delegateRect.attr({x:n,y:r})}else{var i=e.get("group"),o=Object(v.deepMix)({},Wr.delegateStyle,this.delegateStyle),a=this.calculationGroupPosition(t),s=a.x,u=a.y,c=a.width,l=a.height,f=a.minX,h=a.minY;this.originPoint={x:s,y:u,width:c,height:l,minX:f,minY:h},this.delegateRect=i.addShape("rect",{attrs:Object(g.__assign)({width:c,height:l,x:s,y:u},o),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(t){var e=this.targets;0===e.length&&e.push(t.item);for(var n=1/0,r=-1/0,i=1/0,o=-1/0,a=0;ar&&(r=l),f>o&&(o=f)}return{x:Math.floor(n),y:Math.floor(i),width:Math.ceil(r)-Math.floor(n),height:Math.ceil(o)-Math.floor(i),minX:n,minY:i}},updateParentCombos:function(t,e){var n=t||this.graph,r=e||this.targets,i={};null==r||r.forEach((function(t){var e=t.getModel().comboId;e&&(i[e]=n.findById(e))})),Object.values(i).forEach((function(t){t&&n.updateCombo(t)}))}},Du={getDefaultCfg:function(){return{trigger:"mouseenter",activeState:"active",inactiveState:"inactive",resetSelected:!1,shouldUpdate:function(){return!0}}},getEvents:function(){return"mouseenter"===this.get("trigger")?{"node:mouseenter":"setAllItemStates","combo:mouseenter":"setAllItemStates","node:mouseleave":"clearActiveState","combo:mouseleave":"clearActiveState"}:{"node:click":"setAllItemStates","combo:click":"setAllItemStates","canvas:click":"clearActiveState","node:touchstart":"setOnTouchStart","combo:touchstart":"setOnTouchStart","canvas:touchstart":"clearOnTouchStart"}},setOnTouchStart:function(t){try{var e=t.originalEvent.touches,n=e[0],r=e[1];if(n&&r)return;t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.setAllItemStates(t)},clearOnTouchStart:function(t){try{var e=t.originalEvent.touches,n=e[0],r=e[1];if(n&&r)return;t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.clearActiveState(t)},setAllItemStates:function(t){clearTimeout(this.timer),this.throttleSetAllItemStates(t,this)},clearActiveState:function(t){var e=this;this.timer=setTimeout((function(){e.throttleClearActiveState(t,e)}),50)},throttleSetAllItemStates:Object(v.throttle)((function(t,e){var n=t.item,r=e.graph;if(r&&!r.destroyed&&(e.item=n,e.shouldUpdate(t.item,{event:t,action:"activate"},e))){for(var i=e.activeState,o=e.inactiveState,a=r.getNodes(),s=r.getCombos(),u=r.getEdges(),c=r.get("vedges"),l=a.length,f=s.length,h=u.length,d=c.length,p=e.inactiveItems||{},g=e.activeItems||{},v=0;v-1||(this.trigger="shift",console.warn("Behavior brush-select 鐨� trigger 鍙傛暟涓嶅悎娉曪紝璇疯緭鍏� 'drag'銆�'shift'銆�'ctrl' 鎴� 'alt'")),"drag"===this.trigger?{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates"}:{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates",keyup:"onKeyUp",keydown:"onKeyDown"}},onMouseDown:function(t){var e=t.item,n=this.brush;e||("drag"===this.trigger||this.keydown)&&(this.selectedNodes&&0!==this.selectedNodes.length&&this.clearStates(),n||(n=this.createBrush()),this.originPoint={x:t.canvasX,y:t.canvasY},n.attr({width:0,height:0}),n.show(),this.dragging=!0)},onMouseMove:function(t){this.dragging&&("drag"===this.trigger||this.keydown)&&this.updateBrush(t)},onMouseUp:function(t){this.graph;(this.brush||this.dragging)&&("drag"===this.trigger||this.keydown)&&(this.brush.remove(!0),this.brush=null,this.getSelectedNodes(t),this.dragging=!1)},clearStates:function(){var t=this.graph,e=this.selectedState,n=t.findAllByState("node",e),r=t.findAllByState("edge",e),i=t.findAllByState("combo",e);n.forEach((function(n){return t.setItemState(n,e,!1)})),r.forEach((function(n){return t.setItemState(n,e,!1)})),i.forEach((function(n){return t.setItemState(n,e,!1)})),this.selectedNodes=[],this.selectedEdges=[],this.selectedCombos=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges,this.selectedCombos),t.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})},isBBoxCenterInRect:function(t,e,n,r,i){var o=t.getBBox();return o.centerX>=e&&o.centerX<=n&&o.centerY>=r&&o.centerY<=i},getSelectedNodes:function(t){var e=this,n=this.graph,r=this.originPoint,i=this.shouldUpdate,o=this.isBBoxCenterInRect,a=this.selectedState,s={x:t.x,y:t.y},u=n.getPointByCanvas(r.x,r.y),c=Lu(s.x,u.x),l=Ru(s.x,u.x),f=Lu(s.y,u.y),h=Ru(s.y,u.y),d=[],p=[];n.getNodes().forEach((function(t){if(t.isVisible()&&o(t,c,l,f,h)&&i(t,"select",e)){d.push(t);var r=t.getModel();p.push(r.id),n.setItemState(t,a,!0)}}));var g=[];this.includeEdges&&d.forEach((function(t){t.getOutEdges().forEach((function(t){if(t.isVisible()){var r=t.getModel(),o=r.source,a=r.target;p.includes(o)&&p.includes(a)&&i(t,"select",e)&&(g.push(t),n.setItemState(t,e.selectedState,!0))}}))}));var v=[];this.includeCombos&&n.getCombos().forEach((function(t){if(t.isVisible()&&o(t,c,l,f,h)&&i(t,"select",e)){v.push(t);var r=t.getModel();p.push(r.id),n.setItemState(t,a,!0)}})),this.selectedEdges=g,this.selectedNodes=d,this.selectedCombos=v,this.onSelect&&this.onSelect(d,g,v),n.emit("nodeselectchange",{selectedItems:{nodes:d,edges:g,combos:v},select:!0})},createBrush:function(){var t=this.graph.get("canvas").addShape("rect",{attrs:this.brushStyle,capture:!1,name:"brush-shape"});return this.brush=t,this.delegate=t,t},updateBrush:function(t){var e=this.originPoint;this.brush.attr({width:Bu(t.canvasX-e.x),height:Bu(t.canvasY-e.y),x:Lu(t.canvasX,e.x),y:Lu(t.canvasY,e.y)})},onKeyDown:function(t){var e=t.key;if(e){var n=this.trigger.toLowerCase(),r=e.toLowerCase();this.keydown=r===n||"control"===r&&"ctrl"===n||"ctrl"===r&&"control"===n}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.keydown=!1}},Gu=["shift","ctrl","alt","control"],Yu={getDefaultCfg:function(){return{multiple:!0,trigger:"shift",selectedState:"selected",selectNode:!0,selectEdge:!1,selectCombo:!0}},getEvents:function(){return Gu.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="shift",console.warn("Behavior click-select 鐨� trigger 鍙傛暟涓嶅悎娉曪紝璇疯緭鍏� 'drag'銆�'shift'銆�'ctrl' 鎴� 'alt'")),this.multiple?{"node:click":"onClick","combo:click":"onClick","edge:click":"onClick","canvas:click":"onCanvasClick",keyup:"onKeyUp",keydown:"onKeyDown"}:{"node:click":"onClick","combo:click":"onClick","edge:click":"onClick","canvas:click":"onCanvasClick"}},onClick:function(t){var e=this,n=t.item;if(n&&!n.destroyed){var r=n.getType(),i=e.graph,o=e.keydown,a=e.multiple,s=e.shouldUpdate;if((0,e.shouldBegin)(t,e)){if(!o||!a){var u=i.findAllByState("node",e.selectedState).concat(i.findAllByState("edge",e.selectedState)).concat(i.findAllByState("combo",e.selectedState));Object(v.each)(u,(function(t){t!==n&&i.setItemState(t,e.selectedState,!1)}))}if(function(){switch(r){case"node":return e.selectNode;case"edge":return e.selectEdge;case"combo":return e.selectCombo;default:return!1}}())if(n.hasState(e.selectedState)){s(t,e)&&i.setItemState(n,e.selectedState,!1);c=i.findAllByState("node",e.selectedState),l=i.findAllByState("edge",e.selectedState),f=i.findAllByState("combo",e.selectedState);i.emit("nodeselectchange",{target:n,selectedItems:{nodes:c,edges:l,combos:f},select:!1})}else{s(t,e)&&i.setItemState(n,e.selectedState,!0);c=i.findAllByState("node",e.selectedState),l=i.findAllByState("edge",e.selectedState),f=i.findAllByState("combo",e.selectedState);i.emit("nodeselectchange",{target:n,selectedItems:{nodes:c,edges:l,combos:f},select:!0})}else{var c=i.findAllByState("node",e.selectedState),l=i.findAllByState("edge",e.selectedState),f=i.findAllByState("combo",e.selectedState);i.emit("nodeselectchange",{selectedItems:{nodes:c,edges:l,combos:f},select:!1})}}}},onCanvasClick:function(t){var e=this,n=this.graph;if((0,this.shouldBegin)(t,this)){var r=n.findAllByState("node",this.selectedState);Object(v.each)(r,(function(t){n.setItemState(t,e.selectedState,!1)}));var i=n.findAllByState("edge",this.selectedState);Object(v.each)(i,(function(t){n.setItemState(t,e.selectedState,!1)}));var o=n.findAllByState("combo",this.selectedState);Object(v.each)(o,(function(t){n.setItemState(t,e.selectedState,!1)})),n.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})}},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.trigger.toLowerCase()||"control"===e.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.keydown=!1}},Uu=w.a.transform,Xu={getDefaultCfg:function(){return this.isFireFox="firefox"===li(),{sensitivity:2,minZoom:void 0,maxZoom:void 0,enableOptimize:!1,optimizeZoom:.1,fixSelectedItems:{fixAll:!1,fixLineWidth:!1,fixLabel:!1,fixState:"selected"},animate:!1,animateCfg:{duration:500}}},getEvents:function(){var t=this.fixSelectedItems;return t.fixState||(t.fixState="selected"),t.fixAll&&(t.fixLineWidth=!0,t.fixLabel=!0),{wheel:"onWheel",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd"}},onTouchStart:function(t){var e=t.originalEvent.touches,n=e[0],r=e[1];t.preventDefault(),r&&(this.shouldBegin&&!this.shouldBegin(t,this)||(this.startPoint={pageX:n.pageX,pageY:n.pageY},this.moveable=!0,r&&(this.endPoint={pageX:r.pageX,pageY:r.pageY}),this.originScale=this.graph.getZoom()||this.currentScale||1))},onTouchMove:function(t){if(this.moveable){t.preventDefault();var e=t.originalEvent.touches,n=e[0],r=e[1];if(r){this.endPoint||(this.endPoint={pageX:r.pageX,pageY:r.pageY});var i=function(t,e){return Math.hypot(e.x-t.x,e.y-t.y)},o=i({x:n.pageX,y:n.pageY},{x:r.pageX,y:r.pageY})/i({x:this.startPoint.pageX,y:this.startPoint.pageY},{x:this.endPoint.pageX,y:this.endPoint.pageY}),a=this.originScale*o;this.currentScale=a;var s=this.get("minZoom")||this.graph.get("minZoom");if(!(a>(this.get("maxZoom")||this.graph.get("maxZoom"))||a0||t.wheelDelta<0?1-.05*o:1/(1-.05*o):t.wheelDelta<0?1-.05*o:1/(1-.05*o));var u=this.get("minZoom")||n.get("minZoom"),c=this.get("maxZoom")||n.get("maxZoom");if(s>c?s=c:sn/2?u-=l.width:u+=this.offset,c>r/2?c-=l.height:c+=this.offset;var f="".concat(u,"px"),h="".concat(c,"px");qr(this.container,{left:f,top:h,visibility:"visible"})}else qr(i,{visibility:"hidden"})},createTooltip:function(t){var e=t.get("el");e.style.position="relative";var n=Hr('
    '));return e.parentNode.appendChild(n),qr(n,{position:"absolute",visibility:"visible"}),this.width=t.get("width"),this.height=t.get("height"),this.container=n,this.graph.get("tooltips").push(n),n}},Vu=Object(g.__assign)({getDefaultCfg:function(){return{item:"node",offset:12,formatText:function(t){return t.label}}},getEvents:function(){return{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},Wu),Hu=Object(g.__assign)({getDefaultCfg:function(){return{item:"edge",offset:12,formatText:function(t){return"source: ".concat(t.source," target: ").concat(t.target)}}},getEvents:function(){return{"edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},Wu),qu=["click","dblclick"],Zu={getDefaultCfg:function(){return{trigger:"click",onChange:function(){}}},getEvents:function(){var t,e;return qu.includes(this.trigger)?e=this.trigger:(e="click",console.warn("Behavior collapse-expand 鐨� trigger 鍙傛暟涓嶅悎娉曪紝璇疯緭鍏� 'click' 鎴� 'dblclick'")),(t={})["node:".concat(e)]="onNodeClick",t.touchstart="onNodeClick",t},onNodeClick:function(t){var e=this;if("click"===this.trigger){if(this.timer)return clearTimeout(this.timer),void(this.timer=0);this.timer=setTimeout((function(){e.toggle(t),clearTimeout(e.timer),e.timer=0}),200)}else this.toggle(t)},toggle:function(t){var e=t.item;if(e){var n=this.graph.findDataById(e.get("id"));if(n){var r=n.children;if(r&&0!==r.length){var i=!n.collapsed;this.shouldBegin(t,i,this)&&(n.collapsed=i,e.getModel().collapsed=i,this.graph.emit("itemcollapsed",{item:t.item,collapsed:i}),this.shouldUpdate(t,i,this)&&(this.onChange(e,i,this),this.graph.layout()))}}}}},Ku=fi.calculationItemsBBox,Qu={getDefaultCfg:function(){return{enableDelegate:!1,delegateStyle:{},onlyChangeComboSize:!1,activeState:"",selectedState:"selected",enableStack:!0}},getEvents:function(){return{"combo:mousedown":"onMouseDown","combo:dragstart":"onDragStart","combo:drag":"onDrag","combo:dragend":"onDragEnd","combo:drop":"onDrop","node:drop":"onNodeDrop","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave"}},validationCombo:function(t){var e=t.item;return!(!e||e.destroyed)&&(!!this.shouldUpdate(t,this)&&"combo"===e.getType())},onMouseDown:function(t){this.origin={x:t.x,y:t.y}},onDragStart:function(t){var e=this,n=this.graph,r=t.item;if(this.currentShouldEnd=!0,this.validationCombo(t)){this.targets=[];var i=n.findAllByState("combo",this.selectedState),o=r.get("id");0===i.filter((function(t){var e=t.get("id");return o===e})).length?this.targets.push(r):this.targets=i;var a=[];this.targets.forEach((function(t){var e=t.getModel(),n=e.x,r=e.y,i=e.id;a.push({x:n,y:r,id:i})})),this.set("beforeDragItems",a),this.activeState&&this.targets.map((function(t){var r=t.getModel();if(r.parentId){var i=n.findById(r.parentId);i&&n.setItemState(i,e.activeState,!0)}})),this.point={},this.originPoint={},this.currentItemChildCombos=[],function t(e,n){if(!1!==n(e)&&e){var r=e.get("combos");if(0===r.length)return!1;Object(v.each)(r,(function(e){t(e,n)}))}}(r,(function(t){if(t.destroyed)return!1;var n=t.getModel();return e.currentItemChildCombos.push(n.id),!0}))}},onDrag:function(t){var e=this;if(this.origin&&this.validationCombo(t))if(this.enableDelegate)this.updateDelegate(t);else{if(this.activeState){var n=this.graph,r=t.item,i=r.getModel(),o=n.getCombos(),a=r.getBBox(),s=a.centerX,u=a.centerY,c=a.width;o.filter((function(t){var n=t.getModel();return i.parentId,n.id!==i.id&&!e.currentItemChildCombos.includes(n.id)})).map((function(t){var r=t.getBBox(),i=r.centerX,o=r.centerY,a=r.width,l=s-i,f=u-o,h=2*Math.sqrt(l*l+f*f);c+a-h>.8*c?n.setItemState(t,e.activeState,!0):n.setItemState(t,e.activeState,!1)}))}Object(v.each)(this.targets,(function(n){e.updateCombo(n,t)})),this.onlyChangeComboSize&&this.updateParentCombos()}},updatePositions:function(t,e){var n=this;(this.enableDelegate||e)&&Object(v.each)(this.targets,(function(r){n.updateCombo(r,t,e)}))},onDrop:function(t){var e=this,n=t.item;if(this.currentShouldEnd=this.shouldEnd(t,n,this),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd&&n&&this.targets&&!n.destroyed){var r=this.graph,i=n.getModel();this.targets.map((function(t){t.getModel().parentId!==i.id?(e.activeState&&r.setItemState(n,e.activeState,!1),e.onlyChangeComboSize?r.updateCombo(t):r.updateComboTree(t,i.id,!1)):r.updateCombo(n)})),this.end(n,t),this.endComparison=!0}},onNodeDrop:function(t){var e=this;if(this.targets&&0!==this.targets.length){var n=this.graph,r=t.item.getModel().comboId,i=r?n.findById(r):void 0;if(this.currentShouldEnd=this.shouldEnd(t,i,this),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd){var o;if(r){if(this.activeState){var a=n.findById(r);n.setItemState(a,this.activeState,!1)}this.targets.map((function(t){e.onlyChangeComboSize?n.updateCombo(t):r!==t.getID()&&(o=n.findById(r),r!==t.getModel().parentId&&n.updateComboTree(t,r,!1))}))}else this.targets.map((function(t){e.onlyChangeComboSize?n.updateCombo(t):t.getModel().comboId&&n.updateComboTree(t,void 0,!1)}));this.endComparison=!0,this.end(o,t)}}},onDragEnter:function(t){if(this.origin&&this.validationCombo(t)){var e=t.item,n=this.graph;this.activeState&&n.setItemState(e,this.activeState,!0)}},onDragLeave:function(t){if(this.origin&&this.validationCombo(t)){var e=t.item,n=this.graph;this.activeState&&n.setItemState(e,this.activeState,!1)}},onDragEnd:function(t){if(this.targets&&0!==this.targets.length){var e=t.item;this.currentShouldEnd&&this.updatePositions(t);var n=this.getParentCombo(e.getModel().parentId),r=this.graph;n&&this.activeState&&r.setItemState(n,this.activeState,!1),this.end(void 0,t)}},end:function(t,e){var n=this;if(this.origin){var r=this.graph;if(this.delegateShape)r.get("delegateGroup").clear(),this.delegateShape=null;if(t&&this.activeState&&r.setItemState(t,this.activeState,!1),!t){var i=r.get("enabledStack")&&this.enableStack,o={before:{nodes:[],edges:[],combos:[].concat(this.get("beforeDragItems"))},after:{nodes:[],edges:[],combos:[]}};this.targets.map((function(t){if(n.onlyChangeComboSize){r.updateCombo(t);var e=t.getModel(),a=e.x,s=e.y,u=e.id;o.after.combos.push({x:a,y:s,id:u}),r.pushStack("update",o)}else r.updateComboTree(t,void 0,i)}))}this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(t,e,n){var r=this;if(void 0===n&&(n={}),!1!==e(t,n)&&t){var i=t.get("combos");Object(v.each)(i,(function(t){r.traverse(t,e,n)}));var o=t.get("nodes");Object(v.each)(o,(function(t){r.traverse(t,e,n)}))}},updateCombo:function(t,e,n){this.updateSingleItem(t,e,n);var r={};this.traverse(t,(function(t,e){return!t.destroyed&&(t.getEdges().forEach((function(t){return e[t.getID()]=t})),!0)}),r),Object.values(r).forEach((function(t){return t.refresh()}))},updateSingleItem:function(t,e,n){var r=this.origin,i=this.graph,o=t.getModel(),a=t.get("id");this.point[a]||(this.point[a]={x:o.x,y:o.y});var s=e.x-r.x+this.point[a].x,u=e.y-r.y+this.point[a].y;n&&(s+=r.x-e.x,u+=r.y-e.y),i.updateItem(t,{x:s,y:u},!1)},getParentCombo:function(t){var e=this.graph;if(t){var n=e.findById(t);if(n)return n}},updateDelegate:function(t){var e=this.graph;if(this.delegateShape){var n=t.x-this.origin.x+this.originPoint.minX,r=t.y-this.origin.y+this.originPoint.minY;this.delegateShape.attr({x:n,y:r})}else{var i=e.get("delegateGroup"),o=null,a=(o=this.targets.length>1?Ku(this.targets):this.targets[0].getBBox()).x,s=o.y,u=o.width,c=o.height,l=o.minX,f=o.minY;this.originPoint={x:a,y:s,width:u,height:c,minX:l,minY:f};var h=Object(g.__assign)(Object(g.__assign)({},Wr.delegateStyle),this.delegateStyle);this.delegateShape=i.addShape("rect",{attrs:Object(g.__assign)({width:o.width,height:o.height,x:o.x,y:o.y},h),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}},updateParentCombos:function(){var t=this.graph,e=this.targets,n={};null==e||e.forEach((function(e){var r=e.getModel().parentId;r&&(n[r]=t.findById(r))})),Object.values(n).forEach((function(e){e&&t.updateCombo(e)}))}},$u=["click","dblclick"],Ju={getDefaultCfg:function(){return{trigger:"dblclick",relayout:!0}},getEvents:function(){var t,e;return $u.includes(this.trigger)?e=this.trigger:(e="dblclick",console.warn("Behavior collapse-expand-group 鐨� trigger 鍙傛暟涓嶅悎娉曪紝璇疯緭鍏� 'click' 鎴� 'dblclick'")),(t={})["combo:".concat(e)]="onComboClick",t},onComboClick:function(t){var e=t.item,n=this.graph,r=this.relayout;if(e&&!e.destroyed&&"combo"===e.getType()){var i=e.getModel().id;i&&(n.collapseExpandCombo(i),r&&n.get("layout")?n.layout():n.refreshPositions())}}},tc=fi.isPolygonsIntersect,ec=fi.pathToPoints,nc=["drag","shift","ctrl","alt","control"],rc=["click","drag"],ic=["shift","ctrl","control","alt","meta",void 0],oc=["shift","ctrl","alt","control"],ac=["shift","ctrl","alt","control","meta"],sc={"drag-canvas":Nu,"zoom-canvas":Xu,"drag-node":Pu,"activate-relations":Du,"brush-select":zu,"click-select":Yu,"lasso-select":{getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:"shift",includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return nc.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="shift",console.warn("Behavior lasso-select 鐨� trigger 鍙傛暟涓嶅悎娉曪紝璇疯緭鍏� 'drag'銆�'shift'銆�'ctrl' 鎴� 'alt'")),"drag"===this.trigger?{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd","canvas:click":"clearStates"}:{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd",keyup:"onKeyUp",keydown:"onKeyDown","canvas:click":"clearStates"}},onDragStart:function(t){var e=this.lasso;t.item||("drag"===this.trigger||this.keydown)&&(this.selectedNodes&&0!==this.selectedNodes.length&&this.clearStates("dragstart"),e||(e=this.createLasso()),this.dragging=!0,this.originPoint={x:t.x,y:t.y},this.points.push(this.originPoint),e.show())},onDragMove:function(t){this.dragging&&("drag"===this.trigger||this.keydown)&&(this.points.push({x:t.x,y:t.y}),this.updateLasso(t))},onDragEnd:function(t){(this.lasso||this.dragging)&&("drag"===this.trigger||this.keydown)&&(this.points.push(this.originPoint),this.getSelectedItems(),this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1)},getLassoPath:function(){var t=this.points,e=[];return t.length&&(t.forEach((function(t,n){0===n?e.push(["M",t.x,t.y]):e.push(["L",t.x,t.y])})),e.push(["L",t[0].x,t[0].y])),e},clearStates:function(t){void 0===t&&(t="canvas:click");var e=this.graph,n=this.selectedState,r=this.shouldDeselect,i=e.findAllByState("node",n),o=e.findAllByState("edge",n);r&&!r({action:t,nodes:i,edges:o})||(i.forEach((function(t){return e.setItemState(t,n,!1)})),o.forEach((function(t){return e.setItemState(t,n,!1)}))),this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),this.selectedNodes=[],this.selectedEdges=[],e.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedItems:function(){var t=this,e=this.graph,n=this.shouldUpdate,r=this.points.map((function(t){return[e.getCanvasByPoint(t.x,t.y).x,e.getCanvasByPoint(t.x,t.y).y]})),i=this.selectedState,o=[],a=[];e.getNodes().forEach((function(s){if(s.isVisible()&&function(t,e){var n,r=t.getKeyShape();if("path"===t.get("type"))n=ec(r.attr("path"));else{var i=r.getCanvasBBox();n=[[i.minX,i.minY],[i.maxX,i.minY],[i.maxX,i.maxY],[i.minX,i.maxY]]}return tc(e,n)}(s,r)&&n(s,"select",t)){o.push(s);var u=s.getModel();a.push(u.id),e.setItemState(s,i,!0)}}));var s=[];this.includeEdges&&o.forEach((function(r){r.getOutEdges().forEach((function(r){if(r.isVisible()){var i=r.getModel(),o=i.source,u=i.target;a.includes(o)&&a.includes(u)&&n(r,"select",t)&&(s.push(r),e.setItemState(r,t.selectedState,!0))}}))})),this.selectedEdges=s,this.selectedNodes=o,this.onSelect&&this.onSelect(o,s),e.emit("nodeselectchange",{selectedItems:{nodes:o,edges:s},select:!0})},createLasso:function(){var t=this.graph.get("delegateGroup").addShape("path",{attrs:Object(g.__assign)({path:[]},this.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=t,this.delegate=t,this.points=[],t},updateLasso:function(t){this.lasso.attr({path:this.getLassoPath()})},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.trigger.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.lasso&&(this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1),this.keydown=!1}},tooltip:Vu,"edge-tooltip":Hu,"collapse-expand":Zu,"drag-combo":Qu,"collapse-expand-combo":Ju,"create-edge":{getDefaultCfg:function(){return{trigger:"click",key:void 0,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var t;return rc.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="click",console.warn("Behavior create-edge 鐨� trigger 鍙傛暟涓嶅悎娉曪紝璇疯緭鍏� 'click'锛�'drag'")),this.key&&-1===ic.indexOf(this.key.toLowerCase())&&(this.trigger=void 0,console.warn("Behavior create-edge 鐨� key 鍙傛暟涓嶅悎娉曪紝璇疯緭鍏� 'shift'锛�'ctrl'锛�'alt'锛�'control'锛屾垨 undefined")),"drag"===this.trigger?t={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:"click"===this.trigger&&(t={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),this.key&&(t.keydown="onKeyDown",t.keyup="onKeyUp"),t},onDragEnd:function(t){if(!this.key||this.keydown){var e=t.item;e&&e.getID()!==this.source&&"node"===e.getType()||this.cancelCreating({item:this.edge,x:t.x,y:t.y})}},onClick:function(t){if(!this.key||this.keydown){var e=t.item,n=this.graph,r=e.getModel(),i=this.getEdgeConfig;if(this.addingEdge&&this.edge){if(!this.shouldEnd(t,this))return;var o=void 0;o=i&&Object(v.isFunction)(i)?i({source:this.source,target:r.id},this):this.edgeConfig;var a=Object(g.__assign)({target:r.id},o);if(this.source===r.id&&(a.type="loop"),n.emit("beforecreateedge",{}),n.updateItem(this.edge,a,!1),n.get("enabledStack")){var s=Object(g.__assign)(Object(g.__assign)({},this.edge.getModel()),{itemType:"edge"}),u={};u.edges=[s],n.pushStack("add",{before:{},after:u})}n.emit("aftercreateedge",{edge:this.edge}),this.edge.getKeyShape().set("capture",!0),this.edge=null,this.addingEdge=!1}else{if(!this.shouldBegin(t,this))return;o=void 0;o=i&&Object(v.isFunction)(i)?i({source:r.id,target:r.id},this):this.edgeConfig,this.edge=n.addItem("edge",Object(g.__assign)({source:r.id,target:r.id},o),!1),this.source=r.id,this.addingEdge=!0,this.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(t){if(!this.key||this.keydown){this.edge&&this.edge.destroyed&&this.cancelCreating({item:this.edge});var e={x:t.x,y:t.y};this.graph.findById(this.source)?this.addingEdge&&this.edge&&this.graph.updateItem(this.edge,{target:e},!1):this.addingEdge=!1}},cancelCreating:function(t){var e,n;if(!this.key||this.keydown){var r=this.graph,i=t.item;return this.addingEdge&&(this.edge===i||(null===(n=null===(e=t.target)||void 0===e?void 0:e.isCanvas)||void 0===n?void 0:n.call(e)))?(this.edge&&!this.edge.destroyed&&r.removeItem(this.edge,!1),this.edge=null,void(this.addingEdge=!1)):void 0}},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.key.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.addingEdge&&this.edge&&(this.graph.removeItem(this.edge,!1),this.addingEdge=!1,this.edge=null),this.keydown=!1}},"shortcuts-call":{getDefaultCfg:function(){return{trigger:"ctrl",combinedKey:"1",functionName:"fitView",functionParams:[]}},getEvents:function(){return oc.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="ctrl",console.warn("Behavior shortcuts-fit-view 鐨� trigger 鍙傛暟 '".concat(this.trigger,"' 涓嶅悎娉曪紝璇疯緭鍏� 'drag'銆�'shift'銆�'ctrl' 鎴� 'alt'"))),this.combinedKey===this.trigger&&(this.combinedKey=void 0),{keyup:"onKeyUp",keydown:"onKeyDown"}},onKeyDown:function(t){var e=t.key;if(e){var n=this.trigger.toLowerCase(),r=e.toLowerCase();this.triggerKeydown||(this.triggerKeydown=r===n||"control"===r&&"ctrl"===n||"ctrl"===r&&"control"===n);var i=this.graph;if(!i[this.functionName])return console.warn("Behavior shortcuts-fit-view 鐨� functionName 鍙傛暟 '".concat(this.functionName,"' 涓嶅悎娉曪紝瀹冧笉鏄� Graph 鐨勪竴涓嚱鏁板悕")),{};if(!this.triggerKeydown||this.combinedKey){var o=this.combinedKey.toLowerCase();this.triggerKeydown&&(r===o||"control"===r&&"ctrl"===o||"ctrl"===r&&"control"===o)&&(this.functionParams&&this.functionParams.length?i[this.functionName].apply(i,this.functionParams):i[this.functionName]())}else this.functionParams&&this.functionParams.length?i[this.functionName].apply(i,this.functionParams):i[this.functionName]()}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.triggerKeydown=!1}},"scroll-canvas":{getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0,allowDragOnItem:!0}},getEvents:function(){return this.zoomKey&&-1!==ac.indexOf(this.zoomKey)||(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(t){var e=this;if(this.allowDrag(t)){var n=this.graph,r=Array.isArray(this.zoomKey)?[].concat(this.zoomKey):[this.zoomKey];if(r.includes("control")&&r.push("ctrl"),r.some((function(e){return t["".concat(e,"Key")]}))){var i=n.get("canvas").getPointByClient(t.clientX,t.clientY),o=n.getZoom();t.wheelDelta>0?o+=.05*o:o-=.05*o,n.zoomTo(o,{x:i.x,y:i.y})}else{var a=t.deltaX||t.movementX,s=t.deltaY||t.movementY;!s&&navigator.userAgent.indexOf("Firefox")>-1&&(s=125*-t.wheelDelta/3);var u=this.graph.get("width"),c=this.graph.get("height"),l=this.graph.get("canvas").getCanvasBBox(),f=this.scalableRange,h=this.scalableRange;f<1&&f>-1&&(f*=u,h*=c);var d=l.minX,p=l.maxX,g=l.minY,v=l.maxY;a>0?p<-f?a=0:p-a<-f&&(a=p+f):a<0&&(d>u+f?a=0:d-a>u+f&&(a=d-(u+f))),s>0?v<-h?s=0:v-s<-h&&(s=v+h):s<0&&(g>c+h?s=0:g-s>c+h&&(s=g-(c+h))),"x"===this.get("direction")?s=0:"y"===this.get("direction")&&(a=0),n.translate(-a,-s)}if(t.preventDefault(),this.get("enableOptimize")){var y=this.get("optimizeZoom"),m=this.get("optimized"),b=n.getNodes(),x=n.getEdges(),w=b.length,_=x.length;if(!m){for(var E=0;E