@gkd-kit/inspect 0.0.1734183276724 → 0.0.1734266056335
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-C4GDiKVM.js +25 -0
- package/dist/assets/{ActionCard.vue_vue_type_script_setup_true_lang-Cx9MxARB.js.map → ActionCard.vue_vue_type_script_setup_true_lang-C4GDiKVM.js.map} +1 -1
- package/dist/assets/{DevicePage-BgoiAa0w.js → DevicePage-BIwpMgjL.js} +3 -3
- package/dist/assets/{DevicePage-BgoiAa0w.js.map → DevicePage-BIwpMgjL.js.map} +1 -1
- package/dist/assets/{HomePage-B1AWqOKl.js → HomePage-6pbbXVox.js} +3 -3
- package/dist/assets/{HomePage-B1AWqOKl.js.map → HomePage-6pbbXVox.js.map} +1 -1
- package/dist/assets/ImportPage-pprILn6B.js +2 -0
- package/dist/assets/{ImportPage-waFz1gnB.js.map → ImportPage-pprILn6B.js.map} +1 -1
- package/dist/assets/{SelectorPage-BETjRvhr.js → SelectorPage-ftaQbixd.js} +2 -2
- package/dist/assets/{SelectorPage-BETjRvhr.js.map → SelectorPage-ftaQbixd.js.map} +1 -1
- package/dist/assets/SnapshotPage-BpCWU2Lq.js +277 -0
- package/dist/assets/SnapshotPage-BpCWU2Lq.js.map +1 -0
- package/dist/assets/TrackGraph-pCILQKep.js +670 -0
- package/dist/assets/{TrackGraph-Cb4XqKyq.js.map → TrackGraph-pCILQKep.js.map} +1 -1
- package/dist/assets/_404Page-CtIlnfyk.js +2 -0
- package/dist/assets/{_404Page-C3M4kvSQ.js.map → _404Page-CtIlnfyk.js.map} +1 -1
- package/dist/assets/chunk-B7h9CrOT.js +3 -0
- package/dist/assets/chunk-B7h9CrOT.js.map +1 -0
- package/dist/assets/dayjs.min-NDdrP0U0.js +629 -0
- package/dist/assets/dayjs.min-NDdrP0U0.js.map +1 -0
- package/dist/assets/{error-CZ84ft92.js → error-BuWiIPq5.js} +2 -2
- package/dist/assets/{error-CZ84ft92.js.map → error-BuWiIPq5.js.map} +1 -1
- package/dist/assets/{import-B14L1kmZ.js → import-iYDGuobE.js} +2 -2
- package/dist/assets/{import-B14L1kmZ.js.map → import-iYDGuobE.js.map} +1 -1
- package/dist/assets/index-D3bLDlEa.js +904 -0
- package/dist/assets/index-D3bLDlEa.js.map +1 -0
- package/dist/assets/{jszip.min-uSOAwpjk.js → jszip.min-5Im3j6i9.js} +4 -4
- package/dist/assets/{jszip.min-uSOAwpjk.js.map → jszip.min-5Im3j6i9.js.map} +1 -1
- package/dist/assets/polyfills-CKx2Tz-c.js +2 -0
- package/dist/assets/polyfills-CKx2Tz-c.js.map +1 -0
- package/dist/assets/{snapshot-B2PB8ROT.js → snapshot-B6z6pf3s.js} +2 -2
- package/dist/assets/snapshot-B6z6pf3s.js.map +1 -0
- package/dist/assets/{table-DQyiFo-B.js → table-CileF2fI.js} +19 -17
- package/dist/assets/table-CileF2fI.js.map +1 -0
- package/dist/index.html +3 -3
- package/package.json +28 -28
- package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-Cx9MxARB.js +0 -25
- package/dist/assets/ImportPage-waFz1gnB.js +0 -2
- package/dist/assets/SnapshotPage-SMsfk7xe.js +0 -277
- package/dist/assets/SnapshotPage-SMsfk7xe.js.map +0 -1
- package/dist/assets/TrackGraph-Cb4XqKyq.js +0 -670
- package/dist/assets/_404Page-C3M4kvSQ.js +0 -2
- package/dist/assets/chunk-DXBlvl95.js +0 -3
- package/dist/assets/chunk-DXBlvl95.js.map +0 -1
- package/dist/assets/dayjs.min-DoBAfbjz.js +0 -628
- package/dist/assets/dayjs.min-DoBAfbjz.js.map +0 -1
- package/dist/assets/index-CarbvpLb.js +0 -904
- package/dist/assets/index-CarbvpLb.js.map +0 -1
- package/dist/assets/polyfills-CO2Y5WYh.js +0 -1
- package/dist/assets/snapshot-B2PB8ROT.js.map +0 -1
- package/dist/assets/table-DQyiFo-B.js.map +0 -1
- /package/dist/assets/{index-CC48p5w9.css → index-Bkz03J5r.css} +0 -0
|
@@ -1,670 +0,0 @@
|
|
|
1
|
-
import{cs as va,cm as pa,b0 as xe,h as M5,m as C5,A as A5,D as T5,ax as xw,H as I5,I as k5}from"./index-CarbvpLb.js";import{a0 as ww}from"./dayjs.min-DoBAfbjz.js";function L5(r,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in r)){const a=Object.getOwnPropertyDescriptor(n,i);a&&Object.defineProperty(r,i,a.get?a:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}const lm=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return Ri},get Circle(){return V7},get Ellipse(){return H7},get Image(){return q7},get Line(){return Z7},get Marker(){return Q7},get Path(){return u1},get Polygon(){return aX},get Polyline(){return oX},get Rect(){return fX},get Text(){return lX}},Symbol.toStringTag,{value:"Module"})),cm=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return mi},get Circle(){return vX},get Dom(){return pX},get Ellipse(){return gX},get Image(){return yX},get Line(){return mX},get Marker(){return bX},get Path(){return xX},get Polygon(){return wX},get Polyline(){return EX},get Rect(){return SX},get Text(){return TX}},Symbol.toStringTag,{value:"Module"}));var _0=function(r,e){return _0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},_0(r,e)};function kt(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");_0(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var B=function(){return B=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},B.apply(this,arguments)};function nn(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function eC(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function tC(r,e){return function(t,n){e(t,n,r)}}function N5(r,e,t,n,i,a){function o(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",f=!e&&r?n.static?r:r.prototype:null,l=e||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),c,h=!1,d=t.length-1;d>=0;d--){var v={};for(var p in n)v[p]=p==="access"?{}:n[p];for(var p in n.access)v.access[p]=n.access[p];v.addInitializer=function(y){if(h)throw new TypeError("Cannot add initializers after decoration has completed");a.push(o(y||null))};var g=(0,t[d])(s==="accessor"?{get:l.get,set:l.set}:l[u],v);if(s==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(c=o(g.get))&&(l.get=c),(c=o(g.set))&&(l.set=c),(c=o(g.init))&&i.unshift(c)}else(c=o(g))&&(s==="field"?i.unshift(c):l[u]=c)}f&&Object.defineProperty(f,n.name,l),h=!0}function O5(r,e,t){for(var n=arguments.length>2,i=0;i<e.length;i++)t=n?e[i].call(r,t):e[i].call(r);return n?t:void 0}function D5(r){return typeof r=="symbol"?r:"".concat(r)}function P5(r,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(r,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}function rC(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function Wn(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(l){try{f(n.next(l))}catch(c){o(c)}}function u(l){try{f(n.throw(l))}catch(c){o(c)}}function f(l){l.done?a(l.value):i(l.value).then(s,u)}f((n=n.apply(r,e||[])).next())})}function Vn(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(f){return function(l){return u([f,l])}}function u(f){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(t=0)),t;)try{if(n=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,i=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){t.label=f[1];break}if(f[0]===6&&t.label<a[1]){t.label=a[1],a=f;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(f);break}a[2]&&t.ops.pop(),t.trys.pop();continue}f=e.call(r,t)}catch(l){f=[6,l],i=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}var dv=Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]};function nC(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&dv(e,r,t)}function md(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function hm(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return a}function iC(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(hm(arguments[e]));return r}function vv(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],o=0,s=a.length;o<s;o++,i++)n[i]=a[o];return n}function Jn(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))}function Lu(r){return this instanceof Lu?(this.v=r,this):new Lu(r)}function aC(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},s("next"),s("throw"),s("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(d){return function(v){return Promise.resolve(v).then(d,c)}}function s(d,v){n[d]&&(i[d]=function(p){return new Promise(function(g,y){a.push([d,p,g,y])>1||u(d,p)})},v&&(i[d]=v(i[d])))}function u(d,v){try{f(n[d](v))}catch(p){h(a[0][3],p)}}function f(d){d.value instanceof Lu?Promise.resolve(d.value.v).then(l,c):h(a[0][2],d)}function l(d){u("next",d)}function c(d){u("throw",d)}function h(d,v){d(v),a.shift(),a.length&&u(a[0][0],a[0][1])}}function oC(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(o){return(t=!t)?{value:Lu(r[i](o)),done:!1}:a?a(o):o}:a}}function sC(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof md=="function"?md(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(s,u){o=r[a](o),i(s,u,o.done,o.value)})}}function i(a,o,s,u){Promise.resolve(u).then(function(f){a({value:f,done:s})},o)}}function uC(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}var R5=Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e};function fC(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&dv(e,r,t);return R5(e,r),e}function lC(r){return r&&r.__esModule?r:{default:r}}function cC(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)}function hC(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t}function dC(r,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?e===r:r.has(e)}function vC(r,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,i;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],t&&(i=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(a){return Promise.reject(a)}}),r.stack.push({value:e,dispose:n,async:t})}else t&&r.stack.push({async:!0});return e}var B5=typeof SuppressedError=="function"?SuppressedError:function(r,e,t){var n=new Error(t);return n.name="SuppressedError",n.error=r,n.suppressed=e,n};function pC(r){function e(n){r.error=r.hasError?new B5(n,r.error,"An error was suppressed during disposal."):n,r.hasError=!0}function t(){for(;r.stack.length;){var n=r.stack.pop();try{var i=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(i).then(t,function(a){return e(a),t()})}catch(a){e(a)}}if(r.hasError)throw r.error}return t()}const F5={__extends:kt,__assign:B,__rest:nn,__decorate:eC,__param:tC,__metadata:rC,__awaiter:Wn,__generator:Vn,__createBinding:dv,__exportStar:nC,__values:md,__read:hm,__spread:iC,__spreadArrays:vv,__spreadArray:Jn,__await:Lu,__asyncGenerator:aC,__asyncDelegator:oC,__asyncValues:sC,__makeTemplateObject:uC,__importStar:fC,__importDefault:lC,__classPrivateFieldGet:cC,__classPrivateFieldSet:hC,__classPrivateFieldIn:dC,__addDisposableResource:vC,__disposeResources:pC},G5=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:vC,get __assign(){return B},__asyncDelegator:oC,__asyncGenerator:aC,__asyncValues:sC,__await:Lu,__awaiter:Wn,__classPrivateFieldGet:cC,__classPrivateFieldIn:dC,__classPrivateFieldSet:hC,__createBinding:dv,__decorate:eC,__disposeResources:pC,__esDecorate:N5,__exportStar:nC,__extends:kt,__generator:Vn,__importDefault:lC,__importStar:fC,__makeTemplateObject:uC,__metadata:rC,__param:tC,__propKey:D5,__read:hm,__rest:nn,__runInitializers:O5,__setFunctionName:P5,__spread:iC,__spreadArray:Jn,__spreadArrays:vv,__values:md,default:F5},Symbol.toStringTag,{value:"Module"}));var Gn=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},bd=function(r,e){return Gn(r)?r.indexOf(e)>-1:!1},pv=function(r,e){if(!Gn(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];e(i,n)&&t.push(i)}return t},z5=function(r,e){return e===void 0&&(e=[]),pv(r,function(t){return!bd(e,t)})},$5={}.toString,Pi=function(r,e){return $5.call(r)==="[object "+e+"]"};const Mr=function(r){return Pi(r,"Function")};var ct=function(r){return r==null};const pt=function(r){return Array.isArray?Array.isArray(r):Pi(r,"Array")},yn=function(r){var e=typeof r;return r!==null&&e==="object"||e==="function"};function me(r,e){if(r){var t;if(pt(r))for(var n=0,i=r.length;n<i&&(t=e(r[n],n),t!==!1);n++);else if(yn(r)){for(var a in r)if(r.hasOwnProperty(a)&&(t=e(r[a],a),t===!1))break}}}var gC=Object.keys?function(r){return Object.keys(r)}:function(r){var e=[];return me(r,function(t,n){Mr(r)&&n==="prototype"||e.push(n)}),e};function yC(r,e){var t=gC(e),n=t.length;if(ct(r))return!n;for(var i=0;i<n;i+=1){var a=t[i];if(e[a]!==r[a]||!(a in r))return!1}return!0}var xd=function(r){return typeof r=="object"&&r!==null},pn=function(r){if(!xd(r)||!Pi(r,"Object"))return!1;if(Object.getPrototypeOf(r)===null)return!0;for(var e=r;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e};function j5(r,e){if(!pt(r))return null;var t;if(Mr(e)&&(t=e),pn(e)&&(t=function(i){return yC(i,e)}),t){for(var n=0;n<r.length;n+=1)if(t(r[n]))return r[n]}return null}function U5(r,e,t){t===void 0&&(t=0);for(var n=t;n<r.length;n++)if(e(r[n],n))return n;return-1}var X5=function(r,e){for(var t=null,n=0;n<r.length;n++){var i=r[n],a=i[e];if(!ct(a)){pt(a)?t=a[0]:t=a;break}}return t},Y5=function(r){if(!pt(r))return[];for(var e=[],t=0;t<r.length;t++)e=e.concat(r[t]);return e},mC=function(r,e){if(e===void 0&&(e=[]),!pt(r))e.push(r);else for(var t=0;t<r.length;t+=1)mC(r[t],e);return e};const ca=function(r){if(pt(r))return r.reduce(function(e,t){return Math.max(e,t)},r[0])},ha=function(r){if(pt(r))return r.reduce(function(e,t){return Math.min(e,t)},r[0])};var bC=function(r){var e=r.filter(function(o){return!isNaN(o)});if(!e.length)return{min:0,max:0};if(pt(r[0])){for(var t=[],n=0;n<r.length;n++)t=t.concat(r[n]);e=t}var i=ca(e),a=ha(e);return{min:a,max:i}},xC=Array.prototype,W5=xC.splice,V5=xC.indexOf,H5=function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n++)for(var i=e[n],a=-1;(a=V5.call(r,i))>-1;)W5.call(r,a,1);return r},q5=Array.prototype.splice,wC=function(e,t){if(!Gn(e))return[];for(var n=e?t.length:0,i=n-1;n--;){var a=void 0,o=t[n];(n===i||o!==a)&&(a=o,q5.call(e,o,1))}return e},EC=function(r,e,t){if(!pt(r)&&!pn(r))return r;var n=t;return me(r,function(i,a){n=e(n,i,a)}),n},Z5=function(r,e){var t=[];if(!Gn(r))return t;for(var n=-1,i=[],a=r.length;++n<a;){var o=r[n];e(o,n,r)&&(t.push(o),i.push(n))}return wC(r,i),t};const Pe=function(r){return Pi(r,"String")};function K5(r,e){var t;if(Mr(e))t=function(i,a){return e(i)-e(a)};else{var n=[];Pe(e)?n.push(e):pt(e)&&(n=e),t=function(i,a){for(var o=0;o<n.length;o+=1){var s=n[o];if(i[s]>a[s])return 1;if(i[s]<a[s])return-1}return 0}}return r.sort(t),r}function gl(r,e){e===void 0&&(e=new Map);var t=[];if(Array.isArray(r))for(var n=0,i=r.length;n<i;n++){var a=r[n];e.has(a)||(t.push(a),e.set(a,!0))}return t}var Q5=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return gl([].concat.apply([],r))};const J5=function(r,e){for(var t=[],n={},i=0;i<r.length;i++){var a=r[i],o=a[e];if(!ct(o)){pt(o)||(o=[o]);for(var s=0;s<o.length;s++){var u=o[s];n[u]||(t.push(u),n[u]=!0)}}}return t};function ua(r){if(Gn(r))return r[0]}function vi(r){if(Gn(r)){var e=r;return e[e.length-1]}}function eR(r,e){return pt(r)||Pe(r)?r[0]===e:!1}function tR(r,e){return pt(r)||Pe(r)?r[r.length-1]===e:!1}var rR=function(r,e){for(var t=0;t<r.length;t++)if(!e(r[t],t))return!1;return!0},nR=function(r,e){for(var t=0;t<r.length;t++)if(e(r[t],t))return!0;return!1},iR=Object.prototype.hasOwnProperty;function wd(r,e){if(!e||!pt(r))return{};for(var t={},n=Mr(e)?e:function(s){return s[e]},i,a=0;a<r.length;a++){var o=r[a];i=n(o),iR.call(t,i)?t[i].push(o):t[i]=[o]}return t}function _C(r,e){if(!e)return{0:r};if(!Mr(e)){var t=pt(e)?e:e.replace(/\s+/g,"").split("*");e=function(n){for(var i="_",a=0,o=t.length;a<o;a++)i+=n[t[a]]&&n[t[a]].toString();return i}}return wd(r,e)}const aR=function(r,e){if(!e)return[r];var t=_C(r,e),n=[];for(var i in t)n.push(t[i]);return n};function oR(r,e){return r["_wrap_"+e]}function cs(r,e){if(r["_wrap_"+e])return r["_wrap_"+e];var t=function(n){r[e](n)};return r["_wrap_"+e]=t,t}var Ew={};function sR(r){var e=Ew[r];if(!e){for(var t=r.toString(16),n=t.length;n<6;n++)t="0"+t;e="#"+t,Ew[r]=e}return e}function uR(r){var e=0,t=0,n=0,i=0;return pt(r)?r.length===1?e=t=n=i=r[0]:r.length===2?(e=n=r[0],t=i=r[1]):r.length===3?(e=r[0],t=i=r[1],n=r[2]):(e=r[0],t=r[1],n=r[2],i=r[3]):e=t=n=i=r,{r1:e,r2:t,r3:n,r4:i}}var fR=function(r,e,t){return r<e?e:r>t?t:r},Vh=function(r,e){var t=e.toString(),n=t.indexOf(".");if(n===-1)return Math.round(r);var i=t.substr(n+1).length;return i>20&&(i=20),parseFloat(r.toFixed(i))},ht=function(r){return Pi(r,"Number")},lR=function(r){return ht(r)&&r%1!==0},cR=function(r){return ht(r)&&r%2===0},hR=Number.isInteger?Number.isInteger:function(r){return ht(r)&&r%1===0},dR=function(r){return ht(r)&&r<0},vR=1e-5;function SC(r,e,t){return t===void 0&&(t=vR),Math.abs(r-e)<t}var pR=function(r){return ht(r)&&r%2!==0},gR=function(r){return ht(r)&&r>0};const yR=function(r,e){if(pt(r)){for(var t,n=-1/0,i=0;i<r.length;i++){var a=r[i],o=Mr(e)?e(a):a[e];o>n&&(t=a,n=o)}return t}},mR=function(r,e){if(pt(r)){for(var t,n=1/0,i=0;i<r.length;i++){var a=r[i],o=Mr(e)?e(a):a[e];o<n&&(t=a,n=o)}return t}};var gv=function(r,e){return(r%e+e)%e},bR=180/Math.PI,xR=function(r){return bR*r};const wR=parseInt;var ER=Math.PI/180,yv=function(r){return ER*r};const _w=function(r,e){return r.hasOwnProperty(e)};var dm=Object.values?function(r){return Object.values(r)}:function(r){var e=[];return me(r,function(t,n){Mr(r)&&n==="prototype"||e.push(t)}),e};const _R=function(r,e){return bd(dm(r),e)},Zu=function(r){return ct(r)?"":r.toString()};var SR=function(r){return Zu(r).toLowerCase()},MR=function(r){var e=Zu(r);return e.charAt(0).toLowerCase()+e.substring(1)};function CR(r,e){return!r||!e?r:r.replace(/\\?\{([^{}]+)\}/g,function(t,n){return t.charAt(0)==="\\"?t.slice(1):e[n]===void 0?"":e[n]})}var AR=function(r){return Zu(r).toUpperCase()},Nu=function(r){var e=Zu(r);return e.charAt(0).toUpperCase()+e.substring(1)},TR={}.toString,MC=function(r){return TR.call(r).replace(/^\[object /,"").replace(/]$/,"")},IR=function(r){return Pi(r,"Arguments")},$l=function(r){return Pi(r,"Boolean")},vm=function(r){return Pi(r,"Date")},kR=function(r){return Pi(r,"Error")};function LR(r){return ht(r)&&isFinite(r)}var NR=function(r){return r===null},OR=Object.prototype,CC=function(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||OR;return r===t},DR=function(r){return Pi(r,"RegExp")},PR=function(r){return r===void 0},RR=function(r){return r instanceof Element||r instanceof HTMLDocument};function AC(r){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,16)};return e(r)}function TC(r){var e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;e(r)}function cg(r,e){for(var t in e)e.hasOwnProperty(t)&&t!=="constructor"&&e[t]!==void 0&&(r[t]=e[t])}function yt(r,e,t,n){return e&&cg(r,e),t&&cg(r,t),n&&cg(r,n),r}var BR=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var t=r[0],n=1;n<r.length;n++){var i=r[n];Mr(i)&&(i=i.prototype),yt(t.prototype,i)}},Vt=function(r){if(typeof r!="object"||r===null)return r;var e;if(pt(r)){e=[];for(var t=0,n=r.length;t<n;t++)typeof r[t]=="object"&&r[t]!=null?e[t]=Vt(r[t]):e[t]=r[t]}else{e={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?e[i]=Vt(r[i]):e[i]=r[i]}return e};function jl(r,e,t){var n;return function(){var i=this,a=arguments,o=function(){n=null,t||r.apply(i,a)},s=t&&!n;clearTimeout(n),n=setTimeout(o,e),s&&r.apply(i,a)}}const IC=function(r,e){if(!Mr(r))throw new TypeError("Expected a function");var t=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=e?e.apply(this,n):n[0],o=t.cache;if(o.has(a))return o.get(a);var s=r.apply(this,n);return o.set(a,s),s};return t.cache=new Map,t};var FR=5;function kC(r,e,t,n){t=t||0,n=n||FR;for(var i in e)if(e.hasOwnProperty(i)){var a=e[i];a!==null&&pn(a)?(pn(r[i])||(r[i]={}),t<n?kC(r[i],a,t+1,n):r[i]=e[i]):pt(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var yr=function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n+=1)kC(r,e[n]);return r},GR=function(r,e,t,n){Mr(e)||(t=e,e=r,r=function(){});var i=Object.create?function(o,s){return Object.create(o,{constructor:{value:s}})}:function(o,s){function u(){}u.prototype=o;var f=new u;return f.constructor=s,f},a=i(e.prototype,r);return r.prototype=yt(a,r.prototype),r.superclass=i(e.prototype,e),yt(a,t),yt(r,n),r},pm=function(r,e){if(!Gn(r))return-1;var t=Array.prototype.indexOf;if(t)return t.call(r,e);for(var n=-1,i=0;i<r.length;i++)if(r[i]===e){n=i;break}return n},zR=Object.prototype.hasOwnProperty;function LC(r){if(ct(r))return!0;if(Gn(r))return!r.length;var e=MC(r);if(e==="Map"||e==="Set")return!r.size;if(CC(r))return!Object.keys(r).length;for(var t in r)if(zR.call(r,t))return!1;return!0}var Mo=function(r,e){if(r===e)return!0;if(!r||!e||Pe(r)||Pe(e))return!1;if(Gn(r)||Gn(e)){if(r.length!==e.length)return!1;for(var t=!0,n=0;n<r.length&&(t=Mo(r[n],e[n]),!!t);n++);return t}if(xd(r)||xd(e)){var i=Object.keys(r),a=Object.keys(e);if(i.length!==a.length)return!1;for(var t=!0,n=0;n<i.length&&(t=Mo(r[i[n]],e[i[n]]),!!t);n++);return t}return!1};const $R=function(r,e,t){return Mr(t)?!!t(r,e):Mo(r,e)};var _s=function(r,e){if(!Gn(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];t.push(e(i,n))}return t},jR=function(r){return r};const UR=function(r,e){e===void 0&&(e=jR);var t={};return yn(r)&&!ct(r)&&Object.keys(r).forEach(function(n){t[n]=e(r[n],n)}),t},Oa=function(r,e,t){for(var n=0,i=Pe(e)?e.split("."):e;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?t:r},XR=function(r,e,t){var n=r,i=Pe(e)?e.split("."):e;return i.forEach(function(a,o){o<i.length-1?(yn(n[a])||(n[a]=ht(i[o+1])?[]:{}),n=n[a]):n[a]=t}),r};var YR=Object.prototype.hasOwnProperty;const WR=function(r,e){if(r===null||!pn(r))return{};var t={};return me(e,function(n){YR.call(r,n)&&(t[n]=r[n])}),t},VR=function(r,e){return EC(r,function(t,n,i){return e.includes(i)||(t[i]=n),t},{})},yl=function(r,e,t){var n,i,a,o,s=0;t||(t={});var u=function(){s=t.leading===!1?0:Date.now(),n=null,o=r.apply(i,a),n||(i=a=null)},f=function(){var l=Date.now();!s&&t.leading===!1&&(s=l);var c=e-(l-s);return i=this,a=arguments,c<=0||c>e?(n&&(clearTimeout(n),n=null),s=l,o=r.apply(i,a),n||(i=a=null)):!n&&t.trailing!==!1&&(n=setTimeout(u,c)),o};return f.cancel=function(){clearTimeout(n),s=0,n=i=a=null},f},NC=function(r){return Gn(r)?Array.prototype.slice.call(r):[]};var Hc={};const da=function(r){return r=r||"g",Hc[r]?Hc[r]+=1:Hc[r]=1,r+Hc[r]},Uf=function(){},HR=function(r){return r};function mv(r){return ct(r)?0:Gn(r)?r.length:Object.keys(r).length}var qc;const Xf=IC(function(r,e){e===void 0&&(e={});var t=e.fontSize,n=e.fontFamily,i=e.fontWeight,a=e.fontStyle,o=e.fontVariant;return qc||(qc=document.createElement("canvas").getContext("2d")),qc.font=[a,o,i,t+"px",n].join(" "),qc.measureText(Pe(r)?r:"").width},function(r,e){return e===void 0&&(e={}),vv([r],dm(e)).join("")}),qR=function(r,e,t,n){n===void 0&&(n="...");var i=16,a=Xf(n,t),o=Pe(r)?r:Zu(r),s=e,u=[],f,l;if(Xf(r,t)<=e)return r;for(;f=o.substr(0,i),l=Xf(f,t),!(l+a>s&&l>s);)if(u.push(f),s-=l,o=o.substr(i),!o)return u.join("");for(;f=o.substr(0,1),l=Xf(f,t),!(l+a>s);)if(u.push(f),s-=l,o=o.substr(1),!o)return u.join("");return""+u.join("")+n};var ZR=function(){function r(){this.map={}}return r.prototype.has=function(e){return this.map[e]!==void 0},r.prototype.get=function(e,t){var n=this.map[e];return n===void 0?t:n},r.prototype.set=function(e,t){this.map[e]=t},r.prototype.clear=function(){this.map={}},r.prototype.delete=function(e){delete this.map[e]},r.prototype.size=function(){return Object.keys(this.map).length},r}();const KR=Object.freeze(Object.defineProperty({__proto__:null,Cache:ZR,assign:yt,augment:BR,clamp:fR,clearAnimationFrame:TC,clone:Vt,contains:bd,debounce:jl,deepMix:yr,difference:z5,each:me,endsWith:tR,every:rR,extend:GR,filter:pv,find:j5,findIndex:U5,firstValue:X5,fixedBase:Vh,flatten:Y5,flattenDeep:mC,forIn:me,get:Oa,getEllipsisText:qR,getRange:bC,getType:MC,getWrapBehavior:oR,group:aR,groupBy:wd,groupToMap:_C,has:_w,hasKey:_w,hasValue:_R,head:ua,identity:HR,includes:bd,indexOf:pm,isArguments:IR,isArray:pt,isArrayLike:Gn,isBoolean:$l,isDate:vm,isDecimal:lR,isElement:RR,isEmpty:LC,isEqual:Mo,isEqualWith:$R,isError:kR,isEven:cR,isFinite:LR,isFunction:Mr,isInteger:hR,isMatch:yC,isNegative:dR,isNil:ct,isNull:NR,isNumber:ht,isNumberEqual:SC,isObject:yn,isObjectLike:xd,isOdd:pR,isPlainObject:pn,isPositive:gR,isPrototype:CC,isRegExp:DR,isString:Pe,isType:Pi,isUndefined:PR,keys:gC,last:vi,lowerCase:SR,lowerFirst:MR,map:_s,mapValues:UR,max:ca,maxBy:yR,measureTextWidth:Xf,memoize:IC,min:ha,minBy:mR,mix:yt,mod:gv,noop:Uf,number2color:sR,omit:VR,parseRadius:uR,pick:WR,pull:H5,pullAt:wC,reduce:EC,remove:Z5,requestAnimationFrame:AC,set:XR,size:mv,some:nR,sortBy:K5,startsWith:eR,substitute:CR,throttle:yl,toArray:NC,toDegree:xR,toInteger:wR,toRadian:yv,toString:Zu,union:Q5,uniq:gl,uniqueId:da,upperCase:AR,upperFirst:Nu,values:dm,valuesOfKey:J5,wrapBehavior:cs},Symbol.toStringTag,{value:"Module"})),QR={getDefaultCfg:function(){return{}},getEvents:function(){return{}},updateCfg:function(e){return Object.assign(this,e),!0},shouldBegin:function(){return!0},shouldUpdate:function(){return!0},shouldEnd:function(){return!0},bind:function(e){var t=this,n=this.events;this.graph=e,(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&e.get("canvas").set("draggable",!0),me(n,function(i,a){e.on(a,i)}),document.addEventListener("visibilitychange",function(){t.keydown=!1})},unbind:function(e){var t=this.events,n=e.get("canvas").get("draggable");(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&e.get("canvas").set("draggable",!1),me(t,function(i,a){e.off(a,i)}),e.get("canvas").set("draggable",n)},get:function(e){return this[e]},set:function(e,t){return this[e]=t,this}};var gm=function(){function r(){}return r.registerBehavior=function(e,t){if(!t)throw new Error("please specify handler for this behavior: ".concat(e));var n=Vt(QR);Object.assign(n,t);var i=function(o){var s=this;Object.assign(this,this.getDefaultCfg(),o);var u=this.getEvents();this.events=null;var f={};u&&(me(u,function(l,c){f[c]=cs(s,l)}),this.events=f)};i.prototype=n,r.types[e]=i},r.hasBehavior=function(e){return!!r.types[e]},r.getBehavior=function(e){return r.types[e]},r.types={},r}(),JR="*",OC=function(){function r(){this._events={}}return r.prototype.on=function(e,t,n){return this._events[e]||(this._events[e]=[]),this._events[e].push({callback:t,once:!!n}),this},r.prototype.once=function(e,t){return this.on(e,t,!0)},r.prototype.emit=function(e){for(var t=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var a=this._events[e]||[],o=this._events[JR]||[],s=function(u){for(var f=u.length,l=0;l<f;l++)if(u[l]){var c=u[l],h=c.callback,d=c.once;d&&(u.splice(l,1),u.length===0&&delete t._events[e],f--,l--),h.apply(t,n)}};s(a),s(o)},r.prototype.off=function(e,t){if(!e)this._events={};else if(!t)delete this._events[e];else{for(var n=this._events[e]||[],i=n.length,a=0;a<i;a++)n[a].callback===t&&(n.splice(a,1),i--,a--);n.length===0&&delete this._events[e]}return this},r.prototype.getEvents=function(){return this._events},r}(),wt=1e-6,Qt=typeof Float32Array<"u"?Float32Array:Array,Li=Math.random;function eB(r){Qt=r}var tB=Math.PI/180;function rB(r){return r*tB}function nB(r,e){return Math.abs(r-e)<=wt*Math.max(1,Math.abs(r),Math.abs(e))}Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});const iB=Object.freeze(Object.defineProperty({__proto__:null,get ARRAY_TYPE(){return Qt},EPSILON:wt,RANDOM:Li,equals:nB,setMatrixArrayType:eB,toRadian:rB},Symbol.toStringTag,{value:"Module"}));function aB(){var r=new Qt(4);return Qt!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r}function oB(r){var e=new Qt(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}function sB(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function uB(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r}function fB(r,e,t,n){var i=new Qt(4);return i[0]=r,i[1]=e,i[2]=t,i[3]=n,i}function lB(r,e,t,n,i){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r}function cB(r,e){if(r===e){var t=e[1];r[1]=e[2],r[2]=t}else r[0]=e[0],r[1]=e[2],r[2]=e[1],r[3]=e[3];return r}function hB(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t*a-i*n;return o?(o=1/o,r[0]=a*o,r[1]=-n*o,r[2]=-i*o,r[3]=t*o,r):null}function dB(r,e){var t=e[0];return r[0]=e[3],r[1]=-e[1],r[2]=-e[2],r[3]=t,r}function vB(r){return r[0]*r[3]-r[2]*r[1]}function DC(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0],u=t[1],f=t[2],l=t[3];return r[0]=n*s+a*u,r[1]=i*s+o*u,r[2]=n*f+a*l,r[3]=i*f+o*l,r}function pB(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u+a*s,r[1]=i*u+o*s,r[2]=n*-s+a*u,r[3]=i*-s+o*u,r}function gB(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0],u=t[1];return r[0]=n*s,r[1]=i*s,r[2]=a*u,r[3]=o*u,r}function yB(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=-t,r[3]=n,r}function mB(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=e[1],r}function bB(r){return"mat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function xB(r){return Math.hypot(r[0],r[1],r[2],r[3])}function wB(r,e,t,n){return r[2]=n[2]/n[0],t[0]=n[0],t[1]=n[1],t[3]=n[3]-r[2]*t[1],[r,e,t]}function EB(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function PC(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}function _B(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function SB(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=e[0],s=e[1],u=e[2],f=e[3];return Math.abs(t-o)<=wt*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(n-s)<=wt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=wt*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-f)<=wt*Math.max(1,Math.abs(a),Math.abs(f))}function MB(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function CB(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r}var AB=DC,TB=PC;const IB=Object.freeze(Object.defineProperty({__proto__:null,LDU:wB,add:EB,adjoint:dB,clone:oB,copy:sB,create:aB,determinant:vB,equals:SB,exactEquals:_B,frob:xB,fromRotation:yB,fromScaling:mB,fromValues:fB,identity:uB,invert:hB,mul:AB,multiply:DC,multiplyScalar:MB,multiplyScalarAndAdd:CB,rotate:pB,scale:gB,set:lB,str:bB,sub:TB,subtract:PC,transpose:cB},Symbol.toStringTag,{value:"Module"}));function kB(){var r=new Qt(6);return Qt!=Float32Array&&(r[1]=0,r[2]=0,r[4]=0,r[5]=0),r[0]=1,r[3]=1,r}function LB(r){var e=new Qt(6);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e}function NB(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r}function OB(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r}function DB(r,e,t,n,i,a){var o=new Qt(6);return o[0]=r,o[1]=e,o[2]=t,o[3]=n,o[4]=i,o[5]=a,o}function PB(r,e,t,n,i,a,o){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r}function RB(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=t*a-n*i;return u?(u=1/u,r[0]=a*u,r[1]=-n*u,r[2]=-i*u,r[3]=t*u,r[4]=(i*s-a*o)*u,r[5]=(n*o-t*s)*u,r):null}function BB(r){return r[0]*r[3]-r[1]*r[2]}function RC(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=t[0],l=t[1],c=t[2],h=t[3],d=t[4],v=t[5];return r[0]=n*f+a*l,r[1]=i*f+o*l,r[2]=n*c+a*h,r[3]=i*c+o*h,r[4]=n*d+a*v+s,r[5]=i*d+o*v+u,r}function FB(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=Math.sin(t),l=Math.cos(t);return r[0]=n*l+a*f,r[1]=i*l+o*f,r[2]=n*-f+a*l,r[3]=i*-f+o*l,r[4]=s,r[5]=u,r}function GB(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=t[0],l=t[1];return r[0]=n*f,r[1]=i*f,r[2]=a*l,r[3]=o*l,r[4]=s,r[5]=u,r}function zB(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=t[0],l=t[1];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=n*f+a*l+s,r[5]=i*f+o*l+u,r}function $B(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=-t,r[3]=n,r[4]=0,r[5]=0,r}function jB(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=e[1],r[4]=0,r[5]=0,r}function UB(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=e[0],r[5]=e[1],r}function XB(r){return"mat2d("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+")"}function YB(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],1)}function WB(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r}function BC(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r}function VB(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r}function HB(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r}function qB(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]}function ZB(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=e[0],f=e[1],l=e[2],c=e[3],h=e[4],d=e[5];return Math.abs(t-u)<=wt*Math.max(1,Math.abs(t),Math.abs(u))&&Math.abs(n-f)<=wt*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-l)<=wt*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-c)<=wt*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(o-h)<=wt*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-d)<=wt*Math.max(1,Math.abs(s),Math.abs(d))}var KB=RC,QB=BC;const JB=Object.freeze(Object.defineProperty({__proto__:null,add:WB,clone:LB,copy:NB,create:kB,determinant:BB,equals:ZB,exactEquals:qB,frob:YB,fromRotation:$B,fromScaling:jB,fromTranslation:UB,fromValues:DB,identity:OB,invert:RB,mul:KB,multiply:RC,multiplyScalar:VB,multiplyScalarAndAdd:HB,rotate:FB,scale:GB,set:PB,str:XB,sub:QB,subtract:BC,translate:zB},Symbol.toStringTag,{value:"Module"}));function FC(){var r=new Qt(9);return Qt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function eF(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r}function tF(r){var e=new Qt(9);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e}function rF(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function nF(r,e,t,n,i,a,o,s,u){var f=new Qt(9);return f[0]=r,f[1]=e,f[2]=t,f[3]=n,f[4]=i,f[5]=a,f[6]=o,f[7]=s,f[8]=u,f}function iF(r,e,t,n,i,a,o,s,u,f){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r[6]=s,r[7]=u,r[8]=f,r}function aF(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function oF(r,e){if(r===e){var t=e[1],n=e[2],i=e[5];r[1]=e[3],r[2]=e[6],r[3]=t,r[5]=e[7],r[6]=n,r[7]=i}else r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8];return r}function ym(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=l*o-s*f,h=-l*a+s*u,d=f*a-o*u,v=t*c+n*h+i*d;return v?(v=1/v,r[0]=c*v,r[1]=(-l*n+i*f)*v,r[2]=(s*n-i*o)*v,r[3]=h*v,r[4]=(l*t-i*u)*v,r[5]=(-s*t+i*a)*v,r[6]=d*v,r[7]=(-f*t+n*u)*v,r[8]=(o*t-n*a)*v,r):null}function sF(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8];return r[0]=o*l-s*f,r[1]=i*f-n*l,r[2]=n*s-i*o,r[3]=s*u-a*l,r[4]=t*l-i*u,r[5]=i*a-t*s,r[6]=a*f-o*u,r[7]=n*u-t*f,r[8]=t*o-n*a,r}function uF(r){var e=r[0],t=r[1],n=r[2],i=r[3],a=r[4],o=r[5],s=r[6],u=r[7],f=r[8];return e*(f*a-o*u)+t*(-f*i+o*s)+n*(u*i-a*s)}function ga(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=t[0],d=t[1],v=t[2],p=t[3],g=t[4],y=t[5],m=t[6],b=t[7],x=t[8];return r[0]=h*n+d*o+v*f,r[1]=h*i+d*s+v*l,r[2]=h*a+d*u+v*c,r[3]=p*n+g*o+y*f,r[4]=p*i+g*s+y*l,r[5]=p*a+g*u+y*c,r[6]=m*n+b*o+x*f,r[7]=m*i+b*s+x*l,r[8]=m*a+b*u+x*c,r}function fF(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=t[0],d=t[1];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=u,r[6]=h*n+d*o+f,r[7]=h*i+d*s+l,r[8]=h*a+d*u+c,r}function lF(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=Math.sin(t),d=Math.cos(t);return r[0]=d*n+h*o,r[1]=d*i+h*s,r[2]=d*a+h*u,r[3]=d*o-h*n,r[4]=d*s-h*i,r[5]=d*u-h*a,r[6]=f,r[7]=l,r[8]=c,r}function cF(r,e,t){var n=t[0],i=t[1];return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=i*e[3],r[4]=i*e[4],r[5]=i*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function mm(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=e[0],r[7]=e[1],r[8]=1,r}function bm(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=0,r[3]=-t,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function xm(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=e[1],r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function hF(r,e){return r[0]=e[0],r[1]=e[1],r[2]=0,r[3]=e[2],r[4]=e[3],r[5]=0,r[6]=e[4],r[7]=e[5],r[8]=1,r}function dF(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t+t,s=n+n,u=i+i,f=t*o,l=n*o,c=n*s,h=i*o,d=i*s,v=i*u,p=a*o,g=a*s,y=a*u;return r[0]=1-c-v,r[3]=l-y,r[6]=h+g,r[1]=l+y,r[4]=1-f-v,r[7]=d-p,r[2]=h-g,r[5]=d+p,r[8]=1-f-c,r}function vF(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=e[9],h=e[10],d=e[11],v=e[12],p=e[13],g=e[14],y=e[15],m=t*s-n*o,b=t*u-i*o,x=t*f-a*o,w=n*u-i*s,E=n*f-a*s,_=i*f-a*u,M=l*p-c*v,C=l*g-h*v,S=l*y-d*v,A=c*g-h*p,T=c*y-d*p,k=h*y-d*g,O=m*k-b*T+x*A+w*S-E*C+_*M;return O?(O=1/O,r[0]=(s*k-u*T+f*A)*O,r[1]=(u*S-o*k-f*C)*O,r[2]=(o*T-s*S+f*M)*O,r[3]=(i*T-n*k-a*A)*O,r[4]=(t*k-i*S+a*C)*O,r[5]=(n*S-t*T-a*M)*O,r[6]=(p*_-g*E+y*w)*O,r[7]=(g*x-v*_-y*b)*O,r[8]=(v*E-p*x+y*m)*O,r):null}function pF(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}function gF(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}function yF(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])}function mF(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r}function GC(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r}function bF(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r}function xF(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r[6]=e[6]+t[6]*n,r[7]=e[7]+t[7]*n,r[8]=e[8]+t[8]*n,r}function wF(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]}function EF(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],f=r[7],l=r[8],c=e[0],h=e[1],d=e[2],v=e[3],p=e[4],g=e[5],y=e[6],m=e[7],b=e[8];return Math.abs(t-c)<=wt*Math.max(1,Math.abs(t),Math.abs(c))&&Math.abs(n-h)<=wt*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-d)<=wt*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-v)<=wt*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(o-p)<=wt*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(s-g)<=wt*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(u-y)<=wt*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(f-m)<=wt*Math.max(1,Math.abs(f),Math.abs(m))&&Math.abs(l-b)<=wt*Math.max(1,Math.abs(l),Math.abs(b))}var _F=ga,SF=GC;const zC=Object.freeze(Object.defineProperty({__proto__:null,add:mF,adjoint:sF,clone:tF,copy:rF,create:FC,determinant:uF,equals:EF,exactEquals:wF,frob:yF,fromMat2d:hF,fromMat4:eF,fromQuat:dF,fromRotation:bm,fromScaling:xm,fromTranslation:mm,fromValues:nF,identity:aF,invert:ym,mul:_F,multiply:ga,multiplyScalar:bF,multiplyScalarAndAdd:xF,normalFromMat4:vF,projection:pF,rotate:lF,scale:cF,set:iF,str:gF,sub:SF,subtract:GC,translate:fF,transpose:oF},Symbol.toStringTag,{value:"Module"}));function MF(){var r=new Qt(16);return Qt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function CF(r){var e=new Qt(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function AF(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function TF(r,e,t,n,i,a,o,s,u,f,l,c,h,d,v,p){var g=new Qt(16);return g[0]=r,g[1]=e,g[2]=t,g[3]=n,g[4]=i,g[5]=a,g[6]=o,g[7]=s,g[8]=u,g[9]=f,g[10]=l,g[11]=c,g[12]=h,g[13]=d,g[14]=v,g[15]=p,g}function IF(r,e,t,n,i,a,o,s,u,f,l,c,h,d,v,p,g){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r[6]=s,r[7]=u,r[8]=f,r[9]=l,r[10]=c,r[11]=h,r[12]=d,r[13]=v,r[14]=p,r[15]=g,r}function $C(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function kF(r,e){if(r===e){var t=e[1],n=e[2],i=e[3],a=e[6],o=e[7],s=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[6]=e[9],r[7]=e[13],r[8]=n,r[9]=a,r[11]=e[14],r[12]=i,r[13]=o,r[14]=s}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r}function LF(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=e[9],h=e[10],d=e[11],v=e[12],p=e[13],g=e[14],y=e[15],m=t*s-n*o,b=t*u-i*o,x=t*f-a*o,w=n*u-i*s,E=n*f-a*s,_=i*f-a*u,M=l*p-c*v,C=l*g-h*v,S=l*y-d*v,A=c*g-h*p,T=c*y-d*p,k=h*y-d*g,O=m*k-b*T+x*A+w*S-E*C+_*M;return O?(O=1/O,r[0]=(s*k-u*T+f*A)*O,r[1]=(i*T-n*k-a*A)*O,r[2]=(p*_-g*E+y*w)*O,r[3]=(h*E-c*_-d*w)*O,r[4]=(u*S-o*k-f*C)*O,r[5]=(t*k-i*S+a*C)*O,r[6]=(g*x-v*_-y*b)*O,r[7]=(l*_-h*x+d*b)*O,r[8]=(o*T-s*S+f*M)*O,r[9]=(n*S-t*T-a*M)*O,r[10]=(v*E-p*x+y*m)*O,r[11]=(c*x-l*E-d*m)*O,r[12]=(s*C-o*A-u*M)*O,r[13]=(t*A-n*C+i*M)*O,r[14]=(p*b-v*w-g*m)*O,r[15]=(l*w-c*b+h*m)*O,r):null}function NF(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=e[9],h=e[10],d=e[11],v=e[12],p=e[13],g=e[14],y=e[15];return r[0]=s*(h*y-d*g)-c*(u*y-f*g)+p*(u*d-f*h),r[1]=-(n*(h*y-d*g)-c*(i*y-a*g)+p*(i*d-a*h)),r[2]=n*(u*y-f*g)-s*(i*y-a*g)+p*(i*f-a*u),r[3]=-(n*(u*d-f*h)-s*(i*d-a*h)+c*(i*f-a*u)),r[4]=-(o*(h*y-d*g)-l*(u*y-f*g)+v*(u*d-f*h)),r[5]=t*(h*y-d*g)-l*(i*y-a*g)+v*(i*d-a*h),r[6]=-(t*(u*y-f*g)-o*(i*y-a*g)+v*(i*f-a*u)),r[7]=t*(u*d-f*h)-o*(i*d-a*h)+l*(i*f-a*u),r[8]=o*(c*y-d*p)-l*(s*y-f*p)+v*(s*d-f*c),r[9]=-(t*(c*y-d*p)-l*(n*y-a*p)+v*(n*d-a*c)),r[10]=t*(s*y-f*p)-o*(n*y-a*p)+v*(n*f-a*s),r[11]=-(t*(s*d-f*c)-o*(n*d-a*c)+l*(n*f-a*s)),r[12]=-(o*(c*g-h*p)-l*(s*g-u*p)+v*(s*h-u*c)),r[13]=t*(c*g-h*p)-l*(n*g-i*p)+v*(n*h-i*c),r[14]=-(t*(s*g-u*p)-o*(n*g-i*p)+v*(n*u-i*s)),r[15]=t*(s*h-u*c)-o*(n*h-i*c)+l*(n*u-i*s),r}function OF(r){var e=r[0],t=r[1],n=r[2],i=r[3],a=r[4],o=r[5],s=r[6],u=r[7],f=r[8],l=r[9],c=r[10],h=r[11],d=r[12],v=r[13],p=r[14],g=r[15],y=e*o-t*a,m=e*s-n*a,b=e*u-i*a,x=t*s-n*o,w=t*u-i*o,E=n*u-i*s,_=f*v-l*d,M=f*p-c*d,C=f*g-h*d,S=l*p-c*v,A=l*g-h*v,T=c*g-h*p;return y*T-m*A+b*S+x*C-w*M+E*_}function jC(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=e[9],d=e[10],v=e[11],p=e[12],g=e[13],y=e[14],m=e[15],b=t[0],x=t[1],w=t[2],E=t[3];return r[0]=b*n+x*s+w*c+E*p,r[1]=b*i+x*u+w*h+E*g,r[2]=b*a+x*f+w*d+E*y,r[3]=b*o+x*l+w*v+E*m,b=t[4],x=t[5],w=t[6],E=t[7],r[4]=b*n+x*s+w*c+E*p,r[5]=b*i+x*u+w*h+E*g,r[6]=b*a+x*f+w*d+E*y,r[7]=b*o+x*l+w*v+E*m,b=t[8],x=t[9],w=t[10],E=t[11],r[8]=b*n+x*s+w*c+E*p,r[9]=b*i+x*u+w*h+E*g,r[10]=b*a+x*f+w*d+E*y,r[11]=b*o+x*l+w*v+E*m,b=t[12],x=t[13],w=t[14],E=t[15],r[12]=b*n+x*s+w*c+E*p,r[13]=b*i+x*u+w*h+E*g,r[14]=b*a+x*f+w*d+E*y,r[15]=b*o+x*l+w*v+E*m,r}function DF(r,e,t){var n=t[0],i=t[1],a=t[2],o,s,u,f,l,c,h,d,v,p,g,y;return e===r?(r[12]=e[0]*n+e[4]*i+e[8]*a+e[12],r[13]=e[1]*n+e[5]*i+e[9]*a+e[13],r[14]=e[2]*n+e[6]*i+e[10]*a+e[14],r[15]=e[3]*n+e[7]*i+e[11]*a+e[15]):(o=e[0],s=e[1],u=e[2],f=e[3],l=e[4],c=e[5],h=e[6],d=e[7],v=e[8],p=e[9],g=e[10],y=e[11],r[0]=o,r[1]=s,r[2]=u,r[3]=f,r[4]=l,r[5]=c,r[6]=h,r[7]=d,r[8]=v,r[9]=p,r[10]=g,r[11]=y,r[12]=o*n+l*i+v*a+e[12],r[13]=s*n+c*i+p*a+e[13],r[14]=u*n+h*i+g*a+e[14],r[15]=f*n+d*i+y*a+e[15]),r}function PF(r,e,t){var n=t[0],i=t[1],a=t[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*i,r[5]=e[5]*i,r[6]=e[6]*i,r[7]=e[7]*i,r[8]=e[8]*a,r[9]=e[9]*a,r[10]=e[10]*a,r[11]=e[11]*a,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function RF(r,e,t,n){var i=n[0],a=n[1],o=n[2],s=Math.hypot(i,a,o),u,f,l,c,h,d,v,p,g,y,m,b,x,w,E,_,M,C,S,A,T,k,O,F;return s<wt?null:(s=1/s,i*=s,a*=s,o*=s,u=Math.sin(t),f=Math.cos(t),l=1-f,c=e[0],h=e[1],d=e[2],v=e[3],p=e[4],g=e[5],y=e[6],m=e[7],b=e[8],x=e[9],w=e[10],E=e[11],_=i*i*l+f,M=a*i*l+o*u,C=o*i*l-a*u,S=i*a*l-o*u,A=a*a*l+f,T=o*a*l+i*u,k=i*o*l+a*u,O=a*o*l-i*u,F=o*o*l+f,r[0]=c*_+p*M+b*C,r[1]=h*_+g*M+x*C,r[2]=d*_+y*M+w*C,r[3]=v*_+m*M+E*C,r[4]=c*S+p*A+b*T,r[5]=h*S+g*A+x*T,r[6]=d*S+y*A+w*T,r[7]=v*S+m*A+E*T,r[8]=c*k+p*O+b*F,r[9]=h*k+g*O+x*F,r[10]=d*k+y*O+w*F,r[11]=v*k+m*O+E*F,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}function BF(r,e,t){var n=Math.sin(t),i=Math.cos(t),a=e[4],o=e[5],s=e[6],u=e[7],f=e[8],l=e[9],c=e[10],h=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=a*i+f*n,r[5]=o*i+l*n,r[6]=s*i+c*n,r[7]=u*i+h*n,r[8]=f*i-a*n,r[9]=l*i-o*n,r[10]=c*i-s*n,r[11]=h*i-u*n,r}function FF(r,e,t){var n=Math.sin(t),i=Math.cos(t),a=e[0],o=e[1],s=e[2],u=e[3],f=e[8],l=e[9],c=e[10],h=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=a*i-f*n,r[1]=o*i-l*n,r[2]=s*i-c*n,r[3]=u*i-h*n,r[8]=a*n+f*i,r[9]=o*n+l*i,r[10]=s*n+c*i,r[11]=u*n+h*i,r}function GF(r,e,t){var n=Math.sin(t),i=Math.cos(t),a=e[0],o=e[1],s=e[2],u=e[3],f=e[4],l=e[5],c=e[6],h=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=a*i+f*n,r[1]=o*i+l*n,r[2]=s*i+c*n,r[3]=u*i+h*n,r[4]=f*i-a*n,r[5]=l*i-o*n,r[6]=c*i-s*n,r[7]=h*i-u*n,r}function zF(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function $F(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function jF(r,e,t){var n=t[0],i=t[1],a=t[2],o=Math.hypot(n,i,a),s,u,f;return o<wt?null:(o=1/o,n*=o,i*=o,a*=o,s=Math.sin(e),u=Math.cos(e),f=1-u,r[0]=n*n*f+u,r[1]=i*n*f+a*s,r[2]=a*n*f-i*s,r[3]=0,r[4]=n*i*f-a*s,r[5]=i*i*f+u,r[6]=a*i*f+n*s,r[7]=0,r[8]=n*a*f+i*s,r[9]=i*a*f-n*s,r[10]=a*a*f+u,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function UF(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=n,r[6]=t,r[7]=0,r[8]=0,r[9]=-t,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function XF(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=0,r[2]=-t,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=t,r[9]=0,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function YF(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=0,r[3]=0,r[4]=-t,r[5]=n,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function UC(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=n+n,u=i+i,f=a+a,l=n*s,c=n*u,h=n*f,d=i*u,v=i*f,p=a*f,g=o*s,y=o*u,m=o*f;return r[0]=1-(d+p),r[1]=c+m,r[2]=h-y,r[3]=0,r[4]=c-m,r[5]=1-(l+p),r[6]=v+g,r[7]=0,r[8]=h+y,r[9]=v-g,r[10]=1-(l+d),r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function WF(r,e){var t=new Qt(3),n=-e[0],i=-e[1],a=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=n*n+i*i+a*a+o*o;return c>0?(t[0]=(s*o+l*n+u*a-f*i)*2/c,t[1]=(u*o+l*i+f*n-s*a)*2/c,t[2]=(f*o+l*a+s*i-u*n)*2/c):(t[0]=(s*o+l*n+u*a-f*i)*2,t[1]=(u*o+l*i+f*n-s*a)*2,t[2]=(f*o+l*a+s*i-u*n)*2),UC(r,e,t),r}function XC(r,e){return r[0]=e[12],r[1]=e[13],r[2]=e[14],r}function YC(r,e){var t=e[0],n=e[1],i=e[2],a=e[4],o=e[5],s=e[6],u=e[8],f=e[9],l=e[10];return r[0]=Math.hypot(t,n,i),r[1]=Math.hypot(a,o,s),r[2]=Math.hypot(u,f,l),r}function WC(r,e){var t=new Qt(3);YC(t,e);var n=1/t[0],i=1/t[1],a=1/t[2],o=e[0]*n,s=e[1]*i,u=e[2]*a,f=e[4]*n,l=e[5]*i,c=e[6]*a,h=e[8]*n,d=e[9]*i,v=e[10]*a,p=o+l+v,g=0;return p>0?(g=Math.sqrt(p+1)*2,r[3]=.25*g,r[0]=(c-d)/g,r[1]=(h-u)/g,r[2]=(s-f)/g):o>l&&o>v?(g=Math.sqrt(1+o-l-v)*2,r[3]=(c-d)/g,r[0]=.25*g,r[1]=(s+f)/g,r[2]=(h+u)/g):l>v?(g=Math.sqrt(1+l-o-v)*2,r[3]=(h-u)/g,r[0]=(s+f)/g,r[1]=.25*g,r[2]=(c+d)/g):(g=Math.sqrt(1+v-o-l)*2,r[3]=(s-f)/g,r[0]=(h+u)/g,r[1]=(c+d)/g,r[2]=.25*g),r}function VF(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=e[3],u=i+i,f=a+a,l=o+o,c=i*u,h=i*f,d=i*l,v=a*f,p=a*l,g=o*l,y=s*u,m=s*f,b=s*l,x=n[0],w=n[1],E=n[2];return r[0]=(1-(v+g))*x,r[1]=(h+b)*x,r[2]=(d-m)*x,r[3]=0,r[4]=(h-b)*w,r[5]=(1-(c+g))*w,r[6]=(p+y)*w,r[7]=0,r[8]=(d+m)*E,r[9]=(p-y)*E,r[10]=(1-(c+v))*E,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function HF(r,e,t,n,i){var a=e[0],o=e[1],s=e[2],u=e[3],f=a+a,l=o+o,c=s+s,h=a*f,d=a*l,v=a*c,p=o*l,g=o*c,y=s*c,m=u*f,b=u*l,x=u*c,w=n[0],E=n[1],_=n[2],M=i[0],C=i[1],S=i[2],A=(1-(p+y))*w,T=(d+x)*w,k=(v-b)*w,O=(d-x)*E,F=(1-(h+y))*E,D=(g+m)*E,$=(v+b)*_,Y=(g-m)*_,N=(1-(h+p))*_;return r[0]=A,r[1]=T,r[2]=k,r[3]=0,r[4]=O,r[5]=F,r[6]=D,r[7]=0,r[8]=$,r[9]=Y,r[10]=N,r[11]=0,r[12]=t[0]+M-(A*M+O*C+$*S),r[13]=t[1]+C-(T*M+F*C+Y*S),r[14]=t[2]+S-(k*M+D*C+N*S),r[15]=1,r}function qF(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t+t,s=n+n,u=i+i,f=t*o,l=n*o,c=n*s,h=i*o,d=i*s,v=i*u,p=a*o,g=a*s,y=a*u;return r[0]=1-c-v,r[1]=l+y,r[2]=h-g,r[3]=0,r[4]=l-y,r[5]=1-f-v,r[6]=d+p,r[7]=0,r[8]=h+g,r[9]=d-p,r[10]=1-f-c,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function ZF(r,e,t,n,i,a,o){var s=1/(t-e),u=1/(i-n),f=1/(a-o);return r[0]=a*2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a*2*u,r[6]=0,r[7]=0,r[8]=(t+e)*s,r[9]=(i+n)*u,r[10]=(o+a)*f,r[11]=-1,r[12]=0,r[13]=0,r[14]=o*a*2*f,r[15]=0,r}function VC(r,e,t,n,i){var a=1/Math.tan(e/2),o;return r[0]=a/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(o=1/(n-i),r[10]=(i+n)*o,r[14]=2*i*n*o):(r[10]=-1,r[14]=-2*n),r}var KF=VC;function QF(r,e,t,n,i){var a=1/Math.tan(e/2),o;return r[0]=a/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(o=1/(n-i),r[10]=i*o,r[14]=i*n*o):(r[10]=-1,r[14]=-n),r}function JF(r,e,t,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),u=2/(o+s),f=2/(i+a);return r[0]=u,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=f,r[6]=0,r[7]=0,r[8]=-((o-s)*u*.5),r[9]=(i-a)*f*.5,r[10]=n/(t-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*t/(t-n),r[15]=0,r}function HC(r,e,t,n,i,a,o){var s=1/(e-t),u=1/(n-i),f=1/(a-o);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*f,r[11]=0,r[12]=(e+t)*s,r[13]=(i+n)*u,r[14]=(o+a)*f,r[15]=1,r}var e4=HC;function t4(r,e,t,n,i,a,o){var s=1/(e-t),u=1/(n-i),f=1/(a-o);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=f,r[11]=0,r[12]=(e+t)*s,r[13]=(i+n)*u,r[14]=a*f,r[15]=1,r}function r4(r,e,t,n){var i,a,o,s,u,f,l,c,h,d,v=e[0],p=e[1],g=e[2],y=n[0],m=n[1],b=n[2],x=t[0],w=t[1],E=t[2];return Math.abs(v-x)<wt&&Math.abs(p-w)<wt&&Math.abs(g-E)<wt?$C(r):(l=v-x,c=p-w,h=g-E,d=1/Math.hypot(l,c,h),l*=d,c*=d,h*=d,i=m*h-b*c,a=b*l-y*h,o=y*c-m*l,d=Math.hypot(i,a,o),d?(d=1/d,i*=d,a*=d,o*=d):(i=0,a=0,o=0),s=c*o-h*a,u=h*i-l*o,f=l*a-c*i,d=Math.hypot(s,u,f),d?(d=1/d,s*=d,u*=d,f*=d):(s=0,u=0,f=0),r[0]=i,r[1]=s,r[2]=l,r[3]=0,r[4]=a,r[5]=u,r[6]=c,r[7]=0,r[8]=o,r[9]=f,r[10]=h,r[11]=0,r[12]=-(i*v+a*p+o*g),r[13]=-(s*v+u*p+f*g),r[14]=-(l*v+c*p+h*g),r[15]=1,r)}function n4(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=n[0],u=n[1],f=n[2],l=i-t[0],c=a-t[1],h=o-t[2],d=l*l+c*c+h*h;d>0&&(d=1/Math.sqrt(d),l*=d,c*=d,h*=d);var v=u*h-f*c,p=f*l-s*h,g=s*c-u*l;return d=v*v+p*p+g*g,d>0&&(d=1/Math.sqrt(d),v*=d,p*=d,g*=d),r[0]=v,r[1]=p,r[2]=g,r[3]=0,r[4]=c*g-h*p,r[5]=h*v-l*g,r[6]=l*p-c*v,r[7]=0,r[8]=l,r[9]=c,r[10]=h,r[11]=0,r[12]=i,r[13]=a,r[14]=o,r[15]=1,r}function i4(r){return"mat4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+", "+r[9]+", "+r[10]+", "+r[11]+", "+r[12]+", "+r[13]+", "+r[14]+", "+r[15]+")"}function a4(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}function o4(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r}function qC(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r}function s4(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r}function u4(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r[6]=e[6]+t[6]*n,r[7]=e[7]+t[7]*n,r[8]=e[8]+t[8]*n,r[9]=e[9]+t[9]*n,r[10]=e[10]+t[10]*n,r[11]=e[11]+t[11]*n,r[12]=e[12]+t[12]*n,r[13]=e[13]+t[13]*n,r[14]=e[14]+t[14]*n,r[15]=e[15]+t[15]*n,r}function f4(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]}function l4(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],f=r[7],l=r[8],c=r[9],h=r[10],d=r[11],v=r[12],p=r[13],g=r[14],y=r[15],m=e[0],b=e[1],x=e[2],w=e[3],E=e[4],_=e[5],M=e[6],C=e[7],S=e[8],A=e[9],T=e[10],k=e[11],O=e[12],F=e[13],D=e[14],$=e[15];return Math.abs(t-m)<=wt*Math.max(1,Math.abs(t),Math.abs(m))&&Math.abs(n-b)<=wt*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-x)<=wt*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-w)<=wt*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(o-E)<=wt*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(s-_)<=wt*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(u-M)<=wt*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(f-C)<=wt*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(l-S)<=wt*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(c-A)<=wt*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(h-T)<=wt*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(d-k)<=wt*Math.max(1,Math.abs(d),Math.abs(k))&&Math.abs(v-O)<=wt*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(p-F)<=wt*Math.max(1,Math.abs(p),Math.abs(F))&&Math.abs(g-D)<=wt*Math.max(1,Math.abs(g),Math.abs(D))&&Math.abs(y-$)<=wt*Math.max(1,Math.abs(y),Math.abs($))}var c4=jC,h4=qC;const d4=Object.freeze(Object.defineProperty({__proto__:null,add:o4,adjoint:NF,clone:CF,copy:AF,create:MF,determinant:OF,equals:l4,exactEquals:f4,frob:a4,fromQuat:qF,fromQuat2:WF,fromRotation:jF,fromRotationTranslation:UC,fromRotationTranslationScale:VF,fromRotationTranslationScaleOrigin:HF,fromScaling:$F,fromTranslation:zF,fromValues:TF,fromXRotation:UF,fromYRotation:XF,fromZRotation:YF,frustum:ZF,getRotation:WC,getScaling:YC,getTranslation:XC,identity:$C,invert:LF,lookAt:r4,mul:c4,multiply:jC,multiplyScalar:s4,multiplyScalarAndAdd:u4,ortho:e4,orthoNO:HC,orthoZO:t4,perspective:KF,perspectiveFromFieldOfView:JF,perspectiveNO:VC,perspectiveZO:QF,rotate:RF,rotateX:BF,rotateY:FF,rotateZ:GF,scale:PF,set:IF,str:i4,sub:h4,subtract:qC,targetTo:n4,translate:DF,transpose:kF},Symbol.toStringTag,{value:"Module"}));function wm(){var r=new Qt(3);return Qt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function v4(r){var e=new Qt(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function ZC(r){var e=r[0],t=r[1],n=r[2];return Math.hypot(e,t,n)}function S0(r,e,t){var n=new Qt(3);return n[0]=r,n[1]=e,n[2]=t,n}function p4(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function g4(r,e,t,n){return r[0]=e,r[1]=t,r[2]=n,r}function y4(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function KC(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function QC(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function JC(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function m4(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function b4(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}function x4(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function w4(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function E4(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r}function _4(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function S4(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r}function eA(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2];return Math.hypot(t,n,i)}function tA(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2];return t*t+n*n+i*i}function rA(r){var e=r[0],t=r[1],n=r[2];return e*e+t*t+n*n}function M4(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function C4(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function nA(r,e){var t=e[0],n=e[1],i=e[2],a=t*t+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r[2]=e[2]*a,r}function Em(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function Hh(r,e,t){var n=e[0],i=e[1],a=e[2],o=t[0],s=t[1],u=t[2];return r[0]=i*u-a*s,r[1]=a*o-n*u,r[2]=n*s-i*o,r}function A4(r,e,t,n){var i=e[0],a=e[1],o=e[2];return r[0]=i+n*(t[0]-i),r[1]=a+n*(t[1]-a),r[2]=o+n*(t[2]-o),r}function T4(r,e,t,n,i,a){var o=a*a,s=o*(2*a-3)+1,u=o*(a-2)+a,f=o*(a-1),l=o*(3-2*a);return r[0]=e[0]*s+t[0]*u+n[0]*f+i[0]*l,r[1]=e[1]*s+t[1]*u+n[1]*f+i[1]*l,r[2]=e[2]*s+t[2]*u+n[2]*f+i[2]*l,r}function I4(r,e,t,n,i,a){var o=1-a,s=o*o,u=a*a,f=s*o,l=3*a*s,c=3*u*o,h=u*a;return r[0]=e[0]*f+t[0]*l+n[0]*c+i[0]*h,r[1]=e[1]*f+t[1]*l+n[1]*c+i[1]*h,r[2]=e[2]*f+t[2]*l+n[2]*c+i[2]*h,r}function k4(r,e){e=e||1;var t=Li()*2*Math.PI,n=Li()*2-1,i=Math.sqrt(1-n*n)*e;return r[0]=Math.cos(t)*i,r[1]=Math.sin(t)*i,r[2]=n*e,r}function L4(r,e,t){var n=e[0],i=e[1],a=e[2],o=t[3]*n+t[7]*i+t[11]*a+t[15];return o=o||1,r[0]=(t[0]*n+t[4]*i+t[8]*a+t[12])/o,r[1]=(t[1]*n+t[5]*i+t[9]*a+t[13])/o,r[2]=(t[2]*n+t[6]*i+t[10]*a+t[14])/o,r}function bv(r,e,t){var n=e[0],i=e[1],a=e[2];return r[0]=n*t[0]+i*t[3]+a*t[6],r[1]=n*t[1]+i*t[4]+a*t[7],r[2]=n*t[2]+i*t[5]+a*t[8],r}function N4(r,e,t){var n=t[0],i=t[1],a=t[2],o=t[3],s=e[0],u=e[1],f=e[2],l=i*f-a*u,c=a*s-n*f,h=n*u-i*s,d=i*h-a*c,v=a*l-n*h,p=n*c-i*l,g=o*2;return l*=g,c*=g,h*=g,d*=2,v*=2,p*=2,r[0]=s+l+d,r[1]=u+c+v,r[2]=f+h+p,r}function O4(r,e,t,n){var i=[],a=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),r[0]=a[0]+t[0],r[1]=a[1]+t[1],r[2]=a[2]+t[2],r}function D4(r,e,t,n){var i=[],a=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),r[0]=a[0]+t[0],r[1]=a[1]+t[1],r[2]=a[2]+t[2],r}function P4(r,e,t,n){var i=[],a=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],r[0]=a[0]+t[0],r[1]=a[1]+t[1],r[2]=a[2]+t[2],r}function R4(r,e){var t=r[0],n=r[1],i=r[2],a=e[0],o=e[1],s=e[2],u=Math.sqrt(t*t+n*n+i*i),f=Math.sqrt(a*a+o*o+s*s),l=u*f,c=l&&Em(r,e)/l;return Math.acos(Math.min(Math.max(c,-1),1))}function B4(r){return r[0]=0,r[1]=0,r[2]=0,r}function F4(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}function G4(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function z4(r,e){var t=r[0],n=r[1],i=r[2],a=e[0],o=e[1],s=e[2];return Math.abs(t-a)<=wt*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(n-o)<=wt*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=wt*Math.max(1,Math.abs(i),Math.abs(s))}var $4=KC,j4=QC,U4=JC,X4=eA,Y4=tA,iA=ZC,W4=rA,V4=function(){var r=wm();return function(e,t,n,i,a,o){var s,u;for(t||(t=3),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],a(r,r,o),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2];return e}}();const H4=Object.freeze(Object.defineProperty({__proto__:null,add:y4,angle:R4,bezier:I4,ceil:m4,clone:v4,copy:p4,create:wm,cross:Hh,dist:X4,distance:eA,div:U4,divide:JC,dot:Em,equals:z4,exactEquals:G4,floor:b4,forEach:V4,fromValues:S0,hermite:T4,inverse:C4,len:iA,length:ZC,lerp:A4,max:w4,min:x4,mul:j4,multiply:QC,negate:M4,normalize:nA,random:k4,rotateX:O4,rotateY:D4,rotateZ:P4,round:E4,scale:_4,scaleAndAdd:S4,set:g4,sqrDist:Y4,sqrLen:W4,squaredDistance:tA,squaredLength:rA,str:F4,sub:$4,subtract:KC,transformMat3:bv,transformMat4:L4,transformQuat:N4,zero:B4},Symbol.toStringTag,{value:"Module"}));function aA(){var r=new Qt(4);return Qt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function oA(r){var e=new Qt(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}function sA(r,e,t,n){var i=new Qt(4);return i[0]=r,i[1]=e,i[2]=t,i[3]=n,i}function uA(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function fA(r,e,t,n,i){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r}function lA(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function cA(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}function hA(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r[3]=e[3]*t[3],r}function dA(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r[3]=e[3]/t[3],r}function q4(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r[3]=Math.ceil(e[3]),r}function Z4(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r[3]=Math.floor(e[3]),r}function K4(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r[3]=Math.min(e[3],t[3]),r}function Q4(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r[3]=Math.max(e[3],t[3]),r}function J4(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r[3]=Math.round(e[3]),r}function vA(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function eG(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r}function pA(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2],a=e[3]-r[3];return Math.hypot(t,n,i,a)}function gA(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2],a=e[3]-r[3];return t*t+n*n+i*i+a*a}function _m(r){var e=r[0],t=r[1],n=r[2],i=r[3];return Math.hypot(e,t,n,i)}function Sm(r){var e=r[0],t=r[1],n=r[2],i=r[3];return e*e+t*t+n*n+i*i}function tG(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r}function rG(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r[3]=1/e[3],r}function yA(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t*t+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),r[0]=t*o,r[1]=n*o,r[2]=i*o,r[3]=a*o,r}function mA(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function nG(r,e,t,n){var i=t[0]*n[1]-t[1]*n[0],a=t[0]*n[2]-t[2]*n[0],o=t[0]*n[3]-t[3]*n[0],s=t[1]*n[2]-t[2]*n[1],u=t[1]*n[3]-t[3]*n[1],f=t[2]*n[3]-t[3]*n[2],l=e[0],c=e[1],h=e[2],d=e[3];return r[0]=c*f-h*u+d*s,r[1]=-(l*f)+h*o-d*a,r[2]=l*u-c*o+d*i,r[3]=-(l*s)+c*a-h*i,r}function bA(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=e[3];return r[0]=i+n*(t[0]-i),r[1]=a+n*(t[1]-a),r[2]=o+n*(t[2]-o),r[3]=s+n*(t[3]-s),r}function iG(r,e){e=e||1;var t,n,i,a,o,s;do t=Li()*2-1,n=Li()*2-1,o=t*t+n*n;while(o>=1);do i=Li()*2-1,a=Li()*2-1,s=i*i+a*a;while(s>=1);var u=Math.sqrt((1-o)/s);return r[0]=e*t,r[1]=e*n,r[2]=e*i*u,r[3]=e*a*u,r}function aG(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3];return r[0]=t[0]*n+t[4]*i+t[8]*a+t[12]*o,r[1]=t[1]*n+t[5]*i+t[9]*a+t[13]*o,r[2]=t[2]*n+t[6]*i+t[10]*a+t[14]*o,r[3]=t[3]*n+t[7]*i+t[11]*a+t[15]*o,r}function oG(r,e,t){var n=e[0],i=e[1],a=e[2],o=t[0],s=t[1],u=t[2],f=t[3],l=f*n+s*a-u*i,c=f*i+u*n-o*a,h=f*a+o*i-s*n,d=-o*n-s*i-u*a;return r[0]=l*f+d*-o+c*-u-h*-s,r[1]=c*f+d*-s+h*-o-l*-u,r[2]=h*f+d*-u+l*-s-c*-o,r[3]=e[3],r}function sG(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}function uG(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function xA(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function wA(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=e[0],s=e[1],u=e[2],f=e[3];return Math.abs(t-o)<=wt*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(n-s)<=wt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=wt*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-f)<=wt*Math.max(1,Math.abs(a),Math.abs(f))}var fG=cA,lG=hA,cG=dA,hG=pA,dG=gA,vG=_m,pG=Sm,gG=function(){var r=aA();return function(e,t,n,i,a,o){var s,u;for(t||(t=4),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],r[3]=e[s+3],a(r,r,o),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2],e[s+3]=r[3];return e}}();const yG=Object.freeze(Object.defineProperty({__proto__:null,add:lA,ceil:q4,clone:oA,copy:uA,create:aA,cross:nG,dist:hG,distance:pA,div:cG,divide:dA,dot:mA,equals:wA,exactEquals:xA,floor:Z4,forEach:gG,fromValues:sA,inverse:rG,len:vG,length:_m,lerp:bA,max:Q4,min:K4,mul:lG,multiply:hA,negate:tG,normalize:yA,random:iG,round:J4,scale:vA,scaleAndAdd:eG,set:fA,sqrDist:dG,sqrLen:pG,squaredDistance:gA,squaredLength:Sm,str:uG,sub:fG,subtract:cA,transformMat4:aG,transformQuat:oG,zero:sG},Symbol.toStringTag,{value:"Module"}));function Ed(){var r=new Qt(4);return Qt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function mG(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function EA(r,e,t){t=t*.5;var n=Math.sin(t);return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=Math.cos(t),r}function bG(r,e){var t=Math.acos(e[3])*2,n=Math.sin(t/2);return n>wt?(r[0]=e[0]/n,r[1]=e[1]/n,r[2]=e[2]/n):(r[0]=1,r[1]=0,r[2]=0),t}function xG(r,e){var t=Cm(r,e);return Math.acos(2*t*t-1)}function _A(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0],u=t[1],f=t[2],l=t[3];return r[0]=n*l+o*s+i*f-a*u,r[1]=i*l+o*u+a*s-n*f,r[2]=a*l+o*f+n*u-i*s,r[3]=o*l-n*s-i*u-a*f,r}function SA(r,e,t){t*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u+o*s,r[1]=i*u+a*s,r[2]=a*u-i*s,r[3]=o*u-n*s,r}function MA(r,e,t){t*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u-a*s,r[1]=i*u+o*s,r[2]=a*u+n*s,r[3]=o*u-i*s,r}function CA(r,e,t){t*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u+i*s,r[1]=i*u-n*s,r[2]=a*u+o*s,r[3]=o*u-a*s,r}function wG(r,e){var t=e[0],n=e[1],i=e[2];return r[0]=t,r[1]=n,r[2]=i,r[3]=Math.sqrt(Math.abs(1-t*t-n*n-i*i)),r}function AA(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=Math.sqrt(t*t+n*n+i*i),s=Math.exp(a),u=o>0?s*Math.sin(o)/o:0;return r[0]=t*u,r[1]=n*u,r[2]=i*u,r[3]=s*Math.cos(o),r}function TA(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=Math.sqrt(t*t+n*n+i*i),s=o>0?Math.atan2(o,a)/o:0;return r[0]=t*s,r[1]=n*s,r[2]=i*s,r[3]=.5*Math.log(t*t+n*n+i*i+a*a),r}function EG(r,e,t){return TA(r,e),kA(r,r,t),AA(r,r),r}function qh(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=e[3],u=t[0],f=t[1],l=t[2],c=t[3],h,d,v,p,g;return d=i*u+a*f+o*l+s*c,d<0&&(d=-d,u=-u,f=-f,l=-l,c=-c),1-d>wt?(h=Math.acos(d),v=Math.sin(h),p=Math.sin((1-n)*h)/v,g=Math.sin(n*h)/v):(p=1-n,g=n),r[0]=p*i+g*u,r[1]=p*a+g*f,r[2]=p*o+g*l,r[3]=p*s+g*c,r}function _G(r){var e=Li(),t=Li(),n=Li(),i=Math.sqrt(1-e),a=Math.sqrt(e);return r[0]=i*Math.sin(2*Math.PI*t),r[1]=i*Math.cos(2*Math.PI*t),r[2]=a*Math.sin(2*Math.PI*n),r[3]=a*Math.cos(2*Math.PI*n),r}function SG(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t*t+n*n+i*i+a*a,s=o?1/o:0;return r[0]=-t*s,r[1]=-n*s,r[2]=-i*s,r[3]=a*s,r}function MG(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r}function IA(r,e){var t=e[0]+e[4]+e[8],n;if(t>0)n=Math.sqrt(t+1),r[3]=.5*n,n=.5/n,r[0]=(e[5]-e[7])*n,r[1]=(e[6]-e[2])*n,r[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(e[i*3+i]-e[a*3+a]-e[o*3+o]+1),r[i]=.5*n,n=.5/n,r[3]=(e[a*3+o]-e[o*3+a])*n,r[a]=(e[a*3+i]+e[i*3+a])*n,r[o]=(e[o*3+i]+e[i*3+o])*n}return r}function CG(r,e,t,n){var i=.5*Math.PI/180;e*=i,t*=i,n*=i;var a=Math.sin(e),o=Math.cos(e),s=Math.sin(t),u=Math.cos(t),f=Math.sin(n),l=Math.cos(n);return r[0]=a*u*l-o*s*f,r[1]=o*s*l+a*u*f,r[2]=o*u*f-a*s*l,r[3]=o*u*l+a*s*f,r}function AG(r){return"quat("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}var TG=oA,IG=sA,Mm=uA,kG=fA,LG=lA,NG=_A,kA=vA,Cm=mA,OG=bA,Am=_m,DG=Am,Tm=Sm,PG=Tm,Im=yA,RG=xA,BG=wA,FG=function(){var r=wm(),e=S0(1,0,0),t=S0(0,1,0);return function(n,i,a){var o=Em(i,a);return o<-.999999?(Hh(r,e,i),iA(r)<1e-6&&Hh(r,t,i),nA(r,r),EA(n,r,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Hh(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+o,Im(n,n))}}(),GG=function(){var r=Ed(),e=Ed();return function(t,n,i,a,o,s){return qh(r,n,o,s),qh(e,i,a,s),qh(t,r,e,2*s*(1-s)),t}}(),zG=function(){var r=FC();return function(e,t,n,i){return r[0]=n[0],r[3]=n[1],r[6]=n[2],r[1]=i[0],r[4]=i[1],r[7]=i[2],r[2]=-t[0],r[5]=-t[1],r[8]=-t[2],Im(e,IA(e,r))}}();const $G=Object.freeze(Object.defineProperty({__proto__:null,add:LG,calculateW:wG,clone:TG,conjugate:MG,copy:Mm,create:Ed,dot:Cm,equals:BG,exactEquals:RG,exp:AA,fromEuler:CG,fromMat3:IA,fromValues:IG,getAngle:xG,getAxisAngle:bG,identity:mG,invert:SG,len:DG,length:Am,lerp:OG,ln:TA,mul:NG,multiply:_A,normalize:Im,pow:EG,random:_G,rotateX:SA,rotateY:MA,rotateZ:CA,rotationTo:FG,scale:kA,set:kG,setAxes:zG,setAxisAngle:EA,slerp:qh,sqlerp:GG,sqrLen:PG,squaredLength:Tm,str:AG},Symbol.toStringTag,{value:"Module"}));function jG(){var r=new Qt(8);return Qt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0),r[3]=1,r}function UG(r){var e=new Qt(8);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e}function XG(r,e,t,n,i,a,o,s){var u=new Qt(8);return u[0]=r,u[1]=e,u[2]=t,u[3]=n,u[4]=i,u[5]=a,u[6]=o,u[7]=s,u}function YG(r,e,t,n,i,a,o){var s=new Qt(8);s[0]=r,s[1]=e,s[2]=t,s[3]=n;var u=i*.5,f=a*.5,l=o*.5;return s[4]=u*n+f*t-l*e,s[5]=f*n+l*r-u*t,s[6]=l*n+u*e-f*r,s[7]=-u*r-f*e-l*t,s}function LA(r,e,t){var n=t[0]*.5,i=t[1]*.5,a=t[2]*.5,o=e[0],s=e[1],u=e[2],f=e[3];return r[0]=o,r[1]=s,r[2]=u,r[3]=f,r[4]=n*f+i*u-a*s,r[5]=i*f+a*o-n*u,r[6]=a*f+n*s-i*o,r[7]=-n*o-i*s-a*u,r}function WG(r,e){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r[4]=e[0]*.5,r[5]=e[1]*.5,r[6]=e[2]*.5,r[7]=0,r}function VG(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=0,r[5]=0,r[6]=0,r[7]=0,r}function HG(r,e){var t=Ed();WC(t,e);var n=new Qt(3);return XC(n,e),LA(r,t,n),r}function NA(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r}function qG(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r}function ZG(r,e,t,n,i,a,o,s,u){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r[6]=s,r[7]=u,r}var KG=Mm;function QG(r,e){return r[0]=e[4],r[1]=e[5],r[2]=e[6],r[3]=e[7],r}var JG=Mm;function e6(r,e){return r[4]=e[0],r[5]=e[1],r[6]=e[2],r[7]=e[3],r}function t6(r,e){var t=e[4],n=e[5],i=e[6],a=e[7],o=-e[0],s=-e[1],u=-e[2],f=e[3];return r[0]=(t*f+a*o+n*u-i*s)*2,r[1]=(n*f+a*s+i*o-t*u)*2,r[2]=(i*f+a*u+t*s-n*o)*2,r}function r6(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0]*.5,u=t[1]*.5,f=t[2]*.5,l=e[4],c=e[5],h=e[6],d=e[7];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=o*s+i*f-a*u+l,r[5]=o*u+a*s-n*f+c,r[6]=o*f+n*u-i*s+h,r[7]=-n*s-i*u-a*f+d,r}function n6(r,e,t){var n=-e[0],i=-e[1],a=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*a-f*i,h=u*o+l*i+f*n-s*a,d=f*o+l*a+s*i-u*n,v=l*o-s*n-u*i-f*a;return SA(r,e,t),n=r[0],i=r[1],a=r[2],o=r[3],r[4]=c*o+v*n+h*a-d*i,r[5]=h*o+v*i+d*n-c*a,r[6]=d*o+v*a+c*i-h*n,r[7]=v*o-c*n-h*i-d*a,r}function i6(r,e,t){var n=-e[0],i=-e[1],a=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*a-f*i,h=u*o+l*i+f*n-s*a,d=f*o+l*a+s*i-u*n,v=l*o-s*n-u*i-f*a;return MA(r,e,t),n=r[0],i=r[1],a=r[2],o=r[3],r[4]=c*o+v*n+h*a-d*i,r[5]=h*o+v*i+d*n-c*a,r[6]=d*o+v*a+c*i-h*n,r[7]=v*o-c*n-h*i-d*a,r}function a6(r,e,t){var n=-e[0],i=-e[1],a=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*a-f*i,h=u*o+l*i+f*n-s*a,d=f*o+l*a+s*i-u*n,v=l*o-s*n-u*i-f*a;return CA(r,e,t),n=r[0],i=r[1],a=r[2],o=r[3],r[4]=c*o+v*n+h*a-d*i,r[5]=h*o+v*i+d*n-c*a,r[6]=d*o+v*a+c*i-h*n,r[7]=v*o-c*n-h*i-d*a,r}function o6(r,e,t){var n=t[0],i=t[1],a=t[2],o=t[3],s=e[0],u=e[1],f=e[2],l=e[3];return r[0]=s*o+l*n+u*a-f*i,r[1]=u*o+l*i+f*n-s*a,r[2]=f*o+l*a+s*i-u*n,r[3]=l*o-s*n-u*i-f*a,s=e[4],u=e[5],f=e[6],l=e[7],r[4]=s*o+l*n+u*a-f*i,r[5]=u*o+l*i+f*n-s*a,r[6]=f*o+l*a+s*i-u*n,r[7]=l*o-s*n-u*i-f*a,r}function s6(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0],u=t[1],f=t[2],l=t[3];return r[0]=n*l+o*s+i*f-a*u,r[1]=i*l+o*u+a*s-n*f,r[2]=a*l+o*f+n*u-i*s,r[3]=o*l-n*s-i*u-a*f,s=t[4],u=t[5],f=t[6],l=t[7],r[4]=n*l+o*s+i*f-a*u,r[5]=i*l+o*u+a*s-n*f,r[6]=a*l+o*f+n*u-i*s,r[7]=o*l-n*s-i*u-a*f,r}function u6(r,e,t,n){if(Math.abs(n)<wt)return NA(r,e);var i=Math.hypot(t[0],t[1],t[2]);n=n*.5;var a=Math.sin(n),o=a*t[0]/i,s=a*t[1]/i,u=a*t[2]/i,f=Math.cos(n),l=e[0],c=e[1],h=e[2],d=e[3];r[0]=l*f+d*o+c*u-h*s,r[1]=c*f+d*s+h*o-l*u,r[2]=h*f+d*u+l*s-c*o,r[3]=d*f-l*o-c*s-h*u;var v=e[4],p=e[5],g=e[6],y=e[7];return r[4]=v*f+y*o+p*u-g*s,r[5]=p*f+y*s+g*o-v*u,r[6]=g*f+y*u+v*s-p*o,r[7]=y*f-v*o-p*s-g*u,r}function f6(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r}function OA(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[4],u=t[5],f=t[6],l=t[7],c=e[4],h=e[5],d=e[6],v=e[7],p=t[0],g=t[1],y=t[2],m=t[3];return r[0]=n*m+o*p+i*y-a*g,r[1]=i*m+o*g+a*p-n*y,r[2]=a*m+o*y+n*g-i*p,r[3]=o*m-n*p-i*g-a*y,r[4]=n*l+o*s+i*f-a*u+c*m+v*p+h*y-d*g,r[5]=i*l+o*u+a*s-n*f+h*m+v*g+d*p-c*y,r[6]=a*l+o*f+n*u-i*s+d*m+v*y+c*g-h*p,r[7]=o*l-n*s-i*u-a*f+v*m-c*p-h*g-d*y,r}var l6=OA;function c6(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r}var DA=Cm;function h6(r,e,t,n){var i=1-n;return DA(e,t)<0&&(n=-n),r[0]=e[0]*i+t[0]*n,r[1]=e[1]*i+t[1]*n,r[2]=e[2]*i+t[2]*n,r[3]=e[3]*i+t[3]*n,r[4]=e[4]*i+t[4]*n,r[5]=e[5]*i+t[5]*n,r[6]=e[6]*i+t[6]*n,r[7]=e[7]*i+t[7]*n,r}function d6(r,e){var t=xv(e);return r[0]=-e[0]/t,r[1]=-e[1]/t,r[2]=-e[2]/t,r[3]=e[3]/t,r[4]=-e[4]/t,r[5]=-e[5]/t,r[6]=-e[6]/t,r[7]=e[7]/t,r}function v6(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r[4]=-e[4],r[5]=-e[5],r[6]=-e[6],r[7]=e[7],r}var PA=Am,p6=PA,xv=Tm,g6=xv;function y6(r,e){var t=xv(e);if(t>0){t=Math.sqrt(t);var n=e[0]/t,i=e[1]/t,a=e[2]/t,o=e[3]/t,s=e[4],u=e[5],f=e[6],l=e[7],c=n*s+i*u+a*f+o*l;r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=(s-n*c)/t,r[5]=(u-i*c)/t,r[6]=(f-a*c)/t,r[7]=(l-o*c)/t}return r}function m6(r){return"quat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+")"}function b6(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]}function x6(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],f=r[7],l=e[0],c=e[1],h=e[2],d=e[3],v=e[4],p=e[5],g=e[6],y=e[7];return Math.abs(t-l)<=wt*Math.max(1,Math.abs(t),Math.abs(l))&&Math.abs(n-c)<=wt*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-h)<=wt*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-d)<=wt*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(o-v)<=wt*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(s-p)<=wt*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(u-g)<=wt*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(f-y)<=wt*Math.max(1,Math.abs(f),Math.abs(y))}const w6=Object.freeze(Object.defineProperty({__proto__:null,add:f6,clone:UG,conjugate:v6,copy:NA,create:jG,dot:DA,equals:x6,exactEquals:b6,fromMat4:HG,fromRotation:VG,fromRotationTranslation:LA,fromRotationTranslationValues:YG,fromTranslation:WG,fromValues:XG,getDual:QG,getReal:KG,getTranslation:t6,identity:qG,invert:d6,len:p6,length:PA,lerp:h6,mul:l6,multiply:OA,normalize:y6,rotateAroundAxis:u6,rotateByQuatAppend:o6,rotateByQuatPrepend:s6,rotateX:n6,rotateY:i6,rotateZ:a6,scale:c6,set:ZG,setDual:e6,setReal:JG,sqrLen:g6,squaredLength:xv,str:m6,translate:r6},Symbol.toStringTag,{value:"Module"}));function RA(){var r=new Qt(2);return Qt!=Float32Array&&(r[0]=0,r[1]=0),r}function E6(r){var e=new Qt(2);return e[0]=r[0],e[1]=r[1],e}function _6(r,e){var t=new Qt(2);return t[0]=r,t[1]=e,t}function S6(r,e){return r[0]=e[0],r[1]=e[1],r}function M6(r,e,t){return r[0]=e,r[1]=t,r}function vn(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function BA(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function FA(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r}function GA(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r}function C6(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r}function A6(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r}function fo(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}function lo(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}function T6(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r}function An(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function I6(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r}function _d(r,e){var t=e[0]-r[0],n=e[1]-r[1];return Math.hypot(t,n)}function zA(r,e){var t=e[0]-r[0],n=e[1]-r[1];return t*t+n*n}function $A(r){var e=r[0],t=r[1];return Math.hypot(e,t)}function jA(r){var e=r[0],t=r[1];return e*e+t*t}function k6(r,e){return r[0]=-e[0],r[1]=-e[1],r}function L6(r,e){return r[0]=1/e[0],r[1]=1/e[1],r}function _o(r,e){var t=e[0],n=e[1],i=t*t+n*n;return i>0&&(i=1/Math.sqrt(i)),r[0]=e[0]*i,r[1]=e[1]*i,r}function km(r,e){return r[0]*e[0]+r[1]*e[1]}function N6(r,e,t){var n=e[0]*t[1]-e[1]*t[0];return r[0]=r[1]=0,r[2]=n,r}function O6(r,e,t,n){var i=e[0],a=e[1];return r[0]=i+n*(t[0]-i),r[1]=a+n*(t[1]-a),r}function D6(r,e){e=e||1;var t=Li()*2*Math.PI;return r[0]=Math.cos(t)*e,r[1]=Math.sin(t)*e,r}function P6(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i,r[1]=t[1]*n+t[3]*i,r}function R6(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i+t[4],r[1]=t[1]*n+t[3]*i+t[5],r}function B6(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[3]*i+t[6],r[1]=t[1]*n+t[4]*i+t[7],r}function F6(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[4]*i+t[12],r[1]=t[1]*n+t[5]*i+t[13],r}function G6(r,e,t,n){var i=e[0]-t[0],a=e[1]-t[1],o=Math.sin(n),s=Math.cos(n);return r[0]=i*s-a*o+t[0],r[1]=i*o+a*s+t[1],r}function UA(r,e){var t=r[0],n=r[1],i=e[0],a=e[1],o=Math.sqrt(t*t+n*n)*Math.sqrt(i*i+a*a),s=o&&(t*i+n*a)/o;return Math.acos(Math.min(Math.max(s,-1),1))}function z6(r){return r[0]=0,r[1]=0,r}function $6(r){return"vec2("+r[0]+", "+r[1]+")"}function Lm(r,e){return r[0]===e[0]&&r[1]===e[1]}function j6(r,e){var t=r[0],n=r[1],i=e[0],a=e[1];return Math.abs(t-i)<=wt*Math.max(1,Math.abs(t),Math.abs(i))&&Math.abs(n-a)<=wt*Math.max(1,Math.abs(n),Math.abs(a))}var U6=$A,Zh=BA,X6=FA,Y6=GA,W6=_d,V6=zA,H6=jA,q6=function(){var r=RA();return function(e,t,n,i,a,o){var s,u;for(t||(t=2),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],a(r,r,o),e[s]=r[0],e[s+1]=r[1];return e}}();const Z6=Object.freeze(Object.defineProperty({__proto__:null,add:vn,angle:UA,ceil:C6,clone:E6,copy:S6,create:RA,cross:N6,dist:W6,distance:_d,div:Y6,divide:GA,dot:km,equals:j6,exactEquals:Lm,floor:A6,forEach:q6,fromValues:_6,inverse:L6,len:U6,length:$A,lerp:O6,max:lo,min:fo,mul:X6,multiply:FA,negate:k6,normalize:_o,random:D6,rotate:G6,round:T6,scale:An,scaleAndAdd:I6,set:M6,sqrDist:V6,sqrLen:H6,squaredDistance:zA,squaredLength:jA,str:$6,sub:Zh,subtract:BA,transformMat2:P6,transformMat2d:R6,transformMat3:B6,transformMat4:F6,zero:z6},Symbol.toStringTag,{value:"Module"})),K6=Object.freeze(Object.defineProperty({__proto__:null,glMatrix:iB,mat2:IB,mat2d:JB,mat3:zC,mat4:d4,quat:$G,quat2:w6,vec2:Z6,vec3:H4,vec4:yG},Symbol.toStringTag,{value:"Module"}));function Q6(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return mm(n,t),ga(r,n,e)}function J6(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return bm(n,t),ga(r,n,e)}function ez(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return xm(n,t),ga(r,n,e)}function tz(r,e,t){return ga(r,t,e)}function yi(r,e){for(var t=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=e.length;n<i;n++){var a=e[n];switch(a[0]){case"t":Q6(t,t,[a[1],a[2]]);break;case"s":ez(t,t,[a[1],a[2]]);break;case"r":J6(t,t,a[1]);break;case"m":tz(t,t,a[1]);break}}return t}var Ss=function(e,t){var n=e.nodes,i=e.edges,a=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var f=[];a.push(f)}),i&&i.forEach(function(s){var u=s.source,f=s.target,l=o[u],c=o[f];!l&&l!==0||!c&&c!==0||(a[l][c]=1,t||(a[c][l]=1))}),a},rz=function(e,t){return e===t},Sw=function(){function r(e,t){t===void 0&&(t=null),this.value=e,this.next=t}return r.prototype.toString=function(e){return e?e(this.value):"".concat(this.value)},r}(),XA=function(){function r(e){e===void 0&&(e=rz),this.head=null,this.tail=null,this.compare=e}return r.prototype.prepend=function(e){var t=new Sw(e,this.head);return this.head=t,this.tail||(this.tail=t),this},r.prototype.append=function(e){var t=new Sw(e);return this.head?(this.tail.next=t,this.tail=t,this):(this.head=t,this.tail=t,this)},r.prototype.delete=function(e){if(!this.head)return null;for(var t=null;this.head&&this.compare(this.head.value,e);)t=this.head,this.head=this.head.next;var n=this.head;if(n!==null)for(;n.next;)this.compare(n.next.value,e)?(t=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,e)&&(this.tail=n),t},r.prototype.find=function(e){var t=e.value,n=t===void 0?void 0:t,i=e.callback,a=i===void 0?void 0:i;if(!this.head)return null;for(var o=this.head;o;){if(a&&a(o.value)||n!==void 0&&this.compare(o.value,n))return o;o=o.next}return null},r.prototype.deleteTail=function(){var e=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,e;for(var t=this.head;t.next;)t.next.next?t=t.next:t.next=null;return this.tail=t,e},r.prototype.deleteHead=function(){if(!this.head)return null;var e=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),e},r.prototype.fromArray=function(e){var t=this;return e.forEach(function(n){return t.append(n)}),this},r.prototype.toArray=function(){for(var e=[],t=this.head;t;)e.push(t),t=t.next;return e},r.prototype.reverse=function(){for(var e=this.head,t=null,n=null;e;)n=e.next,e.next=t,t=e,e=n;this.tail=this.head,this.head=t},r.prototype.toString=function(e){return e===void 0&&(e=void 0),this.toArray().map(function(t){return t.toString(e)}).toString()},r}(),nz=function(){function r(){this.linkedList=new XA}return r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},r.prototype.enqueue=function(e){this.linkedList.append(e)},r.prototype.dequeue=function(){var e=this.linkedList.deleteHead();return e?e.value:null},r.prototype.toString=function(e){return this.linkedList.toString(e)},r}(),Kn=function(e,t,n){t===void 0&&(t=[]);var i=t.filter(function(u){return u.source===e||u.target===e});if(n==="target"){var a=function(f){return f.source===e};return i.filter(a).map(function(u){return u.target})}if(n==="source"){var o=function(f){return f.target===e};return i.filter(o).map(function(u){return u.source})}var s=function(f){return f.source===e?f.target:f.source};return i.map(s)},iz=function(e,t){return t.filter(function(n){return n.source===e})},Kh=function(e,t){return t.filter(function(n){return n.source===e||n.target===e})},YA=function(e){e===void 0&&(e=0);var t="".concat(Math.random()).split(".")[1].substr(0,5),n="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(e,"-").concat(t).concat(n)};function az(r){r===void 0&&(r={});var e=r,t=function(){},n=function(){var i={};return function(a){var o=a.next,s=o;return i[s]?!1:(i[s]=!0,!0)}}();return e.allowTraversal=r.allowTraversal||n,e.enter=r.enter||t,e.leave=r.leave||t,e}var WA=function(e,t,n,i){i===void 0&&(i=!0);var a=az(n),o=new nz,s=e.edges,u=s===void 0?[]:s;o.enqueue(t);for(var f="",l=function(){var h=o.dequeue();a.enter({current:h,previous:f}),Kn(h,u,i?"target":void 0).forEach(function(d){a.allowTraversal({previous:f,current:h,next:d})&&o.enqueue(d)}),a.leave({current:h,previous:f}),f=h};!o.isEmpty();)l()},oz=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,o=[],s={},u=[],f=function d(v){u.push(v),s[v.id]=!0;for(var p=Kn(v.id,a),g=function(b){var x=p[b];if(!s[x]){var w=n.filter(function(E){return E.id===x});w.length>0&&d(w[0])}},y=0;y<p.length;++y)g(y)},l=0;l<n.length;l++){var c=n[l];if(!s[c.id]){f(c);for(var h=[];u.length>0;)h.push(u.pop());o.push(h)}}return o},VA=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,o=[],s={},u={},f={},l=[],c=0,h=function g(y){u[y.id]=c,f[y.id]=c,c+=1,o.push(y),s[y.id]=!0;for(var m=Kn(y.id,a,"target").filter(function(_){return n.map(function(M){return M.id}).indexOf(_)>-1}),b=function(M){var C=m[M];if(!u[C]&&u[C]!==0){var S=n.filter(function(A){return A.id===C});S.length>0&&g(S[0]),f[y.id]=Math.min(f[y.id],f[C])}else s[C]&&(f[y.id]=Math.min(f[y.id],u[C]))},x=0;x<m.length;x++)b(x);if(f[y.id]===u[y.id]){for(var w=[];o.length>0;){var E=o.pop();if(s[E.id]=!1,w.push(E),E===y)break}w.length>0&&l.push(w)}},d=0,v=n;d<v.length;d++){var p=v[d];!u[p.id]&&u[p.id]!==0&&h(p)}return l};function Nm(r,e){return e?VA(r):oz(r)}var ja=function(e){var t={},n=e.nodes,i=n===void 0?[]:n,a=e.edges,o=a===void 0?[]:a;return i.forEach(function(s){t[s.id]={degree:0,inDegree:0,outDegree:0}}),o.forEach(function(s){t[s.source].degree++,t[s.source].outDegree++,t[s.target].degree++,t[s.target].inDegree++}),t},HA=function(e,t){var n=ja(e);return n[t]?ja(e)[t].inDegree:0},qA=function(e,t){var n=ja(e);return n[t]?ja(e)[t].outDegree:0};function sz(r){r===void 0&&(r={});var e=r,t=function(){},n=function(){var i={};return function(a){var o=a.next;return i[o]?!1:(i[o]=!0,!0)}}();return e.allowTraversal=r.allowTraversal||n,e.enter=r.enter||t,e.leave=r.leave||t,e}function ZA(r,e,t,n,i){i===void 0&&(i=!0),n.enter({current:e,previous:t});var a=r.edges,o=a===void 0?[]:a;Kn(e,o,i?"target":void 0).forEach(function(s){n.allowTraversal({previous:t,current:e,next:s})&&ZA(r,s,e,n,i)}),n.leave({current:e,previous:t})}function Om(r,e,t,n){n===void 0&&(n=!0),ZA(r,e,"",sz(t),n)}var Dm=function(e){var t=null,n=e.nodes,i=n===void 0?[]:n,a={},o={},s={},u={};i.forEach(function(c){o[c.id]=c});for(var f={enter:function(h){var d=h.current,v=h.previous;if(s[d]){t={};for(var p=d,g=v;g!==d;)t[p]=g,p=g,g=a[g];t[p]=g}else s[d]=d,delete o[d],a[d]=v},leave:function(h){var d=h.current;u[d]=d,delete s[d]},allowTraversal:function(h){var d=h.next;return t?!1:!u[d]}};Object.keys(o).length;){var l=Object.keys(o)[0];Om(e,l,f)}return t},Pm=function(e,t,n){var i,a;n===void 0&&(n=!0);for(var o=[],s=Nm(e,!1),u=0,f=s;u<f.length;u++){var l=f[u];if(l.length)for(var c=l[0],h=c.id,d=[c],v=(i={},i[h]=c,i),p=(a={},a[h]=new Set,a);d.length>0;)for(var g=d.pop(),y=g.id,m=Kn(y,e.edges),b=function(E){var _,M=m[E],C=e.nodes.find(function(F){return F.id===M});if(M===y)o.push((_={},_[M]=g,_));else if(!(M in p))v[M]=g,d.push(C),p[M]=new Set([g]);else if(!p[y].has(C)){for(var S=!0,A=[C,g],T=v[y];p[M].size&&!p[M].has(T)&&(A.push(T),T!==v[T.id]);)T=v[T.id];if(A.push(T),t&&n?(S=!1,A.findIndex(function(F){return t.indexOf(F.id)>-1})>-1&&(S=!0)):t&&!n&&A.findIndex(function(F){return t.indexOf(F.id)>-1})>-1&&(S=!1),S){for(var k={},O=1;O<A.length;O+=1)k[A[O-1].id]=A[O];A.length&&(k[A[A.length-1].id]=A[0]),o.push(k)}p[M].add(g)}},x=0;x<m.length;x+=1)b(x)}return o},Rm=function(e,t,n){n===void 0&&(n=!0);for(var i=[],a=new Set,o=[],s=[],u={},f={},l=function(T){for(var k=[T];k.length>0;){var O=k.pop();a.has(O)&&(a.delete(O),o[O.id].forEach(function(F){k.push(F)}),o[O.id].clear())}},c=function A(T,k,O){var F=!1;if(t&&n===!1&&t.indexOf(T.id)>-1)return F;i.push(T),a.add(T);for(var D=O[T.id],$=0;$<D.length;$+=1){var Y=u[D[$]];if(Y===k){for(var N={},P=1;P<i.length;P+=1)N[i[P-1].id]=i[P];i.length&&(N[i[i.length-1].id]=i[0]),s.push(N),F=!0}else a.has(Y)||A(Y,k,O)&&(F=!0)}if(F)l(T);else for(var $=0;$<D.length;$+=1){var Y=u[D[$]];o[Y.id].has(T)||o[Y.id].add(T)}return i.pop(),F},h=e.nodes,d=h===void 0?[]:h,v=0;v<d.length;v+=1){var p=d[v],g=p.id;f[g]=v,u[v]=p}if(t&&n)for(var y=function(T){var k=t[T];f[d[T].id]=f[k],f[k]=0,u[0]=d.find(function(O){return O.id===k}),u[f[d[T].id]]=d[T]},v=0;v<t.length;v++)y(v);for(var m=function(T){for(var k,O,F=1/0,D=0;D<T.length;D+=1)for(var $=T[D],Y=0;Y<$.length;Y++){var N=f[$[Y].id];N<F&&(F=N,O=D)}for(var P=T[O],W=[],D=0;D<P.length;D+=1){var J=P[D];W[J.id]=[];for(var te=0,H=Kn(J.id,e.edges,"target").filter(function(Ne){return P.map(function(Ze){return Ze.id}).indexOf(Ne)>-1});te<H.length;te++){var pe=H[te];pe===J.id&&!(n===!1&&t.indexOf(J.id)>-1)?s.push((k={},k[J.id]=J,k)):W[J.id].push(f[pe])}}return{component:P,adjList:W,minIdx:F}},b=0;b<d.length;){var x=d.filter(function(A){return f[A.id]>=b}),w=VA({nodes:x,edges:e.edges}).filter(function(A){return A.length>1});if(w.length===0)break;var E=m(w),_=E.minIdx,M=E.adjList,C=E.component;if(C.length>1){C.forEach(function(A){o[A.id]=new Set});var S=u[_];if(t&&n&&t.indexOf(S.id)===-1)return s;c(S,S,M),b=_+1}else break}return s},KA=function(e,t,n,i){return i===void 0&&(i=!0),t?Rm(e,n,i):Pm(e,n,i)},uz=function(e,t,n){for(var i=1/0,a,o=0;o<t.length;o++){var s=t[o].id;!n[s]&&e[s]<=i&&(i=e[s],a=t[o])}return a},ml=function(e,t,n,i){var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,f={},l={},c={};o.forEach(function(m,b){var x=m.id;l[x]=1/0,x===t&&(l[x]=0)});for(var h=o.length,d=function(b){var x=uz(l,o,f),w=x.id;if(f[w]=!0,l[w]===1/0)return"continue";var E=[];n?E=iz(w,u):E=Kh(w,u),E.forEach(function(_){var M=_.target,C=_.source,S=M===w?C:M,A=i&&_[i]?_[i]:1;l[S]>l[x.id]+A?(l[S]=l[x.id]+A,c[S]=[x.id]):l[S]===l[x.id]+A&&c[S].push(x.id)})},v=0;v<h;v++)d();c[t]=[t];var p={};for(var g in l)l[g]!==1/0&&QA(t,g,c,p);var y={};for(var g in p)y[g]=p[g][0];return{length:l,path:y,allPath:p}};function QA(r,e,t,n){if(r===e)return[r];if(n[e])return n[e];for(var i=[],a=0,o=t[e];a<o.length;a++){var s=o[a],u=QA(r,s,t,n);if(!u)return;for(var f=0,l=u;f<l.length;f++){var c=l[f];pt(c)?i.push(Jn(Jn([],c,!0),[e],!1)):i.push([c,e])}}return n[e]=i,n[e]}var JA=function(e,t,n,i,a){var o=ml(e,t,i,a),s=o.length,u=o.path,f=o.allPath;return{length:s[n],path:u[n],allPath:f[n]}},eT=function(e,t,n,i){var a;if(t===n)return[[t]];var o=e.edges,s=o===void 0?[]:o,u=[t],f=(a={},a[t]=!0,a),l=[],c=[],h=i?Kn(t,s,"target"):Kn(t,s);for(l.push(h);u.length>0&&l.length>0;){var d=l[l.length-1];if(d.length){var v=d.shift();v&&(u.push(v),f[v]=!0,h=i?Kn(v,s,"target"):Kn(v,s),l.push(h.filter(function(y){return!f[y]})))}else{var p=u.pop();f[p]=!1,l.pop();continue}if(u[u.length-1]===n){var g=u.map(function(m){return m});c.push(g);var p=u.pop();f[p]=!1,l.pop()}}return c},bl=function(e,t){for(var n=Ss(e,t),i=[],a=n.length,o=0;o<a;o+=1){i[o]=[];for(var s=0;s<a;s+=1)o===s?i[o][s]=0:n[o][s]===0||!n[o][s]?i[o][s]=1/0:i[o][s]=n[o][s]}for(var u=0;u<a;u+=1)for(var o=0;o<a;o+=1)for(var s=0;s<a;s+=1)i[o][s]>i[o][u]+i[u][s]&&(i[o][s]=i[o][u]+i[u][s]);return i},tT=function(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e3);var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,f={},l={};o.forEach(function(b,x){var w=YA();b.clusterId=w,f[w]={id:w,nodes:[b]},l[b.id]={node:b,idx:x}});var c=Ss(e,t),h={};c.forEach(function(b,x){var w=o[x].id;h[w]={},b.forEach(function(E,_){if(E){var M=o[_].id;h[w][M]=E}})});for(var d=0,v=function(){var x=!1;if(o.forEach(function(w){var E={};Object.keys(h[w.id]).forEach(function(O){var F=h[w.id][O],D=l[O].node,$=D.clusterId;E[$]||(E[$]=0),E[$]+=F});var _=-1/0,M=[];if(Object.keys(E).forEach(function(O){_<E[O]?(_=E[O],M=[O]):_===E[O]&&M.push(O)}),!(M.length===1&&M[0]===w.clusterId)){var C=M.indexOf(w.clusterId);if(C>=0&&M.splice(C,1),M&&M.length){x=!0;var S=f[w.clusterId],A=S.nodes.indexOf(w);S.nodes.splice(A,1);var T=Math.floor(Math.random()*M.length),k=f[M[T]];k.nodes.push(w),w.clusterId=k.id}}}),!x)return"break";d++};d<i;){var p=v();if(p==="break")break}Object.keys(f).forEach(function(b){var x=f[b];(!x.nodes||!x.nodes.length)&&delete f[b]});var g=[],y={};u.forEach(function(b){var x=b.source,w=b.target,E=b[n]||1,_=l[x].node.clusterId,M=l[w].node.clusterId,C="".concat(_,"---").concat(M);if(y[C])y[C].weight+=E,y[C].count++;else{var S={source:_,target:M,weight:E,count:1};y[C]=S,g.push(S)}});var m=[];return Object.keys(f).forEach(function(b){m.push(f[b])}),{clusters:m,clusterEdges:g}},di=function(){function r(e){this.arr=e}return r.prototype.getArr=function(){return this.arr||[]},r.prototype.add=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length))return new r(n);if(!(n!=null&&n.length))return new r(this.arr);if(this.arr.length===n.length){var i=[];for(var a in this.arr)i[a]=this.arr[a]+n[a];return new r(i)}},r.prototype.subtract=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length))return new r(n);if(!(n!=null&&n.length))return new r(this.arr);if(this.arr.length===n.length){var i=[];for(var a in this.arr)i[a]=this.arr[a]-n[a];return new r(i)}},r.prototype.avg=function(e){var t=[];if(e!==0)for(var n in this.arr)t[n]=this.arr[n]/e;return new r(t)},r.prototype.negate=function(){var e=[];for(var t in this.arr)e[t]=-this.arr[t];return new r(e)},r.prototype.squareEuclideanDistance=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var i=0;for(var a in this.arr)i+=Math.pow(this.arr[a]-e.arr[a],2);return i}},r.prototype.euclideanDistance=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var i=0;for(var a in this.arr)i+=Math.pow(this.arr[a]-e.arr[a],2);return Math.sqrt(i)}else console.error("The two vectors are unequal in length.")},r.prototype.normalize=function(){var e=[],t=Vt(this.arr);t.sort(function(o,s){return o-s});var n=t[t.length-1],i=t[0];for(var a in this.arr)e[a]=(this.arr[a]-i)/(n-i);return new r(e)},r.prototype.norm2=function(){var e;if(!(!((e=this.arr)===null||e===void 0)&&e.length))return 0;var t=0;for(var n in this.arr)t+=Math.pow(this.arr[n],2);return Math.sqrt(t)},r.prototype.dot=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var i=0;for(var a in this.arr)i+=this.arr[a]*e.arr[a];return i}else console.error("The two vectors are unequal in length.")},r.prototype.equal=function(e){var t,n=e.arr;if(((t=this.arr)===null||t===void 0?void 0:t.length)!==(n==null?void 0:n.length))return!1;for(var i in this.arr)if(this.arr[i]!==n[i])return!1;return!0},r}(),Bm=function(e,t){t===void 0&&(t=void 0);var n=[];return e.forEach(function(i){t===void 0&&n.push(i),i[t]!==void 0&&n.push(i[t])}),n},Ii;(function(r){r.EuclideanDistance="euclideanDistance"})(Ii||(Ii={}));var fz=function(e,t,n){var i=[];t!=null&&t.length?i=t:(e.forEach(function(o){i=i.concat(Object.keys(o))}),i=gl(i));var a={};return i.forEach(function(o){var s=[];e.forEach(function(u){u[o]!==void 0&&u[o]!==""&&s.push(u[o])}),s.length&&!(n!=null&&n.includes(o))&&(a[o]=gl(s))}),a},Fm=function(e,t,n){var i=fz(e,t,n),a=[];if(!Object.keys(i).length)return a;var o=Object.values(i),s=o.every(function(u){return u.every(function(f){return typeof f=="number"})});return e.forEach(function(u,f){var l=[];Object.keys(i).forEach(function(c){var h=u[c],d=i[c],v=d.findIndex(function(y){return h===y}),p=[];if(s)p.push(h);else for(var g=0;g<d.length;g++)g===v?p.push(1):p.push(0);l=l.concat(p)}),a[f]=l}),a},Mw=function(e,t,n,i){n===void 0&&(n=Ii.EuclideanDistance);var a=0;switch(n){case Ii.EuclideanDistance:a=new di(e).euclideanDistance(new di(t));break}return a},Cw=function(e,t,n,i){for(var a=t.length,o=2*i,s=0,u=0;u<a;u++)for(var f=e[u].clusterId,l=0;l<a;l++){var c=e[l].clusterId;if(f===c){var h=t[u][l]||0,d=n[u]||0,v=n[l]||0;s+=h-d*v/o}}return s*=1/o,s},hg=function(e,t){e===void 0&&(e=[]);for(var n=e.length,i=new di([]),a=0;a<n;a++)i=i.add(new di(t[a]));var o=i.avg(n);o.normalize();for(var s=0,a=0;a<n;a++){var u=new di(t[a]),f=u.squareEuclideanDistance(o);s+=f}var l=[];e.forEach(function(){l.push([])});for(var a=0;a<n;a++){var u=new di(t[a]);e[a].clusterInertial=0;for(var c=0;c<n;c++){if(a===c){l[a][c]=0;continue}var h=new di(t[c]);l[a][c]=u.squareEuclideanDistance(h),e[a].clusterInertial+=l[a][c]}}for(var d=0,v=2*n*s,a=0;a<n;a++)for(var p=e[a].clusterId,c=0;c<n;c++){var g=e[c].clusterId;if(!(a===c||p!==g)){var y=e[a].clusterInertial*e[c].clusterInertial/Math.pow(v,2)-l[a][c]/v;d+=y}}return Number(d.toFixed(4))},Gm=function(e,t,n,i,a,o,s,u,f){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e-4),a===void 0&&(a=!1),o===void 0&&(o=void 0),s===void 0&&(s=[]),u===void 0&&(u=["id"]),f===void 0&&(f=1);var l=e.nodes,c=l===void 0?[]:l,h=e.edges,d=h===void 0?[]:h,v=[];if(a){c.forEach(function(N,P){N.properties=N.properties||{},N.originIndex=P});var p=[];c.every(function(N){return N.hasOwnProperty("nodeType")})&&(p=Array.from(new Set(c.map(function(N){return N.nodeType}))),c.forEach(function(N){N.properties.nodeType=p.findIndex(function(P){return P===N.nodeType})}));var g=Bm(c,o);v=Fm(g,s,u)}var y=1,m={},b={};c.forEach(function(N,P){var W=String(y++);N.clusterId=W,m[W]={id:W,nodes:[N]},b[N.id]={node:N,idx:P}});var x=Ss(e,t),w=[],E={},_=0;x.forEach(function(N,P){var W=0,J=c[P].id;E[J]={},N.forEach(function(te,H){if(te){W+=te;var pe=c[H].id;E[J][pe]=te,_+=te}}),w.push(W)}),_/=2;for(var M=1/0,C=1/0,S=0,A=[],T={};;){a&&c.every(function(N){return N.hasOwnProperty("properties")})?M=Cw(c,x,w,_)+hg(c,v)*f:M=Cw(c,x,w,_),S===0&&(C=M,A=c,T=m);var k=M>0&&M>C&&M-C<i;if(M>C&&(A=c.map(function(N){return{node:N,clusterId:N.clusterId}}),T=Vt(m),C=M),k||S>100)break;S++,Object.keys(m).forEach(function(N){var P=0;d.forEach(function(W){var J=W.source,te=W.target,H=b[J].node.clusterId,pe=b[te].node.clusterId;(H===N&&pe!==N||pe===N&&H!==N)&&(P=P+(W[n]||1))}),m[N].sumTot=P}),c.forEach(function(N,P){var W=m[N.clusterId],J=0,te,H=w[P]/(2*_),pe=0,Te=W.nodes;Te.forEach(function(Yt){var dr=b[Yt.id].idx;pe+=x[P][dr]||0});var Ne=pe-W.sumTot*H,Ze=Te.filter(function(Yt){return Yt.id!==N.id});Ze.forEach(function(Yt,dr){v[Yt.originIndex]});var at=hg(Ze,v)*f,nt=E[N.id];if(Object.keys(nt).forEach(function(Yt){var dr=b[Yt].node,lr=dr.clusterId;if(lr!==N.clusterId){var jt=m[lr],ir=jt.nodes;if(!(!ir||!ir.length)){var Hr=0;ir.forEach(function(Ge){var ye=b[Ge.id].idx;Hr+=x[P][ye]||0});var tt=Hr-jt.sumTot*H,ae=ir.concat([N]);ae.forEach(function(Ge,ye){v[Ge.originIndex]});var L=hg(ae,v)*f,Se=tt-Ne;a&&(Se=tt+L-(Ne+at)),Se>J&&(J=Se,te=jt)}}}),J>0){te.nodes.push(N);var _t=N.clusterId;N.clusterId=te.id;var St=W.nodes.indexOf(N);W.nodes.splice(St,1);var fr=0,Ft=0;d.forEach(function(Yt){var dr=Yt.source,lr=Yt.target,jt=b[dr].node.clusterId,ir=b[lr].node.clusterId;(jt===te.id&&ir!==te.id||ir===te.id&&jt!==te.id)&&(fr=fr+(Yt[n]||1)),(jt===_t&&ir!==_t||ir===_t&&jt!==_t)&&(Ft=Ft+(Yt[n]||1))}),te.sumTot=fr,W.sumTot=Ft}})}var O={},F=0;Object.keys(T).forEach(function(N){var P=T[N];if(!P.nodes||!P.nodes.length){delete T[N];return}var W=String(F+1);W!==N&&(P.id=W,P.nodes=P.nodes.map(function(J){return{id:J.id,clusterId:W}}),T[W]=P,O[N]=W,delete T[N],F++)}),A.forEach(function(N){var P=N.node,W=N.clusterId;P&&(P.clusterId=W,P.clusterId&&O[P.clusterId]&&(P.clusterId=O[P.clusterId]))});var D=[],$={};d.forEach(function(N){var P=N.source,W=N.target,J=N[n]||1,te=b[P].node.clusterId,H=b[W].node.clusterId;if(!(!te||!H)){var pe="".concat(te,"---").concat(H);if($[pe])$[pe].weight+=J,$[pe].count++;else{var Te={source:te,target:H,weight:J,count:1};$[pe]=Te,D.push(Te)}}});var Y=[];return Object.keys(T).forEach(function(N){Y.push(T[N])}),{clusters:Y,clusterEdges:D}},rT=function(e,t,n,i,a,o,s,u){return t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e-4),a===void 0&&(a=void 0),o===void 0&&(o=[]),s===void 0&&(s=["id"]),u===void 0&&(u=1),Gm(e,t,n,i,!0,a,o,s,u)},nT=function(e,t){var n;t===void 0&&(t=1);for(var i=Vt(e),a=i.nodes,o=a===void 0?[]:a,s=i.edges,u=s===void 0?[]:s,f=function(){var h=ja({nodes:o,edges:u}),d=Object.keys(h);d.sort(function(g,y){var m,b;return((m=h[g])===null||m===void 0?void 0:m.degree)-((b=h[y])===null||b===void 0?void 0:b.degree)});var v=d[0];if(!o.length||((n=h[v])===null||n===void 0?void 0:n.degree)>=t)return"break";var p=o.findIndex(function(g){return g.id===v});o.splice(p,1),u=u.filter(function(g){return!(g.source===v||g.target===v)})};;){var l=f();if(l==="break")break}return{nodes:o,edges:u}},Aw=function(e,t,n){var i=[];switch(e){case Ii.EuclideanDistance:i=t[n];break;default:i=[];break}return i},iT=function(e,t,n,i,a,o){t===void 0&&(t=3),n===void 0&&(n=void 0),i===void 0&&(i=[]),a===void 0&&(a=["id"]),o===void 0&&(o=Ii.EuclideanDistance);var s=e.nodes,u=s===void 0?[]:s,f=e.edges,l=f===void 0?[]:f,c={clusters:[{id:"0",nodes:u}],clusterEdges:[]};if(o===Ii.EuclideanDistance&&!u.every(function(W){return W.hasOwnProperty(n)}))return c;var h=[],d=[];if(o===Ii.EuclideanDistance&&(h=Bm(u,n),d=Fm(h,i,a)),!d.length)return c;for(var v=gl(d.map(function(W){return W.join("")})),p=Math.min(t,u.length,v.length),g=0;g<u.length;g++)u[g].originIndex=g;for(var y=[],m=[],b=[],g=0;g<p;g++)if(g===0){var x=Math.floor(Math.random()*u.length);switch(o){case Ii.EuclideanDistance:y[g]=d[x];break;default:y[g]=[];break}m.push(x),b[g]=[u[x]],u[x].clusterId=String(g)}else{for(var w=-1/0,E=0,_=function(te){if(!m.includes(te)){for(var H=0,pe=0;pe<y.length;pe++){var Te=0;switch(o){case Ii.EuclideanDistance:Te=Mw(d[u[te].originIndex],y[pe],o);break}H+=Te}var Ne=H/y.length;Ne>w&&!y.find(function(Ze){return Mo(Ze,Aw(o,d,u[te].originIndex))})&&(w=Ne,E=te)}},M=0;M<u.length;M++)_(M);y[g]=Aw(o,d,E),m.push(E),b[g]=[u[E]],u[E].clusterId=String(g)}for(var C=0;;){for(var g=0;g<u.length;g++){var S=0,A=1/0;if(!(C===0&&m.includes(g))){for(var T=0;T<y.length;T++){var k=0;switch(o){case Ii.EuclideanDistance:k=Mw(d[g],y[T],o);break}k<A&&(A=k,S=T)}if(u[g].clusterId!==void 0)for(var O=b[Number(u[g].clusterId)].length-1;O>=0;O--)b[Number(u[g].clusterId)][O].id===u[g].id&&b[Number(u[g].clusterId)].splice(O,1);u[g].clusterId=String(S),b[S].push(u[g])}}for(var F=!1,g=0;g<b.length;g++){for(var D=b[g],$=new di([]),T=0;T<D.length;T++)$=$.add(new di(d[D[T].originIndex]));var Y=$.avg(D.length);Y.equal(new di(y[g]))||(F=!0,y[g]=Y.getArr())}if(C++,u.every(function(W){return W.clusterId!==void 0})&&F||C>=1e3)break}var N=[],P={};return l.forEach(function(W){var J,te,H=W.source,pe=W.target,Te=(J=u.find(function(nt){return nt.id===H}))===null||J===void 0?void 0:J.clusterId,Ne=(te=u.find(function(nt){return nt.id===pe}))===null||te===void 0?void 0:te.clusterId,Ze="".concat(Te,"---").concat(Ne);if(P[Ze])P[Ze].count++;else{var at={source:Te,target:Ne,count:1};P[Ze]=at,N.push(at)}}),{clusters:b,clusterEdges:N}},zm=function(e,t){var n=new di(t),i=n.norm2(),a=new di(e),o=a.norm2(),s=n.dot(a),u=i*o,f=u?s/u:0;return f},aT=function(e,t,n,i,a){e===void 0&&(e=[]),n===void 0&&(n=void 0),i===void 0&&(i=[]),a===void 0&&(a=[]);var o=Vt(e.filter(function(h){return h.id!==t.id})),s=e.findIndex(function(h){return h.id===t.id}),u=Bm(e,n),f=Fm(u,i,a),l=f[s],c=[];return o.forEach(function(h,d){if(h.id!==t.id){var v=f[d],p=zm(v,l);c.push(p),h.cosineSimilarity=p}}),o.sort(function(h,d){return d.cosineSimilarity-h.cosineSimilarity}),{allCosineSimilarity:c,similarNodes:o}},lz=function(){function r(e){this.count=e.length,this.parent={};for(var t=0,n=e;t<n.length;t++){var i=n[t];this.parent[i]=i}}return r.prototype.find=function(e){for(;this.parent[e]!==e;)e=this.parent[e];return e},r.prototype.union=function(e,t){var n=this.find(e),i=this.find(t);n!==i&&(n<i?(this.parent[t]!==t&&this.union(this.parent[t],e),this.parent[t]=this.parent[e]):(this.parent[e]!==e&&this.union(this.parent[e],t),this.parent[e]=this.parent[t]))},r.prototype.connected=function(e,t){return this.find(e)===this.find(t)},r}(),cz=function(e,t){return e-t},hz=function(){function r(e){e===void 0&&(e=cz),this.compareFn=e,this.list=[]}return r.prototype.getLeft=function(e){return 2*e+1},r.prototype.getRight=function(e){return 2*e+2},r.prototype.getParent=function(e){return e===0?null:Math.floor((e-1)/2)},r.prototype.isEmpty=function(){return this.list.length<=0},r.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},r.prototype.delMin=function(){var e=this.top(),t=this.list.pop();return this.list.length>0&&(this.list[0]=t,this.moveDown(0)),e},r.prototype.insert=function(e){if(e!==null){this.list.push(e);var t=this.list.length-1;return this.moveUp(t),!0}return!1},r.prototype.moveUp=function(e){for(var t=this.getParent(e);e&&e>0&&this.compareFn(this.list[t],this.list[e])>0;){var n=this.list[t];this.list[t]=this.list[e],this.list[e]=n,e=t,t=this.getParent(e)}},r.prototype.moveDown=function(e){var t,n=e,i=this.getLeft(e),a=this.getRight(e),o=this.list.length;i!==null&&i<o&&this.compareFn(this.list[n],this.list[i])>0?n=i:a!==null&&a<o&&this.compareFn(this.list[n],this.list[a])>0&&(n=a),e!==n&&(t=[this.list[n],this.list[e]],this.list[e]=t[0],this.list[n]=t[1],this.moveDown(n))},r}(),dz=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=a[0],f=new Set;f.add(u);var l=function(g,y){return t?g.weight-y.weight:0},c=new hz(l);for(Kh(u.id,s).forEach(function(p){c.insert(p)});!c.isEmpty();){var h=c.delMin(),d=h.source,v=h.target;f.has(d)&&f.has(v)||(n.push(h),f.has(d)||(f.add(d),Kh(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),Kh(v,s).forEach(function(p){c.insert(p)})))}return n},Tw=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=s.map(function(d){return d});t&&u.sort(function(d,v){return d.weight-v.weight});for(var f=new lz(a.map(function(d){return d.id}));u.length>0;){var l=u.shift(),c=l.source,h=l.target;f.connected(c,h)||(n.push(l),f.union(c,h))}return n},oT=function(e,t,n){var i={prim:dz,kruskal:Tw};return n?i[n](e,t):Tw(e,t)},sT=function(e,t,n){typeof t!="number"&&(t=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,o=1e3,s=e.nodes,u=s===void 0?[]:s,f=e.edges,l=f===void 0?[]:f,c=u.length,h,d={},v={},p=0;p<c;++p){var g=u[p],y=g.id;d[y]=1/c,v[y]=1/c}for(var m=ja(e);o>0&&i>t;){a=0;for(var p=0;p<c;++p){var g=u[p],y=g.id;if(h=0,m[g.id].inDegree===0)d[y]=0;else{for(var b=Kn(y,l,"source"),x=0;x<b.length;++x){var w=b[x],E=m[w].outDegree;E>0&&(h+=v[w]/E)}d[y]=n*h,a+=d[y]}}a=(1-a)/c,i=0;for(var p=0;p<c;++p){var g=u[p],y=g.id;h=d[y]+a,i+=Math.abs(h-v[y]),v[y]=h}o-=1}return v},vz=-1,Sd=-1,uT="-1",ta="-1",fT=-1,Iw=function(){function r(e,t,n,i){e===void 0&&(e=vz),t===void 0&&(t=Sd),n===void 0&&(n=Sd),i===void 0&&(i=uT),this.id=e,this.from=t,this.to=n,this.label=i}return r}(),pz=function(){function r(e,t){e===void 0&&(e=Sd),t===void 0&&(t=ta),this.id=e,this.label=t,this.edges=[],this.edgeMap={}}return r.prototype.addEdge=function(e){this.edges.push(e),this.edgeMap[e.id]=e},r}(),lT=function(){function r(e,t,n){e===void 0&&(e=Sd),t===void 0&&(t=!0),n===void 0&&(n=!1),this.id=e,this.edgeIdAutoIncrease=t,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=n}return r.prototype.getNodeNum=function(){return this.nodes.length},r.prototype.addNode=function(e,t){if(!this.nodeMap[e]){var n=new pz(e,t);this.nodes.push(n),this.nodeMap[e]=n,this.nodeLabelMap[t]||(this.nodeLabelMap[t]=[]),this.nodeLabelMap[t].push(e)}},r.prototype.addEdge=function(e,t,n,i){if((this.edgeIdAutoIncrease||e===void 0)&&(e=this.counter++),!(this.nodeMap[t]&&this.nodeMap[n]&&this.nodeMap[n].edgeMap[e])){var a=new Iw(e,t,n,i);if(this.edges.push(a),this.edgeMap[e]=a,this.nodeMap[t].addEdge(a),this.edgeLabelMap[i]||(this.edgeLabelMap[i]=[]),this.edgeLabelMap[i].push(a),!this.directed){var o=new Iw(e,n,t,i);this.nodeMap[n].addEdge(o),this.edgeLabelMap[i].push(o)}}},r}(),os=function(){function r(e,t,n,i,a){this.fromNode=e,this.toNode=t,this.nodeEdgeNodeLabel={nodeLabel1:n||ta,edgeLabel:i||uT,nodeLabel2:a||ta}}return r.prototype.equalTo=function(e){return this.fromNode===e.formNode&&this.toNode===e.toNode&&this.nodeEdgeNodeLabel===e.nodeEdgeNodeLabel},r.prototype.notEqualTo=function(e){return!this.equalTo(e)},r}(),kw=function(){function r(){this.rmpath=[],this.dfsEdgeList=[]}return r.prototype.equalTo=function(e){var t=this.dfsEdgeList.length,n=e.length;if(t!==n)return!1;for(var i=0;i<t;i++)if(this.dfsEdgeList[i]!==e[i])return!1;return!0},r.prototype.notEqualTo=function(e){return!this.equalTo(e)},r.prototype.pushBack=function(e,t,n,i,a){return this.dfsEdgeList.push(new os(e,t,n,i,a)),this.dfsEdgeList},r.prototype.toGraph=function(e,t){e===void 0&&(e=fT),t===void 0&&(t=!1);var n=new lT(e,!0,t);return this.dfsEdgeList.forEach(function(i){var a=i.fromNode,o=i.toNode,s=i.nodeEdgeNodeLabel,u=s.nodeLabel1,f=s.edgeLabel,l=s.nodeLabel2;u!==ta&&n.addNode(a,u),l!==ta&&n.addNode(o,l),u!==ta&&l!==u&&n.addEdge(void 0,a,o,f)}),n},r.prototype.buildRmpath=function(){this.rmpath=[];for(var e=void 0,t=this.dfsEdgeList.length,n=t-1;n>=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,o=i.toNode;a<o&&(e===void 0||o===e)&&(this.rmpath.push(n),e=a)}return this.rmpath},r.prototype.getNodeNum=function(){var e={};return this.dfsEdgeList.forEach(function(t){e[t.fromNode]||(e[t.fromNode]=!0),e[t.toNode]||(e[t.toNode]=!0)}),Object.keys(e).length},r}(),Zc=function(){function r(e){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!e){for(;e;){var t=e.edge;this.edges.push(t),this.nodesUsed[t.from]=1,this.nodesUsed[t.to]=1,this.edgesUsed[t.id]=1,e=e.preNode}this.edges=this.edges.reverse()}}return r.prototype.hasNode=function(e){return this.nodesUsed[e.id]===1},r.prototype.hasEdge=function(e){return this.edgesUsed[e.id]===1},r}(),gz=function(){function r(e){var t=e.graphs,n=e.minSupport,i=n===void 0?2:n,a=e.minNodeNum,o=a===void 0?1:a,s=e.maxNodeNum,u=s===void 0?4:s,f=e.top,l=f===void 0?10:f,c=e.directed,h=c===void 0?!1:c,d=e.verbose,v=d===void 0?!1:d;this.graphs=t,this.dfsCode=new kw,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=i,this.top=l,this.directed=h,this.counter=0,this.maxNodeNum=u,this.minNodeNum=o,this.verbose=v,this.maxNodeNum<this.minNodeNum&&(this.maxNodeNum=this.minNodeNum),this.reportDF=[]}return r.prototype.findForwardRootEdges=function(e,t){var n=this,i=[],a=e.nodeMap;return t.edges.forEach(function(o){(n.directed||t.label<=a[o.to].label)&&i.push(o)}),i},r.prototype.findBackwardEdge=function(e,t,n,i){if(!this.directed&&t===n)return null;for(var a=e.nodeMap,o=a[n.to],s=o.edges,u=s.length,f=0;f<u;f++){var l=s[f];if(!(i.hasEdge(l)||l.to!==t.from)){if(this.directed){if(a[t.from].label<a[n.to].label||a[t.from].label===a[n.to].label&&t.label<=l.label)return l}else if(t.label<l.label||t.label===l.label&&a[t.to].label<=a[n.to].label)return l}}return null},r.prototype.findForwardPureEdges=function(e,t,n,i){for(var a=[],o=t.to,s=e.nodeMap[o].edges,u=s.length,f=0;f<u;f++){var l=s[f],c=e.nodeMap[l.to];n<=c.label&&!i.hasNode(c)&&a.push(l)}return a},r.prototype.findForwardRmpathEdges=function(e,t,n,i){for(var a=[],o=e.nodeMap,s=o[t.to].label,u=o[t.from],f=u.edges,l=f.length,c=0;c<l;c++){var h=f[c],d=o[h.to].label;t.to===h.to||n>d||i.hasNode(o[h.to])||(t.label<h.label||t.label===h.label&&s<=d)&&a.push(h)}return a},r.prototype.getSupport=function(e){var t={};return e.forEach(function(n){t[n.graphId]||(t[n.graphId]=!0)}),Object.keys(t).length},r.prototype.findMinLabel=function(e){var t=void 0;return Object.keys(e).forEach(function(n){var i=e[n],a=i.nodeLabel1,o=i.edgeLabel,s=i.nodeLabel2;if(!t){t={nodeLabel1:a,edgeLabel:o,nodeLabel2:s};return}(a<t.nodeLabel1||a===t.nodeLabel1&&o<t.edgeLabel||a===t.nodeLabel1&&o===t.edgeLabel&&s<t.nodeLabel2)&&(t={nodeLabel1:a,edgeLabel:o,nodeLabel2:s})}),t},r.prototype.isMin=function(){var e=this,t=this.dfsCode;if(this.verbose&&console.log("isMin checking",t),t.dfsEdgeList.length===1)return!0;var n=this.directed,i=t.toGraph(fT,n),a=i.nodeMap,o=new kw,s={};i.nodes.forEach(function(c){var h=e.findForwardRootEdges(i,c);h.forEach(function(d){var v=a[d.to],p="".concat(c.label,"-").concat(d.label,"-").concat(v.label);s[p]||(s[p]={projected:[],nodeLabel1:c.label,edgeLabel:d.label,nodeLabel2:v.label});var g={graphId:i.id,edge:d,preNode:null};s[p].projected.push(g)})});var u=this.findMinLabel(s);if(u){o.dfsEdgeList.push(new os(0,1,u.nodeLabel1,u.edgeLabel,u.nodeLabel2));var f=function c(h){for(var d=o.buildRmpath(),v=o.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,p=o.dfsEdgeList[d[0]].toNode,g={},y=!1,m=0,b=n?-1:0,x=function($){if(y)return"break";h.forEach(function(Y){var N=new Zc(Y),P=e.findBackwardEdge(i,N.edges[d[$]],N.edges[d[0]],N);P&&(g[P.label]||(g[P.label]={projected:[],edgeLabel:P.label}),g[P.label].projected.push({graphId:i.id,edge:g,preNode:Y}),m=o.dfsEdgeList[d[$]].fromNode,y=!0)})},w=d.length-1;w>b;w--){var E=x(w);if(E==="break")break}if(y){var _=e.findMinLabel(g);o.dfsEdgeList.push(new os(p,m,ta,_.edgeLabel,ta));var M=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[M]!==o.dfsEdgeList[M]?!1:c(g[_.edgeLabel].projected)}var C={};y=!1;var S=0;h.forEach(function(D){var $=new Zc(D),Y=e.findForwardPureEdges(i,$.edges[d[0]],v,$);Y.length>0&&(y=!0,S=p,Y.forEach(function(N){var P="".concat(N.label,"-").concat(a[N.to].label);C[P]||(C[P]={projected:[],edgeLabel:N.label,nodeLabel2:a[N.to].label}),C[P].projected.push({graphId:i.id,edge:N,preNode:D})}))});for(var A=d.length,T=function($){if(y)return"break";var Y=d[$];h.forEach(function(N){var P=new Zc(N),W=e.findForwardRmpathEdges(i,P.edges[Y],v,P);W.length>0&&(y=!0,S=o.dfsEdgeList[Y].fromNode,W.forEach(function(J){var te="".concat(J.label,"-").concat(a[J.to].label);C[te]||(C[te]={projected:[],edgeLabel:J.label,nodeLabel2:a[J.to].label}),C[te].projected.push({graphId:i.id,edge:J,preNode:N})}))})},w=0;w<A;w++){var k=T(w);if(k==="break")break}if(!y)return!0;var O=e.findMinLabel(C);o.dfsEdgeList.push(new os(S,p+1,ta,O.edgeLabel,O.nodeLabel2));var F=o.dfsEdgeList.length-1;return t.dfsEdgeList[F]!==o.dfsEdgeList[F]?!1:c(C["".concat(O.edgeLabel,"-").concat(O.nodeLabel2)].projected)},l="".concat(u.nodeLabel1,"-").concat(u.edgeLabel,"-").concat(u.nodeLabel2);return f(s[l].projected)}},r.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var e=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push(Vt(e))}},r.prototype.subGraphMining=function(e){var t=this,n=this.getSupport(e);if(!(n<this.minSupport)&&this.isMin()){this.report();var i=this.dfsCode.getNodeNum(),a=this.dfsCode.buildRmpath(),o=this.dfsCode.dfsEdgeList[a[0]].toNode,s=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,u={},f={};e.forEach(function(l){for(var c=t.graphs[l.graphId],h=c.nodeMap,d=new Zc(l),v=a.length-1;v>=0;v--){var p=t.findBackwardEdge(c,d.edges[a[v]],d.edges[a[0]],d);if(p){var g="".concat(t.dfsCode.dfsEdgeList[a[v]].fromNode,"-").concat(p.label);f[g]||(f[g]={projected:[],toNodeId:t.dfsCode.dfsEdgeList[a[v]].fromNode,edgeLabel:p.label}),f[g].projected.push({graphId:l.graphId,edge:p,preNode:l})}}if(!(i>=t.maxNodeNum)){var y=t.findForwardPureEdges(c,d.edges[a[0]],s,d);y.forEach(function(b){var x="".concat(o,"-").concat(b.label,"-").concat(h[b.to].label);u[x]||(u[x]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:h[b.to].label}),u[x].projected.push({graphId:l.graphId,edge:b,preNode:l})});for(var m=function(x){var w=t.findForwardRmpathEdges(c,d.edges[a[x]],s,d);w.forEach(function(E){var _="".concat(t.dfsCode.dfsEdgeList[a[x]].fromNode,"-").concat(E.label,"-").concat(h[E.to].label);u[_]||(u[_]={projected:[],fromNodeId:t.dfsCode.dfsEdgeList[a[x]].fromNode,edgeLabel:E.label,nodeLabel2:h[E.to].label}),u[_].projected.push({graphId:l.graphId,edge:E,preNode:l})})},v=0;v<a.length;v++)m(v)}}),Object.keys(f).forEach(function(l){var c=f[l],h=c.toNodeId,d=c.edgeLabel;t.dfsCode.dfsEdgeList.push(new os(o,h,"-1",d,"-1")),t.subGraphMining(f[l].projected),t.dfsCode.dfsEdgeList.pop()}),Object.keys(u).forEach(function(l){var c=u[l],h=c.fromNodeId,d=c.edgeLabel,v=c.nodeLabel2;t.dfsCode.dfsEdgeList.push(new os(h,o+1,ta,d,v)),t.subGraphMining(u[l].projected),t.dfsCode.dfsEdgeList.pop()})}},r.prototype.generate1EdgeFrequentSubGraphs=function(){var e=this.graphs,t=this.directed,n=this.minSupport,i=this.frequentSize1Subgraphs,a={},o={},s={};return Object.keys(e).forEach(function(u){var f=e[u],l=f.nodeMap;f.nodes.forEach(function(c,h){var d=c.label,v="".concat(u,"-").concat(d);if(!s[v]){var p=a[d]||0;p++,a[d]=p}s[v]={graphKey:u,label:d},c.edges.forEach(function(g){var y=d,m=l[g.to].label;if(!t&&y>m){var b=m;m=y,y=b}var x=g.label,w="".concat(y,"-").concat(x,"-").concat(m);if(!o[w]){var E=o[w]||0;E++,o[w]=E}})})}),Object.keys(a).forEach(function(u){var f=a[u];if(!(f<n)){var l={nodes:[],edges:[]};l.nodes.push({id:"0",label:u}),i.push(l)}}),i},r.prototype.run=function(){var e=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var t=this.graphs;this.directed;var n={};Object.keys(t).forEach(function(i){var a=t[i],o=a.nodeMap;a.nodes.forEach(function(s){var u=e.findForwardRootEdges(a,s);u.forEach(function(f){var l=o[f.to],c="".concat(s.label,"-").concat(f.label,"-").concat(l.label);n[c]||(n[c]={projected:[],nodeLabel1:s.label,edgeLabel:f.label,nodeLabel2:l.label});var h={graphId:i,edge:f,preNode:null};n[c].projected.push(h)})})}),Object.keys(n).forEach(function(i){var a=n[i],o=a.projected,s=a.nodeLabel1,u=a.edgeLabel,f=a.nodeLabel2;e.dfsCode.dfsEdgeList.push(new os(0,1,s,u,f)),e.subGraphMining(o),e.dfsCode.dfsEdgeList.pop()})}},r}(),yz=function(e,t,n,i){var a={};return Object.keys(e).forEach(function(o,s){var u=e[o],f=new lT(s,!0,t),l={};u.nodes.forEach(function(c,h){f.addNode(h,c[n]),l[c.id]=h}),u.edges.forEach(function(c,h){var d=l[c.source],v=l[c.target];f.addEdge(-1,d,v,c[i])}),f&&f.getNodeNum()&&(a[f.id]=f)}),a},mz=function(e,t,n){var i=[];return e.forEach(function(a){var o={nodes:[],edges:[]};a.nodes.forEach(function(s){var u;o.nodes.push((u={id:"".concat(s.id)},u[t]=s.label,u))}),a.edges.forEach(function(s){var u;o.edges.push((u={source:"".concat(s.from),target:"".concat(s.to)},u[n]=s.label,u))}),i.push(o)}),i},Lw="cluster",bz=function(e){var t=e.graphs,n=e.directed,i=n===void 0?!1:n,a=e.nodeLabelProp,o=a===void 0?Lw:a,s=e.edgeLabelProp,u=s===void 0?Lw:s,f=yz(t,i,o,u),l=e.minSupport,c=e.maxNodeNum,h=e.minNodeNum,d=e.verbose,v=e.top,p={graphs:f,minSupport:l,maxNodeNum:c,minNodeNum:h,top:v,verbose:d,directed:i},g=new gz(p);g.run();var y=mz(g.frequentSubgraphs,o,u);return y},Nw=function(e,t,n,i){n===void 0&&(n="cluster"),i===void 0&&(i=2);var a=[],o=e.nodes;return t.forEach(function(s,u){a.push(cT(o,s,u,n,i))}),a},cT=function(e,t,n,i,a){var o=[n],s=[],u={};return t.forEach(function(f,l){if(f<=a&&n!==l){o.push(l),s.push(e[l]);var c=e[l][i];u[c]?(u[c].count++,u[c].dists.push(f)):u[c]={count:1,dists:[f]}}}),Object.keys(u).forEach(function(f){u[f].dists=u[f].dists.sort(function(l,c){return l-c})}),{nodeIdx:n,nodeId:e[n].id,nodeIdxs:o,neighbors:s,neighborNum:o.length-1,nodeLabelCountMap:u}},xz=function(e,t,n,i,a){var o=Math.ceil(n/t),s={},u=0;return i.forEach(function(f,l){for(var c=0,h=0,d=f.nodeIdxs,v=f.neighborNum-1;c<o;){for(var p=d[1+Math.floor(Math.random()*v)],g=0;(s["".concat(l,"-").concat(p)]||s["".concat(p,"-").concat(l)])&&(p=Math.floor(Math.random()*t),g++,!(g>2*t)););if(g<2*t&&(s["".concat(l,"-").concat(p)]={start:l,end:p,distance:a[l][p]},c++,u++,u>=n))return s;if(h++,h>2*t)break}if(c<o){var y=o-c;o=(o+y)/(t-l-1)}}),s},Qh=function(e,t,n,i){var a=n.nodes;return i||(i={}),Object.keys(e).forEach(function(o){var s,u;if(!(i&&i[o])){i[o]={nodes:[],edges:[]};var f=e[o],l=(s=t[f.start])===null||s===void 0?void 0:s.nodeIdxs,c=(u=t[f.end])===null||u===void 0?void 0:u.nodeIdxs;if(!(!l||!c)){var h=new Set(c),d=l.filter(function(m){return h.has(m)});if(!(!d||!d.length)){for(var v={},p=d.length,g=0;g<p;g++){var y=a[d[g]];i[o].nodes.push(y),v[y.id]=!0}n.edges.forEach(function(m){v[m.source]&&v[m.target]&&i[o].edges.push(m)})}}}}),i},Jh=function(e,t,n,i){var a,o,s={};e.nodes.forEach(function(f){s[f.id]=f});var u=0;return!(!((a=t==null?void 0:t.edges)===null||a===void 0)&&a.length)||((o=t==null?void 0:t.nodes)===null||o===void 0?void 0:o.length)<2?0:(e.edges.forEach(function(f){var l=s[f.source][n],c=s[f.target][n],h=t==null?void 0:t.nodes[0][n],d=t==null?void 0:t.nodes[1][n],v=t==null?void 0:t.edges[0][i];f[i]===v&&(l===h&&c===d||l===d&&c===h)&&u++}),u)},wz=function(e,t,n){for(var i=1/0,a=0,o=function(f){var l=e[f],c=Object.keys(l).sort(function(m,b){return l[m]-l[b]}),h=10,d=[];c.forEach(function(m,b){d[b%h]||(d[b%h]={graphs:[],totalCount:0,aveCount:0}),d[b%h].graphs.push(m),d[b%h].totalCount+=l[m]});var v=0,p=[];d.forEach(function(m){var b=m.totalCount/m.graphs.length;m.aveCount=b,p.push(b);var x=0,w=m.length;m.graphs.forEach(function(E,_){var M=l[E];m.graphs.forEach(function(C,S){_!==S&&(x+=Math.abs(M-l[C]))})}),x/=w*(w-1)/2,v+=x}),v/=d.length;var g=0;p.forEach(function(m,b){p.forEach(function(x,w){b!==w&&(g+=Math.abs(m-x))}),g/=p.length*(p.length-1)/2});var y=g-v;i<y&&(i=y,a=f)},s=0;s<t;s++)o(s);return{structure:n[a],structureCountMap:e[a]}},Ow=function(e,t){var n={},i={};return e.forEach(function(a,o){n[a.id]={idx:o,node:a,degree:0,inDegree:0,outDegree:0};var s=a[t];i[s]||(i[s]=[]),i[s].push(a)}),{nodeMap:n,nodeLabelMap:i}},Dw=function(e,t,n){var i={},a={};return e.forEach(function(o,s){i["".concat(YA)]={idx:s,edge:o};var u=o[t];a[u]||(a[u]=[]),a[u].push(o);var f=n[o.source];f&&(f.degree++,f.outDegree++);var l=n[o.target];l&&(l.degree++,l.inDegree++)}),{edgeMap:i,edgeLabelMap:a}},Pw=function(e,t,n){var i=t.length,a={};return t.forEach(function(o,s){for(var u=n?0:s+1,f=e[s].id,l=u;l<i;l++)if(s!==l){var c=e[l].id,h=o[l];a["".concat(f,"-").concat(c)]=h,n||(a["".concat(c,"-").concat(f)]=h)}}),a},Ez=function(e,t,n,i,a,o,s,u,f,l,c){var h,d="".concat(t.id,"-").concat(n.id);if(l&&l[d])return l[d];var v=c?c[d]:void 0;if(!v){var p=(h={},h[d]={start:i[t.id].idx,end:i[n.id].idx,distance:a},h);c=Qh(p,o,e,c),v=c[d]}return Jh(v,s,u,f)},Rw=function(e,t,n,i){var a,o,s,u=(a=e[t])===null||a===void 0?void 0:a.degree,f=(o=e[t])===null||o===void 0?void 0:o.inDegree,l=(s=e[t])===null||s===void 0?void 0:s.outDegree;return e[t]===void 0&&(u=1/0,f=1/0,l=1/0,i[t].forEach(function(c){var h=n[c.id].degree;u>h&&(u=h);var d=n[c.id].inDegree;f>d&&(f=d);var v=n[c.id].outDegree;l>v&&(l=v)}),e[t]={degree:u,inDegree:f,outDegree:l}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:f,minPatternNodeLabelOutDegree:l}},hT=function(e,t,n,i,a,o,s){var u;if(n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),!(!e||!e.nodes)){var f=e.nodes.length;if(f){var l=bl(e,n),c=bl(t,n),h=Pw(e.nodes,l,n),d=Pw(t.nodes,c,n),v=Ow(e.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=Ow(t.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;Dw(e.edges,s,p);var x=Dw(t.edges,s,m).edgeLabelMap,w=[];c==null||c.forEach(function(tt){w=w.concat(tt)}),a||(a=Math.max.apply(Math,Jn(Jn([],w,!1),[2],!1))),i||(i=a);var E=Nw(e,l,o,i),_=Nw(t,c,o,i),M=Math.min(100,f*(f-1)/2),C=xz(i,f,M,E,l),S=Qh(C,E,e),A=10,T=1,k=1,O=4,F={graphs:S,nodeLabelProp:o,edgeLabelProp:s,minSupport:T,minNodeNum:k,maxNodeNum:O,directed:n},D=bz(F).slice(0,A),$=D.length,Y=[];D.forEach(function(tt,ae){Y[ae]={},Object.keys(S).forEach(function(L){var Se=S[L],Ge=Jh(Se,tt,o,s);Y[ae][L]=Ge})});var N=wz(Y,$,D),P=N.structure,W=N.structureCountMap,J=t.nodes[0],te=[],H=(u=t.nodes[0])===null||u===void 0?void 0:u[o],pe=-1/0;t.nodes.forEach(function(tt){var ae=tt[o],L=g[ae];(L==null?void 0:L.length)>pe&&(pe=L.length,te=L,H=ae,J=tt)});var Te={},Ne={},Ze={},at={},nt={},_t={};Object.keys(b).forEach(function(tt,ae){nt[tt]=[],n&&(_t[tt]=[]);var L=b[tt],Se={};L.forEach(function(qe){var et=d["".concat(J.id,"-").concat(qe.id)];if(et&&nt[tt].push(et),Se["".concat(J.id,"-").concat(qe.id)]={start:0,end:m[qe.id].idx,distance:et},n){var gt=d["".concat(qe.id,"-").concat(J.id)];gt&&_t[tt].push(gt)}}),nt[tt]=nt[tt].sort(function(qe,et){return qe-et}),n&&(_t[tt]=_t[tt].sort(function(qe,et){return qe-et})),Ne=Qh(Se,_,t,Ne);var Ge=[];if(Object.keys(Se).forEach(function(qe){if(Ze[qe]){Ge.push(Ze[qe]);return}var et=Ne[qe];Ze[qe]=Jh(et,P,o,s),Ge.push(Ze[qe])}),Ge=Ge.sort(function(qe,et){return et-qe}),at["".concat(J.id,"-").concat(tt)]=Ge,tt!==H)for(var ye=(te==null?void 0:te.length)||0,Ye=function(et){var gt=te[et],Pt=E[p[gt.id].idx],cr=Pt.nodeLabelCountMap[tt],Rt=b[tt].length;if(!cr||cr.count<Rt)return te.splice(et,1),"continue";for(var hr=!1,ur=0;ur<Rt;ur++)if(cr.dists[ur]>nt[tt][ur]){hr=!0;break}if(hr)return te.splice(et,1),"continue";var br={};Pt.neighbors.forEach(function(ar){var $r=h["".concat(gt.id,"-").concat(ar.id)];br["".concat(gt.id,"-").concat(ar.id)]={start:p[gt.id].idx,end:p[ar.id].idx,distance:$r}}),S=Qh(br,E,e,S);var vr=[];Object.keys(br).forEach(function(ar){if(W[ar]){vr.push(W[ar]);return}var $r=S[ar];W[ar]=Jh($r,P,o,s),vr.push(W[ar])}),vr=vr.sort(function(ar,$r){return $r-ar});for(var bn=!1,ur=0;ur<Rt;ur++)if(vr[ur]<Ge[ur]){bn=!0;break}if(bn)return te.splice(et,1),"continue"},We=ye-1;We>=0;We--)Ye(We)});var St=[];te==null||te.forEach(function(tt){for(var ae=p[tt.id].idx,L=cT(e.nodes,l[ae],ae,o,a),Se=L.neighbors,Ge=Se.length,ye=!1,Ye=Ge-1;Ye>=0;Ye--){if(Se.length+1<t.nodes.length){ye=!0;return}var We=Se[Ye],qe=We[o];if(!b[qe]||!b[qe].length){Se.splice(Ye,1);continue}if(!nt[qe]||!nt[qe].length){Se.splice(Ye,1);continue}var et="".concat(tt.id,"-").concat(We.id),gt=h[et],Pt=nt[qe].length-1,cr=nt[qe][Pt];if(gt>cr){Se.splice(Ye,1);continue}if(n){var Rt="".concat(We.id,"-").concat(tt.id),hr=h[Rt];Pt=_t[qe].length-1;var ur=_t[qe][Pt];if(hr>ur){Se.splice(Ye,1);continue}}var br=W[et]?W[et]:Ez(e,tt,We,p,gt,E,P,o,s,W,S),vr="".concat(J.id,"-").concat(qe),bn=at[vr][at[vr].length-1];if(br<bn){Se.splice(Ye,1);continue}var ar=Rw(Te,qe,m,b),$r=ar.minPatternNodeLabelDegree;if(ar.minPatternNodeLabelInDegree,ar.minPatternNodeLabelOutDegree,p[We.id].degree<$r){Se.splice(Ye,1);continue}}ye||St.push({nodes:[tt].concat(Se)})});var fr=ml(t,J.id,!1).length,Ft={};n?(Object.keys(fr).forEach(function(tt){var ae=m[tt].node[o];Ft[ae]?Ft[ae].push(fr[tt]):Ft[ae]=[fr[tt]]}),Object.keys(Ft).forEach(function(tt){Ft[tt].sort(function(ae,L){return ae-L})})):Ft=nt;for(var Yt=St.length,dr=function(ae){var L=St[ae],Se=L.nodes[0],Ge={},ye={};L.nodes.forEach(function(At,pr){ye[At.id]={idx:pr,node:At,degree:0,inDegree:0,outDegree:0};var bt=At[o];Ge[bt]?Ge[bt]++:Ge[bt]=1});var Ye=[],We={};e.edges.forEach(function(At){ye[At.source]&&ye[At.target]&&(Ye.push(At),We[At[s]]?We[At[s]]++:We[At[s]]=1,ye[At.source].degree++,ye[At.target].degree++,ye[At.source].outDegree++,ye[At.target].inDegree++)});for(var qe=Object.keys(x).length,et=!1,gt=0;gt<qe;gt++){var Pt=Object.keys(x)[gt];if(!We[Pt]||We[Pt]<x[Pt].length){et=!0;break}}if(et)return St.splice(ae,1),"continue";var cr=Ye.length;if(cr<t.edges.length)return St.splice(ae,1),"break";for(var Rt=!1,hr=function(pr){var bt=Ye[pr],Ir=bt[s],xn=x[Ir];if(!xn||!xn.length)return We[Ir]--,xn&&We[Ir]<xn.length?(Rt=!0,"break"):(Ye.splice(pr,1),ye[bt.source].degree--,ye[bt.target].degree--,ye[bt.source].outDegree--,ye[bt.target].inDegree--,"continue");var Go=ye[bt.source].node[o],zo=ye[bt.target].node[o],_a=!1;if(xn.forEach(function($o){var jo=m[$o.source].node,Uo=m[$o.target].node;jo[o]===Go&&Uo[o]===zo&&(_a=!0),!n&&jo[o]===zo&&Uo[o]===Go&&(_a=!0)}),!_a)return We[Ir]--,xn&&We[Ir]<xn.length?(Rt=!0,"break"):(Ye.splice(pr,1),ye[bt.source].degree--,ye[bt.target].degree--,ye[bt.source].outDegree--,ye[bt.target].inDegree--,"continue")},gt=cr-1;gt>=0;gt--){var ur=hr(gt);if(ur==="break")break}if(Rt)return St.splice(ae,1),"continue";L.edges=Ye;var br=ml(L,L.nodes[0].id,!1).length;if(Object.keys(br).reverse().forEach(function(At){if(!(At===L.nodes[0].id||Rt)){if(br[At]===1/0){var pr=ye[At].node[o];if(Ge[pr]--,Ge[pr]<b[pr].length){Rt=!0;return}var bt=L.nodes.indexOf(ye[At].node);L.nodes.splice(bt,1),ye[At]=void 0;return}var Ir=p[At].node[o];if(!Ft[Ir]||!Ft[Ir].length||br[At]>Ft[Ir][Ft[Ir].length-1]){var pr=ye[At].node[o];if(Ge[pr]--,Ge[pr]<b[pr].length){Rt=!0;return}var bt=L.nodes.indexOf(ye[At].node);L.nodes.splice(bt,1),ye[At]=void 0}}}),Rt)return St.splice(ae,1),"continue";for(var vr=!0,bn=0;vr&&!Rt;){vr=!1;var ar=n?ye[Se.id].degree<m[J.id].degree||ye[Se.id].inDegree<m[J.id].inDegree||ye[Se.id].outDegree<m[J.id].outDegree:ye[Se.id].degree<m[J.id].degree;if(ar){Rt=!0;break}if(Ge[Se[o]]<b[Se[o]].length){Rt=!0;break}for(var $r=L.nodes.length,bi=$r-1;bi>=0;bi--){var qr=L.nodes[bi],Ka=ye[qr.id].degree,rf=ye[qr.id].inDegree,nf=ye[qr.id].outDegree,un=qr[o],Ea=Rw(Te,un,m,b),Fo=Ea.minPatternNodeLabelDegree,af=Ea.minPatternNodeLabelInDegree,of=Ea.minPatternNodeLabelOutDegree,sf=n?Ka<Fo||rf<af||nf<of:Ka<Fo;if(sf){if(Ge[qr[o]]--,Ge[qr[o]]<b[qr[o]].length){Rt=!0;break}L.nodes.splice(bi,1),ye[qr.id]=void 0,vr=!0}}if(Rt||!vr&&bn!==0)break;cr=Ye.length;for(var xi=cr-1;xi>=0;xi--){var jr=Ye[xi];if(!ye[jr.source]||!ye[jr.target]){Ye.splice(xi,1);var wi=jr[s];if(We[wi]--,ye[jr.source]&&(ye[jr.source].degree--,ye[jr.source].outDegree--),ye[jr.target]&&(ye[jr.target].degree--,ye[jr.target].inDegree--),x[wi]&&We[wi]<x[wi].length){Rt=!0;break}vr=!0}}bn++}if(Rt||Rt||L.nodes.length<t.nodes.length||Ye.length<t.edges.length)return St.splice(ae,1),"continue"},lr=Yt-1;lr>=0;lr--){var jt=dr(lr);if(jt==="break")break}for(var ir=St.length,Hr=function(ae){var L=St[ae],Se={};L.edges.forEach(function(Ye){var We="".concat(Ye.source,"-").concat(Ye.target,"-").concat(Ye.label);Se[We]?Se[We]++:Se[We]=1});for(var Ge=function(We){var qe=St[We],et={};qe.edges.forEach(function(Pt){var cr="".concat(Pt.source,"-").concat(Pt.target,"-").concat(Pt.label);et[cr]?et[cr]++:et[cr]=1});var gt=!0;Object.keys(et).length!==Object.keys(Se).length?gt=!1:Object.keys(Se).forEach(function(Pt){et[Pt]!==Se[Pt]&&(gt=!1)}),gt&&St.splice(We,1)},ye=ir-1;ye>ae;ye--)Ge(ye);ir=St.length},lr=0;lr<=ir-1;lr++)Hr(lr);return St}}},xu=function(){function r(e){e===void 0&&(e=10),this.linkedList=new XA,this.maxStep=e}return Object.defineProperty(r.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},r.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},r.prototype.push=function(e){this.linkedList.prepend(e),this.length>this.maxStep&&this.linkedList.deleteTail()},r.prototype.pop=function(){var e=this.linkedList.deleteHead();return e?e.value:null},r.prototype.toArray=function(){return this.linkedList.toArray().map(function(e){return e.value})},r.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},r}(),dT=Dm;const _z={getAdjMatrix:Ss,breadthFirstSearch:WA,connectedComponent:Nm,getDegree:ja,getInDegree:HA,getOutDegree:qA,detectCycle:Dm,detectDirectedCycle:dT,detectAllCycles:KA,detectAllDirectedCycle:Rm,detectAllUndirectedCycle:Pm,depthFirstSearch:Om,dijkstra:ml,findAllPath:eT,findShortestPath:JA,floydWarshall:bl,labelPropagation:tT,louvain:Gm,iLouvain:rT,kCore:nT,kMeans:iT,cosineSimilarity:zm,nodesCosineSimilarity:aT,minimumSpanningTree:oT,pageRank:sT,getNeighbors:Kn,Stack:xu,GADDI:hT},Sz=Object.freeze(Object.defineProperty({__proto__:null,GADDI:hT,Stack:xu,breadthFirstSearch:WA,connectedComponent:Nm,cosineSimilarity:zm,default:_z,depthFirstSearch:Om,detectAllCycles:KA,detectAllDirectedCycle:Rm,detectAllUndirectedCycle:Pm,detectCycle:Dm,detectDirectedCycle:dT,dijkstra:ml,findAllPath:eT,findShortestPath:JA,floydWarshall:bl,getAdjMatrix:Ss,getDegree:ja,getInDegree:HA,getNeighbors:Kn,getOutDegree:qA,iLouvain:rT,kCore:nT,kMeans:iT,labelPropagation:tT,louvain:Gm,minimumSpanningTree:oT,nodesCosineSimilarity:aT,pageRank:sT},Symbol.toStringTag,{value:"Module"}));var Md=yi,Mz=function(e){return function(t,n){return t[e]-n[e]}},Bw=function(e,t,n){return e>=t&&e<=n},wv=function(e,t,n,i){var a=1e-4,o={x:n.x-e.x,y:n.y-e.y},s={x:t.x-e.x,y:t.y-e.y},u={x:i.x-n.x,y:i.y-n.y},f=s.x*u.y-s.y*u.x,l=f*f,c=1/f,h=s.x*s.x+s.y*s.y,d=u.x*u.x+u.y*u.y;if(l>a*h*d){var v=(o.x*u.y-o.y*u.x)*c,p=(o.x*s.y-o.y*s.x)*c;return!Bw(v,0,1)||!Bw(p,0,1)?null:{x:e.x+v*s.x,y:e.y+v*s.y}}return null},vT=function(e,t){var n=e.x,i=e.y,a=e.width,o=e.height,s=n+a/2,u=i+o/2,f=[],l={x:s,y:u};f.push({x:n,y:i}),f.push({x:n+a,y:i}),f.push({x:n+a,y:i+o}),f.push({x:n,y:i+o}),f.push({x:n,y:i});for(var c=null,h=1;h<f.length&&(c=wv(f[h-1],f[h],l,t),!c);h++);return c},pT=function(e,t){var n=e.x,i=e.y,a=e.r,o=t.x,s=t.y,u=o-n,f=s-i;if(u*u+f*f<a*a)return null;var l=Math.atan(f/u);return{x:n+Math.abs(a*Math.cos(l))*Math.sign(u),y:i+Math.abs(a*Math.sin(l))*Math.sign(f)}},gT=function(e,t){var n=e.rx,i=e.ry,a=e.x,o=e.y,s=t.x-a,u=t.y-o,f=Math.atan2(u/i,s/n);return f<0&&(f+=2*Math.PI),{x:a+n*Math.cos(f),y:o+i*Math.sin(f)}},Su=function(e,t,n){n===void 0&&(n=1);var i=[e.x,e.y,n];return(!t||isNaN(t[0]))&&(t=[1,0,0,0,1,0,0,0,1]),bv(i,i,t),{x:i[0],y:i[1]}},yT=function(e,t,n){n===void 0&&(n=1),(!t||isNaN(t[0]))&&(t=[1,0,0,0,1,0,0,0,1]);var i=ym([1,0,0,0,1,0,0,0,1],t);i||(i=[1,0,0,0,1,0,0,0,1]);var a=[e.x,e.y,n];return bv(a,a,i),{x:a[0],y:a[1]}},M0=function(e,t,n){var i=e.x-t.x,a=e.y-t.y,o=e.x-n.x,s=e.y-n.y,u=(e.x*e.x-t.x*t.x-t.y*t.y+e.y*e.y)/2,f=(e.x*e.x-n.x*n.x-n.y*n.y+e.y*e.y)/2,l=a*o-i*s;return{x:-(s*u-a*f)/l,y:-(i*f-o*u)/l}},Cd=function(e,t){var n=e.x-t.x,i=e.y-t.y;return Math.sqrt(n*n+i*i)},Cz=function(e,t){var n=[];return e.forEach(function(i){var a=[];i.forEach(function(o){a.push(o*t)}),n.push(a)}),n},Az=function(e){for(var t=[],n=e.length,i=0;i<n;i+=1){t[i]=[];for(var a=0;a<n;a+=1)i===a?t[i][a]=0:e[i][a]===0||!e[i][a]?t[i][a]=1/0:t[i][a]=e[i][a]}for(var o=0;o<n;o+=1)for(var i=0;i<n;i+=1)for(var a=0;a<n;a+=1)t[i][a]>t[i][o]+t[o][a]&&(t[i][a]=t[i][o]+t[o][a]);return t},Tz=function(e,t){var n=e.nodes,i=e.edges,a=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var f=[];a.push(f)}),i&&i.forEach(function(s){var u=s.source,f=s.target,l=o[u],c=o[f];a[l][c]=1,t||(a[c][l]=1)}),a},mT=function(e,t){e.translate(t.x,t.y)},C0=function(e,t,n,i){i===void 0&&(i={duration:500});var a=e.getMatrix();a||(a=[1,0,0,0,1,0,0,0,1]);var o=e.getCanvasBBox(),s=t.x-o.minX,u=t.y-o.minY;if(n){var f=s*a[0],l=u*a[4],c=0,h=0,d=0,v=0;e.animate(function(g){return d=f*g,v=l*g,a=Md(a,[["t",d-c,v-h]]),c=d,h=v,{matrix:a}},i)}else{var p=Md(a,[["t",s,u]]);e.setMatrix(p)}},Iz=function(e,t){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var i=t;pt(t)||(i=[t,t]),pt(t)&&t.length===1&&(i=[t[0],t[0]]),n=Md(n,[["s",i[0],i[1]]]),e.setMatrix(n)},kz=function(e,t){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]),n=Md(n,[["r",t]]),e.setMatrix(n)},Lz=function(e,t,n){for(var i=[],a=0;a<e;a++)i[a]=0;return n.forEach(function(o){o.source&&(i[t[o.source]]+=1),o.target&&(i[t[o.target]]+=1)}),i};function Nz(r,e,t){return(t[0]-r[0])*(e[1]-r[1])===(e[0]-r[0])*(t[1]-r[1])&&Math.min(r[0],e[0])<=t[0]&&t[0]<=Math.max(r[0],e[0])&&Math.min(r[1],e[1])<=t[1]&&t[1]<=Math.max(r[1],e[1])}var xl=function(e,t,n){var i=!1,a=e.length,o=1e-6;function s(c){return Math.abs(c)<o?0:c<0?-1:1}if(a<=2)return!1;for(var u=0;u<a;u++){var f=e[u],l=e[(u+1)%a];if(Nz(f,l,[t,n]))return!0;s(f[1]-n)>0!=s(l[1]-n)>0&&s(t-(n-f[1])*(f[0]-l[0])/(f[1]-l[1])-f[0])<0&&(i=!i)}return i},bT=function(e,t){return!(t.minX>e.maxX||t.maxX<e.minX||t.minY>e.maxY||t.maxY<e.minY)},Oz=function(e,t){var n=!1;return me(e,function(i){if(wv(i.from,i.to,t.from,t.to))return n=!0,!1}),n},xT=function(e,t){var n=function(h){var d=h.map(function(p){return p[0]}),v=h.map(function(p){return p[1]});return{minX:Math.min.apply(null,d),maxX:Math.max.apply(null,d),minY:Math.min.apply(null,v),maxY:Math.max.apply(null,v)}},i=function(h){for(var d=[],v=h.length,p=0;p<v-1;p++){var g=h[p],y=h[p+1];d.push({from:{x:g[0],y:g[1]},to:{x:y[0],y:y[1]}})}if(d.length>1){var m=h[0],b=h[v-1];d.push({from:{x:b[0],y:b[1]},to:{x:m[0],y:m[1]}})}return d};if(e.length<2||t.length<2)return!1;var a=n(e),o=n(t);if(!bT(a,o))return!1;var s=!1;if(me(t,function(c){if(xl(e,c[0],c[1]))return s=!0,!1}),s||(me(e,function(c){if(xl(t,c[0],c[1]))return s=!0,!1}),s))return!0;var u=i(e),f=i(t),l=!1;return me(f,function(c){if(Oz(u,c))return l=!0,!1}),l},Ms=function(){function r(e,t,n,i){this.x1=e,this.y1=t,this.x2=n,this.y2=i}return r.prototype.getBBox=function(){var e=Math.min(this.x1,this.x2),t=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),i=Math.max(this.y1,this.y2),a={x:e,y:t,minX:e,minY:t,maxX:n,maxY:i,width:n-e,height:i-t};return a},r}(),$m=function(e,t){var n={top:[e.minX,e.minY,e.maxX,e.minY],left:[e.minX,e.minY,e.minX,e.maxY],bottom:[e.minX,e.maxY,e.maxX,e.maxY],right:[e.maxX,e.minY,e.maxX,e.maxY]};return n[t]},Dz=function(e,t){var n=(t.x2-t.x1)*(e.y1-t.y1)-(t.y2-t.y1)*(e.x1-t.x1),i=(e.x2-e.x1)*(e.y1-t.y1)-(e.y2-e.y1)*(e.x1-t.x1),a=(t.y2-t.y1)*(e.x2-e.x1)-(t.x2-t.x1)*(e.y2-e.y1);if(a){var o=n/a,s=i/a;if(o>=0&&o<=1&&s>=0&&s<=1)return o}return Number.POSITIVE_INFINITY},wT=function(e,t){for(var n=["top","left","bottom","right"],i=e.getBBox(),a=0,o=[],s=0;s<4;s++){var u=$m(i,n[s]),f=u[0],l=u[1],c=u[2],h=u[3];o[s]=wv({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},{x:f,y:l},{x:c,y:h}),o[s]&&(a+=1)}return[o,a]},jm=function(e,t){for(var n=["top","left","bottom","right"],i=e.getBBox(),a=Number.POSITIVE_INFINITY,o=0,s=0;s<4;s++){var u=$m(i,n[s]),f=u[0],l=u[1],c=u[2],h=u[3],d=Dz(t,new Ms(f,l,c,h));d=Math.abs(d-.5),d>=0&&d<=1&&(o+=1,a=d<a?d:a)}return o===0?-1:a},ET=function(e){var t=0,n=0;if(e.length>0){for(var i=0,a=e;i<a.length;i++){var o=a[i];t+=o.x,n+=o.y}t/=e.length,n/=e.length}return{x:t,y:n}},Ad=function(e,t){return Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)},_T=function(e,t){var n=t.x1,i=t.y1,a=t.x2-n,o=t.y2-i,s=e.x-n,u=e.y-i,f=s*a+u*o,l;f<=0?l=0:(s=a-s,u=o-u,f=s*a+u*o,f<=0?l=0:l=f*f/(a*a+o*o));var c=s*s+u*u-l;return c<0&&(c=0),c},A0=function(e,t,n){return n===void 0&&(n=.001),Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)<Math.pow(n,2)},ST=function(e,t){var n=e.x<t.x,i=e.x>t.x+t.width,a=e.y>t.y+t.height,o=e.y<t.y,s=n||i||a||o;if(!s)return 0;if(a&&!n&&!i)return Math.pow(t.y+t.height-e.y,2);if(o&&!n&&!i)return Math.pow(e.y-t.y,2);if(n&&!a&&!o)return Math.pow(t.x-e.x,2);if(i&&!a&&!o)return Math.pow(t.x+t.width-e.x,2);var u=Math.min(Math.abs(t.x-e.x),Math.abs(t.x+t.width-e.x)),f=Math.min(Math.abs(t.y-e.y),Math.abs(t.y+t.height-e.y));return u*u+f*f},Pz=function(e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t.x,u=t.y,f=[a-n,o-i];if(Lm(f,[0,0]))return NaN;var l=[-f[1],f[0]];_o(l,l);var c=[s-n,u-i];return Math.abs(km(c,l))},Um=function(e,t,n){return e+(t-e)*n},T0=function(e,t,n){for(var i=Math.min(e.length,t.length),a=new Array(i),o=0;o<i;o++)a[o]=Um(e[o],t[o],n);return a};const Rz=Object.freeze(Object.defineProperty({__proto__:null,Line:Ms,applyMatrix:Su,compare:Mz,distance:Cd,floydWarshall:Az,fractionToLine:jm,getAdjMatrix:Tz,getBBoxBoundLine:$m,getCircleCenterByPoints:M0,getCircleIntersectByPoint:pT,getDegree:Lz,getEllipseIntersectByPoint:gT,getLineIntersect:wv,getPointsCenter:ET,getRectIntersectByPoint:vT,intersectBBox:bT,invertMatrix:yT,isPointInPolygon:xl,isPointsOverlap:A0,isPolygonsIntersect:xT,itemIntersectByLine:wT,lerp:Um,lerpArray:T0,move:C0,pointLineDistance:Pz,pointLineSquareDist:_T,pointRectSquareDist:ST,rotate:kz,scale:Iz,scaleMatrix:Cz,squareDist:Ad,translate:mT},Symbol.toStringTag,{value:"Module"}));var no="rgb(95, 149, 255)",Bz="rgb(255, 255, 255)",Fw="rgb(0, 0, 0)",dg="rgb(247, 250, 255)",MT="rgb(239, 244, 255)",Kc="rgb(253, 253, 253)",Gw="rgb(250, 250, 250)",Qc="rgb(224, 224, 224)",zw="rgb(234, 234, 234)",Fz="rgb(245, 245, 245)",Gz="rgb(191, 213, 255)",$w="#4572d9",zz="rgb(223, 234, 255)",rr={mainStroke:no,mainFill:MT,activeStroke:no,activeFill:dg,inactiveStroke:Gz,inactiveFill:dg,selectedStroke:no,selectedFill:Bz,highlightStroke:$w,highlightFill:zz,disableStroke:Qc,disableFill:Gw,edgeMainStroke:Qc,edgeActiveStroke:no,edgeInactiveStroke:zw,edgeSelectedStroke:no,edgeHighlightStroke:no,edgeDisableStroke:Fz,comboMainStroke:Qc,comboMainFill:Kc,comboActiveStroke:no,comboActiveFill:dg,comboInactiveStroke:Qc,comboInactiveFill:Kc,comboSelectedStroke:no,comboSelectedFill:Kc,comboHighlightStroke:$w,comboHighlightFill:Kc,comboDisableStroke:zw,comboDisableFill:Gw};const lt={version:"0.8.23",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:rr.mainStroke,fill:MT},size:20,color:rr.mainStroke,linkPoints:{size:8,lineWidth:1,fill:rr.activeFill,stroke:rr.activeStroke}},nodeStateStyles:{active:{fill:rr.activeFill,stroke:rr.activeStroke,lineWidth:2,shadowColor:rr.mainStroke,shadowBlur:10},selected:{fill:rr.selectedFill,stroke:rr.selectedStroke,lineWidth:4,shadowColor:rr.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:rr.highlightFill,stroke:rr.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:rr.inactiveFill,stroke:rr.inactiveStroke,lineWidth:1},disable:{fill:rr.disableFill,stroke:rr.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:Fw,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:rr.edgeMainStroke,lineAppendWidth:2},color:rr.edgeMainStroke},edgeStateStyles:{active:{stroke:rr.edgeActiveStroke,lineWidth:1},selected:{stroke:rr.edgeSelectedStroke,lineWidth:2,shadowColor:rr.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:rr.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:rr.edgeInactiveStroke,lineWidth:1},disable:{stroke:rr.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:Fw,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:rr.comboMainFill,lineWidth:1,stroke:rr.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:rr.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:rr.comboActiveStroke,lineWidth:1,fill:rr.comboActiveFill},selected:{stroke:rr.comboSelectedStroke,lineWidth:2,fill:rr.comboSelectedFill,shadowColor:rr.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:rr.comboHighlightStroke,lineWidth:2,fill:rr.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:rr.comboInactiveStroke,fill:rr.comboInactiveFill,lineWidth:1},disable:{stroke:rr.comboDisableStroke,fill:rr.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},windowFontFamily:typeof window<"u"&&window.getComputedStyle&&document.body&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"},$z={" ":.3329986572265625,a:.5589996337890625,A:.6569992065429687,b:.58599853515625,B:.6769989013671875,c:.5469985961914062,C:.7279998779296875,d:.58599853515625,D:.705999755859375,e:.554998779296875,E:.63699951171875,f:.37299957275390627,F:.5769989013671875,g:.5909988403320312,G:.7479995727539063,h:.555999755859375,H:.7199996948242188,i:.255999755859375,I:.23699951171875,j:.26699981689453123,J:.5169998168945312,k:.5289993286132812,K:.6899993896484375,l:.23499908447265624,L:.5879989624023437,m:.854998779296875,M:.8819992065429687,n:.5589996337890625,N:.7189987182617188,o:.58599853515625,O:.7669998168945312,p:.58599853515625,P:.6419998168945312,q:.58599853515625,Q:.7669998168945312,r:.3649993896484375,R:.6759994506835938,s:.504998779296875,S:.6319992065429687,t:.354998779296875,T:.6189987182617187,u:.5599990844726562,U:.7139999389648437,v:.48199920654296874,V:.6389999389648438,w:.754998779296875,W:.929998779296875,x:.5089996337890625,X:.63699951171875,y:.4959991455078125,Y:.66199951171875,z:.48699951171875,Z:.6239990234375,0:.6,1:.40099945068359377,2:.6,3:.6,4:.6,5:.6,6:.6,7:.5469985961914062,8:.6,9:.6,"[":.3329986572265625,"]":.3329986572265625,",":.26399993896484375,".":.26399993896484375,";":.26399993896484375,":":.26399993896484375,"{":.3329986572265625,"}":.3329986572265625,"\\":.5,"|":.19499969482421875,"=":.604998779296875,"+":.604998779296875,"-":.604998779296875,_:.5,"`":.3329986572265625," ~":.8329986572265625,"!":.3329986572265625,"@":.8579986572265625,"#":.6,$:.6,"%":.9699996948242188,"^":.517999267578125,"&":.7259994506835937,"*":.505999755859375,"(":.3329986572265625,")":.3329986572265625,"<":.604998779296875,">":.604998779296875,"/":.5,"?":.53699951171875};var Zi=Math.PI,I0=Math.sin,k0=Math.cos,hn=I0(Zi/8),dn=k0(Zi/8),Td=function(e,t){var n=e.getBBox(),i={x:n.minX,y:n.minY},a={x:n.maxX,y:n.maxY};if(t){var o=t.getMatrix();o||(o=[1,0,0,0,1,0,0,0,1]),i=Su(i,o),a=Su(a,o)}var s=i.x,u=i.y,f=a.x,l=a.y;return{x:s,y:u,minX:s,minY:u,maxX:f,maxY:l,width:f-s,height:l-u}},CT=function(e){var t=e.sourceNode||e.targetNode,n=t.get("group"),i=n.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]);var a=t.getKeyShape(),o=a.getBBox(),s=e.loopCfg||{},u=s.dist||Math.max(o.width,o.height)*2,f=s.position||lt.defaultLoopPosition,l=[(o.minX+o.maxX)/2+i[6],(o.minY+o.maxY)/2+i[7]],c=[e.startPoint.x,e.startPoint.y],h=[e.endPoint.x,e.endPoint.y],d=o.height/2,v=o.width/2,p=d,g=d,y=p*hn,m=p*dn,b=g*hn,x=g*dn,w=a.get("type"),E=Math.min(d/2,v/2),_=Math.min(d,v),M=s!=null&&s.pointPadding?Math.min(_,s==null?void 0:s.pointPadding):E;if(c[0]===h[0]&&c[1]===h[1]){switch(f){case"top":w==="circle"?(c=[l[0]-y,l[1]-m],h=[l[0]+b,l[1]-x]):(c=[l[0]-M,l[1]-d],h=[l[0]+M,l[1]-d]);break;case"top-right":p=d,g=v,w==="circle"?(y=p*hn,m=p*dn,b=g*hn,x=g*dn,c=[l[0]+y,l[1]-m],h=[l[0]+x,l[1]-b]):(c=[l[0]+v-M,l[1]-d],h=[l[0]+v,l[1]-d+M]);break;case"right":p=v,g=v,w==="circle"?(y=p*hn,m=p*dn,b=g*hn,x=g*dn,c=[l[0]+m,l[1]-y],h=[l[0]+x,l[1]+b]):(c=[l[0]+v,l[1]-M],h=[l[0]+v,l[1]+M]);break;case"bottom-right":p=v,g=d,w==="circle"?(y=p*hn,m=p*dn,b=g*hn,x=g*dn,c=[l[0]+m,l[1]+y],h=[l[0]+b,l[1]+x]):(c=[l[0]+v,l[1]+d-M],h=[l[0]+v-M,l[1]+d]);break;case"bottom":p=d,g=d,w==="circle"?(y=p*hn,m=p*dn,b=g*hn,x=g*dn,c=[l[0]+y,l[1]+m],h=[l[0]-b,l[1]+x]):(c=[l[0]-M,l[1]+d],h=[l[0]+M,l[1]+d]);break;case"bottom-left":p=d,g=v,w==="circle"?(y=p*hn,m=p*dn,b=g*hn,x=g*dn,c=[l[0]-y,l[1]+m],h=[l[0]-x,l[1]+b]):(c=[l[0]-v,l[1]+d-M],h=[l[0]-v+M,l[1]+d]);break;case"left":p=v,g=v,w==="circle"?(y=p*hn,m=p*dn,b=g*hn,x=g*dn,c=[l[0]-m,l[1]+y],h=[l[0]-x,l[1]-b]):(c=[l[0]-v,l[1]-M],h=[l[0]-v,l[1]+M]);break;case"top-left":p=v,g=d,w==="circle"?(y=p*hn,m=p*dn,b=g*hn,x=g*dn,c=[l[0]-m,l[1]-y],h=[l[0]-b,l[1]-x]):(c=[l[0]-v+M,l[1]-d],h=[l[0]-v,l[1]-d+M]);break;default:p=v,g=v,y=p*hn,m=p*dn,b=g*hn,x=g*dn,c=[l[0]-y,l[1]-m],h=[l[0]+b,l[1]-x]}if(s.clockwise===!1){var C=[c[0],c[1]];c=[h[0],h[1]],h=[C[0],C[1]]}}var S=[c[0]-l[0],c[1]-l[1]],A=(p+u)/p,T=(g+u)/g;s.clockwise===!1&&(A=(g+u)/g,T=(p+u)/p);var k=An([0,0],S,A),O=[l[0]+k[0],l[1]+k[1]],F=[h[0]-l[0],h[1]-l[1]],D=An([0,0],F,T),$=[l[0]+D[0],l[1]+D[1]];return e.startPoint={x:c[0],y:c[1]},e.endPoint={x:h[0],y:h[1]},e.controlPoints=[{x:O[0],y:O[1]},{x:$[0],y:$[1]}],e},AT=function(e,t,n,i,a){var o=1e-4,s=[],u=e==null?void 0:e.getPoint(t);if(!u)return{x:0,y:0,angle:0};if(t<o)s=e.getStartTangent().reverse();else if(t>1-o)s=e.getEndTangent();else{var f=e==null?void 0:e.getPoint(t+o);s.push([u.x,u.y]),s.push([f.x,f.y])}var l=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]);if(l<0&&(l+=Zi*2),n&&(u.x+=k0(l)*n,u.y+=I0(l)*n),i){var c=l-Zi/2;l>1/2*Zi&&l<3*1/2*Zi&&(c-=Zi),u.x+=k0(c)*i,u.y+=I0(c)*i}var h={x:u.x,y:u.y,angle:l};return a?(l>.5*Zi&&l<1.5*Zi&&(l-=Zi),B({rotate:l},h)):h},jz=function r(e,t,n,i){if(i(e,t,n)===!1)return!1;if(e&&e.children){for(var a=e.children.length-1;a>=0;a--)if(!r(e.children[a],e,a,i))return!1}return!0},Uz=function r(e,t,n,i){if(e&&e.children){for(var a=e.children.length-1;a>=0;a--)if(!r(e.children[a],e,a,i))return}return i(e,t,n)!==!1},Cn=function(e,t){typeof t=="function"&&jz(e,null,-1,t)},Ki=function(e,t){typeof t=="function"&&Uz(e,null,-1,t)},TT=function(e,t){return t*($z[e]||1)},IT=function(e,t){var n=0,i=new RegExp("[一-龥]+");return e.split("").forEach(function(a){i.test(a)?n+=t:n+=TT(a,t)}),[n,t]},kT=function(e,t){return typeof t!="number"||t<=0||t>=e.length?e:e.substring(0,t)+"..."},L0=function(e,t){var n=[],i={},a={};e.forEach(function(u){a[u.id]=u}),e.forEach(function(u,f){var l=Vt(u);l.itemType="combo",l.children=void 0,l.parentId===l.id?(console.warn("The parentId for combo ".concat(l.id," can not be the same as the combo's id")),delete l.parentId):l.parentId&&!a[l.parentId]&&(console.warn("The parent combo for combo ".concat(l.id," does not exist!")),delete l.parentId);var c=i[l.id];if(c){if(l.children=c.children,i[l.id]=l,c=l,!c.parentId){n.push(c);return}var h=i[c.parentId];if(h)h.children?h.children.push(l):h.children=[l];else{var d={id:c.parentId,children:[c]};i[c.parentId]=d,i[l.id]=l}return}if(Pe(u.parentId)){var v=i[u.parentId];if(v)v.children?v.children.push(l):v.children=[l],i[l.id]=l;else{var p={id:u.parentId,children:[l]};i[p.id]=p,i[l.id]=l}}else n.push(l),i[l.id]=l});var o={};(t||[]).forEach(function(u){o[u.id]=u;var f=i[u.comboId];if(f){var l={id:u.id,comboId:u.comboId};f.children?f.children.push(l):f.children=[l],l.itemType="node",i[u.id]=l}});var s=0;return n.forEach(function(u){u.depth=s+10,Cn(u,function(f){var l,c=i[f.id].itemType;c==="node"?l=i[f.comboId]:l=i[f.parentId],l&&c==="node"?f.depth=s+1:f.depth=s+10,s<f.depth&&(s=f.depth);var h=o[f.id];return h&&(h.depth=f.depth),!0})}),n},N0=function(e,t,n){var i,a=e,o,s={root:{children:e}},u=!1,f="root";(e||[]).forEach(function(v){if(!u){if(v.id===t){o=v,v.itemType==="combo"?o.parentId=n:o.comboId=n,u=!0;return}Cn(v,function(p){var g;return s[p.id]={children:(p==null?void 0:p.children)||[]},a=(g=s[p.parentId||p.comboId||"root"])===null||g===void 0?void 0:g.children,p&&(p.removed||t===p.id)&&a?(f=p.parentId||p.comboId||"root",o=p,p.itemType==="combo"?o.parentId=n:o.comboId=n,u=!0,!1):!0})}}),a=(i=s[f])===null||i===void 0?void 0:i.children;var l=a?a.indexOf(o):-1;if(l>-1&&a.splice(l,1),u||(o={id:t,itemType:"node",comboId:n},s[t]={children:void 0}),t){var c=!1;if(n){var h=0;(e||[]).forEach(function(v){c||Cn(v,function(p){return n===p.id?(c=!0,p.children?p.children.push(o):p.children=[o],h=p.depth,o.itemType==="node"?o.depth=h+2:o.depth=h+1,!1):!0})})}else(!n||!c)&&o.itemType!=="node"&&e.push(o);var d=o.depth;Cn(o,function(v){return v.itemType==="node"?d+=2:d+=1,v.depth=d,!0})}return e},ed=function(e,t,n){var i={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(!e||e.length===0){var a=n==null?void 0:n.getModel(),o=a||{},s=o.x,u=o.y,f=o.fixSize,l=o.collapsed,c=o.fixCollapseSize,h=l?c:f,d=pt(h)?h:[h,h],v=d[0],p=d[1],g=[v/2,p/2];return{minX:s-g[0],minY:u-g[1],maxX:s+g[0],maxY:u+g[1],x:s,y:u,width:v,height:p}}return e.forEach(function(y){var m=t.findById(y.id);if(!(!m||!m.isVisible())){m.set("bboxCanvasCache",void 0);var b=m.getCanvasBBox();b.x&&i.minX>b.minX&&(i.minX=b.minX),b.y&&i.minY>b.minY&&(i.minY=b.minY),b.x&&i.maxX<b.maxX&&(i.maxX=b.maxX),b.y&&i.maxY<b.maxY&&(i.maxY=b.maxY)}}),i.x=(i.minX+i.maxX)/2,i.y=(i.minY+i.maxY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY,i.centerX=(i.minX+i.maxX)/2,i.centerY=(i.minY+i.maxY)/2,(n==null?void 0:n.getKeyShape().get("type"))==="circle"&&(i.width=Math.hypot(i.height,i.width),i.height=i.width),Object.keys(i).forEach(function(y){(i[y]===1/0||i[y]===-1/0)&&(i[y]=void 0)}),i},Xz=function(e){var t=ht(e.x)||ht(e.y)||e.type||e.anchorPoints||e.size;return e.style&&(t=t||ht(e.style.r)||ht(e.style.width)||ht(e.style.height)||ht(e.style.rx)||ht(e.style.ry)),t},td=function(e){var t={};return Object.keys(e).forEach(function(n){var i=e[n];if(!(n==="img"&&!Pe(i)))if(yn(i)&&!pt(i)){var a={};Object.keys(i).forEach(function(o){var s=i[o];o==="img"&&!Pe(s)||(a[o]=Vt(s))}),t[n]=a}else t[n]=Vt(i)}),t},wl=function(e){var t=e.animateCfg,n=e.callback,i;if(!t)i={duration:500,callback:n};else if(i=Vt(t),t.callback){var a=t.callback;i.callback=function(){n(),a()}}else i.callback=n;return i};const Yz=Object.freeze(Object.defineProperty({__proto__:null,cloneBesidesImg:td,getAnimateCfgWithCallback:wl,getBBox:Td,getComboBBox:ed,getLabelPosition:AT,getLetterWidth:TT,getLoopCfgs:CT,getTextSize:IT,plainCombosToTrees:L0,reconstructTree:N0,shouldRefreshEdge:Xz,traverseTree:Cn,traverseTreeUp:Ki,truncateLabelByLength:kT},Symbol.toStringTag,{value:"Module"}));var jw=function(e){if(!e)return console.error("G6 Error Tips: the data must be defined"),!1;var t=e.nodes,n=e.edges,i=e.combos,a=i===void 0?[]:i;if(!t&&!n){var o=!0;return Cn(e,function(h){return Pe(h.id)?!0:(o=!1,!1)}),o}var s=(t||[]).find(function(h){return!Pe(h.id)});if(s)return console.warn("G6 Warning Tips: missing 'id' property, or %c".concat(s.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1;var u=(t||[]).map(function(h){return h.id}),f=a==null?void 0:a.map(function(h){return h.id}),l=Jn(Jn([],u,!0),f,!0),c=(n||[]).find(function(h){return!l.includes(h.source)||!l.includes(h.target)});return c?(console.warn("G6 Warning Tips: The source %c".concat(c.source,"%c or the target %c").concat(c.target,"%c of the edge do not exist in the nodes or combos."),"font-size: 20px; color: red;","","font-size: 20px; color: red;",""),!1):!0},Wz=function(e,t){if(e==="node"||e==="combo"){if(t.id&&!Pe(t.id))return console.warn("G6 Warning Tips: missing 'id' property, or the 'id' %c".concat(t.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1}else if(e==="edge"&&(!t.source||!t.target))return console.warn("G6 Warning Tips: missing 'source' or 'target' for the edge."),!1;return!0},Vz=function(){function r(e){this.graph=e,this.destroyed=!1,this.modes=e.get("modes")||{default:[]},this.formatModes(),this.mode=e.get("defaultMode")||"default",this.currentBehaves=[],this.setMode(this.mode)}return r.prototype.formatModes=function(){var e=this.modes;me(e,function(t){me(t,function(n,i){Pe(n)&&(t[i]={type:n})})})},r.prototype.setBehaviors=function(e){var t=this.graph,n=this.modes[e],i=[],a;me(n||[],function(o){var s=gm.getBehavior(o.type||o);s&&(a=new s(o),a&&(a.bind(t),i.push(a)))}),this.currentBehaves=i},r.mergeBehaviors=function(e,t){return me(t,function(n){e.indexOf(n)<0&&(Pe(n)&&(n={type:n}),e.push(n))}),e},r.filterBehaviors=function(e,t){var n=[];return e.forEach(function(i){var a="";Pe(i)?a=i:a=i.type,t.indexOf(a)<0&&n.push(i)}),n},r.prototype.setMode=function(e){var t=this,n=t.modes,i=t.graph,a=e,o=n[a];o&&(i.emit("beforemodechange",{mode:e}),me(this.currentBehaves,function(s){s.delegate&&s.delegate.remove(),s.unbind(i)}),this.setBehaviors(a),i.emit("aftermodechange",{mode:e}),this.mode=e)},r.prototype.getMode=function(){return this.mode},r.prototype.manipulateBehaviors=function(e,t,n){var i=this,a;if(pt(e)?a=e:a=[e],pt(t))return me(t,function(s){i.modes[s]?n?i.modes[s]=r.mergeBehaviors(i.modes[s]||[],a):i.modes[s]=r.filterBehaviors(i.modes[s]||[],a):n&&(i.modes[s]=a)}),this;var o=t;return t||(o=this.mode),this.modes[o]||n&&(this.modes[o]=a),n?this.modes[o]=r.mergeBehaviors(this.modes[o]||[],a):this.modes[o]=r.filterBehaviors(this.modes[o]||[],a),this.formatModes(),this.setMode(this.mode),this},r.prototype.updateBehavior=function(e,t,n){Pe(e)&&(e={type:e});var i=[];if(!n||n===this.mode||n==="default"){if(i=this.currentBehaves,!i||!i.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;for(var a=i.length,o=0;o<a;o++){var s=i[o];if(s.type===e.type)return s.updateCfg(t),this;o===a-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}else{if(i=this.modes[n],!i||!i.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;for(var u=i.length,o=0;o<u;o++){var s=i[o];if(s.type===e.type||s===e.type)return s===e.type&&(s={type:s}),Object.assign(s,t),i[o]=s,this;o===u-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}return this},r.prototype.destroy=function(){this.graph=null,this.modes=null,this.currentBehaves=null,this.destroyed=!0},r}(),rl=`
|
|
2
|
-
\v\f\r \u2028\u2029`,Hz=new RegExp("([a-z])["+rl+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+rl+"]*,?["+rl+"]*)+)","ig"),qz=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+rl+"]*,?["+rl+"]*","ig"),wu=function(r){if(!r)return null;if(pt(r))return r;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},t=[];return String(r).replace(Hz,function(n,i,a){var o=[],s=i.toLowerCase();if(a.replace(qz,function(u,f){f&&o.push(+f)}),s==="m"&&o.length>2&&(t.push([i].concat(o.splice(0,2))),s="l",i=i==="m"?"l":"L"),s==="o"&&o.length===1&&t.push([i,o[0]]),s==="r")t.push([i].concat(o));else for(;o.length>=e[s]&&(t.push([i].concat(o.splice(0,e[s]))),!!e[s]););return r}),t},O0=function(r,e){for(var t=[],n=0,i=r.length;i-2*!e>n;n+=2){var a=[{x:+r[n-2],y:+r[n-1]},{x:+r[n],y:+r[n+1]},{x:+r[n+2],y:+r[n+3]},{x:+r[n+4],y:+r[n+5]}];e?n?i-4===n?a[3]={x:+r[0],y:+r[1]}:i-2===n&&(a[2]={x:+r[0],y:+r[1]},a[3]={x:+r[2],y:+r[3]}):a[0]={x:+r[i-2],y:+r[i-1]}:i-4===n?a[3]=a[2]:n||(a[0]={x:+r[n],y:+r[n+1]}),t.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return t},Jc=function(r,e,t,n,i){var a=[];if(i===null&&n===null&&(n=t),r=+r,e=+e,t=+t,n=+n,i!==null){var o=Math.PI/180,s=r+t*Math.cos(-n*o),u=r+t*Math.cos(-i*o),f=e+t*Math.sin(-n*o),l=e+t*Math.sin(-i*o);a=[["M",s,f],["A",t,t,0,+(i-n>180),0,u,l]]}else a=[["M",r,e],["m",0,-n],["a",t,n,0,1,1,0,2*n],["a",t,n,0,1,1,0,-2*n],["z"]];return a},D0=function(r){if(r=wu(r),!r||!r.length)return[["M",0,0]];var e=[],t=0,n=0,i=0,a=0,o=0,s,u;r[0][0]==="M"&&(t=+r[0][1],n=+r[0][2],i=t,a=n,o++,e[0]=["M",t,n]);for(var f=r.length===3&&r[0][0]==="M"&&r[1][0].toUpperCase()==="R"&&r[2][0].toUpperCase()==="Z",l=void 0,c=void 0,h=o,d=r.length;h<d;h++){if(e.push(l=[]),c=r[h],s=c[0],s!==s.toUpperCase())switch(l[0]=s.toUpperCase(),l[0]){case"A":l[1]=c[1],l[2]=c[2],l[3]=c[3],l[4]=c[4],l[5]=c[5],l[6]=+c[6]+t,l[7]=+c[7]+n;break;case"V":l[1]=+c[1]+n;break;case"H":l[1]=+c[1]+t;break;case"R":u=[t,n].concat(c.slice(1));for(var v=2,p=u.length;v<p;v++)u[v]=+u[v]+t,u[++v]=+u[v]+n;e.pop(),e=e.concat(O0(u,f));break;case"O":e.pop(),u=Jc(t,n,c[1],c[2]),u.push(u[0]),e=e.concat(u);break;case"U":e.pop(),e=e.concat(Jc(t,n,c[1],c[2],c[3])),l=["U"].concat(e[e.length-1].slice(-2));break;case"M":i=+c[1]+t,a=+c[2]+n;break;default:for(var v=1,p=c.length;v<p;v++)l[v]=+c[v]+(v%2?t:n)}else if(s==="R")u=[t,n].concat(c.slice(1)),e.pop(),e=e.concat(O0(u,f)),l=["R"].concat(c.slice(-2));else if(s==="O")e.pop(),u=Jc(t,n,c[1],c[2]),u.push(u[0]),e=e.concat(u);else if(s==="U")e.pop(),e=e.concat(Jc(t,n,c[1],c[2],c[3])),l=["U"].concat(e[e.length-1].slice(-2));else for(var g=0,y=c.length;g<y;g++)l[g]=c[g];if(s=s.toUpperCase(),s!=="O")switch(l[0]){case"Z":t=+i,n=+a;break;case"H":t=l[1];break;case"V":n=l[1];break;case"M":i=l[l.length-2],a=l[l.length-1];break;default:t=l[l.length-2],n=l[l.length-1]}}return e},eh=function(r,e,t,n){return[r,e,t,n,t,n]},Uw=function(r,e,t,n,i,a){var o=.3333333333333333,s=2/3;return[o*r+s*t,o*e+s*n,o*i+s*t,o*a+s*n,i,a]},LT=function(r,e,t,n,i,a,o,s,u,f){t===n&&(t+=1);var l=Math.PI*120/180,c=Math.PI/180*(+i||0),h=[],d,v,p,g,y,m=function(Ne,Ze,at){var nt=Ne*Math.cos(at)-Ze*Math.sin(at),_t=Ne*Math.sin(at)+Ze*Math.cos(at);return{x:nt,y:_t}};if(f)v=f[0],p=f[1],g=f[2],y=f[3];else{d=m(r,e,-c),r=d.x,e=d.y,d=m(s,u,-c),s=d.x,u=d.y,r===s&&e===u&&(s+=1,u+=1);var b=(r-s)/2,x=(e-u)/2,w=b*b/(t*t)+x*x/(n*n);w>1&&(w=Math.sqrt(w),t=w*t,n=w*n);var E=t*t,_=n*n,M=(a===o?-1:1)*Math.sqrt(Math.abs((E*_-E*x*x-_*b*b)/(E*x*x+_*b*b)));g=M*t*x/n+(r+s)/2,y=M*-n*b/t+(e+u)/2,v=Math.asin(((e-y)/n).toFixed(9)),p=Math.asin(((u-y)/n).toFixed(9)),v=r<g?Math.PI-v:v,p=s<g?Math.PI-p:p,v<0&&(v=Math.PI*2+v),p<0&&(p=Math.PI*2+p),o&&v>p&&(v=v-Math.PI*2),!o&&p>v&&(p=p-Math.PI*2)}var C=p-v;if(Math.abs(C)>l){var S=p,A=s,T=u;p=v+l*(o&&p>v?1:-1),s=g+t*Math.cos(p),u=y+n*Math.sin(p),h=LT(s,u,t,n,i,0,o,A,T,[p,S,g,y])}C=p-v;var k=Math.cos(v),O=Math.sin(v),F=Math.cos(p),D=Math.sin(p),$=Math.tan(C/4),Y=4/3*t*$,N=4/3*n*$,P=[r,e],W=[r+Y*O,e-N*k],J=[s+Y*D,u-N*F],te=[s,u];if(W[0]=2*P[0]-W[0],W[1]=2*P[1]-W[1],f)return[W,J,te].concat(h);h=[W,J,te].concat(h).join().split(",");for(var H=[],pe=0,Te=h.length;pe<Te;pe++)H[pe]=pe%2?m(h[pe-1],h[pe],c).y:m(h[pe],h[pe+1],c).x;return H},P0=function(r,e){var t=D0(r),n=e&&D0(e),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=[],s=[],u="",f="",l,c=function(b,x,w){var E,_;if(!b)return["C",x.x,x.y,x.x,x.y,x.x,x.y];switch(!(b[0]in{T:1,Q:1})&&(x.qx=x.qy=null),b[0]){case"M":x.X=b[1],x.Y=b[2];break;case"A":b=["C"].concat(LT.apply(0,[x.x,x.y].concat(b.slice(1))));break;case"S":w==="C"||w==="S"?(E=x.x*2-x.bx,_=x.y*2-x.by):(E=x.x,_=x.y),b=["C",E,_].concat(b.slice(1));break;case"T":w==="Q"||w==="T"?(x.qx=x.x*2-x.qx,x.qy=x.y*2-x.qy):(x.qx=x.x,x.qy=x.y),b=["C"].concat(Uw(x.x,x.y,x.qx,x.qy,b[1],b[2]));break;case"Q":x.qx=b[1],x.qy=b[2],b=["C"].concat(Uw(x.x,x.y,b[1],b[2],b[3],b[4]));break;case"L":b=["C"].concat(eh(x.x,x.y,b[1],b[2]));break;case"H":b=["C"].concat(eh(x.x,x.y,b[1],x.y));break;case"V":b=["C"].concat(eh(x.x,x.y,x.x,b[1]));break;case"Z":b=["C"].concat(eh(x.x,x.y,x.X,x.Y));break}return b},h=function(b,x){if(b[x].length>7){b[x].shift();for(var w=b[x];w.length;)o[x]="A",n&&(s[x]="A"),b.splice(x++,0,["C"].concat(w.splice(0,6)));b.splice(x,1),l=Math.max(t.length,n&&n.length||0)}},d=function(b,x,w,E,_){b&&x&&b[_][0]==="M"&&x[_][0]!=="M"&&(x.splice(_,0,["M",E.x,E.y]),w.bx=0,w.by=0,w.x=b[_][1],w.y=b[_][2],l=Math.max(t.length,n&&n.length||0))};l=Math.max(t.length,n&&n.length||0);for(var v=0;v<l;v++){t[v]&&(u=t[v][0]),u!=="C"&&(o[v]=u,v&&(f=o[v-1])),t[v]=c(t[v],i,f),o[v]!=="A"&&u==="C"&&(o[v]="C"),h(t,v),n&&(n[v]&&(u=n[v][0]),u!=="C"&&(s[v]=u,v&&(f=s[v-1])),n[v]=c(n[v],a,f),s[v]!=="A"&&u==="C"&&(s[v]="C"),h(n,v)),d(t,n,i,a,v),d(n,t,a,i,v);var p=t[v],g=n&&n[v],y=p.length,m=n&&g.length;i.x=p[y-2],i.y=p[y-1],i.bx=parseFloat(p[y-4])||i.x,i.by=parseFloat(p[y-3])||i.y,a.bx=n&&(parseFloat(g[m-4])||a.x),a.by=n&&(parseFloat(g[m-3])||a.y),a.x=n&&g[m-2],a.y=n&&g[m-1]}return n?[t,n]:t},Zz=/,?([a-z]),?/gi,NT=function(r){return r.join(",").replace(Zz,"$1")},Xw=function(r,e,t,n,i){var a=-3*e+9*t-9*n+3*i,o=r*a+6*e-12*t+6*n;return r*o-3*e+3*t},Yw=function(r,e,t,n,i,a,o,s,u){u===null&&(u=1),u=u>1?1:u<0?0:u;for(var f=u/2,l=12,c=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,v=0;v<l;v++){var p=f*c[v]+f,g=Xw(p,r,t,i,o),y=Xw(p,e,n,a,s),m=g*g+y*y;d+=h[v]*Math.sqrt(m)}return f*d},Kz=function(r,e,t,n,i,a,o,s){for(var u=[],f=[[],[]],l,c,h,d,v=0;v<2;++v){if(v===0?(c=6*r-12*t+6*i,l=-3*r+9*t-9*i+3*o,h=3*t-3*r):(c=6*e-12*n+6*a,l=-3*e+9*n-9*a+3*s,h=3*n-3*e),Math.abs(l)<1e-12){if(Math.abs(c)<1e-12)continue;d=-h/c,d>0&&d<1&&u.push(d);continue}var p=c*c-4*h*l,g=Math.sqrt(p);if(!(p<0)){var y=(-c+g)/(2*l);y>0&&y<1&&u.push(y);var m=(-c-g)/(2*l);m>0&&m<1&&u.push(m)}}for(var b=u.length,x=b,w;b--;)d=u[b],w=1-d,f[0][b]=w*w*w*r+3*w*w*d*t+3*w*d*d*i+d*d*d*o,f[1][b]=w*w*w*e+3*w*w*d*n+3*w*d*d*a+d*d*d*s;return f[0][x]=r,f[1][x]=e,f[0][x+1]=o,f[1][x+1]=s,f[0].length=f[1].length=x+2,{min:{x:Math.min.apply(0,f[0]),y:Math.min.apply(0,f[1])},max:{x:Math.max.apply(0,f[0]),y:Math.max.apply(0,f[1])}}},Qz=function(r,e,t,n,i,a,o,s){if(!(Math.max(r,t)<Math.min(i,o)||Math.min(r,t)>Math.max(i,o)||Math.max(e,n)<Math.min(a,s)||Math.min(e,n)>Math.max(a,s))){var u=(r*n-e*t)*(i-o)-(r-t)*(i*s-a*o),f=(r*n-e*t)*(a-s)-(e-n)*(i*s-a*o),l=(r-t)*(a-s)-(e-n)*(i-o);if(l){var c=u/l,h=f/l,d=+c.toFixed(2),v=+h.toFixed(2);if(!(d<+Math.min(r,t).toFixed(2)||d>+Math.max(r,t).toFixed(2)||d<+Math.min(i,o).toFixed(2)||d>+Math.max(i,o).toFixed(2)||v<+Math.min(e,n).toFixed(2)||v>+Math.max(e,n).toFixed(2)||v<+Math.min(a,s).toFixed(2)||v>+Math.max(a,s).toFixed(2)))return{x:c,y:h}}}},io=function(r,e,t){return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height},OT=function(r,e,t,n,i){if(i)return[["M",+r+ +i,e],["l",t-i*2,0],["a",i,i,0,0,1,i,i],["l",0,n-i*2],["a",i,i,0,0,1,-i,i],["l",i*2-t,0],["a",i,i,0,0,1,-i,-i],["l",0,i*2-n],["a",i,i,0,0,1,i,-i],["z"]];var a=[["M",r,e],["l",t,0],["l",0,n],["l",-t,0],["z"]];return a.parsePathArray=NT,a},R0=function(r,e,t,n){return r===null&&(r=e=t=n=0),e===null&&(e=r.y,t=r.width,n=r.height,r=r.x),{x:r,y:e,width:t,w:t,height:n,h:n,x2:r+t,y2:e+n,cx:r+t/2,cy:e+n/2,r1:Math.min(t,n)/2,r2:Math.max(t,n)/2,r0:Math.sqrt(t*t+n*n)/2,path:OT(r,e,t,n),vb:[r,e,t,n].join(" ")}},Jz=function(r,e){return r=R0(r),e=R0(e),io(e,r.x,r.y)||io(e,r.x2,r.y)||io(e,r.x,r.y2)||io(e,r.x2,r.y2)||io(r,e.x,e.y)||io(r,e.x2,e.y)||io(r,e.x,e.y2)||io(r,e.x2,e.y2)||(r.x<e.x2&&r.x>e.x||e.x<r.x2&&e.x>r.x)&&(r.y<e.y2&&r.y>e.y||e.y<r.y2&&e.y>r.y)},Ww=function(r,e,t,n,i,a,o,s){pt(r)||(r=[r,e,t,n,i,a,o,s]);var u=Kz.apply(null,r);return R0(u.min.x,u.min.y,u.max.x-u.min.x,u.max.y-u.min.y)},Vw=function(r,e,t,n,i,a,o,s,u){var f=1-u,l=Math.pow(f,3),c=Math.pow(f,2),h=u*u,d=h*u,v=l*r+c*3*u*t+f*3*u*u*i+d*o,p=l*e+c*3*u*n+f*3*u*u*a+d*s,g=r+2*u*(t-r)+h*(i-2*t+r),y=e+2*u*(n-e)+h*(a-2*n+e),m=t+2*u*(i-t)+h*(o-2*i+t),b=n+2*u*(a-n)+h*(s-2*a+n),x=f*r+u*t,w=f*e+u*n,E=f*i+u*o,_=f*a+u*s,M=90-Math.atan2(g-m,y-b)*180/Math.PI;return{x:v,y:p,m:{x:g,y},n:{x:m,y:b},start:{x,y:w},end:{x:E,y:_},alpha:M}},e8=function(r,e,t){var n=Ww(r),i=Ww(e);if(!Jz(n,i))return t?0:[];for(var a=Yw.apply(0,r),o=Yw.apply(0,e),s=~~(a/8),u=~~(o/8),f=[],l=[],c={},h=t?0:[],d=0;d<s+1;d++){var v=Vw.apply(0,r.concat(d/s));f.push({x:v.x,y:v.y,t:d/s})}for(var d=0;d<u+1;d++){var v=Vw.apply(0,e.concat(d/u));l.push({x:v.x,y:v.y,t:d/u})}for(var d=0;d<s;d++)for(var p=0;p<u;p++){var g=f[d],y=f[d+1],m=l[p],b=l[p+1],x=Math.abs(y.x-g.x)<.001?"y":"x",w=Math.abs(b.x-m.x)<.001?"y":"x",E=Qz(g.x,g.y,y.x,y.y,m.x,m.y,b.x,b.y);if(E){if(c[E.x.toFixed(4)]===E.y.toFixed(4))continue;c[E.x.toFixed(4)]=E.y.toFixed(4);var _=g.t+Math.abs((E[x]-g[x])/(y[x]-g[x]))*(y.t-g.t),M=m.t+Math.abs((E[w]-m[w])/(b[w]-m[w]))*(b.t-m.t);_>=0&&_<=1&&M>=0&&M<=1&&(t?h+=1:h.push({x:E.x,y:E.y,t1:_,t2:M}))}}return h},t8=function(r,e,t){r=P0(r),e=P0(e);for(var n,i,a,o,s,u,f,l,c,h,d=t?0:[],v=0,p=r.length;v<p;v++){var g=r[v];if(g[0]==="M")n=s=g[1],i=u=g[2];else{g[0]==="C"?(c=[n,i].concat(g.slice(1)),n=c[6],i=c[7]):(c=[n,i,n,i,s,u,s,u],n=s,i=u);for(var y=0,m=e.length;y<m;y++){var b=e[y];if(b[0]==="M")a=f=b[1],o=l=b[2];else{b[0]==="C"?(h=[a,o].concat(b.slice(1)),a=h[6],o=h[7]):(h=[a,o,a,o,f,l,f,l],a=f,o=l);var x=e8(c,h,t);if(t)d+=x;else{for(var w=0,E=x.length;w<E;w++)x[w].segment1=v,x[w].segment2=y,x[w].bez1=c,x[w].bez2=h;d=d.concat(x)}}}}}return d},r8=function(r,e){return t8(r,e)};function n8(r,e){var t=[],n=[];function i(a,o){if(a.length===1)t.push(a[0]),n.push(a[0]);else{for(var s=[],u=0;u<a.length-1;u++)u===0&&t.push(a[0]),u===a.length-2&&n.push(a[u+1]),s[u]=[(1-o)*a[u][0]+o*a[u+1][0],(1-o)*a[u][1]+o*a[u+1][1]];i(s,o)}}return r.length&&i(r,e),{left:t,right:n.reverse()}}function i8(r,e,t){var n=[[r[1],r[2]]];t=t||2;var i=[];e[0]==="A"?(n.push(e[6]),n.push(e[7])):e[0]==="C"?(n.push([e[1],e[2]]),n.push([e[3],e[4]]),n.push([e[5],e[6]])):e[0]==="S"||e[0]==="Q"?(n.push([e[1],e[2]]),n.push([e[3],e[4]])):n.push([e[1],e[2]]);for(var a=n,o=1/t,s=0;s<t-1;s++){var u=o/(1-o*s),f=n8(a,u);i.push(f.left),a=f.right}i.push(a);var l=i.map(function(c){var h=[];return c.length===4&&(h.push("C"),h=h.concat(c[2])),c.length>=3&&(c.length===3&&h.push("Q"),h=h.concat(c[1])),c.length===2&&h.push("L"),h=h.concat(c[c.length-1]),h});return l}var a8=function(r,e,t){if(t===1)return[[].concat(r)];var n=[];if(e[0]==="L"||e[0]==="C"||e[0]==="Q")n=n.concat(i8(r,e,t));else{var i=[].concat(r);i[0]==="M"&&(i[0]="L");for(var a=0;a<=t-1;a++)n.push(i)}return n},o8=function(r,e){if(r.length===1)return r;var t=r.length-1,n=e.length-1,i=t/n,a=[];if(r.length===1&&r[0][0]==="M"){for(var o=0;o<n-t;o++)r.push(r[0]);return r}for(var o=0;o<n;o++){var s=Math.floor(i*o);a[s]=(a[s]||0)+1}var u=a.reduce(function(f,l,c){return c===t?f.concat(r[t]):f.concat(a8(r[c],r[c+1],l))},[]);return u.unshift(r[0]),(e[n]==="Z"||e[n]==="z")&&u.push("Z"),u},s8=function(r,e){if(r.length!==e.length)return!1;var t=!0;return me(r,function(n,i){if(n!==e[i])return t=!1,!1}),t};function u8(r,e,t){var n=null,i=t;return e<i&&(i=e,n="add"),r<i&&(i=r,n="del"),{type:n,min:i}}var f8=function(r,e){var t=r.length,n=e.length,i,a,o=0;if(t===0||n===0)return null;for(var s=[],u=0;u<=t;u++)s[u]=[],s[u][0]={min:u};for(var f=0;f<=n;f++)s[0][f]={min:f};for(var u=1;u<=t;u++){i=r[u-1];for(var f=1;f<=n;f++){a=e[f-1],s8(i,a)?o=0:o=1;var l=s[u-1][f].min+1,c=s[u][f-1].min+1,h=s[u-1][f-1].min+o;s[u][f]=u8(l,c,h)}}return s},DT=function(r,e){var t=f8(r,e),n=r.length,i=e.length,a=[],o=1,s=1;if(t[n][i].min!==n){for(var u=1;u<=n;u++){var f=t[u][u].min;s=u;for(var l=o;l<=i;l++)t[u][l].min<f&&(f=t[u][l].min,s=l);o=s,t[u][o].type&&a.push({index:u-1,type:t[u][o].type})}for(var u=a.length-1;u>=0;u--)o=a[u].index,a[u].type==="add"?r.splice(o,0,[].concat(r[o])):r.splice(o,1)}n=r.length;var c=i-n;if(n<i)for(var u=0;u<c;u++)r[n-1][0]==="z"||r[n-1][0]==="Z"?r.splice(n-2,0,r[n-2]):r.push(r[n-1]),n+=1;return r};function vg(r,e,t){for(var n=[].concat(r),i,a=1/(t+1),o=PT(e)[0],s=1;s<=t;s++)a*=s,i=Math.floor(r.length*a),i===0?n.unshift([o[0]*a+r[i][0]*(1-a),o[1]*a+r[i][1]*(1-a)]):n.splice(i,0,[o[0]*a+r[i][0]*(1-a),o[1]*a+r[i][1]*(1-a)]);return n}function PT(r){var e=[];switch(r[0]){case"M":e.push([r[1],r[2]]);break;case"L":e.push([r[1],r[2]]);break;case"A":e.push([r[6],r[7]]);break;case"Q":e.push([r[3],r[4]]),e.push([r[1],r[2]]);break;case"T":e.push([r[1],r[2]]);break;case"C":e.push([r[5],r[6]]),e.push([r[1],r[2]]),e.push([r[3],r[4]]);break;case"S":e.push([r[3],r[4]]),e.push([r[1],r[2]]);break;case"H":e.push([r[1],r[1]]);break;case"V":e.push([r[1],r[1]]);break}return e}var B0=function(r,e){if(r.length<=1)return r;for(var t,n=0;n<e.length;n++)if(r[n][0]!==e[n][0])switch(t=PT(r[n]),e[n][0]){case"M":r[n]=["M"].concat(t[0]);break;case"L":r[n]=["L"].concat(t[0]);break;case"A":r[n]=[].concat(e[n]),r[n][6]=t[0][0],r[n][7]=t[0][1];break;case"Q":if(t.length<2)if(n>0)t=vg(t,r[n-1],1);else{r[n]=e[n];break}r[n]=["Q"].concat(t.reduce(function(i,a){return i.concat(a)},[]));break;case"T":r[n]=["T"].concat(t[0]);break;case"C":if(t.length<3)if(n>0)t=vg(t,r[n-1],2);else{r[n]=e[n];break}r[n]=["C"].concat(t.reduce(function(i,a){return i.concat(a)},[]));break;case"S":if(t.length<2)if(n>0)t=vg(t,r[n-1],1);else{r[n]=e[n];break}r[n]=["S"].concat(t.reduce(function(i,a){return i.concat(a)},[]));break;default:r[n]=e[n]}return r};const l8=Object.freeze(Object.defineProperty({__proto__:null,catmullRomToBezier:O0,fillPath:o8,fillPathByDiff:DT,formatPath:B0,intersection:r8,parsePathArray:NT,parsePathString:wu,pathToAbsolute:D0,pathToCurve:P0,rectPath:OT},Symbol.toStringTag,{value:"Module"}));var RT=function(){function r(e,t){this.bubbles=!0,this.target=null,this.currentTarget=null,this.delegateTarget=null,this.delegateObject=null,this.defaultPrevented=!1,this.propagationStopped=!1,this.shape=null,this.fromShape=null,this.toShape=null,this.propagationPath=[],this.type=e,this.name=e,this.originalEvent=t,this.timeStamp=t.timeStamp}return r.prototype.preventDefault=function(){this.defaultPrevented=!0,this.originalEvent.preventDefault&&this.originalEvent.preventDefault()},r.prototype.stopPropagation=function(){this.propagationStopped=!0},r.prototype.toString=function(){var e=this.type;return"[Event (type="+e+")]"},r.prototype.save=function(){},r.prototype.restore=function(){},r}();function BT(r,e){var t=r.indexOf(e);t!==-1&&r.splice(t,1)}var Hw=typeof window<"u"&&typeof window.document<"u";function FT(r,e){if(r.isCanvas())return!0;for(var t=e.getParent(),n=!1;t;){if(t===r){n=!0;break}t=t.getParent()}return n}function F0(r){return r.cfg.visible&&r.cfg.capture}var c8=function(r){kt(e,r);function e(t){var n=r.call(this)||this;n.destroyed=!1;var i=n.getDefaultCfg();return n.cfg=yt(i,t),n}return e.prototype.getDefaultCfg=function(){return{}},e.prototype.get=function(t){return this.cfg[t]},e.prototype.set=function(t,n){this.cfg[t]=n},e.prototype.destroy=function(){this.cfg={destroyed:!0},this.off(),this.destroyed=!0},e}(OC),qw=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},h8=function(){function r(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"}return r}(),d8=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),v8=function(){function r(e,t,n,i){this.name=e,this.version=t,this.os=n,this.bot=i,this.type="bot-device"}return r}(),p8=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),g8=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),y8=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,m8=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Zw=3,b8=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",y8]],Kw=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function GT(r){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new g8:typeof navigator<"u"?w8(navigator.userAgent):_8()}function x8(r){return r!==""&&b8.reduce(function(e,t){var n=t[0],i=t[1];if(e)return e;var a=i.exec(r);return!!a&&[n,a]},!1)}function w8(r){var e=x8(r);if(!e)return null;var t=e[0],n=e[1];if(t==="searchbot")return new p8;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<Zw&&(i=qw(qw([],i,!0),S8(Zw-i.length),!0)):i=[];var a=i.join("."),o=E8(r),s=m8.exec(r);return s&&s[1]?new v8(t,a,o,s[1]):new h8(t,a,o)}function E8(r){for(var e=0,t=Kw.length;e<t;e++){var n=Kw[e],i=n[0],a=n[1],o=a.exec(r);if(o)return i}return null}function _8(){var r=typeof process<"u"&&process.version;return r?new d8(process.version.slice(1)):null}function S8(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}function Qw(r,e){var t=[],n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],u=r[5],f=r[6],l=r[7],c=r[8],h=e[0],d=e[1],v=e[2],p=e[3],g=e[4],y=e[5],m=e[6],b=e[7],x=e[8];return t[0]=h*n+d*o+v*f,t[1]=h*i+d*s+v*l,t[2]=h*a+d*u+v*c,t[3]=p*n+g*o+y*f,t[4]=p*i+g*s+y*l,t[5]=p*a+g*u+y*c,t[6]=m*n+b*o+x*f,t[7]=m*i+b*s+x*l,t[8]=m*a+b*u+x*c,t}function hs(r,e){var t=[],n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t}function zT(r){var e=[],t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],f=r[7],l=r[8],c=l*o-s*f,h=-l*a+s*u,d=f*a-o*u,v=t*c+n*h+i*d;return v?(v=1/v,e[0]=c*v,e[1]=(-l*n+i*f)*v,e[2]=(s*n-i*o)*v,e[3]=h*v,e[4]=(l*t-i*u)*v,e[5]=(-s*t+i*a)*v,e[6]=d*v,e[7]=(-f*t+n*u)*v,e[8]=(o*t-n*a)*v,e):null}var Mf=yi,pg="matrix",M8=["zIndex","capture","visible","type"],C8=["repeat"],A8=":",T8="*";function I8(r){for(var e=[],t=0;t<r.length;t++)pt(r[t])?e.push([].concat(r[t])):e.push(r[t]);return e}function k8(r,e){var t={},n=e.attrs;for(var i in r)t[i]=n[i];return t}function L8(r,e){var t={},n=e.attr();return me(r,function(i,a){C8.indexOf(a)===-1&&!Mo(n[a],i)&&(t[a]=i)}),t}function N8(r,e){if(e.onFrame)return r;var t=e.startTime,n=e.delay,i=e.duration,a=Object.prototype.hasOwnProperty;return me(r,function(o){t+n<o.startTime+o.delay+o.duration&&i>o.delay&&me(e.toAttrs,function(s,u){a.call(o.toAttrs,u)&&(delete o.toAttrs[u],delete o.fromAttrs[u])})}),r}var $T=function(r){kt(e,r);function e(t){var n=r.call(this,t)||this;n.attrs={};var i=n.getDefaultAttrs();return yt(i,t.attrs),n.attrs=i,n.initAttrs(i),n.initAnimate(),n}return 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,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=n[0],o=n[1];if(!a)return this.attrs;if(yn(a)){for(var s in a)this.setAttr(s,a[s]);return this.afterAttrsChange(a),this}return n.length===2?(this.setAttr(a,o),this.afterAttrsChange((t={},t[a]=o,t)),this):this.attrs[a]},e.prototype.isClipped=function(t,n){var i=this.getClip();return i&&!i.isHit(t,n)},e.prototype.setAttr=function(t,n){var i=this.attrs[t];i!==n&&(this.attrs[t]=n,this.onAttrChange(t,n,i))},e.prototype.onAttrChange=function(t,n,i){t==="matrix"&&this.set("totalMatrix",null)},e.prototype.afterAttrsChange=function(t){if(this.cfg.isClipShape){var n=this.cfg.applyTo;n&&n.onCanvasChange("clip")}else this.onCanvasChange("attr")},e.prototype.show=function(){return this.set("visible",!0),this.onCanvasChange("show"),this},e.prototype.hide=function(){return this.set("visible",!1),this.onCanvasChange("hide"),this},e.prototype.setZIndex=function(t){this.set("zIndex",t);var n=this.getParent();return n&&n.sort(),this},e.prototype.toFront=function(){var t=this.getParent();if(t){var n=t.getChildren();this.get("el");var i=n.indexOf(this);n.splice(i,1),n.push(this),this.onCanvasChange("zIndex")}},e.prototype.toBack=function(){var t=this.getParent();if(t){var n=t.getChildren();this.get("el");var i=n.indexOf(this);n.splice(i,1),n.unshift(this),this.onCanvasChange("zIndex")}},e.prototype.remove=function(t){t===void 0&&(t=!0);var n=this.getParent();n?(BT(n.getChildren(),this),n.get("clearing")||this.onCanvasChange("remove")):this.onCanvasChange("remove"),t&&this.destroy()},e.prototype.resetMatrix=function(){this.attr(pg,this.getDefaultMatrix()),this.onCanvasChange("matrix")},e.prototype.getMatrix=function(){return this.attr(pg)},e.prototype.setMatrix=function(t){this.attr(pg,t),this.onCanvasChange("matrix")},e.prototype.getTotalMatrix=function(){var t=this.cfg.totalMatrix;if(!t){var n=this.attr("matrix"),i=this.cfg.parentMatrix;i&&n?t=Qw(i,n):t=n||i,this.set("totalMatrix",t)}return t},e.prototype.applyMatrix=function(t){var n=this.attr("matrix"),i=null;t&&n?i=Qw(t,n):i=n||t,this.set("totalMatrix",i),this.set("parentMatrix",t)},e.prototype.getDefaultMatrix=function(){return null},e.prototype.applyToMatrix=function(t){var n=this.attr("matrix");return n?hs(n,t):t},e.prototype.invertFromMatrix=function(t){var n=this.attr("matrix");if(n){var i=zT(n);if(i)return hs(i,t)}return t},e.prototype.setClip=function(t){var n=this.getCanvas(),i=null;if(t){var a=this.getShapeBase(),o=Nu(t.type),s=a[o];s&&(i=new s({type:t.type,isClipShape:!0,applyTo:this,attrs:t.attrs,canvas:n}))}return this.set("clipShape",i),this.onCanvasChange("clip"),i},e.prototype.getClip=function(){var t=this.cfg.clipShape;return t||null},e.prototype.clone=function(){var t=this,n=this.attrs,i={};me(n,function(s,u){pt(n[u])?i[u]=I8(n[u]):i[u]=n[u]});var a=this.constructor,o=new a({attrs:i});return me(M8,function(s){o.set(s,t.get(s))}),o},e.prototype.destroy=function(){var t=this.destroyed;t||(this.attrs={},r.prototype.destroy.call(this))},e.prototype.isAnimatePaused=function(){return this.get("_pause").isPaused},e.prototype.animate=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(!(!this.get("timeline")&&!this.get("canvas"))){this.set("animating",!0);var i=this.get("timeline");i||(i=this.get("canvas").get("timeline"),this.set("timeline",i));var a=this.get("animations")||[];i.timer||i.initTimer();var o=t[0],s=t[1],u=t[2],f=u===void 0?"easeLinear":u,l=t[3],c=l===void 0?Uf:l,h=t[4],d=h===void 0?0:h,v,p,g,y,m;Mr(o)?(v=o,o={}):yn(o)&&o.onFrame&&(v=o.onFrame,p=o.repeat),yn(s)?(m=s,s=m.duration,f=m.easing||"easeLinear",d=m.delay||0,p=m.repeat||p||!1,c=m.callback||Uf,g=m.pauseCallback||Uf,y=m.resumeCallback||Uf):(ht(c)&&(d=c,c=null),Mr(f)?(c=f,f="easeLinear"):f=f||"easeLinear");var b=L8(o,this),x={fromAttrs:k8(b,this),toAttrs:b,duration:s,easing:f,repeat:p,callback:c,pauseCallback:g,resumeCallback:y,delay:d,startTime:i.getTime(),id:da(),onFrame:v,pathFormatted:!1};a.length>0?a=N8(a,x):i.addAnimator(this),a.push(x),this.set("animations",a),this.set("_pause",{isPaused:!1})}},e.prototype.stopAnimate=function(t){var n=this;t===void 0&&(t=!0);var i=this.get("animations");me(i,function(a){t&&(a.onFrame?n.attr(a.onFrame(1)):n.attr(a.toAttrs)),a.callback&&a.callback()}),this.set("animating",!1),this.set("animations",[])},e.prototype.pauseAnimate=function(){var t=this.get("timeline"),n=this.get("animations"),i=t.getTime();return me(n,function(a){a._paused=!0,a._pauseTime=i,a.pauseCallback&&a.pauseCallback()}),this.set("_pause",{isPaused:!0,pauseTime:i}),this},e.prototype.resumeAnimate=function(){var t=this.get("timeline"),n=t.getTime(),i=this.get("animations"),a=this.get("_pause").pauseTime;return me(i,function(o){o.startTime=o.startTime+(n-a),o._paused=!1,o._pauseTime=null,o.resumeCallback&&o.resumeCallback()}),this.set("_pause",{isPaused:!1}),this.set("animations",i),this},e.prototype.emitDelegation=function(t,n){var i=this,a=n.propagationPath;this.getEvents();var o;t==="mouseenter"?o=n.fromShape:t==="mouseleave"&&(o=n.toShape);for(var s=function(c){var h=a[c],d=h.get("name");if(d){if((h.isGroup()||h.isCanvas&&h.isCanvas())&&o&&FT(h,o))return"break";pt(d)?me(d,function(v){i.emitDelegateEvent(h,v,n)}):u.emitDelegateEvent(h,d,n)}},u=this,f=0;f<a.length;f++){var l=s(f);if(l==="break")break}},e.prototype.emitDelegateEvent=function(t,n,i){var a=this.getEvents(),o=n+A8+i.type;(a[o]||a[T8])&&(i.name=o,i.currentTarget=t,i.delegateTarget=this,i.delegateObject=t.get("delegateObject"),this.emit(o,i))},e.prototype.translate=function(t,n){t===void 0&&(t=0),n===void 0&&(n=0);var i=this.getMatrix(),a=Mf(i,[["t",t,n]]);return this.setMatrix(a),this},e.prototype.move=function(t,n){var i=this.attr("x")||0,a=this.attr("y")||0;return this.translate(t-i,n-a),this},e.prototype.moveTo=function(t,n){return this.move(t,n)},e.prototype.scale=function(t,n){var i=this.getMatrix(),a=Mf(i,[["s",t,n||t]]);return this.setMatrix(a),this},e.prototype.rotate=function(t){var n=this.getMatrix(),i=Mf(n,[["r",t]]);return this.setMatrix(i),this},e.prototype.rotateAtStart=function(t){var n=this.attr(),i=n.x,a=n.y,o=this.getMatrix(),s=Mf(o,[["t",-i,-a],["r",t],["t",i,a]]);return this.setMatrix(s),this},e.prototype.rotateAtPoint=function(t,n,i){var a=this.getMatrix(),o=Mf(a,[["t",-t,-n],["r",i],["t",t,n]]);return this.setMatrix(o),this},e}(c8),Jw={},G0="_INDEX";function jT(r,e){if(r.set("canvas",e),r.isGroup()){var t=r.get("children");t.length&&t.forEach(function(n){jT(n,e)})}}function UT(r,e){if(r.set("timeline",e),r.isGroup()){var t=r.get("children");t.length&&t.forEach(function(n){UT(n,e)})}}function O8(r,e,t){e.set("parent",null),e.set("canvas",null),BT(r.getChildren(),e)}function D8(r){return function(e,t){var n=r(e,t);return n===0?e[G0]-t[G0]:n}}var XT=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isCanvas=function(){return!1},e.prototype.getBBox=function(){var t=1/0,n=-1/0,i=1/0,a=-1/0,o=this.getChildren().filter(function(u){return u.get("visible")&&(!u.isGroup()||u.isGroup()&&u.getChildren().length>0)});o.length>0?me(o,function(u){var f=u.getBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY;l<t&&(t=l),c>n&&(n=c),h<i&&(i=h),d>a&&(a=d)}):(t=0,n=0,i=0,a=0);var s={x:t,y:i,minX:t,minY:i,maxX:n,maxY:a,width:n-t,height:a-i};return s},e.prototype.getCanvasBBox=function(){var t=1/0,n=-1/0,i=1/0,a=-1/0,o=this.getChildren().filter(function(u){return u.get("visible")&&(!u.isGroup()||u.isGroup()&&u.getChildren().length>0)});o.length>0?me(o,function(u){var f=u.getCanvasBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY;l<t&&(t=l),c>n&&(n=c),h<i&&(i=h),d>a&&(a=d)}):(t=0,n=0,i=0,a=0);var s={x:t,y:i,minX:t,minY:i,maxX:n,maxY:a,width:n-t,height:a-i};return s},e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.children=[],t},e.prototype.onAttrChange=function(t,n,i){if(r.prototype.onAttrChange.call(this,t,n,i),t==="matrix"){var a=this.getTotalMatrix();this._applyChildrenMarix(a)}},e.prototype.applyMatrix=function(t){var n=this.getTotalMatrix();r.prototype.applyMatrix.call(this,t);var i=this.getTotalMatrix();i!==n&&this._applyChildrenMarix(i)},e.prototype._applyChildrenMarix=function(t){var n=this.getChildren();me(n,function(i){i.applyMatrix(t)})},e.prototype.addShape=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t[0],a=t[1];yn(i)?a=i:a.type=i;var o=Jw[a.type];o||(o=Nu(a.type),Jw[a.type]=o);var s=this.getShapeBase(),u=new s[o](a);return this.add(u),u},e.prototype.addGroup=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=t[0],a=t[1],o;if(Mr(i))a?o=new i(a):o=new i({parent:this});else{var s=i||{},u=this.getGroupBase();o=new u(s)}return this.add(o),o},e.prototype.getCanvas=function(){var t;return this.isCanvas()?t=this:t=this.get("canvas"),t},e.prototype.getShape=function(t,n,i){if(!F0(this))return null;var a=this.getChildren(),o;if(this.isCanvas())o=this._findShape(a,t,n,i);else{var s=[t,n,1];s=this.invertFromMatrix(s),this.isClipped(s[0],s[1])||(o=this._findShape(a,s[0],s[1],i))}return o},e.prototype._findShape=function(t,n,i,a){for(var o=null,s=t.length-1;s>=0;s--){var u=t[s];if(F0(u)&&(u.isGroup()?o=u.getShape(n,i,a):u.isHit(n,i)&&(o=u)),o)break}return o},e.prototype.add=function(t){var n=this.getCanvas(),i=this.getChildren(),a=this.get("timeline"),o=t.getParent();o&&O8(o,t),t.set("parent",this),n&&jT(t,n),a&&UT(t,a),i.push(t),t.onCanvasChange("add"),this._applyElementMatrix(t)},e.prototype._applyElementMatrix=function(t){var n=this.getTotalMatrix();n&&t.applyMatrix(n)},e.prototype.getChildren=function(){return this.get("children")||[]},e.prototype.sort=function(){var t=this.getChildren();me(t,function(n,i){return n[G0]=i,n}),t.sort(D8(function(n,i){return n.get("zIndex")-i.get("zIndex")})),this.onCanvasChange("sort")},e.prototype.clear=function(){if(this.set("clearing",!0),!this.destroyed){for(var t=this.getChildren(),n=t.length-1;n>=0;n--)t[n].destroy();this.set("children",[]),this.onCanvasChange("clear"),this.set("clearing",!1)}},e.prototype.destroy=function(){this.get("destroyed")||(this.clear(),r.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){var n=this.getChildren();return n[t]},e.prototype.getCount=function(){var t=this.getChildren();return t.length},e.prototype.contain=function(t){var n=this.getChildren();return n.indexOf(t)>-1},e.prototype.removeChild=function(t,n){n===void 0&&(n=!0),this.contain(t)&&t.remove(n)},e.prototype.findAll=function(t){var n=[],i=this.getChildren();return me(i,function(a){t(a)&&n.push(a),a.isGroup()&&(n=n.concat(a.findAll(t)))}),n},e.prototype.find=function(t){var n=null,i=this.getChildren();return me(i,function(a){if(t(a)?n=a:a.isGroup()&&(n=a.find(t)),n)return!1}),n},e.prototype.findById=function(t){return this.find(function(n){return n.get("id")===t})},e.prototype.findByClassName=function(t){return this.find(function(n){return n.get("className")===t})},e.prototype.findAllByName=function(t){return this.findAll(function(n){return n.get("name")===t})},e}($T),Ou=0,Yf=0,Cf=0,YT=1e3,Id,Wf,kd=0,Cs=0,Ev=0,El=typeof performance=="object"&&performance.now?performance:Date,WT=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function VT(){return Cs||(WT(P8),Cs=El.now()+Ev)}function P8(){Cs=0}function z0(){this._call=this._time=this._next=null}z0.prototype=HT.prototype={constructor:z0,restart:function(r,e,t){if(typeof r!="function")throw new TypeError("callback is not a function");t=(t==null?VT():+t)+(e==null?0:+e),!this._next&&Wf!==this&&(Wf?Wf._next=this:Id=this,Wf=this),this._call=r,this._time=t,$0()},stop:function(){this._call&&(this._call=null,this._time=1/0,$0())}};function HT(r,e,t){var n=new z0;return n.restart(r,e,t),n}function R8(){VT(),++Ou;for(var r=Id,e;r;)(e=Cs-r._time)>=0&&r._call.call(null,e),r=r._next;--Ou}function eE(){Cs=(kd=El.now())+Ev,Ou=Yf=0;try{R8()}finally{Ou=0,F8(),Cs=0}}function B8(){var r=El.now(),e=r-kd;e>YT&&(Ev-=e,kd=r)}function F8(){for(var r,e=Id,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:Id=t);Wf=r,$0(n)}function $0(r){if(!Ou){Yf&&(Yf=clearTimeout(Yf));var e=r-Cs;e>24?(r<1/0&&(Yf=setTimeout(eE,r-El.now()-Ev)),Cf&&(Cf=clearInterval(Cf))):(Cf||(kd=El.now(),Cf=setInterval(B8,YT)),Ou=1,WT(eE))}}function Xm(r,e,t){r.prototype=e.prototype=t,t.constructor=r}function qT(r,e){var t=Object.create(r.prototype);for(var n in e)t[n]=e[n];return t}function Ul(){}var _l=.7,Ld=1/_l,Mu="\\s*([+-]?\\d+)\\s*",Sl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",G8=/^#([0-9a-f]{3,8})$/,z8=new RegExp(`^rgb\\(${Mu},${Mu},${Mu}\\)$`),$8=new RegExp(`^rgb\\(${fa},${fa},${fa}\\)$`),j8=new RegExp(`^rgba\\(${Mu},${Mu},${Mu},${Sl}\\)$`),U8=new RegExp(`^rgba\\(${fa},${fa},${fa},${Sl}\\)$`),X8=new RegExp(`^hsl\\(${Sl},${fa},${fa}\\)$`),Y8=new RegExp(`^hsla\\(${Sl},${fa},${fa},${Sl}\\)$`),tE={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};Xm(Ul,Ml,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:rE,formatHex:rE,formatHex8:W8,formatHsl:V8,formatRgb:nE,toString:nE});function rE(){return this.rgb().formatHex()}function W8(){return this.rgb().formatHex8()}function V8(){return ZT(this).formatHsl()}function nE(){return this.rgb().formatRgb()}function Ml(r){var e,t;return r=(r+"").trim().toLowerCase(),(e=G8.exec(r))?(t=e[1].length,e=parseInt(e[1],16),t===6?iE(e):t===3?new Fn(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?th(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?th(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=z8.exec(r))?new Fn(e[1],e[2],e[3],1):(e=$8.exec(r))?new Fn(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=j8.exec(r))?th(e[1],e[2],e[3],e[4]):(e=U8.exec(r))?th(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=X8.exec(r))?sE(e[1],e[2]/100,e[3]/100,1):(e=Y8.exec(r))?sE(e[1],e[2]/100,e[3]/100,e[4]):tE.hasOwnProperty(r)?iE(tE[r]):r==="transparent"?new Fn(NaN,NaN,NaN,0):null}function iE(r){return new Fn(r>>16&255,r>>8&255,r&255,1)}function th(r,e,t,n){return n<=0&&(r=e=t=NaN),new Fn(r,e,t,n)}function H8(r){return r instanceof Ul||(r=Ml(r)),r?(r=r.rgb(),new Fn(r.r,r.g,r.b,r.opacity)):new Fn}function j0(r,e,t,n){return arguments.length===1?H8(r):new Fn(r,e,t,n==null?1:n)}function Fn(r,e,t,n){this.r=+r,this.g=+e,this.b=+t,this.opacity=+n}Xm(Fn,j0,qT(Ul,{brighter(r){return r=r==null?Ld:Math.pow(Ld,r),new Fn(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?_l:Math.pow(_l,r),new Fn(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Fn(gs(this.r),gs(this.g),gs(this.b),Nd(this.opacity))},displayable(){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:aE,formatHex:aE,formatHex8:q8,formatRgb:oE,toString:oE}));function aE(){return`#${ds(this.r)}${ds(this.g)}${ds(this.b)}`}function q8(){return`#${ds(this.r)}${ds(this.g)}${ds(this.b)}${ds((isNaN(this.opacity)?1:this.opacity)*255)}`}function oE(){const r=Nd(this.opacity);return`${r===1?"rgb(":"rgba("}${gs(this.r)}, ${gs(this.g)}, ${gs(this.b)}${r===1?")":`, ${r})`}`}function Nd(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function gs(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function ds(r){return r=gs(r),(r<16?"0":"")+r.toString(16)}function sE(r,e,t,n){return n<=0?r=e=t=NaN:t<=0||t>=1?r=e=NaN:e<=0&&(r=NaN),new ki(r,e,t,n)}function ZT(r){if(r instanceof ki)return new ki(r.h,r.s,r.l,r.opacity);if(r instanceof Ul||(r=Ml(r)),!r)return new ki;if(r instanceof ki)return r;r=r.rgb();var e=r.r/255,t=r.g/255,n=r.b/255,i=Math.min(e,t,n),a=Math.max(e,t,n),o=NaN,s=a-i,u=(a+i)/2;return s?(e===a?o=(t-n)/s+(t<n)*6:t===a?o=(n-e)/s+2:o=(e-t)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new ki(o,s,u,r.opacity)}function Z8(r,e,t,n){return arguments.length===1?ZT(r):new ki(r,e,t,n==null?1:n)}function ki(r,e,t,n){this.h=+r,this.s=+e,this.l=+t,this.opacity=+n}Xm(ki,Z8,qT(Ul,{brighter(r){return r=r==null?Ld:Math.pow(Ld,r),new ki(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?_l:Math.pow(_l,r),new ki(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,e=isNaN(r)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,i=2*t-n;return new Fn(gg(r>=240?r-240:r+120,i,n),gg(r,i,n),gg(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new ki(uE(this.h),rh(this.s),rh(this.l),Nd(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=Nd(this.opacity);return`${r===1?"hsl(":"hsla("}${uE(this.h)}, ${rh(this.s)*100}%, ${rh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function uE(r){return r=(r||0)%360,r<0?r+360:r}function rh(r){return Math.max(0,Math.min(1,r||0))}function gg(r,e,t){return(r<60?e+(t-e)*r/60:r<180?t:r<240?e+(t-e)*(240-r)/60:e)*255}const Ym=r=>()=>r;function K8(r,e){return function(t){return r+t*e}}function Q8(r,e,t){return r=Math.pow(r,t),e=Math.pow(e,t)-r,t=1/t,function(n){return Math.pow(r+n*e,t)}}function J8(r){return(r=+r)==1?KT:function(e,t){return t-e?Q8(e,t,r):Ym(isNaN(e)?t:e)}}function KT(r,e){var t=e-r;return t?K8(r,t):Ym(isNaN(r)?e:r)}const fE=function r(e){var t=J8(e);function n(i,a){var o=t((i=j0(i)).r,(a=j0(a)).r),s=t(i.g,a.g),u=t(i.b,a.b),f=KT(i.opacity,a.opacity);return function(l){return i.r=o(l),i.g=s(l),i.b=u(l),i.opacity=f(l),i+""}}return n.gamma=r,n}(1);function QT(r,e){e||(e=[]);var t=r?Math.min(e.length,r.length):0,n=e.slice(),i;return function(a){for(i=0;i<t;++i)n[i]=r[i]*(1-a)+e[i]*a;return n}}function JT(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function e$(r,e){return(JT(e)?QT:eI)(r,e)}function eI(r,e){var t=e?e.length:0,n=r?Math.min(t,r.length):0,i=new Array(n),a=new Array(t),o;for(o=0;o<n;++o)i[o]=Od(r[o],e[o]);for(;o<t;++o)a[o]=e[o];return function(s){for(o=0;o<n;++o)a[o]=i[o](s);return a}}function t$(r,e){var t=new Date;return r=+r,e=+e,function(n){return t.setTime(r*(1-n)+e*n),t}}function U0(r,e){return r=+r,e=+e,function(t){return r*(1-t)+e*t}}function r$(r,e){var t={},n={},i;(r===null||typeof r!="object")&&(r={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in r?t[i]=Od(r[i],e[i]):n[i]=e[i];return function(a){for(i in t)n[i]=t[i](a);return n}}var X0=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yg=new RegExp(X0.source,"g");function n$(r){return function(){return r}}function i$(r){return function(e){return r(e)+""}}function a$(r,e){var t=X0.lastIndex=yg.lastIndex=0,n,i,a,o=-1,s=[],u=[];for(r=r+"",e=e+"";(n=X0.exec(r))&&(i=yg.exec(e));)(a=i.index)>t&&(a=e.slice(t,a),s[o]?s[o]+=a:s[++o]=a),(n=n[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,u.push({i:o,x:U0(n,i)})),t=yg.lastIndex;return t<e.length&&(a=e.slice(t),s[o]?s[o]+=a:s[++o]=a),s.length<2?u[0]?i$(u[0].x):n$(e):(e=u.length,function(f){for(var l=0,c;l<e;++l)s[(c=u[l]).i]=c.x(f);return s.join("")})}function Od(r,e){var t=typeof e,n;return e==null||t==="boolean"?Ym(e):(t==="number"?U0:t==="string"?(n=Ml(e))?(e=n,fE):a$:e instanceof Ml?fE:e instanceof Date?t$:JT(e)?QT:Array.isArray(e)?eI:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?r$:U0)(r,e)}function o$(r){return+r}function s$(r){return r*r}function u$(r){return r*(2-r)}function lE(r){return((r*=2)<=1?r*r:--r*(2-r)+1)/2}function f$(r){return r*r*r}function l$(r){return--r*r*r+1}function cE(r){return((r*=2)<=1?r*r*r:(r-=2)*r*r+2)/2}var Wm=3,c$=function r(e){e=+e;function t(n){return Math.pow(n,e)}return t.exponent=r,t}(Wm),h$=function r(e){e=+e;function t(n){return 1-Math.pow(1-n,e)}return t.exponent=r,t}(Wm),hE=function r(e){e=+e;function t(n){return((n*=2)<=1?Math.pow(n,e):2-Math.pow(2-n,e))/2}return t.exponent=r,t}(Wm),tI=Math.PI,rI=tI/2;function d$(r){return+r==1?1:1-Math.cos(r*rI)}function v$(r){return Math.sin(r*rI)}function dE(r){return(1-Math.cos(tI*r))/2}function Co(r){return(Math.pow(2,-10*r)-.0009765625)*1.0009775171065494}function p$(r){return Co(1-+r)}function g$(r){return 1-Co(r)}function vE(r){return((r*=2)<=1?Co(1-r):2-Co(r-1))/2}function y$(r){return 1-Math.sqrt(1-r*r)}function m$(r){return Math.sqrt(1- --r*r)}function pE(r){return((r*=2)<=1?1-Math.sqrt(1-r*r):Math.sqrt(1-(r-=2)*r)+1)/2}var Y0=4/11,b$=6/11,x$=8/11,w$=3/4,E$=9/11,_$=10/11,S$=15/16,M$=21/22,C$=63/64,nh=1/Y0/Y0;function A$(r){return 1-Cl(1-r)}function Cl(r){return(r=+r)<Y0?nh*r*r:r<x$?nh*(r-=b$)*r+w$:r<_$?nh*(r-=E$)*r+S$:nh*(r-=M$)*r+C$}function T$(r){return((r*=2)<=1?1-Cl(1-r):Cl(r-1)+1)/2}var Vm=1.70158,I$=function r(e){e=+e;function t(n){return(n=+n)*n*(e*(n-1)+n)}return t.overshoot=r,t}(Vm),k$=function r(e){e=+e;function t(n){return--n*n*((n+1)*e+n)+1}return t.overshoot=r,t}(Vm),gE=function r(e){e=+e;function t(n){return((n*=2)<1?n*n*((e+1)*n-e):(n-=2)*n*((e+1)*n+e)+2)/2}return t.overshoot=r,t}(Vm),Du=2*Math.PI,Hm=1,qm=.3,L$=function r(e,t){var n=Math.asin(1/(e=Math.max(1,e)))*(t/=Du);function i(a){return e*Co(- --a)*Math.sin((n-a)/t)}return i.amplitude=function(a){return r(a,t*Du)},i.period=function(a){return r(e,a)},i}(Hm,qm),yE=function r(e,t){var n=Math.asin(1/(e=Math.max(1,e)))*(t/=Du);function i(a){return 1-e*Co(a=+a)*Math.sin((a+n)/t)}return i.amplitude=function(a){return r(a,t*Du)},i.period=function(a){return r(e,a)},i}(Hm,qm),N$=function r(e,t){var n=Math.asin(1/(e=Math.max(1,e)))*(t/=Du);function i(a){return((a=a*2-1)<0?e*Co(-a)*Math.sin((n-a)/t):2-e*Co(a)*Math.sin((n+a)/t))/2}return i.amplitude=function(a){return r(a,t*Du)},i.period=function(a){return r(e,a)},i}(Hm,qm);const O$=Object.freeze(Object.defineProperty({__proto__:null,easeBack:gE,easeBackIn:I$,easeBackInOut:gE,easeBackOut:k$,easeBounce:Cl,easeBounceIn:A$,easeBounceInOut:T$,easeBounceOut:Cl,easeCircle:pE,easeCircleIn:y$,easeCircleInOut:pE,easeCircleOut:m$,easeCubic:cE,easeCubicIn:f$,easeCubicInOut:cE,easeCubicOut:l$,easeElastic:yE,easeElasticIn:L$,easeElasticInOut:N$,easeElasticOut:yE,easeExp:vE,easeExpIn:p$,easeExpInOut:vE,easeExpOut:g$,easeLinear:o$,easePoly:hE,easePolyIn:c$,easePolyInOut:hE,easePolyOut:h$,easeQuad:lE,easeQuadIn:s$,easeQuadInOut:lE,easeQuadOut:u$,easeSin:dE,easeSinIn:d$,easeSinInOut:dE,easeSinOut:v$},Symbol.toStringTag,{value:"Module"}));var D$={};function P$(r){return D$[r.toLowerCase()]||O$[r]}var R$=function(r){return["fill","stroke","fillStyle","strokeStyle"].includes(r)},B$=function(r){return/^[r,R,L,l]{1}[\s]*\(/.test(r)},mE=[1,0,0,0,1,0,0,0,1];function F$(r,e,t){var n={},i=e.fromAttrs,a=e.toAttrs;if(!r.destroyed){var o;for(var s in a)if(!Mo(i[s],a[s]))if(s==="path"){var u=a[s],f=i[s];u.length>f.length?(u=wu(a[s]),f=wu(i[s]),f=DT(f,u),f=B0(f,u),e.fromAttrs.path=f,e.toAttrs.path=u):e.pathFormatted||(u=wu(a[s]),f=wu(i[s]),f=B0(f,u),e.fromAttrs.path=f,e.toAttrs.path=u,e.pathFormatted=!0),n[s]=[];for(var l=0;l<u.length;l++){for(var c=u[l],h=f[l],d=[],v=0;v<c.length;v++)ht(c[v])&&h&&ht(h[v])?(o=Od(h[v],c[v]),d.push(o(t))):d.push(c[v]);n[s].push(d)}}else if(s==="matrix"){var p=e$(i[s]||mE,a[s]||mE),g=p(t);n[s]=g}else R$(s)&&B$(a[s])?n[s]=a[s]:Mr(a[s])||(o=Od(i[s],a[s]),n[s]=o(t));r.attr(n)}}function G$(r,e,t){var n=e.startTime,i=e.delay;if(t<n+i||e._paused)return!1;var a,o=e.duration,s=e.easing,u=P$(s);if(t=t-n-e.delay,e.repeat)a=t%o/o,a=u(a);else if(a=t/o,a<1)a=u(a);else return e.onFrame?r.attr(e.onFrame(1)):r.attr(e.toAttrs),!0;if(e.onFrame){var f=e.onFrame(a);r.attr(f)}else F$(r,e,a);return!1}var z$=function(){function r(e){this.animators=[],this.current=0,this.timer=null,this.canvas=e}return r.prototype.initTimer=function(){var e=this,t=!1,n,i,a;this.timer=HT(function(o){if(e.current=o,e.animators.length>0){for(var s=e.animators.length-1;s>=0;s--){if(n=e.animators[s],n.destroyed){e.removeAnimator(s);continue}if(!n.isAnimatePaused()){i=n.get("animations");for(var u=i.length-1;u>=0;u--)a=i[u],t=G$(n,a,o),t&&(i.splice(u,1),t=!1,a.callback&&a.callback())}i.length===0&&e.removeAnimator(s)}var f=e.canvas.get("autoDraw");f||e.canvas.draw()}})},r.prototype.addAnimator=function(e){this.animators.push(e)},r.prototype.removeAnimator=function(e){this.animators.splice(e,1)},r.prototype.isAnimating=function(){return!!this.animators.length},r.prototype.stop=function(){this.timer&&this.timer.stop()},r.prototype.stopAllAnimations=function(e){e===void 0&&(e=!0),this.animators.forEach(function(t){t.stopAnimate(e)}),this.animators=[],this.canvas.draw()},r.prototype.getTime=function(){return this.current},r}(),$$=40,bE=0,xE=["mousedown","mouseup","dblclick","mouseout","mouseover","mousemove","mouseleave","mouseenter","touchstart","touchmove","touchend","dragenter","dragover","dragleave","drop","contextmenu","mousewheel"];function wE(r,e,t){t.name=e,t.target=r,t.currentTarget=r,t.delegateTarget=r,r.emit(e,t)}function j$(r,e,t){if(t.bubbles){var n=void 0,i=!1;if(e==="mouseenter"?(n=t.fromShape,i=!0):e==="mouseleave"&&(i=!0,n=t.toShape),r.isCanvas()&&i)return;if(n&&FT(r,n)){t.bubbles=!1;return}t.name=e,t.currentTarget=r,t.delegateTarget=r,r.emit(e,t)}}var U$=function(){function r(e){var t=this;this.draggingShape=null,this.dragging=!1,this.currentShape=null,this.mousedownShape=null,this.mousedownPoint=null,this._eventCallback=function(n){var i=n.type;t._triggerEvent(i,n)},this._onDocumentMove=function(n){var i=t.canvas,a=i.get("el");if(a!==n.target&&(t.dragging||t.currentShape)){var o=t._getPointInfo(n);t.dragging&&t._emitEvent("drag",n,o,t.draggingShape)}},this._onDocumentMouseUp=function(n){var i=t.canvas,a=i.get("el");if(a!==n.target&&t.dragging){var o=t._getPointInfo(n);t.draggingShape&&t._emitEvent("drop",n,o,null),t._emitEvent("dragend",n,o,t.draggingShape),t._afterDrag(t.draggingShape,o,n)}},this.canvas=e.canvas}return r.prototype.init=function(){this._bindEvents()},r.prototype._bindEvents=function(){var e=this,t=this.canvas.get("el");me(xE,function(n){t.addEventListener(n,e._eventCallback)}),document&&(document.addEventListener("mousemove",this._onDocumentMove),document.addEventListener("mouseup",this._onDocumentMouseUp))},r.prototype._clearEvents=function(){var e=this,t=this.canvas.get("el");me(xE,function(n){t.removeEventListener(n,e._eventCallback)}),document&&(document.removeEventListener("mousemove",this._onDocumentMove),document.removeEventListener("mouseup",this._onDocumentMouseUp))},r.prototype._getEventObj=function(e,t,n,i,a,o){var s=new RT(e,t);return s.fromShape=a,s.toShape=o,s.x=n.x,s.y=n.y,s.clientX=n.clientX,s.clientY=n.clientY,s.propagationPath.push(i),s},r.prototype._getShape=function(e,t){return this.canvas.getShape(e.x,e.y,t)},r.prototype._getPointInfo=function(e){var t=this.canvas,n=t.getClientByEvent(e),i=t.getPointByEvent(e);return{x:i.x,y:i.y,clientX:n.x,clientY:n.y}},r.prototype._triggerEvent=function(e,t){var n=this._getPointInfo(t),i=this._getShape(n,t),a=this["_on"+e],o=!1;if(a)a.call(this,n,i,t);else{var s=this.currentShape;e==="mouseenter"||e==="dragenter"||e==="mouseover"?(this._emitEvent(e,t,n,null,null,i),i&&this._emitEvent(e,t,n,i,null,i),e==="mouseenter"&&this.draggingShape&&this._emitEvent("dragenter",t,n,null)):e==="mouseleave"||e==="dragleave"||e==="mouseout"?(o=!0,s&&this._emitEvent(e,t,n,s,s,null),this._emitEvent(e,t,n,null,s,null),e==="mouseleave"&&this.draggingShape&&this._emitEvent("dragleave",t,n,null)):this._emitEvent(e,t,n,i,null,null)}if(o||(this.currentShape=i),i&&!i.get("destroyed")){var u=this.canvas,f=u.get("el");f.style.cursor=i.attr("cursor")||u.get("cursor")}},r.prototype._onmousedown=function(e,t,n){n.button===bE&&(this.mousedownShape=t,this.mousedownPoint=e,this.mousedownTimeStamp=n.timeStamp),this._emitEvent("mousedown",n,e,t,null,null)},r.prototype._emitMouseoverEvents=function(e,t,n,i){var a=this.canvas.get("el");n!==i&&(n&&(this._emitEvent("mouseout",e,t,n,n,i),this._emitEvent("mouseleave",e,t,n,n,i),(!i||i.get("destroyed"))&&(a.style.cursor=this.canvas.get("cursor"))),i&&(this._emitEvent("mouseover",e,t,i,n,i),this._emitEvent("mouseenter",e,t,i,n,i)))},r.prototype._emitDragoverEvents=function(e,t,n,i,a){i?(i!==n&&(n&&this._emitEvent("dragleave",e,t,n,n,i),this._emitEvent("dragenter",e,t,i,n,i)),a||this._emitEvent("dragover",e,t,i)):n&&this._emitEvent("dragleave",e,t,n,n,i),a&&this._emitEvent("dragover",e,t,i)},r.prototype._afterDrag=function(e,t,n){e&&(e.set("capture",!0),this.draggingShape=null),this.dragging=!1;var i=this._getShape(t,n);i!==e&&this._emitMouseoverEvents(n,t,e,i),this.currentShape=i},r.prototype._onmouseup=function(e,t,n){if(n.button===bE){var i=this.draggingShape;this.dragging?(i&&this._emitEvent("drop",n,e,t),this._emitEvent("dragend",n,e,i),this._afterDrag(i,e,n)):(this._emitEvent("mouseup",n,e,t),t===this.mousedownShape&&this._emitEvent("click",n,e,t),this.mousedownShape=null,this.mousedownPoint=null)}},r.prototype._ondragover=function(e,t,n){n.preventDefault();var i=this.currentShape;this._emitDragoverEvents(n,e,i,t,!0)},r.prototype._onmousemove=function(e,t,n){var i=this.canvas,a=this.currentShape,o=this.draggingShape;if(this.dragging)o&&this._emitDragoverEvents(n,e,a,t,!1),this._emitEvent("drag",n,e,o);else{var s=this.mousedownPoint;if(s){var u=this.mousedownShape,f=n.timeStamp,l=f-this.mousedownTimeStamp,c=s.clientX-e.clientX,h=s.clientY-e.clientY,d=c*c+h*h;l>120||d>$$?u&&u.get("draggable")?(o=this.mousedownShape,o.set("capture",!1),this.draggingShape=o,this.dragging=!0,this._emitEvent("dragstart",n,e,o),this.mousedownShape=null,this.mousedownPoint=null):!u&&i.get("draggable")?(this.dragging=!0,this._emitEvent("dragstart",n,e,null),this.mousedownShape=null,this.mousedownPoint=null):(this._emitMouseoverEvents(n,e,a,t),this._emitEvent("mousemove",n,e,t)):(this._emitMouseoverEvents(n,e,a,t),this._emitEvent("mousemove",n,e,t))}else this._emitMouseoverEvents(n,e,a,t),this._emitEvent("mousemove",n,e,t)}},r.prototype._emitEvent=function(e,t,n,i,a,o){var s=this._getEventObj(e,t,n,i,a,o);if(i){s.shape=i,wE(i,e,s);for(var u=i.getParent();u;)u.emitDelegation(e,s),s.propagationStopped||j$(u,e,s),s.propagationPath.push(u),u=u.getParent()}else{var f=this.canvas;wE(f,e,s)}},r.prototype.destroy=function(){this._clearEvents(),this.canvas=null,this.currentShape=null,this.draggingShape=null,this.mousedownPoint=null,this.mousedownShape=null,this.mousedownTimeStamp=null},r}(),EE="px",_E=GT(),X$=_E&&_E.name==="firefox",nI=function(r){kt(e,r);function e(t){var n=r.call(this,t)||this;return n.initContainer(),n.initDom(),n.initEvents(),n.initTimeline(),n}return e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.cursor="default",t.supportCSSTransform=!1,t},e.prototype.initContainer=function(){var t=this.get("container");Pe(t)&&(t=document.getElementById(t),this.set("container",t))},e.prototype.initDom=function(){var t=this.createDom();this.set("el",t);var n=this.get("container");n.appendChild(t),this.setDOMSize(this.get("width"),this.get("height"))},e.prototype.initEvents=function(){var t=new U$({canvas:this});t.init(),this.set("eventController",t)},e.prototype.initTimeline=function(){var t=new z$(this);this.set("timeline",t)},e.prototype.setDOMSize=function(t,n){var i=this.get("el");Hw&&(i.style.width=t+EE,i.style.height=n+EE)},e.prototype.changeSize=function(t,n){this.setDOMSize(t,n),this.set("width",t),this.set("height",n),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 n=this.get("el");Hw&&n&&(n.style.cursor=t)},e.prototype.getPointByEvent=function(t){var n=this.get("supportCSSTransform");if(n){if(X$&&!ct(t.layerX)&&t.layerX!==t.offsetX)return{x:t.layerX,y:t.layerY};if(!ct(t.offsetX))return{x:t.offsetX,y:t.offsetY}}var i=this.getClientByEvent(t),a=i.x,o=i.y;return this.getPointByClient(a,o)},e.prototype.getClientByEvent=function(t){var n=t;return t.touches&&(t.type==="touchend"?n=t.changedTouches[0]:n=t.touches[0]),{x:n.clientX,y:n.clientY}},e.prototype.getPointByClient=function(t,n){var i=this.get("el"),a=i.getBoundingClientRect();return{x:t-a.left,y:n-a.top}},e.prototype.getClientByPoint=function(t,n){var i=this.get("el"),a=i.getBoundingClientRect();return{x:t+a.left,y:n+a.top}},e.prototype.draw=function(){},e.prototype.removeDom=function(){var t=this.get("el");t.parentNode.removeChild(t)},e.prototype.clearEvents=function(){var t=this.get("eventController");t.destroy()},e.prototype.isCanvas=function(){return!0},e.prototype.getParent=function(){return null},e.prototype.destroy=function(){var t=this.get("timeline");this.get("destroyed")||(this.clear(),t&&t.stop(),this.clearEvents(),this.removeDom(),r.prototype.destroy.call(this))},e}(XT),iI=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isGroup=function(){return!0},e.prototype.isEntityGroup=function(){return!1},e.prototype.clone=function(){for(var t=r.prototype.clone.call(this),n=this.getChildren(),i=0;i<n.length;i++){var a=n[i];t.add(a.clone())}return t},e}(XT),aI=function(r){kt(e,r);function e(t){return r.call(this,t)||this}return e.prototype._isInBBox=function(t,n){var i=this.getBBox();return i.minX<=t&&i.maxX>=t&&i.minY<=n&&i.maxY>=n},e.prototype.afterAttrsChange=function(t){r.prototype.afterAttrsChange.call(this,t),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(t){r.prototype.applyMatrix.call(this,t),this.set("canvasBBox",null)},e.prototype.calculateCanvasBBox=function(){var t=this.getBBox(),n=this.getTotalMatrix(),i=t.minX,a=t.minY,o=t.maxX,s=t.maxY;if(n){var u=hs(n,[t.minX,t.minY]),f=hs(n,[t.maxX,t.minY]),l=hs(n,[t.minX,t.maxY]),c=hs(n,[t.maxX,t.maxY]);i=Math.min(u[0],f[0],l[0],c[0]),o=Math.max(u[0],f[0],l[0],c[0]),a=Math.min(u[1],f[1],l[1],c[1]),s=Math.max(u[1],f[1],l[1],c[1])}var h=this.attrs;if(h.shadowColor){var d=h.shadowBlur,v=d===void 0?0:d,p=h.shadowOffsetX,g=p===void 0?0:p,y=h.shadowOffsetY,m=y===void 0?0:y,b=i-v+g,x=o+v+g,w=a-v+m,E=s+v+m;i=Math.min(i,b),o=Math.max(o,x),a=Math.min(a,w),s=Math.max(s,E)}return{x:i,y:a,minX:i,minY:a,maxX:o,maxY:s,width:o-i,height:s-a}},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,n){return!1},e.prototype.isOnlyHitBox=function(){return!1},e.prototype.isHit=function(t,n){var i=this.get("startArrowShape"),a=this.get("endArrowShape"),o=[t,n,1];o=this.invertFromMatrix(o);var s=o[0],u=o[1],f=this._isInBBox(s,u);return this.isOnlyHitBox()?f:!!(f&&!this.isClipped(s,u)&&(this.isInShape(s,u)||i&&i.isHit(s,u)||a&&a.isHit(s,u)))},e}($T),oI=new Map;function ya(r,e){oI.set(r,e)}function sI(r){return oI.get(r)}function uI(r){var e=r.attr(),t=e.x,n=e.y,i=e.width,a=e.height;return{x:t,y:n,width:i,height:a}}function fI(r){var e=r.attr(),t=e.x,n=e.y,i=e.r;return{x:t-i,y:n-i,width:i*2,height:i*2}}function Tn(r,e,t,n){var i=r-t,a=e-n;return Math.sqrt(i*i+a*a)}function rd(r,e){return Math.abs(r-e)<.001}function Ku(r,e){var t=ha(r),n=ha(e),i=ca(r),a=ca(e);return{x:t,y:n,width:i-t,height:a-n}}function _v(r){return(r+Math.PI*2)%(Math.PI*2)}const gn={box:function(r,e,t,n){return Ku([r,t],[e,n])},length:function(r,e,t,n){return Tn(r,e,t,n)},pointAt:function(r,e,t,n,i){return{x:(1-i)*r+i*t,y:(1-i)*e+i*n}},pointDistance:function(r,e,t,n,i,a){var o=(t-r)*(i-r)+(n-e)*(a-e);if(o<0)return Tn(r,e,i,a);var s=(t-r)*(t-r)+(n-e)*(n-e);return o>s?Tn(t,n,i,a):this.pointToLine(r,e,t,n,i,a)},pointToLine:function(r,e,t,n,i,a){var o=[t-r,n-e];if(Lm(o,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-e)*(a-e));var s=[-o[1],o[0]];_o(s,s);var u=[i-r,a-e];return Math.abs(km(u,s))},tangentAngle:function(r,e,t,n){return Math.atan2(n-e,t-r)}};var Y$=1e-4;function lI(r,e,t,n,i,a){var o,s=1/0,u=[t,n],f=20;a&&a>200&&(f=a/10);for(var l=1/f,c=l/10,h=0;h<=f;h++){var d=h*l,v=[i.apply(null,r.concat([d])),i.apply(null,e.concat([d]))],p=Tn(u[0],u[1],v[0],v[1]);p<s&&(o=d,s=p)}if(o===0)return{x:r[0],y:e[0]};if(o===1){var g=r.length;return{x:r[g-1],y:e[g-1]}}s=1/0;for(var h=0;h<32&&!(c<Y$);h++){var y=o-c,m=o+c,v=[i.apply(null,r.concat([y])),i.apply(null,e.concat([y]))],p=Tn(u[0],u[1],v[0],v[1]);if(y>=0&&p<s)o=y,s=p;else{var b=[i.apply(null,r.concat([m])),i.apply(null,e.concat([m]))],x=Tn(u[0],u[1],b[0],b[1]);m<=1&&x<s?(o=m,s=x):c*=.5}}return{x:i.apply(null,r.concat([o])),y:i.apply(null,e.concat([o]))}}function W$(r,e){for(var t=0,n=r.length,i=0;i<n;i++){var a=r[i],o=e[i],s=r[(i+1)%n],u=e[(i+1)%n];t+=Tn(a,o,s,u)}return t/2}function vo(r,e,t,n){var i=1-n;return i*i*r+2*n*i*e+n*n*t}function SE(r,e,t){var n=r+t-2*e;if(rd(n,0))return[.5];var i=(r-e)/n;return i<=1&&i>=0?[i]:[]}function ME(r,e,t,n){return 2*(1-n)*(e-r)+2*n*(t-e)}function cI(r,e,t,n,i,a,o){var s=vo(r,t,i,o),u=vo(e,n,a,o),f=gn.pointAt(r,e,t,n,o),l=gn.pointAt(t,n,i,a,o);return[[r,e,f.x,f.y,s,u],[s,u,l.x,l.y,i,a]]}function W0(r,e,t,n,i,a,o){if(o===0)return(Tn(r,e,t,n)+Tn(t,n,i,a)+Tn(r,e,i,a))/2;var s=cI(r,e,t,n,i,a,.5),u=s[0],f=s[1];return u.push(o-1),f.push(o-1),W0.apply(null,u)+W0.apply(null,f)}const hI={box:function(r,e,t,n,i,a){var o=SE(r,t,i)[0],s=SE(e,n,a)[0],u=[r,i],f=[e,a];return o!==void 0&&u.push(vo(r,t,i,o)),s!==void 0&&f.push(vo(e,n,a,s)),Ku(u,f)},length:function(r,e,t,n,i,a){return W0(r,e,t,n,i,a,3)},nearestPoint:function(r,e,t,n,i,a,o,s){return lI([r,t,i],[e,n,a],o,s,vo)},pointDistance:function(r,e,t,n,i,a,o,s){var u=this.nearestPoint(r,e,t,n,i,a,o,s);return Tn(u.x,u.y,o,s)},interpolationAt:vo,pointAt:function(r,e,t,n,i,a,o){return{x:vo(r,t,i,o),y:vo(e,n,a,o)}},divide:function(r,e,t,n,i,a,o){return cI(r,e,t,n,i,a,o)},tangentAngle:function(r,e,t,n,i,a,o){var s=ME(r,t,i,o),u=ME(e,n,a,o),f=Math.atan2(u,s);return _v(f)}};function po(r,e,t,n,i){var a=1-i;return a*a*a*r+3*e*i*a*a+3*t*i*i*a+n*i*i*i}function CE(r,e,t,n,i){var a=1-i;return 3*(a*a*(e-r)+2*a*i*(t-e)+i*i*(n-t))}function mg(r,e,t,n){var i=-3*r+9*e-9*t+3*n,a=6*r-12*e+6*t,o=3*e-3*r,s=[],u,f,l;if(rd(i,0))rd(a,0)||(u=-o/a,u>=0&&u<=1&&s.push(u));else{var c=a*a-4*i*o;rd(c,0)?s.push(-a/(2*i)):c>0&&(l=Math.sqrt(c),u=(-a+l)/(2*i),f=(-a-l)/(2*i),u>=0&&u<=1&&s.push(u),f>=0&&f<=1&&s.push(f))}return s}function dI(r,e,t,n,i,a,o,s,u){var f=po(r,t,i,o,u),l=po(e,n,a,s,u),c=gn.pointAt(r,e,t,n,u),h=gn.pointAt(t,n,i,a,u),d=gn.pointAt(i,a,o,s,u),v=gn.pointAt(c.x,c.y,h.x,h.y,u),p=gn.pointAt(h.x,h.y,d.x,d.y,u);return[[r,e,c.x,c.y,v.x,v.y,f,l],[f,l,p.x,p.y,d.x,d.y,o,s]]}function V0(r,e,t,n,i,a,o,s,u){if(u===0)return W$([r,t,i,o],[e,n,a,s]);var f=dI(r,e,t,n,i,a,o,s,.5),l=f[0],c=f[1];return l.push(u-1),c.push(u-1),V0.apply(null,l)+V0.apply(null,c)}const nl={extrema:mg,box:function(r,e,t,n,i,a,o,s){for(var u=[r,o],f=[e,s],l=mg(r,t,i,o),c=mg(e,n,a,s),h=0;h<l.length;h++)u.push(po(r,t,i,o,l[h]));for(var h=0;h<c.length;h++)f.push(po(e,n,a,s,c[h]));return Ku(u,f)},length:function(r,e,t,n,i,a,o,s){return V0(r,e,t,n,i,a,o,s,3)},nearestPoint:function(r,e,t,n,i,a,o,s,u,f,l){return lI([r,t,i,o],[e,n,a,s],u,f,po,l)},pointDistance:function(r,e,t,n,i,a,o,s,u,f,l){var c=this.nearestPoint(r,e,t,n,i,a,o,s,u,f,l);return Tn(c.x,c.y,u,f)},interpolationAt:po,pointAt:function(r,e,t,n,i,a,o,s,u){return{x:po(r,t,i,o,u),y:po(e,n,a,s,u)}},divide:function(r,e,t,n,i,a,o,s,u){return dI(r,e,t,n,i,a,o,s,u)},tangentAngle:function(r,e,t,n,i,a,o,s,u){var f=CE(r,t,i,o,u),l=CE(e,n,a,s,u);return _v(Math.atan2(l,f))}};function AE(r,e){var t=Math.abs(r);return e>0?t:t*-1}const V$={box:function(r,e,t,n){return{x:r-t,y:e-n,width:t*2,height:n*2}},length:function(r,e,t,n){return Math.PI*(3*(t+n)-Math.sqrt((3*t+n)*(t+3*n)))},nearestPoint:function(r,e,t,n,i,a){var o=t,s=n;if(o===0||s===0)return{x:r,y:e};for(var u=i-r,f=a-e,l=Math.abs(u),c=Math.abs(f),h=o*o,d=s*s,v=Math.PI/4,p,g,y=0;y<4;y++){p=o*Math.cos(v),g=s*Math.sin(v);var m=(h-d)*Math.pow(Math.cos(v),3)/o,b=(d-h)*Math.pow(Math.sin(v),3)/s,x=p-m,w=g-b,E=l-m,_=c-b,M=Math.hypot(w,x),C=Math.hypot(_,E),S=M*Math.asin((x*_-w*E)/(M*C)),A=S/Math.sqrt(h+d-p*p-g*g);v+=A,v=Math.min(Math.PI/2,Math.max(0,v))}return{x:r+AE(p,u),y:e+AE(g,f)}},pointDistance:function(r,e,t,n,i,a){var o=this.nearestPoint(r,e,t,n,i,a);return Tn(o.x,o.y,i,a)},pointAt:function(r,e,t,n,i){var a=2*Math.PI*i;return{x:r+t*Math.cos(a),y:e+n*Math.sin(a)}},tangentAngle:function(r,e,t,n,i){var a=2*Math.PI*i,o=Math.atan2(n*Math.cos(a),-t*Math.sin(a));return _v(o)}};function H$(r,e,t,n,i,a,o,s){return-1*t*Math.cos(i)*Math.sin(s)-n*Math.sin(i)*Math.cos(s)}function q$(r,e,t,n,i,a,o,s){return-1*t*Math.sin(i)*Math.sin(s)+n*Math.cos(i)*Math.cos(s)}function Z$(r,e,t){return Math.atan(-e/r*Math.tan(t))}function K$(r,e,t){return Math.atan(e/(r*Math.tan(t)))}function TE(r,e,t,n,i,a){return t*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function IE(r,e,t,n,i,a){return t*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+e}function Q$(r,e,t,n){var i=Math.atan2(n*r,t*e);return(i+Math.PI*2)%(Math.PI*2)}function kE(r,e,t){return{x:r*Math.cos(t),y:e*Math.sin(t)}}function LE(r,e,t){var n=Math.cos(t),i=Math.sin(t);return[r*n-e*i,r*i+e*n]}const J$={box:function(r,e,t,n,i,a,o){for(var s=Z$(t,n,i),u=1/0,f=-1/0,l=[a,o],c=-Math.PI*2;c<=Math.PI*2;c+=Math.PI){var h=s+c;a<o?a<h&&h<o&&l.push(h):o<h&&h<a&&l.push(h)}for(var c=0;c<l.length;c++){var d=TE(r,e,t,n,i,l[c]);d<u&&(u=d),d>f&&(f=d)}for(var v=K$(t,n,i),p=1/0,g=-1/0,y=[a,o],c=-Math.PI*2;c<=Math.PI*2;c+=Math.PI){var m=v+c;a<o?a<m&&m<o&&y.push(m):o<m&&m<a&&y.push(m)}for(var c=0;c<y.length;c++){var b=IE(r,e,t,n,i,y[c]);b<p&&(p=b),b>g&&(g=b)}return{x:u,y:p,width:f-u,height:g-p}},length:function(r,e,t,n,i,a,o){},nearestPoint:function(r,e,t,n,i,a,o,s,u){var f=LE(s-r,u-e,-i),l=f[0],c=f[1],h=V$.nearestPoint(0,0,t,n,l,c),d=Q$(t,n,h.x,h.y);d<a?h=kE(t,n,a):d>o&&(h=kE(t,n,o));var v=LE(h.x,h.y,i);return{x:v[0]+r,y:v[1]+e}},pointDistance:function(r,e,t,n,i,a,o,s,u){var f=this.nearestPoint(r,e,t,n,s,u);return Tn(f.x,f.y,s,u)},pointAt:function(r,e,t,n,i,a,o,s){var u=(o-a)*s+a;return{x:TE(r,e,t,n,i,u),y:IE(r,e,t,n,i,u)}},tangentAngle:function(r,e,t,n,i,a,o,s){var u=(o-a)*s+a,f=H$(r,e,t,n,i,a,o,u),l=q$(r,e,t,n,i,a,o,u);return _v(Math.atan2(l,f))}};function vI(r){for(var e=0,t=[],n=0;n<r.length-1;n++){var i=r[n],a=r[n+1],o=Tn(i[0],i[1],a[0],a[1]),s={from:i,to:a,length:o};t.push(s),e+=o}return{segments:t,totalLength:e}}function ej(r){if(r.length<2)return 0;for(var e=0,t=0;t<r.length-1;t++){var n=r[t],i=r[t+1];e+=Tn(n[0],n[1],i[0],i[1])}return e}function tj(r,e){if(e>1||e<0||r.length<2)return null;var t=vI(r),n=t.segments,i=t.totalLength;if(i===0)return{x:r[0][0],y:r[0][1]};for(var a=0,o=null,s=0;s<n.length;s++){var u=n[s],f=u.from,l=u.to,c=u.length/i;if(e>=a&&e<=a+c){var h=(e-a)/c;o=gn.pointAt(f[0],f[1],l[0],l[1],h);break}a+=c}return o}function rj(r,e){if(e>1||e<0||r.length<2)return 0;for(var t=vI(r),n=t.segments,i=t.totalLength,a=0,o=0,s=0;s<n.length;s++){var u=n[s],f=u.from,l=u.to,c=u.length/i;if(e>=a&&e<=a+c){o=Math.atan2(l[1]-f[1],l[0]-f[0]);break}a+=c}return o}function nj(r,e,t){for(var n=1/0,i=0;i<r.length-1;i++){var a=r[i],o=r[i+1],s=gn.pointDistance(a[0],a[1],o[0],o[1],e,t);s<n&&(n=s)}return n}const pI={box:function(r){for(var e=[],t=[],n=0;n<r.length;n++){var i=r[n];e.push(i[0]),t.push(i[1])}return Ku(e,t)},length:function(r){return ej(r)},pointAt:function(r,e){return tj(r,e)},pointDistance:function(r,e,t){return nj(r,e,t)},tangentAngle:function(r,e){return rj(r,e)}};function NE(r,e){return!r||!e?r||e:{minX:Math.min(r.minX,e.minX),minY:Math.min(r.minY,e.minY),maxX:Math.max(r.maxX,e.maxX),maxY:Math.max(r.maxY,e.maxY)}}function Zm(r,e){var t=r.get("startArrowShape"),n=r.get("endArrowShape"),i=null,a=null;return t&&(i=t.getCanvasBBox(),e=NE(e,i)),n&&(a=n.getCanvasBBox(),e=NE(e,a)),e}function ij(r){for(var e=r.attr(),t=e.points,n=[],i=[],a=0;a<t.length;a++){var o=t[a];n.push(o[0]),i.push(o[1])}var s=Ku(n,i),u=s.x,f=s.y,l=s.width,c=s.height,h={minX:u,minY:f,maxX:u+l,maxY:f+c};return h=Zm(r,h),{x:h.minX,y:h.minY,width:h.maxX-h.minX,height:h.maxY-h.minY}}function aj(r){for(var e=r.attr(),t=e.points,n=[],i=[],a=0;a<t.length;a++){var o=t[a];n.push(o[0]),i.push(o[1])}return Ku(n,i)}var bg=null;function gI(){if(!bg){var r=document.createElement("canvas");r.width=1,r.height=1,bg=r.getContext("2d")}return bg}function yI(r,e,t){var n=1;if(Pe(r)&&(n=r.split(`
|
|
3
|
-
`).length),n>1){var i=oj(e,t);return e*n+i*(n-1)}return e}function oj(r,e){return e?e-r:r*.14}function sj(r,e){var t=gI(),n=0;if(ct(r)||r==="")return n;if(t.save(),t.font=e,Pe(r)&&r.includes(`
|
|
4
|
-
`)){var i=r.split(`
|
|
5
|
-
`);me(i,function(a){var o=t.measureText(a).width;n<o&&(n=o)})}else n=t.measureText(r).width;return t.restore(),n}function mI(r){var e=r.fontSize,t=r.fontFamily,n=r.fontWeight,i=r.fontStyle,a=r.fontVariant;return[i,a,n,e+"px",t].join(" ").trim()}function uj(r){var e=r.attr(),t=e.x,n=e.y,i=e.text,a=e.fontSize,o=e.lineHeight,s=e.font;s||(s=mI(e));var u=sj(i,s),f;if(!u)f={x:t,y:n,width:0,height:0};else{var l=e.textAlign,c=e.textBaseline,h=yI(i,a,o),d={x:t,y:n-h};l&&(l==="end"||l==="right"?d.x-=u:l==="center"&&(d.x-=u/2)),c&&(c==="top"?d.y+=h:c==="middle"&&(d.y+=h/2)),f={x:d.x,y:d.y,width:u,height:h}}return f}var fj=/[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/ig,lj=/[^\s\,]+/ig;function cj(r){var e=r||[];if(pt(e))return e;if(Pe(e))return e=e.match(fj),me(e,function(t,n){if(t=t.match(lj),t[0].length>1){var i=t[0].charAt(0);t.splice(1,0,t[0].substr(1)),t[0]=i}me(t,function(a,o){isNaN(a)||(t[o]=+a)}),e[n]=t}),e}function hj(r,e,t,n){var i=[],a=!!n,o,s,u,f,l,c,h;if(a){u=n[0],f=n[1];for(var d=0,v=r.length;d<v;d+=1){var p=r[d];u=fo([0,0],u,p),f=lo([0,0],f,p)}}for(var d=0,g=r.length;d<g;d+=1){var p=r[d];if(d===0&&!t)h=p;else if(d===g-1&&!t)c=p,i.push(h),i.push(c);else{var y=[d?d-1:g-1,d-1][t?0:1];o=r[y],s=r[t?(d+1)%g:d+1];var m=[0,0];m=Zh(m,s,o),m=An(m,m,e);var b=_d(p,o),x=_d(p,s),w=b+x;w!==0&&(b/=w,x/=w);var E=An([0,0],m,-b),_=An([0,0],m,x);c=vn([0,0],p,E),l=vn([0,0],p,_),l=fo([0,0],l,lo([0,0],s,p)),l=lo([0,0],l,fo([0,0],s,p)),E=Zh([0,0],l,p),E=An([0,0],E,-b/x),c=vn([0,0],p,E),c=fo([0,0],c,lo([0,0],o,p)),c=lo([0,0],c,fo([0,0],o,p)),_=Zh([0,0],p,c),_=An([0,0],_,x/b),l=vn([0,0],p,_),a&&(c=lo([0,0],c,u),c=fo([0,0],c,f),l=lo([0,0],l,u),l=fo([0,0],l,f)),i.push(h),i.push(c),h=l}}return t&&i.push(i.shift()),i}function bI(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=[[0,0],[1,1]]);for(var n=!!e,i=[],a=0,o=r.length;a<o;a+=2)i.push([r[a],r[a+1]]);for(var s=hj(i,.4,n,t),u=i.length,f=[],l,c,h,a=0;a<u-1;a+=1)l=s[a*2],c=s[a*2+1],h=i[a+1],f.push(["C",l[0],l[1],c[0],c[1],h[0],h[1]]);return n&&(l=s[u],c=s[u+1],h=i[0],f.push(["C",l[0],l[1],c[0],c[1],h[0],h[1]])),f}var il=`
|
|
6
|
-
\v\f\r \u2028\u2029`,dj=new RegExp("([a-z])["+il+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+il+"]*,?["+il+"]*)+)","ig"),vj=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+il+"]*,?["+il+"]*","ig");function H0(r){if(!r)return null;if(pt(r))return r;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},t=[];return String(r).replace(dj,function(n,i,a){var o=[],s=i.toLowerCase();if(a.replace(vj,function(u,f){f&&o.push(+f)}),s==="m"&&o.length>2&&(t.push([i].concat(o.splice(0,2))),s="l",i=i==="m"?"l":"L"),s==="o"&&o.length===1&&t.push([i,o[0]]),s==="r")t.push([i].concat(o));else for(;o.length>=e[s]&&(t.push([i].concat(o.splice(0,e[s]))),!!e[s]););return""}),t}var pj=/[a-z]/;function OE(r,e){return[e[0]+(e[0]-r[0]),e[1]+(e[1]-r[1])]}function xI(r){var e=H0(r);if(!e||!e.length)return[["M",0,0]];for(var t=!1,n=0;n<e.length;n++){var i=e[n][0];if(pj.test(i)||["V","H","T","S"].indexOf(i)>=0){t=!0;break}}if(!t)return e;var a=[],o=0,s=0,u=0,f=0,l=0,c=e[0];(c[0]==="M"||c[0]==="m")&&(o=+c[1],s=+c[2],u=o,f=s,l++,a[0]=["M",o,s]);for(var n=l,h=e.length;n<h;n++){var d=e[n],v=a[n-1],p=[],i=d[0],g=i.toUpperCase();if(i!==g)switch(p[0]=g,g){case"A":p[1]=d[1],p[2]=d[2],p[3]=d[3],p[4]=d[4],p[5]=d[5],p[6]=+d[6]+o,p[7]=+d[7]+s;break;case"V":p[1]=+d[1]+s;break;case"H":p[1]=+d[1]+o;break;case"M":u=+d[1]+o,f=+d[2]+s,p[1]=u,p[2]=f;break;default:for(var y=1,m=d.length;y<m;y++)p[y]=+d[y]+(y%2?o:s)}else p=e[n];switch(g){case"Z":o=+u,s=+f;break;case"H":o=p[1],p=["L",o,s];break;case"V":s=p[1],p=["L",o,s];break;case"T":o=p[1],s=p[2];var b=OE([v[1],v[2]],[v[3],v[4]]);p=["Q",b[0],b[1],o,s];break;case"S":o=p[p.length-2],s=p[p.length-1];var x=v.length,w=OE([v[x-4],v[x-3]],[v[x-2],v[x-1]]);p=["C",w[0],w[1],p[1],p[2],o,s];break;case"M":u=p[p.length-2],f=p[p.length-1];break;default:o=p[p.length-2],s=p[p.length-1]}a.push(p)}return a}function ih(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function q0(r,e){return ih(r)*ih(e)?(r[0]*e[0]+r[1]*e[1])/(ih(r)*ih(e)):1}function DE(r,e){return(r[0]*e[1]<r[1]*e[0]?-1:1)*Math.acos(q0(r,e))}function Z0(r,e){return r[0]===e[0]&&r[1]===e[1]}function gj(r,e){var t=e[1],n=e[2],i=gv(yv(e[3]),Math.PI*2),a=e[4],o=e[5],s=r[0],u=r[1],f=e[6],l=e[7],c=Math.cos(i)*(s-f)/2+Math.sin(i)*(u-l)/2,h=-1*Math.sin(i)*(s-f)/2+Math.cos(i)*(u-l)/2,d=c*c/(t*t)+h*h/(n*n);d>1&&(t*=Math.sqrt(d),n*=Math.sqrt(d));var v=t*t*(h*h)+n*n*(c*c),p=v?Math.sqrt((t*t*(n*n)-v)/v):1;a===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*t*h/n:0,y=t?p*-n*c/t:0,m=(s+f)/2+Math.cos(i)*g-Math.sin(i)*y,b=(u+l)/2+Math.sin(i)*g+Math.cos(i)*y,x=[(c-g)/t,(h-y)/n],w=[(-1*c-g)/t,(-1*h-y)/n],E=DE([1,0],x),_=DE(x,w);return q0(x,w)<=-1&&(_=Math.PI),q0(x,w)>=1&&(_=0),o===0&&_>0&&(_=_-2*Math.PI),o===1&&_<0&&(_=_+2*Math.PI),{cx:m,cy:b,rx:Z0(r,[f,l])?0:t,ry:Z0(r,[f,l])?0:n,startAngle:E,endAngle:E+_,xRotation:i,arcFlag:a,sweepFlag:o}}function PE(r,e){return[e[0]+(e[0]-r[0]),e[1]+(e[1]-r[1])]}function wI(r){r=cj(r);for(var e=[],t=null,n=null,i=null,a=0,o=r.length,s=0;s<o;s++){var u=r[s];n=r[s+1];var f=u[0],l={command:f,prePoint:t,params:u,startTangent:null,endTangent:null};switch(f){case"M":i=[u[1],u[2]],a=s;break;case"A":var c=gj(t,u);l.arcParams=c;break}if(f==="Z")t=i,n=r[a+1];else{var h=u.length;t=[u[h-2],u[h-1]]}n&&n[0]==="Z"&&(n=r[a],e[a]&&(e[a].prePoint=t)),l.currentPoint=t,e[a]&&Z0(t,e[a].currentPoint)&&(e[a].prePoint=l.prePoint);var d=n?[n[n.length-2],n[n.length-1]]:null;l.nextPoint=d;var v=l.prePoint;if(["L","H","V"].includes(f))l.startTangent=[v[0]-t[0],v[1]-t[1]],l.endTangent=[t[0]-v[0],t[1]-v[1]];else if(f==="Q"){var p=[u[1],u[2]];l.startTangent=[v[0]-p[0],v[1]-p[1]],l.endTangent=[t[0]-p[0],t[1]-p[1]]}else if(f==="T"){var g=e[s-1],p=PE(g.currentPoint,v);g.command==="Q"?(l.command="Q",l.startTangent=[v[0]-p[0],v[1]-p[1]],l.endTangent=[t[0]-p[0],t[1]-p[1]]):(l.command="TL",l.startTangent=[v[0]-t[0],v[1]-t[1]],l.endTangent=[t[0]-v[0],t[1]-v[1]])}else if(f==="C"){var y=[u[1],u[2]],m=[u[3],u[4]];l.startTangent=[v[0]-y[0],v[1]-y[1]],l.endTangent=[t[0]-m[0],t[1]-m[1]],l.startTangent[0]===0&&l.startTangent[1]===0&&(l.startTangent=[y[0]-m[0],y[1]-m[1]]),l.endTangent[0]===0&&l.endTangent[1]===0&&(l.endTangent=[m[0]-y[0],m[1]-y[1]])}else if(f==="S"){var g=e[s-1],y=PE(g.currentPoint,v),m=[u[1],u[2]];g.command==="C"?(l.command="C",l.startTangent=[v[0]-y[0],v[1]-y[1]],l.endTangent=[t[0]-m[0],t[1]-m[1]]):(l.command="SQ",l.startTangent=[v[0]-m[0],v[1]-m[1]],l.endTangent=[t[0]-m[0],t[1]-m[1]])}else if(f==="A"){var b=.001,x=l.arcParams||{},w=x.cx,E=w===void 0?0:w,_=x.cy,M=_===void 0?0:_,C=x.rx,S=C===void 0?0:C,A=x.ry,T=A===void 0?0:A,k=x.sweepFlag,O=k===void 0?0:k,F=x.startAngle,D=F===void 0?0:F,$=x.endAngle,Y=$===void 0?0:$;O===0&&(b*=-1);var N=S*Math.cos(D-b)+E,P=T*Math.sin(D-b)+M;l.startTangent=[N-i[0],P-i[1]];var W=S*Math.cos(D+Y+b)+E,J=T*Math.sin(D+Y-b)+M;l.endTangent=[v[0]-W,v[1]-J]}e.push(l)}return e}function yj(r,e){for(var t=[],n=[],i=[],a=0;a<r.length;a++){var o=r[a],s=o.currentPoint,u=o.params,f=o.prePoint,l=void 0;switch(o.command){case"Q":l=hI.box(f[0],f[1],u[1],u[2],u[3],u[4]);break;case"C":l=nl.box(f[0],f[1],u[1],u[2],u[3],u[4],u[5],u[6]);break;case"A":var c=o.arcParams;l=J$.box(c.cx,c.cy,c.rx,c.ry,c.xRotation,c.startAngle,c.endAngle);break;default:t.push(s[0]),n.push(s[1]);break}l&&(o.box=l,t.push(l.x,l.x+l.width),n.push(l.y,l.y+l.height)),e&&(o.command==="L"||o.command==="M")&&o.prePoint&&o.nextPoint&&i.push(o)}t=t.filter(function(y){return!Number.isNaN(y)&&y!==1/0&&y!==-1/0}),n=n.filter(function(y){return!Number.isNaN(y)&&y!==1/0&&y!==-1/0});var h=ha(t),d=ha(n),v=ca(t),p=ca(n);if(i.length===0)return{x:h,y:d,width:v-h,height:p-d};for(var a=0;a<i.length;a++){var o=i[a],s=o.currentPoint,g=void 0;s[0]===h?(g=ah(o,e),h=h-g.xExtra):s[0]===v&&(g=ah(o,e),v=v+g.xExtra),s[1]===d?(g=ah(o,e),d=d-g.yExtra):s[1]===p&&(g=ah(o,e),p=p+g.yExtra)}return{x:h,y:d,width:v-h,height:p-d}}function ah(r,e){var t=r.prePoint,n=r.currentPoint,i=r.nextPoint,a=Math.pow(n[0]-t[0],2)+Math.pow(n[1]-t[1],2),o=Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2),s=Math.pow(t[0]-i[0],2)+Math.pow(t[1]-i[1],2),u=Math.acos((a+o-s)/(2*Math.sqrt(a)*Math.sqrt(o)));if(!u||Math.sin(u)===0||SC(u,0))return{xExtra:0,yExtra:0};var f=Math.abs(Math.atan2(i[1]-n[1],i[0]-n[0])),l=Math.abs(Math.atan2(i[0]-n[0],i[1]-n[1]));f=f>Math.PI/2?Math.PI-f:f,l=l>Math.PI/2?Math.PI-l:l;var c={xExtra:Math.cos(u/2-f)*(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};return c}function mj(r){var e=r.attr(),t=e.path,n=e.stroke,i=n?e.lineWidth:0,a=r.get("segments")||wI(t),o=yj(a,i),s=o.x,u=o.y,f=o.width,l=o.height,c={minX:s,minY:u,maxX:s+f,maxY:u+l};return c=Zm(r,c),{x:c.minX,y:c.minY,width:c.maxX-c.minX,height:c.maxY-c.minY}}function bj(r){var e=r.attr(),t=e.x1,n=e.y1,i=e.x2,a=e.y2,o=Math.min(t,i),s=Math.max(t,i),u=Math.min(n,a),f=Math.max(n,a),l={minX:o,maxX:s,minY:u,maxY:f};return l=Zm(r,l),{x:l.minX,y:l.minY,width:l.maxX-l.minX,height:l.maxY-l.minY}}function xj(r){var e=r.attr(),t=e.x,n=e.y,i=e.rx,a=e.ry;return{x:t-i,y:n-a,width:i*2,height:a*2}}ya("rect",uI);ya("image",uI);ya("circle",fI);ya("marker",fI);ya("polyline",ij);ya("polygon",aj);ya("text",uj);ya("path",mj);ya("line",bj);ya("ellipse",xj);var wj=function(r){kt(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.item=n.item,i.canvasX=n.canvasX,i.canvasY=n.canvasY,i.wheelDelta=n.wheelDelta,i.detail=n.detail,i}return e}(RT),K0=function(e){return"".concat(e,"-").concat(Math.random()).concat(Date.now())},Km=function(e){if(pt(e))switch(e.length){case 4:return e;case 3:return e.push(e[1]),e;case 2:return e.concat(e);case 1:return[e[0],e[0],e[0],e[0]];default:return[0,0,0,0]}if(ht(e))return[e,e,e,e];if(Pe(e)){var t=parseInt(e,10);return[t,t,t,t]}return[0,0,0,0]},Ej=function(e){var t=new wj(e.type,e);return t.clientX=e.clientX,t.clientY=e.clientY,t.x=e.x,t.y=e.y,t.target=e.target,t.currentTarget=e.currentTarget,t.bubbles=!0,t.item=e.item,t},_j=function(e){if(!e)return!1;for(var t=9,n=[1,0,0,0,1,0,0,0,1],i=0;i<t;i++)if(e[i]!==n[i])return!0;return!1},Ji=function(e){return Number.isNaN(Number(e))},EI=function(e){for(var t=1/0,n=-1/0,i=1/0,a=-1/0,o=0;o<e.length;o++){var s=e[o],u=s.getBBox(),f=u.minX,l=u.minY,c=u.maxX,h=u.maxY;f<t&&(t=f),l<i&&(i=l),c>n&&(n=c),h>a&&(a=h)}var d=Math.floor(t),v=Math.floor(i),p=Math.ceil(n)-Math.floor(t),g=Math.ceil(a)-Math.floor(i);return{x:d,y:v,width:p,height:g,minX:t,minY:i,maxX:n,maxY:a}},Sj=function(e,t,n,i,a){t===void 0&&(t=15),n===void 0&&(n="quadratic"),i===void 0&&(i=void 0),a===void 0&&(a=void 0);for(var o=e.length,s=t*2,u=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],f={},l=[],c={},h=0;h<o;h++){var d=e[h],v=d.source,p=d.target,g="".concat(v,"-").concat(p);if(!l[h]){f[g]||(f[g]=[]),l[h]=!0,f[g].push(d);for(var y=0;y<o;y++)if(h!==y){var m=e[y],b=m.source,x=m.target;l[y]||(v===x&&p===b?(f[g].push(m),l[y]=!0,c["".concat(b,"|").concat(x,"|").concat(f[g].length-1)]=!0):v===b&&p===x&&(f[g].push(m),l[y]=!0))}}}for(var w in f)for(var E=f[w],_=E.length,M=0;M<_;M++){var C=E[M];if(C.source===C.target){a&&(C.type=a),C.loopCfg={position:u[M%8],dist:Math.floor(M/8)*20+50};continue}if(_===1&&i&&C.source!==C.target){C.type=i;continue}C.type=n;var S=(M%2===0?1:-1)*(c["".concat(C.source,"|").concat(C.target,"|").concat(M)]?-1:1);_%2===1?C.curveOffset=S*Math.ceil(M/2)*s:C.curveOffset=S*(Math.floor(M/2)*s+t)}return e};const Mj=Object.freeze(Object.defineProperty({__proto__:null,calculationItemsBBox:EI,cloneEvent:Ej,formatPadding:Km,isNaN:Ji,isViewportChanged:_j,processParallelEdges:Sj,uniqueId:K0},Symbol.toStringTag,{value:"Module"}));var Oo={};const Cj=va(K6);Object.defineProperty(Oo,"__esModule",{value:!0});var Ao=Cj;function _I(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Ao.mat3.fromTranslation(n,t),Ao.mat3.multiply(r,n,e)}Oo.leftTranslate=_I;function SI(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Ao.mat3.fromRotation(n,t),Ao.mat3.multiply(r,n,e)}Oo.leftRotate=SI;function MI(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Ao.mat3.fromScaling(n,t),Ao.mat3.multiply(r,n,e)}Oo.leftScale=MI;function Aj(r,e,t){return Ao.mat3.multiply(r,t,e)}function Tj(r,e){for(var t=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=e.length;n<i;n++){var a=e[n];switch(a[0]){case"t":_I(t,t,[a[1],a[2]]);break;case"s":MI(t,t,[a[1],a[2]]);break;case"r":SI(t,t,a[1]);break;case"m":Aj(t,t,a[1]);break}}return t}var RE=Oo.transform=Tj;function CI(r,e){return r[0]*e[1]-e[0]*r[1]}Oo.direction=CI;function Ij(r,e,t){var n=Ao.vec2.angle(r,e),i=CI(r,e)>=0;return t?i?Math.PI*2-n:n:i?n:Math.PI*2-n}Oo.angleTo=Ij;function kj(r,e,t){return t?(r[0]=e[1],r[1]=-1*e[0]):(r[0]=-1*e[1],r[1]=e[0]),r}Oo.vertical=kj;var Lj=function(){function r(e){this.destroyed=!1,this.graph=e,this.destroyed=!1}return r.prototype.getViewCenter=function(){var e=this.getFormatPadding(),t=this.graph,n=this.graph.get("width"),i=t.get("height");return{x:(n-e[1]-e[3])/2+e[3],y:(i-e[0]-e[2])/2+e[0]}},r.prototype.fitCenter=function(e,t){var n=this.graph,i=n.get("group"),a,o=n.getNodes();if(o.length>n.get("optimizeThreshold")){var s=1/0,u=1/0,f=-1/0,l=-1/0;o.forEach(function(x){var w=x.getModel(),E=w.x,_=w.y;s>E&&(s=E),u>_&&(u=_),f<E&&(f=E),l<_&&(l=_)});var c=i.getMatrix()||[1,0,0,0,1,0,0,0,1],h=Su({x:s,y:u},c),d=h.x,v=h.y,p=Su({x:f,y:l},c),g=p.x,y=p.y;a={minX:d,maxX:g,minY:v,maxY:y,width:g-d,height:y-v,x:d,y:v}}else a=i.getCanvasBBox();if(!(a.width===0||a.height===0)){var m=this.getViewCenter(),b={x:a.x+a.width/2,y:a.y+a.height/2};n.translate(m.x-b.x,m.y-b.y,e,t)}},r.prototype.animatedFitView=function(e,t,n,i,a,o,s,u){var f=this.graph;n=n||{duration:500,easing:"easeCubic"};var l=[1,0,0,0,1,0,0,0,1],c=i.x+a.x-o.x-i.minX,h=i.y+a.y-o.y-i.minY;if(!(Ji(c)||Ji(h))){var d=RE(l,[["t",c,h]]);if(!u){var v=wl({animateCfg:n,callback:function(){f.emit("viewportchange",{action:"translate",matrix:d})}});e.animate(function(x){return{matrix:T0(t,d,x)}},v);return}var p=f.get("minZoom"),g=f.get("maxZoom"),y=s;p&&s<p?(y=p,console.warn("fitview failed, ratio out of range, ratio: %f",s,"graph minzoom has been used instead")):g&&s>g&&(y=g,console.warn("fitview failed, ratio out of range, ratio: %f",s,"graph maxzoom has been used instead"));var m=RE(d,[["t",-a.x,-a.y],["s",y,y],["t",a.x,a.y]]),b=wl({animateCfg:n,callback:function(){e.setMatrix(m),f.emit("viewportchange",{action:"translate",matrix:d}),f.emit("viewportchange",{action:"zoom",matrix:m})}});e.stopAnimate(),e.setMatrix(t),e.animate(function(x){return{matrix:T0(t,m,x)}},b)}},r.prototype.fitView=function(e,t){var n=this.graph,i=this.getFormatPadding(),a=n.get("width"),o=n.get("height"),s=n.get("group"),u=s.getMatrix()||[1,0,0,0,1,0,0,0,1];s.resetMatrix();var f,l=n.getNodes();if(l.length>n.get("optimizeThreshold")){var c=1/0,h=1/0,d=-1/0,v=-1/0;l.forEach(function(E){var _=E.getModel(),M=_.x,C=_.y;c>M&&(c=M),h>C&&(h=C),d<M&&(d=M),v<C&&(v=C)}),f={minX:c,maxX:d,minY:h,maxY:v,width:d-c,height:v-h,x:c,y:h}}else f=s.getCanvasBBox();if(!(f.width===0||f.height===0)){var p=this.getViewCenter(),g={x:f.x+f.width/2,y:f.y+f.height/2},y=(a-i[1]-i[3])/f.width,m=(o-i[0]-i[2])/f.height,b=y;if(y>m&&(b=m),e)this.animatedFitView(s,u,t,f,p,g,b,!0);else{var x=p.x-g.x,w=p.y-g.y;if(Ji(x)||Ji(w))return;n.translate(x,w),n.zoom(b,p)||console.warn("zoom failed, ratio out of range, ratio: %f",b)}}},r.prototype.fitViewByRules=function(e,t,n){var i=e.onlyOutOfViewPort,a=i===void 0?!1:i,o=e.direction,s=o===void 0?"both":o,u=e.ratioRule,f=u===void 0?"min":u,l=this.graph,c=this.getFormatPadding(),h=l.get("width"),d=l.get("height"),v=l.get("group"),p=v.getMatrix()||[1,0,0,0,1,0,0,0,1];v.resetMatrix();var g,y=l.getNodes();if(y.length>l.get("optimizeThreshold")){var m=1/0,b=1/0,x=-1/0,w=-1/0;y.forEach(function(O){var F=O.getModel(),D=F.x,$=F.y;m>D&&(m=D),b>$&&(b=$),x<D&&(x=D),w<$&&(w=$)}),g={minX:m,maxX:x,minY:b,maxY:w,width:x-m,height:w-b,x:m,y:b}}else g=v.getCanvasBBox();if(!(g.width===0||g.height===0)){var E=this.getViewCenter(),_={x:g.x+g.width/2,y:g.y+g.height/2},M=(h-c[1]-c[3])/g.width,C=(d-c[0]-c[2])/g.height,S;if(s==="x"?S=M:s==="y"?S=C:S=f==="max"?Math.max(M,C):Math.min(M,C),a&&(S=S<1?S:1),t)this.animatedFitView(v,p,n,g,E,_,S,!0);else{var A=l.getZoom(),T=A*S,k=l.get("minZoom");T<k&&(T=k,console.warn("fitview failed, ratio out of range, ratio: %f",S,"graph minzoom has been used instead")),l.translate(E.x-_.x,E.y-_.y),l.zoomTo(T,E)}}},r.prototype.getFormatPadding=function(){var e=this.graph.get("fitViewPadding");return Km(e)},r.prototype.focusPoint=function(e,t,n){var i=this,a=this.getViewCenter(),o=this.getPointByCanvas(a.x,a.y),s=this.graph.get("group").getMatrix();if(s||(s=[1,0,0,0,1,0,0,0,1]),t){var u=(o.x-e.x)*s[0],f=(o.y-e.y)*s[4],l=0,c=0,h=0,d=0;this.graph.get("canvas").animate(function(v){h=u*v,d=f*v,i.graph.translate(h-l,d-c),l=h,c=d},B({},n))}else this.graph.translate((o.x-e.x)*s[0],(o.y-e.y)*s[4])},r.prototype.getPointByCanvas=function(e,t){var n=this.graph.get("group").getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var i=yT({x:e,y:t},n);return i},r.prototype.getPointByClient=function(e,t){var n=this.graph.get("canvas"),i=n.getPointByClient(e,t);return this.getPointByCanvas(i.x,i.y)},r.prototype.getClientByPoint=function(e,t){var n=this.graph.get("canvas"),i=this.getCanvasByPoint(e,t),a=n.getClientByPoint(i.x,i.y);return{x:a.x,y:a.y}},r.prototype.getCanvasByPoint=function(e,t){var n=this.graph.get("group").getMatrix();return n||(n=[1,0,0,0,1,0,0,0,1]),Su({x:e,y:t},n)},r.prototype.focus=function(e,t,n){if(Pe(e)&&(e=this.graph.findById(e)),e){var i=0,a=0;if(e.getType&&e.getType()==="edge"){var o=e.getSource().get("group").getMatrix(),s=e.getTarget().get("group").getMatrix();o&&s?(i=(o[6]+s[6])/2,a=(o[7]+s[7])/2):(o||s)&&(i=o?o[6]:s[6],a=o?o[7]:s[7])}else{var u=e.get("group"),f=u.getMatrix();f||(f=[1,0,0,0,1,0,0,0,1]),i=f[6],a=f[7]}this.focusPoint({x:i,y:a},t,n)}},r.prototype.focusItems=function(e,t,n,i){if(e.length){var a=this.graph,o=this.getFormatPadding(),s=a.get("width"),u=a.get("height"),f=a.get("group"),l=f.getMatrix()||[1,0,0,0,1,0,0,0,1];f.resetMatrix();for(var c={x:0,y:0,minX:Number.MAX_SAFE_INTEGER,minY:Number.MAX_SAFE_INTEGER,maxX:Number.MIN_SAFE_INTEGER,maxY:Number.MIN_SAFE_INTEGER,width:0,height:0},h=0,d=e;h<d.length;h++){var v=d[h],p=v.getBBox();p.minX<c.minX&&(c.minX=p.minX),p.minY<c.minY&&(c.minY=p.minY),p.maxX>c.maxX&&(c.maxX=p.maxX),p.maxY>c.maxY&&(c.maxY=p.maxY)}if(c.x=c.minX,c.y=c.minY,c.width=c.maxX-c.minX,c.height=c.maxY-c.minY,!(c.width===0||c.height===0)){var g=this.getViewCenter(),y={x:c.x+c.width/2,y:c.y+c.height/2},m=(s-o[1]-o[3])/c.width,b=(u-o[0]-o[2])/c.height,x=m;m>b&&(x=b),n?this.animatedFitView(f,l,i,c,g,y,x,t):(a.translate(g.x-y.x,g.y-y.y),t&&!a.zoom(x,g)&&console.warn("zoom failed, ratio out of range, ratio: %f",x))}}},r.prototype.changeSize=function(e,t){var n=this.graph;if(!ht(e)||!ht(t))throw Error("invalid canvas width & height, please make sure width & height type is number");n.set({width:e,height:t});var i=n.get("canvas");i.changeSize(e,t);var a=n.get("plugins");a.forEach(function(o){o.get("gridContainer")&&o.positionInit()})},r.prototype.destroy=function(){this.graph=null,this.destroyed=!1},r}();function Q0(r){"@babel/helpers - typeof";return Q0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Q0(r)}function BE(r){if(typeof r!="string")return r;var e=function(_){if(typeof _!="string")return _;try{return JSON.parse(_.trim())}catch{return _.trim()}},t=e(r);if(typeof t!="string")return t;for(var n=function(_){return _[_.length-1]},i=r.trim(),a=[],o=[],s=function(){for(var _=[],M=0;M<arguments.length;M++)_[M]=arguments[M];return _.some(function(C){return n(o)===C})},u=function(){return n(a)},f=null,l=0,c="";l<i.length;){var h=i[l],d=s('"',"'");if(!d&&!h.trim()){l+=1;continue}var v=i[l-1]==="\\",p=s("}"),g=s("]"),y=s(","),m=u();if(d)if(n(o)===h&&!v){o.pop();var b=e(c);m.push(b),f=b,c=""}else c+=h;else if(g&&h===",")c&&(m.push(e(c)),c="");else if(p&&h===":")o.push(","),c&&(m.push(c),c="");else if(y&&h===",")c&&(m.push(e(c)),c=""),o.pop();else if(h==="}"&&(p||y)){c&&(m.push(e(c)),c=""),y&&o.pop();for(var x={},w=1;w<m.length;w+=2)x[m[w-1]]=m[w];a.pop(),a.length&&n(a).push(x),o.pop(),f=x}else h==="]"&&g?(c&&(m.push(e(c)),c=""),a.pop(),a.length&&n(a).push(m),o.pop(),f=m):h==="{"?(a.push([]),o.push("}")):h==="["?(a.push([]),o.push("]")):h==='"'?o.push('"'):h==="'"?o.push("'"):c+=h;l+=1}return f||c}var Nj=function(e){return e.split("-").reduce(function(t,n){return t+n.charAt(0).toUpperCase()+n.slice(1)})},Oj=function(e){return function(t){for(var n=e.length,i=[],a=0,o="";a<n;)if(e[a]==="{"&&e[a+1]==="{")i.push(o),o="",a+=2;else if(e[a]==="}"&&e[a+1]==="}"){if(i.length){var s=i.pop();o=Oa(t,o,s.endsWith("=")?'"{'.concat(o,'}"'):o),i.push(s+o)}a+=2,o=""}else o+=e[a],a+=1;return i.push(o),i.map(function(u,f){return i[f-1]&&i[f-1].endsWith("=")?'"{'.concat(u,'}"'):u}).join("")}};function AI(r,e){var t={},n=r.getAttributeNames&&r.getAttributeNames()||[],i=r.children&&Array.from(r.children).map(function(s){return AI(s,e)}),a={},o=r.tagName?r.tagName.toLowerCase():"group";return o==="text"&&(t.text=r.innerText),a.type=o,o==="img"&&(a.type="image"),Array.from(n).forEach(function(s){var u=Nj(s),f=r.getAttribute(s);try{if(u==="style"||u==="attrs"){var l=BE(f);t=B(B({},t),l)}else a[u]=BE(f)}catch(c){if(u==="style")throw c;a[u]=f}}),a.attrs=t,e&&e.style&&a.name&&Q0(e.style[a.name])==="object"&&(a.attrs=B(B({},a.attrs),e.style[a.name])),e&&e.style&&a.keyshape&&(a.attrs=B(B({},a.attrs),e.style)),i.length&&(a.children=i),a}function Dj(r,e,t){var n=r.attrs,i=n===void 0?{}:n,a={x:e.x||0,y:e.y||0,width:t.width||0,height:t.height||0},o,s;switch(r.type){case"maker":case"circle":i.r&&(s=2*i.r,o=2*i.r);break;case"text":i.text&&(s=IT(i.text,i.fontSize||12)[0],o=16,a.y+=o,a.height=o,a.width=s,r.attrs=B({fontSize:12,fill:"#000"},i));break;default:i.width&&(s=i.width),i.height&&(o=i.height)}return o>=0&&(a.height=o),s>=0&&(a.width=s),i.marginTop&&(a.y+=i.marginTop),i.marginLeft&&(a.x+=i.marginLeft),a}function TI(r,e){var t;e===void 0&&(e={x:0,y:0});var n=B({x:0,y:0,width:0,height:0},e);if(!((t=r.children)===null||t===void 0)&&t.length){var i=r.attrs,a=i===void 0?{}:i,o=a.marginTop,s=B({},e);o&&(s.y+=o);for(var u=0;u<r.children.length;u++){r.children[u].attrs.key="".concat(a.key||"root"," -").concat(u," ");var f=TI(r.children[u],s);if(f.bbox){var l=f.bbox;f.attrs.next==="inline"?s.x+=f.bbox.width:s.y+=f.bbox.height,l.width+l.x>n.width&&(n.width=l.width+l.x),l.height+l.y>n.height&&(n.height=l.height+l.y)}}}return r.bbox=Dj(r,e,n),r.attrs=B(B({},r.attrs),r.bbox),r}function II(r,e){var t,n,i,a,o=(r||{}).type,s=((e==null?void 0:e.attrs)||{}).key;if(s&&r&&(r.attrs.key=s),!r&&e)return{action:"delete",val:e,type:o,key:s};if(r&&!e)return{action:"add",val:r,type:o};if(!r&&!e)return{action:"same",type:o};var u=[];if(((t=r.children)===null||t===void 0?void 0:t.length)>0||((n=e.children)===null||n===void 0?void 0:n.length)>0)for(var f=Math.max((i=r.children)===null||i===void 0?void 0:i.length,(a=e.children)===null||a===void 0?void 0:a.length),l=e.children||[],c=r.children||[],h=0;h<f;h+=1)u.push(II(c[h],l[h]));var d=Object.keys(e.attrs),v=Object.keys(r.attrs);return e.type!==r.type?{action:"restructure",nowTarget:r,formerTarget:e,key:s,children:u}:d.filter(function(p){return p!=="children"}).some(function(p){return r.attrs[p]!==e.attrs[p]||!v.includes(p)})?{action:"change",val:r,children:u,type:o,key:s}:{action:"same",children:u,type:o,key:s}}function FE(r){var e={},t=function(i){var a=typeof r=="function"?r(i):r,o=Oj(a)(i),s=document.createElement("div");s.innerHTML=o;var u=s.children[0],f=TI(AI(u,i));return s.remove(),f};return{draw:function(i,a){var o=t(i),s=a,u=function f(l){var c=l.attrs,h=c===void 0?{}:c,d=l.bbox,v=l.type,p=l.children,g=nn(l,["attrs","bbox","type","children"]);if(l.type!=="group"){var y=a.addShape(l.type,B({attrs:h,origin:{bbox:d,type:v,children:p}},g));l.keyshape&&(s=y)}l.children&&l.children.forEach(function(m){return f(m)})};return u(o),e[i.id]=[o],s},update:function(i,a){e[i.id]||(e[i.id]=[]);var o=a.getContainer(),s=o.get("children"),u=t(i),f=e[i.id].pop(),l=II(u,f),c=function v(p){var g;p.type!=="group"&&o.addShape(p.type,{attrs:p.attrs}),!((g=p.children)===null||g===void 0)&&g.length&&p.children.map(function(y){return v(y)})},h=function v(p){var g,y=s.find(function(m){return m.attrs.key===p.attrs.key});y&&o.removeChild(y),!((g=p.children)===null||g===void 0)&&g.length&&p.children.map(function(m){return v(m)})},d=function v(p){var g=p.key;if(p.type!=="group"){var y=s.find(function(b){return b.attrs.key===g});switch(p.action){case"change":if(y){var m=p.val.keyshape?a.getOriginStyle():{};y.attr(B(B({},m),p.val.attrs))}break;case"add":c(p.val);break;case"delete":h(p.val);break;case"restructure":h(p.formerTarget),c(p.nowTarget);break}}p.children&&p.children.forEach(function(b){return v(b)})};d(l),e[i.id].push(u)},getAnchorPoints:function(){return[[0,.5],[1,.5],[.5,1],[.5,0]]}}}var xg={};function GE(r){return xg[r]||(xg[r]=Nu(r)),xg[r]}var Pj={defaultShapeType:"defaultType",className:null,getShape:function(e){var t=this,n=t[e]||t[t.defaultShapeType]||t["simple-circle"];return n},draw:function(e,t,n){var i=this.getShape(e);n.shapeMap={};var a=i.draw(t,n);return i.afterDraw&&i.afterDraw(t,n,a),a},baseUpdate:function(e,t,n,i){var a,o,s=this.getShape(e);s.update&&(s.mergeStyle=(a=s.getOptions)===null||a===void 0?void 0:a.call(s,t,i),(o=s.update)===null||o===void 0||o.call(s,t,n,i)),s.afterUpdate&&s.afterUpdate(t,n)},setState:function(e,t,n,i){var a=this.getShape(e);a.setState(t,n,i)},shouldUpdate:function(e){var t=this.getShape(e);return!!t.update},getControlPoints:function(e,t){var n=this.getShape(e);return n.getControlPoints(t)},getAnchorPoints:function(e,t){var n=this.getShape(e);return n.getAnchorPoints(t)}},wg={options:{},draw:function(e,t){return this.drawShape(e,t)},drawShape:function(){},afterDraw:function(){},afterUpdate:function(){},setState:function(){},getControlPoints:function(e){return e.controlPoints},getAnchorPoints:function(e){var t=this.options.anchorPoints,n=e.anchorPoints||t;return n}},mr=function(){function r(){}return r.registerFactory=function(e,t){var n=GE(e),i=Pj,a=B(B({},i),t);return r[n]=a,a.className=n,a},r.getFactory=function(e){var t=GE(e);return r[t]},r.registerNode=function(e,t,n){var i=r.Node,a;if(typeof t=="string"||typeof t=="function"){var o=FE(t);a=B(B({},i.getShape("single-node")),o)}else if(t.jsx){var s=t.jsx,o=FE(s);a=B(B(B({},i.getShape("single-node")),o),t)}else{i.getShape(n);var u=n?i.getShape(n):wg;a=B(B({},u),t)}return a.type=e,a.itemType="node",i[e]=a,a},r.registerEdge=function(e,t,n){var i=r.Edge,a=n?i.getShape(n):wg,o=B(B({},a),t);return o.type=e,o.itemType="edge",i[e]=o,o},r.registerCombo=function(e,t,n){var i=r.Combo,a=n?i.getShape(n):wg,o=B(B({},a),t);return o.type=e,o.itemType="combo",i[e]=o,o},r}();mr.registerFactory("node",{defaultShapeType:"circle"});mr.registerFactory("edge",{defaultShapeType:"line"});mr.registerFactory("combo",{defaultShapeType:"circle"});var Eg="bboxCache",_g="bboxCanvasCache",kI=function(){function r(e){this._cfg={},this.destroyed=!1,this.optimize=!1;var t={id:void 0,type:"item",model:{},group:void 0,animate:!1,visible:!0,locked:!1,event:!0,keyShape:void 0,states:[]};this._cfg=Object.assign(t,this.getDefaultCfg(),e);var n=this.get("model"),i=n.id,a=this.get("type");typeof i>"u"?i=K0(a):typeof i!="string"&&(i=String(i)),this.get("model").id=i,this.set("id",i);var o=e.group;o&&(o.set("item",this),o.set("id",i)),this.init(),this.draw();var s=n.shape||n.type||(a==="edge"?"line":"circle"),u=this.get("shapeFactory");if(u&&u[s]){var f=u[s].options;if(f&&f.stateStyles){var l=this.get("styles")||n.stateStyles;l=yr({},f.stateStyles,l),this.set("styles",l)}}}return r.prototype.calculateBBox=function(){var e=this.get("keyShape"),t=this.get("group"),n=Td(e,t);return n.x=n.minX,n.y=n.minY,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2,n},r.prototype.calculateCanvasBBox=function(){var e=this.get("keyShape"),t=this.get("group"),n=Td(e,t);return n.x=n.minX,n.y=n.minY,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2,n},r.prototype.drawInner=function(){var e=this,t=e.get("shapeFactory"),n=e.get("group"),i=e.get("model");n.clear();var a=i.visible;if(a!==void 0&&!a&&e.changeVisibility(a),!!t){e.updatePosition(i);var o=e.getShapeCfg(i),s=o.type,u=t.draw(s,o,n);u&&(e.set("keyShape",u),u.set("isKeyShape",!0),u.set("draggable",!0)),this.setOriginStyle(),this.set("currentShape",s),this.restoreStates(t,s)}},r.prototype.setOriginStyle=function(){var e=this.get("group"),t=e.get("children"),n=this.getKeyShape(),i=this,a=n.get("name");if(this.get("originStyle")){var d=this.get("originStyle");a&&!d[a]&&(d[a]={});for(var v=this.getCurrentStatesStyle(),p=function(y){var m=t[y],b=m.get("name"),x=m.attr();if(b&&b!==a){var w=v[b];d[b]||(d[b]={}),w?Object.keys(x).forEach(function(M){var C=x[M];C!==w[M]&&(d[b][M]=C)}):d[b]=m.get("type")!=="image"?Vt(x):i.getShapeStyleByName(b)}else{var E=m.attr(),_={};Object.keys(v).forEach(function(M){var C=v[M];(M===a||!pn(C))&&(_[M]=C)}),Object.keys(E).forEach(function(M){var C=E[M];_[M]!==C&&(a?d[a][M]=C:d[M]=C)})}},s=0;s<t.length;s++)p(s);delete d.path,delete d.matrix,delete d.x,delete d.y,d[a]&&(delete d[a].x,delete d[a].y,delete d[a].matrix,delete d[a].path),i.set("originStyle",d)}else{for(var o={},s=0;s<t.length;s++){var u=t[s],f=u.get("type"),l=u.get("name");if(l&&l!==a)o[l]=f!=="image"?Vt(u.attr()):i.getShapeStyleByName(l),f==="text"&&o[l]&&(delete o[l].x,delete o[l].y,delete o[l].matrix);else{var c=i.getShapeStyleByName();if(delete c.path,delete c.matrix,!a)Object.assign(o,c);else if(l)o[a]=c;else{var h=K0("shape");u.set("name",h),e.shapeMap[h]=u,o[h]=f!=="image"?Vt(u.attr()):i.getShapeStyleByName(l)}}}i.set("originStyle",o)}},r.prototype.restoreStates=function(e,t){var n=this,i=n.get("states");me(i,function(a){e.setState(t,a,!0,n)})},r.prototype.init=function(){var e=mr.getFactory(this.get("type"));this.set("shapeFactory",e)},r.prototype.get=function(e){return this._cfg[e]},r.prototype.set=function(e,t){pn(e)?this._cfg=B(B({},this._cfg),e):this._cfg[e]=t},r.prototype.getDefaultCfg=function(){return{}},r.prototype.clearCache=function(){this.set(Eg,null),this.set(_g,null)},r.prototype.beforeDraw=function(){},r.prototype.afterDraw=function(){},r.prototype.afterUpdate=function(){},r.prototype.draw=function(){this.beforeDraw(),this.drawInner(),this.afterDraw()},r.prototype.getShapeStyleByName=function(e){var t=this.get("group"),n;if(e?n=t.shapeMap[e]||t.find(function(a){return a.get("name")===e}):n=this.getKeyShape(),n){var i={};return me(n.attr(),function(a,o){(o!=="img"||Pe(a))&&(i[o]=a)}),i}return{}},r.prototype.getShapeCfg=function(e,t){var n=this.get("styles");if(n){var i=e;return i.style=B(B({},n),e.style),i}return e},r.prototype.getStateStyle=function(e){var t=this.get("styles"),n=t&&t[e];return n},r.prototype.getOriginStyle=function(){return this.get("originStyle")},r.prototype.getCurrentStatesStyle=function(){var e=this,t={},n=e.getStates();return!n||!n.length?this.get("originStyle"):(me(e.getStates(),function(i){t=Object.assign(t,e.getStateStyle(i))}),t)},r.prototype.setState=function(e,t){var n=this.get("states"),i=this.get("shapeFactory"),a=e,o=e;Pe(t)&&(a="".concat(e,":").concat(t),o="".concat(e,":"));var s=n;if($l(t)){var u=n.indexOf(o);if(t){if(u>-1)return;n.push(a)}else u>-1&&n.splice(u,1)}else if(Pe(t)){var f=n.filter(function(h){return h.includes(o)});f.length>0&&this.clearStates(f),s=s.filter(function(h){return!h.includes(o)}),s.push(a),this.set("states",s)}if(i){var l=this.get("model"),c=l.type;i.setState(c,e,t,this)}},r.prototype.clearStates=function(e){var t=this,n=t.getStates(),i=t.get("shapeFactory"),a=t.get("model"),o=a.type;e||(e=n),Pe(e)&&(e=[e]);var s=n.filter(function(u){return e.indexOf(u)===-1});t.set("states",s),e.forEach(function(u){i.setState(o,u,!1,t)})},r.prototype.setOptimize=function(e){this.optimize=e},r.prototype.getContainer=function(){return this.get("group")},r.prototype.getKeyShape=function(){return this.get("keyShape")},r.prototype.getModel=function(){return this.get("model")},r.prototype.getType=function(){return this.get("type")},r.prototype.getID=function(){return this.get("id")},r.prototype.isItem=function(){return!0},r.prototype.getStates=function(){return this.get("states")},r.prototype.hasState=function(e){var t=this.getStates();return t.indexOf(e)>=0},r.prototype.refresh=function(e){var t=this.get("model");this.updatePosition(t),this.updateShape(e),this.afterUpdate(),this.clearCache()},r.prototype.getUpdateType=function(e){},r.prototype.update=function(e,t){t===void 0&&(t=void 0);var n=this.get("model");if(t==="move")this.updatePosition(e);else{var i=n.visible,a=e.visible;i!==a&&a!==void 0&&this.changeVisibility(a);var o={x:n.x,y:n.y};e.x=isNaN(+e.x)?n.x:+e.x,e.y=isNaN(+e.y)?n.y:+e.y;var s=this.get("styles");if(e.stateStyles){var u=e.stateStyles;yt(s,u),delete e.stateStyles}Object.assign(n,e),(o.x!==e.x||o.y!==e.y)&&this.updatePosition(e),this.updateShape(t)}this.afterUpdate(),this.clearCache()},r.prototype.updateShape=function(e){var t=this.get("shapeFactory"),n=this.get("model"),i=n.type;if(t.shouldUpdate(i)&&i===this.get("currentShape")){var a=this.getShapeCfg(n,e);t.baseUpdate(i,a,this,e),e!=="move"&&this.setOriginStyle()}else this.draw();this.restoreStates(t,i)},r.prototype.updatePosition=function(e){var t=this.get("model"),n=isNaN(+e.x)?+t.x:+e.x,i=isNaN(+e.y)?+t.y:+e.y,a=this.get("group");if(isNaN(n)||isNaN(i))return!1;t.x=n,t.y=i;var o=a.getMatrix();return o&&o[6]===n&&o[7]===i?!1:(a.resetMatrix(),mT(a,{x:n,y:i}),this.clearCache(),!0)},r.prototype.getBBox=function(){var e=this.get(Eg);return e||(e=this.calculateBBox(),this.set(Eg,e)),e},r.prototype.getCanvasBBox=function(){var e=this.get(_g);return e||(e=this.calculateCanvasBBox(),this.set(_g,e)),e},r.prototype.toFront=function(){var e=this.get("group");e.toFront()},r.prototype.toBack=function(){var e=this.get("group");e.toBack()},r.prototype.show=function(){this.changeVisibility(!0)},r.prototype.hide=function(){this.changeVisibility(!1)},r.prototype.changeVisibility=function(e){var t=this.get("group");e?t.show():t.hide(),this.set("visible",e)},r.prototype.isVisible=function(){return this.get("visible")},r.prototype.enableCapture=function(e){var t=this.get("group");t&&t.set("capture",e)},r.prototype.destroy=function(){if(!this.destroyed){var e=this.get("animate"),t=this.get("group");e&&t.stopAnimate(),t.shapeMap={},this.clearCache(),t.remove(),this._cfg=null,this.destroyed=!0}},r}(),oh={source:"start",target:"end"},Xi="Node",tu="Point",Rj="Anchor",LI=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){return{type:"edge",sourceNode:null,targetNode:null,startPoint:null,endPoint:null,linkCenter:!1}},e.prototype.setEnd=function(t,n){var i=oh[t]+tu,a=t+Xi,o=this.get(a);o&&!o.destroyed&&o.removeEdge(this),pn(n)?(this.set(i,n),this.set(a,null)):n&&(n.addEdge(this),this.set(a,n),this.set(i,null))},e.prototype.getLinkPoint=function(t,n,i){var a=oh[t]+tu,o=t+Xi,s=this.get(a);if(!s){var u=this.get(o),f=t+Rj,l=this.getPrePoint(t,i),c=n[f];ct(c)||(s=u.getLinkPointByAnchor(c)),s=s||u.getLinkPoint(l),ct(s.index)||this.set("".concat(t,"AnchorIndex"),s.index)}return s},e.prototype.getPrePoint=function(t,n){if(n&&n.length){var i=t==="source"?0:n.length-1;return n[i]}var a=t==="source"?"target":"source";return this.getEndPoint(a)},e.prototype.getEndPoint=function(t){var n=t+Xi,i=oh[t]+tu,a=this.get(n);return a&&!a.destroyed?a.get("model"):this.get(i)},e.prototype.getControlPointsByCenter=function(t){var n=this.getEndPoint("source"),i=this.getEndPoint("target"),a=this.get("shapeFactory"),o=t.type;return a.getControlPoints(o,{startPoint:n,endPoint:i})},e.prototype.getEndCenter=function(t){var n=t+Xi,i=oh[t]+tu,a=this.get(n);if(a){var o=a.getBBox();return{x:o.centerX,y:o.centerY}}return this.get(i)},e.prototype.init=function(){r.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},e.prototype.getShapeCfg=function(t,n){var i=this,a=i.get("linkCenter"),o=n!=null&&n.includes("move")?t:r.prototype.getShapeCfg.call(this,t);if(a)o.startPoint=i.getEndCenter("source"),o.endPoint=i.getEndCenter("target");else{var s=o.controlPoints||i.getControlPointsByCenter(o);o.startPoint=i.getLinkPoint("source",t,s),o.endPoint=i.getLinkPoint("target",t,s)}return o.sourceNode=i.get("sourceNode"),o.targetNode=i.get("targetNode"),o},e.prototype.getModel=function(){var t=this.get("model"),n=this.get("source".concat(Xi)),i=this.get("target".concat(Xi));return n?delete t["source".concat(Xi)]:t.source=this.get("start".concat(tu)),i?delete t["target".concat(Xi)]:t.target=this.get("end".concat(tu)),!Pe(t.source)&&!pn(t.source)&&(t.source=t.source.getID()),!Pe(t.target)&&!pn(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,n){n===void 0&&(n=void 0);var i=this.get("model"),a=i.visible,o=t.visible;a!==o&&o!==void 0&&this.changeVisibility(o);var s=this.get("source"),u=this.get("target");if(!(!s||s.destroyed||!u||u.destroyed)){var f=this.get("styles");if(t.stateStyles){var l=t.stateStyles;yt(f,l),delete t.stateStyles}Object.assign(i,t),this.updateShape(n),this.afterUpdate(),this.clearCache()}},e.prototype.destroy=function(){var t=this.get("source".concat(Xi)),n=this.get("target".concat(Xi));t&&!t.destroyed&&t.removeEdge(this),n&&!n.destroyed&&n.removeEdge(this),r.prototype.destroy.call(this)},e}(kI),Sg="anchorPointsCache",Bj="bboxCache",Qm=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getNearestPoint=function(t,n){for(var i=0,a=t[0],o=Cd(t[0],n),s=0;s<t.length;s++){var u=t[s],f=Cd(u,n);f<o&&(a=u,o=f,i=s)}return a.anchorIndex=i,a},e.prototype.getDefaultCfg=function(){return{type:"node",edges:[]}},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getInEdges=function(){var t=this;return this.get("edges").filter(function(n){return n.get("target")===t})},e.prototype.getOutEdges=function(){var t=this;return this.get("edges").filter(function(n){return n.get("source")===t})},e.prototype.getNeighbors=function(t){var n=this,i=this.get("edges");if(t==="target"){var a=function(f){return f.getSource()===n};return i.filter(a).map(function(u){return u.getTarget()})}if(t==="source"){var o=function(f){return f.getTarget()===n};return i.filter(o).map(function(u){return u.getSource()})}var s=function(f){return f.getSource()===n?f.getTarget():f.getSource()};return i.map(s)},e.prototype.getLinkPointByAnchor=function(t){var n=this.getAnchorPoints();return n[t]},e.prototype.getLinkPoint=function(t){var n=this.get("keyShape"),i=n.get("type"),a=this.get("type"),o,s,u=this.getBBox();a==="combo"?(o=u.centerX||(u.maxX+u.minX)/2,s=u.centerY||(u.maxY+u.minY)/2):(o=u.centerX,s=u.centerY);var f=this.getAnchorPoints(),l;switch(i){case"circle":l=pT({x:o,y:s,r:u.width/2},t);break;case"ellipse":l=gT({x:o,y:s,rx:u.width/2,ry:u.height/2},t);break;default:l=vT(u,t)}var c=l;return f.length&&(c||(c=t),c=this.getNearestPoint(f,c)),c||(c={x:o,y:s}),c},e.prototype.getAnchorPoints=function(){var t=this.get(Sg);if(!t){t=[];var n=this.get("shapeFactory"),i=this.getBBox(),a=this.get("model"),o=this.getShapeCfg(a),s=a.type,u=n.getAnchorPoints(s,o)||[];me(u,function(f,l){var c={x:i.minX+f[0]*i.width,y:i.minY+f[1]*i.height,anchorIndex:l};t.push(c)}),this.set(Sg,t)}return t},e.prototype.addEdge=function(t){this.get("edges").push(t)},e.prototype.lock=function(){this.set("locked",!0)},e.prototype.unlock=function(){this.set("locked",!1)},e.prototype.hasLocked=function(){return this.get("locked")},e.prototype.removeEdge=function(t){var n=this.getEdges(),i=n.indexOf(t);i>-1&&n.splice(i,1)},e.prototype.clearCache=function(){this.set(Bj,null),this.set(Sg,null)},e.prototype.getUpdateType=function(t){var n,i,a,o,s;if(t){var u=!ct(t.x),f=!ct(t.y),l=Object.keys(t);if(l.length===1&&(u||f)||l.length===2&&u&&f)return"move";if(ht(t.x)||ht(t.y)||t.type||t.anchorPoints||t.size||t!=null&&t.style&&(!((n=t==null?void 0:t.style)===null||n===void 0)&&n.r||!((i=t==null?void 0:t.style)===null||i===void 0)&&i.width||!((a=t==null?void 0:t.style)===null||a===void 0)&&a.height||!((o=t==null?void 0:t.style)===null||o===void 0)&&o.rx||!((s=t==null?void 0:t.style)===null||s===void 0)&&s.ry))return"bbox|label";var c=l.includes("label")||l.includes("labelCfg");return c?"style|label":"style"}},e.prototype.setState=function(t,n){var i=this;if(this.optimize){r.prototype.setState.call(this,t,n);return}this.runWithBBoxAffected(function(){return r.prototype.setState.call(i,t,n)})},e.prototype.clearStates=function(t){var n=this;if(this.optimize){r.prototype.clearStates.call(this,t);return}this.runWithBBoxAffected(function(){return r.prototype.clearStates.call(n,t)})},e.prototype.runWithBBoxAffected=function(t){var n=["r","width","height","rx","ry","lineWidth"],i=this.getKeyShape().attr(),a={};Object.keys(this.getKeyShape().attr()).forEach(function(f){n.includes(f)&&(a[f]=i[f])}),t();for(var o=this.getKeyShape().attr(),s=0;s<n.length;s++){var u=n[s];if(o[u]!==a[u]){this.clearCache(),this.getEdges().forEach(function(f){return f.refresh()});break}}},e}(kI),zE="bboxCache",$E="bboxCanvasCache",sh="sizeCache",jE="anchorPointsCache",NI=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){return{type:"combo",nodes:[],edges:[],combos:[]}},e.prototype.getShapeCfg=function(t){var n=this.get("styles"),i=this.get("bbox");if(n&&i){var a=t,o=ht(t.size)?[t.size,t.size]:t.size,s=ht(t.fixSize)?[t.fixSize,t.fixSize]:t.fixSize,u=o||s||lt.defaultCombo.size,f={r:(Math.max(i.width,i.height)||Math.max(u[0],u[1]))/2,width:i.width||u[0],height:i.height||u[1]};a.style=B(B(B({},n),t.style),f);var l=t.padding||lt.defaultCombo.padding;return ht(l)?(f.r+=l,f.width+=l*2,f.height+=l*2):(f.r=f.r+Math.max.apply(Math,l),f.width+=l[1]+l[3]||l[1]*2,f.height+=l[0]+l[2]||l[0]*2),this.set(sh,f),a}return t},e.prototype.calculateCanvasBBox=function(){if(!this.destroyed){var t=this.get("keyShape"),n=this.get("group"),i=this.get(zE)||{},a=i.x,o=i.x,s=this.get(sh),u=Td(t,n);if(u.centerX=(u.minX+u.maxX)/2,u.centerY=(u.minY+u.maxY)/2,s){s.width=Math.max(s.width,u.width),s.height=Math.max(s.height,u.height),this.set(sh,s);var f=t.get("type");f==="circle"?(u.width=s.r*2,u.height=s.r*2):(u.width=s.width,u.height=s.height),u.minX=u.centerX-u.width/2,u.minY=u.centerY-u.height/2,u.maxX=u.centerX+u.width/2,u.maxY=u.centerY+u.height/2}else u.width=u.maxX-u.minX,u.height=u.maxY-u.minY,u.centerX=(u.minX+u.maxX)/2,u.centerY=(u.minY+u.maxY)/2;return u.x=u.minX,u.y=u.minY,(u.x!==a||u.y!==o)&&this.set(jE,null),u}},e.prototype.getChildren=function(){var t=this;return{nodes:t.getNodes(),combos:t.getCombos()}},e.prototype.getNodes=function(){var t=this;return t.get("nodes")},e.prototype.getCombos=function(){var t=this;return t.get("combos")},e.prototype.addChild=function(t){var n=this,i=t.getType();switch(i){case"node":n.addNode(t);break;case"combo":n.addCombo(t);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},e.prototype.addCombo=function(t){var n=this;return n.get("combos").push(t),!0},e.prototype.addNode=function(t){var n=this;return n.get("nodes").push(t),!0},e.prototype.removeChild=function(t){var n=this,i=t.getType();switch(i){case"node":n.removeNode(t);break;case"combo":n.removeCombo(t);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},e.prototype.removeCombo=function(t){if(t){var n=this.getCombos(),i=n.indexOf(t);return i>-1?(n.splice(i,1),!0):!1}},e.prototype.removeNode=function(t){if(t){var n=this.getNodes(),i=n.indexOf(t);return i>-1?(n.splice(i,1),!0):!1}},e.prototype.getUpdateType=function(t){},e.prototype.getBBox=function(){this.set($E,null);var t=this.calculateCanvasBBox();return t},e.prototype.clearCache=function(){this.set(zE,null),this.set($E,null),this.set(jE,null)},e.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),n=this.get("group");t&&n.stopAnimate(),n.shapeMap={},this.clearCache(),this.set(sh,null),this.set("bbox",null),n.remove(),this._cfg=null,this.destroyed=!0}},e}(Qm),uh="node",fh="edge",UE="vedge",Af="combo",Fj="default",XE="Mapper",Ca="stateStyles",Gj=function(){function r(e){var t=this;this.edgeToBeUpdateMap={},this.throttleRefresh=yl(function(n){var i=t.graph;if(!(!i||i.get("destroyed"))){var a=t.edgeToBeUpdateMap;if(a){var o=Object.values(a);o.length&&(o.forEach(function(s){var u=s.edge;if(!(!u||u.destroyed)){var f=u.getSource(),l=u.getTarget();!f||f.destroyed||!l||l.destroyed||u.refresh(s.updateType)}}),t.edgeToBeUpdateMap={})}}},16,{trailing:!0,leading:!0}),this.graph=e,this.destroyed=!1}return r.prototype.addItem=function(e,t){var n=this.graph,i=e===UE?fh:e,a=n.get("".concat(i,"Group"))||n.get("group"),o=Nu(i),s=null,u=n.get(i+Nu(Ca))||{},f=n.get(Fj+o);t[Ca]&&(u=t[Ca]),f&&me(f,function(E,_){yn(E)&&!pt(E)?t[_]=yr({},E,t[_]):pt(E)?t[_]=t[_]||Vt(f[_]):t[_]=t[_]||f[_]});var l=n.get(i+XE);if(l){var c=l(t);c[Ca]&&(u=c[Ca],delete c[Ca]),me(c,function(E,_){yn(E)&&!pt(E)?t[_]=yr({},t[_],E):t[_]=c[_]||t[_]})}if(n.emit("beforeadditem",{type:e,model:t}),e===fh||e===UE){var h=void 0,d=void 0;if(h=t.source,d=t.target,h&&Pe(h)&&(h=n.findById(h)),d&&Pe(d)&&(d=n.findById(d)),!h||!d){console.warn("The source or target node of edge ".concat(t.id," does not exist!"));return}h.getType&&h.getType()==="combo"&&(t.isComboEdge=!0),d.getType&&d.getType()==="combo"&&(t.isComboEdge=!0),s=new LI({model:t,source:h,target:d,styles:u,linkCenter:n.get("linkCenter"),group:a.addGroup()})}else if(e===uh)s=new Qm({model:t,styles:u,group:a.addGroup()});else if(e===Af){var v=t.children,p=ed(v,n),g=void 0,y=void 0;if(isNaN(p.x)?isNaN(t.x)&&(g=Math.random()*100):g=p.x,isNaN(p.y)?isNaN(t.y)&&(y=Math.random()*100):y=p.y,isNaN(t.x)||isNaN(t.y))t.x=g,t.y=y;else{var m=t.x-g,b=t.y-y;this.updateComboSucceeds(t.id,m,b,v)}var x=a.addGroup();x.setZIndex(t.depth),s=new NI({model:t,styles:u,animate:n.get("animate"),bbox:t.collapsed?ed([],n):p,group:x}),!t.collapsed&&s.getKeyShape().get("type")==="circle"&&(p.width=Math.hypot(p.height,p.width),p.height=p.width,s.set("bbox",p),s.refresh());var w=s.getModel();(v||[]).forEach(function(E){var _=n.findById(E.id);s.addChild(_),E.depth=w.depth+2})}if(s)return s.setOptimize(n.getNodes().length>n.get("optimizeThreshold")),n.get("".concat(e,"s")).push(s),n.get("itemMap")[s.get("id")]=s,n.emit("afteradditem",{item:s,model:t}),s},r.prototype.updateItem=function(e,t){var n=this,i,a,o=this.graph;if(Pe(e)&&(e=o.findById(e)),!(!e||e.destroyed)){var s="";e.getType&&(s=e.getType());var u=o.get(s+XE),f=e.getModel(),l=f.x,c=f.y,h=e.getUpdateType(t);if(u){var d=yr({},f,t),v=u(d),p=yr({},f,v,t);v[Ca]&&(e.set("styles",p[Ca]),delete p[Ca]),me(p,function(S,A){t[A]=S})}else me(t,function(S,A){f[A]&&yn(S)&&!pt(S)&&(t[A]=B(B({},f[A]),t[A]))});if(o.emit("beforeupdateitem",{item:e,cfg:t}),s===fh){if(t.source){var g=t.source;Pe(g)&&(g=o.findById(g)),e.setSource(g)}if(t.target){var y=t.target;Pe(y)&&(y=o.findById(y)),e.setTarget(y)}e.update(t)}else if(s===uh){e.update(t,h);var m=e.getEdges();h==="move"?me(m,function(S){n.edgeToBeUpdateMap[S.getID()]={edge:S,updateType:h},n.throttleRefresh()}):h!=null&&h.includes("bbox")&&me(m,function(S){S.refresh(h)})}else if(s===Af){if(e.update(t,h),!isNaN(t.x)||!isNaN(t.y)){var b=t.x-l||0,x=t.y-c||0;this.updateComboSucceeds(f.id,b,x)}var w=e.getEdges(),E=(h==null?void 0:h.includes("bbox"))||h==="move";if(E&&s===Af){var _=e.get("shapeFactory"),M=f.type||"circle",C=f.animate===void 0||t.animate===void 0?(a=(i=_[M])===null||i===void 0?void 0:i.options)===null||a===void 0?void 0:a.animate:f.animate||t.animate;C?setTimeout(function(){if(!(!e||e.destroyed)){var S=e.getKeyShape();!S||S.destroyed||me(w,function(A){A&&!A.destroyed&&A.refresh()})}},201):me(w,function(S){S.refresh()})}}e.setOptimize(o.getNodes().length>o.get("optimizeThreshold")),o.emit("afterupdateitem",{item:e,cfg:t})}},r.prototype.updateCombo=function(e,t,n){var i=this,a,o,s=this.graph;if(Pe(e)&&(e=s.findById(e)),!(!e||e.destroyed)){var u=e.getModel(),f=ed(t,s,e),l=f.x,c=f.y;e.set("bbox",f);var h=l,d=c;n?(h=isNaN(u.x)?l:u.x,d=isNaN(u.y)?c:u.y):(h=isNaN(l)?u.x:l,d=isNaN(c)?u.y:c),e.update({x:h,y:d});var v=e.get("shapeFactory"),p=u.type||"circle",g=u.animate===void 0?(o=(a=v[p])===null||a===void 0?void 0:a.options)===null||o===void 0?void 0:o.animate:u.animate;g?setTimeout(function(){if(!(!e||e.destroyed)){var y=e.getKeyShape();!y||y.destroyed||(e.getShapeCfg(u),i.updateComboEdges(e))}},201):this.updateComboEdges(e)}},r.prototype.updateComboEdges=function(e){for(var t,n,i=e.getEdges()||[],a=0;a<i.length;a++){var o=i[a];!(o!=null&&o.destroyed)&&!(!((t=o==null?void 0:o.getSource())===null||t===void 0)&&t.destroyed)&&!(!((n=o==null?void 0:o.getTarget())===null||n===void 0)&&n.destroyed)&&o.refresh()}},r.prototype.collapseCombo=function(e,t){t===void 0&&(t=!0);var n=this.graph;Pe(e)&&(e=n.findById(e));var i=e.getChildren();i.nodes.forEach(function(a){n.hideItem(a,t)}),i.combos.forEach(function(a){n.hideItem(a,t)})},r.prototype.updateComboSucceeds=function(e,t,n,i){var a=this;i===void 0&&(i=[]);var o=this.graph;if(!(!t&&!n)){var s=i;if(!(s!=null&&s.length)){var u=o.get("comboTrees");u==null||u.forEach(function(f){Cn(f,function(l){return l.id===e?(s=l.children,!1):!0})})}s==null||s.forEach(function(f){var l=o.findById(f.id);if(l){var c=l.getModel();a.updateItem(f.id,{x:(c.x||0)+t,y:(c.y||0)+n})}})}},r.prototype.expandCombo=function(e,t){t===void 0&&(t=!0);var n=this.graph;Pe(e)&&(e=n.findById(e));var i=e.getChildren(),a=new Set;i.nodes.forEach(function(o){n.showItem(o,t),o.getEdges().forEach(function(s){return a.add(s)})}),i.combos.forEach(function(o){o.getModel().collapsed?o.show():n.showItem(o,t),o.getEdges().forEach(function(s){return a.add(s)})}),a.forEach(function(o){return o.refresh()})},r.prototype.removeItem=function(e){var t=this,n=this.graph;if(Pe(e)&&(e=n.findById(e)),!(!e||e.destroyed)){var i=Vt(e.getModel()),a="";e.getType&&(a=e.getType()),n.emit("beforeremoveitem",{item:i,type:a});var o=n.get("".concat(a,"s")),s=o.indexOf(e);if(s>-1&&o.splice(s,1),a===fh){var u=n.get("v".concat(a,"s")),f=u.indexOf(e);f>-1&&u.splice(f,1)}var l=e.get("id"),c=n.get("itemMap");delete c[l];var h=n.get("comboTrees"),d=e.get("id");if(a===uh){var v=e.getModel().comboId;if(h&&v){var p=h,g=!1;h.forEach(function(E){g||Cn(E,function(_){if(_.id===d&&p){var M=p.indexOf(_);return p.splice(M,1),g=!0,!1}return p=_.children,!0})})}for(var y=e.getEdges(),m=y.length-1;m>=0;m--)n.removeItem(y[m],!1);v&&n.updateCombo(v)}else if(a===Af){var b=e.getModel().parentId,x,w=!1;(h||[]).forEach(function(_){w||Cn(_,function(M){return M.id===d?(x=M,w=!0,!1):!0})}),x.removed=!0,x&&x.children&&x.children.forEach(function(_){t.removeItem(_.id)});for(var y=e.getEdges(),m=y.length;m>=0;m--)n.removeItem(y[m],!1);b&&n.updateCombo(b)}e.destroy(),n.emit("afterremoveitem",{item:i,type:a})}},r.prototype.setItemState=function(e,t,n){var i=this.graph,a=t;Pe(n)&&(a="".concat(t,":").concat(n)),!(e.hasState(a)===n&&n||Pe(n)&&e.hasState(a))&&(i.emit("beforeitemstatechange",{item:e,state:a,enabled:n}),e.setState(t,n),i.autoPaint(),i.emit("afteritemstatechange",{item:e,state:a,enabled:n}))},r.prototype.priorityState=function(e,t){var n=this.graph,i=e;Pe(e)&&(i=n.findById(e)),this.setItemState(i,t,!1),this.setItemState(i,t,!0)},r.prototype.clearItemStates=function(e,t){var n=this.graph;Pe(e)&&(e=n.findById(e)),n.emit("beforeitemstatesclear",{item:e,states:t}),e.clearStates(t),n.emit("afteritemstatesclear",{item:e,states:t})},r.prototype.refreshItem=function(e){var t=this.graph;Pe(e)&&(e=t.findById(e)),t.emit("beforeitemrefresh",{item:e}),e.refresh(),t.emit("afteritemrefresh",{item:e})},r.prototype.addCombos=function(e,t){var n=this,i=this.graph;(e||[]).forEach(function(o){Ki(o,function(s){var u;return t.forEach(function(f){f.id===s.id&&(f.children=s.children,f.depth=s.depth,u=f)}),u&&n.addItem("combo",u),!0})});var a=i.get("comboGroup");a&&a.sort()},r.prototype.changeItemVisibility=function(e,t){var n=this,i=this.graph;if(Pe(e)&&(e=i.findById(e)),!e){console.warn("The item to be shown or hidden does not exist!");return}if(i.emit("beforeitemvisibilitychange",{item:e,visible:t}),e.changeVisibility(t),e.getType&&e.getType()===uh){var a=e.getEdges();me(a,function(l){t&&!(l.get("source").isVisible()&&l.get("target").isVisible())||n.changeItemVisibility(l,t)})}else if(e.getType&&e.getType()===Af){var o=i.get("comboTrees"),s=e.get("id"),u=[],f=!1;(o||[]).forEach(function(c){f||!c.children||c.children.length===0||Cn(c,function(h){return h.id===s?(u=h.children,f=!0,!1):!0})}),u&&(!t||t&&!e.getModel().collapsed)&&u.forEach(function(c){var h=i.findById(c.id);n.changeItemVisibility(h,t)});var a=e.getEdges();me(a,function(c){t&&!(c.get("source").isVisible()&&c.get("target").isVisible())||n.changeItemVisibility(c,t)})}return i.emit("afteritemvisibilitychange",{item:e,visible:t}),e},r.prototype.destroy=function(){this.graph=null,this.destroyed=!0},r}(),zj=function(){function r(e){this.graph=e,this.destroyed=!1}return r.prototype.updateState=function(e,t,n){var i=this.graph.get("states"),a=t;Pe(n)&&(a="".concat(t,":").concat(n)),i[a]||(i[a]=[]),n?i[a].push(e):i[a]=i[a].filter(function(o){return o!==e}),this.graph.set("states",i),this.graph.emit("graphstatechange",{states:i})},r.prototype.updateStates=function(e,t,n){var i=this.graph.get("states"),a=Pe(t)?[t]:t;a.forEach(function(o){var s=o;i[s]||(i[s]=[]),Pe(n)&&(s="".concat(o,":").concat(n)),n?i[s].push(e):i[s]=i[s].filter(function(u){return u!==e})}),this.graph.set("states",i),this.graph.emit("graphstatechange",{states:t})},r.prototype.destroy=function(){this.graph=null,this.destroyed=!0},r}(),$j=function(e,t){return!e||!t?e:e.replace(/\\?\{([^{}]+)\}/g,function(n,i){if(n.charAt(0)==="\\")return n.slice(1);var a=t[i];return a===0&&(a="0"),a||""})},OI=function(e){var t=[];if(e.length<2)throw new Error("point length must largn than 2, now it's ".concat(e.length));for(var n=0,i=e;n<i.length;n++){var a=i[n],o=a.x,s=a.y;t.push(o),t.push(s)}var u=bI(t);return u.unshift(["M",e[0].x,e[0].y]),u},Dd=function(e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=0);var a={x:(1-n)*e.x+n*t.x,y:(1-n)*e.y+n*t.y},o=[0,0];_o(o,[t.x-e.x,t.y-e.y]),(!o||!o[0]&&!o[1])&&(o=[0,0]);var s=[-o[1]*i,o[0]*i];return a.x+=s[0],a.y+=s[1],a},jj=function(e,t){var n=e.length;if(!n)return"";for(var i="",a="",o=0;o<n;o++){var s=e[o];o===0?a="M{x} {y}":a="L{x} {y}",i+=$j(a,s)}return t&&(i+="Z"),i},J0=function(e){var t=[];return e.forEach(function(n){var i=n[0];if(i!=="A")for(var a=1;a<n.length;a=a+2)t.push([n[a],n[a+1]]);else{var o=n.length;t.push([n[o-2],n[o-1]])}}),t},ey=function(e){if(e.length<2)throw new Error("point length must larger than 2, now it's ".concat(e.length));var t=e[0],n=e[1],i=e[e.length-1],a=e[e.length-2];e.unshift(i),e.unshift(a),e.push(t),e.push(n);for(var o=[],s=1;s<e.length-2;s+=1){var u=e[s-1].x,f=e[s-1].y,l=e[s].x,c=e[s].y,h=e[s+1].x,d=e[s+1].y,v=s!==e.length-2?e[s+2].x:h,p=s!==e.length-2?e[s+2].y:d,g=l+(h-u)/6,y=c+(d-f)/6,m=h-(v-l)/6,b=d-(p-c)/6;o.push(["C",g,y,m,b,h,d])}return o.unshift(["M",i.x,i.y]),o},YE=function(e,t){return An([0,0],_o([0,0],e),t)},WE=function(e,t){var n=[e[1]-t[1],t[0]-e[0]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]);if(i===0)throw new Error("p0 should not be equal to p1");return[n[0]/i,n[1]/i]},VE=function(e,t){return[t[0]-e[0],t[1]-e[1]]};function ty(r,e){var t=function(c){var h=[c[0][0],c[0][1]-e],d=[c[0][0],c[0][1]+e];return"M ".concat(h," A ").concat(e,",").concat(e,",0,0,0,").concat(d," A ").concat(e,",").concat(e,",0,0,0,").concat(h)},n=function(c){var h=An([0,0],WE(c[0],c[1]),e),d=An([0,0],h,-1),v=vn([0,0],c[0],h),p=vn([0,0],c[1],h),g=vn([0,0],c[1],d),y=vn([0,0],c[0],d);return"M ".concat(v," L ").concat(p," A ").concat([e,e,"0,0,0",g].join(",")," L ").concat(y," A ").concat([e,e,"0,0,0",v].join(","))};if(!r||r.length<1)return"";if(r.length===1)return t(r);if(r.length===2)return n(r);for(var i=new Array(r.length),a=0;a<i.length;++a){var o=a===0?r[r.length-1]:r[a-1],s=r[a],u=An([0,0],WE(o,s),e);i[a]=[vn([0,0],o,u),vn([0,0],s,u)]}var f="A ".concat([e,e,"0,0,0,"].join(","));return i=i.map(function(l,c){var h="";return c===0&&(h="M ".concat(i[i.length-1][1]," ")),h+="".concat(f+l[0]," L ").concat(l[1]),h}),i.join(" ")}function DI(r,e){var t=r.length,n=function(l){var c=[l[0][0],l[0][1]-e],h=[l[0][0],l[0][1]+e];return"M ".concat(c," A ").concat([e,e,"0,0,0",h].join(",")," A ").concat([e,e,"0,0,0",c].join(","))},i=function(l){var c=VE(l[0],l[1]),h=YE(c,e),d=vn([0,0],l[0],An([0,0],h,-1)),v=vn([0,0],l[1],h),p=1.2*e,g=YE(_o([0,0],c),p),y=An([0,0],g,-1),m=vn([0,0],d,y),b=vn([0,0],v,y),x=vn([0,0],d,g);return"M ".concat(d," C ").concat([m,b,v].join(",")," S ").concat([x,d].join(",")," Z")};if(!r||t<1)return"";if(t===1)return n(r);if(t===2)return i(r);for(var a=r.map(function(f,l){var c=r[(l+1)%t];return{p:f,v:_o([0,0],VE(f,c))}}),o=0;o<a.length;++o){var s=o>0?o-1:t-1,u=_o([0,0],vn([0,0],a[s].v,An([0,0],a[o].v,-1)));a[o].p=vn([0,0],a[o].p,An([0,0],u,e))}return a.map(function(f){var l=f.p;return{x:l[0],y:l[1]}})}var Uj=function(e,t){for(var n=[],i=0;i<5;i++){var a=Math.cos((18+72*i)/180*Math.PI)*e,o=Math.sin((18+72*i)/180*Math.PI)*e,s=Math.cos((54+72*i)/180*Math.PI)*t,u=Math.sin((54+72*i)/180*Math.PI)*t;i===0?n.push(["M",a,-o]):n.push(["L",a,-o]),n.push(["L",s,-u])}return n.push(["Z"]),n};const Xj=Object.freeze(Object.defineProperty({__proto__:null,getClosedSpline:ey,getControlPoint:Dd,getSpline:OI,getStarPath:Uj,paddedHull:DI,pathToPoints:J0,pointsToPolygon:jj,roundedHull:ty},Symbol.toStringTag,{value:"Module"}));var HE=function(e,t,n){return(e.y-n.y)*(t.x-n.x)-(e.x-n.x)*(t.y-n.y)},qE=function(e){var t=e.map(function(c){return{x:c.getModel().x,y:c.getModel().y}});t.sort(function(c,h){return c.x===h.x?c.y-h.y:c.x-h.x});for(var n={},i=t.length-1;i>=0;i--){var a=t[i],o=a.x,s=a.y;n["".concat(o,"-").concat(s)]&&t.splice(i,1),n["".concat(o,"-").concat(s)]=!0}if(t.length===1)return t;for(var u=[],i=0;i<t.length;i++){for(;u.length>=2&&HE(u[u.length-2],u[u.length-1],t[i])<=0;)u.pop();u.push(t[i])}for(var f=[],i=t.length-1;i>=0;i--){for(;f.length>=2&&HE(f[f.length-2],f[f.length-1],t[i])<=0;)f.pop();f.push(t[i])}f.pop(),u.pop();var l=u.concat(f);return l},Yj={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 Wj(r,e,t){var n=!1,i=function(u,f){return e.cells[u+f*e.width]},a=function(u,f){var l=0;return i(u-1,f-1)>=t&&(l+=1),i(u,f-1)>t&&(l+=2),i(u-1,f)>t&&(l+=4),i(u,f)>t&&(l+=8),l},o=function(u,f){for(var l=u,c=f,h,d,v=0;v<e.width*e.height;v++){if(h=l,d=c,r.findIndex(function(g){return g.x===l&&g.y===c})>-1){if(!(r[0].x!==l||r[0].y!==c))return!0}else r.push({x:l,y:c});var p=a(l,c);switch(p){case-1:return console.warn("Marched out of bounds"),!0;case 0:case 3:case 2:case 7:l++;break;case 12:case 14:case 4:l--;break;case 6:h===0&&(d===-1?l-=1:l+=1);break;case 1:case 13:case 5:c--;break;case 9:h===1&&(d===0?c-=1:c+=1);break;case 10:case 8:case 11:c++;break;default:return console.warn("Marching squares invalid state: ".concat(p)),!0}}};this.march=function(){for(var s=0;s<e.width&&!n;s+=1)for(var u=0;u<e.height&&!n;u+=1)i(s,u)>t&&a(s,u)!==15&&(n=o(s,u));return n}}var Vj=function(e,t,n){var i=Math.ceil(e/n),a=Math.ceil(t/n),o=new Float32Array(Math.max(0,i*a)).fill(0);return{cells:o,width:i,height:a}},Hj=function(e,t,n){var i=null,a=Number.POSITIVE_INFINITY;return t.forEach(function(o){var s={x:e.getModel().x,y:e.getModel().y},u={x:o.getModel().x,y:o.getModel().y},f=Ad(s,u),l=new Ms(s.x,s.y,u.x,u.y),c=n.reduce(function(h,d){return jm(d,l)>0?h+1:h},0);f*Math.pow(c+1,2)<a&&(i=o,a=f*Math.pow(c+1,2))}),i},PI=function(e,t){var n=Number.POSITIVE_INFINITY,i=null;return e.forEach(function(a){var o=jm(a,t);o>=0&&o<n&&(i=a,n=o)}),i},qj=function(e,t,n,i){var a=[],o=[];o.push(e);for(var s=!0,u=0,f=function(d,v){var p=!1;return v.forEach(function(g){p||(A0(d,{x:g.x1,y:g.y1})||A0(d,{x:g.x2,y:g.y2}))&&(p=!0)}),p},l=function(d,v){for(var p=0,g=v;p<g.length;p++){var y=g[p],m=y.getBBox(),b=[[m.x,m.y],[m.x+m.width,m.y],[m.x,m.y+m.height],[m.x+m.width,m.y+m.height]];if(xl(b,d.x,d.y))return!0}return!1};s&&u<n;){s=!1;for(var c=function(){var d=o.pop(),v=PI(t,d);if(v){var p=wT(v,d),g=p[0],y=p[1];if(y===2){var m=function(x){for(var w=i,E=ZE(v,w,g,x),_=f(E,o)||f(E,a),M=l(E,t);!_&&M&&w>=1;)w/=1.5,E=ZE(v,w,g,x),_=f(E,o)||f(E,a),M=l(E,t);E&&!_&&(!x||!M)&&(o.push(new Ms(d.x1,d.y1,E.x,E.y)),o.push(new Ms(E.x,E.y,d.x2,d.y2)),s=!0)};m(!0),s||m(!1)}}s||a.push(d),u+=1};!s&&o.length;)c()}for(;o.length;)a.push(o.pop());return a};function Zj(r,e,t,n,i){var a=Hj(r,t,e);if(a===null)return[];var o=function(c){for(var h=[];c.length>0;){var d=c.pop();if(c.length===0){h.push(d);break}var v=c.pop(),p=new Ms(d.x1,d.y1,v.x2,v.y2),g=PI(e,p);g?(h.push(d),c.push(v)):c.push(p)}return h},s=new Ms(r.getModel().x,r.getModel().y,a.getModel().x,a.getModel().y),u=qj(s,e,n,i),f=o(u);return f}var Kj=function(e,t,n){var i=Object.assign(Yj,n),a=ET(e.map(function(m){return{x:m.getModel().x,y:m.getModel().y}}));e=e.sort(function(m,b){return Ad({x:m.getModel().x,y:m.getModel().y},a)-Ad({x:b.getModel().x,y:b.getModel().y},a)});var o=[],s=[];e.forEach(function(m){var b=Zj(m,t,o,i.maxRoutingIterations,i.morphBuffer);b.forEach(function(x){s.push(x)}),o.push(m)});for(var u=Qj(e,s,i.nodeR0),f=Vj(u.width,u.height,i.pixelGroupSize),l=[],c=[],h=0;h<i.maxMarchingIterations;h++)if(Jj(e,t,s,u,f,i),l=[],c=[],!!new Wj(l,f,i.threshold).march()){var d=l.map(function(m){return{x:Math.round(m.x*i.pixelGroupSize+u.minX),y:Math.round(m.y*i.pixelGroupSize+u.minY)}});if(d){var v=d.length;if(i.skip>1)for(v=Math.floor(d.length/i.skip);v<3&&i.skip>1;)i.skip-=1,v=Math.floor(d.length/i.skip);for(var p=0,g=0;g<v;g+=1,p+=i.skip)c.push({x:d[p].x,y:d[p].y})}var y=function(){for(var b=0,x=e;b<x.length;b++){var w=x[b],E=c.map(function(_){return[_.x,_.y]});if(!xl(E,w.getBBox().centerX,w.getBBox().centerY))return!1}return!0};if(c&&y())return c;if(i.threshold*=.9,h<=i.maxMarchingIterations*.5)i.memberInfluenceFactor*=1.2,i.edgeInfluenceFactor*=1.2;else if(i.nonMemberInfluenceFactor!==0&&t.length>0)i.nonMemberInfluenceFactor*=.8;else break}return c};function Qj(r,e,t){var n={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=[];r.forEach(function(u){i.push(u.getBBox())}),e.forEach(function(u){i.push(u.getBBox())});for(var a=0,o=i;a<o.length;a++){var s=o[a];n.minX=(s.minX<n.minX?s.minX:n.minX)-t,n.minY=(s.minY<n.minY?s.minY:n.minY)-t,n.maxX=(s.maxX>n.maxX?s.maxX:n.maxX)+t,n.maxY=(s.maxY>n.maxY?s.maxY:n.maxY)+t}return n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.x=n.minX,n.y=n.minY,n}function Jj(r,e,t,n,i,a){function o(d,v){var p=Math.floor((d-v)/a.pixelGroupSize);return p<0?0:p}function s(d,v){return d*a.pixelGroupSize+v}var u=(a.nodeR0-a.nodeR1)*(a.nodeR0-a.nodeR1),f=(a.edgeR0-a.edgeR1)*(a.edgeR0-a.edgeR1),l=function(v,p){var g=Math.min(o(v.minX,p+n.minX),i.width),y=Math.min(o(v.minY,p+n.minY),i.height),m=Math.min(o(v.maxX,-p+n.minX),i.width),b=Math.min(o(v.maxY,-p+n.minY),i.height);return[g,y,m,b]},c=function(v,p){for(var g=v.getBBox(),y=l(g,a.nodeR1),m=y[0],b=y[1],x=y[2],w=y[3],E=b;E<w;E+=1)for(var _=m;_<x;_+=1)if(!(p<0&&i[_+E*i.width]<=0)){var M=s(_,n.minX),C=s(E,n.minY),S=ST({x:M,y:C},{x:g.minX,y:g.minY,width:g.width,height:g.height});if(S<Math.pow(a.nodeR1,2)){var A=Math.sqrt(S)-a.nodeR1;i.cells[_+E*i.width]+=p*A*A}}},h=function(v,p){for(var g=v.getBBox(),y=l(g,a.edgeR1),m=y[0],b=y[1],x=y[2],w=y[3],E=b;E<w;E+=1)for(var _=m;_<x;_+=1)if(!(p<0&&i.cells[_+E*i.width]<=0)){var M=s(_,n.minX),C=s(E,n.minY),S=_T({x:M,y:C},v);if(S<Math.pow(a.edgeR1,2)){var A=Math.sqrt(S)-a.edgeR1;i.cells[_+E*i.width]+=p*A*A}}};a.nodeInfluenceFactor&&r.forEach(function(d){c(d,a.nodeInfluenceFactor/u)}),a.edgeInfluenceFactor&&t.forEach(function(d){h(d,a.edgeInfluenceFactor/f)}),a.negativeNodeInfluenceFactor&&e.forEach(function(d){c(d,a.negativeNodeInfluenceFactor/u)})}function ZE(r,e,t,n){var i=r.getBBox(),a=t[0],o=t[1],s=t[2],u=t[3],f={topLeft:{x:i.minX-e,y:i.minY-e},topRight:{x:i.maxX+e,y:i.minY-e},bottomLeft:{x:i.minX-e,y:i.maxY+e},bottomRight:{x:i.maxX+e,y:i.maxY+e}},l=i.height*i.width;function c(v,p){return i.width*((v.y-i.minY+(p.y-i.minY))*.5)}if(o){if(a)return n?f.topLeft:f.bottomRight;if(s)return n?f.bottomLeft:f.topRight;var h=c(o,u);return h<l*.5?o.y>u.y?n?f.topLeft:f.bottomRight:n?f.topRight:f.bottomLeft:o.y<u.y?n?f.bottomLeft:f.topRight:n?f.bottomRight:f.topLeft}if(u){if(a)return n?f.topRight:f.bottomLeft;if(s)return n?f.bottomRight:f.topLeft}var d=c(a,s);return d<l*.5?a.x>s.x?n?f.topLeft:f.bottomRight:n?f.bottomLeft:f.topRight:a.x<s.x?n?f.topRight:f.bottomLeft:n?f.bottomRight:f.topLeft}var RI=function(){function r(e,t){this.cfg=yr(this.getDefaultCfg(),t),this.graph=e,this.id=this.cfg.id,this.group=this.cfg.group,this.members=this.cfg.members.map(function(n){return Pe(n)?e.findById(n):n}),this.nonMembers=this.cfg.nonMembers.map(function(n){return Pe(n)?e.findById(n):n}),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()}return r.prototype.getDefaultCfg=function(){return{id:"g6-hull",type:"round-convex",members:[],nonMembers:[],style:{fill:"lightblue",stroke:"blue",opacity:.2},padding:10}},r.prototype.setPadding=function(){var e=this.members.length&&this.members[0].getKeyShape().getCanvasBBox().width/2;this.padding=this.cfg.padding>0?this.cfg.padding+e:10+e,this.cfg.bubbleCfg={nodeR0:this.padding-e,nodeR1:this.padding-e,morphBuffer:this.padding-e}},r.prototype.setType=function(){this.type=this.cfg.type,this.members.length<3&&(this.type="round-convex"),this.type!=="round-convex"&&this.type!=="smooth-convex"&&this.type!=="bubble"&&(console.warn("The hull type should be either round-convex, smooth-convex or bubble, round-convex is used by default."),this.type="round-convex")},r.prototype.calcPath=function(e,t){var n,i,a;switch(this.type){case"round-convex":n=qE(e),a=ty(n.map(function(o){return[o.x,o.y]}),this.padding),i=H0(a);break;case"smooth-convex":n=qE(e),n.length===2?(a=ty(n.map(function(o){return[o.x,o.y]}),this.padding),i=H0(a)):n.length>2&&(a=DI(n.map(function(o){return[o.x,o.y]}),this.padding),i=ey(a));break;case"bubble":n=Kj(e,t,this.cfg.bubbleCfg),i=n.length>=2&&ey(n);break}return i},r.prototype.render=function(){this.group.addShape("path",{attrs:B({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},r.prototype.addMember=function(e){if(e){Pe(e)&&(e=this.graph.findById(e)),this.members.push(e);var t=this.nonMembers.indexOf(e);return t>-1&&this.nonMembers.splice(t,1),this.updateData(this.members,this.nonMembers),!0}},r.prototype.addNonMember=function(e){if(e){Pe(e)&&(e=this.graph.findById(e)),this.nonMembers.push(e);var t=this.members.indexOf(e);return t>-1&&this.members.splice(t,1),this.updateData(this.members,this.nonMembers),!0}},r.prototype.removeMember=function(e){if(e){Pe(e)&&(e=this.graph.findById(e));var t=this.members.indexOf(e);return t>-1?(this.members.splice(t,1),this.updateData(this.members,this.nonMembers),!0):!1}},r.prototype.removeNonMember=function(e){if(e){Pe(e)&&(e=this.graph.findById(e));var t=this.nonMembers.indexOf(e);return t>-1?(this.nonMembers.splice(t,1),this.updateData(this.members,this.nonMembers),!0):!1}},r.prototype.updateData=function(e,t){var n=this;this.group.findById(this.id).remove(),e&&(this.members=e.map(function(i){return Pe(i)?n.graph.findById(i):i})),t&&(this.nonMembers=t.map(function(i){return Pe(i)?n.graph.findById(i):i})),this.path=this.calcPath(this.members,this.nonMembers),this.render()},r.prototype.updateStyle=function(e){var t=this.group.findById(this.id);t.attr(B({},e))},r.prototype.updateCfg=function(e){var t=this;this.cfg=yr(this.cfg,e),this.id=this.cfg.id,this.group=this.cfg.group,e.members&&(this.members=this.cfg.members.map(function(n){return Pe(n)?t.graph.findById(n):n})),e.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map(function(n){return Pe(n)?t.graph.findById(n):n})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},r.prototype.contain=function(e){var t=this,n;Pe(e)?n=this.graph.findById(e):n=e;var i,a=n.getKeyShape();if(n.get("type")==="path")i=J0(a.attr("path"));else{var o=a.getCanvasBBox();i=[[o.minX,o.minY],[o.maxX,o.minY],[o.maxX,o.maxY],[o.minX,o.maxY]]}return i=i.map(function(s){var u=t.graph.getPointByCanvas(s[0],s[1]);return[u.x,u.y]}),xT(i,J0(this.path))},r.prototype.destroy=function(){this.group.remove(),this.cfg=null},r}(),Tf=yi,eU="node",BI=function(r){kt(e,r);function e(t){var n=r.call(this)||this;return n.sortCombos=jl(function(){var i=n.get("comboSorted");if(!(!n||n.destroyed||i)){n.set("comboSorted",!0);var a=[],o={},s=n.get("comboTrees");(s||[]).forEach(function(f){Cn(f,function(l){return a[l.depth]?a[l.depth].push(l.id):a[l.depth]=[l.id],o[l.id]=l.depth,!0})});var u=n.getEdges().concat(n.get("vedges"));(u||[]).forEach(function(f){var l=f.getModel(),c=o[l.source]||0,h=o[l.target]||0,d=Math.max(c,h);a[d]?a[d].push(l.id):a[d]=[l.id]}),a.forEach(function(f){if(!(!f||!f.length))for(var l=f.length-1;l>=0;l--){var c=n.findById(f[l]);c&&c.toFront()}})}},500,!1),n.cfg=yr(n.getDefaultCfg(),t),n.init(),n.animating=!1,n.destroyed=!1,n.cfg.enabledStack&&(n.undoStack=new xu(n.cfg.maxStep),n.redoStack=new xu(n.cfg.maxStep)),n}return e.prototype.init=function(){this.initCanvas();var t=new Lj(this),n=new Vz(this),i=new Gj(this),a=new zj(this);this.set({viewController:t,modeController:n,itemController:i,stateController:a}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},e.prototype.initGroups=function(){var t=this.get("canvas");if(t){var n=t.get("el"),i=(n||{}).id,a=i===void 0?"g6":i,o=t.addGroup({id:"".concat(a,"-root"),className:lt.rootContainerClassName});if(this.get("groupByTypes")){var s=o.addGroup({id:"".concat(a,"-edge"),className:lt.edgeContainerClassName}),u=o.addGroup({id:"".concat(a,"-node"),className:lt.nodeContainerClassName}),f=o.addGroup({id:"".concat(a,"-combo"),className:lt.comboContainerClassName});f.toBack(),this.set({nodeGroup:u,edgeGroup:s,comboGroup:f})}var l=o.addGroup({id:"".concat(a,"-delegate"),className:lt.delegateContainerClassName});this.set({delegateGroup:l}),this.set("group",o)}},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,n){return pn(t)?this.cfg=B(B({},this.cfg),t):this.cfg[t]=n,t==="enabledStack"&&n&&!this.undoStack&&!this.redoStack&&(this.undoStack=new xu(this.cfg.maxStep),this.redoStack=new xu(this.cfg.maxStep)),this},e.prototype.get=function(t){var n;return(n=this.cfg)===null||n===void 0?void 0:n[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,n){Pe(t)&&(t=this.findById(t));var i=this.get("itemController");n||(n=t.get("states")),i.clearItemStates(t,n);var a=this.get("stateController");a.updateStates(t,n,!1)},e.prototype.node=function(t){typeof t=="function"&&this.set("nodeMapper",t)},e.prototype.edge=function(t){typeof t=="function"&&this.set("edgeMapper",t)},e.prototype.combo=function(t){typeof t=="function"&&this.set("comboMapper",t)},e.prototype.findById=function(t){return this.get("itemMap")[t]},e.prototype.find=function(t,n){var i,a=this.get("".concat(t,"s"));return me(a,function(o,s){if(n(o,s))return i=o,i}),i},e.prototype.findAll=function(t,n){var i=[];return me(this.get("".concat(t,"s")),function(a,o){n(a,o)&&i.push(a)}),i},e.prototype.findAllByState=function(t,n,i){return i?this.findAll(t,function(a){return a.hasState(n)&&i(a)}):this.findAll(t,function(a){return a.hasState(n)})},e.prototype.translate=function(t,n,i,a){var o=this,s=this.get("group"),u=Vt(s.getMatrix());if(u||(u=[1,0,0,0,1,0,0,0,1]),i){var f=wl({animateCfg:a,callback:function(){return o.emit("viewportchange",{action:"translate",matrix:s.getMatrix()})}});C0(s,{x:s.getCanvasBBox().x+t,y:s.getCanvasBBox().y+n},i,f||{duration:500,easing:"easeCubic"})}else u=Tf(u,[["t",t,n]]),s.setMatrix(u),this.emit("viewportchange",{action:"translate",matrix:u}),this.autoPaint()},e.prototype.moveTo=function(t,n,i,a){var o=this.get("group");C0(o,{x:t,y:n},i,a||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:o.getMatrix()})},e.prototype.fitView=function(t,n,i,a){t&&this.set("fitViewPadding",t);var o=this.get("viewController");n?o.fitViewByRules(n,i,a):o.fitView(i,a),this.autoPaint()},e.prototype.fitCenter=function(t,n){var i=this.get("viewController");i.fitCenter(t,n),this.autoPaint()},e.prototype.addBehaviors=function(t,n){var i=this.get("modeController");return i.manipulateBehaviors(t,n,!0),this},e.prototype.removeBehaviors=function(t,n){var i=this.get("modeController");return i.manipulateBehaviors(t,n,!1),this},e.prototype.updateBehavior=function(t,n,i){var a=this.get("modeController");return a.updateBehavior(t,n,i),this},e.prototype.zoom=function(t,n,i,a){var o=this,s=this.get("group"),u=Vt(s.getMatrix())||[1,0,0,0,1,0,0,0,1],f=this.get("minZoom"),l=this.get("maxZoom"),c=this.getZoom()||1,h=c*t,d=t,v=!1;if(f&&h<f?(d=f/c,v=!0):l&&h>l&&(d=l/c,v=!0),n?u=Tf(u,[["t",-n.x,-n.y],["s",d,d],["t",n.x,n.y]]):u=Tf(u,[["s",d,d]]),i){var p=Vt(s.getMatrix());p||(p=[1,0,0,0,1,0,0,0,1]);var g=p[0],y=g*d,m=wl({animateCfg:a,callback:function(){return o.emit("viewportchange",{action:"zoom",matrix:s.getMatrix()})}});s.animate(function(b){if(b===1)p=u;else{var x=Um(g,y,b)/p[0];n?p=Tf(p,[["t",-n.x,-n.y],["s",x,x],["t",n.x,n.y]]):p=Tf(p,[["s",x,x]])}return{matrix:p}},m)}else s.setMatrix(u),this.emit("viewportchange",{action:"zoom",matrix:u}),this.autoPaint();return!v},e.prototype.zoomTo=function(t,n,i,a){var o=t/this.getZoom();return this.zoom(o,n,i,a)},e.prototype.focusItem=function(t,n,i){var a=this.get("viewController"),o=!1;n?o=!0:n===void 0&&(o=this.get("animate"));var s={};i?s=i:i===void 0&&(s=this.get("animateCfg")),a.focus(t,o,s),this.autoPaint()},e.prototype.focusItems=function(t,n,i,a){var o=this.get("viewController");o.focusItems(t,n,i,a)},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,n){var i=this.get("viewController");return i.getPointByClient(t,n)},e.prototype.getClientByPoint=function(t,n){var i=this.get("viewController");return i.getClientByPoint(t,n)},e.prototype.getPointByCanvas=function(t,n){var i=this.get("viewController");return i.getPointByCanvas(t,n)},e.prototype.getCanvasByPoint=function(t,n){var i=this.get("viewController");return i.getCanvasByPoint(t,n)},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,n){n===void 0&&(n=!0);var i=this.get("itemController"),a=i.changeItemVisibility(t,!0);if(n&&this.get("enabledStack")){var o=a.getID(),s=a.getType(),u={},f={};switch(s){case"node":u.nodes=[{id:o,visible:!1}],f.nodes=[{id:o,visible:!0}];break;case"edge":u.nodes=[{id:o,visible:!1}],f.edges=[{id:o,visible:!0}];break;case"combo":u.nodes=[{id:o,visible:!1}],f.combos=[{id:o,visible:!0}];break}this.pushStack("visible",{before:u,after:f})}},e.prototype.hideItem=function(t,n){n===void 0&&(n=!0);var i=this.get("itemController"),a=i.changeItemVisibility(t,!1);if(n&&this.get("enabledStack")){var o=a.getID(),s=a.getType(),u={},f={};switch(s){case"node":u.nodes=[{id:o,visible:!0}],f.nodes=[{id:o,visible:!1}];break;case"edge":u.nodes=[{id:o,visible:!0}],f.edges=[{id:o,visible:!1}];break;case"combo":u.nodes=[{id:o,visible:!0}],f.combos=[{id:o,visible:!1}];break}this.pushStack("visible",{before:u,after:f})}},e.prototype.refreshItem=function(t){var n=this.get("itemController");n.refreshItem(t)},e.prototype.setAutoPaint=function(t){var n=this;n.set("autoPaint",t);var i=n.get("canvas");i.set("autoDraw",t)},e.prototype.remove=function(t,n){n===void 0&&(n=!0),this.removeItem(t,n)},e.prototype.removeItem=function(t,n){n===void 0&&(n=!0);var i=t;if(Pe(t)&&(i=this.findById(t)),!i&&Pe(t))console.warn("The item ".concat(t," to be removed does not exist!"));else if(i){var a="";if(i.getType&&(a=i.getType()),n&&this.get("enabledStack")){var o=B(B({},i.getModel()),{itemType:a}),s={};switch(a){case"node":{s.nodes=[o],s.edges=[];for(var u=i.getEdges(),f=u.length-1;f>=0;f--)s.edges.push(B(B({},u[f].getModel()),{itemType:"edge"}));break}case"edge":s.edges=[o];break;case"combo":s.combos=[o];break}this.pushStack("delete",{before:s,after:{}})}if(a==="node"){var l=i.getModel();l.comboId&&this.updateComboTree(i,void 0,!1)}var c=this.get("itemController");if(c.removeItem(i),a==="combo"){var h=N0(this.get("comboTrees"));this.set("comboTrees",h)}}},e.prototype.innerAddItem=function(t,n,i){if(!Wz(t,n))return!1;if(n.id&&this.findById(n.id)){console.warn("This item exists already. Be sure the id %c".concat(n.id,"%c is unique."),"font-size: 20px; color: red;","");return}var a,o=this.get("comboTrees")||[];if(t==="combo"){var s=this.get("itemMap"),u=!1;if(o.forEach(function(v){u||Ki(v,function(p){if(n.parentId===p.id){u=!0;var g=B({id:n.id,depth:p.depth+2},n);p.children?p.children.push(g):p.children=[g],n.depth=g.depth,a=i.addItem(t,n)}var y=s[p.id];return u&&y&&y.getType&&y.getType()==="combo"&&i.updateCombo(y,p.children),!0})}),!u){var f=B({id:n.id,depth:0},n);n.depth=f.depth,o.push(f),a=i.addItem(t,n)}this.set("comboTrees",o),n.collapsed&&(this.collapseCombo(a,!1),this.updateCombo(a))}else if(t==="node"&&Pe(n.comboId)&&o){var l=this.findById(n.comboId);l&&l.getType&&l.getType()!=="combo"&&console.warn("'".concat(n.comboId,"' is not a id of a combo in the graph, the node will be added without combo.")),a=i.addItem(t,n);var c=this.get("itemMap"),h=!1,d=!1;o.forEach(function(v){d||h||Ki(v,function(p){if(p.id===n.id)return d=!0,!1;if(n.comboId===p.id&&!d){h=!0;var g=Vt(n);g.itemType="node",p.children?p.children.push(g):p.children=[g],g.depth=p.depth+1}return h&&c[p.id].getType&&c[p.id].getType()==="combo"&&i.updateCombo(c[p.id],p.children),!0})})}else a=i.addItem(t,n);if(t==="node"&&n.comboId||t==="combo"&&n.parentId){var l=this.findById(n.comboId||n.parentId);l&&l.getType&&l.getType()==="combo"&&l.addChild(a)}return a},e.prototype.addItem=function(t,n,i,a){i===void 0&&(i=!0),a===void 0&&(a=!0);var o=this.get("comboSorted");this.set("comboSorted",o&&!a);var s=this.get("itemController"),u=this.innerAddItem(t,n,s);if(u===!1||u===!0)return u;var f=this.get("combos");if(f&&f.length>0&&this.sortCombos(),this.autoPaint(),i&&this.get("enabledStack")){var l=B(B({},u.getModel()),{itemType:t}),c={};switch(t){case"node":c.nodes=[l];break;case"edge":c.edges=[l];break;case"combo":c.combos=[l];break}this.pushStack("add",{before:{},after:c})}return u},e.prototype.addItems=function(t,n,i){t===void 0&&(t=[]),n===void 0&&(n=!0),i===void 0&&(i=!0);var a=this.get("comboSorted");this.set("comboSorted",a&&!i);for(var o=this.get("itemController"),s=[],u=0;u<t.length;u++){var f=t[u];f.type!=="edge"&&f.type!=="vedge"?s.push(this.innerAddItem(f.type,f.model,o)):s.push(void 0)}for(var u=0;u<t.length;u++){var f=t[u];(f.type==="edge"||f.type==="vedge")&&(s[u]=this.innerAddItem(f.type,f.model,o))}if(i){var l=this.get("combos");l&&l.length>0&&this.sortCombos()}if(this.autoPaint(),n&&this.get("enabledStack")){for(var c={nodes:[],edges:[],combos:[]},u=0;u<t.length;u++){var h=t[u].type,d=s[u];if(d&&d!==!0){var v=B(B({},d.getModel()),{itemType:h});switch(h){case"node":c.nodes.push(v);break;case"edge":c.edges.push(v);break;case"combo":c.combos.push(v);break}}}this.pushStack("addItems",{before:{},after:c})}return s},e.prototype.add=function(t,n,i,a){return i===void 0&&(i=!0),a===void 0&&(a=!0),this.addItem(t,n,i,a)},e.prototype.updateItem=function(t,n,i){var a=this;i===void 0&&(i=!0);var o=this.get("itemController"),s;Pe(t)?s=this.findById(t):s=t;var u=i&&this.get("enabledStack"),f;u&&(f=Vt(s.getModel()));var l="";s.getType&&(l=s.getType());var c=Jn([],s.getStates(),!0);if(l==="combo"&&me(c,function(p){return a.setItemState(s,p,!1)}),o.updateItem(s,n),l==="combo"&&me(c,function(p){return a.setItemState(s,p,!0)}),u){var h={nodes:[],edges:[],combos:[]},d={nodes:[],edges:[],combos:[]},v=B({id:f.id},n);switch(l){case"node":h.nodes.push(f),d.nodes.push(v);break;case"edge":h.edges.push(f),d.edges.push(v);break;case"combo":h.combos.push(f),d.combos.push(v);break}this.pushStack("update",{before:h,after:d})}},e.prototype.update=function(t,n,i){i===void 0&&(i=!0),this.updateItem(t,n,i)},e.prototype.setItemState=function(t,n,i){Pe(t)&&(t=this.findById(t));var a=this.get("itemController");a.setItemState(t,n,i);var o=this.get("stateController");o.updateState(t,n,i)},e.prototype.priorityState=function(t,n){var i=this.get("itemController");i.priorityState(t,n)},e.prototype.data=function(t){jw(t),this.set("data",t)},e.prototype.render=function(){var t=this;this.set("comboSorted",!1);var n=this.get("data");if(this.get("enabledStack")&&this.clearStack(),!n)throw new Error("data must be defined first");var i=n.nodes,a=i===void 0?[]:i,o=n.edges,s=o===void 0?[]:o,u=n.combos,f=u===void 0?[]:u;if(this.clear(!0),this.emit("beforerender"),t.addItems(a.map(function(g){return{type:"node",model:g}}),!1,!1),(f==null?void 0:f.length)!==0){var l=L0(f,a);this.set("comboTrees",l),t.addCombos(f)}t.addItems(s.map(function(g){return{type:"edge",model:g}}),!1,!1);var c=t.get("animate");(t.get("fitView")||t.get("fitCenter"))&&t.set("animate",!1);var h=t.get("layoutController");if(h){if(h.layout(d),this.destroyed)return}else d();function d(){(t.get("comboTrees")||[]).forEach(function(g){Ki(g,function(y){var m=t.findById(y.id);return m.getType()==="combo"&&y.collapsed&&(t.collapseCombo(y.id,!1),t.updateCombo(m)),!0})}),t.get("fitView")?t.fitView():t.get("fitCenter")&&t.fitCenter(),t.autoPaint(),t.emit("afterrender"),(t.get("fitView")||t.get("fitCenter"))&&t.set("animate",c),setTimeout(function(){var g;(g=t.getCombos())===null||g===void 0||g.forEach(function(y){y.set("animate",!0)})},0)}if(!this.get("groupByTypes"))if(f&&f.length!==0)this.sortCombos();else if(n.nodes&&n.edges&&n.nodes.length<n.edges.length){var v=this.getNodes();v.forEach(function(g){g.toFront()})}else{var p=this.getEdges();p.forEach(function(g){g.toBack()})}},e.prototype.read=function(t){this.data(t),this.render()},e.prototype.diffItems=function(t,n,i){var a=this,o,s=this.get("itemMap");me(i,function(u){if(o=s[u.id],o){if(a.get("animate")&&t===eU){var f=o.getContainer().getMatrix();f||(f=[1,0,0,0,1,0,0,0,1]),o.set("originAttrs",{x:f[6],y:f[7]})}a.updateItem(o,u,!1)}else o=a.addItem(t,u,!1);o&&n["".concat(t,"s")].push(o)})},e.prototype.changeData=function(t,n){var i=this,a;n===void 0&&(n=!0);var o=this,s=t||o.get("data");if(!jw(s))return this;this.emit("beforechangedata"),n&&this.get("enabledStack")&&this.pushStack("changedata",{before:o.save(),after:s}),this.set("comboSorted",!1),this.removeHulls(),this.getNodes().map(function(x){return o.clearItemStates(x)}),this.getEdges().map(function(x){return o.clearItemStates(x)});var u=this.get("canvas"),f=u.get("localRefresh");u.set("localRefresh",!1),o.get("data")||(o.data(s),o.render());var l=this.get("itemMap"),c={nodes:[],edges:[]},h=s.combos;if(h){var d=L0(h,s.nodes);this.set("comboTrees",d)}else this.set("comboTrees",[]);this.diffItems("node",c,s.nodes),me(l,function(x,w){l[w].getModel().depth=0,!(x.getType&&x.getType()==="edge")&&(x.getType&&x.getType()==="combo"?(delete l[w],x.destroy()):c.nodes.indexOf(x)<0&&(delete l[w],o.remove(x,!1)))});for(var v=this.getCombos(),p=v.length,g=p-1;g>=0;g--)v[g].destroyed&&v.splice(g,1);h&&(o.addCombos(h),this.get("groupByTypes")||this.sortCombos()),this.diffItems("edge",c,s.edges),me(l,function(x,w){x.getType&&(x.getType()==="node"||x.getType()==="combo")||c.edges.indexOf(x)<0&&(delete l[w],o.remove(x,!1))}),(this.get("comboTrees")||[]).forEach(function(x){Ki(x,function(w){var E=i.findById(w.id);return E.getType()==="combo"&&w.collapsed&&i.collapseCombo(w.id,!1),!0})}),this.set({nodes:c.nodes,edges:c.edges});var y=(this.get("layout")||{}).relayoutAtChangeData,m=y===void 0?!0:y,b=this.get("layoutController");return m&&b&&(b.changeData(function(){setTimeout(function(){var x;(x=o.getCombos())===null||x===void 0||x.forEach(function(w){w.set("animate",!0)})},0)}),o.get("animate")&&!b.getLayoutType()?(o.positionsAnimate(),(a=o.getCombos())===null||a===void 0||a.forEach(function(x){return x.set("animate",!0)})):o.autoPaint()),setTimeout(function(){u.set("localRefresh",f)},16),this.set("data",s),this.emit("afterchangedata"),this},e.prototype.addCombos=function(t){var n=this,i=n.get("comboTrees"),a=this.get("itemController");a.addCombos(i,t)},e.prototype.createCombo=function(t,n,i){var a=this;i===void 0&&(i=!0);var o=this.get("itemController");this.set("comboSorted",!1);var s="",u;if(t){if(Pe(t))s=t,u={id:t};else{if(s=t.id,!s){console.warn("Create combo failed. Please assign a unique string id for the adding combo.");return}u=t}var f=i&&this.get("enabledStack"),l={nodes:[],combos:[]};f&&n.forEach(function(y){var m=a.findById(y),b=m.getType();if(!(b!=="node"&&b!=="combo")){var x=m.getModel();l["".concat(b,"s")].push({id:y,parentId:b==="node"?x.comboId:x.parentId})}});var c=this.get("comboTrees"),h=new Set(n),d=new Map;c&&(c.forEach(function(y){Ki(y,function(m,b,x){if(h.has(m.id)){if(b){var w=a.findById(b.id),E=a.findById(m.id);b.children.splice(x,1),w.removeChild(E),o.updateCombo(w,b.children)}m.itemType==="combo"&&d.set(m.id,m)}return!0})}),c=c.filter(function(y){return!h.has(y.id)}),this.set("comboTrees",c));var v={nodes:[],combos:[]},p=n.map(function(y){var m=a.findById(y),b=m.getModel(),x="";m.getType&&(x=m.getType());var w=d.get(y)||{id:m.getID(),itemType:x};return x==="combo"?(w.parentId=s,b.parentId=s):x==="node"&&(w.comboId=s,b.comboId=s),f&&v["".concat(x,"s")].push({id:b.id,parentId:s}),w});u.children=p,this.addItem("combo",u,!1),this.set("comboSorted",!1),c&&(c.forEach(function(y){Cn(y,function(m){return m.id===s?(m.itemType="combo",m.children=p,!1):!0})}),this.sortCombos()),f&&(v.combos.push(u),this.pushStack("createCombo",{before:l,after:v}));var g=this.findById(s);!g.getModel().parentId&&g.getChildren().combos.length&&this.updateComboTree(g,void 0,!1),setTimeout(function(){g.set("animate",!0)},0)}},e.prototype.uncombo=function(t,n){var i=this,a,o;n===void 0&&(n=!0);var s=this,u=t;if(Pe(t)&&(u=this.findById(t)),!u||u.getType&&u.getType()!=="combo"){console.warn("The item is not a combo!");return}var f=u.getModel(),l=u.getModel().parentId,c=s.get("comboTrees");c||(c=[]);var h=this.get("itemMap"),d=u.get("id"),v,p=[],g=this.get("combos"),y=this.findById(l),m=n&&this.get("enabledStack"),b={};if(m&&(b=Vt(f),b.children=[]),c.forEach(function(_){v||Ki(_,function(M){var C;if(M.id===d){v=M;var S=u.getEdges().map(function(k){return k.getID()});S.forEach(function(k){i.removeItem(k,!1)});var A=g.indexOf(u);g.splice(A,1),delete h[d];var T=Vt(u.getModel());u.destroy(),i.emit("afterremoveitem",{item:T,type:"combo"})}if(l&&v&&M.id===l){y.removeCombo(u),p=M.children;var A=p.indexOf(v);return A!==-1&&p.splice(A,1),(C=v.children)===null||C===void 0||C.forEach(function(O){var F=i.findById(O.id),D=F.getModel();F.getType&&F.getType()==="combo"?(O.parentId=l,delete O.comboId,D.parentId=l,delete D.comboId):F.getType&&F.getType()==="node"&&(O.comboId=l,D.comboId=l),y.addChild(F),p.push(O)}),i.updateCombo(y),!1}return!0})}),!l&&v){var x=c.indexOf(v);c.splice(x,1),(a=v.children)===null||a===void 0||a.forEach(function(_){_.parentId=void 0;var M=i.findById(_.id).getModel();delete M.parentId,delete M.comboId,_.itemType!=="node"&&c.push(_)})}if(m){var w={nodes:[],combos:[]},E={nodes:[],combos:[]};(o=v.children)===null||o===void 0||o.forEach(function(_){var M=i.findById(_.id),C=M.getType();C!=="node"&&C!=="combo"||(w["".concat(C,"s")].push({id:_.id,parentId:d}),E["".concat(C,"s")].push({id:_.id,parentId:l}))}),w.combos.push(b),this.pushStack("uncombo",{before:w,after:E})}},e.prototype.updateCombos=function(t){var n=this;t===void 0&&(t=!1);var i=this,a=this.get("comboTrees"),o=i.get("itemController"),s=i.get("itemMap");(a||[]).forEach(function(u){Ki(u,function(f){var l;if(!f)return!0;var c=s[f.id];if(((l=c==null?void 0:c.getType)===null||l===void 0?void 0:l.call(c))==="combo"){var h=Jn([],c.getStates(),!0);me(h,function(d){return n.setItemState(c,d,!1)}),o.updateCombo(c,f.children,t),me(h,function(d){return n.setItemState(c,d,!0)})}return!0})}),i.sortCombos()},e.prototype.updateCombo=function(t){var n=this,i=this,a=t,o;if(Pe(t)&&(a=this.findById(t)),!a||a.getType&&a.getType()!=="combo"){console.warn("The item to be updated is not a combo!");return}o=a.get("id");var s=this.get("comboTrees"),u=i.get("itemController"),f=i.get("itemMap");(s||[]).forEach(function(l){Ki(l,function(c){if(!c)return!0;var h=f[c.id];if(o===c.id&&h&&h.getType&&h.getType()==="combo"){var d=Jn([],h.getStates(),!0);me(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!1)}),u.updateCombo(h,c.children),me(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!0)}),o&&(o=c.parentId)}return!0})})},e.prototype.updateComboTree=function(t,n,i){i===void 0&&(i=!0);var a=this;this.set("comboSorted",!1);var o;Pe(t)?o=a.findById(t):o=t;var s=o.getModel(),u=s.comboId||s.parentId,f="";if(o.getType&&(f=o.getType()),n&&f==="combo"){var l=this.get("comboTrees"),c=!0,h;if((l||[]).forEach(function(m){h||Cn(m,function(b){if(!h)return b.id===o.getID()&&(h=b),!0})}),Cn(h,function(m){return m.id===n?(c=!1,!1):!0}),!c){console.warn("Failed to update the combo tree! The parentId points to a descendant of the combo!");return}}if(i&&this.get("enabledStack")){var d={},v={};f==="combo"?(d.combos=[{id:s.id,parentId:s.parentId}],v.combos=[{id:s.id,parentId:n}]):f==="node"&&(d.nodes=[{id:s.id,parentId:s.comboId}],v.nodes=[{id:s.id,parentId:n}]),this.pushStack("updateComboTree",{before:d,after:v})}if(s.parentId||s.comboId){var p=this.findById(s.parentId||s.comboId);p&&p.removeChild(o)}if(f==="combo"?s.parentId=n:f==="node"&&(s.comboId=n),n){var g=this.findById(n);g&&g.addChild(o)}if(u){var g=this.findById(u);g&&g.removeChild(o)}var y=N0(this.get("comboTrees"),s.id,n);this.set("comboTrees",y),this.updateCombos()},e.prototype.save=function(){var t=[],n=[],i=[];return me(this.get("nodes"),function(a){t.push(a.getModel())}),me(this.get("edges"),function(a){n.push(a.getModel())}),me(this.get("combos"),function(a){i.push(a.getModel())}),{nodes:t,edges:n,combos:i}},e.prototype.changeSize=function(t,n){var i=this.get("viewController");return i.changeSize(t,n),this},e.prototype.refresh=function(){var t=this;if(t.emit("beforegraphrefresh"),t.get("animate"))t.positionsAnimate();else{var n=t.get("nodes"),i=t.get("edges"),a=t.get("edges");me(n,function(o){o.refresh()}),me(i,function(o){o.refresh()}),me(a,function(o){o.refresh()})}t.emit("aftergraphrefresh"),t.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(Pe(t)&&(t=this.findById(t)),!t||t.getType&&t.getType()!=="combo"){console.warn("The combo does not exist!");return}return t.getChildren()},e.prototype.positionsAnimate=function(t){var n=this;n.emit("beforeanimate");var i=n.get("animateCfg"),a=i.onFrame,o=t?n.getNodes().concat(n.getCombos()):n.getNodes(),s=o.map(function(f){var l=f.getModel();return{id:l.id,x:l.x,y:l.y}});n.stopAnimate();var u=n.get("canvas");n.animating=!0,setTimeout(function(){u.animate(function(f){me(s,function(l){var c=n.findById(l.id);if(!(!c||c.destroyed)){var h=c.get("originAttrs"),d=c.get("model"),v=c.getContainer().getMatrix();if(h==null&&(v&&(h={x:v[6],y:v[7]}),c.set("originAttrs",h||0)),a){var p=a(c,f,l,h||{x:0,y:0});c.set("model",Object.assign(d,p))}else h?(d.x=h.x+(l.x-h.x)*f,d.y=h.y+(l.y-h.y)*f):(d.x=l.x,d.y=l.y)}}),n.refreshPositions(t)},{duration:i.duration,easing:i.easing,callback:function(){me(o,function(l){l.set("originAttrs",null)}),i.callback&&i.callback(),n.emit("afteranimate"),n.animating=!1}})},0)},e.prototype.refreshPositions=function(t){var n=this;n.emit("beforegraphrefreshposition");var i=n.get("nodes"),a=n.get("edges"),o=n.get("vedges"),s=n.get("combos"),u,f={},l=function(h){me(h,function(d){u=d.getModel();var v=d.get("originAttrs");if(!(v&&u.x===v.x&&u.y===v.y)){var p=d.updatePosition({x:u.x,y:u.y});f[u.id]=p,u.comboId&&(f[u.comboId]=f[u.comboId]||p),u.parentId&&(f[u.parentId]=f[u.parentId]||p)}})};l(s),l(i),s&&s.length!==0&&(t&&l(s),n.updateCombos()),me(a,function(c){var h=c.getSource().getModel(),d=c.getTarget();if(!pn(d)){var v=d.getModel();(f[h.id]||f[v.id]||c.getModel().isComboEdge)&&c.refresh()}}),me(o,function(c){c.refresh()}),n.emit("aftergraphrefreshposition"),n.autoPaint()},e.prototype.stopAnimate=function(){var t=this.get("canvas"),n=t.cfg.timeline;n&&n.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(){var t=this.get("modeController");return t.getMode()},e.prototype.setMode=function(t){var n=this.get("modeController");return n.setMode(t),this},e.prototype.clear=function(t){var n;return t===void 0&&(t=!1),(n=this.get("canvas"))===null||n===void 0||n.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],vedges:[],groups:[],combos:[],comboTrees:[]}),t||this.emit("afterrender"),this},e.prototype.updateLayout=function(t,n,i,a){var o=this;t===void 0&&(t={}),a===void 0&&(a=!0);var s=this.get("layoutController");if(Pe(t)&&(t={type:t}),n){var u=i;u||(n==="begin"?u={x:0,y:0}:u={x:this.getWidth()/2,y:this.getHeight()/2}),u=this.getPointByCanvas(u.x,u.y);var f=["force","gForce","fruchterman","force2"];f.includes(t.type)||!t.type&&f.includes(s==null?void 0:s.layoutType)?t.center=[u.x,u.y]:this.once("afterlayout",function(h){var d=o.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];u.x=u.x*d[0]+d[6],u.y=u.y*d[0]+d[7];var v=o.getGroup().getCanvasBBox(),p=v.minX,g=v.maxX,y=v.minY,m=v.maxY,b={x:(p+g)/2,y:(y+m)/2};n==="begin"&&(b.x=p,b.y=y),o.translate(u.x-b.x,u.y-b.y)})}var l=B({},this.get("layout")),c={};Object.assign(c,l,t),t.pipes&&!t.type?delete c.type:!t.pipes&&c.type&&delete c.pipes,this.set("layout",c),s&&(s.isLayoutTypeSame(c)&&c.gpuEnabled===l.gpuEnabled?s.updateLayoutCfg(c):s.changeLayout(c),a&&this.get("enabledStack")&&this.pushStack("layout",{before:l,after:c}))},e.prototype.destroyLayout=function(){var t=this.get("layoutController");t==null||t.destroyLayout()},e.prototype.layout=function(){var t,n=this.get("layoutController"),i=this.get("layout");if(!(!i||!n)){if(i.workerEnabled){n.layout();return}!((t=n.layoutMethods)===null||t===void 0)&&t.length?n.relayout(!0):n.layout()}},e.prototype.collapseCombo=function(t,n){var i=this;if(n===void 0&&(n=!0),!this.destroyed){if(Pe(t)&&(t=this.findById(t)),!t){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"collapse",item:t});var a=t.getModel(),o=this.get("itemController");o.collapseCombo(t,n),a.collapsed=!0;var s=this.getEdges().concat(this.get("vedges")),u=[],f=this.get("comboTrees"),l=!1;(f||[]).forEach(function(h){l||Cn(h,function(d){if(l&&d.depth<=a.depth)return!1;if(a.id===d.id&&(l=!0),l){var v=i.findById(d.id);v&&v.getType&&v.getType()==="combo"&&(u=u.concat(v.getNodes()),u=u.concat(v.getCombos()))}return!0})});var c={};s.forEach(function(h){var d=h.getModel(),v=d.isVEdge,p=d.size,g=p===void 0?1:p;if(!(h.isVisible()&&!v)){var y=h.getSource(),m=h.getTarget(),b=null,x;if(y.getModel().id===a.id||u.includes(y)&&!u.includes(m)?(b=m,x=!1):(m.getModel().id===a.id||!u.includes(y)&&u.includes(m))&&(b=y,x=!0),b){if(v){i.removeItem(h,!1);return}for(var w=b.getModel();!b.isVisible();){var E=w.parentId,_=w.comboId,M=E||_;if(b=i.findById(M),!b||!M)return;w=b.getModel()}var C=w.id,S=x?{source:C,target:a.id,size:g,isVEdge:!0}:{source:a.id,target:C,size:g,isVEdge:!0},A="".concat(S.source,"-").concat(S.target);if(c[A]){c[A].size+=g;return}c[A]=S}}}),this.addItems(Object.values(c).map(function(h){return{type:"vedge",model:h}}),!1),this.emit("aftercollapseexpandcombo",{action:"collapse",item:t})}},e.prototype.expandCombo=function(t,n){var i=this;if(n===void 0&&(n=!0),Pe(t)&&(t=this.findById(t)),!t||t.getType&&t.getType()!=="combo"){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"expand",item:t});var a=t.getModel(),o=this.get("itemController");o.expandCombo(t,n),a.collapsed=!1;var s=this.getEdges().concat(this.get("vedges")),u=[],f=this.get("comboTrees"),l=!1;(f||[]).forEach(function(h){l||Cn(h,function(d){if(l&&d.depth<=a.depth)return!1;if(a.id===d.id&&(l=!0),l){var v=i.findById(d.id);v&&v.getType&&v.getType()==="combo"&&(u=u.concat(v.getNodes()),u=u.concat(v.getCombos()))}return!0})});var c={};s.forEach(function(h){if(!(h.isVisible()&&!h.getModel().isVEdge)){var d=h.getSource(),v=h.getTarget(),p=d.get("id"),g=v.get("id"),y=null,m;if(p===a.id||u.includes(d)&&!u.includes(v)?(y=v,m=!1):g===a.id||!u.includes(d)&&u.includes(v)?(y=d,m=!0):u.includes(d)&&u.includes(v)&&d.isVisible()&&v.isVisible()&&h.show(),y){var b=h.getModel(),x=b.isVEdge,w=b.size,E=w===void 0?1:w;if(x){i.removeItem(h,!1);return}for(var _=y.getModel();!y.isVisible();){var M=_.parentId,C=_.comboId,S=M||C;if(y=i.findById(S),!y||!S)return;_=y.getModel()}for(var A=_.id,T=m?v:d,k=T.getModel();!T.isVisible();){var O=k.parentId,F=k.comboId,D=O||F;if(T=i.findById(D),!T||!D)return;if(k.comboId===a.id||k.parentId===a.id)break;k=T.getModel()}var $=k.id;if(A){var Y=m?{source:A,target:$,isVEdge:!0,size:E}:{source:$,target:A,isVEdge:!0,size:E},N="".concat(Y.source,"-").concat(Y.target);if(c[N]){c[N].size+=E;return}c[N]=Y}}}}),this.addItems(Object.values(c).map(function(h){return{type:"vedge",model:h}}),!1),this.emit("aftercollapseexpandcombo",{action:"expand",item:t})},e.prototype.collapseExpandCombo=function(t,n){if(n===void 0&&(n=!0),Pe(t)&&(t=this.findById(t)),!(!t||t.getType&&t.getType()!=="combo")){for(var i=t.getModel(),a=this.findById(i.parentId);a;){var o=a.getModel();if(o.collapsed){console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),a=void 0;return}a=this.findById(o.parentId)}var s=i.collapsed;s?this.expandCombo(t,n):this.collapseCombo(t,n),this.updateCombo(t)}},e.prototype.getNeighbors=function(t,n){var i=t;return Pe(t)&&(i=this.findById(t)),i.getNeighbors(n)},e.prototype.getNodeDegree=function(t,n,i){n===void 0&&(n=void 0),i===void 0&&(i=!1);var a=t;Pe(t)&&(a=this.findById(t));var o=this.get("degrees");(!o||i)&&(o=ja(this.save()),this.set("degrees",o));var s=o[a.getID()],u=0;if(!s)return 0;switch(n){case"in":u=s.inDegree;break;case"out":u=s.outDegree;break;case"all":u=s;break;default:u=s.degree;break}return u},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,n,i){if(t===void 0&&(t="update"),i===void 0&&(i="undo"),!this.get("enabledStack")){console.warn("请先启用 undo & redo 功能,在实例化 Graph 时候配置 enabledStack: true !");return}var a=n?Vt(n):{before:{},after:Vt(this.save())};i==="redo"?this.redoStack.push({action:t,data:a}):this.undoStack.push({action:t,data:a}),this.emit("stackchange",{action:t,stackType:i,undoStack:this.undoStack,redoStack:this.redoStack})},e.prototype.getAdjMatrix=function(t,n){t===void 0&&(t=!0),n===void 0&&(n=this.get("directed"));var i=this.get("adjMatrix");return(!i||!t)&&(i=Ss(this.save(),n),this.set("adjMatrix",i)),i},e.prototype.getShortestPathMatrix=function(t,n){t===void 0&&(t=!0),n===void 0&&(n=this.get("directed"));var i=this.get("adjMatrix"),a=this.get("shortestPathMatrix");return(!i||!t)&&(i=Ss(this.save(),n),this.set("adjMatrix",i)),(!a||!t)&&(a=bl(this.save(),n),this.set("shortestPathMatrix",a)),a},e.prototype.on=function(t,n,i){return r.prototype.on.call(this,t,n,i)},e.prototype.destroy=function(){var t,n,i,a,o;this.emit("beforedestroy"),this.clear(),this.clearStack(),(t=this.get("itemController"))===null||t===void 0||t.destroy(),(n=this.get("modeController"))===null||n===void 0||n.destroy(),(i=this.get("viewController"))===null||i===void 0||i.destroy(),(a=this.get("stateController"))===null||a===void 0||a.destroy(),(o=this.get("canvas"))===null||o===void 0||o.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){console.warn("Create hull failed! The members is empty.");return}var n=this.get("hullGroup"),i=this.get("hullMap");if(i||(i={},this.set("hullMap",i)),(!n||n.get("destroyed"))&&(n=this.get("group").addGroup({id:"hullGroup"}),n.toBack(),this.set("hullGroup",n)),i[t.id])return console.warn("Existed hull id."),i[t.id];var a=n.addGroup({id:"".concat(t.id,"-container")}),o=new RI(this,B(B({},t),{group:a})),s=o.id;return i[s]=o,o},e.prototype.getHulls=function(){return this.get("hullMap")},e.prototype.getHullById=function(t){return this.get("hullMap")[t]},e.prototype.removeHull=function(t){var n,i;Pe(t)?i=this.getHullById(t):i=t,(n=this.get("hullMap"))===null||n===void 0||delete n[i.id],i.destroy()},e.prototype.removeHulls=function(){var t=this.getHulls();!t||!Object.keys(t).length||(Object.keys(t).forEach(function(n){var i=t[n];i.destroy()}),this.set("hullMap",{}))},e}(OC);function ry(r){"@babel/helpers - typeof";return ry=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ry(r)}var ru=yi,KE="-shape",Mg="-label",lh=["startArrow","endArrow"],QE={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},tU={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},ch={edge:tU,node:QE,combo:QE},ny="-label-bg",Jm={options:{labelCfg:{style:{fontFamily:lt.windowFontFamily}},descriptionCfg:{style:{fontFamily:lt.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(e){return{}},getOptions:function(e,t){return t==="move"||t!=null&&t.includes("bbox")?e:yr({},this.options,this.getCustomConfig(e)||{},e)},draw:function(e,t){t.shapeMap={},this.mergeStyle=this.getOptions(e);var n=this.drawShape(e,t);if(n.set("className",this.itemType+KE),t.shapeMap[this.itemType+KE]=n,e.label){var i=this.drawLabel(e,t);i.set("className",this.itemType+Mg),t.shapeMap[this.itemType+Mg]=i}return n},afterDraw:function(e,t,n){},drawShape:function(e,t){return null},drawLabel:function(e,t){var n=(this.mergeStyle||this.getOptions(e)||{}).labelCfg,i=n||{},a=this.getLabelStyle(e,i,t),o=a.rotate;delete a.rotate;var s=t.addShape("text",{attrs:a,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(t.shapeMap["text-shape"]=s,!isNaN(o)&&o!==""){var u=s.getBBox(),f=[1,0,0,0,1,0,0,0,1];if(a.rotateCenter)switch(a.rotateCenter){case"center":f=ru(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break;case"lefttop":f=ru(f,[["t",-a.x,-a.y],["r",o],["t",a.x,a.y]]);break;case"leftcenter":f=ru(f,[["t",-a.x,-a.y-u.height/2],["r",o],["t",a.x,a.y+u.height/2]]);break;default:f=ru(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break}else f=ru(f,[["t",-a.x,-a.y-u.height/2],["r",o],["t",a.x,a.y+u.height/2]]);s.setMatrix(f)}if(a.background){var l=this.drawLabelBg(e,t,s),c=this.itemType+ny;l.set("classname",c),t.shapeMap[c]=l,s.toFront()}return s},drawLabelBg:function(e,t,n){var i=this.options.labelCfg,a=yt({},i,e.labelCfg),o=this.getLabelBgStyleByPosition(n,a),s=t.addShape("rect",{name:"text-bg-shape",attrs:o,labelRelated:!0});return t.shapeMap["text-bg-shape"]=s,s},getLabelStyleByPosition:function(e,t,n){return{text:e.label}},getLabelBgStyleByPosition:function(e,t){return{}},getLabelStyle:function(e,t,n){var i=this.getLabelStyleByPosition(e,t,n),a="".concat(this.itemType,"Label"),o=lt[a]?lt[a].style:null;return B(B(B({},o),i),t.style)},getShapeStyle:function(e){return e.style},update:function(e,t,n){this.updateShapeStyle(e,t,n),this.updateLabel(e,t,n)},updateShapeStyle:function(e,t,n){var i,a=t.getContainer(),o=t.getKeyShape(),s=yt({},o.attr(),e.style),u=function(c){var h,d=s[c];if(pn(d)){var v=((i=a.shapeMap)===null||i===void 0?void 0:i[c])||a.find(function(p){return p.get("name")===c});v==null||v.attr(d)}else o.attr((h={},h[c]=d,h))};for(var f in s)u(f)},updateLabel:function(e,t,n){var i,a,o=t.getContainer(),s=(this.mergeStyle||this.getOptions({},n)||{}).labelCfg,u=s===void 0?{}:s,f=this.itemType+Mg,l=o.shapeMap[f]||o.find(function(x){return x.get("className")===f}),c=this.itemType+ny,h=o.shapeMap[c]||o.find(function(x){return x.get("className")===c});if(l&&e.label===void 0&&(o.removeChild(l),delete o.shapeMap[f],h&&(o.removeChild(h),delete o.shapeMap[c])),e.label||e.label==="")if(l){(!n||n==="bbox|label"||this.itemType==="edge"&&n!=="style")&&(u=yr(u,e.labelCfg));var v=this.getLabelStyleByPosition(e,u,o),p=(i=e.labelCfg)===null||i===void 0?void 0:i.style,g=B(B({},v),p),y=g.rotate;if(delete g.rotate,!isNaN(y)&&y!==""){var m=[1,0,0,0,1,0,0,0,1];m=ru(m,[["t",-g.x,-g.y],["r",y],["t",g.x,g.y]]),g.matrix=m,l.attr(g)}else((a=l.getMatrix())===null||a===void 0?void 0:a[4])!==1&&l.resetMatrix(),l.attr(g);if(!h)g.background&&(h=this.drawLabelBg(e,o,l),h.set("classname",c),o.shapeMap[c]=h,l.toFront());else if(g.background){var b=this.getLabelBgStyleByPosition(l,u);h.attr(b)}else o.removeChild(h)}else{var d=this.drawLabel(e,o);d.set("className",f),o.shapeMap[f]=d}},afterUpdate:function(e,t){},setState:function(e,t,n){var i,a,o,s=n.get("keyShape");if(!(!s||s.destroyed)){var u=n.getType(),f=$l(t)?e:"".concat(e,":").concat(t),l=this.getStateStyle(f,n),c=n.getStateStyle(f);if(!(!c&&!l)){var h=yt({},c||l),d=n.getContainer(),v={x:1,y:1,cx:1,cy:1,matrix:1};if(u==="combo"&&(v.r=1,v.width=1,v.height=1),t){var p=function(D){var $,Y=h[D];if(pn(Y)&&!lh.includes(D)){var N=((o=d.shapeMap)===null||o===void 0?void 0:o[D])||d.find(function(P){return P.get("name")===D});N==null||N.attr(Y)}else s.attr(($={},$[D]=Y,$))};for(var g in h)p(g)}else{var y=td(n.getCurrentStatesStyle()),m=n.getModel(),b=yt({},m.style,td(n.getOriginStyle())),x=s.get("name"),w=s.attr(),E={};Object.keys(w).forEach(function(F){if(F!=="img"){var D=w[F];D&&ry(D)==="object"?E[F]=Vt(D):E[F]=D}});var _={},M=function(D){var $=h[D];if(pn($)&&!lh.includes(D)){var Y=d.shapeMap[D]||d.find(function(W){return W.get("name")===D});if(Y){var N=td(Y.attr());me($,function(W,J){if(D===x&&E[J]&&!v[J]){delete E[J];var te=b[D][J]||ch[u][J];s.attr(J,te)}else if(N[J]||N[J]===0){delete N[J];var H=b[D][J]||ch[u][J];Y.attr(J,H)}}),_[D]=N}}else if(E[D]&&!v[D]){delete E[D];var P=b[D]||(b[x]?b[x][D]:void 0)||ch[u][D];s.attr(D,P)}};for(var C in h)M(C);x?_[x]=E:yt(_,E);for(var g in y)if(!v[g]){var S=y[g];(!pn(S)||lh.includes(g))&&(x?(yt(b[x],(a={},a[g]=S,a)),delete b[g]):yt(b,(i={},i[g]=S,i)),delete y[g])}var A={};yr(A,b,_,y);var T=!1,k=function(D){var $,Y,N=A[D];if(pn(N)&&!lh.includes(D)){var P=d.shapeMap[D]||d.find(function(J){return J.get("name")===D});P&&((P.get("type")==="text"||P.get("labelRelated"))&&(delete N.x,delete N.y,delete N.matrix),D===x&&(u==="combo"&&(delete N.r,delete N.width,delete N.height),T=!0),P.attr(N))}else if(!T){var W=N||ch[u][D];u==="combo"?x||s.attr(($={},$[D]=W,$)):s.attr((Y={},Y[D]=W,Y))}};for(var O in A)k(O)}}}},getStateStyle:function(e,t){var n=t.getModel(),i=t.getType(),a=this.getOptions(n),o=a.stateStyles,s=a.style,u=s===void 0?{}:s,f=n.stateStyles?n.stateStyles[e]:o&&o[e];return i==="combo"?Vt(f):yt({},u,f)},getControlPoints:function(e){return e.controlPoints},getAnchorPoints:function(e){var t,n,i=(e==null?void 0:e.anchorPoints)||((t=this.getCustomConfig(e))===null||t===void 0?void 0:t.anchorPoints)||((n=this.options)===null||n===void 0?void 0:n.anchorPoints);return i}},rU={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:lt.nodeLabel.offset,getSize:function(e){var t,n=((t=this.mergeStyle)===null||t===void 0?void 0:t.size)||e.size||this.getOptions({}).size||lt.defaultNode.size;return pt(n)&&n.length===1&&(n=[n[0],n[0]]),pt(n)||(n=[n,n]),n},getLabelStyleByPosition:function(e,t){var n=t.maxLength,i=e.label;n&&(i=kT(i,n));var a=t.position||this.labelPosition;if(a==="center")return{x:0,y:0,text:i,textBaseline:"middle",textAlign:"center"};var o=t.offset;ct(o)&&(o=this.offset);var s=this.getSize(e),u;switch(a){case"top":u={x:0,y:-s[1]/2-o,textBaseline:"bottom",textAlign:"center"};break;case"bottom":u={x:0,y:s[1]/2+o,textBaseline:"top",textAlign:"center"};break;case"left":u={x:-s[0]/2-o,y:0,textBaseline:"middle",textAlign:"right"};break;default:u={x:s[0]/2+o,y:0,textBaseline:"middle",textAlign:"left"};break}return u.text=i,u},getLabelBgStyleByPosition:function(e,t){var n;if(!e)return{};var i=(n=t.style)===null||n===void 0?void 0:n.background;if(!i)return{};var a=e.getBBox(),o=Km(i.padding),s=a.width+o[1]+o[3],u=a.height+o[0]+o[2];return B(B({x:a.minX-o[3],y:a.minY-o[0]},i),{width:s,height:u})},drawShape:function(e,t){var n=this.shapeType,i=this.getShapeStyle(e),a=t.addShape(n,{attrs:i,draggable:!0,name:"node-shape"});return t.shapeMap["node-shape"]=a,a},updateLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=t.shapeMap["link-point-left"]||t.find(function(A){return A.get("className")==="link-point-left"}),a=t.shapeMap["link-point-right"]||t.find(function(A){return A.get("className")==="link-point-right"}),o=t.shapeMap["link-point-top"]||t.find(function(A){return A.get("className")==="link-point-top"}),s=t.shapeMap["link-point-bottom"]||t.find(function(A){return A.get("className")==="link-point-bottom"}),u;i&&(u=i.attr()),a&&!u&&(u=a.attr()),o&&!u&&(u=o.attr()),s&&!u&&(u=s.attr()),u||(u=n);var f=yt({},u,e.linkPoints),l=f.fill,c=f.stroke,h=f.lineWidth,d=f.size/2;d||(d=f.r);var v=e.linkPoints?e.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},p=v.left,g=v.right,y=v.top,m=v.bottom,b=this.getSize(e),x=b[0],w=b[1],E={r:d,fill:l,stroke:c,lineWidth:h};if(i)!p&&p!==void 0?(i.remove(),delete t.shapeMap["link-point-left"]):i.attr(B(B({},E),{x:-x/2,y:0}));else if(p){var _="link-point-left";t.shapeMap[_]=t.addShape("circle",{attrs:B(B({},E),{x:-x/2,y:0}),className:_,name:_,isAnchorPoint:!0})}if(a)!g&&g!==void 0&&(a.remove(),delete t.shapeMap["link-point-right"]),a.attr(B(B({},E),{x:x/2,y:0}));else if(g){var M="link-point-right";t.shapeMap[M]=t.addShape("circle",{attrs:B(B({},E),{x:x/2,y:0}),className:M,name:M,isAnchorPoint:!0})}if(o)!y&&y!==void 0&&(o.remove(),delete t.shapeMap["link-point-top"]),o.attr(B(B({},E),{x:0,y:-w/2}));else if(y){var C="link-point-top";t.shapeMap[C]=t.addShape("circle",{attrs:B(B({},E),{x:0,y:-w/2}),className:C,name:C,isAnchorPoint:!0})}if(s)!m&&m!==void 0?(s.remove(),delete t.shapeMap["link-point-bottom"]):s.attr(B(B({},E),{x:0,y:w/2}));else if(m){var S="link-point-bottom";t.shapeMap[S]=t.addShape("circle",{attrs:B(B({},E),{x:0,y:w/2}),className:S,name:S,isAnchorPoint:!0})}},updateShape:function(e,t,n,i,a){var o=t.get("keyShape");o.attr(B({},n)),this.updateLabel(e,t,a),i&&this.updateIcon(e,t)},updateIcon:function(e,t){var n=this,i=t.getContainer(),a=(this.mergeStyle||this.getOptions(e)).icon,o=e.icon?e.icon:{show:void 0,text:void 0},s=o.show,u=o.text,f=i.shapeMap["".concat(this.type,"-icon")]||i.find(function(y){return y.get("name")==="".concat(n.type,"-icon")});if(f)if(s||s===void 0){var l=yt({},f.attr(),a),c=l.width,h=c===void 0?20:c,d=l.height,v=d===void 0?20:d;(l.fontFamily==="iconfont"||l.hasOwnProperty("text"))&&(h=0,v=0),f.attr(B(B({},l),{x:-h/2,y:-v/2}))}else f.remove(),delete i.shapeMap["".concat(this.type,"-icon")];else if(s){var p="".concat(this.type,"-icon");if(u)i.shapeMap[p]=i.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},a),className:p,name:p});else{var h=a.width,v=a.height;i.shapeMap[p]=i.addShape("image",{attrs:B(B({},a),{x:-h/2,y:-v/2}),className:p,name:p})}var g=i.shapeMap["node-label"]||i.find(function(y){return y.get("name")==="node-label"});g&&g.toFront()}}},nU=B(B({},Jm),rU);mr.registerNode("single-node",nU);var hh="edge-shape";function iU(r){var e=r;return r==="start"?e="end":r==="end"&&(e="start"),e}var aU={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:lt.defaultEdge.size,style:{x:0,y:0,stroke:lt.defaultEdge.style.stroke,lineAppendWidth:lt.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:lt.edgeLabel.style.fill,fontSize:lt.edgeLabel.style.fontSize,fontFamily:lt.windowFontFamily}},stateStyles:B({},lt.edgeStateStyles)},getPath:function(e){var t=[];return me(e,function(n,i){i===0?t.push(["M",n.x,n.y]):t.push(["L",n.x,n.y])}),t},getShapeStyle:function(e){var t=this.options.style,n={stroke:e.color},i=yt({},t,n,e.style),a=e.size||lt.defaultEdge.size;e=this.getPathPoints(e);var o=e.startPoint,s=e.endPoint,u=this.getControlPoints(e),f=[o];u&&(f=f.concat(u)),f.push(s);var l=this.getPath(f),c=yt({},lt.defaultEdge.style,{stroke:lt.defaultEdge.color,lineWidth:a,path:l},i);return c},updateShapeStyle:function(e,t,n){var i,a=t.getContainer(),o=((i=t.getKeyShape)===null||i===void 0?void 0:i.call(t))||a.shapeMap["edge-shape"],s=e.size;e=this.getPathPoints(e);var u=e.startPoint,f=e.endPoint,l=this.getControlPoints(e),c=[u];l&&(c=c.concat(l)),c.push(f);var h=o.attr(),d=e.style||{};d.stroke===void 0&&(d.stroke=e.color);var v=e.sourceNode,p=e.targetNode,g={radius:d.radius};l||(g={source:v,target:p,offset:d.offset,radius:d.radius});var y=this.getPath(c,g),m={};n==="move"?m={path:y}:(h.endArrow&&d.endArrow===!1&&(e.style.endArrow={path:""}),h.startArrow&&d.startArrow===!1&&(e.style.startArrow={path:""}),m=B({},e.style),m.lineWidth===void 0&&(m.lineWidth=(ht(s)?s:s==null?void 0:s[0])||h.lineWidth),m.path===void 0&&(m.path=y),m.stroke===void 0&&(m.stroke=h.stroke||e.color)),o&&o.attr(m)},getLabelStyleByPosition:function(e,t,n){var i=t.position||this.labelPosition,a={},o=n==null?void 0:n.shapeMap[hh],s;i==="start"?s=0:i==="end"?s=1:s=.5;var u=t.refX||this.refX,f=t.refY||this.refY;if(e.startPoint.x===e.endPoint.x&&e.startPoint.y===e.endPoint.y)return a.x=e.startPoint.x+u,a.y=e.startPoint.y+f,a.text=e.label,a;var l;ct(t.autoRotate)?l=this.labelAutoRotate:l=t.autoRotate;var c=AT(o,s,u,f,l);return a.x=c.x,a.y=c.y,a.rotate=c.rotate,a.textAlign=this._getTextAlign(i,c.angle),a.text=e.label,a},getLabelBgStyleByPosition:function(e,t){if(!e)return{};var n=e.getBBox(),i=t.style&&t.style.background;if(!i)return{};var a=i.padding,o=n.width+a[1]+a[3],s=n.height+a[0]+a[2],u=B(B({},i),{width:o,height:s,x:n.minX-a[3],y:n.minY-a[0],matrix:[1,0,0,0,1,0,0,0,1]}),f;return ct(t.autoRotate)?f=this.labelAutoRotate:f=t.autoRotate,f&&(u.matrix=e.attr("matrix")||[1,0,0,0,1,0,0,0,1]),u},_getTextAlign:function(e,t){var n="center";return t?(t=t%(Math.PI*2),e!=="center"&&(t>=0&&t<=Math.PI/2||t>=3/2*Math.PI&&t<2*Math.PI?n=e:n=iU(e)),n):e},getControlPoints:function(e){return e.controlPoints},getPathPoints:function(e){return e},drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("path",{className:hh,name:hh,attrs:n});return t.shapeMap[hh]=i,i},drawLabel:function(e,t){var n=this.options.labelCfg,i=yr({},n,e.labelCfg),a=this.getLabelStyle(e,i,t),o=a.rotate;delete a.rotate;var s=t.addShape("text",{attrs:a,name:"text-shape",labelRelated:!0,draggable:!0});if(t.shapeMap["text-shape"]=s,!isNaN(o)&&o!==""&&s.rotateAtStart(o),a.background){var u=this.drawLabelBg(e,t,s,a,o),f=this.itemType+ny;u.set("classname",f),t.shapeMap[f]=u,s.toFront()}return s},drawLabelBg:function(e,t,n,i,a){var o=this.options.labelCfg,s=yr({},o,e.labelCfg),u=this.getLabelBgStyleByPosition(n,s),f=t.addShape("rect",{name:"text-bg-shape",attrs:u,labelRelated:!0});return t.shapeMap["text-bg-shape"]=f,f}},oU=B(B({},Jm),aU);mr.registerEdge("single-edge",oU);mr.registerEdge("line",{getControlPoints:function(){}},"single-edge");mr.registerEdge("spline",{getPath:function(e){var t=OI(e);return t}},"single-edge");mr.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(e){var t=e.startPoint,n=e.endPoint,i={x:(t.x+n.x)/2,y:(t.y+n.y)/2},a,o;if(e.controlPoints!==void 0){if(o=e.controlPoints[0],a=M0(t,o,n),t.x<=n.x&&t.y>n.y?this.clockwise=a.x>o.x?0:1:t.x<=n.x&&t.y<n.y?this.clockwise=a.x>o.x?1:0:t.x>n.x&&t.y<=n.y?this.clockwise=a.y<o.y?0:1:this.clockwise=a.y<o.y?1:0,(o.x-t.x)/(o.y-t.y)===(n.x-t.x)/(n.y-t.y))return[]}else{e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),pt(e.curveOffset)&&(e.curveOffset=e.curveOffset[0]),e.curveOffset<0?this.clockwise=0:this.clockwise=1;var s={x:n.x-t.x,y:n.y-t.y},u=Math.atan2(s.y,s.x);o={x:e.curveOffset*Math.cos(-Math.PI/2+u)+i.x,y:e.curveOffset*Math.sin(-Math.PI/2+u)+i.y},a=M0(t,o,n)}var f=Cd(t,a),l=[{x:f,y:f}];return l},getPath:function(e){var t=[];return t.push(["M",e[0].x,e[0].y]),e.length===2?t.push(["L",e[1].x,e[1].y]):t.push(["A",e[1].x,e[1].y,0,0,this.clockwise,e[2].x,e[2].y]),t}},"single-edge");mr.registerEdge("quadratic",{curvePosition:.5,curveOffset:-20,getControlPoints:function(e){var t=e.controlPoints;if(!t||!t.length){var n=e.startPoint,i=e.endPoint;e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),pt(e.curveOffset)&&(e.curveOffset=e.curveOffset[0]),pt(e.curvePosition)&&(e.curvePosition=e.curveOffset[0]);var a=Dd(n,i,e.curvePosition,e.curveOffset);t=[a]}return t},getPath:function(e){var t=[];return t.push(["M",e[0].x,e[0].y]),t.push(["Q",e[1].x,e[1].y,e[2].x,e[2].y]),t}},"single-edge");mr.registerEdge("cubic",{curvePosition:[1/2,1/2],curveOffset:[-20,20],getControlPoints:function(e){var t=e.controlPoints;if(e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),ht(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),ht(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]),!t||!t.length||t.length<2){var n=e.startPoint,i=e.endPoint,a=Dd(n,i,e.curvePosition[0],e.curveOffset[0]),o=Dd(n,i,e.curvePosition[1],e.curveOffset[1]);t=[a,o]}return t},getPath:function(e){var t=[];return t.push(["M",e[0].x,e[0].y]),t.push(["C",e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y]),t}},"single-edge");mr.registerEdge("cubic-vertical",{curvePosition:[1/2,1/2],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(e){var t=e.startPoint,n=e.endPoint;e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.minCurveOffset===void 0&&(e.minCurveOffset=this.minCurveOffset),ht(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),ht(e.minCurveOffset)&&(e.minCurveOffset=[e.minCurveOffset,-e.minCurveOffset]),ht(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]);var i=n.y-t.y,a=[0,0];e.curveOffset?a=e.curveOffset:Math.abs(i)<Math.abs(e.minCurveOffset[0])&&(a=e.minCurveOffset);var o={x:t.x,y:t.y+i*this.curvePosition[0]+a[0]},s={x:n.x,y:n.y-i*this.curvePosition[1]+a[1]};return[o,s]}},"cubic");mr.registerEdge("cubic-horizontal",{curvePosition:[1/2,1/2],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(e){var t=e.startPoint,n=e.endPoint;e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.minCurveOffset===void 0&&(e.minCurveOffset=this.minCurveOffset),ht(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),ht(e.minCurveOffset)&&(e.minCurveOffset=[e.minCurveOffset,-e.minCurveOffset]),ht(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]);var i=n.x-t.x,a=[0,0];e.curveOffset?a=e.curveOffset:Math.abs(i)<Math.abs(e.minCurveOffset[0])&&(a=e.minCurveOffset);var o={x:t.x+i*this.curvePosition[0]+a[0],y:t.y},s={x:n.x-i*this.curvePosition[1]+a[1],y:n.y},u=[o,s];return u}},"cubic");mr.registerEdge("loop",{getPathPoints:function(e){return CT(e)},getControlPoints:function(e){return e.controlPoints},afterDraw:function(e){e.controlPoints=void 0},afterUpdate:function(e){e.controlPoints=void 0}},"cubic");var sU={itemType:"combo",shapeType:"single-combo",labelPosition:"top",refX:lt.comboLabel.refX,refY:lt.comboLabel.refY,options:{style:{stroke:lt.defaultCombo.style.stroke,fill:lt.defaultCombo.style.fill,lineWidth:lt.defaultCombo.style.lineWidth},labelCfg:{style:{fill:lt.comboLabel.style.fill,fontSize:lt.comboLabel.style.fontSize,fontFamily:lt.windowFontFamily}},stateStyles:B({},lt.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},getSize:function(e){var t=Vt(e.size||this.options.size||lt.defaultCombo.size);return pt(t)&&t.length===1&&(t=[t[0],t[0]]),pt(t)||(t=[t,t]),t},getLabelStyleByPosition:function(e,t){var n=t.position||this.labelPosition,i=e.style,a=e.padding||this.options.padding;pt(a)&&(a=Math.max.apply(Math,a));var o=t.refX,s=t.refY;ct(o)&&(o=this.refX),ct(s)&&(s=this.refY);var u=this.getSize(e),f=Math.max(i.r,u[0]/2)||u[0]/2,l=f+a,c;switch(n){case"top":c={x:0,y:-l-s,textBaseline:"bottom",textAlign:"center"};break;case"bottom":c={x:0,y:l+s,textBaseline:"bottom",textAlign:"center"};break;case"left":c={x:-l+o,y:0,textAlign:"left"};break;case"center":c={x:0,y:0,text:e.label,textAlign:"center"};break;default:c={x:l+o,y:0,textAlign:"right"};break}return c.text=e.label,c},drawShape:function(e,t){var n=this.shapeType,i=this.getShapeStyle(e),a=t.addShape(n,{attrs:i,draggable:!0,name:"combo-shape"});return a},updateCollapsedIcon:function(e,t,n){var i=e.collapsed,a=e.collapsedSubstituteIcon,o=a===void 0?{}:a,s=Object.assign({},this.options.collapsedSubstituteIcon,o),u=s.show,f=s.img,l=s.width,c=s.height,h=t.getContainer(),d=h.find(function(y){return y.get("name")==="combo-collapsed-substitute-icon"}),v=d&&!d.destroyed,p=t.get("keyShape");if(i&&u){if(v)d.show();else{var g={width:l||n.r*2||n.width,height:c||n.r*2||n.height};d=h.addShape("image",{attrs:B({img:f,x:-g.width/2,y:-g.height/2},g),name:"combo-collapsed-substitute-icon",draggable:!0})}p.hide()}else v&&(d.hide(),p.show())},updateShape:function(e,t,n){var i=this,a=t.get("keyShape"),o=t.get("animate"),s=o&&(e.animate===void 0?this.options.animate:e.animate);s&&a.animate?(e.collapsed||this.updateCollapsedIcon(e,t,n),a.animate(n,{duration:200,easing:"easeLinear",callback:function(){e.collapsed&&i.updateCollapsedIcon(e,t,n)}})):(a.attr(B({},n)),this.updateCollapsedIcon(e,t,n)),this.updateLabel(e,t)}},uU=B(B({},Jm),sU);mr.registerCombo("single-combo",uU);mr.registerCombo("circle",{options:{size:[lt.defaultCombo.size[0],lt.defaultCombo.size[0]],padding:Math.max.apply(Math,lt.defaultCombo.padding),animate:!0,style:{stroke:lt.defaultCombo.style.stroke,fill:lt.defaultCombo.style.fill,lineWidth:lt.defaultCombo.style.lineWidth},labelCfg:{style:{fill:lt.comboLabel.style.fill,fontSize:lt.comboLabel.style.fontSize},refX:0,refY:0},stateStyles:B({},lt.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},shapeType:"circle",labelPosition:"top",drawShape:function(e,t){var n=this.getShapeStyle(e);delete n.height,delete n.width;var i=t.addShape("circle",{attrs:n,className:"circle-combo",name:"circle-combo",draggable:!0});return i},getShapeStyle:function(e){var t=this.options.style,n=e.padding||this.options.padding;pt(n)&&(n=Math.max.apply(Math,n));var i={stroke:e.color},a=yt({},t,i,e.style),o=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize,s;if(o)s=ht(o)?o/2:o[0]/2;else{var u=this.getSize(e);!ht(a.r)||isNaN(a.r)?s=u[0]/2||lt.defaultCombo.style.r:s=Math.max(a.r,u[0]/2)||u[0]/2}a.r=s+n;var f=B({x:0,y:0},a);return e.style?e.style.r=s:e.style={r:s},f},update:function(e,t){var n=this.getSize(e),i=e.padding||this.options.padding;pt(i)&&(i=Math.max.apply(Math,i));var a=Vt(e.style),o=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize,s;o?s=ht(o)?o/2:o[0]/2:s=Math.max(a.r,n[0]/2)||n[0]/2,a.r=s+i;var u=t.get("sizeCache");u&&(u.r=a.r);var f={stroke:e.color},l=t.get("keyShape"),c=yt({},l.attr(),f,a);e.style?e.style.r=s:e.style={r:s},this.updateShape(e,t,c,!0)}},"single-combo");mr.registerCombo("rect",{options:{size:[40,5],padding:[25,20,15,20],animate:!0,style:{radius:0,stroke:lt.defaultCombo.style.stroke,fill:lt.defaultCombo.style.fill,lineWidth:lt.defaultCombo.style.lineWidth},labelCfg:{style:{fill:lt.comboLabel.style.fill,fontSize:lt.comboLabel.style.fontSize,fontFamily:lt.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:B({},lt.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},shapeType:"rect",labelPosition:"top",drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("rect",{attrs:n,className:"rect-combo",name:"rect-combo",draggable:!0});return i},getLabelStyleByPosition:function(e,t){var n=t.position||this.labelPosition,i=e.style,a=e.padding||this.options.padding;ht(a)&&(a=[a,a,a,a]);var o=t.refX,s=t.refY;ct(o)&&(o=this.refX),ct(s)&&(s=this.refY);var u=-i.width/2-a[3],f=i.width/2+a[1],l=-i.height/2-a[0],c=i.height/2+a[2],h;switch(n){case"top":h={x:u+o,y:l+s,textBaseline:"top",textAlign:"left"};break;case"bottom":h={x:0,y:c+s,textBaseline:"top",textAlign:"center"};break;case"left":h={x:u+s,y:0,textAlign:"left"};break;case"center":h={x:0,y:0,text:e.label,textAlign:"center"};break;case"top-center":h={x:0,y:l+s,textBaseline:"top",textAlign:"center"};break;default:h={x:f+o,y:0,textAlign:"right"};break}return h.text=e.label,h},getShapeStyle:function(e){var t=this.options.style,n=e.padding||this.options.padding;ht(n)&&(n=[n,n,n,n]);var i={stroke:e.color},a=yt({},t,i,e.style),o=this.getSize(e),s,u,f=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize;f?ht(f)?(s=f,u=f):(s=f[0],u=f[1]):(!ht(a.width)||isNaN(a.width)?s=o[0]||lt.defaultCombo.style.width:s=Math.max(a.width,o[0])||o[0],!ht(a.height)||isNaN(a.height)?u=o[1]||lt.defaultCombo.style.height:u=Math.max(a.height,o[1])||o[1]);var l=-s/2-n[3],c=-u/2-n[0];a.width=s+n[1]+n[3],a.height=u+n[0]+n[2];var h=B({x:l,y:c},a);return e.style?(e.style.width=s,e.style.height=u):e.style={width:s,height:u},h},update:function(e,t){var n=this.getSize(e),i=e.padding||this.options.padding;ht(i)&&(i=[i,i,i,i]);var a=Vt(e.style),o,s,u=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize;u?ht(u)?(o=u,s=u):(o=u[0],s=u[1]):(o=Math.max(a.width,n[0])||n[0],s=Math.max(a.height,n[1])||n[1]),a.width=o+i[1]+i[3],a.height=s+i[0]+i[2];var f=t.get("sizeCache");f&&(f.width=a.width,f.height=a.height),a.x=-o/2-i[3],a.y=-s/2-i[0];var l={stroke:e.color},c=t.get("keyShape"),h=yt({},c.attr(),l,a);e.style?(e.style.width=o,e.style.height=s):e.style={width:o,height:s},this.updateShape(e,t,h,!1)}},"single-combo");mr.registerNode("simple-circle",{options:{size:lt.defaultNode.size,style:{x:0,y:0,stroke:lt.defaultNode.style.stroke,fill:lt.defaultNode.style.fill,lineWidth:lt.defaultNode.style.lineWidth},labelCfg:{style:{fill:lt.nodeLabel.style.fill,fontSize:lt.nodeLabel.style.fontSize,fontFamily:lt.windowFontFamily}},stateStyles:B({},lt.nodeStateStyles)},shapeType:"simple-circle",labelPosition:"center",shapeMap:{},drawShape:function(e,t){var n=this.getShapeStyle(e),i="".concat(this.type,"-keyShape"),a=t.addShape("circle",{attrs:n,className:"".concat(this.type,"-keyShape"),name:i,draggable:!0});return t.shapeMap[i]=a,a},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=yr({},t,n),a=this.getSize(e),o=a[0]/2,s=B({x:0,y:0,r:o},i);return s},update:function(e,t,n){var i=this.getSize(e),a={stroke:e.color,r:i[0]/2},o=t.get("keyShape"),s=yr({},o.attr(),a,e.style);this.updateShape(e,t,s,!0,n)}},"single-node");mr.registerNode("simple-rect",{options:{size:[100,30],style:{radius:0,stroke:lt.defaultNode.style.stroke,fill:lt.defaultNode.style.fill,lineWidth:lt.defaultNode.style.lineWidth},labelCfg:{style:{fill:lt.nodeLabel.style.fill,fontSize:lt.nodeLabel.style.fontSize,fontFamily:lt.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:B({},lt.nodeStateStyles)},shapeType:"simple-rect",labelPosition:"center",drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return i},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=yt({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=B({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(e,t,n){t.getContainer();var i=(this.mergeStyle||this.getOptions(e)).style,a=this.getSize(e),o=t.get("keyShape");e.size||(a[0]=o.attr("width")||i.width,a[1]=o.attr("height")||i.height);var s={stroke:e.color,x:-a[0]/2,y:-a[1]/2,width:a[0],height:a[1]},u=yt({},i,o.attr(),s);u=yt(u,e.style),this.updateShape(e,t,u,!1,n)}},"single-node");mr.registerNode("image",{options:{img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*eD7nT6tmYgAAAAAAAAAAAABkARQnAQ",size:200,labelCfg:{style:{fontFamily:lt.windowFontFamily}},clipCfg:{show:!1,type:"circle",r:50,rx:50,ry:35,width:50,height:35,points:[[30,12],[12,30],[30,48],[48,30]],path:[["M",25,25],["L",50,25],["A",12.5,12.5,0,1,1,50,50],["A",12.5,12.5,0,1,0,50,50],["L",25,75],["Z"]],x:0,y:0}},shapeType:"image",labelPosition:"bottom",drawShape:function(e,t){var n=this.shapeType,i=this.getShapeStyle(e);delete i.fill;var a=t.addShape(n,{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return this.drawClip(e,a),a},drawClip:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).clipCfg;if(n.show){var i=n.type,a=n.x,o=n.y,s=n.style;if(i==="circle"){var u=n.r;t.setClip({type:"circle",attrs:B({r:u,x:a,y:o},s)})}else if(i==="rect"){var f=n.width,l=n.height,c=a-f/2,h=o-l/2;t.setClip({type:"rect",attrs:B({x:c,y:h,width:f,height:l},s)})}else if(i==="ellipse"){var d=n.rx,v=n.ry;t.setClip({type:"ellipse",attrs:B({x:a,y:o,rx:d,ry:v},s)})}else if(i==="polygon"){var p=n.points;t.setClip({type:"polygon",attrs:B({points:p},s)})}else if(i==="path"){var g=n.path;t.setClip({type:"path",attrs:B({path:g},s)})}}},getShapeStyle:function(e){var t=this.mergeStyle||this.getOptions(e),n=t.style,i=t.img,a=this.getSize(e),o=a[0],s=a[1];n&&(o=n.width||a[0],s=n.height||a[1]);var u=B({x:-o/2,y:-s/2,width:o,height:s,img:i},n);return u},updateShapeStyle:function(e,t){var n=t.getContainer(),i="".concat(this.itemType,"-shape"),a=n.shapeMap[i]||n.find(function(s){return s.get("className")===i})||t.getKeyShape(),o=this.getShapeStyle(e);a&&!a.destroyed&&a.attr(o)}},"single-node");const FI={triangle:function(e,t,n){e===void 0&&(e=10),t===void 0&&(t=15),n===void 0&&(n=0);var i=n*2,a="M ".concat(i,",0 L ").concat(i+t,",-").concat(e/2," L ").concat(i+t,",").concat(e/2," Z");return a},vee:function(e,t,n){e===void 0&&(e=15),t===void 0&&(t=20),n===void 0&&(n=0);var i=n*2,a="M ".concat(i,",0 L ").concat(i+t,",-").concat(e/2,`
|
|
7
|
-
L `).concat(i+2*t/3,",0 L ").concat(i+t,",").concat(e/2," Z");return a},circle:function(e,t){e===void 0&&(e=5),t===void 0&&(t=0);var n=t*2,i="M ".concat(n,`, 0
|
|
8
|
-
a `).concat(e,",").concat(e," 0 1,0 ").concat(e*2,`,0
|
|
9
|
-
a `).concat(e,",").concat(e," 0 1,0 ").concat(-e*2,",0");return i},rect:function(e,t,n){e===void 0&&(e=10),t===void 0&&(t=10),n===void 0&&(n=0);var i=n*2,a="M ".concat(i,",").concat(-e/2,`
|
|
10
|
-
L `).concat(i+t,",").concat(-e/2,`
|
|
11
|
-
L `).concat(i+t,",").concat(e/2,`
|
|
12
|
-
L `).concat(i,",").concat(e/2," Z");return a},diamond:function(e,t,n){e===void 0&&(e=15),t===void 0&&(t=15),n===void 0&&(n=0);var i=n*2,a="M ".concat(i,`,0
|
|
13
|
-
L `).concat(i+t/2,",").concat(-e/2,`
|
|
14
|
-
L `).concat(i+t,`,0
|
|
15
|
-
L `).concat(i+t/2,",").concat(e/2," Z");return a},triangleRect:function(e,t,n,i,a,o){e===void 0&&(e=15),t===void 0&&(t=15),n===void 0&&(n=15),i===void 0&&(i=3),a===void 0&&(a=5),o===void 0&&(o=0);var s=o*2,u=s+t+a,f="M ".concat(s,",0 L ").concat(s+t,",-").concat(e/2," L ").concat(s+t,",").concat(e/2,` Z
|
|
16
|
-
M `).concat(u,", -").concat(n/2,`
|
|
17
|
-
L `).concat(u+i," -").concat(n/2,`
|
|
18
|
-
L `).concat(u+i," ").concat(n/2,`
|
|
19
|
-
L `).concat(u," ").concat(n/2,`
|
|
20
|
-
Z`);return f}},GI={collapse:function(e,t,n){return[["M",e-n,t],["a",n,n,0,1,0,n*2,0],["a",n,n,0,1,0,-n*2,0],["M",e-n+4,t],["L",e+n-4,t]]},expand:function(e,t,n){return[["M",e-n,t],["a",n,n,0,1,0,n*2,0],["a",n,n,0,1,0,-n*2,0],["M",e-n+4,t],["L",e-n+2*n-4,t],["M",e-n+n,t-n+4],["L",e,t+n-4]]},upTriangle:function(e,t,n){var i=n*Math.cos(Math.PI/6),a=n*Math.sin(Math.PI/6);return[["M",e-i,t+a],["L",e+i,t+a],["L",e,t-n],["Z"]]},downTriangle:function(e,t,n){var i=n*Math.cos(Math.PI/6),a=n*Math.sin(Math.PI/6);return[["M",e-i,t-a],["L",e+i,t-a],["L",e,t+n],["Z"]]}};var fU=["#5F95FF","#61DDAA","#65789B","#F6BD16","#7262FD","#78D3F8","#9661BC","#F6903D","#008685","#F08BB4"];const lU=Object.freeze(Object.defineProperty({__proto__:null,defaultSubjectColors:fU},Symbol.toStringTag,{value:"Module"}));var zI=function(e){return e==="force"||e==="g6force"||e==="gForce"||e==="force2"};const cU=Object.freeze(Object.defineProperty({__proto__:null,isForce:zI},Symbol.toStringTag,{value:"Module"}));var hU=yi,_n=B(B(B(B(B(B(B({},Mj),Yz),Xj),Rz),lU),cU),{transform:hU,mat3:zC}),$I=function(){function r(e){this.graph=e,this.layoutCfg=e.get("layout")||{},this.layoutType=this.getLayoutType(),this.layoutMethods=[],this.initLayout()}return r.prototype.initLayout=function(){},r.prototype.getLayoutType=function(){return this.getLayoutCfgType(this.layoutCfg)},r.prototype.getLayoutCfgType=function(e){var t=e.type;if(t)return t;var n=e.pipes;return Array.isArray(n)?n.map(function(i){return(i==null?void 0:i.type)||""}):null},r.prototype.isLayoutTypeSame=function(e){var t=this.getLayoutCfgType(e),n=Array.isArray(this.layoutType),i=Array.isArray(t);return n&&i?this.layoutType.every(function(a,o){return a===t[o]}):Array.isArray(t)||Array.isArray(this.layoutType)?!1:(e==null?void 0:e.type)===this.layoutType},r.prototype.refreshLayout=function(){var e=this,t=e.graph,n=e.layoutType,i=e.layoutCfg,a=i===void 0?{}:i;if(t){var o=a.animate,s=o===void 0&&(n==="force"||n==="force2"),u=zI(n)&&(o||s);t.get("animate")&&!u?t.positionsAnimate(n==="comboCombined"):t.refreshPositions(n==="comboCombined")}},r.prototype.changeLayout=function(e){var t=e.disableTriggerLayout,n=nn(e,["disableTriggerLayout"]);this.layoutCfg=n,this.layoutType=n.type||this.layoutType,!t&&this.layout()},r.prototype.changeData=function(e){this.layout(e)},r.prototype.destoryLayoutMethods=function(){var e=this.layoutMethods,t=[];return e==null||e.forEach(function(n){var i,a=(i=n.getType)===null||i===void 0?void 0:i.call(n);a&&t.push(a),n.destroy()}),this.layoutMethods=[],t},r.prototype.destroyLayout=function(){this.destoryLayoutMethods();var e=this.graph;e&&!e.get("destroyed")&&e.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0},r.prototype.setDataFromGraph=function(){for(var e,t=[],n=[],i=[],a=[],o=[],s=[],u=[],f=this.graph.getNodes(),l=this.graph.getEdges(),c=this.graph.getCombos(),h=f.length,d=0;d<h;d++){var v=f[d];if(!(!v||v.destroyed)){var p=v.getModel();if(!v.isVisible()){n.push(p);continue}t.push(p)}}for(var g=l.length,d=0;d<g;d++){var y=l[d];if(!(!y||y.destroyed)){var p=y.getModel();if(!y.isVisible()){a.push(p);continue}p.isComboEdge?o.push(p):i.push(p)}}for(var m=c.length,d=0;d<m;d++){var b=c[d];if(!b.destroyed){var p=b.getModel();if(!b.isVisible()){u.push(p);continue}s.push(p)}}return{nodes:t,hiddenNodes:n,edges:i,hiddenEdges:a,combos:s,hiddenCombos:u,comboEdges:o,vedges:(e=this.graph.get("vedges"))===null||e===void 0?void 0:e.map(function(x){return x.getModel()})}},r.prototype.relayout=function(e){var t=this,n=this,i=n.graph,a=n.layoutMethods,o=n.layoutCfg;if(!(!i||i.get("destroyed"))){var s=Promise.resolve();if(e){this.data=this.setDataFromGraph();var u=this.data.nodes;if(!u)return!1;s=this.initPositions(o.center,u)}i.emit("beforelayout"),a==null||a.forEach(function(f,l){var c=o[l]||o;s=s.then(function(){var h,d=t.execLayoutMethod(c,l);return l===a.length-1&&((h=o.onAllLayoutEnd)===null||h===void 0||h.call(o)),d})})}},r.prototype.filterLayoutData=function(e,t){var n=e.nodes,i=e.edges,a=nn(e,["nodes","edges"]);if(!n)return e;var o,s;Mr(t==null?void 0:t.nodesFilter)?o=t.nodesFilter:o=function(){return!0};var u=n.filter(o);if(Mr(t==null?void 0:t.edgesFilter))s=t.edgesFilter;else{var f=u.reduce(function(l,c){return l[c.id]=!0,l},{});s=function(c){return f[c.source]&&f[c.target]}}return B({nodes:u,edges:i.filter(s)},a)},r.prototype.getLayoutBBox=function(e){var t=this.graph,n=wd(t.getNodes(),function(o){return o.getModel().layoutOrder}),i=Object.values(n).map(function(o){var s=EI(o);return s.size=[s.width,s.height],s}),a=Object.values(wd(e,"layoutOrder"));return{groupNodes:a,layoutNodes:i}},r.prototype.layoutAnimate=function(){},r.prototype.moveToZero=function(){var e=this.graph,t=e.get("data"),n=t.nodes;if(!(n[0].x===void 0||n[0].x===null||Ji(n[0].x))){for(var i=[0,0],a=n.length,o=0;o<a;o++){var s=n[o];i[0]+=s.x,i[1]+=s.y}i[0]/=n.length,i[1]/=n.length;for(var o=0;o<a;o++){var s=n[o];s.x-=i[0],s.y-=i[1]}}},r.prototype.initPositions=function(e,t){var n;return Wn(this,void 0,void 0,function(){var i,a,o;return Vn(this,function(s){return i=this.graph,t!=null&&t.length?(a=t.filter(function(u){return Ji(u.x)||Ji(u.y)}),o=a?a.length:0,o?[2,(n=this.initWithPreset)===null||n===void 0?void 0:n.call(this,function(){},function(){var u=i.get("width")*.85,f=i.get("height")*.85,l=Math.ceil(Math.sqrt(o)*(u/f)),c=Math.ceil(o/l),h=u/(l-1),d=f/(c-1);(!isFinite(h)||!h)&&(h=0),(!isFinite(d)||!h)&&(d=0);for(var v=e[0]-u/2,p=e[1]-f/2,g=0;g<o;g++){var y=a[g];Ji(+y.x)&&(y.x=g%l*h+v),Ji(+y.y)&&(y.y=Math.floor(g/l)*d+p)}})]:[2]):[2,Promise.resolve()]})})},r.prototype.destroy=function(){this.graph=null,this.destoryLayoutMethods(),this.destroyed=!0},r}(),jI=function(){function r(e){this.graph=e,this.destroyed=!1,this.initEvents()}return r}(),Xa=mr.registerNode,UI=mr.registerEdge,dU=mr.registerCombo,XI=gm.registerBehavior,Qe=lt;lt.version,mr.registerNode,mr.registerEdge,mr.registerCombo,gm.registerBehavior;var e1={},Kt={},Sv={},To={};Object.defineProperty(To,"__esModule",{value:!0});To.MESSAGE=To.ALGORITHM=void 0;var vU={pageRank:"pageRank",breadthFirstSearch:"breadthFirstSearch",connectedComponent:"connectedComponent",depthFirstSearch:"depthFirstSearch",detectCycle:"detectCycle",detectDirectedCycle:"detectDirectedCycle",detectAllCycles:"detectAllCycles",detectAllDirectedCycle:"detectAllDirectedCycle",detectAllUndirectedCycle:"detectAllUndirectedCycle",dijkstra:"dijkstra",findAllPath:"findAllPath",findShortestPath:"findShortestPath",floydWarshall:"floydWarshall",getAdjMatrix:"getAdjMatrix",getDegree:"getDegree",getInDegree:"getInDegree",getNeighbors:"getNeighbors",getOutDegree:"getOutDegree",labelPropagation:"labelPropagation",louvain:"louvain",GADDI:"GADDI",minimumSpanningTree:"minimumSpanningTree",SUCCESS:"SUCCESS",FAILURE:"FAILURE"};To.ALGORITHM=vU;var pU={SUCCESS:"SUCCESS",FAILURE:"FAILURE"};To.MESSAGE=pU;var Mv={},YI={},Os={};Object.defineProperty(Os,"__esModule",{value:!0});Os.default=void 0;var gU=function(e,t){var n=e.nodes,i=e.edges,a=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var f=[];a.push(f)}),i&&i.forEach(function(s){var u=s.source,f=s.target,l=o[u],c=o[f];!l&&l!==0||!c&&c!==0||(a[l][c]=1,t||(a[c][l]=1))}),a},yU=gU;Os.default=yU;var Cv={},Av={},Pu={};Object.defineProperty(Pu,"__esModule",{value:!0});Pu.default=Pu.LinkedListNode=void 0;var mU=function(e,t){return e===t},iy=function(){function r(e,t){t===void 0&&(t=null),this.value=e,this.next=t}return r.prototype.toString=function(e){return e?e(this.value):"".concat(this.value)},r}();Pu.LinkedListNode=iy;var bU=function(){function r(e){e===void 0&&(e=mU),this.head=null,this.tail=null,this.compare=e}return r.prototype.prepend=function(e){var t=new iy(e,this.head);return this.head=t,this.tail||(this.tail=t),this},r.prototype.append=function(e){var t=new iy(e);return this.head?(this.tail.next=t,this.tail=t,this):(this.head=t,this.tail=t,this)},r.prototype.delete=function(e){if(!this.head)return null;for(var t=null;this.head&&this.compare(this.head.value,e);)t=this.head,this.head=this.head.next;var n=this.head;if(n!==null)for(;n.next;)this.compare(n.next.value,e)?(t=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,e)&&(this.tail=n),t},r.prototype.find=function(e){var t=e.value,n=t===void 0?void 0:t,i=e.callback,a=i===void 0?void 0:i;if(!this.head)return null;for(var o=this.head;o;){if(a&&a(o.value)||n!==void 0&&this.compare(o.value,n))return o;o=o.next}return null},r.prototype.deleteTail=function(){var e=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,e;for(var t=this.head;t.next;)t.next.next?t=t.next:t.next=null;return this.tail=t,e},r.prototype.deleteHead=function(){if(!this.head)return null;var e=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),e},r.prototype.fromArray=function(e){var t=this;return e.forEach(function(n){return t.append(n)}),this},r.prototype.toArray=function(){for(var e=[],t=this.head;t;)e.push(t),t=t.next;return e},r.prototype.reverse=function(){for(var e=this.head,t=null,n=null;e;)n=e.next,e.next=t,t=e,e=n;this.tail=this.head,this.head=t},r.prototype.toString=function(e){return e===void 0&&(e=void 0),this.toArray().map(function(t){return t.toString(e)}).toString()},r}(),xU=bU;Pu.default=xU;Object.defineProperty(Av,"__esModule",{value:!0});Av.default=void 0;var wU=EU(Pu);function EU(r){return r&&r.__esModule?r:{default:r}}var _U=function(){function r(){this.linkedList=new wU.default}return r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},r.prototype.enqueue=function(e){this.linkedList.append(e)},r.prototype.dequeue=function(){var e=this.linkedList.deleteHead();return e?e.value:null},r.prototype.toString=function(e){return this.linkedList.toString(e)},r}(),SU=_U;Av.default=SU;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.uniqueId=Qr.getOutEdgesNodeId=Qr.getNeighbors=Qr.getEdgesByNodeId=void 0;var MU=function(e,t,n){t===void 0&&(t=[]);var i=t.filter(function(u){return u.source===e||u.target===e});if(n==="target"){var a=function(f){return f.source===e};return i.filter(a).map(function(u){return u.target})}if(n==="source"){var o=function(f){return f.target===e};return i.filter(o).map(function(u){return u.source})}var s=function(f){return f.source===e?f.target:f.source};return i.map(s)};Qr.getNeighbors=MU;var CU=function(e,t){return t.filter(function(n){return n.source===e})};Qr.getOutEdgesNodeId=CU;var AU=function(e,t){return t.filter(function(n){return n.source===e||n.target===e})};Qr.getEdgesByNodeId=AU;var TU=function(e){e===void 0&&(e=0);var t="".concat(Math.random()).split(".")[1].substr(0,5),n="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(e,"-").concat(t).concat(n)};Qr.uniqueId=TU;Object.defineProperty(Cv,"__esModule",{value:!0});Cv.default=void 0;var IU=LU(Av),kU=Qr;function LU(r){return r&&r.__esModule?r:{default:r}}function NU(r){r===void 0&&(r={});var e=r,t=function(){},n=function(){var i={};return function(a){var o=a.next,s=o;return i[s]?!1:(i[s]=!0,!0)}}();return e.allowTraversal=r.allowTraversal||n,e.enter=r.enter||t,e.leave=r.leave||t,e}var OU=function(e,t,n,i){i===void 0&&(i=!0);var a=NU(n),o=new IU.default,s=e.edges,u=s===void 0?[]:s;o.enqueue(t);for(var f="",l=function(){var h=o.dequeue();a.enter({current:h,previous:f}),(0,kU.getNeighbors)(h,u,i?"target":void 0).forEach(function(d){a.allowTraversal({previous:f,current:h,next:d})&&o.enqueue(d)}),a.leave({current:h,previous:f}),f=h};!o.isEmpty();)l()},DU=OU;Cv.default=DU;var Io={};Object.defineProperty(Io,"__esModule",{value:!0});Io.default=PU;Io.detectStrongConnectComponents=Io.detectConnectedComponents=void 0;var WI=Qr,VI=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,o=[],s={},u=[],f=function d(v){u.push(v),s[v.id]=!0;for(var p=(0,WI.getNeighbors)(v.id,a),g=function(b){var x=p[b];if(!s[x]){var w=n.filter(function(E){return E.id===x});w.length>0&&d(w[0])}},y=0;y<p.length;++y)g(y)},l=0;l<n.length;l++){var c=n[l];if(!s[c.id]){f(c);for(var h=[];u.length>0;)h.push(u.pop());o.push(h)}}return o};Io.detectConnectedComponents=VI;var HI=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,o=[],s={},u={},f={},l=[],c=0,h=function g(y){u[y.id]=c,f[y.id]=c,c+=1,o.push(y),s[y.id]=!0;for(var m=(0,WI.getNeighbors)(y.id,a,"target").filter(function(_){return n.map(function(M){return M.id}).indexOf(_)>-1}),b=function(M){var C=m[M];if(!u[C]&&u[C]!==0){var S=n.filter(function(A){return A.id===C});S.length>0&&g(S[0]),f[y.id]=Math.min(f[y.id],f[C])}else s[C]&&(f[y.id]=Math.min(f[y.id],u[C]))},x=0;x<m.length;x++)b(x);if(f[y.id]===u[y.id]){for(var w=[];o.length>0;){var E=o.pop();if(s[E.id]=!1,w.push(E),E===y)break}w.length>0&&l.push(w)}},d=0,v=n;d<v.length;d++){var p=v[d];!u[p.id]&&u[p.id]!==0&&h(p)}return l};Io.detectStrongConnectComponents=HI;function PU(r,e){return e?HI(r):VI(r)}var za={};Object.defineProperty(za,"__esModule",{value:!0});za.getOutDegree=za.getInDegree=za.default=void 0;var Al=function(e){var t={},n=e.nodes,i=n===void 0?[]:n,a=e.edges,o=a===void 0?[]:a;return i.forEach(function(s){t[s.id]={degree:0,inDegree:0,outDegree:0}}),o.forEach(function(s){t[s.source].degree++,t[s.source].outDegree++,t[s.target].degree++,t[s.target].inDegree++}),t},RU=Al;za.default=RU;var BU=function(e,t){var n=Al(e);return n[t]?Al(e)[t].inDegree:0};za.getInDegree=BU;var FU=function(e,t){var n=Al(e);return n[t]?Al(e)[t].outDegree:0};za.getOutDegree=FU;var ra={},Tv={};Object.defineProperty(Tv,"__esModule",{value:!0});Tv.default=$U;var GU=Qr;function zU(r){r===void 0&&(r={});var e=r,t=function(){},n=function(){var i={};return function(a){var o=a.next;return i[o]?!1:(i[o]=!0,!0)}}();return e.allowTraversal=r.allowTraversal||n,e.enter=r.enter||t,e.leave=r.leave||t,e}function qI(r,e,t,n,i){i===void 0&&(i=!0),n.enter({current:e,previous:t});var a=r.edges,o=a===void 0?[]:a;(0,GU.getNeighbors)(e,o,i?"target":void 0).forEach(function(s){n.allowTraversal({previous:t,current:e,next:s})&&qI(r,s,e,n,i)}),n.leave({current:e,previous:t})}function $U(r,e,t,n){n===void 0&&(n=!0),qI(r,e,"",zU(t),n)}function ay(r){"@babel/helpers - typeof";return ay=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ay(r)}Object.defineProperty(ra,"__esModule",{value:!0});ra.detectAllUndirectedCycle=ra.detectAllDirectedCycle=ra.detectAllCycles=ra.default=void 0;var jU=XU(Tv),ZI=UU(Io),KI=Qr;function QI(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(QI=function(i){return i?t:e})(r)}function UU(r,e){if(r&&r.__esModule)return r;if(r===null||ay(r)!=="object"&&typeof r!="function")return{default:r};var t=QI(e);if(t&&t.has(r))return t.get(r);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in r)if(a!=="default"&&Object.prototype.hasOwnProperty.call(r,a)){var o=i?Object.getOwnPropertyDescriptor(r,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=r[a]}return n.default=r,t&&t.set(r,n),n}function XU(r){return r&&r.__esModule?r:{default:r}}var YU=function(e){var t=null,n=e.nodes,i=n===void 0?[]:n,a={},o={},s={},u={};i.forEach(function(c){o[c.id]=c});for(var f={enter:function(h){var d=h.current,v=h.previous;if(s[d]){t={};for(var p=d,g=v;g!==d;)t[p]=g,p=g,g=a[g];t[p]=g}else s[d]=d,delete o[d],a[d]=v},leave:function(h){var d=h.current;u[d]=d,delete s[d]},allowTraversal:function(h){var d=h.next;return t?!1:!u[d]}};Object.keys(o).length;){var l=Object.keys(o)[0];(0,jU.default)(e,l,f)}return t},JI=function(e,t,n){var i,a;n===void 0&&(n=!0);for(var o=[],s=(0,ZI.default)(e,!1),u=0,f=s;u<f.length;u++){var l=f[u];if(l.length)for(var c=l[0],h=c.id,d=[c],v=(i={},i[h]=c,i),p=(a={},a[h]=new Set,a);d.length>0;)for(var g=d.pop(),y=g.id,m=(0,KI.getNeighbors)(y,e.edges),b=function(E){var _,M=m[E],C=e.nodes.find(function(F){return F.id===M});if(M===y)o.push((_={},_[M]=g,_));else if(!(M in p))v[M]=g,d.push(C),p[M]=new Set([g]);else if(!p[y].has(C)){for(var S=!0,A=[C,g],T=v[y];p[M].size&&!p[M].has(T)&&(A.push(T),T!==v[T.id]);)T=v[T.id];if(A.push(T),t&&n?(S=!1,A.findIndex(function(F){return t.indexOf(F.id)>-1})>-1&&(S=!0)):t&&!n&&A.findIndex(function(F){return t.indexOf(F.id)>-1})>-1&&(S=!1),S){for(var k={},O=1;O<A.length;O+=1)k[A[O-1].id]=A[O];A.length&&(k[A[A.length-1].id]=A[0]),o.push(k)}p[M].add(g)}},x=0;x<m.length;x+=1)b(x)}return o};ra.detectAllUndirectedCycle=JI;var ek=function(e,t,n){n===void 0&&(n=!0);for(var i=[],a=new Set,o=[],s=[],u={},f={},l=function(T){for(var k=[T];k.length>0;){var O=k.pop();a.has(O)&&(a.delete(O),o[O.id].forEach(function(F){k.push(F)}),o[O.id].clear())}},c=function A(T,k,O){var F=!1;if(t&&n===!1&&t.indexOf(T.id)>-1)return F;i.push(T),a.add(T);for(var D=O[T.id],$=0;$<D.length;$+=1){var Y=u[D[$]];if(Y===k){for(var N={},P=1;P<i.length;P+=1)N[i[P-1].id]=i[P];i.length&&(N[i[i.length-1].id]=i[0]),s.push(N),F=!0}else a.has(Y)||A(Y,k,O)&&(F=!0)}if(F)l(T);else for(var $=0;$<D.length;$+=1){var Y=u[D[$]];o[Y.id].has(T)||o[Y.id].add(T)}return i.pop(),F},h=e.nodes,d=h===void 0?[]:h,v=0;v<d.length;v+=1){var p=d[v],g=p.id;f[g]=v,u[v]=p}if(t&&n)for(var y=function(T){var k=t[T];f[d[T].id]=f[k],f[k]=0,u[0]=d.find(function(O){return O.id===k}),u[f[d[T].id]]=d[T]},v=0;v<t.length;v++)y(v);for(var m=function(T){for(var k,O,F=1/0,D=0;D<T.length;D+=1)for(var $=T[D],Y=0;Y<$.length;Y++){var N=f[$[Y].id];N<F&&(F=N,O=D)}for(var P=T[O],W=[],D=0;D<P.length;D+=1){var J=P[D];W[J.id]=[];for(var te=0,H=(0,KI.getNeighbors)(J.id,e.edges,"target").filter(function(Ne){return P.map(function(Ze){return Ze.id}).indexOf(Ne)>-1});te<H.length;te++){var pe=H[te];pe===J.id&&!(n===!1&&t.indexOf(J.id)>-1)?s.push((k={},k[J.id]=J,k)):W[J.id].push(f[pe])}}return{component:P,adjList:W,minIdx:F}},b=0;b<d.length;){var x=d.filter(function(A){return f[A.id]>=b}),w=(0,ZI.detectStrongConnectComponents)({nodes:x,edges:e.edges}).filter(function(A){return A.length>1});if(w.length===0)break;var E=m(w),_=E.minIdx,M=E.adjList,C=E.component;if(C.length>1){C.forEach(function(A){o[A.id]=new Set});var S=u[_];if(t&&n&&t.indexOf(S.id)===-1)return s;c(S,S,M),b=_+1}else break}return s};ra.detectAllDirectedCycle=ek;var WU=function(e,t,n,i){return i===void 0&&(i=!0),t?ek(e,n,i):JI(e,n,i)};ra.detectAllCycles=WU;var VU=YU;ra.default=VU;var Qu={};const tk=va(G5),Xl=va(KR);Object.defineProperty(Qu,"__esModule",{value:!0});Qu.default=void 0;var JE=tk,HU=Xl,e2=Qr,qU=function(e,t,n){for(var i=1/0,a,o=0;o<t.length;o++){var s=t[o].id;!n[s]&&e[s]<=i&&(i=e[s],a=t[o])}return a},ZU=function(e,t,n,i){var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,f={},l={},c={};o.forEach(function(m,b){var x=m.id;l[x]=1/0,x===t&&(l[x]=0)});for(var h=o.length,d=function(b){var x=qU(l,o,f),w=x.id;if(f[w]=!0,l[w]===1/0)return"continue";var E=[];n?E=(0,e2.getOutEdgesNodeId)(w,u):E=(0,e2.getEdgesByNodeId)(w,u),E.forEach(function(_){var M=_.target,C=_.source,S=M===w?C:M,A=i&&_[i]?_[i]:1;l[S]>l[x.id]+A?(l[S]=l[x.id]+A,c[S]=[x.id]):l[S]===l[x.id]+A&&c[S].push(x.id)})},v=0;v<h;v++)d();c[t]=[t];var p={};for(var g in l)l[g]!==1/0&&rk(t,g,c,p);var y={};for(var g in p)y[g]=p[g][0];return{length:l,path:y,allPath:p}},KU=ZU;Qu.default=KU;function rk(r,e,t,n){if(r===e)return[r];if(n[e])return n[e];for(var i=[],a=0,o=t[e];a<o.length;a++){var s=o[a],u=rk(r,s,t,n);if(!u)return;for(var f=0,l=u;f<l.length;f++){var c=l[f];(0,HU.isArray)(c)?i.push((0,JE.__spreadArray)((0,JE.__spreadArray)([],c,!0),[e],!1)):i.push([c,e])}}return n[e]=i,n[e]}var Ru={};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.findShortestPath=Ru.findAllPath=void 0;var QU=JU(Qu),dh=Qr;function JU(r){return r&&r.__esModule?r:{default:r}}var e9=function(e,t,n,i,a){var o=(0,QU.default)(e,t,i,a),s=o.length,u=o.path,f=o.allPath;return{length:s[n],path:u[n],allPath:f[n]}};Ru.findShortestPath=e9;var t9=function(e,t,n,i){var a;if(t===n)return[[t]];var o=e.edges,s=o===void 0?[]:o,u=[t],f=(a={},a[t]=!0,a),l=[],c=[],h=i?(0,dh.getNeighbors)(t,s,"target"):(0,dh.getNeighbors)(t,s);for(l.push(h);u.length>0&&l.length>0;){var d=l[l.length-1];if(d.length){var v=d.shift();v&&(u.push(v),f[v]=!0,h=i?(0,dh.getNeighbors)(v,s,"target"):(0,dh.getNeighbors)(v,s),l.push(h.filter(function(y){return!f[y]})))}else{var p=u.pop();f[p]=!1,l.pop();continue}if(u[u.length-1]===n){var g=u.map(function(m){return m});c.push(g);var p=u.pop();f[p]=!1,l.pop()}}return c};Ru.findAllPath=t9;var Yl={};Object.defineProperty(Yl,"__esModule",{value:!0});Yl.default=void 0;var r9=n9(Os);function n9(r){return r&&r.__esModule?r:{default:r}}var i9=function(e,t){for(var n=(0,r9.default)(e,t),i=[],a=n.length,o=0;o<a;o+=1){i[o]=[];for(var s=0;s<a;s+=1)o===s?i[o][s]=0:n[o][s]===0||!n[o][s]?i[o][s]=1/0:i[o][s]=n[o][s]}for(var u=0;u<a;u+=1)for(var o=0;o<a;o+=1)for(var s=0;s<a;s+=1)i[o][s]>i[o][u]+i[u][s]&&(i[o][s]=i[o][u]+i[u][s]);return i},a9=i9;Yl.default=a9;var Iv={};Object.defineProperty(Iv,"__esModule",{value:!0});Iv.default=void 0;var o9=u9(Os),s9=Qr;function u9(r){return r&&r.__esModule?r:{default:r}}var f9=function(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e3);var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,f={},l={};o.forEach(function(b,x){var w=(0,s9.uniqueId)();b.clusterId=w,f[w]={id:w,nodes:[b]},l[b.id]={node:b,idx:x}});var c=(0,o9.default)(e,t),h={};c.forEach(function(b,x){var w=o[x].id;h[w]={},b.forEach(function(E,_){if(E){var M=o[_].id;h[w][M]=E}})});for(var d=0,v=function(){var x=!1;if(o.forEach(function(w){var E={};Object.keys(h[w.id]).forEach(function(O){var F=h[w.id][O],D=l[O].node,$=D.clusterId;E[$]||(E[$]=0),E[$]+=F});var _=-1/0,M=[];if(Object.keys(E).forEach(function(O){_<E[O]?(_=E[O],M=[O]):_===E[O]&&M.push(O)}),!(M.length===1&&M[0]===w.clusterId)){var C=M.indexOf(w.clusterId);if(C>=0&&M.splice(C,1),M&&M.length){x=!0;var S=f[w.clusterId],A=S.nodes.indexOf(w);S.nodes.splice(A,1);var T=Math.floor(Math.random()*M.length),k=f[M[T]];k.nodes.push(w),w.clusterId=k.id}}}),!x)return"break";d++};d<i;){var p=v();if(p==="break")break}Object.keys(f).forEach(function(b){var x=f[b];(!x.nodes||!x.nodes.length)&&delete f[b]});var g=[],y={};u.forEach(function(b){var x=b.source,w=b.target,E=b[n]||1,_=l[x].node.clusterId,M=l[w].node.clusterId,C="".concat(_,"---").concat(M);if(y[C])y[C].weight+=E,y[C].count++;else{var S={source:_,target:M,weight:E,count:1};y[C]=S,g.push(S)}});var m=[];return Object.keys(f).forEach(function(b){m.push(f[b])}),{clusters:m,clusterEdges:g}},l9=f9;Iv.default=l9;var kv={},Wl={};Object.defineProperty(Wl,"__esModule",{value:!0});Wl.default=void 0;var c9=Xl,h9=function(){function r(e){this.arr=e}return r.prototype.getArr=function(){return this.arr||[]},r.prototype.add=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length))return new r(n);if(!(n!=null&&n.length))return new r(this.arr);if(this.arr.length===n.length){var i=[];for(var a in this.arr)i[a]=this.arr[a]+n[a];return new r(i)}},r.prototype.subtract=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length))return new r(n);if(!(n!=null&&n.length))return new r(this.arr);if(this.arr.length===n.length){var i=[];for(var a in this.arr)i[a]=this.arr[a]-n[a];return new r(i)}},r.prototype.avg=function(e){var t=[];if(e!==0)for(var n in this.arr)t[n]=this.arr[n]/e;return new r(t)},r.prototype.negate=function(){var e=[];for(var t in this.arr)e[t]=-this.arr[t];return new r(e)},r.prototype.squareEuclideanDistance=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var i=0;for(var a in this.arr)i+=Math.pow(this.arr[a]-e.arr[a],2);return i}},r.prototype.euclideanDistance=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var i=0;for(var a in this.arr)i+=Math.pow(this.arr[a]-e.arr[a],2);return Math.sqrt(i)}else console.error("The two vectors are unequal in length.")},r.prototype.normalize=function(){var e=[],t=(0,c9.clone)(this.arr);t.sort(function(o,s){return o-s});var n=t[t.length-1],i=t[0];for(var a in this.arr)e[a]=(this.arr[a]-i)/(n-i);return new r(e)},r.prototype.norm2=function(){var e;if(!(!((e=this.arr)===null||e===void 0)&&e.length))return 0;var t=0;for(var n in this.arr)t+=Math.pow(this.arr[n],2);return Math.sqrt(t)},r.prototype.dot=function(e){var t,n=e.arr;if(!(!((t=this.arr)===null||t===void 0)&&t.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var i=0;for(var a in this.arr)i+=this.arr[a]*e.arr[a];return i}else console.error("The two vectors are unequal in length.")},r.prototype.equal=function(e){var t,n=e.arr;if(((t=this.arr)===null||t===void 0?void 0:t.length)!==(n==null?void 0:n.length))return!1;for(var i in this.arr)if(this.arr[i]!==n[i])return!1;return!0},r}(),d9=h9;Wl.default=d9;var na={},Bu={};Object.defineProperty(Bu,"__esModule",{value:!0});Bu.secondReg=Bu.dateReg=void 0;var v9=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/;Bu.secondReg=v9;var p9=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;Bu.dateReg=p9;Object.defineProperty(na,"__esModule",{value:!0});na.getPropertyWeight=na.getAllSortProperties=na.getAllProperties=na.default=void 0;var t2=Bu,t1=function(e,t){e===void 0&&(e=[]),t===void 0&&(t=100);var n={};e.forEach(function(a){a.properties&&Object.keys(a.properties).forEach(function(o){if(o==="id"||!"".concat(a.properties[o]).match(t2.secondReg)&&!"".concat(a.properties[o]).match(t2.dateReg)&&isNaN(Number(a.properties[o]))){n.hasOwnProperty(o)&&delete n[o];return}n.hasOwnProperty(o)?n[o]+=1:n[o]=1})});var i=Object.keys(n).sort(function(a,o){return n[o]-n[a]});return i.length<t?i:i.slice(0,t)};na.getAllSortProperties=t1;var g9=function(e,t){return t.map(function(n){return e.hasOwnProperty(n)?e[n]:0})},nk=function(e){for(var t=t1(e),n=[],i=0;i<e.length;i++)n[i]=g9(e[i].properties,t);return n};na.getPropertyWeight=nk;var ik=function(e,t){t===void 0&&(t=void 0);var n=[];return e.forEach(function(i){t===void 0&&n.push(i),i[t]!==void 0&&n.push(i[t])}),n};na.getAllProperties=ik;var y9={getAllSortProperties:t1,getPropertyWeight:nk,getAllProperties:ik};na.default=y9;var ia={},Vl={};Object.defineProperty(Vl,"__esModule",{value:!0});Vl.DistanceType=void 0;var oy;Vl.DistanceType=oy;(function(r){r.EuclideanDistance="euclideanDistance"})(oy||(Vl.DistanceType=oy={}));Object.defineProperty(ia,"__esModule",{value:!0});ia.oneHot=ia.getDistance=ia.getAllKeyValueMap=ia.default=void 0;var r2=Xl,n2=Vl,i2=m9(Wl);function m9(r){return r&&r.__esModule?r:{default:r}}var r1=function(e,t,n){var i=[];t!=null&&t.length?i=t:(e.forEach(function(o){i=i.concat(Object.keys(o))}),i=(0,r2.uniq)(i));var a={};return i.forEach(function(o){var s=[];e.forEach(function(u){u[o]!==void 0&&u[o]!==""&&s.push(u[o])}),s.length&&!(n!=null&&n.includes(o))&&(a[o]=(0,r2.uniq)(s))}),a};ia.getAllKeyValueMap=r1;var ak=function(e,t,n){var i=r1(e,t,n),a=[];if(!Object.keys(i).length)return a;var o=Object.values(i),s=o.every(function(u){return u.every(function(f){return typeof f=="number"})});return e.forEach(function(u,f){var l=[];Object.keys(i).forEach(function(c){var h=u[c],d=i[c],v=d.findIndex(function(y){return h===y}),p=[];if(s)p.push(h);else for(var g=0;g<d.length;g++)g===v?p.push(1):p.push(0);l=l.concat(p)}),a[f]=l}),a};ia.oneHot=ak;var ok=function(e,t,n,i){n===void 0&&(n=n2.DistanceType.EuclideanDistance);var a=0;switch(n){case n2.DistanceType.EuclideanDistance:a=new i2.default(e).euclideanDistance(new i2.default(t));break}return a};ia.getDistance=ok;var b9={getAllKeyValueMap:r1,oneHot:ak,getDistance:ok};ia.default=b9;Object.defineProperty(kv,"__esModule",{value:!0});kv.default=void 0;var x9=Xl,w9=sk(Os),If=sk(Wl),E9=na,_9=ia;function sk(r){return r&&r.__esModule?r:{default:r}}var a2=function(e,t,n,i){for(var a=t.length,o=2*i,s=0,u=0;u<a;u++)for(var f=e[u].clusterId,l=0;l<a;l++){var c=e[l].clusterId;if(f===c){var h=t[u][l]||0,d=n[u]||0,v=n[l]||0;s+=h-d*v/o}}return s*=1/o,s},Cg=function(e,t){e===void 0&&(e=[]);for(var n=e.length,i=new If.default([]),a=0;a<n;a++)i=i.add(new If.default(t[a]));var o=i.avg(n);o.normalize();for(var s=0,a=0;a<n;a++){var u=new If.default(t[a]),f=u.squareEuclideanDistance(o);s+=f}var l=[];e.forEach(function(){l.push([])});for(var a=0;a<n;a++){var u=new If.default(t[a]);e[a].clusterInertial=0;for(var c=0;c<n;c++){if(a===c){l[a][c]=0;continue}var h=new If.default(t[c]);l[a][c]=u.squareEuclideanDistance(h),e[a].clusterInertial+=l[a][c]}}for(var d=0,v=2*n*s,a=0;a<n;a++)for(var p=e[a].clusterId,c=0;c<n;c++){var g=e[c].clusterId;if(!(a===c||p!==g)){var y=e[a].clusterInertial*e[c].clusterInertial/Math.pow(v,2)-l[a][c]/v;d+=y}}return Number(d.toFixed(4))},S9=function(e,t,n,i,a,o,s,u,f){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e-4),a===void 0&&(a=!1),o===void 0&&(o=void 0),s===void 0&&(s=[]),u===void 0&&(u=["id"]),f===void 0&&(f=1);var l=e.nodes,c=l===void 0?[]:l,h=e.edges,d=h===void 0?[]:h,v=[];if(a){c.forEach(function(N,P){N.properties=N.properties||{},N.originIndex=P});var p=[];c.every(function(N){return N.hasOwnProperty("nodeType")})&&(p=Array.from(new Set(c.map(function(N){return N.nodeType}))),c.forEach(function(N){N.properties.nodeType=p.findIndex(function(P){return P===N.nodeType})}));var g=(0,E9.getAllProperties)(c,o);v=(0,_9.oneHot)(g,s,u)}var y=1,m={},b={};c.forEach(function(N,P){var W=String(y++);N.clusterId=W,m[W]={id:W,nodes:[N]},b[N.id]={node:N,idx:P}});var x=(0,w9.default)(e,t),w=[],E={},_=0;x.forEach(function(N,P){var W=0,J=c[P].id;E[J]={},N.forEach(function(te,H){if(te){W+=te;var pe=c[H].id;E[J][pe]=te,_+=te}}),w.push(W)}),_/=2;for(var M=1/0,C=1/0,S=0,A=[],T={};;){a&&c.every(function(N){return N.hasOwnProperty("properties")})?M=a2(c,x,w,_)+Cg(c,v)*f:M=a2(c,x,w,_),S===0&&(C=M,A=c,T=m);var k=M>0&&M>C&&M-C<i;if(M>C&&(A=c.map(function(N){return{node:N,clusterId:N.clusterId}}),T=(0,x9.clone)(m),C=M),k||S>100)break;S++,Object.keys(m).forEach(function(N){var P=0;d.forEach(function(W){var J=W.source,te=W.target,H=b[J].node.clusterId,pe=b[te].node.clusterId;(H===N&&pe!==N||pe===N&&H!==N)&&(P=P+(W[n]||1))}),m[N].sumTot=P}),c.forEach(function(N,P){var W=m[N.clusterId],J=0,te,H=w[P]/(2*_),pe=0,Te=W.nodes;Te.forEach(function(Yt){var dr=b[Yt.id].idx;pe+=x[P][dr]||0});var Ne=pe-W.sumTot*H,Ze=Te.filter(function(Yt){return Yt.id!==N.id});Ze.forEach(function(Yt,dr){v[Yt.originIndex]});var at=Cg(Ze,v)*f,nt=E[N.id];if(Object.keys(nt).forEach(function(Yt){var dr=b[Yt].node,lr=dr.clusterId;if(lr!==N.clusterId){var jt=m[lr],ir=jt.nodes;if(!(!ir||!ir.length)){var Hr=0;ir.forEach(function(Ge){var ye=b[Ge.id].idx;Hr+=x[P][ye]||0});var tt=Hr-jt.sumTot*H,ae=ir.concat([N]);ae.forEach(function(Ge,ye){v[Ge.originIndex]});var L=Cg(ae,v)*f,Se=tt-Ne;a&&(Se=tt+L-(Ne+at)),Se>J&&(J=Se,te=jt)}}}),J>0){te.nodes.push(N);var _t=N.clusterId;N.clusterId=te.id;var St=W.nodes.indexOf(N);W.nodes.splice(St,1);var fr=0,Ft=0;d.forEach(function(Yt){var dr=Yt.source,lr=Yt.target,jt=b[dr].node.clusterId,ir=b[lr].node.clusterId;(jt===te.id&&ir!==te.id||ir===te.id&&jt!==te.id)&&(fr=fr+(Yt[n]||1)),(jt===_t&&ir!==_t||ir===_t&&jt!==_t)&&(Ft=Ft+(Yt[n]||1))}),te.sumTot=fr,W.sumTot=Ft}})}var O={},F=0;Object.keys(T).forEach(function(N){var P=T[N];if(!P.nodes||!P.nodes.length){delete T[N];return}var W=String(F+1);W!==N&&(P.id=W,P.nodes=P.nodes.map(function(J){return{id:J.id,clusterId:W}}),T[W]=P,O[N]=W,delete T[N],F++)}),A.forEach(function(N){var P=N.node,W=N.clusterId;P&&(P.clusterId=W,P.clusterId&&O[P.clusterId]&&(P.clusterId=O[P.clusterId]))});var D=[],$={};d.forEach(function(N){var P=N.source,W=N.target,J=N[n]||1,te=b[P].node.clusterId,H=b[W].node.clusterId;if(!(!te||!H)){var pe="".concat(te,"---").concat(H);if($[pe])$[pe].weight+=J,$[pe].count++;else{var Te={source:te,target:H,weight:J,count:1};$[pe]=Te,D.push(Te)}}});var Y=[];return Object.keys(T).forEach(function(N){Y.push(T[N])}),{clusters:Y,clusterEdges:D}},M9=S9;kv.default=M9;var Lv={},Nv={};Object.defineProperty(Nv,"__esModule",{value:!0});Nv.default=void 0;var C9=function(){function r(e){this.count=e.length,this.parent={};for(var t=0,n=e;t<n.length;t++){var i=n[t];this.parent[i]=i}}return r.prototype.find=function(e){for(;this.parent[e]!==e;)e=this.parent[e];return e},r.prototype.union=function(e,t){var n=this.find(e),i=this.find(t);n!==i&&(n<i?(this.parent[t]!==t&&this.union(this.parent[t],e),this.parent[t]=this.parent[e]):(this.parent[e]!==e&&this.union(this.parent[e],t),this.parent[e]=this.parent[t]))},r.prototype.connected=function(e,t){return this.find(e)===this.find(t)},r}(),A9=C9;Nv.default=A9;var Ov={};Object.defineProperty(Ov,"__esModule",{value:!0});Ov.default=void 0;var T9=function(e,t){return e-t},I9=function(){function r(e){e===void 0&&(e=T9),this.compareFn=e,this.list=[]}return r.prototype.getLeft=function(e){return 2*e+1},r.prototype.getRight=function(e){return 2*e+2},r.prototype.getParent=function(e){return e===0?null:Math.floor((e-1)/2)},r.prototype.isEmpty=function(){return this.list.length<=0},r.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},r.prototype.delMin=function(){var e=this.top(),t=this.list.pop();return this.list.length>0&&(this.list[0]=t,this.moveDown(0)),e},r.prototype.insert=function(e){if(e!==null){this.list.push(e);var t=this.list.length-1;return this.moveUp(t),!0}return!1},r.prototype.moveUp=function(e){for(var t=this.getParent(e);e&&e>0&&this.compareFn(this.list[t],this.list[e])>0;){var n=this.list[t];this.list[t]=this.list[e],this.list[e]=n,e=t,t=this.getParent(e)}},r.prototype.moveDown=function(e){var t,n=e,i=this.getLeft(e),a=this.getRight(e),o=this.list.length;i!==null&&i<o&&this.compareFn(this.list[n],this.list[i])>0?n=i:a!==null&&a<o&&this.compareFn(this.list[n],this.list[a])>0&&(n=a),e!==n&&(t=[this.list[n],this.list[e]],this.list[e]=t[0],this.list[n]=t[1],this.moveDown(n))},r}(),k9=I9;Ov.default=k9;Object.defineProperty(Lv,"__esModule",{value:!0});Lv.default=void 0;var L9=uk(Nv),N9=uk(Ov),Ag=Qr;function uk(r){return r&&r.__esModule?r:{default:r}}var O9=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=a[0],f=new Set;f.add(u);var l=function(g,y){return t?g.weight-y.weight:0},c=new N9.default(l);for((0,Ag.getEdgesByNodeId)(u.id,s).forEach(function(p){c.insert(p)});!c.isEmpty();){var h=c.delMin(),d=h.source,v=h.target;f.has(d)&&f.has(v)||(n.push(h),f.has(d)||(f.add(d),(0,Ag.getEdgesByNodeId)(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),(0,Ag.getEdgesByNodeId)(v,s).forEach(function(p){c.insert(p)})))}return n},o2=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=s.map(function(d){return d});t&&u.sort(function(d,v){return d.weight-v.weight});for(var f=new L9.default(a.map(function(d){return d.id}));u.length>0;){var l=u.shift(),c=l.source,h=l.target;f.connected(c,h)||(n.push(l),f.union(c,h))}return n},D9=function(e,t,n){var i={prim:O9,kruskal:o2};return n?i[n](e,t):o2(e,t)},P9=D9;Lv.default=P9;var Dv={};Object.defineProperty(Dv,"__esModule",{value:!0});Dv.default=void 0;var R9=F9(za),B9=Qr;function F9(r){return r&&r.__esModule?r:{default:r}}var G9=function(e,t,n){typeof t!="number"&&(t=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,o=1e3,s=e.nodes,u=s===void 0?[]:s,f=e.edges,l=f===void 0?[]:f,c=u.length,h,d={},v={},p=0;p<c;++p){var g=u[p],y=g.id;d[y]=1/c,v[y]=1/c}for(var m=(0,R9.default)(e);o>0&&i>t;){a=0;for(var p=0;p<c;++p){var g=u[p],y=g.id;if(h=0,m[g.id].inDegree===0)d[y]=0;else{for(var b=(0,B9.getNeighbors)(y,l,"source"),x=0;x<b.length;++x){var w=b[x],E=m[w].outDegree;E>0&&(h+=v[w]/E)}d[y]=n*h,a+=d[y]}}a=(1-a)/c,i=0;for(var p=0;p<c;++p){var g=u[p],y=g.id;h=d[y]+a,i+=Math.abs(h-v[y]),v[y]=h}o-=1}return v},z9=G9;Dv.default=z9;var Pv={},Rv={},Kr={};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.VACANT_NODE_LABEL=Kr.VACANT_NODE_ID=Kr.VACANT_GRAPH_ID=Kr.VACANT_EDGE_LABEL=Kr.VACANT_EDGE_ID=Kr.Node=Kr.Graph=Kr.Edge=Kr.AUTO_EDGE_ID=void 0;var fk=-1;Kr.VACANT_EDGE_ID=fk;var Tl=-1;Kr.VACANT_NODE_ID=Tl;var lk="-1";Kr.VACANT_EDGE_LABEL=lk;var ck="-1";Kr.VACANT_NODE_LABEL=ck;var $9=-1;Kr.VACANT_GRAPH_ID=$9;var j9="-1";Kr.AUTO_EDGE_ID=j9;var sy=function(){function r(e,t,n,i){e===void 0&&(e=fk),t===void 0&&(t=Tl),n===void 0&&(n=Tl),i===void 0&&(i=lk),this.id=e,this.from=t,this.to=n,this.label=i}return r}();Kr.Edge=sy;var hk=function(){function r(e,t){e===void 0&&(e=Tl),t===void 0&&(t=ck),this.id=e,this.label=t,this.edges=[],this.edgeMap={}}return r.prototype.addEdge=function(e){this.edges.push(e),this.edgeMap[e.id]=e},r}();Kr.Node=hk;var U9=function(){function r(e,t,n){e===void 0&&(e=Tl),t===void 0&&(t=!0),n===void 0&&(n=!1),this.id=e,this.edgeIdAutoIncrease=t,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=n}return r.prototype.getNodeNum=function(){return this.nodes.length},r.prototype.addNode=function(e,t){if(!this.nodeMap[e]){var n=new hk(e,t);this.nodes.push(n),this.nodeMap[e]=n,this.nodeLabelMap[t]||(this.nodeLabelMap[t]=[]),this.nodeLabelMap[t].push(e)}},r.prototype.addEdge=function(e,t,n,i){if((this.edgeIdAutoIncrease||e===void 0)&&(e=this.counter++),!(this.nodeMap[t]&&this.nodeMap[n]&&this.nodeMap[n].edgeMap[e])){var a=new sy(e,t,n,i);if(this.edges.push(a),this.edgeMap[e]=a,this.nodeMap[t].addEdge(a),this.edgeLabelMap[i]||(this.edgeLabelMap[i]=[]),this.edgeLabelMap[i].push(a),!this.directed){var o=new sy(e,n,t,i);this.nodeMap[n].addEdge(o),this.edgeLabelMap[i].push(o)}}},r}();Kr.Graph=U9;Object.defineProperty(Rv,"__esModule",{value:!0});Rv.default=void 0;var X9=Xl,Rn=Kr,ss=function(){function r(e,t,n,i,a){this.fromNode=e,this.toNode=t,this.nodeEdgeNodeLabel={nodeLabel1:n||Rn.VACANT_NODE_LABEL,edgeLabel:i||Rn.VACANT_EDGE_LABEL,nodeLabel2:a||Rn.VACANT_NODE_LABEL}}return r.prototype.equalTo=function(e){return this.fromNode===e.formNode&&this.toNode===e.toNode&&this.nodeEdgeNodeLabel===e.nodeEdgeNodeLabel},r.prototype.notEqualTo=function(e){return!this.equalTo(e)},r}(),s2=function(){function r(){this.rmpath=[],this.dfsEdgeList=[]}return r.prototype.equalTo=function(e){var t=this.dfsEdgeList.length,n=e.length;if(t!==n)return!1;for(var i=0;i<t;i++)if(this.dfsEdgeList[i]!==e[i])return!1;return!0},r.prototype.notEqualTo=function(e){return!this.equalTo(e)},r.prototype.pushBack=function(e,t,n,i,a){return this.dfsEdgeList.push(new ss(e,t,n,i,a)),this.dfsEdgeList},r.prototype.toGraph=function(e,t){e===void 0&&(e=Rn.VACANT_GRAPH_ID),t===void 0&&(t=!1);var n=new Rn.Graph(e,!0,t);return this.dfsEdgeList.forEach(function(i){var a=i.fromNode,o=i.toNode,s=i.nodeEdgeNodeLabel,u=s.nodeLabel1,f=s.edgeLabel,l=s.nodeLabel2;u!==Rn.VACANT_NODE_LABEL&&n.addNode(a,u),l!==Rn.VACANT_NODE_LABEL&&n.addNode(o,l),u!==Rn.VACANT_NODE_LABEL&&l!==u&&n.addEdge(void 0,a,o,f)}),n},r.prototype.buildRmpath=function(){this.rmpath=[];for(var e=void 0,t=this.dfsEdgeList.length,n=t-1;n>=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,o=i.toNode;a<o&&(e===void 0||o===e)&&(this.rmpath.push(n),e=a)}return this.rmpath},r.prototype.getNodeNum=function(){var e={};return this.dfsEdgeList.forEach(function(t){e[t.fromNode]||(e[t.fromNode]=!0),e[t.toNode]||(e[t.toNode]=!0)}),Object.keys(e).length},r}(),vh=function(){function r(e){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!e){for(;e;){var t=e.edge;this.edges.push(t),this.nodesUsed[t.from]=1,this.nodesUsed[t.to]=1,this.edgesUsed[t.id]=1,e=e.preNode}this.edges=this.edges.reverse()}}return r.prototype.hasNode=function(e){return this.nodesUsed[e.id]===1},r.prototype.hasEdge=function(e){return this.edgesUsed[e.id]===1},r}(),Y9=function(){function r(e){var t=e.graphs,n=e.minSupport,i=n===void 0?2:n,a=e.minNodeNum,o=a===void 0?1:a,s=e.maxNodeNum,u=s===void 0?4:s,f=e.top,l=f===void 0?10:f,c=e.directed,h=c===void 0?!1:c,d=e.verbose,v=d===void 0?!1:d;this.graphs=t,this.dfsCode=new s2,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=i,this.top=l,this.directed=h,this.counter=0,this.maxNodeNum=u,this.minNodeNum=o,this.verbose=v,this.maxNodeNum<this.minNodeNum&&(this.maxNodeNum=this.minNodeNum),this.reportDF=[]}return r.prototype.findForwardRootEdges=function(e,t){var n=this,i=[],a=e.nodeMap;return t.edges.forEach(function(o){(n.directed||t.label<=a[o.to].label)&&i.push(o)}),i},r.prototype.findBackwardEdge=function(e,t,n,i){if(!this.directed&&t===n)return null;for(var a=e.nodeMap,o=a[n.to],s=o.edges,u=s.length,f=0;f<u;f++){var l=s[f];if(!(i.hasEdge(l)||l.to!==t.from)){if(this.directed){if(a[t.from].label<a[n.to].label||a[t.from].label===a[n.to].label&&t.label<=l.label)return l}else if(t.label<l.label||t.label===l.label&&a[t.to].label<=a[n.to].label)return l}}return null},r.prototype.findForwardPureEdges=function(e,t,n,i){for(var a=[],o=t.to,s=e.nodeMap[o].edges,u=s.length,f=0;f<u;f++){var l=s[f],c=e.nodeMap[l.to];n<=c.label&&!i.hasNode(c)&&a.push(l)}return a},r.prototype.findForwardRmpathEdges=function(e,t,n,i){for(var a=[],o=e.nodeMap,s=o[t.to].label,u=o[t.from],f=u.edges,l=f.length,c=0;c<l;c++){var h=f[c],d=o[h.to].label;t.to===h.to||n>d||i.hasNode(o[h.to])||(t.label<h.label||t.label===h.label&&s<=d)&&a.push(h)}return a},r.prototype.getSupport=function(e){var t={};return e.forEach(function(n){t[n.graphId]||(t[n.graphId]=!0)}),Object.keys(t).length},r.prototype.findMinLabel=function(e){var t=void 0;return Object.keys(e).forEach(function(n){var i=e[n],a=i.nodeLabel1,o=i.edgeLabel,s=i.nodeLabel2;if(!t){t={nodeLabel1:a,edgeLabel:o,nodeLabel2:s};return}(a<t.nodeLabel1||a===t.nodeLabel1&&o<t.edgeLabel||a===t.nodeLabel1&&o===t.edgeLabel&&s<t.nodeLabel2)&&(t={nodeLabel1:a,edgeLabel:o,nodeLabel2:s})}),t},r.prototype.isMin=function(){var e=this,t=this.dfsCode;if(this.verbose&&console.log("isMin checking",t),t.dfsEdgeList.length===1)return!0;var n=this.directed,i=t.toGraph(Rn.VACANT_GRAPH_ID,n),a=i.nodeMap,o=new s2,s={};i.nodes.forEach(function(c){var h=e.findForwardRootEdges(i,c);h.forEach(function(d){var v=a[d.to],p="".concat(c.label,"-").concat(d.label,"-").concat(v.label);s[p]||(s[p]={projected:[],nodeLabel1:c.label,edgeLabel:d.label,nodeLabel2:v.label});var g={graphId:i.id,edge:d,preNode:null};s[p].projected.push(g)})});var u=this.findMinLabel(s);if(u){o.dfsEdgeList.push(new ss(0,1,u.nodeLabel1,u.edgeLabel,u.nodeLabel2));var f=function c(h){for(var d=o.buildRmpath(),v=o.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,p=o.dfsEdgeList[d[0]].toNode,g={},y=!1,m=0,b=n?-1:0,x=function($){if(y)return"break";h.forEach(function(Y){var N=new vh(Y),P=e.findBackwardEdge(i,N.edges[d[$]],N.edges[d[0]],N);P&&(g[P.label]||(g[P.label]={projected:[],edgeLabel:P.label}),g[P.label].projected.push({graphId:i.id,edge:g,preNode:Y}),m=o.dfsEdgeList[d[$]].fromNode,y=!0)})},w=d.length-1;w>b;w--){var E=x(w);if(E==="break")break}if(y){var _=e.findMinLabel(g);o.dfsEdgeList.push(new ss(p,m,Rn.VACANT_NODE_LABEL,_.edgeLabel,Rn.VACANT_NODE_LABEL));var M=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[M]!==o.dfsEdgeList[M]?!1:c(g[_.edgeLabel].projected)}var C={};y=!1;var S=0;h.forEach(function(D){var $=new vh(D),Y=e.findForwardPureEdges(i,$.edges[d[0]],v,$);Y.length>0&&(y=!0,S=p,Y.forEach(function(N){var P="".concat(N.label,"-").concat(a[N.to].label);C[P]||(C[P]={projected:[],edgeLabel:N.label,nodeLabel2:a[N.to].label}),C[P].projected.push({graphId:i.id,edge:N,preNode:D})}))});for(var A=d.length,T=function($){if(y)return"break";var Y=d[$];h.forEach(function(N){var P=new vh(N),W=e.findForwardRmpathEdges(i,P.edges[Y],v,P);W.length>0&&(y=!0,S=o.dfsEdgeList[Y].fromNode,W.forEach(function(J){var te="".concat(J.label,"-").concat(a[J.to].label);C[te]||(C[te]={projected:[],edgeLabel:J.label,nodeLabel2:a[J.to].label}),C[te].projected.push({graphId:i.id,edge:J,preNode:N})}))})},w=0;w<A;w++){var k=T(w);if(k==="break")break}if(!y)return!0;var O=e.findMinLabel(C);o.dfsEdgeList.push(new ss(S,p+1,Rn.VACANT_NODE_LABEL,O.edgeLabel,O.nodeLabel2));var F=o.dfsEdgeList.length-1;return t.dfsEdgeList[F]!==o.dfsEdgeList[F]?!1:c(C["".concat(O.edgeLabel,"-").concat(O.nodeLabel2)].projected)},l="".concat(u.nodeLabel1,"-").concat(u.edgeLabel,"-").concat(u.nodeLabel2);return f(s[l].projected)}},r.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var e=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push((0,X9.clone)(e))}},r.prototype.subGraphMining=function(e){var t=this,n=this.getSupport(e);if(!(n<this.minSupport)&&this.isMin()){this.report();var i=this.dfsCode.getNodeNum(),a=this.dfsCode.buildRmpath(),o=this.dfsCode.dfsEdgeList[a[0]].toNode,s=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,u={},f={};e.forEach(function(l){for(var c=t.graphs[l.graphId],h=c.nodeMap,d=new vh(l),v=a.length-1;v>=0;v--){var p=t.findBackwardEdge(c,d.edges[a[v]],d.edges[a[0]],d);if(p){var g="".concat(t.dfsCode.dfsEdgeList[a[v]].fromNode,"-").concat(p.label);f[g]||(f[g]={projected:[],toNodeId:t.dfsCode.dfsEdgeList[a[v]].fromNode,edgeLabel:p.label}),f[g].projected.push({graphId:l.graphId,edge:p,preNode:l})}}if(!(i>=t.maxNodeNum)){var y=t.findForwardPureEdges(c,d.edges[a[0]],s,d);y.forEach(function(b){var x="".concat(o,"-").concat(b.label,"-").concat(h[b.to].label);u[x]||(u[x]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:h[b.to].label}),u[x].projected.push({graphId:l.graphId,edge:b,preNode:l})});for(var m=function(x){var w=t.findForwardRmpathEdges(c,d.edges[a[x]],s,d);w.forEach(function(E){var _="".concat(t.dfsCode.dfsEdgeList[a[x]].fromNode,"-").concat(E.label,"-").concat(h[E.to].label);u[_]||(u[_]={projected:[],fromNodeId:t.dfsCode.dfsEdgeList[a[x]].fromNode,edgeLabel:E.label,nodeLabel2:h[E.to].label}),u[_].projected.push({graphId:l.graphId,edge:E,preNode:l})})},v=0;v<a.length;v++)m(v)}}),Object.keys(f).forEach(function(l){var c=f[l],h=c.toNodeId,d=c.edgeLabel;t.dfsCode.dfsEdgeList.push(new ss(o,h,"-1",d,"-1")),t.subGraphMining(f[l].projected),t.dfsCode.dfsEdgeList.pop()}),Object.keys(u).forEach(function(l){var c=u[l],h=c.fromNodeId,d=c.edgeLabel,v=c.nodeLabel2;t.dfsCode.dfsEdgeList.push(new ss(h,o+1,Rn.VACANT_NODE_LABEL,d,v)),t.subGraphMining(u[l].projected),t.dfsCode.dfsEdgeList.pop()})}},r.prototype.generate1EdgeFrequentSubGraphs=function(){var e=this.graphs,t=this.directed,n=this.minSupport,i=this.frequentSize1Subgraphs,a={},o={},s={};return Object.keys(e).forEach(function(u){var f=e[u],l=f.nodeMap;f.nodes.forEach(function(c,h){var d=c.label,v="".concat(u,"-").concat(d);if(!s[v]){var p=a[d]||0;p++,a[d]=p}s[v]={graphKey:u,label:d},c.edges.forEach(function(g){var y=d,m=l[g.to].label;if(!t&&y>m){var b=m;m=y,y=b}var x=g.label,w="".concat(y,"-").concat(x,"-").concat(m);if(!o[w]){var E=o[w]||0;E++,o[w]=E}})})}),Object.keys(a).forEach(function(u){var f=a[u];if(!(f<n)){var l={nodes:[],edges:[]};l.nodes.push({id:"0",label:u}),i.push(l)}}),i},r.prototype.run=function(){var e=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var t=this.graphs;this.directed;var n={};Object.keys(t).forEach(function(i){var a=t[i],o=a.nodeMap;a.nodes.forEach(function(s){var u=e.findForwardRootEdges(a,s);u.forEach(function(f){var l=o[f.to],c="".concat(s.label,"-").concat(f.label,"-").concat(l.label);n[c]||(n[c]={projected:[],nodeLabel1:s.label,edgeLabel:f.label,nodeLabel2:l.label});var h={graphId:i,edge:f,preNode:null};n[c].projected.push(h)})})}),Object.keys(n).forEach(function(i){var a=n[i],o=a.projected,s=a.nodeLabel1,u=a.edgeLabel,f=a.nodeLabel2;e.dfsCode.dfsEdgeList.push(new ss(0,1,s,u,f)),e.subGraphMining(o),e.dfsCode.dfsEdgeList.pop()})}},r}(),W9=function(e,t,n,i){var a={};return Object.keys(e).forEach(function(o,s){var u=e[o],f=new Rn.Graph(s,!0,t),l={};u.nodes.forEach(function(c,h){f.addNode(h,c[n]),l[c.id]=h}),u.edges.forEach(function(c,h){var d=l[c.source],v=l[c.target];f.addEdge(-1,d,v,c[i])}),f&&f.getNodeNum()&&(a[f.id]=f)}),a},V9=function(e,t,n){var i=[];return e.forEach(function(a){var o={nodes:[],edges:[]};a.nodes.forEach(function(s){var u;o.nodes.push((u={id:"".concat(s.id)},u[t]=s.label,u))}),a.edges.forEach(function(s){var u;o.edges.push((u={source:"".concat(s.from),target:"".concat(s.to)},u[n]=s.label,u))}),i.push(o)}),i},u2="cluster",H9=function(e){var t=e.graphs,n=e.directed,i=n===void 0?!1:n,a=e.nodeLabelProp,o=a===void 0?u2:a,s=e.edgeLabelProp,u=s===void 0?u2:s,f=W9(t,i,o,u),l=e.minSupport,c=e.maxNodeNum,h=e.minNodeNum,d=e.verbose,v=e.top,p={graphs:f,minSupport:l,maxNodeNum:c,minNodeNum:h,top:v,verbose:d,directed:i},g=new Y9(p);g.run();var y=V9(g.frequentSubgraphs,o,u);return y},q9=H9;Rv.default=q9;Object.defineProperty(Pv,"__esModule",{value:!0});Pv.default=void 0;var f2=tk,l2=n1(Yl),Z9=n1(Rv),c2=n1(Qu),K9=Qr;function n1(r){return r&&r.__esModule?r:{default:r}}var h2=function(e,t,n,i){n===void 0&&(n="cluster"),i===void 0&&(i=2);var a=[],o=e.nodes;return t.forEach(function(s,u){a.push(dk(o,s,u,n,i))}),a},dk=function(e,t,n,i,a){var o=[n],s=[],u={};return t.forEach(function(f,l){if(f<=a&&n!==l){o.push(l),s.push(e[l]);var c=e[l][i];u[c]?(u[c].count++,u[c].dists.push(f)):u[c]={count:1,dists:[f]}}}),Object.keys(u).forEach(function(f){u[f].dists=u[f].dists.sort(function(l,c){return l-c})}),{nodeIdx:n,nodeId:e[n].id,nodeIdxs:o,neighbors:s,neighborNum:o.length-1,nodeLabelCountMap:u}},Q9=function(e,t,n,i,a){var o=Math.ceil(n/t),s={},u=0;return i.forEach(function(f,l){for(var c=0,h=0,d=f.nodeIdxs,v=f.neighborNum-1;c<o;){for(var p=d[1+Math.floor(Math.random()*v)],g=0;(s["".concat(l,"-").concat(p)]||s["".concat(p,"-").concat(l)])&&(p=Math.floor(Math.random()*t),g++,!(g>2*t)););if(g<2*t&&(s["".concat(l,"-").concat(p)]={start:l,end:p,distance:a[l][p]},c++,u++,u>=n))return s;if(h++,h>2*t)break}if(c<o){var y=o-c;o=(o+y)/(t-l-1)}}),s},nd=function(e,t,n,i){var a=n.nodes;return i||(i={}),Object.keys(e).forEach(function(o){var s,u;if(!(i&&i[o])){i[o]={nodes:[],edges:[]};var f=e[o],l=(s=t[f.start])===null||s===void 0?void 0:s.nodeIdxs,c=(u=t[f.end])===null||u===void 0?void 0:u.nodeIdxs;if(!(!l||!c)){var h=new Set(c),d=l.filter(function(m){return h.has(m)});if(!(!d||!d.length)){for(var v={},p=d.length,g=0;g<p;g++){var y=a[d[g]];i[o].nodes.push(y),v[y.id]=!0}n.edges.forEach(function(m){v[m.source]&&v[m.target]&&i[o].edges.push(m)})}}}}),i},id=function(e,t,n,i){var a,o,s={};e.nodes.forEach(function(f){s[f.id]=f});var u=0;return!(!((a=t==null?void 0:t.edges)===null||a===void 0)&&a.length)||((o=t==null?void 0:t.nodes)===null||o===void 0?void 0:o.length)<2?0:(e.edges.forEach(function(f){var l=s[f.source][n],c=s[f.target][n],h=t==null?void 0:t.nodes[0][n],d=t==null?void 0:t.nodes[1][n],v=t==null?void 0:t.edges[0][i];f[i]===v&&(l===h&&c===d||l===d&&c===h)&&u++}),u)},J9=function(e,t,n){for(var i=1/0,a=0,o=function(f){var l=e[f],c=Object.keys(l).sort(function(m,b){return l[m]-l[b]}),h=10,d=[];c.forEach(function(m,b){d[b%h]||(d[b%h]={graphs:[],totalCount:0,aveCount:0}),d[b%h].graphs.push(m),d[b%h].totalCount+=l[m]});var v=0,p=[];d.forEach(function(m){var b=m.totalCount/m.graphs.length;m.aveCount=b,p.push(b);var x=0,w=m.length;m.graphs.forEach(function(E,_){var M=l[E];m.graphs.forEach(function(C,S){_!==S&&(x+=Math.abs(M-l[C]))})}),x/=w*(w-1)/2,v+=x}),v/=d.length;var g=0;p.forEach(function(m,b){p.forEach(function(x,w){b!==w&&(g+=Math.abs(m-x))}),g/=p.length*(p.length-1)/2});var y=g-v;i<y&&(i=y,a=f)},s=0;s<t;s++)o(s);return{structure:n[a],structureCountMap:e[a]}},d2=function(e,t){var n={},i={};return e.forEach(function(a,o){n[a.id]={idx:o,node:a,degree:0,inDegree:0,outDegree:0};var s=a[t];i[s]||(i[s]=[]),i[s].push(a)}),{nodeMap:n,nodeLabelMap:i}},v2=function(e,t,n){var i={},a={};return e.forEach(function(o,s){i["".concat(K9.uniqueId)]={idx:s,edge:o};var u=o[t];a[u]||(a[u]=[]),a[u].push(o);var f=n[o.source];f&&(f.degree++,f.outDegree++);var l=n[o.target];l&&(l.degree++,l.inDegree++)}),{edgeMap:i,edgeLabelMap:a}},p2=function(e,t,n){var i=t.length,a={};return t.forEach(function(o,s){for(var u=n?0:s+1,f=e[s].id,l=u;l<i;l++)if(s!==l){var c=e[l].id,h=o[l];a["".concat(f,"-").concat(c)]=h,n||(a["".concat(c,"-").concat(f)]=h)}}),a},e7=function(e,t,n,i,a,o,s,u,f,l,c){var h,d="".concat(t.id,"-").concat(n.id);if(l&&l[d])return l[d];var v=c?c[d]:void 0;if(!v){var p=(h={},h[d]={start:i[t.id].idx,end:i[n.id].idx,distance:a},h);c=nd(p,o,e,c),v=c[d]}return id(v,s,u,f)},g2=function(e,t,n,i){var a,o,s,u=(a=e[t])===null||a===void 0?void 0:a.degree,f=(o=e[t])===null||o===void 0?void 0:o.inDegree,l=(s=e[t])===null||s===void 0?void 0:s.outDegree;return e[t]===void 0&&(u=1/0,f=1/0,l=1/0,i[t].forEach(function(c){var h=n[c.id].degree;u>h&&(u=h);var d=n[c.id].inDegree;f>d&&(f=d);var v=n[c.id].outDegree;l>v&&(l=v)}),e[t]={degree:u,inDegree:f,outDegree:l}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:f,minPatternNodeLabelOutDegree:l}},t7=function(e,t,n,i,a,o,s){var u;if(n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),!(!e||!e.nodes)){var f=e.nodes.length;if(f){var l=(0,l2.default)(e,n),c=(0,l2.default)(t,n),h=p2(e.nodes,l,n),d=p2(t.nodes,c,n),v=d2(e.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=d2(t.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;v2(e.edges,s,p);var x=v2(t.edges,s,m).edgeLabelMap,w=[];c==null||c.forEach(function(tt){w=w.concat(tt)}),a||(a=Math.max.apply(Math,(0,f2.__spreadArray)((0,f2.__spreadArray)([],w,!1),[2],!1))),i||(i=a);var E=h2(e,l,o,i),_=h2(t,c,o,i),M=Math.min(100,f*(f-1)/2),C=Q9(i,f,M,E,l),S=nd(C,E,e),A=10,T=1,k=1,O=4,F={graphs:S,nodeLabelProp:o,edgeLabelProp:s,minSupport:T,minNodeNum:k,maxNodeNum:O,directed:n},D=(0,Z9.default)(F).slice(0,A),$=D.length,Y=[];D.forEach(function(tt,ae){Y[ae]={},Object.keys(S).forEach(function(L){var Se=S[L],Ge=id(Se,tt,o,s);Y[ae][L]=Ge})});var N=J9(Y,$,D),P=N.structure,W=N.structureCountMap,J=t.nodes[0],te=[],H=(u=t.nodes[0])===null||u===void 0?void 0:u[o],pe=-1/0;t.nodes.forEach(function(tt){var ae=tt[o],L=g[ae];(L==null?void 0:L.length)>pe&&(pe=L.length,te=L,H=ae,J=tt)});var Te={},Ne={},Ze={},at={},nt={},_t={};Object.keys(b).forEach(function(tt,ae){nt[tt]=[],n&&(_t[tt]=[]);var L=b[tt],Se={};L.forEach(function(qe){var et=d["".concat(J.id,"-").concat(qe.id)];if(et&&nt[tt].push(et),Se["".concat(J.id,"-").concat(qe.id)]={start:0,end:m[qe.id].idx,distance:et},n){var gt=d["".concat(qe.id,"-").concat(J.id)];gt&&_t[tt].push(gt)}}),nt[tt]=nt[tt].sort(function(qe,et){return qe-et}),n&&(_t[tt]=_t[tt].sort(function(qe,et){return qe-et})),Ne=nd(Se,_,t,Ne);var Ge=[];if(Object.keys(Se).forEach(function(qe){if(Ze[qe]){Ge.push(Ze[qe]);return}var et=Ne[qe];Ze[qe]=id(et,P,o,s),Ge.push(Ze[qe])}),Ge=Ge.sort(function(qe,et){return et-qe}),at["".concat(J.id,"-").concat(tt)]=Ge,tt!==H)for(var ye=(te==null?void 0:te.length)||0,Ye=function(et){var gt=te[et],Pt=E[p[gt.id].idx],cr=Pt.nodeLabelCountMap[tt],Rt=b[tt].length;if(!cr||cr.count<Rt)return te.splice(et,1),"continue";for(var hr=!1,ur=0;ur<Rt;ur++)if(cr.dists[ur]>nt[tt][ur]){hr=!0;break}if(hr)return te.splice(et,1),"continue";var br={};Pt.neighbors.forEach(function(ar){var $r=h["".concat(gt.id,"-").concat(ar.id)];br["".concat(gt.id,"-").concat(ar.id)]={start:p[gt.id].idx,end:p[ar.id].idx,distance:$r}}),S=nd(br,E,e,S);var vr=[];Object.keys(br).forEach(function(ar){if(W[ar]){vr.push(W[ar]);return}var $r=S[ar];W[ar]=id($r,P,o,s),vr.push(W[ar])}),vr=vr.sort(function(ar,$r){return $r-ar});for(var bn=!1,ur=0;ur<Rt;ur++)if(vr[ur]<Ge[ur]){bn=!0;break}if(bn)return te.splice(et,1),"continue"},We=ye-1;We>=0;We--)Ye(We)});var St=[];te==null||te.forEach(function(tt){for(var ae=p[tt.id].idx,L=dk(e.nodes,l[ae],ae,o,a),Se=L.neighbors,Ge=Se.length,ye=!1,Ye=Ge-1;Ye>=0;Ye--){if(Se.length+1<t.nodes.length){ye=!0;return}var We=Se[Ye],qe=We[o];if(!b[qe]||!b[qe].length){Se.splice(Ye,1);continue}if(!nt[qe]||!nt[qe].length){Se.splice(Ye,1);continue}var et="".concat(tt.id,"-").concat(We.id),gt=h[et],Pt=nt[qe].length-1,cr=nt[qe][Pt];if(gt>cr){Se.splice(Ye,1);continue}if(n){var Rt="".concat(We.id,"-").concat(tt.id),hr=h[Rt];Pt=_t[qe].length-1;var ur=_t[qe][Pt];if(hr>ur){Se.splice(Ye,1);continue}}var br=W[et]?W[et]:e7(e,tt,We,p,gt,E,P,o,s,W,S),vr="".concat(J.id,"-").concat(qe),bn=at[vr][at[vr].length-1];if(br<bn){Se.splice(Ye,1);continue}var ar=g2(Te,qe,m,b),$r=ar.minPatternNodeLabelDegree;if(ar.minPatternNodeLabelInDegree,ar.minPatternNodeLabelOutDegree,p[We.id].degree<$r){Se.splice(Ye,1);continue}}ye||St.push({nodes:[tt].concat(Se)})});var fr=(0,c2.default)(t,J.id,!1).length,Ft={};n?(Object.keys(fr).forEach(function(tt){var ae=m[tt].node[o];Ft[ae]?Ft[ae].push(fr[tt]):Ft[ae]=[fr[tt]]}),Object.keys(Ft).forEach(function(tt){Ft[tt].sort(function(ae,L){return ae-L})})):Ft=nt;for(var Yt=St.length,dr=function(ae){var L=St[ae],Se=L.nodes[0],Ge={},ye={};L.nodes.forEach(function(At,pr){ye[At.id]={idx:pr,node:At,degree:0,inDegree:0,outDegree:0};var bt=At[o];Ge[bt]?Ge[bt]++:Ge[bt]=1});var Ye=[],We={};e.edges.forEach(function(At){ye[At.source]&&ye[At.target]&&(Ye.push(At),We[At[s]]?We[At[s]]++:We[At[s]]=1,ye[At.source].degree++,ye[At.target].degree++,ye[At.source].outDegree++,ye[At.target].inDegree++)});for(var qe=Object.keys(x).length,et=!1,gt=0;gt<qe;gt++){var Pt=Object.keys(x)[gt];if(!We[Pt]||We[Pt]<x[Pt].length){et=!0;break}}if(et)return St.splice(ae,1),"continue";var cr=Ye.length;if(cr<t.edges.length)return St.splice(ae,1),"break";for(var Rt=!1,hr=function(pr){var bt=Ye[pr],Ir=bt[s],xn=x[Ir];if(!xn||!xn.length)return We[Ir]--,xn&&We[Ir]<xn.length?(Rt=!0,"break"):(Ye.splice(pr,1),ye[bt.source].degree--,ye[bt.target].degree--,ye[bt.source].outDegree--,ye[bt.target].inDegree--,"continue");var Go=ye[bt.source].node[o],zo=ye[bt.target].node[o],_a=!1;if(xn.forEach(function($o){var jo=m[$o.source].node,Uo=m[$o.target].node;jo[o]===Go&&Uo[o]===zo&&(_a=!0),!n&&jo[o]===zo&&Uo[o]===Go&&(_a=!0)}),!_a)return We[Ir]--,xn&&We[Ir]<xn.length?(Rt=!0,"break"):(Ye.splice(pr,1),ye[bt.source].degree--,ye[bt.target].degree--,ye[bt.source].outDegree--,ye[bt.target].inDegree--,"continue")},gt=cr-1;gt>=0;gt--){var ur=hr(gt);if(ur==="break")break}if(Rt)return St.splice(ae,1),"continue";L.edges=Ye;var br=(0,c2.default)(L,L.nodes[0].id,!1).length;if(Object.keys(br).reverse().forEach(function(At){if(!(At===L.nodes[0].id||Rt)){if(br[At]===1/0){var pr=ye[At].node[o];if(Ge[pr]--,Ge[pr]<b[pr].length){Rt=!0;return}var bt=L.nodes.indexOf(ye[At].node);L.nodes.splice(bt,1),ye[At]=void 0;return}var Ir=p[At].node[o];if(!Ft[Ir]||!Ft[Ir].length||br[At]>Ft[Ir][Ft[Ir].length-1]){var pr=ye[At].node[o];if(Ge[pr]--,Ge[pr]<b[pr].length){Rt=!0;return}var bt=L.nodes.indexOf(ye[At].node);L.nodes.splice(bt,1),ye[At]=void 0}}}),Rt)return St.splice(ae,1),"continue";for(var vr=!0,bn=0;vr&&!Rt;){vr=!1;var ar=n?ye[Se.id].degree<m[J.id].degree||ye[Se.id].inDegree<m[J.id].inDegree||ye[Se.id].outDegree<m[J.id].outDegree:ye[Se.id].degree<m[J.id].degree;if(ar){Rt=!0;break}if(Ge[Se[o]]<b[Se[o]].length){Rt=!0;break}for(var $r=L.nodes.length,bi=$r-1;bi>=0;bi--){var qr=L.nodes[bi],Ka=ye[qr.id].degree,rf=ye[qr.id].inDegree,nf=ye[qr.id].outDegree,un=qr[o],Ea=g2(Te,un,m,b),Fo=Ea.minPatternNodeLabelDegree,af=Ea.minPatternNodeLabelInDegree,of=Ea.minPatternNodeLabelOutDegree,sf=n?Ka<Fo||rf<af||nf<of:Ka<Fo;if(sf){if(Ge[qr[o]]--,Ge[qr[o]]<b[qr[o]].length){Rt=!0;break}L.nodes.splice(bi,1),ye[qr.id]=void 0,vr=!0}}if(Rt||!vr&&bn!==0)break;cr=Ye.length;for(var xi=cr-1;xi>=0;xi--){var jr=Ye[xi];if(!ye[jr.source]||!ye[jr.target]){Ye.splice(xi,1);var wi=jr[s];if(We[wi]--,ye[jr.source]&&(ye[jr.source].degree--,ye[jr.source].outDegree--),ye[jr.target]&&(ye[jr.target].degree--,ye[jr.target].inDegree--),x[wi]&&We[wi]<x[wi].length){Rt=!0;break}vr=!0}}bn++}if(Rt||Rt||L.nodes.length<t.nodes.length||Ye.length<t.edges.length)return St.splice(ae,1),"continue"},lr=Yt-1;lr>=0;lr--){var jt=dr(lr);if(jt==="break")break}for(var ir=St.length,Hr=function(ae){var L=St[ae],Se={};L.edges.forEach(function(Ye){var We="".concat(Ye.source,"-").concat(Ye.target,"-").concat(Ye.label);Se[We]?Se[We]++:Se[We]=1});for(var Ge=function(We){var qe=St[We],et={};qe.edges.forEach(function(Pt){var cr="".concat(Pt.source,"-").concat(Pt.target,"-").concat(Pt.label);et[cr]?et[cr]++:et[cr]=1});var gt=!0;Object.keys(et).length!==Object.keys(Se).length?gt=!1:Object.keys(Se).forEach(function(Pt){et[Pt]!==Se[Pt]&&(gt=!1)}),gt&&St.splice(We,1)},ye=ir-1;ye>ae;ye--)Ge(ye);ir=St.length},lr=0;lr<=ir-1;lr++)Hr(lr);return St}}},r7=t7;Pv.default=r7;(function(r){function e(x){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(w){return typeof w}:function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},e(x)}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"GADDI",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(r,"breadthFirstSearch",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(r,"connectedComponent",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(r,"depthFirstSearch",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(r,"detectCycle",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(r,"dijkstra",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(r,"findAllPath",{enumerable:!0,get:function(){return f.findAllPath}}),Object.defineProperty(r,"findShortestPath",{enumerable:!0,get:function(){return f.findShortestPath}}),Object.defineProperty(r,"floydWarshall",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(r,"getAdjMatrix",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(r,"getDegree",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(r,"getInDegree",{enumerable:!0,get:function(){return a.getInDegree}}),Object.defineProperty(r,"getNeighbors",{enumerable:!0,get:function(){return g.getNeighbors}}),Object.defineProperty(r,"getOutDegree",{enumerable:!0,get:function(){return a.getOutDegree}}),Object.defineProperty(r,"labelPropagation",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(r,"louvain",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(r,"minimumSpanningTree",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(r,"pageRank",{enumerable:!0,get:function(){return v.default}});var t=b(Os),n=b(Cv),i=b(Io),a=m(za),o=b(ra),s=b(Tv),u=b(Qu),f=Ru,l=b(Yl),c=b(Iv),h=b(kv),d=b(Lv),v=b(Dv),p=b(Pv),g=Qr;function y(x){if(typeof WeakMap!="function")return null;var w=new WeakMap,E=new WeakMap;return(y=function(M){return M?E:w})(x)}function m(x,w){if(x&&x.__esModule)return x;if(x===null||e(x)!=="object"&&typeof x!="function")return{default:x};var E=y(w);if(E&&E.has(x))return E.get(x);var _={},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var C in x)if(C!=="default"&&Object.prototype.hasOwnProperty.call(x,C)){var S=M?Object.getOwnPropertyDescriptor(x,C):null;S&&(S.get||S.set)?Object.defineProperty(_,C,S):_[C]=x[C]}return _.default=x,E&&E.set(x,_),_}function b(x){return x&&x.__esModule?x:{default:x}}})(YI);function uy(r){"@babel/helpers - typeof";return uy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uy(r)}Object.defineProperty(Mv,"__esModule",{value:!0});Mv.default=void 0;var Tg=n7(YI),y2=To;function vk(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(vk=function(i){return i?t:e})(r)}function n7(r,e){if(r&&r.__esModule)return r;if(r===null||uy(r)!=="object"&&typeof r!="function")return{default:r};var t=vk(e);if(t&&t.has(r))return t.get(r);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in r)if(a!=="default"&&Object.prototype.hasOwnProperty.call(r,a)){var o=i?Object.getOwnPropertyDescriptor(r,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=r[a]}return n.default=r,t&&t.set(r,n),n}var Ig=typeof self<"u"?self:{};Ig.onmessage=function(r){var e=r.data,t=e._algorithmType,n=e.data;if(t){if(typeof Tg[t]=="function"){var i=Tg[t].apply(Tg,n);Ig.postMessage({_algorithmType:y2.MESSAGE.SUCCESS,data:i});return}Ig.postMessage({_algorithmType:y2.MESSAGE.FAILURE})}};var i7=null;Mv.default=i7;Object.defineProperty(Sv,"__esModule",{value:!0});Sv.default=void 0;var a7=To,o7=s7(Mv);function s7(r){return r&&r.__esModule?r:{default:r}}var u7=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new Promise(function(i,a){var o=new o7.default;o.postMessage({_algorithmType:e,data:t}),o.onmessage=function(s){var u=s.data,f=u.data,l=u._algorithmType;a7.MESSAGE.SUCCESS===l?i(f):a(),o.terminate()}})}},f7=u7;Sv.default=f7;Object.defineProperty(Kt,"__esModule",{value:!0});Kt.pageRankAsync=Kt.minimumSpanningTreeAsync=Kt.louvainAsync=Kt.labelPropagationAsync=Kt.getOutDegreeAsync=Kt.getNeighborsAsync=Kt.getInDegreeAsync=Kt.getDegreeAsync=Kt.getAdjMatrixAsync=Kt.floydWarshallAsync=Kt.findShortestPathAsync=Kt.findAllPathAsync=Kt.dijkstraAsync=Kt.detectCycleAsync=Kt.detectAllUndirectedCycleAsync=Kt.detectAllDirectedCycleAsync=Kt.detectAllCyclesAsync=Kt.connectedComponentAsync=Kt.GADDIAsync=void 0;var on=l7(Sv),sn=To;function l7(r){return r&&r.__esModule?r:{default:r}}var c7=function(e,t){return(0,on.default)(sn.ALGORITHM.getAdjMatrix).apply(void 0,[e,t])};Kt.getAdjMatrixAsync=c7;var h7=function(e,t){return(0,on.default)(sn.ALGORITHM.connectedComponent).apply(void 0,[e,t])};Kt.connectedComponentAsync=h7;var d7=function(e){return(0,on.default)(sn.ALGORITHM.getDegree)(e)};Kt.getDegreeAsync=d7;var v7=function(e,t){return(0,on.default)(sn.ALGORITHM.getInDegree)(e,t)};Kt.getInDegreeAsync=v7;var p7=function(e,t){return(0,on.default)(sn.ALGORITHM.getOutDegree)(e,t)};Kt.getOutDegreeAsync=p7;var g7=function(e){return(0,on.default)(sn.ALGORITHM.detectCycle)(e)};Kt.detectCycleAsync=g7;var y7=function(e){return(0,on.default)(sn.ALGORITHM.detectAllCycles)(e)};Kt.detectAllCyclesAsync=y7;var m7=function(e){return(0,on.default)(sn.ALGORITHM.detectAllDirectedCycle)(e)};Kt.detectAllDirectedCycleAsync=m7;var b7=function(e){return(0,on.default)(sn.ALGORITHM.detectAllUndirectedCycle)(e)};Kt.detectAllUndirectedCycleAsync=b7;var x7=function(e,t,n,i){return(0,on.default)(sn.ALGORITHM.dijkstra).apply(void 0,[e,t,n,i])};Kt.dijkstraAsync=x7;var w7=function(e,t,n,i){return(0,on.default)(sn.ALGORITHM.findAllPath).apply(void 0,[e,t,n,i])};Kt.findAllPathAsync=w7;var E7=function(e,t,n,i,a){return(0,on.default)(sn.ALGORITHM.findShortestPath).apply(void 0,[e,t,n,i,a])};Kt.findShortestPathAsync=E7;var _7=function(e,t){return(0,on.default)(sn.ALGORITHM.floydWarshall).apply(void 0,[e,t])};Kt.floydWarshallAsync=_7;var S7=function(e,t,n,i){return i===void 0&&(i=1e3),(0,on.default)(sn.ALGORITHM.labelPropagation)(e,t,n,i)};Kt.labelPropagationAsync=S7;var M7=function(e,t,n,i){return(0,on.default)(sn.ALGORITHM.louvain)(e,t,n,i)};Kt.louvainAsync=M7;var C7=function(e,t,n){return(0,on.default)(sn.ALGORITHM.minimumSpanningTree).apply(void 0,[e,t,n])};Kt.minimumSpanningTreeAsync=C7;var A7=function(e,t,n){return(0,on.default)(sn.ALGORITHM.pageRank).apply(void 0,[e,t,n])};Kt.pageRankAsync=A7;var T7=function(e,t,n){return(0,on.default)(sn.ALGORITHM.getNeighbors).apply(void 0,[e,t,n])};Kt.getNeighborsAsync=T7;var I7=function(e,t,n,i,a,o,s){return n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),(0,on.default)(sn.ALGORITHM.GADDI).apply(void 0,[e,t,n,i,a,o,s])};Kt.GADDIAsync=I7;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"GADDIAsync",{enumerable:!0,get:function(){return e.GADDIAsync}}),Object.defineProperty(r,"connectedComponentAsync",{enumerable:!0,get:function(){return e.connectedComponentAsync}}),r.default=void 0,Object.defineProperty(r,"detectAllCyclesAsync",{enumerable:!0,get:function(){return e.detectAllCyclesAsync}}),Object.defineProperty(r,"detectAllDirectedCycleAsync",{enumerable:!0,get:function(){return e.detectAllDirectedCycleAsync}}),Object.defineProperty(r,"detectAllUndirectedCycleAsync",{enumerable:!0,get:function(){return e.detectAllUndirectedCycleAsync}}),Object.defineProperty(r,"detectCycleAsync",{enumerable:!0,get:function(){return e.detectCycleAsync}}),r.detectDirectedCycleAsync=void 0,Object.defineProperty(r,"dijkstraAsync",{enumerable:!0,get:function(){return e.dijkstraAsync}}),Object.defineProperty(r,"findAllPathAsync",{enumerable:!0,get:function(){return e.findAllPathAsync}}),Object.defineProperty(r,"findShortestPathAsync",{enumerable:!0,get:function(){return e.findShortestPathAsync}}),Object.defineProperty(r,"floydWarshallAsync",{enumerable:!0,get:function(){return e.floydWarshallAsync}}),Object.defineProperty(r,"getAdjMatrixAsync",{enumerable:!0,get:function(){return e.getAdjMatrixAsync}}),Object.defineProperty(r,"getDegreeAsync",{enumerable:!0,get:function(){return e.getDegreeAsync}}),Object.defineProperty(r,"getInDegreeAsync",{enumerable:!0,get:function(){return e.getInDegreeAsync}}),Object.defineProperty(r,"getNeighborsAsync",{enumerable:!0,get:function(){return e.getNeighborsAsync}}),Object.defineProperty(r,"getOutDegreeAsync",{enumerable:!0,get:function(){return e.getOutDegreeAsync}}),Object.defineProperty(r,"labelPropagationAsync",{enumerable:!0,get:function(){return e.labelPropagationAsync}}),Object.defineProperty(r,"louvainAsync",{enumerable:!0,get:function(){return e.louvainAsync}}),Object.defineProperty(r,"minimumSpanningTreeAsync",{enumerable:!0,get:function(){return e.minimumSpanningTreeAsync}}),Object.defineProperty(r,"pageRankAsync",{enumerable:!0,get:function(){return e.pageRankAsync}});var e=Kt,t=e.detectCycleAsync;r.detectDirectedCycleAsync=t;var n={getAdjMatrixAsync:e.getAdjMatrixAsync,connectedComponentAsync:e.connectedComponentAsync,getDegreeAsync:e.getDegreeAsync,getInDegreeAsync:e.getInDegreeAsync,getOutDegreeAsync:e.getOutDegreeAsync,detectCycleAsync:e.detectCycleAsync,detectDirectedCycleAsync:t,detectAllCyclesAsync:e.detectAllCyclesAsync,detectAllDirectedCycleAsync:e.detectAllDirectedCycleAsync,detectAllUndirectedCycleAsync:e.detectAllUndirectedCycleAsync,dijkstraAsync:e.dijkstraAsync,findAllPathAsync:e.findAllPathAsync,findShortestPathAsync:e.findShortestPathAsync,floydWarshallAsync:e.floydWarshallAsync,labelPropagationAsync:e.labelPropagationAsync,louvainAsync:e.louvainAsync,minimumSpanningTreeAsync:e.minimumSpanningTreeAsync,pageRankAsync:e.pageRankAsync,getNeighborsAsync:e.getNeighborsAsync,GADDIAsync:e.GADDIAsync};r.default=n})(e1);const k7=pa(e1),L7=L5({__proto__:null,default:k7},[e1]);function N7(){return window?window.devicePixelRatio:1}function pk(r,e,t,n){var i=r-t,a=e-n;return Math.sqrt(i*i+a*a)}function vs(r,e,t,n,i,a){return i>=r&&i<=r+t&&a>=e&&a<=e+n}function Il(r,e){return!(e.minX>r.maxX||e.maxX<r.minX||e.minY>r.maxY||e.maxY<r.minY)}function O7(r,e){return!r||!e?r||e:{minX:Math.min(r.minX,e.minX),minY:Math.min(r.minY,e.minY),maxX:Math.max(r.maxX,e.maxX),maxY:Math.max(r.maxY,e.maxY)}}function m2(r,e){return r[0]===e[0]&&r[1]===e[1]}var D7=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,P7=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,R7=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,gk=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function yk(r,e){var t=r.match(gk);me(t,function(n){var i=n.split(":");e.addColorStop(i[0],i[1])})}function B7(r,e,t){var n=D7.exec(t),i=parseFloat(n[1])%360*(Math.PI/180),a=n[2],o=e.getBBox(),s,u;i>=0&&i<1/2*Math.PI?(s={x:o.minX,y:o.minY},u={x:o.maxX,y:o.maxY}):1/2*Math.PI<=i&&i<Math.PI?(s={x:o.maxX,y:o.minY},u={x:o.minX,y:o.maxY}):Math.PI<=i&&i<3/2*Math.PI?(s={x:o.maxX,y:o.maxY},u={x:o.minX,y:o.minY}):(s={x:o.minX,y:o.maxY},u={x:o.maxX,y:o.minY});var f=Math.tan(i),l=f*f,c=(u.x-s.x+f*(u.y-s.y))/(l+1)+s.x,h=f*(u.x-s.x+f*(u.y-s.y))/(l+1)+s.y,d=r.createLinearGradient(s.x,s.y,c,h);return yk(a,d),d}function F7(r,e,t){var n=P7.exec(t),i=parseFloat(n[1]),a=parseFloat(n[2]),o=parseFloat(n[3]),s=n[4];if(o===0){var u=s.match(gk);return u[u.length-1].split(":")[1]}var f=e.getBBox(),l=f.maxX-f.minX,c=f.maxY-f.minY,h=Math.sqrt(l*l+c*c)/2,d=r.createRadialGradient(f.minX+l*i,f.minY+c*a,0,f.minX+l/2,f.minY+c/2,o*h);return yk(s,d),d}function G7(r,e,t){if(e.get("patternSource")&&e.get("patternSource")===t)return e.get("pattern");var n,i,a=R7.exec(t),o=a[1],s=a[2];function u(){n=r.createPattern(i,o),e.set("pattern",n),e.set("patternSource",t)}switch(o){case"a":o="repeat";break;case"x":o="repeat-x";break;case"y":o="repeat-y";break;case"n":o="no-repeat";break;default:o="no-repeat"}return i=new Image,s.match(/^data:/i)||(i.crossOrigin="Anonymous"),i.src=s,i.complete?u():(i.onload=u,i.src=i.src),n}function z7(r,e,t){var n=e.getBBox();if(isNaN(n.x)||isNaN(n.y)||isNaN(n.width)||isNaN(n.height))return t;if(Pe(t)){if(t[1]==="("||t[2]==="("){if(t[0]==="l")return B7(r,e,t);if(t[0]==="r")return F7(r,e,t);if(t[0]==="p")return G7(r,e,t)}return t}if(t instanceof CanvasPattern)return t}function $7(r){var e=0,t=0,n=0,i=0;return pt(r)?r.length===1?e=t=n=i=r[0]:r.length===2?(e=n=r[0],t=i=r[1]):r.length===3?(e=r[0],t=i=r[1],n=r[2]):(e=r[0],t=r[1],n=r[2],i=r[3]):e=t=n=i=r,[e,t,n,i]}function ph(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function fy(r,e){return ph(r)*ph(e)?(r[0]*e[0]+r[1]*e[1])/(ph(r)*ph(e)):1}function b2(r,e){return(r[0]*e[1]<r[1]*e[0]?-1:1)*Math.acos(fy(r,e))}function x2(r,e){var t=e[1],n=e[2],i=gv(yv(e[3]),Math.PI*2),a=e[4],o=e[5],s=r[0],u=r[1],f=e[6],l=e[7],c=Math.cos(i)*(s-f)/2+Math.sin(i)*(u-l)/2,h=-1*Math.sin(i)*(s-f)/2+Math.cos(i)*(u-l)/2,d=c*c/(t*t)+h*h/(n*n);d>1&&(t*=Math.sqrt(d),n*=Math.sqrt(d));var v=t*t*(h*h)+n*n*(c*c),p=v?Math.sqrt((t*t*(n*n)-v)/v):1;a===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*t*h/n:0,y=t?p*-n*c/t:0,m=(s+f)/2+Math.cos(i)*g-Math.sin(i)*y,b=(u+l)/2+Math.sin(i)*g+Math.cos(i)*y,x=[(c-g)/t,(h-y)/n],w=[(-1*c-g)/t,(-1*h-y)/n],E=b2([1,0],x),_=b2(x,w);return fy(x,w)<=-1&&(_=Math.PI),fy(x,w)>=1&&(_=0),o===0&&_>0&&(_=_-2*Math.PI),o===1&&_<0&&(_=_+2*Math.PI),{cx:m,cy:b,rx:m2(r,[f,l])?0:t,ry:m2(r,[f,l])?0:n,startAngle:E,endAngle:E+_,xRotation:i,arcFlag:a,sweepFlag:o}}var Pd=Math.sin,Rd=Math.cos,i1=Math.atan2,gh=Math.PI;function mk(r,e,t,n,i,a,o){var s=e.stroke,u=e.lineWidth,f=t-i,l=n-a,c=i1(l,f),h=new u1({type:"path",canvas:r.get("canvas"),isArrowShape:!0,attrs:{path:"M"+10*Rd(gh/6)+","+10*Pd(gh/6)+" L0,0 L"+10*Rd(gh/6)+",-"+10*Pd(gh/6),stroke:s,lineWidth:u}});h.translate(i,a),h.rotateAtPoint(i,a,c),r.set(o?"startArrowShape":"endArrowShape",h)}function bk(r,e,t,n,i,a,o){var s=e.startArrow,u=e.endArrow,f=e.stroke,l=e.lineWidth,c=o?s:u,h=c.d,d=c.fill,v=c.stroke,p=c.lineWidth,g=nn(c,["d","fill","stroke","lineWidth"]),y=t-i,m=n-a,b=i1(m,y);h&&(i=i-Rd(b)*h,a=a-Pd(b)*h);var x=new u1({type:"path",canvas:r.get("canvas"),isArrowShape:!0,attrs:B(B({},g),{stroke:v||f,lineWidth:p||l,fill:d})});x.translate(i,a),x.rotateAtPoint(i,a,b),r.set(o?"startArrowShape":"endArrowShape",x)}function ys(r,e,t,n,i){var a=i1(n-e,t-r);return{dx:Rd(a)*i,dy:Pd(a)*i}}function a1(r,e,t,n,i,a){typeof e.startArrow=="object"?bk(r,e,t,n,i,a,!0):e.startArrow?mk(r,e,t,n,i,a,!0):r.set("startArrowShape",null)}function o1(r,e,t,n,i,a){typeof e.endArrow=="object"?bk(r,e,t,n,i,a,!1):e.endArrow?mk(r,e,t,n,i,a,!1):r.set("startArrowShape",null)}var w2={fill:"fillStyle",stroke:"strokeStyle",opacity:"globalAlpha"};function Fu(r,e){var t=e.attr();for(var n in t){var i=t[n],a=w2[n]?w2[n]:n;a==="matrix"&&i?r.transform(i[0],i[1],i[3],i[4],i[6],i[7]):a==="lineDash"&&r.setLineDash?pt(i)&&r.setLineDash(i):(a==="strokeStyle"||a==="fillStyle"?i=z7(r,e,i):a==="globalAlpha"&&(i=i*r.globalAlpha),r[a]=i)}}function ly(r,e,t){for(var n=0;n<e.length;n++){var i=e[n];i.cfg.visible?i.draw(r,t):i.skipDraw()}}function j7(r,e,t){var n=r.get("refreshElements");me(n,function(i){if(i!==r)for(var a=i.cfg.parent;a&&a!==r&&!a.cfg.refresh;)a.cfg.refresh=!0,a=a.cfg.parent}),n[0]===r?s1(e):cy(e,t)}function cy(r,e){for(var t=0;t<r.length;t++){var n=r[t];if(n.cfg.visible)if(n.cfg.hasChanged)n.cfg.refresh=!0,n.isGroup()&&s1(n.cfg.children);else if(n.cfg.refresh)n.isGroup()&&cy(n.cfg.children,e);else{var i=U7(n,e);n.cfg.refresh=i,i&&n.isGroup()&&cy(n.cfg.children,e)}}}function xk(r){for(var e=0;e<r.length;e++){var t=r[e];t.cfg.hasChanged=!1,t.isGroup()&&!t.destroyed&&xk(t.cfg.children)}}function s1(r,e){for(var t=0;t<r.length;t++){var n=r[t];n.cfg.visible&&(n.cfg.refresh=!0,n.isGroup()&&s1(n.get("children")))}}function U7(r,e){var t=r.cfg.cacheCanvasBBox,n=r.cfg.isInView&&t&&Il(t,e);return n}function wk(r,e,t,n){var i=t.path,a=t.startArrow,o=t.endArrow;if(i){var s=[0,0],u=[0,0],f={dx:0,dy:0};e.beginPath();for(var l=0;l<i.length;l++){var c=i[l],h=c[0];if(l===0&&a&&a.d){var d=r.getStartTangent();f=ys(d[0][0],d[0][1],d[1][0],d[1][1],a.d)}else if(l===i.length-2&&i[l+1][0]==="Z"&&o&&o.d){var v=i[l+1];if(v[0]==="Z"){var d=r.getEndTangent();f=ys(d[0][0],d[0][1],d[1][0],d[1][1],o.d)}}else if(l===i.length-1&&o&&o.d&&i[0]!=="Z"){var d=r.getEndTangent();f=ys(d[0][0],d[0][1],d[1][0],d[1][1],o.d)}var p=f.dx,g=f.dy;switch(h){case"M":e.moveTo(c[1]-p,c[2]-g),u=[c[1],c[2]];break;case"L":e.lineTo(c[1]-p,c[2]-g);break;case"Q":e.quadraticCurveTo(c[1],c[2],c[3]-p,c[4]-g);break;case"C":e.bezierCurveTo(c[1],c[2],c[3],c[4],c[5]-p,c[6]-g);break;case"A":{var y=void 0;n?(y=n[l],y||(y=x2(s,c),n[l]=y)):y=x2(s,c);var m=y.cx,b=y.cy,x=y.rx,w=y.ry,E=y.startAngle,_=y.endAngle,M=y.xRotation,C=y.sweepFlag;if(e.ellipse)e.ellipse(m,b,x,w,M,E,_,1-C);else{var S=x>w?x:w,A=x>w?1:x/w,T=x>w?w/x:1;e.translate(m,b),e.rotate(M),e.scale(A,T),e.arc(0,0,S,E,_,1-C),e.scale(1/A,1/T),e.rotate(-M),e.translate(-m,-b)}break}case"Z":e.closePath();break}if(h==="Z")s=u;else{var k=c.length;s=[c[k-2],c[k-1]]}}}}function Ek(r,e){var t=r.get("canvas");t&&(e==="remove"&&(r._cacheCanvasBBox=r.get("cacheCanvasBBox")),r.get("hasChanged")||(r.set("hasChanged",!0),r.cfg.parent&&r.cfg.parent.get("hasChanged")||(t.refreshElement(r,e,t),t.get("autoDraw")&&t.draw())))}function X7(r){var e;if(r.destroyed)e=r._cacheCanvasBBox;else{var t=r.get("cacheCanvasBBox"),n=t&&!!(t.width&&t.height),i=r.getCanvasBBox(),a=i&&!!(i.width&&i.height);n&&a?e=O7(t,i):n?e=t:a&&(e=i)}return e}function Y7(r){if(!r.length)return null;var e=[],t=[],n=[],i=[];return me(r,function(a){var o=X7(a);o&&(e.push(o.minX),t.push(o.minY),n.push(o.maxX),i.push(o.maxY))}),{minX:ha(e),minY:ha(t),maxX:ca(n),maxY:ca(i)}}function W7(r,e){return!r||!e||!Il(r,e)?null:{minX:Math.max(r.minX,e.minX),minY:Math.max(r.minY,e.minY),maxX:Math.min(r.maxX,e.maxX),maxY:Math.min(r.maxY,e.maxY)}}var _k=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onCanvasChange=function(t){Ek(this,t)},e.prototype.getShapeBase=function(){return lm},e.prototype.getGroupBase=function(){return e},e.prototype._applyClip=function(t,n){n&&(t.save(),Fu(t,n),n.createPath(t),t.restore(),t.clip(),n._afterDraw())},e.prototype.cacheCanvasBBox=function(){var t=this.cfg.children,n=[],i=[];me(t,function(h){var d=h.cfg.cacheCanvasBBox;d&&h.cfg.isInView&&(n.push(d.minX,d.maxX),i.push(d.minY,d.maxY))});var a=null;if(n.length){var o=ha(n),s=ca(n),u=ha(i),f=ca(i);a={minX:o,minY:u,x:o,y:u,maxX:s,maxY:f,width:s-o,height:f-u};var l=this.cfg.canvas;if(l){var c=l.getViewRange();this.set("isInView",Il(a,c))}}else this.set("isInView",!1);this.set("cacheCanvasBBox",a)},e.prototype.draw=function(t,n){var i=this.cfg.children,a=n?this.cfg.refresh:!0;i.length&&a&&(t.save(),Fu(t,this),this._applyClip(t,this.getClip()),ly(t,i,n),t.restore(),this.cacheCanvasBBox()),this.cfg.refresh=null,this.set("hasChanged",!1)},e.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("hasChanged",!1)},e}(iI),Ri=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.getShapeBase=function(){return lm},e.prototype.getGroupBase=function(){return _k},e.prototype.onCanvasChange=function(t){Ek(this,t)},e.prototype.calculateBBox=function(){var t=this.get("type"),n=this.getHitLineWidth(),i=sI(t),a=i(this),o=n/2,s=a.x-o,u=a.y-o,f=a.x+a.width+o,l=a.y+a.height+o;return{x:s,minX:s,y:u,minY:u,width:a.width+n,height:a.height+n,maxX:f,maxY:l}},e.prototype.isFill=function(){return!!this.attrs.fill||this.isClipShape()},e.prototype.isStroke=function(){return!!this.attrs.stroke},e.prototype._applyClip=function(t,n){n&&(t.save(),Fu(t,n),n.createPath(t),t.restore(),t.clip(),n._afterDraw())},e.prototype.draw=function(t,n){var i=this.cfg.clipShape;if(n){if(this.cfg.refresh===!1){this.set("hasChanged",!1);return}var a=this.getCanvasBBox();if(!Il(n,a)){this.set("hasChanged",!1),this.cfg.isInView&&this._afterDraw();return}}t.save(),Fu(t,this),this._applyClip(t,i),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 n=this.getCanvasBBox(),i=Il(n,t);this.set("isInView",i),i?this.set("cacheCanvasBBox",n):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 n=this.attrs,i=n.lineWidth,a=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isFill()&&(!ct(s)&&s!==1?(t.globalAlpha=s,this.fill(t),t.globalAlpha=a):this.fill(t)),this.isStroke()&&i>0&&(!ct(o)&&o!==1&&(t.globalAlpha=o),this.stroke(t)),this.afterDrawPath(t)},e.prototype.createPath=function(t){},e.prototype.afterDrawPath=function(t){},e.prototype.isInShape=function(t,n){var i=this.isStroke(),a=this.isFill(),o=this.getHitLineWidth();return this.isInStrokeOrPath(t,n,i,a,o)},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){return!1},e.prototype.getHitLineWidth=function(){if(!this.isStroke())return 0;var t=this.attrs;return t.lineWidth+t.lineAppendWidth},e}(aI),V7=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,r:0})},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr(),u=s.x,f=s.y,l=s.r,c=o/2,h=pk(u,f,t,n);return a&&i?h<=l+c:a?h<=l:i?h>=l-c&&h<=l+c:!1},e.prototype.createPath=function(t){var n=this.attr(),i=n.x,a=n.y,o=n.r;t.beginPath(),t.arc(i,a,o,0,Math.PI*2,!1),t.closePath()},e}(Ri);function yh(r,e,t,n){return r/(t*t)+e/(n*n)}var H7=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,rx:0,ry:0})},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr(),u=o/2,f=s.x,l=s.y,c=s.rx,h=s.ry,d=(t-f)*(t-f),v=(n-l)*(n-l);return a&&i?yh(d,v,c+u,h+u)<=1:a?yh(d,v,c,h)<=1:i?yh(d,v,c-u,h-u)>=1&&yh(d,v,c+u,h+u)<=1:!1},e.prototype.createPath=function(t){var n=this.attr(),i=n.x,a=n.y,o=n.rx,s=n.ry;if(t.beginPath(),t.ellipse)t.ellipse(i,a,o,s,0,0,Math.PI*2,!1);else{var u=o>s?o:s,f=o>s?1:o/s,l=o>s?s/o:1;t.save(),t.translate(i,a),t.scale(f,l),t.arc(0,0,u,0,Math.PI*2),t.restore(),t.closePath()}},e}(Ri);function E2(r){return r instanceof HTMLElement&&Pe(r.nodeName)&&r.nodeName.toUpperCase()==="CANVAS"}var q7=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{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(this.get("toDraw")===!0){var t=this.get("canvas");t?t.draw():this.createPath(this.get("context"))}},e.prototype._setImage=function(t){var n=this,i=this.attrs;if(Pe(t)){var a=new Image;a.onload=function(){if(n.destroyed)return!1;n.attr("img",a),n.set("loading",!1),n._afterLoading();var o=n.get("callback");o&&o.call(n)},a.crossOrigin="Anonymous",a.src=t,this.set("loading",!0)}else t instanceof Image?(i.width||(i.width=t.width),i.height||(i.height=t.height)):E2(t)&&(i.width||(i.width=Number(t.getAttribute("width"))),i.height||(i.height,Number(t.getAttribute("height"))))},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),t==="img"&&this._setImage(n)},e.prototype.createPath=function(t){if(this.get("loading")){this.set("toDraw",!0),this.set("context",t);return}var n=this.attr(),i=n.x,a=n.y,o=n.width,s=n.height,u=n.sx,f=n.sy,l=n.swidth,c=n.sheight,h=n.img;(h instanceof Image||E2(h))&&(!ct(u)&&!ct(f)&&!ct(l)&&!ct(c)?t.drawImage(h,u,f,l,c,i,a,o,s):t.drawImage(h,i,a,o,s))},e}(Ri);function mo(r,e,t,n,i,a,o){var s=Math.min(r,t),u=Math.max(r,t),f=Math.min(e,n),l=Math.max(e,n),c=i/2;return a>=s-c&&a<=u+c&&o>=f-c&&o<=l+c?gn.pointToLine(r,e,t,n,a,o)<=i/2:!1}var Z7=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this.setArrow()},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),this.setArrow()},e.prototype.setArrow=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2,s=t.startArrow,u=t.endArrow;s&&a1(this,t,a,o,n,i),u&&o1(this,t,n,i,a,o)},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){if(!i||!o)return!1;var s=this.attr(),u=s.x1,f=s.y1,l=s.x2,c=s.y2;return mo(u,f,l,c,o,t,n)},e.prototype.createPath=function(t){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2,u=n.startArrow,f=n.endArrow,l={dx:0,dy:0},c={dx:0,dy:0};u&&u.d&&(l=ys(i,a,o,s,n.startArrow.d)),f&&f.d&&(c=ys(i,a,o,s,n.endArrow.d)),t.beginPath(),t.moveTo(i+l.dx,a+l.dy),t.lineTo(o-c.dx,s-c.dy)},e.prototype.afterDrawPath=function(t){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(t),i&&i.draw(t)},e.prototype.getTotalLength=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2;return gn.length(n,i,a,o)},e.prototype.getPoint=function(t){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2;return gn.pointAt(i,a,o,s,t)},e}(Ri),K7={circle:function(r,e,t){return[["M",r-t,e],["A",t,t,0,1,0,r+t,e],["A",t,t,0,1,0,r-t,e]]},square:function(r,e,t){return[["M",r-t,e-t],["L",r+t,e-t],["L",r+t,e+t],["L",r-t,e+t],["Z"]]},diamond:function(r,e,t){return[["M",r-t,e],["L",r,e-t],["L",r+t,e],["L",r,e+t],["Z"]]},triangle:function(r,e,t){var n=t*Math.sin(.3333333333333333*Math.PI);return[["M",r-t,e+n],["L",r,e-n],["L",r+t,e+n],["Z"]]},"triangle-down":function(r,e,t){var n=t*Math.sin(.3333333333333333*Math.PI);return[["M",r-t,e-n],["L",r+t,e-n],["L",r,e+n],["Z"]]}},Q7=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.initAttrs=function(t){this._resetParamsCache()},e.prototype._resetParamsCache=function(){this.set("paramsCache",{})},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),["symbol","x","y","r","radius"].indexOf(t)!==-1&&this._resetParamsCache()},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._getR=function(t){return ct(t.r)?t.radius:t.r},e.prototype._getPath=function(){var t=this.attr(),n=t.x,i=t.y,a=t.symbol||"circle",o=this._getR(t),s,u;if(Mr(a))s=a,u=s(n,i,o),u=xI(u);else{if(s=e.Symbols[a],!s)return console.warn(a+" marker is not supported."),null;u=s(n,i,o)}return u},e.prototype.createPath=function(t){var n=this._getPath(),i=this.get("paramsCache");wk(this,t,{path:n},i)},e.Symbols=K7,e}(Ri);function Sk(r,e,t){var n=gI();return r.createPath(n),n.isPointInPath(e,t)}var J7=1e-6;function kg(r){return Math.abs(r)<J7?0:r<0?-1:1}function eX(r,e,t){return(t[0]-r[0])*(e[1]-r[1])===(e[0]-r[0])*(t[1]-r[1])&&Math.min(r[0],e[0])<=t[0]&&t[0]<=Math.max(r[0],e[0])&&Math.min(r[1],e[1])<=t[1]&&t[1]<=Math.max(r[1],e[1])}function Mk(r,e,t){var n=!1,i=r.length;if(i<=2)return!1;for(var a=0;a<i;a++){var o=r[a],s=r[(a+1)%i];if(eX(o,s,[e,t]))return!0;kg(o[1]-t)>0!=kg(s[1]-t)>0&&kg(e-(t-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}function Vf(r,e,t,n,i,a,o,s){var u=(Math.atan2(s-e,o-r)+Math.PI*2)%(Math.PI*2);if(u<n||u>i)return!1;var f={x:r+t*Math.cos(u),y:e+t*Math.sin(u)};return pk(f.x,f.y,o,s)<=a/2}var tX=yi;function rX(r){for(var e=!1,t=r.length,n=0;n<t;n++){var i=r[n],a=i[0];if(a==="C"||a==="A"||a==="Q"){e=!0;break}}return e}function nX(r,e,t,n,i){for(var a=!1,o=e/2,s=0;s<r.length;s++){var u=r[s],f=u.currentPoint,l=u.params,c=u.prePoint,h=u.box;if(!(h&&!vs(h.x-o,h.y-o,h.width+e,h.height+e,t,n))){switch(u.command){case"L":case"Z":a=mo(c[0],c[1],f[0],f[1],e,t,n);break;case"Q":var d=hI.pointDistance(c[0],c[1],l[1],l[2],l[3],l[4],t,n);a=d<=e/2;break;case"C":var v=nl.pointDistance(c[0],c[1],l[1],l[2],l[3],l[4],l[5],l[6],t,n,i);a=v<=e/2;break;case"A":var p=u.arcParams,g=p.cx,y=p.cy,m=p.rx,b=p.ry,x=p.startAngle,w=p.endAngle,E=p.xRotation,_=[t,n,1],M=m>b?m:b,C=m>b?1:m/b,S=m>b?b/m:1,A=tX(null,[["t",-g,-y],["r",-E],["s",1/C,1/S]]);bv(_,_,A),a=Vf(0,0,M,x,w,e,_[0],_[1]);break}if(a)break}}return a}function iX(r){for(var e=r.length,t=[],n=[],i=[],a=0;a<e;a++){var o=r[a],s=o[0];s==="M"?(i.length&&(n.push(i),i=[]),i.push([o[1],o[2]])):s==="Z"?i.length&&(t.push(i),i=[]):i.push([o[1],o[2]])}return i.length>0&&n.push(i),{polygons:t,polylines:n}}const mh=B({hasArc:rX,extractPolygons:iX,isPointInStroke:nX},l8);function _2(r,e,t){for(var n=!1,i=0;i<r.length;i++){var a=r[i];if(n=Mk(a,e,t),n)break}return n}var u1=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this._setPathArr(t.path),this.setArrow()},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),t==="path"&&this._setPathArr(n),this.setArrow()},e.prototype._setPathArr=function(t){this.attrs.path=xI(t);var n=mh.hasArc(t);this.set("hasArc",n),this.set("paramsCache",{}),this.set("segments",null),this.set("curve",null),this.set("tCache",null),this.set("totalLength",null)},e.prototype.getSegments=function(){var t=this.get("segements");return t||(t=wI(this.attr("path")),this.set("segments",t)),t},e.prototype.setArrow=function(){var t=this.attr(),n=t.startArrow,i=t.endArrow;if(n){var a=this.getStartTangent();a1(this,t,a[0][0],a[0][1],a[1][0],a[1][1])}if(i){var a=this.getEndTangent();o1(this,t,a[0][0],a[0][1],a[1][0],a[1][1])}},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.getSegments(),u=this.get("hasArc"),f=!1;if(i){var l=this.getTotalLength();f=mh.isPointInStroke(s,o,t,n,l)}if(!f&&a)if(u)f=Sk(this,t,n);else{var c=this.attr("path"),h=mh.extractPolygons(c);f=_2(h.polygons,t,n)||_2(h.polylines,t,n)}return f},e.prototype.createPath=function(t){var n=this.attr(),i=this.get("paramsCache");wk(this,t,n,i)},e.prototype.afterDrawPath=function(t){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(t),i&&i.draw(t)},e.prototype.getTotalLength=function(){var t=this.get("totalLength");return ct(t)?(this._calculateCurve(),this._setTcache(),this.get("totalLength")):t},e.prototype.getPoint=function(t){var n=this.get("tCache");n||(this._calculateCurve(),this._setTcache(),n=this.get("tCache"));var i,a,o=this.get("curve");if(!n||n.length===0)return o?{x:o[0][1],y:o[0][2]}:null;me(n,function(l,c){t>=l[0]&&t<=l[1]&&(i=(t-l[0])/(l[1]-l[0]),a=c)});var s=o[a];if(ct(s)||ct(a))return null;var u=s.length,f=o[a+1];return nl.pointAt(s[u-2],s[u-1],f[1],f[2],f[3],f[4],f[5],f[6],i)},e.prototype._calculateCurve=function(){var t=this.attr().path;this.set("curve",mh.pathToCurve(t))},e.prototype._setTcache=function(){var t=0,n=0,i=[],a,o,s,u,f=this.get("curve");if(f){if(me(f,function(l,c){s=f[c+1],u=l.length,s&&(t+=nl.length(l[u-2],l[u-1],s[1],s[2],s[3],s[4],s[5],s[6])||0)}),this.set("totalLength",t),t===0){this.set("tCache",[]);return}me(f,function(l,c){s=f[c+1],u=l.length,s&&(a=[],a[0]=n/t,o=nl.length(l[u-2],l[u-1],s[1],s[2],s[3],s[4],s[5],s[6]),n+=o||0,a[1]=n/t,i.push(a))}),this.set("tCache",i)}},e.prototype.getStartTangent=function(){var t=this.getSegments(),n;if(t.length>1){var i=t[0].currentPoint,a=t[1].currentPoint,o=t[1].startTangent;n=[],o?(n.push([i[0]-o[0],i[1]-o[1]]),n.push([i[0],i[1]])):(n.push([a[0],a[1]]),n.push([i[0],i[1]]))}return n},e.prototype.getEndTangent=function(){var t=this.getSegments(),n=t.length,i;if(n>1){var a=t[n-2].currentPoint,o=t[n-1].currentPoint,s=t[n-1].endTangent;i=[],s?(i.push([o[0]-s[0],o[1]-s[1]]),i.push([o[0],o[1]])):(i.push([a[0],a[1]]),i.push([o[0],o[1]]))}return i},e}(Ri);function Ck(r,e,t,n,i){var a=r.length;if(a<2)return!1;for(var o=0;o<a-1;o++){var s=r[o][0],u=r[o][1],f=r[o+1][0],l=r[o+1][1];if(mo(s,u,f,l,e,t,n))return!0}if(i){var c=r[0],h=r[a-1];if(mo(c[0],c[1],h[0],h[1],e,t,n))return!0}return!1}var aX=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr().points,u=!1;return i&&(u=Ck(s,o,t,n,!0)),!u&&a&&(u=Mk(s,t,n)),u},e.prototype.createPath=function(t){var n=this.attr(),i=n.points;if(!(i.length<2)){t.beginPath();for(var a=0;a<i.length;a++){var o=i[a];a===0?t.moveTo(o[0],o[1]):t.lineTo(o[0],o[1])}t.closePath()}},e}(Ri),oX=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this.setArrow()},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),this.setArrow(),["points"].indexOf(t)!==-1&&this._resetCache()},e.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},e.prototype.setArrow=function(){var t=this.attr(),n=this.attrs,i=n.points,a=n.startArrow,o=n.endArrow,s=i.length,u=i[0][0],f=i[0][1],l=i[s-1][0],c=i[s-1][1];a&&a1(this,t,i[1][0],i[1][1],u,f),o&&o1(this,t,i[s-2][0],i[s-2][1],l,c)},e.prototype.isFill=function(){return!1},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){if(!i||!o)return!1;var s=this.attr().points;return Ck(s,o,t,n,!1)},e.prototype.isStroke=function(){return!0},e.prototype.createPath=function(t){var n=this.attr(),i=n.points,a=n.startArrow,o=n.endArrow,s=i.length;if(!(i.length<2)){var u=i[0][0],f=i[0][1],l=i[s-1][0],c=i[s-1][1];if(a&&a.d){var h=ys(u,f,i[1][0],i[1][1],a.d);u+=h.dx,f+=h.dy}if(o&&o.d){var h=ys(i[s-2][0],i[s-2][1],l,c,o.d);l-=h.dx,c-=h.dy}t.beginPath(),t.moveTo(u,f);for(var d=0;d<s-1;d++){var v=i[d];t.lineTo(v[0],v[1])}t.lineTo(l,c)}},e.prototype.afterDrawPath=function(t){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(t),i&&i.draw(t)},e.prototype.getTotalLength=function(){var t=this.attr().points,n=this.get("totalLength");return ct(n)?(this.set("totalLength",pI.length(t)),this.get("totalLength")):n},e.prototype.getPoint=function(t){var n=this.attr().points,i=this.get("tCache");i||(this._setTcache(),i=this.get("tCache"));var a,o;return me(i,function(s,u){t>=s[0]&&t<=s[1]&&(a=(t-s[0])/(s[1]-s[0]),o=u)}),gn.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],a)},e.prototype._setTcache=function(){var t=this.attr().points;if(!(!t||t.length===0)){var n=this.getTotalLength();if(!(n<=0)){var i=0,a=[],o,s;me(t,function(u,f){t[f+1]&&(o=[],o[0]=i/n,s=gn.length(u[0],u[1],t[f+1][0],t[f+1][1]),i+=s,o[1]=i/n,a.push(o))}),this.set("tCache",a)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,n=[];return n.push([t[1][0],t[1][1]]),n.push([t[0][0],t[0][1]]),n},e.prototype.getEndTangent=function(){var t=this.attr().points,n=t.length-1,i=[];return i.push([t[n-1][0],t[n-1][1]]),i.push([t[n][0],t[n][1]]),i},e}(Ri);function sX(r,e,t,n,i,a,o){var s=i/2;return vs(r-s,e-s,t,i,a,o)||vs(r+t-s,e-s,i,n,a,o)||vs(r+s,e+n-s,t,i,a,o)||vs(r-s,e+s,i,n,a,o)}function uX(r,e,t,n,i,a,o,s){return mo(r+i,e,r+t-i,e,a,o,s)||mo(r+t,e+i,r+t,e+n-i,a,o,s)||mo(r+t-i,e+n,r+i,e+n,a,o,s)||mo(r,e+n-i,r,e+i,a,o,s)||Vf(r+t-i,e+i,i,1.5*Math.PI,2*Math.PI,a,o,s)||Vf(r+t-i,e+n-i,i,0,.5*Math.PI,a,o,s)||Vf(r+i,e+n-i,i,.5*Math.PI,Math.PI,a,o,s)||Vf(r+i,e+i,i,Math.PI,1.5*Math.PI,a,o,s)}var fX=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr(),u=s.x,f=s.y,l=s.width,c=s.height,h=s.radius;if(h){var v=!1;return i&&(v=uX(u,f,l,c,h,o,t,n)),!v&&a&&(v=Sk(this,t,n)),v}else{var d=o/2;if(a&&i)return vs(u-d,f-d,l+d,c+d,t,n);if(a)return vs(u,f,l,c,t,n);if(i)return sX(u,f,l,c,o,t,n)}},e.prototype.createPath=function(t){var n=this.attr(),i=n.x,a=n.y,o=n.width,s=n.height,u=n.radius;if(t.beginPath(),u===0)t.rect(i,a,o,s);else{var f=$7(u),l=f[0],c=f[1],h=f[2],d=f[3];t.moveTo(i+l,a),t.lineTo(i+o-c,a),c!==0&&t.arc(i+o-c,a+c,c,-Math.PI/2,0),t.lineTo(i+o,a+s-h),h!==0&&t.arc(i+o-h,a+s-h,h,0,Math.PI/2),t.lineTo(i+d,a+s),d!==0&&t.arc(i+d,a+s-d,d,Math.PI/2,Math.PI),t.lineTo(i,a+l),l!==0&&t.arc(i+l,a+l,l,Math.PI,Math.PI*1.5),t.closePath()}},e}(Ri),lX=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{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=mI(t)},e.prototype._setText=function(t){var n=null;Pe(t)&&t.indexOf(`
|
|
21
|
-
`)!==-1&&(n=t.split(`
|
|
22
|
-
`)),this.set("textArr",n)},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),t.startsWith("font")&&this._assembleFont(),t==="text"&&this._setText(n)},e.prototype._getSpaceingY=function(){var t=this.attrs,n=t.lineHeight,i=t.fontSize*1;return n?n-i:i*.14},e.prototype._drawTextArr=function(t,n,i){var a=this.attrs,o=a.textBaseline,s=a.x,u=a.y,f=a.fontSize*1,l=this._getSpaceingY(),c=yI(a.text,a.fontSize,a.lineHeight),h;me(n,function(d,v){h=u+v*(l+f)-c+f,o==="middle"&&(h+=c-f-(c-f)/2),o==="top"&&(h+=c-f),ct(d)||(i?t.fillText(d,s,h):t.strokeText(d,s,h))})},e.prototype._drawText=function(t,n){var i=this.attr(),a=i.x,o=i.y,s=this.get("textArr");if(s)this._drawTextArr(t,s,n);else{var u=i.text;ct(u)||(n?t.fillText(u,a,o):t.strokeText(u,a,o))}},e.prototype.strokeAndFill=function(t){var n=this.attrs,i=n.lineWidth,a=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isStroke()&&i>0&&(!ct(o)&&o!==1&&(t.globalAlpha=a),this.stroke(t)),this.isFill()&&(!ct(s)&&s!==1?(t.globalAlpha=s,this.fill(t),t.globalAlpha=a):this.fill(t)),this.afterDrawPath(t)},e.prototype.fill=function(t){this._drawText(t,!0)},e.prototype.stroke=function(t){this._drawText(t,!1)},e}(Ri);function cX(r,e){if(e){var t=zT(e);return hs(t,r)}return r}function Ak(r,e,t){var n=r.getTotalMatrix();if(n){var i=cX([e,t,1],n),a=i[0],o=i[1];return[a,o]}return[e,t]}function S2(r,e,t){if(r.isCanvas&&r.isCanvas())return!0;if(!F0(r)||r.cfg.isInView===!1)return!1;if(r.cfg.clipShape){var n=Ak(r,e,t),i=n[0],a=n[1];if(r.isClipped(i,a))return!1}var o=r.cfg.cacheCanvasBBox||r.getCanvasBBox();return e>=o.minX&&e<=o.maxX&&t>=o.minY&&t<=o.maxY}function Tk(r,e,t){if(!S2(r,e,t))return null;for(var n=null,i=r.getChildren(),a=i.length,o=a-1;o>=0;o--){var s=i[o];if(s.isGroup())n=Tk(s,e,t);else if(S2(s,e,t)){var u=s,f=Ak(s,e,t),l=f[0],c=f[1];u.isInShape(l,c)&&(n=s)}if(n)break}return n}var Ra=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.renderer="canvas",t.autoDraw=!0,t.localRefresh=!0,t.refreshElements=[],t.clipView=!0,t.quickHit=!1,t},e.prototype.onCanvasChange=function(t){(t==="attr"||t==="sort"||t==="changeSize")&&(this.set("refreshElements",[this]),this.draw())},e.prototype.getShapeBase=function(){return lm},e.prototype.getGroupBase=function(){return _k},e.prototype.getPixelRatio=function(){var t=this.get("pixelRatio")||N7();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"),n=t.getContext("2d");return this.set("context",n),t},e.prototype.setDOMSize=function(t,n){r.prototype.setDOMSize.call(this,t,n);var i=this.get("context"),a=this.get("el"),o=this.getPixelRatio();a.width=o*t,a.height=o*n,o>1&&i.scale(o,o)},e.prototype.clear=function(){r.prototype.clear.call(this),this._clearFrame();var t=this.get("context"),n=this.get("el");t.clearRect(0,0,n.width,n.height)},e.prototype.getShape=function(t,n){var i;return this.get("quickHit")?i=Tk(this,t,n):i=r.prototype.getShape.call(this,t,n,null),i},e.prototype._getRefreshRegion=function(){var t=this.get("refreshElements"),n=this.getViewRange(),i;if(t.length&&t[0]===this)i=n;else if(i=Y7(t),i){i.minX=Math.floor(i.minX),i.minY=Math.floor(i.minY),i.maxX=Math.ceil(i.maxX),i.maxY=Math.ceil(i.maxY),i.maxY+=1;var a=this.get("clipView");a&&(i=W7(i,n))}return i},e.prototype.refreshElement=function(t){var n=this.get("refreshElements");n.push(t)},e.prototype._clearFrame=function(){var t=this.get("drawFrame");t&&(TC(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"),n=this.get("el"),i=this.getChildren();t.clearRect(0,0,n.width,n.height),Fu(t,this),ly(t,i),this.set("refreshElements",[])},e.prototype._drawRegion=function(){var t=this.get("context"),n=this.get("refreshElements"),i=this.getChildren(),a=this._getRefreshRegion();a?(t.clearRect(a.minX,a.minY,a.maxX-a.minX,a.maxY-a.minY),t.save(),t.beginPath(),t.rect(a.minX,a.minY,a.maxX-a.minX,a.maxY-a.minY),t.clip(),Fu(t,this),j7(this,i,a),ly(t,i,a),t.restore()):n.length&&xk(n),me(n,function(o){o.get("hasChanged")&&o.set("hasChanged",!1)}),this.set("refreshElements",[])},e.prototype._startDraw=function(){var t=this,n=this.get("drawFrame"),i=this.get("drawFrameCallback");n||(n=AC(function(){t.get("localRefresh")?t._drawRegion():t._drawAll(),t.set("drawFrame",null),i&&i()}),this.set("drawFrame",n))},e.prototype.skipDraw=function(){},e.prototype.removeDom=function(){var t=this.get("el");t.width=0,t.height=0,t.parentNode.removeChild(t)},e}(nI),hy={rect:"path",circle:"circle",line:"line",path:"path",marker:"path",text:"text",polyline:"polyline",polygon:"polygon",image:"image",ellipse:"ellipse",dom:"foreignObject"},or={opacity:"opacity",fillStyle:"fill",fill:"fill",fillOpacity:"fill-opacity",strokeStyle:"stroke",strokeOpacity:"stroke-opacity",stroke:"stroke",x:"x",y:"y",r:"r",rx:"rx",ry:"ry",width:"width",height:"height",x1:"x1",x2:"x2",y1:"y1",y2:"y2",lineCap:"stroke-linecap",lineJoin:"stroke-linejoin",lineWidth:"stroke-width",lineDash:"stroke-dasharray",lineDashOffset:"stroke-dashoffset",miterLimit:"stroke-miterlimit",font:"font",fontSize:"font-size",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",fontFamily:"font-family",startArrow:"marker-start",endArrow:"marker-end",path:"d",class:"class",id:"id",style:"style",preserveAspectRatio:"preserveAspectRatio"};function pi(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Ik(r){var e=hy[r.type],t=r.getParent();if(!e)throw new Error("the type "+r.type+" is not supported by svg");var n=pi(e);if(r.get("id")&&(n.id=r.get("id")),r.set("el",n),r.set("attrs",{}),t){var i=t.get("el");i||(i=t.createDom(),t.set("el",i)),i.appendChild(n)}return n}function kk(r,e){var t=r.get("el"),n=NC(t.children).sort(e),i=document.createDocumentFragment();n.forEach(function(a){i.appendChild(a)}),t.appendChild(i)}function hX(r,e){var t=r.parentNode,n=Array.from(t.childNodes).filter(function(s){return s.nodeType===1&&s.nodeName.toLowerCase()!=="defs"}),i=n[e],a=n.indexOf(r);if(i){if(a>e)t.insertBefore(r,i);else if(a<e){var o=n[e+1];o?t.insertBefore(r,o):t.appendChild(r)}}else t.appendChild(r)}function dX(r,e){var t=r.cfg.el,n=r.attr(),i={dx:n.shadowOffsetX,dy:n.shadowOffsetY,blur:n.shadowBlur,color:n.shadowColor};if(!i.dx&&!i.dy&&!i.blur&&!i.color)t.removeAttribute("filter");else{var a=e.find("filter",i);a||(a=e.addShadow(i)),t.setAttribute("filter","url(#"+a+")")}}function Hl(r){var e=r.attr().matrix;if(e){for(var t=r.cfg.el,n=[],i=0;i<9;i+=3)n.push(e[i]+","+e[i+1]);n=n.join(","),n.indexOf("NaN")===-1?t.setAttribute("transform","matrix("+n+")"):console.warn("invalid matrix:",e)}}function kl(r,e){var t=r.getClip(),n=r.get("el");if(!t)n.removeAttribute("clip-path");else if(t&&!n.hasAttribute("clip-path")){Ik(t),t.createPath(e);var i=e.addClip(t);n.setAttribute("clip-path","url(#"+i+")")}}function Lk(r,e){e.forEach(function(t){t.draw(r)})}function Nk(r,e){var t=r.get("canvas");if(t&&t.get("autoDraw")){var n=t.get("context"),i=r.getParent(),a=i?i.getChildren():[t],o=r.get("el");if(e==="remove"){var s=r.get("isClipShape");if(s){var u=o&&o.parentNode,f=u&&u.parentNode;u&&f&&f.removeChild(u)}else o&&o.parentNode&&o.parentNode.removeChild(o)}else if(e==="show")o.setAttribute("visibility","visible");else if(e==="hide")o.setAttribute("visibility","hidden");else if(e==="zIndex")hX(o,a.indexOf(r));else if(e==="sort"){var l=r.get("children");l&&l.length&&kk(r,function(c,h){return l.indexOf(c)-l.indexOf(h)?1:0})}else e==="clear"?o&&(o.innerHTML=""):e==="matrix"?Hl(r):e==="clip"?kl(r,n):e==="attr"||e==="add"&&r.draw(n)}}var Ok=function(r){kt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isEntityGroup=function(){return!0},e.prototype.createDom=function(){var t=pi("g");this.set("el",t);var n=this.getParent();if(n){var i=n.get("el");i||(i=n.createDom(),n.set("el",i)),i.appendChild(t)}return t},e.prototype.afterAttrsChange=function(t){r.prototype.afterAttrsChange.call(this,t);var n=this.get("canvas");if(n&&n.get("autoDraw")){var i=n.get("context");this.createPath(i,t)}},e.prototype.onCanvasChange=function(t){Nk(this,t)},e.prototype.getShapeBase=function(){return cm},e.prototype.getGroupBase=function(){return e},e.prototype.draw=function(t){var n=this.getChildren(),i=this.get("el");this.get("destroyed")?i&&i.parentNode.removeChild(i):(i||this.createDom(),kl(this,t),this.createPath(t),n.length&&Lk(t,n))},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");me(n||i,function(o,s){or[s]&&a.setAttribute(or[s],o)}),Hl(this)},e}(iI),mi=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="svg",t.canFill=!1,t.canStroke=!1,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.afterAttrsChange=function(t){r.prototype.afterAttrsChange.call(this,t);var n=this.get("canvas");if(n&&n.get("autoDraw")){var i=n.get("context");this.draw(i,t)}},e.prototype.getShapeBase=function(){return cm},e.prototype.getGroupBase=function(){return Ok},e.prototype.onCanvasChange=function(t){Nk(this,t)},e.prototype.calculateBBox=function(){var t=this.get("el"),n=null;if(t)n=t.getBBox();else{var i=sI(this.get("type"));i&&(n=i(this))}if(n){var a=n.x,o=n.y,s=n.width,u=n.height,f=this.getHitLineWidth(),l=f/2,c=a-l,h=o-l,d=a+s+l,v=o+u+l;return{x:c,y:h,minX:c,minY:h,maxX:d,maxY:v,width:s+f,height:u+f}}return{x:0,y:0,minX:0,minY:0,maxX:0,maxY:0,width:0,height:0}},e.prototype.isFill=function(){var t=this.attr(),n=t.fill,i=t.fillStyle;return(n||i||this.isClipShape())&&this.canFill},e.prototype.isStroke=function(){var t=this.attr(),n=t.stroke,i=t.strokeStyle;return(n||i)&&this.canStroke},e.prototype.draw=function(t,n){var i=this.get("el");this.get("destroyed")?i&&i.parentNode.removeChild(i):(i||Ik(this),kl(this,t),this.createPath(t,n),this.shadow(t,n),this.strokeAndFill(t,n),this.transform(n))},e.prototype.createPath=function(t,n){},e.prototype.strokeAndFill=function(t,n){var i=n||this.attr(),a=i.fill,o=i.fillStyle,s=i.stroke,u=i.strokeStyle,f=i.fillOpacity,l=i.strokeOpacity,c=i.lineWidth,h=this.get("el");this.canFill&&(n?"fill"in i?this._setColor(t,"fill",a):"fillStyle"in i&&this._setColor(t,"fill",o):this._setColor(t,"fill",a||o),f&&h.setAttribute(or.fillOpacity,f)),this.canStroke&&c>0&&(n?"stroke"in i?this._setColor(t,"stroke",s):"strokeStyle"in i&&this._setColor(t,"stroke",u):this._setColor(t,"stroke",s||u),l&&h.setAttribute(or.strokeOpacity,l),c&&h.setAttribute(or.lineWidth,c))},e.prototype._setColor=function(t,n,i){var a=this.get("el");if(!i){a.setAttribute(or[n],"none");return}if(i=i.trim(),/^[r,R,L,l]{1}[\s]*\(/.test(i)){var o=t.find("gradient",i);o||(o=t.addGradient(i)),a.setAttribute(or[n],"url(#"+o+")")}else if(/^[p,P]{1}[\s]*\(/.test(i)){var o=t.find("pattern",i);o||(o=t.addPattern(i)),a.setAttribute(or[n],"url(#"+o+")")}else a.setAttribute(or[n],i)},e.prototype.shadow=function(t,n){var i=this.attr(),a=n||i,o=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,f=a.shadowColor;(o||s||u||f)&&dX(this,t)},e.prototype.transform=function(t){var n=this.attr(),i=(t||n).matrix;i&&Hl(this)},e.prototype.isInShape=function(t,n){return this.isPointInPath(t,n)},e.prototype.isPointInPath=function(t,n){var i=this.get("el"),a=this.get("canvas"),o=a.get("el").getBoundingClientRect(),s=t+o.left,u=n+o.top,f=document.elementFromPoint(s,u);return!!(f&&f.isEqualNode(i))},e.prototype.getHitLineWidth=function(){var t=this.attrs,n=t.lineWidth,i=t.lineAppendWidth;return this.isStroke()?n+i:0},e}(aI),vX=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="circle",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,r:0})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");me(n||i,function(o,s){s==="x"||s==="y"?a.setAttribute("c"+s,o):or[s]&&a.setAttribute(or[s],o)})},e}(mi),pX=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dom",t.canFill=!1,t.canStroke=!1,t}return e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");if(me(n||i,function(f,l){or[l]&&a.setAttribute(or[l],f)}),typeof i.html=="function"){var o=i.html.call(this,i);if(o instanceof Element||o instanceof HTMLDocument){for(var s=a.childNodes,u=s.length-1;u>=0;u--)a.removeChild(s[u]);a.appendChild(o)}else a.innerHTML=o}else a.innerHTML=i.html},e}(mi),gX=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="ellipse",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,rx:0,ry:0})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");me(n||i,function(o,s){s==="x"||s==="y"?a.setAttribute("c"+s,o):or[s]&&a.setAttribute(or[s],o)})},e}(mi),yX=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="image",t.canFill=!1,t.canStroke=!1,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,width:0,height:0})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el");me(n||a,function(s,u){u==="img"?i._setImage(a.img):or[u]&&o.setAttribute(or[u],s)})},e.prototype.setAttr=function(t,n){this.attrs[t]=n,t==="img"&&this._setImage(n)},e.prototype._setImage=function(t){var n=this.attr(),i=this.get("el");if(Pe(t))i.setAttribute("href",t);else if(t instanceof window.Image)n.width||(i.setAttribute("width",t.width),this.attr("width",t.width)),n.height||(i.setAttribute("height",t.height),this.attr("height",t.height)),i.setAttribute("href",t.src);else if(t instanceof HTMLElement&&Pe(t.nodeName)&&t.nodeName.toUpperCase()==="CANVAS")i.setAttribute("href",t.toDataURL());else if(t instanceof ImageData){var a=document.createElement("canvas");a.setAttribute("width",""+t.width),a.setAttribute("height",""+t.height),a.getContext("2d").putImageData(t,0,0),n.width||(i.setAttribute("width",""+t.width),this.attr("width",t.width)),n.height||(i.setAttribute("height",""+t.height),this.attr("height",t.height)),i.setAttribute("href",a.toDataURL())}},e}(mi),mX=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="line",t.canFill=!1,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");me(n||i,function(o,s){if(s==="startArrow"||s==="endArrow")if(o){var u=yn(o)?t.addArrow(i,or[s]):t.getDefaultArrow(i,or[s]);a.setAttribute(or[s],"url(#"+u+")")}else a.removeAttribute(or[s]);else or[s]&&a.setAttribute(or[s],o)})},e.prototype.getTotalLength=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2;return gn.length(n,i,a,o)},e.prototype.getPoint=function(t){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2;return gn.pointAt(i,a,o,s,t)},e}(mi),bh={circle:function(r,e,t){return[["M",r,e],["m",-t,0],["a",t,t,0,1,0,t*2,0],["a",t,t,0,1,0,-t*2,0]]},square:function(r,e,t){return[["M",r-t,e-t],["L",r+t,e-t],["L",r+t,e+t],["L",r-t,e+t],["Z"]]},diamond:function(r,e,t){return[["M",r-t,e],["L",r,e-t],["L",r+t,e],["L",r,e+t],["Z"]]},triangle:function(r,e,t){var n=t*Math.sin(.3333333333333333*Math.PI);return[["M",r-t,e+n],["L",r,e-n],["L",r+t,e+n],["z"]]},triangleDown:function(r,e,t){var n=t*Math.sin(.3333333333333333*Math.PI);return[["M",r-t,e-n],["L",r+t,e-n],["L",r,e+n],["Z"]]}};const M2={get:function(r){return bh[r]},register:function(r,e){bh[r]=e},remove:function(r){delete bh[r]},getAll:function(){return bh}};var bX=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="marker",t.canFill=!0,t.canStroke=!0,t}return e.prototype.createPath=function(t){var n=this.get("el");n.setAttribute("d",this._assembleMarker())},e.prototype._assembleMarker=function(){var t=this._getPath();return pt(t)?t.map(function(n){return n.join(" ")}).join(""):t},e.prototype._getPath=function(){var t=this.attr(),n=t.x,i=t.y,a=t.r||t.radius,o=t.symbol||"circle",s;return Mr(o)?s=o:s=M2.get(o),s?s(n,i,a):(console.warn(s+" symbol is not exist."),null)},e.symbolsFactory=M2,e}(mi),xX=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="path",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el");me(n||a,function(s,u){if(u==="path"&&pt(s))o.setAttribute("d",i._formatPath(s));else if(u==="startArrow"||u==="endArrow")if(s){var f=yn(s)?t.addArrow(a,or[u]):t.getDefaultArrow(a,or[u]);o.setAttribute(or[u],"url(#"+f+")")}else o.removeAttribute(or[u]);else or[u]&&o.setAttribute(or[u],s)})},e.prototype._formatPath=function(t){var n=t.map(function(i){return i.join(" ")}).join("");return~n.indexOf("NaN")?"":n},e.prototype.getTotalLength=function(){var t=this.get("el");return t?t.getTotalLength():null},e.prototype.getPoint=function(t){var n=this.get("el"),i=this.getTotalLength();if(i===0)return null;var a=n?n.getPointAtLength(t*i):null;return a?{x:a.x,y:a.y}:null},e}(mi),wX=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="polygon",t.canFill=!0,t.canStroke=!0,t}return e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");me(n||i,function(o,s){s==="points"&&pt(o)&&o.length>=2?a.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):or[s]&&a.setAttribute(or[s],o)})},e}(mi),EX=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="polyline",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{startArrow:!1,endArrow:!1})},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),["points"].indexOf(t)!==-1&&this._resetCache()},e.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");me(n||i,function(o,s){s==="points"&&pt(o)&&o.length>=2?a.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):or[s]&&a.setAttribute(or[s],o)})},e.prototype.getTotalLength=function(){var t=this.attr().points,n=this.get("totalLength");return ct(n)?(this.set("totalLength",pI.length(t)),this.get("totalLength")):n},e.prototype.getPoint=function(t){var n=this.attr().points,i=this.get("tCache");i||(this._setTcache(),i=this.get("tCache"));var a,o;return me(i,function(s,u){t>=s[0]&&t<=s[1]&&(a=(t-s[0])/(s[1]-s[0]),o=u)}),gn.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],a)},e.prototype._setTcache=function(){var t=this.attr().points;if(!(!t||t.length===0)){var n=this.getTotalLength();if(!(n<=0)){var i=0,a=[],o,s;me(t,function(u,f){t[f+1]&&(o=[],o[0]=i/n,s=gn.length(u[0],u[1],t[f+1][0],t[f+1][1]),i+=s,o[1]=i/n,a.push(o))}),this.set("tCache",a)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,n=[];return n.push([t[1][0],t[1][1]]),n.push([t[0][0],t[0][1]]),n},e.prototype.getEndTangent=function(){var t=this.attr().points,n=t.length-1,i=[];return i.push([t[n-1][0],t[n-1][1]]),i.push([t[n][0],t[n][1]]),i},e}(mi);function _X(r){var e=0,t=0,n=0,i=0;return pt(r)?r.length===1?e=t=n=i=r[0]:r.length===2?(e=n=r[0],t=i=r[1]):r.length===3?(e=r[0],t=i=r[1],n=r[2]):(e=r[0],t=r[1],n=r[2],i=r[3]):e=t=n=i=r,{r1:e,r2:t,r3:n,r4:i}}var SX=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="rect",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el"),s=!1,u=["x","y","width","height","radius"];me(n||a,function(f,l){u.indexOf(l)!==-1&&!s?(o.setAttribute("d",i._assembleRect(a)),s=!0):u.indexOf(l)===-1&&or[l]&&o.setAttribute(or[l],f)})},e.prototype._assembleRect=function(t){var n=t.x,i=t.y,a=t.width,o=t.height,s=t.radius;if(!s)return"M "+n+","+i+" l "+a+",0 l 0,"+o+" l"+-a+" 0 z";var u=_X(s);pt(s)?s.length===1?u.r1=u.r2=u.r3=u.r4=s[0]:s.length===2?(u.r1=u.r3=s[0],u.r2=u.r4=s[1]):s.length===3?(u.r1=s[0],u.r2=u.r4=s[1],u.r3=s[2]):(u.r1=s[0],u.r2=s[1],u.r3=s[2],u.r4=s[3]):u.r1=u.r2=u.r3=u.r4=s;var f=[["M "+(n+u.r1)+","+i],["l "+(a-u.r1-u.r2)+",0"],["a "+u.r2+","+u.r2+",0,0,1,"+u.r2+","+u.r2],["l 0,"+(o-u.r2-u.r3)],["a "+u.r3+","+u.r3+",0,0,1,"+-u.r3+","+u.r3],["l "+(u.r3+u.r4-a)+",0"],["a "+u.r4+","+u.r4+",0,0,1,"+-u.r4+","+-u.r4],["l 0,"+(u.r4+u.r1-o)],["a "+u.r1+","+u.r1+",0,0,1,"+u.r1+","+-u.r1],["z"]];return f.join(" ")},e}(mi),C2=.3,MX={top:"before-edge",middle:"central",bottom:"after-edge",alphabetic:"baseline",hanging:"hanging"},CX={top:"text-before-edge",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",hanging:"hanging"},AX={left:"left",start:"left",center:"middle",right:"end",end:"end"},TX=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="text",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{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,n){var i=this,a=this.attr(),o=this.get("el");this._setFont(),me(n||a,function(s,u){u==="text"?i._setText(""+s):u==="matrix"&&s?Hl(i):or[u]&&o.setAttribute(or[u],s)}),o.setAttribute("paint-order","stroke"),o.setAttribute("style","stroke-linecap:butt; stroke-linejoin:miter;")},e.prototype._setFont=function(){var t=this.get("el"),n=this.attr(),i=n.textBaseline,a=n.textAlign,o=GT();o&&o.name==="firefox"?t.setAttribute("dominant-baseline",CX[i]||"alphabetic"):t.setAttribute("alignment-baseline",MX[i]||"baseline"),t.setAttribute("text-anchor",AX[a]||"left")},e.prototype._setText=function(t){var n=this.get("el"),i=this.attr(),a=i.x,o=i.textBaseline,s=o===void 0?"bottom":o;if(!t)n.innerHTML="";else if(~t.indexOf(`
|
|
23
|
-
`)){var u=t.split(`
|
|
24
|
-
`),f=u.length-1,l="";me(u,function(c,h){h===0?s==="alphabetic"?l+='<tspan x="'+a+'" dy="'+-f+'em">'+c+"</tspan>":s==="top"?l+='<tspan x="'+a+'" dy="0.9em">'+c+"</tspan>":s==="middle"?l+='<tspan x="'+a+'" dy="'+-(f-1)/2+'em">'+c+"</tspan>":s==="bottom"?l+='<tspan x="'+a+'" dy="-'+(f+C2)+'em">'+c+"</tspan>":s==="hanging"&&(l+='<tspan x="'+a+'" dy="'+(-(f-1)-C2)+'em">'+c+"</tspan>"):l+='<tspan x="'+a+'" dy="1em">'+c+"</tspan>"}),n.innerHTML=l}else n.innerHTML=t},e}(mi),IX=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,kX=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,LX=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function Dk(r){var e=r.match(LX);if(!e)return"";var t="";return e.sort(function(n,i){return n=n.split(":"),i=i.split(":"),Number(n[0])-Number(i[0])}),me(e,function(n){n=n.split(":"),t+='<stop offset="'+n[0]+'" stop-color="'+n[1]+'"></stop>'}),t}function NX(r,e){var t=IX.exec(r),n=gv(yv(parseFloat(t[1])),Math.PI*2),i=t[2],a,o;n>=0&&n<.5*Math.PI?(a={x:0,y:0},o={x:1,y:1}):.5*Math.PI<=n&&n<Math.PI?(a={x:1,y:0},o={x:0,y:1}):Math.PI<=n&&n<1.5*Math.PI?(a={x:1,y:1},o={x:0,y:0}):(a={x:0,y:1},o={x:1,y:0});var s=Math.tan(n),u=s*s,f=(o.x-a.x+s*(o.y-a.y))/(u+1)+a.x,l=s*(o.x-a.x+s*(o.y-a.y))/(u+1)+a.y;e.setAttribute("x1",a.x),e.setAttribute("y1",a.y),e.setAttribute("x2",f),e.setAttribute("y2",l),e.innerHTML=Dk(i)}function OX(r,e){var t=kX.exec(r),n=parseFloat(t[1]),i=parseFloat(t[2]),a=parseFloat(t[3]),o=t[4];e.setAttribute("cx",n),e.setAttribute("cy",i),e.setAttribute("r",a),e.innerHTML=Dk(o)}var DX=function(){function r(e){this.cfg={};var t=null,n=da("gradient_");return e.toLowerCase()[0]==="l"?(t=pi("linearGradient"),NX(e,t)):(t=pi("radialGradient"),OX(e,t)),t.setAttribute("id",n),this.el=t,this.id=n,this.cfg=e,this}return r.prototype.match=function(e,t){return this.cfg===t},r}(),PX={shadowColor:"color",shadowOpacity:"opacity",shadowBlur:"blur",shadowOffsetX:"dx",shadowOffsetY:"dy"},RX={x:"-40%",y:"-40%",width:"200%",height:"200%"},BX=function(){function r(e){this.type="filter",this.cfg={},this.type="filter";var t=pi("filter");return me(RX,function(n,i){t.setAttribute(i,n)}),this.el=t,this.id=da("filter_"),this.el.id=this.id,this.cfg=e,this._parseShadow(e,t),this}return r.prototype.match=function(e,t){if(this.type!==e)return!1;var n=!0,i=this.cfg;return me(Object.keys(i),function(a){if(i[a]!==t[a])return n=!1,!1}),n},r.prototype.update=function(e,t){var n=this.cfg;return n[PX[e]]=t,this._parseShadow(n,this.el),this},r.prototype._parseShadow=function(e,t){var n=`<feDropShadow
|
|
25
|
-
dx="`+(e.dx||0)+`"
|
|
26
|
-
dy="`+(e.dy||0)+`"
|
|
27
|
-
stdDeviation="`+(e.blur?e.blur/10:0)+`"
|
|
28
|
-
flood-color="`+(e.color?e.color:"#000")+`"
|
|
29
|
-
flood-opacity="`+(e.opacity?e.opacity:1)+`"
|
|
30
|
-
/>`;t.innerHTML=n},r}(),A2=function(){function r(e,t){this.cfg={};var n=pi("marker"),i=da("marker_");n.setAttribute("id",i);var a=pi("path");a.setAttribute("stroke",e.stroke||"none"),a.setAttribute("fill",e.fill||"none"),n.appendChild(a),n.setAttribute("overflow","visible"),n.setAttribute("orient","auto-start-reverse"),this.el=n,this.child=a,this.id=i;var o=e[t==="marker-start"?"startArrow":"endArrow"];return this.stroke=e.stroke||"#000",o===!0?this._setDefaultPath(t,a):(this.cfg=o,this._setMarker(e.lineWidth,a)),this}return r.prototype.match=function(){return!1},r.prototype._setDefaultPath=function(e,t){var n=this.el;t.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")},r.prototype._setMarker=function(e,t){var n=this.el,i=this.cfg.path,a=this.cfg.d;pt(i)&&(i=i.map(function(o){return o.join(" ")}).join("")),t.setAttribute("d",i),n.appendChild(t),a&&n.setAttribute("refX",""+a/e)},r.prototype.update=function(e){var t=this.child;t.attr?t.attr("fill",e):t.setAttribute("fill",e)},r}(),FX=function(){function r(e){this.type="clip",this.cfg={};var t=pi("clipPath");this.el=t,this.id=da("clip_"),t.id=this.id;var n=e.cfg.el;return t.appendChild(n),this.cfg=e,this}return r.prototype.match=function(){return!1},r.prototype.remove=function(){var e=this.el;e.parentNode.removeChild(e)},r}(),GX=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,zX=function(){function r(e){this.cfg={};var t=pi("pattern");t.setAttribute("patternUnits","userSpaceOnUse");var n=pi("image");t.appendChild(n);var i=da("pattern_");t.id=i,this.el=t,this.id=i,this.cfg=e;var a=GX.exec(e),o=a[2];n.setAttribute("href",o);var s=new Image;o.match(/^data:/i)||(s.crossOrigin="Anonymous"),s.src=o;function u(){t.setAttribute("width",""+s.width),t.setAttribute("height",""+s.height)}return s.complete?u():(s.onload=u,s.src=s.src),this}return r.prototype.match=function(e,t){return this.cfg===t},r}(),$X=function(){function r(e){var t=pi("defs"),n=da("defs_");t.id=n,e.appendChild(t),this.children=[],this.defaultArrow={},this.el=t,this.canvas=e}return r.prototype.find=function(e,t){for(var n=this.children,i=null,a=0;a<n.length;a++)if(n[a].match(e,t)){i=n[a].id;break}return i},r.prototype.findById=function(e){for(var t=this.children,n=null,i=0;i<t.length;i++)if(t[i].id===e){n=t[i];break}return n},r.prototype.add=function(e){this.children.push(e),e.canvas=this.canvas,e.parent=this},r.prototype.getDefaultArrow=function(e,t){var n=e.stroke||e.strokeStyle;if(this.defaultArrow[n])return this.defaultArrow[n].id;var i=new A2(e,t);return this.defaultArrow[n]=i,this.el.appendChild(i.el),this.add(i),i.id},r.prototype.addGradient=function(e){var t=new DX(e);return this.el.appendChild(t.el),this.add(t),t.id},r.prototype.addArrow=function(e,t){var n=new A2(e,t);return this.el.appendChild(n.el),this.add(n),n.id},r.prototype.addShadow=function(e){var t=new BX(e);return this.el.appendChild(t.el),this.add(t),t.id},r.prototype.addPattern=function(e){var t=new zX(e);return this.el.appendChild(t.el),this.add(t),t.id},r.prototype.addClip=function(e){var t=new FX(e);return this.el.appendChild(t.el),this.add(t),t.id},r}(),al=function(r){kt(e,r);function e(t){return r.call(this,B(B({},t),{autoDraw:!0,renderer:"svg"}))||this}return e.prototype.getShapeBase=function(){return cm},e.prototype.getGroupBase=function(){return Ok},e.prototype.getShape=function(t,n,i){var a=i.target||i.srcElement;if(!hy[a.tagName]){for(var o=a.parentNode;o&&!hy[o.tagName];)o=o.parentNode;a=o}return this.find(function(s){return s.get("el")===a})},e.prototype.createDom=function(){var t=pi("svg"),n=new $X(t);return t.setAttribute("width",""+this.get("width")),t.setAttribute("height",""+this.get("height")),this.set("context",n),t},e.prototype.onCanvasChange=function(t){var n=this.get("context"),i=this.get("el");if(t==="sort"){var a=this.get("children");a&&a.length&&kk(this,function(s,u){return a.indexOf(s)-a.indexOf(u)?1:0})}else if(t==="clear"){if(i){i.innerHTML="";var o=n.el;o.innerHTML="",i.appendChild(o)}}else t==="matrix"?Hl(this):t==="clip"?kl(this,n):t==="changeSize"&&(i.setAttribute("width",""+this.get("width")),i.setAttribute("height",""+this.get("height")))},e.prototype.draw=function(){var t=this.get("context"),n=this.getChildren();kl(this,t),n.length&&Lk(t,n)},e}(nI);function xh(r,e,t){if(r){if(typeof r.addEventListener=="function")return r.addEventListener(e,t,!1),{remove:function(){r.removeEventListener(e,t,!1)}};if(typeof r.attachEvent=="function")return r.attachEvent("on"+e,t),{remove:function(){r.detachEvent("on"+e,t)}}}}var Hf,Lg,Pk,dy;function jX(){Hf=document.createElement("table"),Lg=document.createElement("tr"),Pk=/^\s*<(\w+|!)[^>]*>/,dy={tr:document.createElement("tbody"),tbody:Hf,thead:Hf,tfoot:Hf,td:Lg,th:Lg,"*":document.createElement("div")}}function Er(r){Hf||jX();var e=Pk.test(r)&&RegExp.$1;(!e||!(e in dy))&&(e="*");var t=dy[e];r=typeof r=="string"?r.replace(/(^\s*)|(\s*$)/g,""):r,t.innerHTML=""+r;var n=t.childNodes[0];return n&&t.contains(n)&&t.removeChild(n),n}function Xt(r,e){if(r)for(var t in e)e.hasOwnProperty(t)&&(r.style[t]=e[t]);return r}var Rk={exports:{}},UX={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]},Bk={exports:{}},XX=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")},YX=XX,WX=Array.prototype.concat,VX=Array.prototype.slice,T2=Bk.exports=function(e){for(var t=[],n=0,i=e.length;n<i;n++){var a=e[n];YX(a)?t=WX.call(t,VX.call(a)):t.push(a)}return t};T2.wrap=function(r){return function(){return r(T2(arguments))}};var HX=Bk.exports,ol=UX,ql=HX,Fk=Object.hasOwnProperty,Gk=Object.create(null);for(var Ng in ol)Fk.call(ol,Ng)&&(Gk[ol[Ng]]=Ng);var Qn=Rk.exports={to:{},get:{}};Qn.get=function(r){var e=r.substring(0,3).toLowerCase(),t,n;switch(e){case"hsl":t=Qn.get.hsl(r),n="hsl";break;case"hwb":t=Qn.get.hwb(r),n="hwb";break;default:t=Qn.get.rgb(r),n="rgb";break}return t?{model:n,value:t}:null};Qn.get.rgb=function(r){if(!r)return null;var e=/^#([a-f0-9]{3,4})$/i,t=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,a=/^(\w+)$/,o=[0,0,0,1],s,u,f;if(s=r.match(t)){for(f=s[2],s=s[1],u=0;u<3;u++){var l=u*2;o[u]=parseInt(s.slice(l,l+2),16)}f&&(o[3]=parseInt(f,16)/255)}else if(s=r.match(e)){for(s=s[1],f=s[3],u=0;u<3;u++)o[u]=parseInt(s[u]+s[u],16);f&&(o[3]=parseInt(f+f,16)/255)}else if(s=r.match(n)){for(u=0;u<3;u++)o[u]=parseInt(s[u+1],0);s[4]&&(s[5]?o[3]=parseFloat(s[4])*.01:o[3]=parseFloat(s[4]))}else if(s=r.match(i)){for(u=0;u<3;u++)o[u]=Math.round(parseFloat(s[u+1])*2.55);s[4]&&(s[5]?o[3]=parseFloat(s[4])*.01:o[3]=parseFloat(s[4]))}else return(s=r.match(a))?s[1]==="transparent"?[0,0,0,0]:Fk.call(ol,s[1])?(o=ol[s[1]],o[3]=1,o):null:null;for(u=0;u<3;u++)o[u]=So(o[u],0,255);return o[3]=So(o[3],0,1),o};Qn.get.hsl=function(r){if(!r)return null;var e=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,t=r.match(e);if(t){var n=parseFloat(t[4]),i=(parseFloat(t[1])%360+360)%360,a=So(parseFloat(t[2]),0,100),o=So(parseFloat(t[3]),0,100),s=So(isNaN(n)?1:n,0,1);return[i,a,o,s]}return null};Qn.get.hwb=function(r){if(!r)return null;var e=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,t=r.match(e);if(t){var n=parseFloat(t[4]),i=(parseFloat(t[1])%360+360)%360,a=So(parseFloat(t[2]),0,100),o=So(parseFloat(t[3]),0,100),s=So(isNaN(n)?1:n,0,1);return[i,a,o,s]}return null};Qn.to.hex=function(){var r=ql(arguments);return"#"+wh(r[0])+wh(r[1])+wh(r[2])+(r[3]<1?wh(Math.round(r[3]*255)):"")};Qn.to.rgb=function(){var r=ql(arguments);return r.length<4||r[3]===1?"rgb("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+")":"rgba("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+", "+r[3]+")"};Qn.to.rgb.percent=function(){var r=ql(arguments),e=Math.round(r[0]/255*100),t=Math.round(r[1]/255*100),n=Math.round(r[2]/255*100);return r.length<4||r[3]===1?"rgb("+e+"%, "+t+"%, "+n+"%)":"rgba("+e+"%, "+t+"%, "+n+"%, "+r[3]+")"};Qn.to.hsl=function(){var r=ql(arguments);return r.length<4||r[3]===1?"hsl("+r[0]+", "+r[1]+"%, "+r[2]+"%)":"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+r[3]+")"};Qn.to.hwb=function(){var r=ql(arguments),e="";return r.length>=4&&r[3]!==1&&(e=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+e+")"};Qn.to.keyword=function(r){return Gk[r.slice(0,3)]};function So(r,e,t){return Math.min(Math.max(e,r),t)}function wh(r){var e=Math.round(r).toString(16).toUpperCase();return e.length<2?"0"+e:e}var qX=Rk.exports,zk={exports:{}},ZX={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]},ms=ZX,$k={};for(var Og in ms)ms.hasOwnProperty(Og)&&($k[ms[Og]]=Og);var Et=zk.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 Dn in Et)if(Et.hasOwnProperty(Dn)){if(!("channels"in Et[Dn]))throw new Error("missing channels property: "+Dn);if(!("labels"in Et[Dn]))throw new Error("missing channel labels property: "+Dn);if(Et[Dn].labels.length!==Et[Dn].channels)throw new Error("channel and label counts mismatch: "+Dn);var KX=Et[Dn].channels,QX=Et[Dn].labels;delete Et[Dn].channels,delete Et[Dn].labels,Object.defineProperty(Et[Dn],"channels",{value:KX}),Object.defineProperty(Et[Dn],"labels",{value:QX})}Et.rgb.hsl=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,i=Math.min(e,t,n),a=Math.max(e,t,n),o=a-i,s,u,f;return a===i?s=0:e===a?s=(t-n)/o:t===a?s=2+(n-e)/o:n===a&&(s=4+(e-t)/o),s=Math.min(s*60,360),s<0&&(s+=360),f=(i+a)/2,a===i?u=0:f<=.5?u=o/(a+i):u=o/(2-a-i),[s,u*100,f*100]};Et.rgb.hsv=function(r){var e,t,n,i,a,o=r[0]/255,s=r[1]/255,u=r[2]/255,f=Math.max(o,s,u),l=f-Math.min(o,s,u),c=function(h){return(f-h)/6/l+1/2};return l===0?i=a=0:(a=l/f,e=c(o),t=c(s),n=c(u),o===f?i=n-t:s===f?i=1/3+e-n:u===f&&(i=2/3+t-e),i<0?i+=1:i>1&&(i-=1)),[i*360,a*100,f*100]};Et.rgb.hwb=function(r){var e=r[0],t=r[1],n=r[2],i=Et.rgb.hsl(r)[0],a=1/255*Math.min(e,Math.min(t,n));return n=1-1/255*Math.max(e,Math.max(t,n)),[i,a*100,n*100]};Et.rgb.cmyk=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,i,a,o,s;return s=Math.min(1-e,1-t,1-n),i=(1-e-s)/(1-s)||0,a=(1-t-s)/(1-s)||0,o=(1-n-s)/(1-s)||0,[i*100,a*100,o*100,s*100]};function JX(r,e){return Math.pow(r[0]-e[0],2)+Math.pow(r[1]-e[1],2)+Math.pow(r[2]-e[2],2)}Et.rgb.keyword=function(r){var e=$k[r];if(e)return e;var t=1/0,n;for(var i in ms)if(ms.hasOwnProperty(i)){var a=ms[i],o=JX(r,a);o<t&&(t=o,n=i)}return n};Et.keyword.rgb=function(r){return ms[r]};Et.rgb.xyz=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var i=e*.4124+t*.3576+n*.1805,a=e*.2126+t*.7152+n*.0722,o=e*.0193+t*.1192+n*.9505;return[i*100,a*100,o*100]};Et.rgb.lab=function(r){var e=Et.rgb.xyz(r),t=e[0],n=e[1],i=e[2],a,o,s;return t/=95.047,n/=100,i/=108.883,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=i>.008856?Math.pow(i,1/3):7.787*i+16/116,a=116*n-16,o=500*(t-n),s=200*(n-i),[a,o,s]};Et.hsl.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100,i,a,o,s,u;if(t===0)return u=n*255,[u,u,u];n<.5?a=n*(1+t):a=n+t-n*t,i=2*n-a,s=[0,0,0];for(var f=0;f<3;f++)o=e+1/3*-(f-1),o<0&&o++,o>1&&o--,6*o<1?u=i+(a-i)*6*o:2*o<1?u=a:3*o<2?u=i+(a-i)*(2/3-o)*6:u=i,s[f]=u*255;return s};Et.hsl.hsv=function(r){var e=r[0],t=r[1]/100,n=r[2]/100,i=t,a=Math.max(n,.01),o,s;return n*=2,t*=n<=1?n:2-n,i*=a<=1?a:2-a,s=(n+t)/2,o=n===0?2*i/(a+i):2*t/(n+t),[e,o*100,s*100]};Et.hsv.rgb=function(r){var e=r[0]/60,t=r[1]/100,n=r[2]/100,i=Math.floor(e)%6,a=e-Math.floor(e),o=255*n*(1-t),s=255*n*(1-t*a),u=255*n*(1-t*(1-a));switch(n*=255,i){case 0:return[n,u,o];case 1:return[s,n,o];case 2:return[o,n,u];case 3:return[o,s,n];case 4:return[u,o,n];case 5:return[n,o,s]}};Et.hsv.hsl=function(r){var e=r[0],t=r[1]/100,n=r[2]/100,i=Math.max(n,.01),a,o,s;return s=(2-t)*n,a=(2-t)*i,o=t*i,o/=a<=1?a:2-a,o=o||0,s/=2,[e,o*100,s*100]};Et.hwb.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100,i=t+n,a,o,s,u;i>1&&(t/=i,n/=i),a=Math.floor(6*e),o=1-n,s=6*e-a,a&1&&(s=1-s),u=t+s*(o-t);var f,l,c;switch(a){default:case 6:case 0:f=o,l=u,c=t;break;case 1:f=u,l=o,c=t;break;case 2:f=t,l=o,c=u;break;case 3:f=t,l=u,c=o;break;case 4:f=u,l=t,c=o;break;case 5:f=o,l=t,c=u;break}return[f*255,l*255,c*255]};Et.cmyk.rgb=function(r){var e=r[0]/100,t=r[1]/100,n=r[2]/100,i=r[3]/100,a,o,s;return a=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,t*(1-i)+i),s=1-Math.min(1,n*(1-i)+i),[a*255,o*255,s*255]};Et.xyz.rgb=function(r){var e=r[0]/100,t=r[1]/100,n=r[2]/100,i,a,o;return i=e*3.2406+t*-1.5372+n*-.4986,a=e*-.9689+t*1.8758+n*.0415,o=e*.0557+t*-.204+n*1.057,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[i*255,a*255,o*255]};Et.xyz.lab=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;return e/=95.047,t/=100,n/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=116*t-16,a=500*(e-t),o=200*(t-n),[i,a,o]};Et.lab.xyz=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;a=(e+16)/116,i=t/500+a,o=a-n/200;var s=Math.pow(a,3),u=Math.pow(i,3),f=Math.pow(o,3);return a=s>.008856?s:(a-16/116)/7.787,i=u>.008856?u:(i-16/116)/7.787,o=f>.008856?f:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]};Et.lab.lch=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;return i=Math.atan2(n,t),a=i*360/2/Math.PI,a<0&&(a+=360),o=Math.sqrt(t*t+n*n),[e,o,a]};Et.lch.lab=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;return o=n/360*2*Math.PI,i=t*Math.cos(o),a=t*Math.sin(o),[e,i,a]};Et.rgb.ansi16=function(r){var e=r[0],t=r[1],n=r[2],i=1 in arguments?arguments[1]:Et.rgb.hsv(r)[2];if(i=Math.round(i/50),i===0)return 30;var a=30+(Math.round(n/255)<<2|Math.round(t/255)<<1|Math.round(e/255));return i===2&&(a+=60),a};Et.hsv.ansi16=function(r){return Et.rgb.ansi16(Et.hsv.rgb(r),r[2])};Et.rgb.ansi256=function(r){var e=r[0],t=r[1],n=r[2];if(e===t&&t===n)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;var i=16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5);return i};Et.ansi16.rgb=function(r){var e=r%10;if(e===0||e===7)return r>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var t=(~~(r>50)+1)*.5,n=(e&1)*t*255,i=(e>>1&1)*t*255,a=(e>>2&1)*t*255;return[n,i,a]};Et.ansi256.rgb=function(r){if(r>=232){var e=(r-232)*10+8;return[e,e,e]}r-=16;var t,n=Math.floor(r/36)/5*255,i=Math.floor((t=r%36)/6)/5*255,a=t%6/5*255;return[n,i,a]};Et.rgb.hex=function(r){var e=((Math.round(r[0])&255)<<16)+((Math.round(r[1])&255)<<8)+(Math.round(r[2])&255),t=e.toString(16).toUpperCase();return"000000".substring(t.length)+t};Et.hex.rgb=function(r){var e=r.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var t=e[0];e[0].length===3&&(t=t.split("").map(function(s){return s+s}).join(""));var n=parseInt(t,16),i=n>>16&255,a=n>>8&255,o=n&255;return[i,a,o]};Et.rgb.hcg=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,i=Math.max(Math.max(e,t),n),a=Math.min(Math.min(e,t),n),o=i-a,s,u;return o<1?s=a/(1-o):s=0,o<=0?u=0:i===e?u=(t-n)/o%6:i===t?u=2+(n-e)/o:u=4+(e-t)/o+4,u/=6,u%=1,[u*360,o*100,s*100]};Et.hsl.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=1,i=0;return t<.5?n=2*e*t:n=2*e*(1-t),n<1&&(i=(t-.5*n)/(1-n)),[r[0],n*100,i*100]};Et.hsv.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=e*t,i=0;return n<1&&(i=(t-n)/(1-n)),[r[0],n*100,i*100]};Et.hcg.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100;if(t===0)return[n*255,n*255,n*255];var i=[0,0,0],a=e%1*6,o=a%1,s=1-o,u=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return u=(1-t)*n,[(t*i[0]+u)*255,(t*i[1]+u)*255,(t*i[2]+u)*255]};Et.hcg.hsv=function(r){var e=r[1]/100,t=r[2]/100,n=e+t*(1-e),i=0;return n>0&&(i=e/n),[r[0],i*100,n*100]};Et.hcg.hsl=function(r){var e=r[1]/100,t=r[2]/100,n=t*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[r[0],i*100,n*100]};Et.hcg.hwb=function(r){var e=r[1]/100,t=r[2]/100,n=e+t*(1-e);return[r[0],(n-e)*100,(1-n)*100]};Et.hwb.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=1-t,i=n-e,a=0;return i<1&&(a=(n-i)/(1-i)),[r[0],i*100,a*100]};Et.apple.rgb=function(r){return[r[0]/65535*255,r[1]/65535*255,r[2]/65535*255]};Et.rgb.apple=function(r){return[r[0]/255*65535,r[1]/255*65535,r[2]/255*65535]};Et.gray.rgb=function(r){return[r[0]/100*255,r[0]/100*255,r[0]/100*255]};Et.gray.hsl=Et.gray.hsv=function(r){return[0,0,r[0]]};Et.gray.hwb=function(r){return[0,100,r[0]]};Et.gray.cmyk=function(r){return[0,0,0,r[0]]};Et.gray.lab=function(r){return[r[0],0,0]};Et.gray.hex=function(r){var e=Math.round(r[0]/100*255)&255,t=(e<<16)+(e<<8)+e,n=t.toString(16).toUpperCase();return"000000".substring(n.length)+n};Et.rgb.gray=function(r){var e=(r[0]+r[1]+r[2])/3;return[e/255*100]};var jk=zk.exports,Bd=jk;function eY(){for(var r={},e=Object.keys(Bd),t=e.length,n=0;n<t;n++)r[e[n]]={distance:-1,parent:null};return r}function tY(r){var e=eY(),t=[r];for(e[r].distance=0;t.length;)for(var n=t.pop(),i=Object.keys(Bd[n]),a=i.length,o=0;o<a;o++){var s=i[o],u=e[s];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,t.unshift(s))}return e}function rY(r,e){return function(t){return e(r(t))}}function nY(r,e){for(var t=[e[r].parent,r],n=Bd[e[r].parent][r],i=e[r].parent;e[i].parent;)t.unshift(e[i].parent),n=rY(Bd[e[i].parent][i],n),i=e[i].parent;return n.conversion=t,n}var iY=function(r){for(var e=tY(r),t={},n=Object.keys(e),i=n.length,a=0;a<i;a++){var o=n[a],s=e[o];s.parent!==null&&(t[o]=nY(o,e))}return t},vy=jk,aY=iY,du={},oY=Object.keys(vy);function sY(r){var e=function(t){return t==null?t:(arguments.length>1&&(t=Array.prototype.slice.call(arguments)),r(t))};return"conversion"in r&&(e.conversion=r.conversion),e}function uY(r){var e=function(t){if(t==null)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var n=r(t);if(typeof n=="object")for(var i=n.length,a=0;a<i;a++)n[a]=Math.round(n[a]);return n};return"conversion"in r&&(e.conversion=r.conversion),e}oY.forEach(function(r){du[r]={},Object.defineProperty(du[r],"channels",{value:vy[r].channels}),Object.defineProperty(du[r],"labels",{value:vy[r].labels});var e=aY(r),t=Object.keys(e);t.forEach(function(n){var i=e[n];du[r][n]=uY(i),du[r][n].raw=sY(i)})});var fY=du,qf=qX,qn=fY,f1=[].slice,Uk=["keyword","gray","hex"],py={};Object.keys(qn).forEach(function(r){py[f1.call(qn[r].labels).sort().join("")]=r});var Fd={};function En(r,e){if(!(this instanceof En))return new En(r,e);if(e&&e in Uk&&(e=null),e&&!(e in qn))throw new Error("Unknown model: "+e);var t,n;if(r==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(r instanceof En)this.model=r.model,this.color=r.color.slice(),this.valpha=r.valpha;else if(typeof r=="string"){var i=qf.get(r);if(i===null)throw new Error("Unable to parse color from string: "+r);this.model=i.model,n=qn[this.model].channels,this.color=i.value.slice(0,n),this.valpha=typeof i.value[n]=="number"?i.value[n]:1}else if(r.length){this.model=e||"rgb",n=qn[this.model].channels;var a=f1.call(r,0,n);this.color=gy(a,n),this.valpha=typeof r[n]=="number"?r[n]:1}else if(typeof r=="number")r&=16777215,this.model="rgb",this.color=[r>>16&255,r>>8&255,r&255],this.valpha=1;else{this.valpha=1;var o=Object.keys(r);"alpha"in r&&(o.splice(o.indexOf("alpha"),1),this.valpha=typeof r.alpha=="number"?r.alpha:0);var s=o.sort().join("");if(!(s in py))throw new Error("Unable to parse color from object: "+JSON.stringify(r));this.model=py[s];var u=qn[this.model].labels,f=[];for(t=0;t<u.length;t++)f.push(r[u[t]]);this.color=gy(f)}if(Fd[this.model])for(n=qn[this.model].channels,t=0;t<n;t++){var l=Fd[this.model][t];l&&(this.color[t]=l(this.color[t]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}En.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(r){var e=this.model in qf.to?this:this.rgb();e=e.round(typeof r=="number"?r:1);var t=e.valpha===1?e.color:e.color.concat(this.valpha);return qf.to[e.model](t)},percentString:function(r){var e=this.rgb().round(typeof r=="number"?r:1),t=e.valpha===1?e.color:e.color.concat(this.valpha);return qf.to.rgb.percent(t)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var r={},e=qn[this.model].channels,t=qn[this.model].labels,n=0;n<e;n++)r[t[n]]=this.color[n];return this.valpha!==1&&(r.alpha=this.valpha),r},unitArray:function(){var r=this.rgb().color;return r[0]/=255,r[1]/=255,r[2]/=255,this.valpha!==1&&r.push(this.valpha),r},unitObject:function(){var r=this.rgb().object();return r.r/=255,r.g/=255,r.b/=255,this.valpha!==1&&(r.alpha=this.valpha),r},round:function(r){return r=Math.max(r||0,0),new En(this.color.map(cY(r)).concat(this.valpha),this.model)},alpha:function(r){return arguments.length?new En(this.color.concat(Math.max(0,Math.min(1,r))),this.model):this.valpha},red:Br("rgb",0,en(255)),green:Br("rgb",1,en(255)),blue:Br("rgb",2,en(255)),hue:Br(["hsl","hsv","hsl","hwb","hcg"],0,function(r){return(r%360+360)%360}),saturationl:Br("hsl",1,en(100)),lightness:Br("hsl",2,en(100)),saturationv:Br("hsv",1,en(100)),value:Br("hsv",2,en(100)),chroma:Br("hcg",1,en(100)),gray:Br("hcg",2,en(100)),white:Br("hwb",1,en(100)),wblack:Br("hwb",2,en(100)),cyan:Br("cmyk",0,en(100)),magenta:Br("cmyk",1,en(100)),yellow:Br("cmyk",2,en(100)),black:Br("cmyk",3,en(100)),x:Br("xyz",0,en(100)),y:Br("xyz",1,en(100)),z:Br("xyz",2,en(100)),l:Br("lab",0,en(100)),a:Br("lab",1),b:Br("lab",2),keyword:function(r){return arguments.length?new En(r):qn[this.model].keyword(this.color)},hex:function(r){return arguments.length?new En(r):qf.to.hex(this.rgb().round().color)},rgbNumber:function(){var r=this.rgb().color;return(r[0]&255)<<16|(r[1]&255)<<8|r[2]&255},luminosity:function(){for(var r=this.rgb().color,e=[],t=0;t<r.length;t++){var n=r[t]/255;e[t]=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}return .2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(r){var e=this.luminosity(),t=r.luminosity();return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)},level:function(r){var e=this.contrast(r);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var r=this.rgb().color,e=(r[0]*299+r[1]*587+r[2]*114)/1e3;return e<128},isLight:function(){return!this.isDark()},negate:function(){for(var r=this.rgb(),e=0;e<3;e++)r.color[e]=255-r.color[e];return r},lighten:function(r){var e=this.hsl();return e.color[2]+=e.color[2]*r,e},darken:function(r){var e=this.hsl();return e.color[2]-=e.color[2]*r,e},saturate:function(r){var e=this.hsl();return e.color[1]+=e.color[1]*r,e},desaturate:function(r){var e=this.hsl();return e.color[1]-=e.color[1]*r,e},whiten:function(r){var e=this.hwb();return e.color[1]+=e.color[1]*r,e},blacken:function(r){var e=this.hwb();return e.color[2]+=e.color[2]*r,e},grayscale:function(){var r=this.rgb().color,e=r[0]*.3+r[1]*.59+r[2]*.11;return En.rgb(e,e,e)},fade:function(r){return this.alpha(this.valpha-this.valpha*r)},opaquer:function(r){return this.alpha(this.valpha+this.valpha*r)},rotate:function(r){var e=this.hsl(),t=e.color[0];return t=(t+r)%360,t=t<0?360+t:t,e.color[0]=t,e},mix:function(r,e){if(!r||!r.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof r);var t=r.rgb(),n=this.rgb(),i=e===void 0?.5:e,a=2*i-1,o=t.alpha()-n.alpha(),s=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,u=1-s;return En.rgb(s*t.red()+u*n.red(),s*t.green()+u*n.green(),s*t.blue()+u*n.blue(),t.alpha()*i+n.alpha()*(1-i))}};Object.keys(qn).forEach(function(r){if(Uk.indexOf(r)===-1){var e=qn[r].channels;En.prototype[r]=function(){if(this.model===r)return new En(this);if(arguments.length)return new En(arguments,r);var t=typeof arguments[e]=="number"?e:this.valpha;return new En(hY(qn[this.model][r].raw(this.color)).concat(t),r)},En[r]=function(t){return typeof t=="number"&&(t=gy(f1.call(arguments),e)),new En(t,r)}}});function lY(r,e){return Number(r.toFixed(e))}function cY(r){return function(e){return lY(e,r)}}function Br(r,e,t){return r=Array.isArray(r)?r:[r],r.forEach(function(n){(Fd[n]||(Fd[n]=[]))[e]=t}),r=r[0],function(n){var i;return arguments.length?(t&&(n=t(n)),i=this[r](),i.color[e]=n,i):(i=this[r]().color[e],t&&(i=t(i)),i)}}function en(r){return function(e){return Math.max(0,Math.min(r,e))}}function hY(r){return Array.isArray(r)?r:[r]}function gy(r,e){for(var t=0;t<e;t++)typeof r[t]!="number"&&(r[t]=0);return r}var dY=En;const sl=pa(dY);function Gd(r){"@babel/helpers - typeof";return Gd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gd(r)}var vY=/^\s+/,pY=/\s+$/;function Mt(r,e){if(r=r||"",e=e||{},r instanceof Mt)return r;if(!(this instanceof Mt))return new Mt(r,e);var t=gY(r);this._originalInput=r,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.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=t.ok}Mt.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 e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,i,a,o,s;return t=e.r/255,n=e.g/255,i=e.b/255,t<=.03928?a=t/12.92:a=Math.pow((t+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),i<=.03928?s=i/12.92:s=Math.pow((i+.055)/1.055,2.4),.2126*a+.7152*o+.0722*s},setAlpha:function(e){return this._a=Xk(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=k2(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=k2(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),i=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+i+"%)":"hsva("+t+", "+n+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var e=I2(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=I2(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),i=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+i+"%)":"hsla("+t+", "+n+"%, "+i+"%, "+this._roundA+")"},toHex:function(e){return L2(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return xY(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"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(Tr(this._r,255)*100)+"%",g:Math.round(Tr(this._g,255)*100)+"%",b:Math.round(Tr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Tr(this._r,255)*100)+"%, "+Math.round(Tr(this._g,255)*100)+"%, "+Math.round(Tr(this._b,255)*100)+"%)":"rgba("+Math.round(Tr(this._r,255)*100)+"%, "+Math.round(Tr(this._g,255)*100)+"%, "+Math.round(Tr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:NY[L2(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+N2(this._r,this._g,this._b,this._a),n=t,i=this._gradientType?"GradientType = 1, ":"";if(e){var a=Mt(e);n="#"+N2(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,i=this._a<1&&this._a>=0,a=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return a?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return Mt(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(SY,arguments)},brighten:function(){return this._applyModification(MY,arguments)},darken:function(){return this._applyModification(CY,arguments)},desaturate:function(){return this._applyModification(wY,arguments)},saturate:function(){return this._applyModification(EY,arguments)},greyscale:function(){return this._applyModification(_Y,arguments)},spin:function(){return this._applyModification(AY,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(kY,arguments)},complement:function(){return this._applyCombination(TY,arguments)},monochromatic:function(){return this._applyCombination(LY,arguments)},splitcomplement:function(){return this._applyCombination(IY,arguments)},triad:function(){return this._applyCombination(O2,[3])},tetrad:function(){return this._applyCombination(O2,[4])}};Mt.fromRatio=function(r,e){if(Gd(r)=="object"){var t={};for(var n in r)r.hasOwnProperty(n)&&(n==="a"?t[n]=r[n]:t[n]=Zf(r[n]));r=t}return Mt(r,e)};function gY(r){var e={r:0,g:0,b:0},t=1,n=null,i=null,a=null,o=!1,s=!1;return typeof r=="string"&&(r=RY(r)),Gd(r)=="object"&&(Aa(r.r)&&Aa(r.g)&&Aa(r.b)?(e=yY(r.r,r.g,r.b),o=!0,s=String(r.r).substr(-1)==="%"?"prgb":"rgb"):Aa(r.h)&&Aa(r.s)&&Aa(r.v)?(n=Zf(r.s),i=Zf(r.v),e=bY(r.h,n,i),o=!0,s="hsv"):Aa(r.h)&&Aa(r.s)&&Aa(r.l)&&(n=Zf(r.s),a=Zf(r.l),e=mY(r.h,n,a),o=!0,s="hsl"),r.hasOwnProperty("a")&&(t=r.a)),t=Xk(t),{ok:o,format:r.format||s,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function yY(r,e,t){return{r:Tr(r,255)*255,g:Tr(e,255)*255,b:Tr(t,255)*255}}function I2(r,e,t){r=Tr(r,255),e=Tr(e,255),t=Tr(t,255);var n=Math.max(r,e,t),i=Math.min(r,e,t),a,o,s=(n+i)/2;if(n==i)a=o=0;else{var u=n-i;switch(o=s>.5?u/(2-n-i):u/(n+i),n){case r:a=(e-t)/u+(e<t?6:0);break;case e:a=(t-r)/u+2;break;case t:a=(r-e)/u+4;break}a/=6}return{h:a,s:o,l:s}}function mY(r,e,t){var n,i,a;r=Tr(r,360),e=Tr(e,100),t=Tr(t,100);function o(f,l,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?f+(l-f)*6*c:c<1/2?l:c<2/3?f+(l-f)*(2/3-c)*6:f}if(e===0)n=i=a=t;else{var s=t<.5?t*(1+e):t+e-t*e,u=2*t-s;n=o(u,s,r+1/3),i=o(u,s,r),a=o(u,s,r-1/3)}return{r:n*255,g:i*255,b:a*255}}function k2(r,e,t){r=Tr(r,255),e=Tr(e,255),t=Tr(t,255);var n=Math.max(r,e,t),i=Math.min(r,e,t),a,o,s=n,u=n-i;if(o=n===0?0:u/n,n==i)a=0;else{switch(n){case r:a=(e-t)/u+(e<t?6:0);break;case e:a=(t-r)/u+2;break;case t:a=(r-e)/u+4;break}a/=6}return{h:a,s:o,v:s}}function bY(r,e,t){r=Tr(r,360)*6,e=Tr(e,100),t=Tr(t,100);var n=Math.floor(r),i=r-n,a=t*(1-e),o=t*(1-i*e),s=t*(1-(1-i)*e),u=n%6,f=[t,o,a,a,s,t][u],l=[s,t,t,o,a,a][u],c=[a,a,s,t,t,o][u];return{r:f*255,g:l*255,b:c*255}}function L2(r,e,t,n){var i=[Ni(Math.round(r).toString(16)),Ni(Math.round(e).toString(16)),Ni(Math.round(t).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function xY(r,e,t,n,i){var a=[Ni(Math.round(r).toString(16)),Ni(Math.round(e).toString(16)),Ni(Math.round(t).toString(16)),Ni(Yk(n))];return i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function N2(r,e,t,n){var i=[Ni(Yk(n)),Ni(Math.round(r).toString(16)),Ni(Math.round(e).toString(16)),Ni(Math.round(t).toString(16))];return i.join("")}Mt.equals=function(r,e){return!r||!e?!1:Mt(r).toRgbString()==Mt(e).toRgbString()};Mt.random=function(){return Mt.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function wY(r,e){e=e===0?0:e||10;var t=Mt(r).toHsl();return t.s-=e/100,t.s=Bv(t.s),Mt(t)}function EY(r,e){e=e===0?0:e||10;var t=Mt(r).toHsl();return t.s+=e/100,t.s=Bv(t.s),Mt(t)}function _Y(r){return Mt(r).desaturate(100)}function SY(r,e){e=e===0?0:e||10;var t=Mt(r).toHsl();return t.l+=e/100,t.l=Bv(t.l),Mt(t)}function MY(r,e){e=e===0?0:e||10;var t=Mt(r).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),Mt(t)}function CY(r,e){e=e===0?0:e||10;var t=Mt(r).toHsl();return t.l-=e/100,t.l=Bv(t.l),Mt(t)}function AY(r,e){var t=Mt(r).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,Mt(t)}function TY(r){var e=Mt(r).toHsl();return e.h=(e.h+180)%360,Mt(e)}function O2(r,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=Mt(r).toHsl(),n=[Mt(r)],i=360/e,a=1;a<e;a++)n.push(Mt({h:(t.h+a*i)%360,s:t.s,l:t.l}));return n}function IY(r){var e=Mt(r).toHsl(),t=e.h;return[Mt(r),Mt({h:(t+72)%360,s:e.s,l:e.l}),Mt({h:(t+216)%360,s:e.s,l:e.l})]}function kY(r,e,t){e=e||6,t=t||30;var n=Mt(r).toHsl(),i=360/t,a=[Mt(r)];for(n.h=(n.h-(i*e>>1)+720)%360;--e;)n.h=(n.h+i)%360,a.push(Mt(n));return a}function LY(r,e){e=e||6;for(var t=Mt(r).toHsv(),n=t.h,i=t.s,a=t.v,o=[],s=1/e;e--;)o.push(Mt({h:n,s:i,v:a})),a=(a+s)%1;return o}Mt.mix=function(r,e,t){t=t===0?0:t||50;var n=Mt(r).toRgb(),i=Mt(e).toRgb(),a=t/100,o={r:(i.r-n.r)*a+n.r,g:(i.g-n.g)*a+n.g,b:(i.b-n.b)*a+n.b,a:(i.a-n.a)*a+n.a};return Mt(o)};Mt.readability=function(r,e){var t=Mt(r),n=Mt(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};Mt.isReadable=function(r,e,t){var n=Mt.readability(r,e),i,a;switch(a=!1,i=BY(t),i.level+i.size){case"AAsmall":case"AAAlarge":a=n>=4.5;break;case"AAlarge":a=n>=3;break;case"AAAsmall":a=n>=7;break}return a};Mt.mostReadable=function(r,e,t){var n=null,i=0,a,o,s,u;t=t||{},o=t.includeFallbackColors,s=t.level,u=t.size;for(var f=0;f<e.length;f++)a=Mt.readability(r,e[f]),a>i&&(i=a,n=Mt(e[f]));return Mt.isReadable(r,n,{level:s,size:u})||!o?n:(t.includeFallbackColors=!1,Mt.mostReadable(r,["#fff","#000"],t))};var yy=Mt.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"},NY=Mt.hexNames=OY(yy);function OY(r){var e={};for(var t in r)r.hasOwnProperty(t)&&(e[r[t]]=t);return e}function Xk(r){return r=parseFloat(r),(isNaN(r)||r<0||r>1)&&(r=1),r}function Tr(r,e){DY(r)&&(r="100%");var t=PY(r);return r=Math.min(e,Math.max(0,parseFloat(r))),t&&(r=parseInt(r*e,10)/100),Math.abs(r-e)<1e-6?1:r%e/parseFloat(e)}function Bv(r){return Math.min(1,Math.max(0,r))}function Yn(r){return parseInt(r,16)}function DY(r){return typeof r=="string"&&r.indexOf(".")!=-1&&parseFloat(r)===1}function PY(r){return typeof r=="string"&&r.indexOf("%")!=-1}function Ni(r){return r.length==1?"0"+r:""+r}function Zf(r){return r<=1&&(r=r*100+"%"),r}function Yk(r){return Math.round(parseFloat(r)*255).toString(16)}function D2(r){return Yn(r)/255}var Mi=function(){var r="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+r+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),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 Aa(r){return!!Mi.CSS_UNIT.exec(r)}function RY(r){r=r.replace(vY,"").replace(pY,"").toLowerCase();var e=!1;if(yy[r])r=yy[r],e=!0;else if(r=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Mi.rgb.exec(r))?{r:t[1],g:t[2],b:t[3]}:(t=Mi.rgba.exec(r))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Mi.hsl.exec(r))?{h:t[1],s:t[2],l:t[3]}:(t=Mi.hsla.exec(r))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Mi.hsv.exec(r))?{h:t[1],s:t[2],v:t[3]}:(t=Mi.hsva.exec(r))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Mi.hex8.exec(r))?{r:Yn(t[1]),g:Yn(t[2]),b:Yn(t[3]),a:D2(t[4]),format:e?"name":"hex8"}:(t=Mi.hex6.exec(r))?{r:Yn(t[1]),g:Yn(t[2]),b:Yn(t[3]),format:e?"name":"hex"}:(t=Mi.hex4.exec(r))?{r:Yn(t[1]+""+t[1]),g:Yn(t[2]+""+t[2]),b:Yn(t[3]+""+t[3]),a:D2(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Mi.hex3.exec(r))?{r:Yn(t[1]+""+t[1]),g:Yn(t[2]+""+t[2]),b:Yn(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function BY(r){var e,t;return r=r||{level:"AA",size:"small"},e=(r.level||"AA").toUpperCase(),t=(r.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var Eh=2,P2=.16,FY=.05,GY=.05,zY=.15,Wk=5,Vk=4,$Y=[{index:7,opacity:.15},{index:6,opacity:.25},{index:5,opacity:.3},{index:5,opacity:.45},{index:5,opacity:.65},{index:5,opacity:.85},{index:4,opacity:.9},{index:3,opacity:.95},{index:2,opacity:.97},{index:1,opacity:.98}];function R2(r,e,t){var n;return Math.round(r.h)>=60&&Math.round(r.h)<=240?n=t?Math.round(r.h)-Eh*e:Math.round(r.h)+Eh*e:n=t?Math.round(r.h)+Eh*e:Math.round(r.h)-Eh*e,n<0?n+=360:n>=360&&(n-=360),n}function B2(r,e,t){if(r.h===0&&r.s===0)return r.s;var n;return t?n=r.s-P2*e:e===Vk?n=r.s+P2:n=r.s+FY*e,n>1&&(n=1),t&&e===Wk&&n>.1&&(n=.1),n<.06&&(n=.06),Number(n.toFixed(2))}function F2(r,e,t){var n;return t?n=r.v+GY*e:n=r.v-zY*e,n>1&&(n=1),Number(n.toFixed(2))}function zd(r){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=[],n=Mt(r),i=Wk;i>0;i-=1){var a=n.toHsv(),o=Mt({h:R2(a,i,!0),s:B2(a,i,!0),v:F2(a,i,!0)}).toHexString();t.push(o)}t.push(n.toHexString());for(var s=1;s<=Vk;s+=1){var u=n.toHsv(),f=Mt({h:R2(u,s),s:B2(u,s),v:F2(u,s)}).toHexString();t.push(f)}return e.theme==="dark"?$Y.map(function(l){var c=l.index,h=l.opacity,d=Mt.mix(e.backgroundColor||"#141414",t[c],h*100).toHexString();return d}):t}var Dg={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"},Pg={},Rg={};Object.keys(Dg).forEach(function(r){Pg[r]=zd(Dg[r]),Pg[r].primary=Pg[r][5],Rg[r]=zd(Dg[r],{theme:"dark",backgroundColor:"#141414"}),Rg[r].primary=Rg[r][5]});var rn=function(e,t,n){var i=sl(e),a=sl(t);return sl([(1-n)*i.red()+n*a.red(),(1-n)*i.green()+n*a.green(),(1-n)*i.blue()+n*a.blue()]).rgb()},jY=function(e,t,n){t===void 0&&(t="#fff");var i=rn(t,e,.05).rgb().toString(),a=rn(t,e,.1).rgb().toString(),o=rn(t,e,.2).rgb().toString(),s=rn(t,e,.4).rgb().toString(),u=rn(t,n,.02).rgb().toString(),f=rn(t,n,.05).rgb().toString(),l=rn(t,n,.1).rgb().toString(),c=rn(t,n,.2).rgb().toString(),h=rn(t,n,.3).rgb().toString(),d=zd(e,{theme:"default",backgroundColor:t}),v=sl(e).hex().toLowerCase(),p=d.indexOf(v),g=e;return p!==-1&&(g=d[p+1]),{mainStroke:e,mainFill:a,activeStroke:e,activeFill:i,inactiveStroke:s,inactiveFill:i,selectedStroke:e,selectedFill:t,highlightStroke:g,highlightFill:o,disableStroke:h,disableFill:f,edgeMainStroke:h,edgeActiveStroke:e,edgeInactiveStroke:c,edgeSelectedStroke:e,edgeHighlightStroke:e,edgeDisableStroke:l,comboMainStroke:h,comboMainFill:u,comboActiveStroke:e,comboActiveFill:i,comboInactiveStroke:h,comboInactiveFill:u,comboSelectedStroke:e,comboSelectedFill:u,comboHighlightStroke:g,comboHighlightFill:u,comboDisableStroke:c,comboDisableFill:f}},UY=function(e,t,n){t===void 0&&(t="#fff");var i=rn(t,e,.2).rgb().toString(),a=rn(t,e,.3).rgb().toString(),o=rn(t,e,.6).rgb().toString(),s=rn(t,e,.8).rgb().toString(),u=rn(t,n,.2).rgb().toString(),f=rn(t,n,.25).rgb().toString(),l=rn(t,n,.3).rgb().toString(),c=rn(t,n,.4).rgb().toString(),h=rn(t,n,.5).rgb().toString(),d=zd(e,{theme:"dark",backgroundColor:t}),v=sl(e).hex().toLowerCase(),p=d.indexOf(v),g=e;return p!==-1&&(g=d[p+1]),{mainStroke:s,mainFill:i,activeStroke:e,activeFill:a,inactiveStroke:s,inactiveFill:i,selectedStroke:e,selectedFill:i,highlightStroke:e,highlightFill:o,disableStroke:h,disableFill:f,edgeMainStroke:n,edgeActiveStroke:e,edgeInactiveStroke:n,edgeSelectedStroke:e,edgeHighlightStroke:e,edgeDisableStroke:l,comboMainStroke:c,comboMainFill:f,comboActiveStroke:e,comboActiveFill:u,comboInactiveStroke:c,comboInactiveFill:f,comboSelectedStroke:e,comboSelectedFill:u,comboHighlightStroke:g,comboHighlightFill:f,comboDisableStroke:c,comboDisableFill:u}},l1=function(e,t,n,i){return t===void 0&&(t="#fff"),n===void 0&&(n="default"),n==="default"?jY(e,t,"rgb(150, 150, 150)"):UY(e,t,"#777")},XY=function(e,t,n,i){t===void 0&&(t="#fff"),n===void 0&&(n="default");var a=[];return e.forEach(function(o){a.push(l1(o,t,n))}),a};const YY=Object.freeze(Object.defineProperty({__proto__:null,getColorSetsBySubjectColors:XY,getColorsWithSubjectColor:l1,mixColor:rn},Symbol.toStringTag,{value:"Module"}));var WY="rgb(95, 149, 255)",VY="rgb(255, 255, 255)",G2="rgb(0, 0, 0)",Jt=l1(WY,VY);const bs={version:"0.8.23",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:Jt.mainStroke,fill:Jt.mainFill},size:20,color:Jt.mainStroke,linkPoints:{size:8,lineWidth:1,fill:Jt.activeFill,stroke:Jt.activeStroke}},nodeStateStyles:{active:{fill:Jt.activeFill,stroke:Jt.activeStroke,lineWidth:2,shadowColor:Jt.mainStroke,shadowBlur:10},selected:{fill:Jt.selectedFill,stroke:Jt.selectedStroke,lineWidth:4,shadowColor:Jt.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:Jt.highlightFill,stroke:Jt.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:Jt.inactiveFill,stroke:Jt.inactiveStroke,lineWidth:1},disable:{fill:Jt.disableFill,stroke:Jt.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:G2,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:Jt.edgeMainStroke,lineAppendWidth:2},color:Jt.edgeMainStroke},edgeStateStyles:{active:{stroke:Jt.edgeActiveStroke,lineWidth:1},selected:{stroke:Jt.edgeSelectedStroke,lineWidth:2,shadowColor:Jt.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Jt.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:Jt.edgeInactiveStroke,lineWidth:1},disable:{stroke:Jt.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:G2,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:Jt.comboMainFill,lineWidth:1,stroke:Jt.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:Jt.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:Jt.comboActiveStroke,lineWidth:1,fill:Jt.comboActiveFill},selected:{stroke:Jt.comboSelectedStroke,lineWidth:2,fill:Jt.comboSelectedFill,shadowColor:Jt.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Jt.comboHighlightStroke,lineWidth:2,fill:Jt.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:Jt.comboInactiveStroke,fill:Jt.comboInactiveFill,lineWidth:1},disable:{stroke:Jt.comboDisableStroke,fill:Jt.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"};var HY=function(e){var t=e.clone();return qY(e,t),t},qY=function r(e,t){var n;e.isGroup()&&t.isGroup()&&((n=e.get("children"))===null||n===void 0||n.forEach(function(s,u){var f=t.get("children")[u];r(s,f)}));var i=e.get("type"),a=t.get("type");if(!(i!=="image"||a!=="image")){var o=e.get("clipShape");o&&t.setClip({type:o.get("type"),attrs:o.attr()})}},ZY=_n.cloneEvent,KY=_n.isViewportChanged,QY=function(r){kt(e,r);function e(t){var n=r.call(this,t)||this;return n.extendEvents=[],n.dragging=!1,n.mousedown=!1,n.preItem=null,n.destroy(),n.graph=t,n.destroyed=!1,n.initEvents(),n}return e.prototype.initEvents=function(){var t=this,n=t.graph,i=t.extendEvents,a=i===void 0?[]:i,o=n.get("canvas"),s=o.get("el"),u=cs(this,"onCanvasEvents"),f=cs(this,"onExtendEvents"),l=cs(this,"onWheelEvent");o.off("*").on("*",u),this.canvasHandler=u,a.push(xh(s,"wheel",l)),typeof window<"u"&&(a.push(xh(window,"keydown",f)),a.push(xh(window,"keyup",f)),a.push(xh(window,"focus",f))),this.resetHandler&&n.off("afterchangedata",this.resetHandler),this.resetHandler=cs(this,"resetStatus"),n.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,i=this.graph,a=i.get("canvas"),o=t.target,s=t.type;switch(s){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"mouseup":setTimeout(function(){return n.mousedown=!1});break;case"click":if(!this.mousedown)return;break}t.canvasX=t.x,t.canvasY=t.y;var u={x:t.canvasX,y:t.canvasY},f=i.get("group"),l=f.getMatrix();if(l||(l=[1,0,0,0,1,0,0,0,1]),KY(l)&&(u=i.getPointByClient(t.clientX,t.clientY)),t.x=u.x,t.y=u.y,t.currentTarget=i,o===a){(s==="mousemove"||s==="mouseleave")&&this.handleMouseMove(t,"canvas"),t.target=a,t.item=null,i.emit(s,t),i.emit("canvas:".concat(s),t);return}var c=e.getItemRoot(o);if(!c){i.emit(s,t);return}var h=c.get("item");if(!h.destroyed){var d=h.getType();if(t.target=o,t.item=h,t.canvasX===t.x&&t.canvasY===t.y){var v=i.getCanvasByPoint(t.x,t.y);t.canvasX=v.x,t.canvasY=v.y}t.name&&!t.name.includes(":")?(i.emit("".concat(d,":").concat(s),t),i.emit(s,t)):t.name&&i.emit(t.name,t),s==="dragstart"&&(this.dragging=!0),s==="dragend"&&(this.dragging=!1),s==="mousemove"&&this.handleMouseMove(t,d)}},e.prototype.onExtendEvents=function(t){this.graph.emit(t.type,t)},e.prototype.onWheelEvent=function(t){ct(t.wheelDelta)&&(t.wheelDelta=-t.detail),this.graph.emit("wheel",t)},e.prototype.handleMouseMove=function(t,n){var i=this,a=i.graph,o=i.preItem,s=a.get("canvas"),u=t.target===s?null:t.item;t=ZY(t),o&&o!==u&&!o.destroyed&&(t.item=o,this.emitCustomEvent(o.getType(),"mouseleave",t),this.dragging&&this.emitCustomEvent(o.getType(),"dragleave",t)),u&&o!==u&&(t.item=u,this.emitCustomEvent(n,"mouseenter",t),this.dragging&&this.emitCustomEvent(n,"dragenter",t)),this.preItem=u},e.prototype.emitCustomEvent=function(t,n,i){i.type=n,this.graph.emit("".concat(t,":").concat(n),i)},e.prototype.resetStatus=function(){this.mousedown=!1,this.dragging=!1,this.preItem=null},e.prototype.destroy=function(){var t=this,n=t.graph,i=t.canvasHandler,a=t.extendEvents,o=n.get("canvas");o.off("*",i),me(a,function(s){s.remove()}),this.resetStatus(),this.extendEvents.length=0,this.canvasHandler=null,this.resetHandler=null,this.destroyed=!0},e}(jI),Ht={},$a={},zr={};Object.defineProperty(zr,"__esModule",{value:!0});zr.Base=void 0;var JY=function(){function r(){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 r.prototype.layout=function(e){return this.init(e),this.execute(!0)},r.prototype.init=function(e){this.nodes=e.nodes||[],this.edges=e.edges||[],this.combos=e.combos||[],this.comboEdges=e.comboEdges||[],this.hiddenNodes=e.hiddenNodes||[],this.hiddenEdges=e.hiddenEdges||[],this.hiddenCombos=e.hiddenCombos||[],this.vedges=e.vedges||[]},r.prototype.execute=function(e){},r.prototype.executeWithWorker=function(){},r.prototype.getDefaultCfg=function(){return{}},r.prototype.updateCfg=function(e){e&&Object.assign(this,e)},r.prototype.getType=function(){return"base"},r.prototype.destroy=function(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0},r}();zr.Base=JY;var Bg={},Gu={};Object.defineProperty(Gu,"__esModule",{value:!0});Gu.camelize=Gu.isString=void 0;var eW=function(r){return typeof r=="string"};Gu.isString=eW;var tW=function(r){var e=Object.create(null);return function(t){var n=e[t];return n||(e[t]=r(t))}},rW=/-(\w)/g;Gu.camelize=tW(function(r){return r.replace(rW,function(e,t){return t?t.toUpperCase():""})});var Zl={};Object.defineProperty(Zl,"__esModule",{value:!0});Zl.isArray=void 0;Zl.isArray=Array.isArray;var Fv={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.toNumber=r.isNaN=r.isNumber=void 0;var e=function(i){return typeof i=="number"};r.isNumber=e;var t=function(i){return Number.isNaN(Number(i))};r.isNaN=t;var n=function(i){var a=parseFloat(i);return(0,r.isNaN)(a)?i:a};r.toNumber=n})(Fv);var Gv={},c1={};(function(r){var e=xe&&xe.__assign||function(){return e=Object.assign||function(i){for(var a,o=1,s=arguments.length;o<s;o++){a=arguments[o];for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(i[u]=a[u])}return i},e.apply(this,arguments)};Object.defineProperty(r,"__esModule",{value:!0}),r.clone=r.isObject=void 0;var t=function(i){return i!==null&&typeof i=="object"};r.isObject=t;var n=function(i){if(i===null)return i;if(i instanceof Date)return new Date(i.getTime());if(i instanceof Array){var a=[];return i.forEach(function(s){a.push(s)}),a.map(function(s){return(0,r.clone)(s)})}if(typeof i=="object"&&Object.keys(i).length){var o=e({},i);return Object.keys(o).forEach(function(s){o[s]=(0,r.clone)(o[s])}),o}return i};r.clone=n})(c1);(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.getCoreNodeAndRelativeLeafNodes=r.getAvgNodePosition=r.getLayoutBBox=r.traverseTreeUp=r.scaleMatrix=r.getAdjMatrix=r.floydWarshall=r.getDegreeMap=r.getDegree=r.getEdgeTerminal=void 0;var e=Zl,t=Fv,n=c1,i=function(m,b){var x=m[b];return(0,n.isObject)(x)?x.cell:x};r.getEdgeTerminal=i;var a=function(m,b,x){for(var w=[],E=0;E<m;E++)w[E]={in:0,out:0,all:0};return x&&x.forEach(function(_){var M=(0,r.getEdgeTerminal)(_,"source"),C=(0,r.getEdgeTerminal)(_,"target");M&&w[b[M]]&&(w[b[M]].out+=1,w[b[M]].all+=1),C&&w[b[C]]&&(w[b[C]].in+=1,w[b[C]].all+=1)}),w};r.getDegree=a;var o=function(m,b){var x={};return m.forEach(function(w){x[w.id]={in:0,out:0,all:0}}),b&&b.forEach(function(w){var E=(0,r.getEdgeTerminal)(w,"source"),_=(0,r.getEdgeTerminal)(w,"target");E&&(x[E].out+=1,x[E].all+=1),_&&(x[_].in+=1,x[_].all+=1)}),x};r.getDegreeMap=o;var s=function(m){for(var b=[],x=m.length,w=0;w<x;w+=1){b[w]=[];for(var E=0;E<x;E+=1)w===E?b[w][E]=0:m[w][E]===0||!m[w][E]?b[w][E]=1/0:b[w][E]=m[w][E]}for(var _=0;_<x;_+=1)for(var w=0;w<x;w+=1)for(var E=0;E<x;E+=1)b[w][E]>b[w][_]+b[_][E]&&(b[w][E]=b[w][_]+b[_][E]);return b};r.floydWarshall=s;var u=function(m,b){var x=m.nodes,w=m.edges,E=[],_={};if(!x)throw new Error("invalid nodes data!");return x&&x.forEach(function(M,C){_[M.id]=C;var S=[];E.push(S)}),w==null||w.forEach(function(M){var C=(0,r.getEdgeTerminal)(M,"source"),S=(0,r.getEdgeTerminal)(M,"target"),A=_[C],T=_[S];A===void 0||T===void 0||(E[A][T]=1,b||(E[T][A]=1))}),E};r.getAdjMatrix=u;var f=function(m,b){var x=[];return m.forEach(function(w){var E=[];w.forEach(function(_){E.push(_*b)}),x.push(E)}),x};r.scaleMatrix=f;var l=function(m,b){if(m&&m.children){for(var x=m.children.length-1;x>=0;x--)if(!l(m.children[x],b))return}return!!b(m)},c=function(m,b){typeof b=="function"&&l(m,b)};r.traverseTreeUp=c;var h=function(m){var b=1/0,x=1/0,w=-1/0,E=-1/0;return m.forEach(function(_){var M=_.size;(0,e.isArray)(M)?M.length===1&&(M=[M[0],M[0]]):(0,t.isNumber)(M)?M=[M,M]:(M===void 0||isNaN(M))&&(M=[30,30]);var C=[M[0]/2,M[1]/2],S=_.x-C[0],A=_.x+C[0],T=_.y-C[1],k=_.y+C[1];b>S&&(b=S),x>T&&(x=T),w<A&&(w=A),E<k&&(E=k)}),{minX:b,minY:x,maxX:w,maxY:E}};r.getLayoutBBox=h;var d=function(m){var b={x:0,y:0};m.forEach(function(w){b.x+=w.x||0,b.y+=w.y||0});var x=m.length||1;return{x:b.x/x,y:b.y/x}};r.getAvgNodePosition=d;var v=function(m,b,x){var w,E;return m==="source"?((w=x==null?void 0:x.find(function(_){return _.target===b.id}))===null||w===void 0?void 0:w.source)||{}:((E=x==null?void 0:x.find(function(_){return _.source===b.id}))===null||E===void 0?void 0:E.target)||{}},p=function(m,b,x){var w=[];switch(m){case"source":w=x==null?void 0:x.filter(function(_){return _.source===b.id}).map(function(_){return _.target});break;case"target":w=x==null?void 0:x.filter(function(_){return _.target===b.id}).map(function(_){return _.source});break;case"both":w=x==null?void 0:x.filter(function(_){return _.source===b.id}).map(function(_){return _.target}).concat(x==null?void 0:x.filter(function(_){return _.target===b.id}).map(function(_){return _.source}));break}var E=new Set(w);return Array.from(E)},g=function(m,b,x,w,E){var _=x[b]||"",M=(w==null?void 0:w.filter(function(C){return C[b]===_}))||[];return m==="leaf"&&(M=M.filter(function(C){var S,A;return((S=E[C.id])===null||S===void 0?void 0:S.in)===0||((A=E[C.id])===null||A===void 0?void 0:A.out)===0})),M},y=function(m,b,x,w,E,_){var M=E[b.id],C=M.in,S=M.out,A=b,T=[];C===0?(A=v("source",b,x),T=p("both",A,x).map(function(O){return _[O]})):S===0&&(A=v("target",b,x),T=p("both",A,x).map(function(O){return _[O]})),T=T.filter(function(O){return E[O.id]&&(E[O.id].in===0||E[O.id].out===0)});var k=g(m,w,b,T,E);return{coreNode:A,relativeLeafNodes:T,sameTypeLeafNodes:k}};r.getCoreNodeAndRelativeLeafNodes=y})(Gv);var Fg={},z2;function nW(){return z2||(z2=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.getFuncByUnknownType=r.getFunc=r.isFunction=void 0;var e=Or(),t=Fv,n=function(o){return typeof o=="function"};r.isFunction=n;var i=function(o,s,u){var f;return u?f=u:(0,t.isNumber)(o)?f=function(){return o}:f=function(){return s},f};r.getFunc=i;var a=function(o,s,u){return u===void 0&&(u=!0),!s&&s!==0?function(f){return f.size?(0,e.isArray)(f.size)?f.size[0]>f.size[1]?f.size[0]:f.size[1]:(0,e.isObject)(f.size)?f.size.width>f.size.height?f.size.width:f.size.height:f.size:o}:(0,r.isFunction)(s)?s:(0,t.isNumber)(s)?function(){return s}:(0,e.isArray)(s)?function(){if(u){var f=Math.max.apply(Math,s);return isNaN(f)?o:f}return s}:(0,e.isObject)(s)?function(){if(u){var f=Math.max(s.width,s.height);return isNaN(f)?o:f}return[s.width,s.height]}:function(){return o}};r.getFuncByUnknownType=a}(Fg)),Fg}var $2;function Or(){return $2||($2=1,function(r){var e=xe&&xe.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),t=xe&&xe.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&e(i,n,a)};Object.defineProperty(r,"__esModule",{value:!0}),t(Gu,r),t(Zl,r),t(Fv,r),t(Gv,r),t(c1,r),t(nW(),r)}(Bg)),Bg}var iW=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty($a,"__esModule",{value:!0});$a.getLayoutByName=$a.unRegisterLayout=$a.registerLayout=void 0;var aW=zr,oW=Or(),bo=new Map,sW=function(r,e){if(bo.get(r)&&console.warn("The layout with the name ".concat(r," exists already, it will be overridden")),(0,oW.isObject)(e)){var t=function(n){iW(i,n);function i(a){var o=this,s;o=n.call(this)||this;var u=o,f={},l=Object.assign({},u.getDefaultCfg(),((s=e.getDefaultCfg)===null||s===void 0?void 0:s.call(e))||{});return Object.assign(f,l,e,a),Object.keys(f).forEach(function(c){var h=f[c];u[c]=h}),o}return i}(aW.Base);bo.set(r,t)}else bo.set(r,e);return bo.get(r)};$a.registerLayout=sW;var uW=function(r){bo.has(r)&&bo.delete(r)};$a.unRegisterLayout=uW;var fW=function(r){return bo.has(r)?bo.get(r):null};$a.getLayoutByName=fW;var Gg={},Kl={},lW=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Kl,"__esModule",{value:!0});Kl.GridLayout=void 0;var nu=Or(),cW=zr,hW=function(r){lW(e,r);function e(t){var n=r.call(this)||this;return n.begin=[0,0],n.preventOverlap=!0,n.preventOverlapPadding=10,n.condense=!1,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.row=0,n.col=0,n.cellWidth=0,n.cellHeight=0,n.cellUsed={},n.id2manPos={},n.onLayoutEnd=function(){},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30}},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.edges,a=t.begin,o=n.length;if(o===0)return t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:i};if(o===1)return n[0].x=a[0],n[0].y=a[1],t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:i};var s=t.sortBy,u=t.width,f=t.height,l=t.condense,c=t.preventOverlapPadding,h=t.preventOverlap,d=t.nodeSpacing,v=t.nodeSize,p=[];n.forEach(function(T){p.push(T)});var g={};if(p.forEach(function(T,k){g[T.id]=k}),(s==="degree"||!(0,nu.isString)(s)||p[0][s]===void 0)&&(s="degree",(0,nu.isNaN)(n[0].degree))){var y=(0,nu.getDegree)(p.length,g,i);p.forEach(function(T,k){T.degree=y[k].all})}p.sort(function(T,k){return k[s]-T[s]}),!u&&typeof window<"u"&&(u=window.innerWidth),!f&&typeof window<"u"&&(f=window.innerHeight);var m=t.rows,b=t.cols!=null?t.cols:t.columns;if(t.cells=o,m!=null&&b!=null?(t.rows=m,t.cols=b):m!=null&&b==null?(t.rows=m,t.cols=Math.ceil(t.cells/t.rows)):m==null&&b!=null?(t.cols=b,t.rows=Math.ceil(t.cells/t.cols)):(t.splits=Math.sqrt(t.cells*t.height/t.width),t.rows=Math.round(t.splits),t.cols=Math.round(t.width/t.height*t.splits)),t.rows=Math.max(t.rows,1),t.cols=Math.max(t.cols,1),t.cols*t.rows>t.cells){var x=t.small(),w=t.large();(x-1)*w>=t.cells?t.small(x-1):(w-1)*x>=t.cells&&t.large(w-1)}else for(;t.cols*t.rows<t.cells;){var x=t.small(),w=t.large();(w+1)*x>=t.cells?t.large(w+1):t.small(x+1)}if(t.cellWidth=u/t.cols,t.cellHeight=f/t.rows,l&&(t.cellWidth=0,t.cellHeight=0),h||d){var E=(0,nu.getFuncByUnknownType)(10,d),_=(0,nu.getFuncByUnknownType)(30,v,!1);p.forEach(function(T){(!T.x||!T.y)&&(T.x=0,T.y=0);var k=_(T)||30,O,F;(0,nu.isArray)(k)?(O=k[0],F=k[1]):(O=k,F=k);var D=E!==void 0?E(T):c,$=O+D,Y=F+D;t.cellWidth=Math.max(t.cellWidth,$),t.cellHeight=Math.max(t.cellHeight,Y)})}t.cellUsed={},t.row=0,t.col=0,t.id2manPos={};for(var M=0;M<p.length;M++){var C=p[M],S=void 0;if(t.position&&(S=t.position(C)),S&&(S.row!==void 0||S.col!==void 0)){var A={row:S.row,col:S.col};if(A.col===void 0)for(A.col=0;t.used(A.row,A.col);)A.col++;else if(A.row===void 0)for(A.row=0;t.used(A.row,A.col);)A.row++;t.id2manPos[C.id]=A,t.use(A.row,A.col)}t.getPos(C)}return t.onLayoutEnd&&t.onLayoutEnd(),{edges:i,nodes:p}},e.prototype.small=function(t){var n=this,i,a=n.rows||5,o=n.cols||5;if(t==null)i=Math.min(a,o);else{var s=Math.min(a,o);s===n.rows?n.rows=t:n.cols=t}return i},e.prototype.large=function(t){var n=this,i,a=n.rows||5,o=n.cols||5;if(t==null)i=Math.max(a,o);else{var s=Math.max(a,o);s===n.rows?n.rows=t:n.cols=t}return i},e.prototype.used=function(t,n){var i=this;return i.cellUsed["c-".concat(t,"-").concat(n)]||!1},e.prototype.use=function(t,n){var i=this;i.cellUsed["c-".concat(t,"-").concat(n)]=!0},e.prototype.moveToNextCell=function(){var t=this,n=t.cols||5;t.col++,t.col>=n&&(t.col=0,t.row++)},e.prototype.getPos=function(t){var n=this,i=n.begin,a=n.cellWidth,o=n.cellHeight,s,u,f=n.id2manPos[t.id];if(f)s=f.col*a+a/2+i[0],u=f.row*o+o/2+i[1];else{for(;n.used(n.row,n.col);)n.moveToNextCell();s=n.col*a+a/2+i[0],u=n.row*o+o/2+i[1],n.use(n.row,n.col),n.moveToNextCell()}t.x=s,t.y=u},e.prototype.getType=function(){return"grid"},e}(cW.Base);Kl.GridLayout=hW;var Ql={},dW=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Ql,"__esModule",{value:!0});Ql.RandomLayout=void 0;var vW=zr,pW=function(r){dW(e,r);function e(t){var n=r.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},e.prototype.execute=function(){var t=this,n=t.nodes,i=.9,a=t.center;return!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight),n&&n.forEach(function(o){o.x=(Math.random()-.5)*i*t.width+a[0],o.y=(Math.random()-.5)*i*t.height+a[1]}),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:this.edges}},e.prototype.getType=function(){return"random"},e}(vW.Base);Ql.RandomLayout=pW;var Jl={},gW=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Jl,"__esModule",{value:!0});Jl.GForceLayout=void 0;var yW=zr,Sn=Or(),zg=function(r,e){var t;return r?(0,Sn.isNumber)(r)?t=function(n){return r}:t=r:t=function(n){return e},t},mW=function(r){gW(e,r);function e(t){var n=r.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(t),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t,n,i=this,a=i.nodes;if(i.timeInterval!==void 0&&typeof window<"u"&&window.clearInterval(i.timeInterval),!a||a.length===0){(t=i.onLayoutEnd)===null||t===void 0||t.call(i);return}!i.width&&typeof window<"u"&&(i.width=window.innerWidth),!i.height&&typeof window<"u"&&(i.height=window.innerHeight),i.center||(i.center=[i.width/2,i.height/2]);var o=i.center;if(a.length===1){a[0].x=o[0],a[0].y=o[1],(n=i.onLayoutEnd)===null||n===void 0||n.call(i);return}var s={},u={};a.forEach(function(v,p){(0,Sn.isNumber)(v.x)||(v.x=Math.random()*i.width),(0,Sn.isNumber)(v.y)||(v.y=Math.random()*i.height),s[v.id]=v,u[v.id]=p}),i.nodeMap=s,i.nodeIdxMap=u,i.linkDistance=zg(i.linkDistance,1),i.nodeStrength=zg(i.nodeStrength,1),i.edgeStrength=zg(i.edgeStrength,1);var f=i.nodeSize,l;if(i.preventOverlap){var c=i.nodeSpacing,h;(0,Sn.isNumber)(c)?h=function(){return c}:(0,Sn.isFunction)(c)?h=c:h=function(){return 0},f?(0,Sn.isArray)(f)?l=function(v){return Math.max(f[0],f[1])+h(v)}:l=function(v){return f+h(v)}:l=function(v){return v.size?(0,Sn.isArray)(v.size)?Math.max(v.size[0],v.size[1])+h(v):(0,Sn.isObject)(v.size)?Math.max(v.size.width,v.size.height)+h(v):v.size+h(v):10+h(v)}}i.nodeSize=l;var d=i.edges;i.degrees=(0,Sn.getDegree)(a.length,i.nodeIdxMap,d),i.getMass||(i.getMass=function(v){var p=v.mass||i.degrees[i.nodeIdxMap[v.id]].all||1;return p}),i.run()},e.prototype.run=function(){var t,n=this,i=n.maxIteration,a=n.nodes,o=n.workerEnabled,s=n.minMovement,u=n.animate;if(a)if(o||!u){for(var f=0;f<i;f++){var l=n.runOneStep(f);if(n.reachMoveThreshold(a,l,s))break}(t=n.onLayoutEnd)===null||t===void 0||t.call(n)}else{if(typeof window>"u")return;var c=0;this.timeInterval=window.setInterval(function(){var h,d;if(a){var v=n.runOneStep(c)||[];n.reachMoveThreshold(a,v,s)&&((h=n.onLayoutEnd)===null||h===void 0||h.call(n),window.clearInterval(n.timeInterval)),c++,c>=i&&((d=n.onLayoutEnd)===null||d===void 0||d.call(n),window.clearInterval(n.timeInterval))}},0)}},e.prototype.reachMoveThreshold=function(t,n,i){var a=0;return t.forEach(function(o,s){var u=o.x-n[s].x,f=o.y-n[s].y;a+=Math.sqrt(u*u+f*f)}),a/=t.length,a<i},e.prototype.runOneStep=function(t){var n,i=this,a=i.nodes,o=i.edges,s=[],u=[];if(a){a.forEach(function(c,h){s[2*h]=0,s[2*h+1]=0,u[2*h]=0,u[2*h+1]=0}),i.calRepulsive(s,a),o&&i.calAttractive(s,o),i.calGravity(s,a);var f=Math.max(.02,i.interval-t*.002);i.updateVelocity(s,u,f,a);var l=[];return a.forEach(function(c){l.push({x:c.x,y:c.y})}),i.updatePosition(u,f,a),(n=i.tick)===null||n===void 0||n.call(i),l}},e.prototype.calRepulsive=function(t,n){var i=this,a=i.getMass,o=i.factor,s=i.coulombDisScale,u=i.preventOverlap,f=i.collideStrength,l=f===void 0?1:f,c=i.nodeStrength,h=i.nodeSize;n.forEach(function(d,v){var p=a?a(d):1;n.forEach(function(g,y){if(!(v>=y)){var m=d.x-g.x,b=d.y-g.y;m===0&&b===0&&(m=Math.random()*.01,b=Math.random()*.01);var x=m*m+b*b,w=Math.sqrt(x),E=(w+.1)*s,_=m/w,M=b/w,C=(c(d)+c(g))*.5*o/(E*E),S=a?a(g):1;if(t[2*v]+=_*C,t[2*v+1]+=M*C,t[2*y]-=_*C,t[2*y+1]-=M*C,u&&(h(d)+h(g))/2>w){var A=l*(c(d)+c(g))*.5/x;t[2*v]+=_*A/p,t[2*v+1]+=M*A/p,t[2*y]-=_*A/S,t[2*y+1]-=M*A/S}}})})},e.prototype.calAttractive=function(t,n){var i=this,a=i.nodeMap,o=i.nodeIdxMap,s=i.linkDistance,u=i.edgeStrength,f=i.nodeSize,l=i.getMass;n.forEach(function(c,h){var d=(0,Sn.getEdgeTerminal)(c,"source"),v=(0,Sn.getEdgeTerminal)(c,"target"),p=a[d],g=a[v],y=g.x-p.x,m=g.y-p.y;y===0&&m===0&&(y=Math.random()*.01,m=Math.random()*.01);var b=Math.sqrt(y*y+m*m),x=y/b,w=m/b,E=s(c,p,g)||1+(f(p)+f(g)||0)/2,_=E-b,M=_*u(c),C=o[d],S=o[v],A=l?l(p):1,T=l?l(g):1;t[2*C]-=x*M/A,t[2*C+1]-=w*M/A,t[2*S]+=x*M/T,t[2*S+1]+=w*M/T})},e.prototype.calGravity=function(t,n){for(var i=this,a=i.center,o=i.gravity,s=i.degrees,u=n.length,f=0;f<u;f++){var l=n[f],c=l.x-a[0],h=l.y-a[1],d=o;if(i.getCenter){var v=i.getCenter(l,s[f].all);v&&(0,Sn.isNumber)(v[0])&&(0,Sn.isNumber)(v[1])&&(0,Sn.isNumber)(v[2])&&(c=l.x-v[0],h=l.y-v[1],d=v[2])}d&&(t[2*f]-=d*c,t[2*f+1]-=d*h)}},e.prototype.updateVelocity=function(t,n,i,a){var o=this,s=i*o.damping;a.forEach(function(u,f){var l=t[2*f]*s||.01,c=t[2*f+1]*s||.01,h=Math.sqrt(l*l+c*c);if(h>o.maxSpeed){var d=o.maxSpeed/h;l=d*l,c=d*c}n[2*f]=l,n[2*f+1]=c})},e.prototype.updatePosition=function(t,n,i){i.forEach(function(a,o){if((0,Sn.isNumber)(a.fx)&&(0,Sn.isNumber)(a.fy)){a.x=a.fx,a.y=a.fy;return}var s=t[2*o]*n,u=t[2*o+1]*n;a.x+=s,a.y+=u})},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"gForce"},e}(yW.Base);Jl.GForceLayout=mW;var ec={},zv={};function bW(r){const e=+this._x.call(null,r),t=+this._y.call(null,r);return Hk(this.cover(e,t),e,t,r)}function Hk(r,e,t,n){if(isNaN(e)||isNaN(t))return r;var i,a=r._root,o={data:n},s=r._x0,u=r._y0,f=r._x1,l=r._y1,c,h,d,v,p,g,y,m;if(!a)return r._root=o,r;for(;a.length;)if((p=e>=(c=(s+f)/2))?s=c:f=c,(g=t>=(h=(u+l)/2))?u=h:l=h,i=a,!(a=a[y=g<<1|p]))return i[y]=o,r;if(d=+r._x.call(null,a.data),v=+r._y.call(null,a.data),e===d&&t===v)return o.next=a,i?i[y]=o:r._root=o,r;do i=i?i[y]=new Array(4):r._root=new Array(4),(p=e>=(c=(s+f)/2))?s=c:f=c,(g=t>=(h=(u+l)/2))?u=h:l=h;while((y=g<<1|p)===(m=(v>=h)<<1|d>=c));return i[m]=a,i[y]=o,r}function xW(r){var e,t,n=r.length,i,a,o=new Array(n),s=new Array(n),u=1/0,f=1/0,l=-1/0,c=-1/0;for(t=0;t<n;++t)isNaN(i=+this._x.call(null,e=r[t]))||isNaN(a=+this._y.call(null,e))||(o[t]=i,s[t]=a,i<u&&(u=i),i>l&&(l=i),a<f&&(f=a),a>c&&(c=a));if(u>l||f>c)return this;for(this.cover(u,f).cover(l,c),t=0;t<n;++t)Hk(this,o[t],s[t],r[t]);return this}function wW(r,e){if(isNaN(r=+r)||isNaN(e=+e))return this;var t=this._x0,n=this._y0,i=this._x1,a=this._y1;if(isNaN(t))i=(t=Math.floor(r))+1,a=(n=Math.floor(e))+1;else{for(var o=i-t||1,s=this._root,u,f;t>r||r>=i||n>e||e>=a;)switch(f=(e<n)<<1|r<t,u=new Array(4),u[f]=s,s=u,o*=2,f){case 0:i=t+o,a=n+o;break;case 1:t=i-o,a=n+o;break;case 2:i=t+o,n=a-o;break;case 3:t=i-o,n=a-o;break}this._root&&this._root.length&&(this._root=s)}return this._x0=t,this._y0=n,this._x1=i,this._y1=a,this}function EW(){var r=[];return this.visit(function(e){if(!e.length)do r.push(e.data);while(e=e.next)}),r}function _W(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Ln(r,e,t,n,i){this.node=r,this.x0=e,this.y0=t,this.x1=n,this.y1=i}function SW(r,e,t){var n,i=this._x0,a=this._y0,o,s,u,f,l=this._x1,c=this._y1,h=[],d=this._root,v,p;for(d&&h.push(new Ln(d,i,a,l,c)),t==null?t=1/0:(i=r-t,a=e-t,l=r+t,c=e+t,t*=t);v=h.pop();)if(!(!(d=v.node)||(o=v.x0)>l||(s=v.y0)>c||(u=v.x1)<i||(f=v.y1)<a))if(d.length){var g=(o+u)/2,y=(s+f)/2;h.push(new Ln(d[3],g,y,u,f),new Ln(d[2],o,y,g,f),new Ln(d[1],g,s,u,y),new Ln(d[0],o,s,g,y)),(p=(e>=y)<<1|r>=g)&&(v=h[h.length-1],h[h.length-1]=h[h.length-1-p],h[h.length-1-p]=v)}else{var m=r-+this._x.call(null,d.data),b=e-+this._y.call(null,d.data),x=m*m+b*b;if(x<t){var w=Math.sqrt(t=x);i=r-w,a=e-w,l=r+w,c=e+w,n=d.data}}return n}function MW(r){if(isNaN(l=+this._x.call(null,r))||isNaN(c=+this._y.call(null,r)))return this;var e,t=this._root,n,i,a,o=this._x0,s=this._y0,u=this._x1,f=this._y1,l,c,h,d,v,p,g,y;if(!t)return this;if(t.length)for(;;){if((v=l>=(h=(o+u)/2))?o=h:u=h,(p=c>=(d=(s+f)/2))?s=d:f=d,e=t,!(t=t[g=p<<1|v]))return this;if(!t.length)break;(e[g+1&3]||e[g+2&3]||e[g+3&3])&&(n=e,y=g)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(a=t.next)&&delete t.next,i?(a?i.next=a:delete i.next,this):e?(a?e[g]=a:delete e[g],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[y]=t:this._root=t),this):(this._root=a,this)}function CW(r){for(var e=0,t=r.length;e<t;++e)this.remove(r[e]);return this}function AW(){return this._root}function TW(){var r=0;return this.visit(function(e){if(!e.length)do++r;while(e=e.next)}),r}function IW(r){var e=[],t,n=this._root,i,a,o,s,u;for(n&&e.push(new Ln(n,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!r(n=t.node,a=t.x0,o=t.y0,s=t.x1,u=t.y1)&&n.length){var f=(a+s)/2,l=(o+u)/2;(i=n[3])&&e.push(new Ln(i,f,l,s,u)),(i=n[2])&&e.push(new Ln(i,a,l,f,u)),(i=n[1])&&e.push(new Ln(i,f,o,s,l)),(i=n[0])&&e.push(new Ln(i,a,o,f,l))}return this}function kW(r){var e=[],t=[],n;for(this._root&&e.push(new Ln(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var a,o=n.x0,s=n.y0,u=n.x1,f=n.y1,l=(o+u)/2,c=(s+f)/2;(a=i[0])&&e.push(new Ln(a,o,s,l,c)),(a=i[1])&&e.push(new Ln(a,l,s,u,c)),(a=i[2])&&e.push(new Ln(a,o,c,l,f)),(a=i[3])&&e.push(new Ln(a,l,c,u,f))}t.push(n)}for(;n=t.pop();)r(n.node,n.x0,n.y0,n.x1,n.y1);return this}function LW(r){return r[0]}function NW(r){return arguments.length?(this._x=r,this):this._x}function OW(r){return r[1]}function DW(r){return arguments.length?(this._y=r,this):this._y}function $v(r,e,t){var n=new h1(e==null?LW:e,t==null?OW:t,NaN,NaN,NaN,NaN);return r==null?n:n.addAll(r)}function h1(r,e,t,n,i,a){this._x=r,this._y=e,this._x0=t,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function j2(r){for(var e={data:r.data},t=e;r=r.next;)t=t.next={data:r.data};return e}var Nn=$v.prototype=h1.prototype;Nn.copy=function(){var r=new h1(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,n;if(!e)return r;if(!e.length)return r._root=j2(e),r;for(t=[{source:e,target:r._root=new Array(4)}];e=t.pop();)for(var i=0;i<4;++i)(n=e.source[i])&&(n.length?t.push({source:n,target:e.target[i]=new Array(4)}):e.target[i]=j2(n));return r};Nn.add=bW;Nn.addAll=xW;Nn.cover=wW;Nn.data=EW;Nn.extent=_W;Nn.find=SW;Nn.remove=MW;Nn.removeAll=CW;Nn.root=AW;Nn.size=TW;Nn.visit=IW;Nn.visitAfter=kW;Nn.x=NW;Nn.y=DW;const PW=Object.freeze(Object.defineProperty({__proto__:null,quadtree:$v},Symbol.toStringTag,{value:"Module"})),RW=va(PW);Object.defineProperty(zv,"__esModule",{value:!0});zv.forceNBody=void 0;var BW=RW,FW=.81,U2=.1;function GW(r,e,t,n,i){var a=t/n,o=r.map(function(u,f){var l=e[u.id],c=l.data,h=l.x,d=l.y,v=l.size,p=c.layout.force.nodeStrength;return{x:h,y:d,size:v,index:f,vx:0,vy:0,weight:a*p}}),s=(0,BW.quadtree)(o,function(u){return u.x},function(u){return u.y}).visitAfter(zW);return o.forEach(function(u){jW(u,s)}),o.map(function(u,f){var l=e[r[f].id],c=l.data.layout.force.mass,h=c===void 0?1:c;i[2*f]=u.vx/h,i[2*f+1]=u.vy/h}),i}zv.forceNBody=GW;function zW(r){var e=0,t=0,n=0;if(r.length){for(var i=0;i<4;i++){var a=r[i];a&&a.weight&&(e+=a.weight,t+=a.x*a.weight,n+=a.y*a.weight)}r.x=t/e,r.y=n/e,r.weight=e}else{var a=r;r.x=a.data.x,r.y=a.data.y,r.weight=a.data.weight}}var $W=function(r,e,t,n,i,a){var o=a.x-r.x||U2,s=a.y-r.y||U2,u=n-e,f=o*o+s*s,l=Math.sqrt(f)*f;if(u*u*FW<f){var c=r.weight/l;return a.vx+=o*c,a.vy+=s*c,!0}if(r.length)return!1;if(r.data!==a){var c=r.data.weight/l;a.vx+=o*c,a.vy+=s*c}};function jW(r,e){e.visit(function(t,n,i,a,o){return $W(t,n,i,a,o,r)})}var UW=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ci=xe&&xe.__assign||function(){return Ci=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Ci.apply(this,arguments)};Object.defineProperty(ec,"__esModule",{value:!0});ec.Force2Layout=void 0;var XW=zr,tn=Or(),YW=zv,$g=function(r,e){var t;return r?(0,tn.isNumber)(r)?t=function(n){return r}:t=r:t=function(n){return e},t},WW=function(r){UW(e,r);function e(t){var n=r.call(this)||this;n.maxIteration=1e3,n.workerEnabled=!1,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=500,n.minMovement=.4,n.interval=.02,n.factor=1,n.linkDistance=200,n.gravity=0,n.clusterNodeStrength=20,n.preventOverlap=!0,n.distanceThresholdMode="mean",n.tick=function(){},n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.judgingDistance=0,n.centripetalOptions={leaf:2,single:2,others:1,center:function(a){return{x:n.width/2,y:n.height/2}}};var i=t.getMass;return n.propsGetMass=i,n.updateCfg(t),n}return e.prototype.getCentripetalOptions=function(){var t=this,n=t.leafCluster,i=t.clustering,a=t.nodeClusterBy,o=t.nodes,s=t.nodeMap,u=t.clusterNodeStrength,f=function(b){return typeof u=="function"?u(b):u},l={},c;if(n){c=this.getSameTypeLeafMap()||{};var h=Array.from(new Set(o==null?void 0:o.map(function(b){return b[a]})))||[];l={single:100,leaf:function(b,x,w){var E=c[b.id]||{},_=E.relativeLeafNodes,M=E.sameTypeLeafNodes;return(M==null?void 0:M.length)===(_==null?void 0:_.length)||(h==null?void 0:h.length)===1?1:f(b)},others:1,center:function(b,x,w){var E,_=(((E=b.data)===null||E===void 0?void 0:E.layout)||{}).degree;if(!_)return{x:100,y:100};var M;if(_===1){var C=(c[b.id]||{}).sameTypeLeafNodes,S=C===void 0?[]:C;S.length===1?M=void 0:S.length>1&&(M=(0,tn.getAvgNodePosition)(S))}else M=void 0;return{x:M==null?void 0:M.x,y:M==null?void 0:M.y}}}}if(i){c||(c=this.getSameTypeLeafMap());var d=Array.from(new Set(o.map(function(b,x){return b[a]}))).filter(function(b){return b!==void 0}),v={};d.forEach(function(b){var x=o.filter(function(w){return w[a]===b}).map(function(w){return s[w.id]});v[b]=(0,tn.getAvgNodePosition)(x)}),l={single:function(b){return f(b)},leaf:function(b){return f(b)},others:function(b){return f(b)},center:function(b,x,w){var E=v[b[a]];return{x:E==null?void 0:E.x,y:E==null?void 0:E.y}}}}this.centripetalOptions=Ci(Ci({},this.centripetalOptions),l);var p=this.centripetalOptions,g=p.leaf,y=p.single,m=p.others;g&&typeof g!="function"&&(this.centripetalOptions.leaf=function(){return g}),y&&typeof y!="function"&&(this.centripetalOptions.single=function(){return y}),m&&typeof m!="function"&&(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 n=t.nodes,i=t.edges,a=t.defSpringLen;if(t.judgingDistance=0,!n||n.length===0){t.onLayoutEnd([]);return}!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var o=t.center;if(n.length===1){n[0].x=o[0],n[0].y=o[1],t.onLayoutEnd([Ci({},n[0])]);return}t.degreesMap=(0,tn.getDegreeMap)(n,i),t.propsGetMass?t.getMass=t.propsGetMass:t.getMass=function(d){var v=1;(0,tn.isNumber)(d.mass)&&(v=d.mass);var p=t.degreesMap[d.id].all;return!p||p<5?v:p*5*v};var s=t.nodeSize,u;if(t.preventOverlap){var f=t.nodeSpacing,l;(0,tn.isNumber)(f)?l=function(){return f}:(0,tn.isFunction)(f)?l=f:l=function(){return 0},s?(0,tn.isArray)(s)?u=function(d){return Math.max(s[0],s[1])+l(d)}:u=function(d){return s+l(d)}:u=function(d){return d.size?(0,tn.isArray)(d.size)?Math.max(d.size[0],d.size[1])+l(d):(0,tn.isObject)(d.size)?Math.max(d.size.width,d.size.height)+l(d):d.size+l(d):10+l(d)}}t.nodeSize=u,t.linkDistance=$g(t.linkDistance,1),t.nodeStrength=$g(t.nodeStrength,1),t.edgeStrength=$g(t.edgeStrength,1);var c={},h={};n.forEach(function(d,v){(0,tn.isNumber)(d.x)||(d.x=Math.random()*t.width),(0,tn.isNumber)(d.y)||(d.y=Math.random()*t.height);var p=t.degreesMap[d.id];c[d.id]=Ci(Ci({},d),{data:Ci(Ci({},d.data),{size:t.nodeSize(d)||30,layout:{inDegree:p.in,outDegree:p.out,degree:p.all,tDegree:p.in,sDegree:p.out,force:{mass:t.getMass(d),nodeStrength:t.nodeStrength(d,i)}}})}),h[d.id]=v}),t.nodeMap=c,t.nodeIdxMap=h,t.edgeInfos=[],i==null||i.forEach(function(d){var v=c[d.source],p=c[d.target];!v||!p?elf.edgeInfos.push({}):t.edgeInfos.push({edgeStrength:t.edgeStrength(d),linkDistance:a?a(Ci(Ci({},d),{source:v,target:p}),v,p):t.linkDistance(d,v,p)||1+(s(v)+s(v)||0)/2})}),this.getCentripetalOptions(),t.onLayoutEnd=t.onLayoutEnd||function(){},t.run()},e.prototype.run=function(){var t=this,n=t.maxIteration,i=t.nodes,a=t.edges,o=t.workerEnabled,s=t.minMovement,u=t.animate,f=t.nodeMap,l=t.height;if(t.currentMinY=0,t.currentMaxY=l,!!i){var c=[];if(i.forEach(function(y,m){c[2*m]=0,c[2*m+1]=0}),this.defSideCoe&&typeof this.defSideCoe=="function"){var h={};a.forEach(function(y){var m=y.source,b=y.target;h[m]=h[m]||[],h[m].push(y),h[b]=h[b]||[],h[b].push(y)}),this.relatedEdges=h}var d=n,v=!u;if(o||v){for(var p=0;(t.judgingDistance>s||p<1)&&p<d;p++)t.runOneStep(p,c);t.onLayoutEnd(Object.values(f))}else{if(typeof window>"u")return;var g=0;this.timeInterval=window.setInterval(function(){i&&(t.runOneStep(g,c),g++,(g>=d||t.judgingDistance<s)&&(t.onLayoutEnd(Object.values(f)),window.clearInterval(t.timeInterval)))},0)}}},e.prototype.runOneStep=function(t,n){var i,a=this,o=a.nodes,s=a.edges;a.nodeMap;var u=a.monitor,f=[];if(o!=null&&o.length){a.calRepulsive(f),s&&a.calAttractive(f),a.calGravity(f),a.attractToSide(f);var l=a.interval;if(a.updateVelocity(f,n,l),a.updatePosition(n,l),(i=a.tick)===null||i===void 0||i.call(a),u){var c=this.calTotalEnergy(f);u({energy:c,nodes:o,edges:s,iterations:t})}}},e.prototype.calTotalEnergy=function(t){var n=this,i=n.nodes,a=n.nodeMap;if(!(i!=null&&i.length))return 0;var o=0;return i.forEach(function(s,u){var f=t[2*u],l=t[2*u+1],c=f*f+l*l,h=a[s.id].data.layout.force.mass,d=h===void 0?1:h;o+=d*c*.5}),o},e.prototype.calRepulsive=function(t){var n=this,i=n.nodes,a=n.nodeMap,o=n.factor,s=n.coulombDisScale;n.nodeSize,(0,YW.forceNBody)(i,a,o,s*s,t)},e.prototype.calAttractive=function(t){var n=this,i=n.edges,a=n.nodeMap,o=n.nodeIdxMap,s=n.edgeInfos;n.nodeSize,i.forEach(function(u,f){var l=(0,tn.getEdgeTerminal)(u,"source"),c=(0,tn.getEdgeTerminal)(u,"target"),h=a[l],d=a[c];if(!(!h||!d)){var v=d.x-h.x,p=d.y-h.y;!v&&!p&&(v=Math.random()*.01,p=Math.random()*.01);var g=Math.sqrt(v*v+p*p),y=v/g,m=p/g,b=s[f]||{},x=b.linkDistance,w=x===void 0?200:x,E=b.edgeStrength,_=E===void 0?200:E,M=w-g,C=M*_,S=h.data.layout.force.mass||1,A=d.data.layout.force.mass||1,T=1/S,k=1/A,O=y*C,F=m*C,D=2*o[l],$=2*o[c];t[D]-=O*T,t[D+1]-=F*T,t[$]+=O*k,t[$+1]+=F*k}})},e.prototype.calGravity=function(t){var n,i=this,a=i.nodes,o=i.edges,s=o===void 0?[]:o,u=i.nodeMap,f=i.width,l=i.height,c=i.center,h=i.gravity,d=i.degreesMap,v=i.centripetalOptions;if(a)for(var p=a.length,g=0;g<p;g++){var y=2*g,m=u[a[g].id],b=m.data.layout.force.mass,x=b===void 0?1:b,w=0,E=0,_=h,M=d[m.id],C=M.in,S=M.out,A=M.all,T=(n=i.getCenter)===null||n===void 0?void 0:n.call(i,m,A);if(T){var k=T[0],O=T[1],F=T[2];w=m.x-k,E=m.y-O,_=F}else w=m.x-c[0],E=m.y-c[1];if(_&&(t[y]-=_*w/x,t[y+1]-=_*E/x),v){var D=v.leaf,$=v.single,Y=v.others,N=v.center,P=(N==null?void 0:N(m,a,s,f,l))||{x:0,y:0,centerStrength:0},W=P.x,J=P.y,te=P.centerStrength;if(!(0,tn.isNumber)(W)||!(0,tn.isNumber)(J))continue;var H=(m.x-W)/x,pe=(m.y-J)/x;if(te&&(t[y]-=te*H,t[y+1]-=te*pe),A===0){var Te=$(m);if(!Te)continue;t[y]-=Te*H,t[y+1]-=Te*pe;continue}if(C===0||S===0){var Ne=D(m,a,s);if(!Ne)continue;t[y]-=Ne*H,t[y+1]-=Ne*pe;continue}var Ze=Y(m);if(!Ze)continue;t[y]-=Ze*H,t[y+1]-=Ze*pe}}},e.prototype.attractToSide=function(t){var n=this,i=n.defSideCoe;n.height;var a=n.nodes,o=n.relatedEdges,s=n.currentMinY,u=s===void 0?0:s,f=n.currentMaxY,l=f===void 0?this.height:f;!i||typeof i!="function"||!(a!=null&&a.length)||a.forEach(function(c,h){var d=i(c,o[c.id]||[]);if(d!==0){var v=d<0?u:l,p=Math.abs(d);t[2*h+1]-=p*(c.y-v)}})},e.prototype.updateVelocity=function(t,n,i){var a=this,o=a.nodes,s=a.damping,u=a.maxSpeed;o!=null&&o.length&&o.forEach(function(f,l){var c=(n[2*l]+t[2*l]*i)*s||.01,h=(n[2*l+1]+t[2*l+1]*i)*s||.01,d=Math.sqrt(c*c+h*h);if(d>u){var v=u/d;c=v*c,h=v*h}n[2*l]=c,n[2*l+1]=h})},e.prototype.updatePosition=function(t,n){var i=this,a=i.nodes,o=i.distanceThresholdMode,s=i.nodeMap;if(!(a!=null&&a.length)){this.judgingDistance=0;return}var u=0;o==="max"?i.judgingDistance=-1/0:o==="min"&&(i.judgingDistance=1/0);var f=1/0,l=-1/0;a.forEach(function(c,h){var d=s[c.id];if((0,tn.isNumber)(c.fx)&&(0,tn.isNumber)(c.fy)){c.x=c.fx,c.y=c.fy,d.x=c.x,d.y=c.y;return}var v=t[2*h]*n,p=t[2*h+1]*n;c.x+=v,c.y+=p,d.x=c.x,d.y=c.y,c.y<f&&(f=c.y),c.y>l&&(l=c.y);var g=Math.sqrt(v*v+p*p);switch(o){case"max":i.judgingDistance<g&&(i.judgingDistance=g);break;case"min":i.judgingDistance>g&&(i.judgingDistance=g);break;default:u=u+g;break}}),this.currentMinY=f,this.currentMaxY=l,(!o||o==="mean")&&(i.judgingDistance=u/a.length)},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"force2"},e.prototype.getSameTypeLeafMap=function(){var t=this,n=t.nodeClusterBy,i=t.nodes,a=t.edges,o=t.nodeMap,s=t.degreesMap;if(i!=null&&i.length){var u={};return i.forEach(function(f,l){var c=s[f.id].all;c===1&&(u[f.id]=(0,tn.getCoreNodeAndRelativeLeafNodes)("leaf",f,a,n,s,o))}),u}},e}(XW.Base);ec.Force2Layout=WW;var d1={},jv={};function VW(r,e){var t,n=1;r==null&&(r=0),e==null&&(e=0);function i(){var a,o=t.length,s,u=0,f=0;for(a=0;a<o;++a)s=t[a],u+=s.x,f+=s.y;for(u=(u/o-r)*n,f=(f/o-e)*n,a=0;a<o;++a)s=t[a],s.x-=u,s.y-=f}return i.initialize=function(a){t=a},i.x=function(a){return arguments.length?(r=+a,i):r},i.y=function(a){return arguments.length?(e=+a,i):e},i.strength=function(a){return arguments.length?(n=+a,i):n},i}function an(r){return function(){return r}}function xo(r){return(r()-.5)*1e-6}function HW(r){return r.x+r.vx}function qW(r){return r.y+r.vy}function ZW(r){var e,t,n,i=1,a=1;typeof r!="function"&&(r=an(r==null?1:+r));function o(){for(var f,l=e.length,c,h,d,v,p,g,y=0;y<a;++y)for(c=$v(e,HW,qW).visitAfter(s),f=0;f<l;++f)h=e[f],p=t[h.index],g=p*p,d=h.x+h.vx,v=h.y+h.vy,c.visit(m);function m(b,x,w,E,_){var M=b.data,C=b.r,S=p+C;if(M){if(M.index>h.index){var A=d-M.x-M.vx,T=v-M.y-M.vy,k=A*A+T*T;k<S*S&&(A===0&&(A=xo(n),k+=A*A),T===0&&(T=xo(n),k+=T*T),k=(S-(k=Math.sqrt(k)))/k*i,h.vx+=(A*=k)*(S=(C*=C)/(g+C)),h.vy+=(T*=k)*S,M.vx-=A*(S=1-S),M.vy-=T*S)}return}return x>d+S||E<d-S||w>v+S||_<v-S}}function s(f){if(f.data)return f.r=t[f.data.index];for(var l=f.r=0;l<4;++l)f[l]&&f[l].r>f.r&&(f.r=f[l].r)}function u(){if(e){var f,l=e.length,c;for(t=new Array(l),f=0;f<l;++f)c=e[f],t[c.index]=+r(c,f,e)}}return o.initialize=function(f,l){e=f,n=l,u()},o.iterations=function(f){return arguments.length?(a=+f,o):a},o.strength=function(f){return arguments.length?(i=+f,o):i},o.radius=function(f){return arguments.length?(r=typeof f=="function"?f:an(+f),u(),o):r},o}function KW(r){return r.index}function X2(r,e){var t=r.get(e);if(!t)throw new Error("node not found: "+e);return t}function QW(r){var e=KW,t=c,n,i=an(30),a,o,s,u,f,l=1;r==null&&(r=[]);function c(g){return 1/Math.min(s[g.source.index],s[g.target.index])}function h(g){for(var y=0,m=r.length;y<l;++y)for(var b=0,x,w,E,_,M,C,S;b<m;++b)x=r[b],w=x.source,E=x.target,_=E.x+E.vx-w.x-w.vx||xo(f),M=E.y+E.vy-w.y-w.vy||xo(f),C=Math.sqrt(_*_+M*M),C=(C-a[b])/C*g*n[b],_*=C,M*=C,E.vx-=_*(S=u[b]),E.vy-=M*S,w.vx+=_*(S=1-S),w.vy+=M*S}function d(){if(o){var g,y=o.length,m=r.length,b=new Map(o.map((w,E)=>[e(w,E,o),w])),x;for(g=0,s=new Array(y);g<m;++g)x=r[g],x.index=g,typeof x.source!="object"&&(x.source=X2(b,x.source)),typeof x.target!="object"&&(x.target=X2(b,x.target)),s[x.source.index]=(s[x.source.index]||0)+1,s[x.target.index]=(s[x.target.index]||0)+1;for(g=0,u=new Array(m);g<m;++g)x=r[g],u[g]=s[x.source.index]/(s[x.source.index]+s[x.target.index]);n=new Array(m),v(),a=new Array(m),p()}}function v(){if(o)for(var g=0,y=r.length;g<y;++g)n[g]=+t(r[g],g,r)}function p(){if(o)for(var g=0,y=r.length;g<y;++g)a[g]=+i(r[g],g,r)}return h.initialize=function(g,y){o=g,f=y,d()},h.links=function(g){return arguments.length?(r=g,d(),h):r},h.id=function(g){return arguments.length?(e=g,h):e},h.iterations=function(g){return arguments.length?(l=+g,h):l},h.strength=function(g){return arguments.length?(t=typeof g=="function"?g:an(+g),v(),h):t},h.distance=function(g){return arguments.length?(i=typeof g=="function"?g:an(+g),p(),h):i},h}var JW={value:()=>{}};function qk(){for(var r=0,e=arguments.length,t={},n;r<e;++r){if(!(n=arguments[r]+"")||n in t||/[\s.]/.test(n))throw new Error("illegal type: "+n);t[n]=[]}return new ad(t)}function ad(r){this._=r}function eV(r,e){return r.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}ad.prototype=qk.prototype={constructor:ad,on:function(r,e){var t=this._,n=eV(r+"",t),i,a=-1,o=n.length;if(arguments.length<2){for(;++a<o;)if((i=(r=n[a]).type)&&(i=tV(t[i],r.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<o;)if(i=(r=n[a]).type)t[i]=Y2(t[i],r.name,e);else if(e==null)for(i in t)t[i]=Y2(t[i],r.name,null);return this},copy:function(){var r={},e=this._;for(var t in e)r[t]=e[t].slice();return new ad(r)},call:function(r,e){if((i=arguments.length-2)>0)for(var t=new Array(i),n=0,i,a;n<i;++n)t[n]=arguments[n+2];if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(a=this._[r],n=0,i=a.length;n<i;++n)a[n].value.apply(e,t)},apply:function(r,e,t){if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(var n=this._[r],i=0,a=n.length;i<a;++i)n[i].value.apply(e,t)}};function tV(r,e){for(var t=0,n=r.length,i;t<n;++t)if((i=r[t]).name===e)return i.value}function Y2(r,e,t){for(var n=0,i=r.length;n<i;++n)if(r[n].name===e){r[n]=JW,r=r.slice(0,n).concat(r.slice(n+1));break}return t!=null&&r.push({name:e,value:t}),r}var zu=0,Kf=0,kf=0,Zk=1e3,$d,Qf,jd=0,As=0,Uv=0,Ll=typeof performance=="object"&&performance.now?performance:Date,Kk=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function Qk(){return As||(Kk(rV),As=Ll.now()+Uv)}function rV(){As=0}function my(){this._call=this._time=this._next=null}my.prototype=Jk.prototype={constructor:my,restart:function(r,e,t){if(typeof r!="function")throw new TypeError("callback is not a function");t=(t==null?Qk():+t)+(e==null?0:+e),!this._next&&Qf!==this&&(Qf?Qf._next=this:$d=this,Qf=this),this._call=r,this._time=t,by()},stop:function(){this._call&&(this._call=null,this._time=1/0,by())}};function Jk(r,e,t){var n=new my;return n.restart(r,e,t),n}function nV(){Qk(),++zu;for(var r=$d,e;r;)(e=As-r._time)>=0&&r._call.call(null,e),r=r._next;--zu}function W2(){As=(jd=Ll.now())+Uv,zu=Kf=0;try{nV()}finally{zu=0,aV(),As=0}}function iV(){var r=Ll.now(),e=r-jd;e>Zk&&(Uv-=e,jd=r)}function aV(){for(var r,e=$d,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:$d=t);Qf=r,by(n)}function by(r){if(!zu){Kf&&(Kf=clearTimeout(Kf));var e=r-As;e>24?(r<1/0&&(Kf=setTimeout(W2,r-Ll.now()-Uv)),kf&&(kf=clearInterval(kf))):(kf||(jd=Ll.now(),kf=setInterval(iV,Zk)),zu=1,Kk(W2))}}const oV=1664525,sV=1013904223,V2=4294967296;function uV(){let r=1;return()=>(r=(oV*r+sV)%V2)/V2}function fV(r){return r.x}function lV(r){return r.y}var cV=10,hV=Math.PI*(3-Math.sqrt(5));function dV(r){var e,t=1,n=.001,i=1-Math.pow(n,1/300),a=0,o=.6,s=new Map,u=Jk(c),f=qk("tick","end"),l=uV();r==null&&(r=[]);function c(){h(),f.call("tick",e),t<n&&(u.stop(),f.call("end",e))}function h(p){var g,y=r.length,m;p===void 0&&(p=1);for(var b=0;b<p;++b)for(t+=(a-t)*i,s.forEach(function(x){x(t)}),g=0;g<y;++g)m=r[g],m.fx==null?m.x+=m.vx*=o:(m.x=m.fx,m.vx=0),m.fy==null?m.y+=m.vy*=o:(m.y=m.fy,m.vy=0);return e}function d(){for(var p=0,g=r.length,y;p<g;++p){if(y=r[p],y.index=p,y.fx!=null&&(y.x=y.fx),y.fy!=null&&(y.y=y.fy),isNaN(y.x)||isNaN(y.y)){var m=cV*Math.sqrt(.5+p),b=p*hV;y.x=m*Math.cos(b),y.y=m*Math.sin(b)}(isNaN(y.vx)||isNaN(y.vy))&&(y.vx=y.vy=0)}}function v(p){return p.initialize&&p.initialize(r,l),p}return d(),e={tick:h,restart:function(){return u.restart(c),e},stop:function(){return u.stop(),e},nodes:function(p){return arguments.length?(r=p,d(),s.forEach(v),e):r},alpha:function(p){return arguments.length?(t=+p,e):t},alphaMin:function(p){return arguments.length?(n=+p,e):n},alphaDecay:function(p){return arguments.length?(i=+p,e):+i},alphaTarget:function(p){return arguments.length?(a=+p,e):a},velocityDecay:function(p){return arguments.length?(o=1-p,e):1-o},randomSource:function(p){return arguments.length?(l=p,s.forEach(v),e):l},force:function(p,g){return arguments.length>1?(g==null?s.delete(p):s.set(p,v(g)),e):s.get(p)},find:function(p,g,y){var m=0,b=r.length,x,w,E,_,M;for(y==null?y=1/0:y*=y,m=0;m<b;++m)_=r[m],x=p-_.x,w=g-_.y,E=x*x+w*w,E<y&&(M=_,y=E);return M},on:function(p,g){return arguments.length>1?(f.on(p,g),e):f.on(p)}}}function vV(){var r,e,t,n,i=an(-30),a,o=1,s=1/0,u=.81;function f(d){var v,p=r.length,g=$v(r,fV,lV).visitAfter(c);for(n=d,v=0;v<p;++v)e=r[v],g.visit(h)}function l(){if(r){var d,v=r.length,p;for(a=new Array(v),d=0;d<v;++d)p=r[d],a[p.index]=+i(p,d,r)}}function c(d){var v=0,p,g,y=0,m,b,x;if(d.length){for(m=b=x=0;x<4;++x)(p=d[x])&&(g=Math.abs(p.value))&&(v+=p.value,y+=g,m+=g*p.x,b+=g*p.y);d.x=m/y,d.y=b/y}else{p=d,p.x=p.data.x,p.y=p.data.y;do v+=a[p.data.index];while(p=p.next)}d.value=v}function h(d,v,p,g){if(!d.value)return!0;var y=d.x-e.x,m=d.y-e.y,b=g-v,x=y*y+m*m;if(b*b/u<x)return x<s&&(y===0&&(y=xo(t),x+=y*y),m===0&&(m=xo(t),x+=m*m),x<o&&(x=Math.sqrt(o*x)),e.vx+=y*d.value*n/x,e.vy+=m*d.value*n/x),!0;if(d.length||x>=s)return;(d.data!==e||d.next)&&(y===0&&(y=xo(t),x+=y*y),m===0&&(m=xo(t),x+=m*m),x<o&&(x=Math.sqrt(o*x)));do d.data!==e&&(b=a[d.data.index]*n/x,e.vx+=y*b,e.vy+=m*b);while(d=d.next)}return f.initialize=function(d,v){r=d,t=v,l()},f.strength=function(d){return arguments.length?(i=typeof d=="function"?d:an(+d),l(),f):i},f.distanceMin=function(d){return arguments.length?(o=d*d,f):Math.sqrt(o)},f.distanceMax=function(d){return arguments.length?(s=d*d,f):Math.sqrt(s)},f.theta=function(d){return arguments.length?(u=d*d,f):Math.sqrt(u)},f}function pV(r,e,t){var n,i=an(.1),a,o;typeof r!="function"&&(r=an(+r)),e==null&&(e=0),t==null&&(t=0);function s(f){for(var l=0,c=n.length;l<c;++l){var h=n[l],d=h.x-e||1e-6,v=h.y-t||1e-6,p=Math.sqrt(d*d+v*v),g=(o[l]-p)*a[l]*f/p;h.vx+=d*g,h.vy+=v*g}}function u(){if(n){var f,l=n.length;for(a=new Array(l),o=new Array(l),f=0;f<l;++f)o[f]=+r(n[f],f,n),a[f]=isNaN(o[f])?0:+i(n[f],f,n)}}return s.initialize=function(f){n=f,u()},s.strength=function(f){return arguments.length?(i=typeof f=="function"?f:an(+f),u(),s):i},s.radius=function(f){return arguments.length?(r=typeof f=="function"?f:an(+f),u(),s):r},s.x=function(f){return arguments.length?(e=+f,s):e},s.y=function(f){return arguments.length?(t=+f,s):t},s}function gV(r){var e=an(.1),t,n,i;typeof r!="function"&&(r=an(r==null?0:+r));function a(s){for(var u=0,f=t.length,l;u<f;++u)l=t[u],l.vx+=(i[u]-l.x)*n[u]*s}function o(){if(t){var s,u=t.length;for(n=new Array(u),i=new Array(u),s=0;s<u;++s)n[s]=isNaN(i[s]=+r(t[s],s,t))?0:+e(t[s],s,t)}}return a.initialize=function(s){t=s,o()},a.strength=function(s){return arguments.length?(e=typeof s=="function"?s:an(+s),o(),a):e},a.x=function(s){return arguments.length?(r=typeof s=="function"?s:an(+s),o(),a):r},a}function yV(r){var e=an(.1),t,n,i;typeof r!="function"&&(r=an(r==null?0:+r));function a(s){for(var u=0,f=t.length,l;u<f;++u)l=t[u],l.vy+=(i[u]-l.y)*n[u]*s}function o(){if(t){var s,u=t.length;for(n=new Array(u),i=new Array(u),s=0;s<u;++s)n[s]=isNaN(i[s]=+r(t[s],s,t))?0:+e(t[s],s,t)}}return a.initialize=function(s){t=s,o()},a.strength=function(s){return arguments.length?(e=typeof s=="function"?s:an(+s),o(),a):e},a.y=function(s){return arguments.length?(r=typeof s=="function"?s:an(+s),o(),a):r},a}const mV=Object.freeze(Object.defineProperty({__proto__:null,forceCenter:VW,forceCollide:ZW,forceLink:QW,forceManyBody:vV,forceRadial:pV,forceSimulation:dV,forceX:gV,forceY:yV},Symbol.toStringTag,{value:"Module"})),v1=va(mV);var p1={},bV=xe&&xe.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),xV=xe&&xe.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),wV=xe&&xe.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&bV(e,r,t);return xV(e,r),e};Object.defineProperty(p1,"__esModule",{value:!0});var iu=wV(v1),_h=Or();function EV(){function r(H){return function(){return H}}var e=function(H){return H.cluster},t=r(1),n=r(-1),i=r(100),a=r(.1),o=[0,0],s=[],u={},f=[],l=100,c=100,h={none:{x:0,y:0}},d=[],v,p="force",g=!0,y=.1;function m(H){if(!g)return m;v.tick(),M();for(var pe=0,Te=s.length,Ne=void 0,Ze=H*y;pe<Te;++pe)Ne=s[pe],Ne.vx+=(h[e(Ne)].x-Ne.x)*Ze,Ne.vy+=(h[e(Ne)].y-Ne.y)*Ze}function b(){s&&x()}function x(){if(!(!s||!s.length)){if(e(s[0])===void 0)throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInABox.groupBy('clusterAttr') before calling .links()");var H=w();v=iu.forceSimulation(H.nodes).force("x",iu.forceX(l).strength(.1)).force("y",iu.forceY(c).strength(.1)).force("collide",iu.forceCollide(function(pe){return pe.r}).iterations(4)).force("charge",iu.forceManyBody().strength(n)).force("links",iu.forceLink(H.nodes.length?H.links:[]).distance(i).strength(a)),d=v.nodes(),M()}}function w(){var H=[],pe=[],Te={},Ne=[],Ze={},at=[];return Ze=E(s),at=_(f),Ne=Object.keys(Ze),Ne.forEach(function(nt,_t){var St=Ze[nt];H.push({id:nt,size:St.count,r:Math.sqrt(St.sumforceNodeSize/Math.PI)}),Te[nt]=_t}),at.forEach(function(nt){var _t=(0,_h.getEdgeTerminal)(nt,"source"),St=(0,_h.getEdgeTerminal)(nt,"target"),fr=Te[_t],Ft=Te[St];fr!==void 0&&Ft!==void 0&&pe.push({source:fr,target:Ft,count:nt.count})}),{nodes:H,links:pe}}function E(H){var pe={};return H.forEach(function(Te){var Ne=e(Te);pe[Ne]||(pe[Ne]={count:0,sumforceNodeSize:0})}),H.forEach(function(Te){var Ne=e(Te),Ze=t(Te),at=pe[Ne];at.count=at.count+1,at.sumforceNodeSize=at.sumforceNodeSize+Math.PI*(Ze*Ze)*1.3,pe[Ne]=at}),pe}function _(H){var pe={},Te=[];H.forEach(function(Ze){var at=C(Ze),nt=0;pe[at]!==void 0&&(nt=pe[at]),nt+=1,pe[at]=nt});var Ne=Object.entries(pe);return Ne.forEach(function(Ze){var at=Ze[0],nt=Ze[1],_t=at.split("~")[0],St=at.split("~")[1];_t!==void 0&&St!==void 0&&Te.push({source:_t,target:St,count:nt})}),Te}function M(){return h={none:{x:0,y:0}},d.forEach(function(H){h[H.id]={x:H.x-o[0],y:H.y-o[1]}}),h}function C(H){var pe=(0,_h.getEdgeTerminal)(H,"source"),Te=(0,_h.getEdgeTerminal)(H,"target"),Ne=e(u[pe]),Ze=e(u[Te]);return Ne<=Ze?"".concat(Ne,"~").concat(Ze):"".concat(Ze,"~").concat(Ne)}function S(H){u={},H.forEach(function(pe){u[pe.id]=pe})}function A(H){return arguments.length?(p=H,b(),m):p}function T(H){return arguments.length?typeof H=="string"?(e=function(pe){return pe[H]},m):(e=H,m):e}function k(H){return arguments.length?(g=H,m):g}function O(H){return arguments.length?(y=H,m):y}function F(H){return arguments.length?(l=H,m):l}function D(H){return arguments.length?(c=H,m):c}function $(H){return arguments.length?(S(H||[]),s=H||[],m):s}function Y(H){return arguments.length?(f=H||[],b(),m):f}function N(H){return arguments.length?(typeof H=="function"?t=H:t=r(+H),b(),m):t}function P(H){return arguments.length?(typeof H=="function"?n=H:n=r(+H),b(),m):n}function W(H){return arguments.length?(typeof H=="function"?i=H:i=r(+H),b(),m):i}function J(H){return arguments.length?(typeof H=="function"?a=H:a=r(+H),b(),m):a}function te(H){return arguments.length?(o=H,m):o}return m.initialize=function(H){s=H,b()},m.template=A,m.groupBy=T,m.enableGrouping=k,m.strength=O,m.centerX=F,m.centerY=D,m.nodes=$,m.links=Y,m.forceNodeSize=N,m.nodeSize=m.forceNodeSize,m.forceCharge=P,m.forceLinkDistance=W,m.forceLinkStrength=J,m.offset=te,m.getFocis=M,m}p1.default=EV;var Ua={};Object.defineProperty(Ua,"__esModule",{value:!0});Ua.FORCE_LAYOUT_TYPE_MAP=Ua.LAYOUT_MESSAGE=void 0;Ua.LAYOUT_MESSAGE={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};Ua.FORCE_LAYOUT_TYPE_MAP={gForce:!0,force2:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0};var _V=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),SV=xe&&xe.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),MV=xe&&xe.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),CV=xe&&xe.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&SV(e,r,t);return MV(e,r),e},AV=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(jv,"__esModule",{value:!0});jv.ForceLayout=void 0;var au=CV(v1),TV=AV(p1),ts=Or(),IV=zr,kV=Ua,LV=function(r){_V(e,r);function e(t){var n=r.call(this)||this;return n.center=[0,0],n.nodeStrength=null,n.edgeStrength=null,n.preventOverlap=!1,n.clusterNodeStrength=null,n.clusterEdgeStrength=null,n.clusterEdgeDistance=null,n.clusterNodeSize=null,n.clusterFociStrength=null,n.linkDistance=50,n.alphaDecay=.028,n.alphaMin=.001,n.alpha=.3,n.collideStrength=1,n.workerEnabled=!1,n.tick=function(){},n.onLayoutEnd=function(){},n.ticking=void 0,t&&n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{center:[0,0],nodeStrength:null,edgeStrength:null,preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,linkDistance:50,forceSimulation:null,alphaDecay:.028,alphaMin:.001,alpha:.3,collideStrength:1,clustering:!1,clusterNodeStrength:-1,clusterEdgeStrength:.1,clusterEdgeDistance:100,clusterFociStrength:.8,clusterNodeSize:10,tick:function(){},onLayoutEnd:function(){},workerEnabled:!1}},e.prototype.init=function(t){var n=this;n.nodes=t.nodes||[];var i=t.edges||[];n.edges=i.map(function(a){var o={},s=["targetNode","sourceNode","startPoint","endPoint"];return Object.keys(a).forEach(function(u){s.indexOf(u)>-1||(o[u]=a[u])}),o}),n.ticking=!1},e.prototype.execute=function(t){var n=this,i=n.nodes,a=n.edges;if(!n.ticking){var o=n.forceSimulation,s=n.alphaMin,u=n.alphaDecay,f=n.alpha;if(o){if(t){if(n.clustering&&n.clusterForce&&(n.clusterForce.nodes(i),n.clusterForce.links(a)),o.nodes(i),a&&n.edgeForce)n.edgeForce.links(a);else if(a&&!n.edgeForce){var h=au.forceLink().id(function(g){return g.id}).links(a);n.edgeStrength&&h.strength(n.edgeStrength),n.linkDistance&&h.distance(n.linkDistance),n.edgeForce=h,o.force("link",h)}}n.preventOverlap&&n.overlapProcess(o),o.alpha(f).restart(),this.ticking=!0}else try{var l=au.forceManyBody();if(n.nodeStrength&&l.strength(n.nodeStrength),o=au.forceSimulation().nodes(i),n.clustering){var c=(0,TV.default)();c.centerX(n.center[0]).centerY(n.center[1]).template("force").strength(n.clusterFociStrength),a&&c.links(a),i&&c.nodes(i),c.forceLinkDistance(n.clusterEdgeDistance).forceLinkStrength(n.clusterEdgeStrength).forceCharge(n.clusterNodeStrength).forceNodeSize(n.clusterNodeSize),n.clusterForce=c,o.force("group",c)}if(o.force("center",au.forceCenter(n.center[0],n.center[1])).force("charge",l).alpha(f).alphaDecay(u).alphaMin(s),n.preventOverlap&&n.overlapProcess(o),a){var h=au.forceLink().id(function(p){return p.id}).links(a);n.edgeStrength&&h.strength(n.edgeStrength),n.linkDistance&&h.distance(n.linkDistance),n.edgeForce=h,o.force("link",h)}if(n.workerEnabled&&!OV()&&(n.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),!n.workerEnabled)o.on("tick",function(){n.tick()}).on("end",function(){n.ticking=!1,n.onLayoutEnd&&n.onLayoutEnd()}),n.ticking=!0;else{o.stop();for(var d=NV(o),v=1;v<=d;v++)o.tick(),postMessage({nodes:i,currentTick:v,totalTicks:d,type:kV.LAYOUT_MESSAGE.TICK},void 0);n.ticking=!1}n.forceSimulation=o,n.ticking=!0}catch(p){n.ticking=!1,console.warn(p)}}},e.prototype.overlapProcess=function(t){var n=this,i=n.nodeSize,a=n.nodeSpacing,o,s,u=n.collideStrength;if((0,ts.isNumber)(a)?s=function(){return a}:(0,ts.isFunction)(a)?s=a:s=function(){return 0},!i)o=function(h){if(h.size){if((0,ts.isArray)(h.size)){var d=h.size[0]>h.size[1]?h.size[0]:h.size[1];return d/2+s(h)}if((0,ts.isObject)(h.size)){var d=h.size.width>h.size.height?h.size.width:h.size.height;return d/2+s(h)}return h.size/2+s(h)}return 10+s(h)};else if((0,ts.isFunction)(i))o=function(h){var d=i(h);return d+s(h)};else if((0,ts.isArray)(i)){var f=i[0]>i[1]?i[0]:i[1],l=f/2;o=function(h){return l+s(h)}}else if((0,ts.isNumber)(i)){var c=i/2;o=function(h){return c+s(h)}}else o=function(){return 10};t.force("collisionForce",au.forceCollide(o).strength(u))},e.prototype.updateCfg=function(t){var n=this;n.ticking&&(n.forceSimulation.stop(),n.ticking=!1),n.forceSimulation=null,Object.assign(n,t)},e.prototype.destroy=function(){var t=this;t.ticking&&(t.forceSimulation.stop(),t.ticking=!1),t.nodes=null,t.edges=null,t.destroyed=!0},e}(IV.Base);jv.ForceLayout=LV;function NV(r){var e=r.alphaMin(),t=r.alphaTarget(),n=r.alpha(),i=Math.log((e-t)/(n-t))/Math.log(1-r.alphaDecay()),a=Math.ceil(i);return a}function OV(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}(function(r){var e=xe&&xe.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),t=xe&&xe.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&e(i,n,a)};Object.defineProperty(r,"__esModule",{value:!0}),t(jv,r)})(d1);var tc={},DV=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(tc,"__esModule",{value:!0});tc.CircularLayout=void 0;var PV=zr,aa=Or();function RV(r,e,t,n){r.forEach(function(i,a){r[a].children=[],r[a].parent=[]}),n?e.forEach(function(i){var a=(0,aa.getEdgeTerminal)(i,"source"),o=(0,aa.getEdgeTerminal)(i,"target"),s=0;a&&(s=t[a]);var u=0;o&&(u=t[o]);var f=r[s].children,l=r[u].parent;f.push(r[u].id),l.push(r[s].id)}):e.forEach(function(i){var a=(0,aa.getEdgeTerminal)(i,"source"),o=(0,aa.getEdgeTerminal)(i,"target"),s=0;a&&(s=t[a]);var u=0;o&&(u=t[o]);var f=r[s].children,l=r[u].children;f.push(r[u].id),l.push(r[s].id)})}function BV(r,e,t){for(var n=t.length,i=0;i<n;i++){var a=(0,aa.getEdgeTerminal)(t[i],"source"),o=(0,aa.getEdgeTerminal)(t[i],"target");if(r.id===a&&e.id===o||e.id===a&&r.id===o)return!0}return!1}function FV(r,e){var t=r.degree,n=e.degree;return t<n?-1:t>n?1:0}var GV=function(r){DV(e,r);function e(t){var n=r.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(t),n}return 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,n=this,i=n.nodes,a=n.edges,o=i.length;if(o===0){n.onLayoutEnd&&n.onLayoutEnd();return}!n.width&&typeof window<"u"&&(n.width=window.innerWidth),!n.height&&typeof window<"u"&&(n.height=window.innerHeight),n.center||(n.center=[n.width/2,n.height/2]);var s=n.center;if(o===1){i[0].x=s[0],i[0].y=s[1],n.onLayoutEnd&&n.onLayoutEnd();return}var u=n.radius,f=n.startRadius,l=n.endRadius,c=n.divisions,h=n.startAngle,d=n.endAngle,v=n.angleRatio,p=n.ordering,g=n.clockwise,y=n.nodeSpacing,m=n.nodeSize,b=(d-h)/o,x={};i.forEach(function(D,$){x[D.id]=$}),n.nodeMap=x;var w=(0,aa.getDegree)(i.length,x,a);if(n.degrees=w,y){var E=(0,aa.getFuncByUnknownType)(10,y),_=(0,aa.getFuncByUnknownType)(10,m),M=-1/0;i.forEach(function(D){var $=_(D);M<$&&(M=$)});var C=0;i.forEach(function(D,$){$===0?C+=M||10:C+=(E(D)||0)+(M||10)}),u=C/(2*Math.PI)}else!u&&!f&&!l?u=n.height>n.width?n.width/2:n.height/2:!f&&l?f=l:f&&!l&&(l=f);var S=b*v,A=[];p==="topology"?A=n.topologyOrdering():p==="topology-directed"?A=n.topologyOrdering(!0):p==="degree"?A=n.degreeOrdering():A=i;for(var T=Math.ceil(o/c),k=0;k<o;++k){var O=u;!O&&f!==null&&l!==null&&(O=f+k*(l-f)/(o-1)),O||(O=10+k*100/(o-1));var F=h+k%T*S+2*Math.PI/c*Math.floor(k/T);g||(F=d-k%T*S-2*Math.PI/c*Math.floor(k/T)),A[k].x=s[0]+Math.cos(F)*O,A[k].y=s[1]+Math.sin(F)*O,A[k].weight=w[k].all}return(t=n.onLayoutEnd)===null||t===void 0||t.call(n),{nodes:A,edges:this.edges}},e.prototype.topologyOrdering=function(t){t===void 0&&(t=!1);var n=this,i=n.degrees,a=n.edges,o=n.nodes,s=(0,aa.clone)(o),u=n.nodeMap,f=[s[0]],l=[o[0]],c=[],h=o.length;c[0]=!0,RV(s,a,u,t);var d=0;return s.forEach(function(v,p){if(p!==0)if((p===h-1||i[p].all!==i[p+1].all||BV(f[d],v,a))&&!c[p])f.push(v),l.push(o[u[v.id]]),c[p]=!0,d++;else{for(var g=f[d].children,y=!1,m=0;m<g.length;m++){var b=u[g[m]];if(i[b].all===i[p].all&&!c[b]){f.push(s[b]),l.push(o[u[s[b].id]]),c[b]=!0,y=!0;break}}for(var x=0;!y&&(c[x]||(f.push(s[x]),l.push(o[u[s[x].id]]),c[x]=!0,y=!0),x++,x!==h););}}),l},e.prototype.degreeOrdering=function(){var t=this,n=t.nodes,i=[],a=t.degrees;return n.forEach(function(o,s){o.degree=a[s].all,i.push(o)}),i.sort(FV),i},e.prototype.getType=function(){return"circular"},e}(PV.Base);tc.CircularLayout=GV;var Ju={},g1={},y1={},m1={},b1={},x1={};Object.defineProperty(x1,"__esModule",{value:!0});var zV=function(r,e){if(r!=="next"&&r!=="prev")return e},H2=function(r){r.prev.next=r.next,r.next.prev=r.prev,delete r.next,delete r.prev},$V=function(){function r(){var e={};e.prev=e,e.next=e.prev,this.shortcut=e}return r.prototype.dequeue=function(){var e=this.shortcut,t=e.prev;if(t&&t!==e)return H2(t),t},r.prototype.enqueue=function(e){var t=this.shortcut;e.prev&&e.next&&H2(e),e.next=t.next,t.next.prev=e,t.next=e,e.prev=t},r.prototype.toString=function(){for(var e=[],t=this.shortcut,n=t.prev;n!==t;)e.push(JSON.stringify(n,zV)),n=n==null?void 0:n.prev;return"[".concat(e.join(", "),"]")},r}();x1.default=$V;var Cu;(function(r){r.DEFAULT_EDGE_NAME="\0",r.GRAPH_NODE="\0",r.EDGE_KEY_DELIM=""})(Cu||(Cu={}));function q2(r,e){var t=r.get(e)||0;r.set(e,t+1)}function Z2(r,e){var t=r.get(e);t!==void 0&&(t=t-1,t>0?r.set(e,t):r.delete(e))}function eL(r,e,t,n){var i=String(e),a=String(t);if(!r&&i>a){var o=i;i=a,a=o}return i+Cu.EDGE_KEY_DELIM+a+Cu.EDGE_KEY_DELIM+(n===void 0?Cu.DEFAULT_EDGE_NAME:n)}function K2(r,e,t,n){var i=String(e),a=String(t),o={v:e,w:t};if(!r&&i>a){var s=o.v;o.v=o.w,o.w=s}return n!==void 0&&(o.name=n),o}function jg(r,e){return eL(r,e.v,e.w,e.name)}function Q2(r){return typeof r=="function"}var jV=function(e){return e.nodes().map(function(t){var n=e.node(t),i=e.parent(t),a={id:t,value:n,parent:i};return a.value===void 0&&delete a.value,a.parent===void 0&&delete a.parent,a})},UV=function(e){return e.edges().map(function(t){var n=e.edge(t),i={v:t.v,w:t.w,value:n,name:t.name};return i.name===void 0&&delete i.name,i.value===void 0&&delete i.value,i})},XV=function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:jV(e),edges:UV(e),value:e.graph()};return t.value===void 0&&delete t.value,t},YV=function(e){var t=new Ds(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(function(n){t.setNode(n.id,n.value),n.parent&&t.setParent(n.id,n.parent)}),e.edges.forEach(function(n){t.setEdge(n.v,n.w,n.value,n.name)}),t};function J2(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function e_(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?J2(Object(t),!0).forEach(function(n){WV(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):J2(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function WV(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function VV(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function HV(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function qV(r,e,t){return e&&HV(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}var ZV={compound:!1,multigraph:!1,directed:!0},Ds=function(){function r(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};VV(this,r),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=Cu.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(i){return e.label=i,e},this.graph=function(){return e.label},this.setDefaultNodeLabel=function(i){return Q2(i)?e.defaultNodeLabelFn=i:e.defaultNodeLabelFn=function(){return i},e},this.nodeCount=function(){return e.nodeCountNum},this.node=function(i){return e.nodesLabelMap.get(i)},this.nodes=function(){return Array.from(e.nodesLabelMap.keys())},this.sources=function(){return e.nodes().filter(function(i){var a;return!(!((a=e.inEdgesMap.get(i))===null||a===void 0)&&a.size)})},this.sinks=function(){return e.nodes().filter(function(i){var a;return!(!((a=e.outEdgesMap.get(i))===null||a===void 0)&&a.size)})},this.setNodes=function(i,a){return i.map(function(o){return e.setNode(o,a)}),e},this.hasNode=function(i){return e.nodesLabelMap.has(i)},this.checkCompound=function(){if(!e.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(i){if(e.isCompound()){var a,o=(a=e.parentMap)===null||a===void 0?void 0:a.get(i);if(o!==e.GRAPH_NODE)return o}},this.removeFromParentsChildList=function(i){var a=e.parentMap.get(i);e.childrenMap.get(a).delete(i)},this.setParent=function(i,a){var o,s;e.checkCompound();for(var u=a===void 0?e.GRAPH_NODE:a,f=e.parent(u);f;){if(i===f)throw new Error("Setting "+a+" as parent of "+i+" would create a cycle");f=e.parent(f)}a&&e.setNode(a),e.setNode(i),e.removeFromParentsChildList(i),(o=e.parentMap)===null||o===void 0||o.set(i,u);var l=e.childrenMap.get(u);return l.set(i,!0),(s=e.childrenMap)===null||s===void 0||s.set(u,l),e},this.children=function(i){var a=i===void 0?e.GRAPH_NODE:i;if(e.isCompound()){var o,s=(o=e.childrenMap)===null||o===void 0?void 0:o.get(a);return s?Array.from(s.keys()):void 0}if(a===e.GRAPH_NODE)return e.nodes();if(i&&e.hasNode(i))return[]},this.predecessors=function(i){var a=e.predecessorsMap.get(i);return a?Array.from(a.keys()):void 0},this.successors=function(i){var a=e.successorsMap.get(i);return a?Array.from(a.keys()):void 0},this.neighbors=function(i){var a;if(e.hasNode(i))return Array.from(new Set((a=e.predecessors(i))===null||a===void 0?void 0:a.concat(e.successors(i))))},this.isLeaf=function(i){var a;if(e.isDirected()){var o;return!(!((o=e.successors(i))===null||o===void 0)&&o.length)}return!(!((a=e.neighbors(i))===null||a===void 0)&&a.length)},this.filterNodes=function(i){var a=e.directed,o=e.multigraph,s=e.compound,u=new r({directed:a,multigraph:o,compound:s});if(u.setGraph(e.graph()),e.nodes().forEach(function(l){i(l)&&u.setNode(l,e.node(l))}),e.edges().forEach(function(l){u.hasNode(l.v)&&u.hasNode(l.w)&&u.setEdgeObj(l,e.edge(l))}),s){var f=function(c){for(var h=e.parent(c);h!==void 0&&!u.hasNode(h);)h=e.parent(h);return h};u.nodes().forEach(function(l){u.setParent(l,f(l))})}return u},this.setDefaultEdgeLabel=function(i){return Q2(i)?e.defaultEdgeLabelFn=i:e.defaultEdgeLabelFn=function(){return i},e},this.edgeCount=function(){return e.edgeCountNum},this.setEdgeObj=function(i,a){return e.setEdge(i.v,i.w,a,i.name)},this.setPath=function(i,a){return i.reduce(function(o,s){return e.setEdge(o,s,a),s}),e},this.edgeFromArgs=function(i,a,o){return e.edge({v:i,w:a,name:o})},this.edge=function(i){return e.edgesLabelsMap.get(jg(e.isDirected(),i))},this.hasEdge=function(i,a,o){return e.edgesLabelsMap.has(jg(e.isDirected(),{v:i,w:a,name:o}))},this.removeEdgeObj=function(i){var a=i.v,o=i.w,s=i.name;return e.removeEdge(a,o,s)},this.edges=function(){return Array.from(e.edgesMap.values())},this.inEdges=function(i,a){var o=e.inEdgesMap.get(i);if(o)return Array.from(o.values()).filter(function(s){return!a||s.v===a})},this.outEdges=function(i,a){var o=e.outEdgesMap.get(i);if(o)return Array.from(o.values()).filter(function(s){return!a||s.w===a})},this.nodeEdges=function(i,a){var o;if(e.hasNode(i))return(o=e.inEdges(i,a))===null||o===void 0?void 0:o.concat(e.outEdges(i,a))},this.toJSON=function(){return XV(e)},this.nodeInDegree=function(i){var a=e.inEdgesMap.get(i);return a?a.size:0},this.nodeOutDegree=function(i){var a=e.outEdgesMap.get(i);return a?a.size:0},this.nodeDegree=function(i){return e.nodeInDegree(i)+e.nodeOutDegree(i)},this.source=function(i){return i.v},this.target=function(i){return i.w};var n=e_(e_({},ZV),t);this.compound=n.compound,this.directed=n.directed,this.multigraph=n.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}return qV(r,[{key:"setNode",value:function(t,n){var i=this.nodesLabelMap,a=this.defaultNodeLabelFn,o=this.isCompound,s=this.parentMap,u=this.childrenMap,f=this.inEdgesMap,l=this.outEdgesMap,c=this.predecessorsMap,h=this.successorsMap;if(i.has(t))return n!==void 0&&i.set(t,n),this;if(i.set(t,n||a(t)),o()){var d;s==null||s.set(t,this.GRAPH_NODE),u==null||u.set(t,new Map),u!=null&&u.has(this.GRAPH_NODE)||u==null||u.set(this.GRAPH_NODE,new Map),u==null||(d=u.get(this.GRAPH_NODE))===null||d===void 0||d.set(t,!0)}return[f,l,c,h].forEach(function(v){return v.set(t,new Map)}),this.nodeCountNum+=1,this}},{key:"removeNode",value:function(t){var n=this;if(this.hasNode(t)){var i=function(g){n.removeEdge(g.v,g.w,g.name)},a=this.inEdgesMap,o=this.outEdgesMap,s=this.predecessorsMap,u=this.successorsMap,f=this.nodesLabelMap;if(this.isCompound()){var l,c,h;this.removeFromParentsChildList(t),(l=this.parentMap)===null||l===void 0||l.delete(t),(c=this.children(t))===null||c===void 0||c.forEach(function(p){return n.setParent(p)}),(h=this.childrenMap)===null||h===void 0||h.delete(t)}var d=a.get(t),v=o.get(t);Array.from(d.values()).forEach(function(p){return i(p)}),Array.from(v.values()).forEach(function(p){return i(p)}),f.delete(t),a.delete(t),o.delete(t),s.delete(t),u.delete(t),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(t,n,i,a){var o,s,u=K2(this.isDirected(),t,n,a),f=jg(this.isDirected(),u),l=u.v,c=u.w;if(this.edgesLabelsMap.has(f))return this.edgesLabelsMap.set(f,i),this;if(a!==void 0&&!this.isMultigraph())throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(l),this.setNode(c),this.edgesLabelsMap.set(f,i||this.defaultEdgeLabelFn(l,c,a)),Object.freeze(u),this.edgesMap.set(f,u);var h=this.predecessorsMap.get(c),d=this.successorsMap.get(l);return q2(h,l),q2(d,c),(o=this.inEdgesMap.get(c))===null||o===void 0||o.set(f,u),(s=this.outEdgesMap.get(l))===null||s===void 0||s.set(f,u),this.edgeCountNum+=1,this}},{key:"removeEdge",value:function(t,n,i){var a=eL(this.isDirected(),t,n,i),o=this.edgesMap.get(a);if(o){var s=K2(this.isDirected(),t,n,i),u=s.v,f=s.w;this.edgesLabelsMap.delete(a),this.edgesMap.delete(a);var l=this.predecessorsMap.get(f),c=this.successorsMap.get(u);Z2(l,u),Z2(c,f),this.inEdgesMap.get(f).delete(a),this.outEdgesMap.get(u).delete(a),this.edgeCountNum-=1}return this}}]),r}();Ds.fromJSON=YV;function xy(r){"@babel/helpers - typeof";return xy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xy(r)}function KV(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function QV(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function JV(r,e,t){return e&&QV(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function ps(){return typeof Reflect<"u"&&Reflect.get?ps=Reflect.get:ps=function(e,t,n){var i=eH(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(arguments.length<3?e:n):a.value}},ps.apply(this,arguments)}function eH(r,e){for(;!Object.prototype.hasOwnProperty.call(r,e)&&(r=Ba(r),r!==null););return r}function tH(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&wy(r,e)}function wy(r,e){return wy=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},wy(r,e)}function rH(r){var e=aH();return function(){var n=Ba(r),i;if(e){var a=Ba(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return nH(this,i)}}function nH(r,e){if(e&&(xy(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iH(r)}function iH(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function aH(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ba(r){return Ba=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ba(r)}var oH=function(r){tH(t,r);var e=rH(t);function t(){var n;KV(this,t);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=e.call.apply(e,[this].concat(a)),n.eventPool={},n}return JV(t,[{key:"appendEvent",value:function(i,a){this.eventPool[i]||(this.eventPool[i]=[]),this.eventPool[i].push(a)}},{key:"removeEvent",value:function(i,a){if(this.eventPool[i]){var o=this.eventPool[i].indexOf(a);o>-1&&this.eventPool[i].splice(o,1)}}},{key:"emitEvent",value:function(i){for(var a=arguments.length,o=new Array(a>1?a-1:0),s=1;s<a;s++)o[s-1]=arguments[s];this.eventPool[i]&&this.eventPool[i].forEach(function(u){u.apply(void 0,o)})}},{key:"setNode",value:function(i,a){return ps(Ba(t.prototype),"setNode",this).call(this,i,a),this.emitEvent("nodeAdd",i,a),this}},{key:"removeNode",value:function(i){return ps(Ba(t.prototype),"removeNode",this).call(this,i),this.emitEvent("nodeRemove",i),this}},{key:"setEdge",value:function(i,a,o,s){return ps(Ba(t.prototype),"setEdge",this).call(this,i,a,o,s),this.emitEvent("edgeAdd",i,a,o,s),this}},{key:"removeEdge",value:function(i,a,o){return ps(Ba(t.prototype),"removeEdge",this).call(this,i,a,o),this.emitEvent("edgeRemove",i,a,o),this}}]),t}(Ds);function sH(r,e,t){return Object.defineProperty(r,"prototype",{writable:!1}),r}function uH(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var tL=sH(function r(){var e=this;uH(this,r),this.arr=[],this.keyIndice=new Map,this.size=function(){return e.arr.length},this.keys=function(){return e.arr.map(function(t){return t.key})},this.has=function(t){return e.keyIndice.has(t)},this.priority=function(t){var n=e.keyIndice.get(t);if(n!==void 0)return e.arr[n].priority},this.swap=function(t,n){var i=e.arr,a=e.keyIndice,o=[i[t],i[n]],s=o[0],u=o[1];i[t]=u,i[n]=s,a.set(s.key,n),a.set(u.key,t)},this.innerDecrease=function(t){for(var n=e.arr,i=n[t].priority,a,o=t;o!==0;){var s;if(a=o>>1,((s=n[a])===null||s===void 0?void 0:s.priority)<i)break;e.swap(o,a),o=a}},this.heapify=function(t){var n=e.arr,i=t<<1,a=i+1,o=t;i<n.length&&(o=n[i].priority<n[o].priority?i:o,a<n.length&&(o=n[a].priority<n[o].priority?a:o),o!==t&&(e.swap(t,o),e.heapify(o)))},this.min=function(){if(e.size()===0)throw new Error("Queue underflow");return e.arr[0].key},this.add=function(t,n){var i=e.keyIndice,a=e.arr;if(!i.has(t)){var o=a.length;return i.set(t,o),a.push({key:t,priority:n}),e.innerDecrease(o),!0}return!1},this.removeMin=function(){e.swap(0,e.arr.length-1);var t=e.arr.pop();return e.keyIndice.delete(t.key),e.heapify(0),t.key},this.decrease=function(t,n){if(!e.has(t))throw new Error("There's no key named ".concat(t));var i=e.keyIndice.get(t);if(n>e.arr[i].priority)throw new Error("New priority is greater than current priority.Key: ".concat(t," Old: + ").concat(e.arr[i].priority," New: ").concat(n));e.arr[i].priority=n,e.innerDecrease(i)}}),fH=function(e,t){var n=new Ds,i=new Map,a=new tL,o;function s(l){var c=l.v===o?l.w:l.v,h=a.priority(c);if(h!==void 0){var d=t(l);d<h&&(i.set(c,o),a.decrease(c,d))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(l){a.add(l,Number.POSITIVE_INFINITY),n.setNode(l)}),a.decrease(e.nodes()[0],0);for(var u=!1;a.size()>0;){var f;if(o=a.removeMin(),i.has(o))n.setEdge(o,i.get(o));else{if(u)throw new Error("Input graph is not connected: "+e.graph());u=!0}(f=e.nodeEdges(o))===null||f===void 0||f.forEach(s)}return n},lH=function(e){var t=new Set,n=[],i=e.nodes();return i.forEach(function(a){for(var o=[],s=[a];s.length>0;){var u=s.pop();if(!t.has(u)){var f,l;t.add(u),o.push(u),(f=e.successors(u))===null||f===void 0||f.forEach(function(c){return s.push(c)}),(l=e.predecessors(u))===null||l===void 0||l.forEach(function(c){return s.push(c)})}}o.length&&n.push(o)}),n},cH=function r(e,t,n,i,a,o){i.includes(t)||(i.push(t),n||o.push(t),a(t).forEach(function(s){return r(e,s,n,i,a,o)}),n&&o.push(t))},w1=function(e,t,n){var i=Array.isArray(t)?t:[t],a=function(f){return e.isDirected()?e.successors(f):e.neighbors(f)},o=[],s=[];return i.forEach(function(u){if(e.hasNode(u))cH(e,u,n==="post",s,a,o);else throw new Error("Graph does not have node: "+u)}),o};function hH(r,e){return gH(r)||pH(r,e)||vH(r,e)||dH()}function dH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
31
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vH(r,e){if(r){if(typeof r=="string")return t_(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return t_(r,e)}}function t_(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function pH(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n=[],i=!0,a=!1,o,s;try{for(t=t.call(r);!(i=(o=t.next()).done)&&(n.push(o.value),!(e&&n.length===e));i=!0);}catch(u){a=!0,s=u}finally{try{!i&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function gH(r){if(Array.isArray(r))return r}var yH=function(){return 1},rL=function(e,t,n,i){return mH(e,t,n||yH,i||function(a){return e.outEdges(a)})},mH=function(e,t,n,i){var a=new Map,o=new tL,s,u,f=function(h){var d=h.v!==s?h.v:h.w,v=a.get(d),p=n(h),g=u.distance+p;if(p<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+h+" Weight: "+p);g<v.distance&&(v.distance=g,v.predecessor=s,o.decrease(d,g))};for(e.nodes().forEach(function(c){var h=c===t?0:Number.POSITIVE_INFINITY;a.set(c,{distance:h}),o.add(c,h)});o.size()>0&&(s=o.removeMin(),u=a.get(s),!(u&&u.distance===Number.POSITIVE_INFINITY));)i(s).forEach(f);var l={};return Array.from(a.entries()).forEach(function(c){var h=hH(c,2),d=h[0],v=h[1];return l[String(d)]=v,l}),l},bH=function(e,t,n){var i={};return e.nodes().forEach(function(a){return i[String(a)]=rL(e,a,t,n),i}),i},nL=function(e){var t=0,n=[],i=new Map,a=[];function o(s){var u,f={onStack:!0,lowlink:t,index:t};if(i.set(s,f),t+=1,n.push(s),(u=e.successors(s))===null||u===void 0||u.forEach(function(d){var v;if(i.has(d)){if(!((v=i.get(d))===null||v===void 0)&&v.onStack){var g=i.get(d);f.lowlink=Math.min(f.lowlink,g.index)}}else{o(d);var p=i.get(d);f.lowlink=Math.min(f.lowlink,p.lowlink)}}),f.lowlink===f.index){var l=[],c;do{c=n.pop();var h=i.get(c);h.onStack=!1,l.push(c)}while(s!==c);a.push(l)}}return e.nodes().forEach(function(s){i.has(s)||o(s)}),a},xH=function(e){return nL(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})};function Ey(r){"@babel/helpers - typeof";return Ey=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ey(r)}function wH(r,e,t){return Object.defineProperty(r,"prototype",{writable:!1}),r}function EH(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function _H(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&Nl(r,e)}function SH(r){var e=iL();return function(){var n=Ol(r),i;if(e){var a=Ol(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return MH(this,i)}}function MH(r,e){if(e&&(Ey(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return CH(r)}function CH(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function _y(r){var e=typeof Map=="function"?new Map:void 0;return _y=function(n){if(n===null||!AH(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return od(n,arguments,Ol(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Nl(i,n)},_y(r)}function od(r,e,t){return iL()?od=Reflect.construct:od=function(i,a,o){var s=[null];s.push.apply(s,a);var u=Function.bind.apply(i,s),f=new u;return o&&Nl(f,o.prototype),f},od.apply(null,arguments)}function iL(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function AH(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function Nl(r,e){return Nl=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Nl(r,e)}function Ol(r){return Ol=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ol(r)}var Sy=function(r){_H(t,r);var e=SH(t);function t(){return EH(this,t),e.apply(this,arguments)}return wH(t)}(_y(Error));function aL(r){var e=new Set,t=new Set,n=[];function i(a){if(t.has(a))throw new Sy;if(!e.has(a)){var o;t.add(a),e.add(a),(o=r.predecessors(a))===null||o===void 0||o.forEach(i),t.delete(a),n.push(a)}}if(r.sinks().forEach(i),e.size!==r.nodeCount())throw new Sy;return n}var TH=function(e){try{aL(e)}catch(t){if(t instanceof Sy)return!1;throw t}return!0},IH=function(e,t){return w1(e,t,"post")},kH=function(e,t){return w1(e,t,"pre")},LH=function(){return 1};function NH(r,e,t){return OH(r,e||LH,t||function(n){return r.outEdges(n)})}function OH(r,e,t){var n={},i=r.nodes();return i.forEach(function(a){var o=String(a);n[o]={},n[o][o]={distance:0},i.forEach(function(s){a!==s&&(n[o][String(s)]={distance:Number.POSITIVE_INFINITY})}),t(a).forEach(function(s){var u=s.v===a?s.w:s.v,f=e(s);n[o][String(u)]={distance:f,predecessor:a}})}),i.forEach(function(a){var o=String(a),s=n[o];i.forEach(function(u){var f=String(u),l=n[f];i.forEach(function(c){var h=String(c),d=l[o],v=s[h],p=l[h],g=d.distance+v.distance;g<p.distance&&(p.distance=g,p.predecessor=v.predecessor)})})}),n}const DH=Object.freeze(Object.defineProperty({__proto__:null,components:lH,dfs:w1,dijkstra:rL,dijkstraAll:bH,findCycles:xH,floydWarshall:NH,isAcyclic:TH,postorder:IH,preorder:kH,prim:fH,tarjan:nL,topsort:aL},Symbol.toStringTag,{value:"Module"}));var PH=function(e,t){for(var n=e.nodes(),i=0;i<n.length;i++){var a=n[i];if(t.hasNode(a))return!0}return!1},oL=function(e,t){for(var n=e.edges(),i=0;i<n.length;i++){var a=n[i];if(t.hasEdge(a.v,a.w,a.name))return!0}return!1},sL=function(e,t){var n=e.nodes(),i=n.filter(function(a){return t.hasNode(a)});return i},uL=function(e,t){var n=e.edges(),i=n.filter(function(a){return t.hasEdge(a.v,a.w,a.name)});return i},fL=function(e,t){return e.isCompound()===t.isCompound()&&e.isDirected()===t.isDirected()&&e.isMultigraph()===t.isMultigraph()},Xv=function(e,t){var n=sL(e,t);return n.length===e.nodes().length},E1=function(e,t){var n=uL(e,t);return n.length===e.edges().length},RH=function(e,t){return fL(e,t)&&e.nodeCount()===t.nodeCount()&&Xv(e,t)&&e.edgeCount()===t.edgeCount()&&E1(e,t)},BH=function(e,t){return Xv(e,t)&&E1(e,t)};function FH(r,e){return jH(r)||$H(r,e)||zH(r,e)||GH()}function GH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
32
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zH(r,e){if(r){if(typeof r=="string")return r_(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r_(r,e)}}function r_(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function $H(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n=[],i=!0,a=!1,o,s;try{for(t=t.call(r);!(i=(o=t.next()).done)&&(n.push(o.value),!(e&&n.length===e));i=!0);}catch(u){a=!0,s=u}finally{try{!i&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function jH(r){if(Array.isArray(r))return r}function UH(r){return r instanceof Ds}function Ud(r){if(r.isMultigraph())return!1;for(var e=r.edges(),t=new Map,n=0;n<e.length;n++){var i=e[n];if(i.v===i.w)return!1;var a=[i.v,i.w].sort(),o=FH(a,2),s=o[0],u=o[1],f="".concat(s,"-").concat(u);if(t.has(f))return!1;t.set(f,!0)}return!0}function XH(r){return r.nodes().length===0}function YH(r){for(var e=r.edges(),t=0;t<e.length;t++){var n=e[t];if(n.v===n.w)return!0}return!1}const WH=Object.freeze(Object.defineProperty({__proto__:null,hasSelfLoop:YH,isGraph:UH,isNullGraph:XH,isSimpleGraph:Ud},Symbol.toStringTag,{value:"Module"}));var VH=function(e,t){if(!Ud(e)||!Ud(t)||!Xv(e,t)||oL(e,t))return!1;var n=e.nodeCount();return e.edgeCount()+t.edgeCount()===n*(n-1)/2};const HH=Object.freeze(Object.defineProperty({__proto__:null,containAllSameEdges:E1,containAllSameNodes:Xv,containSameEdges:oL,containSameNodes:PH,getSameEdges:uL,getSameNodes:sL,isGraphComplement:VH,isGraphContainsAnother:BH,isGraphOptionSame:fL,isGraphSame:RH},Symbol.toStringTag,{value:"Module"}));var qH=function(e){if(!Ud(e))return null;for(var t=e.nodeCount(),n=new Ds({compound:e.isCompound(),directed:e.isDirected(),multigraph:e.isMultigraph()}),i=e.nodes(),a=0;a<t;a++){var o=i[a];n.setNode(o,e.node(o));for(var s=a+1;s<t;s++){var u=i[s];e.hasEdge(o,u)||n.setEdge(o,u)}}return n};const ZH=Object.freeze(Object.defineProperty({__proto__:null,getGraphComplement:qH},Symbol.toStringTag,{value:"Module"})),KH=Object.freeze(Object.defineProperty({__proto__:null,Graph:Ds,GraphWithEvent:oH,algorithm:DH,comparision:HH,essence:WH,generate:ZH},Symbol.toStringTag,{value:"Module"})),Yv=va(KH);var lL=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),QH=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(b1,"__esModule",{value:!0});var JH=QH(x1),eq=Yv,tq=function(r){lL(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(JH.default),rq=function(r){lL(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(eq.Graph),nq=function(){return 1},iq=function(r,e){var t;if(r.nodeCount()<=1)return[];var n=oq(r,e||nq),i=aq(n.graph,n.buckets,n.zeroIdx);return(t=i.map(function(a){return r.outEdges(a.v,a.w)}))===null||t===void 0?void 0:t.flat()},aq=function(r,e,t){for(var n=[],i=e[e.length-1],a=e[0],o;r.nodeCount();){for(;o=a.dequeue();)Ug(r,e,t,o);for(;o=i.dequeue();)Ug(r,e,t,o);if(r.nodeCount()){for(var s=e.length-2;s>0;--s)if(o=e[s].dequeue(),o){n=n.concat(Ug(r,e,t,o,!0));break}}}return n},Ug=function(r,e,t,n,i){var a,o,s=[];return(a=r.inEdges(n.v))===null||a===void 0||a.forEach(function(u){var f=r.edge(u),l=r.node(u.v);i&&s.push({v:u.v,w:u.w,in:0,out:0}),l.out===void 0&&(l.out=0),l.out-=f,My(e,t,l)}),(o=r.outEdges(n.v))===null||o===void 0||o.forEach(function(u){var f=r.edge(u),l=u.w,c=r.node(l);c.in===void 0&&(c.in=0),c.in-=f,My(e,t,c)}),r.removeNode(n.v),i?s:void 0},oq=function(r,e){var t=new rq,n=0,i=0;r.nodes().forEach(function(f){t.setNode(f,{v:f,in:0,out:0})}),r.edges().forEach(function(f){var l=t.edge(f)||0,c=(e==null?void 0:e(f))||1,h=l+c;t.setEdge(f.v,f.w,h),i=Math.max(i,t.node(f.v).out+=c),n=Math.max(n,t.node(f.w).in+=c)});for(var a=[],o=i+n+3,s=0;s<o;s++)a.push(new tq);var u=n+1;return t.nodes().forEach(function(f){My(a,u,t.node(f))}),{buckets:a,zeroIdx:u,graph:t}},My=function(r,e,t){t.out?t.in?r[t.out-t.in+e].enqueue(t):r[r.length-1].enqueue(t):r[0].enqueue(t)};b1.default=iq;var sq=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(m1,"__esModule",{value:!0});var uq=sq(b1),fq=function(r){var e=function(n){return function(i){var a;return((a=n.edge(i))===null||a===void 0?void 0:a.weight)||1}},t=r.graph().acyclicer==="greedy"?(0,uq.default)(r,e(r)):lq(r);t==null||t.forEach(function(n){var i=r.edge(n);r.removeEdgeObj(n),i.forwardName=n.name,i.reversed=!0,r.setEdge(n.w,n.v,i,"rev-".concat(Math.random()))})},lq=function(r){var e=[],t={},n={},i=function(a){var o;n[a]||(n[a]=!0,t[a]=!0,(o=r.outEdges(a))===null||o===void 0||o.forEach(function(s){t[s.w]?e.push(s):i(s.w)}),delete t[a])};return r.nodes().forEach(i),e},cq=function(r){r.edges().forEach(function(e){var t=r.edge(e);if(t.reversed){r.removeEdgeObj(e);var n=t.forwardName;delete t.reversed,delete t.forwardName,r.setEdge(e.w,e.v,t,n)}})};m1.default={run:fq,undo:cq};var _1={},ti={},Ya={},hq=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Ya,"__esModule",{value:!0});Ya.Graph=void 0;var dq=Yv,vq=function(r){hq(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(dq.Graph);Ya.Graph=vq;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.minBy=r.notime=r.time=r.partition=r.maxRank=r.addBorderNode=r.removeEmptyRanks=r.normalizeRanks=r.buildLayerMatrix=r.intersectRect=r.predecessorWeights=r.successorWeights=r.zipObject=r.asNonCompoundGraph=r.simplify=r.addDummyNode=void 0;var e=Or(),t=Ya,n=function(x,w){return Number(x)-Number(w)},i=function(x,w,E,_){var M;do M="".concat(_).concat(Math.random());while(x.hasNode(M));return E.dummy=w,x.setNode(M,E),M};r.addDummyNode=i;var a=function(x){var w=new t.Graph().setGraph(x.graph());return x.nodes().forEach(function(E){w.setNode(E,x.node(E))}),x.edges().forEach(function(E){var _=w.edgeFromArgs(E.v,E.w)||{weight:0,minlen:1},M=x.edge(E);w.setEdge(E.v,E.w,{weight:_.weight+M.weight,minlen:Math.max(_.minlen,M.minlen)})}),w};r.simplify=a;var o=function(x){var w=new t.Graph({multigraph:x.isMultigraph()}).setGraph(x.graph());return x.nodes().forEach(function(E){var _;!((_=x.children(E))===null||_===void 0)&&_.length||w.setNode(E,x.node(E))}),x.edges().forEach(function(E){w.setEdgeObj(E,x.edge(E))}),w};r.asNonCompoundGraph=o;var s=function(x,w){return x==null?void 0:x.reduce(function(E,_,M){return E[_]=w[M],E},{})};r.zipObject=s;var u=function(x){var w={};return x.nodes().forEach(function(E){var _,M={};(_=x.outEdges(E))===null||_===void 0||_.forEach(function(C){var S;M[C.w]=(M[C.w]||0)+(((S=x.edge(C))===null||S===void 0?void 0:S.weight)||0)}),w[E]=M}),w};r.successorWeights=u;var f=function(x){var w=x.nodes(),E=w.map(function(_){var M,C={};return(M=x.inEdges(_))===null||M===void 0||M.forEach(function(S){C[S.v]=(C[S.v]||0)+x.edge(S).weight}),C});return(0,r.zipObject)(w,E)};r.predecessorWeights=f;var l=function(x,w){var E=Number(x.x),_=Number(x.y),M=Number(w.x)-E,C=Number(w.y)-_,S=Number(x.width)/2,A=Number(x.height)/2;if(!M&&!C)return{x:0,y:0};var T,k;return Math.abs(C)*S>Math.abs(M)*A?(C<0&&(A=-A),T=A*M/C,k=A):(M<0&&(S=-S),T=S,k=S*C/M),{x:E+T,y:_+k}};r.intersectRect=l;var c=function(x){for(var w=[],E=(0,r.maxRank)(x)+1,_=0;_<E;_++)w.push([]);x.nodes().forEach(function(M){var C=x.node(M);if(C){var S=C.rank;S!==void 0&&w[S]&&w[S].push(M)}});for(var _=0;_<E;_++)w[_]=w[_].sort(function(C,S){var A,T;return n((A=x.node(C))===null||A===void 0?void 0:A.order,(T=x.node(S))===null||T===void 0?void 0:T.order)});return w};r.buildLayerMatrix=c;var h=function(x){var w=x.nodes().filter(function(_){var M;return((M=x.node(_))===null||M===void 0?void 0:M.rank)!==void 0}).map(function(_){return x.node(_).rank}),E=Math.min.apply(Math,w);x.nodes().forEach(function(_){var M=x.node(_);M.hasOwnProperty("rank")&&E!==1/0&&(M.rank-=E)})};r.normalizeRanks=h;var d=function(x){var w=x.nodes(),E=w.filter(function(k){var O;return((O=x.node(k))===null||O===void 0?void 0:O.rank)!==void 0}).map(function(k){return x.node(k).rank}),_=Math.min.apply(Math,E),M=[];w.forEach(function(k){var O,F=(((O=x.node(k))===null||O===void 0?void 0:O.rank)||0)-_;M[F]||(M[F]=[]),M[F].push(k)});for(var C=0,S=x.graph().nodeRankFactor||0,A=0;A<M.length;A++){var T=M[A];T===void 0?A%S!==0&&(C-=1):C&&(T==null||T.forEach(function(k){var O=x.node(k);O&&(O.rank=O.rank||0,O.rank+=C)}))}};r.removeEmptyRanks=d;var v=function(x,w,E,_){var M={width:0,height:0};return(0,e.isNumber)(E)&&(0,e.isNumber)(_)&&(M.rank=E,M.order=_),(0,r.addDummyNode)(x,"border",M,w)};r.addBorderNode=v;var p=function(x){var w;return x.nodes().forEach(function(E){var _,M=(_=x.node(E))===null||_===void 0?void 0:_.rank;M!==void 0&&(w===void 0||M>w)&&(w=M)}),w||(w=0),w};r.maxRank=p;var g=function(x,w){var E={lhs:[],rhs:[]};return x==null||x.forEach(function(_){w(_)?E.lhs.push(_):E.rhs.push(_)}),E};r.partition=g;var y=function(x,w){var E=Date.now();try{return w()}finally{console.log("".concat(x," time: ").concat(Date.now()-E,"ms"))}};r.time=y;var m=function(x,w){return w()};r.notime=m;var b=function(x,w){return x.reduce(function(E,_){var M=w(E),C=w(_);return M>C?_:E})};r.minBy=b})(ti);Object.defineProperty(_1,"__esModule",{value:!0});var pq=ti,gq=function(r){r.graph().dummyChains=[],r.edges().forEach(function(e){return yq(r,e)})},yq=function(r,e){var t=e.v,n=r.node(t).rank,i=e.w,a=r.node(i).rank,o=e.name,s=r.edge(e),u=s.labelRank;if(a!==n+1){r.removeEdgeObj(e);var f=r.graph(),l,c,h;for(h=0,++n;n<a;++h,++n)s.points=[],c={edgeLabel:s,width:0,height:0,edgeObj:e,rank:n},l=(0,pq.addDummyNode)(r,"edge",c,"_d"),n===u&&(c.width=s.width,c.height=s.height,c.dummy="edge-label",c.labelpos=s.labelpos),r.setEdge(t,l,{weight:s.weight},o),h===0&&(f.dummyChains||(f.dummyChains=[]),f.dummyChains.push(l)),t=l;r.setEdge(t,i,{weight:s.weight},o)}},mq=function(r){var e;(e=r.graph().dummyChains)===null||e===void 0||e.forEach(function(t){var n=r.node(t),i=n.edgeLabel,a;n.edgeObj&&r.setEdgeObj(n.edgeObj,i);for(var o=t;n.dummy;)a=r.successors(o)[0],r.removeNode(o),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),o=a,n=r.node(o)})};_1.default={run:gq,undo:mq};var S1={},Oi={};Object.defineProperty(Oi,"__esModule",{value:!0});Oi.slack=Oi.longestPathWithLayer=Oi.longestPath=void 0;var cL=function(r){var e,t={},n=function(i){var a,o=r.node(i);if(!o)return 0;if(t[i])return o.rank;t[i]=!0;var s;return(a=r.outEdges(i))===null||a===void 0||a.forEach(function(u){var f=n(u.w),l=r.edge(u).minlen,c=f-l;c&&(s===void 0||c<s)&&(s=c)}),s||(s=0),o.rank=s,s};(e=r.sources())===null||e===void 0||e.forEach(function(i){return n(i)})};Oi.longestPath=cL;var hL=function(r){var e,t={},n,i=function(s){var u,f=r.node(s);if(!f)return 0;if(t[s])return f.rank;t[s]=!0;var l;return(u=r.outEdges(s))===null||u===void 0||u.forEach(function(c){var h=i(c.w),d=r.edge(c).minlen,v=h-d;v&&(l===void 0||v<l)&&(l=v)}),l||(l=0),(n===void 0||l<n)&&(n=l),f.rank=l,l};(e=r.sources())===null||e===void 0||e.forEach(function(s){r.node(s)&&i(s)}),n===void 0&&(n=0);var a={},o=function(s,u){var f,l=r.node(s),c=isNaN(l.layer)?u:l.layer;(l.rank===void 0||l.rank<c)&&(l.rank=c),!a[s]&&(a[s]=!0,(f=r.outEdges(s))===null||f===void 0||f.map(function(h){o(h.w,c+r.edge(h).minlen)}))};r.nodes().forEach(function(s){var u=r.node(s);u&&(isNaN(u.layer)?u.rank-=n:o(s,u.layer))})};Oi.longestPathWithLayer=hL;var dL=function(r,e){return r.node(e.w).rank-r.node(e.v).rank-r.edge(e).minlen};Oi.slack=dL;Oi.default={longestPath:cL,longestPathWithLayer:hL,slack:dL};var ko={};Object.defineProperty(ko,"__esModule",{value:!0});ko.feasibleTreeWithLayer=ko.feasibleTree=void 0;var Ts=Oi,bq=ti,vL=Ya,pL=function(r){var e=new vL.Graph({directed:!1}),t=r.nodes()[0],n=r.nodeCount();e.setNode(t,{});for(var i,a;xq(e,r)<n;)i=yL(e,r),a=e.hasNode(i.v)?(0,Ts.slack)(r,i):-(0,Ts.slack)(r,i),mL(e,r,a);return e};ko.feasibleTree=pL;var xq=function(r,e){var t=function(n){e.nodeEdges(n).forEach(function(i){var a=i.v,o=n===a?i.w:a;!r.hasNode(o)&&!(0,Ts.slack)(e,i)&&(r.setNode(o,{}),r.setEdge(n,o,{}),t(o))})};return r.nodes().forEach(t),r.nodeCount()},gL=function(r){var e=new vL.Graph({directed:!1}),t=r.nodes()[0],n=r.nodes().filter(function(o){return!!r.node(o)}).length;e.setNode(t,{});for(var i,a;wq(e,r)<n;)i=yL(e,r),a=e.hasNode(i.v)?(0,Ts.slack)(r,i):-(0,Ts.slack)(r,i),mL(e,r,a);return e};ko.feasibleTreeWithLayer=gL;var wq=function(r,e){var t=function(n){var i;(i=e.nodeEdges(n))===null||i===void 0||i.forEach(function(a){var o=a.v,s=n===o?a.w:o;!r.hasNode(s)&&(e.node(s).layer!==void 0||!(0,Ts.slack)(e,a))&&(r.setNode(s,{}),r.setEdge(n,s,{}),t(s))})};return r.nodes().forEach(t),r.nodeCount()},yL=function(r,e){return(0,bq.minBy)(e.edges(),function(t){return r.hasNode(t.v)!==r.hasNode(t.w)?(0,Ts.slack)(e,t):1/0})},mL=function(r,e,t){r.nodes().forEach(function(n){e.node(n).rank||(e.node(n).rank=0),e.node(n).rank+=t})};ko.default={feasibleTree:pL,feasibleTreeWithLayer:gL};var bL={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.exchangeEdges=r.enterEdge=r.leaveEdge=r.initLowLimValues=r.calcCutValue=r.initCutValues=void 0;var e=ko,t=Oi,n=ti,i=Yv,a=i.algorithm.preorder,o=i.algorithm.postorder,s=function(b){var x=(0,n.simplify)(b);(0,t.longestPath)(x);var w=(0,e.feasibleTree)(x);(0,r.initLowLimValues)(w),(0,r.initCutValues)(w,x);for(var E,_;E=(0,r.leaveEdge)(w);)_=(0,r.enterEdge)(w,x,E),(0,r.exchangeEdges)(w,x,E,_)},u=function(b,x){var w=o(b,b.nodes());w=w==null?void 0:w.slice(0,(w==null?void 0:w.length)-1),w==null||w.forEach(function(E){f(b,x,E)})};r.initCutValues=u;var f=function(b,x,w){var E=b.node(w),_=E.parent;b.edgeFromArgs(w,_).cutvalue=(0,r.calcCutValue)(b,x,w)},l=function(b,x,w){var E,_=b.node(w),M=_.parent,C=!0,S=x.edgeFromArgs(w,M),A=0;return S||(C=!1,S=x.edgeFromArgs(M,w)),A=S.weight,(E=x.nodeEdges(w))===null||E===void 0||E.forEach(function(T){var k=T.v===w,O=k?T.w:T.v;if(O!==M){var F=k===C,D=x.edge(T).weight;if(A+=F?D:-D,y(b,w,O)){var $=b.edgeFromArgs(w,O).cutvalue;A+=F?-$:$}}}),A};r.calcCutValue=l;var c=function(b,x){x===void 0&&(x=b.nodes()[0]),h(b,{},1,x)};r.initLowLimValues=c;var h=function(b,x,w,E,_){var M,C=w,S=w,A=b.node(E);return x[E]=!0,(M=b.neighbors(E))===null||M===void 0||M.forEach(function(T){x[T]||(S=h(b,x,S,T,E))}),A.low=C,A.lim=S++,_?A.parent=_:delete A.parent,S},d=function(b){return b.edges().find(function(x){return b.edge(x).cutvalue<0})};r.leaveEdge=d;var v=function(b,x,w){var E=w.v,_=w.w;x.hasEdge(E,_)||(E=w.w,_=w.v);var M=b.node(E),C=b.node(_),S=M,A=!1;M.lim>C.lim&&(S=C,A=!0);var T=x.edges().filter(function(k){return A===m(b,b.node(k.v),S)&&A!==m(b,b.node(k.w),S)});return(0,n.minBy)(T,function(k){return(0,t.slack)(x,k)})};r.enterEdge=v;var p=function(b,x,w,E){var _=w.v,M=w.w;b.removeEdge(_,M),b.setEdge(E.v,E.w,{}),(0,r.initLowLimValues)(b),(0,r.initCutValues)(b,x),g(b,x)};r.exchangeEdges=p;var g=function(b,x){var w=b.nodes().find(function(_){var M;return!(!((M=x.node(_))===null||M===void 0)&&M.parent)}),E=a(b,w);E=E==null?void 0:E.slice(1),E==null||E.forEach(function(_){var M=b.node(_).parent,C=x.edgeFromArgs(_,M),S=!1;C||(C=x.edgeFromArgs(M,_),S=!0),x.node(_).rank=x.node(M).rank+(S?C.minlen:-C.minlen)})},y=function(b,x,w){return b.hasEdge(x,w)},m=function(b,x,w){return w.low<=x.lim&&x.lim<=w.lim};r.default=s})(bL);var Eq=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(S1,"__esModule",{value:!0});var xL=Oi,_q=ko,Sq=Eq(bL),Mq=function(r){switch(r.graph().ranker){case"network-simplex":Aq(r);break;case"tight-tree":n_(r);break;case"longest-path":Cq(r);break;default:n_(r)}},Cq=xL.longestPath,n_=function(r){(0,xL.longestPathWithLayer)(r),(0,_q.feasibleTreeWithLayer)(r)},Aq=function(r){(0,Sq.default)(r)};S1.default=Mq;var M1={};Object.defineProperty(M1,"__esModule",{value:!0});var Tq=function(r){var e,t={},n=0,i=function(a){var o,s=n;(o=r.children(a))===null||o===void 0||o.forEach(i),t[a]={low:s,lim:n++}};return(e=r.children())===null||e===void 0||e.forEach(i),t},Iq=function(r,e,t,n){var i=[],a=[],o=Math.min(e[t].low,e[n].low),s=Math.max(e[t].lim,e[n].lim),u,f;u=t;do u=r.parent(u),i.push(u);while(u&&(e[u].low>o||s>e[u].lim));for(f=u,u=n;u&&u!==f;)a.push(u),u=r.parent(u);return{lca:f,path:i.concat(a.reverse())}},kq=function(r){var e,t=Tq(r);(e=r.graph().dummyChains)===null||e===void 0||e.forEach(function(n){var i,a,o=n,s=r.node(o),u=s.edgeObj;if(u)for(var f=Iq(r,t,u.v,u.w),l=f.path,c=f.lca,h=0,d=l[h],v=!0;o!==u.w;){if(s=r.node(o),v){for(;d!==c&&((i=r.node(d))===null||i===void 0?void 0:i.maxRank)<s.rank;)h++,d=l[h];d===c&&(v=!1)}if(!v){for(;h<l.length-1&&((a=r.node(l[h+1]))===null||a===void 0?void 0:a.minRank)<=s.rank;)h++;d=l[h]}r.setParent(o,d),o=r.successors(o)[0]}})};M1.default=kq;var C1={};Object.defineProperty(C1,"__esModule",{value:!0});var Cy=ti,Lq=function(r){var e,t=(0,Cy.addDummyNode)(r,"root",{},"_root"),n=Nq(r),i=Math.max.apply(Math,Object.values(n));Math.abs(i)===1/0&&(i=1);var a=i-1,o=2*a+1;r.graph().nestingRoot=t,r.edges().forEach(function(u){r.edge(u).minlen*=o});var s=Oq(r)+1;(e=r.children())===null||e===void 0||e.forEach(function(u){wL(r,t,o,s,a,n,u)}),r.graph().nodeRankFactor=o},wL=function(r,e,t,n,i,a,o){var s=r.children(o);if(!(s!=null&&s.length)){o!==e&&r.setEdge(e,o,{weight:0,minlen:t});return}var u=(0,Cy.addBorderNode)(r,"_bt"),f=(0,Cy.addBorderNode)(r,"_bb"),l=r.node(o);r.setParent(u,o),l.borderTop=u,r.setParent(f,o),l.borderBottom=f,s==null||s.forEach(function(c){wL(r,e,t,n,i,a,c);var h=r.node(c),d=h.borderTop?h.borderTop:c,v=h.borderBottom?h.borderBottom:c,p=h.borderTop?n:2*n,g=d!==v?1:i-a[o]+1;r.setEdge(u,d,{minlen:g,weight:p,nestingEdge:!0}),r.setEdge(v,f,{minlen:g,weight:p,nestingEdge:!0})}),r.parent(o)||r.setEdge(e,u,{weight:0,minlen:i+a[o]})},Nq=function(r){var e,t={},n=function(i,a){var o=r.children(i);o==null||o.forEach(function(s){return n(s,a+1)}),t[i]=a};return(e=r.children())===null||e===void 0||e.forEach(function(i){return n(i,1)}),t},Oq=function(r){var e=0;return r.edges().forEach(function(t){e+=r.edge(t).weight}),e},Dq=function(r){var e=r.graph();e.nestingRoot&&r.removeNode(e.nestingRoot),delete e.nestingRoot,r.edges().forEach(function(t){var n=r.edge(t);n.nestingEdge&&r.removeEdgeObj(t)})};C1.default={run:Lq,cleanup:Dq};var A1={};Object.defineProperty(A1,"__esModule",{value:!0});var Pq=ti,Rq=function(r){var e,t=function(n){var i=r.children(n),a=r.node(n);if(i!=null&&i.length&&i.forEach(function(u){return t(u)}),a.hasOwnProperty("minRank")){a.borderLeft=[],a.borderRight=[];for(var o=a.minRank,s=a.maxRank+1;o<s;o+=1)i_(r,"borderLeft","_bl",n,a,o),i_(r,"borderRight","_br",n,a,o)}};(e=r.children())===null||e===void 0||e.forEach(function(n){return t(n)})},i_=function(r,e,t,n,i,a){var o={rank:a,borderType:e,width:0,height:0},s=i[e][a-1],u=(0,Pq.addDummyNode)(r,"border",o,t);i[e][a]=u,r.setParent(u,n),s&&r.setEdge(s,u,{weight:1})};A1.default=Rq;var T1={};Object.defineProperty(T1,"__esModule",{value:!0});var Bq=function(r){var e,t=(e=r.graph().rankdir)===null||e===void 0?void 0:e.toLowerCase();(t==="lr"||t==="rl")&&EL(r)},Fq=function(r){var e,t=(e=r.graph().rankdir)===null||e===void 0?void 0:e.toLowerCase();(t==="bt"||t==="rl")&&Gq(r),(t==="lr"||t==="rl")&&(zq(r),EL(r))},EL=function(r){r.nodes().forEach(function(e){a_(r.node(e))}),r.edges().forEach(function(e){a_(r.edge(e))})},a_=function(r){var e=r.width;r.width=r.height,r.height=e},Gq=function(r){r.nodes().forEach(function(e){Xg(r.node(e))}),r.edges().forEach(function(e){var t,n=r.edge(e);(t=n.points)===null||t===void 0||t.forEach(function(i){return Xg(i)}),n.hasOwnProperty("y")&&Xg(n)})},Xg=function(r){r!=null&&r.y&&(r.y=-r.y)},zq=function(r){r.nodes().forEach(function(e){Yg(r.node(e))}),r.edges().forEach(function(e){var t,n=r.edge(e);(t=n.points)===null||t===void 0||t.forEach(function(i){return Yg(i)}),n.hasOwnProperty("x")&&Yg(n)})},Yg=function(r){var e=r.x;r.x=r.y,r.y=e};T1.default={adjust:Bq,undo:Fq};var I1={},k1={};function _L(r){return[parseInt(r.substr(1,2),16),parseInt(r.substr(3,2),16),parseInt(r.substr(5,2),16)]}function Wg(r){var e=Math.round(r).toString(16);return e.length===1?"0"+e:e}function SL(r){return"#"+Wg(r[0])+Wg(r[1])+Wg(r[2])}var zn=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},$q=function(r,e){return zn(r)?r.indexOf(e)>-1:!1};const Xd=$q;var ML=function(r,e){if(!zn(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];e(i,n)&&t.push(i)}return t},jq=function(r,e){return e===void 0&&(e=[]),ML(r,function(t){return!Xd(e,t)})};const Uq=jq,ri=function(r){return typeof r=="function"};var Do=function(r){return r==null},Xq={}.toString,ma=function(r,e){return Xq.call(r)==="[object "+e+"]"};const Vr=function(r){return Array.isArray?Array.isArray(r):ma(r,"Array")},Wv=function(r){var e=typeof r;return r!==null&&e==="object"||e==="function"};function $u(r,e){if(r){var t;if(Vr(r))for(var n=0,i=r.length;n<i&&(t=e(r[n],n),t!==!1);n++);else if(Wv(r)){for(var a in r)if(r.hasOwnProperty(a)&&(t=e(r[a],a),t===!1))break}}}var Yq=Object.keys?function(r){return Object.keys(r)}:function(r){var e=[];return $u(r,function(t,n){ri(r)&&n==="prototype"||e.push(n)}),e};const CL=Yq;function AL(r,e){var t=CL(e),n=t.length;if(Do(r))return!n;for(var i=0;i<n;i+=1){var a=t[i];if(e[a]!==r[a]||!(a in r))return!1}return!0}var Wq=function(r){return typeof r=="object"&&r!==null};const Yd=Wq;var Vq=function(r){if(!Yd(r)||!ma(r,"Object"))return!1;if(Object.getPrototypeOf(r)===null)return!0;for(var e=r;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e};const ju=Vq;function Hq(r,e){if(!Vr(r))return null;var t;if(ri(e)&&(t=e),ju(e)&&(t=function(i){return AL(i,e)}),t){for(var n=0;n<r.length;n+=1)if(t(r[n]))return r[n]}return null}function qq(r,e,t){t===void 0&&(t=0);for(var n=t;n<r.length;n++)if(e(r[n],n))return n;return-1}var Zq=function(r,e){for(var t=null,n=0;n<r.length;n++){var i=r[n],a=i[e];if(!Do(a)){Vr(a)?t=a[0]:t=a;break}}return t};const Kq=Zq;var Qq=function(r){if(!Vr(r))return[];for(var e=[],t=0;t<r.length;t++)e=e.concat(r[t]);return e};const Jq=Qq;var TL=function(r,e){if(e===void 0&&(e=[]),!Vr(r))e.push(r);else for(var t=0;t<r.length;t+=1)TL(r[t],e);return e};const eZ=TL,IL=function(r){if(Vr(r))return r.reduce(function(e,t){return Math.max(e,t)},r[0])},kL=function(r){if(Vr(r))return r.reduce(function(e,t){return Math.min(e,t)},r[0])};var tZ=function(r){var e=r.filter(function(o){return!isNaN(o)});if(!e.length)return{min:0,max:0};if(Vr(r[0])){for(var t=[],n=0;n<r.length;n++)t=t.concat(r[n]);e=t}var i=IL(e),a=kL(e);return{min:a,max:i}};const rZ=tZ;var LL=Array.prototype,nZ=LL.splice,iZ=LL.indexOf,aZ=function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n++)for(var i=e[n],a=-1;(a=iZ.call(r,i))>-1;)nZ.call(r,a,1);return r};const oZ=aZ;var sZ=Array.prototype.splice,uZ=function(e,t){if(!zn(e))return[];for(var n=e?t.length:0,i=n-1;n--;){var a=void 0,o=t[n];(n===i||o!==a)&&(a=o,sZ.call(e,o,1))}return e};const NL=uZ;var fZ=function(r,e,t){if(!Vr(r)&&!ju(r))return r;var n=t;return $u(r,function(i,a){n=e(n,i,a)}),n};const OL=fZ;var lZ=function(r,e){var t=[];if(!zn(r))return t;for(var n=-1,i=[],a=r.length;++n<a;){var o=r[n];e(o,n,r)&&(t.push(o),i.push(n))}return NL(r,i),t};const cZ=lZ,Lo=function(r){return ma(r,"String")};function hZ(r,e){var t;if(ri(e))t=function(i,a){return e(i)-e(a)};else{var n=[];Lo(e)?n.push(e):Vr(e)&&(n=e),t=function(i,a){for(var o=0;o<n.length;o+=1){var s=n[o];if(i[s]>a[s])return 1;if(i[s]<a[s])return-1}return 0}}return r.sort(t),r}function DL(r,e){e===void 0&&(e=new Map);var t=[];if(Array.isArray(r))for(var n=0,i=r.length;n<i;n++){var a=r[n];e.has(a)||(t.push(a),e.set(a,!0))}return t}var dZ=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return DL([].concat.apply([],r))};const vZ=dZ,pZ=function(r,e){for(var t=[],n={},i=0;i<r.length;i++){var a=r[i],o=a[e];if(!Do(o)){Vr(o)||(o=[o]);for(var s=0;s<o.length;s++){var u=o[s];n[u]||(t.push(u),n[u]=!0)}}}return t};function gZ(r){if(zn(r))return r[0]}function yZ(r){if(zn(r)){var e=r;return e[e.length-1]}}function mZ(r,e){return Vr(r)||Lo(r)?r[0]===e:!1}function bZ(r,e){return Vr(r)||Lo(r)?r[r.length-1]===e:!1}var xZ=function(r,e){for(var t=0;t<r.length;t++)if(!e(r[t],t))return!1;return!0};const wZ=xZ;var EZ=function(r,e){for(var t=0;t<r.length;t++)if(e(r[t],t))return!0;return!1};const _Z=EZ;var SZ=Object.prototype.hasOwnProperty;function PL(r,e){if(!e||!Vr(r))return{};for(var t={},n=ri(e)?e:function(s){return s[e]},i,a=0;a<r.length;a++){var o=r[a];i=n(o),SZ.call(t,i)?t[i].push(o):t[i]=[o]}return t}function RL(r,e){if(!e)return{0:r};if(!ri(e)){var t=Vr(e)?e:e.replace(/\s+/g,"").split("*");e=function(n){for(var i="_",a=0,o=t.length;a<o;a++)i+=n[t[a]]&&n[t[a]].toString();return i}}return PL(r,e)}const MZ=function(r,e){if(!e)return[r];var t=RL(r,e),n=[];for(var i in t)n.push(t[i]);return n};function CZ(r,e){return r["_wrap_"+e]}function AZ(r,e){if(r["_wrap_"+e])return r["_wrap_"+e];var t=function(n){r[e](n)};return r["_wrap_"+e]=t,t}var o_={};function TZ(r){var e=o_[r];if(!e){for(var t=r.toString(16),n=t.length;n<6;n++)t="0"+t;e="#"+t,o_[r]=e}return e}function IZ(r){var e=0,t=0,n=0,i=0;return Vr(r)?r.length===1?e=t=n=i=r[0]:r.length===2?(e=n=r[0],t=i=r[1]):r.length===3?(e=r[0],t=i=r[1],n=r[2]):(e=r[0],t=r[1],n=r[2],i=r[3]):e=t=n=i=r,{r1:e,r2:t,r3:n,r4:i}}var kZ=function(r,e,t){return r<e?e:r>t?t:r};const LZ=kZ;var NZ=function(r,e){var t=e.toString(),n=t.indexOf(".");if(n===-1)return Math.round(r);var i=t.substr(n+1).length;return i>20&&(i=20),parseFloat(r.toFixed(i))};const OZ=NZ;var Wa=function(r){return ma(r,"Number")},DZ=function(r){return Wa(r)&&r%1!==0};const PZ=DZ;var RZ=function(r){return Wa(r)&&r%2===0};const BZ=RZ;var FZ=Number.isInteger?Number.isInteger:function(r){return Wa(r)&&r%1===0};const GZ=FZ;var zZ=function(r){return Wa(r)&&r<0};const $Z=zZ;var jZ=1e-5;function UZ(r,e,t){return t===void 0&&(t=jZ),Math.abs(r-e)<t}var XZ=function(r){return Wa(r)&&r%2!==0};const YZ=XZ;var WZ=function(r){return Wa(r)&&r>0};const VZ=WZ,HZ=function(r,e){if(Vr(r)){for(var t,n=-1/0,i=0;i<r.length;i++){var a=r[i],o=ri(e)?e(a):a[e];o>n&&(t=a,n=o)}return t}},qZ=function(r,e){if(Vr(r)){for(var t,n=1/0,i=0;i<r.length;i++){var a=r[i],o=ri(e)?e(a):a[e];o<n&&(t=a,n=o)}return t}};var ZZ=function(r,e){return(r%e+e)%e};const KZ=ZZ;var QZ=180/Math.PI,JZ=function(r){return QZ*r};const eK=JZ,tK=parseInt;var rK=Math.PI/180,nK=function(r){return rK*r};const iK=nK,s_=function(r,e){return r.hasOwnProperty(e)};var BL=Object.values?function(r){return Object.values(r)}:function(r){var e=[];return $u(r,function(t,n){ri(r)&&n==="prototype"||e.push(t)}),e};const aK=function(r,e){return Xd(BL(r),e)},rc=function(r){return Do(r)?"":r.toString()};var oK=function(r){return rc(r).toLowerCase()};const sK=oK;var uK=function(r){var e=rc(r);return e.charAt(0).toLowerCase()+e.substring(1)};const fK=uK;function lK(r,e){return!r||!e?r:r.replace(/\\?\{([^{}]+)\}/g,function(t,n){return t.charAt(0)==="\\"?t.slice(1):e[n]===void 0?"":e[n]})}var cK=function(r){return rc(r).toUpperCase()};const hK=cK;var dK=function(r){var e=rc(r);return e.charAt(0).toUpperCase()+e.substring(1)};const vK=dK;var pK={}.toString,gK=function(r){return pK.call(r).replace(/^\[object /,"").replace(/]$/,"")};const FL=gK;var yK=function(r){return ma(r,"Arguments")};const mK=yK;var bK=function(r){return ma(r,"Boolean")};const xK=bK;var wK=function(r){return ma(r,"Date")};const EK=wK;var _K=function(r){return ma(r,"Error")};const SK=_K;function MK(r){return Wa(r)&&isFinite(r)}var CK=function(r){return r===null};const AK=CK;var TK=Object.prototype,IK=function(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||TK;return r===t};const GL=IK;var kK=function(r){return ma(r,"RegExp")};const LK=kK;var NK=function(r){return r===void 0};const OK=NK;var DK=function(r){return r instanceof Element||r instanceof Document};const PK=DK;function RK(r){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,16)};return e(r)}function BK(r){var e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;e(r)}function Vg(r,e){for(var t in e)e.hasOwnProperty(t)&&t!=="constructor"&&e[t]!==void 0&&(r[t]=e[t])}function Au(r,e,t,n){return e&&Vg(r,e),t&&Vg(r,t),n&&Vg(r,n),r}var FK=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var t=r[0],n=1;n<r.length;n++){var i=r[n];ri(i)&&(i=i.prototype),Au(t.prototype,i)}};const GK=FK;var Ay=function(r){if(typeof r!="object"||r===null)return r;var e;if(Vr(r)){e=[];for(var t=0,n=r.length;t<n;t++)typeof r[t]=="object"&&r[t]!=null?e[t]=Ay(r[t]):e[t]=r[t]}else{e={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?e[i]=Ay(r[i]):e[i]=r[i]}return e};const zK=Ay;function $K(r,e,t){var n;return function(){var i=this,a=arguments,o=function(){n=null,t||r.apply(i,a)},s=t&&!n;clearTimeout(n),n=setTimeout(o,e),s&&r.apply(i,a)}}function jK(r){var e,t,n,i=r||1;function a(s,u){++e>i&&(n=t,o(1),++e),t[s]=u}function o(s){e=0,t=Object.create(null),s||(n=Object.create(null))}return o(),{clear:o,has:function(s){return t[s]!==void 0||n[s]!==void 0},get:function(s){var u=t[s];if(u!==void 0)return u;if((u=n[s])!==void 0)return a(s,u),u},set:function(s,u){t[s]!==void 0?t[s]=u:a(s,u)}}}const zL=function(r,e,t){if(t===void 0&&(t=128),!ri(r))throw new TypeError("Expected a function");var n=function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=e?e.apply(this,i):i[0],s=n.cache;if(s.has(o))return s.get(o);var u=r.apply(this,i);return s.set(o,u),u};return n.cache=jK(t),n};var UK=5;function XK(r,e){if(Object.hasOwn)return Object.hasOwn(r,e);if(r==null)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(r),e)}function $L(r,e,t,n){t=t||0,n=n||UK;for(var i in e)if(XK(e,i)){var a=e[i];a!==null&&ju(a)?(ju(r[i])||(r[i]={}),t<n?$L(r[i],a,t+1,n):r[i]=e[i]):Vr(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var YK=function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n+=1)$L(r,e[n]);return r};const WK=YK;var VK=function(r,e,t,n){ri(e)||(t=e,e=r,r=function(){});var i=Object.create?function(o,s){return Object.create(o,{constructor:{value:s}})}:function(o,s){function u(){}u.prototype=o;var f=new u;return f.constructor=s,f},a=i(e.prototype,r);return r.prototype=Au(a,r.prototype),r.superclass=i(e.prototype,e),Au(a,t),Au(r,n),r};const HK=VK;var qK=function(r,e){if(!zn(r))return-1;var t=Array.prototype.indexOf;if(t)return t.call(r,e);for(var n=-1,i=0;i<r.length;i++)if(r[i]===e){n=i;break}return n};const ZK=qK;var KK=Object.prototype.hasOwnProperty;function QK(r){if(Do(r))return!0;if(zn(r))return!r.length;var e=FL(r);if(e==="Map"||e==="Set")return!r.size;if(GL(r))return!Object.keys(r).length;for(var t in r)if(KK.call(r,t))return!1;return!0}var Ty=function(r,e){if(r===e)return!0;if(!r||!e||Lo(r)||Lo(e))return!1;if(zn(r)||zn(e)){if(r.length!==e.length)return!1;for(var t=!0,n=0;n<r.length&&(t=Ty(r[n],e[n]),!!t);n++);return t}if(Yd(r)||Yd(e)){var i=Object.keys(r),a=Object.keys(e);if(i.length!==a.length)return!1;for(var t=!0,n=0;n<i.length&&(t=Ty(r[i[n]],e[i[n]]),!!t);n++);return t}return!1};const jL=Ty,JK=function(r,e,t){return ri(t)?!!t(r,e):jL(r,e)};var eQ=function(r,e){if(!zn(r))return r;for(var t=[],n=0;n<r.length;n++){var i=r[n];t.push(e(i,n))}return t};const tQ=eQ;var rQ=function(r){return r};const nQ=function(r,e){e===void 0&&(e=rQ);var t={};return Wv(r)&&!Do(r)&&Object.keys(r).forEach(function(n){t[n]=e(r[n],n)}),t},iQ=function(r,e,t){for(var n=0,i=Lo(e)?e.split("."):e;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?t:r},aQ=function(r,e,t){var n=r,i=Lo(e)?e.split("."):e;return i.forEach(function(a,o){o<i.length-1?(Wv(n[a])||(n[a]=Wa(i[o+1])?[]:{}),n=n[a]):n[a]=t}),r};var oQ=Object.prototype.hasOwnProperty;const sQ=function(r,e){if(r===null||!ju(r))return{};var t={};return $u(e,function(n){oQ.call(r,n)&&(t[n]=r[n])}),t},uQ=function(r,e){return OL(r,function(t,n,i){return e.includes(i)||(t[i]=n),t},{})},fQ=function(r,e,t){var n,i,a,o,s=0;t||(t={});var u=function(){s=t.leading===!1?0:Date.now(),n=null,o=r.apply(i,a),n||(i=a=null)},f=function(){var l=Date.now();!s&&t.leading===!1&&(s=l);var c=e-(l-s);return i=this,a=arguments,c<=0||c>e?(n&&(clearTimeout(n),n=null),s=l,o=r.apply(i,a),n||(i=a=null)):!n&&t.trailing!==!1&&(n=setTimeout(u,c)),o};return f.cancel=function(){clearTimeout(n),s=0,n=i=a=null},f},lQ=function(r){return zn(r)?Array.prototype.slice.call(r):[]};var Sh={};const cQ=function(r){return r=r||"g",Sh[r]?Sh[r]+=1:Sh[r]=1,r+Sh[r]},hQ=function(){},dQ=function(r){return r};function vQ(r){return Do(r)?0:zn(r)?r.length:Object.keys(r).length}var pQ=function(){function r(){this.map={}}return r.prototype.has=function(e){return this.map[e]!==void 0},r.prototype.get=function(e,t){var n=this.map[e];return n===void 0?t:n},r.prototype.set=function(e,t){this.map[e]=t},r.prototype.clear=function(){this.map={}},r.prototype.delete=function(e){delete this.map[e]},r.prototype.size=function(){return Object.keys(this.map).length},r}();const gQ=pQ;var yQ=/rgba?\(([\s.,0-9]+)\)/;function mQ(){var r=document.createElement("i");return r.title="Web Colour Picker",r.style.display="none",document.body.appendChild(r),r}var Mh;function bQ(r){if(r[0]==="#"&&r.length===7)return r;Mh||(Mh=mQ()),Mh.style.color=r;var e=document.defaultView.getComputedStyle(Mh,"").getPropertyValue("color"),t=yQ.exec(e),n=t[1].split(/\s*,\s*/).map(function(i){return Number(i)});return e=SL(n),e}var UL=zL(bQ,function(r){return r},256);function Hg(r,e,t,n){return r[n]+(e[n]-r[n])*t}function xQ(r,e){var t=isNaN(Number(e))||e<0?0:e>1?1:Number(e),n=r.length-1,i=Math.floor(n*t),a=n*t-i,o=r[i],s=i===n?o:r[i+1];return SL([Hg(o,s,a,0),Hg(o,s,a,1),Hg(o,s,a,2)])}function wQ(r){var e=typeof r=="string"?r.split("-"):r,t=e.map(function(n){return _L(n.indexOf("#")===-1?UL(n):n)});return function(n){return xQ(t,n)}}var EQ=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,_Q=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,SQ=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function MQ(r){return/^[r,R,L,l]{1}[\s]*\(/.test(r)}function CQ(r){if(MQ(r)){var e,t=void 0;if(r[0]==="l"){var n=EQ.exec(r),i=+n[1]+90;t=n[2],e="linear-gradient("+i+"deg, "}else if(r[0]==="r"){e="radial-gradient(";var n=_Q.exec(r);t=n[4]}var a=t.match(SQ);return a.forEach(function(o,s){var u=o.split(":");e+=u[1]+" "+Number(u[0])*100+"%",s!==a.length-1&&(e+=", ")}),e+=")",e}return r}function AQ(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return mm(n,t),ga(r,n,e)}function TQ(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return bm(n,t),ga(r,n,e)}function IQ(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return xm(n,t),ga(r,n,e)}function kQ(r,e,t){return ga(r,t,e)}function LQ(r,e){for(var t=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=e.length;n<i;n++){var a=e[n];switch(a[0]){case"t":AQ(t,t,[a[1],a[2]]);break;case"s":IQ(t,t,[a[1],a[2]]);break;case"r":TQ(t,t,a[1]);break;case"m":kQ(t,t,a[1]);break}}return t}function XL(r,e){return r[0]*e[1]-e[0]*r[1]}function NQ(r,e,t){var n=UA(r,e),i=XL(r,e)>=0;return t?i?Math.PI*2-n:n:i?n:Math.PI*2-n}function OQ(r,e,t){return t?(r[0]=e[1],r[1]=-1*e[0]):(r[0]=-1*e[1],r[1]=e[0]),r}function DQ(r,e){if(e==="off")return[].concat(r);var t=typeof e=="number"&&e>=1?Math.pow(10,e):1;return r.map(function(n){var i=n.slice(1).map(Number).map(function(a){return e?Math.round(a*t)/t:Math.round(a)});return[n[0]].concat(i)})}function PQ(r,e){return e===void 0&&(e="off"),DQ(r,e).map(function(t){return t[0]+t.slice(1).join(" ")}).join("")}var YL={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function RQ(r,e,t){if(r[t].length>7){r[t].shift();for(var n=r[t],i=t;n.length;)e[t]="A",r.splice(i+=1,0,["C"].concat(n.splice(0,6)));r.splice(t,1)}}var ul={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function WL(r){return Array.isArray(r)&&r.every(function(e){var t=e[0].toLowerCase();return ul[t]===e.length-1&&"achlmqstvz".includes(t)})}function VL(r){return WL(r)&&r.every(function(e){var t=e[0];return t===t.toUpperCase()})}function HL(r){return VL(r)&&r.every(function(e){var t=e[0];return"ACLMQZ".includes(t)})}function u_(r){for(var e=r.pathValue[r.segmentStart],t=e.toLowerCase(),n=r.data;n.length>=ul[t]&&(t==="m"&&n.length>2?(r.segments.push([e].concat(n.splice(0,2))),t="l",e=e==="m"?"l":"L"):r.segments.push([e].concat(n.splice(0,ul[t]))),!!ul[t]););}function BQ(r){var e=r.index,t=r.pathValue,n=t.charCodeAt(e);if(n===48){r.param=0,r.index+=1;return}if(n===49){r.param=1,r.index+=1;return}r.err='[path-util]: invalid Arc flag "'+t[e]+'", expecting 0 or 1 at index '+e}function FQ(r){return r>=48&&r<=57||r===43||r===45||r===46}function ou(r){return r>=48&&r<=57}function GQ(r){var e=r.max,t=r.pathValue,n=r.index,i=n,a=!1,o=!1,s=!1,u=!1,f;if(i>=e){r.err="[path-util]: Invalid path value at index "+i+', "pathValue" is missing param';return}if(f=t.charCodeAt(i),(f===43||f===45)&&(i+=1,f=t.charCodeAt(i)),!ou(f)&&f!==46){r.err="[path-util]: Invalid path value at index "+i+', "'+t[i]+'" is not a number';return}if(f!==46){if(a=f===48,i+=1,f=t.charCodeAt(i),a&&i<e&&f&&ou(f)){r.err="[path-util]: Invalid path value at index "+n+', "'+t[n]+'" illegal number';return}for(;i<e&&ou(t.charCodeAt(i));)i+=1,o=!0;f=t.charCodeAt(i)}if(f===46){for(u=!0,i+=1;ou(t.charCodeAt(i));)i+=1,s=!0;f=t.charCodeAt(i)}if(f===101||f===69){if(u&&!o&&!s){r.err="[path-util]: Invalid path value at index "+i+', "'+t[i]+'" invalid float exponent';return}if(i+=1,f=t.charCodeAt(i),(f===43||f===45)&&(i+=1),i<e&&ou(t.charCodeAt(i)))for(;i<e&&ou(t.charCodeAt(i));)i+=1;else{r.err="[path-util]: Invalid path value at index "+i+', "'+t[i]+'" invalid integer exponent';return}}r.index=i,r.param=+r.pathValue.slice(n,i)}function zQ(r){var e=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];return r===10||r===13||r===8232||r===8233||r===32||r===9||r===11||r===12||r===160||r>=5760&&e.includes(r)}function sd(r){for(var e=r.pathValue,t=r.max;r.index<t&&zQ(e.charCodeAt(r.index));)r.index+=1}function $Q(r){switch(r|32){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}}function jQ(r){return(r|32)===97}function UQ(r){var e=r.max,t=r.pathValue,n=r.index,i=t.charCodeAt(n),a=ul[t[n].toLowerCase()];if(r.segmentStart=n,!$Q(i)){r.err='[path-util]: Invalid path value "'+t[n]+'" is not a path command';return}if(r.index+=1,sd(r),r.data=[],!a){u_(r);return}for(;;){for(var o=a;o>0;o-=1){if(jQ(i)&&(o===3||o===4)?BQ(r):GQ(r),r.err.length)return;r.data.push(r.param),sd(r),r.index<e&&t.charCodeAt(r.index)===44&&(r.index+=1,sd(r))}if(r.index>=r.max||!FQ(t.charCodeAt(r.index)))break}u_(r)}var XQ=function(){function r(e){this.pathValue=e,this.segments=[],this.max=e.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return r}();function Vv(r){if(WL(r))return[].concat(r);var e=new XQ(r);for(sd(e);e.index<e.max&&!e.err.length;)UQ(e);return e.err?e.err:e.segments}function qL(r){if(VL(r))return[].concat(r);var e=Vv(r),t=0,n=0,i=0,a=0;return e.map(function(o){var s=o.slice(1).map(Number),u=o[0],f=u.toUpperCase();if(u==="M")return t=s[0],n=s[1],i=t,a=n,["M",t,n];var l;if(u!==f)switch(f){case"A":l=[f,s[0],s[1],s[2],s[3],s[4],s[5]+t,s[6]+n];break;case"V":l=[f,s[0]+n];break;case"H":l=[f,s[0]+t];break;default:{var c=s.map(function(d,v){return d+(v%2?n:t)});l=[f].concat(c)}}else l=[f].concat(s);var h=l.length;switch(f){case"Z":t=i,n=a;break;case"H":t=l[1];break;case"V":n=l[1];break;default:t=l[h-2],n=l[h-1],f==="M"&&(i=t,a=n)}return l})}function YQ(r,e){var t=r[0],n=e.x1,i=e.y1,a=e.x2,o=e.y2,s=r.slice(1).map(Number),u=r;if("TQ".includes(t)||(e.qx=null,e.qy=null),t==="H")u=["L",r[1],i];else if(t==="V")u=["L",n,r[1]];else if(t==="S"){var f=n*2-a,l=i*2-o;e.x1=f,e.y1=l,u=["C",f,l].concat(s)}else if(t==="T"){var c=n*2-e.qx,h=i*2-e.qy;e.qx=c,e.qy=h,u=["Q",c,h].concat(s)}else if(t==="Q"){var d=s[0],v=s[1];e.qx=d,e.qy=v}return u}function Hv(r){if(HL(r))return[].concat(r);for(var e=qL(r),t=B({},YL),n=0;n<e.length;n+=1){e[n]=YQ(e[n],t);var i=e[n],a=i.length;t.x1=+i[a-2],t.y1=+i[a-1],t.x2=+i[a-4]||t.x1,t.y2=+i[a-3]||t.y1}return e}function WQ(r){return HL(r)&&r.every(function(e){var t=e[0];return"MC".includes(t)})}function Ch(r,e,t){var n=r*Math.cos(t)-e*Math.sin(t),i=r*Math.sin(t)+e*Math.cos(t);return{x:n,y:i}}function L1(r,e,t,n,i,a,o,s,u,f){var l=r,c=e,h=t,d=n,v=s,p=u,g=Math.PI*120/180,y=Math.PI/180*(+i||0),m=[],b,x,w,E,_;if(f)x=f[0],w=f[1],E=f[2],_=f[3];else{b=Ch(l,c,-y),l=b.x,c=b.y,b=Ch(v,p,-y),v=b.x,p=b.y;var M=(l-v)/2,C=(c-p)/2,S=M*M/(h*h)+C*C/(d*d);S>1&&(S=Math.sqrt(S),h*=S,d*=S);var A=h*h,T=d*d,k=(a===o?-1:1)*Math.sqrt(Math.abs((A*T-A*C*C-T*M*M)/(A*C*C+T*M*M)));E=k*h*C/d+(l+v)/2,_=k*-d*M/h+(c+p)/2,x=Math.asin(((c-_)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),w=Math.asin(((p-_)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),x=l<E?Math.PI-x:x,w=v<E?Math.PI-w:w,x<0&&(x=Math.PI*2+x),w<0&&(w=Math.PI*2+w),o&&x>w&&(x-=Math.PI*2),!o&&w>x&&(w-=Math.PI*2)}var O=w-x;if(Math.abs(O)>g){var F=w,D=v,$=p;w=x+g*(o&&w>x?1:-1),v=E+h*Math.cos(w),p=_+d*Math.sin(w),m=L1(v,p,h,d,i,0,o,D,$,[w,F,E,_])}O=w-x;var Y=Math.cos(x),N=Math.sin(x),P=Math.cos(w),W=Math.sin(w),J=Math.tan(O/4),te=4/3*h*J,H=4/3*d*J,pe=[l,c],Te=[l+te*N,c-H*Y],Ne=[v+te*W,p-H*P],Ze=[v,p];if(Te[0]=2*pe[0]-Te[0],Te[1]=2*pe[1]-Te[1],f)return Te.concat(Ne,Ze,m);m=Te.concat(Ne,Ze,m);for(var at=[],nt=0,_t=m.length;nt<_t;nt+=1)at[nt]=nt%2?Ch(m[nt-1],m[nt],y).y:Ch(m[nt],m[nt+1],y).x;return at}function VQ(r,e,t,n,i,a){var o=.3333333333333333,s=2/3;return[o*r+s*t,o*e+s*n,o*i+s*t,o*a+s*n,i,a]}function go(r,e,t){var n=r[0],i=r[1],a=e[0],o=e[1];return[n+(a-n)*t,i+(o-i)*t]}var f_=function(r,e,t,n){var i=.5,a=go([r,e],[t,n],i);return Jn(Jn([],a,!0),[t,n,t,n],!1)};function HQ(r,e){var t=r[0],n=r.slice(1).map(Number),i=n[0],a=n[1],o,s=e.x1,u=e.y1,f=e.x,l=e.y;switch("TQ".includes(t)||(e.qx=null,e.qy=null),t){case"M":return e.x=i,e.y=a,r;case"A":return o=[s,u].concat(n),["C"].concat(L1(o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9]));case"Q":return e.qx=i,e.qy=a,o=[s,u].concat(n),["C"].concat(VQ(o[0],o[1],o[2],o[3],o[4],o[5]));case"L":return["C"].concat(f_(s,u,i,a));case"Z":return s===f&&u===l?["C",s,u,f,l,f,l]:["C"].concat(f_(s,u,f,l))}return r}function ZL(r,e){if(e===void 0&&(e=!1),WQ(r)){var t=[].concat(r);return e?[t,[]]:t}for(var n=Hv(r),i=B({},YL),a=[],o="",s=n.length,u,f,l=[],c=0;c<s;c+=1){n[c]&&(o=n[c][0]),a[c]=o;var h=HQ(n[c],i);n[c]=h,RQ(n,a,c),s=n.length,o==="Z"&&l.push(c),u=n[c],f=u.length,i.x1=+u[f-2],i.y1=+u[f-1],i.x2=+u[f-4]||i.x1,i.y2=+u[f-3]||i.y1}return e?[n,l]:n}function qQ(r){return Vv(r)}function ZQ(r){return r.map(function(e){return Array.isArray(e)?[].concat(e):e})}function KQ(r){var e=r.slice(1).map(function(t,n,i){return n?i[n-1].slice(-2).concat(t.slice(1)):r[0].slice(1).concat(t.slice(1))}).map(function(t){return t.map(function(n,i){return t[t.length-i-2*(1-i%2)]})}).reverse();return[["M"].concat(e[0].slice(0,2))].concat(e.map(function(t){return["C"].concat(t.slice(2))}))}function ef(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}function Iy(r,e,t,n,i){var a=ef([r,e],[t,n]),o={x:0,y:0};if(typeof i=="number")if(i<=0)o={x:r,y:e};else if(i>=a)o={x:t,y:n};else{var s=go([r,e],[t,n],i/a),u=s[0],f=s[1];o={x:u,y:f}}return{length:a,point:o,min:{x:Math.min(r,t),y:Math.min(e,n)},max:{x:Math.max(r,t),y:Math.max(e,n)}}}function l_(r,e){var t=r.x,n=r.y,i=e.x,a=e.y,o=t*i+n*a,s=Math.sqrt((Math.pow(t,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),u=t*a-n*i<0?-1:1,f=u*Math.acos(o/s);return f}function QQ(r,e,t,n,i,a,o,s,u,f){var l=Math.abs,c=Math.sin,h=Math.cos,d=Math.sqrt,v=Math.PI,p=l(t),g=l(n),y=(i%360+360)%360,m=y*(v/180);if(r===s&&e===u)return{x:r,y:e};if(p===0||g===0)return Iy(r,e,s,u,f).point;var b=(r-s)/2,x=(e-u)/2,w={x:h(m)*b+c(m)*x,y:-c(m)*b+h(m)*x},E=Math.pow(w.x,2)/Math.pow(p,2)+Math.pow(w.y,2)/Math.pow(g,2);E>1&&(p*=d(E),g*=d(E));var _=Math.pow(p,2)*Math.pow(g,2)-Math.pow(p,2)*Math.pow(w.y,2)-Math.pow(g,2)*Math.pow(w.x,2),M=Math.pow(p,2)*Math.pow(w.y,2)+Math.pow(g,2)*Math.pow(w.x,2),C=_/M;C=C<0?0:C;var S=(a!==o?1:-1)*d(C),A={x:S*(p*w.y/g),y:S*(-(g*w.x)/p)},T={x:h(m)*A.x-c(m)*A.y+(r+s)/2,y:c(m)*A.x+h(m)*A.y+(e+u)/2},k={x:(w.x-A.x)/p,y:(w.y-A.y)/g},O=l_({x:1,y:0},k),F={x:(-w.x-A.x)/p,y:(-w.y-A.y)/g},D=l_(k,F);!o&&D>0?D-=2*v:o&&D<0&&(D+=2*v),D%=2*v;var $=O+D*f,Y=p*h($),N=g*c($),P={x:h(m)*Y-c(m)*N+T.x,y:c(m)*Y+h(m)*N+T.y};return P}function JQ(r,e,t,n,i,a,o,s,u,f,l){var c,h=l.bbox,d=h===void 0?!0:h,v=l.length,p=v===void 0?!0:v,g=l.sampleSize,y=g===void 0?30:g,m=typeof f=="number",b=r,x=e,w=0,E=[b,x,w],_=[b,x],M=0,C={x:0,y:0},S=[{x:b,y:x}];m&&f<=0&&(C={x:b,y:x});for(var A=0;A<=y;A+=1){if(M=A/y,c=QQ(r,e,t,n,i,a,o,s,u,M),b=c.x,x=c.y,d&&S.push({x:b,y:x}),p&&(w+=ef(_,[b,x])),_=[b,x],m&&w>=f&&f>E[2]){var T=(w-f)/(w-E[2]);C={x:_[0]*(1-T)+E[0]*T,y:_[1]*(1-T)+E[1]*T}}E=[b,x,w]}return m&&f>=w&&(C={x:s,y:u}),{length:w,point:C,min:{x:Math.min.apply(null,S.map(function(k){return k.x})),y:Math.min.apply(null,S.map(function(k){return k.y}))},max:{x:Math.max.apply(null,S.map(function(k){return k.x})),y:Math.max.apply(null,S.map(function(k){return k.y}))}}}function eJ(r,e,t,n,i,a,o,s,u){var f=1-u;return{x:Math.pow(f,3)*r+3*Math.pow(f,2)*u*t+3*f*Math.pow(u,2)*i+Math.pow(u,3)*o,y:Math.pow(f,3)*e+3*Math.pow(f,2)*u*n+3*f*Math.pow(u,2)*a+Math.pow(u,3)*s}}function KL(r,e,t,n,i,a,o,s,u,f){var l,c=f.bbox,h=c===void 0?!0:c,d=f.length,v=d===void 0?!0:d,p=f.sampleSize,g=p===void 0?10:p,y=typeof u=="number",m=r,b=e,x=0,w=[m,b,x],E=[m,b],_=0,M={x:0,y:0},C=[{x:m,y:b}];y&&u<=0&&(M={x:m,y:b});for(var S=0;S<=g;S+=1){if(_=S/g,l=eJ(r,e,t,n,i,a,o,s,_),m=l.x,b=l.y,h&&C.push({x:m,y:b}),v&&(x+=ef(E,[m,b])),E=[m,b],y&&x>=u&&u>w[2]){var A=(x-u)/(x-w[2]);M={x:E[0]*(1-A)+w[0]*A,y:E[1]*(1-A)+w[1]*A}}w=[m,b,x]}return y&&u>=x&&(M={x:o,y:s}),{length:x,point:M,min:{x:Math.min.apply(null,C.map(function(T){return T.x})),y:Math.min.apply(null,C.map(function(T){return T.y}))},max:{x:Math.max.apply(null,C.map(function(T){return T.x})),y:Math.max.apply(null,C.map(function(T){return T.y}))}}}function tJ(r,e,t,n,i,a,o){var s=1-o;return{x:Math.pow(s,2)*r+2*s*o*t+Math.pow(o,2)*i,y:Math.pow(s,2)*e+2*s*o*n+Math.pow(o,2)*a}}function rJ(r,e,t,n,i,a,o,s){var u,f=s.bbox,l=f===void 0?!0:f,c=s.length,h=c===void 0?!0:c,d=s.sampleSize,v=d===void 0?10:d,p=typeof o=="number",g=r,y=e,m=0,b=[g,y,m],x=[g,y],w=0,E={x:0,y:0},_=[{x:g,y}];p&&o<=0&&(E={x:g,y});for(var M=0;M<=v;M+=1){if(w=M/v,u=tJ(r,e,t,n,i,a,w),g=u.x,y=u.y,l&&_.push({x:g,y}),h&&(m+=ef(x,[g,y])),x=[g,y],p&&m>=o&&o>b[2]){var C=(m-o)/(m-b[2]);E={x:x[0]*(1-C)+b[0]*C,y:x[1]*(1-C)+b[1]*C}}b=[g,y,m]}return p&&o>=m&&(E={x:i,y:a}),{length:m,point:E,min:{x:Math.min.apply(null,_.map(function(S){return S.x})),y:Math.min.apply(null,_.map(function(S){return S.y}))},max:{x:Math.max.apply(null,_.map(function(S){return S.x})),y:Math.max.apply(null,_.map(function(S){return S.y}))}}}function qv(r,e,t){for(var n,i,a,o,s,u,f=Hv(r),l=typeof e=="number",c,h=[],d,v=0,p=0,g=0,y=0,m,b=[],x=[],w=0,E={x:0,y:0},_=E,M=E,C=E,S=0,A=0,T=f.length;A<T;A+=1)m=f[A],d=m[0],c=d==="M",h=c?h:[v,p].concat(m.slice(1)),c?(g=m[1],y=m[2],E={x:g,y},_=E,w=0,l&&e<.001&&(C=E)):d==="L"?(n=Iy(h[0],h[1],h[2],h[3],(e||0)-S),w=n.length,E=n.min,_=n.max,M=n.point):d==="A"?(i=JQ(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],(e||0)-S,t||{}),w=i.length,E=i.min,_=i.max,M=i.point):d==="C"?(a=KL(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],(e||0)-S,t||{}),w=a.length,E=a.min,_=a.max,M=a.point):d==="Q"?(o=rJ(h[0],h[1],h[2],h[3],h[4],h[5],(e||0)-S,t||{}),w=o.length,E=o.min,_=o.max,M=o.point):d==="Z"&&(h=[v,p,g,y],s=Iy(h[0],h[1],h[2],h[3],(e||0)-S),w=s.length,E=s.min,_=s.max,M=s.point),l&&S<e&&S+w>=e&&(C=M),x.push(_),b.push(E),S+=w,u=d!=="Z"?m.slice(-2):[g,y],v=u[0],p=u[1];return l&&e>=S&&(C={x:v,y:p}),{length:S,point:C,min:{x:Math.min.apply(null,b.map(function(k){return k.x})),y:Math.min.apply(null,b.map(function(k){return k.y}))},max:{x:Math.max.apply(null,x.map(function(k){return k.x})),y:Math.max.apply(null,x.map(function(k){return k.y}))}}}function nJ(r,e){if(!r)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var t=qv(r,void 0,B(B({},e),{length:!1})),n=t.min,i=n.x,a=n.y,o=t.max,s=o.x,u=o.y,f=s-i,l=u-a;return{width:f,height:l,x:i,y:a,x2:s,y2:u,cx:i+f/2,cy:a+l/2,cz:Math.max(f,l)+Math.min(f,l)/2}}function fl(r,e){return qv(r,void 0,B(B({},e),{bbox:!1,length:!0})).length}function iJ(r,e){if(!r)return{length:0,x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var t=qv(r,void 0,B(B({},e),{bbox:!0,length:!0})),n=t.length,i=t.min,a=i.x,o=i.y,s=t.max,u=s.x,f=s.y,l=u-a,c=f-o;return{length:n,width:l,height:c,x:a,y:o,x2:u,y2:f,cx:a+l/2,cy:o+c/2,cz:Math.max(l,c)+Math.min(l,c)/2}}function aJ(r){var e=r.length,t=e-1;return r.map(function(n,i){return r.map(function(a,o){var s=i+o,u;return o===0||r[s]&&r[s][0]==="M"?(u=r[s],["M"].concat(u.slice(-2))):(s>=e&&(s-=t),r[s])})})}function oJ(r,e){var t=r.length-1,n=[],i=0,a=0,o=aJ(r);return o.forEach(function(s,u){r.slice(1).forEach(function(f,l){a+=ef(r[(u+l)%t].slice(-2),e[l%t].slice(-2))}),n[u]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),o[i]}function sJ(r,e,t,n,i,a,o,s){return 3*((s-e)*(t+i)-(o-r)*(n+a)+n*(r-i)-t*(e-a)+s*(i+r/3)-o*(a+e/3))/20}function QL(r){var e=0,t=0,n=0;return ZL(r).map(function(i){var a;switch(i[0]){case"M":return e=i[1],t=i[2],0;default:var o=i.slice(1),s=o[0],u=o[1],f=o[2],l=o[3],c=o[4],h=o[5];return n=sJ(e,t,s,u,f,l,c,h),a=i.slice(-2),e=a[0],t=a[1],n}}).reduce(function(i,a){return i+a},0)}function uJ(r){return QL(r)>=0}function ud(r,e,t){return qv(r,e,B(B({},t),{bbox:!1,length:!0})).point}function fJ(r,e){var t=Vv(r);if(typeof t=="string")throw TypeError(t);var n=t.slice(),i=fl(n),a=n.length-1,o=0,s=0,u=t[0],f=u.slice(-2),l=f[0],c=f[1],h={x:l,y:c};if(a<=0||!e||!Number.isFinite(e))return{segment:u,index:0,length:s,point:h,lengthAtSegment:o};if(e>=i)return n=t.slice(0,-1),o=fl(n),s=i-o,{segment:t[a],index:a,length:s,lengthAtSegment:o};for(var d=[];a>0;)u=n[a],n=n.slice(0,-1),o=fl(n),s=i-o,i=o,d.push({segment:u,index:a,length:s,lengthAtSegment:o}),a-=1;return d.find(function(v){var p=v.lengthAtSegment;return p<=e})}function lJ(r,e){for(var t=Vv(r),n=Hv(t),i=fl(t),a=function(w){var E=w.x-e.x,_=w.y-e.y;return E*E+_*_},o=8,s,u=0,f,l=0,c=1/0,h=0;h<=i;h+=o)s=ud(n,h),u=a(s),u<c&&(f=s,l=h,c=u);o/=2;for(var d,v,p=0,g=0,y=0,m=0;o>.5;)p=l-o,d=ud(n,p),y=a(d),g=l+o,v=ud(n,g),m=a(v),p>=0&&y<c?(f=d,l=p,c=y):g<=i&&m<c?(f=v,l=g,c=m):o/=2;var b=fJ(t,l),x=Math.sqrt(c);return{closest:f,distance:x,segment:b}}function cJ(r,e){var t=lJ(r,e).distance;return Math.abs(t)<.001}function hJ(r,e){e===void 0&&(e=.5);var t=r.slice(0,2),n=r.slice(2,4),i=r.slice(4,6),a=r.slice(6,8),o=go(t,n,e),s=go(n,i,e),u=go(i,a,e),f=go(o,s,e),l=go(s,u,e),c=go(f,l,e);return[["C"].concat(o,f,c),["C"].concat(l,u,a)]}function c_(r){return r.map(function(e,t,n){var i=t&&n[t-1].slice(-2).concat(e.slice(1)),a=t?KL(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],{bbox:!1}).length:0,o;return t?o=a?hJ(i):[e,e]:o=[e],{s:e,ss:o,l:a}})}function JL(r,e,t){var n=c_(r),i=c_(e),a=n.length,o=i.length,s=n.filter(function(g){return g.l}).length,u=i.filter(function(g){return g.l}).length,f=n.filter(function(g){return g.l}).reduce(function(g,y){var m=y.l;return g+m},0)/s||0,l=i.filter(function(g){return g.l}).reduce(function(g,y){var m=y.l;return g+m},0)/u||0,c=t||Math.max(a,o),h=[f,l],d=[c-a,c-o],v=0,p=[n,i].map(function(g,y){return g.l===c?g.map(function(m){return m.s}):g.map(function(m,b){return v=b&&d[y]&&m.l>=h[y],d[y]-=v?1:0,v?m.ss:[m.s]}).flat()});return p[0].length===p[1].length?p:JL(p[0],p[1],c)}var dJ=1e-6;function qg(r){return Math.abs(r)<dJ?0:r<0?-1:1}function vJ(r,e,t){return(t[0]-r[0])*(e[1]-r[1])===(e[0]-r[0])*(t[1]-r[1])&&Math.min(r[0],e[0])<=t[0]&&t[0]<=Math.max(r[0],e[0])&&Math.min(r[1],e[1])<=t[1]&&t[1]<=Math.max(r[1],e[1])}function ky(r,e,t){var n=!1,i=r.length;if(i<=2)return!1;for(var a=0;a<i;a++){var o=r[a],s=r[(a+1)%i];if(vJ(o,s,[e,t]))return!0;qg(o[1]-t)>0!=qg(s[1]-t)>0&&qg(e-(t-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}var h_=function(r,e,t){return r>=e&&r<=t};function pJ(r,e,t,n){var i=.001,a={x:t.x-r.x,y:t.y-r.y},o={x:e.x-r.x,y:e.y-r.y},s={x:n.x-t.x,y:n.y-t.y},u=o.x*s.y-o.y*s.x,f=u*u,l=o.x*o.x+o.y*o.y,c=s.x*s.x+s.y*s.y,h=null;if(f>i*l*c){var d=(a.x*s.y-a.y*s.x)/u,v=(a.x*o.y-a.y*o.x)/u;h_(d,0,1)&&h_(v,0,1)&&(h={x:r.x+d*o.x,y:r.y+d*o.y})}return h}function d_(r){for(var e=[],t=r.length,n=0;n<t-1;n++){var i=r[n],a=r[n+1];e.push({from:{x:i[0],y:i[1]},to:{x:a[0],y:a[1]}})}if(e.length>1){var o=r[0],s=r[t-1];e.push({from:{x:s[0],y:s[1]},to:{x:o[0],y:o[1]}})}return e}function gJ(r,e){var t=!1;return r.forEach(function(n){if(pJ(n.from,n.to,e.from,e.to))return t=!0,!1}),t}function v_(r){var e=r.map(function(n){return n[0]}),t=r.map(function(n){return n[1]});return{minX:Math.min.apply(null,e),maxX:Math.max.apply(null,e),minY:Math.min.apply(null,t),maxY:Math.max.apply(null,t)}}function yJ(r,e){return!(e.minX>r.maxX||e.maxX<r.minX||e.minY>r.maxY||e.maxY<r.minY)}function mJ(r,e){if(r.length<2||e.length<2)return!1;var t=v_(r),n=v_(e);if(!yJ(t,n))return!1;var i=!1;if(e.forEach(function(u){if(ky(r,u[0],u[1]))return i=!0,!1}),i||(r.forEach(function(u){if(ky(e,u[0],u[1]))return i=!0,!1}),i))return!0;var a=d_(r),o=d_(e),s=!1;return o.forEach(function(u){if(gJ(a,u))return s=!0,!1}),s}function bJ(r){var e=document.createElement("div");e.innerHTML=r;var t=e.childNodes[0];return t&&e.contains(t)&&e.removeChild(t),t}function xJ(r,e){if(r)return Object.keys(e).forEach(function(t){r.style[t]=e[t]}),r}const wJ=Object.freeze(Object.defineProperty({__proto__:null,Cache:gQ,angleTo:NQ,arcToCubic:L1,assign:Au,augment:GK,clamp:LZ,clearAnimationFrame:BK,clone:zK,clonePath:ZQ,contains:Xd,createDOM:bJ,debounce:$K,deepMix:WK,difference:Uq,direction:XL,distanceSquareRoot:ef,each:$u,endsWith:bZ,equalizeSegments:JL,every:wZ,extend:HK,filter:ML,find:Hq,findIndex:qq,firstValue:Kq,fixedBase:OZ,flatten:Jq,flattenDeep:eZ,forIn:$u,get:iQ,getDrawDirection:uJ,getPathArea:QL,getPathBBox:nJ,getPathBBoxTotalLength:iJ,getPointAtLength:ud,getRange:rZ,getRotatedCurve:oJ,getTotalLength:fl,getType:FL,getWrapBehavior:CZ,gradient:wQ,group:MZ,groupBy:PL,groupToMap:RL,has:s_,hasKey:s_,hasValue:aK,head:gZ,identity:dQ,includes:Xd,indexOf:ZK,isArguments:mK,isArray:Vr,isArrayLike:zn,isBoolean:xK,isDate:EK,isDecimal:PZ,isElement:PK,isEmpty:QK,isEqual:jL,isEqualWith:JK,isError:SK,isEven:BZ,isFinite:MK,isFunction:ri,isInteger:GZ,isMatch:AL,isNegative:$Z,isNil:Do,isNull:AK,isNumber:Wa,isNumberEqual:UZ,isObject:Wv,isObjectLike:Yd,isOdd:YZ,isPlainObject:ju,isPointInPolygon:ky,isPointInStroke:cJ,isPolygonsIntersect:mJ,isPositive:VZ,isPrototype:GL,isRegExp:LK,isString:Lo,isType:ma,isUndefined:OK,keys:CL,last:yZ,lowerCase:sK,lowerFirst:fK,map:tQ,mapValues:nQ,max:IL,maxBy:HZ,memoize:zL,min:kL,minBy:qZ,mix:Au,mod:KZ,modifyCSS:xJ,noop:hQ,normalizePath:Hv,number2color:TZ,omit:uQ,parseRadius:IZ,path2Absolute:qL,path2Array:qQ,path2Curve:ZL,path2String:PQ,pick:sQ,pull:oZ,pullAt:NL,reduce:OL,remove:cZ,requestAnimationFrame:RK,reverseCurve:KQ,rgb2arr:_L,set:aQ,size:vQ,some:_Z,sortBy:hZ,startsWith:mZ,substitute:lK,throttle:fQ,toArray:lQ,toCSSGradient:CQ,toDegree:eK,toInteger:tK,toRGB:UL,toRadian:iK,toString:rc,transform:LQ,union:vZ,uniq:DL,uniqueId:cQ,upperCase:hK,upperFirst:vK,values:BL,valuesOfKey:pZ,vertical:OQ,wrapBehavior:AZ},Symbol.toStringTag,{value:"Module"})),eN=va(wJ);Object.defineProperty(k1,"__esModule",{value:!0});var EJ=eN,_J=function(r){for(var e={},t=r.nodes().filter(function(c){var h;return!(!((h=r.children(c))===null||h===void 0)&&h.length)}),n=t.map(function(c){return r.node(c).rank}),i=(0,EJ.max)(n),a=[],o=0;o<i+1;o++)a.push([]);var s=function(c){var h;if(!e.hasOwnProperty(c)){e[c]=!0;var d=r.node(c);isNaN(d.rank)||a[d.rank].push(c),(h=r.successors(c))===null||h===void 0||h.forEach(function(v){return s(v)})}},u=t.sort(function(c,h){return r.node(c).rank-r.node(h).rank}),f=u.filter(function(c){return r.node(c).fixorder!==void 0}),l=f.sort(function(c,h){return r.node(c).fixorder-r.node(h).fixorder});return l==null||l.forEach(function(c){isNaN(r.node(c).rank)||a[r.node(c).rank].push(c),e[c]=!0}),u==null||u.forEach(s),a};k1.default=_J;var N1={};Object.defineProperty(N1,"__esModule",{value:!0});var SJ=ti,MJ=function(r,e,t){for(var n=(0,SJ.zipObject)(t,t.map(function(l,c){return c})),i=e.map(function(l){var c,h=(c=r.outEdges(l))===null||c===void 0?void 0:c.map(function(d){return{pos:n[d.w]||0,weight:r.edge(d).weight}});return h==null?void 0:h.sort(function(d,v){return d.pos-v.pos})}),a=i.flat().filter(function(l){return l!==void 0}),o=1;o<t.length;)o<<=1;var s=2*o-1;o-=1;var u=Array(s).fill(0,0,s),f=0;return a==null||a.forEach(function(l){if(l){var c=l.pos+o;u[c]+=l.weight;for(var h=0;c>0;)c%2&&(h+=u[c+1]),c=c-1>>1,u[c]+=l.weight;f+=l.weight*h}}),f},CJ=function(r,e){for(var t=0,n=1;n<(e==null?void 0:e.length);n+=1)t+=MJ(r,e[n-1],e[n]);return t};N1.default=CJ;var O1={};Object.defineProperty(O1,"__esModule",{value:!0});var AJ=Ya,TJ=function(r,e,t){var n=IJ(r),i=new AJ.Graph({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return r.nodes().forEach(function(a){var o,s=r.node(a),u=r.parent(a);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(i.setNode(a),i.setParent(a,u||n),(o=r[t](a))===null||o===void 0||o.forEach(function(f){var l=f.v===a?f.w:f.v,c=i.edgeFromArgs(l,a),h=c!==void 0?c.weight:0;i.setEdge(l,a,{weight:r.edge(f).weight+h})}),s.hasOwnProperty("minRank")&&i.setNode(a,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))}),i},IJ=function(r){for(var e;r.hasNode(e="_root".concat(Math.random())););return e};O1.default=TJ;var D1={};Object.defineProperty(D1,"__esModule",{value:!0});var kJ=function(r,e,t){var n={},i;t==null||t.forEach(function(a){for(var o=r.parent(a),s,u;o;){if(s=r.parent(o),s?(u=n[s],n[s]=o):(u=i,i=o),u&&u!==o){e.setEdge(u,o);return}o=s}})};D1.default=kJ;var P1={},R1={};Object.defineProperty(R1,"__esModule",{value:!0});var LJ=function(r,e){return e.map(function(t){var n=r.inEdges(t);if(!(n!=null&&n.length))return{v:t};{var i={sum:0,weight:0};return n==null||n.forEach(function(a){var o=r.edge(a),s=r.node(a.v);i.sum+=o.weight*s.order,i.weight+=o.weight}),{v:t,barycenter:i.sum/i.weight,weight:i.weight}}})};R1.default=LJ;var B1={};Object.defineProperty(B1,"__esModule",{value:!0});var NJ=function(r,e){var t,n,i,a={};r==null||r.forEach(function(s,u){a[s.v]={i:u,indegree:0,in:[],out:[],vs:[s.v]};var f=a[s.v];s.barycenter!==void 0&&(f.barycenter=s.barycenter,f.weight=s.weight)}),(t=e.edges())===null||t===void 0||t.forEach(function(s){var u=a[s.v],f=a[s.w];u!==void 0&&f!==void 0&&(f.indegree++,u.out.push(a[s.w]))});var o=(i=(n=Object.values(a)).filter)===null||i===void 0?void 0:i.call(n,function(s){return!s.indegree});return OJ(o)},OJ=function(r){for(var e,t,n=[],i=function(f){return function(l){l.merged||(l.barycenter===void 0||f.barycenter===void 0||l.barycenter>=f.barycenter)&&DJ(f,l)}},a=function(f){return function(l){l.in.push(f),--l.indegree===0&&r.push(l)}},o=function(){var f=r.pop();n.push(f),(e=f.in.reverse())===null||e===void 0||e.forEach(function(l){return i(f)(l)}),(t=f.out)===null||t===void 0||t.forEach(function(l){return a(f)(l)})};r!=null&&r.length;)o();var s=n.filter(function(f){return!f.merged}),u=["vs","i","barycenter","weight"];return s.map(function(f){var l={};return u==null||u.forEach(function(c){f[c]!==void 0&&(l[c]=f[c])}),l})},DJ=function(r,e){var t,n=0,i=0;r.weight&&(n+=r.barycenter*r.weight,i+=r.weight),e.weight&&(n+=e.barycenter*e.weight,i+=e.weight),r.vs=(t=e.vs)===null||t===void 0?void 0:t.concat(r.vs),r.barycenter=n/i,r.weight=i,r.i=Math.min(e.i,r.i),e.merged=!0};B1.default=NJ;var F1={};Object.defineProperty(F1,"__esModule",{value:!0});var PJ=ti,RJ=function(r,e,t,n){var i=(0,PJ.partition)(r,function(h){var d=h.hasOwnProperty("fixorder")&&!isNaN(h.fixorder);return n?!d&&h.hasOwnProperty("barycenter"):d||h.hasOwnProperty("barycenter")}),a=i.lhs,o=i.rhs.sort(function(h,d){return-h.i- -d.i}),s=[],u=0,f=0,l=0;a==null||a.sort(BJ(!!e,!!t)),l=p_(s,o,l),a==null||a.forEach(function(h){var d;l+=(d=h.vs)===null||d===void 0?void 0:d.length,s.push(h.vs),u+=h.barycenter*h.weight,f+=h.weight,l=p_(s,o,l)});var c={vs:s.flat()};return f&&(c.barycenter=u/f,c.weight=f),c},p_=function(r,e,t){for(var n=t,i;e.length&&(i=e[e.length-1]).i<=n;)e.pop(),r==null||r.push(i.vs),n++;return n},BJ=function(r,e){return function(t,n){if(t.fixorder!==void 0&&n.fixorder!==void 0)return t.fixorder-n.fixorder;if(t.barycenter<n.barycenter)return-1;if(t.barycenter>n.barycenter)return 1;if(e&&t.order!==void 0&&n.order!==void 0){if(t.order<n.order)return-1;if(t.order>n.order)return 1}return r?n.i-t.i:t.i-n.i}};F1.default=RJ;var G1=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(P1,"__esModule",{value:!0});var FJ=G1(R1),GJ=G1(B1),zJ=G1(F1),tN=function(r,e,t,n,i,a){var o,s,u,f,l=r.children(e),c=r.node(e),h=c?c.borderLeft:void 0,d=c?c.borderRight:void 0,v={};h&&(l=l==null?void 0:l.filter(function(x){return x!==h&&x!==d}));var p=(0,FJ.default)(r,l||[]);p==null||p.forEach(function(x){var w;if(!((w=r.children(x.v))===null||w===void 0)&&w.length){var E=tN(r,x.v,t,n,a);v[x.v]=E,E.hasOwnProperty("barycenter")&&jJ(x,E)}});var g=(0,GJ.default)(p,t);$J(g,v),(o=g.filter(function(x){return x.vs.length>0}))===null||o===void 0||o.forEach(function(x){var w=r.node(x.vs[0]);w&&(x.fixorder=w.fixorder,x.order=w.order)});var y=(0,zJ.default)(g,n,i,a);if(h&&(y.vs=[h,y.vs,d].flat(),!((s=r.predecessors(h))===null||s===void 0)&&s.length)){var m=r.node(((u=r.predecessors(h))===null||u===void 0?void 0:u[0])||""),b=r.node(((f=r.predecessors(d))===null||f===void 0?void 0:f[0])||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+b.order)/(y.weight+2),y.weight+=2}return y},$J=function(r,e){r==null||r.forEach(function(t){var n,i=(n=t.vs)===null||n===void 0?void 0:n.map(function(a){return e[a]?e[a].vs:a});t.vs=i.flat()})},jJ=function(r,e){r.barycenter!==void 0?(r.barycenter=(r.barycenter*r.weight+e.barycenter*e.weight)/(r.weight+e.weight),r.weight+=e.weight):(r.barycenter=e.barycenter,r.weight=e.weight)};P1.default=tN;var nc=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(I1,"__esModule",{value:!0});var g_=nc(k1),y_=nc(N1),UJ=nc(O1),XJ=nc(D1),YJ=nc(P1),m_=Or(),WJ=Ya,Zg=ti,VJ=function(r,e){for(var t=(0,Zg.maxRank)(r),n=[],i=[],a=1;a<t+1;a++)n.push(a);for(var a=t-1;a>-1;a--)i.push(a);var o=b_(r,n,"inEdges"),s=b_(r,i,"outEdges"),u=(0,g_.default)(r);Kg(r,u);for(var f=Number.POSITIVE_INFINITY,l,a=0,c=0;c<4;++a,++c){x_(a%2?o:s,a%4>=2,!1,e),u=(0,Zg.buildLayerMatrix)(r);var h=(0,y_.default)(r,u);h<f&&(c=0,l=(0,m_.clone)(u),f=h)}u=(0,g_.default)(r),Kg(r,u);for(var a=0,c=0;c<4;++a,++c){x_(a%2?o:s,a%4>=2,!0,e),u=(0,Zg.buildLayerMatrix)(r);var h=(0,y_.default)(r,u);h<f&&(c=0,l=(0,m_.clone)(u),f=h)}Kg(r,l)},b_=function(r,e,t){return e.map(function(n){return(0,UJ.default)(r,n,t)})},x_=function(r,e,t,n){var i=new WJ.Graph;r==null||r.forEach(function(a){for(var o,s=a.graph().root,u=(0,YJ.default)(a,s,i,e,t,n),f=0;f<((o=u.vs)===null||o===void 0?void 0:o.length);f++){var l=a.node(u.vs[f]);l&&(l.order=f)}(0,XJ.default)(a,i,u.vs)})},Kg=function(r,e){e==null||e.forEach(function(t){t==null||t.forEach(function(n,i){r.node(n).order=i})})};I1.default=VJ;var z1={},rN={};(function(r){var e=xe&&xe.__extends||function(){var x=function(w,E){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,M){_.__proto__=M}||function(_,M){for(var C in M)Object.prototype.hasOwnProperty.call(M,C)&&(_[C]=M[C])},x(w,E)};return function(w,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");x(w,E);function _(){this.constructor=w}w.prototype=E===null?Object.create(E):(_.prototype=E.prototype,new _)}}();Object.defineProperty(r,"__esModule",{value:!0}),r.width=r.sep=r.positionX=r.balance=r.alignCoordinates=r.findSmallestWidthAlignment=r.buildBlockGraph=r.horizontalCompaction=r.verticalAlignment=r.hasConflict=r.addConflict=r.findOtherInnerSegmentNode=r.findType2Conflicts=r.findType1Conflicts=void 0;var t=Yv,n=eN,i=ti,a=function(x){e(w,x);function w(){return x!==null&&x.apply(this,arguments)||this}return w}(t.Graph),o=function(x,w){var E={},_=function(M,C){var S=0,A=0,T=M.length,k=C==null?void 0:C[(C==null?void 0:C.length)-1];return C==null||C.forEach(function(O,F){var D,$=(0,r.findOtherInnerSegmentNode)(x,O),Y=$?x.node($).order:T;($||O===k)&&((D=C.slice(A,F+1))===null||D===void 0||D.forEach(function(N){var P;(P=x.predecessors(N))===null||P===void 0||P.forEach(function(W){var J,te=x.node(W),H=te.order;(H<S||Y<H)&&!(te.dummy&&(!((J=x.node(N))===null||J===void 0)&&J.dummy))&&(0,r.addConflict)(E,W,N)})}),A=F+1,S=Y)}),C};return w!=null&&w.length&&w.reduce(_),E};r.findType1Conflicts=o;var s=function(x,w){var E={};function _(A,T,k,O,F){for(var D,$,Y,N=T;N<k;N++)Y=A[N],!((D=x.node(Y))===null||D===void 0)&&D.dummy&&(($=x.predecessors(Y))===null||$===void 0||$.forEach(function(P){var W=x.node(P);W.dummy&&(W.order<O||W.order>F)&&(0,r.addConflict)(E,P,Y)}))}function M(A){return JSON.stringify(A.slice(1))}function C(A,T){var k=M(A);T.get(k)||(_.apply(void 0,A),T.set(k,!0))}var S=function(A,T){var k=-1,O,F=0,D=new Map;return T==null||T.forEach(function($,Y){var N;if(((N=x.node($))===null||N===void 0?void 0:N.dummy)==="border"){var P=x.predecessors($)||[];P.length&&(O=x.node(P[0]).order,C([T,F,Y,k,O],D),F=Y,k=O)}C([T,F,T.length,O,A.length],D)}),T};return w!=null&&w.length&&w.reduce(S),E};r.findType2Conflicts=s;var u=function(x,w){var E,_;if(!((E=x.node(w))===null||E===void 0)&&E.dummy)return(_=x.predecessors(w))===null||_===void 0?void 0:_.find(function(M){return x.node(M).dummy})};r.findOtherInnerSegmentNode=u;var f=function(x,w,E){var _=w,M=E;if(_>M){var C=_;_=M,M=C}var S=x[_];S||(x[_]=S={}),S[M]=!0};r.addConflict=f;var l=function(x,w,E){var _=w,M=E;if(_>M){var C=w;_=M,M=C}return!!x[_]};r.hasConflict=l;var c=function(x,w,E,_){var M={},C={},S={};return w==null||w.forEach(function(A){A==null||A.forEach(function(T,k){M[T]=T,C[T]=T,S[T]=k})}),w==null||w.forEach(function(A){var T=-1;A==null||A.forEach(function(k){var O=_(k);if(O.length){O=O.sort(function(N,P){return S[N]-S[P]});for(var F=(O.length-1)/2,D=Math.floor(F),$=Math.ceil(F);D<=$;++D){var Y=O[D];C[k]===k&&T<S[Y]&&!(0,r.hasConflict)(E,k,Y)&&(C[Y]=k,C[k]=M[k]=M[Y],T=S[Y])}}})}),{root:M,align:C}};r.verticalAlignment=c;var h=function(x,w,E,_,M){var C,S={},A=(0,r.buildBlockGraph)(x,w,E,M),T=M?"borderLeft":"borderRight",k=function(D,$){for(var Y=A.nodes(),N=Y.pop(),P={};N;)P[N]?D(N):(P[N]=!0,Y.push(N),Y=Y.concat($(N))),N=Y.pop()},O=function(D){S[D]=(A.inEdges(D)||[]).reduce(function($,Y){return Math.max($,(S[Y.v]||0)+A.edge(Y))},0)},F=function(D){var $=(A.outEdges(D)||[]).reduce(function(N,P){return Math.min(N,(S[P.w]||0)-A.edge(P))},Number.POSITIVE_INFINITY),Y=x.node(D);$!==Number.POSITIVE_INFINITY&&Y.borderType!==T&&(S[D]=Math.max(S[D],$))};return k(O,A.predecessors.bind(A)),k(F,A.successors.bind(A)),(C=Object.values(_))===null||C===void 0||C.forEach(function(D){S[D]=S[E[D]]}),S};r.horizontalCompaction=h;var d=function(x,w,E,_){var M=new a,C=x.graph(),S=(0,r.sep)(C.nodesep,C.edgesep,_);return w==null||w.forEach(function(A){var T;A==null||A.forEach(function(k){var O=E[k];if(M.setNode(O),T){var F=E[T],D=M.edgeFromArgs(F,O);M.setEdge(F,O,Math.max(S(x,k,T),D||0))}T=k})}),M};r.buildBlockGraph=d;var v=function(x,w){return(0,i.minBy)(Object.values(w),function(E){var _,M=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY;return(_=Object.keys(E))===null||_===void 0||_.forEach(function(S){var A=E[S],T=(0,r.width)(x,S)/2;M=Math.max(A+T,M),C=Math.min(A-T,C)}),M-C})};r.findSmallestWidthAlignment=v;function p(x,w){var E=Object.values(w),_=(0,n.min)(E),M=(0,n.max)(E);["u","d"].forEach(function(C){["l","r"].forEach(function(S){var A=C+S,T=x[A],k;if(T!==w){var O=Object.values(T);k=S==="l"?_-(0,n.min)(O):M-(0,n.max)(O),k&&(x[A]={},Object.keys(T).forEach(function(F){x[A][F]=T[F]+k}))}})})}r.alignCoordinates=p;var g=function(x,w){var E={};return Object.keys(x.ul).forEach(function(_){if(w)E[_]=x[w.toLowerCase()][_];else{var M=Object.values(x).map(function(C){return C[_]});E[_]=(M[0]+M[1])/2}}),E};r.balance=g;var y=function(x){var w=(0,i.buildLayerMatrix)(x),E=Object.assign((0,r.findType1Conflicts)(x,w),(0,r.findType2Conflicts)(x,w)),_={},M;["u","d"].forEach(function(S){M=S==="u"?w:Object.values(w).reverse(),["l","r"].forEach(function(A){A==="r"&&(M=M.map(function(F){return Object.values(F).reverse()}));var T=(S==="u"?x.predecessors:x.successors).bind(x),k=(0,r.verticalAlignment)(x,M,E,T),O=(0,r.horizontalCompaction)(x,M,k.root,k.align,A==="r");A==="r"&&Object.keys(O).forEach(function(F){O[F]=-O[F]}),_[S+A]=O})});var C=(0,r.findSmallestWidthAlignment)(x,_);return p(_,C),(0,r.balance)(_,x.graph().align)};r.positionX=y;var m=function(x,w,E){return function(_,M,C){var S=_.node(M),A=_.node(C),T=0,k;if(T+=S.width/2,S.hasOwnProperty("labelpos"))switch((S.labelpos||"").toLowerCase()){case"l":k=-S.width/2;break;case"r":k=S.width/2;break}if(k&&(T+=E?k:-k),k=0,T+=(S.dummy?w:x)/2,T+=(A.dummy?w:x)/2,T+=A.width/2,A.labelpos)switch((A.labelpos||"").toLowerCase()){case"l":k=A.width/2;break;case"r":k=-A.width/2;break}return k&&(T+=E?k:-k),k=0,T}};r.sep=m;var b=function(x,w){return x.node(w).width||0};r.width=b})(rN);var w_=xe&&xe.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))};Object.defineProperty(z1,"__esModule",{value:!0});var $1=ti,rs=rN,HJ=function(r){var e=(0,$1.buildLayerMatrix)(r),t=r.graph().ranksep,n=0;e==null||e.forEach(function(i){var a=i.map(function(s){return r.node(s).height}),o=Math.max.apply(Math,w_(w_([],a,!1),[0],!1));i==null||i.forEach(function(s){r.node(s).y=n+o/2}),n+=o+t})},qJ=function(r){var e=(0,$1.buildLayerMatrix)(r),t=Object.assign((0,rs.findType1Conflicts)(r,e),(0,rs.findType2Conflicts)(r,e)),n={},i=[];["u","d"].forEach(function(o){i=o==="u"?e:Object.values(e).reverse(),["l","r"].forEach(function(s){s==="r"&&(i=i.map(function(c){return Object.values(c).reverse()}));var u=(o==="u"?r.predecessors:r.successors).bind(r),f=(0,rs.verticalAlignment)(r,i,t,u),l=(0,rs.horizontalCompaction)(r,i,f.root,f.align,s==="r");s==="r"&&Object.keys(l).forEach(function(c){return l[c]=-l[c]}),n[o+s]=l})});var a=(0,rs.findSmallestWidthAlignment)(r,n);return a&&(0,rs.alignCoordinates)(n,a),(0,rs.balance)(n,r.graph().align)},ZJ=function(r){var e,t=(0,$1.asNonCompoundGraph)(r);HJ(t);var n=qJ(t);(e=Object.keys(n))===null||e===void 0||e.forEach(function(i){t.node(i).x=n[i]})};z1.default=ZJ;var j1={};Object.defineProperty(j1,"__esModule",{value:!0});var KJ=function(r,e){for(var t=r.nodes().filter(function(s){var u;return!(!((u=r.children(s))===null||u===void 0)&&u.length)}),n=t.map(function(s){return r.node(s).rank}),i=Math.max.apply(Math,n),a=[],o=0;o<i+1;o++)a[o]=[];e==null||e.forEach(function(s){var u=r.node(s);!u||u!=null&&u.dummy||isNaN(u.rank)||(u.fixorder=a[u.rank].length,a[u.rank].push(s))})};j1.default=KJ;var Wd=xe&&xe.__assign||function(){return Wd=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Wd.apply(this,arguments)},ba=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(y1,"__esModule",{value:!0});var E_=ba(m1),__=ba(_1),QJ=ba(S1),la=ti,JJ=ba(M1),S_=ba(C1),eee=ba(A1),M_=ba(T1),tee=ba(I1),ree=ba(z1),nee=ba(j1),iee=Ya,aee=function(r,e){var t=e&&e.debugTiming?la.time:la.notime;t("layout",function(){e&&!e.keepNodeOrder&&e.prevGraph&&t(" inheritOrder",function(){see(r,e.prevGraph)});var n=t(" buildLayoutGraph",function(){return pee(r)});e&&e.edgeLabelSpace===!1||t(" makeSpaceForEdgeLabels",function(){gee(n)});try{t(" runLayout",function(){oee(n,t,e)})}catch(i){if(i.message==="Not possible to find intersection inside of the rectangle"){console.error(`The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:
|
|
33
|
-
`,i);return}throw i}t(" updateInputGraph",function(){uee(r,n)})})},oee=function(r,e,t){e(" removeSelfEdges",function(){Mee(r)}),e(" acyclic",function(){E_.default.run(r)}),e(" nestingGraph.run",function(){S_.default.run(r)}),e(" rank",function(){(0,QJ.default)((0,la.asNonCompoundGraph)(r))}),e(" injectEdgeLabelProxies",function(){yee(r)}),e(" removeEmptyRanks",function(){(0,la.removeEmptyRanks)(r)}),e(" nestingGraph.cleanup",function(){S_.default.cleanup(r)}),e(" normalizeRanks",function(){(0,la.normalizeRanks)(r)}),e(" assignRankMinMax",function(){mee(r)}),e(" removeEdgeLabelProxies",function(){bee(r)}),e(" normalize.run",function(){__.default.run(r)}),e(" parentDummyChains",function(){(0,JJ.default)(r)}),e(" addBorderSegments",function(){(0,eee.default)(r)}),t&&t.keepNodeOrder&&e(" initDataOrder",function(){(0,nee.default)(r,t.nodeOrder)}),e(" order",function(){(0,tee.default)(r,t==null?void 0:t.keepNodeOrder)}),e(" insertSelfEdges",function(){Cee(r)}),e(" adjustCoordinateSystem",function(){M_.default.adjust(r)}),e(" position",function(){(0,ree.default)(r)}),e(" positionSelfEdges",function(){Aee(r)}),e(" removeBorderNodes",function(){See(r)}),e(" normalize.undo",function(){__.default.undo(r)}),e(" fixupEdgeLabelCoords",function(){Eee(r)}),e(" undoCoordinateSystem",function(){M_.default.undo(r)}),e(" translateGraph",function(){xee(r)}),e(" assignNodeIntersects",function(){wee(r)}),e(" reversePoints",function(){_ee(r)}),e(" acyclic.undo",function(){E_.default.undo(r)})},see=function(r,e){r.nodes().forEach(function(t){var n=r.node(t),i=e.node(t);i!==void 0?(n.fixorder=i._order,delete i._order):delete n.fixorder})},uee=function(r,e){r.nodes().forEach(function(t){var n,i=r.node(t);if(i){var a=e.node(t);i.x=a.x,i.y=a.y,i._order=a.order,i._rank=a.rank,!((n=e.children(t))===null||n===void 0)&&n.length&&(i.width=a.width,i.height=a.height)}}),r.edges().forEach(function(t){var n=r.edge(t),i=e.edge(t);n.points=i?i.points:[],i&&i.hasOwnProperty("x")&&(n.x=i.x,n.y=i.y)}),r.graph().width=e.graph().width,r.graph().height=e.graph().height},fee=["nodesep","edgesep","ranksep","marginx","marginy"],lee={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Qg=["acyclicer","ranker","rankdir","align"],cee=["width","height","layer","fixorder"],hee={width:0,height:0},dee=["minlen","weight","width","height","labeloffset"],vee={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Jg=["labelpos"],pee=function(r){var e=new iee.Graph({multigraph:!0,compound:!0}),t=t0(r.graph()),n={};return Qg==null||Qg.forEach(function(i){t[i]!==void 0&&(n[i]=t[i])}),e.setGraph(Object.assign({},lee,e0(t,fee),n)),r.nodes().forEach(function(i){var a=t0(r.node(i)),o=Wd(Wd({},hee),a),s=e0(o,cee);e.setNode(i,s),e.setParent(i,r.parent(i))}),r.edges().forEach(function(i){var a=t0(r.edge(i)),o={};Jg==null||Jg.forEach(function(s){a[s]!==void 0&&(o[s]=a[s])}),e.setEdgeObj(i,Object.assign({},vee,e0(a,dee),o))}),e},gee=function(r){var e=r.graph();e.ranksep||(e.ranksep=0),e.ranksep/=2,r.nodes().forEach(function(t){var n=r.node(t);isNaN(n.layer)||n.layer||(n.layer=0)}),r.edges().forEach(function(t){var n,i=r.edge(t);i.minlen*=2,((n=i.labelpos)===null||n===void 0?void 0:n.toLowerCase())!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})},yee=function(r){r.edges().forEach(function(e){var t=r.edge(e);if(t.width&&t.height){var n=r.node(e.v),i=r.node(e.w),a={e,rank:(i.rank-n.rank)/2+n.rank};(0,la.addDummyNode)(r,"edge-proxy",a,"_ep")}})},mee=function(r){var e=0;r.nodes().forEach(function(t){var n,i,a=r.node(t);a.borderTop&&(a.minRank=(n=r.node(a.borderTop))===null||n===void 0?void 0:n.rank,a.maxRank=(i=r.node(a.borderBottom))===null||i===void 0?void 0:i.rank,e=Math.max(e,a.maxRank||-1/0))}),r.graph().maxRank=e},bee=function(r){r.nodes().forEach(function(e){var t=r.node(e);t.dummy==="edge-proxy"&&(r.edge(t.e).labelRank=t.rank,r.removeNode(e))})},xee=function(r){var e,t=0,n,i=0,a=r.graph(),o=a.marginx||0,s=a.marginy||0,u=function(f){if(f){var l=f.x,c=f.y,h=f.width,d=f.height;!isNaN(l)&&!isNaN(h)&&(e===void 0&&(e=l-h/2),e=Math.min(e,l-h/2),t=Math.max(t,l+h/2)),!isNaN(c)&&!isNaN(d)&&(n===void 0&&(n=c-d/2),n=Math.min(n,c-d/2),i=Math.max(i,c+d/2))}};r.nodes().forEach(function(f){u(r.node(f))}),r.edges().forEach(function(f){var l=r.edge(f);l!=null&&l.hasOwnProperty("x")&&u(l)}),e-=o,n-=s,r.nodes().forEach(function(f){var l=r.node(f);l&&(l.x-=e,l.y-=n)}),r.edges().forEach(function(f){var l,c=r.edge(f);(l=c.points)===null||l===void 0||l.forEach(function(h){h.x-=e,h.y-=n}),c.hasOwnProperty("x")&&(c.x-=e),c.hasOwnProperty("y")&&(c.y-=n)}),a.width=t-e+o,a.height=i-n+s},wee=function(r){r.edges().forEach(function(e){var t=r.edge(e),n=r.node(e.v),i=r.node(e.w),a,o;t.points?(a=t.points[0],o=t.points[t.points.length-1]):(t.points=[],a=i,o=n),t.points.unshift((0,la.intersectRect)(n,a)),t.points.push((0,la.intersectRect)(i,o))})},Eee=function(r){r.edges().forEach(function(e){var t=r.edge(e);if(t!=null&&t.hasOwnProperty("x"))switch((t.labelpos==="l"||t.labelpos==="r")&&(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset;break}})},_ee=function(r){r.edges().forEach(function(e){var t,n=r.edge(e);n.reversed&&((t=n.points)===null||t===void 0||t.reverse())})},See=function(r){r.nodes().forEach(function(e){var t,n,i;if(!((t=r.children(e))===null||t===void 0)&&t.length){var a=r.node(e),o=r.node(a.borderTop),s=r.node(a.borderBottom),u=r.node(a.borderLeft[((n=a.borderLeft)===null||n===void 0?void 0:n.length)-1]),f=r.node(a.borderRight[((i=a.borderRight)===null||i===void 0?void 0:i.length)-1]);a.width=Math.abs((f==null?void 0:f.x)-(u==null?void 0:u.x))||10,a.height=Math.abs((s==null?void 0:s.y)-(o==null?void 0:o.y))||10,a.x=((u==null?void 0:u.x)||0)+a.width/2,a.y=((o==null?void 0:o.y)||0)+a.height/2}}),r.nodes().forEach(function(e){var t;((t=r.node(e))===null||t===void 0?void 0:t.dummy)==="border"&&r.removeNode(e)})},Mee=function(r){r.edges().forEach(function(e){if(e.v===e.w){var t=r.node(e.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e,label:r.edge(e)}),r.removeEdgeObj(e)}})},Cee=function(r){var e=(0,la.buildLayerMatrix)(r);e==null||e.forEach(function(t){var n=0;t==null||t.forEach(function(i,a){var o,s=r.node(i);s.order=a+n,(o=s.selfEdges)===null||o===void 0||o.forEach(function(u){(0,la.addDummyNode)(r,"selfedge",{width:u.label.width,height:u.label.height,rank:s.rank,order:a+ ++n,e:u.e,label:u.label},"_se")}),delete s.selfEdges})})},Aee=function(r){r.nodes().forEach(function(e){var t=r.node(e);if(t.dummy==="selfedge"){var n=r.node(t.e.v),i=n.x+n.width/2,a=n.y,o=t.x-i,s=n.height/2;r.setEdgeObj(t.e,t.label),r.removeNode(e),t.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{y:a,x:i+o},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],t.label.x=t.x,t.label.y=t.y}})},e0=function(r,e){var t={};return e==null||e.forEach(function(n){r[n]!==void 0&&(t[n]=+r[n])}),t},t0=function(r){r===void 0&&(r={});var e={};return Object.keys(r).forEach(function(t){e[t.toLowerCase()]=r[t]}),e};y1.default=aee;var Tee=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(g1,"__esModule",{value:!0});var Iee=Tee(y1),C_=ti;g1.default={layout:Iee.default,util:{time:C_.time,notime:C_.notime}};var kee=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Lee=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.DagreLayout=void 0;var Nee=Lee(g1),Xn=Or(),Oee=zr,A_=Ya,Dee=function(r){kee(e,r);function e(t){var n=r.call(this)||this;return n.rankdir="TB",n.nodesep=50,n.ranksep=50,n.controlPoints=!1,n.sortByCombo=!1,n.edgeLabelSpace=!0,n.radial=!1,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.layoutNode=function(i){var a=n,o=a.nodes,s=o.find(function(f){return f.id===i});if(s){var u=s.layout!==!1;return u}return!0},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{rankdir:"TB",align:void 0,nodeSize:void 0,nodesepFunc:void 0,ranksepFunc:void 0,nodesep:50,ranksep:50,controlPoints:!1,radial:!1,focusNode:null}},e.prototype.execute=function(){var t=this,n,i,a,o,s=this,u=s.nodes,f=s.nodeSize,l=s.rankdir,c=s.combos,h=s.begin,d=s.radial,v=s.comboEdges,p=v===void 0?[]:v,g=s.vedges,y=g===void 0?[]:g;if(u){var m=s.edges||[],b=new A_.Graph({multigraph:!0,compound:!0});s.nodeMap={};var x={};u.forEach(function(ae){s.nodeMap[ae.id]=ae,ae.comboId&&(x[ae.comboId]=x[ae.comboId]||[],x[ae.comboId].push(ae.id))});var w=[],E={};!((n=s.nodeOrder)===null||n===void 0)&&n.length?(s.nodeOrder.forEach(function(ae){E[ae]=!0,w.push(s.nodeMap[ae])}),u.forEach(function(ae){E[ae.id]||w.push(ae)})):w=u;var _;f?(0,Xn.isArray)(f)?_=function(){return f}:_=function(){return[f,f]}:_=function(ae){return ae.size?(0,Xn.isArray)(ae.size)?ae.size:(0,Xn.isObject)(ae.size)?[ae.size.width||40,ae.size.height||40]:[ae.size,ae.size]:[40,40]};var M=(0,Xn.getFunc)(s.ranksep,50,s.ranksepFunc),C=(0,Xn.getFunc)(s.nodesep,50,s.nodesepFunc),S=C,A=M;(l==="LR"||l==="RL")&&(S=M,A=C),b.setDefaultEdgeLabel(function(){return{}}),b.setGraph(s);var T={};this.sortByCombo&&c&&c.forEach(function(ae){if(T[ae.id]=ae,ae.collapsed){var L=_(ae),Se=A(ae),Ge=S(ae),ye=L[0]+2*Ge,Ye=L[1]+2*Se;b.setNode(ae.id,{width:ye,height:Ye})}ae.parentId&&(T[ae.parentId]||b.setNode(ae.parentId,{}),b.setParent(ae.id,ae.parentId))}),w.filter(function(ae){return ae.layout!==!1}).forEach(function(ae){var L=_(ae),Se=A(ae),Ge=S(ae),ye=L[0]+2*Ge,Ye=L[1]+2*Se,We=ae.layer;(0,Xn.isNumber)(We)?b.setNode(ae.id,{width:ye,height:Ye,layer:We}):b.setNode(ae.id,{width:ye,height:Ye}),t.sortByCombo&&ae.comboId&&(T[ae.comboId]||(T[ae.comboId]={id:ae.comboId},b.setNode(ae.comboId,{})),b.setParent(ae.id,ae.comboId))}),m.forEach(function(ae){var L=(0,Xn.getEdgeTerminal)(ae,"source"),Se=(0,Xn.getEdgeTerminal)(ae,"target");t.layoutNode(L)&&t.layoutNode(Se)&&b.setEdge(L,Se,{weight:ae.weight||1})}),(i=p==null?void 0:p.concat(y||[]))===null||i===void 0||i.forEach(function(ae){var L,Se,Ge=ae.source,ye=ae.target,Ye=!((L=T[Ge])===null||L===void 0)&&L.collapsed?[Ge]:x[Ge]||[Ge],We=!((Se=T[ye])===null||Se===void 0)&&Se.collapsed?[ye]:x[ye]||[ye];Ye.forEach(function(qe){We.forEach(function(et){b.setEdge(qe,et,{weight:ae.weight||1})})})});var k=void 0;!((a=s.preset)===null||a===void 0)&&a.nodes&&(k=new A_.Graph({multigraph:!0,compound:!0}),s.preset.nodes.forEach(function(ae){k==null||k.setNode(ae.id,ae)})),Nee.default.layout(b,{prevGraph:k,edgeLabelSpace:s.edgeLabelSpace,keepNodeOrder:!!s.nodeOrder,nodeOrder:s.nodeOrder});var O=[0,0];if(h){var F=1/0,D=1/0;b.nodes().forEach(function(ae){var L=b.node(ae);F>L.x&&(F=L.x),D>L.y&&(D=L.y)}),b.edges().forEach(function(ae){var L,Se=b.edge(ae);(L=Se.points)===null||L===void 0||L.forEach(function(Ge){F>Ge.x&&(F=Ge.x),D>Ge.y&&(D=Ge.y)})}),O[0]=h[0]-F,O[1]=h[1]-D}var $=l==="LR"||l==="RL";if(d){var Y=this,N=Y.focusNode,P=Y.ranksep,W=Y.getRadialPos,J=(0,Xn.isString)(N)?N:N==null?void 0:N.id,te=J?(o=b.node(J))===null||o===void 0?void 0:o._rank:0,H=[],pe=$?"y":"x",Te=$?"height":"width",Ne=1/0,Ze=-1/0;b.nodes().forEach(function(ae){var L=b.node(ae);if(s.nodeMap[ae]){var Se=C(s.nodeMap[ae]);if(te===0)H[L._rank]||(H[L._rank]={nodes:[],totalWidth:0,maxSize:-1/0}),H[L._rank].nodes.push(ae),H[L._rank].totalWidth+=Se*2+L[Te],H[L._rank].maxSize<Math.max(L.width,L.height)&&(H[L._rank].maxSize=Math.max(L.width,L.height));else{var Ge=L._rank-te;if(Ge===0)H[Ge]||(H[Ge]={nodes:[],totalWidth:0,maxSize:-1/0}),H[Ge].nodes.push(ae),H[Ge].totalWidth+=Se*2+L[Te],H[Ge].maxSize<Math.max(L.width,L.height)&&(H[Ge].maxSize=Math.max(L.width,L.height));else{var ye=Math.abs(Ge);H[ye]||(H[ye]={left:[],right:[],totalWidth:0,maxSize:-1/0}),H[ye].totalWidth+=Se*2+L[Te],H[ye].maxSize<Math.max(L.width,L.height)&&(H[ye].maxSize=Math.max(L.width,L.height)),Ge<0?H[ye].left.push(ae):H[ye].right.push(ae)}}var Ye=L[pe]-L[Te]/2-Se,We=L[pe]+L[Te]/2+Se;Ye<Ne&&(Ne=Ye),We>Ze&&(Ze=We)}});var at=P||50,nt={},_t=(Ze-Ne)/.9,St=[(Ne+Ze-_t)*.5,(Ne+Ze+_t)*.5],fr=function(ae,L,Se,Ge){Se===void 0&&(Se=-1/0),Ge===void 0&&(Ge=[0,1]);var ye=Se;return ae.forEach(function(Ye){var We=b.node(Ye);nt[Ye]=L;var qe=W(We[pe],St,_t,L,Ge),et=qe.x,gt=qe.y;if(s.nodeMap[Ye]){s.nodeMap[Ye].x=et+O[0],s.nodeMap[Ye].y=gt+O[1],s.nodeMap[Ye]._order=We._order;var Pt=M(s.nodeMap[Ye]);ye<Pt&&(ye=Pt)}}),ye},Ft=!0,Yt=0;H.forEach(function(ae){var L,Se,Ge,ye,Ye,We,qe;if(!(!(!((L=ae==null?void 0:ae.nodes)===null||L===void 0)&&L.length)&&!(!((Se=ae==null?void 0:ae.left)===null||Se===void 0)&&Se.length)&&!(!((Ge=ae==null?void 0:ae.right)===null||Ge===void 0)&&Ge.length))){if(Ft&&ae.nodes.length===1){var et=ae.nodes[0];if(!s.nodeMap[et])return;s.nodeMap[et].x=O[0],s.nodeMap[et].y=O[1],nt[ae.nodes[0]]=0,at=M(s.nodeMap[et]),Ft=!1;return}at=Math.max(at,ae.totalWidth/(2*Math.PI));var gt=-1/0;if(te===0||!((ye=ae.nodes)===null||ye===void 0)&&ye.length)gt=fr(ae.nodes,at,gt,[0,1]);else{var Pt=((Ye=ae.left)===null||Ye===void 0?void 0:Ye.length)/(((We=ae.left)===null||We===void 0?void 0:We.length)+((qe=ae.right)===null||qe===void 0?void 0:qe.length));gt=fr(ae.left,at,gt,[0,Pt]),gt=fr(ae.right,at,gt,[Pt+.05,1])}at+=gt,Ft=!1,Yt-ae.maxSize}}),b.edges().forEach(function(ae){var L,Se,Ge,ye=b.edge(ae),Ye=m.findIndex(function(hr){var ur=(0,Xn.getEdgeTerminal)(hr,"source"),br=(0,Xn.getEdgeTerminal)(hr,"target");return ur===ae.v&&br===ae.w});if(!(Ye<=-1)&&s.edgeLabelSpace&&s.controlPoints&&m[Ye].type!=="loop"){var We=pe==="x"?"y":"x",qe=(L=ye==null?void 0:ye.points)===null||L===void 0?void 0:L.slice(1,ye.points.length-1),et=[],gt=(Se=b.node(ae.v))===null||Se===void 0?void 0:Se[We],Pt=gt-((Ge=b.node(ae.w))===null||Ge===void 0?void 0:Ge[We]),cr=nt[ae.v],Rt=cr-nt[ae.w];qe==null||qe.forEach(function(hr){var ur=(hr[We]-gt)/Pt*Rt+cr,br=W(hr[pe],St,_t,ur);et.push({x:br.x+O[0],y:br.y+O[1]})}),m[Ye].controlPoints=et}})}else{var dr=new Set,lr=l==="BT"||l==="RL",jt=lr?function(ae,L){return L-ae}:function(ae,L){return ae-L};b.nodes().forEach(function(ae){var L=b.node(ae);if(L){var Se=t.nodeMap[ae];Se||(Se=c==null?void 0:c.find(function(Ge){return Ge.id===ae})),Se&&(Se.x=L.x+O[0],Se.y=L.y+O[1],Se._order=L._order,dr.add($?Se.x:Se.y))}});var ir=Array.from(dr).sort(jt),Hr=$?function(ae,L){return ae.x!==L.x}:function(ae,L){return ae.y!==L.y},tt=$?function(ae,L,Se){var Ge=Math.max(L.y,Se.y),ye=Math.min(L.y,Se.y);return ae.filter(function(Ye){return Ye.y<=Ge&&Ye.y>=ye})}:function(ae,L,Se){var Ge=Math.max(L.x,Se.x),ye=Math.min(L.x,Se.x);return ae.filter(function(Ye){return Ye.x<=Ge&&Ye.x>=ye})};b.edges().forEach(function(ae){var L,Se=b.edge(ae),Ge=m.findIndex(function(We){var qe=(0,Xn.getEdgeTerminal)(We,"source"),et=(0,Xn.getEdgeTerminal)(We,"target");return qe===ae.v&&et===ae.w});if(!(Ge<=-1)&&s.edgeLabelSpace&&s.controlPoints&&m[Ge].type!=="loop"){(L=Se==null?void 0:Se.points)===null||L===void 0||L.forEach(function(We){We.x+=O[0],We.y+=O[1]});var ye=s.nodeMap[ae.v],Ye=s.nodeMap[ae.w];m[Ge].controlPoints=Pee(Se==null?void 0:Se.points,ye,Ye,ir,$,Hr,tt)}})}return s.onLayoutEnd&&s.onLayoutEnd(),{nodes:u,edges:m}}},e.prototype.getRadialPos=function(t,n,i,a,o){o===void 0&&(o=[0,1]);var s=(t-n[0])/i;s=s*(o[1]-o[0])+o[0];var u=s*2*Math.PI;return{x:Math.cos(u)*a,y:Math.sin(u)*a}},e.prototype.getType=function(){return"dagre"},e}(Oee.Base);Ju.DagreLayout=Dee;var Pee=function(r,e,t,n,i,a,o){var s=(r==null?void 0:r.slice(1,r.length-1))||[];if(e&&t){var u=e.x,f=e.y,l=t.x,c=t.y;if(i&&(u=e.y,f=e.x,l=t.y,c=t.x),c!==f&&u!==l){var h=n.indexOf(f),d=n[h+1];if(d){var v=s[0],p=i?{x:(f+d)/2,y:(v==null?void 0:v.y)||l}:{x:(v==null?void 0:v.x)||l,y:(f+d)/2};(!v||a(v,p))&&s.unshift(p)}var g=n.indexOf(c),y=Math.abs(g-h);if(y===1)s=o(s,e,t),s.length||s.push(i?{x:(f+c)/2,y:u}:{x:u,y:(f+c)/2});else if(y>1){var m=n[g-1];if(m){var b=s[s.length-1],x=i?{x:(c+m)/2,y:(b==null?void 0:b.y)||l}:{x:(b==null?void 0:b.x)||u,y:(c+m)/2};(!b||a(b,x))&&s.push(x)}}}}return s},ic={};const Vd={graph:{meta:{rankDir:"TB",nodeSep:50,rankSep:50,edgeSep:5,align:void 0}},subScene:{meta:{paddingTop:20,paddingBottom:20,paddingLeft:20,paddingRight:20,labelHeight:20}},nodeSize:{meta:{width:100,maxLabelWidth:0,height:20},node:{width:80,height:20,labelOffset:10,maxLabelWidth:40},bridge:{width:5,height:5,radius:2,labelOffset:0}}};function Ly(r={},e=Vd){var t,n,i,a;const o=JSON.parse(JSON.stringify(e)),s=((t=r==null?void 0:r.graph)===null||t===void 0?void 0:t.meta)||{},u=((n=r==null?void 0:r.subScene)===null||n===void 0?void 0:n.meta)||{},f=((i=r==null?void 0:r.nodeSize)===null||i===void 0?void 0:i.meta)||{},l=((a=r==null?void 0:r.nodeSize)===null||a===void 0?void 0:a.node)||{},c=o.nodeSize.bridge;return{graph:{meta:Object.assign(o.graph.meta,s)},subScene:{meta:Object.assign(o.subScene.meta,u)},nodeSize:{meta:Object.assign(o.nodeSize.meta,f),node:Object.assign(o.nodeSize.node,l),bridge:c}}}function nN(r){return`◬${r}◬`}const Uu=nN("ROOT"),iN=nN("BRIDGE_GRAPH");var Bn,Is,Xu,Ny;(function(r){r[r.META=0]="META",r[r.NODE=1]="NODE",r[r.BRIDGE=2]="BRIDGE"})(Bn||(Bn={})),function(r){r[r.INCLUDE=0]="INCLUDE",r[r.EXCLUDE=1]="EXCLUDE",r[r.UNSPECIFIED=2]="UNSPECIFIED"}(Is||(Is={})),function(r){r[r.META=0]="META",r[r.CORE=1]="CORE",r[r.BRIDGE=2]="BRIDGE"}(Xu||(Xu={})),function(r){r[r.META=0]="META",r[r.OP=1]="OP",r[r.SERIES=2]="SERIES"}(Ny||(Ny={}));var Ah=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function U1(r,e){return r(e={exports:{}},e.exports),e.exports}var Ree=function(){this.__data__=[],this.size=0},tf=function(r,e){return r===e||r!=r&&e!=e},Zv=function(r,e){for(var t=r.length;t--;)if(tf(r[t][0],e))return t;return-1},Bee=Array.prototype.splice,Fee=function(r){var e=this.__data__,t=Zv(e,r);return!(t<0)&&(t==e.length-1?e.pop():Bee.call(e,t,1),--this.size,!0)},Gee=function(r){var e=this.__data__,t=Zv(e,r);return t<0?void 0:e[t][1]},zee=function(r){return Zv(this.__data__,r)>-1},$ee=function(r,e){var t=this.__data__,n=Zv(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this};function vu(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}vu.prototype.clear=Ree,vu.prototype.delete=Fee,vu.prototype.get=Gee,vu.prototype.has=zee,vu.prototype.set=$ee;var Kv=vu,jee=function(){this.__data__=new Kv,this.size=0},Uee=function(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t},Xee=function(r){return this.__data__.get(r)},Yee=function(r){return this.__data__.has(r)},aN=typeof Ah=="object"&&Ah&&Ah.Object===Object&&Ah,Wee=typeof self=="object"&&self&&self.Object===Object&&self,Bi=aN||Wee||Function("return this")(),gi=Bi.Symbol,oN=Object.prototype,Vee=oN.hasOwnProperty,Hee=oN.toString,Lf=gi?gi.toStringTag:void 0,qee=function(r){var e=Vee.call(r,Lf),t=r[Lf];try{r[Lf]=void 0;var n=!0}catch{}var i=Hee.call(r);return n&&(e?r[Lf]=t:delete r[Lf]),i},Zee=Object.prototype.toString,Kee=function(r){return Zee.call(r)},T_=gi?gi.toStringTag:void 0,Po=function(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":T_&&T_ in Object(r)?qee(r):Kee(r)},$n=function(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")},I_,ac=function(r){if(!$n(r))return!1;var e=Po(r);return e=="[object Function]"||e=="[object GeneratorFunction]"||e=="[object AsyncFunction]"||e=="[object Proxy]"},r0=Bi["__core-js_shared__"],k_=(I_=/[^.]+$/.exec(r0&&r0.keys&&r0.keys.IE_PROTO||""))?"Symbol(src)_1."+I_:"",Qee=function(r){return!!k_&&k_ in r},Jee=Function.prototype.toString,Ps=function(r){if(r!=null){try{return Jee.call(r)}catch{}try{return r+""}catch{}}return""},ete=/^\[object .+?Constructor\]$/,tte=Function.prototype,rte=Object.prototype,nte=tte.toString,ite=rte.hasOwnProperty,ate=RegExp("^"+nte.call(ite).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ote=function(r){return!(!$n(r)||Qee(r))&&(ac(r)?ate:ete).test(Ps(r))},ste=function(r,e){return r==null?void 0:r[e]},Rs=function(r,e){var t=ste(r,e);return ote(t)?t:void 0},Dl=Rs(Bi,"Map"),Pl=Rs(Object,"create"),ute=function(){this.__data__=Pl?Pl(null):{},this.size=0},fte=function(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e},lte=Object.prototype.hasOwnProperty,cte=function(r){var e=this.__data__;if(Pl){var t=e[r];return t==="__lodash_hash_undefined__"?void 0:t}return lte.call(e,r)?e[r]:void 0},hte=Object.prototype.hasOwnProperty,dte=function(r){var e=this.__data__;return Pl?e[r]!==void 0:hte.call(e,r)},vte=function(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Pl&&e===void 0?"__lodash_hash_undefined__":e,this};function pu(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}pu.prototype.clear=ute,pu.prototype.delete=fte,pu.prototype.get=cte,pu.prototype.has=dte,pu.prototype.set=vte;var L_=pu,pte=function(){this.size=0,this.__data__={hash:new L_,map:new(Dl||Kv),string:new L_}},gte=function(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null},Qv=function(r,e){var t=r.__data__;return gte(e)?t[typeof e=="string"?"string":"hash"]:t.map},yte=function(r){var e=Qv(this,r).delete(r);return this.size-=e?1:0,e},mte=function(r){return Qv(this,r).get(r)},bte=function(r){return Qv(this,r).has(r)},xte=function(r,e){var t=Qv(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this};function gu(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}gu.prototype.clear=pte,gu.prototype.delete=yte,gu.prototype.get=mte,gu.prototype.has=bte,gu.prototype.set=xte;var Jv=gu,wte=function(r,e){var t=this.__data__;if(t instanceof Kv){var n=t.__data__;if(!Dl||n.length<199)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new Jv(n)}return t.set(r,e),this.size=t.size,this};function yu(r){var e=this.__data__=new Kv(r);this.size=e.size}yu.prototype.clear=jee,yu.prototype.delete=Uee,yu.prototype.get=Xee,yu.prototype.has=Yee,yu.prototype.set=wte;var Tu=yu,X1=function(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r},Hd=function(){try{var r=Rs(Object,"defineProperty");return r({},"",{}),r}catch{}}(),ep=function(r,e,t){e=="__proto__"&&Hd?Hd(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t},Ete=Object.prototype.hasOwnProperty,tp=function(r,e,t){var n=r[e];Ete.call(r,e)&&tf(n,t)&&(t!==void 0||e in r)||ep(r,e,t)},oc=function(r,e,t,n){var i=!t;t||(t={});for(var a=-1,o=e.length;++a<o;){var s=e[a],u=void 0;u===void 0&&(u=r[s]),i?ep(t,s,u):tp(t,s,u)}return t},_te=function(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n},Di=function(r){return r!=null&&typeof r=="object"},N_=function(r){return Di(r)&&Po(r)=="[object Arguments]"},sN=Object.prototype,Ste=sN.hasOwnProperty,Mte=sN.propertyIsEnumerable,Yu=N_(function(){return arguments}())?N_:function(r){return Di(r)&&Ste.call(r,"callee")&&!Mte.call(r,"callee")},Gr=Array.isArray,Cte=function(){return!1},ks=U1(function(r,e){var t=e&&!e.nodeType&&e,n=t&&r&&!r.nodeType&&r,i=n&&n.exports===t?Bi.Buffer:void 0,a=(i?i.isBuffer:void 0)||Cte;r.exports=a}),Ate=/^(?:0|[1-9]\d*)$/,rp=function(r,e){var t=typeof r;return!!(e=e==null?9007199254740991:e)&&(t=="number"||t!="symbol"&&Ate.test(r))&&r>-1&&r%1==0&&r<e},Y1=function(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=9007199254740991},_r={};_r["[object Float32Array]"]=_r["[object Float64Array]"]=_r["[object Int8Array]"]=_r["[object Int16Array]"]=_r["[object Int32Array]"]=_r["[object Uint8Array]"]=_r["[object Uint8ClampedArray]"]=_r["[object Uint16Array]"]=_r["[object Uint32Array]"]=!0,_r["[object Arguments]"]=_r["[object Array]"]=_r["[object ArrayBuffer]"]=_r["[object Boolean]"]=_r["[object DataView]"]=_r["[object Date]"]=_r["[object Error]"]=_r["[object Function]"]=_r["[object Map]"]=_r["[object Number]"]=_r["[object Object]"]=_r["[object RegExp]"]=_r["[object Set]"]=_r["[object String]"]=_r["[object WeakMap]"]=!1;var Tte=function(r){return Di(r)&&Y1(r.length)&&!!_r[Po(r)]},np=function(r){return function(e){return r(e)}},Wu=U1(function(r,e){var t=e&&!e.nodeType&&e,n=t&&r&&!r.nodeType&&r,i=n&&n.exports===t&&aN.process,a=function(){try{var o=n&&n.require&&n.require("util").types;return o||i&&i.binding&&i.binding("util")}catch{}}();r.exports=a}),O_=Wu&&Wu.isTypedArray,sc=O_?np(O_):Tte,Ite=Object.prototype.hasOwnProperty,uN=function(r,e){var t=Gr(r),n=!t&&Yu(r),i=!t&&!n&&ks(r),a=!t&&!n&&!i&&sc(r),o=t||n||i||a,s=o?_te(r.length,String):[],u=s.length;for(var f in r)!e&&!Ite.call(r,f)||o&&(f=="length"||i&&(f=="offset"||f=="parent")||a&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||rp(f,u))||s.push(f);return s},kte=Object.prototype,ip=function(r){var e=r&&r.constructor;return r===(typeof e=="function"&&e.prototype||kte)},fN=function(r,e){return function(t){return r(e(t))}},Lte=fN(Object.keys,Object),Nte=Object.prototype.hasOwnProperty,W1=function(r){if(!ip(r))return Lte(r);var e=[];for(var t in Object(r))Nte.call(r,t)&&t!="constructor"&&e.push(t);return e},Va=function(r){return r!=null&&Y1(r.length)&&!ac(r)},Ro=function(r){return Va(r)?uN(r):W1(r)},Ote=function(r,e){return r&&oc(e,Ro(e),r)},Dte=function(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e},Pte=Object.prototype.hasOwnProperty,Rte=function(r){if(!$n(r))return Dte(r);var e=ip(r),t=[];for(var n in r)(n!="constructor"||!e&&Pte.call(r,n))&&t.push(n);return t},Bs=function(r){return Va(r)?uN(r,!0):Rte(r)},Bte=function(r,e){return r&&oc(e,Bs(e),r)},lN=U1(function(r,e){var t=e&&!e.nodeType&&e,n=t&&r&&!r.nodeType&&r,i=n&&n.exports===t?Bi.Buffer:void 0,a=i?i.allocUnsafe:void 0;r.exports=function(o,s){if(s)return o.slice();var u=o.length,f=a?a(u):new o.constructor(u);return o.copy(f),f}}),cN=function(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e},hN=function(r,e){for(var t=-1,n=r==null?0:r.length,i=0,a=[];++t<n;){var o=r[t];e(o,t,r)&&(a[i++]=o)}return a},dN=function(){return[]},Fte=Object.prototype.propertyIsEnumerable,D_=Object.getOwnPropertySymbols,V1=D_?function(r){return r==null?[]:(r=Object(r),hN(D_(r),function(e){return Fte.call(r,e)}))}:dN,Gte=function(r,e){return oc(r,V1(r),e)},H1=function(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r},ap=fN(Object.getPrototypeOf,Object),vN=Object.getOwnPropertySymbols?function(r){for(var e=[];r;)H1(e,V1(r)),r=ap(r);return e}:dN,zte=function(r,e){return oc(r,vN(r),e)},pN=function(r,e,t){var n=e(r);return Gr(r)?n:H1(n,t(r))},Oy=function(r){return pN(r,Ro,V1)},$te=function(r){return pN(r,Bs,vN)},Dy=Rs(Bi,"DataView"),Py=Rs(Bi,"Promise"),Iu=Rs(Bi,"Set"),Ry=Rs(Bi,"WeakMap"),jte=Ps(Dy),Ute=Ps(Dl),Xte=Ps(Py),Yte=Ps(Iu),Wte=Ps(Ry),us=Po;(Dy&&us(new Dy(new ArrayBuffer(1)))!="[object DataView]"||Dl&&us(new Dl)!="[object Map]"||Py&&us(Py.resolve())!="[object Promise]"||Iu&&us(new Iu)!="[object Set]"||Ry&&us(new Ry)!="[object WeakMap]")&&(us=function(r){var e=Po(r),t=e=="[object Object]"?r.constructor:void 0,n=t?Ps(t):"";if(n)switch(n){case jte:return"[object DataView]";case Ute:return"[object Map]";case Xte:return"[object Promise]";case Yte:return"[object Set]";case Wte:return"[object WeakMap]"}return e});var Ls=us,Vte=Object.prototype.hasOwnProperty,Hte=function(r){var e=r.length,t=new r.constructor(e);return e&&typeof r[0]=="string"&&Vte.call(r,"index")&&(t.index=r.index,t.input=r.input),t},qd=Bi.Uint8Array,q1=function(r){var e=new r.constructor(r.byteLength);return new qd(e).set(new qd(r)),e},qte=function(r,e){var t=e?q1(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)},Zte=/\w*$/,Kte=function(r){var e=new r.constructor(r.source,Zte.exec(r));return e.lastIndex=r.lastIndex,e},P_=gi?gi.prototype:void 0,R_=P_?P_.valueOf:void 0,Qte=function(r){return R_?Object(R_.call(r)):{}},gN=function(r,e){var t=e?q1(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)},Jte=function(r,e,t){var n=r.constructor;switch(e){case"[object ArrayBuffer]":return q1(r);case"[object Boolean]":case"[object Date]":return new n(+r);case"[object DataView]":return qte(r,t);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return gN(r,t);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(r);case"[object RegExp]":return Kte(r);case"[object Set]":return new n;case"[object Symbol]":return Qte(r)}},B_=Object.create,yN=function(){function r(){}return function(e){if(!$n(e))return{};if(B_)return B_(e);r.prototype=e;var t=new r;return r.prototype=void 0,t}}(),mN=function(r){return typeof r.constructor!="function"||ip(r)?{}:yN(ap(r))},ere=function(r){return Di(r)&&Ls(r)=="[object Map]"},F_=Wu&&Wu.isMap,tre=F_?np(F_):ere,rre=function(r){return Di(r)&&Ls(r)=="[object Set]"},G_=Wu&&Wu.isSet,nre=G_?np(G_):rre,wr={};wr["[object Arguments]"]=wr["[object Array]"]=wr["[object ArrayBuffer]"]=wr["[object DataView]"]=wr["[object Boolean]"]=wr["[object Date]"]=wr["[object Float32Array]"]=wr["[object Float64Array]"]=wr["[object Int8Array]"]=wr["[object Int16Array]"]=wr["[object Int32Array]"]=wr["[object Map]"]=wr["[object Number]"]=wr["[object Object]"]=wr["[object RegExp]"]=wr["[object Set]"]=wr["[object String]"]=wr["[object Symbol]"]=wr["[object Uint8Array]"]=wr["[object Uint8ClampedArray]"]=wr["[object Uint16Array]"]=wr["[object Uint32Array]"]=!0,wr["[object Error]"]=wr["[object Function]"]=wr["[object WeakMap]"]=!1;var bN=function r(e,t,n,i,a,o){var s,u=1&t,f=2&t,l=4&t;if(s!==void 0)return s;if(!$n(e))return e;var c=Gr(e);if(c){if(s=Hte(e),!u)return cN(e,s)}else{var h=Ls(e),d=h=="[object Function]"||h=="[object GeneratorFunction]";if(ks(e))return lN(e,u);if(h=="[object Object]"||h=="[object Arguments]"||d&&!a){if(s=f||d?{}:mN(e),!u)return f?zte(e,Bte(s,e)):Gte(e,Ote(s,e))}else{if(!wr[h])return a?e:{};s=Jte(e,h,u)}}o||(o=new Tu);var v=o.get(e);if(v)return v;o.set(e,s),nre(e)?e.forEach(function(g){s.add(r(g,t,n,g,e,o))}):tre(e)&&e.forEach(function(g,y){s.set(y,r(g,t,n,y,e,o))});var p=c?void 0:(l?f?$te:Oy:f?Bs:Ro)(e);return X1(p||e,function(g,y){p&&(g=e[y=g]),tp(s,y,r(g,t,n,y,e,o))}),s},ire=function(r){return bN(r,4)},Z1=function(r){return function(){return r}},K1=function(r){return function(e,t,n){for(var i=-1,a=Object(e),o=n(e),s=o.length;s--;){var u=o[++i];if(t(a[u],u,a)===!1)break}return e}}(),Q1=function(r,e){return r&&K1(r,e,Ro)},op=function(r,e){return function(t,n){if(t==null)return t;if(!Va(t))return r(t,n);for(var i=t.length,a=-1,o=Object(t);++a<i&&n(o[a],a,o)!==!1;);return t}}(Q1),Fs=function(r){return r},xN=function(r){return typeof r=="function"?r:Fs},wN=function(r,e){return(Gr(r)?X1:op)(r,xN(e))},EN=wN,are=function(r,e){var t=[];return op(r,function(n,i,a){e(n,i,a)&&t.push(n)}),t},ore=function(r){return this.__data__.set(r,"__lodash_hash_undefined__"),this},sre=function(r){return this.__data__.has(r)};function fd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Jv;++e<t;)this.add(r[e])}fd.prototype.add=fd.prototype.push=ore,fd.prototype.has=sre;var _N=fd,ure=function(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(e(r[t],t,r))return!0;return!1},SN=function(r,e){return r.has(e)},MN=function(r,e,t,n,i,a){var o=1&t,s=r.length,u=e.length;if(s!=u&&!(o&&u>s))return!1;var f=a.get(r),l=a.get(e);if(f&&l)return f==e&&l==r;var c=-1,h=!0,d=2&t?new _N:void 0;for(a.set(r,e),a.set(e,r);++c<s;){var v=r[c],p=e[c];if(n)var g=o?n(p,v,c,e,r,a):n(v,p,c,r,e,a);if(g!==void 0){if(g)continue;h=!1;break}if(d){if(!ure(e,function(y,m){if(!SN(d,m)&&(v===y||i(v,y,t,n,a)))return d.push(m)})){h=!1;break}}else if(v!==p&&!i(v,p,t,n,a)){h=!1;break}}return a.delete(r),a.delete(e),h},fre=function(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t},J1=function(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t},z_=gi?gi.prototype:void 0,n0=z_?z_.valueOf:void 0,lre=function(r,e,t,n,i,a,o){switch(t){case"[object DataView]":if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(r.byteLength!=e.byteLength||!a(new qd(r),new qd(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return tf(+r,+e);case"[object Error]":return r.name==e.name&&r.message==e.message;case"[object RegExp]":case"[object String]":return r==e+"";case"[object Map]":var s=fre;case"[object Set]":var u=1&n;if(s||(s=J1),r.size!=e.size&&!u)return!1;var f=o.get(r);if(f)return f==e;n|=2,o.set(r,e);var l=MN(s(r),s(e),n,i,a,o);return o.delete(r),l;case"[object Symbol]":if(n0)return n0.call(r)==n0.call(e)}return!1},cre=Object.prototype.hasOwnProperty,hre=function(r,e,t,n,i,a){var o=1&t,s=Oy(r),u=s.length;if(u!=Oy(e).length&&!o)return!1;for(var f=u;f--;){var l=s[f];if(!(o?l in e:cre.call(e,l)))return!1}var c=a.get(r),h=a.get(e);if(c&&h)return c==e&&h==r;var d=!0;a.set(r,e),a.set(e,r);for(var v=o;++f<u;){var p=r[l=s[f]],g=e[l];if(n)var y=o?n(g,p,l,e,r,a):n(p,g,l,r,e,a);if(!(y===void 0?p===g||i(p,g,t,n,a):y)){d=!1;break}v||(v=l=="constructor")}if(d&&!v){var m=r.constructor,b=e.constructor;m==b||!("constructor"in r)||!("constructor"in e)||typeof m=="function"&&m instanceof m&&typeof b=="function"&&b instanceof b||(d=!1)}return a.delete(r),a.delete(e),d},$_=Object.prototype.hasOwnProperty,dre=function(r,e,t,n,i,a){var o=Gr(r),s=Gr(e),u=o?"[object Array]":Ls(r),f=s?"[object Array]":Ls(e),l=(u=u=="[object Arguments]"?"[object Object]":u)=="[object Object]",c=(f=f=="[object Arguments]"?"[object Object]":f)=="[object Object]",h=u==f;if(h&&ks(r)){if(!ks(e))return!1;o=!0,l=!1}if(h&&!l)return a||(a=new Tu),o||sc(r)?MN(r,e,t,n,i,a):lre(r,e,u,t,n,i,a);if(!(1&t)){var d=l&&$_.call(r,"__wrapped__"),v=c&&$_.call(e,"__wrapped__");if(d||v){var p=d?r.value():r,g=v?e.value():e;return a||(a=new Tu),i(p,g,t,n,a)}}return!!h&&(a||(a=new Tu),hre(r,e,t,n,i,a))},CN=function r(e,t,n,i,a){return e===t||(e==null||t==null||!Di(e)&&!Di(t)?e!=e&&t!=t:dre(e,t,n,i,r,a))},vre=function(r,e,t,n){var i=t.length,a=i;if(r==null)return!a;for(r=Object(r);i--;){var o=t[i];if(o[2]?o[1]!==r[o[0]]:!(o[0]in r))return!1}for(;++i<a;){var s=(o=t[i])[0],u=r[s],f=o[1];if(o[2]){if(u===void 0&&!(s in r))return!1}else{var l=new Tu,c;if(!(c===void 0?CN(f,u,3,n,l):c))return!1}}return!0},AN=function(r){return r==r&&!$n(r)},pre=function(r){for(var e=Ro(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,AN(i)]}return e},TN=function(r,e){return function(t){return t!=null&&t[r]===e&&(e!==void 0||r in Object(t))}},gre=function(r){var e=pre(r);return e.length==1&&e[0][2]?TN(e[0][0],e[0][1]):function(t){return t===r||vre(t,r,e)}},Ns=function(r){return typeof r=="symbol"||Di(r)&&Po(r)=="[object Symbol]"},yre=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mre=/^\w*$/,eb=function(r,e){if(Gr(r))return!1;var t=typeof r;return!(t!="number"&&t!="symbol"&&t!="boolean"&&r!=null&&!Ns(r))||mre.test(r)||!yre.test(r)||e!=null&&r in Object(e)};function tb(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");var t=function(){var n=arguments,i=e?e.apply(this,n):n[0],a=t.cache;if(a.has(i))return a.get(i);var o=r.apply(this,n);return t.cache=a.set(i,o)||a,o};return t.cache=new(tb.Cache||Jv),t}tb.Cache=Jv;var bre=tb,xre=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wre=/\\(\\)?/g,Ere=function(r){var e=bre(r,function(n){return t.size===500&&t.clear(),n}),t=e.cache;return e}(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(xre,function(t,n,i,a){e.push(i?a.replace(wre,"$1"):n||t)}),e}),ku=function(r,e){for(var t=-1,n=r==null?0:r.length,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i},j_=gi?gi.prototype:void 0,U_=j_?j_.toString:void 0,_re=function r(e){if(typeof e=="string")return e;if(Gr(e))return ku(e,r)+"";if(Ns(e))return U_?U_.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t},IN=function(r){return r==null?"":_re(r)},sp=function(r,e){return Gr(r)?r:eb(r,e)?[r]:Ere(IN(r))},uc=function(r){if(typeof r=="string"||Ns(r))return r;var e=r+"";return e=="0"&&1/r==-1/0?"-0":e},up=function(r,e){for(var t=0,n=(e=sp(e,r)).length;r!=null&&t<n;)r=r[uc(e[t++])];return t&&t==n?r:void 0},Sre=function(r,e,t){var n=r==null?void 0:up(r,e);return n===void 0?t:n},Mre=function(r,e){return r!=null&&e in Object(r)},kN=function(r,e,t){for(var n=-1,i=(e=sp(e,r)).length,a=!1;++n<i;){var o=uc(e[n]);if(!(a=r!=null&&t(r,o)))break;r=r[o]}return a||++n!=i?a:!!(i=r==null?0:r.length)&&Y1(i)&&rp(o,i)&&(Gr(r)||Yu(r))},LN=function(r,e){return r!=null&&kN(r,e,Mre)},Cre=function(r,e){return eb(r)&&AN(e)?TN(uc(r),e):function(t){var n=Sre(t,r);return n===void 0&&n===e?LN(t,r):CN(e,n,3)}},NN=function(r){return function(e){return e==null?void 0:e[r]}},Are=function(r){return function(e){return up(e,r)}},Tre=function(r){return eb(r)?NN(uc(r)):Are(r)},Ha=function(r){return typeof r=="function"?r:r==null?Fs:typeof r=="object"?Gr(r)?Cre(r[0],r[1]):gre(r):Tre(r)},ON=function(r,e){return(Gr(r)?hN:are)(r,Ha(e))},Ire=Object.prototype.hasOwnProperty,kre=function(r,e){return r!=null&&Ire.call(r,e)},DN=function(r,e){return r!=null&&kN(r,e,kre)},Lre=Object.prototype.hasOwnProperty,Nre=function(r){if(r==null)return!0;if(Va(r)&&(Gr(r)||typeof r=="string"||typeof r.splice=="function"||ks(r)||sc(r)||Yu(r)))return!r.length;var e=Ls(r);if(e=="[object Map]"||e=="[object Set]")return!r.size;if(ip(r))return!W1(r).length;for(var t in r)if(Lre.call(r,t))return!1;return!0},PN=function(r){return r===void 0},RN=function(r,e){var t=-1,n=Va(r)?Array(r.length):[];return op(r,function(i,a,o){n[++t]=e(i,a,o)}),n},BN=function(r,e){return(Gr(r)?ku:RN)(r,Ha(e))},Ore=function(r,e,t,n){var i=-1,a=r==null?0:r.length;for(n&&a&&(t=r[++i]);++i<a;)t=e(t,r[i],i,r);return t},Dre=function(r,e,t,n,i){return i(r,function(a,o,s){t=n?(n=!1,a):e(t,a,o,s)}),t},FN=function(r,e,t){var n=Gr(r)?Ore:Dre,i=arguments.length<3;return n(r,Ha(e),t,i,op)},Pre=function(r){return typeof r=="string"||!Gr(r)&&Di(r)&&Po(r)=="[object String]"},Rre=NN("length"),Bre=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),Fre=function(r){return Bre.test(r)},Gre="[\\ud800-\\udfff]",By="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Fy="\\ud83c[\\udffb-\\udfff]",GN="[^\\ud800-\\udfff]",zN="(?:\\ud83c[\\udde6-\\uddff]){2}",$N="[\\ud800-\\udbff][\\udc00-\\udfff]",X_="(?:"+By+"|"+Fy+")?",zre="[\\ufe0e\\ufe0f]?"+X_+("(?:\\u200d(?:"+[GN,zN,$N].join("|")+")[\\ufe0e\\ufe0f]?"+X_+")*"),$re="(?:"+[GN+By+"?",By,zN,$N,Gre].join("|")+")",Y_=RegExp(Fy+"(?="+Fy+")|"+$re+zre,"g"),jre=function(r){for(var e=Y_.lastIndex=0;Y_.test(r);)++e;return e},Ure=function(r){return Fre(r)?jre(r):Rre(r)},Xre=function(r){if(r==null)return 0;if(Va(r))return Pre(r)?Ure(r):r.length;var e=Ls(r);return e=="[object Map]"||e=="[object Set]"?r.size:W1(r).length},Yre=function(r,e,t){var n=Gr(r),i=n||ks(r)||sc(r);if(e=Ha(e),t==null){var a=r&&r.constructor;t=i?n?new a:[]:$n(r)&&ac(a)?yN(ap(r)):{}}return(i?X1:Q1)(r,function(o,s,u){return e(t,o,s,u)}),t},W_=gi?gi.isConcatSpreadable:void 0,Wre=function(r){return Gr(r)||Yu(r)||!!(W_&&r&&r[W_])},rb=function(e,t,n,i,a){var o=-1,s=e.length;for(n||(n=Wre),a||(a=[]);++o<s;){var u=e[o];n(u)?H1(a,u):i||(a[a.length]=u)}return a},Vre=function(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)},V_=Math.max,jN=function(r,e,t){return e=V_(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=V_(n.length-e,0),o=Array(a);++i<a;)o[i]=n[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=n[i];return s[e]=t(o),Vre(r,this,s)}},Hre=Hd?function(r,e){return Hd(r,"toString",{configurable:!0,enumerable:!1,value:Z1(e),writable:!0})}:Fs,qre=Date.now,UN=function(r){var e=0,t=0;return function(){var n=qre(),i=16-(n-t);if(t=n,i>0){if(++e>=800)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}(Hre),fp=function(r,e){return UN(jN(r,e,Fs),r+"")},XN=function(r,e,t,n){for(var i=r.length,a=t+-1;++a<i;)if(e(r[a],a,r))return a;return-1},Zre=function(r){return r!=r},Kre=function(r,e,t){for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1},Qre=function(r,e,t){return e==e?Kre(r,e,t):XN(r,Zre,t)},Jre=function(r,e){return!!(r!=null&&r.length)&&Qre(r,e,0)>-1},ene=function(){},tne=Iu&&1/J1(new Iu([,-0]))[1]==1/0?function(r){return new Iu(r)}:ene,rne=function(r,e,t){var n=-1,i=Jre,a=r.length,o=!0,s=[],u=s;if(a>=200){var f=tne(r);if(f)return J1(f);o=!1,i=SN,u=new _N}else u=s;e:for(;++n<a;){var l=r[n],c=l;if(l=l!==0?l:0,o&&c==c){for(var h=u.length;h--;)if(u[h]===c)continue e;s.push(l)}else i(u,c,t)||(u!==s&&u.push(c),s.push(l))}return s},YN=function(r){return Di(r)&&Va(r)},nne=fp(function(r){return rne(rb(r,1,YN,!0))}),ine=function(r,e){return ku(e,function(t){return r[t]})},Zd,WN=function(r){return r==null?[]:ine(r,Ro(r))};try{Zd={clone:ire,constant:Z1,each:EN,filter:ON,has:DN,isArray:Gr,isEmpty:Nre,isFunction:ac,isUndefined:PN,keys:Ro,map:BN,reduce:FN,size:Xre,transform:Yre,union:nne,values:WN}}catch{}Zd||(Zd=window._);var ut=Zd,nb=nr;function nr(r){this._isDirected=!ut.has(r,"directed")||r.directed,this._isMultigraph=!!ut.has(r,"multigraph")&&r.multigraph,this._isCompound=!!ut.has(r,"compound")&&r.compound,this._label=void 0,this._defaultNodeLabelFn=ut.constant(void 0),this._defaultEdgeLabelFn=ut.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function H_(r,e){r[e]?r[e]++:r[e]=1}function q_(r,e){--r[e]||delete r[e]}function Jf(r,e,t,n){var i=""+e,a=""+t;if(!r&&i>a){var o=i;i=a,a=o}return i+""+a+""+(ut.isUndefined(n)?"\0":n)}function ane(r,e,t,n){var i=""+e,a=""+t;if(!r&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return n&&(s.name=n),s}function i0(r,e){return Jf(r,e.v,e.w,e.name)}nr.prototype._nodeCount=0,nr.prototype._edgeCount=0,nr.prototype.isDirected=function(){return this._isDirected},nr.prototype.isMultigraph=function(){return this._isMultigraph},nr.prototype.isCompound=function(){return this._isCompound},nr.prototype.setGraph=function(r){return this._label=r,this},nr.prototype.graph=function(){return this._label},nr.prototype.setDefaultNodeLabel=function(r){return ut.isFunction(r)||(r=ut.constant(r)),this._defaultNodeLabelFn=r,this},nr.prototype.nodeCount=function(){return this._nodeCount},nr.prototype.nodes=function(){return ut.keys(this._nodes)},nr.prototype.sources=function(){var r=this;return ut.filter(this.nodes(),function(e){return ut.isEmpty(r._in[e])})},nr.prototype.sinks=function(){var r=this;return ut.filter(this.nodes(),function(e){return ut.isEmpty(r._out[e])})},nr.prototype.setNodes=function(r,e){var t=arguments,n=this;return ut.each(r,function(i){t.length>1?n.setNode(i,e):n.setNode(i)}),this},nr.prototype.setNode=function(r,e){return ut.has(this._nodes,r)?(arguments.length>1&&(this._nodes[r]=e),this):(this._nodes[r]=arguments.length>1?e:this._defaultNodeLabelFn(r),this._isCompound&&(this._parent[r]="\0",this._children[r]={},this._children["\0"][r]=!0),this._in[r]={},this._preds[r]={},this._out[r]={},this._sucs[r]={},++this._nodeCount,this)},nr.prototype.node=function(r){return this._nodes[r]},nr.prototype.hasNode=function(r){return ut.has(this._nodes,r)},nr.prototype.removeNode=function(r){var e=this;if(ut.has(this._nodes,r)){var t=function(n){e.removeEdge(e._edgeObjs[n])};delete this._nodes[r],this._isCompound&&(this._removeFromParentsChildList(r),delete this._parent[r],ut.each(this.children(r),function(n){e.setParent(n)}),delete this._children[r]),ut.each(ut.keys(this._in[r]),t),delete this._in[r],delete this._preds[r],ut.each(ut.keys(this._out[r]),t),delete this._out[r],delete this._sucs[r],--this._nodeCount}return this},nr.prototype.setParent=function(r,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ut.isUndefined(e))e="\0";else{for(var t=e+="";!ut.isUndefined(t);t=this.parent(t))if(t===r)throw new Error("Setting "+e+" as parent of "+r+" would create a cycle");this.setNode(e)}return this.setNode(r),this._removeFromParentsChildList(r),this._parent[r]=e,this._children[e][r]=!0,this},nr.prototype._removeFromParentsChildList=function(r){delete this._children[this._parent[r]][r]},nr.prototype.parent=function(r){if(this._isCompound){var e=this._parent[r];if(e!=="\0")return e}},nr.prototype.children=function(r){if(ut.isUndefined(r)&&(r="\0"),this._isCompound){var e=this._children[r];if(e)return ut.keys(e)}else{if(r==="\0")return this.nodes();if(this.hasNode(r))return[]}},nr.prototype.predecessors=function(r){var e=this._preds[r];if(e)return ut.keys(e)},nr.prototype.successors=function(r){var e=this._sucs[r];if(e)return ut.keys(e)},nr.prototype.neighbors=function(r){var e=this.predecessors(r);if(e)return ut.union(e,this.successors(r))},nr.prototype.isLeaf=function(r){return(this.isDirected()?this.successors(r):this.neighbors(r)).length===0},nr.prototype.filterNodes=function(r){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var t=this;ut.each(this._nodes,function(a,o){r(o)&&e.setNode(o,a)}),ut.each(this._edgeObjs,function(a){e.hasNode(a.v)&&e.hasNode(a.w)&&e.setEdge(a,t.edge(a))});var n={};function i(a){var o=t.parent(a);return o===void 0||e.hasNode(o)?(n[a]=o,o):o in n?n[o]:i(o)}return this._isCompound&&ut.each(e.nodes(),function(a){e.setParent(a,i(a))}),e},nr.prototype.setDefaultEdgeLabel=function(r){return ut.isFunction(r)||(r=ut.constant(r)),this._defaultEdgeLabelFn=r,this},nr.prototype.edgeCount=function(){return this._edgeCount},nr.prototype.edges=function(){return ut.values(this._edgeObjs)},nr.prototype.setPath=function(r,e){var t=this,n=arguments;return ut.reduce(r,function(i,a){return n.length>1?t.setEdge(i,a,e):t.setEdge(i,a),a}),this},nr.prototype.setEdge=function(){var r,e,t,n,i=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(r=a.v,e=a.w,t=a.name,arguments.length===2&&(n=arguments[1],i=!0)):(r=a,e=arguments[1],t=arguments[3],arguments.length>2&&(n=arguments[2],i=!0)),r=""+r,e=""+e,ut.isUndefined(t)||(t=""+t);var o=Jf(this._isDirected,r,e,t);if(ut.has(this._edgeLabels,o))return i&&(this._edgeLabels[o]=n),this;if(!ut.isUndefined(t)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(r),this.setNode(e),this._edgeLabels[o]=i?n:this._defaultEdgeLabelFn(r,e,t);var s=ane(this._isDirected,r,e,t);return r=s.v,e=s.w,Object.freeze(s),this._edgeObjs[o]=s,H_(this._preds[e],r),H_(this._sucs[r],e),this._in[e][o]=s,this._out[r][o]=s,this._edgeCount++,this},nr.prototype.edge=function(r,e,t){var n=arguments.length===1?i0(this._isDirected,arguments[0]):Jf(this._isDirected,r,e,t);return this._edgeLabels[n]},nr.prototype.hasEdge=function(r,e,t){var n=arguments.length===1?i0(this._isDirected,arguments[0]):Jf(this._isDirected,r,e,t);return ut.has(this._edgeLabels,n)},nr.prototype.removeEdge=function(r,e,t){var n=arguments.length===1?i0(this._isDirected,arguments[0]):Jf(this._isDirected,r,e,t),i=this._edgeObjs[n];return i&&(r=i.v,e=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],q_(this._preds[e],r),q_(this._sucs[r],e),delete this._in[e][n],delete this._out[r][n],this._edgeCount--),this},nr.prototype.inEdges=function(r,e){var t=this._in[r];if(t){var n=ut.values(t);return e?ut.filter(n,function(i){return i.v===e}):n}},nr.prototype.outEdges=function(r,e){var t=this._out[r];if(t){var n=ut.values(t);return e?ut.filter(n,function(i){return i.w===e}):n}},nr.prototype.nodeEdges=function(r,e){var t=this.inEdges(r,e);if(t)return t.concat(this.outEdges(r,e))};var Z_={Graph:nb,version:"2.1.8"},one={write:function(r){var e={options:{directed:r.isDirected(),multigraph:r.isMultigraph(),compound:r.isCompound()},nodes:sne(r),edges:une(r)};return ut.isUndefined(r.graph())||(e.value=ut.clone(r.graph())),e},read:function(r){var e=new nb(r.options).setGraph(r.value);return ut.each(r.nodes,function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),ut.each(r.edges,function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}};function sne(r){return ut.map(r.nodes(),function(e){var t=r.node(e),n=r.parent(e),i={v:e};return ut.isUndefined(t)||(i.value=t),ut.isUndefined(n)||(i.parent=n),i})}function une(r){return ut.map(r.edges(),function(e){var t=r.edge(e),n={v:e.v,w:e.w};return ut.isUndefined(e.name)||(n.name=e.name),ut.isUndefined(t)||(n.value=t),n})}var fne=function(r){var e,t={},n=[];function i(a){ut.has(t,a)||(t[a]=!0,e.push(a),ut.each(r.successors(a),i),ut.each(r.predecessors(a),i))}return ut.each(r.nodes(),function(a){e=[],i(a),e.length&&n.push(e)}),n},VN=ui;function ui(){this._arr=[],this._keyIndices={}}ui.prototype.size=function(){return this._arr.length},ui.prototype.keys=function(){return this._arr.map(function(r){return r.key})},ui.prototype.has=function(r){return ut.has(this._keyIndices,r)},ui.prototype.priority=function(r){var e=this._keyIndices[r];if(e!==void 0)return this._arr[e].priority},ui.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},ui.prototype.add=function(r,e){var t=this._keyIndices;if(r=String(r),!ut.has(t,r)){var n=this._arr,i=n.length;return t[r]=i,n.push({key:r,priority:e}),this._decrease(i),!0}return!1},ui.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},ui.prototype.decrease=function(r,e){var t=this._keyIndices[r];if(e>this._arr[t].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[t].priority+" New: "+e);this._arr[t].priority=e,this._decrease(t)},ui.prototype._heapify=function(r){var e=this._arr,t=2*r,n=t+1,i=r;t<e.length&&(i=e[t].priority<e[i].priority?t:i,n<e.length&&(i=e[n].priority<e[i].priority?n:i),i!==r&&(this._swap(r,i),this._heapify(i)))},ui.prototype._decrease=function(r){for(var e,t=this._arr,n=t[r].priority;r!==0&&!(t[e=r>>1].priority<n);)this._swap(r,e),r=e},ui.prototype._swap=function(r,e){var t=this._arr,n=this._keyIndices,i=t[r],a=t[e];t[r]=a,t[e]=i,n[a.key]=r,n[i.key]=e};var HN=function(r,e,t,n){return function(i,a,o,s){var u,f,l={},c=new VN,h=function(d){var v=d.v!==u?d.v:d.w,p=l[v],g=o(d),y=f.distance+g;if(g<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+d+" Weight: "+g);y<p.distance&&(p.distance=y,p.predecessor=u,c.decrease(v,y))};for(i.nodes().forEach(function(d){var v=d===a?0:Number.POSITIVE_INFINITY;l[d]={distance:v},c.add(d,v)});c.size()>0&&(u=c.removeMin(),(f=l[u]).distance!==Number.POSITIVE_INFINITY);)s(u).forEach(h);return l}(r,String(e),t||lne,n||function(i){return r.outEdges(i)})},lne=ut.constant(1),cne=function(r,e,t){return ut.transform(r.nodes(),function(n,i){n[i]=HN(r,i,e,t)},{})},qN=function(r){var e=0,t=[],n={},i=[];function a(o){var s=n[o]={onStack:!0,lowlink:e,index:e++};if(t.push(o),r.successors(o).forEach(function(l){ut.has(n,l)?n[l].onStack&&(s.lowlink=Math.min(s.lowlink,n[l].index)):(a(l),s.lowlink=Math.min(s.lowlink,n[l].lowlink))}),s.lowlink===s.index){var u,f=[];do u=t.pop(),n[u].onStack=!1,f.push(u);while(o!==u);i.push(f)}}return r.nodes().forEach(function(o){ut.has(n,o)||a(o)}),i},hne=function(r){return ut.filter(qN(r),function(e){return e.length>1||e.length===1&&r.hasEdge(e[0],e[0])})},dne=function(r,e,t){return function(n,i,a){var o={},s=n.nodes();return s.forEach(function(u){o[u]={},o[u][u]={distance:0},s.forEach(function(f){u!==f&&(o[u][f]={distance:Number.POSITIVE_INFINITY})}),a(u).forEach(function(f){var l=f.v===u?f.w:f.v,c=i(f);o[u][l]={distance:c,predecessor:u}})}),s.forEach(function(u){var f=o[u];s.forEach(function(l){var c=o[l];s.forEach(function(h){var d=c[u],v=f[h],p=c[h],g=d.distance+v.distance;g<p.distance&&(p.distance=g,p.predecessor=v.predecessor)})})}),o}(r,e||vne,t||function(n){return r.outEdges(n)})},vne=ut.constant(1),a0=ZN;function ZN(r){var e={},t={},n=[];if(ut.each(r.sinks(),function i(a){if(ut.has(t,a))throw new Kd;ut.has(e,a)||(t[a]=!0,e[a]=!0,ut.each(r.predecessors(a),i),delete t[a],n.push(a))}),ut.size(e)!==r.nodeCount())throw new Kd;return n}function Kd(){}ZN.CycleException=Kd,Kd.prototype=new Error;var K_=function(r,e,t){ut.isArray(e)||(e=[e]);var n=(r.isDirected()?r.successors:r.neighbors).bind(r),i=[],a={};return ut.each(e,function(o){if(!r.hasNode(o))throw new Error("Graph does not have node: "+o);KN(r,o,t==="post",a,n,i)}),i};function KN(r,e,t,n,i,a){ut.has(n,e)||(n[e]=!0,t||a.push(e),ut.each(i(e),function(o){KN(r,o,t,n,i,a)}),t&&a.push(e))}var Qd,pne={Graph:Z_.Graph,json:one,alg:{components:fne,dijkstra:HN,dijkstraAll:cne,findCycles:hne,floydWarshall:dne,isAcyclic:function(r){try{a0(r)}catch(e){if(e instanceof a0.CycleException)return!1;throw e}return!0},postorder:function(r,e){return K_(r,e,"post")},preorder:function(r,e){return K_(r,e,"pre")},prim:function(r,e){var t,n=new nb,i={},a=new VN;function o(u){var f=u.v===t?u.w:u.v,l=a.priority(f);if(l!==void 0){var c=e(u);c<l&&(i[f]=t,a.decrease(f,c))}}if(r.nodeCount()===0)return n;ut.each(r.nodes(),function(u){a.add(u,Number.POSITIVE_INFINITY),n.setNode(u)}),a.decrease(r.nodes()[0],0);for(var s=!1;a.size()>0;){if(t=a.removeMin(),ut.has(i,t))n.setEdge(t,i[t]);else{if(s)throw new Error("Input graph is not connected: "+r);s=!0}r.nodeEdges(t).forEach(o)}return n},tarjan:qN,topsort:a0},version:Z_.version};try{Qd=pne}catch{}Qd||(Qd=window.graphlib);var Fi=Qd,gne=function(r){return bN(r,5)},Rl=function(r,e,t){if(!$n(t))return!1;var n=typeof e;return!!(n=="number"?Va(t)&&rp(e,t.length):n=="string"&&e in t)&&tf(t[e],r)},QN=Object.prototype,yne=QN.hasOwnProperty,mne=fp(function(r,e){r=Object(r);var t=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&Rl(e[0],e[1],i)&&(n=1);++t<n;)for(var a=e[t],o=Bs(a),s=-1,u=o.length;++s<u;){var f=o[s],l=r[f];(l===void 0||tf(l,QN[f])&&!yne.call(r,f))&&(r[f]=a[f])}return r}),bne=function(r){return function(e,t,n){var i=Object(e);if(!Va(e)){var a=Ha(t);e=Ro(e),t=function(s){return a(i[s],s,i)}}var o=r(e,t,n);return o>-1?i[a?e[o]:o]:void 0}},xne=/^\s+|\s+$/g,wne=/^[-+]0x[0-9a-f]+$/i,Ene=/^0b[01]+$/i,_ne=/^0o[0-7]+$/i,Sne=parseInt,Mne=function(r){if(typeof r=="number")return r;if(Ns(r))return NaN;if($n(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=$n(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(xne,"");var t=Ene.test(r);return t||_ne.test(r)?Sne(r.slice(2),t?2:8):wne.test(r)?NaN:+r},ld=function(r){return r?(r=Mne(r))===1/0||r===-1/0?17976931348623157e292*(r<0?-1:1):r==r?r:0:r===0?r:0},Cne=function(r){var e=ld(r),t=e%1;return e==e?t?e-t:e:0},Ane=Math.max,Tne=bne(function(r,e,t){var n=r==null?0:r.length;if(!n)return-1;var i=t==null?0:Cne(t);return i<0&&(i=Ane(n+i,0)),XN(r,Ha(e),i)}),JN=function(r){return r!=null&&r.length?rb(r):[]},Ine=function(r,e){return r==null?r:K1(r,xN(e),Bs)},kne=function(r){var e=r==null?0:r.length;return e?r[e-1]:void 0},Lne=function(r,e){var t={};return e=Ha(e),Q1(r,function(n,i,a){ep(t,i,e(n,i,a))}),t},ib=function(r,e,t){for(var n=-1,i=r.length;++n<i;){var a=r[n],o=e(a);if(o!=null&&(s===void 0?o==o&&!Ns(o):t(o,s)))var s=o,u=a}return u},Nne=function(r,e){return r>e},One=function(r){return r&&r.length?ib(r,Fs,Nne):void 0},Gy=function(r,e,t){(t!==void 0&&!tf(r[e],t)||t===void 0&&!(e in r))&&ep(r,e,t)},Dne=Function.prototype,Pne=Object.prototype,eO=Dne.toString,Rne=Pne.hasOwnProperty,Bne=eO.call(Object),Fne=function(r){if(!Di(r)||Po(r)!="[object Object]")return!1;var e=ap(r);if(e===null)return!0;var t=Rne.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&eO.call(t)==Bne},Q_=function(r,e){if((e!=="constructor"||typeof r[e]!="function")&&e!="__proto__")return r[e]},Gne=function(r){return oc(r,Bs(r))},zne=function(r,e,t,n,i,a,o){var s=Q_(r,t),u=Q_(e,t),f=o.get(u);if(f)Gy(r,t,f);else{var l=void 0,c=l===void 0;if(c){var h=Gr(u),d=!h&&ks(u),v=!h&&!d&&sc(u);l=u,h||d||v?Gr(s)?l=s:YN(s)?l=cN(s):d?(c=!1,l=lN(u,!0)):v?(c=!1,l=gN(u,!0)):l=[]:Fne(u)||Yu(u)?(l=s,Yu(s)?l=Gne(s):$n(s)&&!ac(s)||(l=mN(u))):c=!1}c&&(o.set(u,l),i(l,u,n,a,o),o.delete(u)),Gy(r,t,l)}},$ne=function r(e,t,n,i,a){e!==t&&K1(t,function(o,s){if(a||(a=new Tu),$n(o))zne(e,t,s,n,r,i,a);else{var u=void 0;u===void 0&&(u=o),Gy(e,s,u)}},Bs)},jne=function(r){return fp(function(e,t){var n=-1,i=t.length,a=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(a=r.length>3&&typeof a=="function"?(i--,a):void 0,o&&Rl(t[0],t[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var s=t[n];s&&r(e,s,n,a)}return e})}(function(r,e,t){$ne(r,e,t)}),tO=function(r,e){return r<e},Une=function(r){return r&&r.length?ib(r,Fs,tO):void 0},Xne=function(r,e){return r&&r.length?ib(r,Ha(e),tO):void 0},Yne=function(){return Bi.Date.now()},Wne=function(r,e,t,n){if(!$n(r))return r;for(var i=-1,a=(e=sp(e,r)).length,o=a-1,s=r;s!=null&&++i<a;){var u=uc(e[i]),f=t;if(u==="__proto__"||u==="constructor"||u==="prototype")return r;if(i!=o){var l=s[u];(f=void 0)==void 0&&(f=$n(l)?l:rp(e[i+1])?[]:{})}tp(s,u,f),s=s[u]}return r},Vne=function(r,e,t){for(var n=-1,i=e.length,a={};++n<i;){var o=e[n],s=up(r,o);t(s,o)&&Wne(a,sp(o,r),s)}return a},Hne=function(r,e){return Vne(r,e,function(t,n){return LN(r,n)})},qne=function(r){return UN(jN(r,void 0,JN),r+"")}(function(r,e){return r==null?{}:Hne(r,e)}),Zne=Math.ceil,Kne=Math.max,Qne=function(r,e,t,n){for(var i=-1,a=Kne(Zne((e-r)/(t||1)),0),o=Array(a);a--;)o[++i]=r,r+=t;return o},Jne=function(r){return function(e,t,n){return n&&typeof n!="number"&&Rl(e,t,n)&&(t=n=void 0),e=ld(e),t===void 0?(t=e,e=0):t=ld(t),n=n===void 0?e<t?1:-1:ld(n),Qne(e,t,n)}}(),eie=function(r,e){var t=r.length;for(r.sort(e);t--;)r[t]=r[t].value;return r},tie=function(r,e){if(r!==e){var t=r!==void 0,n=r===null,i=r==r,a=Ns(r),o=e!==void 0,s=e===null,u=e==e,f=Ns(e);if(!s&&!f&&!a&&r>e||a&&o&&u&&!s&&!f||n&&o&&u||!t&&u||!i)return 1;if(!n&&!a&&!f&&r<e||f&&t&&i&&!n&&!a||s&&t&&i||!o&&i||!u)return-1}return 0},rie=function(r,e,t){for(var n=-1,i=r.criteria,a=e.criteria,o=i.length,s=t.length;++n<o;){var u=tie(i[n],a[n]);if(u)return n>=s?u:u*(t[n]=="desc"?-1:1)}return r.index-e.index},nie=function(r,e,t){e=e.length?ku(e,function(a){return Gr(a)?function(o){return up(o,a.length===1?a[0]:a)}:a}):[Fs];var n=-1;e=ku(e,np(Ha));var i=RN(r,function(a,o,s){return{criteria:ku(e,function(u){return u(a)}),index:++n,value:a}});return eie(i,function(a,o){return rie(a,o,t)})},iie=fp(function(r,e){if(r==null)return[];var t=e.length;return t>1&&Rl(r,e[0],e[1])?e=[]:t>2&&Rl(e[0],e[1],e[2])&&(e=[e[0]]),nie(r,rb(e),[])}),aie=0,oie=function(r){var e=++aie;return IN(r)+e},sie=function(r,e,t){for(var n=-1,i=r.length,a=e.length,o={};++n<i;){var s=n<a?e[n]:void 0;t(o,r[n],s)}return o},Jd,uie=function(r,e){return sie(r||[],e||[],tp)};try{Jd={cloneDeep:gne,constant:Z1,defaults:mne,each:EN,filter:ON,find:Tne,flatten:JN,forEach:wN,forIn:Ine,has:DN,isUndefined:PN,last:kne,map:BN,mapValues:Lne,max:One,merge:jne,min:Une,minBy:Xne,now:Yne,pick:qne,range:Jne,reduce:FN,sortBy:iie,uniqueId:oie,values:WN,zipObject:uie}}catch{}Jd||(Jd=window._);var K=Jd,fie=cd;function cd(){var r={};r._next=r._prev=r,this._sentinel=r}function J_(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function lie(r,e){if(r!=="_next"&&r!=="_prev")return e}cd.prototype.dequeue=function(){var r=this._sentinel,e=r._prev;if(e!==r)return J_(e),e},cd.prototype.enqueue=function(r){var e=this._sentinel;r._prev&&r._next&&J_(r),r._next=e._next,e._next._prev=r,e._next=r,r._prev=e},cd.prototype.toString=function(){for(var r=[],e=this._sentinel,t=e._prev;t!==e;)r.push(JSON.stringify(t,lie)),t=t._prev;return"["+r.join(", ")+"]"};var cie=Fi.Graph,hie=function(r,e){if(r.nodeCount()<=1)return[];var t=function(i,a){var o=new cie,s=0,u=0;K.forEach(i.nodes(),function(c){o.setNode(c,{v:c,in:0,out:0})}),K.forEach(i.edges(),function(c){var h=o.edge(c.v,c.w)||0,d=a(c),v=h+d;o.setEdge(c.v,c.w,v),u=Math.max(u,o.node(c.v).out+=d),s=Math.max(s,o.node(c.w).in+=d)});var f=K.range(u+s+3).map(function(){return new fie}),l=s+1;return K.forEach(o.nodes(),function(c){zy(f,l,o.node(c))}),{graph:o,buckets:f,zeroIdx:l}}(r,e||die),n=function(i,a,o){for(var s,u=[],f=a[a.length-1],l=a[0];i.nodeCount();){for(;s=l.dequeue();)o0(i,a,o,s);for(;s=f.dequeue();)o0(i,a,o,s);if(i.nodeCount()){for(var c=a.length-2;c>0;--c)if(s=a[c].dequeue()){u=u.concat(o0(i,a,o,s,!0));break}}}return u}(t.graph,t.buckets,t.zeroIdx);return K.flatten(K.map(n,function(i){return r.outEdges(i.v,i.w)}),!0)},die=K.constant(1);function o0(r,e,t,n,i){var a=i?[]:void 0;return K.forEach(r.inEdges(n.v),function(o){var s=r.edge(o),u=r.node(o.v);i&&a.push({v:o.v,w:o.w}),u.out-=s,zy(e,t,u)}),K.forEach(r.outEdges(n.v),function(o){var s=r.edge(o),u=o.w,f=r.node(u);f.in-=s,zy(e,t,f)}),r.removeNode(n.v),a}function zy(r,e,t){t.out?t.in?r[t.out-t.in+e].enqueue(t):r[r.length-1].enqueue(t):r[0].enqueue(t)}var eS={run:function(r){var e=r.graph().acyclicer==="greedy"?hie(r,function(t){return function(n){return t.edge(n).weight}}(r)):function(t){var n=[],i={},a={};function o(s){K.has(a,s)||(a[s]=!0,i[s]=!0,K.forEach(t.outEdges(s),function(u){K.has(i,u.w)?n.push(u):o(u.w)}),delete i[s])}return K.forEach(t.nodes(),o),n}(r);K.forEach(e,function(t){var n=r.edge(t);r.removeEdge(t),n.forwardName=t.name,n.reversed=!0,r.setEdge(t.w,t.v,n,K.uniqueId("rev"))})},undo:function(r){K.forEach(r.edges(),function(e){var t=r.edge(e);if(t.reversed){r.removeEdge(e);var n=t.forwardName;delete t.reversed,delete t.forwardName,r.setEdge(e.w,e.v,t,n)}})}},tS=Fi.Graph,mn={addDummyNode:rS,simplify:function(r){var e=new tS().setGraph(r.graph());return K.forEach(r.nodes(),function(t){e.setNode(t,r.node(t))}),K.forEach(r.edges(),function(t){var n=e.edge(t.v,t.w)||{weight:0,minlen:1},i=r.edge(t);e.setEdge(t.v,t.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),e},asNonCompoundGraph:function(r){var e=new tS({multigraph:r.isMultigraph()}).setGraph(r.graph());return K.forEach(r.nodes(),function(t){r.children(t).length||e.setNode(t,r.node(t))}),K.forEach(r.edges(),function(t){e.setEdge(t,r.edge(t))}),e},successorWeights:function(r){var e=K.map(r.nodes(),function(t){var n={};return K.forEach(r.outEdges(t),function(i){n[i.w]=(n[i.w]||0)+r.edge(i).weight}),n});return K.zipObject(r.nodes(),e)},predecessorWeights:function(r){var e=K.map(r.nodes(),function(t){var n={};return K.forEach(r.inEdges(t),function(i){n[i.v]=(n[i.v]||0)+r.edge(i).weight}),n});return K.zipObject(r.nodes(),e)},intersectRect:function(r,e){var t,n,i=r.x,a=r.y,o=e.x-i,s=e.y-a,u=r.width/2,f=r.height/2;if(!o&&!s)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*u>Math.abs(o)*f?(s<0&&(f=-f),t=f*o/s,n=f):(o<0&&(u=-u),t=u,n=u*s/o),{x:i+t,y:a+n}},buildLayerMatrix:function(r){var e=K.map(K.range(nS(r)+1),function(){return[]});return K.forEach(r.nodes(),function(t){var n=r.node(t),i=n.rank;K.isUndefined(i)||(e[i][n.order]=t)}),e},normalizeRanks:function(r){var e=K.min(K.map(r.nodes(),function(t){return r.node(t).rank}));K.forEach(r.nodes(),function(t){var n=r.node(t);K.has(n,"rank")&&(n.rank-=e)})},removeEmptyRanks:function(r){var e=K.min(K.map(r.nodes(),function(a){return r.node(a).rank})),t=[];K.forEach(r.nodes(),function(a){var o=r.node(a).rank-e;t[o]||(t[o]=[]),t[o].push(a)});var n=0,i=r.graph().nodeRankFactor;K.forEach(t,function(a,o){K.isUndefined(a)&&o%i!=0?--n:n&&K.forEach(a,function(s){r.node(s).rank+=n})})},addBorderNode:function(r,e,t,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=t,i.order=n),rS(r,"border",i,e)},maxRank:nS,partition:function(r,e){var t={lhs:[],rhs:[]};return K.forEach(r,function(n){e(n)?t.lhs.push(n):t.rhs.push(n)}),t},time:function(r,e){var t=K.now();try{return e()}finally{console.log(r+" time: "+(K.now()-t)+"ms")}},notime:function(r,e){return e()}};function rS(r,e,t,n){var i;do i=K.uniqueId(n);while(r.hasNode(i));return t.dummy=e,r.setNode(i,t),i}function nS(r){return K.max(K.map(r.nodes(),function(e){var t=r.node(e).rank;if(!K.isUndefined(t))return t}))}var iS={run:function(r){r.graph().dummyChains=[],K.forEach(r.edges(),function(e){(function(t,n){var i,a,o,s=n.v,u=t.node(s).rank,f=n.w,l=t.node(f).rank,c=n.name,h=t.edge(n),d=h.labelRank;if(l!==u+1){for(t.removeEdge(n),o=0,++u;u<l;++o,++u)h.points=[],a={width:0,height:0,edgeLabel:h,edgeObj:n,rank:u},i=mn.addDummyNode(t,"edge",a,"_d"),u===d&&(a.width=h.width,a.height=h.height,a.dummy="edge-label",a.labelpos=h.labelpos),t.setEdge(s,i,{weight:h.weight},c),o===0&&t.graph().dummyChains.push(i),s=i;t.setEdge(s,f,{weight:h.weight},c)}})(r,e)})},undo:function(r){K.forEach(r.graph().dummyChains,function(e){var t,n=r.node(e),i=n.edgeLabel;for(r.setEdge(n.edgeObj,i);n.dummy;)t=r.successors(e)[0],r.removeNode(e),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),e=t,n=r.node(e)})}},rO=function(r){var e={};K.forEach(r.sources(),function t(n){var i=r.node(n);if(K.has(e,n))return i.rank;e[n]=!0;var a=K.min(K.map(r.outEdges(n),function(o){return t(o.w)-r.edge(o).minlen}));return a!==Number.POSITIVE_INFINITY&&a!=null||(a=0),i.rank=a})},nO=function(r,e){return r.node(e.w).rank-r.node(e.v).rank-r.edge(e).minlen},vie=Fi.Graph,ev=nO,iO=function(r){var e,t,n=new vie({directed:!1}),i=r.nodes()[0],a=r.nodeCount();for(n.setNode(i,{});pie(n,r)<a;)e=gie(n,r),t=n.hasNode(e.v)?ev(r,e):-ev(r,e),yie(n,r,t);return n};function pie(r,e){return K.forEach(r.nodes(),function t(n){K.forEach(e.nodeEdges(n),function(i){var a=i.v,o=n===a?i.w:a;r.hasNode(o)||ev(e,i)||(r.setNode(o,{}),r.setEdge(n,o,{}),t(o))})}),r.nodeCount()}function gie(r,e){return K.minBy(e.edges(),function(t){if(r.hasNode(t.v)!==r.hasNode(t.w))return ev(e,t)})}function yie(r,e,t){K.forEach(r.nodes(),function(n){e.node(n).rank+=t})}var mie=nO,bie=rO,xie=Fi.alg.preorder,wie=Fi.alg.postorder,Eie=mn.simplify,_ie=fs;function fs(r){r=Eie(r),bie(r);var e,t=iO(r);for(ob(t),ab(t,r);e=sO(t);)fO(t,r,e,uO(t,r,e))}function ab(r,e){var t=wie(r,r.nodes());t=t.slice(0,t.length-1),K.forEach(t,function(n){(function(i,a,o){var s=i.node(o).parent;i.edge(o,s).cutvalue=aO(i,a,o)})(r,e,n)})}function aO(r,e,t){var n=r.node(t).parent,i=!0,a=e.edge(t,n),o=0;return a||(i=!1,a=e.edge(n,t)),o=a.weight,K.forEach(e.nodeEdges(t),function(s){var u,f,l=s.v===t,c=l?s.w:s.v;if(c!==n){var h=l===i,d=e.edge(s).weight;if(o+=h?d:-d,u=t,f=c,r.hasEdge(u,f)){var v=r.edge(t,c).cutvalue;o+=h?-v:v}}}),o}function ob(r,e){arguments.length<2&&(e=r.nodes()[0]),oO(r,{},1,e)}function oO(r,e,t,n,i){var a=t,o=r.node(n);return e[n]=!0,K.forEach(r.neighbors(n),function(s){K.has(e,s)||(t=oO(r,e,t,s,n))}),o.low=a,o.lim=t++,i?o.parent=i:delete o.parent,t}function sO(r){return K.find(r.edges(),function(e){return r.edge(e).cutvalue<0})}function uO(r,e,t){var n=t.v,i=t.w;e.hasEdge(n,i)||(n=t.w,i=t.v);var a=r.node(n),o=r.node(i),s=a,u=!1;a.lim>o.lim&&(s=o,u=!0);var f=K.filter(e.edges(),function(l){return u===aS(r,r.node(l.v),s)&&u!==aS(r,r.node(l.w),s)});return K.minBy(f,function(l){return mie(e,l)})}function fO(r,e,t,n){var i=t.v,a=t.w;r.removeEdge(i,a),r.setEdge(n.v,n.w,{}),ob(r),ab(r,e),function(o,s){var u=K.find(o.nodes(),function(l){return!s.node(l).parent}),f=xie(o,u);f=f.slice(1),K.forEach(f,function(l){var c=o.node(l).parent,h=s.edge(l,c),d=!1;h||(h=s.edge(c,l),d=!0),s.node(l).rank=s.node(c).rank+(d?h.minlen:-h.minlen)})}(r,e)}function aS(r,e,t){return t.low<=e.lim&&e.lim<=t.lim}fs.initLowLimValues=ob,fs.initCutValues=ab,fs.calcCutValue=aO,fs.leaveEdge=sO,fs.enterEdge=uO,fs.exchangeEdges=fO;var lO=rO,Sie=function(r){switch(r.graph().ranker){case"network-simplex":oS(r);break;case"tight-tree":(function(e){lO(e),iO(e)})(r);break;case"longest-path":Mie(r);break;default:oS(r)}},Mie=lO;function oS(r){_ie(r)}var Cie=function(r){var e=function(t){var n={},i=0;function a(o){var s=i;K.forEach(t.children(o),a),n[o]={low:s,lim:i++}}return K.forEach(t.children(),a),n}(r);K.forEach(r.graph().dummyChains,function(t){for(var n=r.node(t),i=n.edgeObj,a=function(c,h,d,v){var p,g,y=[],m=[],b=Math.min(h[d].low,h[v].low),x=Math.max(h[d].lim,h[v].lim);p=d;do p=c.parent(p),y.push(p);while(p&&(h[p].low>b||x>h[p].lim));for(g=p,p=v;(p=c.parent(p))!==g;)m.push(p);return{path:y.concat(m.reverse()),lca:g}}(r,e,i.v,i.w),o=a.path,s=a.lca,u=0,f=o[u],l=!0;t!==i.w;){if(n=r.node(t),l){for(;(f=o[u])!==s&&r.node(f).maxRank<n.rank;)u++;f===s&&(l=!1)}if(!l){for(;u<o.length-1&&r.node(f=o[u+1]).minRank<=n.rank;)u++;f=o[u]}r.setParent(t,f),t=r.successors(t)[0]}})},sS={run:function(r){var e=mn.addDummyNode(r,"root",{},"_root"),t=function(o){var s={};function u(f,l){var c=o.children(f);c&&c.length&&K.forEach(c,function(h){u(h,l+1)}),s[f]=l}return K.forEach(o.children(),function(f){u(f,1)}),s}(r),n=K.max(K.values(t))-1,i=2*n+1;r.graph().nestingRoot=e,K.forEach(r.edges(),function(o){r.edge(o).minlen*=i});var a=function(o){return K.reduce(o.edges(),function(s,u){return s+o.edge(u).weight},0)}(r)+1;K.forEach(r.children(),function(o){cO(r,e,i,a,n,t,o)}),r.graph().nodeRankFactor=i},cleanup:function(r){var e=r.graph();r.removeNode(e.nestingRoot),delete e.nestingRoot,K.forEach(r.edges(),function(t){r.edge(t).nestingEdge&&r.removeEdge(t)})}};function cO(r,e,t,n,i,a,o){var s=r.children(o);if(s.length){var u=mn.addBorderNode(r,"_bt"),f=mn.addBorderNode(r,"_bb"),l=r.node(o);r.setParent(u,o),l.borderTop=u,r.setParent(f,o),l.borderBottom=f,K.forEach(s,function(c){cO(r,e,t,n,i,a,c);var h=r.node(c),d=h.borderTop?h.borderTop:c,v=h.borderBottom?h.borderBottom:c,p=h.borderTop?n:2*n,g=d!==v?1:i-a[o]+1;r.setEdge(u,d,{weight:p,minlen:g,nestingEdge:!0}),r.setEdge(v,f,{weight:p,minlen:g,nestingEdge:!0})}),r.parent(o)||r.setEdge(e,u,{weight:0,minlen:i+a[o]})}else o!==e&&r.setEdge(e,o,{weight:0,minlen:t})}var Aie=function(r){K.forEach(r.children(),function e(t){var n=r.children(t),i=r.node(t);if(n.length&&K.forEach(n,e),K.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)uS(r,"borderLeft","_bl",t,i,a),uS(r,"borderRight","_br",t,i,a)}})};function uS(r,e,t,n,i,a){var o={width:0,height:0,rank:a,borderType:e},s=i[e][a-1],u=mn.addDummyNode(r,"border",o,t);i[e][a]=u,r.setParent(u,n),s&&r.setEdge(s,u,{weight:1})}var fS={adjust:function(r){var e=r.graph().rankdir.toLowerCase();e!=="lr"&&e!=="rl"||lS(r)},undo:function(r){var e=r.graph().rankdir.toLowerCase();e!=="bt"&&e!=="rl"||function(t){K.forEach(t.nodes(),function(n){s0(t.node(n))}),K.forEach(t.edges(),function(n){var i=t.edge(n);K.forEach(i.points,s0),K.has(i,"y")&&s0(i)})}(r),e!=="lr"&&e!=="rl"||(function(t){K.forEach(t.nodes(),function(n){u0(t.node(n))}),K.forEach(t.edges(),function(n){var i=t.edge(n);K.forEach(i.points,u0),K.has(i,"x")&&u0(i)})}(r),lS(r))}};function lS(r){K.forEach(r.nodes(),function(e){cS(r.node(e))}),K.forEach(r.edges(),function(e){cS(r.edge(e))})}function cS(r){var e=r.width;r.width=r.height,r.height=e}function s0(r){r.y=-r.y}function u0(r){var e=r.x;r.x=r.y,r.y=e}var Tie=function(r){var e={},t=K.filter(r.nodes(),function(s){return!r.children(s).length}),n=K.max(K.map(t,function(s){return r.node(s).rank})),i=K.map(K.range(n+1),function(){return[]});function a(s){if(!K.has(e,s)){e[s]=!0;var u=r.node(s);i[u.rank].push(s),K.forEach(r.successors(s),a)}}var o=K.sortBy(t,function(s){return r.node(s).rank});return K.forEach(o,a),i},Iie=function(r,e){for(var t=0,n=1;n<e.length;++n)t+=kie(r,e[n-1],e[n]);return t};function kie(r,e,t){for(var n=K.zipObject(t,K.map(t,function(f,l){return l})),i=K.flatten(K.map(e,function(f){return K.sortBy(K.map(r.outEdges(f),function(l){return{pos:n[l.w],weight:r.edge(l).weight}}),"pos")}),!0),a=1;a<t.length;)a<<=1;var o=2*a-1;a-=1;var s=K.map(new Array(o),function(){return 0}),u=0;return K.forEach(i.forEach(function(f){var l=f.pos+a;s[l]+=f.weight;for(var c=0;l>0;)l%2&&(c+=s[l+1]),s[l=l-1>>1]+=f.weight;u+=f.weight*c})),u}var Lie=function(r,e){return K.map(e,function(t){var n=r.inEdges(t);if(n.length){var i=K.reduce(n,function(a,o){var s=r.edge(o),u=r.node(o.v);return{sum:a.sum+s.weight*u.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:t,barycenter:i.sum/i.weight,weight:i.weight}}return{v:t}})},Nie=function(r,e){var t={};return K.forEach(r,function(n,i){var a=t[n.v]={indegree:0,in:[],out:[],vs:[n.v],i};K.isUndefined(n.barycenter)||(a.barycenter=n.barycenter,a.weight=n.weight)}),K.forEach(e.edges(),function(n){var i=t[n.v],a=t[n.w];K.isUndefined(i)||K.isUndefined(a)||(a.indegree++,i.out.push(t[n.w]))}),function(n){var i=[];function a(u){return function(f){f.merged||(K.isUndefined(f.barycenter)||K.isUndefined(u.barycenter)||f.barycenter>=u.barycenter)&&function(l,c){var h=0,d=0;l.weight&&(h+=l.barycenter*l.weight,d+=l.weight),c.weight&&(h+=c.barycenter*c.weight,d+=c.weight),l.vs=c.vs.concat(l.vs),l.barycenter=h/d,l.weight=d,l.i=Math.min(c.i,l.i),c.merged=!0}(u,f)}}function o(u){return function(f){f.in.push(u),--f.indegree==0&&n.push(f)}}for(;n.length;){var s=n.pop();i.push(s),K.forEach(s.in.reverse(),a(s)),K.forEach(s.out,o(s))}return K.map(K.filter(i,function(u){return!u.merged}),function(u){return K.pick(u,["vs","i","barycenter","weight"])})}(K.filter(t,function(n){return!n.indegree}))},Oie=function(r,e){var t=mn.partition(r,function(c){return K.has(c,"barycenter")}),n=t.lhs,i=K.sortBy(t.rhs,function(c){return-c.i}),a=[],o=0,s=0,u=0;n.sort((f=!!e,function(c,h){return c.barycenter<h.barycenter?-1:c.barycenter>h.barycenter?1:f?h.i-c.i:c.i-h.i})),u=hS(a,i,u),K.forEach(n,function(c){u+=c.vs.length,a.push(c.vs),o+=c.barycenter*c.weight,s+=c.weight,u=hS(a,i,u)});var f,l={vs:K.flatten(a,!0)};return s&&(l.barycenter=o/s,l.weight=s),l};function hS(r,e,t){for(var n;e.length&&(n=K.last(e)).i<=t;)e.pop(),r.push(n.vs),t++;return t}var Die=function r(e,t,n,i){var a=e.children(t),o=e.node(t),s=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,f={};s&&(a=K.filter(a,function(p){return p!==s&&p!==u}));var l=Lie(e,a);K.forEach(l,function(p){if(e.children(p.v).length){var g=r(e,p.v,n,i);f[p.v]=g,K.has(g,"barycenter")&&(y=p,m=g,K.isUndefined(y.barycenter)?(y.barycenter=m.barycenter,y.weight=m.weight):(y.barycenter=(y.barycenter*y.weight+m.barycenter*m.weight)/(y.weight+m.weight),y.weight+=m.weight))}var y,m});var c=Nie(l,n);(function(p,g){K.forEach(p,function(y){y.vs=K.flatten(y.vs.map(function(m){return g[m]?g[m].vs:m}),!0)})})(c,f);var h=Oie(c,i);if(s&&(h.vs=K.flatten([s,h.vs,u],!0),e.predecessors(s).length)){var d=e.node(e.predecessors(s)[0]),v=e.node(e.predecessors(u)[0]);K.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+d.order+v.order)/(h.weight+2),h.weight+=2}return h},Pie=Fi.Graph,Rie=function(r,e,t){var n=function(a){for(var o;a.hasNode(o=K.uniqueId("_root")););return o}(r),i=new Pie({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return K.forEach(r.nodes(),function(a){var o=r.node(a),s=r.parent(a);(o.rank===e||o.minRank<=e&&e<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||n),K.forEach(r[t](a),function(u){var f=u.v===a?u.w:u.v,l=i.edge(f,a),c=K.isUndefined(l)?0:l.weight;i.setEdge(f,a,{weight:r.edge(u).weight+c})}),K.has(o,"minRank")&&i.setNode(a,{borderLeft:o.borderLeft[e],borderRight:o.borderRight[e]}))}),i},Bie=function(r,e,t){var n,i={};K.forEach(t,function(a){for(var o,s,u=r.parent(a);u;){if((o=r.parent(u))?(s=i[o],i[o]=u):(s=n,n=u),s&&s!==u)return void e.setEdge(s,u);u=o}})},Fie=Fi.Graph,Gie=function(r){var e=mn.maxRank(r),t=dS(r,K.range(1,e+1),"inEdges"),n=dS(r,K.range(e-1,-1,-1),"outEdges"),i=Tie(r);vS(r,i);for(var a,o=Number.POSITIVE_INFINITY,s=0,u=0;u<4;++s,++u){zie(s%2?t:n,s%4>=2),i=mn.buildLayerMatrix(r);var f=Iie(r,i);f<o&&(u=0,a=K.cloneDeep(i),o=f)}vS(r,a)};function dS(r,e,t){return K.map(e,function(n){return Rie(r,n,t)})}function zie(r,e){var t=new Fie;K.forEach(r,function(n){var i=n.graph().root,a=Die(n,i,t,e);K.forEach(a.vs,function(o,s){n.node(o).order=s}),Bie(n,t,a.vs)})}function vS(r,e){K.forEach(e,function(t){K.forEach(t,function(n,i){r.node(n).order=i})})}var $ie=Fi.Graph,jie=function(r){var e,t=mn.buildLayerMatrix(r),n=K.merge(Uie(r,t),Xie(r,t)),i={};K.forEach(["u","d"],function(o){e=o==="u"?t:K.values(t).reverse(),K.forEach(["l","r"],function(s){s==="r"&&(e=K.map(e,function(c){return K.values(c).reverse()}));var u=(o==="u"?r.predecessors:r.successors).bind(r),f=Wie(r,e,n,u),l=Vie(r,e,f.root,f.align,s==="r");s==="r"&&(l=K.mapValues(l,function(c){return-c})),i[o+s]=l})});var a=Hie(r,i);return qie(i,a),Zie(i,r.graph().align)};function Uie(r,e){var t={};return K.reduce(e,function(n,i){var a=0,o=0,s=n.length,u=K.last(i);return K.forEach(i,function(f,l){var c=function(d,v){if(d.node(v).dummy)return K.find(d.predecessors(v),function(p){return d.node(p).dummy})}(r,f),h=c?r.node(c).order:s;(c||f===u)&&(K.forEach(i.slice(o,l+1),function(d){K.forEach(r.predecessors(d),function(v){var p=r.node(v),g=p.order;!(g<a||h<g)||p.dummy&&r.node(d).dummy||hO(t,v,d)})}),o=l+1,a=h)}),i}),t}function Xie(r,e){var t={};function n(i,a,o,s,u){var f;K.forEach(K.range(a,o),function(l){f=i[l],r.node(f).dummy&&K.forEach(r.predecessors(f),function(c){var h=r.node(c);h.dummy&&(h.order<s||h.order>u)&&hO(t,c,f)})})}return K.reduce(e,function(i,a){var o,s=-1,u=0;return K.forEach(a,function(f,l){if(r.node(f).dummy==="border"){var c=r.predecessors(f);c.length&&(o=r.node(c[0]).order,n(a,u,l,s,o),u=l,s=o)}n(a,u,a.length,o,i.length)}),a}),t}function hO(r,e,t){if(e>t){var n=e;e=t,t=n}var i=r[e];i||(r[e]=i={}),i[t]=!0}function Yie(r,e,t){if(e>t){var n=e;e=t,t=n}return K.has(r[e],t)}function Wie(r,e,t,n){var i={},a={},o={};return K.forEach(e,function(s){K.forEach(s,function(u,f){i[u]=u,a[u]=u,o[u]=f})}),K.forEach(e,function(s){var u=-1;K.forEach(s,function(f){var l=n(f);if(l.length)for(var c=((l=K.sortBy(l,function(p){return o[p]})).length-1)/2,h=Math.floor(c),d=Math.ceil(c);h<=d;++h){var v=l[h];a[f]===f&&u<o[v]&&!Yie(t,f,v)&&(a[v]=f,a[f]=i[f]=i[v],u=o[v])}})}),{root:i,align:a}}function Vie(r,e,t,n,i){var a={},o=function(f,l,c,h){var d=new $ie,v=f.graph(),p=function(g,y,m){return function(b,x,w){var E,_=b.node(x),M=b.node(w),C=0;if(C+=_.width/2,K.has(_,"labelpos"))switch(_.labelpos.toLowerCase()){case"l":E=-_.width/2;break;case"r":E=_.width/2}if(E&&(C+=m?E:-E),E=0,C+=(_.dummy?y:g)/2,C+=(M.dummy?y:g)/2,C+=M.width/2,K.has(M,"labelpos"))switch(M.labelpos.toLowerCase()){case"l":E=M.width/2;break;case"r":E=-M.width/2}return E&&(C+=m?E:-E),E=0,C}}(v.nodesep,v.edgesep,h);return K.forEach(l,function(g){var y;K.forEach(g,function(m){var b=c[m];if(d.setNode(b),y){var x=c[y],w=d.edge(x,b);d.setEdge(x,b,Math.max(p(f,m,y),w||0))}y=m})}),d}(r,e,t,i),s=i?"borderLeft":"borderRight";function u(f,l){for(var c=o.nodes(),h=c.pop(),d={};h;)d[h]?f(h):(d[h]=!0,c.push(h),c=c.concat(l(h))),h=c.pop()}return u(function(f){a[f]=o.inEdges(f).reduce(function(l,c){return Math.max(l,a[c.v]+o.edge(c))},0)},o.predecessors.bind(o)),u(function(f){var l=o.outEdges(f).reduce(function(h,d){return Math.min(h,a[d.w]-o.edge(d))},Number.POSITIVE_INFINITY),c=r.node(f);l!==Number.POSITIVE_INFINITY&&c.borderType!==s&&(a[f]=Math.max(a[f],l))},o.successors.bind(o)),K.forEach(n,function(f){a[f]=a[t[f]]}),a}function Hie(r,e){return K.minBy(K.values(e),function(t){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return K.forIn(t,function(a,o){var s=function(u,f){return u.node(f).width}(r,o)/2;n=Math.max(a+s,n),i=Math.min(a-s,i)}),n-i})}function qie(r,e){var t=K.values(e),n=K.min(t),i=K.max(t);K.forEach(["u","d"],function(a){K.forEach(["l","r"],function(o){var s,u=a+o,f=r[u];if(f!==e){var l=K.values(f);(s=o==="l"?n-K.min(l):i-K.max(l))&&(r[u]=K.mapValues(f,function(c){return c+s}))}})})}function Zie(r,e){return K.mapValues(r.ul,function(t,n){if(e)return r[e.toLowerCase()][n];var i=K.sortBy(K.map(r,n));return(i[1]+i[2])/2})}var Kie=jie,Qie=function(r){(function(e){var t=mn.buildLayerMatrix(e),n=e.graph().ranksep,i=0;K.forEach(t,function(a){var o=K.max(K.map(a,function(s){return e.node(s).height}));K.forEach(a,function(s){e.node(s).y=i+o/2}),i+=o+n})})(r=mn.asNonCompoundGraph(r)),K.forEach(Kie(r),function(e,t){r.node(t).x=e})},Jie=mn.normalizeRanks,eae=mn.removeEmptyRanks,ao=mn,tae=Fi.Graph,rae=function(r,e){var t=e&&e.debugTiming?ao.time:ao.notime;t("layout",function(){var n=t(" buildLayoutGraph",function(){return function(i){var a=new tae({multigraph:!0,compound:!0}),o=l0(i.graph());return a.setGraph(K.merge({},iae,f0(o,nae),K.pick(o,aae))),K.forEach(i.nodes(),function(s){var u=l0(i.node(s));a.setNode(s,K.defaults(f0(u,oae),sae)),a.setParent(s,i.parent(s))}),K.forEach(i.edges(),function(s){var u=l0(i.edge(s));a.setEdge(s,K.merge({},fae,f0(u,uae),K.pick(u,lae)))}),a}(r)});t(" runLayout",function(){(function(i,a){a(" makeSpaceForEdgeLabels",function(){(function(o){var s=o.graph();s.ranksep/=2,K.forEach(o.edges(),function(u){var f=o.edge(u);f.minlen*=2,f.labelpos.toLowerCase()!=="c"&&(s.rankdir==="TB"||s.rankdir==="BT"?f.width+=f.labeloffset:f.height+=f.labeloffset)})})(i)}),a(" removeSelfEdges",function(){(function(o){K.forEach(o.edges(),function(s){if(s.v===s.w){var u=o.node(s.v);u.selfEdges||(u.selfEdges=[]),u.selfEdges.push({e:s,label:o.edge(s)}),o.removeEdge(s)}})})(i)}),a(" acyclic",function(){eS.run(i)}),a(" nestingGraph.run",function(){sS.run(i)}),a(" rank",function(){Sie(ao.asNonCompoundGraph(i))}),a(" injectEdgeLabelProxies",function(){(function(o){K.forEach(o.edges(),function(s){var u=o.edge(s);if(u.width&&u.height){var f=o.node(s.v),l={rank:(o.node(s.w).rank-f.rank)/2+f.rank,e:s};ao.addDummyNode(o,"edge-proxy",l,"_ep")}})})(i)}),a(" removeEmptyRanks",function(){eae(i)}),a(" nestingGraph.cleanup",function(){sS.cleanup(i)}),a(" normalizeRanks",function(){Jie(i)}),a(" assignRankMinMax",function(){(function(o){var s=0;K.forEach(o.nodes(),function(u){var f=o.node(u);f.borderTop&&(f.minRank=o.node(f.borderTop).rank,f.maxRank=o.node(f.borderBottom).rank,s=K.max(s,f.maxRank))}),o.graph().maxRank=s})(i)}),a(" removeEdgeLabelProxies",function(){(function(o){K.forEach(o.nodes(),function(s){var u=o.node(s);u.dummy==="edge-proxy"&&(o.edge(u.e).labelRank=u.rank,o.removeNode(s))})})(i)}),a(" normalize.run",function(){iS.run(i)}),a(" parentDummyChains",function(){Cie(i)}),a(" addBorderSegments",function(){Aie(i)}),a(" order",function(){Gie(i)}),a(" insertSelfEdges",function(){(function(o){var s=ao.buildLayerMatrix(o);K.forEach(s,function(u){var f=0;K.forEach(u,function(l,c){var h=o.node(l);h.order=c+f,K.forEach(h.selfEdges,function(d){ao.addDummyNode(o,"selfedge",{width:d.label.width,height:d.label.height,rank:h.rank,order:c+ ++f,e:d.e,label:d.label},"_se")}),delete h.selfEdges})})})(i)}),a(" adjustCoordinateSystem",function(){fS.adjust(i)}),a(" position",function(){Qie(i)}),a(" positionSelfEdges",function(){(function(o){K.forEach(o.nodes(),function(s){var u=o.node(s);if(u.dummy==="selfedge"){var f=o.node(u.e.v),l=f.x+f.width/2,c=f.y,h=u.x-l,d=f.height/2;o.setEdge(u.e,u.label),o.removeNode(s),u.label.points=[{x:l+2*h/3,y:c-d},{x:l+5*h/6,y:c-d},{x:l+h,y:c},{x:l+5*h/6,y:c+d},{x:l+2*h/3,y:c+d}],u.label.x=u.x,u.label.y=u.y}})})(i)}),a(" removeBorderNodes",function(){(function(o){K.forEach(o.nodes(),function(s){if(o.children(s).length){var u=o.node(s),f=o.node(u.borderTop),l=o.node(u.borderBottom),c=o.node(K.last(u.borderLeft)),h=o.node(K.last(u.borderRight));u.width=Math.abs(h.x-c.x),u.height=Math.abs(l.y-f.y),u.x=c.x+u.width/2,u.y=f.y+u.height/2}}),K.forEach(o.nodes(),function(s){o.node(s).dummy==="border"&&o.removeNode(s)})})(i)}),a(" normalize.undo",function(){iS.undo(i)}),a(" fixupEdgeLabelCoords",function(){(function(o){K.forEach(o.edges(),function(s){var u=o.edge(s);if(K.has(u,"x"))switch(u.labelpos!=="l"&&u.labelpos!=="r"||(u.width-=u.labeloffset),u.labelpos){case"l":u.x-=u.width/2+u.labeloffset;break;case"r":u.x+=u.width/2+u.labeloffset}})})(i)}),a(" undoCoordinateSystem",function(){fS.undo(i)}),a(" translateGraph",function(){(function(o){var s=Number.POSITIVE_INFINITY,u=0,f=Number.POSITIVE_INFINITY,l=0,c=o.graph(),h=c.marginx||0,d=c.marginy||0;function v(p){var g=p.x,y=p.y,m=p.width,b=p.height;s=Math.min(s,g-m/2),u=Math.max(u,g+m/2),f=Math.min(f,y-b/2),l=Math.max(l,y+b/2)}K.forEach(o.nodes(),function(p){v(o.node(p))}),K.forEach(o.edges(),function(p){var g=o.edge(p);K.has(g,"x")&&v(g)}),s-=h,f-=d,K.forEach(o.nodes(),function(p){var g=o.node(p);g.x-=s,g.y-=f}),K.forEach(o.edges(),function(p){var g=o.edge(p);K.forEach(g.points,function(y){y.x-=s,y.y-=f}),K.has(g,"x")&&(g.x-=s),K.has(g,"y")&&(g.y-=f)}),c.width=u-s+h,c.height=l-f+d})(i)}),a(" assignNodeIntersects",function(){(function(o){K.forEach(o.edges(),function(s){var u,f,l=o.edge(s),c=o.node(s.v),h=o.node(s.w);l.points?(u=l.points[0],f=l.points[l.points.length-1]):(l.points=[],u=h,f=c),l.points.unshift(ao.intersectRect(c,u)),l.points.push(ao.intersectRect(h,f))})})(i)}),a(" reversePoints",function(){(function(o){K.forEach(o.edges(),function(s){var u=o.edge(s);u.reversed&&u.points.reverse()})})(i)}),a(" acyclic.undo",function(){eS.undo(i)})})(n,t)}),t(" updateInputGraph",function(){(function(i,a){K.forEach(i.nodes(),function(o){var s=i.node(o),u=a.node(o);s&&(s.x=u.x,s.y=u.y,a.children(o).length&&(s.width=u.width,s.height=u.height))}),K.forEach(i.edges(),function(o){var s=i.edge(o),u=a.edge(o);s.points=u.points,K.has(u,"x")&&(s.x=u.x,s.y=u.y)}),i.graph().width=a.graph().width,i.graph().height=a.graph().height})(r,n)})})},nae=["nodesep","edgesep","ranksep","marginx","marginy"],iae={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},aae=["acyclicer","ranker","rankdir","align"],oae=["width","height"],sae={width:0,height:0},uae=["minlen","weight","width","height","labeloffset"],fae={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},lae=["labelpos"];function f0(r,e){return K.mapValues(K.pick(r,e),Number)}function l0(r){var e={};return K.forEach(r,function(t,n){e[n.toLowerCase()]=t}),e}var cae=Fi.Graph,dO={graphlib:Fi,layout:rae,debug:{debugOrdering:function(r){var e=mn.buildLayerMatrix(r),t=new cae({compound:!0,multigraph:!0}).setGraph({});return K.forEach(r.nodes(),function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+r.node(n).rank)}),K.forEach(r.edges(),function(n){t.setEdge(n.v,n.w,{},n.name)}),K.forEach(e,function(n,i){var a="layer"+i;t.setNode(a,{rank:"same"}),K.reduce(n,function(o,s){return t.setEdge(o,s,{style:"invis"}),s})}),t}},util:{time:mn.time,notime:mn.notime},version:"0.8.5"},hae=dO.graphlib,dae=dO.layout;class vae{constructor(e){this.cardinality=1,this.include=Is.UNSPECIFIED,this.isGroupNode=!1,this.parentNode=null,this.type=Bn.NODE,this.name=e.name,this.attr=e.attr||{},this.inputs=e.inputs,this.path=e.path||[],this.width=e.width,this.height=e.height}}class pae{constructor(){this.nodes={},this.edges=[],this.nodes={},this.edges=[]}}function gae(r){const e=new pae;return r.nodes.map(t=>new vae(t)).forEach(t=>{e.nodes[t.name]=t,t.inputs.forEach(n=>{(function(i,a,o){o.name!==a.name&&i.edges.push(Object.assign(Object.assign({},o.attr),{v:o.name,w:a.name}))})(e,t,n)})}),e}class yae{constructor(e,t={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=Is.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=Bn.META,this.path=[],this.name=e,this.metaGraph=sb(e,Xu.META,t)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map(e=>this.metaGraph.node(e))}leaves(){let e,t=[],n=[this];for(;n.length;){let i=n.shift();i.isGroupNode?(e=i.metaGraph,e.nodes().forEach(a=>n.push(e.node(a)))):t.push(i.name)}return t}}class mae{constructor(e,t){this.v=e,this.w=t,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(e,t){this.baseEdgeList.push(e)}}function vO(r,e={}){return new yae(r,e)}function pO(r,e){return new mae(r,e)}function sb(r,e,t){const n=t||{},i=new hae.Graph(n);return i.setGraph({name:r,rankdir:n.rankdir,type:e,align:n.align}),i}class bae{constructor(e={}){this.graphOptions=e,this.index={},this.graphOptions.compound=!0,this.root=vO(Uu,this.graphOptions),this.index[Uu]=this.root}getNodeMap(){return this.index}node(e){return this.index[e]}setNode(e,t){this.index[e]=t}getBridgeGraph(e){const t=this.index[e];if(!t)throw Error("Could not find node in hierarchy: "+e);if(!("metaGraph"in t))return null;const n=t;if(n.bridgeGraph)return n.bridgeGraph;const i=sb(iN,Xu.BRIDGE,this.graphOptions);if(n.bridgeGraph=i,!t.parentNode||!("metaGraph"in t.parentNode))return i;const a=t.parentNode;return[a.metaGraph,this.getBridgeGraph(a.name)].forEach(o=>{o.edges().filter(s=>s.v===e||s.w===e).forEach(s=>{const u=s.w===e;o.edge(s).baseEdgeList.forEach(f=>{const[l,c]=u?[f.w,s.v]:[f.v,s.w],h=this.getChildName(e,l),d={v:u?c:h,w:u?h:c};let v=i.edge(d);v||(v=pO(d.v,d.w),v.inbound=u,i.setEdge(d.v,d.w,v)),v.addBaseEdge(f,this)})})}),i}getChildName(e,t){let n=this.index[t];for(;n;){if(n.parentNode&&n.parentNode.name===e)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+t)}getPredecessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!0)}getSuccessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!1)}getOneWayEdges(e,t){const n=[];if(!e.parentNode||!e.parentNode.isGroupNode)return n;const i=e.parentNode,a=i.metaGraph,o=this.getBridgeGraph(i.name);return pS(a,e,t,n),pS(o,e,t,n),n}}function xae(r,e){const{rankDirection:t,align:n}=e,i=new bae({rankdir:t,align:n});return function(a,o){Object.keys(o.nodes).forEach(s=>{const u=o.nodes[s],f=u.path;let l=a.root;l.depth=Math.max(f.length,l.depth);for(let c=0;c<f.length&&(l.depth=Math.max(l.depth,f.length-c),l.cardinality+=u.cardinality,c!==f.length-1);c++){const h=f[c];let d=a.node(h);d||(d=vO(h,a.graphOptions),d.path=u.path.slice(0,c+1),d.parentNode=l,a.setNode(h,d),l.metaGraph.setNode(h,d)),l=d}a.setNode(u.name,u),u.parentNode=l,l.metaGraph.setNode(u.name,u)})}(i,r),function(a,o){const s=a.getNodeMap();let u=[],f=[];const l=(c,h)=>{let d=0;for(;c;)h[d++]=c.name,c=c.parentNode;return d-1};o.edges.forEach(c=>{u=[],f=[];let h=l(o.nodes[c.v],u),d=l(o.nodes[c.w],f);for(;u[h]===f[d];)if(h--,d--,h<0||d<0)throw Error("No difference found between ancestor paths.");const v=s[u[h+1]],p=u[h],g=f[d];let y=v.metaGraph.edge(p,g);y||(y=pO(p,g),v.metaGraph.setEdge(p,g,y)),y.addBaseEdge(c,a)})}(i,r),i}function pS(r,e,t,n){(t?r.inEdges(e.name):r.outEdges(e.name)).forEach(i=>{const a=r.edge(i);n.push(a)})}class wae{constructor(e){this.hierarchy=e,this.index={},this.hasSubHierarchy={},this.root=new yS(this.hierarchy.root,this.hierarchy.graphOptions),this.index[e.root.name]=this.root,this.buildSubHierarchy(e.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(e){if(e in this.hasSubHierarchy)return;this.hasSubHierarchy[e]=!0;const t=this.index[e];if(t.node.type!==Bn.META)return;const n=t,i=n.node.metaGraph,a=n.coreGraph;i.nodes().forEach(l=>{const c=this.getOrCreateRenderNodeByName(l);a.setNode(l,c)}),i.edges().forEach(l=>{const c=i.edge(l),h=new gS(c);a.setEdge(l.v,l.w,h)});const o=n.node.parentNode;if(!o)return;const s=this.getRenderNodeByName(o.name),u=(l,...c)=>c.concat([l?"IN":"OUT"]).join("~~"),f=this.hierarchy.getBridgeGraph(e);f.edges().forEach(l=>{const c=f.edge(l),h=!!i.node(l.w),[d,v]=h?[l.w,l.v]:[l.v,l.w],p=w=>{const E=h?{v:w,w:e}:{v:e,w};return s.coreGraph.edge(E)};let g=p(v);g||(g=p(u(h,v,o.name)));const y=u(h,e),m=u(h,v,e);let b=a.node(m);if(!b){let w=a.node(y);if(!w){const _={name:y,type:Bn.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:Is.UNSPECIFIED,inbound:h,attr:{}};w=new hd(_),this.index[y]=w,a.setNode(y,w)}const E={name:m,type:Bn.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:Is.UNSPECIFIED,inbound:h,attr:{}};b=new hd(E),this.index[m]=b,a.setNode(m,b),a.setParent(m,y),w.node.cardinality++}const x=new gS(c);x.adjoiningMetaEdge=g,h?a.setEdge(m,d,x):a.setEdge(d,m,x)})}getOrCreateRenderNodeByName(e){if(!e)return null;if(e in this.index)return this.index[e];const t=this.getNodeByName(e);return t?(this.index[e]=t.isGroupNode?new yS(t,this.hierarchy.graphOptions):new hd(t),this.index[e]):null}getRenderNodeByName(e){return this.index[e]}getNodeByName(e){return this.hierarchy.node(e)}}class hd{constructor(e){this.node=e,this.expanded=!1,this.x=0,this.y=0,this.coreBox={width:0,height:0},this.outboxWidth=0,this.labelOffset=0,this.radius=0,this.labelHeight=0,this.paddingTop=0,this.paddingLeft=0,this.paddingRight=0,this.paddingBottom=0,this.width=e.width||0,this.height=e.height||0,this.displayName=e.name,this.attr=e.attr}}class gS{constructor(e){this.metaEdge=e,this.adjoiningMetaEdge=null,this.weight=1,this.points=[]}}class yS extends hd{constructor(e,t){super(e);const n=e.metaGraph.graph();t.compound=!0,this.coreGraph=sb(n.name,Xu.CORE,t)}}function gO(r,e){r.node.isGroupNode&&function(t,n){const i=Ly(n);t.coreGraph.nodes().map(a=>t.coreGraph.node(a)).forEach(a=>{var o,s,u,f,l,c;const{height:h,width:d}=a;switch(a.node.type){case Bn.NODE:Object.assign(a,i.nodeSize.node),a.height=h||i.nodeSize.node.height,a.width=d||i.nodeSize.node.width;break;case Bn.BRIDGE:Object.assign(a,i.nodeSize.bridge);break;case Bn.META:a.expanded?gO(a,n):(Object.assign(a,i.nodeSize.meta),a.height=i.nodeSize.meta.height,a.width=i.nodeSize.meta.width);break;default:throw Error("Unrecognized node type: "+a.node.type)}if(!a.expanded){const v=a.attr;(function(p,g=!1){if(p.coreBox.width=p.width,p.coreBox.height=p.height,!g){const y=`${p.displayName}`.length,m=3;p.width=Math.max(p.coreBox.width,y*m)}})(a,n&&(a.node.type===0&&!!(!((s=(o=n==null?void 0:n.nodeSize)===null||o===void 0?void 0:o.meta)===null||s===void 0)&&s.width)||a.node.type===1&&(!!(!((f=(u=n==null?void 0:n.nodeSize)===null||u===void 0?void 0:u.node)===null||f===void 0)&&f.width)||!!v.width)||a.node.type===2&&!!(!((c=(l=n==null?void 0:n.nodeSize)===null||l===void 0?void 0:l.bridge)===null||c===void 0)&&c.width)))}})}(r,e),r.node.type===Bn.META&&function(t,n){const i=Ly(n),a=i.subScene.meta;Object.assign(t,a);const{nodeSep:o,rankSep:s,edgeSep:u,align:f}=i.graph.meta,l={nodesep:o,ranksep:s,edgesep:u,align:f};Object.assign(t.coreBox,function(d,v){const{ranksep:p,nodesep:g,edgesep:y,align:m}=v;Object.assign(d.graph(),{ranksep:p,nodesep:g,edgesep:y,align:m});const b=[];if(d.nodes().forEach(M=>{d.node(M).node.type!==Bn.BRIDGE&&b.push(M)}),!b.length)return{width:0,height:0};dae(d);let x=1/0,w=1/0,E=-1/0,_=-1/0;return b.forEach(M=>{const C=d.node(M),S=.5*C.width,A=C.x-S,T=C.x+S;x=A<x?A:x,E=T>E?T:E;const k=.5*C.height,O=C.y-k,F=C.y+k;w=O<w?O:w,_=F>_?F:_}),d.edges().forEach(M=>{const C=d.edge(M),S=d.node(C.metaEdge.v),A=d.node(C.metaEdge.w);if(C.points.length===3&&function(O){let F=mS(O[0],O[1]);for(let D=1;D<O.length-1;D++){const $=mS(O[D],O[D+1]);if(Math.abs($-F)>1)return!1;F=$}return!0}(C.points)){if(S!=null){const O=S.expanded?S.x:$y(S);C.points[0].x=O}if(A!=null){const O=A.expanded?A.x:$y(A);C.points[2].x=O}C.points=[C.points[0],C.points[1]]}const T=C.points[C.points.length-2];A!=null&&(C.points[C.points.length-1]=bS(T,A));const k=C.points[1];S!=null&&(C.points[0]=bS(k,S)),C.points.forEach(O=>{x=O.x<x?O.x:x,E=O.x>E?O.x:E,w=O.y<w?O.y:w,_=O.y>_?O.y:_})}),d.nodes().forEach(M=>{const C=d.node(M);C.x-=x,C.y-=w}),d.edges().forEach(M=>{d.edge(M).points.forEach(C=>{C.x-=x,C.y-=w})}),{width:E-x,height:_-w}}(t.coreGraph,l));let c=0;t.coreGraph.nodeCount()>0&&c++;const h=c<=1?0:c;t.coreBox.width+=h+h,t.coreBox.height=a.labelHeight+t.coreBox.height,t.width=t.coreBox.width+a.paddingLeft+a.paddingRight,t.height=t.paddingTop+t.coreBox.height+t.paddingBottom}(r,e)}function mS(r,e){const t=e.x-r.x,n=e.y-r.y;return 180*Math.atan(n/t)/Math.PI}function $y(r){return r.expanded?r.x:r.x-r.width/2+0+r.coreBox.width/2}function bS(r,e){const t=e.expanded?e.x:$y(e),n=e.y,i=r.x-t,a=r.y-n;let o,s,u=e.expanded?e.width:e.coreBox.width,f=e.expanded?e.height:e.coreBox.height;return Math.abs(a)*u/2>Math.abs(i)*f/2?(a<0&&(f=-f),o=a===0?0:f/2*i/a,s=f/2):(i<0&&(u=-u),o=u/2,s=i===0?0:u/2*a/i),{x:t+o,y:n+s}}function Eae(r,e,t){var n,i,a,o;const s=r.nodes.filter((c,h,d)=>d.findIndex(v=>v.id===c.id)!==h).map(c=>c.id);if(s.length)throw new Error(`Duplicated ids found: ${s.join(", ")}`);const u=function(c){const h={nodes:[]},d=c.compound,v=Object.keys(d||{}),p=new Map,g=(m,b=[])=>{if(p.has(m))return p.get(m);for(let x=0;x<v.length;x++){let w=v[x];if(d&&d[w].indexOf(m)!==-1)return b.unshift(w),g(w,b)}return b.length===0&&p.set(m,b),b},y=m=>c.edges.filter(b=>b.w===m).map(b=>({name:b.v}));return c.nodes.forEach(m=>{const b=m.id,x=[...g(b),b];let w=y(b);h.nodes.push({name:b,path:x,inputs:w,width:m.width,height:m.height,attr:Object.assign({},m)})}),h}(r),f=function(c,h){const d=(p,g)=>{for(let y of g.values())if(y.includes(p))return!0;return!1},v=(p,g=[])=>{if(Object.keys(p).length===0)return[...new Set(g)];const y=new Map(Object.keys(p).map(b=>[b,p[b]])),m={};for(let[b,x]of y)d(b,y)?m[b]=x:g=g.concat(b,x);return v(m,g)};return v(c).filter(p=>h.includes(p))}(r.compound||{},(e==null?void 0:e.expanded)||[]),l=function(c,h){return function(d){return new wae(d)}(xae(gae(c),h))}(u,{rankDirection:((i=(n=t==null?void 0:t.graph)===null||n===void 0?void 0:n.meta)===null||i===void 0?void 0:i.rankDir)||(e==null?void 0:e.rankDirection)||Vd.graph.meta.rankDir,align:((o=(a=t==null?void 0:t.graph)===null||a===void 0?void 0:a.meta)===null||o===void 0?void 0:o.align)||Vd.graph.meta.align});return function(c,h){h.forEach(d=>{const v=c.getRenderInfoNodes().find(y=>y.displayName===d);let p=v&&v.node&&v.node.name||"";const g=c.getRenderNodeByName(p);if(!g)throw new Error(`No nodes found: ${p}`);g.expanded=!0,c.buildSubHierarchy(p)})}(l,f),gO(l.root,t),yO(l.root)}function _ae(r,e=!1){const t=JSON.parse(JSON.stringify(r)),n={nodes:[t],edges:[...t.edges]};return t.nodes.forEach(function i(a){(a.type===0||a.type===1)&&n.nodes.push(a),a.type===0&&(n.edges=n.edges.concat(a.edges)),Array.isArray(a.nodes)&&a.nodes.forEach(i)}),e&&n.nodes.forEach(i=>{const a=n.nodes.find(o=>o.id===i.parentNodeName);if(a){const o=a.x-a.width/2+a.paddingLeft,s=a.y-a.height/2+a.labelHeight+a.paddingTop;a.id!==Uu&&(i.x+=o,i.y+=s),i.type===0&&i.edges.forEach(u=>{u.points.forEach(f=>{f.x+=i.x-i.width/2+i.paddingLeft,f.y+=i.y-i.height/2+i.labelHeight+i.paddingTop})})}}),n}function Sae(r,e,t,n){var i,a;let o=[];const s=((i=t.find(c=>c.id===r))===null||i===void 0?void 0:i.path)||[],u=((a=t.find(c=>c.id===e))===null||a===void 0?void 0:a.path)||[],f=[Uu,...s].slice(0,s.length).reverse(),l=[Uu,...u].slice(0,u.length);return f.forEach(c=>{const h=t.find(d=>d.id===c);o=o.concat(h.edges.filter(d=>d.baseEdgeList.some(v=>v.v===((n==null?void 0:n.v)||r)&&v.w===((n==null?void 0:n.w)||e))))}),l.filter(c=>!f.includes(c)).forEach(c=>{const h=t.find(d=>d.id===c);o=o.concat(h.edges.filter(d=>d.baseEdgeList.some(v=>v.v===((n==null?void 0:n.v)||r)&&v.w===((n==null?void 0:n.w)||e))))}),o}function yO(r){const e=r.coreGraph.nodes().map(n=>r.coreGraph.node(n));return Object.assign(Object.assign({},xS(r)),{expanded:r.expanded,nodes:r.expanded?(t=e,t.map(n=>n.node.type===Bn.META?yO(n):xS(n))):[],edges:r.expanded?Mae(r):[]});var t}function xS(r){return{id:r.node.name,name:r.node.name,type:r.node.type,cardinality:r.node.cardinality,attr:r.attr,parentNodeName:r.node.parentNode?r.node.parentNode.name:null,coreBox:Object.assign({},r.coreBox),x:r.x,y:r.y,width:r.width,height:r.height,radius:r.radius,labelHeight:r.labelHeight,labelOffset:r.labelOffset,outboxWidth:r.outboxWidth,paddingLeft:r.paddingLeft,paddingTop:r.paddingTop,paddingRight:r.paddingRight,paddingBottom:r.paddingBottom,path:r.node.path}}function Mae(r){return r.coreGraph.edges().map(e=>({renderInfoEdge:r.coreGraph.edge(e),edge:e})).filter(({renderInfoEdge:e})=>e.metaEdge).map(({edge:e,renderInfoEdge:t})=>{const n=function(i,a){const o=a.points.map(s=>Object.assign({},s));if(a.adjoiningMetaEdge){const s=a.adjoiningMetaEdge.points,u=a.metaEdge.inbound,f=u?s[s.length-1]:s[0],l=o[u?0:o.length-1],c=i.x-i.width/2,h=i.y-i.height/2,d=f.x-c,v=f.y-h,p=-i.paddingLeft,g=-(i.paddingTop+i.labelHeight);l.x=d+p,l.y=v+g}return o}(r,t);return{adjoiningEdge:t.adjoiningMetaEdge?{w:t.adjoiningMetaEdge.metaEdge.w,v:t.adjoiningMetaEdge.metaEdge.v}:null,inbound:t.metaEdge.inbound,w:e.w,v:e.v,points:n,weight:t.weight,baseEdgeList:t.metaEdge.baseEdgeList,parentNodeName:r.node.name}})}const Cae=Object.freeze(Object.defineProperty({__proto__:null,BRIDGE_GRAPH_NAME:iN,get GraphType(){return Xu},get HierarchyNodeType(){return Ny},get InclusionType(){return Is},LAYOUT_CONFIG:Vd,get NodeType(){return Bn},ROOT_NAME:Uu,buildGraph:Eae,flatGraph:_ae,getEdges:Sae,mergeConfig:Ly},Symbol.toStringTag,{value:"Module"})),Aae=va(Cae);var Tae=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ai=xe&&xe.__assign||function(){return Ai=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Ai.apply(this,arguments)},su=xe&&xe.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))};Object.defineProperty(ic,"__esModule",{value:!0});ic.DagreCompoundLayout=void 0;var Iae=zr,ai=Aae,Th=Or(),kae=function(r){Tae(e,r);function e(t){var n=r.call(this)||this;return n.rankdir="TB",n.nodesep=50,n.edgesep=5,n.ranksep=50,n.controlPoints=!0,n.anchorPoint=!0,n.nodes=[],n.edges=[],n.combos=[],n.onLayoutEnd=function(){},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{rankdir:"TB",align:void 0,begin:void 0,nodeSize:void 0,nodesep:50,ranksep:50,controlPoints:!0,anchorPoint:!0}},e.prototype.init=function(t){var n=t.hiddenNodes||[],i=t.hiddenEdges||[],a=t.hiddenCombos||[];this.nodes=this.getDataByOrder((t.nodes||[]).concat(n)),this.edges=this.getDataByOrder((t.edges||[]).concat(i)),this.combos=(t.combos||[]).concat(a.map(function(o){return Ai(Ai({},o),{collapsed:!0})}))},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.edges;if(n){var a=t.getLayoutConfig(),o=a.graphDef,s=a.graphOption,u=a.graphSettings,f=(0,ai.buildGraph)(o,s,u),l=(0,ai.flatGraph)(f,!0);return this.updatePosition(l),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:i}}},e.prototype.getNodePath=function(t){var n=this,i=n.nodes,a=n.combos,o=i.find(function(u){return u.id===t}),s=function(u,f){f===void 0&&(f=[]);var l=a.find(function(c){return c.id===u});return l?(f.unshift(u),l.parentId?s(l.parentId,f):f):f};return o&&o.comboId?s(o.comboId,[t]):[t]},e.prototype.getLayoutConfig=function(){var t,n,i,a=this,o=a.nodes,s=a.edges,u=a.combos,f=a.nodeSize,l=a.rankdir,c=a.align,h=a.edgesep,d=a.nodesep,v=a.ranksep,p=a.settings,g=(u||[]).reduce(function(D,$){var Y=o.filter(function(P){return P.comboId===$.id}).map(function(P){return P.id}),N=(u||[]).filter(function(P){return P.parentId===$.id}).map(function(P){return P.id});return(Y.length||N.length)&&(D[$.id]=su(su([],Y,!0),N,!0)),D},{}),y;f?(0,Th.isArray)(f)?y=function(){return f}:y=function(){return[f,f]}:y=function(D){return D&&D.size?(0,Th.isArray)(D.size)?D.size:(0,Th.isObject)(D.size)?[D.size.width||40,D.size.height||40]:[D.size,D.size]:[40,40]};var m=function(D){return D&&D.size?(0,Th.isArray)(D.size)?D.size:[D.size,D.size]:[80,40]},b=m(u==null?void 0:u[0]),x=b[0],w=b[1],E=(n=(t=a.graphSettings)===null||t===void 0?void 0:t.subScene)===null||n===void 0?void 0:n.meta,_=((i=u.find(function(D){return!D.collapsed}))===null||i===void 0?void 0:i.padding)||[20,20,20,20],M=_[0],C=_[1],S=_[2],A=_[3],T={compound:g,nodes:su([],(o||[]).map(function(D){var $=y(D),Y=$[0],N=$[1];return Ai(Ai({},D),{width:Y,height:N})}),!0),edges:su([],(s||[]).map(function(D){return Ai(Ai({},D),{v:D.source,w:D.target})}),!0)},k={expanded:(u||[]).filter(function(D){return!D.collapsed}).map(function(D){return D.id})},O={graph:{meta:{align:c,rankDir:l,nodeSep:d,edgeSep:h,rankSep:v}},subScene:{meta:{paddingTop:M||(E==null?void 0:E.paddingTop)||20,paddingRight:C||(E==null?void 0:E.paddingRight)||20,paddingBottom:S||(E==null?void 0:E.paddingBottom)||20,paddingLeft:A||(E==null?void 0:E.paddingLeft)||20,labelHeight:0}},nodeSize:{meta:{width:x,height:w}}},F=(0,ai.mergeConfig)(p,Ai({},(0,ai.mergeConfig)(O,ai.LAYOUT_CONFIG)));return a.graphSettings=F,{graphDef:T,graphOption:k,graphSettings:F}},e.prototype.updatePosition=function(t){var n=t.nodes,i=t.edges;this.updateNodePosition(n,i),this.updateEdgePosition(n,i)},e.prototype.getBegin=function(t,n){var i=this,a=i.begin,o=[0,0];if(a){var s=1/0,u=1/0;t.forEach(function(f){s>f.x&&(s=f.x),u>f.y&&(u=f.y)}),n.forEach(function(f){f.points.forEach(function(l){s>l.x&&(s=l.x),u>l.y&&(u=l.y)})}),o[0]=a[0]-s,o[1]=a[1]-u}return o},e.prototype.updateNodePosition=function(t,n){var i=this,a=i.combos,o=i.nodes,s=i.edges,u=i.anchorPoint,f=i.graphSettings,l=this.getBegin(t,n);t.forEach(function(c){var h,d=c.x,v=c.y,p=c.id,g=c.type,y=c.coreBox;if(g===ai.HierarchyNodeType.META&&p!==ai.ROOT_NAME){var m=a.findIndex(function(_){return _.id===p}),b=(h=f==null?void 0:f.subScene)===null||h===void 0?void 0:h.meta;a[m].offsetX=d+l[0],a[m].offsetY=v+l[1],a[m].fixSize=[y.width,y.height],a[m].fixCollapseSize=[y.width,y.height],c.expanded?a[m].padding=[b==null?void 0:b.paddingTop,b==null?void 0:b.paddingRight,b==null?void 0:b.paddingBottom,b==null?void 0:b.paddingLeft]:a[m].padding=[0,0,0,0]}else if(g===ai.HierarchyNodeType.OP){var m=o.findIndex(function(M){return M.id===p});if(o[m].x=d+l[0],o[m].y=v+l[1],u){var x=[],w=n.filter(function(M){return M.v===p}),E=n.filter(function(M){return M.w===p});w.length>0&&w.forEach(function(M){var C=M.points[0],S=(C.x-d)/c.width+.5,A=(C.y-v)/c.height+.5;x.push([S,A]),M.baseEdgeList.forEach(function(T){var k=s.find(function(O){return O.source===T.v&&O.target===T.w});k&&(k.sourceAnchor=x.length-1)})}),E.length>0&&E.forEach(function(M){var C=M.points[M.points.length-1],S=(C.x-d)/c.width+.5,A=(C.y-v)/c.height+.5;x.push([S,A]),M.baseEdgeList.forEach(function(T){var k=s.find(function(O){return O.source===T.v&&O.target===T.w});k&&(k.targetAnchor=x.length-1)})}),o[m].anchorPoints=x.length>0?x:o[m].anchorPoints||[]}}})},e.prototype.updateEdgePosition=function(t,n){var i=this,a=i.combos,o=i.edges,s=i.controlPoints,u=this.getBegin(t,n);s&&(a.forEach(function(f){f.inEdges=[],f.outEdges=[]}),o.forEach(function(f){var l,c,h,d,v=t.find(function(_){return _.id===f.source}),p=t.find(function(_){return _.id===f.target}),g=[],y=[];if(v&&p)y=(0,ai.getEdges)(v==null?void 0:v.id,p==null?void 0:p.id,t);else if(!v||!p){var m=i.getNodePath(f.source),b=i.getNodePath(f.target),x=m.reverse().slice(v?0:1).find(function(_){return t.find(function(M){return M.id===_})}),w=b.reverse().slice(p?0:1).find(function(_){return t.find(function(M){return M.id===_})});v=t.find(function(_){return _.id===x}),p=t.find(function(_){return _.id===w}),y=(0,ai.getEdges)(v==null?void 0:v.id,p==null?void 0:p.id,t,{v:f.source,w:f.target})}if(g=y.reduce(function(_,M){return su(su([],_,!0),M.points.map(function(C){return Ai(Ai({},C),{x:C.x+u[0],y:C.y+u[1]})}),!0)},[]),g=g.slice(1,-1),f.controlPoints=g,(p==null?void 0:p.type)===ai.NodeType.META){var E=a.findIndex(function(_){return _.id===(p==null?void 0:p.id)});if(!a[E]||!((l=a[E].inEdges)===null||l===void 0)&&l.some(function(_){return _.source===v.id&&_.target===p.id}))return;(c=a[E].inEdges)===null||c===void 0||c.push({source:v.id,target:p.id,controlPoints:g})}if((v==null?void 0:v.type)===ai.NodeType.META){var E=a.findIndex(function(M){return M.id===(v==null?void 0:v.id)});if(!a[E]||!((h=a[E].outEdges)===null||h===void 0)&&h.some(function(M){return M.source===v.id&&M.target===p.id}))return;(d=a[E].outEdges)===null||d===void 0||d.push({source:v.id,target:p.id,controlPoints:g})}}))},e.prototype.getType=function(){return"dagreCompound"},e.prototype.getDataByOrder=function(t){return t.every(function(n){return n.layoutOrder!==void 0})||t.forEach(function(n,i){n.layoutOrder=i}),t.sort(function(n,i){return n.layoutOrder-i.layoutOrder})},e}(Iae.Base);ic.DagreCompoundLayout=kae;var ub={},lp={},fb={};const Lae=Object.prototype.toString;function tv(r){const e=Lae.call(r);return e.endsWith("Array]")&&!e.includes("Big")}function Nae(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!tv(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,n=t===void 0?0:t,i=e.toIndex,a=i===void 0?r.length:i;if(n<0||n>=r.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>r.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var o=r[n],s=n+1;s<a;s++)r[s]>o&&(o=r[s]);return o}function Oae(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!tv(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,n=t===void 0?0:t,i=e.toIndex,a=i===void 0?r.length:i;if(n<0||n>=r.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>r.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var o=r[n],s=n+1;s<a;s++)r[s]<o&&(o=r[s]);return o}function wS(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(tv(r)){if(r.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var t;if(e.output!==void 0){if(!tv(e.output))throw new TypeError("output option must be an array if specified");t=e.output}else t=new Array(r.length);var n=Oae(r),i=Nae(r);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var a=e.min,o=a===void 0?e.autoMinMax?n:0:a,s=e.max,u=s===void 0?e.autoMinMax?i:1:s;if(o>=u)throw new RangeError("min option must be smaller than max option");for(var f=(u-o)/(i-n),l=0;l<r.length;l++)t[l]=(r[l]-n)*f+o;return t}const Ih=" ".repeat(2),mO=" ".repeat(4);function Dae(){return bO(this)}function bO(r,e={}){const{maxRows:t=15,maxColumns:n=10,maxNumSize:i=8}=e;return`${r.constructor.name} {
|
|
34
|
-
${Ih}[
|
|
35
|
-
${mO}${Pae(r,t,n,i)}
|
|
36
|
-
${Ih}]
|
|
37
|
-
${Ih}rows: ${r.rows}
|
|
38
|
-
${Ih}columns: ${r.columns}
|
|
39
|
-
}`}function Pae(r,e,t,n){const{rows:i,columns:a}=r,o=Math.min(i,e),s=Math.min(a,t),u=[];for(let f=0;f<o;f++){let l=[];for(let c=0;c<s;c++)l.push(Rae(r.get(f,c),n));u.push(`${l.join(" ")}`)}return s!==a&&(u[u.length-1]+=` ... ${a-t} more columns`),o!==i&&u.push(`... ${i-e} more rows`),u.join(`
|
|
40
|
-
${mO}`)}function Rae(r,e){const t=String(r);if(t.length<=e)return t.padEnd(e," ");const n=r.toPrecision(e-2);if(n.length<=e)return n;const i=r.toExponential(e-2),a=i.indexOf("e"),o=i.slice(a);return i.slice(0,e-o.length)+o}function Bae(r,e){r.prototype.add=function(n){return typeof n=="number"?this.addS(n):this.addM(n)},r.prototype.addS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)+n);return this},r.prototype.addM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)+n.get(i,a));return this},r.add=function(n,i){return new e(n).add(i)},r.prototype.sub=function(n){return typeof n=="number"?this.subS(n):this.subM(n)},r.prototype.subS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)-n);return this},r.prototype.subM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)-n.get(i,a));return this},r.sub=function(n,i){return new e(n).sub(i)},r.prototype.subtract=r.prototype.sub,r.prototype.subtractS=r.prototype.subS,r.prototype.subtractM=r.prototype.subM,r.subtract=r.sub,r.prototype.mul=function(n){return typeof n=="number"?this.mulS(n):this.mulM(n)},r.prototype.mulS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)*n);return this},r.prototype.mulM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)*n.get(i,a));return this},r.mul=function(n,i){return new e(n).mul(i)},r.prototype.multiply=r.prototype.mul,r.prototype.multiplyS=r.prototype.mulS,r.prototype.multiplyM=r.prototype.mulM,r.multiply=r.mul,r.prototype.div=function(n){return typeof n=="number"?this.divS(n):this.divM(n)},r.prototype.divS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)/n);return this},r.prototype.divM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)/n.get(i,a));return this},r.div=function(n,i){return new e(n).div(i)},r.prototype.divide=r.prototype.div,r.prototype.divideS=r.prototype.divS,r.prototype.divideM=r.prototype.divM,r.divide=r.div,r.prototype.mod=function(n){return typeof n=="number"?this.modS(n):this.modM(n)},r.prototype.modS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)%n);return this},r.prototype.modM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)%n.get(i,a));return this},r.mod=function(n,i){return new e(n).mod(i)},r.prototype.modulus=r.prototype.mod,r.prototype.modulusS=r.prototype.modS,r.prototype.modulusM=r.prototype.modM,r.modulus=r.mod,r.prototype.and=function(n){return typeof n=="number"?this.andS(n):this.andM(n)},r.prototype.andS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)&n);return this},r.prototype.andM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)&n.get(i,a));return this},r.and=function(n,i){return new e(n).and(i)},r.prototype.or=function(n){return typeof n=="number"?this.orS(n):this.orM(n)},r.prototype.orS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)|n);return this},r.prototype.orM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)|n.get(i,a));return this},r.or=function(n,i){return new e(n).or(i)},r.prototype.xor=function(n){return typeof n=="number"?this.xorS(n):this.xorM(n)},r.prototype.xorS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)^n);return this},r.prototype.xorM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)^n.get(i,a));return this},r.xor=function(n,i){return new e(n).xor(i)},r.prototype.leftShift=function(n){return typeof n=="number"?this.leftShiftS(n):this.leftShiftM(n)},r.prototype.leftShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)<<n);return this},r.prototype.leftShiftM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)<<n.get(i,a));return this},r.leftShift=function(n,i){return new e(n).leftShift(i)},r.prototype.signPropagatingRightShift=function(n){return typeof n=="number"?this.signPropagatingRightShiftS(n):this.signPropagatingRightShiftM(n)},r.prototype.signPropagatingRightShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>n);return this},r.prototype.signPropagatingRightShiftM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>n.get(i,a));return this},r.signPropagatingRightShift=function(n,i){return new e(n).signPropagatingRightShift(i)},r.prototype.rightShift=function(n){return typeof n=="number"?this.rightShiftS(n):this.rightShiftM(n)},r.prototype.rightShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>>n);return this},r.prototype.rightShiftM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>>n.get(i,a));return this},r.rightShift=function(n,i){return new e(n).rightShift(i)},r.prototype.zeroFillRightShift=r.prototype.rightShift,r.prototype.zeroFillRightShiftS=r.prototype.rightShiftS,r.prototype.zeroFillRightShiftM=r.prototype.rightShiftM,r.zeroFillRightShift=r.rightShift,r.prototype.not=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,~this.get(n,i));return this},r.not=function(n){return new e(n).not()},r.prototype.abs=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.abs(this.get(n,i)));return this},r.abs=function(n){return new e(n).abs()},r.prototype.acos=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.acos(this.get(n,i)));return this},r.acos=function(n){return new e(n).acos()},r.prototype.acosh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.acosh(this.get(n,i)));return this},r.acosh=function(n){return new e(n).acosh()},r.prototype.asin=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.asin(this.get(n,i)));return this},r.asin=function(n){return new e(n).asin()},r.prototype.asinh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.asinh(this.get(n,i)));return this},r.asinh=function(n){return new e(n).asinh()},r.prototype.atan=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.atan(this.get(n,i)));return this},r.atan=function(n){return new e(n).atan()},r.prototype.atanh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.atanh(this.get(n,i)));return this},r.atanh=function(n){return new e(n).atanh()},r.prototype.cbrt=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cbrt(this.get(n,i)));return this},r.cbrt=function(n){return new e(n).cbrt()},r.prototype.ceil=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.ceil(this.get(n,i)));return this},r.ceil=function(n){return new e(n).ceil()},r.prototype.clz32=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.clz32(this.get(n,i)));return this},r.clz32=function(n){return new e(n).clz32()},r.prototype.cos=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cos(this.get(n,i)));return this},r.cos=function(n){return new e(n).cos()},r.prototype.cosh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cosh(this.get(n,i)));return this},r.cosh=function(n){return new e(n).cosh()},r.prototype.exp=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.exp(this.get(n,i)));return this},r.exp=function(n){return new e(n).exp()},r.prototype.expm1=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.expm1(this.get(n,i)));return this},r.expm1=function(n){return new e(n).expm1()},r.prototype.floor=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.floor(this.get(n,i)));return this},r.floor=function(n){return new e(n).floor()},r.prototype.fround=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.fround(this.get(n,i)));return this},r.fround=function(n){return new e(n).fround()},r.prototype.log=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log(this.get(n,i)));return this},r.log=function(n){return new e(n).log()},r.prototype.log1p=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log1p(this.get(n,i)));return this},r.log1p=function(n){return new e(n).log1p()},r.prototype.log10=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log10(this.get(n,i)));return this},r.log10=function(n){return new e(n).log10()},r.prototype.log2=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log2(this.get(n,i)));return this},r.log2=function(n){return new e(n).log2()},r.prototype.round=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.round(this.get(n,i)));return this},r.round=function(n){return new e(n).round()},r.prototype.sign=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sign(this.get(n,i)));return this},r.sign=function(n){return new e(n).sign()},r.prototype.sin=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sin(this.get(n,i)));return this},r.sin=function(n){return new e(n).sin()},r.prototype.sinh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sinh(this.get(n,i)));return this},r.sinh=function(n){return new e(n).sinh()},r.prototype.sqrt=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sqrt(this.get(n,i)));return this},r.sqrt=function(n){return new e(n).sqrt()},r.prototype.tan=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.tan(this.get(n,i)));return this},r.tan=function(n){return new e(n).tan()},r.prototype.tanh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.tanh(this.get(n,i)));return this},r.tanh=function(n){return new e(n).tanh()},r.prototype.trunc=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.trunc(this.get(n,i)));return this},r.trunc=function(n){return new e(n).trunc()},r.pow=function(n,i){return new e(n).pow(i)},r.prototype.pow=function(n){return typeof n=="number"?this.powS(n):this.powM(n)},r.prototype.powS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,Math.pow(this.get(i,a),n));return this},r.prototype.powM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,Math.pow(this.get(i,a),n.get(i,a)));return this}}function li(r,e,t){let n=t?r.rows:r.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function ci(r,e,t){let n=t?r.columns:r.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function mu(r,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==r.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function bu(r,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==r.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function xO(r,e,t){return{row:wO(r,e),column:EO(r,t)}}function wO(r,e){if(typeof e!="object")throw new TypeError("unexpected type for row indices");if(e.some(n=>n<0||n>=r.rows))throw new RangeError("row indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function EO(r,e){if(typeof e!="object")throw new TypeError("unexpected type for column indices");if(e.some(n=>n<0||n>=r.columns))throw new RangeError("column indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function jy(r,e,t,n,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(kh("startRow",e),kh("endRow",t),kh("startColumn",n),kh("endColumn",i),e>t||n>i||e<0||e>=r.rows||t<0||t>=r.rows||n<0||n>=r.columns||i<0||i>=r.columns)throw new RangeError("Submatrix indices are out of range")}function cp(r,e=0){let t=[];for(let n=0;n<r;n++)t.push(e);return t}function kh(r,e){if(typeof e!="number")throw new TypeError(`${r} must be a number`)}function Fae(r){let e=cp(r.rows);for(let t=0;t<r.rows;++t)for(let n=0;n<r.columns;++n)e[t]+=r.get(t,n);return e}function Gae(r){let e=cp(r.columns);for(let t=0;t<r.rows;++t)for(let n=0;n<r.columns;++n)e[n]+=r.get(t,n);return e}function zae(r){let e=0;for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)e+=r.get(t,n);return e}function $ae(r){let e=cp(r.rows,1);for(let t=0;t<r.rows;++t)for(let n=0;n<r.columns;++n)e[t]*=r.get(t,n);return e}function jae(r){let e=cp(r.columns,1);for(let t=0;t<r.rows;++t)for(let n=0;n<r.columns;++n)e[n]*=r.get(t,n);return e}function Uae(r){let e=1;for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)e*=r.get(t,n);return e}function Xae(r,e,t){const n=r.rows,i=r.columns,a=[];for(let o=0;o<n;o++){let s=0,u=0,f=0;for(let l=0;l<i;l++)f=r.get(o,l)-t[o],s+=f,u+=f*f;e?a.push((u-s*s/i)/(i-1)):a.push((u-s*s/i)/i)}return a}function Yae(r,e,t){const n=r.rows,i=r.columns,a=[];for(let o=0;o<i;o++){let s=0,u=0,f=0;for(let l=0;l<n;l++)f=r.get(l,o)-t[o],s+=f,u+=f*f;e?a.push((u-s*s/n)/(n-1)):a.push((u-s*s/n)/n)}return a}function Wae(r,e,t){const n=r.rows,i=r.columns,a=n*i;let o=0,s=0,u=0;for(let f=0;f<n;f++)for(let l=0;l<i;l++)u=r.get(f,l)-t,o+=u,s+=u*u;return e?(s-o*o/a)/(a-1):(s-o*o/a)/a}function Vae(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)-e[t])}function Hae(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)-e[n])}function qae(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)-e)}function Zae(r){const e=[];for(let t=0;t<r.rows;t++){let n=0;for(let i=0;i<r.columns;i++)n+=Math.pow(r.get(t,i),2)/(r.columns-1);e.push(Math.sqrt(n))}return e}function Kae(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)/e[t])}function Qae(r){const e=[];for(let t=0;t<r.columns;t++){let n=0;for(let i=0;i<r.rows;i++)n+=Math.pow(r.get(i,t),2)/(r.rows-1);e.push(Math.sqrt(n))}return e}function Jae(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)/e[n])}function eoe(r){const e=r.size-1;let t=0;for(let n=0;n<r.columns;n++)for(let i=0;i<r.rows;i++)t+=Math.pow(r.get(i,n),2)/e;return Math.sqrt(t)}function toe(r,e){for(let t=0;t<r.rows;t++)for(let n=0;n<r.columns;n++)r.set(t,n,r.get(t,n)/e)}class qt{static from1DArray(e,t,n){if(e*t!==n.length)throw new RangeError("data length does not match given dimensions");let a=new dt(e,t);for(let o=0;o<e;o++)for(let s=0;s<t;s++)a.set(o,s,n[o*t+s]);return a}static rowVector(e){let t=new dt(1,e.length);for(let n=0;n<e.length;n++)t.set(0,n,e[n]);return t}static columnVector(e){let t=new dt(e.length,1);for(let n=0;n<e.length;n++)t.set(n,0,e[n]);return t}static zeros(e,t){return new dt(e,t)}static ones(e,t){return new dt(e,t).fill(1)}static rand(e,t,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{random:i=Math.random}=n;let a=new dt(e,t);for(let o=0;o<e;o++)for(let s=0;s<t;s++)a.set(o,s,i());return a}static randInt(e,t,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{min:i=0,max:a=1e3,random:o=Math.random}=n;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");let s=a-i,u=new dt(e,t);for(let f=0;f<e;f++)for(let l=0;l<t;l++){let c=i+Math.round(o()*s);u.set(f,l,c)}return u}static eye(e,t,n){t===void 0&&(t=e),n===void 0&&(n=1);let i=Math.min(e,t),a=this.zeros(e,t);for(let o=0;o<i;o++)a.set(o,o,n);return a}static diag(e,t,n){let i=e.length;t===void 0&&(t=i),n===void 0&&(n=t);let a=Math.min(i,t,n),o=this.zeros(t,n);for(let s=0;s<a;s++)o.set(s,s,e[s]);return o}static min(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let n=e.rows,i=e.columns,a=new dt(n,i);for(let o=0;o<n;o++)for(let s=0;s<i;s++)a.set(o,s,Math.min(e.get(o,s),t.get(o,s)));return a}static max(e,t){e=this.checkMatrix(e),t=this.checkMatrix(t);let n=e.rows,i=e.columns,a=new this(n,i);for(let o=0;o<n;o++)for(let s=0;s<i;s++)a.set(o,s,Math.max(e.get(o,s),t.get(o,s)));return a}static checkMatrix(e){return qt.isMatrix(e)?e:new dt(e)}static isMatrix(e){return e!=null&&e.klass==="Matrix"}get size(){return this.rows*this.columns}apply(e){if(typeof e!="function")throw new TypeError("callback must be a function");for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.call(this,t,n);return this}to1DArray(){let e=[];for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}to2DArray(){let e=[];for(let t=0;t<this.rows;t++){e.push([]);for(let n=0;n<this.columns;n++)e[t].push(this.get(t,n))}return e}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isSymmetric(){if(this.isSquare()){for(let e=0;e<this.rows;e++)for(let t=0;t<=e;t++)if(this.get(e,t)!==this.get(t,e))return!1;return!0}return!1}isEchelonForm(){let e=0,t=0,n=-1,i=!0,a=!1;for(;e<this.rows&&i;){for(t=0,a=!1;t<this.columns&&a===!1;)this.get(e,t)===0?t++:this.get(e,t)===1&&t>n?(a=!0,n=t):(i=!1,a=!0);e++}return i}isReducedEchelonForm(){let e=0,t=0,n=-1,i=!0,a=!1;for(;e<this.rows&&i;){for(t=0,a=!1;t<this.columns&&a===!1;)this.get(e,t)===0?t++:this.get(e,t)===1&&t>n?(a=!0,n=t):(i=!1,a=!0);for(let o=t+1;o<this.rows;o++)this.get(e,o)!==0&&(i=!1);e++}return i}echelonForm(){let e=this.clone(),t=0,n=0;for(;t<e.rows&&n<e.columns;){let i=t;for(let a=t;a<e.rows;a++)e.get(a,n)>e.get(i,n)&&(i=a);if(e.get(i,n)===0)n++;else{e.swapRows(t,i);let a=e.get(t,n);for(let o=n;o<e.columns;o++)e.set(t,o,e.get(t,o)/a);for(let o=t+1;o<e.rows;o++){let s=e.get(o,n)/e.get(t,n);e.set(o,n,0);for(let u=n+1;u<e.columns;u++)e.set(o,u,e.get(o,u)-e.get(t,u)*s)}t++,n++}}return e}reducedEchelonForm(){let e=this.echelonForm(),t=e.columns,n=e.rows,i=n-1;for(;i>=0;)if(e.maxRow(i)===0)i--;else{let a=0,o=!1;for(;a<n&&o===!1;)e.get(i,a)===1?o=!0:a++;for(let s=0;s<i;s++){let u=e.get(s,a);for(let f=a;f<t;f++){let l=e.get(s,f)-u*e.get(i,f);e.set(s,f,l)}}i--}return e}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{rows:t=1,columns:n=1}=e;if(!Number.isInteger(t)||t<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let i=new dt(this.rows*t,this.columns*n);for(let a=0;a<t;a++)for(let o=0;o<n;o++)i.setSubMatrix(this,this.rows*a,this.columns*o);return i}fill(e){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,e);return this}neg(){return this.mulS(-1)}getRow(e){li(this,e);let t=[];for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}getRowVector(e){return dt.rowVector(this.getRow(e))}setRow(e,t){li(this,e),t=mu(this,t);for(let n=0;n<this.columns;n++)this.set(e,n,t[n]);return this}swapRows(e,t){li(this,e),li(this,t);for(let n=0;n<this.columns;n++){let i=this.get(e,n);this.set(e,n,this.get(t,n)),this.set(t,n,i)}return this}getColumn(e){ci(this,e);let t=[];for(let n=0;n<this.rows;n++)t.push(this.get(n,e));return t}getColumnVector(e){return dt.columnVector(this.getColumn(e))}setColumn(e,t){ci(this,e),t=bu(this,t);for(let n=0;n<this.rows;n++)this.set(n,e,t[n]);return this}swapColumns(e,t){ci(this,e),ci(this,t);for(let n=0;n<this.rows;n++){let i=this.get(n,e);this.set(n,e,this.get(n,t)),this.set(n,t,i)}return this}addRowVector(e){e=mu(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e[n]);return this}subRowVector(e){e=mu(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e[n]);return this}mulRowVector(e){e=mu(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e[n]);return this}divRowVector(e){e=mu(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e[n]);return this}addColumnVector(e){e=bu(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)+e[t]);return this}subColumnVector(e){e=bu(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)-e[t]);return this}mulColumnVector(e){e=bu(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e[t]);return this}divColumnVector(e){e=bu(this,e);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)/e[t]);return this}mulRow(e,t){li(this,e);for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this}mulColumn(e,t){ci(this,e);for(let n=0;n<this.rows;n++)this.set(n,e,this.get(n,e)*t);return this}max(){let e=this.get(0,0);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxIndex(){let e=this.get(0,0),t=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e&&(e=this.get(n,i),t[0]=n,t[1]=i);return t}min(){let e=this.get(0,0);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minIndex(){let e=this.get(0,0),t=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<e&&(e=this.get(n,i),t[0]=n,t[1]=i);return t}maxRow(e){li(this,e);let t=this.get(e,0);for(let n=1;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}maxRowIndex(e){li(this,e);let t=this.get(e,0),n=[e,0];for(let i=1;i<this.columns;i++)this.get(e,i)>t&&(t=this.get(e,i),n[1]=i);return n}minRow(e){li(this,e);let t=this.get(e,0);for(let n=1;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}minRowIndex(e){li(this,e);let t=this.get(e,0),n=[e,0];for(let i=1;i<this.columns;i++)this.get(e,i)<t&&(t=this.get(e,i),n[1]=i);return n}maxColumn(e){ci(this,e);let t=this.get(0,e);for(let n=1;n<this.rows;n++)this.get(n,e)>t&&(t=this.get(n,e));return t}maxColumnIndex(e){ci(this,e);let t=this.get(0,e),n=[0,e];for(let i=1;i<this.rows;i++)this.get(i,e)>t&&(t=this.get(i,e),n[0]=i);return n}minColumn(e){ci(this,e);let t=this.get(0,e);for(let n=1;n<this.rows;n++)this.get(n,e)<t&&(t=this.get(n,e));return t}minColumnIndex(e){ci(this,e);let t=this.get(0,e),n=[0,e];for(let i=1;i<this.rows;i++)this.get(i,e)<t&&(t=this.get(i,e),n[0]=i);return n}diag(){let e=Math.min(this.rows,this.columns),t=[];for(let n=0;n<e;n++)t.push(this.get(n,n));return t}norm(e="frobenius"){let t=0;if(e==="max")return this.max();if(e==="frobenius"){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)t=t+this.get(n,i)*this.get(n,i);return Math.sqrt(t)}else throw new RangeError(`unknown norm type: ${e}`)}cumulativeSum(){let e=0;for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e+=this.get(t,n),this.set(t,n,e);return this}dot(e){qt.isMatrix(e)&&(e=e.to1DArray());let t=this.to1DArray();if(t.length!==e.length)throw new RangeError("vectors do not have the same size");let n=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i];return n}mmul(e){e=dt.checkMatrix(e);let t=this.rows,n=this.columns,i=e.columns,a=new dt(t,i),o=new Float64Array(n);for(let s=0;s<i;s++){for(let u=0;u<n;u++)o[u]=e.get(u,s);for(let u=0;u<t;u++){let f=0;for(let l=0;l<n;l++)f+=this.get(u,l)*o[l];a.set(u,s,f)}}return a}strassen2x2(e){e=dt.checkMatrix(e);let t=new dt(2,2);const n=this.get(0,0),i=e.get(0,0),a=this.get(0,1),o=e.get(0,1),s=this.get(1,0),u=e.get(1,0),f=this.get(1,1),l=e.get(1,1),c=(n+f)*(i+l),h=(s+f)*i,d=n*(o-l),v=f*(u-i),p=(n+a)*l,g=(s-n)*(i+o),y=(a-f)*(u+l),m=c+v-p+y,b=d+p,x=h+v,w=c-h+d+g;return t.set(0,0,m),t.set(0,1,b),t.set(1,0,x),t.set(1,1,w),t}strassen3x3(e){e=dt.checkMatrix(e);let t=new dt(3,3);const n=this.get(0,0),i=this.get(0,1),a=this.get(0,2),o=this.get(1,0),s=this.get(1,1),u=this.get(1,2),f=this.get(2,0),l=this.get(2,1),c=this.get(2,2),h=e.get(0,0),d=e.get(0,1),v=e.get(0,2),p=e.get(1,0),g=e.get(1,1),y=e.get(1,2),m=e.get(2,0),b=e.get(2,1),x=e.get(2,2),w=(n+i+a-o-s-l-c)*g,E=(n-o)*(-d+g),_=s*(-h+d+p-g-y-m+x),M=(-n+o+s)*(h-d+g),C=(o+s)*(-h+d),S=n*h,A=(-n+f+l)*(h-v+y),T=(-n+f)*(v-y),k=(f+l)*(-h+v),O=(n+i+a-s-u-f-l)*y,F=l*(-h+v+p-g-y-m+b),D=(-a+l+c)*(g+m-b),$=(a-c)*(g-b),Y=a*m,N=(l+c)*(-m+b),P=(-a+s+u)*(y+m-x),W=(a-u)*(y-x),J=(s+u)*(-m+x),te=i*p,H=u*b,pe=o*v,Te=f*d,Ne=c*x,Ze=S+Y+te,at=w+M+C+S+D+Y+N,nt=S+A+k+O+Y+P+J,_t=E+_+M+S+Y+P+W,St=E+M+C+S+H,fr=Y+P+W+J+pe,Ft=S+A+T+F+D+$+Y,Yt=D+$+Y+N+Te,dr=S+A+T+k+Ne;return t.set(0,0,Ze),t.set(0,1,at),t.set(0,2,nt),t.set(1,0,_t),t.set(1,1,St),t.set(1,2,fr),t.set(2,0,Ft),t.set(2,1,Yt),t.set(2,2,dr),t}mmulStrassen(e){e=dt.checkMatrix(e);let t=this.clone(),n=t.rows,i=t.columns,a=e.rows,o=e.columns;i!==a&&console.warn(`Multiplying ${n} x ${i} and ${a} x ${o} matrix: dimensions do not match.`);function s(c,h,d){let v=c.rows,p=c.columns;if(v===h&&p===d)return c;{let g=qt.zeros(h,d);return g=g.setSubMatrix(c,0,0),g}}let u=Math.max(n,a),f=Math.max(i,o);t=s(t,u,f),e=s(e,u,f);function l(c,h,d,v){if(d<=512||v<=512)return c.mmul(h);d%2===1&&v%2===1?(c=s(c,d+1,v+1),h=s(h,d+1,v+1)):d%2===1?(c=s(c,d+1,v),h=s(h,d+1,v)):v%2===1&&(c=s(c,d,v+1),h=s(h,d,v+1));let p=parseInt(c.rows/2,10),g=parseInt(c.columns/2,10),y=c.subMatrix(0,p-1,0,g-1),m=h.subMatrix(0,p-1,0,g-1),b=c.subMatrix(0,p-1,g,c.columns-1),x=h.subMatrix(0,p-1,g,h.columns-1),w=c.subMatrix(p,c.rows-1,0,g-1),E=h.subMatrix(p,h.rows-1,0,g-1),_=c.subMatrix(p,c.rows-1,g,c.columns-1),M=h.subMatrix(p,h.rows-1,g,h.columns-1),C=l(qt.add(y,_),qt.add(m,M),p,g),S=l(qt.add(w,_),m,p,g),A=l(y,qt.sub(x,M),p,g),T=l(_,qt.sub(E,m),p,g),k=l(qt.add(y,b),M,p,g),O=l(qt.sub(w,y),qt.add(m,x),p,g),F=l(qt.sub(b,_),qt.add(E,M),p,g),D=qt.add(C,T);D.sub(k),D.add(F);let $=qt.add(A,k),Y=qt.add(S,T),N=qt.sub(C,S);N.add(A),N.add(O);let P=qt.zeros(2*D.rows,2*D.columns);return P=P.setSubMatrix(D,0,0),P=P.setSubMatrix($,D.rows,0),P=P.setSubMatrix(Y,0,D.columns),P=P.setSubMatrix(N,D.rows,D.columns),P.subMatrix(0,d-1,0,v-1)}return l(t,e,u,f)}scaleRows(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:n=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(t>=n)throw new RangeError("min must be smaller than max");let i=new dt(this.rows,this.columns);for(let a=0;a<this.rows;a++){const o=this.getRow(a);wS(o,{min:t,max:n,output:o}),i.setRow(a,o)}return i}scaleColumns(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:n=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(t>=n)throw new RangeError("min must be smaller than max");let i=new dt(this.rows,this.columns);for(let a=0;a<this.columns;a++){const o=this.getColumn(a);wS(o,{min:t,max:n,output:o}),i.setColumn(a,o)}return i}flipRows(){const e=Math.ceil(this.columns/2);for(let t=0;t<this.rows;t++)for(let n=0;n<e;n++){let i=this.get(t,n),a=this.get(t,this.columns-1-n);this.set(t,n,a),this.set(t,this.columns-1-n,i)}return this}flipColumns(){const e=Math.ceil(this.rows/2);for(let t=0;t<this.columns;t++)for(let n=0;n<e;n++){let i=this.get(n,t),a=this.get(this.rows-1-n,t);this.set(n,t,a),this.set(this.rows-1-n,t,i)}return this}kroneckerProduct(e){e=dt.checkMatrix(e);let t=this.rows,n=this.columns,i=e.rows,a=e.columns,o=new dt(t*i,n*a);for(let s=0;s<t;s++)for(let u=0;u<n;u++)for(let f=0;f<i;f++)for(let l=0;l<a;l++)o.set(i*s+f,a*u+l,this.get(s,u)*e.get(f,l));return o}transpose(){let e=new dt(this.columns,this.rows);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.set(n,t,this.get(t,n));return e}sortRows(e=ES){for(let t=0;t<this.rows;t++)this.setRow(t,this.getRow(t).sort(e));return this}sortColumns(e=ES){for(let t=0;t<this.columns;t++)this.setColumn(t,this.getColumn(t).sort(e));return this}subMatrix(e,t,n,i){jy(this,e,t,n,i);let a=new dt(t-e+1,i-n+1);for(let o=e;o<=t;o++)for(let s=n;s<=i;s++)a.set(o-e,s-n,this.get(o,s));return a}subMatrixRow(e,t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.columns-1),t>n||t<0||t>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let i=new dt(e.length,n-t+1);for(let a=0;a<e.length;a++)for(let o=t;o<=n;o++){if(e[a]<0||e[a]>=this.rows)throw new RangeError(`Row index out of range: ${e[a]}`);i.set(a,o-t,this.get(e[a],o))}return i}subMatrixColumn(e,t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.rows-1),t>n||t<0||t>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let i=new dt(n-t+1,e.length);for(let a=0;a<e.length;a++)for(let o=t;o<=n;o++){if(e[a]<0||e[a]>=this.columns)throw new RangeError(`Column index out of range: ${e[a]}`);i.set(o-t,a,this.get(o,e[a]))}return i}setSubMatrix(e,t,n){e=dt.checkMatrix(e);let i=t+e.rows-1,a=n+e.columns-1;jy(this,t,i,n,a);for(let o=0;o<e.rows;o++)for(let s=0;s<e.columns;s++)this.set(t+o,n+s,e.get(o,s));return this}selection(e,t){let n=xO(this,e,t),i=new dt(e.length,t.length);for(let a=0;a<n.row.length;a++){let o=n.row[a];for(let s=0;s<n.column.length;s++){let u=n.column[s];i.set(a,s,this.get(o,u))}}return i}trace(){let e=Math.min(this.rows,this.columns),t=0;for(let n=0;n<e;n++)t+=this.get(n,n);return t}clone(){let e=new dt(this.rows,this.columns);for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e.set(t,n,this.get(t,n));return e}sum(e){switch(e){case"row":return Fae(this);case"column":return Gae(this);case void 0:return zae(this);default:throw new Error(`invalid option: ${e}`)}}product(e){switch(e){case"row":return $ae(this);case"column":return jae(this);case void 0:return Uae(this);default:throw new Error(`invalid option: ${e}`)}}mean(e){const t=this.sum(e);switch(e){case"row":{for(let n=0;n<this.rows;n++)t[n]/=this.columns;return t}case"column":{for(let n=0;n<this.columns;n++)t[n]/=this.rows;return t}case void 0:return t/this.size;default:throw new Error(`invalid option: ${e}`)}}variance(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");const{unbiased:n=!0,mean:i=this.mean(e)}=t;if(typeof n!="boolean")throw new TypeError("unbiased must be a boolean");switch(e){case"row":{if(!Array.isArray(i))throw new TypeError("mean must be an array");return Xae(this,n,i)}case"column":{if(!Array.isArray(i))throw new TypeError("mean must be an array");return Yae(this,n,i)}case void 0:{if(typeof i!="number")throw new TypeError("mean must be a number");return Wae(this,n,i)}default:throw new Error(`invalid option: ${e}`)}}standardDeviation(e,t){typeof e=="object"&&(t=e,e=void 0);const n=this.variance(e,t);if(e===void 0)return Math.sqrt(n);for(let i=0;i<n.length;i++)n[i]=Math.sqrt(n[i]);return n}center(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");const{center:n=this.mean(e)}=t;switch(e){case"row":{if(!Array.isArray(n))throw new TypeError("center must be an array");return Vae(this,n),this}case"column":{if(!Array.isArray(n))throw new TypeError("center must be an array");return Hae(this,n),this}case void 0:{if(typeof n!="number")throw new TypeError("center must be a number");return qae(this,n),this}default:throw new Error(`invalid option: ${e}`)}}scale(e,t={}){if(typeof e=="object"&&(t=e,e=void 0),typeof t!="object")throw new TypeError("options must be an object");let n=t.scale;switch(e){case"row":{if(n===void 0)n=Zae(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return Kae(this,n),this}case"column":{if(n===void 0)n=Qae(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return Jae(this,n),this}case void 0:{if(n===void 0)n=eoe(this);else if(typeof n!="number")throw new TypeError("scale must be a number");return toe(this,n),this}default:throw new Error(`invalid option: ${e}`)}}toString(e){return bO(this,e)}}qt.prototype.klass="Matrix";typeof Symbol<"u"&&(qt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Dae);function ES(r,e){return r-e}qt.random=qt.rand;qt.randomInt=qt.randInt;qt.diagonal=qt.diag;qt.prototype.diagonal=qt.prototype.diag;qt.identity=qt.eye;qt.prototype.negate=qt.prototype.neg;qt.prototype.tensorProduct=qt.prototype.kroneckerProduct;class dt extends qt{constructor(e,t){if(super(),dt.isMatrix(e))return e.clone();if(Number.isInteger(e)&&e>0)if(this.data=[],Number.isInteger(t)&&t>0)for(let n=0;n<e;n++)this.data.push(new Float64Array(t));else throw new TypeError("nColumns must be a positive integer");else if(Array.isArray(e)){const n=e;if(e=n.length,t=n[0].length,typeof t!="number"||t===0)throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let i=0;i<e;i++){if(n[i].length!==t)throw new RangeError("Inconsistent array dimensions");this.data.push(Float64Array.from(n[i]))}}else throw new TypeError("First argument must be a positive number or an array");return this.rows=e,this.columns=t,this}set(e,t,n){return this.data[e][t]=n,this}get(e,t){return this.data[e][t]}removeRow(e){if(li(this,e),this.rows===1)throw new RangeError("A matrix cannot have less than one row");return this.data.splice(e,1),this.rows-=1,this}addRow(e,t){return t===void 0&&(t=e,e=this.rows),li(this,e,!0),t=Float64Array.from(mu(this,t)),this.data.splice(e,0,t),this.rows+=1,this}removeColumn(e){if(ci(this,e),this.columns===1)throw new RangeError("A matrix cannot have less than one column");for(let t=0;t<this.rows;t++){const n=new Float64Array(this.columns-1);for(let i=0;i<e;i++)n[i]=this.data[t][i];for(let i=e+1;i<this.columns;i++)n[i-1]=this.data[t][i];this.data[t]=n}return this.columns-=1,this}addColumn(e,t){typeof t>"u"&&(t=e,e=this.columns),ci(this,e,!0),t=bu(this,t);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns+1);let a=0;for(;a<e;a++)i[a]=this.data[n][a];for(i[a++]=t[n];a<this.columns+1;a++)i[a]=this.data[n][a-1];this.data[n]=i}return this.columns+=1,this}}Bae(qt,dt);class qa extends qt{constructor(e,t,n){super(),this.matrix=e,this.rows=t,this.columns=n}}class roe extends qa{constructor(e,t){ci(e,t),super(e,e.rows,1),this.column=t}set(e,t,n){return this.matrix.set(e,this.column,n),this}get(e){return this.matrix.get(e,this.column)}}class noe extends qa{constructor(e,t){t=EO(e,t),super(e,e.rows,t.length),this.columnIndices=t}set(e,t,n){return this.matrix.set(e,this.columnIndices[t],n),this}get(e,t){return this.matrix.get(e,this.columnIndices[t])}}class ioe extends qa{constructor(e){super(e,e.rows,e.columns)}set(e,t,n){return this.matrix.set(e,this.columns-t-1,n),this}get(e,t){return this.matrix.get(e,this.columns-t-1)}}class aoe extends qa{constructor(e){super(e,e.rows,e.columns)}set(e,t,n){return this.matrix.set(this.rows-e-1,t,n),this}get(e,t){return this.matrix.get(this.rows-e-1,t)}}class ooe extends qa{constructor(e,t){li(e,t),super(e,1,e.columns),this.row=t}set(e,t,n){return this.matrix.set(this.row,t,n),this}get(e,t){return this.matrix.get(this.row,t)}}class soe extends qa{constructor(e,t){t=wO(e,t),super(e,t.length,e.columns),this.rowIndices=t}set(e,t,n){return this.matrix.set(this.rowIndices[e],t,n),this}get(e,t){return this.matrix.get(this.rowIndices[e],t)}}class dd extends qa{constructor(e,t,n){let i=xO(e,t,n);super(e,i.row.length,i.column.length),this.rowIndices=i.row,this.columnIndices=i.column}set(e,t,n){return this.matrix.set(this.rowIndices[e],this.columnIndices[t],n),this}get(e,t){return this.matrix.get(this.rowIndices[e],this.columnIndices[t])}}class uoe extends qa{constructor(e,t,n,i,a){jy(e,t,n,i,a),super(e,n-t+1,a-i+1),this.startRow=t,this.startColumn=i}set(e,t,n){return this.matrix.set(this.startRow+e,this.startColumn+t,n),this}get(e,t){return this.matrix.get(this.startRow+e,this.startColumn+t)}}class foe extends qa{constructor(e){super(e,e.columns,e.rows)}set(e,t,n){return this.matrix.set(t,e,n),this}get(e,t){return this.matrix.get(t,e)}}class _O extends qt{constructor(e,t={}){const{rows:n=1}=t;if(e.length%n!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=e.length/n,this.data=e}set(e,t,n){let i=this._calculateIndex(e,t);return this.data[i]=n,this}get(e,t){let n=this._calculateIndex(e,t);return this.data[n]}_calculateIndex(e,t){return e*this.columns+t}}class ei extends qt{constructor(e){super(),this.data=e,this.rows=e.length,this.columns=e[0].length}set(e,t,n){return this.data[e][t]=n,this}get(e,t){return this.data[e][t]}}function loe(r,e){if(Array.isArray(r))return r[0]&&Array.isArray(r[0])?new ei(r):new _O(r,e);throw new Error("the argument is not an array")}class rv{constructor(e){e=ei.checkMatrix(e);let t=e.clone(),n=t.rows,i=t.columns,a=new Float64Array(n),o=1,s,u,f,l,c,h,d,v,p;for(s=0;s<n;s++)a[s]=s;for(v=new Float64Array(n),u=0;u<i;u++){for(s=0;s<n;s++)v[s]=t.get(s,u);for(s=0;s<n;s++){for(p=Math.min(s,u),c=0,f=0;f<p;f++)c+=t.get(s,f)*v[f];v[s]-=c,t.set(s,u,v[s])}for(l=u,s=u+1;s<n;s++)Math.abs(v[s])>Math.abs(v[l])&&(l=s);if(l!==u){for(f=0;f<i;f++)h=t.get(l,f),t.set(l,f,t.get(u,f)),t.set(u,f,h);d=a[l],a[l]=a[u],a[u]=d,o=-o}if(u<n&&t.get(u,u)!==0)for(s=u+1;s<n;s++)t.set(s,u,t.get(s,u)/t.get(u,u))}this.LU=t,this.pivotVector=a,this.pivotSign=o}isSingular(){let e=this.LU,t=e.columns;for(let n=0;n<t;n++)if(e.get(n,n)===0)return!0;return!1}solve(e){e=dt.checkMatrix(e);let t=this.LU;if(t.rows!==e.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let i=e.columns,a=e.subMatrixRow(this.pivotVector,0,i-1),o=t.columns,s,u,f;for(f=0;f<o;f++)for(s=f+1;s<o;s++)for(u=0;u<i;u++)a.set(s,u,a.get(s,u)-a.get(f,u)*t.get(s,f));for(f=o-1;f>=0;f--){for(u=0;u<i;u++)a.set(f,u,a.get(f,u)/t.get(f,f));for(s=0;s<f;s++)for(u=0;u<i;u++)a.set(s,u,a.get(s,u)-a.get(f,u)*t.get(s,f))}return a}get determinant(){let e=this.LU;if(!e.isSquare())throw new Error("Matrix must be square");let t=this.pivotSign,n=e.columns;for(let i=0;i<n;i++)t*=e.get(i,i);return t}get lowerTriangularMatrix(){let e=this.LU,t=e.rows,n=e.columns,i=new dt(t,n);for(let a=0;a<t;a++)for(let o=0;o<n;o++)a>o?i.set(a,o,e.get(a,o)):a===o?i.set(a,o,1):i.set(a,o,0);return i}get upperTriangularMatrix(){let e=this.LU,t=e.rows,n=e.columns,i=new dt(t,n);for(let a=0;a<t;a++)for(let o=0;o<n;o++)a<=o?i.set(a,o,e.get(a,o)):i.set(a,o,0);return i}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Pa(r,e){let t=0;return Math.abs(r)>Math.abs(e)?(t=e/r,Math.abs(r)*Math.sqrt(1+t*t)):e!==0?(t=r/e,Math.abs(e)*Math.sqrt(1+t*t)):0}class Uy{constructor(e){e=ei.checkMatrix(e);let t=e.clone(),n=e.rows,i=e.columns,a=new Float64Array(i),o,s,u,f;for(u=0;u<i;u++){let l=0;for(o=u;o<n;o++)l=Pa(l,t.get(o,u));if(l!==0){for(t.get(u,u)<0&&(l=-l),o=u;o<n;o++)t.set(o,u,t.get(o,u)/l);for(t.set(u,u,t.get(u,u)+1),s=u+1;s<i;s++){for(f=0,o=u;o<n;o++)f+=t.get(o,u)*t.get(o,s);for(f=-f/t.get(u,u),o=u;o<n;o++)t.set(o,s,t.get(o,s)+f*t.get(o,u))}}a[u]=-l}this.QR=t,this.Rdiag=a}solve(e){e=dt.checkMatrix(e);let t=this.QR,n=t.rows;if(e.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let i=e.columns,a=e.clone(),o=t.columns,s,u,f,l;for(f=0;f<o;f++)for(u=0;u<i;u++){for(l=0,s=f;s<n;s++)l+=t.get(s,f)*a.get(s,u);for(l=-l/t.get(f,f),s=f;s<n;s++)a.set(s,u,a.get(s,u)+l*t.get(s,f))}for(f=o-1;f>=0;f--){for(u=0;u<i;u++)a.set(f,u,a.get(f,u)/this.Rdiag[f]);for(s=0;s<f;s++)for(u=0;u<i;u++)a.set(s,u,a.get(s,u)-a.get(f,u)*t.get(s,f))}return a.subMatrix(0,o-1,0,i-1)}isFullRank(){let e=this.QR.columns;for(let t=0;t<e;t++)if(this.Rdiag[t]===0)return!1;return!0}get upperTriangularMatrix(){let e=this.QR,t=e.columns,n=new dt(t,t),i,a;for(i=0;i<t;i++)for(a=0;a<t;a++)i<a?n.set(i,a,e.get(i,a)):i===a?n.set(i,a,this.Rdiag[i]):n.set(i,a,0);return n}get orthogonalMatrix(){let e=this.QR,t=e.rows,n=e.columns,i=new dt(t,n),a,o,s,u;for(s=n-1;s>=0;s--){for(a=0;a<t;a++)i.set(a,s,0);for(i.set(s,s,1),o=s;o<n;o++)if(e.get(s,s)!==0){for(u=0,a=s;a<t;a++)u+=e.get(a,s)*i.get(a,o);for(u=-u/e.get(s,s),a=s;a<t;a++)i.set(a,o,i.get(a,o)+u*e.get(a,s))}}return i}}class Vu{constructor(e,t={}){e=ei.checkMatrix(e);let n=e.rows,i=e.columns;const{computeLeftSingularVectors:a=!0,computeRightSingularVectors:o=!0,autoTranspose:s=!1}=t;let u=!!a,f=!!o,l=!1,c;if(n<i)if(!s)c=e.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{c=e.transpose(),n=c.rows,i=c.columns,l=!0;let S=u;u=f,f=S}else c=e.clone();let h=Math.min(n,i),d=Math.min(n+1,i),v=new Float64Array(d),p=new dt(n,h),g=new dt(i,i),y=new Float64Array(i),m=new Float64Array(n),b=new Float64Array(d);for(let S=0;S<d;S++)b[S]=S;let x=Math.min(n-1,i),w=Math.max(0,Math.min(i-2,n)),E=Math.max(x,w);for(let S=0;S<E;S++){if(S<x){v[S]=0;for(let A=S;A<n;A++)v[S]=Pa(v[S],c.get(A,S));if(v[S]!==0){c.get(S,S)<0&&(v[S]=-v[S]);for(let A=S;A<n;A++)c.set(A,S,c.get(A,S)/v[S]);c.set(S,S,c.get(S,S)+1)}v[S]=-v[S]}for(let A=S+1;A<i;A++){if(S<x&&v[S]!==0){let T=0;for(let k=S;k<n;k++)T+=c.get(k,S)*c.get(k,A);T=-T/c.get(S,S);for(let k=S;k<n;k++)c.set(k,A,c.get(k,A)+T*c.get(k,S))}y[A]=c.get(S,A)}if(u&&S<x)for(let A=S;A<n;A++)p.set(A,S,c.get(A,S));if(S<w){y[S]=0;for(let A=S+1;A<i;A++)y[S]=Pa(y[S],y[A]);if(y[S]!==0){y[S+1]<0&&(y[S]=0-y[S]);for(let A=S+1;A<i;A++)y[A]/=y[S];y[S+1]+=1}if(y[S]=-y[S],S+1<n&&y[S]!==0){for(let A=S+1;A<n;A++)m[A]=0;for(let A=S+1;A<n;A++)for(let T=S+1;T<i;T++)m[A]+=y[T]*c.get(A,T);for(let A=S+1;A<i;A++){let T=-y[A]/y[S+1];for(let k=S+1;k<n;k++)c.set(k,A,c.get(k,A)+T*m[k])}}if(f)for(let A=S+1;A<i;A++)g.set(A,S,y[A])}}let _=Math.min(i,n+1);if(x<i&&(v[x]=c.get(x,x)),n<_&&(v[_-1]=0),w+1<_&&(y[w]=c.get(w,_-1)),y[_-1]=0,u){for(let S=x;S<h;S++){for(let A=0;A<n;A++)p.set(A,S,0);p.set(S,S,1)}for(let S=x-1;S>=0;S--)if(v[S]!==0){for(let A=S+1;A<h;A++){let T=0;for(let k=S;k<n;k++)T+=p.get(k,S)*p.get(k,A);T=-T/p.get(S,S);for(let k=S;k<n;k++)p.set(k,A,p.get(k,A)+T*p.get(k,S))}for(let A=S;A<n;A++)p.set(A,S,-p.get(A,S));p.set(S,S,1+p.get(S,S));for(let A=0;A<S-1;A++)p.set(A,S,0)}else{for(let A=0;A<n;A++)p.set(A,S,0);p.set(S,S,1)}}if(f)for(let S=i-1;S>=0;S--){if(S<w&&y[S]!==0)for(let A=S+1;A<i;A++){let T=0;for(let k=S+1;k<i;k++)T+=g.get(k,S)*g.get(k,A);T=-T/g.get(S+1,S);for(let k=S+1;k<i;k++)g.set(k,A,g.get(k,A)+T*g.get(k,S))}for(let A=0;A<i;A++)g.set(A,S,0);g.set(S,S,1)}let M=_-1,C=Number.EPSILON;for(;_>0;){let S,A;for(S=_-2;S>=-1&&S!==-1;S--){const T=Number.MIN_VALUE+C*Math.abs(v[S]+Math.abs(v[S+1]));if(Math.abs(y[S])<=T||Number.isNaN(y[S])){y[S]=0;break}}if(S===_-2)A=4;else{let T;for(T=_-1;T>=S&&T!==S;T--){let k=(T!==_?Math.abs(y[T]):0)+(T!==S+1?Math.abs(y[T-1]):0);if(Math.abs(v[T])<=C*k){v[T]=0;break}}T===S?A=3:T===_-1?A=1:(A=2,S=T)}switch(S++,A){case 1:{let T=y[_-2];y[_-2]=0;for(let k=_-2;k>=S;k--){let O=Pa(v[k],T),F=v[k]/O,D=T/O;if(v[k]=O,k!==S&&(T=-D*y[k-1],y[k-1]=F*y[k-1]),f)for(let $=0;$<i;$++)O=F*g.get($,k)+D*g.get($,_-1),g.set($,_-1,-D*g.get($,k)+F*g.get($,_-1)),g.set($,k,O)}break}case 2:{let T=y[S-1];y[S-1]=0;for(let k=S;k<_;k++){let O=Pa(v[k],T),F=v[k]/O,D=T/O;if(v[k]=O,T=-D*y[k],y[k]=F*y[k],u)for(let $=0;$<n;$++)O=F*p.get($,k)+D*p.get($,S-1),p.set($,S-1,-D*p.get($,k)+F*p.get($,S-1)),p.set($,k,O)}break}case 3:{const T=Math.max(Math.abs(v[_-1]),Math.abs(v[_-2]),Math.abs(y[_-2]),Math.abs(v[S]),Math.abs(y[S])),k=v[_-1]/T,O=v[_-2]/T,F=y[_-2]/T,D=v[S]/T,$=y[S]/T,Y=((O+k)*(O-k)+F*F)/2,N=k*F*(k*F);let P=0;(Y!==0||N!==0)&&(Y<0?P=0-Math.sqrt(Y*Y+N):P=Math.sqrt(Y*Y+N),P=N/(Y+P));let W=(D+k)*(D-k)+P,J=D*$;for(let te=S;te<_-1;te++){let H=Pa(W,J);H===0&&(H=Number.MIN_VALUE);let pe=W/H,Te=J/H;if(te!==S&&(y[te-1]=H),W=pe*v[te]+Te*y[te],y[te]=pe*y[te]-Te*v[te],J=Te*v[te+1],v[te+1]=pe*v[te+1],f)for(let Ne=0;Ne<i;Ne++)H=pe*g.get(Ne,te)+Te*g.get(Ne,te+1),g.set(Ne,te+1,-Te*g.get(Ne,te)+pe*g.get(Ne,te+1)),g.set(Ne,te,H);if(H=Pa(W,J),H===0&&(H=Number.MIN_VALUE),pe=W/H,Te=J/H,v[te]=H,W=pe*y[te]+Te*v[te+1],v[te+1]=-Te*y[te]+pe*v[te+1],J=Te*y[te+1],y[te+1]=pe*y[te+1],u&&te<n-1)for(let Ne=0;Ne<n;Ne++)H=pe*p.get(Ne,te)+Te*p.get(Ne,te+1),p.set(Ne,te+1,-Te*p.get(Ne,te)+pe*p.get(Ne,te+1)),p.set(Ne,te,H)}y[_-2]=W;break}case 4:{if(v[S]<=0&&(v[S]=v[S]<0?-v[S]:0,f))for(let T=0;T<=M;T++)g.set(T,S,-g.get(T,S));for(;S<M&&!(v[S]>=v[S+1]);){let T=v[S];if(v[S]=v[S+1],v[S+1]=T,f&&S<i-1)for(let k=0;k<i;k++)T=g.get(k,S+1),g.set(k,S+1,g.get(k,S)),g.set(k,S,T);if(u&&S<n-1)for(let k=0;k<n;k++)T=p.get(k,S+1),p.set(k,S+1,p.get(k,S)),p.set(k,S,T);S++}_--;break}}}if(l){let S=g;g=p,p=S}this.m=n,this.n=i,this.s=v,this.U=p,this.V=g}solve(e){let t=e,n=this.threshold,i=this.s.length,a=dt.zeros(i,i);for(let h=0;h<i;h++)Math.abs(this.s[h])<=n?a.set(h,h,0):a.set(h,h,1/this.s[h]);let o=this.U,s=this.rightSingularVectors,u=s.mmul(a),f=s.rows,l=o.rows,c=dt.zeros(f,l);for(let h=0;h<f;h++)for(let d=0;d<l;d++){let v=0;for(let p=0;p<i;p++)v+=u.get(h,p)*o.get(d,p);c.set(h,d,v)}return c.mmul(t)}solveForDiagonal(e){return this.solve(dt.diag(e))}inverse(){let e=this.V,t=this.threshold,n=e.rows,i=e.columns,a=new dt(n,this.s.length);for(let l=0;l<n;l++)for(let c=0;c<i;c++)Math.abs(this.s[c])>t&&a.set(l,c,e.get(l,c)/this.s[c]);let o=this.U,s=o.rows,u=o.columns,f=new dt(n,s);for(let l=0;l<n;l++)for(let c=0;c<s;c++){let h=0;for(let d=0;d<u;d++)h+=a.get(l,d)*o.get(c,d);f.set(l,c,h)}return f}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let e=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,t=0,n=this.s;for(let i=0,a=n.length;i<a;i++)n[i]>e&&t++;return t}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return dt.diag(this.s)}}function coe(r,e=!1){return r=ei.checkMatrix(r),e?new Vu(r).inverse():SO(r,dt.eye(r.rows))}function SO(r,e,t=!1){return r=ei.checkMatrix(r),e=ei.checkMatrix(e),t?new Vu(r).solve(e):r.isSquare()?new rv(r).solve(e):new Uy(r).solve(e)}function vd(r){if(r=dt.checkMatrix(r),r.isSquare()){let e,t,n,i;if(r.columns===2)return e=r.get(0,0),t=r.get(0,1),n=r.get(1,0),i=r.get(1,1),e*i-t*n;if(r.columns===3){let a,o,s;return a=new dd(r,[1,2],[1,2]),o=new dd(r,[1,2],[0,2]),s=new dd(r,[1,2],[0,1]),e=r.get(0,0),t=r.get(0,1),n=r.get(0,2),e*vd(a)-t*vd(o)+n*vd(s)}else return new rv(r).determinant}else throw Error("determinant can only be calculated for a square matrix")}function hoe(r,e){let t=[];for(let n=0;n<r;n++)n!==e&&t.push(n);return t}function doe(r,e,t,n=1e-9,i=1e-9){if(r>i)return new Array(e.rows+1).fill(0);{let a=e.addRow(t,[0]);for(let o=0;o<a.rows;o++)Math.abs(a.get(o,0))<n&&a.set(o,0,0);return a.to1DArray()}}function voe(r,e={}){const{thresholdValue:t=1e-9,thresholdError:n=1e-9}=e;r=dt.checkMatrix(r);let i=r.rows,a=new dt(i,i);for(let o=0;o<i;o++){let s=dt.columnVector(r.getRow(o)),u=r.subMatrixRow(hoe(i,o)).transpose(),l=new Vu(u).solve(s),c=dt.sub(s,u.mmul(l)).abs().max();a.setRow(o,doe(c,l,o,t,n))}return a}function poe(r,e=Number.EPSILON){r=dt.checkMatrix(r);let t=new Vu(r,{autoTranspose:!0}),n=t.leftSingularVectors,i=t.rightSingularVectors,a=t.diagonal;for(let o=0;o<a.length;o++)Math.abs(a[o])>e?a[o]=1/a[o]:a[o]=0;return i.mmul(dt.diag(a).mmul(n.transpose()))}function goe(r,e=r,t={}){r=new dt(r);let n=!1;if(typeof e=="object"&&!dt.isMatrix(e)&&!Array.isArray(e)?(t=e,e=r,n=!0):e=new dt(e),r.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=t;i&&(r=r.center("column"),n||(e=e.center("column")));const a=r.transpose().mmul(e);for(let o=0;o<a.rows;o++)for(let s=0;s<a.columns;s++)a.set(o,s,a.get(o,s)*(1/(r.rows-1)));return a}function yoe(r,e=r,t={}){r=new dt(r);let n=!1;if(typeof e=="object"&&!dt.isMatrix(e)&&!Array.isArray(e)?(t=e,e=r,n=!0):e=new dt(e),r.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:a=!0}=t;i&&(r.center("column"),n||e.center("column")),a&&(r.scale("column"),n||e.scale("column"));const o=r.standardDeviation("column",{unbiased:!0}),s=n?o:e.standardDeviation("column",{unbiased:!0}),u=r.transpose().mmul(e);for(let f=0;f<u.rows;f++)for(let l=0;l<u.columns;l++)u.set(f,l,u.get(f,l)*(1/(o[f]*s[l]))*(1/(r.rows-1)));return u}class _S{constructor(e,t={}){const{assumeSymmetric:n=!1}=t;if(e=ei.checkMatrix(e),!e.isSquare())throw new Error("Matrix is not a square matrix");let i=e.columns,a=new dt(i,i),o=new Float64Array(i),s=new Float64Array(i),u=e,f,l,c=!1;if(n?c=!0:c=e.isSymmetric(),c){for(f=0;f<i;f++)for(l=0;l<i;l++)a.set(f,l,u.get(f,l));moe(i,s,o,a),boe(i,s,o,a)}else{let h=new dt(i,i),d=new Float64Array(i);for(l=0;l<i;l++)for(f=0;f<i;f++)h.set(f,l,u.get(f,l));xoe(i,h,d,a),woe(i,s,o,a,h)}this.n=i,this.e=s,this.d=o,this.V=a}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let e=this.n,t=this.e,n=this.d,i=new dt(e,e),a,o;for(a=0;a<e;a++){for(o=0;o<e;o++)i.set(a,o,0);i.set(a,a,n[a]),t[a]>0?i.set(a,a+1,t[a]):t[a]<0&&i.set(a,a-1,t[a])}return i}}function moe(r,e,t,n){let i,a,o,s,u,f,l,c;for(u=0;u<r;u++)t[u]=n.get(r-1,u);for(s=r-1;s>0;s--){for(c=0,o=0,f=0;f<s;f++)c=c+Math.abs(t[f]);if(c===0)for(e[s]=t[s-1],u=0;u<s;u++)t[u]=n.get(s-1,u),n.set(s,u,0),n.set(u,s,0);else{for(f=0;f<s;f++)t[f]/=c,o+=t[f]*t[f];for(i=t[s-1],a=Math.sqrt(o),i>0&&(a=-a),e[s]=c*a,o=o-i*a,t[s-1]=i-a,u=0;u<s;u++)e[u]=0;for(u=0;u<s;u++){for(i=t[u],n.set(u,s,i),a=e[u]+n.get(u,u)*i,f=u+1;f<=s-1;f++)a+=n.get(f,u)*t[f],e[f]+=n.get(f,u)*i;e[u]=a}for(i=0,u=0;u<s;u++)e[u]/=o,i+=e[u]*t[u];for(l=i/(o+o),u=0;u<s;u++)e[u]-=l*t[u];for(u=0;u<s;u++){for(i=t[u],a=e[u],f=u;f<=s-1;f++)n.set(f,u,n.get(f,u)-(i*e[f]+a*t[f]));t[u]=n.get(s-1,u),n.set(s,u,0)}}t[s]=o}for(s=0;s<r-1;s++){if(n.set(r-1,s,n.get(s,s)),n.set(s,s,1),o=t[s+1],o!==0){for(f=0;f<=s;f++)t[f]=n.get(f,s+1)/o;for(u=0;u<=s;u++){for(a=0,f=0;f<=s;f++)a+=n.get(f,s+1)*n.get(f,u);for(f=0;f<=s;f++)n.set(f,u,n.get(f,u)-a*t[f])}}for(f=0;f<=s;f++)n.set(f,s+1,0)}for(u=0;u<r;u++)t[u]=n.get(r-1,u),n.set(r-1,u,0);n.set(r-1,r-1,1),e[0]=0}function boe(r,e,t,n){let i,a,o,s,u,f,l,c,h,d,v,p,g,y,m,b;for(o=1;o<r;o++)e[o-1]=e[o];e[r-1]=0;let x=0,w=0,E=Number.EPSILON;for(f=0;f<r;f++){for(w=Math.max(w,Math.abs(t[f])+Math.abs(e[f])),l=f;l<r&&!(Math.abs(e[l])<=E*w);)l++;if(l>f)do{for(i=t[f],c=(t[f+1]-i)/(2*e[f]),h=Pa(c,1),c<0&&(h=-h),t[f]=e[f]/(c+h),t[f+1]=e[f]*(c+h),d=t[f+1],a=i-t[f],o=f+2;o<r;o++)t[o]-=a;for(x=x+a,c=t[l],v=1,p=v,g=v,y=e[f+1],m=0,b=0,o=l-1;o>=f;o--)for(g=p,p=v,b=m,i=v*e[o],a=v*c,h=Pa(c,e[o]),e[o+1]=m*h,m=e[o]/h,v=c/h,c=v*t[o]-m*i,t[o+1]=a+m*(v*i+m*t[o]),u=0;u<r;u++)a=n.get(u,o+1),n.set(u,o+1,m*n.get(u,o)+v*a),n.set(u,o,v*n.get(u,o)-m*a);c=-m*b*g*y*e[f]/d,e[f]=m*c,t[f]=v*c}while(Math.abs(e[f])>E*w);t[f]=t[f]+x,e[f]=0}for(o=0;o<r-1;o++){for(u=o,c=t[o],s=o+1;s<r;s++)t[s]<c&&(u=s,c=t[s]);if(u!==o)for(t[u]=t[o],t[o]=c,s=0;s<r;s++)c=n.get(s,o),n.set(s,o,n.get(s,u)),n.set(s,u,c)}}function xoe(r,e,t,n){let i=0,a=r-1,o,s,u,f,l,c,h;for(c=i+1;c<=a-1;c++){for(h=0,f=c;f<=a;f++)h=h+Math.abs(e.get(f,c-1));if(h!==0){for(u=0,f=a;f>=c;f--)t[f]=e.get(f,c-1)/h,u+=t[f]*t[f];for(s=Math.sqrt(u),t[c]>0&&(s=-s),u=u-t[c]*s,t[c]=t[c]-s,l=c;l<r;l++){for(o=0,f=a;f>=c;f--)o+=t[f]*e.get(f,l);for(o=o/u,f=c;f<=a;f++)e.set(f,l,e.get(f,l)-o*t[f])}for(f=0;f<=a;f++){for(o=0,l=a;l>=c;l--)o+=t[l]*e.get(f,l);for(o=o/u,l=c;l<=a;l++)e.set(f,l,e.get(f,l)-o*t[l])}t[c]=h*t[c],e.set(c,c-1,h*s)}}for(f=0;f<r;f++)for(l=0;l<r;l++)n.set(f,l,f===l?1:0);for(c=a-1;c>=i+1;c--)if(e.get(c,c-1)!==0){for(f=c+1;f<=a;f++)t[f]=e.get(f,c-1);for(l=c;l<=a;l++){for(s=0,f=c;f<=a;f++)s+=t[f]*n.get(f,l);for(s=s/t[c]/e.get(c,c-1),f=c;f<=a;f++)n.set(f,l,n.get(f,l)+s*t[f])}}}function woe(r,e,t,n,i){let a=r-1,o=0,s=r-1,u=Number.EPSILON,f=0,l=0,c=0,h=0,d=0,v=0,p=0,g=0,y,m,b,x,w,E,_,M,C,S,A,T,k,O,F;for(y=0;y<r;y++)for((y<o||y>s)&&(t[y]=i.get(y,y),e[y]=0),m=Math.max(y-1,0);m<r;m++)l=l+Math.abs(i.get(y,m));for(;a>=o;){for(x=a;x>o&&(v=Math.abs(i.get(x-1,x-1))+Math.abs(i.get(x,x)),v===0&&(v=l),!(Math.abs(i.get(x,x-1))<u*v));)x--;if(x===a)i.set(a,a,i.get(a,a)+f),t[a]=i.get(a,a),e[a]=0,a--,g=0;else if(x===a-1){if(_=i.get(a,a-1)*i.get(a-1,a),c=(i.get(a-1,a-1)-i.get(a,a))/2,h=c*c+_,p=Math.sqrt(Math.abs(h)),i.set(a,a,i.get(a,a)+f),i.set(a-1,a-1,i.get(a-1,a-1)+f),M=i.get(a,a),h>=0){for(p=c>=0?c+p:c-p,t[a-1]=M+p,t[a]=t[a-1],p!==0&&(t[a]=M-_/p),e[a-1]=0,e[a]=0,M=i.get(a,a-1),v=Math.abs(M)+Math.abs(p),c=M/v,h=p/v,d=Math.sqrt(c*c+h*h),c=c/d,h=h/d,m=a-1;m<r;m++)p=i.get(a-1,m),i.set(a-1,m,h*p+c*i.get(a,m)),i.set(a,m,h*i.get(a,m)-c*p);for(y=0;y<=a;y++)p=i.get(y,a-1),i.set(y,a-1,h*p+c*i.get(y,a)),i.set(y,a,h*i.get(y,a)-c*p);for(y=o;y<=s;y++)p=n.get(y,a-1),n.set(y,a-1,h*p+c*n.get(y,a)),n.set(y,a,h*n.get(y,a)-c*p)}else t[a-1]=M+c,t[a]=M+c,e[a-1]=p,e[a]=-p;a=a-2,g=0}else{if(M=i.get(a,a),C=0,_=0,x<a&&(C=i.get(a-1,a-1),_=i.get(a,a-1)*i.get(a-1,a)),g===10){for(f+=M,y=o;y<=a;y++)i.set(y,y,i.get(y,y)-M);v=Math.abs(i.get(a,a-1))+Math.abs(i.get(a-1,a-2)),M=C=.75*v,_=-.4375*v*v}if(g===30&&(v=(C-M)/2,v=v*v+_,v>0)){for(v=Math.sqrt(v),C<M&&(v=-v),v=M-_/((C-M)/2+v),y=o;y<=a;y++)i.set(y,y,i.get(y,y)-v);f+=v,M=C=_=.964}for(g=g+1,w=a-2;w>=x&&(p=i.get(w,w),d=M-p,v=C-p,c=(d*v-_)/i.get(w+1,w)+i.get(w,w+1),h=i.get(w+1,w+1)-p-d-v,d=i.get(w+2,w+1),v=Math.abs(c)+Math.abs(h)+Math.abs(d),c=c/v,h=h/v,d=d/v,!(w===x||Math.abs(i.get(w,w-1))*(Math.abs(h)+Math.abs(d))<u*(Math.abs(c)*(Math.abs(i.get(w-1,w-1))+Math.abs(p)+Math.abs(i.get(w+1,w+1))))));)w--;for(y=w+2;y<=a;y++)i.set(y,y-2,0),y>w+2&&i.set(y,y-3,0);for(b=w;b<=a-1&&(O=b!==a-1,b!==w&&(c=i.get(b,b-1),h=i.get(b+1,b-1),d=O?i.get(b+2,b-1):0,M=Math.abs(c)+Math.abs(h)+Math.abs(d),M!==0&&(c=c/M,h=h/M,d=d/M)),M!==0);b++)if(v=Math.sqrt(c*c+h*h+d*d),c<0&&(v=-v),v!==0){for(b!==w?i.set(b,b-1,-v*M):x!==w&&i.set(b,b-1,-i.get(b,b-1)),c=c+v,M=c/v,C=h/v,p=d/v,h=h/c,d=d/c,m=b;m<r;m++)c=i.get(b,m)+h*i.get(b+1,m),O&&(c=c+d*i.get(b+2,m),i.set(b+2,m,i.get(b+2,m)-c*p)),i.set(b,m,i.get(b,m)-c*M),i.set(b+1,m,i.get(b+1,m)-c*C);for(y=0;y<=Math.min(a,b+3);y++)c=M*i.get(y,b)+C*i.get(y,b+1),O&&(c=c+p*i.get(y,b+2),i.set(y,b+2,i.get(y,b+2)-c*d)),i.set(y,b,i.get(y,b)-c),i.set(y,b+1,i.get(y,b+1)-c*h);for(y=o;y<=s;y++)c=M*n.get(y,b)+C*n.get(y,b+1),O&&(c=c+p*n.get(y,b+2),n.set(y,b+2,n.get(y,b+2)-c*d)),n.set(y,b,n.get(y,b)-c),n.set(y,b+1,n.get(y,b+1)-c*h)}}}if(l!==0){for(a=r-1;a>=0;a--)if(c=t[a],h=e[a],h===0)for(x=a,i.set(a,a,1),y=a-1;y>=0;y--){for(_=i.get(y,y)-c,d=0,m=x;m<=a;m++)d=d+i.get(y,m)*i.get(m,a);if(e[y]<0)p=_,v=d;else if(x=y,e[y]===0?i.set(y,a,_!==0?-d/_:-d/(u*l)):(M=i.get(y,y+1),C=i.get(y+1,y),h=(t[y]-c)*(t[y]-c)+e[y]*e[y],E=(M*v-p*d)/h,i.set(y,a,E),i.set(y+1,a,Math.abs(M)>Math.abs(p)?(-d-_*E)/M:(-v-C*E)/p)),E=Math.abs(i.get(y,a)),u*E*E>1)for(m=y;m<=a;m++)i.set(m,a,i.get(m,a)/E)}else if(h<0)for(x=a-1,Math.abs(i.get(a,a-1))>Math.abs(i.get(a-1,a))?(i.set(a-1,a-1,h/i.get(a,a-1)),i.set(a-1,a,-(i.get(a,a)-c)/i.get(a,a-1))):(F=Lh(0,-i.get(a-1,a),i.get(a-1,a-1)-c,h),i.set(a-1,a-1,F[0]),i.set(a-1,a,F[1])),i.set(a,a-1,0),i.set(a,a,1),y=a-2;y>=0;y--){for(S=0,A=0,m=x;m<=a;m++)S=S+i.get(y,m)*i.get(m,a-1),A=A+i.get(y,m)*i.get(m,a);if(_=i.get(y,y)-c,e[y]<0)p=_,d=S,v=A;else if(x=y,e[y]===0?(F=Lh(-S,-A,_,h),i.set(y,a-1,F[0]),i.set(y,a,F[1])):(M=i.get(y,y+1),C=i.get(y+1,y),T=(t[y]-c)*(t[y]-c)+e[y]*e[y]-h*h,k=(t[y]-c)*2*h,T===0&&k===0&&(T=u*l*(Math.abs(_)+Math.abs(h)+Math.abs(M)+Math.abs(C)+Math.abs(p))),F=Lh(M*d-p*S+h*A,M*v-p*A-h*S,T,k),i.set(y,a-1,F[0]),i.set(y,a,F[1]),Math.abs(M)>Math.abs(p)+Math.abs(h)?(i.set(y+1,a-1,(-S-_*i.get(y,a-1)+h*i.get(y,a))/M),i.set(y+1,a,(-A-_*i.get(y,a)-h*i.get(y,a-1))/M)):(F=Lh(-d-C*i.get(y,a-1),-v-C*i.get(y,a),p,h),i.set(y+1,a-1,F[0]),i.set(y+1,a,F[1]))),E=Math.max(Math.abs(i.get(y,a-1)),Math.abs(i.get(y,a))),u*E*E>1)for(m=y;m<=a;m++)i.set(m,a-1,i.get(m,a-1)/E),i.set(m,a,i.get(m,a)/E)}for(y=0;y<r;y++)if(y<o||y>s)for(m=y;m<r;m++)n.set(y,m,i.get(y,m));for(m=r-1;m>=o;m--)for(y=o;y<=s;y++){for(p=0,b=o;b<=Math.min(m,s);b++)p=p+n.get(y,b)*i.get(b,m);n.set(y,m,p)}}}function Lh(r,e,t,n){let i,a;return Math.abs(t)>Math.abs(n)?(i=n/t,a=t+i*n,[(r+i*e)/a,(e-i*r)/a]):(i=t/n,a=n+i*t,[(i*r+e)/a,(i*e-r)/a])}class SS{constructor(e){if(e=ei.checkMatrix(e),!e.isSymmetric())throw new Error("Matrix is not symmetric");let t=e,n=t.rows,i=new dt(n,n),a=!0,o,s,u;for(s=0;s<n;s++){let f=0;for(u=0;u<s;u++){let l=0;for(o=0;o<u;o++)l+=i.get(u,o)*i.get(s,o);l=(t.get(s,u)-l)/i.get(u,u),i.set(s,u,l),f=f+l*l}for(f=t.get(s,s)-f,a&=f>0,i.set(s,s,Math.sqrt(Math.max(f,0))),u=s+1;u<n;u++)i.set(s,u,0)}this.L=i,this.positiveDefinite=!!a}isPositiveDefinite(){return this.positiveDefinite}solve(e){e=ei.checkMatrix(e);let t=this.L,n=t.rows;if(e.rows!==n)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let i=e.columns,a=e.clone(),o,s,u;for(u=0;u<n;u++)for(s=0;s<i;s++){for(o=0;o<u;o++)a.set(u,s,a.get(u,s)-a.get(o,s)*t.get(u,o));a.set(u,s,a.get(u,s)/t.get(u,u))}for(u=n-1;u>=0;u--)for(s=0;s<i;s++){for(o=u+1;o<n;o++)a.set(u,s,a.get(u,s)-a.get(o,s)*t.get(o,u));a.set(u,s,a.get(u,s)/t.get(u,u))}return a}get lowerTriangularMatrix(){return this.L}}class MS{constructor(e,t={}){e=ei.checkMatrix(e);let{Y:n}=t;const{scaleScores:i=!1,maxIterations:a=1e3,terminationCriteria:o=1e-10}=t;let s;if(n){if(Array.isArray(n)&&typeof n[0]=="number"?n=dt.columnVector(n):n=ei.checkMatrix(n),!n.isColumnVector()||n.rows!==e.rows)throw new Error("Y must be a column vector of length X.rows");s=n}else s=e.getColumnVector(0);let u=1,f,l,c,h;for(let d=0;d<a&&u>o;d++)c=e.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),c=c.div(c.norm()),f=e.mmul(c).div(c.transpose().mmul(c).get(0,0)),d>0&&(u=f.clone().sub(h).pow(2).sum()),h=f.clone(),n?(l=n.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0)),l=l.div(l.norm()),s=n.mmul(l).div(l.transpose().mmul(l).get(0,0))):s=f;if(n){let d=e.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0));d=d.div(d.norm());let v=e.clone().sub(f.clone().mmul(d.transpose())),p=s.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0)),g=n.clone().sub(f.clone().mulS(p.get(0,0)).mmul(l.transpose()));this.t=f,this.p=d.transpose(),this.w=c.transpose(),this.q=l,this.u=s,this.s=f.transpose().mmul(f),this.xResidual=v,this.yResidual=g,this.betas=p}else this.w=c.transpose(),this.s=f.transpose().mmul(f).sqrt(),i?this.t=f.clone().div(this.s.get(0,0)):this.t=f,this.xResidual=e.sub(f.mmul(c.transpose()))}}const Eoe=Object.freeze(Object.defineProperty({__proto__:null,AbstractMatrix:qt,CHO:SS,CholeskyDecomposition:SS,EVD:_S,EigenvalueDecomposition:_S,LU:rv,LuDecomposition:rv,Matrix:dt,MatrixColumnSelectionView:noe,MatrixColumnView:roe,MatrixFlipColumnView:ioe,MatrixFlipRowView:aoe,MatrixRowSelectionView:soe,MatrixRowView:ooe,MatrixSelectionView:dd,MatrixSubView:uoe,MatrixTransposeView:foe,NIPALS:MS,Nipals:MS,QR:Uy,QrDecomposition:Uy,SVD:Vu,SingularValueDecomposition:Vu,WrapperMatrix1D:_O,WrapperMatrix2D:ei,correlation:yoe,covariance:goe,default:dt,determinant:vd,inverse:coe,linearDependencies:voe,pseudoInverse:poe,solve:SO,wrap:loe},Symbol.toStringTag,{value:"Module"})),MO=va(Eoe);Object.defineProperty(fb,"__esModule",{value:!0});var Nf=MO,_oe=function(){function r(e){this.distances=e.distances,this.dimension=e.dimension||2,this.linkDistance=e.linkDistance}return r.prototype.layout=function(){var e=this,t=e.dimension,n=e.distances,i=e.linkDistance;try{var a=Nf.Matrix.mul(Nf.Matrix.pow(n,2),-.5),o=a.mean("row"),s=a.mean("column"),u=a.mean();a.add(u).subRowVector(o).subColumnVector(s);var f=new Nf.SingularValueDecomposition(a),l=Nf.Matrix.sqrt(f.diagonalMatrix).diagonal();return f.leftSingularVectors.toJSON().map(function(p){return Nf.Matrix.mul([p],[l]).toJSON()[0].splice(0,t)})}catch{for(var c=[],h=0;h<n.length;h++){var d=Math.random()*i,v=Math.random()*i;c.push([d,v])}return c}},r}();fb.default=_oe;var lb={};Object.defineProperty(lb,"__esModule",{value:!0});var Soe=800,Moe=function(){function r(e){this.disp=[],this.positions=e.positions,this.adjMatrix=e.adjMatrix,this.focusID=e.focusID,this.radii=e.radii,this.iterations=e.iterations||10,this.height=e.height||10,this.width=e.width||10,this.speed=e.speed||100,this.gravity=e.gravity||10,this.nodeSizeFunc=e.nodeSizeFunc,this.k=e.k||5,this.strictRadial=e.strictRadial,this.nodes=e.nodes}return r.prototype.layout=function(){var e=this,t=e.positions,n=[],i=e.iterations,a=e.width/10;e.maxDisplace=a,e.disp=n;for(var o=0;o<i;o++)t.forEach(function(s,u){n[u]={x:0,y:0}}),e.getRepulsion(),e.updatePositions();return t},r.prototype.getRepulsion=function(){var e=this,t=e.positions,n=e.nodes,i=e.disp,a=e.k,o=e.radii||[];t.forEach(function(s,u){i[u]={x:0,y:0},t.forEach(function(f,l){if(u!==l&&o[u]===o[l]){var c=s[0]-f[0],h=s[1]-f[1],d=Math.sqrt(c*c+h*h);if(d===0){d=1;var v=u>l?1:-1;c=.01*v,h=.01*v}if(d<e.nodeSizeFunc(n[u])/2+e.nodeSizeFunc(n[l])/2){var p=a*a/d;i[u].x+=c/d*p,i[u].y+=h/d*p}}})})},r.prototype.updatePositions=function(){var e=this,t=e.positions,n=e.disp,i=e.speed,a=e.strictRadial,o=e.focusID,s=e.maxDisplace||e.width/10;a&&n.forEach(function(f,l){var c=t[l][0]-t[o][0],h=t[l][1]-t[o][1],d=Math.sqrt(c*c+h*h),v=h/d,p=-c/d,g=Math.sqrt(f.x*f.x+f.y*f.y),y=Math.acos((v*f.x+p*f.y)/g);y>Math.PI/2&&(y-=Math.PI/2,v*=-1,p*=-1);var m=Math.cos(y)*g;f.x=v*m,f.y=p*m});var u=e.radii;t.forEach(function(f,l){if(l!==o){var c=Math.sqrt(n[l].x*n[l].x+n[l].y*n[l].y);if(c>0&&l!==o){var h=Math.min(s*(i/Soe),c);if(f[0]+=n[l].x/c*h,f[1]+=n[l].y/c*h,a){var d=f[0]-t[o][0],v=f[1]-t[o][1],p=Math.sqrt(d*d+v*v);d=d/p*u[l],v=v/p*u[l],f[0]=t[o][0]+d,f[1]=t[o][1]+v}}}})},r}();lb.default=Moe;var Coe=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),CO=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(lp,"__esModule",{value:!0});lp.RadialLayout=void 0;var oi=Or(),Aoe=zr,Toe=CO(fb),Ioe=CO(lb);function koe(r){for(var e=r.length,t=r[0].length,n=[],i=0;i<e;i++){for(var a=[],o=0;o<t;o++)r[i][o]!==0?a.push(1/(r[i][o]*r[i][o])):a.push(0);n.push(a)}return n}function Loe(r,e){var t=-1;return r.forEach(function(n,i){n.id===e&&(t=i)}),t}function CS(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}var Noe=function(r){Coe(e,r);function e(t){var n=r.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(t),n}return 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,n=t.nodes,i=t.edges||[];if(!n||n.length===0){t.onLayoutEnd&&t.onLayoutEnd();return}!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var a=t.center;if(n.length===1){n[0].x=a[0],n[0].y=a[1],t.onLayoutEnd&&t.onLayoutEnd();return}var o=t.linkDistance,s=null;if((0,oi.isString)(t.focusNode)){for(var u=!1,f=0;f<n.length;f++)n[f].id===t.focusNode&&(s=n[f],t.focusNode=s,u=!0,f=n.length);u||(s=null)}else s=t.focusNode;s||(s=n[0],t.focusNode=s);var l=Loe(n,s.id);l<0&&(l=0),t.focusIndex=l;var c=(0,oi.getAdjMatrix)({nodes:n,edges:i},!1),h=(0,oi.floydWarshall)(c),d=t.maxToFocus(h,l);t.handleInfinity(h,l,d+1),t.distances=h;var v=h[l],p=t.width||500,g=t.height||500,y=p-a[0]>a[0]?a[0]:p-a[0],m=g-a[1]>a[1]?a[1]:g-a[1];y===0&&(y=p/2),m===0&&(m=g/2);var b=m>y?y:m,x=Math.max.apply(Math,v),w=[];v.forEach(function(Y,N){t.unitRadius||(t.unitRadius=b/x),w[N]=Y*t.unitRadius}),t.radii=w;var E=t.eIdealDisMatrix();t.eIdealDistances=E;var _=koe(E);t.weights=_;var M=new Toe.default({linkDistance:o,distances:E}),C=M.layout();C.forEach(function(Y){(0,oi.isNaN)(Y[0])&&(Y[0]=Math.random()*o),(0,oi.isNaN)(Y[1])&&(Y[1]=Math.random()*o)}),t.positions=C,C.forEach(function(Y,N){n[N].x=Y[0]+a[0],n[N].y=Y[1]+a[1]}),C.forEach(function(Y){Y[0]-=C[l][0],Y[1]-=C[l][1]}),t.run();var S=t.preventOverlap,A=t.nodeSize,T,k=t.strictRadial;if(S){var O=t.nodeSpacing,F;(0,oi.isNumber)(O)?F=function(){return O}:(0,oi.isFunction)(O)?F=O:F=function(){return 0},A?(0,oi.isArray)(A)?T=function(Y){var N=A[0]>A[1]?A[0]:A[1];return N+F(Y)}:T=function(Y){return A+F(Y)}:T=function(Y){if(Y.size){if((0,oi.isArray)(Y.size)){var N=Y.size[0]>Y.size[1]?Y.size[0]:Y.size[1];return N+F(Y)}if((0,oi.isObject)(Y.size)){var N=Y.size.width>Y.size.height?Y.size.width:Y.size.height;return N+F(Y)}return Y.size+F(Y)}return 10+F(Y)};var D={nodes:n,nodeSizeFunc:T,adjMatrix:c,positions:C,radii:w,height:g,width:p,strictRadial:k,focusID:l,iterations:t.maxPreventOverlapIteration||200,k:C.length/4.5},$=new Ioe.default(D);C=$.layout()}return C.forEach(function(Y,N){n[N].x=Y[0]+a[0],n[N].y=Y[1]+a[1]}),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:i}},e.prototype.run=function(){for(var t=this,n=t.maxIteration,i=t.positions||[],a=t.weights||[],o=t.eIdealDistances||[],s=t.radii||[],u=0;u<=n;u++){var f=u/n;t.oneIteration(f,i,s,o,a)}},e.prototype.oneIteration=function(t,n,i,a,o){var s=this,u=1-t,f=s.focusIndex;n.forEach(function(l,c){var h=CS(l,[0,0]),d=h===0?0:1/h;if(c!==f){var v=0,p=0,g=0;n.forEach(function(m,b){if(c!==b){var x=CS(l,m),w=x===0?0:1/x,E=a[b][c];g+=o[c][b],v+=o[c][b]*(m[0]+E*(l[0]-m[0])*w),p+=o[c][b]*(m[1]+E*(l[1]-m[1])*w)}});var y=i[c]===0?0:1/i[c];g*=u,g+=t*y*y,v*=u,v+=t*y*l[0]*d,l[0]=v/g,p*=u,p+=t*y*l[1]*d,l[1]=p/g}})},e.prototype.eIdealDisMatrix=function(){var t=this,n=t.nodes;if(!n)return[];var i=t.distances,a=t.linkDistance,o=t.radii||[],s=t.unitRadius||50,u=[];return i&&i.forEach(function(f,l){var c=[];f.forEach(function(h,d){if(l===d)c.push(0);else if(o[l]===o[d])if(t.sortBy==="data")c.push(h*(Math.abs(l-d)*t.sortStrength)/(o[l]/s));else if(t.sortBy){var v=n[l][t.sortBy]||0,p=n[d][t.sortBy]||0;(0,oi.isString)(v)&&(v=v.charCodeAt(0)),(0,oi.isString)(p)&&(p=p.charCodeAt(0)),c.push(h*(Math.abs(v-p)*t.sortStrength)/(o[l]/s))}else c.push(h*a/(o[l]/s));else{var g=(a+s)/2;c.push(h*g)}}),u.push(c)}),u},e.prototype.handleInfinity=function(t,n,i){for(var a=t.length,o=0;o<a;o++)if(t[n][o]===1/0){t[n][o]=i,t[o][n]=i;for(var s=0;s<a;s++)t[o][s]!==1/0&&t[n][s]===1/0&&(t[n][s]=i+t[o][s],t[s][n]=i+t[o][s])}for(var o=0;o<a;o++)if(o!==n){for(var s=0;s<a;s++)if(t[o][s]===1/0){var u=Math.abs(t[n][o]-t[n][s]);u=u===0?1:u,t[o][s]=u}}},e.prototype.maxToFocus=function(t,n){for(var i=0,a=0;a<t[n].length;a++)t[n][a]!==1/0&&(i=t[n][a]>i?t[n][a]:i);return i},e.prototype.getType=function(){return"radial"},e}(Aoe.Base);lp.RadialLayout=Noe;(function(r){var e=xe&&xe.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),t=xe&&xe.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&e(i,n,a)};Object.defineProperty(r,"__esModule",{value:!0}),t(lp,r)})(ub);var fc={},Ooe=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(fc,"__esModule",{value:!0});fc.ConcentricLayout=void 0;var Yi=Or(),Doe=zr,Poe=function(r){Ooe(e,r);function e(t){var n=r.call(this)||this;return n.nodeSize=30,n.minNodeSpacing=10,n.nodeSpacing=10,n.preventOverlap=!1,n.equidistant=!1,n.startAngle=3/2*Math.PI,n.clockwise=!0,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.onLayoutEnd=function(){},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{nodeSize:30,minNodeSpacing:10,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"}},e.prototype.execute=function(){var t,n,i=this,a=i.nodes,o=i.edges,s=a.length;if(s===0){(t=i.onLayoutEnd)===null||t===void 0||t.call(i);return}!i.width&&typeof window<"u"&&(i.width=window.innerWidth),!i.height&&typeof window<"u"&&(i.height=window.innerHeight),i.center||(i.center=[i.width/2,i.height/2]);var u=i.center;if(s===1){a[0].x=u[0],a[0].y=u[1],(n=i.onLayoutEnd)===null||n===void 0||n.call(i);return}var f=i.nodeSize,l=i.nodeSpacing,c=[],h,d=0;(0,Yi.isArray)(f)?h=Math.max(f[0],f[1]):h=f,(0,Yi.isArray)(l)?d=Math.max(l[0],l[1]):(0,Yi.isNumber)(l)&&(d=l),a.forEach(function(k){c.push(k);var O=h;(0,Yi.isArray)(k.size)?O=Math.max(k.size[0],k.size[1]):(0,Yi.isNumber)(k.size)?O=k.size:(0,Yi.isObject)(k.size)&&(O=Math.max(k.size.width,k.size.height)),h=Math.max(h,O),(0,Yi.isFunction)(l)&&(d=Math.max(l(k),d))}),i.clockwise=i.counterclockwise!==void 0?!i.counterclockwise:i.clockwise;var v={},p={};if(c.forEach(function(k,O){v[k.id]=k,p[k.id]=O}),(i.sortBy==="degree"||!(0,Yi.isString)(i.sortBy)||c[0][i.sortBy]===void 0)&&(i.sortBy="degree",!(0,Yi.isNumber)(a[0].degree))){var g=(0,Yi.getDegree)(a.length,p,o);c.forEach(function(k,O){k.degree=g[O].all})}c.sort(function(k,O){return O[i.sortBy]-k[i.sortBy]}),i.maxValueNode=c[0],i.maxLevelDiff=i.maxLevelDiff||i.maxValueNode[i.sortBy]/4;var y=[[]],m=y[0];c.forEach(function(k){if(m.length>0){var O=Math.abs(m[0][i.sortBy]-k[i.sortBy]);i.maxLevelDiff&&O>=i.maxLevelDiff&&(m=[],y.push(m))}m.push(k)});var b=h+(d||i.minNodeSpacing);if(!i.preventOverlap){var x=y.length>0&&y[0].length>1,w=Math.min(i.width,i.height)/2-b,E=w/(y.length+(x?1:0));b=Math.min(b,E)}var _=0;if(y.forEach(function(k){var O=i.sweep;O===void 0&&(O=2*Math.PI-2*Math.PI/k.length);var F=k.dTheta=O/Math.max(1,k.length-1);if(k.length>1&&i.preventOverlap){var D=Math.cos(F)-Math.cos(0),$=Math.sin(F)-Math.sin(0),Y=Math.sqrt(b*b/(D*D+$*$));_=Math.max(Y,_)}k.r=_,_+=b}),i.equidistant){for(var M=0,C=0,S=0;S<y.length;S++){var A=y[S],T=A.r-C;M=Math.max(M,T)}C=0,y.forEach(function(k,O){O===0&&(C=k.r),k.r=C,C+=M})}return y.forEach(function(k){var O=k.dTheta,F=k.r;k.forEach(function(D,$){var Y=i.startAngle+(i.clockwise?1:-1)*O*$;D.x=u[0]+F*Math.cos(Y),D.y=u[1]+F*Math.sin(Y)})}),i.onLayoutEnd&&i.onLayoutEnd(),{nodes:a,edges:o}},e.prototype.getType=function(){return"concentric"},e}(Doe.Base);fc.ConcentricLayout=Poe;var lc={},Roe=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(lc,"__esModule",{value:!0});lc.MDSLayout=void 0;var Of=MO,c0=Or(),Boe=zr,Foe=function(r){Roe(e,r);function e(t){var n=r.call(this)||this;return n.center=[0,0],n.linkDistance=50,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{center:[0,0],linkDistance:50}},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.edges,a=i===void 0?[]:i,o=t.center;if(!n||n.length===0){t.onLayoutEnd&&t.onLayoutEnd();return}if(n.length===1){n[0].x=o[0],n[0].y=o[1],t.onLayoutEnd&&t.onLayoutEnd();return}var s=t.linkDistance,u=(0,c0.getAdjMatrix)({nodes:n,edges:a},!1),f=(0,c0.floydWarshall)(u);t.handleInfinity(f);var l=(0,c0.scaleMatrix)(f,s);t.scaledDistances=l;var c=t.runMDS();return t.positions=c,c.forEach(function(h,d){n[d].x=h[0]+o[0],n[d].y=h[1]+o[1]}),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:a}},e.prototype.runMDS=function(){var t=this,n=2,i=t.scaledDistances,a=Of.Matrix.mul(Of.Matrix.pow(i,2),-.5),o=a.mean("row"),s=a.mean("column"),u=a.mean();a.add(u).subRowVector(o).subColumnVector(s);var f=new Of.SingularValueDecomposition(a),l=Of.Matrix.sqrt(f.diagonalMatrix).diagonal();return f.leftSingularVectors.toJSON().map(function(c){return Of.Matrix.mul([c],[l]).toJSON()[0].splice(0,n)})},e.prototype.handleInfinity=function(t){var n=-999999;t.forEach(function(i){i.forEach(function(a){a!==1/0&&n<a&&(n=a)})}),t.forEach(function(i,a){i.forEach(function(o,s){o===1/0&&(t[a][s]=n)})})},e.prototype.getType=function(){return"mds"},e}(Boe.Base);lc.MDSLayout=Foe;var cc={},Goe=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(cc,"__esModule",{value:!0});cc.FruchtermanLayout=void 0;var zoe=zr,Fr=Or(),$oe=800,joe=function(r){Goe(e,r);function e(t){var n=r.call(this)||this;return n.maxIteration=1e3,n.workerEnabled=!1,n.gravity=10,n.speed=5,n.clustering=!1,n.clusterGravity=10,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.onLayoutEnd=function(){},n.tick=function(){},n.animate=!0,n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10,animate:!0}},e.prototype.execute=function(){var t=this,n,i,a=this,o=a.nodes;if(a.timeInterval!==void 0&&typeof window<"u"&&window.clearInterval(a.timeInterval),!o||o.length===0){(n=a.onLayoutEnd)===null||n===void 0||n.call(a);return}!a.width&&typeof window<"u"&&(a.width=window.innerWidth),!a.height&&typeof window<"u"&&(a.height=window.innerHeight),a.center||(a.center=[a.width/2,a.height/2]);var s=a.center;if(o.length===1){o[0].x=s[0],o[0].y=s[1],(i=a.onLayoutEnd)===null||i===void 0||i.call(a);return}var u={},f={};return o.forEach(function(l,c){(0,Fr.isNumber)(l.x)||(l.x=Math.random()*t.width),(0,Fr.isNumber)(l.y)||(l.y=Math.random()*t.height),u[l.id]=l,f[l.id]=c}),a.nodeMap=u,a.nodeIdxMap=f,a.run()},e.prototype.run=function(){var t,n=this,i=n.nodes;if(i){var a=n.edges,o=n.maxIteration,s=n.workerEnabled,u=n.clustering,f=n.animate,l={};if(u&&i.forEach(function(d){l[d.cluster]===void 0&&(l[d.cluster]={name:d.cluster,cx:0,cy:0,count:0})}),s||!f){for(var c=0;c<o;c++)n.runOneStep(l);(t=n.onLayoutEnd)===null||t===void 0||t.call(n)}else{if(typeof window>"u")return;var h=0;this.timeInterval=window.setInterval(function(){var d;n.runOneStep(l),h++,h>=o&&((d=n.onLayoutEnd)===null||d===void 0||d.call(n),window.clearInterval(n.timeInterval))},0)}return{nodes:i,edges:a}}},e.prototype.runOneStep=function(t){var n,i=this,a=i.nodes;if(a){var o=i.edges,s=i.center,u=i.gravity,f=i.speed,l=i.clustering,c=i.height*i.width,h=Math.sqrt(c)/10,d=c/(a.length+1),v=Math.sqrt(d),p=[];if(a.forEach(function(m,b){p[b]={x:0,y:0}}),i.applyCalculate(a,o,p,v,d),l){for(var g in t)t[g].cx=0,t[g].cy=0,t[g].count=0;a.forEach(function(m){var b=t[m.cluster];(0,Fr.isNumber)(m.x)&&(b.cx+=m.x),(0,Fr.isNumber)(m.y)&&(b.cy+=m.y),b.count++});for(var g in t)t[g].cx/=t[g].count,t[g].cy/=t[g].count;var y=i.clusterGravity||u;a.forEach(function(m,b){if(!(!(0,Fr.isNumber)(m.x)||!(0,Fr.isNumber)(m.y))){var x=t[m.cluster],w=Math.sqrt((m.x-x.cx)*(m.x-x.cx)+(m.y-x.cy)*(m.y-x.cy)),E=v*y;p[b].x-=E*(m.x-x.cx)/w,p[b].y-=E*(m.y-x.cy)/w}})}a.forEach(function(m,b){if(!(!(0,Fr.isNumber)(m.x)||!(0,Fr.isNumber)(m.y))){var x=.01*v*u;p[b].x-=x*(m.x-s[0]),p[b].y-=x*(m.y-s[1])}}),a.forEach(function(m,b){if((0,Fr.isNumber)(m.fx)&&(0,Fr.isNumber)(m.fy)){m.x=m.fx,m.y=m.fy;return}if(!(!(0,Fr.isNumber)(m.x)||!(0,Fr.isNumber)(m.y))){var x=Math.sqrt(p[b].x*p[b].x+p[b].y*p[b].y);if(x>0){var w=Math.min(h*(f/$oe),x);m.x+=p[b].x/x*w,m.y+=p[b].y/x*w}}}),(n=i.tick)===null||n===void 0||n.call(i)}},e.prototype.applyCalculate=function(t,n,i,a,o){var s=this;s.calRepulsive(t,i,o),n&&s.calAttractive(n,i,a)},e.prototype.calRepulsive=function(t,n,i){t.forEach(function(a,o){n[o]={x:0,y:0},t.forEach(function(s,u){if(o!==u&&!(!(0,Fr.isNumber)(a.x)||!(0,Fr.isNumber)(s.x)||!(0,Fr.isNumber)(a.y)||!(0,Fr.isNumber)(s.y))){var f=a.x-s.x,l=a.y-s.y,c=f*f+l*l;if(c===0){c=1;var h=o>u?1:-1;f=.01*h,l=.01*h}var d=i/c;n[o].x+=f*d,n[o].y+=l*d}})})},e.prototype.calAttractive=function(t,n,i){var a=this;t.forEach(function(o){var s=(0,Fr.getEdgeTerminal)(o,"source"),u=(0,Fr.getEdgeTerminal)(o,"target");if(!(!s||!u)){var f=a.nodeIdxMap[s],l=a.nodeIdxMap[u];if(f!==l){var c=a.nodeMap[s],h=a.nodeMap[u];if(!(!(0,Fr.isNumber)(h.x)||!(0,Fr.isNumber)(c.x)||!(0,Fr.isNumber)(h.y)||!(0,Fr.isNumber)(c.y))){var d=h.x-c.x,v=h.y-c.y,p=Math.sqrt(d*d+v*v),g=p*p/i;n[l].x-=d/p*g,n[l].y-=v/p*g,n[f].x+=d/p*g,n[f].y+=v/p*g}}}})},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"fruchterman"},e}(zoe.Base);cc.FruchtermanLayout=joe;var hc={};function AS(r,e,t,n,i,a,o){try{var s=r[a](o),u=s.value}catch(f){return void t(f)}s.done?e(u):Promise.resolve(u).then(n,i)}function wo(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(u){AS(a,n,i,o,s,"next",u)}function s(u){AS(a,n,i,o,s,"throw",u)}o(void 0)})}}function Hu(r){"@babel/helpers - typeof";return Hu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hu(r)}function Uoe(r,e){if(Hu(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(Hu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function AO(r){var e=Uoe(r,"string");return Hu(e)=="symbol"?e:e+""}function Je(r,e,t){return(e=AO(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gi(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function TS(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,AO(n.key),n)}}function zi(r,e,t){return e&&TS(r.prototype,e),t&&TS(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var Xoe=typeof xe=="object"&&xe&&xe.Object===Object&&xe,TO=Xoe,Yoe=TO,Woe=typeof self=="object"&&self&&self.Object===Object&&self,Voe=Yoe||Woe||Function("return this")(),Hoe=Voe,qoe=Hoe,Zoe=qoe.Symbol,IO=Zoe,IS=IO,kO=Object.prototype,Koe=kO.hasOwnProperty,Qoe=kO.toString,Df=IS?IS.toStringTag:void 0;function Joe(r){var e=Koe.call(r,Df),t=r[Df];try{r[Df]=void 0;var n=!0}catch{}var i=Qoe.call(r);return n&&(e?r[Df]=t:delete r[Df]),i}var ese=Joe,tse=Object.prototype,rse=tse.toString;function nse(r){return rse.call(r)}var ise=nse,kS=IO,ase=ese,ose=ise,sse="[object Null]",use="[object Undefined]",LS=kS?kS.toStringTag:void 0;function fse(r){return r==null?r===void 0?use:sse:LS&&LS in Object(r)?ase(r):ose(r)}var cb=fse,lse=9007199254740991;function cse(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=lse}var hse=cse;function dse(r){return r!=null&&typeof r=="object"}var hb=dse,vse=cb,pse=hse,gse=hb,yse="[object Arguments]",mse="[object Array]",bse="[object Boolean]",xse="[object Date]",wse="[object Error]",Ese="[object Function]",_se="[object Map]",Sse="[object Number]",Mse="[object Object]",Cse="[object RegExp]",Ase="[object Set]",Tse="[object String]",Ise="[object WeakMap]",kse="[object ArrayBuffer]",Lse="[object DataView]",Nse="[object Float32Array]",Ose="[object Float64Array]",Dse="[object Int8Array]",Pse="[object Int16Array]",Rse="[object Int32Array]",Bse="[object Uint8Array]",Fse="[object Uint8ClampedArray]",Gse="[object Uint16Array]",zse="[object Uint32Array]",Sr={};Sr[Nse]=Sr[Ose]=Sr[Dse]=Sr[Pse]=Sr[Rse]=Sr[Bse]=Sr[Fse]=Sr[Gse]=Sr[zse]=!0;Sr[yse]=Sr[mse]=Sr[kse]=Sr[bse]=Sr[Lse]=Sr[xse]=Sr[wse]=Sr[Ese]=Sr[_se]=Sr[Sse]=Sr[Mse]=Sr[Cse]=Sr[Ase]=Sr[Tse]=Sr[Ise]=!1;function $se(r){return gse(r)&&pse(r.length)&&!!Sr[vse(r)]}var jse=$se;function Use(r){return function(e){return r(e)}}var Xse=Use,nv={exports:{}};nv.exports;(function(r,e){var t=TO,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a&&t.process,s=function(){try{var u=i&&i.require&&i.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}}();r.exports=s})(nv,nv.exports);var Yse=nv.exports,Wse=jse,Vse=Xse,NS=Yse,OS=NS&&NS.isTypedArray,Hse=OS?Vse(OS):Wse,qse=Hse;const iv=pa(qse);var Zse=cb,Kse=hb,Qse="[object Number]";function Jse(r){return typeof r=="number"||Kse(r)&&Zse(r)==Qse}var eue=Jse;const tue=pa(eue);var rue=Array.isArray,nue=rue;const iue=pa(nue);var LO={exports:{}},NO={exports:{}};(function(r){function e(t){"@babel/helpers - typeof";return r.exports=e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},r.exports.__esModule=!0,r.exports.default=r.exports,e(t)}r.exports=e,r.exports.__esModule=!0,r.exports.default=r.exports})(NO);var aue=NO.exports;(function(r){var e=aue.default;function t(){r.exports=t=function(){return i},r.exports.__esModule=!0,r.exports.default=r.exports;var n,i={},a=Object.prototype,o=a.hasOwnProperty,s=Object.defineProperty||function(N,P,W){N[P]=W.value},u=typeof Symbol=="function"?Symbol:{},f=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag";function h(N,P,W){return Object.defineProperty(N,P,{value:W,enumerable:!0,configurable:!0,writable:!0}),N[P]}try{h({},"")}catch{h=function(W,J,te){return W[J]=te}}function d(N,P,W,J){var te=P&&P.prototype instanceof x?P:x,H=Object.create(te.prototype),pe=new $(J||[]);return s(H,"_invoke",{value:k(N,W,pe)}),H}function v(N,P,W){try{return{type:"normal",arg:N.call(P,W)}}catch(J){return{type:"throw",arg:J}}}i.wrap=d;var p="suspendedStart",g="suspendedYield",y="executing",m="completed",b={};function x(){}function w(){}function E(){}var _={};h(_,f,function(){return this});var M=Object.getPrototypeOf,C=M&&M(M(Y([])));C&&C!==a&&o.call(C,f)&&(_=C);var S=E.prototype=x.prototype=Object.create(_);function A(N){["next","throw","return"].forEach(function(P){h(N,P,function(W){return this._invoke(P,W)})})}function T(N,P){function W(te,H,pe,Te){var Ne=v(N[te],N,H);if(Ne.type!=="throw"){var Ze=Ne.arg,at=Ze.value;return at&&e(at)=="object"&&o.call(at,"__await")?P.resolve(at.__await).then(function(nt){W("next",nt,pe,Te)},function(nt){W("throw",nt,pe,Te)}):P.resolve(at).then(function(nt){Ze.value=nt,pe(Ze)},function(nt){return W("throw",nt,pe,Te)})}Te(Ne.arg)}var J;s(this,"_invoke",{value:function(H,pe){function Te(){return new P(function(Ne,Ze){W(H,pe,Ne,Ze)})}return J=J?J.then(Te,Te):Te()}})}function k(N,P,W){var J=p;return function(te,H){if(J===y)throw Error("Generator is already running");if(J===m){if(te==="throw")throw H;return{value:n,done:!0}}for(W.method=te,W.arg=H;;){var pe=W.delegate;if(pe){var Te=O(pe,W);if(Te){if(Te===b)continue;return Te}}if(W.method==="next")W.sent=W._sent=W.arg;else if(W.method==="throw"){if(J===p)throw J=m,W.arg;W.dispatchException(W.arg)}else W.method==="return"&&W.abrupt("return",W.arg);J=y;var Ne=v(N,P,W);if(Ne.type==="normal"){if(J=W.done?m:g,Ne.arg===b)continue;return{value:Ne.arg,done:W.done}}Ne.type==="throw"&&(J=m,W.method="throw",W.arg=Ne.arg)}}}function O(N,P){var W=P.method,J=N.iterator[W];if(J===n)return P.delegate=null,W==="throw"&&N.iterator.return&&(P.method="return",P.arg=n,O(N,P),P.method==="throw")||W!=="return"&&(P.method="throw",P.arg=new TypeError("The iterator does not provide a '"+W+"' method")),b;var te=v(J,N.iterator,P.arg);if(te.type==="throw")return P.method="throw",P.arg=te.arg,P.delegate=null,b;var H=te.arg;return H?H.done?(P[N.resultName]=H.value,P.next=N.nextLoc,P.method!=="return"&&(P.method="next",P.arg=n),P.delegate=null,b):H:(P.method="throw",P.arg=new TypeError("iterator result is not an object"),P.delegate=null,b)}function F(N){var P={tryLoc:N[0]};1 in N&&(P.catchLoc=N[1]),2 in N&&(P.finallyLoc=N[2],P.afterLoc=N[3]),this.tryEntries.push(P)}function D(N){var P=N.completion||{};P.type="normal",delete P.arg,N.completion=P}function $(N){this.tryEntries=[{tryLoc:"root"}],N.forEach(F,this),this.reset(!0)}function Y(N){if(N||N===""){var P=N[f];if(P)return P.call(N);if(typeof N.next=="function")return N;if(!isNaN(N.length)){var W=-1,J=function te(){for(;++W<N.length;)if(o.call(N,W))return te.value=N[W],te.done=!1,te;return te.value=n,te.done=!0,te};return J.next=J}}throw new TypeError(e(N)+" is not iterable")}return w.prototype=E,s(S,"constructor",{value:E,configurable:!0}),s(E,"constructor",{value:w,configurable:!0}),w.displayName=h(E,c,"GeneratorFunction"),i.isGeneratorFunction=function(N){var P=typeof N=="function"&&N.constructor;return!!P&&(P===w||(P.displayName||P.name)==="GeneratorFunction")},i.mark=function(N){return Object.setPrototypeOf?Object.setPrototypeOf(N,E):(N.__proto__=E,h(N,c,"GeneratorFunction")),N.prototype=Object.create(S),N},i.awrap=function(N){return{__await:N}},A(T.prototype),h(T.prototype,l,function(){return this}),i.AsyncIterator=T,i.async=function(N,P,W,J,te){te===void 0&&(te=Promise);var H=new T(d(N,P,W,J),te);return i.isGeneratorFunction(P)?H:H.next().then(function(pe){return pe.done?pe.value:H.next()})},A(S),h(S,c,"Generator"),h(S,f,function(){return this}),h(S,"toString",function(){return"[object Generator]"}),i.keys=function(N){var P=Object(N),W=[];for(var J in P)W.push(J);return W.reverse(),function te(){for(;W.length;){var H=W.pop();if(H in P)return te.value=H,te.done=!1,te}return te.done=!0,te}},i.values=Y,$.prototype={constructor:$,reset:function(P){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(D),!P)for(var W in this)W.charAt(0)==="t"&&o.call(this,W)&&!isNaN(+W.slice(1))&&(this[W]=n)},stop:function(){this.done=!0;var P=this.tryEntries[0].completion;if(P.type==="throw")throw P.arg;return this.rval},dispatchException:function(P){if(this.done)throw P;var W=this;function J(Ze,at){return pe.type="throw",pe.arg=P,W.next=Ze,at&&(W.method="next",W.arg=n),!!at}for(var te=this.tryEntries.length-1;te>=0;--te){var H=this.tryEntries[te],pe=H.completion;if(H.tryLoc==="root")return J("end");if(H.tryLoc<=this.prev){var Te=o.call(H,"catchLoc"),Ne=o.call(H,"finallyLoc");if(Te&&Ne){if(this.prev<H.catchLoc)return J(H.catchLoc,!0);if(this.prev<H.finallyLoc)return J(H.finallyLoc)}else if(Te){if(this.prev<H.catchLoc)return J(H.catchLoc,!0)}else{if(!Ne)throw Error("try statement without catch or finally");if(this.prev<H.finallyLoc)return J(H.finallyLoc)}}}},abrupt:function(P,W){for(var J=this.tryEntries.length-1;J>=0;--J){var te=this.tryEntries[J];if(te.tryLoc<=this.prev&&o.call(te,"finallyLoc")&&this.prev<te.finallyLoc){var H=te;break}}H&&(P==="break"||P==="continue")&&H.tryLoc<=W&&W<=H.finallyLoc&&(H=null);var pe=H?H.completion:{};return pe.type=P,pe.arg=W,H?(this.method="next",this.next=H.finallyLoc,b):this.complete(pe)},complete:function(P,W){if(P.type==="throw")throw P.arg;return P.type==="break"||P.type==="continue"?this.next=P.arg:P.type==="return"?(this.rval=this.arg=P.arg,this.method="return",this.next="end"):P.type==="normal"&&W&&(this.next=W),b},finish:function(P){for(var W=this.tryEntries.length-1;W>=0;--W){var J=this.tryEntries[W];if(J.finallyLoc===P)return this.complete(J.completion,J.afterLoc),D(J),b}},catch:function(P){for(var W=this.tryEntries.length-1;W>=0;--W){var J=this.tryEntries[W];if(J.tryLoc===P){var te=J.completion;if(te.type==="throw"){var H=te.arg;D(J)}return H}}throw Error("illegal catch attempt")},delegateYield:function(P,W,J){return this.delegate={iterator:Y(P),resultName:W,nextLoc:J},this.method==="next"&&(this.arg=n),b}},i}r.exports=t,r.exports.__esModule=!0,r.exports.default=r.exports})(LO);var oue=LO.exports,pd=oue(),sue=pd;try{regeneratorRuntime=pd}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=pd:Function("r","regeneratorRuntime = r")(pd)}const Mn=pa(sue);var uue=1;function OO(){return uue++}var Le;(function(r){r[r.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",r[r.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",r[r.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r[r.ZERO=0]="ZERO",r[r.ONE=1]="ONE",r[r.SRC_COLOR=768]="SRC_COLOR",r[r.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",r[r.SRC_ALPHA=770]="SRC_ALPHA",r[r.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",r[r.DST_ALPHA=772]="DST_ALPHA",r[r.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",r[r.DST_COLOR=774]="DST_COLOR",r[r.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",r[r.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",r[r.FUNC_ADD=32774]="FUNC_ADD",r[r.BLEND_EQUATION=32777]="BLEND_EQUATION",r[r.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",r[r.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",r[r.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",r[r.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",r[r.MAX_EXT=32776]="MAX_EXT",r[r.MIN_EXT=32775]="MIN_EXT",r[r.BLEND_DST_RGB=32968]="BLEND_DST_RGB",r[r.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",r[r.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",r[r.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",r[r.CONSTANT_COLOR=32769]="CONSTANT_COLOR",r[r.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",r[r.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",r[r.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",r[r.BLEND_COLOR=32773]="BLEND_COLOR",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",r[r.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",r[r.STREAM_DRAW=35040]="STREAM_DRAW",r[r.STATIC_DRAW=35044]="STATIC_DRAW",r[r.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",r[r.BUFFER_SIZE=34660]="BUFFER_SIZE",r[r.BUFFER_USAGE=34661]="BUFFER_USAGE",r[r.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",r[r.FRONT=1028]="FRONT",r[r.BACK=1029]="BACK",r[r.FRONT_AND_BACK=1032]="FRONT_AND_BACK",r[r.CULL_FACE=2884]="CULL_FACE",r[r.BLEND=3042]="BLEND",r[r.DITHER=3024]="DITHER",r[r.STENCIL_TEST=2960]="STENCIL_TEST",r[r.DEPTH_TEST=2929]="DEPTH_TEST",r[r.SCISSOR_TEST=3089]="SCISSOR_TEST",r[r.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",r[r.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",r[r.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",r[r.NO_ERROR=0]="NO_ERROR",r[r.INVALID_ENUM=1280]="INVALID_ENUM",r[r.INVALID_VALUE=1281]="INVALID_VALUE",r[r.INVALID_OPERATION=1282]="INVALID_OPERATION",r[r.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",r[r.CW=2304]="CW",r[r.CCW=2305]="CCW",r[r.LINE_WIDTH=2849]="LINE_WIDTH",r[r.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",r[r.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",r[r.CULL_FACE_MODE=2885]="CULL_FACE_MODE",r[r.FRONT_FACE=2886]="FRONT_FACE",r[r.DEPTH_RANGE=2928]="DEPTH_RANGE",r[r.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",r[r.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",r[r.DEPTH_FUNC=2932]="DEPTH_FUNC",r[r.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",r[r.STENCIL_FUNC=2962]="STENCIL_FUNC",r[r.STENCIL_FAIL=2964]="STENCIL_FAIL",r[r.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",r[r.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",r[r.STENCIL_REF=2967]="STENCIL_REF",r[r.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",r[r.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",r[r.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",r[r.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",r[r.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",r[r.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",r[r.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",r[r.VIEWPORT=2978]="VIEWPORT",r[r.SCISSOR_BOX=3088]="SCISSOR_BOX",r[r.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",r[r.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",r[r.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",r[r.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",r[r.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",r[r.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",r[r.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",r[r.RED_BITS=3410]="RED_BITS",r[r.GREEN_BITS=3411]="GREEN_BITS",r[r.BLUE_BITS=3412]="BLUE_BITS",r[r.ALPHA_BITS=3413]="ALPHA_BITS",r[r.DEPTH_BITS=3414]="DEPTH_BITS",r[r.STENCIL_BITS=3415]="STENCIL_BITS",r[r.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",r[r.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",r[r.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",r[r.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",r[r.SAMPLES=32937]="SAMPLES",r[r.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",r[r.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",r[r.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",r[r.DONT_CARE=4352]="DONT_CARE",r[r.FASTEST=4353]="FASTEST",r[r.NICEST=4354]="NICEST",r[r.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",r[r.BYTE=5120]="BYTE",r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.SHORT=5122]="SHORT",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.INT=5124]="INT",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.FLOAT=5126]="FLOAT",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.ALPHA=6406]="ALPHA",r[r.RGB=6407]="RGB",r[r.RGBA=6408]="RGBA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",r[r.VERTEX_SHADER=35633]="VERTEX_SHADER",r[r.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",r[r.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",r[r.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",r[r.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",r[r.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",r[r.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",r[r.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",r[r.SHADER_TYPE=35663]="SHADER_TYPE",r[r.DELETE_STATUS=35712]="DELETE_STATUS",r[r.LINK_STATUS=35714]="LINK_STATUS",r[r.VALIDATE_STATUS=35715]="VALIDATE_STATUS",r[r.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",r[r.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",r[r.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",r[r.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",r[r.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",r[r.NEVER=512]="NEVER",r[r.LESS=513]="LESS",r[r.EQUAL=514]="EQUAL",r[r.LEQUAL=515]="LEQUAL",r[r.GREATER=516]="GREATER",r[r.NOTEQUAL=517]="NOTEQUAL",r[r.GEQUAL=518]="GEQUAL",r[r.ALWAYS=519]="ALWAYS",r[r.KEEP=7680]="KEEP",r[r.REPLACE=7681]="REPLACE",r[r.INCR=7682]="INCR",r[r.DECR=7683]="DECR",r[r.INVERT=5386]="INVERT",r[r.INCR_WRAP=34055]="INCR_WRAP",r[r.DECR_WRAP=34056]="DECR_WRAP",r[r.VENDOR=7936]="VENDOR",r[r.RENDERER=7937]="RENDERER",r[r.VERSION=7938]="VERSION",r[r.NEAREST=9728]="NEAREST",r[r.LINEAR=9729]="LINEAR",r[r.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",r[r.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",r[r.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",r[r.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",r[r.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",r[r.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",r[r.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",r[r.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE=5890]="TEXTURE",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r[r.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",r[r.TEXTURE0=33984]="TEXTURE0",r[r.TEXTURE1=33985]="TEXTURE1",r[r.TEXTURE2=33986]="TEXTURE2",r[r.TEXTURE3=33987]="TEXTURE3",r[r.TEXTURE4=33988]="TEXTURE4",r[r.TEXTURE5=33989]="TEXTURE5",r[r.TEXTURE6=33990]="TEXTURE6",r[r.TEXTURE7=33991]="TEXTURE7",r[r.TEXTURE8=33992]="TEXTURE8",r[r.TEXTURE9=33993]="TEXTURE9",r[r.TEXTURE10=33994]="TEXTURE10",r[r.TEXTURE11=33995]="TEXTURE11",r[r.TEXTURE12=33996]="TEXTURE12",r[r.TEXTURE13=33997]="TEXTURE13",r[r.TEXTURE14=33998]="TEXTURE14",r[r.TEXTURE15=33999]="TEXTURE15",r[r.TEXTURE16=34e3]="TEXTURE16",r[r.TEXTURE17=34001]="TEXTURE17",r[r.TEXTURE18=34002]="TEXTURE18",r[r.TEXTURE19=34003]="TEXTURE19",r[r.TEXTURE20=34004]="TEXTURE20",r[r.TEXTURE21=34005]="TEXTURE21",r[r.TEXTURE22=34006]="TEXTURE22",r[r.TEXTURE23=34007]="TEXTURE23",r[r.TEXTURE24=34008]="TEXTURE24",r[r.TEXTURE25=34009]="TEXTURE25",r[r.TEXTURE26=34010]="TEXTURE26",r[r.TEXTURE27=34011]="TEXTURE27",r[r.TEXTURE28=34012]="TEXTURE28",r[r.TEXTURE29=34013]="TEXTURE29",r[r.TEXTURE30=34014]="TEXTURE30",r[r.TEXTURE31=34015]="TEXTURE31",r[r.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",r[r.REPEAT=10497]="REPEAT",r[r.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r[r.FLOAT_VEC2=35664]="FLOAT_VEC2",r[r.FLOAT_VEC3=35665]="FLOAT_VEC3",r[r.FLOAT_VEC4=35666]="FLOAT_VEC4",r[r.INT_VEC2=35667]="INT_VEC2",r[r.INT_VEC3=35668]="INT_VEC3",r[r.INT_VEC4=35669]="INT_VEC4",r[r.BOOL=35670]="BOOL",r[r.BOOL_VEC2=35671]="BOOL_VEC2",r[r.BOOL_VEC3=35672]="BOOL_VEC3",r[r.BOOL_VEC4=35673]="BOOL_VEC4",r[r.FLOAT_MAT2=35674]="FLOAT_MAT2",r[r.FLOAT_MAT3=35675]="FLOAT_MAT3",r[r.FLOAT_MAT4=35676]="FLOAT_MAT4",r[r.SAMPLER_2D=35678]="SAMPLER_2D",r[r.SAMPLER_CUBE=35680]="SAMPLER_CUBE",r[r.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",r[r.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",r[r.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",r[r.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",r[r.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",r[r.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",r[r.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",r[r.COMPILE_STATUS=35713]="COMPILE_STATUS",r[r.LOW_FLOAT=36336]="LOW_FLOAT",r[r.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",r[r.HIGH_FLOAT=36338]="HIGH_FLOAT",r[r.LOW_INT=36339]="LOW_INT",r[r.MEDIUM_INT=36340]="MEDIUM_INT",r[r.HIGH_INT=36341]="HIGH_INT",r[r.FRAMEBUFFER=36160]="FRAMEBUFFER",r[r.RENDERBUFFER=36161]="RENDERBUFFER",r[r.RGBA4=32854]="RGBA4",r[r.RGB5_A1=32855]="RGB5_A1",r[r.RGB565=36194]="RGB565",r[r.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",r[r.STENCIL_INDEX=6401]="STENCIL_INDEX",r[r.STENCIL_INDEX8=36168]="STENCIL_INDEX8",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r[r.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",r[r.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",r[r.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",r[r.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",r[r.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",r[r.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",r[r.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",r[r.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",r[r.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",r[r.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",r[r.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",r[r.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",r[r.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",r[r.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",r[r.NONE=0]="NONE",r[r.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",r[r.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",r[r.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",r[r.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",r[r.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",r[r.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",r[r.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",r[r.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",r[r.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",r[r.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",r[r.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",r[r.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",r[r.COPY_SRC=1]="COPY_SRC",r[r.COPY_DST=2]="COPY_DST",r[r.SAMPLED=4]="SAMPLED",r[r.STORAGE=8]="STORAGE",r[r.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"})(Le||(Le={}));var fue=function(){function r(){Gi(this,r),this.config=void 0}return zi(r,[{key:"get",value:function(){return this.config}},{key:"set",value:function(t){this.config=t}}]),r}(),Bl;(function(r){r.Void="Void",r.Boolean="Boolean",r.Float="Float",r.Uint32="Uint32",r.Int32="Int32",r.Vector="Vector",r.Vector2Float="vec2<f32>",r.Vector3Float="vec3<f32>",r.Vector4Float="vec4<f32>",r.Vector2Boolean="vec2<bool>",r.Vector3Boolean="vec3<bool>",r.Vector4Boolean="vec4<bool>",r.Vector2Uint="vec2<u32>",r.Vector3Uint="vec3<u32>",r.Vector4Uint="vec4<u32>",r.Vector2Int="vec2<i32>",r.Vector3Int="vec3<i32>",r.Vector4Int="vec4<i32>",r.Matrix="Matrix",r.Matrix3x3Float="mat3x3<f32>",r.Matrix4x4Float="mat4x4<i32>",r.Struct="Struct",r.FloatArray="Float[]",r.Vector4FloatArray="vec4<f32>[]"})(Bl||(Bl={}));var DS;(function(r){r.Program="Program",r.Identifier="Identifier",r.VariableDeclaration="VariableDeclaration",r.BlockStatement="BlockStatement",r.ReturnStatement="ReturnStatement",r.FunctionDeclaration="FunctionDeclaration",r.VariableDeclarator="VariableDeclarator",r.AssignmentExpression="AssignmentExpression",r.LogicalExpression="LogicalExpression",r.BinaryExpression="BinaryExpression",r.ArrayExpression="ArrayExpression",r.UnaryExpression="UnaryExpression",r.UpdateExpression="UpdateExpression",r.FunctionExpression="FunctionExpression",r.MemberExpression="MemberExpression",r.ConditionalExpression="ConditionalExpression",r.ExpressionStatement="ExpressionStatement",r.CallExpression="CallExpression",r.NumThreadStatement="NumThreadStatement",r.StorageStatement="StorageStatement",r.DoWhileStatement="DoWhileStatement",r.WhileStatement="WhileStatement",r.ForStatement="ForStatement",r.BreakStatement="BreakStatement",r.ContinueStatement="ContinueStatement",r.IfStatement="IfStatement",r.ImportedFunctionStatement="ImportedFunctionStatement"})(DS||(DS={}));var qu;(function(r){r.Input="Input",r.Output="Output",r.Uniform="Uniform",r.Workgroup="Workgroup",r.UniformConstant="UniformConstant",r.Image="Image",r.StorageBuffer="StorageBuffer",r.Private="Private",r.Function="Function"})(qu||(qu={}));var ll;(function(r){r.GLSL100="GLSL100",r.GLSL450="GLSL450",r.WGSL="WGSL"})(ll||(ll={}));var lue="__DefineValuePlaceholder__";function cue(){if(typeof document<"u")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function PS(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function RS(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?PS(Object(t),!0).forEach(function(n){Je(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):PS(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var DO=function(){function r(e,t){Gi(this,r),this.engine=e,this.configService=t,this.model=void 0,this.dirty=!0,this.compiledBundle=void 0,this.initPromise=void 0}return zi(r,[{key:"init",value:function(){var t=this.configService.get(),n=t.canvas,i=t.engineOptions;this.initPromise=this.engine.init(RS({canvas:n||cue(),antialiasing:!1},i))}},{key:"setBundle",value:function(t){this.compiledBundle=JSON.parse(JSON.stringify(t))}},{key:"setDispatch",value:function(t){return this.compiledBundle.context&&(this.compiledBundle.context.dispatch=t),this}},{key:"setMaxIteration",value:function(t){return this.compiledBundle.context&&(this.compiledBundle.context.maxIteration=t),this}},{key:"setBinding",value:function(t,n){var i=this;if(typeof t=="string"){var a=tue(n)||iv(n)||iue(n);if(this.compiledBundle&&this.compiledBundle.context){var o=this.compiledBundle.context.defines.find(function(u){return u.name===t});if(o)return o.value=n,this;var s=this.compiledBundle.context.uniforms.find(function(u){return u.name===t});s&&(a?(s.data=n,s.isReferer=!1,s.storageClass===qu.Uniform?this.model&&this.model.updateUniform(t,n):this.model&&this.model.updateBuffer(t,n)):(s.isReferer=!0,s.data=n))}}else Object.keys(t).forEach(function(u){i.setBinding(u,t[u])});return this}},{key:"execute",value:function(){var e=wo(Mn.mark(function n(){var i=this,a,o,s=arguments;return Mn.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(a=s.length>0&&s[0]!==void 0?s[0]:1,!this.dirty){f.next=6;break}return this.compiledBundle.context&&(a>1?this.compiledBundle.context.maxIteration=a:this.compiledBundle.context.maxIteration++),f.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(l){var c=l.isReferer;return c}).forEach(function(l){var c=l.data,h=l.name;i.model.confirmInput(c.model,h)}),o=0;o<a;o++)this.model.run();return this.engine.endFrame(),f.abrupt("return",this);case 12:case"end":return f.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"getOutput",value:function(){var e=wo(Mn.mark(function n(){return Mn.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.model.readData());case 1:case"end":return a.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"compile",value:function(){var e=wo(Mn.mark(function n(){var i,a,o;return Mn.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.initPromise;case 2:return i=RS({},this.compiledBundle.context),a=this.engine.supportWebGPU?this.engine.useWGSL?ll.WGSL:ll.GLSL450:ll.GLSL100,o=this.compiledBundle.shaders[a],i.defines.filter(function(f){return f.runtime}).forEach(function(f){var l="".concat(lue).concat(f.name);o=o.replace(l,"".concat(f.value))}),i.shader=o,i.uniforms.forEach(function(f){if(!f.data&&f.storageClass===qu.StorageBuffer){var l=1;f.type===Bl.FloatArray?l=1:f.type===Bl.Vector4FloatArray&&(l=4),f.data=new Float32Array(i.output.length*l).fill(0)}}),this.compiledBundle.context=i,u.next=11,this.engine.createComputeModel(this.compiledBundle.context);case 11:this.model=u.sent;case 12:case"end":return u.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()}]),r}(),PO={exports:{}};(function(r,e){(function(t,n){r.exports=n()})(xe,function(){var t=function(I){return I instanceof Uint8Array||I instanceof Uint16Array||I instanceof Uint32Array||I instanceof Int8Array||I instanceof Int16Array||I instanceof Int32Array||I instanceof Float32Array||I instanceof Float64Array||I instanceof Uint8ClampedArray},n=function(I,G){for(var V=Object.keys(G),ce=0;ce<V.length;++ce)I[V[ce]]=G[V[ce]];return I},i=`
|
|
41
|
-
`;function a(I){return typeof atob<"u"?atob(I):"base64:"+I}function o(I){var G=new Error("(regl) "+I);throw console.error(G),G}function s(I,G){I||o(G)}function u(I){return I?": "+I:""}function f(I,G,V){I in G||o("unknown parameter ("+I+")"+u(V)+". possible values: "+Object.keys(G).join())}function l(I,G){t(I)||o("invalid parameter type"+u(G)+". must be a typed array")}function c(I,G){switch(G){case"number":return typeof I=="number";case"object":return typeof I=="object";case"string":return typeof I=="string";case"boolean":return typeof I=="boolean";case"function":return typeof I=="function";case"undefined":return typeof I>"u";case"symbol":return typeof I=="symbol"}}function h(I,G,V){c(I,G)||o("invalid parameter type"+u(V)+". expected "+G+", got "+typeof I)}function d(I,G){I>=0&&(I|0)===I||o("invalid parameter type, ("+I+")"+u(G)+". must be a nonnegative integer")}function v(I,G,V){G.indexOf(I)<0&&o("invalid value"+u(V)+". must be one of: "+G)}var p=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function g(I){Object.keys(I).forEach(function(G){p.indexOf(G)<0&&o('invalid regl constructor argument "'+G+'". must be one of '+p)})}function y(I,G){for(I=I+"";I.length<G;)I=" "+I;return I}function m(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function b(I,G){this.number=I,this.line=G,this.errors=[]}function x(I,G,V){this.file=I,this.line=G,this.message=V}function w(){var I=new Error,G=(I.stack||I).toString(),V=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(G);if(V)return V[1];var ce=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(G);return ce?ce[1]:"unknown"}function E(){var I=new Error,G=(I.stack||I).toString(),V=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(G);if(V)return V[1];var ce=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(G);return ce?ce[1]:"unknown"}function _(I,G){var V=I.split(`
|
|
42
|
-
`),ce=1,we=0,le={unknown:new m,0:new m};le.unknown.name=le[0].name=G||w(),le.unknown.lines.push(new b(0,""));for(var de=0;de<V.length;++de){var Ie=V[de],Oe=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(Ie);if(Oe)switch(Oe[1]){case"line":var Fe=/(\d+)(\s+\d+)?/.exec(Oe[2]);Fe&&(ce=Fe[1]|0,Fe[2]&&(we=Fe[2]|0,we in le||(le[we]=new m)));break;case"define":var De=/SHADER_NAME(_B64)?\s+(.*)$/.exec(Oe[2]);De&&(le[we].name=De[1]?a(De[2]):De[2]);break}le[we].lines.push(new b(ce++,Ie))}return Object.keys(le).forEach(function($e){var Ve=le[$e];Ve.lines.forEach(function(ke){Ve.index[ke.number]=ke})}),le}function M(I){var G=[];return I.split(`
|
|
43
|
-
`).forEach(function(V){if(!(V.length<5)){var ce=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(V);ce?G.push(new x(ce[1]|0,ce[2]|0,ce[3].trim())):V.length>0&&G.push(new x("unknown",0,V))}}),G}function C(I,G){G.forEach(function(V){var ce=I[V.file];if(ce){var we=ce.index[V.line];if(we){we.errors.push(V),ce.hasErrors=!0;return}}I.unknown.hasErrors=!0,I.unknown.lines[0].errors.push(V)})}function S(I,G,V,ce,we){if(!I.getShaderParameter(G,I.COMPILE_STATUS)){var le=I.getShaderInfoLog(G),de=ce===I.FRAGMENT_SHADER?"fragment":"vertex";$(V,"string",de+" shader source must be a string",we);var Ie=_(V,we),Oe=M(le);C(Ie,Oe),Object.keys(Ie).forEach(function(Fe){var De=Ie[Fe];if(!De.hasErrors)return;var $e=[""],Ve=[""];function ke(je,oe){$e.push(je),Ve.push(oe||"")}ke("file number "+Fe+": "+De.name+`
|
|
44
|
-
`,"color:red;text-decoration:underline;font-weight:bold"),De.lines.forEach(function(je){if(je.errors.length>0){ke(y(je.number,4)+"| ","background-color:yellow; font-weight:bold"),ke(je.line+i,"color:red; background-color:yellow; font-weight:bold");var oe=0;je.errors.forEach(function(ve){var Be=ve.message,Ke=/^\s*'(.*)'\s*:\s*(.*)$/.exec(Be);if(Ke){var Me=Ke[1];switch(Be=Ke[2],Me){case"assign":Me="=";break}oe=Math.max(je.line.indexOf(Me,oe),0)}else oe=0;ke(y("| ",6)),ke(y("^^^",oe+3)+i,"font-weight:bold"),ke(y("| ",6)),ke(Be+i,"font-weight:bold")}),ke(y("| ",6)+i)}else ke(y(je.number,4)+"| "),ke(je.line+i,"color:red")}),typeof document<"u"&&!window.chrome?(Ve[0]=$e.join("%c"),console.log.apply(console,Ve)):console.log($e.join(""))}),s.raise("Error compiling "+de+" shader, "+Ie[0].name)}}function A(I,G,V,ce,we){if(!I.getProgramParameter(G,I.LINK_STATUS)){var le=I.getProgramInfoLog(G),de=_(V,we),Ie=_(ce,we),Oe='Error linking program with vertex shader, "'+Ie[0].name+'", and fragment shader "'+de[0].name+'"';typeof document<"u"?console.log("%c"+Oe+i+"%c"+le,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Oe+i+le),s.raise(Oe)}}function T(I){I._commandRef=w()}function k(I,G,V,ce){T(I);function we(Oe){return Oe?ce.id(Oe):0}I._fragId=we(I.static.frag),I._vertId=we(I.static.vert);function le(Oe,Fe){Object.keys(Fe).forEach(function(De){Oe[ce.id(De)]=!0})}var de=I._uniformSet={};le(de,G.static),le(de,G.dynamic);var Ie=I._attributeSet={};le(Ie,V.static),le(Ie,V.dynamic),I._hasCount="count"in I.static||"count"in I.dynamic||"elements"in I.static||"elements"in I.dynamic}function O(I,G){var V=E();o(I+" in command "+(G||w())+(V==="unknown"?"":" called from "+V))}function F(I,G,V){I||O(G,V||w())}function D(I,G,V,ce){I in G||O("unknown parameter ("+I+")"+u(V)+". possible values: "+Object.keys(G).join(),ce||w())}function $(I,G,V,ce){c(I,G)||O("invalid parameter type"+u(V)+". expected "+G+", got "+typeof I,ce||w())}function Y(I){I()}function N(I,G,V){I.texture?v(I.texture._texture.internalformat,G,"unsupported texture format for attachment"):v(I.renderbuffer._renderbuffer.format,V,"unsupported renderbuffer format for attachment")}var P=33071,W=9728,J=9984,te=9985,H=9986,pe=9987,Te=5120,Ne=5121,Ze=5122,at=5123,nt=5124,_t=5125,St=5126,fr=32819,Ft=32820,Yt=33635,dr=34042,lr=36193,jt={};jt[Te]=jt[Ne]=1,jt[Ze]=jt[at]=jt[lr]=jt[Yt]=jt[fr]=jt[Ft]=2,jt[nt]=jt[_t]=jt[St]=jt[dr]=4;function ir(I,G){return I===Ft||I===fr||I===Yt?2:I===dr?4:jt[I]*G}function Hr(I){return!(I&I-1)&&!!I}function tt(I,G,V){var ce,we=G.width,le=G.height,de=G.channels;s(we>0&&we<=V.maxTextureSize&&le>0&&le<=V.maxTextureSize,"invalid texture shape"),(I.wrapS!==P||I.wrapT!==P)&&s(Hr(we)&&Hr(le),"incompatible wrap mode for texture, both width and height must be power of 2"),G.mipmask===1?we!==1&&le!==1&&s(I.minFilter!==J&&I.minFilter!==H&&I.minFilter!==te&&I.minFilter!==pe,"min filter requires mipmap"):(s(Hr(we)&&Hr(le),"texture must be a square power of 2 to support mipmapping"),s(G.mipmask===(we<<1)-1,"missing or incomplete mipmap data")),G.type===St&&(V.extensions.indexOf("oes_texture_float_linear")<0&&s(I.minFilter===W&&I.magFilter===W,"filter not supported, must enable oes_texture_float_linear"),s(!I.genMipmaps,"mipmap generation not supported with float textures"));var Ie=G.images;for(ce=0;ce<16;++ce)if(Ie[ce]){var Oe=we>>ce,Fe=le>>ce;s(G.mipmask&1<<ce,"missing mipmap data");var De=Ie[ce];if(s(De.width===Oe&&De.height===Fe,"invalid shape for mip images"),s(De.format===G.format&&De.internalformat===G.internalformat&&De.type===G.type,"incompatible type for mip image"),!De.compressed)if(De.data){var $e=Math.ceil(ir(De.type,de)*Oe/De.unpackAlignment)*De.unpackAlignment;s(De.data.byteLength===$e*Fe,"invalid data for image, buffer size is inconsistent with image format")}else De.element||De.copy}else I.genMipmaps||s((G.mipmask&1<<ce)===0,"extra mipmap data");G.compressed&&s(!I.genMipmaps,"mipmap generation for compressed images not supported")}function ae(I,G,V,ce){var we=I.width,le=I.height,de=I.channels;s(we>0&&we<=ce.maxTextureSize&&le>0&&le<=ce.maxTextureSize,"invalid texture shape"),s(we===le,"cube map must be square"),s(G.wrapS===P&&G.wrapT===P,"wrap mode not supported by cube map");for(var Ie=0;Ie<V.length;++Ie){var Oe=V[Ie];s(Oe.width===we&&Oe.height===le,"inconsistent cube map face shape"),G.genMipmaps&&(s(!Oe.compressed,"can not generate mipmap for compressed textures"),s(Oe.mipmask===1,"can not specify mipmaps and generate mipmaps"));for(var Fe=Oe.images,De=0;De<16;++De){var $e=Fe[De];if($e){var Ve=we>>De,ke=le>>De;s(Oe.mipmask&1<<De,"missing mipmap data"),s($e.width===Ve&&$e.height===ke,"invalid shape for mip images"),s($e.format===I.format&&$e.internalformat===I.internalformat&&$e.type===I.type,"incompatible type for mip image"),$e.compressed||($e.data?s($e.data.byteLength===Ve*ke*Math.max(ir($e.type,de),$e.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):$e.element||$e.copy)}}}}var L=n(s,{optional:Y,raise:o,commandRaise:O,command:F,parameter:f,commandParameter:D,constructor:g,type:h,commandType:$,isTypedArray:l,nni:d,oneOf:v,shaderError:S,linkError:A,callSite:E,saveCommandRef:T,saveDrawInfo:k,framebufferFormat:N,guessCommand:w,texture2D:tt,textureCube:ae}),Se=0,Ge=0,ye=5,Ye=6;function We(I,G){this.id=Se++,this.type=I,this.data=G}function qe(I){return I.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function et(I){if(I.length===0)return[];var G=I.charAt(0),V=I.charAt(I.length-1);if(I.length>1&&G===V&&(G==='"'||G==="'"))return['"'+qe(I.substr(1,I.length-2))+'"'];var ce=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(I);if(ce)return et(I.substr(0,ce.index)).concat(et(ce[1])).concat(et(I.substr(ce.index+ce[0].length)));var we=I.split(".");if(we.length===1)return['"'+qe(I)+'"'];for(var le=[],de=0;de<we.length;++de)le=le.concat(et(we[de]));return le}function gt(I){return"["+et(I).join("][")+"]"}function Pt(I,G){return new We(I,gt(G+""))}function cr(I){return typeof I=="function"&&!I._reglType||I instanceof We}function Rt(I,G){if(typeof I=="function")return new We(Ge,I);if(typeof I=="number"||typeof I=="boolean")return new We(ye,I);if(Array.isArray(I))return new We(Ye,I.map((V,ce)=>Rt(V,G+"["+ce+"]")));if(I instanceof We)return I;L(!1,"invalid option type in uniform "+G)}var hr={DynamicVariable:We,define:Pt,isDynamic:cr,unbox:Rt,accessor:gt},ur={next:typeof requestAnimationFrame=="function"?function(I){return requestAnimationFrame(I)}:function(I){return setTimeout(I,16)},cancel:typeof cancelAnimationFrame=="function"?function(I){return cancelAnimationFrame(I)}:clearTimeout},br=typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return+new Date};function vr(){var I={"":0},G=[""];return{id:function(V){var ce=I[V];return ce||(ce=I[V]=G.length,G.push(V),ce)},str:function(V){return G[V]}}}function bn(I,G,V){var ce=document.createElement("canvas");n(ce.style,{border:0,margin:0,padding:0,top:0,left:0}),I.appendChild(ce),I===document.body&&(ce.style.position="absolute",n(I.style,{margin:0,padding:0}));function we(){var Ie=window.innerWidth,Oe=window.innerHeight;if(I!==document.body){var Fe=I.getBoundingClientRect();Ie=Fe.right-Fe.left,Oe=Fe.bottom-Fe.top}ce.width=V*Ie,ce.height=V*Oe,n(ce.style,{width:Ie+"px",height:Oe+"px"})}var le;I!==document.body&&typeof ResizeObserver=="function"?(le=new ResizeObserver(function(){setTimeout(we)}),le.observe(I)):window.addEventListener("resize",we,!1);function de(){le?le.disconnect():window.removeEventListener("resize",we),I.removeChild(ce)}return we(),{canvas:ce,onDestroy:de}}function ar(I,G){function V(ce){try{return I.getContext(ce,G)}catch{return null}}return V("webgl")||V("experimental-webgl")||V("webgl-experimental")}function $r(I){return typeof I.nodeName=="string"&&typeof I.appendChild=="function"&&typeof I.getBoundingClientRect=="function"}function bi(I){return typeof I.drawArrays=="function"||typeof I.drawElements=="function"}function qr(I){return typeof I=="string"?I.split():(L(Array.isArray(I),"invalid extension array"),I)}function Ka(I){return typeof I=="string"?(L(typeof document<"u","not supported outside of DOM"),document.querySelector(I)):I}function rf(I){var G=I||{},V,ce,we,le,de={},Ie=[],Oe=[],Fe=typeof window>"u"?1:window.devicePixelRatio,De=!1,$e=function(je){je&&L.raise(je)},Ve=function(){};if(typeof G=="string"?(L(typeof document<"u","selector queries only supported in DOM enviroments"),V=document.querySelector(G),L(V,"invalid query string for element")):typeof G=="object"?$r(G)?V=G:bi(G)?(le=G,we=le.canvas):(L.constructor(G),"gl"in G?le=G.gl:"canvas"in G?we=Ka(G.canvas):"container"in G&&(ce=Ka(G.container)),"attributes"in G&&(de=G.attributes,L.type(de,"object","invalid context attributes")),"extensions"in G&&(Ie=qr(G.extensions)),"optionalExtensions"in G&&(Oe=qr(G.optionalExtensions)),"onDone"in G&&(L.type(G.onDone,"function","invalid or missing onDone callback"),$e=G.onDone),"profile"in G&&(De=!!G.profile),"pixelRatio"in G&&(Fe=+G.pixelRatio,L(Fe>0,"invalid pixel ratio"))):L.raise("invalid arguments to regl"),V&&(V.nodeName.toLowerCase()==="canvas"?we=V:ce=V),!le){if(!we){L(typeof document<"u","must manually specify webgl context outside of DOM environments");var ke=bn(ce||document.body,$e,Fe);if(!ke)return null;we=ke.canvas,Ve=ke.onDestroy}de.premultipliedAlpha===void 0&&(de.premultipliedAlpha=!0),le=ar(we,de)}return le?{gl:le,canvas:we,container:ce,extensions:Ie,optionalExtensions:Oe,pixelRatio:Fe,profile:De,onDone:$e,onDestroy:Ve}:(Ve(),$e("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function nf(I,G){var V={};function ce(de){L.type(de,"string","extension name must be string");var Ie=de.toLowerCase(),Oe;try{Oe=V[Ie]=I.getExtension(Ie)}catch{}return!!Oe}for(var we=0;we<G.extensions.length;++we){var le=G.extensions[we];if(!ce(le))return G.onDestroy(),G.onDone('"'+le+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return G.optionalExtensions.forEach(ce),{extensions:V,restore:function(){Object.keys(V).forEach(function(de){if(V[de]&&!ce(de))throw new Error("(regl): error restoring extension "+de)})}}}function un(I,G){for(var V=Array(I),ce=0;ce<I;++ce)V[ce]=G(ce);return V}var Ea=5120,Fo=5121,af=5122,of=5123,sf=5124,xi=5125,jr=5126;function wi(I){for(var G=16;G<=1<<28;G*=16)if(I<=G)return G;return 0}function At(I){var G,V;return G=(I>65535)<<4,I>>>=G,V=(I>255)<<3,I>>>=V,G|=V,V=(I>15)<<2,I>>>=V,G|=V,V=(I>3)<<1,I>>>=V,G|=V,G|I>>1}function pr(){var I=un(8,function(){return[]});function G(le){var de=wi(le),Ie=I[At(de)>>2];return Ie.length>0?Ie.pop():new ArrayBuffer(de)}function V(le){I[At(le.byteLength)>>2].push(le)}function ce(le,de){var Ie=null;switch(le){case Ea:Ie=new Int8Array(G(de),0,de);break;case Fo:Ie=new Uint8Array(G(de),0,de);break;case af:Ie=new Int16Array(G(2*de),0,de);break;case of:Ie=new Uint16Array(G(2*de),0,de);break;case sf:Ie=new Int32Array(G(4*de),0,de);break;case xi:Ie=new Uint32Array(G(4*de),0,de);break;case jr:Ie=new Float32Array(G(4*de),0,de);break;default:return null}return Ie.length!==de?Ie.subarray(0,de):Ie}function we(le){V(le.buffer)}return{alloc:G,free:V,allocType:ce,freeType:we}}var bt=pr();bt.zero=pr();var Ir=3408,xn=3410,Go=3411,zo=3412,_a=3413,$o=3414,jo=3415,Uo=33901,GD=33902,zD=3379,$D=3386,jD=34921,UD=36347,XD=36348,YD=35661,WD=35660,VD=34930,HD=36349,qD=34076,ZD=34024,KD=7936,QD=7937,JD=7938,eP=35724,tP=34047,rP=36063,nP=34852,bc=3553,kb=34067,iP=34069,aP=33984,uf=6408,gp=5126,Lb=5121,yp=36160,oP=36053,sP=36064,uP=16384,fP=function(I,G){var V=1;G.ext_texture_filter_anisotropic&&(V=I.getParameter(tP));var ce=1,we=1;G.webgl_draw_buffers&&(ce=I.getParameter(nP),we=I.getParameter(rP));var le=!!G.oes_texture_float;if(le){var de=I.createTexture();I.bindTexture(bc,de),I.texImage2D(bc,0,uf,1,1,0,uf,gp,null);var Ie=I.createFramebuffer();if(I.bindFramebuffer(yp,Ie),I.framebufferTexture2D(yp,sP,bc,de,0),I.bindTexture(bc,null),I.checkFramebufferStatus(yp)!==oP)le=!1;else{I.viewport(0,0,1,1),I.clearColor(1,0,0,1),I.clear(uP);var Oe=bt.allocType(gp,4);I.readPixels(0,0,1,1,uf,gp,Oe),I.getError()?le=!1:(I.deleteFramebuffer(Ie),I.deleteTexture(de),le=Oe[0]===1),bt.freeType(Oe)}}var Fe=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),De=!0;if(!Fe){var $e=I.createTexture(),Ve=bt.allocType(Lb,36);I.activeTexture(aP),I.bindTexture(kb,$e),I.texImage2D(iP,0,uf,3,3,0,uf,Lb,Ve),bt.freeType(Ve),I.bindTexture(kb,null),I.deleteTexture($e),De=!I.getError()}return{colorBits:[I.getParameter(xn),I.getParameter(Go),I.getParameter(zo),I.getParameter(_a)],depthBits:I.getParameter($o),stencilBits:I.getParameter(jo),subpixelBits:I.getParameter(Ir),extensions:Object.keys(G).filter(function(ke){return!!G[ke]}),maxAnisotropic:V,maxDrawbuffers:ce,maxColorAttachments:we,pointSizeDims:I.getParameter(Uo),lineWidthDims:I.getParameter(GD),maxViewportDims:I.getParameter($D),maxCombinedTextureUnits:I.getParameter(YD),maxCubeMapSize:I.getParameter(qD),maxRenderbufferSize:I.getParameter(ZD),maxTextureUnits:I.getParameter(VD),maxTextureSize:I.getParameter(zD),maxAttributes:I.getParameter(jD),maxVertexUniforms:I.getParameter(UD),maxVertexTextureUnits:I.getParameter(WD),maxVaryingVectors:I.getParameter(XD),maxFragmentUniforms:I.getParameter(HD),glsl:I.getParameter(eP),renderer:I.getParameter(QD),vendor:I.getParameter(KD),version:I.getParameter(JD),readFloat:le,npotTextureCube:De}};function Ei(I){return!!I&&typeof I=="object"&&Array.isArray(I.shape)&&Array.isArray(I.stride)&&typeof I.offset=="number"&&I.shape.length===I.stride.length&&(Array.isArray(I.data)||t(I.data))}var Un=function(I){return Object.keys(I).map(function(G){return I[G]})},xc={shape:dP,flatten:hP};function lP(I,G,V){for(var ce=0;ce<G;++ce)V[ce]=I[ce]}function cP(I,G,V,ce){for(var we=0,le=0;le<G;++le)for(var de=I[le],Ie=0;Ie<V;++Ie)ce[we++]=de[Ie]}function Nb(I,G,V,ce,we,le){for(var de=le,Ie=0;Ie<G;++Ie)for(var Oe=I[Ie],Fe=0;Fe<V;++Fe)for(var De=Oe[Fe],$e=0;$e<ce;++$e)we[de++]=De[$e]}function Ob(I,G,V,ce,we){for(var le=1,de=V+1;de<G.length;++de)le*=G[de];var Ie=G[V];if(G.length-V===4){var Oe=G[V+1],Fe=G[V+2],De=G[V+3];for(de=0;de<Ie;++de)Nb(I[de],Oe,Fe,De,ce,we),we+=le}else for(de=0;de<Ie;++de)Ob(I[de],G,V+1,ce,we),we+=le}function hP(I,G,V,ce){var we=1;if(G.length)for(var le=0;le<G.length;++le)we*=G[le];else we=0;var de=ce||bt.allocType(V,we);switch(G.length){case 0:break;case 1:lP(I,G[0],de);break;case 2:cP(I,G[0],G[1],de);break;case 3:Nb(I,G[0],G[1],G[2],de,0);break;default:Ob(I,G,0,de,0)}return de}function dP(I){for(var G=[],V=I;V.length;V=V[0])G.push(V.length);return G}var mp={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},vP=5120,pP=5122,gP=5124,yP=5121,mP=5123,bP=5125,xP=5126,wP=5126,Xo={int8:vP,int16:pP,int32:gP,uint8:yP,uint16:mP,uint32:bP,float:xP,float32:wP},EP=35048,_P=35040,wc={dynamic:EP,stream:_P,static:35044},bp=xc.flatten,Db=xc.shape,Pb=35044,SP=35040,xp=5121,wp=5126,Qa=[];Qa[5120]=1,Qa[5122]=2,Qa[5124]=4,Qa[5121]=1,Qa[5123]=2,Qa[5125]=4,Qa[5126]=4;function Ec(I){return mp[Object.prototype.toString.call(I)]|0}function Rb(I,G){for(var V=0;V<G.length;++V)I[V]=G[V]}function Bb(I,G,V,ce,we,le,de){for(var Ie=0,Oe=0;Oe<V;++Oe)for(var Fe=0;Fe<ce;++Fe)I[Ie++]=G[we*Oe+le*Fe+de]}function MP(I,G,V,ce){var we=0,le={};function de(oe){this.id=we++,this.buffer=I.createBuffer(),this.type=oe,this.usage=Pb,this.byteLength=0,this.dimension=1,this.dtype=xp,this.persistentData=null,V.profile&&(this.stats={size:0})}de.prototype.bind=function(){I.bindBuffer(this.type,this.buffer)},de.prototype.destroy=function(){Ve(this)};var Ie=[];function Oe(oe,ve){var Be=Ie.pop();return Be||(Be=new de(oe)),Be.bind(),$e(Be,ve,SP,0,1,!1),Be}function Fe(oe){Ie.push(oe)}function De(oe,ve,Be){oe.byteLength=ve.byteLength,I.bufferData(oe.type,ve,Be)}function $e(oe,ve,Be,Ke,Me,rt){var Ae;if(oe.usage=Be,Array.isArray(ve)){if(oe.dtype=Ke||wp,ve.length>0){var Ue;if(Array.isArray(ve[0])){Ae=Db(ve);for(var Ce=1,Xe=1;Xe<Ae.length;++Xe)Ce*=Ae[Xe];oe.dimension=Ce,Ue=bp(ve,Ae,oe.dtype),De(oe,Ue,Be),rt?oe.persistentData=Ue:bt.freeType(Ue)}else if(typeof ve[0]=="number"){oe.dimension=Me;var vt=bt.allocType(oe.dtype,ve.length);Rb(vt,ve),De(oe,vt,Be),rt?oe.persistentData=vt:bt.freeType(vt)}else t(ve[0])?(oe.dimension=ve[0].length,oe.dtype=Ke||Ec(ve[0])||wp,Ue=bp(ve,[ve.length,ve[0].length],oe.dtype),De(oe,Ue,Be),rt?oe.persistentData=Ue:bt.freeType(Ue)):L.raise("invalid buffer data")}}else if(t(ve))oe.dtype=Ke||Ec(ve),oe.dimension=Me,De(oe,ve,Be),rt&&(oe.persistentData=new Uint8Array(new Uint8Array(ve.buffer)));else if(Ei(ve)){Ae=ve.shape;var Tt=ve.stride,He=ve.offset,ze=0,_e=0,Ct=0,Nt=0;Ae.length===1?(ze=Ae[0],_e=1,Ct=Tt[0],Nt=0):Ae.length===2?(ze=Ae[0],_e=Ae[1],Ct=Tt[0],Nt=Tt[1]):L.raise("invalid shape"),oe.dtype=Ke||Ec(ve.data)||wp,oe.dimension=_e;var ot=bt.allocType(oe.dtype,ze*_e);Bb(ot,ve.data,ze,_e,Ct,Nt,He),De(oe,ot,Be),rt?oe.persistentData=ot:bt.freeType(ot)}else ve instanceof ArrayBuffer?(oe.dtype=xp,oe.dimension=Me,De(oe,ve,Be),rt&&(oe.persistentData=new Uint8Array(new Uint8Array(ve)))):L.raise("invalid buffer data")}function Ve(oe){G.bufferCount--,ce(oe);var ve=oe.buffer;L(ve,"buffer must not be deleted already"),I.deleteBuffer(ve),oe.buffer=null,delete le[oe.id]}function ke(oe,ve,Be,Ke){G.bufferCount++;var Me=new de(ve);le[Me.id]=Me;function rt(Ce){var Xe=Pb,vt=null,Tt=0,He=0,ze=1;return Array.isArray(Ce)||t(Ce)||Ei(Ce)||Ce instanceof ArrayBuffer?vt=Ce:typeof Ce=="number"?Tt=Ce|0:Ce&&(L.type(Ce,"object","buffer arguments must be an object, a number or an array"),"data"in Ce&&(L(vt===null||Array.isArray(vt)||t(vt)||Ei(vt),"invalid data for buffer"),vt=Ce.data),"usage"in Ce&&(L.parameter(Ce.usage,wc,"invalid buffer usage"),Xe=wc[Ce.usage]),"type"in Ce&&(L.parameter(Ce.type,Xo,"invalid buffer type"),He=Xo[Ce.type]),"dimension"in Ce&&(L.type(Ce.dimension,"number","invalid dimension"),ze=Ce.dimension|0),"length"in Ce&&(L.nni(Tt,"buffer length must be a nonnegative integer"),Tt=Ce.length|0)),Me.bind(),vt?$e(Me,vt,Xe,He,ze,Ke):(Tt&&I.bufferData(Me.type,Tt,Xe),Me.dtype=He||xp,Me.usage=Xe,Me.dimension=ze,Me.byteLength=Tt),V.profile&&(Me.stats.size=Me.byteLength*Qa[Me.dtype]),rt}function Ae(Ce,Xe){L(Xe+Ce.byteLength<=Me.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+Ce.byteLength+" starting from offset "+Xe+" to a buffer of size "+Me.byteLength),I.bufferSubData(Me.type,Xe,Ce)}function Ue(Ce,Xe){var vt=(Xe||0)|0,Tt;if(Me.bind(),t(Ce)||Ce instanceof ArrayBuffer)Ae(Ce,vt);else if(Array.isArray(Ce)){if(Ce.length>0)if(typeof Ce[0]=="number"){var He=bt.allocType(Me.dtype,Ce.length);Rb(He,Ce),Ae(He,vt),bt.freeType(He)}else if(Array.isArray(Ce[0])||t(Ce[0])){Tt=Db(Ce);var ze=bp(Ce,Tt,Me.dtype);Ae(ze,vt),bt.freeType(ze)}else L.raise("invalid buffer data")}else if(Ei(Ce)){Tt=Ce.shape;var _e=Ce.stride,Ct=0,Nt=0,ot=0,Gt=0;Tt.length===1?(Ct=Tt[0],Nt=1,ot=_e[0],Gt=0):Tt.length===2?(Ct=Tt[0],Nt=Tt[1],ot=_e[0],Gt=_e[1]):L.raise("invalid shape");var It=Array.isArray(Ce.data)?Me.dtype:Ec(Ce.data),Bt=bt.allocType(It,Ct*Nt);Bb(Bt,Ce.data,Ct,Nt,ot,Gt,Ce.offset),Ae(Bt,vt),bt.freeType(Bt)}else L.raise("invalid data for buffer subdata");return rt}return Be||rt(oe),rt._reglType="buffer",rt._buffer=Me,rt.subdata=Ue,V.profile&&(rt.stats=Me.stats),rt.destroy=function(){Ve(Me)},rt}function je(){Un(le).forEach(function(oe){oe.buffer=I.createBuffer(),I.bindBuffer(oe.type,oe.buffer),I.bufferData(oe.type,oe.persistentData||oe.byteLength,oe.usage)})}return V.profile&&(G.getTotalBufferSize=function(){var oe=0;return Object.keys(le).forEach(function(ve){oe+=le[ve].stats.size}),oe}),{create:ke,createStream:Oe,destroyStream:Fe,clear:function(){Un(le).forEach(Ve),Ie.forEach(Ve)},getBuffer:function(oe){return oe&&oe._buffer instanceof de?oe._buffer:null},restore:je,_initBuffer:$e}}var CP=0,AP=0,TP=1,IP=1,kP=4,LP=4,Gs={points:CP,point:AP,lines:TP,line:IP,triangles:kP,triangle:LP,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},NP=0,OP=1,ff=4,DP=5120,zs=5121,Fb=5122,$s=5123,Gb=5124,Yo=5125,Ep=34963,PP=35040,RP=35044;function BP(I,G,V,ce){var we={},le=0,de={uint8:zs,uint16:$s};G.oes_element_index_uint&&(de.uint32=Yo);function Ie(je){this.id=le++,we[this.id]=this,this.buffer=je,this.primType=ff,this.vertCount=0,this.type=0}Ie.prototype.bind=function(){this.buffer.bind()};var Oe=[];function Fe(je){var oe=Oe.pop();return oe||(oe=new Ie(V.create(null,Ep,!0,!1)._buffer)),$e(oe,je,PP,-1,-1,0,0),oe}function De(je){Oe.push(je)}function $e(je,oe,ve,Be,Ke,Me,rt){je.buffer.bind();var Ae;if(oe){var Ue=rt;!rt&&(!t(oe)||Ei(oe)&&!t(oe.data))&&(Ue=G.oes_element_index_uint?Yo:$s),V._initBuffer(je.buffer,oe,ve,Ue,3)}else I.bufferData(Ep,Me,ve),je.buffer.dtype=Ae||zs,je.buffer.usage=ve,je.buffer.dimension=3,je.buffer.byteLength=Me;if(Ae=rt,!rt){switch(je.buffer.dtype){case zs:case DP:Ae=zs;break;case $s:case Fb:Ae=$s;break;case Yo:case Gb:Ae=Yo;break;default:L.raise("unsupported type for element array")}je.buffer.dtype=Ae}je.type=Ae,L(Ae!==Yo||!!G.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var Ce=Ke;Ce<0&&(Ce=je.buffer.byteLength,Ae===$s?Ce>>=1:Ae===Yo&&(Ce>>=2)),je.vertCount=Ce;var Xe=Be;if(Be<0){Xe=ff;var vt=je.buffer.dimension;vt===1&&(Xe=NP),vt===2&&(Xe=OP),vt===3&&(Xe=ff)}je.primType=Xe}function Ve(je){ce.elementsCount--,L(je.buffer!==null,"must not double destroy elements"),delete we[je.id],je.buffer.destroy(),je.buffer=null}function ke(je,oe){var ve=V.create(null,Ep,!0),Be=new Ie(ve._buffer);ce.elementsCount++;function Ke(Me){if(!Me)ve(),Be.primType=ff,Be.vertCount=0,Be.type=zs;else if(typeof Me=="number")ve(Me),Be.primType=ff,Be.vertCount=Me|0,Be.type=zs;else{var rt=null,Ae=RP,Ue=-1,Ce=-1,Xe=0,vt=0;Array.isArray(Me)||t(Me)||Ei(Me)?rt=Me:(L.type(Me,"object","invalid arguments for elements"),"data"in Me&&(rt=Me.data,L(Array.isArray(rt)||t(rt)||Ei(rt),"invalid data for element buffer")),"usage"in Me&&(L.parameter(Me.usage,wc,"invalid element buffer usage"),Ae=wc[Me.usage]),"primitive"in Me&&(L.parameter(Me.primitive,Gs,"invalid element buffer primitive"),Ue=Gs[Me.primitive]),"count"in Me&&(L(typeof Me.count=="number"&&Me.count>=0,"invalid vertex count for elements"),Ce=Me.count|0),"type"in Me&&(L.parameter(Me.type,de,"invalid buffer type"),vt=de[Me.type]),"length"in Me?Xe=Me.length|0:(Xe=Ce,vt===$s||vt===Fb?Xe*=2:(vt===Yo||vt===Gb)&&(Xe*=4))),$e(Be,rt,Ae,Ue,Ce,Xe,vt)}return Ke}return Ke(je),Ke._reglType="elements",Ke._elements=Be,Ke.subdata=function(Me,rt){return ve.subdata(Me,rt),Ke},Ke.destroy=function(){Ve(Be)},Ke}return{create:ke,createStream:Fe,destroyStream:De,getElements:function(je){return typeof je=="function"&&je._elements instanceof Ie?je._elements:null},clear:function(){Un(we).forEach(Ve)}}}var zb=new Float32Array(1),FP=new Uint32Array(zb.buffer),GP=5123;function $b(I){for(var G=bt.allocType(GP,I.length),V=0;V<I.length;++V)if(isNaN(I[V]))G[V]=65535;else if(I[V]===1/0)G[V]=31744;else if(I[V]===-1/0)G[V]=64512;else{zb[0]=I[V];var ce=FP[0],we=ce>>>31<<15,le=(ce<<1>>>24)-127,de=ce>>13&1023;if(le<-24)G[V]=we;else if(le<-14){var Ie=-14-le;G[V]=we+(de+1024>>Ie)}else le>15?G[V]=we+31744:G[V]=we+(le+15<<10)+de}return G}function kr(I){return Array.isArray(I)||t(I)}var jb=function(I){return!(I&I-1)&&!!I},zP=34467,$i=3553,_p=34067,_c=34069,Wo=6408,Sp=6406,Sc=6407,lf=6409,Mc=6410,Ub=32854,Mp=32855,Xb=36194,$P=32819,jP=32820,UP=33635,XP=34042,Cp=6402,Cc=34041,Ap=35904,Tp=35906,js=36193,Ip=33776,kp=33777,Lp=33778,Np=33779,Yb=35986,Wb=35987,Vb=34798,Hb=35840,qb=35841,Zb=35842,Kb=35843,Qb=36196,Us=5121,Op=5123,Dp=5125,cf=5126,YP=10242,WP=10243,VP=10497,Pp=33071,HP=33648,qP=10240,ZP=10241,Rp=9728,KP=9729,Bp=9984,Jb=9985,ex=9986,Fp=9987,QP=33170,Ac=4352,JP=4353,e3=4354,t3=34046,r3=3317,n3=37440,i3=37441,a3=37443,tx=37444,hf=33984,o3=[Bp,ex,Jb,Fp],Tc=[0,lf,Mc,Sc,Wo],ni={};ni[lf]=ni[Sp]=ni[Cp]=1,ni[Cc]=ni[Mc]=2,ni[Sc]=ni[Ap]=3,ni[Wo]=ni[Tp]=4;function Xs(I){return"[object "+I+"]"}var rx=Xs("HTMLCanvasElement"),nx=Xs("OffscreenCanvas"),ix=Xs("CanvasRenderingContext2D"),ax=Xs("ImageBitmap"),ox=Xs("HTMLImageElement"),sx=Xs("HTMLVideoElement"),s3=Object.keys(mp).concat([rx,nx,ix,ax,ox,sx]),Ys=[];Ys[Us]=1,Ys[cf]=4,Ys[js]=2,Ys[Op]=2,Ys[Dp]=4;var fn=[];fn[Ub]=2,fn[Mp]=2,fn[Xb]=2,fn[Cc]=4,fn[Ip]=.5,fn[kp]=.5,fn[Lp]=1,fn[Np]=1,fn[Yb]=.5,fn[Wb]=1,fn[Vb]=1,fn[Hb]=.5,fn[qb]=.25,fn[Zb]=.5,fn[Kb]=.25,fn[Qb]=.5;function ux(I){return Array.isArray(I)&&(I.length===0||typeof I[0]=="number")}function fx(I){if(!Array.isArray(I))return!1;var G=I.length;return!(G===0||!kr(I[0]))}function Vo(I){return Object.prototype.toString.call(I)}function lx(I){return Vo(I)===rx}function cx(I){return Vo(I)===nx}function u3(I){return Vo(I)===ix}function f3(I){return Vo(I)===ax}function l3(I){return Vo(I)===ox}function c3(I){return Vo(I)===sx}function Gp(I){if(!I)return!1;var G=Vo(I);return s3.indexOf(G)>=0?!0:ux(I)||fx(I)||Ei(I)}function hx(I){return mp[Object.prototype.toString.call(I)]|0}function h3(I,G){var V=G.length;switch(I.type){case Us:case Op:case Dp:case cf:var ce=bt.allocType(I.type,V);ce.set(G),I.data=ce;break;case js:I.data=$b(G);break;default:L.raise("unsupported texture type, must specify a typed array")}}function dx(I,G){return bt.allocType(I.type===js?cf:I.type,G)}function vx(I,G){I.type===js?(I.data=$b(G),bt.freeType(G)):I.data=G}function d3(I,G,V,ce,we,le){for(var de=I.width,Ie=I.height,Oe=I.channels,Fe=de*Ie*Oe,De=dx(I,Fe),$e=0,Ve=0;Ve<Ie;++Ve)for(var ke=0;ke<de;++ke)for(var je=0;je<Oe;++je)De[$e++]=G[V*ke+ce*Ve+we*je+le];vx(I,De)}function Ic(I,G,V,ce,we,le){var de;if(typeof fn[I]<"u"?de=fn[I]:de=ni[I]*Ys[G],le&&(de*=6),we){for(var Ie=0,Oe=V;Oe>=1;)Ie+=de*Oe*Oe,Oe/=2;return Ie}else return de*V*ce}function v3(I,G,V,ce,we,le,de){var Ie={"don't care":Ac,"dont care":Ac,nice:e3,fast:JP},Oe={repeat:VP,clamp:Pp,mirror:HP},Fe={nearest:Rp,linear:KP},De=n({mipmap:Fp,"nearest mipmap nearest":Bp,"linear mipmap nearest":Jb,"nearest mipmap linear":ex,"linear mipmap linear":Fp},Fe),$e={none:0,browser:tx},Ve={uint8:Us,rgba4:$P,rgb565:UP,"rgb5 a1":jP},ke={alpha:Sp,luminance:lf,"luminance alpha":Mc,rgb:Sc,rgba:Wo,rgba4:Ub,"rgb5 a1":Mp,rgb565:Xb},je={};G.ext_srgb&&(ke.srgb=Ap,ke.srgba=Tp),G.oes_texture_float&&(Ve.float32=Ve.float=cf),G.oes_texture_half_float&&(Ve.float16=Ve["half float"]=js),G.webgl_depth_texture&&(n(ke,{depth:Cp,"depth stencil":Cc}),n(Ve,{uint16:Op,uint32:Dp,"depth stencil":XP})),G.webgl_compressed_texture_s3tc&&n(je,{"rgb s3tc dxt1":Ip,"rgba s3tc dxt1":kp,"rgba s3tc dxt3":Lp,"rgba s3tc dxt5":Np}),G.webgl_compressed_texture_atc&&n(je,{"rgb atc":Yb,"rgba atc explicit alpha":Wb,"rgba atc interpolated alpha":Vb}),G.webgl_compressed_texture_pvrtc&&n(je,{"rgb pvrtc 4bppv1":Hb,"rgb pvrtc 2bppv1":qb,"rgba pvrtc 4bppv1":Zb,"rgba pvrtc 2bppv1":Kb}),G.webgl_compressed_texture_etc1&&(je["rgb etc1"]=Qb);var oe=Array.prototype.slice.call(I.getParameter(zP));Object.keys(je).forEach(function(X){var he=je[X];oe.indexOf(he)>=0&&(ke[X]=he)});var ve=Object.keys(ke);V.textureFormats=ve;var Be=[];Object.keys(ke).forEach(function(X){var he=ke[X];Be[he]=X});var Ke=[];Object.keys(Ve).forEach(function(X){var he=Ve[X];Ke[he]=X});var Me=[];Object.keys(Fe).forEach(function(X){var he=Fe[X];Me[he]=X});var rt=[];Object.keys(De).forEach(function(X){var he=De[X];rt[he]=X});var Ae=[];Object.keys(Oe).forEach(function(X){var he=Oe[X];Ae[he]=X});var Ue=ve.reduce(function(X,he){var fe=ke[he];return fe===lf||fe===Sp||fe===lf||fe===Mc||fe===Cp||fe===Cc||G.ext_srgb&&(fe===Ap||fe===Tp)?X[fe]=fe:fe===Mp||he.indexOf("rgba")>=0?X[fe]=Wo:X[fe]=Sc,X},{});function Ce(){this.internalformat=Wo,this.format=Wo,this.type=Us,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=tx,this.width=0,this.height=0,this.channels=0}function Xe(X,he){X.internalformat=he.internalformat,X.format=he.format,X.type=he.type,X.compressed=he.compressed,X.premultiplyAlpha=he.premultiplyAlpha,X.flipY=he.flipY,X.unpackAlignment=he.unpackAlignment,X.colorSpace=he.colorSpace,X.width=he.width,X.height=he.height,X.channels=he.channels}function vt(X,he){if(!(typeof he!="object"||!he)){if("premultiplyAlpha"in he&&(L.type(he.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),X.premultiplyAlpha=he.premultiplyAlpha),"flipY"in he&&(L.type(he.flipY,"boolean","invalid texture flip"),X.flipY=he.flipY),"alignment"in he&&(L.oneOf(he.alignment,[1,2,4,8],"invalid texture unpack alignment"),X.unpackAlignment=he.alignment),"colorSpace"in he&&(L.parameter(he.colorSpace,$e,"invalid colorSpace"),X.colorSpace=$e[he.colorSpace]),"type"in he){var fe=he.type;L(G.oes_texture_float||!(fe==="float"||fe==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),L(G.oes_texture_half_float||!(fe==="half float"||fe==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),L(G.webgl_depth_texture||!(fe==="uint16"||fe==="uint32"||fe==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),L.parameter(fe,Ve,"invalid texture type"),X.type=Ve[fe]}var it=X.width,zt=X.height,j=X.channels,R=!1;"shape"in he?(L(Array.isArray(he.shape)&&he.shape.length>=2,"shape must be an array"),it=he.shape[0],zt=he.shape[1],he.shape.length===3&&(j=he.shape[2],L(j>0&&j<=4,"invalid number of channels"),R=!0),L(it>=0&&it<=V.maxTextureSize,"invalid width"),L(zt>=0&&zt<=V.maxTextureSize,"invalid height")):("radius"in he&&(it=zt=he.radius,L(it>=0&&it<=V.maxTextureSize,"invalid radius")),"width"in he&&(it=he.width,L(it>=0&&it<=V.maxTextureSize,"invalid width")),"height"in he&&(zt=he.height,L(zt>=0&&zt<=V.maxTextureSize,"invalid height")),"channels"in he&&(j=he.channels,L(j>0&&j<=4,"invalid number of channels"),R=!0)),X.width=it|0,X.height=zt|0,X.channels=j|0;var Z=!1;if("format"in he){var ie=he.format;L(G.webgl_depth_texture||!(ie==="depth"||ie==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),L.parameter(ie,ke,"invalid texture format");var se=X.internalformat=ke[ie];X.format=Ue[se],ie in Ve&&("type"in he||(X.type=Ve[ie])),ie in je&&(X.compressed=!0),Z=!0}!R&&Z?X.channels=ni[X.format]:R&&!Z?X.channels!==Tc[X.format]&&(X.format=X.internalformat=Tc[X.channels]):Z&&R&&L(X.channels===ni[X.format],"number of channels inconsistent with specified format")}}function Tt(X){I.pixelStorei(n3,X.flipY),I.pixelStorei(i3,X.premultiplyAlpha),I.pixelStorei(a3,X.colorSpace),I.pixelStorei(r3,X.unpackAlignment)}function He(){Ce.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function ze(X,he){var fe=null;if(Gp(he)?fe=he:he&&(L.type(he,"object","invalid pixel data type"),vt(X,he),"x"in he&&(X.xOffset=he.x|0),"y"in he&&(X.yOffset=he.y|0),Gp(he.data)&&(fe=he.data)),L(!X.compressed||fe instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),he.copy){L(!fe,"can not specify copy and data field for the same texture");var it=we.viewportWidth,zt=we.viewportHeight;X.width=X.width||it-X.xOffset,X.height=X.height||zt-X.yOffset,X.needsCopy=!0,L(X.xOffset>=0&&X.xOffset<it&&X.yOffset>=0&&X.yOffset<zt&&X.width>0&&X.width<=it&&X.height>0&&X.height<=zt,"copy texture read out of bounds")}else if(!fe)X.width=X.width||1,X.height=X.height||1,X.channels=X.channels||4;else if(t(fe))X.channels=X.channels||4,X.data=fe,!("type"in he)&&X.type===Us&&(X.type=hx(fe));else if(ux(fe))X.channels=X.channels||4,h3(X,fe),X.alignment=1,X.needsFree=!0;else if(Ei(fe)){var j=fe.data;!Array.isArray(j)&&X.type===Us&&(X.type=hx(j));var R=fe.shape,Z=fe.stride,ie,se,ee,Q,re,U;R.length===3?(ee=R[2],U=Z[2]):(L(R.length===2,"invalid ndarray pixel data, must be 2 or 3D"),ee=1,U=1),ie=R[0],se=R[1],Q=Z[0],re=Z[1],X.alignment=1,X.width=ie,X.height=se,X.channels=ee,X.format=X.internalformat=Tc[ee],X.needsFree=!0,d3(X,j,Q,re,U,fe.offset)}else if(lx(fe)||cx(fe)||u3(fe))lx(fe)||cx(fe)?X.element=fe:X.element=fe.canvas,X.width=X.element.width,X.height=X.element.height,X.channels=4;else if(f3(fe))X.element=fe,X.width=fe.width,X.height=fe.height,X.channels=4;else if(l3(fe))X.element=fe,X.width=fe.naturalWidth,X.height=fe.naturalHeight,X.channels=4;else if(c3(fe))X.element=fe,X.width=fe.videoWidth,X.height=fe.videoHeight,X.channels=4;else if(fx(fe)){var q=X.width||fe[0].length,z=X.height||fe.length,ne=X.channels;kr(fe[0][0])?ne=ne||fe[0][0].length:ne=ne||1;for(var ue=xc.shape(fe),be=1,Ee=0;Ee<ue.length;++Ee)be*=ue[Ee];var ge=dx(X,be);xc.flatten(fe,ue,"",ge),vx(X,ge),X.alignment=1,X.width=q,X.height=z,X.channels=ne,X.format=X.internalformat=Tc[ne],X.needsFree=!0}X.type===cf?L(V.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):X.type===js&&L(V.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function _e(X,he,fe){var it=X.element,zt=X.data,j=X.internalformat,R=X.format,Z=X.type,ie=X.width,se=X.height;Tt(X),it?I.texImage2D(he,fe,R,R,Z,it):X.compressed?I.compressedTexImage2D(he,fe,j,ie,se,0,zt):X.needsCopy?(ce(),I.copyTexImage2D(he,fe,R,X.xOffset,X.yOffset,ie,se,0)):I.texImage2D(he,fe,R,ie,se,0,R,Z,zt||null)}function Ct(X,he,fe,it,zt){var j=X.element,R=X.data,Z=X.internalformat,ie=X.format,se=X.type,ee=X.width,Q=X.height;Tt(X),j?I.texSubImage2D(he,zt,fe,it,ie,se,j):X.compressed?I.compressedTexSubImage2D(he,zt,fe,it,Z,ee,Q,R):X.needsCopy?(ce(),I.copyTexSubImage2D(he,zt,fe,it,X.xOffset,X.yOffset,ee,Q)):I.texSubImage2D(he,zt,fe,it,ee,Q,ie,se,R)}var Nt=[];function ot(){return Nt.pop()||new He}function Gt(X){X.needsFree&&bt.freeType(X.data),He.call(X),Nt.push(X)}function It(){Ce.call(this),this.genMipmaps=!1,this.mipmapHint=Ac,this.mipmask=0,this.images=Array(16)}function Bt(X,he,fe){var it=X.images[0]=ot();X.mipmask=1,it.width=X.width=he,it.height=X.height=fe,it.channels=X.channels=4}function er(X,he){var fe=null;if(Gp(he))fe=X.images[0]=ot(),Xe(fe,X),ze(fe,he),X.mipmask=1;else if(vt(X,he),Array.isArray(he.mipmap))for(var it=he.mipmap,zt=0;zt<it.length;++zt)fe=X.images[zt]=ot(),Xe(fe,X),fe.width>>=zt,fe.height>>=zt,ze(fe,it[zt]),X.mipmask|=1<<zt;else fe=X.images[0]=ot(),Xe(fe,X),ze(fe,he),X.mipmask=1;Xe(X,X.images[0]),X.compressed&&(X.internalformat===Ip||X.internalformat===kp||X.internalformat===Lp||X.internalformat===Np)&&L(X.width%4===0&&X.height%4===0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function Pr(X,he){for(var fe=X.images,it=0;it<fe.length;++it){if(!fe[it])return;_e(fe[it],he,it)}}var Zr=[];function Ut(){var X=Zr.pop()||new It;Ce.call(X),X.mipmask=0;for(var he=0;he<16;++he)X.images[he]=null;return X}function Ur(X){for(var he=X.images,fe=0;fe<he.length;++fe)he[fe]&&Gt(he[fe]),he[fe]=null;Zr.push(X)}function gr(){this.minFilter=Rp,this.magFilter=Rp,this.wrapS=Pp,this.wrapT=Pp,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=Ac}function Rr(X,he){if("min"in he){var fe=he.min;L.parameter(fe,De),X.minFilter=De[fe],o3.indexOf(X.minFilter)>=0&&!("faces"in he)&&(X.genMipmaps=!0)}if("mag"in he){var it=he.mag;L.parameter(it,Fe),X.magFilter=Fe[it]}var zt=X.wrapS,j=X.wrapT;if("wrap"in he){var R=he.wrap;typeof R=="string"?(L.parameter(R,Oe),zt=j=Oe[R]):Array.isArray(R)&&(L.parameter(R[0],Oe),L.parameter(R[1],Oe),zt=Oe[R[0]],j=Oe[R[1]])}else{if("wrapS"in he){var Z=he.wrapS;L.parameter(Z,Oe),zt=Oe[Z]}if("wrapT"in he){var ie=he.wrapT;L.parameter(ie,Oe),j=Oe[ie]}}if(X.wrapS=zt,X.wrapT=j,"anisotropic"in he){var se=he.anisotropic;L(typeof se=="number"&&se>=1&&se<=V.maxAnisotropic,"aniso samples must be between 1 and "),X.anisotropic=he.anisotropic}if("mipmap"in he){var ee=!1;switch(typeof he.mipmap){case"string":L.parameter(he.mipmap,Ie,"invalid mipmap hint"),X.mipmapHint=Ie[he.mipmap],X.genMipmaps=!0,ee=!0;break;case"boolean":ee=X.genMipmaps=he.mipmap;break;case"object":L(Array.isArray(he.mipmap),"invalid mipmap type"),X.genMipmaps=!1,ee=!0;break;default:L.raise("invalid mipmap type")}ee&&!("min"in he)&&(X.minFilter=Bp)}}function Xr(X,he){I.texParameteri(he,ZP,X.minFilter),I.texParameteri(he,qP,X.magFilter),I.texParameteri(he,YP,X.wrapS),I.texParameteri(he,WP,X.wrapT),G.ext_texture_filter_anisotropic&&I.texParameteri(he,t3,X.anisotropic),X.genMipmaps&&(I.hint(QP,X.mipmapHint),I.generateMipmap(he))}var Yr=0,Jr={},ln=V.maxTextureUnits,Lr=Array(ln).map(function(){return null});function Ot(X){Ce.call(this),this.mipmask=0,this.internalformat=Wo,this.id=Yr++,this.refCount=1,this.target=X,this.texture=I.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new gr,de.profile&&(this.stats={size:0})}function cn(X){I.activeTexture(hf),I.bindTexture(X.target,X.texture)}function sr(){var X=Lr[0];X?I.bindTexture(X.target,X.texture):I.bindTexture($i,null)}function mt(X){var he=X.texture;L(he,"must not double destroy texture");var fe=X.unit,it=X.target;fe>=0&&(I.activeTexture(hf+fe),I.bindTexture(it,null),Lr[fe]=null),I.deleteTexture(he),X.texture=null,X.params=null,X.pixels=null,X.refCount=0,delete Jr[X.id],le.textureCount--}n(Ot.prototype,{bind:function(){var X=this;X.bindCount+=1;var he=X.unit;if(he<0){for(var fe=0;fe<ln;++fe){var it=Lr[fe];if(it){if(it.bindCount>0)continue;it.unit=-1}Lr[fe]=X,he=fe;break}he>=ln&&L.raise("insufficient number of texture units"),de.profile&&le.maxTextureUnits<he+1&&(le.maxTextureUnits=he+1),X.unit=he,I.activeTexture(hf+he),I.bindTexture(X.target,X.texture)}return he},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&mt(this)}});function $t(X,he){var fe=new Ot($i);Jr[fe.id]=fe,le.textureCount++;function it(R,Z){var ie=fe.texInfo;gr.call(ie);var se=Ut();return typeof R=="number"?typeof Z=="number"?Bt(se,R|0,Z|0):Bt(se,R|0,R|0):R?(L.type(R,"object","invalid arguments to regl.texture"),Rr(ie,R),er(se,R)):Bt(se,1,1),ie.genMipmaps&&(se.mipmask=(se.width<<1)-1),fe.mipmask=se.mipmask,Xe(fe,se),L.texture2D(ie,se,V),fe.internalformat=se.internalformat,it.width=se.width,it.height=se.height,cn(fe),Pr(se,$i),Xr(ie,$i),sr(),Ur(se),de.profile&&(fe.stats.size=Ic(fe.internalformat,fe.type,se.width,se.height,ie.genMipmaps,!1)),it.format=Be[fe.internalformat],it.type=Ke[fe.type],it.mag=Me[ie.magFilter],it.min=rt[ie.minFilter],it.wrapS=Ae[ie.wrapS],it.wrapT=Ae[ie.wrapT],it}function zt(R,Z,ie,se){L(!!R,"must specify image data");var ee=Z|0,Q=ie|0,re=se|0,U=ot();return Xe(U,fe),U.width=0,U.height=0,ze(U,R),U.width=U.width||(fe.width>>re)-ee,U.height=U.height||(fe.height>>re)-Q,L(fe.type===U.type&&fe.format===U.format&&fe.internalformat===U.internalformat,"incompatible format for texture.subimage"),L(ee>=0&&Q>=0&&ee+U.width<=fe.width&&Q+U.height<=fe.height,"texture.subimage write out of bounds"),L(fe.mipmask&1<<re,"missing mipmap data"),L(U.data||U.element||U.needsCopy,"missing image data"),cn(fe),Ct(U,$i,ee,Q,re),sr(),Gt(U),it}function j(R,Z){var ie=R|0,se=Z|0||ie;if(ie===fe.width&&se===fe.height)return it;it.width=fe.width=ie,it.height=fe.height=se,cn(fe);for(var ee=0;fe.mipmask>>ee;++ee){var Q=ie>>ee,re=se>>ee;if(!Q||!re)break;I.texImage2D($i,ee,fe.format,Q,re,0,fe.format,fe.type,null)}return sr(),de.profile&&(fe.stats.size=Ic(fe.internalformat,fe.type,ie,se,!1,!1)),it}return it(X,he),it.subimage=zt,it.resize=j,it._reglType="texture2d",it._texture=fe,de.profile&&(it.stats=fe.stats),it.destroy=function(){fe.decRef()},it}function Zt(X,he,fe,it,zt,j){var R=new Ot(_p);Jr[R.id]=R,le.cubeCount++;var Z=new Array(6);function ie(Q,re,U,q,z,ne){var ue,be=R.texInfo;for(gr.call(be),ue=0;ue<6;++ue)Z[ue]=Ut();if(typeof Q=="number"||!Q){var Ee=Q|0||1;for(ue=0;ue<6;++ue)Bt(Z[ue],Ee,Ee)}else if(typeof Q=="object")if(re)er(Z[0],Q),er(Z[1],re),er(Z[2],U),er(Z[3],q),er(Z[4],z),er(Z[5],ne);else if(Rr(be,Q),vt(R,Q),"faces"in Q){var ge=Q.faces;for(L(Array.isArray(ge)&&ge.length===6,"cube faces must be a length 6 array"),ue=0;ue<6;++ue)L(typeof ge[ue]=="object"&&!!ge[ue],"invalid input for cube map face"),Xe(Z[ue],R),er(Z[ue],ge[ue])}else for(ue=0;ue<6;++ue)er(Z[ue],Q);else L.raise("invalid arguments to cube map");for(Xe(R,Z[0]),V.npotTextureCube||L(jb(R.width)&&jb(R.height),"your browser does not support non power or two texture dimensions"),be.genMipmaps?R.mipmask=(Z[0].width<<1)-1:R.mipmask=Z[0].mipmask,L.textureCube(R,be,Z,V),R.internalformat=Z[0].internalformat,ie.width=Z[0].width,ie.height=Z[0].height,cn(R),ue=0;ue<6;++ue)Pr(Z[ue],_c+ue);for(Xr(be,_p),sr(),de.profile&&(R.stats.size=Ic(R.internalformat,R.type,ie.width,ie.height,be.genMipmaps,!0)),ie.format=Be[R.internalformat],ie.type=Ke[R.type],ie.mag=Me[be.magFilter],ie.min=rt[be.minFilter],ie.wrapS=Ae[be.wrapS],ie.wrapT=Ae[be.wrapT],ue=0;ue<6;++ue)Ur(Z[ue]);return ie}function se(Q,re,U,q,z){L(!!re,"must specify image data"),L(typeof Q=="number"&&Q===(Q|0)&&Q>=0&&Q<6,"invalid face");var ne=U|0,ue=q|0,be=z|0,Ee=ot();return Xe(Ee,R),Ee.width=0,Ee.height=0,ze(Ee,re),Ee.width=Ee.width||(R.width>>be)-ne,Ee.height=Ee.height||(R.height>>be)-ue,L(R.type===Ee.type&&R.format===Ee.format&&R.internalformat===Ee.internalformat,"incompatible format for texture.subimage"),L(ne>=0&&ue>=0&&ne+Ee.width<=R.width&&ue+Ee.height<=R.height,"texture.subimage write out of bounds"),L(R.mipmask&1<<be,"missing mipmap data"),L(Ee.data||Ee.element||Ee.needsCopy,"missing image data"),cn(R),Ct(Ee,_c+Q,ne,ue,be),sr(),Gt(Ee),ie}function ee(Q){var re=Q|0;if(re!==R.width){ie.width=R.width=re,ie.height=R.height=re,cn(R);for(var U=0;U<6;++U)for(var q=0;R.mipmask>>q;++q)I.texImage2D(_c+U,q,R.format,re>>q,re>>q,0,R.format,R.type,null);return sr(),de.profile&&(R.stats.size=Ic(R.internalformat,R.type,ie.width,ie.height,!1,!0)),ie}}return ie(X,he,fe,it,zt,j),ie.subimage=se,ie.resize=ee,ie._reglType="textureCube",ie._texture=R,de.profile&&(ie.stats=R.stats),ie.destroy=function(){R.decRef()},ie}function Nr(){for(var X=0;X<ln;++X)I.activeTexture(hf+X),I.bindTexture($i,null),Lr[X]=null;Un(Jr).forEach(mt),le.cubeCount=0,le.textureCount=0}de.profile&&(le.getTotalTextureSize=function(){var X=0;return Object.keys(Jr).forEach(function(he){X+=Jr[he].stats.size}),X});function Ui(){for(var X=0;X<ln;++X){var he=Lr[X];he&&(he.bindCount=0,he.unit=-1,Lr[X]=null)}Un(Jr).forEach(function(fe){fe.texture=I.createTexture(),I.bindTexture(fe.target,fe.texture);for(var it=0;it<32;++it)if(fe.mipmask&1<<it)if(fe.target===$i)I.texImage2D($i,it,fe.internalformat,fe.width>>it,fe.height>>it,0,fe.internalformat,fe.type,null);else for(var zt=0;zt<6;++zt)I.texImage2D(_c+zt,it,fe.internalformat,fe.width>>it,fe.height>>it,0,fe.internalformat,fe.type,null);Xr(fe.texInfo,fe.target)})}function es(){for(var X=0;X<ln;++X){var he=Lr[X];he&&(he.bindCount=0,he.unit=-1,Lr[X]=null),I.activeTexture(hf+X),I.bindTexture($i,null),I.bindTexture(_p,null)}}return{create2D:$t,createCube:Zt,clear:Nr,getTexture:function(X){return null},restore:Ui,refresh:es}}var Ja=36161,kc=32854,px=32855,gx=36194,yx=33189,mx=36168,bx=34041,xx=35907,wx=34836,Ex=34842,_x=34843,_i=[];_i[kc]=2,_i[px]=2,_i[gx]=2,_i[yx]=2,_i[mx]=1,_i[bx]=4,_i[xx]=4,_i[wx]=16,_i[Ex]=8,_i[_x]=6;function Sx(I,G,V){return _i[I]*G*V}var p3=function(I,G,V,ce,we){var le={rgba4:kc,rgb565:gx,"rgb5 a1":px,depth:yx,stencil:mx,"depth stencil":bx};G.ext_srgb&&(le.srgba=xx),G.ext_color_buffer_half_float&&(le.rgba16f=Ex,le.rgb16f=_x),G.webgl_color_buffer_float&&(le.rgba32f=wx);var de=[];Object.keys(le).forEach(function(ke){var je=le[ke];de[je]=ke});var Ie=0,Oe={};function Fe(ke){this.id=Ie++,this.refCount=1,this.renderbuffer=ke,this.format=kc,this.width=0,this.height=0,we.profile&&(this.stats={size:0})}Fe.prototype.decRef=function(){--this.refCount<=0&&De(this)};function De(ke){var je=ke.renderbuffer;L(je,"must not double destroy renderbuffer"),I.bindRenderbuffer(Ja,null),I.deleteRenderbuffer(je),ke.renderbuffer=null,ke.refCount=0,delete Oe[ke.id],ce.renderbufferCount--}function $e(ke,je){var oe=new Fe(I.createRenderbuffer());Oe[oe.id]=oe,ce.renderbufferCount++;function ve(Ke,Me){var rt=0,Ae=0,Ue=kc;if(typeof Ke=="object"&&Ke){var Ce=Ke;if("shape"in Ce){var Xe=Ce.shape;L(Array.isArray(Xe)&&Xe.length>=2,"invalid renderbuffer shape"),rt=Xe[0]|0,Ae=Xe[1]|0}else"radius"in Ce&&(rt=Ae=Ce.radius|0),"width"in Ce&&(rt=Ce.width|0),"height"in Ce&&(Ae=Ce.height|0);"format"in Ce&&(L.parameter(Ce.format,le,"invalid renderbuffer format"),Ue=le[Ce.format])}else typeof Ke=="number"?(rt=Ke|0,typeof Me=="number"?Ae=Me|0:Ae=rt):Ke?L.raise("invalid arguments to renderbuffer constructor"):rt=Ae=1;if(L(rt>0&&Ae>0&&rt<=V.maxRenderbufferSize&&Ae<=V.maxRenderbufferSize,"invalid renderbuffer size"),!(rt===oe.width&&Ae===oe.height&&Ue===oe.format))return ve.width=oe.width=rt,ve.height=oe.height=Ae,oe.format=Ue,I.bindRenderbuffer(Ja,oe.renderbuffer),I.renderbufferStorage(Ja,Ue,rt,Ae),L(I.getError()===0,"invalid render buffer format"),we.profile&&(oe.stats.size=Sx(oe.format,oe.width,oe.height)),ve.format=de[oe.format],ve}function Be(Ke,Me){var rt=Ke|0,Ae=Me|0||rt;return rt===oe.width&&Ae===oe.height||(L(rt>0&&Ae>0&&rt<=V.maxRenderbufferSize&&Ae<=V.maxRenderbufferSize,"invalid renderbuffer size"),ve.width=oe.width=rt,ve.height=oe.height=Ae,I.bindRenderbuffer(Ja,oe.renderbuffer),I.renderbufferStorage(Ja,oe.format,rt,Ae),L(I.getError()===0,"invalid render buffer format"),we.profile&&(oe.stats.size=Sx(oe.format,oe.width,oe.height))),ve}return ve(ke,je),ve.resize=Be,ve._reglType="renderbuffer",ve._renderbuffer=oe,we.profile&&(ve.stats=oe.stats),ve.destroy=function(){oe.decRef()},ve}we.profile&&(ce.getTotalRenderbufferSize=function(){var ke=0;return Object.keys(Oe).forEach(function(je){ke+=Oe[je].stats.size}),ke});function Ve(){Un(Oe).forEach(function(ke){ke.renderbuffer=I.createRenderbuffer(),I.bindRenderbuffer(Ja,ke.renderbuffer),I.renderbufferStorage(Ja,ke.format,ke.width,ke.height)}),I.bindRenderbuffer(Ja,null)}return{create:$e,clear:function(){Un(Oe).forEach(De)},restore:Ve}},Sa=36160,zp=36161,Ho=3553,Lc=34069,Mx=36064,Cx=36096,Ax=36128,Tx=33306,Ix=36053,g3=36054,y3=36055,m3=36057,b3=36061,x3=36193,w3=5121,E3=5126,kx=6407,Lx=6408,_3=6402,S3=[kx,Lx],$p=[];$p[Lx]=4,$p[kx]=3;var Nc=[];Nc[w3]=1,Nc[E3]=4,Nc[x3]=2;var M3=32854,C3=32855,A3=36194,T3=33189,I3=36168,Nx=34041,k3=35907,L3=34836,N3=34842,O3=34843,D3=[M3,C3,A3,k3,N3,O3,L3],Ws={};Ws[Ix]="complete",Ws[g3]="incomplete attachment",Ws[m3]="incomplete dimensions",Ws[y3]="incomplete, missing attachment",Ws[b3]="unsupported";function P3(I,G,V,ce,we,le){var de={cur:null,next:null,dirty:!1,setFBO:null},Ie=["rgba"],Oe=["rgba4","rgb565","rgb5 a1"];G.ext_srgb&&Oe.push("srgba"),G.ext_color_buffer_half_float&&Oe.push("rgba16f","rgb16f"),G.webgl_color_buffer_float&&Oe.push("rgba32f");var Fe=["uint8"];G.oes_texture_half_float&&Fe.push("half float","float16"),G.oes_texture_float&&Fe.push("float","float32");function De(He,ze,_e){this.target=He,this.texture=ze,this.renderbuffer=_e;var Ct=0,Nt=0;ze?(Ct=ze.width,Nt=ze.height):_e&&(Ct=_e.width,Nt=_e.height),this.width=Ct,this.height=Nt}function $e(He){He&&(He.texture&&He.texture._texture.decRef(),He.renderbuffer&&He.renderbuffer._renderbuffer.decRef())}function Ve(He,ze,_e){if(He)if(He.texture){var Ct=He.texture._texture,Nt=Math.max(1,Ct.width),ot=Math.max(1,Ct.height);L(Nt===ze&&ot===_e,"inconsistent width/height for supplied texture"),Ct.refCount+=1}else{var Gt=He.renderbuffer._renderbuffer;L(Gt.width===ze&&Gt.height===_e,"inconsistent width/height for renderbuffer"),Gt.refCount+=1}}function ke(He,ze){ze&&(ze.texture?I.framebufferTexture2D(Sa,He,ze.target,ze.texture._texture.texture,0):I.framebufferRenderbuffer(Sa,He,zp,ze.renderbuffer._renderbuffer.renderbuffer))}function je(He){var ze=Ho,_e=null,Ct=null,Nt=He;typeof He=="object"&&(Nt=He.data,"target"in He&&(ze=He.target|0)),L.type(Nt,"function","invalid attachment data");var ot=Nt._reglType;return ot==="texture2d"?(_e=Nt,L(ze===Ho)):ot==="textureCube"?(_e=Nt,L(ze>=Lc&&ze<Lc+6,"invalid cube map target")):ot==="renderbuffer"?(Ct=Nt,ze=zp):L.raise("invalid regl object for attachment"),new De(ze,_e,Ct)}function oe(He,ze,_e,Ct,Nt){if(_e){var ot=ce.create2D({width:He,height:ze,format:Ct,type:Nt});return ot._texture.refCount=0,new De(Ho,ot,null)}else{var Gt=we.create({width:He,height:ze,format:Ct});return Gt._renderbuffer.refCount=0,new De(zp,null,Gt)}}function ve(He){return He&&(He.texture||He.renderbuffer)}function Be(He,ze,_e){He&&(He.texture?He.texture.resize(ze,_e):He.renderbuffer&&He.renderbuffer.resize(ze,_e),He.width=ze,He.height=_e)}var Ke=0,Me={};function rt(){this.id=Ke++,Me[this.id]=this,this.framebuffer=I.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function Ae(He){He.colorAttachments.forEach($e),$e(He.depthAttachment),$e(He.stencilAttachment),$e(He.depthStencilAttachment)}function Ue(He){var ze=He.framebuffer;L(ze,"must not double destroy framebuffer"),I.deleteFramebuffer(ze),He.framebuffer=null,le.framebufferCount--,delete Me[He.id]}function Ce(He){var ze;I.bindFramebuffer(Sa,He.framebuffer);var _e=He.colorAttachments;for(ze=0;ze<_e.length;++ze)ke(Mx+ze,_e[ze]);for(ze=_e.length;ze<V.maxColorAttachments;++ze)I.framebufferTexture2D(Sa,Mx+ze,Ho,null,0);I.framebufferTexture2D(Sa,Tx,Ho,null,0),I.framebufferTexture2D(Sa,Cx,Ho,null,0),I.framebufferTexture2D(Sa,Ax,Ho,null,0),ke(Cx,He.depthAttachment),ke(Ax,He.stencilAttachment),ke(Tx,He.depthStencilAttachment);var Ct=I.checkFramebufferStatus(Sa);!I.isContextLost()&&Ct!==Ix&&L.raise("framebuffer configuration not supported, status = "+Ws[Ct]),I.bindFramebuffer(Sa,de.next?de.next.framebuffer:null),de.cur=de.next,I.getError()}function Xe(He,ze){var _e=new rt;le.framebufferCount++;function Ct(ot,Gt){var It;L(de.next!==_e,"can not update framebuffer which is currently in use");var Bt=0,er=0,Pr=!0,Zr=!0,Ut=null,Ur=!0,gr="rgba",Rr="uint8",Xr=1,Yr=null,Jr=null,ln=null,Lr=!1;if(typeof ot=="number")Bt=ot|0,er=Gt|0||Bt;else if(!ot)Bt=er=1;else{L.type(ot,"object","invalid arguments for framebuffer");var Ot=ot;if("shape"in Ot){var cn=Ot.shape;L(Array.isArray(cn)&&cn.length>=2,"invalid shape for framebuffer"),Bt=cn[0],er=cn[1]}else"radius"in Ot&&(Bt=er=Ot.radius),"width"in Ot&&(Bt=Ot.width),"height"in Ot&&(er=Ot.height);("color"in Ot||"colors"in Ot)&&(Ut=Ot.color||Ot.colors,Array.isArray(Ut)&&L(Ut.length===1||G.webgl_draw_buffers,"multiple render targets not supported")),Ut||("colorCount"in Ot&&(Xr=Ot.colorCount|0,L(Xr>0,"invalid color buffer count")),"colorTexture"in Ot&&(Ur=!!Ot.colorTexture,gr="rgba4"),"colorType"in Ot&&(Rr=Ot.colorType,Ur?(L(G.oes_texture_float||!(Rr==="float"||Rr==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),L(G.oes_texture_half_float||!(Rr==="half float"||Rr==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):Rr==="half float"||Rr==="float16"?(L(G.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),gr="rgba16f"):(Rr==="float"||Rr==="float32")&&(L(G.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),gr="rgba32f"),L.oneOf(Rr,Fe,"invalid color type")),"colorFormat"in Ot&&(gr=Ot.colorFormat,Ie.indexOf(gr)>=0?Ur=!0:Oe.indexOf(gr)>=0?Ur=!1:Ur?L.oneOf(Ot.colorFormat,Ie,"invalid color format for texture"):L.oneOf(Ot.colorFormat,Oe,"invalid color format for renderbuffer"))),("depthTexture"in Ot||"depthStencilTexture"in Ot)&&(Lr=!!(Ot.depthTexture||Ot.depthStencilTexture),L(!Lr||G.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in Ot&&(typeof Ot.depth=="boolean"?Pr=Ot.depth:(Yr=Ot.depth,Zr=!1)),"stencil"in Ot&&(typeof Ot.stencil=="boolean"?Zr=Ot.stencil:(Jr=Ot.stencil,Pr=!1)),"depthStencil"in Ot&&(typeof Ot.depthStencil=="boolean"?Pr=Zr=Ot.depthStencil:(ln=Ot.depthStencil,Pr=!1,Zr=!1))}var sr=null,mt=null,$t=null,Zt=null;if(Array.isArray(Ut))sr=Ut.map(je);else if(Ut)sr=[je(Ut)];else for(sr=new Array(Xr),It=0;It<Xr;++It)sr[It]=oe(Bt,er,Ur,gr,Rr);L(G.webgl_draw_buffers||sr.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),L(sr.length<=V.maxColorAttachments,"too many color attachments, not supported"),Bt=Bt||sr[0].width,er=er||sr[0].height,Yr?mt=je(Yr):Pr&&!Zr&&(mt=oe(Bt,er,Lr,"depth","uint32")),Jr?$t=je(Jr):Zr&&!Pr&&($t=oe(Bt,er,!1,"stencil","uint8")),ln?Zt=je(ln):!Yr&&!Jr&&Zr&&Pr&&(Zt=oe(Bt,er,Lr,"depth stencil","depth stencil")),L(!!Yr+!!Jr+!!ln<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var Nr=null;for(It=0;It<sr.length;++It)if(Ve(sr[It],Bt,er),L(!sr[It]||sr[It].texture&&S3.indexOf(sr[It].texture._texture.format)>=0||sr[It].renderbuffer&&D3.indexOf(sr[It].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+It+" is invalid"),sr[It]&&sr[It].texture){var Ui=$p[sr[It].texture._texture.format]*Nc[sr[It].texture._texture.type];Nr===null?Nr=Ui:L(Nr===Ui,"all color attachments much have the same number of bits per pixel.")}return Ve(mt,Bt,er),L(!mt||mt.texture&&mt.texture._texture.format===_3||mt.renderbuffer&&mt.renderbuffer._renderbuffer.format===T3,"invalid depth attachment for framebuffer object"),Ve($t,Bt,er),L(!$t||$t.renderbuffer&&$t.renderbuffer._renderbuffer.format===I3,"invalid stencil attachment for framebuffer object"),Ve(Zt,Bt,er),L(!Zt||Zt.texture&&Zt.texture._texture.format===Nx||Zt.renderbuffer&&Zt.renderbuffer._renderbuffer.format===Nx,"invalid depth-stencil attachment for framebuffer object"),Ae(_e),_e.width=Bt,_e.height=er,_e.colorAttachments=sr,_e.depthAttachment=mt,_e.stencilAttachment=$t,_e.depthStencilAttachment=Zt,Ct.color=sr.map(ve),Ct.depth=ve(mt),Ct.stencil=ve($t),Ct.depthStencil=ve(Zt),Ct.width=_e.width,Ct.height=_e.height,Ce(_e),Ct}function Nt(ot,Gt){L(de.next!==_e,"can not resize a framebuffer which is currently in use");var It=Math.max(ot|0,1),Bt=Math.max(Gt|0||It,1);if(It===_e.width&&Bt===_e.height)return Ct;for(var er=_e.colorAttachments,Pr=0;Pr<er.length;++Pr)Be(er[Pr],It,Bt);return Be(_e.depthAttachment,It,Bt),Be(_e.stencilAttachment,It,Bt),Be(_e.depthStencilAttachment,It,Bt),_e.width=Ct.width=It,_e.height=Ct.height=Bt,Ce(_e),Ct}return Ct(He,ze),n(Ct,{resize:Nt,_reglType:"framebuffer",_framebuffer:_e,destroy:function(){Ue(_e),Ae(_e)},use:function(ot){de.setFBO({framebuffer:Ct},ot)}})}function vt(He){var ze=Array(6);function _e(Nt){var ot;L(ze.indexOf(de.next)<0,"can not update framebuffer which is currently in use");var Gt={color:null},It=0,Bt=null,er="rgba",Pr="uint8",Zr=1;if(typeof Nt=="number")It=Nt|0;else if(!Nt)It=1;else{L.type(Nt,"object","invalid arguments for framebuffer");var Ut=Nt;if("shape"in Ut){var Ur=Ut.shape;L(Array.isArray(Ur)&&Ur.length>=2,"invalid shape for framebuffer"),L(Ur[0]===Ur[1],"cube framebuffer must be square"),It=Ur[0]}else"radius"in Ut&&(It=Ut.radius|0),"width"in Ut?(It=Ut.width|0,"height"in Ut&&L(Ut.height===It,"must be square")):"height"in Ut&&(It=Ut.height|0);("color"in Ut||"colors"in Ut)&&(Bt=Ut.color||Ut.colors,Array.isArray(Bt)&&L(Bt.length===1||G.webgl_draw_buffers,"multiple render targets not supported")),Bt||("colorCount"in Ut&&(Zr=Ut.colorCount|0,L(Zr>0,"invalid color buffer count")),"colorType"in Ut&&(L.oneOf(Ut.colorType,Fe,"invalid color type"),Pr=Ut.colorType),"colorFormat"in Ut&&(er=Ut.colorFormat,L.oneOf(Ut.colorFormat,Ie,"invalid color format for texture"))),"depth"in Ut&&(Gt.depth=Ut.depth),"stencil"in Ut&&(Gt.stencil=Ut.stencil),"depthStencil"in Ut&&(Gt.depthStencil=Ut.depthStencil)}var gr;if(Bt)if(Array.isArray(Bt))for(gr=[],ot=0;ot<Bt.length;++ot)gr[ot]=Bt[ot];else gr=[Bt];else{gr=Array(Zr);var Rr={radius:It,format:er,type:Pr};for(ot=0;ot<Zr;++ot)gr[ot]=ce.createCube(Rr)}for(Gt.color=Array(gr.length),ot=0;ot<gr.length;++ot){var Xr=gr[ot];L(typeof Xr=="function"&&Xr._reglType==="textureCube","invalid cube map"),It=It||Xr.width,L(Xr.width===It&&Xr.height===It,"invalid cube map shape"),Gt.color[ot]={target:Lc,data:gr[ot]}}for(ot=0;ot<6;++ot){for(var Yr=0;Yr<gr.length;++Yr)Gt.color[Yr].target=Lc+ot;ot>0&&(Gt.depth=ze[0].depth,Gt.stencil=ze[0].stencil,Gt.depthStencil=ze[0].depthStencil),ze[ot]?ze[ot](Gt):ze[ot]=Xe(Gt)}return n(_e,{width:It,height:It,color:gr})}function Ct(Nt){var ot,Gt=Nt|0;if(L(Gt>0&&Gt<=V.maxCubeMapSize,"invalid radius for cube fbo"),Gt===_e.width)return _e;var It=_e.color;for(ot=0;ot<It.length;++ot)It[ot].resize(Gt);for(ot=0;ot<6;++ot)ze[ot].resize(Gt);return _e.width=_e.height=Gt,_e}return _e(He),n(_e,{faces:ze,resize:Ct,_reglType:"framebufferCube",destroy:function(){ze.forEach(function(Nt){Nt.destroy()})}})}function Tt(){de.cur=null,de.next=null,de.dirty=!0,Un(Me).forEach(function(He){He.framebuffer=I.createFramebuffer(),Ce(He)})}return n(de,{getFramebuffer:function(He){if(typeof He=="function"&&He._reglType==="framebuffer"){var ze=He._framebuffer;if(ze instanceof rt)return ze}return null},create:Xe,createCube:vt,clear:function(){Un(Me).forEach(Ue)},restore:Tt})}var R3=5126,Ox=34962;function jp(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=R3,this.offset=0,this.stride=0,this.divisor=0}function B3(I,G,V,ce,we){for(var le=V.maxAttributes,de=new Array(le),Ie=0;Ie<le;++Ie)de[Ie]=new jp;var Oe=0,Fe={},De={Record:jp,scope:{},state:de,currentVAO:null,targetVAO:null,restore:Ve()?Me:function(){},createVAO:rt,getVAO:je,destroyBuffer:$e,setVAO:Ve()?oe:ve,clear:Ve()?Be:function(){}};function $e(Ae){for(var Ue=0;Ue<de.length;++Ue){var Ce=de[Ue];Ce.buffer===Ae&&(I.disableVertexAttribArray(Ue),Ce.buffer=null)}}function Ve(){return G.oes_vertex_array_object}function ke(){return G.angle_instanced_arrays}function je(Ae){return typeof Ae=="function"&&Ae._vao?Ae._vao:null}function oe(Ae){if(Ae!==De.currentVAO){var Ue=Ve();Ae?Ue.bindVertexArrayOES(Ae.vao):Ue.bindVertexArrayOES(null),De.currentVAO=Ae}}function ve(Ae){if(Ae!==De.currentVAO){if(Ae)Ae.bindAttrs();else for(var Ue=ke(),Ce=0;Ce<de.length;++Ce){var Xe=de[Ce];Xe.buffer?(I.enableVertexAttribArray(Ce),I.vertexAttribPointer(Ce,Xe.size,Xe.type,Xe.normalized,Xe.stride,Xe.offfset),Ue&&Xe.divisor&&Ue.vertexAttribDivisorANGLE(Ce,Xe.divisor)):(I.disableVertexAttribArray(Ce),I.vertexAttrib4f(Ce,Xe.x,Xe.y,Xe.z,Xe.w))}De.currentVAO=Ae}}function Be(){Un(Fe).forEach(function(Ae){Ae.destroy()})}function Ke(){this.id=++Oe,this.attributes=[];var Ae=Ve();Ae?this.vao=Ae.createVertexArrayOES():this.vao=null,Fe[this.id]=this,this.buffers=[]}Ke.prototype.bindAttrs=function(){for(var Ae=ke(),Ue=this.attributes,Ce=0;Ce<Ue.length;++Ce){var Xe=Ue[Ce];Xe.buffer?(I.enableVertexAttribArray(Ce),I.bindBuffer(Ox,Xe.buffer.buffer),I.vertexAttribPointer(Ce,Xe.size,Xe.type,Xe.normalized,Xe.stride,Xe.offset),Ae&&Xe.divisor&&Ae.vertexAttribDivisorANGLE(Ce,Xe.divisor)):(I.disableVertexAttribArray(Ce),I.vertexAttrib4f(Ce,Xe.x,Xe.y,Xe.z,Xe.w))}for(var vt=Ue.length;vt<le;++vt)I.disableVertexAttribArray(vt)},Ke.prototype.refresh=function(){var Ae=Ve();Ae&&(Ae.bindVertexArrayOES(this.vao),this.bindAttrs(),De.currentVAO=this)},Ke.prototype.destroy=function(){if(this.vao){var Ae=Ve();this===De.currentVAO&&(De.currentVAO=null,Ae.bindVertexArrayOES(null)),Ae.deleteVertexArrayOES(this.vao),this.vao=null}Fe[this.id]&&(delete Fe[this.id],ce.vaoCount-=1)};function Me(){var Ae=Ve();Ae&&Un(Fe).forEach(function(Ue){Ue.refresh()})}function rt(Ae){var Ue=new Ke;ce.vaoCount+=1;function Ce(Xe){L(Array.isArray(Xe),"arguments to vertex array constructor must be an array"),L(Xe.length<le,"too many attributes"),L(Xe.length>0,"must specify at least one attribute");var vt={},Tt=Ue.attributes;Tt.length=Xe.length;for(var He=0;He<Xe.length;++He){var ze=Xe[He],_e=Tt[He]=new jp,Ct=ze.data||ze;if(Array.isArray(Ct)||t(Ct)||Ei(Ct)){var Nt;Ue.buffers[He]&&(Nt=Ue.buffers[He],t(Ct)&&Nt._buffer.byteLength>=Ct.byteLength?Nt.subdata(Ct):(Nt.destroy(),Ue.buffers[He]=null)),Ue.buffers[He]||(Nt=Ue.buffers[He]=we.create(ze,Ox,!1,!0)),_e.buffer=we.getBuffer(Nt),_e.size=_e.buffer.dimension|0,_e.normalized=!1,_e.type=_e.buffer.dtype,_e.offset=0,_e.stride=0,_e.divisor=0,_e.state=1,vt[He]=1}else we.getBuffer(ze)?(_e.buffer=we.getBuffer(ze),_e.size=_e.buffer.dimension|0,_e.normalized=!1,_e.type=_e.buffer.dtype,_e.offset=0,_e.stride=0,_e.divisor=0,_e.state=1):we.getBuffer(ze.buffer)?(_e.buffer=we.getBuffer(ze.buffer),_e.size=(+ze.size||_e.buffer.dimension)|0,_e.normalized=!!ze.normalized||!1,"type"in ze?(L.parameter(ze.type,Xo,"invalid buffer type"),_e.type=Xo[ze.type]):_e.type=_e.buffer.dtype,_e.offset=(ze.offset||0)|0,_e.stride=(ze.stride||0)|0,_e.divisor=(ze.divisor||0)|0,_e.state=1,L(_e.size>=1&&_e.size<=4,"size must be between 1 and 4"),L(_e.offset>=0,"invalid offset"),L(_e.stride>=0&&_e.stride<=255,"stride must be between 0 and 255"),L(_e.divisor>=0,"divisor must be positive"),L(!_e.divisor||!!G.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in ze?(L(He>0,"first attribute must not be a constant"),_e.x=+ze.x||0,_e.y=+ze.y||0,_e.z=+ze.z||0,_e.w=+ze.w||0,_e.state=2):L(!1,"invalid attribute spec for location "+He)}for(var ot=0;ot<Ue.buffers.length;++ot)!vt[ot]&&Ue.buffers[ot]&&(Ue.buffers[ot].destroy(),Ue.buffers[ot]=null);return Ue.refresh(),Ce}return Ce.destroy=function(){for(var Xe=0;Xe<Ue.buffers.length;++Xe)Ue.buffers[Xe]&&Ue.buffers[Xe].destroy();Ue.buffers.length=0,Ue.destroy()},Ce._vao=Ue,Ce._reglType="vao",Ce(Ae)}return De}var Dx=35632,F3=35633,G3=35718,z3=35721;function $3(I,G,V,ce){var we={},le={};function de(oe,ve,Be,Ke){this.name=oe,this.id=ve,this.location=Be,this.info=Ke}function Ie(oe,ve){for(var Be=0;Be<oe.length;++Be)if(oe[Be].id===ve.id){oe[Be].location=ve.location;return}oe.push(ve)}function Oe(oe,ve,Be){var Ke=oe===Dx?we:le,Me=Ke[ve];if(!Me){var rt=G.str(ve);Me=I.createShader(oe),I.shaderSource(Me,rt),I.compileShader(Me),L.shaderError(I,Me,rt,oe,Be),Ke[ve]=Me}return Me}var Fe={},De=[],$e=0;function Ve(oe,ve){this.id=$e++,this.fragId=oe,this.vertId=ve,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,ce.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function ke(oe,ve,Be){var Ke,Me,rt=Oe(Dx,oe.fragId),Ae=Oe(F3,oe.vertId),Ue=oe.program=I.createProgram();if(I.attachShader(Ue,rt),I.attachShader(Ue,Ae),Be)for(Ke=0;Ke<Be.length;++Ke){var Ce=Be[Ke];I.bindAttribLocation(Ue,Ce[0],Ce[1])}I.linkProgram(Ue),L.linkError(I,Ue,G.str(oe.fragId),G.str(oe.vertId),ve);var Xe=I.getProgramParameter(Ue,G3);ce.profile&&(oe.stats.uniformsCount=Xe);var vt=oe.uniforms;for(Ke=0;Ke<Xe;++Ke)if(Me=I.getActiveUniform(Ue,Ke),Me)if(Me.size>1)for(var Tt=0;Tt<Me.size;++Tt){var He=Me.name.replace("[0]","["+Tt+"]");Ie(vt,new de(He,G.id(He),I.getUniformLocation(Ue,He),Me))}else Ie(vt,new de(Me.name,G.id(Me.name),I.getUniformLocation(Ue,Me.name),Me));var ze=I.getProgramParameter(Ue,z3);ce.profile&&(oe.stats.attributesCount=ze);var _e=oe.attributes;for(Ke=0;Ke<ze;++Ke)Me=I.getActiveAttrib(Ue,Ke),Me&&Ie(_e,new de(Me.name,G.id(Me.name),I.getAttribLocation(Ue,Me.name),Me))}ce.profile&&(V.getMaxUniformsCount=function(){var oe=0;return De.forEach(function(ve){ve.stats.uniformsCount>oe&&(oe=ve.stats.uniformsCount)}),oe},V.getMaxAttributesCount=function(){var oe=0;return De.forEach(function(ve){ve.stats.attributesCount>oe&&(oe=ve.stats.attributesCount)}),oe});function je(){we={},le={};for(var oe=0;oe<De.length;++oe)ke(De[oe],null,De[oe].attributes.map(function(ve){return[ve.location,ve.name]}))}return{clear:function(){var oe=I.deleteShader.bind(I);Un(we).forEach(oe),we={},Un(le).forEach(oe),le={},De.forEach(function(ve){I.deleteProgram(ve.program)}),De.length=0,Fe={},V.shaderCount=0},program:function(oe,ve,Be,Ke){L.command(oe>=0,"missing vertex shader",Be),L.command(ve>=0,"missing fragment shader",Be);var Me=Fe[ve];Me||(Me=Fe[ve]={});var rt=Me[oe];if(rt&&(rt.refCount++,!Ke))return rt;var Ae=new Ve(ve,oe);return V.shaderCount++,ke(Ae,Be,Ke),rt||(Me[oe]=Ae),De.push(Ae),n(Ae,{destroy:function(){if(Ae.refCount--,Ae.refCount<=0){I.deleteProgram(Ae.program);var Ue=De.indexOf(Ae);De.splice(Ue,1),V.shaderCount--}Me[Ae.vertId].refCount<=0&&(I.deleteShader(le[Ae.vertId]),delete le[Ae.vertId],delete Fe[Ae.fragId][Ae.vertId]),Object.keys(Fe[Ae.fragId]).length||(I.deleteShader(we[Ae.fragId]),delete we[Ae.fragId],delete Fe[Ae.fragId])}})},restore:je,shader:Oe,frag:-1,vert:-1}}var j3=6408,df=5121,U3=3333,Oc=5126;function X3(I,G,V,ce,we,le,de){function Ie(De){var $e;G.next===null?(L(we.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),$e=df):(L(G.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),$e=G.next.colorAttachments[0].texture._texture.type,le.oes_texture_float?(L($e===df||$e===Oc,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),$e===Oc&&L(de.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):L($e===df,"Reading from a framebuffer is only allowed for the type 'uint8'"));var Ve=0,ke=0,je=ce.framebufferWidth,oe=ce.framebufferHeight,ve=null;t(De)?ve=De:De&&(L.type(De,"object","invalid arguments to regl.read()"),Ve=De.x|0,ke=De.y|0,L(Ve>=0&&Ve<ce.framebufferWidth,"invalid x offset for regl.read"),L(ke>=0&&ke<ce.framebufferHeight,"invalid y offset for regl.read"),je=(De.width||ce.framebufferWidth-Ve)|0,oe=(De.height||ce.framebufferHeight-ke)|0,ve=De.data||null),ve&&($e===df?L(ve instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):$e===Oc&&L(ve instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),L(je>0&&je+Ve<=ce.framebufferWidth,"invalid width for read pixels"),L(oe>0&&oe+ke<=ce.framebufferHeight,"invalid height for read pixels"),V();var Be=je*oe*4;return ve||($e===df?ve=new Uint8Array(Be):$e===Oc&&(ve=ve||new Float32Array(Be))),L.isTypedArray(ve,"data buffer for regl.read() must be a typedarray"),L(ve.byteLength>=Be,"data buffer for regl.read() too small"),I.pixelStorei(U3,4),I.readPixels(Ve,ke,je,oe,j3,$e,ve),ve}function Oe(De){var $e;return G.setFBO({framebuffer:De.framebuffer},function(){$e=Ie(De)}),$e}function Fe(De){return!De||!("framebuffer"in De)?Ie(De):Oe(De)}return Fe}function Vs(I){return Array.prototype.slice.call(I)}function Hs(I){return Vs(I).join("")}function Y3(){var I=0,G=[],V=[];function ce($e){for(var Ve=0;Ve<V.length;++Ve)if(V[Ve]===$e)return G[Ve];var ke="g"+I++;return G.push(ke),V.push($e),ke}function we(){var $e=[];function Ve(){$e.push.apply($e,Vs(arguments))}var ke=[];function je(){var oe="v"+I++;return ke.push(oe),arguments.length>0&&($e.push(oe,"="),$e.push.apply($e,Vs(arguments)),$e.push(";")),oe}return n(Ve,{def:je,toString:function(){return Hs([ke.length>0?"var "+ke.join(",")+";":"",Hs($e)])}})}function le(){var $e=we(),Ve=we(),ke=$e.toString,je=Ve.toString;function oe(ve,Be){Ve(ve,Be,"=",$e.def(ve,Be),";")}return n(function(){$e.apply($e,Vs(arguments))},{def:$e.def,entry:$e,exit:Ve,save:oe,set:function(ve,Be,Ke){oe(ve,Be),$e(ve,Be,"=",Ke,";")},toString:function(){return ke()+je()}})}function de(){var $e=Hs(arguments),Ve=le(),ke=le(),je=Ve.toString,oe=ke.toString;return n(Ve,{then:function(){return Ve.apply(Ve,Vs(arguments)),this},else:function(){return ke.apply(ke,Vs(arguments)),this},toString:function(){var ve=oe();return ve&&(ve="else{"+ve+"}"),Hs(["if(",$e,"){",je(),"}",ve])}})}var Ie=we(),Oe={};function Fe($e,Ve){var ke=[];function je(){var Me="a"+ke.length;return ke.push(Me),Me}Ve=Ve||0;for(var oe=0;oe<Ve;++oe)je();var ve=le(),Be=ve.toString,Ke=Oe[$e]=n(ve,{arg:je,toString:function(){return Hs(["function(",ke.join(),"){",Be(),"}"])}});return Ke}function De(){var $e=['"use strict";',Ie,"return {"];Object.keys(Oe).forEach(function(je){$e.push('"',je,'":',Oe[je].toString(),",")}),$e.push("}");var Ve=Hs($e).replace(/;/g,`;
|
|
45
|
-
`).replace(/}/g,`}
|
|
46
|
-
`).replace(/{/g,`{
|
|
47
|
-
`),ke=Function.apply(null,G.concat(Ve));return ke.apply(null,V)}return{global:Ie,link:ce,block:we,proc:Fe,scope:le,cond:de,compile:De}}var qs="xyzw".split(""),Px=5121,Zs=1,Up=2,Xp=0,Yp=1,Wp=2,Vp=3,Dc=4,Rx=5,Bx=6,Fx="dither",Gx="blend.enable",zx="blend.color",Hp="blend.equation",qp="blend.func",$x="depth.enable",jx="depth.func",Ux="depth.range",Xx="depth.mask",Zp="colorMask",Yx="cull.enable",Wx="cull.face",Kp="frontFace",Qp="lineWidth",Vx="polygonOffset.enable",Jp="polygonOffset.offset",Hx="sample.alpha",qx="sample.enable",eg="sample.coverage",Zx="stencil.enable",Kx="stencil.mask",tg="stencil.func",rg="stencil.opFront",vf="stencil.opBack",Qx="scissor.enable",Pc="scissor.box",Ma="viewport",pf="profile",qo="framebuffer",gf="vert",yf="frag",Zo="elements",Ko="primitive",Qo="count",Rc="offset",Bc="instances",mf="vao",ng="Width",ig="Height",Ks=qo+ng,Qs=qo+ig,W3=Ma+ng,V3=Ma+ig,Jx="drawingBuffer",ew=Jx+ng,tw=Jx+ig,H3=[qp,Hp,tg,rg,vf,eg,Ma,Pc,Jp],Js=34962,q3=34963,Z3=35632,K3=35633,rw=3553,Q3=34067,J3=2884,e5=3042,t5=3024,r5=2960,n5=2929,i5=3089,a5=32823,o5=32926,s5=32928,ag=5126,Fc=35664,Gc=35665,zc=35666,og=5124,$c=35667,jc=35668,Uc=35669,sg=35670,Xc=35671,Yc=35672,Wc=35673,bf=35674,xf=35675,wf=35676,Ef=35678,_f=35680,nw=4,Sf=1028,Jo=1029,iw=2304,ug=2305,u5=32775,f5=32776,l5=519,eo=7680,aw=0,ow=1,sw=32774,c5=513,uw=36160,h5=36064,ji={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},fw=["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"],eu={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},to={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},lw={frag:Z3,vert:K3},fg={cw:iw,ccw:ug};function Vc(I){return Array.isArray(I)||t(I)||Ei(I)}function cw(I){return I.sort(function(G,V){return G===Ma?-1:V===Ma?1:G<V?-1:1})}function In(I,G,V,ce){this.thisDep=I,this.contextDep=G,this.propDep=V,this.append=ce}function ro(I){return I&&!(I.thisDep||I.contextDep||I.propDep)}function Dr(I){return new In(!1,!1,!1,I)}function On(I,G){var V=I.type;if(V===Xp){var ce=I.data.length;return new In(!0,ce>=1,ce>=2,G)}else if(V===Dc){var we=I.data;return new In(we.thisDep,we.contextDep,we.propDep,G)}else{if(V===Rx)return new In(!1,!1,!1,G);if(V===Bx){for(var le=!1,de=!1,Ie=!1,Oe=0;Oe<I.data.length;++Oe){var Fe=I.data[Oe];if(Fe.type===Yp)Ie=!0;else if(Fe.type===Wp)de=!0;else if(Fe.type===Vp)le=!0;else if(Fe.type===Xp){le=!0;var De=Fe.data;De>=1&&(de=!0),De>=2&&(Ie=!0)}else Fe.type===Dc&&(le=le||Fe.data.thisDep,de=de||Fe.data.contextDep,Ie=Ie||Fe.data.propDep)}return new In(le,de,Ie,G)}else return new In(V===Vp,V===Wp,V===Yp,G)}}var hw=new In(!1,!1,!1,function(){});function d5(I,G,V,ce,we,le,de,Ie,Oe,Fe,De,$e,Ve,ke,je){var oe=Fe.Record,ve={add:32774,subtract:32778,"reverse subtract":32779};V.ext_blend_minmax&&(ve.min=u5,ve.max=f5);var Be=V.angle_instanced_arrays,Ke=V.webgl_draw_buffers,Me={dirty:!0,profile:je.profile},rt={},Ae=[],Ue={},Ce={};function Xe(j){return j.replace(".","_")}function vt(j,R,Z){var ie=Xe(j);Ae.push(j),rt[ie]=Me[ie]=!!Z,Ue[ie]=R}function Tt(j,R,Z){var ie=Xe(j);Ae.push(j),Array.isArray(Z)?(Me[ie]=Z.slice(),rt[ie]=Z.slice()):Me[ie]=rt[ie]=Z,Ce[ie]=R}vt(Fx,t5),vt(Gx,e5),Tt(zx,"blendColor",[0,0,0,0]),Tt(Hp,"blendEquationSeparate",[sw,sw]),Tt(qp,"blendFuncSeparate",[ow,aw,ow,aw]),vt($x,n5,!0),Tt(jx,"depthFunc",c5),Tt(Ux,"depthRange",[0,1]),Tt(Xx,"depthMask",!0),Tt(Zp,Zp,[!0,!0,!0,!0]),vt(Yx,J3),Tt(Wx,"cullFace",Jo),Tt(Kp,Kp,ug),Tt(Qp,Qp,1),vt(Vx,a5),Tt(Jp,"polygonOffset",[0,0]),vt(Hx,o5),vt(qx,s5),Tt(eg,"sampleCoverage",[1,!1]),vt(Zx,r5),Tt(Kx,"stencilMask",-1),Tt(tg,"stencilFunc",[l5,0,-1]),Tt(rg,"stencilOpSeparate",[Sf,eo,eo,eo]),Tt(vf,"stencilOpSeparate",[Jo,eo,eo,eo]),vt(Qx,i5),Tt(Pc,"scissor",[0,0,I.drawingBufferWidth,I.drawingBufferHeight]),Tt(Ma,Ma,[0,0,I.drawingBufferWidth,I.drawingBufferHeight]);var He={gl:I,context:Ve,strings:G,next:rt,current:Me,draw:$e,elements:le,buffer:we,shader:De,attributes:Fe.state,vao:Fe,uniforms:Oe,framebuffer:Ie,extensions:V,timer:ke,isBufferArgs:Vc},ze={primTypes:Gs,compareFuncs:eu,blendFuncs:ji,blendEquations:ve,stencilOps:to,glTypes:Xo,orientationType:fg};L.optional(function(){He.isArrayLike=kr}),Ke&&(ze.backBuffer=[Jo],ze.drawBuffer=un(ce.maxDrawbuffers,function(j){return j===0?[0]:un(j,function(R){return h5+R})}));var _e=0;function Ct(){var j=Y3(),R=j.link,Z=j.global;j.id=_e++,j.batchId="0";var ie=R(He),se=j.shared={props:"a0"};Object.keys(He).forEach(function(q){se[q]=Z.def(ie,".",q)}),L.optional(function(){j.CHECK=R(L),j.commandStr=L.guessCommand(),j.command=R(j.commandStr),j.assert=function(q,z,ne){q("if(!(",z,"))",this.CHECK,".commandRaise(",R(ne),",",this.command,");")},ze.invalidBlendCombinations=fw});var ee=j.next={},Q=j.current={};Object.keys(Ce).forEach(function(q){Array.isArray(Me[q])&&(ee[q]=Z.def(se.next,".",q),Q[q]=Z.def(se.current,".",q))});var re=j.constants={};Object.keys(ze).forEach(function(q){re[q]=Z.def(JSON.stringify(ze[q]))}),j.invoke=function(q,z){switch(z.type){case Xp:var ne=["this",se.context,se.props,j.batchId];return q.def(R(z.data),".call(",ne.slice(0,Math.max(z.data.length+1,4)),")");case Yp:return q.def(se.props,z.data);case Wp:return q.def(se.context,z.data);case Vp:return q.def("this",z.data);case Dc:return z.data.append(j,q),z.data.ref;case Rx:return z.data.toString();case Bx:return z.data.map(function(ue){return j.invoke(q,ue)})}},j.attribCache={};var U={};return j.scopeAttrib=function(q){var z=G.id(q);if(z in U)return U[z];var ne=Fe.scope[z];ne||(ne=Fe.scope[z]=new oe);var ue=U[z]=R(ne);return ue},j}function Nt(j){var R=j.static,Z=j.dynamic,ie;if(pf in R){var se=!!R[pf];ie=Dr(function(Q,re){return se}),ie.enable=se}else if(pf in Z){var ee=Z[pf];ie=On(ee,function(Q,re){return Q.invoke(re,ee)})}return ie}function ot(j,R){var Z=j.static,ie=j.dynamic;if(qo in Z){var se=Z[qo];return se?(se=Ie.getFramebuffer(se),L.command(se,"invalid framebuffer object"),Dr(function(Q,re){var U=Q.link(se),q=Q.shared;re.set(q.framebuffer,".next",U);var z=q.context;return re.set(z,"."+Ks,U+".width"),re.set(z,"."+Qs,U+".height"),U})):Dr(function(Q,re){var U=Q.shared;re.set(U.framebuffer,".next","null");var q=U.context;return re.set(q,"."+Ks,q+"."+ew),re.set(q,"."+Qs,q+"."+tw),"null"})}else if(qo in ie){var ee=ie[qo];return On(ee,function(Q,re){var U=Q.invoke(re,ee),q=Q.shared,z=q.framebuffer,ne=re.def(z,".getFramebuffer(",U,")");L.optional(function(){Q.assert(re,"!"+U+"||"+ne,"invalid framebuffer object")}),re.set(z,".next",ne);var ue=q.context;return re.set(ue,"."+Ks,ne+"?"+ne+".width:"+ue+"."+ew),re.set(ue,"."+Qs,ne+"?"+ne+".height:"+ue+"."+tw),ne})}else return null}function Gt(j,R,Z){var ie=j.static,se=j.dynamic;function ee(U){if(U in ie){var q=ie[U];L.commandType(q,"object","invalid "+U,Z.commandStr);var z=!0,ne=q.x|0,ue=q.y|0,be,Ee;return"width"in q?(be=q.width|0,L.command(be>=0,"invalid "+U,Z.commandStr)):z=!1,"height"in q?(Ee=q.height|0,L.command(Ee>=0,"invalid "+U,Z.commandStr)):z=!1,new In(!z&&R&&R.thisDep,!z&&R&&R.contextDep,!z&&R&&R.propDep,function(ft,Dt){var st=ft.shared.context,xt=be;"width"in q||(xt=Dt.def(st,".",Ks,"-",ne));var Lt=Ee;return"height"in q||(Lt=Dt.def(st,".",Qs,"-",ue)),[ne,ue,xt,Lt]})}else if(U in se){var ge=se[U],Re=On(ge,function(ft,Dt){var st=ft.invoke(Dt,ge);L.optional(function(){ft.assert(Dt,st+"&&typeof "+st+'==="object"',"invalid "+U)});var xt=ft.shared.context,Lt=Dt.def(st,".x|0"),tr=Dt.def(st,".y|0"),Cr=Dt.def('"width" in ',st,"?",st,".width|0:","(",xt,".",Ks,"-",Lt,")"),kn=Dt.def('"height" in ',st,"?",st,".height|0:","(",xt,".",Qs,"-",tr,")");return L.optional(function(){ft.assert(Dt,Cr+">=0&&"+kn+">=0","invalid "+U)}),[Lt,tr,Cr,kn]});return R&&(Re.thisDep=Re.thisDep||R.thisDep,Re.contextDep=Re.contextDep||R.contextDep,Re.propDep=Re.propDep||R.propDep),Re}else return R?new In(R.thisDep,R.contextDep,R.propDep,function(ft,Dt){var st=ft.shared.context;return[0,0,Dt.def(st,".",Ks),Dt.def(st,".",Qs)]}):null}var Q=ee(Ma);if(Q){var re=Q;Q=new In(Q.thisDep,Q.contextDep,Q.propDep,function(U,q){var z=re.append(U,q),ne=U.shared.context;return q.set(ne,"."+W3,z[2]),q.set(ne,"."+V3,z[3]),z})}return{viewport:Q,scissor_box:ee(Pc)}}function It(j,R){var Z=j.static,ie=typeof Z[yf]=="string"&&typeof Z[gf]=="string";if(ie){if(Object.keys(R.dynamic).length>0)return null;var se=R.static,ee=Object.keys(se);if(ee.length>0&&typeof se[ee[0]]=="number"){for(var Q=[],re=0;re<ee.length;++re)L(typeof se[ee[re]]=="number","must specify all vertex attribute locations when using vaos"),Q.push([se[ee[re]]|0,ee[re]]);return Q}}return null}function Bt(j,R,Z){var ie=j.static,se=j.dynamic;function ee(z){if(z in ie){var ne=G.id(ie[z]);L.optional(function(){De.shader(lw[z],ne,L.guessCommand())});var ue=Dr(function(){return ne});return ue.id=ne,ue}else if(z in se){var be=se[z];return On(be,function(Ee,ge){var Re=Ee.invoke(ge,be),ft=ge.def(Ee.shared.strings,".id(",Re,")");return L.optional(function(){ge(Ee.shared.shader,".shader(",lw[z],",",ft,",",Ee.command,");")}),ft})}return null}var Q=ee(yf),re=ee(gf),U=null,q;return ro(Q)&&ro(re)?(U=De.program(re.id,Q.id,null,Z),q=Dr(function(z,ne){return z.link(U)})):q=new In(Q&&Q.thisDep||re&&re.thisDep,Q&&Q.contextDep||re&&re.contextDep,Q&&Q.propDep||re&&re.propDep,function(z,ne){var ue=z.shared.shader,be;Q?be=Q.append(z,ne):be=ne.def(ue,".",yf);var Ee;re?Ee=re.append(z,ne):Ee=ne.def(ue,".",gf);var ge=ue+".program("+Ee+","+be;return L.optional(function(){ge+=","+z.command}),ne.def(ge+")")}),{frag:Q,vert:re,progVar:q,program:U}}function er(j,R){var Z=j.static,ie=j.dynamic;function se(){if(Zo in Z){var z=Z[Zo];Vc(z)?z=le.getElements(le.create(z,!0)):z&&(z=le.getElements(z),L.command(z,"invalid elements",R.commandStr));var ne=Dr(function(be,Ee){if(z){var ge=be.link(z);return be.ELEMENTS=ge,ge}return be.ELEMENTS=null,null});return ne.value=z,ne}else if(Zo in ie){var ue=ie[Zo];return On(ue,function(be,Ee){var ge=be.shared,Re=ge.isBufferArgs,ft=ge.elements,Dt=be.invoke(Ee,ue),st=Ee.def("null"),xt=Ee.def(Re,"(",Dt,")"),Lt=be.cond(xt).then(st,"=",ft,".createStream(",Dt,");").else(st,"=",ft,".getElements(",Dt,");");return L.optional(function(){be.assert(Lt.else,"!"+Dt+"||"+st,"invalid elements")}),Ee.entry(Lt),Ee.exit(be.cond(xt).then(ft,".destroyStream(",st,");")),be.ELEMENTS=st,st})}return null}var ee=se();function Q(){if(Ko in Z){var z=Z[Ko];return L.commandParameter(z,Gs,"invalid primitve",R.commandStr),Dr(function(ue,be){return Gs[z]})}else if(Ko in ie){var ne=ie[Ko];return On(ne,function(ue,be){var Ee=ue.constants.primTypes,ge=ue.invoke(be,ne);return L.optional(function(){ue.assert(be,ge+" in "+Ee,"invalid primitive, must be one of "+Object.keys(Gs))}),be.def(Ee,"[",ge,"]")})}else if(ee)return ro(ee)?ee.value?Dr(function(ue,be){return be.def(ue.ELEMENTS,".primType")}):Dr(function(){return nw}):new In(ee.thisDep,ee.contextDep,ee.propDep,function(ue,be){var Ee=ue.ELEMENTS;return be.def(Ee,"?",Ee,".primType:",nw)});return null}function re(z,ne){if(z in Z){var ue=Z[z]|0;return L.command(!ne||ue>=0,"invalid "+z,R.commandStr),Dr(function(Ee,ge){return ne&&(Ee.OFFSET=ue),ue})}else if(z in ie){var be=ie[z];return On(be,function(Ee,ge){var Re=Ee.invoke(ge,be);return ne&&(Ee.OFFSET=Re,L.optional(function(){Ee.assert(ge,Re+">=0","invalid "+z)})),Re})}else if(ne&&ee)return Dr(function(Ee,ge){return Ee.OFFSET="0",0});return null}var U=re(Rc,!0);function q(){if(Qo in Z){var z=Z[Qo]|0;return L.command(typeof z=="number"&&z>=0,"invalid vertex count",R.commandStr),Dr(function(){return z})}else if(Qo in ie){var ne=ie[Qo];return On(ne,function(Ee,ge){var Re=Ee.invoke(ge,ne);return L.optional(function(){Ee.assert(ge,"typeof "+Re+'==="number"&&'+Re+">=0&&"+Re+"===("+Re+"|0)","invalid vertex count")}),Re})}else if(ee)if(ro(ee)){if(ee)return U?new In(U.thisDep,U.contextDep,U.propDep,function(Ee,ge){var Re=ge.def(Ee.ELEMENTS,".vertCount-",Ee.OFFSET);return L.optional(function(){Ee.assert(ge,Re+">=0","invalid vertex offset/element buffer too small")}),Re}):Dr(function(Ee,ge){return ge.def(Ee.ELEMENTS,".vertCount")});var ue=Dr(function(){return-1});return L.optional(function(){ue.MISSING=!0}),ue}else{var be=new In(ee.thisDep||U.thisDep,ee.contextDep||U.contextDep,ee.propDep||U.propDep,function(Ee,ge){var Re=Ee.ELEMENTS;return Ee.OFFSET?ge.def(Re,"?",Re,".vertCount-",Ee.OFFSET,":-1"):ge.def(Re,"?",Re,".vertCount:-1")});return L.optional(function(){be.DYNAMIC=!0}),be}return null}return{elements:ee,primitive:Q(),count:q(),instances:re(Bc,!1),offset:U}}function Pr(j,R){var Z=j.static,ie=j.dynamic,se={};return Ae.forEach(function(ee){var Q=Xe(ee);function re(U,q){if(ee in Z){var z=U(Z[ee]);se[Q]=Dr(function(){return z})}else if(ee in ie){var ne=ie[ee];se[Q]=On(ne,function(ue,be){return q(ue,be,ue.invoke(be,ne))})}}switch(ee){case Yx:case Gx:case Fx:case Zx:case $x:case Qx:case Vx:case Hx:case qx:case Xx:return re(function(U){return L.commandType(U,"boolean",ee,R.commandStr),U},function(U,q,z){return L.optional(function(){U.assert(q,"typeof "+z+'==="boolean"',"invalid flag "+ee,U.commandStr)}),z});case jx:return re(function(U){return L.commandParameter(U,eu,"invalid "+ee,R.commandStr),eu[U]},function(U,q,z){var ne=U.constants.compareFuncs;return L.optional(function(){U.assert(q,z+" in "+ne,"invalid "+ee+", must be one of "+Object.keys(eu))}),q.def(ne,"[",z,"]")});case Ux:return re(function(U){return L.command(kr(U)&&U.length===2&&typeof U[0]=="number"&&typeof U[1]=="number"&&U[0]<=U[1],"depth range is 2d array",R.commandStr),U},function(U,q,z){L.optional(function(){U.assert(q,U.shared.isArrayLike+"("+z+")&&"+z+".length===2&&typeof "+z+'[0]==="number"&&typeof '+z+'[1]==="number"&&'+z+"[0]<="+z+"[1]","depth range must be a 2d array")});var ne=q.def("+",z,"[0]"),ue=q.def("+",z,"[1]");return[ne,ue]});case qp:return re(function(U){L.commandType(U,"object","blend.func",R.commandStr);var q="srcRGB"in U?U.srcRGB:U.src,z="srcAlpha"in U?U.srcAlpha:U.src,ne="dstRGB"in U?U.dstRGB:U.dst,ue="dstAlpha"in U?U.dstAlpha:U.dst;return L.commandParameter(q,ji,Q+".srcRGB",R.commandStr),L.commandParameter(z,ji,Q+".srcAlpha",R.commandStr),L.commandParameter(ne,ji,Q+".dstRGB",R.commandStr),L.commandParameter(ue,ji,Q+".dstAlpha",R.commandStr),L.command(fw.indexOf(q+", "+ne)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+q+", "+ne+")",R.commandStr),[ji[q],ji[ne],ji[z],ji[ue]]},function(U,q,z){var ne=U.constants.blendFuncs;L.optional(function(){U.assert(q,z+"&&typeof "+z+'==="object"',"invalid blend func, must be an object")});function ue(st,xt){var Lt=q.def('"',st,xt,'" in ',z,"?",z,".",st,xt,":",z,".",st);return L.optional(function(){U.assert(q,Lt+" in "+ne,"invalid "+ee+"."+st+xt+", must be one of "+Object.keys(ji))}),Lt}var be=ue("src","RGB"),Ee=ue("dst","RGB");L.optional(function(){var st=U.constants.invalidBlendCombinations;U.assert(q,st+".indexOf("+be+'+", "+'+Ee+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var ge=q.def(ne,"[",be,"]"),Re=q.def(ne,"[",ue("src","Alpha"),"]"),ft=q.def(ne,"[",Ee,"]"),Dt=q.def(ne,"[",ue("dst","Alpha"),"]");return[ge,ft,Re,Dt]});case Hp:return re(function(U){if(typeof U=="string")return L.commandParameter(U,ve,"invalid "+ee,R.commandStr),[ve[U],ve[U]];if(typeof U=="object")return L.commandParameter(U.rgb,ve,ee+".rgb",R.commandStr),L.commandParameter(U.alpha,ve,ee+".alpha",R.commandStr),[ve[U.rgb],ve[U.alpha]];L.commandRaise("invalid blend.equation",R.commandStr)},function(U,q,z){var ne=U.constants.blendEquations,ue=q.def(),be=q.def(),Ee=U.cond("typeof ",z,'==="string"');return L.optional(function(){function ge(Re,ft,Dt){U.assert(Re,Dt+" in "+ne,"invalid "+ft+", must be one of "+Object.keys(ve))}ge(Ee.then,ee,z),U.assert(Ee.else,z+"&&typeof "+z+'==="object"',"invalid "+ee),ge(Ee.else,ee+".rgb",z+".rgb"),ge(Ee.else,ee+".alpha",z+".alpha")}),Ee.then(ue,"=",be,"=",ne,"[",z,"];"),Ee.else(ue,"=",ne,"[",z,".rgb];",be,"=",ne,"[",z,".alpha];"),q(Ee),[ue,be]});case zx:return re(function(U){return L.command(kr(U)&&U.length===4,"blend.color must be a 4d array",R.commandStr),un(4,function(q){return+U[q]})},function(U,q,z){return L.optional(function(){U.assert(q,U.shared.isArrayLike+"("+z+")&&"+z+".length===4","blend.color must be a 4d array")}),un(4,function(ne){return q.def("+",z,"[",ne,"]")})});case Kx:return re(function(U){return L.commandType(U,"number",Q,R.commandStr),U|0},function(U,q,z){return L.optional(function(){U.assert(q,"typeof "+z+'==="number"',"invalid stencil.mask")}),q.def(z,"|0")});case tg:return re(function(U){L.commandType(U,"object",Q,R.commandStr);var q=U.cmp||"keep",z=U.ref||0,ne="mask"in U?U.mask:-1;return L.commandParameter(q,eu,ee+".cmp",R.commandStr),L.commandType(z,"number",ee+".ref",R.commandStr),L.commandType(ne,"number",ee+".mask",R.commandStr),[eu[q],z,ne]},function(U,q,z){var ne=U.constants.compareFuncs;L.optional(function(){function ge(){U.assert(q,Array.prototype.join.call(arguments,""),"invalid stencil.func")}ge(z+"&&typeof ",z,'==="object"'),ge('!("cmp" in ',z,")||(",z,".cmp in ",ne,")")});var ue=q.def('"cmp" in ',z,"?",ne,"[",z,".cmp]",":",eo),be=q.def(z,".ref|0"),Ee=q.def('"mask" in ',z,"?",z,".mask|0:-1");return[ue,be,Ee]});case rg:case vf:return re(function(U){L.commandType(U,"object",Q,R.commandStr);var q=U.fail||"keep",z=U.zfail||"keep",ne=U.zpass||"keep";return L.commandParameter(q,to,ee+".fail",R.commandStr),L.commandParameter(z,to,ee+".zfail",R.commandStr),L.commandParameter(ne,to,ee+".zpass",R.commandStr),[ee===vf?Jo:Sf,to[q],to[z],to[ne]]},function(U,q,z){var ne=U.constants.stencilOps;L.optional(function(){U.assert(q,z+"&&typeof "+z+'==="object"',"invalid "+ee)});function ue(be){return L.optional(function(){U.assert(q,'!("'+be+'" in '+z+")||("+z+"."+be+" in "+ne+")","invalid "+ee+"."+be+", must be one of "+Object.keys(to))}),q.def('"',be,'" in ',z,"?",ne,"[",z,".",be,"]:",eo)}return[ee===vf?Jo:Sf,ue("fail"),ue("zfail"),ue("zpass")]});case Jp:return re(function(U){L.commandType(U,"object",Q,R.commandStr);var q=U.factor|0,z=U.units|0;return L.commandType(q,"number",Q+".factor",R.commandStr),L.commandType(z,"number",Q+".units",R.commandStr),[q,z]},function(U,q,z){L.optional(function(){U.assert(q,z+"&&typeof "+z+'==="object"',"invalid "+ee)});var ne=q.def(z,".factor|0"),ue=q.def(z,".units|0");return[ne,ue]});case Wx:return re(function(U){var q=0;return U==="front"?q=Sf:U==="back"&&(q=Jo),L.command(!!q,Q,R.commandStr),q},function(U,q,z){return L.optional(function(){U.assert(q,z+'==="front"||'+z+'==="back"',"invalid cull.face")}),q.def(z,'==="front"?',Sf,":",Jo)});case Qp:return re(function(U){return L.command(typeof U=="number"&&U>=ce.lineWidthDims[0]&&U<=ce.lineWidthDims[1],"invalid line width, must be a positive number between "+ce.lineWidthDims[0]+" and "+ce.lineWidthDims[1],R.commandStr),U},function(U,q,z){return L.optional(function(){U.assert(q,"typeof "+z+'==="number"&&'+z+">="+ce.lineWidthDims[0]+"&&"+z+"<="+ce.lineWidthDims[1],"invalid line width")}),z});case Kp:return re(function(U){return L.commandParameter(U,fg,Q,R.commandStr),fg[U]},function(U,q,z){return L.optional(function(){U.assert(q,z+'==="cw"||'+z+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),q.def(z+'==="cw"?'+iw+":"+ug)});case Zp:return re(function(U){return L.command(kr(U)&&U.length===4,"color.mask must be length 4 array",R.commandStr),U.map(function(q){return!!q})},function(U,q,z){return L.optional(function(){U.assert(q,U.shared.isArrayLike+"("+z+")&&"+z+".length===4","invalid color.mask")}),un(4,function(ne){return"!!"+z+"["+ne+"]"})});case eg:return re(function(U){L.command(typeof U=="object"&&U,Q,R.commandStr);var q="value"in U?U.value:1,z=!!U.invert;return L.command(typeof q=="number"&&q>=0&&q<=1,"sample.coverage.value must be a number between 0 and 1",R.commandStr),[q,z]},function(U,q,z){L.optional(function(){U.assert(q,z+"&&typeof "+z+'==="object"',"invalid sample.coverage")});var ne=q.def('"value" in ',z,"?+",z,".value:1"),ue=q.def("!!",z,".invert");return[ne,ue]})}}),se}function Zr(j,R){var Z=j.static,ie=j.dynamic,se={};return Object.keys(Z).forEach(function(ee){var Q=Z[ee],re;if(typeof Q=="number"||typeof Q=="boolean")re=Dr(function(){return Q});else if(typeof Q=="function"){var U=Q._reglType;U==="texture2d"||U==="textureCube"?re=Dr(function(q){return q.link(Q)}):U==="framebuffer"||U==="framebufferCube"?(L.command(Q.color.length>0,'missing color attachment for framebuffer sent to uniform "'+ee+'"',R.commandStr),re=Dr(function(q){return q.link(Q.color[0])})):L.commandRaise('invalid data for uniform "'+ee+'"',R.commandStr)}else kr(Q)?re=Dr(function(q){var z=q.global.def("[",un(Q.length,function(ne){return L.command(typeof Q[ne]=="number"||typeof Q[ne]=="boolean","invalid uniform "+ee,q.commandStr),Q[ne]}),"]");return z}):L.commandRaise('invalid or missing data for uniform "'+ee+'"',R.commandStr);re.value=Q,se[ee]=re}),Object.keys(ie).forEach(function(ee){var Q=ie[ee];se[ee]=On(Q,function(re,U){return re.invoke(U,Q)})}),se}function Ut(j,R){var Z=j.static,ie=j.dynamic,se={};return Object.keys(Z).forEach(function(ee){var Q=Z[ee],re=G.id(ee),U=new oe;if(Vc(Q))U.state=Zs,U.buffer=we.getBuffer(we.create(Q,Js,!1,!0)),U.type=0;else{var q=we.getBuffer(Q);if(q)U.state=Zs,U.buffer=q,U.type=0;else if(L.command(typeof Q=="object"&&Q,"invalid data for attribute "+ee,R.commandStr),"constant"in Q){var z=Q.constant;U.buffer="null",U.state=Up,typeof z=="number"?U.x=z:(L.command(kr(z)&&z.length>0&&z.length<=4,"invalid constant for attribute "+ee,R.commandStr),qs.forEach(function(ft,Dt){Dt<z.length&&(U[ft]=z[Dt])}))}else{Vc(Q.buffer)?q=we.getBuffer(we.create(Q.buffer,Js,!1,!0)):q=we.getBuffer(Q.buffer),L.command(!!q,'missing buffer for attribute "'+ee+'"',R.commandStr);var ne=Q.offset|0;L.command(ne>=0,'invalid offset for attribute "'+ee+'"',R.commandStr);var ue=Q.stride|0;L.command(ue>=0&&ue<256,'invalid stride for attribute "'+ee+'", must be integer betweeen [0, 255]',R.commandStr);var be=Q.size|0;L.command(!("size"in Q)||be>0&&be<=4,'invalid size for attribute "'+ee+'", must be 1,2,3,4',R.commandStr);var Ee=!!Q.normalized,ge=0;"type"in Q&&(L.commandParameter(Q.type,Xo,"invalid type for attribute "+ee,R.commandStr),ge=Xo[Q.type]);var Re=Q.divisor|0;"divisor"in Q&&(L.command(Re===0||Be,'cannot specify divisor for attribute "'+ee+'", instancing not supported',R.commandStr),L.command(Re>=0,'invalid divisor for attribute "'+ee+'"',R.commandStr)),L.optional(function(){var ft=R.commandStr,Dt=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(Q).forEach(function(st){L.command(Dt.indexOf(st)>=0,'unknown parameter "'+st+'" for attribute pointer "'+ee+'" (valid parameters are '+Dt+")",ft)})}),U.buffer=q,U.state=Zs,U.size=be,U.normalized=Ee,U.type=ge||q.dtype,U.offset=ne,U.stride=ue,U.divisor=Re}}se[ee]=Dr(function(ft,Dt){var st=ft.attribCache;if(re in st)return st[re];var xt={isStream:!1};return Object.keys(U).forEach(function(Lt){xt[Lt]=U[Lt]}),U.buffer&&(xt.buffer=ft.link(U.buffer),xt.type=xt.type||xt.buffer+".dtype"),st[re]=xt,xt})}),Object.keys(ie).forEach(function(ee){var Q=ie[ee];function re(U,q){var z=U.invoke(q,Q),ne=U.shared,ue=U.constants,be=ne.isBufferArgs,Ee=ne.buffer;L.optional(function(){U.assert(q,z+"&&(typeof "+z+'==="object"||typeof '+z+'==="function")&&('+be+"("+z+")||"+Ee+".getBuffer("+z+")||"+Ee+".getBuffer("+z+".buffer)||"+be+"("+z+'.buffer)||("constant" in '+z+"&&(typeof "+z+'.constant==="number"||'+ne.isArrayLike+"("+z+".constant))))",'invalid dynamic attribute "'+ee+'"')});var ge={isStream:q.def(!1)},Re=new oe;Re.state=Zs,Object.keys(Re).forEach(function(xt){ge[xt]=q.def(""+Re[xt])});var ft=ge.buffer,Dt=ge.type;q("if(",be,"(",z,")){",ge.isStream,"=true;",ft,"=",Ee,".createStream(",Js,",",z,");",Dt,"=",ft,".dtype;","}else{",ft,"=",Ee,".getBuffer(",z,");","if(",ft,"){",Dt,"=",ft,".dtype;",'}else if("constant" in ',z,"){",ge.state,"=",Up,";","if(typeof "+z+'.constant === "number"){',ge[qs[0]],"=",z,".constant;",qs.slice(1).map(function(xt){return ge[xt]}).join("="),"=0;","}else{",qs.map(function(xt,Lt){return ge[xt]+"="+z+".constant.length>"+Lt+"?"+z+".constant["+Lt+"]:0;"}).join(""),"}}else{","if(",be,"(",z,".buffer)){",ft,"=",Ee,".createStream(",Js,",",z,".buffer);","}else{",ft,"=",Ee,".getBuffer(",z,".buffer);","}",Dt,'="type" in ',z,"?",ue.glTypes,"[",z,".type]:",ft,".dtype;",ge.normalized,"=!!",z,".normalized;");function st(xt){q(ge[xt],"=",z,".",xt,"|0;")}return st("size"),st("offset"),st("stride"),st("divisor"),q("}}"),q.exit("if(",ge.isStream,"){",Ee,".destroyStream(",ft,");","}"),ge}se[ee]=On(Q,re)}),se}function Ur(j,R){var Z=j.static,ie=j.dynamic;if(mf in Z){var se=Z[mf];return se!==null&&Fe.getVAO(se)===null&&(se=Fe.createVAO(se)),Dr(function(Q){return Q.link(Fe.getVAO(se))})}else if(mf in ie){var ee=ie[mf];return On(ee,function(Q,re){var U=Q.invoke(re,ee);return re.def(Q.shared.vao+".getVAO("+U+")")})}return null}function gr(j){var R=j.static,Z=j.dynamic,ie={};return Object.keys(R).forEach(function(se){var ee=R[se];ie[se]=Dr(function(Q,re){return typeof ee=="number"||typeof ee=="boolean"?""+ee:Q.link(ee)})}),Object.keys(Z).forEach(function(se){var ee=Z[se];ie[se]=On(ee,function(Q,re){return Q.invoke(re,ee)})}),ie}function Rr(j,R,Z,ie,se){var ee=j.static,Q=j.dynamic;L.optional(function(){var st=[qo,gf,yf,Zo,Ko,Rc,Qo,Bc,pf,mf].concat(Ae);function xt(Lt){Object.keys(Lt).forEach(function(tr){L.command(st.indexOf(tr)>=0,'unknown parameter "'+tr+'"',se.commandStr)})}xt(ee),xt(Q)});var re=It(j,R),U=ot(j),q=Gt(j,U,se),z=er(j,se),ne=Pr(j,se),ue=Bt(j,se,re);function be(st){var xt=q[st];xt&&(ne[st]=xt)}be(Ma),be(Xe(Pc));var Ee=Object.keys(ne).length>0,ge={framebuffer:U,draw:z,shader:ue,state:ne,dirty:Ee,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(ge.profile=Nt(j),ge.uniforms=Zr(Z,se),ge.drawVAO=ge.scopeVAO=Ur(j),!ge.drawVAO&&ue.program&&!re&&V.angle_instanced_arrays){var Re=!0,ft=ue.program.attributes.map(function(st){var xt=R.static[st];return Re=Re&&!!xt,xt});if(Re&&ft.length>0){var Dt=Fe.getVAO(Fe.createVAO(ft));ge.drawVAO=new In(null,null,null,function(st,xt){return st.link(Dt)}),ge.useVAO=!0}}return re?ge.useVAO=!0:ge.attributes=Ut(R,se),ge.context=gr(ie),ge}function Xr(j,R,Z){var ie=j.shared,se=ie.context,ee=j.scope();Object.keys(Z).forEach(function(Q){R.save(se,"."+Q);var re=Z[Q],U=re.append(j,R);Array.isArray(U)?ee(se,".",Q,"=[",U.join(),"];"):ee(se,".",Q,"=",U,";")}),R(ee)}function Yr(j,R,Z,ie){var se=j.shared,ee=se.gl,Q=se.framebuffer,re;Ke&&(re=R.def(se.extensions,".webgl_draw_buffers"));var U=j.constants,q=U.drawBuffer,z=U.backBuffer,ne;Z?ne=Z.append(j,R):ne=R.def(Q,".next"),ie||R("if(",ne,"!==",Q,".cur){"),R("if(",ne,"){",ee,".bindFramebuffer(",uw,",",ne,".framebuffer);"),Ke&&R(re,".drawBuffersWEBGL(",q,"[",ne,".colorAttachments.length]);"),R("}else{",ee,".bindFramebuffer(",uw,",null);"),Ke&&R(re,".drawBuffersWEBGL(",z,");"),R("}",Q,".cur=",ne,";"),ie||R("}")}function Jr(j,R,Z){var ie=j.shared,se=ie.gl,ee=j.current,Q=j.next,re=ie.current,U=ie.next,q=j.cond(re,".dirty");Ae.forEach(function(z){var ne=Xe(z);if(!(ne in Z.state)){var ue,be;if(ne in Q){ue=Q[ne],be=ee[ne];var Ee=un(Me[ne].length,function(Re){return q.def(ue,"[",Re,"]")});q(j.cond(Ee.map(function(Re,ft){return Re+"!=="+be+"["+ft+"]"}).join("||")).then(se,".",Ce[ne],"(",Ee,");",Ee.map(function(Re,ft){return be+"["+ft+"]="+Re}).join(";"),";"))}else{ue=q.def(U,".",ne);var ge=j.cond(ue,"!==",re,".",ne);q(ge),ne in Ue?ge(j.cond(ue).then(se,".enable(",Ue[ne],");").else(se,".disable(",Ue[ne],");"),re,".",ne,"=",ue,";"):ge(se,".",Ce[ne],"(",ue,");",re,".",ne,"=",ue,";")}}}),Object.keys(Z.state).length===0&&q(re,".dirty=false;"),R(q)}function ln(j,R,Z,ie){var se=j.shared,ee=j.current,Q=se.current,re=se.gl;cw(Object.keys(Z)).forEach(function(U){var q=Z[U];if(!(ie&&!ie(q))){var z=q.append(j,R);if(Ue[U]){var ne=Ue[U];ro(q)?z?R(re,".enable(",ne,");"):R(re,".disable(",ne,");"):R(j.cond(z).then(re,".enable(",ne,");").else(re,".disable(",ne,");")),R(Q,".",U,"=",z,";")}else if(kr(z)){var ue=ee[U];R(re,".",Ce[U],"(",z,");",z.map(function(be,Ee){return ue+"["+Ee+"]="+be}).join(";"),";")}else R(re,".",Ce[U],"(",z,");",Q,".",U,"=",z,";")}})}function Lr(j,R){Be&&(j.instancing=R.def(j.shared.extensions,".angle_instanced_arrays"))}function Ot(j,R,Z,ie,se){var ee=j.shared,Q=j.stats,re=ee.current,U=ee.timer,q=Z.profile;function z(){return typeof performance>"u"?"Date.now()":"performance.now()"}var ne,ue;function be(st){ne=R.def(),st(ne,"=",z(),";"),typeof se=="string"?st(Q,".count+=",se,";"):st(Q,".count++;"),ke&&(ie?(ue=R.def(),st(ue,"=",U,".getNumPendingQueries();")):st(U,".beginQuery(",Q,");"))}function Ee(st){st(Q,".cpuTime+=",z(),"-",ne,";"),ke&&(ie?st(U,".pushScopeStats(",ue,",",U,".getNumPendingQueries(),",Q,");"):st(U,".endQuery();"))}function ge(st){var xt=R.def(re,".profile");R(re,".profile=",st,";"),R.exit(re,".profile=",xt,";")}var Re;if(q){if(ro(q)){q.enable?(be(R),Ee(R.exit),ge("true")):ge("false");return}Re=q.append(j,R),ge(Re)}else Re=R.def(re,".profile");var ft=j.block();be(ft),R("if(",Re,"){",ft,"}");var Dt=j.block();Ee(Dt),R.exit("if(",Re,"){",Dt,"}")}function cn(j,R,Z,ie,se){var ee=j.shared;function Q(U){switch(U){case Fc:case $c:case Xc:return 2;case Gc:case jc:case Yc:return 3;case zc:case Uc:case Wc:return 4;default:return 1}}function re(U,q,z){var ne=ee.gl,ue=R.def(U,".location"),be=R.def(ee.attributes,"[",ue,"]"),Ee=z.state,ge=z.buffer,Re=[z.x,z.y,z.z,z.w],ft=["buffer","normalized","offset","stride"];function Dt(){R("if(!",be,".buffer){",ne,".enableVertexAttribArray(",ue,");}");var xt=z.type,Lt;if(z.size?Lt=R.def(z.size,"||",q):Lt=q,R("if(",be,".type!==",xt,"||",be,".size!==",Lt,"||",ft.map(function(Cr){return be+"."+Cr+"!=="+z[Cr]}).join("||"),"){",ne,".bindBuffer(",Js,",",ge,".buffer);",ne,".vertexAttribPointer(",[ue,Lt,xt,z.normalized,z.stride,z.offset],");",be,".type=",xt,";",be,".size=",Lt,";",ft.map(function(Cr){return be+"."+Cr+"="+z[Cr]+";"}).join(""),"}"),Be){var tr=z.divisor;R("if(",be,".divisor!==",tr,"){",j.instancing,".vertexAttribDivisorANGLE(",[ue,tr],");",be,".divisor=",tr,";}")}}function st(){R("if(",be,".buffer){",ne,".disableVertexAttribArray(",ue,");",be,".buffer=null;","}if(",qs.map(function(xt,Lt){return be+"."+xt+"!=="+Re[Lt]}).join("||"),"){",ne,".vertexAttrib4f(",ue,",",Re,");",qs.map(function(xt,Lt){return be+"."+xt+"="+Re[Lt]+";"}).join(""),"}")}Ee===Zs?Dt():Ee===Up?st():(R("if(",Ee,"===",Zs,"){"),Dt(),R("}else{"),st(),R("}"))}ie.forEach(function(U){var q=U.name,z=Z.attributes[q],ne;if(z){if(!se(z))return;ne=z.append(j,R)}else{if(!se(hw))return;var ue=j.scopeAttrib(q);L.optional(function(){j.assert(R,ue+".state","missing attribute "+q)}),ne={},Object.keys(new oe).forEach(function(be){ne[be]=R.def(ue,".",be)})}re(j.link(U),Q(U.info.type),ne)})}function sr(j,R,Z,ie,se){for(var ee=j.shared,Q=ee.gl,re,U=0;U<ie.length;++U){var q=ie[U],z=q.name,ne=q.info.type,ue=Z.uniforms[z],be=j.link(q),Ee=be+".location",ge;if(ue){if(!se(ue))continue;if(ro(ue)){var Re=ue.value;if(L.command(Re!==null&&typeof Re<"u",'missing uniform "'+z+'"',j.commandStr),ne===Ef||ne===_f){L.command(typeof Re=="function"&&(ne===Ef&&(Re._reglType==="texture2d"||Re._reglType==="framebuffer")||ne===_f&&(Re._reglType==="textureCube"||Re._reglType==="framebufferCube")),"invalid texture for uniform "+z,j.commandStr);var ft=j.link(Re._texture||Re.color[0]._texture);R(Q,".uniform1i(",Ee,",",ft+".bind());"),R.exit(ft,".unbind();")}else if(ne===bf||ne===xf||ne===wf){L.optional(function(){L.command(kr(Re),"invalid matrix for uniform "+z,j.commandStr),L.command(ne===bf&&Re.length===4||ne===xf&&Re.length===9||ne===wf&&Re.length===16,"invalid length for matrix uniform "+z,j.commandStr)});var Dt=j.global.def("new Float32Array(["+Array.prototype.slice.call(Re)+"])"),st=2;ne===xf?st=3:ne===wf&&(st=4),R(Q,".uniformMatrix",st,"fv(",Ee,",false,",Dt,");")}else{switch(ne){case ag:L.commandType(Re,"number","uniform "+z,j.commandStr),re="1f";break;case Fc:L.command(kr(Re)&&Re.length===2,"uniform "+z,j.commandStr),re="2f";break;case Gc:L.command(kr(Re)&&Re.length===3,"uniform "+z,j.commandStr),re="3f";break;case zc:L.command(kr(Re)&&Re.length===4,"uniform "+z,j.commandStr),re="4f";break;case sg:L.commandType(Re,"boolean","uniform "+z,j.commandStr),re="1i";break;case og:L.commandType(Re,"number","uniform "+z,j.commandStr),re="1i";break;case Xc:L.command(kr(Re)&&Re.length===2,"uniform "+z,j.commandStr),re="2i";break;case $c:L.command(kr(Re)&&Re.length===2,"uniform "+z,j.commandStr),re="2i";break;case Yc:L.command(kr(Re)&&Re.length===3,"uniform "+z,j.commandStr),re="3i";break;case jc:L.command(kr(Re)&&Re.length===3,"uniform "+z,j.commandStr),re="3i";break;case Wc:L.command(kr(Re)&&Re.length===4,"uniform "+z,j.commandStr),re="4i";break;case Uc:L.command(kr(Re)&&Re.length===4,"uniform "+z,j.commandStr),re="4i";break}R(Q,".uniform",re,"(",Ee,",",kr(Re)?Array.prototype.slice.call(Re):Re,");")}continue}else ge=ue.append(j,R)}else{if(!se(hw))continue;ge=R.def(ee.uniforms,"[",G.id(z),"]")}ne===Ef?(L(!Array.isArray(ge),"must specify a scalar prop for textures"),R("if(",ge,"&&",ge,'._reglType==="framebuffer"){',ge,"=",ge,".color[0];","}")):ne===_f&&(L(!Array.isArray(ge),"must specify a scalar prop for cube maps"),R("if(",ge,"&&",ge,'._reglType==="framebufferCube"){',ge,"=",ge,".color[0];","}")),L.optional(function(){function kn(Si,bw){j.assert(R,Si,'bad data or missing for uniform "'+z+'". '+bw)}function lg(Si){L(!Array.isArray(ge),"must not specify an array type for uniform"),kn("typeof "+ge+'==="'+Si+'"',"invalid type, expected "+Si)}function ii(Si,bw){Array.isArray(ge)?L(ge.length===Si,"must have length "+Si):kn(ee.isArrayLike+"("+ge+")&&"+ge+".length==="+Si,"invalid vector, should have length "+Si,j.commandStr)}function mw(Si){L(!Array.isArray(ge),"must not specify a value type"),kn("typeof "+ge+'==="function"&&'+ge+'._reglType==="texture'+(Si===rw?"2d":"Cube")+'"',"invalid texture type",j.commandStr)}switch(ne){case og:lg("number");break;case $c:ii(2);break;case jc:ii(3);break;case Uc:ii(4);break;case ag:lg("number");break;case Fc:ii(2);break;case Gc:ii(3);break;case zc:ii(4);break;case sg:lg("boolean");break;case Xc:ii(2);break;case Yc:ii(3);break;case Wc:ii(4);break;case bf:ii(4);break;case xf:ii(9);break;case wf:ii(16);break;case Ef:mw(rw);break;case _f:mw(Q3);break}});var xt=1;switch(ne){case Ef:case _f:var Lt=R.def(ge,"._texture");R(Q,".uniform1i(",Ee,",",Lt,".bind());"),R.exit(Lt,".unbind();");continue;case og:case sg:re="1i";break;case $c:case Xc:re="2i",xt=2;break;case jc:case Yc:re="3i",xt=3;break;case Uc:case Wc:re="4i",xt=4;break;case ag:re="1f";break;case Fc:re="2f",xt=2;break;case Gc:re="3f",xt=3;break;case zc:re="4f",xt=4;break;case bf:re="Matrix2fv";break;case xf:re="Matrix3fv";break;case wf:re="Matrix4fv";break}if(R(Q,".uniform",re,"(",Ee,","),re.charAt(0)==="M"){var tr=Math.pow(ne-bf+2,2),Cr=j.global.def("new Float32Array(",tr,")");Array.isArray(ge)?R("false,(",un(tr,function(kn){return Cr+"["+kn+"]="+ge[kn]}),",",Cr,")"):R("false,(Array.isArray(",ge,")||",ge," instanceof Float32Array)?",ge,":(",un(tr,function(kn){return Cr+"["+kn+"]="+ge+"["+kn+"]"}),",",Cr,")")}else xt>1?R(un(xt,function(kn){return Array.isArray(ge)?ge[kn]:ge+"["+kn+"]"})):(L(!Array.isArray(ge),"uniform value must not be an array"),R(ge));R(");")}}function mt(j,R,Z,ie){var se=j.shared,ee=se.gl,Q=se.draw,re=ie.draw;function U(){var Lt=re.elements,tr,Cr=R;return Lt?((Lt.contextDep&&ie.contextDynamic||Lt.propDep)&&(Cr=Z),tr=Lt.append(j,Cr)):tr=Cr.def(Q,".",Zo),tr&&Cr("if("+tr+")"+ee+".bindBuffer("+q3+","+tr+".buffer.buffer);"),tr}function q(){var Lt=re.count,tr,Cr=R;return Lt?((Lt.contextDep&&ie.contextDynamic||Lt.propDep)&&(Cr=Z),tr=Lt.append(j,Cr),L.optional(function(){Lt.MISSING&&j.assert(R,"false","missing vertex count"),Lt.DYNAMIC&&j.assert(Cr,tr+">=0","missing vertex count")})):(tr=Cr.def(Q,".",Qo),L.optional(function(){j.assert(Cr,tr+">=0","missing vertex count")})),tr}var z=U();function ne(Lt){var tr=re[Lt];return tr?tr.contextDep&&ie.contextDynamic||tr.propDep?tr.append(j,Z):tr.append(j,R):R.def(Q,".",Lt)}var ue=ne(Ko),be=ne(Rc),Ee=q();if(typeof Ee=="number"){if(Ee===0)return}else Z("if(",Ee,"){"),Z.exit("}");var ge,Re;Be&&(ge=ne(Bc),Re=j.instancing);var ft=z+".type",Dt=re.elements&&ro(re.elements);function st(){function Lt(){Z(Re,".drawElementsInstancedANGLE(",[ue,Ee,ft,be+"<<(("+ft+"-"+Px+")>>1)",ge],");")}function tr(){Z(Re,".drawArraysInstancedANGLE(",[ue,be,Ee,ge],");")}z?Dt?Lt():(Z("if(",z,"){"),Lt(),Z("}else{"),tr(),Z("}")):tr()}function xt(){function Lt(){Z(ee+".drawElements("+[ue,Ee,ft,be+"<<(("+ft+"-"+Px+")>>1)"]+");")}function tr(){Z(ee+".drawArrays("+[ue,be,Ee]+");")}z?Dt?Lt():(Z("if(",z,"){"),Lt(),Z("}else{"),tr(),Z("}")):tr()}Be&&(typeof ge!="number"||ge>=0)?typeof ge=="string"?(Z("if(",ge,">0){"),st(),Z("}else if(",ge,"<0){"),xt(),Z("}")):st():xt()}function $t(j,R,Z,ie,se){var ee=Ct(),Q=ee.proc("body",se);return L.optional(function(){ee.commandStr=R.commandStr,ee.command=ee.link(R.commandStr)}),Be&&(ee.instancing=Q.def(ee.shared.extensions,".angle_instanced_arrays")),j(ee,Q,Z,ie),ee.compile().body}function Zt(j,R,Z,ie){Lr(j,R),Z.useVAO?Z.drawVAO?R(j.shared.vao,".setVAO(",Z.drawVAO.append(j,R),");"):R(j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"):(R(j.shared.vao,".setVAO(null);"),cn(j,R,Z,ie.attributes,function(){return!0})),sr(j,R,Z,ie.uniforms,function(){return!0}),mt(j,R,R,Z)}function Nr(j,R){var Z=j.proc("draw",1);Lr(j,Z),Xr(j,Z,R.context),Yr(j,Z,R.framebuffer),Jr(j,Z,R),ln(j,Z,R.state),Ot(j,Z,R,!1,!0);var ie=R.shader.progVar.append(j,Z);if(Z(j.shared.gl,".useProgram(",ie,".program);"),R.shader.program)Zt(j,Z,R,R.shader.program);else{Z(j.shared.vao,".setVAO(null);");var se=j.global.def("{}"),ee=Z.def(ie,".id"),Q=Z.def(se,"[",ee,"]");Z(j.cond(Q).then(Q,".call(this,a0);").else(Q,"=",se,"[",ee,"]=",j.link(function(re){return $t(Zt,j,R,re,1)}),"(",ie,");",Q,".call(this,a0);"))}Object.keys(R.state).length>0&&Z(j.shared.current,".dirty=true;")}function Ui(j,R,Z,ie){j.batchId="a1",Lr(j,R);function se(){return!0}cn(j,R,Z,ie.attributes,se),sr(j,R,Z,ie.uniforms,se),mt(j,R,R,Z)}function es(j,R,Z,ie){Lr(j,R);var se=Z.contextDep,ee=R.def(),Q="a0",re="a1",U=R.def();j.shared.props=U,j.batchId=ee;var q=j.scope(),z=j.scope();R(q.entry,"for(",ee,"=0;",ee,"<",re,";++",ee,"){",U,"=",Q,"[",ee,"];",z,"}",q.exit);function ne(ft){return ft.contextDep&&se||ft.propDep}function ue(ft){return!ne(ft)}if(Z.needsContext&&Xr(j,z,Z.context),Z.needsFramebuffer&&Yr(j,z,Z.framebuffer),ln(j,z,Z.state,ne),Z.profile&&ne(Z.profile)&&Ot(j,z,Z,!1,!0),ie)Z.useVAO?Z.drawVAO?ne(Z.drawVAO)?z(j.shared.vao,".setVAO(",Z.drawVAO.append(j,z),");"):q(j.shared.vao,".setVAO(",Z.drawVAO.append(j,q),");"):q(j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"):(q(j.shared.vao,".setVAO(null);"),cn(j,q,Z,ie.attributes,ue),cn(j,z,Z,ie.attributes,ne)),sr(j,q,Z,ie.uniforms,ue),sr(j,z,Z,ie.uniforms,ne),mt(j,q,z,Z);else{var be=j.global.def("{}"),Ee=Z.shader.progVar.append(j,z),ge=z.def(Ee,".id"),Re=z.def(be,"[",ge,"]");z(j.shared.gl,".useProgram(",Ee,".program);","if(!",Re,"){",Re,"=",be,"[",ge,"]=",j.link(function(ft){return $t(Ui,j,Z,ft,2)}),"(",Ee,");}",Re,".call(this,a0[",ee,"],",ee,");")}}function X(j,R){var Z=j.proc("batch",2);j.batchId="0",Lr(j,Z);var ie=!1,se=!0;Object.keys(R.context).forEach(function(be){ie=ie||R.context[be].propDep}),ie||(Xr(j,Z,R.context),se=!1);var ee=R.framebuffer,Q=!1;ee?(ee.propDep?ie=Q=!0:ee.contextDep&&ie&&(Q=!0),Q||Yr(j,Z,ee)):Yr(j,Z,null),R.state.viewport&&R.state.viewport.propDep&&(ie=!0);function re(be){return be.contextDep&&ie||be.propDep}Jr(j,Z,R),ln(j,Z,R.state,function(be){return!re(be)}),(!R.profile||!re(R.profile))&&Ot(j,Z,R,!1,"a1"),R.contextDep=ie,R.needsContext=se,R.needsFramebuffer=Q;var U=R.shader.progVar;if(U.contextDep&&ie||U.propDep)es(j,Z,R,null);else{var q=U.append(j,Z);if(Z(j.shared.gl,".useProgram(",q,".program);"),R.shader.program)es(j,Z,R,R.shader.program);else{Z(j.shared.vao,".setVAO(null);");var z=j.global.def("{}"),ne=Z.def(q,".id"),ue=Z.def(z,"[",ne,"]");Z(j.cond(ue).then(ue,".call(this,a0,a1);").else(ue,"=",z,"[",ne,"]=",j.link(function(be){return $t(es,j,R,be,2)}),"(",q,");",ue,".call(this,a0,a1);"))}}Object.keys(R.state).length>0&&Z(j.shared.current,".dirty=true;")}function he(j,R){var Z=j.proc("scope",3);j.batchId="a2";var ie=j.shared,se=ie.current;Xr(j,Z,R.context),R.framebuffer&&R.framebuffer.append(j,Z),cw(Object.keys(R.state)).forEach(function(Q){var re=R.state[Q],U=re.append(j,Z);kr(U)?U.forEach(function(q,z){Z.set(j.next[Q],"["+z+"]",q)}):Z.set(ie.next,"."+Q,U)}),Ot(j,Z,R,!0,!0),[Zo,Rc,Qo,Bc,Ko].forEach(function(Q){var re=R.draw[Q];re&&Z.set(ie.draw,"."+Q,""+re.append(j,Z))}),Object.keys(R.uniforms).forEach(function(Q){var re=R.uniforms[Q].append(j,Z);Array.isArray(re)&&(re="["+re.join()+"]"),Z.set(ie.uniforms,"["+G.id(Q)+"]",re)}),Object.keys(R.attributes).forEach(function(Q){var re=R.attributes[Q].append(j,Z),U=j.scopeAttrib(Q);Object.keys(new oe).forEach(function(q){Z.set(U,"."+q,re[q])})}),R.scopeVAO&&Z.set(ie.vao,".targetVAO",R.scopeVAO.append(j,Z));function ee(Q){var re=R.shader[Q];re&&Z.set(ie.shader,"."+Q,re.append(j,Z))}ee(gf),ee(yf),Object.keys(R.state).length>0&&(Z(se,".dirty=true;"),Z.exit(se,".dirty=true;")),Z("a1(",j.shared.context,",a0,",j.batchId,");")}function fe(j){if(!(typeof j!="object"||kr(j))){for(var R=Object.keys(j),Z=0;Z<R.length;++Z)if(hr.isDynamic(j[R[Z]]))return!0;return!1}}function it(j,R,Z){var ie=R.static[Z];if(!ie||!fe(ie))return;var se=j.global,ee=Object.keys(ie),Q=!1,re=!1,U=!1,q=j.global.def("{}");ee.forEach(function(ne){var ue=ie[ne];if(hr.isDynamic(ue)){typeof ue=="function"&&(ue=ie[ne]=hr.unbox(ue));var be=On(ue,null);Q=Q||be.thisDep,U=U||be.propDep,re=re||be.contextDep}else{switch(se(q,".",ne,"="),typeof ue){case"number":se(ue);break;case"string":se('"',ue,'"');break;case"object":Array.isArray(ue)&&se("[",ue.join(),"]");break;default:se(j.link(ue));break}se(";")}});function z(ne,ue){ee.forEach(function(be){var Ee=ie[be];if(hr.isDynamic(Ee)){var ge=ne.invoke(ue,Ee);ue(q,".",be,"=",ge,";")}})}R.dynamic[Z]=new hr.DynamicVariable(Dc,{thisDep:Q,contextDep:re,propDep:U,ref:q,append:z}),delete R.static[Z]}function zt(j,R,Z,ie,se){var ee=Ct();ee.stats=ee.link(se),Object.keys(R.static).forEach(function(re){it(ee,R,re)}),H3.forEach(function(re){it(ee,j,re)});var Q=Rr(j,R,Z,ie,ee);return Nr(ee,Q),he(ee,Q),X(ee,Q),n(ee.compile(),{destroy:function(){Q.shader.program.destroy()}})}return{next:rt,current:Me,procs:function(){var j=Ct(),R=j.proc("poll"),Z=j.proc("refresh"),ie=j.block();R(ie),Z(ie);var se=j.shared,ee=se.gl,Q=se.next,re=se.current;ie(re,".dirty=false;"),Yr(j,R),Yr(j,Z,null,!0);var U;Be&&(U=j.link(Be)),V.oes_vertex_array_object&&Z(j.link(V.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var q=0;q<ce.maxAttributes;++q){var z=Z.def(se.attributes,"[",q,"]"),ne=j.cond(z,".buffer");ne.then(ee,".enableVertexAttribArray(",q,");",ee,".bindBuffer(",Js,",",z,".buffer.buffer);",ee,".vertexAttribPointer(",q,",",z,".size,",z,".type,",z,".normalized,",z,".stride,",z,".offset);").else(ee,".disableVertexAttribArray(",q,");",ee,".vertexAttrib4f(",q,",",z,".x,",z,".y,",z,".z,",z,".w);",z,".buffer=null;"),Z(ne),Be&&Z(U,".vertexAttribDivisorANGLE(",q,",",z,".divisor);")}return Z(j.shared.vao,".currentVAO=null;",j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"),Object.keys(Ue).forEach(function(ue){var be=Ue[ue],Ee=ie.def(Q,".",ue),ge=j.block();ge("if(",Ee,"){",ee,".enable(",be,")}else{",ee,".disable(",be,")}",re,".",ue,"=",Ee,";"),Z(ge),R("if(",Ee,"!==",re,".",ue,"){",ge,"}")}),Object.keys(Ce).forEach(function(ue){var be=Ce[ue],Ee=Me[ue],ge,Re,ft=j.block();if(ft(ee,".",be,"("),kr(Ee)){var Dt=Ee.length;ge=j.global.def(Q,".",ue),Re=j.global.def(re,".",ue),ft(un(Dt,function(st){return ge+"["+st+"]"}),");",un(Dt,function(st){return Re+"["+st+"]="+ge+"["+st+"];"}).join("")),R("if(",un(Dt,function(st){return ge+"["+st+"]!=="+Re+"["+st+"]"}).join("||"),"){",ft,"}")}else ge=ie.def(Q,".",ue),Re=ie.def(re,".",ue),ft(ge,");",re,".",ue,"=",ge,";"),R("if(",ge,"!==",Re,"){",ft,"}");Z(ft)}),j.compile()}(),compile:zt}}function v5(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var p5=34918,g5=34919,dw=35007,y5=function(I,G){if(!G.ext_disjoint_timer_query)return null;var V=[];function ce(){return V.pop()||G.ext_disjoint_timer_query.createQueryEXT()}function we(Be){V.push(Be)}var le=[];function de(Be){var Ke=ce();G.ext_disjoint_timer_query.beginQueryEXT(dw,Ke),le.push(Ke),ke(le.length-1,le.length,Be)}function Ie(){G.ext_disjoint_timer_query.endQueryEXT(dw)}function Oe(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var Fe=[];function De(){return Fe.pop()||new Oe}function $e(Be){Fe.push(Be)}var Ve=[];function ke(Be,Ke,Me){var rt=De();rt.startQueryIndex=Be,rt.endQueryIndex=Ke,rt.sum=0,rt.stats=Me,Ve.push(rt)}var je=[],oe=[];function ve(){var Be,Ke,Me=le.length;if(Me!==0){oe.length=Math.max(oe.length,Me+1),je.length=Math.max(je.length,Me+1),je[0]=0,oe[0]=0;var rt=0;for(Be=0,Ke=0;Ke<le.length;++Ke){var Ae=le[Ke];G.ext_disjoint_timer_query.getQueryObjectEXT(Ae,g5)?(rt+=G.ext_disjoint_timer_query.getQueryObjectEXT(Ae,p5),we(Ae)):le[Be++]=Ae,je[Ke+1]=rt,oe[Ke+1]=Be}for(le.length=Be,Be=0,Ke=0;Ke<Ve.length;++Ke){var Ue=Ve[Ke],Ce=Ue.startQueryIndex,Xe=Ue.endQueryIndex;Ue.sum+=je[Xe]-je[Ce];var vt=oe[Ce],Tt=oe[Xe];Tt===vt?(Ue.stats.gpuTime+=Ue.sum/1e6,$e(Ue)):(Ue.startQueryIndex=vt,Ue.endQueryIndex=Tt,Ve[Be++]=Ue)}Ve.length=Be}}return{beginQuery:de,endQuery:Ie,pushScopeStats:ke,update:ve,getNumPendingQueries:function(){return le.length},clear:function(){V.push.apply(V,le);for(var Be=0;Be<V.length;Be++)G.ext_disjoint_timer_query.deleteQueryEXT(V[Be]);le.length=0,V.length=0},restore:function(){le.length=0,V.length=0}}},m5=16384,b5=256,x5=1024,w5=34962,vw="webglcontextlost",pw="webglcontextrestored",gw=1,E5=2,_5=3;function yw(I,G){for(var V=0;V<I.length;++V)if(I[V]===G)return V;return-1}function S5(I){var G=rf(I);if(!G)return null;var V=G.gl,ce=V.getContextAttributes(),we=V.isContextLost(),le=nf(V,G);if(!le)return null;var de=vr(),Ie=v5(),Oe=le.extensions,Fe=y5(V,Oe),De=br(),$e=V.drawingBufferWidth,Ve=V.drawingBufferHeight,ke={tick:0,time:0,viewportWidth:$e,viewportHeight:Ve,framebufferWidth:$e,framebufferHeight:Ve,drawingBufferWidth:$e,drawingBufferHeight:Ve,pixelRatio:G.pixelRatio},je={},oe={elements:null,primitive:4,count:-1,offset:0,instances:-1},ve=fP(V,Oe),Be=MP(V,Ie,G,Me),Ke=B3(V,Oe,ve,Ie,Be);function Me(mt){return Ke.destroyBuffer(mt)}var rt=BP(V,Oe,Be,Ie),Ae=$3(V,de,Ie,G),Ue=v3(V,Oe,ve,function(){vt.procs.poll()},ke,Ie,G),Ce=p3(V,Oe,ve,Ie,G),Xe=P3(V,Oe,ve,Ue,Ce,Ie),vt=d5(V,de,Oe,ve,Be,rt,Ue,Xe,je,Ke,Ae,oe,ke,Fe,G),Tt=X3(V,Xe,vt.procs.poll,ke,ce,Oe,ve),He=vt.next,ze=V.canvas,_e=[],Ct=[],Nt=[],ot=[G.onDestroy],Gt=null;function It(){if(_e.length===0){Fe&&Fe.update(),Gt=null;return}Gt=ur.next(It),ln();for(var mt=_e.length-1;mt>=0;--mt){var $t=_e[mt];$t&&$t(ke,null,0)}V.flush(),Fe&&Fe.update()}function Bt(){!Gt&&_e.length>0&&(Gt=ur.next(It))}function er(){Gt&&(ur.cancel(It),Gt=null)}function Pr(mt){mt.preventDefault(),we=!0,er(),Ct.forEach(function($t){$t()})}function Zr(mt){V.getError(),we=!1,le.restore(),Ae.restore(),Be.restore(),Ue.restore(),Ce.restore(),Xe.restore(),Ke.restore(),Fe&&Fe.restore(),vt.procs.refresh(),Bt(),Nt.forEach(function($t){$t()})}ze&&(ze.addEventListener(vw,Pr,!1),ze.addEventListener(pw,Zr,!1));function Ut(){_e.length=0,er(),ze&&(ze.removeEventListener(vw,Pr),ze.removeEventListener(pw,Zr)),Ae.clear(),Xe.clear(),Ce.clear(),Ue.clear(),rt.clear(),Be.clear(),Ke.clear(),Fe&&Fe.clear(),ot.forEach(function(mt){mt()})}function Ur(mt){L(!!mt,"invalid args to regl({...})"),L.type(mt,"object","invalid args to regl({...})");function $t(se){var ee=n({},se);delete ee.uniforms,delete ee.attributes,delete ee.context,delete ee.vao,"stencil"in ee&&ee.stencil.op&&(ee.stencil.opBack=ee.stencil.opFront=ee.stencil.op,delete ee.stencil.op);function Q(re){if(re in ee){var U=ee[re];delete ee[re],Object.keys(U).forEach(function(q){ee[re+"."+q]=U[q]})}}return Q("blend"),Q("depth"),Q("cull"),Q("stencil"),Q("polygonOffset"),Q("scissor"),Q("sample"),"vao"in se&&(ee.vao=se.vao),ee}function Zt(se,ee){var Q={},re={};return Object.keys(se).forEach(function(U){var q=se[U];if(hr.isDynamic(q)){re[U]=hr.unbox(q,U);return}else if(ee&&Array.isArray(q)){for(var z=0;z<q.length;++z)if(hr.isDynamic(q[z])){re[U]=hr.unbox(q,U);return}}Q[U]=q}),{dynamic:re,static:Q}}var Nr=Zt(mt.context||{},!0),Ui=Zt(mt.uniforms||{},!0),es=Zt(mt.attributes||{},!1),X=Zt($t(mt),!1),he={gpuTime:0,cpuTime:0,count:0},fe=vt.compile(X,es,Ui,Nr,he),it=fe.draw,zt=fe.batch,j=fe.scope,R=[];function Z(se){for(;R.length<se;)R.push(null);return R}function ie(se,ee){var Q;if(we&&L.raise("context lost"),typeof se=="function")return j.call(this,null,se,0);if(typeof ee=="function")if(typeof se=="number")for(Q=0;Q<se;++Q)j.call(this,null,ee,Q);else if(Array.isArray(se))for(Q=0;Q<se.length;++Q)j.call(this,se[Q],ee,Q);else return j.call(this,se,ee,0);else if(typeof se=="number"){if(se>0)return zt.call(this,Z(se|0),se|0)}else if(Array.isArray(se)){if(se.length)return zt.call(this,se,se.length)}else return it.call(this,se)}return n(ie,{stats:he,destroy:function(){fe.destroy()}})}var gr=Xe.setFBO=Ur({framebuffer:hr.define.call(null,gw,"framebuffer")});function Rr(mt,$t){var Zt=0;vt.procs.poll();var Nr=$t.color;Nr&&(V.clearColor(+Nr[0]||0,+Nr[1]||0,+Nr[2]||0,+Nr[3]||0),Zt|=m5),"depth"in $t&&(V.clearDepth(+$t.depth),Zt|=b5),"stencil"in $t&&(V.clearStencil($t.stencil|0),Zt|=x5),L(!!Zt,"called regl.clear with no buffer specified"),V.clear(Zt)}function Xr(mt){if(L(typeof mt=="object"&&mt,"regl.clear() takes an object as input"),"framebuffer"in mt)if(mt.framebuffer&&mt.framebuffer_reglType==="framebufferCube")for(var $t=0;$t<6;++$t)gr(n({framebuffer:mt.framebuffer.faces[$t]},mt),Rr);else gr(mt,Rr);else Rr(null,mt)}function Yr(mt){L.type(mt,"function","regl.frame() callback must be a function"),_e.push(mt);function $t(){var Zt=yw(_e,mt);L(Zt>=0,"cannot cancel a frame twice");function Nr(){var Ui=yw(_e,Nr);_e[Ui]=_e[_e.length-1],_e.length-=1,_e.length<=0&&er()}_e[Zt]=Nr}return Bt(),{cancel:$t}}function Jr(){var mt=He.viewport,$t=He.scissor_box;mt[0]=mt[1]=$t[0]=$t[1]=0,ke.viewportWidth=ke.framebufferWidth=ke.drawingBufferWidth=mt[2]=$t[2]=V.drawingBufferWidth,ke.viewportHeight=ke.framebufferHeight=ke.drawingBufferHeight=mt[3]=$t[3]=V.drawingBufferHeight}function ln(){ke.tick+=1,ke.time=Ot(),Jr(),vt.procs.poll()}function Lr(){Ue.refresh(),Jr(),vt.procs.refresh(),Fe&&Fe.update()}function Ot(){return(br()-De)/1e3}Lr();function cn(mt,$t){L.type($t,"function","listener callback must be a function");var Zt;switch(mt){case"frame":return Yr($t);case"lost":Zt=Ct;break;case"restore":Zt=Nt;break;case"destroy":Zt=ot;break;default:L.raise("invalid event, must be one of frame,lost,restore,destroy")}return Zt.push($t),{cancel:function(){for(var Nr=0;Nr<Zt.length;++Nr)if(Zt[Nr]===$t){Zt[Nr]=Zt[Zt.length-1],Zt.pop();return}}}}var sr=n(Ur,{clear:Xr,prop:hr.define.bind(null,gw),context:hr.define.bind(null,E5),this:hr.define.bind(null,_5),draw:Ur({}),buffer:function(mt){return Be.create(mt,w5,!1,!1)},elements:function(mt){return rt.create(mt,!1)},texture:Ue.create2D,cube:Ue.createCube,renderbuffer:Ce.create,framebuffer:Xe.create,framebufferCube:Xe.createCube,vao:Ke.createVAO,attributes:ce,frame:Yr,on:cn,limits:ve,hasExtension:function(mt){return ve.extensions.indexOf(mt.toLowerCase())>=0},read:Tt,destroy:Ut,_gl:V,_refresh:Lr,poll:function(){ln(),Fe&&Fe.update()},now:Ot,stats:Ie});return G.onDone(null,sr),sr}return S5})})(PO);var hue=PO.exports;const due=pa(hue);var vue=function(){function r(e,t){Gi(this,r),this.attribute=void 0,this.buffer=void 0;var n=t.buffer,i=t.offset,a=t.stride,o=t.normalized,s=t.size,u=t.divisor;this.buffer=n,this.attribute={buffer:n.get(),offset:i||0,stride:a||0,normalized:o||!1,divisor:u||0},s&&(this.attribute.size=s)}return zi(r,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),r}(),Ta,Pf,Ia,si,Rf,oo,Bf,Nh,Wi,ns,wn,Vi,Hi,Oh,pue=(Ta={},Je(Ta,Le.POINTS,"points"),Je(Ta,Le.LINES,"lines"),Je(Ta,Le.LINE_LOOP,"line loop"),Je(Ta,Le.LINE_STRIP,"line strip"),Je(Ta,Le.TRIANGLES,"triangles"),Je(Ta,Le.TRIANGLE_FAN,"triangle fan"),Je(Ta,Le.TRIANGLE_STRIP,"triangle strip"),Ta),RO=(Pf={},Je(Pf,Le.STATIC_DRAW,"static"),Je(Pf,Le.DYNAMIC_DRAW,"dynamic"),Je(Pf,Le.STREAM_DRAW,"stream"),Pf),db=(Ia={},Je(Ia,Le.BYTE,"int8"),Je(Ia,Le.UNSIGNED_INT,"int16"),Je(Ia,Le.INT,"int32"),Je(Ia,Le.UNSIGNED_BYTE,"uint8"),Je(Ia,Le.UNSIGNED_SHORT,"uint16"),Je(Ia,Le.UNSIGNED_INT,"uint32"),Je(Ia,Le.FLOAT,"float"),Ia),gue=(si={},Je(si,Le.ALPHA,"alpha"),Je(si,Le.LUMINANCE,"luminance"),Je(si,Le.LUMINANCE_ALPHA,"luminance alpha"),Je(si,Le.RGB,"rgb"),Je(si,Le.RGBA,"rgba"),Je(si,Le.RGBA4,"rgba4"),Je(si,Le.RGB5_A1,"rgb5 a1"),Je(si,Le.RGB565,"rgb565"),Je(si,Le.DEPTH_COMPONENT,"depth"),Je(si,Le.DEPTH_STENCIL,"depth stencil"),si),yue=(Rf={},Je(Rf,Le.DONT_CARE,"dont care"),Je(Rf,Le.NICEST,"nice"),Je(Rf,Le.FASTEST,"fast"),Rf),BS=(oo={},Je(oo,Le.NEAREST,"nearest"),Je(oo,Le.LINEAR,"linear"),Je(oo,Le.LINEAR_MIPMAP_LINEAR,"mipmap"),Je(oo,Le.NEAREST_MIPMAP_LINEAR,"nearest mipmap linear"),Je(oo,Le.LINEAR_MIPMAP_NEAREST,"linear mipmap nearest"),Je(oo,Le.NEAREST_MIPMAP_NEAREST,"nearest mipmap nearest"),oo),FS=(Bf={},Je(Bf,Le.REPEAT,"repeat"),Je(Bf,Le.CLAMP_TO_EDGE,"clamp"),Je(Bf,Le.MIRRORED_REPEAT,"mirror"),Bf),mue=(Nh={},Je(Nh,Le.NONE,"none"),Je(Nh,Le.BROWSER_DEFAULT_WEBGL,"browser"),Nh),bue=(Wi={},Je(Wi,Le.NEVER,"never"),Je(Wi,Le.ALWAYS,"always"),Je(Wi,Le.LESS,"less"),Je(Wi,Le.LEQUAL,"lequal"),Je(Wi,Le.GREATER,"greater"),Je(Wi,Le.GEQUAL,"gequal"),Je(Wi,Le.EQUAL,"equal"),Je(Wi,Le.NOTEQUAL,"notequal"),Wi),GS=(ns={},Je(ns,Le.FUNC_ADD,"add"),Je(ns,Le.MIN_EXT,"min"),Je(ns,Le.MAX_EXT,"max"),Je(ns,Le.FUNC_SUBTRACT,"subtract"),Je(ns,Le.FUNC_REVERSE_SUBTRACT,"reverse subtract"),ns),Dh=(wn={},Je(wn,Le.ZERO,"zero"),Je(wn,Le.ONE,"one"),Je(wn,Le.SRC_COLOR,"src color"),Je(wn,Le.ONE_MINUS_SRC_COLOR,"one minus src color"),Je(wn,Le.SRC_ALPHA,"src alpha"),Je(wn,Le.ONE_MINUS_SRC_ALPHA,"one minus src alpha"),Je(wn,Le.DST_COLOR,"dst color"),Je(wn,Le.ONE_MINUS_DST_COLOR,"one minus dst color"),Je(wn,Le.DST_ALPHA,"dst alpha"),Je(wn,Le.ONE_MINUS_DST_ALPHA,"one minus dst alpha"),Je(wn,Le.CONSTANT_COLOR,"constant color"),Je(wn,Le.ONE_MINUS_CONSTANT_COLOR,"one minus constant color"),Je(wn,Le.CONSTANT_ALPHA,"constant alpha"),Je(wn,Le.ONE_MINUS_CONSTANT_ALPHA,"one minus constant alpha"),Je(wn,Le.SRC_ALPHA_SATURATE,"src alpha saturate"),wn),xue=(Vi={},Je(Vi,Le.NEVER,"never"),Je(Vi,Le.ALWAYS,"always"),Je(Vi,Le.LESS,"less"),Je(Vi,Le.LEQUAL,"lequal"),Je(Vi,Le.GREATER,"greater"),Je(Vi,Le.GEQUAL,"gequal"),Je(Vi,Le.EQUAL,"equal"),Je(Vi,Le.NOTEQUAL,"notequal"),Vi),uu=(Hi={},Je(Hi,Le.ZERO,"zero"),Je(Hi,Le.KEEP,"keep"),Je(Hi,Le.REPLACE,"replace"),Je(Hi,Le.INVERT,"invert"),Je(Hi,Le.INCR,"increment"),Je(Hi,Le.DECR,"decrement"),Je(Hi,Le.INCR_WRAP,"increment wrap"),Je(Hi,Le.DECR_WRAP,"decrement wrap"),Hi),wue=(Oh={},Je(Oh,Le.FRONT,"front"),Je(Oh,Le.BACK,"back"),Oh),Eue=function(){function r(e,t){Gi(this,r),this.buffer=void 0;var n=t.data,i=t.usage,a=t.type;this.buffer=e.buffer({data:n,usage:RO[i||Le.STATIC_DRAW],type:db[a||Le.UNSIGNED_BYTE]})}return zi(r,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){}},{key:"subData",value:function(t){var n=t.data,i=t.offset;this.buffer.subdata(n,i)}}]),r}();function Xy(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function _ue(r){if(Array.isArray(r))return Xy(r)}function Sue(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Mue(r,e){if(r){if(typeof r=="string")return Xy(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Xy(r,e):void 0}}function Cue(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
48
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Aue(r){return _ue(r)||Sue(r)||Mue(r)||Cue()}function zS(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function $S(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zS(Object(t),!0).forEach(function(n){Je(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):zS(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Tue=`attribute vec3 a_Position;
|
|
49
|
-
attribute vec2 a_TexCoord;
|
|
50
|
-
|
|
51
|
-
varying vec2 v_TexCoord;
|
|
52
|
-
|
|
53
|
-
void main() {
|
|
54
|
-
gl_Position = vec4(a_Position, 1.0);
|
|
55
|
-
v_TexCoord = a_TexCoord;
|
|
56
|
-
}`,jS=0,Iue=function(){function r(e,t){var n=this;Gi(this,r),this.reGl=e,this.context=t,this.entity=OO(),this.texFBO=void 0,this.computeCommand=void 0,this.textureCache={},this.outputTextureName=void 0,this.swapOutputTextureName=void 0,this.compiledPingpong=void 0,this.dynamicPingpong=void 0;var i={};this.context.uniforms.forEach(function(f){var l=f.name,c=f.type,h=f.data,d=f.isReferer,v=f.storageClass;if(v===qu.StorageBuffer){if(d)n.textureCache[l]={data:void 0},i["".concat(l,"Size")]=function(){return h.compiledBundle.context.output.textureSize};else{n.textureCache[l]=n.calcDataTexture(l,c,h);var p=n.textureCache[l],g=p.textureWidth,y=p.isOutput;i["".concat(l,"Size")]=[g,g],y&&(n.outputTextureName=l,n.context.needPingpong&&(n.outputTextureName="".concat(l,"Output"),n.textureCache[n.outputTextureName]=n.calcDataTexture(l,c,h)))}i[l]=function(){return n.textureCache[l].texture}}else if(v===qu.Uniform){if(h&&(Array.isArray(h)||iv(h))&&h.length>16)throw new Error("invalid data type ".concat(c));i[l]=function(){return f.data}}});var a=this.getOuputDataTexture(),o=a.textureWidth,s=a.texelCount;i.u_OutputTextureSize=[o,o],i.u_OutputTexelCount=s,this.context.output.textureSize=[o,o];var u={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
|
|
57
|
-
precision highp float;
|
|
58
|
-
#else
|
|
59
|
-
precision mediump float;
|
|
60
|
-
#endif
|
|
61
|
-
`.concat(this.context.shader),uniforms:i,vert:Tue,primitive:"triangle strip",count:4};this.computeCommand=this.reGl(u)}return zi(r,[{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:function(){var e=wo(Mn.mark(function n(){var i=this,a,o,s,u,f,l,c,h;return Mn.wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(this.reGl({framebuffer:this.texFBO})(function(){a=i.reGl.read()}),!a){v.next=6;break}if(o=this.getOuputDataTexture(),s=o.originalDataLength,u=o.elementsPerTexel,f=o.typedArrayConstructor,l=f===void 0?Float32Array:f,c=[],u!==4)for(h=0;h<a.length;h+=4)u===1?c.push(a[h]):u===2?c.push(a[h],a[h+1]):c.push(a[h],a[h+1],a[h+2]);else c=a;return v.abrupt("return",new l(c.slice(0,s)));case 6:return v.abrupt("return",new Float32Array);case 7:case"end":return v.stop()}},n,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"confirmInput",value:function(t,n){var i;this.entity===t.entity?(this.dynamicPingpong=!0,i=this):i=t,this.textureCache[n].id=i.getOuputDataTexture().id,this.textureCache[n].texture=i.getOuputDataTexture().texture}},{key:"updateUniform",value:function(){}},{key:"updateBuffer",value:function(t,n){var i=this.context.uniforms.find(function(u){var f=u.name;return f===t});if(i){var a=this.calcDataTexture(t,i.type,n),o=a.texture,s=a.data;this.textureCache[t].data=s,this.textureCache[t].texture=o}}},{key:"destroy",value:function(){}},{key:"swap",value:function(){if(this.swapOutputTextureName||this.createSwapOutputDataTexture(),this.compiledPingpong){var t=this.context.output.name;this.textureCache[t].id=this.getOuputDataTexture().id,this.textureCache[t].texture=this.getOuputDataTexture().texture}var n=this.outputTextureName;this.outputTextureName=this.swapOutputTextureName,this.swapOutputTextureName=n}},{key:"getOuputDataTexture",value:function(){return this.textureCache[this.outputTextureName]}},{key:"createSwapOutputDataTexture",value:function(){var t=this.cloneDataTexture(this.getOuputDataTexture());this.swapOutputTextureName="".concat(this.entity,"-swap"),this.textureCache[this.swapOutputTextureName]=t}},{key:"cloneDataTexture",value:function(t){var n=t.data,i=t.textureWidth;return $S($S({},t),{},{id:jS++,texture:this.reGl.texture({width:i,height:i,data:n,type:"float"})})}},{key:"calcDataTexture",value:function(t,n,i){var a=1;n===Bl.Vector4FloatArray&&(a=4);for(var o=[],s=0;s<i.length;s+=a)a===1?o.push(i[s],0,0,0):a===2?o.push(i[s],i[s+1],0,0):a===3?o.push(i[s],i[s+1],i[s+2],0):a===4&&o.push(i[s],i[s+1],i[s+2],i[s+3]);var u=i.length,f=Math.ceil(u/a),l=Math.ceil(Math.sqrt(f)),c=l*l;f<c&&o.push.apply(o,Aue(new Array((c-f)*4).fill(0)));var h=this.reGl.texture({width:l,height:l,data:o,type:"float"});return{id:jS++,data:o,originalDataLength:u,typedArrayConstructor:iv(i)?i.constructor:void 0,textureWidth:l,texture:h,texelCount:f,elementsPerTexel:a,isOutput:t===this.context.output.name}}}]),r}(),kue=function(){function r(e,t){Gi(this,r),this.elements=void 0;var n=t.data,i=t.usage,a=t.type,o=t.count;this.elements=e.elements({data:n,usage:RO[i||Le.STATIC_DRAW],type:db[a||Le.UNSIGNED_BYTE],count:o})}return zi(r,[{key:"get",value:function(){return this.elements}},{key:"subData",value:function(t){var n=t.data;this.elements.subdata(n)}},{key:"destroy",value:function(){this.elements.destroy()}}]),r}(),Lue=function(){function r(e,t){Gi(this,r),this.framebuffer=void 0;var n=t.width,i=t.height,a=t.color,o=t.colors;t.depth,t.stencil;var s={width:n,height:i};Array.isArray(o)&&(s.colors=o.map(function(u){return u.get()})),a&&typeof a!="boolean"&&(s.color=a.get()),this.framebuffer=e.framebuffer(s)}return zi(r,[{key:"get",value:function(){return this.framebuffer}},{key:"destroy",value:function(){this.framebuffer.destroy()}},{key:"resize",value:function(t){var n=t.width,i=t.height;this.framebuffer.resize(n,i)}}]),r}();function Nue(r,e){return function(t){return r(e(t))}}var Oue=Nue,Due=Oue,Pue=Due(Object.getPrototypeOf,Object),Rue=Pue,Bue=cb,Fue=Rue,Gue=hb,zue="[object Object]",$ue=Function.prototype,jue=Object.prototype,BO=$ue.toString,Uue=jue.hasOwnProperty,Xue=BO.call(Object);function Yue(r){if(!Gue(r)||Bue(r)!=zue)return!1;var e=Fue(r);if(e===null)return!0;var t=Uue.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&BO.call(t)==Xue}var Wue=Yue;const Vue=pa(Wue);function h0(r){var e={};return Object.keys(r).forEach(function(t){Yy(t,r[t],e,"")}),e}function Yy(r,e,t,n){if(e===null||typeof e=="number"||typeof e=="boolean"||Array.isArray(e)&&typeof e[0]=="number"||iv(e)||e===""||e.resize!==void 0){t["".concat(n&&n+".").concat(r)]=e;return}Vue(e)&&Object.keys(e).forEach(function(i){Yy(i,e[i],t,"".concat(n&&n+".").concat(r))}),Array.isArray(e)&&e.forEach(function(i,a){Object.keys(i).forEach(function(o){Yy(o,i[o],t,"".concat(n&&n+".").concat(r,"[").concat(a,"]"))})})}function US(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function fu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?US(Object(t),!0).forEach(function(n){Je(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):US(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Hue=function(){function r(e,t){Gi(this,r),this.reGl=void 0,this.drawCommand=void 0,this.uniforms={},this.reGl=e;var n=t.vs,i=t.fs,a=t.defines,o=t.attributes,s=t.uniforms,u=t.primitive,f=t.count,l=t.elements,c=t.depth,h=t.blend,d=t.stencil,v=t.cull,p=t.instances,g=t.scissor,y=t.viewport,m={};s&&(this.uniforms=h0(s),Object.keys(s).forEach(function(E){m[E]=e.prop(E)}));var b={};Object.keys(o).forEach(function(E){b[E]=o[E].get()});var x=a&&this.generateDefines(a)||"",w={attributes:b,frag:`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
62
|
-
precision highp float;
|
|
63
|
-
#else
|
|
64
|
-
precision mediump float;
|
|
65
|
-
#endif
|
|
66
|
-
`.concat(x,`
|
|
67
|
-
`).concat(i),uniforms:m,vert:`
|
|
68
|
-
`.concat(x,`
|
|
69
|
-
`).concat(n),primitive:pue[u===void 0?Le.TRIANGLES:u]};p&&(w.instances=p),f&&(w.count=f),l&&(w.elements=l.get()),g&&(w.scissor=g),y&&(w.viewport=y),this.initDepthDrawParams({depth:c},w),this.initBlendDrawParams({blend:h},w),this.initStencilDrawParams({stencil:d},w),this.initCullDrawParams({cull:v},w),this.drawCommand=e(w)}return zi(r,[{key:"addUniforms",value:function(t){this.uniforms=fu(fu({},this.uniforms),h0(t))}},{key:"draw",value:function(t){var n=fu(fu({},this.uniforms),h0(t.uniforms||{})),i={};Object.keys(n).forEach(function(a){var o=Hu(n[a]);o==="boolean"||o==="number"||Array.isArray(n[a])||n[a].BYTES_PER_ELEMENT?i[a]=n[a]:o==="string"||(i[a]=n[a].get())}),this.drawCommand(i)}},{key:"destroy",value:function(){}},{key:"initDepthDrawParams",value:function(t,n){var i=t.depth;i&&(n.depth={enable:i.enable===void 0?!0:!!i.enable,mask:i.mask===void 0?!0:!!i.mask,func:bue[i.func||Le.LESS],range:i.range||[0,1]})}},{key:"initBlendDrawParams",value:function(t,n){var i=t.blend;if(i){var a=i.enable,o=i.func,s=i.equation,u=i.color,f=u===void 0?[0,0,0,0]:u;n.blend={enable:!!a,func:{srcRGB:Dh[o&&o.srcRGB||Le.SRC_ALPHA],srcAlpha:Dh[o&&o.srcAlpha||Le.SRC_ALPHA],dstRGB:Dh[o&&o.dstRGB||Le.ONE_MINUS_SRC_ALPHA],dstAlpha:Dh[o&&o.dstAlpha||Le.ONE_MINUS_SRC_ALPHA]},equation:{rgb:GS[s&&s.rgb||Le.FUNC_ADD],alpha:GS[s&&s.alpha||Le.FUNC_ADD]},color:f}}}},{key:"initStencilDrawParams",value:function(t,n){var i=t.stencil;if(i){var a=i.enable,o=i.mask,s=o===void 0?-1:o,u=i.func,f=u===void 0?{cmp:Le.ALWAYS,ref:0,mask:-1}:u,l=i.opFront,c=l===void 0?{fail:Le.KEEP,zfail:Le.KEEP,zpass:Le.KEEP}:l,h=i.opBack,d=h===void 0?{fail:Le.KEEP,zfail:Le.KEEP,zpass:Le.KEEP}:h;n.stencil={enable:!!a,mask:s,func:fu(fu({},f),{},{cmp:xue[f.cmp]}),opFront:{fail:uu[c.fail],zfail:uu[c.zfail],zpass:uu[c.zpass]},opBack:{fail:uu[d.fail],zfail:uu[d.zfail],zpass:uu[d.zpass]}}}}},{key:"initCullDrawParams",value:function(t,n){var i=t.cull;if(i){var a=i.enable,o=i.face,s=o===void 0?Le.BACK:o;n.cull={enable:!!a,face:wue[s]}}}},{key:"generateDefines",value:function(t){return Object.keys(t).map(function(n){return"#define ".concat(n," ").concat(Number(t[n]))}).join(`
|
|
70
|
-
`)}}]),r}(),que=function(){function r(e,t){Gi(this,r),this.texture=void 0,this.width=void 0,this.height=void 0;var n=t.data,i=t.type,a=i===void 0?Le.UNSIGNED_BYTE:i,o=t.width,s=t.height,u=t.flipY,f=u===void 0?!1:u,l=t.format,c=l===void 0?Le.RGBA:l,h=t.mipmap,d=h===void 0?!1:h,v=t.wrapS,p=v===void 0?Le.CLAMP_TO_EDGE:v,g=t.wrapT,y=g===void 0?Le.CLAMP_TO_EDGE:g,m=t.aniso,b=m===void 0?0:m,x=t.alignment,w=x===void 0?1:x,E=t.premultiplyAlpha,_=E===void 0?!1:E,M=t.mag,C=M===void 0?Le.NEAREST:M,S=t.min,A=S===void 0?Le.NEAREST:S,T=t.colorSpace,k=T===void 0?Le.BROWSER_DEFAULT_WEBGL:T;this.width=o,this.height=s;var O={width:o,height:s,type:db[a],format:gue[c],wrapS:FS[p],wrapT:FS[y],mag:BS[C],min:BS[A],alignment:w,flipY:f,colorSpace:mue[k],premultiplyAlpha:_,aniso:b};n&&(O.data=n),typeof d=="number"?O.mipmap=yue[d]:typeof d=="boolean"&&(O.mipmap=d),this.texture=e.texture(O)}return zi(r,[{key:"get",value:function(){return this.texture}},{key:"update",value:function(){this.texture._texture.bind()}},{key:"resize",value:function(t){var n=t.width,i=t.height;this.texture.resize(n,i),this.width=n,this.height=i}},{key:"destroy",value:function(){this.texture.destroy()}}]),r}(),Zue=function(){function r(){var e=this;Gi(this,r),this.supportWebGPU=!1,this.useWGSL=!1,this.$canvas=void 0,this.gl=void 0,this.inited=void 0,this.createModel=function(){var t=wo(Mn.mark(function n(i){return Mn.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!i.uniforms){o.next=3;break}return o.next=3,Promise.all(Object.keys(i.uniforms).map(function(){var s=wo(Mn.mark(function u(f){var l;return Mn.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(i.uniforms[f]&&i.uniforms[f].load!==void 0)){h.next=5;break}return h.next=3,i.uniforms[f].load();case 3:l=h.sent,i.uniforms[f]=l;case 5:case"end":return h.stop()}},u)}));return function(u){return s.apply(this,arguments)}}()));case 3:return o.abrupt("return",new Hue(e.gl,i));case 4:case"end":return o.stop()}},n)}));return function(n){return t.apply(this,arguments)}}(),this.createAttribute=function(t){return new vue(e.gl,t)},this.createBuffer=function(t){return new Eue(e.gl,t)},this.createElements=function(t){return new kue(e.gl,t)},this.createTexture2D=function(t){return new que(e.gl,t)},this.createFramebuffer=function(t){return new Lue(e.gl,t)},this.useFramebuffer=function(t,n){e.gl({framebuffer:t?t.get():null})(n)},this.createComputeModel=function(){var t=wo(Mn.mark(function n(i){return Mn.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new Iue(e.gl,i));case 1:case"end":return o.stop()}},n)}));return function(n){return t.apply(this,arguments)}}(),this.clear=function(t){var n=t.color,i=t.depth,a=t.stencil,o=t.framebuffer,s=o===void 0?null:o,u={color:n,depth:i,stencil:a};u.framebuffer=s===null?s:s.get(),e.gl.clear(u)},this.setScissor=function(t){e.gl&&e.gl._gl&&(t.enable&&t.box?(e.gl._gl.enable(Le.SCISSOR_TEST),e.gl._gl.scissor(t.box.x,t.box.y,t.box.width,t.box.height)):e.gl._gl.disable(Le.SCISSOR_TEST),e.gl._refresh())},this.viewport=function(t){var n=t.x,i=t.y,a=t.width,o=t.height;e.gl&&e.gl._gl&&(e.gl._gl.viewport(n,i,a,o),e.gl._refresh())},this.readPixels=function(t){var n=t.framebuffer,i=t.x,a=t.y,o=t.width,s=t.height,u={x:i,y:a,width:o,height:s};return n&&(u.framebuffer=n.get()),e.gl.read(u)},this.getCanvas=function(){return e.$canvas},this.getGLContext=function(){return e.gl._gl},this.destroy=function(){e.gl&&(e.gl.destroy(),e.inited=!1)}}return zi(r,[{key:"init",value:function(){var e=wo(Mn.mark(function n(i){return Mn.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!this.inited){o.next=2;break}return o.abrupt("return");case 2:return this.$canvas=i.canvas,o.next=5,new Promise(function(s,u){due({canvas:i.canvas,attributes:{alpha:!0,antialias:i.antialias,premultipliedAlpha:!0},pixelRatio:1,extensions:["OES_element_index_uint","OES_texture_float","OES_standard_derivatives","angle_instanced_arrays"],optionalExtensions:["EXT_texture_filter_anisotropic","EXT_blend_minmax","WEBGL_depth_texture"],profile:!0,onDone:function(l,c){(l||!c)&&u(l),s(c)}})});case 5:this.gl=o.sent,this.inited=!0;case 7:case"end":return o.stop()}},n,this)}));function t(n){return e.apply(this,arguments)}return t}()},{key:"isFloatSupported",value:function(){return this.gl.limits.readFloat}},{key:"beginFrame",value:function(){}},{key:"endFrame",value:function(){}}]),r}(),Kue=function(){function r(){Gi(this,r),this.engine=void 0,this.configService=new fue}return zi(r,[{key:"setConfig",value:function(t){this.configService.set(t)}},{key:"setEngine",value:function(t){this.engine=t}},{key:"createEntity",value:function(){return OO()}},{key:"createKernel",value:function(t){var n=new DO(this.engine,this.configService);return typeof t=="string"?n.setBundle(JSON.parse(t)):n.setBundle(t),n.init(),n}},{key:"destroy",value:function(){this.engine.destroy()}}],[{key:"create",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=new r;return n.setConfig(t),n.setEngine(new Zue),n}}]),r}();const Que=Object.freeze(Object.defineProperty({__proto__:null,Kernel:DO,World:Kue},Symbol.toStringTag,{value:"Module"})),FO=va(Que);var Zn={};Object.defineProperty(Zn,"__esModule",{value:!0});Zn.arrayToTextureData=Zn.attributesToTextureData=Zn.buildTextureDataWithTwoEdgeAttr=Zn.buildTextureData=Zn.proccessToFunc=void 0;var Jue=Or(),av=Gv,efe=function(r,e){var t;return r?(0,Jue.isNumber)(r)?t=function(){return r}:t=r:t=function(){return e||1},t};Zn.proccessToFunc=efe;var tfe=function(r,e){var t=[],n=[],i={},a=0;for(a=0;a<r.length;a++){var o=r[a];i[o.id]=a,t.push(o.x),t.push(o.y),t.push(0),t.push(0),n.push([])}for(a=0;a<e.length;a++){var s=e[a],u=(0,av.getEdgeTerminal)(s,"source"),f=(0,av.getEdgeTerminal)(s,"target");!isNaN(i[u])&&!isNaN(i[f])&&(n[i[u]].push(i[f]),n[i[f]].push(i[u]))}var l=0;for(a=0;a<r.length;a++){var c=t.length,h=n[a],d=h.length;t[a*4+2]=c,t[a*4+3]=d,l=Math.max(l,d);for(var v=0;v<d;++v){var p=h[v];t.push(+p)}}for(;t.length%4!==0;)t.push(0);return{maxEdgePerVetex:l,array:new Float32Array(t)}};Zn.buildTextureData=tfe;var rfe=function(r,e,t,n){var i=[],a=[],o={},s=0;for(s=0;s<r.length;s++){var u=r[s];o[u.id]=s,i.push(u.x),i.push(u.y),i.push(0),i.push(0),a.push([])}for(s=0;s<e.length;s++){var f=e[s],l=(0,av.getEdgeTerminal)(f,"source"),c=(0,av.getEdgeTerminal)(f,"target");a[o[l]].push(o[c]),a[o[l]].push(t(f)),a[o[l]].push(n(f)),a[o[l]].push(0),a[o[c]].push(o[l]),a[o[c]].push(t(f)),a[o[c]].push(n(f)),a[o[c]].push(0)}var h=0;for(s=0;s<r.length;s++){var d=i.length,v=a[s],p=v.length;i[s*4+2]=d+1048576*p/4,i[s*4+3]=0,h=Math.max(h,p/4);for(var g=0;g<p;++g){var y=v[g];i.push(+y)}}for(;i.length%4!==0;)i.push(0);return{maxEdgePerVetex:h,array:new Float32Array(i)}};Zn.buildTextureDataWithTwoEdgeAttr=rfe;var nfe=function(r,e){var t=[],n=r.length,i={};return e.forEach(function(a){r.forEach(function(o,s){if(i[a[o]]===void 0&&(i[a[o]]=Object.keys(i).length),t.push(i[a[o]]),s===n-1)for(;t.length%4!==0;)t.push(0)})}),{array:new Float32Array(t),count:Object.keys(i).length}};Zn.attributesToTextureData=nfe;var ife=function(r){for(var e=[],t=r.length,n=r[0].length,i=function(o){r.forEach(function(s,u){if(e.push(s[o]),u===t-1)for(;e.length%4!==0;)e.push(0)})},a=0;a<n;a++)i(a);return new Float32Array(e)};Zn.arrayToTextureData=ife;var oa={};Object.defineProperty(oa,"__esModule",{value:!0});oa.clusterBundle=oa.clusterCode=oa.fruchtermanBundle=oa.fruchtermanCode=void 0;oa.fruchtermanCode=`
|
|
71
|
-
import { globalInvocationID } from 'g-webgpu';
|
|
72
|
-
const MAX_EDGE_PER_VERTEX;
|
|
73
|
-
const VERTEX_COUNT;
|
|
74
|
-
@numthreads(1, 1, 1)
|
|
75
|
-
class Fruchterman {
|
|
76
|
-
@in @out
|
|
77
|
-
u_Data: vec4[];
|
|
78
|
-
@in
|
|
79
|
-
u_K: float;
|
|
80
|
-
@in
|
|
81
|
-
u_K2: float;
|
|
82
|
-
|
|
83
|
-
@in
|
|
84
|
-
u_Center: vec2;
|
|
85
|
-
@in
|
|
86
|
-
u_Gravity: float;
|
|
87
|
-
@in
|
|
88
|
-
u_ClusterGravity: float;
|
|
89
|
-
@in
|
|
90
|
-
u_Speed: float;
|
|
91
|
-
@in
|
|
92
|
-
u_MaxDisplace: float;
|
|
93
|
-
@in
|
|
94
|
-
u_Clustering: float;
|
|
95
|
-
@in
|
|
96
|
-
u_AttributeArray: vec4[];
|
|
97
|
-
@in
|
|
98
|
-
u_ClusterCenters: vec4[];
|
|
99
|
-
calcRepulsive(i: int, currentNode: vec4): vec2 {
|
|
100
|
-
let dx = 0, dy = 0;
|
|
101
|
-
for (let j = 0; j < VERTEX_COUNT; j++) {
|
|
102
|
-
if (i != j) {
|
|
103
|
-
const nextNode = this.u_Data[j];
|
|
104
|
-
const xDist = currentNode[0] - nextNode[0];
|
|
105
|
-
const yDist = currentNode[1] - nextNode[1];
|
|
106
|
-
const dist = (xDist * xDist + yDist * yDist) + 0.01;
|
|
107
|
-
let param = this.u_K2 / dist;
|
|
108
|
-
|
|
109
|
-
if (dist > 0.0) {
|
|
110
|
-
dx += param * xDist;
|
|
111
|
-
dy += param * yDist;
|
|
112
|
-
if (xDist == 0 && yDist == 0) {
|
|
113
|
-
const sign = i < j ? 1 : -1;
|
|
114
|
-
dx += param * sign;
|
|
115
|
-
dy += param * sign;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return [dx, dy];
|
|
121
|
-
}
|
|
122
|
-
calcGravity(currentNode: vec4, nodeAttributes: vec4): vec2 { //
|
|
123
|
-
let dx = 0, dy = 0;
|
|
124
|
-
const vx = currentNode[0] - this.u_Center[0];
|
|
125
|
-
const vy = currentNode[1] - this.u_Center[1];
|
|
126
|
-
const gf = 0.01 * this.u_K * this.u_Gravity;
|
|
127
|
-
dx = gf * vx;
|
|
128
|
-
dy = gf * vy;
|
|
129
|
-
if (this.u_Clustering == 1) {
|
|
130
|
-
const clusterIdx = int(nodeAttributes[0]);
|
|
131
|
-
const center = this.u_ClusterCenters[clusterIdx];
|
|
132
|
-
const cvx = currentNode[0] - center[0];
|
|
133
|
-
const cvy = currentNode[1] - center[1];
|
|
134
|
-
const dist = sqrt(cvx * cvx + cvy * cvy) + 0.01;
|
|
135
|
-
const parma = this.u_K * this.u_ClusterGravity / dist;
|
|
136
|
-
dx += parma * cvx;
|
|
137
|
-
dy += parma * cvy;
|
|
138
|
-
}
|
|
139
|
-
return [dx, dy];
|
|
140
|
-
}
|
|
141
|
-
calcAttractive(i: int, currentNode: vec4): vec2 {
|
|
142
|
-
let dx = 0, dy = 0;
|
|
143
|
-
const arr_offset = int(floor(currentNode[2] + 0.5));
|
|
144
|
-
const length = int(floor(currentNode[3] + 0.5));
|
|
145
|
-
const node_buffer: vec4;
|
|
146
|
-
for (let p = 0; p < MAX_EDGE_PER_VERTEX; p++) {
|
|
147
|
-
if (p >= length) break;
|
|
148
|
-
const arr_idx = arr_offset + p;
|
|
149
|
-
// when arr_idx % 4 == 0 update currentNodedx_buffer
|
|
150
|
-
const buf_offset = arr_idx - arr_idx / 4 * 4;
|
|
151
|
-
if (p == 0 || buf_offset == 0) {
|
|
152
|
-
node_buffer = this.u_Data[int(arr_idx / 4)];
|
|
153
|
-
}
|
|
154
|
-
const float_j = buf_offset == 0 ? node_buffer[0] :
|
|
155
|
-
buf_offset == 1 ? node_buffer[1] :
|
|
156
|
-
buf_offset == 2 ? node_buffer[2] :
|
|
157
|
-
node_buffer[3];
|
|
158
|
-
const nextNode = this.u_Data[int(float_j)];
|
|
159
|
-
const xDist = currentNode[0] - nextNode[0];
|
|
160
|
-
const yDist = currentNode[1] - nextNode[1];
|
|
161
|
-
const dist = sqrt(xDist * xDist + yDist * yDist) + 0.01;
|
|
162
|
-
let attractiveF = dist / this.u_K;
|
|
163
|
-
|
|
164
|
-
if (dist > 0.0) {
|
|
165
|
-
dx -= xDist * attractiveF;
|
|
166
|
-
dy -= yDist * attractiveF;
|
|
167
|
-
if (xDist == 0 && yDist == 0) {
|
|
168
|
-
const sign = i < int(float_j) ? 1 : -1;
|
|
169
|
-
dx -= sign * attractiveF;
|
|
170
|
-
dy -= sign * attractiveF;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return [dx, dy];
|
|
175
|
-
}
|
|
176
|
-
@main
|
|
177
|
-
compute() {
|
|
178
|
-
const i = globalInvocationID.x;
|
|
179
|
-
const currentNode = this.u_Data[i];
|
|
180
|
-
let dx = 0, dy = 0;
|
|
181
|
-
if (i >= VERTEX_COUNT) {
|
|
182
|
-
this.u_Data[i] = currentNode;
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// [gravity, fx, fy, 0]
|
|
187
|
-
const nodeAttributes = this.u_AttributeArray[i];
|
|
188
|
-
|
|
189
|
-
if (nodeAttributes[1] != 0 && nodeAttributes[2] != 0) {
|
|
190
|
-
// the node is fixed
|
|
191
|
-
this.u_Data[i] = [
|
|
192
|
-
nodeAttributes[1],
|
|
193
|
-
nodeAttributes[2],
|
|
194
|
-
currentNode[2],
|
|
195
|
-
currentNode[3]
|
|
196
|
-
];
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// repulsive
|
|
201
|
-
const repulsive = this.calcRepulsive(i, currentNode);
|
|
202
|
-
dx += repulsive[0];
|
|
203
|
-
dy += repulsive[1];
|
|
204
|
-
// attractive
|
|
205
|
-
const attractive = this.calcAttractive(i, currentNode);
|
|
206
|
-
dx += attractive[0];
|
|
207
|
-
dy += attractive[1];
|
|
208
|
-
// gravity
|
|
209
|
-
const gravity = this.calcGravity(currentNode, nodeAttributes);
|
|
210
|
-
dx -= gravity[0];
|
|
211
|
-
dy -= gravity[1];
|
|
212
|
-
// speed
|
|
213
|
-
dx *= this.u_Speed;
|
|
214
|
-
dy *= this.u_Speed;
|
|
215
|
-
|
|
216
|
-
// move
|
|
217
|
-
const distLength = sqrt(dx * dx + dy * dy);
|
|
218
|
-
if (distLength > 0.0) {
|
|
219
|
-
const limitedDist = min(this.u_MaxDisplace * this.u_Speed, distLength);
|
|
220
|
-
this.u_Data[i] = [
|
|
221
|
-
currentNode[0] + dx / distLength * limitedDist,
|
|
222
|
-
currentNode[1] + dy / distLength * limitedDist,
|
|
223
|
-
currentNode[2],
|
|
224
|
-
currentNode[3]
|
|
225
|
-
];
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
`;oa.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<f32>[]","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<f32>","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<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}';oa.clusterCode=`
|
|
230
|
-
import { globalInvocationID } from 'g-webgpu';
|
|
231
|
-
const VERTEX_COUNT;
|
|
232
|
-
const CLUSTER_COUNT;
|
|
233
|
-
@numthreads(1, 1, 1)
|
|
234
|
-
class CalcCenter {
|
|
235
|
-
@in
|
|
236
|
-
u_Data: vec4[];
|
|
237
|
-
@in
|
|
238
|
-
u_NodeAttributes: vec4[]; // [[clusterIdx, 0, 0, 0], ...]
|
|
239
|
-
@in @out
|
|
240
|
-
u_ClusterCenters: vec4[]; // [[cx, cy, nodeCount, clusterIdx], ...]
|
|
241
|
-
@main
|
|
242
|
-
compute() {
|
|
243
|
-
const i = globalInvocationID.x;
|
|
244
|
-
const center = this.u_ClusterCenters[i];
|
|
245
|
-
let sumx = 0;
|
|
246
|
-
let sumy = 0;
|
|
247
|
-
let count = 0;
|
|
248
|
-
for (let j = 0; j < VERTEX_COUNT; j++) {
|
|
249
|
-
const attributes = this.u_NodeAttributes[j];
|
|
250
|
-
const clusterIdx = int(attributes[0]);
|
|
251
|
-
const vertex = this.u_Data[j];
|
|
252
|
-
if (clusterIdx == i) {
|
|
253
|
-
sumx += vertex.x;
|
|
254
|
-
sumy += vertex.y;
|
|
255
|
-
count += 1;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
this.u_ClusterCenters[i] = [
|
|
259
|
-
sumx / count,
|
|
260
|
-
sumy / count,
|
|
261
|
-
count,
|
|
262
|
-
i
|
|
263
|
-
];
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
`;oa.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<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}';var afe=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ph=xe&&xe.__awaiter||function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(l){try{f(n.next(l))}catch(c){o(c)}}function u(l){try{f(n.throw(l))}catch(c){o(c)}}function f(l){l.done?a(l.value):i(l.value).then(s,u)}f((n=n.apply(r,e||[])).next())})},Rh=xe&&xe.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(f){return function(l){return u([f,l])}}function u(f){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(t=0)),t;)try{if(n=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,i=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){t.label=f[1];break}if(f[0]===6&&t.label<a[1]){t.label=a[1],a=f;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(f);break}a[2]&&t.ops.pop(),t.trys.pop();continue}f=e.call(r,t)}catch(l){f=[6,l],i=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(hc,"__esModule",{value:!0});hc.FruchtermanGPULayout=void 0;var ofe=zr,lu=Or(),XS=FO,YS=Zn,WS=oa,sfe=Ua,ufe=function(r){afe(e,r);function e(t){var n=r.call(this)||this;return n.maxIteration=1e3,n.gravity=10,n.speed=1,n.clustering=!1,n.clusterField="cluster",n.clusterGravity=10,n.workerEnabled=!1,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10}},e.prototype.execute=function(){return Ph(this,void 0,void 0,function(){var t,n,i,a,o,s=this;return Rh(this,function(u){switch(u.label){case 0:return t=this,n=t.nodes,!n||n.length===0?(t.onLayoutEnd&&t.onLayoutEnd(),[2]):(!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]),i=t.center,n.length===1?(n[0].x=i[0],n[0].y=i[1],t.onLayoutEnd&&t.onLayoutEnd(),[2]):(a={},o={},n.forEach(function(f,l){(0,lu.isNumber)(f.x)||(f.x=Math.random()*s.width),(0,lu.isNumber)(f.y)||(f.y=Math.random()*s.height),a[f.id]=f,o[f.id]=l}),t.nodeMap=a,t.nodeIdxMap=o,[4,t.run()]));case 1:return u.sent(),[2]}})})},e.prototype.executeWithWorker=function(t,n){return Ph(this,void 0,void 0,function(){var i,a,o,s,u,f=this;return Rh(this,function(l){switch(l.label){case 0:return i=this,a=i.nodes,o=i.center,!a||a.length===0?[2]:a.length===1?(a[0].x=o[0],a[0].y=o[1],[2]):(s={},u={},a.forEach(function(c,h){(0,lu.isNumber)(c.x)||(c.x=Math.random()*f.width),(0,lu.isNumber)(c.y)||(c.y=Math.random()*f.height),s[c.id]=c,u[c.id]=h}),i.nodeMap=s,i.nodeIdxMap=u,[4,i.run(t,n)]);case 1:return l.sent(),[2]}})})},e.prototype.run=function(t,n){return Ph(this,void 0,void 0,function(){var i,a,o,s,u,f,l,c,h,d,v,p,g,y,m,b,x,w,E,_,M,C,S,A,T,k,O=this;return Rh(this,function(F){switch(F.label){case 0:for(i=this,a=i.nodes,o=i.edges,s=i.maxIteration,u=i.center,f=i.height*i.width,l=Math.sqrt(f)/10,c=f/(a.length+1),h=Math.sqrt(c),d=i.speed,v=i.clustering,p=(0,YS.attributesToTextureData)([i.clusterField],a),g=p.array,y=p.count,a.forEach(function(D,$){var Y=0,N=0;(0,lu.isNumber)(D.fx)&&(0,lu.isNumber)(D.fy)&&(Y=D.fx||.001,N=D.fy||.001),g[4*$+1]=Y,g[4*$+2]=N}),m=a.length,b=(0,YS.buildTextureData)(a,o),x=b.maxEdgePerVetex,w=b.array,E=i.workerEnabled,E?_=XS.World.create({canvas:t,engineOptions:{supportCompute:!0}}):_=XS.World.create({engineOptions:{supportCompute:!0}}),M=i.onLayoutEnd,C=[],S=0;S<y;S++)C.push(0,0,0,0);return A=_.createKernel(WS.fruchtermanBundle).setDispatch([m,1,1]).setBinding({u_Data:w,u_K:h,u_K2:c,u_Gravity:i.gravity,u_ClusterGravity:i.clusterGravity||i.gravity||1,u_Speed:d,u_MaxDisplace:l,u_Clustering:v?1:0,u_Center:u,u_AttributeArray:g,u_ClusterCenters:C,MAX_EDGE_PER_VERTEX:x,VERTEX_COUNT:m}),v&&(T=_.createKernel(WS.clusterBundle).setDispatch([y,1,1]).setBinding({u_Data:w,u_NodeAttributes:g,u_ClusterCenters:C,VERTEX_COUNT:m,CLUSTER_COUNT:y})),k=function(){return Ph(O,void 0,void 0,function(){var D,$;return Rh(this,function(Y){switch(Y.label){case 0:D=0,Y.label=1;case 1:return D<s?[4,A.execute()]:[3,6];case 2:return Y.sent(),v?(T.setBinding({u_Data:A}),[4,T.execute()]):[3,4];case 3:Y.sent(),A.setBinding({u_ClusterCenters:T}),Y.label=4;case 4:A.setBinding({u_MaxDisplace:l*=.99}),Y.label=5;case 5:return D++,[3,1];case 6:return[4,A.getOutput()];case 7:return $=Y.sent(),t?n.postMessage({type:sfe.LAYOUT_MESSAGE.GPUEND,vertexEdgeData:$}):a.forEach(function(N,P){var W=$[4*P],J=$[4*P+1];N.x=W,N.y=J}),M&&M(),[2]}})})},[4,k()];case 1:return F.sent(),[2]}})})},e.prototype.getType=function(){return"fruchterman-gpu"},e}(ofe.Base);hc.FruchtermanGPULayout=ufe;var dc={},sa={};Object.defineProperty(sa,"__esModule",{value:!0});sa.aveMovementBundle=sa.aveMovementCode=sa.gForceBundle=sa.gForceCode=void 0;sa.gForceCode=`
|
|
267
|
-
import { globalInvocationID } from 'g-webgpu';
|
|
268
|
-
|
|
269
|
-
const MAX_EDGE_PER_VERTEX;
|
|
270
|
-
const VERTEX_COUNT;
|
|
271
|
-
const SHIFT_20 = 1048576;
|
|
272
|
-
|
|
273
|
-
@numthreads(1, 1, 1)
|
|
274
|
-
class GGForce {
|
|
275
|
-
@in @out
|
|
276
|
-
u_Data: vec4[];
|
|
277
|
-
|
|
278
|
-
@in
|
|
279
|
-
u_damping: float;
|
|
280
|
-
|
|
281
|
-
@in
|
|
282
|
-
u_maxSpeed: float;
|
|
283
|
-
|
|
284
|
-
@in
|
|
285
|
-
u_minMovement: float;
|
|
286
|
-
|
|
287
|
-
@in
|
|
288
|
-
u_AveMovement: vec4[];
|
|
289
|
-
|
|
290
|
-
@in
|
|
291
|
-
u_coulombDisScale: float;
|
|
292
|
-
|
|
293
|
-
@in
|
|
294
|
-
u_factor: float;
|
|
295
|
-
|
|
296
|
-
@in
|
|
297
|
-
u_NodeAttributeArray1: vec4[];
|
|
298
|
-
|
|
299
|
-
@in
|
|
300
|
-
u_NodeAttributeArray2: vec4[];
|
|
301
|
-
|
|
302
|
-
@in
|
|
303
|
-
u_interval: float;
|
|
304
|
-
|
|
305
|
-
unpack_float(packedValue: float): ivec2 {
|
|
306
|
-
const packedIntValue = int(packedValue);
|
|
307
|
-
const v0 = packedIntValue / SHIFT_20;
|
|
308
|
-
return [v0, packedIntValue - v0 * SHIFT_20];
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
calcRepulsive(i: int, currentNode: vec4): vec2 {
|
|
312
|
-
let ax = 0, ay = 0;
|
|
313
|
-
for (let j: int = 0; j < VERTEX_COUNT; j++) {
|
|
314
|
-
if (i != j) {
|
|
315
|
-
const nextNode = this.u_Data[j];
|
|
316
|
-
const vx = currentNode[0] - nextNode[0];
|
|
317
|
-
const vy = currentNode[1] - nextNode[1];
|
|
318
|
-
const dist = sqrt(vx * vx + vy * vy) + 0.01;
|
|
319
|
-
const n_dist = (dist + 0.1) * this.u_coulombDisScale;
|
|
320
|
-
const direx = vx / dist;
|
|
321
|
-
const direy = vy / dist;
|
|
322
|
-
const attributesi = this.u_NodeAttributeArray1[i];
|
|
323
|
-
const attributesj = this.u_NodeAttributeArray1[j];
|
|
324
|
-
const massi = attributesi[0];
|
|
325
|
-
const nodeStrengthi = attributesi[2];
|
|
326
|
-
const nodeStrengthj = attributesj[2];
|
|
327
|
-
const nodeStrength = (nodeStrengthi + nodeStrengthj) / 2;
|
|
328
|
-
// const param = nodeStrength * this.u_factor / (n_dist * n_dist * massi);
|
|
329
|
-
const param = nodeStrength * this.u_factor / (n_dist * n_dist);
|
|
330
|
-
ax += direx * param;
|
|
331
|
-
ay += direy * param;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
return [ax, ay];
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
calcGravity(i: int, currentNode: vec4, attributes2: vec4): vec2 {
|
|
338
|
-
// note: attributes2 = [centerX, centerY, gravity, 0]
|
|
339
|
-
|
|
340
|
-
const vx = currentNode[0] - attributes2[0];
|
|
341
|
-
const vy = currentNode[1] - attributes2[1];
|
|
342
|
-
|
|
343
|
-
const ax = vx * attributes2[2];
|
|
344
|
-
const ay = vy * attributes2[2];
|
|
345
|
-
|
|
346
|
-
return [ax, ay];
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
calcAttractive(i: int, currentNode: vec4, attributes1: vec4): vec2 {
|
|
350
|
-
// note: attributes1 = [mass, degree, nodeSterngth, 0]
|
|
351
|
-
|
|
352
|
-
const mass = attributes1[0];
|
|
353
|
-
let ax = 0, ay = 0;
|
|
354
|
-
// const arr_offset = int(floor(currentNode[2] + 0.5));
|
|
355
|
-
// const length = int(floor(currentNode[3] + 0.5));
|
|
356
|
-
|
|
357
|
-
const compressed = this.unpack_float(currentNode[2]);
|
|
358
|
-
const length = compressed[0];
|
|
359
|
-
const arr_offset = compressed[1];
|
|
360
|
-
|
|
361
|
-
const node_buffer: vec4;
|
|
362
|
-
for (let p: int = 0; p < MAX_EDGE_PER_VERTEX; p++) {
|
|
363
|
-
if (p >= length) break;
|
|
364
|
-
const arr_idx = arr_offset + 4 * p; // i 节点的第 p 条边开始的小格子位置
|
|
365
|
-
const buf_offset = arr_idx - arr_idx / 4 * 4;
|
|
366
|
-
if (p == 0 || buf_offset == 0) {
|
|
367
|
-
node_buffer = this.u_Data[int(arr_idx / 4)]; // 大格子,大格子位置=小个子位置 / 4,
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
let float_j: float = node_buffer[0];
|
|
371
|
-
|
|
372
|
-
const nextNode = this.u_Data[int(float_j)];
|
|
373
|
-
const vx = nextNode[0] - currentNode[0];
|
|
374
|
-
const vy = nextNode[1] - currentNode[1];
|
|
375
|
-
const dist = sqrt(vx * vx + vy * vy) + 0.01;
|
|
376
|
-
const direx = vx / dist;
|
|
377
|
-
const direy = vy / dist;
|
|
378
|
-
const edgeLength = node_buffer[1];
|
|
379
|
-
const edgeStrength = node_buffer[2];
|
|
380
|
-
const diff: float = edgeLength - dist;//edgeLength
|
|
381
|
-
// const param = diff * this.u_stiffness / mass; //
|
|
382
|
-
const param = diff * edgeStrength / mass; //
|
|
383
|
-
ax -= direx * param;
|
|
384
|
-
ay -= direy * param;
|
|
385
|
-
}
|
|
386
|
-
return [ax, ay];
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
@main
|
|
390
|
-
compute() {
|
|
391
|
-
const i = globalInvocationID.x;
|
|
392
|
-
const currentNode = this.u_Data[i];
|
|
393
|
-
const movement = u_AveMovement[0];
|
|
394
|
-
let ax = 0, ay = 0;
|
|
395
|
-
|
|
396
|
-
if (i >= VERTEX_COUNT || movement.x < u_minMovement) {
|
|
397
|
-
this.u_Data[i] = currentNode;
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
// 每个节点属性占两个数组中各一格
|
|
402
|
-
// [mass, degree, nodeStrength, fx]
|
|
403
|
-
const nodeAttributes1 = this.u_NodeAttributeArray1[i];
|
|
404
|
-
// [centerX, centerY, centerGravity, fy]
|
|
405
|
-
const nodeAttributes2 = this.u_NodeAttributeArray2[i];
|
|
406
|
-
|
|
407
|
-
// repulsive
|
|
408
|
-
const repulsive = this.calcRepulsive(i, currentNode);
|
|
409
|
-
ax += repulsive[0];
|
|
410
|
-
ay += repulsive[1];
|
|
411
|
-
|
|
412
|
-
// attractive
|
|
413
|
-
const attractive = this.calcAttractive(i, currentNode, nodeAttributes1);
|
|
414
|
-
ax += attractive[0];
|
|
415
|
-
ay += attractive[1];
|
|
416
|
-
|
|
417
|
-
// gravity
|
|
418
|
-
const gravity = this.calcGravity(i, currentNode, nodeAttributes2);
|
|
419
|
-
ax -= gravity[0];
|
|
420
|
-
ay -= gravity[1];
|
|
421
|
-
|
|
422
|
-
// speed
|
|
423
|
-
const param = this.u_interval * this.u_damping;
|
|
424
|
-
let vx = ax * param;
|
|
425
|
-
let vy = ay * param;
|
|
426
|
-
const vlength = sqrt(vx * vx + vy * vy) + 0.0001;
|
|
427
|
-
if (vlength > this.u_maxSpeed) {
|
|
428
|
-
const param2 = this.u_maxSpeed / vlength;
|
|
429
|
-
vx = param2 * vx;
|
|
430
|
-
vy = param2 * vy;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// move
|
|
434
|
-
if (nodeAttributes1[3] != 0 && nodeAttributes2[3] != 0) {
|
|
435
|
-
this.u_Data[i] = [
|
|
436
|
-
nodeAttributes1[3],
|
|
437
|
-
nodeAttributes2[3],
|
|
438
|
-
currentNode[2],
|
|
439
|
-
0
|
|
440
|
-
];
|
|
441
|
-
} else {
|
|
442
|
-
const distx = vx * this.u_interval;
|
|
443
|
-
const disty = vy * this.u_interval;
|
|
444
|
-
const distLength = sqrt(distx * distx + disty * disty);
|
|
445
|
-
this.u_Data[i] = [
|
|
446
|
-
currentNode[0] + distx,
|
|
447
|
-
currentNode[1] + disty,
|
|
448
|
-
currentNode[2],
|
|
449
|
-
distLength
|
|
450
|
-
];
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
// the avarage move distance
|
|
454
|
-
// need to share memory
|
|
455
|
-
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
`;sa.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<f32>[]","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<f32>[]","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<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray2","type":"vec4<f32>[]","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}}';sa.aveMovementCode=`
|
|
459
|
-
const VERTEX_COUNT;
|
|
460
|
-
@numthreads(1, 1, 1)
|
|
461
|
-
class CalcAveMovement {
|
|
462
|
-
@in
|
|
463
|
-
u_Data: vec4[];
|
|
464
|
-
@in
|
|
465
|
-
u_iter: float;
|
|
466
|
-
@in @out
|
|
467
|
-
u_AveMovement: vec4[];
|
|
468
|
-
@main
|
|
469
|
-
compute() {
|
|
470
|
-
let movement = 0;
|
|
471
|
-
for (let j: int = 0; j < VERTEX_COUNT; j++) {
|
|
472
|
-
const vertex = this.u_Data[j];
|
|
473
|
-
movement += vertex[3];
|
|
474
|
-
}
|
|
475
|
-
movement = movement / float(VERTEX_COUNT);
|
|
476
|
-
this.u_AveMovement[0] = [movement, 0, 0, 0];
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
`;sa.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<f32>[]","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<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}';var ffe=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),d0=xe&&xe.__awaiter||function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(l){try{f(n.next(l))}catch(c){o(c)}}function u(l){try{f(n.throw(l))}catch(c){o(c)}}function f(l){l.done?a(l.value):i(l.value).then(s,u)}f((n=n.apply(r,e||[])).next())})},v0=xe&&xe.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(f){return function(l){return u([f,l])}}function u(f){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(t=0)),t;)try{if(n=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,i=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){t.label=f[1];break}if(f[0]===6&&t.label<a[1]){t.label=a[1],a=f;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(f);break}a[2]&&t.ops.pop(),t.trys.pop();continue}f=e.call(r,t)}catch(l){f=[6,l],i=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(dc,"__esModule",{value:!0});dc.GForceGPULayout=void 0;var lfe=zr,ka=Or(),VS=FO,La=Zn,cfe=Gv,HS=sa,hfe=Ua,dfe=function(r){ffe(e,r);function e(t){var n=r.call(this)||this;return n.maxIteration=1e3,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.workerEnabled=!1,n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:2e3,gravity:10,clustering:!1,clusterGravity:10}},e.prototype.execute=function(){return d0(this,void 0,void 0,function(){var t,n,i,a,o;return v0(this,function(s){switch(s.label){case 0:return t=this,n=t.nodes,!n||n.length===0?(t.onLayoutEnd&&t.onLayoutEnd(),[2]):(!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]),i=t.center,n.length===1?(n[0].x=i[0],n[0].y=i[1],t.onLayoutEnd&&t.onLayoutEnd(),[2]):(a={},o={},n.forEach(function(u,f){(0,ka.isNumber)(u.x)||(u.x=Math.random()*t.width),(0,ka.isNumber)(u.y)||(u.y=Math.random()*t.height),a[u.id]=u,o[u.id]=f}),t.nodeMap=a,t.nodeIdxMap=o,t.nodeStrength=(0,La.proccessToFunc)(t.nodeStrength,1),t.edgeStrength=(0,La.proccessToFunc)(t.edgeStrength,1),[4,t.run()]));case 1:return s.sent(),[2]}})})},e.prototype.executeWithWorker=function(t,n){var i=this,a=i.nodes,o=i.center;if(!(!a||a.length===0)){if(a.length===1){a[0].x=o[0],a[0].y=o[1];return}var s={},u={};a.forEach(function(f,l){(0,ka.isNumber)(f.x)||(f.x=Math.random()*i.width),(0,ka.isNumber)(f.y)||(f.y=Math.random()*i.height),s[f.id]=f,u[f.id]=l}),i.nodeMap=s,i.nodeIdxMap=u,i.nodeStrength=(0,La.proccessToFunc)(i.nodeStrength,1),i.edgeStrength=(0,La.proccessToFunc)(i.edgeStrength,1),i.run(t,n)}},e.prototype.run=function(t,n){return d0(this,void 0,void 0,function(){var i,a,o,s,u,f,l,c,h,d,v,p,g,y,m,b,x,w,E,_,M,C,S,A,T,k,O,F=this;return v0(this,function(D){switch(D.label){case 0:for(i=this,a=i.nodes,o=i.edges,s=i.maxIteration,!i.width&&typeof window<"u"&&(i.width=window.innerWidth),!i.height&&typeof window<"u"&&(i.height=window.innerHeight),u=a.length,i.linkDistance=(0,La.proccessToFunc)(i.linkDistance),i.edgeStrength=(0,La.proccessToFunc)(i.edgeStrength),f=(0,La.buildTextureDataWithTwoEdgeAttr)(a,o,i.linkDistance,i.edgeStrength),l=f.maxEdgePerVetex,c=f.array,i.degrees=(0,cfe.getDegree)(a.length,i.nodeIdxMap,o).map(function($){return $.all}),h=[],d=[],v=[],p=[],g=[],y=[],m=[],i.getMass||(i.getMass=function($){return i.degrees[i.nodeIdxMap[$.id]]||1}),b=i.gravity,x=i.center,a.forEach(function($,Y){h.push(i.getMass($)),d.push(i.nodeStrength($)),i.degrees[Y]||(i.degrees[Y]=0);var N=[x[0],x[1],b];if(i.getCenter){var P=i.getCenter($,i.degrees[Y]);P&&(0,ka.isNumber)(P[0])&&(0,ka.isNumber)(P[1])&&(0,ka.isNumber)(P[2])&&(N=P)}v.push(N[0]),p.push(N[1]),g.push(N[2]),(0,ka.isNumber)($.fx)&&(0,ka.isNumber)($.fy)?(y.push($.fx||.001),m.push($.fy||.001)):(y.push(0),m.push(0))}),w=(0,La.arrayToTextureData)([h,i.degrees,d,y]),E=(0,La.arrayToTextureData)([v,p,g,m]),_=i.workerEnabled,_?M=VS.World.create({canvas:t,engineOptions:{supportCompute:!0}}):M=VS.World.create({engineOptions:{supportCompute:!0}}),C=i.onLayoutEnd,S=[],c.forEach(function($){S.push($)}),A=0;A<4;A++)S.push(0);return T=M.createKernel(HS.gForceBundle).setDispatch([u,1,1]).setBinding({u_Data:c,u_damping:i.damping,u_maxSpeed:i.maxSpeed,u_minMovement:i.minMovement,u_coulombDisScale:i.coulombDisScale,u_factor:i.factor,u_NodeAttributeArray1:w,u_NodeAttributeArray2:E,MAX_EDGE_PER_VERTEX:l,VERTEX_COUNT:u,u_AveMovement:S,u_interval:i.interval}),k=M.createKernel(HS.aveMovementBundle).setDispatch([1,1,1]).setBinding({u_Data:c,VERTEX_COUNT:u,u_AveMovement:[0,0,0,0]}),O=function(){return d0(F,void 0,void 0,function(){var $,Y,N;return v0(this,function(P){switch(P.label){case 0:$=0,P.label=1;case 1:return $<s?[4,T.execute()]:[3,5];case 2:return P.sent(),k.setBinding({u_Data:T}),[4,k.execute()];case 3:P.sent(),Y=Math.max(.02,i.interval-$*.002),T.setBinding({u_interval:Y,u_AveMovement:k}),P.label=4;case 4:return $++,[3,1];case 5:return[4,T.getOutput()];case 6:return N=P.sent(),t?n.postMessage({type:hfe.LAYOUT_MESSAGE.GPUEND,vertexEdgeData:N}):a.forEach(function(W,J){var te=N[4*J],H=N[4*J+1];W.x=te,W.y=H}),C&&C(),[2]}})})},[4,O()];case 1:return D.sent(),[2]}})})},e.prototype.getType=function(){return"gForce-gpu"},e}(lfe.Base);dc.GForceGPULayout=dfe;var vc={},vfe=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(vc,"__esModule",{value:!0});vc.ComboForceLayout=void 0;var pfe=zr,Wt=Or(),gfe=function(r){vfe(e,r);function e(t){var n=r.call(this)||this;return n.center=[0,0],n.maxIteration=100,n.gravity=10,n.comboGravity=10,n.linkDistance=10,n.alpha=1,n.alphaMin=.001,n.alphaDecay=1-Math.pow(n.alphaMin,1/300),n.alphaTarget=0,n.velocityDecay=.6,n.edgeStrength=.6,n.nodeStrength=30,n.preventOverlap=!1,n.preventNodeOverlap=!1,n.preventComboOverlap=!1,n.collideStrength=void 0,n.nodeCollideStrength=.5,n.comboCollideStrength=.5,n.comboSpacing=20,n.comboPadding=10,n.optimizeRangeFactor=1,n.onTick=function(){},n.onLayoutEnd=function(){},n.depthAttractiveForceScale=1,n.depthRepulsiveForceScale=2,n.nodes=[],n.edges=[],n.combos=[],n.comboTrees=[],n.width=300,n.height=300,n.bias=[],n.nodeMap={},n.oriComboMap={},n.indexMap={},n.comboMap={},n.previousLayouted=!1,n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:100,center:[0,0],gravity:10,speed:1,comboGravity:30,preventOverlap:!1,preventComboOverlap:!0,preventNodeOverlap:!0,nodeSpacing:void 0,collideStrength:void 0,nodeCollideStrength:.5,comboCollideStrength:.5,comboSpacing:20,comboPadding:10,edgeStrength:.6,nodeStrength:30,linkDistance:10}},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.center;if(t.comboTree={id:"comboTreeRoot",depth:-1,children:t.comboTrees},!n||n.length===0){t.onLayoutEnd&&t.onLayoutEnd();return}if(n.length===1){n[0].x=i[0],n[0].y=i[1],t.onLayoutEnd&&t.onLayoutEnd();return}t.initVals(),t.run(),t.onLayoutEnd&&t.onLayoutEnd()},e.prototype.run=function(){var t=this,n=t.nodes,i=t.previousLayouted?t.maxIteration/5:t.maxIteration;!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight);var a=t.center,o=t.velocityDecay,s=t.comboMap;t.previousLayouted||t.initPos(s);for(var u=function(h){var d=[];n.forEach(function(v,p){d[p]={x:0,y:0}}),t.applyCalculate(d),t.applyComboCenterForce(d),n.forEach(function(v,p){!(0,Wt.isNumber)(v.x)||!(0,Wt.isNumber)(v.y)||(v.x+=d[p].x*o,v.y+=d[p].y*o)}),t.alpha+=(t.alphaTarget-t.alpha)*t.alphaDecay,t.onTick()},f=0;f<i;f++)u();var l=[0,0];n.forEach(function(h){!(0,Wt.isNumber)(h.x)||!(0,Wt.isNumber)(h.y)||(l[0]+=h.x,l[1]+=h.y)}),l[0]/=n.length,l[1]/=n.length;var c=[a[0]-l[0],a[1]-l[1]];n.forEach(function(h,d){!(0,Wt.isNumber)(h.x)||!(0,Wt.isNumber)(h.y)||(h.x+=c[0],h.y+=c[1])}),t.combos.forEach(function(h){var d=s[h.id];d&&d.empty&&(h.x=d.cx||h.x,h.y=d.cy||h.y)}),t.previousLayouted=!0},e.prototype.initVals=function(){var t=this,n=t.edges,i=t.nodes,a=t.combos,o={},s={},u={};i.forEach(function($,Y){s[$.id]=$,u[$.id]=Y}),t.nodeMap=s,t.indexMap=u;var f={};a.forEach(function($){f[$.id]=$}),t.oriComboMap=f,t.comboMap=t.getComboMap();var l=t.preventOverlap;t.preventComboOverlap=t.preventComboOverlap||l,t.preventNodeOverlap=t.preventNodeOverlap||l;var c=t.collideStrength;c&&(t.comboCollideStrength=c,t.nodeCollideStrength=c),t.comboCollideStrength=t.comboCollideStrength?t.comboCollideStrength:0,t.nodeCollideStrength=t.nodeCollideStrength?t.nodeCollideStrength:0;for(var h=0;h<n.length;++h){var d=(0,Wt.getEdgeTerminal)(n[h],"source"),v=(0,Wt.getEdgeTerminal)(n[h],"target");o[d]?o[d]++:o[d]=1,o[v]?o[v]++:o[v]=1}for(var p=[],h=0;h<n.length;++h){var d=(0,Wt.getEdgeTerminal)(n[h],"source"),v=(0,Wt.getEdgeTerminal)(n[h],"target");p[h]=o[d]/(o[d]+o[v])}this.bias=p;var g=t.nodeSize,y=t.nodeSpacing,m,b;if((0,Wt.isNumber)(y)?b=function(){return y}:(0,Wt.isFunction)(y)?b=y:b=function(){return 0},this.nodeSpacing=b,!g)m=function($){if($.size){if((0,Wt.isArray)($.size)){var Y=$.size[0]>$.size[1]?$.size[0]:$.size[1];return Y/2}if((0,Wt.isObject)($.size)){var Y=$.size.width>$.size.height?$.size.width:$.size.height;return Y/2}return $.size/2}return 10};else if((0,Wt.isFunction)(g))m=function($){return g($)};else if((0,Wt.isArray)(g)){var x=g[0]>g[1]?g[0]:g[1],w=x/2;m=function($){return w}}else{var E=g/2;m=function($){return E}}this.nodeSize=m;var _=t.comboSpacing,M;(0,Wt.isNumber)(_)?M=function(){return _}:(0,Wt.isFunction)(_)?M=_:M=function(){return 0},this.comboSpacing=M;var C=t.comboPadding,S;(0,Wt.isNumber)(C)?S=function(){return C}:(0,Wt.isArray)(C)?S=function(){return Math.max.apply(null,C)}:(0,Wt.isFunction)(C)?S=C:S=function(){return 0},this.comboPadding=S;var A=this.linkDistance,T;A||(A=10),(0,Wt.isNumber)(A)?T=function($){return A}:T=A,this.linkDistance=T;var k=this.edgeStrength,O;k||(k=1),(0,Wt.isNumber)(k)?O=function($){return k}:O=k,this.edgeStrength=O;var F=this.nodeStrength,D;F||(F=30),(0,Wt.isNumber)(F)?D=function($){return F}:D=F,this.nodeStrength=D},e.prototype.initPos=function(t){var n=this,i=n.nodes;i.forEach(function(a,o){var s=a.comboId,u=t[s];s&&u?(a.x=u.cx+100/(o+1),a.y=u.cy+100/(o+1)):(a.x=100/(o+1),a.y=100/(o+1))})},e.prototype.getComboMap=function(){var t=this,n=t.nodeMap,i=t.comboTrees,a=t.oriComboMap,o={};return(i||[]).forEach(function(s){var u=[];(0,Wt.traverseTreeUp)(s,function(f){if(f.itemType==="node"||!a[f.id])return!0;if(o[f.id]===void 0){var l={id:f.id,name:f.id,cx:0,cy:0,count:0,depth:t.oriComboMap[f.id].depth||0,children:[]};o[f.id]=l}var c=f.children;c&&c.forEach(function(v){if(!o[v.id]&&!n[v.id])return!0;u.push(v)});var h=o[f.id];if(h.cx=0,h.cy=0,u.length===0){h.empty=!0;var d=a[f.id];h.cx=d.x,h.cy=d.y}return u.forEach(function(v){if(h.count++,v.itemType!=="node"){var p=o[v.id];(0,Wt.isNumber)(p.cx)&&(h.cx+=p.cx),(0,Wt.isNumber)(p.cy)&&(h.cy+=p.cy);return}var g=n[v.id];g&&((0,Wt.isNumber)(g.x)&&(h.cx+=g.x),(0,Wt.isNumber)(g.y)&&(h.cy+=g.y))}),h.cx/=h.count||1,h.cy/=h.count||1,h.children=u,!0})}),o},e.prototype.applyComboCenterForce=function(t){var n=this,i=n.gravity,a=n.comboGravity||i,o=this.alpha,s=n.comboTrees,u=n.indexMap,f=n.nodeMap,l=n.comboMap;(s||[]).forEach(function(c){(0,Wt.traverseTreeUp)(c,function(h){if(h.itemType==="node")return!0;var d=l[h.id];if(!d)return!0;var v=l[h.id],p=(v.depth+1)/10*.5,g=v.cx,y=v.cy;return v.cx=0,v.cy=0,v.children.forEach(function(m){if(m.itemType!=="node"){var b=l[m.id];b&&(0,Wt.isNumber)(b.cx)&&(v.cx+=b.cx),b&&(0,Wt.isNumber)(b.cy)&&(v.cy+=b.cy);return}var x=f[m.id],w=x.x-g||.005,E=x.y-y||.005,_=Math.sqrt(w*w+E*E),M=u[x.id],C=a*o/_*p;t[M].x-=w*C,t[M].y-=E*C,(0,Wt.isNumber)(x.x)&&(v.cx+=x.x),(0,Wt.isNumber)(x.y)&&(v.cy+=x.y)}),v.cx/=v.count||1,v.cy/=v.count||1,!0})})},e.prototype.applyCalculate=function(t){var n=this,i=n.comboMap,a=n.nodes,o={};a.forEach(function(u,f){a.forEach(function(l,c){if(!(f<c)){var h=u.x-l.x||.005,d=u.y-l.y||.005,v=h*h+d*d,p=Math.sqrt(v);v<1&&(v=p),o["".concat(u.id,"-").concat(l.id)]={vx:h,vy:d,vl2:v,vl:p},o["".concat(l.id,"-").concat(u.id)]={vl2:v,vl:p,vx:-h,vy:-d}}})}),n.updateComboSizes(i),n.calRepulsive(t,o),n.calAttractive(t,o);var s=n.preventComboOverlap;s&&n.comboNonOverlapping(t,i)},e.prototype.updateComboSizes=function(t){var n=this,i=n.comboTrees,a=n.nodeMap,o=n.nodeSize,s=n.comboSpacing,u=n.comboPadding;(i||[]).forEach(function(f){var l=[];(0,Wt.traverseTreeUp)(f,function(c){if(c.itemType==="node")return!0;var h=t[c.id];if(!h)return!1;var d=c.children;d&&d.forEach(function(g){!t[g.id]&&!a[g.id]||l.push(g)}),h.minX=1/0,h.minY=1/0,h.maxX=-1/0,h.maxY=-1/0,l.forEach(function(g){if(g.itemType!=="node")return!0;var y=a[g.id];if(!y)return!0;var m=o(y),b=y.x-m,x=y.y-m,w=y.x+m,E=y.y+m;h.minX>b&&(h.minX=b),h.minY>x&&(h.minY=x),h.maxX<w&&(h.maxX=w),h.maxY<E&&(h.maxY=E)});var v=n.oriComboMap[c.id].size||10;(0,Wt.isArray)(v)&&(v=v[0]);var p=Math.max(h.maxX-h.minX,h.maxY-h.minY,v);return h.r=p/2+s(h)/2+u(h),!0})})},e.prototype.comboNonOverlapping=function(t,n){var i=this,a=i.comboTree,o=i.comboCollideStrength,s=i.indexMap,u=i.nodeMap;(0,Wt.traverseTreeUp)(a,function(f){if(!n[f.id]&&!u[f.id]&&f.id!=="comboTreeRoot")return!1;var l=f.children;return l&&l.length>1&&l.forEach(function(c,h){if(c.itemType==="node")return!1;var d=n[c.id];d&&l.forEach(function(v,p){if(h<=p||v.itemType==="node")return!1;var g=n[v.id];if(!g)return!1;var y=d.cx-g.cx||.005,m=d.cy-g.cy||.005,b=y*y+m*m,x=d.r||1,w=g.r||1,E=x+w,_=w*w,M=x*x;if(b<E*E){var C=c.children;if(!C||C.length===0)return!1;var S=v.children;if(!S||S.length===0)return!1;var A=Math.sqrt(b),T=(E-A)/A*o,k=y*T,O=m*T,F=_/(M+_),D=1-F;C.forEach(function($){if($.itemType!=="node")return!1;if(u[$.id]){var Y=s[$.id];S.forEach(function(N){if(N.itemType!=="node"||!u[N.id])return!1;var P=s[N.id];t[Y].x+=k*F,t[Y].y+=O*F,t[P].x-=k*D,t[P].y-=O*D})}})}})}),!0})},e.prototype.calRepulsive=function(t,n){var i=this,a=i.nodes,o=i.width*i.optimizeRangeFactor,s=i.nodeStrength,u=i.alpha,f=i.nodeCollideStrength,l=i.preventNodeOverlap,c=i.nodeSize,h=i.nodeSpacing,d=i.depthRepulsiveForceScale,v=i.center;a.forEach(function(p,g){if(!(!p.x||!p.y)){if(v){var y=i.gravity,m=p.x-v[0]||.005,b=p.y-v[1]||.005,x=Math.sqrt(m*m+b*b);t[g].x-=m*y*u/x,t[g].y-=b*y*u/x}a.forEach(function(w,E){if(g!==E&&!(!w.x||!w.y)){var _=n["".concat(p.id,"-").concat(w.id)],M=_.vl2,C=_.vl;if(!(C>o)){var S=n["".concat(p.id,"-").concat(w.id)],A=S.vx,T=S.vy,k=Math.log(Math.abs(w.depth-p.depth)/10)+1||1;k=k<1?1:k,w.comboId!==p.comboId&&(k+=1);var O=k?Math.pow(d,k):1,F=s(w)*u/M*O;if(t[g].x+=A*F,t[g].y+=T*F,g<E&&l){var D=c(p)+h(p)||1,$=c(w)+h(w)||1,Y=D+$;if(M<Y*Y){var N=(Y-C)/C*f,P=$*$,W=P/(D*D+P),J=A*N,te=T*N;t[g].x+=J*W,t[g].y+=te*W,W=1-W,t[E].x-=J*W,t[E].y-=te*W}}}}})}})},e.prototype.calAttractive=function(t,n){var i=this,a=i.edges,o=i.linkDistance,s=i.alpha,u=i.edgeStrength,f=i.bias,l=i.depthAttractiveForceScale;a.forEach(function(c,h){var d=(0,Wt.getEdgeTerminal)(c,"source"),v=(0,Wt.getEdgeTerminal)(c,"target");if(!(!d||!v||d===v)){var p=i.indexMap[d],g=i.indexMap[v],y=i.nodeMap[d],m=i.nodeMap[v];if(!(!y||!m)){var b=y.depth===m.depth?0:Math.log(Math.abs(y.depth-m.depth)/10);y.comboId===m.comboId&&(b=b/2);var x=b?Math.pow(l,b):1;if(y.comboId!==m.comboId&&x===1?x=l/2:y.comboId===m.comboId&&(x=2),!(!(0,Wt.isNumber)(m.x)||!(0,Wt.isNumber)(y.x)||!(0,Wt.isNumber)(m.y)||!(0,Wt.isNumber)(y.y))){var w=n["".concat(v,"-").concat(d)],E=w.vl,_=w.vx,M=w.vy,C=(E-o(c))/E*s*u(c)*x,S=_*C,A=M*C,T=f[h];t[g].x-=S*T,t[g].y-=A*T,t[p].x+=S*(1-T),t[p].y+=A*(1-T)}}}})},e.prototype.getType=function(){return"comboForce"},e}(pfe.Base);vc.ComboForceLayout=gfe;var Ff={},qS;function GO(){if(qS)return Ff;qS=1;var r=xe&&xe.__extends||function(){var s=function(u,f){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,c){l.__proto__=c}||function(l,c){for(var h in c)Object.prototype.hasOwnProperty.call(c,h)&&(l[h]=c[h])},s(u,f)};return function(u,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");s(u,f);function l(){this.constructor=u}u.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}}(),e=xe&&xe.__assign||function(){return e=Object.assign||function(s){for(var u,f=1,l=arguments.length;f<l;f++){u=arguments[f];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(s[c]=u[c])}return s},e.apply(this,arguments)};Object.defineProperty(Ff,"__esModule",{value:!0}),Ff.ComboCombinedLayout=void 0;var t=Ua,n=zr,i=Or(),a=VO(),o=function(s){r(u,s);function u(f){var l=s.call(this)||this;return l.center=[0,0],l.nodes=[],l.edges=[],l.combos=[],l.comboEdges=[],l.comboPadding=10,l.comboTrees=[],l.updateCfg(f),l}return u.prototype.getDefaultCfg=function(){return{}},u.prototype.execute=function(){var f=this,l=f.nodes,c=f.center;if(!l||l.length===0){f.onLayoutEnd&&f.onLayoutEnd();return}if(l.length===1){l[0].x=c[0],l[0].y=c[1],f.onLayoutEnd&&f.onLayoutEnd();return}f.initVals(),f.run(),f.onLayoutEnd&&f.onLayoutEnd()},u.prototype.run=function(){var f,l=this,c=l.nodes,h=l.edges,d=l.combos,v=l.comboEdges,p=l.center,g={};c.forEach(function(F){g[F.id]=F});var y={};d.forEach(function(F){y[F.id]=F});var m=l.getInnerGraphs(g),b=[],x=[],w={},E=!0;this.comboTrees.forEach(function(F){var D=m[F.id];if(D){var $=e(e({},F),{x:D.x||y[F.id].x,y:D.y||y[F.id].y,fx:D.fx||y[F.id].fx,fy:D.fy||y[F.id].fy,mass:D.mass||y[F.id].mass,size:D.size});x.push($),!isNaN($.x)&&$.x!==0&&!isNaN($.y)&&$.y!==0?E=!1:($.x=Math.random()*100,$.y=Math.random()*100),b.push(F.id),(0,i.traverseTreeUp)(F,function(Y){return Y.id!==F.id&&(w[Y.id]=F.id),!0})}}),c.forEach(function(F){if(!(F.comboId&&y[F.comboId])){var D=e({},F);x.push(D),!isNaN(D.x)&&D.x!==0&&!isNaN(D.y)&&D.y!==0?E=!1:(D.x=Math.random()*100,D.y=Math.random()*100),b.push(F.id)}});var _=[];if(h.concat(v).forEach(function(F){var D=w[F.source]||F.source,$=w[F.target]||F.target;D!==$&&b.includes(D)&&b.includes($)&&_.push({source:D,target:$})}),x!=null&&x.length){if(x.length===1)x[0].x=p[0],x[0].y=p[1];else{var M={nodes:x,edges:_},C=this.outerLayout||new a.GForceLayout({gravity:1,factor:4,linkDistance:function(F,D,$){var Y,N,P=((((Y=D.size)===null||Y===void 0?void 0:Y[0])||30)+(((N=$.size)===null||N===void 0?void 0:N[0])||30))/2;return Math.min(P*1.5,700)}}),S=(f=C.getType)===null||f===void 0?void 0:f.call(C);if(C.updateCfg({center:p,kg:5,preventOverlap:!0,animate:!1}),E&&t.FORCE_LAYOUT_TYPE_MAP[S]){var A=x.length<100?new a.MDSLayout:new a.GridLayout;A.layout(M)}C.layout(M)}x.forEach(function(F){var D=m[F.id];if(!D){var $=g[F.id];$&&($.x=F.x,$.y=F.y);return}D.visited=!0,D.x=F.x,D.y=F.y,D.nodes.forEach(function(Y){Y.x+=F.x,Y.y+=F.y})})}for(var T=Object.keys(m),k=function(F){var D=T[F],$=m[D];if(!$)return"continue";$.nodes.forEach(function(Y){$.visited||(Y.x+=$.x||0,Y.y+=$.y||0),g[Y.id]&&(g[Y.id].x=Y.x,g[Y.id].y=Y.y)}),y[D]&&(y[D].x=$.x,y[D].y=$.y)},O=T.length-1;O>=0;O--)k(O);return{nodes:c,edges:h,combos:d,comboEdges:v}},u.prototype.getInnerGraphs=function(f){var l=this,c=l.comboTrees,h=l.nodeSize,d=l.edges,v=l.comboPadding,p=l.spacing,g={},y=this.innerLayout||new a.ConcentricLayout({type:"concentric",sortBy:"id"});return y.center=[0,0],y.preventOverlap=!0,y.nodeSpacing=p,(c||[]).forEach(function(m){(0,i.traverseTreeUp)(m,function(b){var x,w=(v==null?void 0:v(b))||10;if((0,i.isArray)(w)&&(w=Math.max.apply(Math,w)),!((x=b.children)===null||x===void 0)&&x.length){var _=b.children.map(function(N){if(N.itemType==="combo")return g[N.id];var P=f[N.id]||{};return e(e({},P),N)}),M=_.map(function(N){return N.id}),C={nodes:_,edges:d.filter(function(N){return M.includes(N.source)&&M.includes(N.target)})},S=1/0;_.forEach(function(N){var P;N.size||(N.size=((P=g[N.id])===null||P===void 0?void 0:P.size)||(h==null?void 0:h(N))||[30,30]),(0,i.isNumber)(N.size)&&(N.size=[N.size,N.size]),S>N.size[0]&&(S=N.size[0]),S>N.size[1]&&(S=N.size[1])}),y.layout(C);var A=(0,i.getLayoutBBox)(_),T=A.minX,k=A.minY,O=A.maxX,F=A.maxY,D={x:(O+T)/2,y:(F+k)/2};C.nodes.forEach(function(N){N.x-=D.x,N.y-=D.y});var $=Math.max(O-T,S)+w*2,Y=Math.max(F-k,S)+w*2;g[b.id]={id:b.id,nodes:_,size:[$,Y]}}else if(b.itemType==="combo"){var E=w?[w*2,w*2]:[30,30];g[b.id]={id:b.id,nodes:[],size:E}}return!0})}),g},u.prototype.initVals=function(){var f=this,l=f.nodeSize,c=f.spacing,h,d;if((0,i.isNumber)(c)?d=function(){return c}:(0,i.isFunction)(c)?d=c:d=function(){return 0},this.spacing=d,!l)h=function(b){var x=d(b);if(b.size){if((0,i.isArray)(b.size)){var w=b.size[0]>b.size[1]?b.size[0]:b.size[1];return(w+x)/2}if((0,i.isObject)(b.size)){var w=b.size.width>b.size.height?b.size.width:b.size.height;return(w+x)/2}return(b.size+x)/2}return 10+x/2};else if((0,i.isFunction)(l))h=function(b){var x=l(b),w=d(b);if((0,i.isArray)(b.size)){var E=b.size[0]>b.size[1]?b.size[0]:b.size[1];return(E+w)/2}return((x||10)+w)/2};else if((0,i.isArray)(l)){var v=l[0]>l[1]?l[0]:l[1],p=v/2;h=function(b){return p+d(b)/2}}else{var g=l/2;h=function(b){return g+d(b)/2}}this.nodeSize=h;var y=f.comboPadding,m;(0,i.isNumber)(y)?m=function(){return y}:(0,i.isArray)(y)?m=function(){return Math.max.apply(null,y)}:(0,i.isFunction)(y)?m=y:m=function(){return 0},this.comboPadding=m},u.prototype.getType=function(){return"comboCombined"},u}(n.Base);return Ff.ComboCombinedLayout=o,Ff}var pc={},vb={};Object.defineProperty(vb,"__esModule",{value:!0});var yfe=function(){function r(e){this.id=e.id||0,this.rx=e.rx,this.ry=e.ry,this.fx=0,this.fy=0,this.mass=e.mass,this.degree=e.degree,this.g=e.g||0}return r.prototype.distanceTo=function(e){var t=this.rx-e.rx,n=this.ry-e.ry;return Math.hypot(t,n)},r.prototype.setPos=function(e,t){this.rx=e,this.ry=t},r.prototype.resetForce=function(){this.fx=0,this.fy=0},r.prototype.addForce=function(e){var t=e.rx-this.rx,n=e.ry-this.ry,i=Math.hypot(t,n);i=i<1e-4?1e-4:i;var a=this.g*(this.degree+1)*(e.degree+1)/i;this.fx+=a*t/i,this.fy+=a*n/i},r.prototype.in=function(e){return e.contains(this.rx,this.ry)},r.prototype.add=function(e){var t=this.mass+e.mass,n=(this.rx*this.mass+e.rx*e.mass)/t,i=(this.ry*this.mass+e.ry*e.mass)/t,a=this.degree+e.degree,o={rx:n,ry:i,mass:t,degree:a};return new r(o)},r}();vb.default=yfe;var pb={};Object.defineProperty(pb,"__esModule",{value:!0});var mfe=function(){function r(e){this.xmid=e.xmid,this.ymid=e.ymid,this.length=e.length,this.massCenter=e.massCenter||[0,0],this.mass=e.mass||1}return r.prototype.getLength=function(){return this.length},r.prototype.contains=function(e,t){var n=this.length/2;return e<=this.xmid+n&&e>=this.xmid-n&&t<=this.ymid+n&&t>=this.ymid-n},r.prototype.NW=function(){var e=this.xmid-this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n},a=new r(i);return a},r.prototype.NE=function(){var e=this.xmid+this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n},a=new r(i);return a},r.prototype.SW=function(){var e=this.xmid-this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n},a=new r(i);return a},r.prototype.SE=function(){var e=this.xmid+this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n},a=new r(i);return a},r}();pb.default=mfe;var gb={};Object.defineProperty(gb,"__esModule",{value:!0});var bfe=function(){function r(e){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,e!=null&&(this.quad=e)}return r.prototype.insert=function(e){if(this.body==null){this.body=e;return}this._isExternal()?(this.quad&&(this.NW=new r(this.quad.NW()),this.NE=new r(this.quad.NE()),this.SW=new r(this.quad.SW()),this.SE=new r(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))},r.prototype._putBody=function(e){this.quad&&(e.in(this.quad.NW())&&this.NW?this.NW.insert(e):e.in(this.quad.NE())&&this.NE?this.NE.insert(e):e.in(this.quad.SW())&&this.SW?this.SW.insert(e):e.in(this.quad.SE())&&this.SE&&this.SE.insert(e))},r.prototype._isExternal=function(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null},r.prototype.updateForce=function(e){if(!(this.body==null||e===this.body))if(this._isExternal())e.addForce(this.body);else{var t=this.quad?this.quad.getLength():0,n=this.body.distanceTo(e);t/n<this.theta?e.addForce(this.body):(this.NW&&this.NW.updateForce(e),this.NE&&this.NE.updateForce(e),this.SW&&this.SW.updateForce(e),this.SE&&this.SE.updateForce(e))}},r}();gb.default=bfe;var xfe=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),yb=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(pc,"__esModule",{value:!0});pc.ForceAtlas2Layout=void 0;var wfe=zr,Na=Or(),Efe=yb(vb),_fe=yb(pb),Sfe=yb(gb),Mfe=function(r){xfe(e,r);function e(t){var n=r.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(t),n}return e.prototype.getDefaultCfg=function(){return{}},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.onLayoutEnd,a=t.prune,o=t.maxIteration;!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight);for(var s=[],u=n.length,f=0;f<u;f+=1){var l=n[f],c=10,h=10;(0,Na.isNumber)(l.size)&&(c=l.size,h=l.size),(0,Na.isArray)(l.size)?(isNaN(l.size[0])||(c=l.size[0]),isNaN(l.size[1])||(h=l.size[1])):(0,Na.isObject)(l.size)&&(c=l.size.width,h=l.size.height),t.getWidth&&!isNaN(t.getWidth(l))&&(h=t.getWidth(l)),t.getHeight&&!isNaN(t.getHeight(l))&&(c=t.getHeight(l));var d=Math.max(c,h);s.push(d)}t.barnesHut===void 0&&u>250&&(t.barnesHut=!0),t.prune===void 0&&u>100&&(t.prune=!0),this.maxIteration===0&&!t.prune?(o=250,u<=200&&u>100?o=1e3:u>200&&(o=1200),this.maxIteration=o):this.maxIteration===0&&a&&(o=100,u<=200&&u>100?o=500:u>200&&(o=950),this.maxIteration=o),t.kr||(t.kr=50,u>100&&u<=500?t.kr=20:u>500&&(t.kr=1)),t.kg||(t.kg=20,u>100&&u<=500?t.kg=10:u>500&&(t.kg=1)),this.nodes=t.updateNodesByForces(s),i()},e.prototype.updateNodesByForces=function(t){for(var n=this,i=n.edges,a=n.maxIteration,o=n.nodes,s=i.filter(function(_){var M=(0,Na.getEdgeTerminal)(_,"source"),C=(0,Na.getEdgeTerminal)(_,"target");return M!==C}),u=o.length,f=s.length,l=[],c={},h={},d=[],v=0;v<u;v+=1)c[o[v].id]=v,l[v]=0,(o[v].x===void 0||isNaN(o[v].x))&&(o[v].x=Math.random()*1e3),(o[v].y===void 0||isNaN(o[v].y))&&(o[v].y=Math.random()*1e3),d.push({x:o[v].x,y:o[v].y});for(var v=0;v<f;v+=1){for(var p=void 0,g=void 0,y=0,m=0,b=0;b<u;b+=1){var x=(0,Na.getEdgeTerminal)(s[v],"source"),w=(0,Na.getEdgeTerminal)(s[v],"target");o[b].id===x?(p=o[b],y=b):o[b].id===w&&(g=o[b],m=b),h[v]={sourceIdx:y,targetIdx:m}}p&&(l[c[p.id]]+=1),g&&(l[c[g.id]]+=1)}var E=a;if(o=this.iterate(E,c,h,f,l,t),n.prune){for(var b=0;b<f;b+=1)l[h[b].sourceIdx]<=1?(o[h[b].sourceIdx].x=o[h[b].targetIdx].x,o[h[b].sourceIdx].y=o[h[b].targetIdx].y):l[h[b].targetIdx]<=1&&(o[h[b].targetIdx].x=o[h[b].sourceIdx].x,o[h[b].targetIdx].y=o[h[b].sourceIdx].y);n.prune=!1,n.barnesHut=!1,E=100,o=this.iterate(E,c,h,f,l,t)}return o},e.prototype.iterate=function(t,n,i,a,o,s){for(var u=this,f=u.nodes,l=u.kr,c=u.preventOverlap,h=u.barnesHut,d=f.length,v=0,p=100,g=t,y=50,m=[],b=[],x=[],w=0;w<d;w+=1)if(m[2*w]=0,m[2*w+1]=0,h){var E={id:w,rx:f[w].x,ry:f[w].y,mass:1,g:l,degree:o[w]};x[w]=new Efe.default(E)}for(;g>0;){for(var w=0;w<d;w+=1)b[2*w]=m[2*w],b[2*w+1]=m[2*w+1],m[2*w]=0,m[2*w+1]=0;m=this.getAttrForces(g,y,a,n,i,o,s,m),h&&(c&&g>y||!c)?m=this.getOptRepGraForces(m,x,o):m=this.getRepGraForces(g,y,m,p,s,o);var _=this.updatePos(m,b,v,o);f=_.nodes,v=_.sg,g--,u.tick&&u.tick()}return f},e.prototype.getAttrForces=function(t,n,i,a,o,s,u,f){for(var l=this,c=l.nodes,h=l.preventOverlap,d=l.dissuadeHubs,v=l.mode,p=l.prune,g=0;g<i;g+=1){var y=c[o[g].sourceIdx],m=o[g].sourceIdx,b=c[o[g].targetIdx],x=o[g].targetIdx;if(!(p&&(s[m]<=1||s[x]<=1))){var w=[b.x-y.x,b.y-y.y],E=Math.hypot(w[0],w[1]);E=E<1e-4?1e-4:E,w[0]=w[0]/E,w[1]=w[1]/E,h&&t<n&&(E=E-u[m]-u[x]);var _=E,M=_;v==="linlog"&&(_=Math.log(1+E),M=_),d&&(_=E/s[m],M=E/s[x]),h&&t<n&&E<=0?(_=0,M=0):h&&t<n&&E>0&&(_=E,M=E),f[2*a[y.id]]+=_*w[0],f[2*a[b.id]]-=M*w[0],f[2*a[y.id]+1]+=_*w[1],f[2*a[b.id]+1]-=M*w[1]}}return f},e.prototype.getRepGraForces=function(t,n,i,a,o,s){for(var u=this,f=u.nodes,l=u.preventOverlap,c=u.kr,h=u.kg,d=u.center,v=u.prune,p=f.length,g=0;g<p;g+=1){for(var y=g+1;y<p;y+=1)if(!(v&&(s[g]<=1||s[y]<=1))){var m=[f[y].x-f[g].x,f[y].y-f[g].y],b=Math.hypot(m[0],m[1]);b=b<1e-4?1e-4:b,m[0]=m[0]/b,m[1]=m[1]/b,l&&t<n&&(b=b-o[g]-o[y]);var x=c*(s[g]+1)*(s[y]+1)/b;l&&t<n&&b<0?x=a*(s[g]+1)*(s[y]+1):l&&t<n&&b===0?x=0:l&&t<n&&b>0&&(x=c*(s[g]+1)*(s[y]+1)/b),i[2*g]-=x*m[0],i[2*y]+=x*m[0],i[2*g+1]-=x*m[1],i[2*y+1]+=x*m[1]}var w=[f[g].x-d[0],f[g].y-d[1]],E=Math.hypot(w[0],w[1]);w[0]=w[0]/E,w[1]=w[1]/E;var _=h*(s[g]+1);i[2*g]-=_*w[0],i[2*g+1]-=_*w[1]}return i},e.prototype.getOptRepGraForces=function(t,n,i){for(var a=this,o=a.nodes,s=a.kg,u=a.center,f=a.prune,l=o.length,c=9e10,h=-9e10,d=9e10,v=-9e10,p=0;p<l;p+=1)f&&i[p]<=1||(n[p].setPos(o[p].x,o[p].y),o[p].x>=h&&(h=o[p].x),o[p].x<=c&&(c=o[p].x),o[p].y>=v&&(v=o[p].y),o[p].y<=d&&(d=o[p].y));for(var g=Math.max(h-c,v-d),y={xmid:(h+c)/2,ymid:(v+d)/2,length:g,massCenter:u,mass:l},m=new _fe.default(y),b=new Sfe.default(m),p=0;p<l;p+=1)f&&i[p]<=1||n[p].in(m)&&b.insert(n[p]);for(var p=0;p<l;p+=1)if(!(f&&i[p]<=1)){n[p].resetForce(),b.updateForce(n[p]),t[2*p]-=n[p].fx,t[2*p+1]-=n[p].fy;var x=[o[p].x-u[0],o[p].y-u[1]],w=Math.hypot(x[0],x[1]);w=w<1e-4?1e-4:w,x[0]=x[0]/w,x[1]=x[1]/w;var E=s*(i[p]+1);t[2*p]-=E*x[0],t[2*p+1]-=E*x[1]}return t},e.prototype.updatePos=function(t,n,i,a){for(var o=this,s=o.nodes,u=o.ks,f=o.tao,l=o.prune,c=o.ksmax,h=s.length,d=[],v=[],p=0,g=0,y=0;y<h;y+=1)if(!(l&&a[y]<=1)){var m=[t[2*y]-n[2*y],t[2*y+1]-n[2*y+1]],b=Math.hypot(m[0],m[1]),x=[t[2*y]+n[2*y],t[2*y+1]+n[2*y+1]],w=Math.hypot(x[0],x[1]);d[y]=b,v[y]=w/2,p+=(a[y]+1)*d[y],g+=(a[y]+1)*v[y]}var E=i;i=f*g/p,E!==0&&(i=i>1.5*E?1.5*E:i);for(var y=0;y<h;y+=1)if(!(l&&a[y]<=1)&&!((0,Na.isNumber)(s[y].fx)&&(0,Na.isNumber)(s[y].fy))){var _=u*i/(1+i*Math.sqrt(d[y])),M=Math.hypot(t[2*y],t[2*y+1]);M=M<1e-4?1e-4:M;var C=c/M;_=_>C?C:_;var S=_*t[2*y],A=_*t[2*y+1];s[y].x+=S,s[y].y+=A}return{nodes:s,sg:i}},e}(wfe.Base);pc.ForceAtlas2Layout=Mfe;var gc={},mb={},bb={},xb={},Eu=xe&&xe.__assign||function(){return Eu=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Eu.apply(this,arguments)};Object.defineProperty(xb,"__esModule",{value:!0});var Cfe=function(){function r(){this.cells=[],this.columnNum=0,this.rowNum=0,this.additionColumn=[],this.additionRow=[]}return r.prototype.init=function(e,t,n){this.cells=[],this.CELL_W=n.CELL_W||r.DEFAULT_CELL_W,this.CELL_H=n.CELL_H||r.DEFAULT_CELL_H,this.columnNum=Math.ceil(e/this.CELL_W),this.rowNum=Math.ceil(t/this.CELL_H),r.MIN_DIST=Math.pow(e,2)+Math.pow(t,2);for(var i=0;i<this.columnNum;i++){for(var a=[],o=0;o<this.rowNum;o++){var s={dx:i,dy:o,x:i*this.CELL_W,y:o*this.CELL_H,occupied:!1};a.push(s)}this.cells.push(a)}},r.prototype.findGridByNodeId=function(e){for(var t,n,i=0;i<this.columnNum;i++)for(var a=0;a<this.rowNum;a++)if(this.cells[i][a].node&&((n=(t=this.cells[i][a])===null||t===void 0?void 0:t.node)===null||n===void 0?void 0:n.id)===e)return{column:i,row:a};return null},r.prototype.sqdist=function(e,t){return Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)},r.prototype.occupyNearest=function(e){for(var t=r.MIN_DIST,n,i=null,a=0;a<this.columnNum;a++)for(var o=0;o<this.rowNum;o++)!this.cells[a][o].occupied&&(n=this.sqdist(e,this.cells[a][o]))<t&&(t=n,i=this.cells[a][o]);return i&&(i.occupied=!0),i},r.prototype.insertColumn=function(e,t){if(!(t<=0)){for(var n=0;n<t;n++){this.cells[n+this.columnNum]=[];for(var i=0;i<this.rowNum;i++)this.cells[n+this.columnNum][i]={dx:n,dy:i,x:n*this.CELL_W,y:i*this.CELL_H,occupied:!1,node:null}}for(var n=this.columnNum-1;n>e;n--)for(var i=0;i<this.rowNum;i++)this.cells[n+t][i]=Eu(Eu({},this.cells[n][i]),{x:(n+t)*this.CELL_W,y:i*this.CELL_H}),this.cells[n][i]={x:n*this.CELL_W,y:i*this.CELL_H,occupied:!0,node:null};for(var i=0;i<this.additionColumn.length;i++)this.additionColumn[i]>=e&&(this.additionColumn[i]+=t);for(var n=0;n<t;n++)this.additionColumn.push(e+n+1);this.columnNum+=t}},r.prototype.insertRow=function(e,t){if(!(t<=0)){for(var n=0;n<t;n++)for(var i=0;i<this.columnNum;i++)this.cells[i][n+this.rowNum]={dx:i,dy:n,x:i*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(var i=0;i<this.columnNum;i++)for(var n=this.rowNum-1;n>e;n--)this.cells[i][n+t]=Eu(Eu({},this.cells[i][n]),{dx:i,dy:n+t,x:i*this.CELL_W,y:(n+t)*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(var n=0;n<this.additionRow.length;n++)this.additionRow[n]>=e&&(this.additionRow[n]+=t);for(var i=0;i<t;i++)this.additionRow.push(e+i+1);this.rowNum+=t}},r.prototype.getNodes=function(){for(var e=[],t=0;t<this.columnNum;t++)for(var n=0;n<this.rowNum;n++)this.cells[t][n].node&&e.push(this.cells[t][n]);return e},r.MIN_DIST=50,r.DEFAULT_CELL_W=80,r.DEFAULT_CELL_H=80,r}();xb.default=Cfe;var Afe=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(bb,"__esModule",{value:!0});var Tfe=Afe(xb);function Ife(r,e){if(!r.nodes||r.nodes.length===0)return r;var t=e.width,n=e.height,i=e.nodeMinGap,a=1e4,o=1e4;r.nodes.forEach(function(m){var b=m.size[0]||50,x=m.size[1]||50;a=Math.min(b,a),o=Math.min(x,o)});var s=new Tfe.default;s.init(t,n,{CELL_H:o,CELL_W:a}),r.nodes.forEach(function(m){var b=s.occupyNearest(m);b&&(b.node={id:m.id,size:m.size},m.x=b.x,m.y=b.y,m.dx=b.dx,m.dy=b.dy)});for(var u=0;u<r.nodes.length;u++){var f=r.nodes[u],l=s.findGridByNodeId(f.id);if(!l)throw new Error("can not find node cell");var c=l.column,h=l.row;if(f.size[0]+i>a){for(var d=Math.ceil((f.size[0]+i)/a)-1,v=d,p=0;p<d;p++){var g=s.additionColumn.indexOf(c+p+1)>-1;if(g&&!s.cells[c+p+1][h].node)v--;else break}s.insertColumn(c,v)}if(f.size[1]+i>o){for(var d=Math.ceil((f.size[1]+i)/o)-1,v=d,p=0;p<d;p++){var g=s.additionRow.indexOf(h+p+1)>-1;if(g&&!s.cells[c][h+p+1].node)v--;else break}s.insertRow(h,v)}}for(var u=0;u<s.columnNum;u++)for(var y=function(b){var x=s.cells[u][b];if(x.node){var w=r.nodes.find(function(E){var _;return E.id===((_=x==null?void 0:x.node)===null||_===void 0?void 0:_.id)});w&&(w.x=x.x+w.size[0]/2,w.y=x.y+w.size[1]/2)}},p=0;p<s.rowNum;p++)y(p)}bb.default=Ife;var wb={};Object.defineProperty(wb,"__esModule",{value:!0});var zO=1200,$O=800,Bh=1e7,Gf=10,jO=3.141592653589793,p0=1.5707963267948966,kfe=jO*.375,Lfe=jO*.625,gd=new Map,Nfe=10,Ofe=10,g0=.8,ZS=.1,Dfe=.5;function Pfe(r,e,t){var n=r.x-r.size[0]/2,i=r.y-r.size[1]/2,a=r.x+r.size[0]/2,o=r.y+r.size[1]/2,s=e.x-e.size[0]/2,u=e.y-e.size[1]/2,f=e.x+e.size[0]/2,l=e.y+e.size[1]/2,c=r.x,h=r.y,d=e.x,v=e.y,p=d-c,g=Math.atan2(p,v-h),y=0,m=0,b=0,x=0;g>p0?(m=i-l,y=s-a,b=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)),x=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):0<g&&g<=p0?(m=u-o,y=s-a,m>y?b=x=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=x=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):g<-p0?(m=i-l,y=-(f-n),m>y?b=x=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=x=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):(m=u-o,Math.abs(p)>(a-n)/2?y=n-f:y=p,m>y?b=x=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=x=parseFloat(y&&g!==0?(y/Math.sin(g)).toFixed(2):m.toFixed(2)));var w=parseFloat(g.toFixed(2)),E=t;return t&&(E=kfe<w&&w<Lfe),{distance:Math.abs(b<x?b:x),isHoriz:E}}function UO(r,e){var t=gd.get(r.id)||[],n=t.find(function(D){return D.source===e.id||D.target===e.id}),i=r.size[0]*r.size[1],a=e.size[0]*e.size[1],o=i>a?e:r,s=i>a?r:e,u=o.x-o.size[0]/2,f=o.y-o.size[1]/2,l=o.x+o.size[0]/2,c=o.y+o.size[1]/2,h=s.x-s.size[0]/2,d=s.y-s.size[1]/2,v=s.x+s.size[0]/2,p=s.y+s.size[1]/2,g=o.x,y=o.y,m=s.x,b=s.y,x=l>=h&&v>=u&&c>=d&&p>=f,w=0,E=0;if(x){E=Math.sqrt(Math.pow(m-g,2)+Math.pow(b-y,2));var _=u>h?u:h,M=f>d?f:d,C=l<v?l:v,S=c<p?c:p,A=C-_,T=S-M,k=A*T;E===0&&(E=1e-7),w=Gf*1/E*100+k,w*=Bh}else{var O=!1,F=Pfe(o,s,O);E=F.distance,O=F.isHoriz,E<=Gf?E!==0?n?w+=Gf+Bh*1/E:w+=Gf+Bh*Gf/E:w+=Bh:(w+=E,n&&(w+=E*E))}return w}function XO(r){for(var e=0,t=0;t<r.length;t++){var n=r[t];(n.x<0||n.y<0||n.x>zO||n.y>$O)&&(e+=1e12);for(var i=t+1;i<r.length;i++)e+=UO(n,r[i])}return e}function Rfe(r,e,t,n){var i=new Map;t.forEach(function(g,y){i.set(g.id,g)});var a=n.filter(function(g){return g.source===r.id||g.target===r.id})||[],o=[];a.forEach(function(g){var y=g.source===r.id?g.target:g.source,m=i.get(y);m&&o.push(m)});for(var s=!0,u=0;u<o.length;u++){var f=o[u],l=Math.atan((r.y-f.y)/(f.x-r.y))*180,c=Math.atan((e.y-f.y)/(f.x-e.y))*180,h=l<30||l>150,d=c<30||c>150,v=l>70&&l<110,p=c>70&&c<110;if(h&&!d||l*c<0){s=!1;break}else if(v&&!p||l*c<0){s=!1;break}else if((f.x-r.x)*(f.x-e.x)<0){s=!1;break}else if((f.y-r.y)*(f.y-e.y)<0){s=!1;break}}return s}function Bfe(r,e){for(var t=!1,n=1,i=Nfe*n,a=Ofe*n,o=[i,-i,0,0],s=[0,0,a,-a],u=0;u<r.length;++u)for(var f=r[u],l=KS(f,r),c=0;c<o.length;c++){var h=Rfe(f,{x:f.x+o[c],y:f.y+s[c]},r,e);if(h){f.x+=o[c],f.y+=s[c];var d=KS(f,r),v=Math.random();d<l||v<g0&&v>ZS?(l=d,t=!0):(f.x-=o[c],f.y-=s[c])}}return g0>ZS&&(g0*=Dfe),t?XO(r):0}function KS(r,e){var t=0;(r.x<0||r.y<0||r.x+r.size[0]+20>zO||r.y+r.size[1]+20>$O)&&(t+=1e12);for(var n=0;n<e.length;++n)r.id!==e[n].id&&(t+=UO(r,e[n]));return t}function Ffe(r,e){if(r.length===0)return{nodes:r,edges:e};r.forEach(function(f){var l=e.filter(function(c){return c.source===f.id||c.target===f.id});gd.set(f,l)}),r.sort(function(f,l){var c,h;return((c=gd.get(f.id))===null||c===void 0?void 0:c.length)-((h=gd.get(l.id))===null||h===void 0?void 0:h.length)});for(var t=XO(r),n=20,i=1,a=0,o=50,s=0;n>0&&(s++,!(s>=o));){var u=Bfe(r,e);u!==0&&(a=u),i=a-t,t=a,i===0?--n:n=20}return r.forEach(function(f){f.x=f.x-f.size[0]/2,f.y=f.y-f.size[1]/2}),{nodes:r,edges:e}}wb.default=Ffe;var Wy=xe&&xe.__assign||function(){return Wy=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Wy.apply(this,arguments)},Gfe=xe&&xe.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),zfe=xe&&xe.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),$fe=xe&&xe.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Gfe(e,r,t);return zfe(e,r),e},YO=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(mb,"__esModule",{value:!0});var cu=$fe(v1),jfe=YO(bb),Ufe=YO(wb),Xfe=Ju;function Yfe(r,e){var t=r.nodes,n=r.edges,i=e.width,a=e.height;if(!(t!=null&&t.length))return Promise.resolve();var o=[];t.forEach(function(v){var p=n.filter(function(y){return y.source===v.id||y.target===v.id});if(p.length>1){var g=Wy({},v);delete g.size,o.push(g)}});var s=[];n.forEach(function(v){var p=o.find(function(y){return y.id===v.source}),g=o.find(function(y){return y.id===v.target});p&&g&&s.push(v)});var u=new Xfe.DagreLayout({type:"dagre",ranksep:e.nodeMinGap,nodesep:e.nodeMinGap}),f=u.layout({nodes:o,edges:s}).nodes;t.forEach(function(v){var p=(f||[]).find(function(g){return g.id===v.id});v.x=(p==null?void 0:p.x)||i/2,v.y=(p==null?void 0:p.y)||a/2});var l=JSON.parse(JSON.stringify(t)),c=JSON.parse(JSON.stringify(n)),h=cu.forceSimulation().nodes(l).force("link",cu.forceLink(c).id(function(v){return v.id}).distance(function(v){var p=s.find(function(g){return g.source===v.source&&g.target===v.target});return p?30:20})).force("charge",cu.forceManyBody()).force("center",cu.forceCenter(i/2,a/2)).force("x",cu.forceX(i/2)).force("y",cu.forceY(a/2)).alpha(.3).alphaDecay(.08).alphaMin(.001),d=new Promise(function(v){h.on("end",function(){t.forEach(function(w){var E=l.find(function(_){return _.id===w.id});E&&(w.x=E.x,w.y=E.y)});var p=Math.min.apply(Math,t.map(function(w){return w.x})),g=Math.max.apply(Math,t.map(function(w){return w.x})),y=Math.min.apply(Math,t.map(function(w){return w.y})),m=Math.max.apply(Math,t.map(function(w){return w.y})),b=i/(g-p),x=a/(m-y);t.forEach(function(w){w.x!==void 0&&b<1&&(w.x=(w.x-p)*b),w.y!==void 0&&x<1&&(w.y=(w.y-y)*x)}),t.forEach(function(w){w.sizeTemp=w.size,w.size=[10,10]}),(0,Ufe.default)(t,n),t.forEach(function(w){w.size=w.sizeTemp||[],delete w.sizeTemp}),(0,jfe.default)({nodes:t,edges:n},e),v()})});return d}mb.default=Yfe;var Wfe=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Vfe=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(gc,"__esModule",{value:!0});gc.ERLayout=void 0;var Hfe=zr,qfe=Vfe(mb),Zfe=function(r){Wfe(e,r);function e(t){var n=r.call(this)||this;return n.width=300,n.height=300,n.nodeMinGap=50,n.onLayoutEnd=function(){},t&&n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{width:300,height:300,nodeMinGap:50}},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.edges;return n==null||n.forEach(function(a){a.size||(a.size=[50,50])}),(0,qfe.default)({nodes:n,edges:i},{width:this.width,height:this.height,nodeMinGap:this.nodeMinGap}).then(function(){t.onLayoutEnd&&t.onLayoutEnd()})},e.prototype.getType=function(){return"er"},e}(Hfe.Base);gc.ERLayout=Zfe;var is={},QS;function Kfe(){if(QS)return is;QS=1,Object.defineProperty(is,"__esModule",{value:!0}),is.Layouts=is.Layout=void 0;var r=$a,e=Kl,t=Ql,n=ec,i=Jl,a=d1,o=tc,s=Ju,u=ub,f=fc,l=lc,c=cc,h=hc,d=dc,v=vc,p=GO(),g=pc,y=gc,m=ic,b=Or(),x=function(){function w(E){var _=(0,r.getLayoutByName)(E.type);this.layoutInstance=new _(E)}return w.prototype.layout=function(E){return this.layoutInstance.layout(E)},w.prototype.updateCfg=function(E){this.layoutInstance.updateCfg(E)},w.prototype.init=function(E){this.correctLayers(E.nodes),this.layoutInstance.init(E)},w.prototype.correctLayers=function(E){if(E!=null&&E.length){var _=1/0,M=[];if(E.forEach(function(S){(0,b.isString)(S.layer)&&(S.layer=parseInt(S.layer,10)),!(S.layer===void 0||isNaN(S.layer))&&(M.push(S),S.layer<_&&(_=S.layer))}),_<=0){var C=Math.abs(_)+1;M.forEach(function(S){return S.layer+=C})}}},w.prototype.execute=function(){this.layoutInstance.execute()},w.prototype.getDefaultCfg=function(){return this.layoutInstance.getDefaultCfg()},w.prototype.destroy=function(){return this.layoutInstance.destroy()},w}();return is.Layout=x,is.Layouts={force:a.ForceLayout,fruchterman:c.FruchtermanLayout,forceAtlas2:g.ForceAtlas2Layout,gForce:i.GForceLayout,force2:n.Force2Layout,dagre:s.DagreLayout,dagreCompound:m.DagreCompoundLayout,circular:o.CircularLayout,radial:u.RadialLayout,concentric:f.ConcentricLayout,grid:e.GridLayout,mds:l.MDSLayout,comboForce:v.ComboForceLayout,comboCombined:p.ComboCombinedLayout,random:t.RandomLayout,"gForce-gpu":d.GForceGPULayout,"fruchterman-gpu":h.FruchtermanGPULayout,er:y.ERLayout},is}var WO={};Object.defineProperty(WO,"__esModule",{value:!0});var JS;function VO(){return JS||(JS=1,function(r){var e=xe&&xe.__createBinding||(Object.create?function(E,_,M,C){C===void 0&&(C=M);var S=Object.getOwnPropertyDescriptor(_,M);(!S||("get"in S?!_.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return _[M]}}),Object.defineProperty(E,C,S)}:function(E,_,M,C){C===void 0&&(C=M),E[C]=_[M]}),t=xe&&xe.__exportStar||function(E,_){for(var M in E)M!=="default"&&!Object.prototype.hasOwnProperty.call(_,M)&&e(_,E,M)};Object.defineProperty(r,"__esModule",{value:!0}),r.ERLayout=r.ForceAtlas2Layout=r.ComboCombinedLayout=r.ComboForceLayout=r.GForceGPULayout=r.FruchtermanGPULayout=r.FruchtermanLayout=r.MDSLayout=r.ConcentricLayout=r.RadialLayout=r.DagreCompoundLayout=r.DagreLayout=r.CircularLayout=r.ForceLayout=r.Force2Layout=r.GForceLayout=r.RandomLayout=r.GridLayout=r.Layouts=r.Layout=void 0;var n=Kl;Object.defineProperty(r,"GridLayout",{enumerable:!0,get:function(){return n.GridLayout}});var i=Ql;Object.defineProperty(r,"RandomLayout",{enumerable:!0,get:function(){return i.RandomLayout}});var a=Jl;Object.defineProperty(r,"GForceLayout",{enumerable:!0,get:function(){return a.GForceLayout}});var o=ec;Object.defineProperty(r,"Force2Layout",{enumerable:!0,get:function(){return o.Force2Layout}});var s=d1;Object.defineProperty(r,"ForceLayout",{enumerable:!0,get:function(){return s.ForceLayout}});var u=tc;Object.defineProperty(r,"CircularLayout",{enumerable:!0,get:function(){return u.CircularLayout}});var f=Ju;Object.defineProperty(r,"DagreLayout",{enumerable:!0,get:function(){return f.DagreLayout}});var l=ic;Object.defineProperty(r,"DagreCompoundLayout",{enumerable:!0,get:function(){return l.DagreCompoundLayout}});var c=ub;Object.defineProperty(r,"RadialLayout",{enumerable:!0,get:function(){return c.RadialLayout}});var h=fc;Object.defineProperty(r,"ConcentricLayout",{enumerable:!0,get:function(){return h.ConcentricLayout}});var d=lc;Object.defineProperty(r,"MDSLayout",{enumerable:!0,get:function(){return d.MDSLayout}});var v=cc;Object.defineProperty(r,"FruchtermanLayout",{enumerable:!0,get:function(){return v.FruchtermanLayout}});var p=hc;Object.defineProperty(r,"FruchtermanGPULayout",{enumerable:!0,get:function(){return p.FruchtermanGPULayout}});var g=dc;Object.defineProperty(r,"GForceGPULayout",{enumerable:!0,get:function(){return g.GForceGPULayout}});var y=vc;Object.defineProperty(r,"ComboForceLayout",{enumerable:!0,get:function(){return y.ComboForceLayout}});var m=GO();Object.defineProperty(r,"ComboCombinedLayout",{enumerable:!0,get:function(){return m.ComboCombinedLayout}});var b=pc;Object.defineProperty(r,"ForceAtlas2Layout",{enumerable:!0,get:function(){return b.ForceAtlas2Layout}});var x=gc;Object.defineProperty(r,"ERLayout",{enumerable:!0,get:function(){return x.ERLayout}});var w=Kfe();Object.defineProperty(r,"Layout",{enumerable:!0,get:function(){return w.Layout}}),Object.defineProperty(r,"Layouts",{enumerable:!0,get:function(){return w.Layouts}}),t(WO,r)}(Gg)),Gg}(function(r){var e=xe&&xe.__createBinding||(Object.create?function(i,a,o,s){s===void 0&&(s=o);var u=Object.getOwnPropertyDescriptor(a,o);(!u||("get"in u?!a.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,s,u)}:function(i,a,o,s){s===void 0&&(s=o),i[s]=a[o]}),t=xe&&xe.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&e(a,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),r.getLayoutByName=r.unRegisterLayout=r.registerLayout=void 0;var n=$a;Object.defineProperty(r,"registerLayout",{enumerable:!0,get:function(){return n.registerLayout}}),Object.defineProperty(r,"unRegisterLayout",{enumerable:!0,get:function(){return n.unRegisterLayout}}),Object.defineProperty(r,"getLayoutByName",{enumerable:!0,get:function(){return n.getLayoutByName}}),t(VO(),r)})(Ht);function Qfe(r,e,t,n){return n===void 0&&(n="height"),t==="center"?(r[n]+e[n])/2:r.height}var Bo={assign:Object.assign,getHeight:Qfe},HO=Bo,Eb=18,Jfe=Eb*2,eM=Eb,ele={getId:function(e){return e.id||e.name},getPreH:function(e){return e.preH||0},getPreV:function(e){return e.preV||0},getHGap:function(e){return e.hgap||eM},getVGap:function(e){return e.vgap||eM},getChildren:function(e){return e.children},getHeight:function(e){return e.height||Jfe},getWidth:function(e){var t=e.label||" ";return e.width||t.split("").length*Eb}};function ov(r,e){var t=this;if(t.vgap=t.hgap=0,r instanceof ov)return r;t.data=r;var n=e.getHGap(r),i=e.getVGap(r);return t.preH=e.getPreH(r),t.preV=e.getPreV(r),t.width=e.getWidth(r),t.height=e.getHeight(r),t.width+=t.preH,t.height+=t.preV,t.id=e.getId(r),t.x=t.y=0,t.depth=0,t.children||(t.children=[]),t.addGap(n,i),t}HO.assign(ov.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(e,t){var n=this;n.hgap+=e,n.vgap+=t,n.width+=2*e,n.height+=2*t},eachNode:function(e){for(var t=this,n=[t],i;i=n.shift();)e(i),n=i.children.concat(n)},DFTraverse:function(e){this.eachNode(e)},BFTraverse:function(e){for(var t=this,n=[t],i;i=n.shift();)e(i),n=n.concat(i.children)},getBoundingBox:function(){var e={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(t){e.left=Math.min(e.left,t.x),e.top=Math.min(e.top,t.y),e.width=Math.max(e.width,t.x+t.width),e.height=Math.max(e.height,t.y+t.height)}),e},translate:function(e,t){e===void 0&&(e=0),t===void 0&&(t=0),this.eachNode(function(n){n.x+=e,n.y+=t,n.x+=n.preH,n.y+=n.preV})},right2left:function(){var e=this,t=e.getBoundingBox();e.eachNode(function(n){n.x=n.x-(n.x-t.left)*2-n.width}),e.translate(t.width,0)},bottom2top:function(){var e=this,t=e.getBoundingBox();e.eachNode(function(n){n.y=n.y-(n.y-t.top)*2-n.height}),e.translate(0,t.height)}});function tle(r,e,t){e===void 0&&(e={}),e=HO.assign({},ele,e);var n=new ov(r,e),i=[n],a;if(!t&&!r.collapsed){for(;a=i.shift();)if(!a.data.collapsed){var o=e.getChildren(a.data),s=o?o.length:0;if(a.children=new Array(s),o&&s)for(var u=0;u<s;u++){var f=new ov(o[u],e);a.children[u]=f,i.push(f),f.parent=a,f.depth=a.depth+1}}}return n}var qO=tle,rle=qO,nle=function(){function r(t,n){n===void 0&&(n={});var i=this;i.options=n,i.rootNode=rle(t,n)}var e=r.prototype;return e.execute=function(){throw new Error("please override this method")},r}(),hp=nle;function el(r,e,t,n){n===void 0&&(n=[]);var i=this;i.w=r||0,i.h=e||0,i.y=t||0,i.x=0,i.c=n||[],i.cs=n.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}el.fromNode=function(r,e){if(!r)return null;var t=[];return r.children.forEach(function(n){t.push(el.fromNode(n,e))}),e?new el(r.height,r.width,r.x,t):new el(r.width,r.height,r.y,t)};function ZO(r,e,t){t?r.y+=e:r.x+=e,r.children.forEach(function(n){ZO(n,e,t)})}function KO(r,e){var t=e?r.y:r.x;return r.children.forEach(function(n){t=Math.min(KO(n,e),t)}),t}function ile(r,e){var t=KO(r,e);ZO(r,-t,e)}function QO(r,e,t){t?e.y=r.x:e.x=r.x,r.c.forEach(function(n,i){QO(n,e.children[i],t)})}function JO(r,e,t){t===void 0&&(t=0),e?(r.x=t,t+=r.width):(r.y=t,t+=r.height),r.children.forEach(function(n){JO(n,e,t)})}var ale=function(r,e){e===void 0&&(e={});var t=e.isHorizontal;function n(m){if(m.cs===0){i(m);return}n(m.c[0]);for(var b=g(f(m.c[0].el),0,null),x=1;x<m.cs;++x){n(m.c[x]);var w=f(m.c[x].er);a(m,x,b),b=g(w,x,b)}h(m),i(m)}function i(m){m.cs===0?(m.el=m,m.er=m,m.msel=m.mser=0):(m.el=m.c[0].el,m.msel=m.c[0].msel,m.er=m.c[m.cs-1].er,m.mser=m.c[m.cs-1].mser)}function a(m,b,x){for(var w=m.c[b-1],E=w.mod,_=m.c[b],M=_.mod;w!==null&&_!==null;){f(w)>x.low&&(x=x.nxt);var C=E+w.prelim+w.w-(M+_.prelim);C>0&&(M+=C,o(m,b,x.index,C));var S=f(w),A=f(_);S<=A&&(w=u(w),w!==null&&(E+=w.mod)),S>=A&&(_=s(_),_!==null&&(M+=_.mod))}!w&&_?l(m,b,_,M):w&&!_&&c(m,b,w,E)}function o(m,b,x,w){m.c[b].mod+=w,m.c[b].msel+=w,m.c[b].mser+=w,v(m,b,x,w)}function s(m){return m.cs===0?m.tl:m.c[0]}function u(m){return m.cs===0?m.tr:m.c[m.cs-1]}function f(m){return m.y+m.h}function l(m,b,x,w){var E=m.c[0].el;E.tl=x;var _=w-x.mod-m.c[0].msel;E.mod+=_,E.prelim-=_,m.c[0].el=m.c[b].el,m.c[0].msel=m.c[b].msel}function c(m,b,x,w){var E=m.c[b].er;E.tr=x;var _=w-x.mod-m.c[b].mser;E.mod+=_,E.prelim-=_,m.c[b].er=m.c[b-1].er,m.c[b].mser=m.c[b-1].mser}function h(m){m.prelim=(m.c[0].prelim+m.c[0].mod+m.c[m.cs-1].mod+m.c[m.cs-1].prelim+m.c[m.cs-1].w)/2-m.w/2}function d(m,b){b+=m.mod,m.x=m.prelim+b,p(m);for(var x=0;x<m.cs;x++)d(m.c[x],b)}function v(m,b,x,w){if(x!==b-1){var E=b-x;m.c[x+1].shift+=w/E,m.c[b].shift-=w/E,m.c[b].change-=w-w/E}}function p(m){for(var b=0,x=0,w=0;w<m.cs;w++)b+=m.c[w].shift,x+=b+m.c[w].change,m.c[w].mod+=x}function g(m,b,x){for(;x!==null&&m>=x.low;)x=x.nxt;return{low:m,index:b,nxt:x}}JO(r,t);var y=el.fromNode(r,t);return n(y),d(y,0),QO(y,r,t),ile(r,t),r},tM=qO,eD=function(r,e){for(var t=tM(r.data,e,!0),n=tM(r.data,e,!0),i=r.children.length,a=Math.round(i/2),o=e.getSide||function(l,c){return c<a?"right":"left"},s=0;s<i;s++){var u=r.children[s],f=o(u,s);f==="right"?n.children.push(u):t.children.push(u)}return t.eachNode(function(l){l.isRoot()||(l.side="left")}),n.eachNode(function(l){l.isRoot()||(l.side="right")}),{left:t,right:n}},ole=eD,co=["LR","RL","TB","BT","H","V"],sle=["LR","RL","H"],ule=function(e){return sle.indexOf(e)>-1},fle=co[0],_b=function(r,e,t){var n=e.direction||fle;if(e.isHorizontal=ule(n),n&&co.indexOf(n)===-1)throw new TypeError("Invalid direction: "+n);if(n===co[0])t(r,e);else if(n===co[1])t(r,e),r.right2left();else if(n===co[2])t(r,e);else if(n===co[3])t(r,e),r.bottom2top();else if(n===co[4]||n===co[5]){var i=ole(r,e),a=i.left,o=i.right;t(a,e),t(o,e),e.isHorizontal?a.right2left():a.bottom2top(),o.translate(a.x-o.x,a.y-o.y),r.x=a.x,r.y=o.y;var s=r.getBoundingBox();e.isHorizontal?s.top<0&&r.translate(0,-s.top):s.left<0&&r.translate(-s.left,0)}var u=e.fixedRoot;return u===void 0&&(u=!0),u&&r.translate(-(r.x+r.width/2+r.hgap),-(r.y+r.height/2+r.vgap)),r};function lle(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,Vy(r,e)}function Vy(r,e){return Vy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Vy(r,e)}var cle=hp,hle=ale,dle=_b,vle=Bo,ple=function(r){function e(){return r.apply(this,arguments)||this}lle(e,r);var t=e.prototype;return t.execute=function(){var i=this;return dle(i.rootNode,i.options,hle)},e}(cle),gle={};function yle(r,e){return e=vle.assign({},gle,e),new ple(r,e).execute()}var mle=yle,ble=Bo;function xle(r,e){e===void 0&&(e=[]);var t=this;t.x=t.y=0,t.leftChild=t.rightChild=null,t.height=0,t.children=e}var wle={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function tD(r,e,t){t?(e.x=r.x,e.y=r.y):(e.x=r.y,e.y=r.x),r.children.forEach(function(n,i){tD(n,e.children[i],t)})}var Ele=function(r,e){e===void 0&&(e={}),e=ble.assign({},wle,e);var t=0;function n(u){if(!u)return null;u.width=0,u.depth&&u.depth>t&&(t=u.depth);var f=u.children,l=f.length,c=new xle(u.height,[]);return f.forEach(function(h,d){var v=n(h);c.children.push(v),d===0&&(c.leftChild=v),d===l-1&&(c.rightChild=v)}),c.originNode=u,c.isLeaf=u.isLeaf(),c}function i(u){if(u.isLeaf||u.children.length===0)u.drawingDepth=t;else{var f=u.children.map(function(c){return i(c)}),l=Math.min.apply(null,f);u.drawingDepth=l-1}return u.drawingDepth}var a;function o(u){u.x=u.drawingDepth*e.rankSep,u.isLeaf?(u.y=0,a&&(u.y=a.y+a.height+e.nodeSep,u.originNode.parent!==a.originNode.parent&&(u.y+=e.subTreeSep)),a=u):(u.children.forEach(function(f){o(f)}),u.y=(u.leftChild.y+u.rightChild.y)/2)}var s=n(r);return i(s),o(s),tD(s,r,e.isHorizontal),r};function _le(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,Hy(r,e)}function Hy(r,e){return Hy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Hy(r,e)}var Sle=hp,Mle=Ele,Cle=_b,Ale=Bo,Tle=function(r){function e(){return r.apply(this,arguments)||this}_le(e,r);var t=e.prototype;return t.execute=function(){var i=this;return i.rootNode.width=0,Cle(i.rootNode,i.options,Mle)},e}(Sle),Ile={};function kle(r,e){return e=Ale.assign({},Ile,e),new Tle(r,e).execute()}var Lle=kle,rM=Bo;function Nle(r,e,t,n,i){var a=typeof t=="function"?t(r):t*r.depth;if(!n)try{if(r.id===r.parent.children[0].id){r.x+=a,r.y=e?e.y:0;return}}catch{}if(r.x+=a,e){if(r.y=e.y+rM.getHeight(e,r,i),e.parent&&r.parent.id!==e.parent.id){var o=e.parent,s=o.y+rM.getHeight(o,r,i);r.y=s>r.y?s:r.y}}else r.y=0}var Ole=function(r,e,t,n){var i=null;r.eachNode(function(a){Nle(a,i,e,t,n),i=a})};function Dle(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,qy(r,e)}function qy(r,e){return qy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},qy(r,e)}var Ple=hp,Fh=Ole,Rle=eD,Ble=Bo,tl=["LR","RL","H"],Fle=tl[0],Gle=function(r){function e(){return r.apply(this,arguments)||this}Dle(e,r);var t=e.prototype;return t.execute=function(){var i=this,a=i.options,o=i.rootNode;a.isHorizontal=!0;var s=a.indent,u=s===void 0?20:s,f=a.dropCap,l=f===void 0?!0:f,c=a.direction,h=c===void 0?Fle:c,d=a.align;if(h&&tl.indexOf(h)===-1)throw new TypeError("Invalid direction: "+h);if(h===tl[0])Fh(o,u,l,d);else if(h===tl[1])Fh(o,u,l,d),o.right2left();else if(h===tl[2]){var v=Rle(o,a),p=v.left,g=v.right;Fh(p,u,l,d),p.right2left(),Fh(g,u,l,d);var y=p.getBoundingBox();g.translate(y.width,0),o.x=g.x-o.width/2}return o},e}(Ple),zle={};function $le(r,e){return e=Ble.assign({},zle,e),new Gle(r,e).execute()}var jle=$le,Ule=Bo;function rD(r,e){var t=0;return r.children.length?r.children.forEach(function(n){t+=rD(n,e)}):t=r.height,r._subTreeSep=e.getSubTreeSep(r.data),r.totalHeight=Math.max(r.height,t)+2*r._subTreeSep,r.totalHeight}function nD(r){var e=r.children,t=e.length;if(t){e.forEach(function(u){nD(u)});var n=e[0],i=e[t-1],a=i.y-n.y+i.height,o=0;if(e.forEach(function(u){o+=u.totalHeight}),a>r.height)r.y=n.y+a/2-r.height/2;else if(e.length!==1||r.height>o){var s=r.y+(r.height-a)/2-n.y;e.forEach(function(u){u.translate(0,s)})}else r.y=(n.y+n.height/2+i.y+i.height/2)/2-r.height/2}}var Xle={getSubTreeSep:function(){return 0}},Yle=function(r,e){e===void 0&&(e={}),e=Ule.assign({},Xle,e),r.parent={x:0,width:0,height:0,y:0},r.BFTraverse(function(t){t.x=t.parent.x+t.parent.width}),r.parent=null,rD(r,e),r.startY=0,r.y=r.totalHeight/2-r.height/2,r.eachNode(function(t){var n=t.children,i=n.length;if(i){var a=n[0];if(a.startY=t.startY+t._subTreeSep,i===1)a.y=t.y+t.height/2-a.height/2;else{a.y=a.startY+a.totalHeight/2-a.height/2;for(var o=1;o<i;o++){var s=n[o];s.startY=n[o-1].startY+n[o-1].totalHeight,s.y=s.startY+s.totalHeight/2-s.height/2}}}}),nD(r)};function Wle(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,Zy(r,e)}function Zy(r,e){return Zy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Zy(r,e)}var Vle=hp,Hle=Yle,qle=_b,Zle=Bo,Kle=function(r){function e(){return r.apply(this,arguments)||this}Wle(e,r);var t=e.prototype;return t.execute=function(){var i=this;return qle(i.rootNode,i.options,Hle)},e}(Vle),Qle={};function Jle(r,e){return e=Zle.assign({},Qle,e),new Kle(r,e).execute()}var ece=Jle,tce={compactBox:mle,dendrogram:Lle,indented:jle,mindmap:ece},rce=tce;const sv=pa(rce);var nM=_n.traverseTree,nce=function(e,t){var n;return e?ht(e)?n=function(a){return e}:n=e:n=function(a){return t||1},n},ice=function(e,t){var n=[],i=[],a={},o=0;for(o=0;o<e.length;o++){var s=e[o];a[s.id]=o,n.push(s.x),n.push(s.y),n.push(0),n.push(0),i.push([])}for(o=0;o<t.length;o++){var u=t[o];i[a[u.source]].push(a[u.target]),i[a[u.target]].push(a[u.source])}var f=0;for(o=0;o<e.length;o++){var l=n.length,c=i[o],h=c.length;n[o*4+2]=l,n[o*4+3]=c.length,f=Math.max(f,c.length);for(var d=0;d<h;++d){var v=c[d];n.push(+v)}}for(;n.length%4!==0;)n.push(0);return{array:new Float32Array(n),maxEdgePerVetex:f}},ace=function(e,t,n){var i=[],a=[],o={},s=0;for(s=0;s<e.length;s++){var u=e[s];o[u.id]=s,i.push(u.x),i.push(u.y),i.push(0),i.push(0),a.push([])}for(s=0;s<t.length;s++){var f=t[s];a[o[f.source]].push(o[f.target]),a[o[f.source]].push(n(f)),a[o[f.target]].push(o[f.source]),a[o[f.target]].push(n(f))}var l=0;for(s=0;s<e.length;s++){var c=i.length,h=a[s],d=h.length;i[s*4+2]=c,i[s*4+3]=d/2,l=Math.max(l,d/2);for(var v=0;v<d;++v){var p=h[v];i.push(+p)}}for(;i.length%4!==0;)i.push(0);return{array:new Float32Array(i),maxEdgePerVetex:l}},oce=function(e,t,n,i){var a=[],o=[],s={},u=0;for(u=0;u<e.length;u++){var f=e[u];s[f.id]=u,a.push(f.x),a.push(f.y),a.push(0),a.push(0),o.push([])}for(u=0;u<t.length;u++){var l=t[u];o[s[l.source]].push(s[l.target]),o[s[l.source]].push(n(l)),o[s[l.source]].push(i(l)),o[s[l.source]].push(0),o[s[l.target]].push(s[l.source]),o[s[l.target]].push(n(l)),o[s[l.target]].push(i(l)),o[s[l.target]].push(0)}var c=0;for(u=0;u<e.length;u++){var h=a.length,d=o[u],v=d.length;a[u*4+2]=h+1048576*v/4,a[u*4+3]=0,c=Math.max(c,v/4);for(var p=0;p<v;++p){var g=d[p];a.push(+g)}}for(;a.length%4!==0;)a.push(0);return{array:new Float32Array(a),maxEdgePerVetex:c}},sce=function(e,t){var n=[],i=e.length,a={};return t.forEach(function(o){e.forEach(function(s,u){if(a[o[s]]===void 0&&(a[o[s]]=Object.keys(a).length),n.push(a[o[s]]),u===i-1)for(;n.length%4!==0;)n.push(0)})}),{array:new Float32Array(n),count:Object.keys(a).length}},uce=function(e){for(var t=[],n=e.length,i=e[0].length,a=function(u){e.forEach(function(f,l){if(t.push(f[u]),l===n-1)for(;t.length%4!==0;)t.push(0)})},o=0;o<i;o++)a(o);return new Float32Array(t)},fce=function(e,t){var n=["V","TB","BT"],i={x:1/0,y:1/0},a={x:-1/0,y:-1/0},o="x",s="y";t&&n.indexOf(t)>=0&&(s="x",o="y");var u=0;nM(e,function(c){return u++,c.x>a.x&&(a.x=c.x),c.x<i.x&&(i.x=c.x),c.y>a.y&&(a.y=c.y),c.y<i.y&&(i.y=c.y),!0});var f=Math.PI*2/u,l=a[s]-i[s];return l===0||nM(e,function(c){var h=(c[s]-i[s])/l*(Math.PI*2-f)+f,d=Math.abs(o==="x"?c.x-e.x:c.y-e.y);return c.x=d*Math.cos(h),c.y=d*Math.sin(h),!0}),e};const lce=Object.freeze(Object.defineProperty({__proto__:null,arrayToTextureData:uce,attributesToTextureData:sce,buildTextureData:ice,buildTextureDataWithOneEdgeAttr:ace,buildTextureDataWithTwoEdgeAttr:oce,proccessToFunc:nce,radialLayout:fce},Symbol.toStringTag,{value:"Module"}));var iD=function r(){return typeof window>"u"||typeof document>"u"?{}:{canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var e=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(e.getContext("webgl")||e.getContext("experimental-webgl")))}catch{return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var t=document.createElement("div");return t.id="webgl-error-message",t.style.fontFamily="monospace",t.style.fontSize="13px",t.style.fontWeight="normal",t.style.textAlign="center",t.style.background="#fff",t.style.color="#000",t.style.padding="1.5em",t.style.width="400px",t.style.margin="5em auto 0",this.webgl||(t.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.'].join(`
|
|
480
|
-
`):['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br/>','Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.'].join(`
|
|
481
|
-
`)),t},addGetWebGLMessage:function(t){t=t||{};var n=t.parent!==void 0?t.parent:document.body,i=t.id!==void 0?t.id:"oldie",a=r().getWebGLErrorMessage();a.id=i,n.appendChild(a)}}};const cce=Object.freeze(Object.defineProperty({__proto__:null,gpuDetector:iD},Symbol.toStringTag,{value:"Module"}));var aD=function(){var e=navigator.userAgent.toLowerCase();return e.indexOf("firefox")>-1?"firefox":e.indexOf("safari")>-1?"safari":e.indexOf("opr")>-1?"opera":e.indexOf("chrome")>-1?"chrome":e.indexOf("trident")>-1?"ie 11":e.indexOf("ie")>-1?"ie":"unknown"};const hce=Object.freeze(Object.defineProperty({__proto__:null,getBrowserName:aD},Symbol.toStringTag,{value:"Module"}));var Za=B(B(B(B(B({},_n),YY),lce),cce),hce),dce=Za.radialLayout,vce=function(){function r(e){this.type=e.type,this.radial=e.radial,this.config=e}return r.prototype.init=function(e){var t=this;if(this.data=e,this.radial){this.layoutMethod=function(n){var i=sv[t.type](n,t.config);return dce(i),i};return}this.layoutMethod=function(n){return sv[t.type](n,t.config)}},r.prototype.execute=function(){return this.layoutMethod(this.data,this.config)},r.prototype.layout=function(e){return this.init(e),this.execute()},r}();Ht.registerLayout("grid",Ht.GridLayout);Ht.registerLayout("random",Ht.RandomLayout);Ht.registerLayout("force",Ht.ForceLayout);Ht.registerLayout("circular",Ht.CircularLayout);Ht.registerLayout("dagre",Ht.DagreLayout);Ht.registerLayout("dagreCompound",Ht.DagreCompoundLayout);Ht.registerLayout("radial",Ht.RadialLayout);Ht.registerLayout("concentric",Ht.ConcentricLayout);Ht.registerLayout("mds",Ht.MDSLayout);Ht.registerLayout("fruchterman",Ht.FruchtermanLayout);Ht.registerLayout("fruchterman-gpu",Ht.FruchtermanGPULayout);Ht.registerLayout("gForce",Ht.GForceLayout);Ht.registerLayout("force2",Ht.Force2Layout);Ht.registerLayout("gForce-gpu",Ht.GForceGPULayout);Ht.registerLayout("comboForce",Ht.ComboForceLayout);Ht.registerLayout("comboCombined",Ht.ComboCombinedLayout);Ht.registerLayout("forceAtlas2",Ht.ForceAtlas2Layout);var pce=function(e,t){t.isCustomLayout=!0,Ht.Layouts[e]=Ht.registerLayout(e,t)},gce=function(){function r(e,t){var n=e.toString(),i=new Blob(["importScripts('".concat(t,"');(").concat(n,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(i))}return r}(),yce=function(e){e===void 0&&(e="https://unpkg.com/@antv/layout@0.3.23/dist/layout.min.js");function t(){var i={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};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);function a(s){var u=s.data.type;return u===i.RUN||u===i.GPURUN}function o(s){var u=this,f=s.data.type;switch(f){case i.RUN:{var l=s.data,c=l.nodes,h=l.edges,d=l.layoutCfg,v=d===void 0?{}:d,p=v.type,g=layout.getLayoutByName(p);if(!g){this.postMessage({type:i.ERROR,message:"layout ".concat(p," not found")});break}var y;v.onLayoutEnd=function(){u.postMessage({type:i.END,nodes:c}),y==null||y.destroy()},y=new g(v),y.init({nodes:c,edges:h}),y.execute();break}case i.GPURUN:{var m=s.data,b=m.nodes,h=m.edges,x=m.layoutCfg,v=x===void 0?{}:x,w=m.canvas,p=v.type,g=layout.getLayoutByName(p);if(!g){this.postMessage({type:i.ERROR,message:"layout ".concat(p," not found")});break}if(p.split("-")[1]!=="gpu"){this.postMessage({type:i.ERROR,message:"layout ".concat(p," does not support GPU")});break}var E=new g(v);E.init({nodes:b,edges:h}),E.executeWithWorker(w,this);break}}}onmessage=function(u){a(u)&&o(u)}}var n=new gce(t,e);return n},hu={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};function Ky(r){"@babel/helpers - typeof";return Ky=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ky(r)}var iM=function(e){return setTimeout(e,16)},aM=function(e){return clearTimeout(e)},Gh={requestAnimationFrame:function(e){var t=typeof window<"u"&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||iM;return t(e)},cancelAnimationFrame:function(e){var t=typeof window<"u"&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||aM;return t(e)}},mce=["fruchterman","gForce"],bce=["force","grid","circular"],xce=function(r){kt(e,r);function e(t){var n=r.call(this,t)||this;return n.graph=t,n.layoutCfg=t.get("layout")||{},n.layoutType=n.getLayoutType(),n.worker=null,n.workerData={},n.initLayout(),n}return e.prototype.initLayout=function(){},e.prototype.getWorker=function(){return this.worker?this.worker:(typeof Worker>"u"?(console.warn("Web worker is not supported in current browser."),this.worker=null):this.worker=yce(this.layoutCfg.workerScriptURL),this.worker)},e.prototype.stopWorker=function(){var t=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,t.requestId&&(Gh.cancelAnimationFrame(t.requestId),t.requestId=null),t.requestId2&&(Gh.cancelAnimationFrame(t.requestId2),t.requestId2=null))},e.prototype.execLayoutMethod=function(t,n){var i=this;return new Promise(function(a,o){return Wn(i,void 0,void 0,function(){var s,u,f,l,c,p,h,d,v,p,g;return Vn(this,function(y){switch(y.label){case 0:if(s=this.graph,!s||s.get("destroyed"))return[2];u=t.type,t.onLayoutEnd=function(){s.emit("aftersublayout",{type:u}),a()},u&&this.isGPU&&(oD(u)?u="".concat(u,"-gpu"):console.warn("The '".concat(u,"' layout does not support GPU calculation for now, it will run in CPU."))),_n.isForce(u)?(f=t.onTick,l=t.animate,c=l===void 0&&(u==="force"||u==="force2"),p=function(){f&&f(),(l||c)&&s.refreshPositions()},t.tick=p):(u==="comboForce"||u==="comboCombined")&&(t.comboTrees=s.get("comboTrees")),h=!1;try{d=new Ht.Layouts[u](t),this.layoutMethods[n]&&this.layoutMethods[n].destroy(),this.layoutMethods[n]=d}catch{console.warn("The layout method: '".concat(u,"' does not exist! Please specify it first.")),o()}return h=d.enableTick,h&&(v=t.onTick,p=function(){v&&v(),s.refreshPositions()},d.tick=p),g=this.filterLayoutData(this.data,t),_ce(g,n),d.init(g),s.emit("beforesublayout",{type:u}),[4,d.execute()];case 1:return y.sent(),d.isCustomLayout&&t.onLayoutEnd&&t.onLayoutEnd(),[2]}})})})},e.prototype.updateLayoutMethod=function(t,n){var i=this;return new Promise(function(a,o){return Wn(i,void 0,void 0,function(){var s,u,f,l,c,h,d;return Vn(this,function(v){switch(v.label){case 0:return s=this.graph,u=n==null?void 0:n.type,n.onLayoutEnd=function(){s.emit("aftersublayout",{type:u}),a()},_n.isForce(u)&&(f=n.onTick,l=n.animate,c=l===void 0&&(u==="force"||u==="force2"),h=function(){f==null||f(),(l||c)&&s.refreshPositions()},n.tick=h),d=this.filterLayoutData(this.data,n),t.init(d),t.updateCfg(n),s.emit("beforesublayout",{type:u}),[4,t.execute()];case 1:return v.sent(),t.isCustomLayout&&n.onLayoutEnd&&n.onLayoutEnd(),[2]}})})})},e.prototype.layout=function(t){var n=this,i,a=this.graph;if(!(!a||a.get("destroyed"))){this.data=this.setDataFromGraph();var o=this.data,s=o.nodes,u=o.hiddenNodes;if(!s)return!1;var f=a.get("width"),l=a.get("height"),c={};Object.assign(c,{width:f,height:l,center:[f/2,l/2]},this.layoutCfg),this.layoutCfg=c;var h=c.type,d=!1;(i=this.layoutMethods)===null||i===void 0||i.forEach(function(w){var E;return d=!!(!((E=w.nodes)===null||E===void 0)&&E.length)||d});var v=this.destoryLayoutMethods();a.emit("beforelayout");var p=Promise.resolve();d&&h&&(v==null?void 0:v.length)===1&&v[0]===h?this.tweakInit():p=this.initPositions(c.center,s);var g=this.initPositions(c.center,u);g.then(),this.isGPU=oM(c,h);var y=c.onLayoutEnd,m=c.layoutEndFormatted,b=c.adjust;if(m||(c.layoutEndFormatted=!0,c.onAllLayoutEnd=function(){return Wn(n,void 0,void 0,function(){return Vn(this,function(w){switch(w.label){case 0:return y&&y(s),this.refreshLayout(),b&&c.pipes?[4,this.adjustPipesBox(this.data,b)]:[3,2];case 1:w.sent(),this.refreshLayout(),w.label=2;case 2:return a.emit("afterlayout"),[2]}})})}),this.stopWorker(),c.workerEnabled&&this.layoutWithWorker(this.data,t))return!0;var x=!1;return c.type?(x=!0,p=p.then(function(){return Wn(n,void 0,void 0,function(){return Vn(this,function(w){switch(w.label){case 0:return[4,this.execLayoutMethod(c,0)];case 1:return[2,w.sent()]}})})})):c.pipes&&(x=!0,c.pipes.forEach(function(w,E){p=p.then(function(){return Wn(n,void 0,void 0,function(){return Vn(this,function(_){switch(_.label){case 0:return[4,this.execLayoutMethod(w,E)];case 1:return[2,_.sent()]}})})})})),x?p.then(function(){c.onAllLayoutEnd&&c.onAllLayoutEnd(),t&&t()}).catch(function(w){console.warn("graph layout failed,",w)}):(a.refreshPositions(),t==null||t()),!1}},e.prototype.tweakInit=function(){var t=this,n=t.data,i=t.graph,a=n.nodes,o=n.edges;if(a!=null&&a.length){var s={};a.forEach(function(l){var c=l.x,h=l.y;!isNaN(c)&&!isNaN(h)&&(s[l.id]={x:c,y:h},l.mass=l.mass||2)}),o.forEach(function(l){var c=l.source,h=l.target,d=s[c],v=s[h];!d&&v?s[c]={x:v.x+(Math.random()-.5)*80,y:v.y+(Math.random()-.5)*80}:!v&&d&&(s[h]={x:d.x+(Math.random()-.5)*80,y:d.y+(Math.random()-.5)*80})});var u=i.get("width"),f=i.get("height");a.forEach(function(l){var c=s[l.id]||{x:u/2+(Math.random()-.5)*20,y:f/2+(Math.random()-.5)*20};l.x=c.x,l.y=c.y})}},e.prototype.initWithPreset=function(t,n){var i=this;return new Promise(function(a,o){return Wn(i,void 0,void 0,function(){var s,u,f,l,c,h,d;return Vn(this,function(v){switch(v.label){case 0:return s=this,u=s.layoutCfg,f=s.data,l=u.preset,!(l!=null&&l.type)||!Ht.Layouts[l==null?void 0:l.type]?(n==null||n(),a(),[2,!1]):(c=oM(l,l.type),h=c?"".concat(l.type,"-gpu"):l.type,d=new Ht.Layouts[h](l),delete u.preset,d.init(f),[4,d.execute()]);case 1:return v.sent(),t==null||t(),a(),[2,!0]}})})})},e.prototype.layoutWithWorker=function(t,n){var i=this,a=this,o=a.layoutCfg,s=a.graph,u=this.getWorker(),f=this.workerData;if(!u)return!1;f.requestId=null,f.requestId2=null,f.currentTick=null,f.currentTickData=null,s.emit("beforelayout");var l=Promise.resolve(),c=!1;if(o.type)c=!0,l=l.then(function(){return i.runWebworker(u,t,o)});else if(o.pipes){c=!0;for(var h=function(y){l=l.then(function(){return i.runWebworker(u,t,y)})},d=0,v=o.pipes;d<v.length;d++){var p=v[d];h(p)}}return c&&l.then(function(){o.onAllLayoutEnd&&o.onAllLayoutEnd(),n==null||n()}).catch(function(g){console.error("layout failed",g)}),!0},e.prototype.runWebworker=function(t,n,i){var a=this,o=this.isGPU,s=this.filterLayoutData(n,i),u=s.nodes,f=s.edges,l=document.createElement("canvas"),c=o&&typeof window<"u"&&window.navigator&&!navigator.gpu&&"OffscreenCanvas"in window&&"transferControlToOffscreen"in l,h=wce(i,function(v){return typeof v!="function"});if(!c)t.postMessage({type:hu.RUN,nodes:u,edges:f,layoutCfg:h});else{var d=l.transferControlToOffscreen();h.type="".concat(h.type,"-gpu"),t.postMessage({type:hu.GPURUN,nodes:u,edges:f,layoutCfg:h,canvas:d},[d])}return new Promise(function(v,p){t.onmessage=function(g){a.handleWorkerMessage(v,p,g,s,i)}})},e.prototype.handleWorkerMessage=function(t,n,i,a,o){var s=this,u=s.graph,f=s.workerData,l=i.data,c=l.type,h=function(){o.onTick&&o.onTick()};switch(c){case hu.TICK:f.currentTick=l.currentTick,f.currentTickData=l,f.requestId||(f.requestId=Gh.requestAnimationFrame(function(){y0(a,l),u.refreshPositions(),h(),l.currentTick===l.totalTicks?t():f.currentTick===l.totalTicks&&(f.requestId2=Gh.requestAnimationFrame(function(){y0(a,f.currentTickData),u.refreshPositions(),f.requestId2=null,h(),t()})),f.requestId=null}));break;case hu.END:f.currentTick==null&&(y0(a,l),t());break;case hu.GPUEND:f.currentTick==null&&(Ece(a,l),t());break;case hu.ERROR:console.warn("Web-Worker layout error!",l.message),n();break;default:n();break}},e.prototype.updateLayoutCfg=function(t){var n=this,i=this,a=i.graph,o=i.layoutMethods;if(!(!a||a.get("destroyed"))){var s=t.disableTriggerLayout,u=nn(t,["disableTriggerLayout"]),f=yt({},this.layoutCfg,u);if(this.layoutCfg=f,!s){if(!(o!=null&&o.length)){this.layout();return}if(this.data=this.setDataFromGraph(),this.stopWorker(),!(u.workerEnabled&&this.layoutWithWorker(this.data,null))){a.emit("beforelayout");var l=Promise.resolve(),c=!1;(o==null?void 0:o.length)===1?(c=!0,l=l.then(function(){return Wn(n,void 0,void 0,function(){return Vn(this,function(h){switch(h.label){case 0:return[4,this.updateLayoutMethod(o[0],f)];case 1:return[2,h.sent()]}})})})):o!=null&&o.length&&(c=!0,o.forEach(function(h,d){var v=f.pipes[d];l=l.then(function(){return Wn(n,void 0,void 0,function(){return Vn(this,function(p){switch(p.label){case 0:return[4,this.updateLayoutMethod(h,v)];case 1:return[2,p.sent()]}})})})})),c&&l.then(function(){f.onAllLayoutEnd&&f.onAllLayoutEnd()}).catch(function(h){console.warn("layout failed",h)})}}}},e.prototype.adjustPipesBox=function(t,n){var i=this;return new Promise(function(a){var o=t.nodes;o!=null&&o.length||a(),bce.includes(n)||(console.warn("The adjust type ".concat(n," is not supported yet, please assign it with 'force', 'grid', or 'circular'.")),a());var s={center:i.layoutCfg.center,nodeSize:function(v){return Math.max(v.height,v.width)},preventOverlap:!0,onLayoutEnd:function(){}},u=i.getLayoutBBox(o),f=u.groupNodes,l=u.layoutNodes,c=Vt(l);s.onLayoutEnd=function(){l==null||l.forEach(function(d,v){var p,g,y,m=d.x-((p=c[v])===null||p===void 0?void 0:p.x),b=d.y-((g=c[v])===null||g===void 0?void 0:g.y);(y=f[v])===null||y===void 0||y.forEach(function(x){x.x+=m,x.y+=b})}),a()};var h=new Ht.Layouts[n](s);h.layout({nodes:l})})},e.prototype.destroy=function(){this.destoryLayoutMethods();var t=this.worker;t&&(t.terminate(),this.worker=null),this.destroyed=!0,this.graph.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0,this.graph=null},e}($I);function y0(r,e){for(var t=r.nodes,n=e.nodes,i=t.length,a=0;a<i;a++){var o=t[a];o.x=n[a].x,o.y=n[a].y}}function wce(r,e){var t={};return r&&Ky(r)==="object"?(Object.keys(r).forEach(function(n){r.hasOwnProperty(n)&&e(r[n])&&(t[n]=r[n])}),t):r}function Ece(r,e){for(var t=r.nodes,n=e.vertexEdgeData,i=t.length,a=0;a<i;a++){var o=t[a],s=n[4*a],u=n[4*a+1];o.x=s,o.y=u}}function _ce(r,e){var t;if(!((t=r==null?void 0:r.nodes)===null||t===void 0)&&t.length){var n=r.nodes;n.forEach(function(i){i.layoutOrder=e})}}function oD(r){return mce.includes(r)}function oM(r,e){var t=e;e&&e.split("-")[1]==="gpu"&&(t=e.split("-")[0],r.gpuEnabled=!0);var n=!1;return r.gpuEnabled&&(n=!0,iD().webgl||(console.warn("Your browser does not support webGL or GPGPU. The layout will run in CPU."),n=!1)),n&&!oD(t)&&(console.warn("The '".concat(t,"' layout does not support GPU calculation for now, it will run in CPU.")),n=!1),n}var sM=yi,Sce="svg",sD=function(r){kt(e,r);function e(t){var n=r.call(this,t)||this,i=n.get("defaultNode");return i||n.set("defaultNode",{type:"circle"}),i.type||(i.type="circle",n.set("defaultNode",i)),n.destroyed=!1,n}return e.prototype.initLayoutController=function(){var t=new xce(this);this.set({layoutController:t})},e.prototype.initEventController=function(){var t=new QY(this);this.set({eventController:t})},e.prototype.initCanvas=function(){var t=this.get("container");if(typeof t=="string"&&(t=document.getElementById(t),this.set("container",t)),!t)throw new Error("invalid container");var n=t.clientWidth,i=t.clientHeight,a=this.get("width")||n,o=this.get("height")||i;!this.get("width")&&!this.get("height")&&(this.set("width",n),this.set("height",i));var s=this.get("renderer"),u;if(s===Sce)u=new al({container:t,width:a,height:o});else{var f={container:t,width:a,height:o},l=this.get("pixelRatio");l&&(f.pixelRatio=l,window.devicePixelRatio=l),u=new Ra(f)}this.set("canvas",u)},e.prototype.initPlugins=function(){var t=this;me(t.get("plugins"),function(n){!n.destroyed&&n.initPlugin&&n.initPlugin(t)})},e.prototype.downloadImageWatermark=function(t,n,i,a){return Wn(this,void 0,void 0,function(){var o,s,u;return Vn(this,function(f){switch(f.label){case 0:return o=t.style.backgroundImage,s=o.slice(5,o.length-2),u=new Image,u.src=s,[4,new Promise(function(l){u.onload=function(){var c=n.createPattern(u,"repeat");n.rect(0,0,i,a),n.fillStyle=c,n.fill(),l("")}})];case 1:return f.sent(),[2]}})})},e.prototype.asyncToDataUrl=function(t,n,i,a,o,s){var u=this,f=document.querySelector(".g6-graph-watermarker"),l=this.get("canvas"),c=l.getRenderer(),h=s||l.get("el"),d="";t||(t="image/png"),setTimeout(function(){return Wn(u,void 0,void 0,function(){var v,p,g,y,m,b,x,w,E,_;return Vn(this,function(M){switch(M.label){case 0:return c!=="svg"?[3,1]:(v=h.cloneNode(!0),p=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),g=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",p),g.replaceChild(v,g.documentElement),y=new XMLSerializer().serializeToString(g),d="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(y)),[3,4]);case 1:return m=void 0,b=h.getContext("2d"),x=a||this.get("width"),w=o||this.get("height"),E=void 0,f?[4,this.downloadImageWatermark(f,b,x,w)]:[3,3];case 2:M.sent(),M.label=3;case 3:if(n){_=typeof window<"u"?window.devicePixelRatio:1;try{m=b.getImageData(0,0,x*_,w*_),E=b.globalCompositeOperation,b.globalCompositeOperation="destination-over",b.fillStyle=n,b.fillRect(0,0,x,w)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}d=h.toDataURL(t),n&&(b.clearRect(0,0,x,w),b.putImageData(m,0,0),b.globalCompositeOperation=E),M.label=4;case 4:return i&&i(d),[2]}})})},16)},e.prototype.toDataURL=function(t,n){var i=this.get("canvas"),a=i.getRenderer(),o=i.get("el");t||(t="image/png");var s="";if(a==="svg"){var u=o.cloneNode(!0),f=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),l=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",f);l.replaceChild(u,l.documentElement);var c=new XMLSerializer().serializeToString(l);s="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(c))}else{var h=void 0,d=o.getContext("2d"),v=Math.max(this.get("width"),500),p=Math.max(this.get("height"),500),g=void 0;if(n){var y=typeof window<"u"&&window.devicePixelRatio||1;try{h=d.getImageData(0,0,v*y,p*y),g=d.globalCompositeOperation,d.globalCompositeOperation="destination-over",d.fillStyle=n,d.fillRect(0,0,v,p)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}s=o.toDataURL(t),n&&(d.clearRect(0,0,v,p),d.putImageData(h,0,0),d.globalCompositeOperation=g)}return s},e.prototype.toFullDataURL=function(t,n,i){var a=this.get("group").getCanvasBBox(),o=a.height,s=a.width,u=this.get("renderer"),f=Er('<div id="virtual-image"></div>'),l=i?i.backgroundColor:void 0,c=i?i.padding:void 0;c?ht(c)&&(c=[c,c,c,c]):c=[0,0,0,0];var h=o+c[0]+c[2],d=s+c[1]+c[3],v={container:f,height:h,width:d,quickHit:!0},p=u==="svg"?new al(v):new Ra(v),g=this.get("group"),y=g.clone(),m=Vt(y.getMatrix());m||(m=[1,0,0,0,1,0,0,0,1]);var b=(a.maxX+a.minX)/2,x=(a.maxY+a.minY)/2;m=sM(m,[["t",-b,-x],["t",s/2+c[3],o/2+c[0]]]),y.resetMatrix(),y.setMatrix(m),p.add(y);var w=p.get("el"),E="";n||(n="image/png"),setTimeout(function(){if(u==="svg"){var _=w.cloneNode(!0),M=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),C=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",M);C.replaceChild(_,C.documentElement);var S=new XMLSerializer().serializeToString(C);E="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(S))}else{var A=void 0,T=w.getContext("2d"),k=void 0;if(l){var O=typeof window<"u"?window.devicePixelRatio:1;try{A=T.getImageData(0,0,d*O,h*O),k=T.globalCompositeOperation,T.globalCompositeOperation="destination-over",T.fillStyle=l,T.fillRect(0,0,d,h)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}E=w.toDataURL(n),l&&(T.clearRect(0,0,d,h),T.putImageData(A,0,0),T.globalCompositeOperation=k)}t&&t(E)},16)},e.prototype.downloadFullImage=function(t,n,i){var a=this,o=this.get("group").getCanvasBBox(),s=o.height,u=o.width,f=this.get("renderer"),l=Er('<div id="virtual-image"></div>'),c=document.querySelector(".g6-graph-watermarker"),h=i?i.backgroundColor:void 0,d=i?i.padding:void 0;d?ht(d)&&(d=[d,d,d,d]):d=[0,0,0,0];var v=s+d[0]+d[2],p=u+d[1]+d[3];if(c){var g=this.get("graphWaterMarker").cfg||{},y=g.width,m=g.height;v=Math.ceil(v/m)*m,p=Math.ceil(p/y)*y}var b={container:l,height:v,width:p},x=f==="svg"?new al(b):new Ra(b),w=this.get("group"),E=HY(w),_=Vt(E.getMatrix());_||(_=[1,0,0,0,1,0,0,0,1]);var M=(o.maxX+o.minX)/2,C=(o.maxY+o.minY)/2;_=sM(_,[["t",-M,-C],["t",u/2+d[3],s/2+d[0]]]),E.resetMatrix(),E.setMatrix(_),x.add(E);var S=x.get("el");n||(n="image/png"),this.asyncToDataUrl(n,h,function(A){var T=document.createElement("a"),k=(t||"graph")+(f==="svg"?".svg":".".concat(n.split("/")[1]));a.dataURLToImage(A,f,T,k);var O=document.createEvent("MouseEvents");O.initEvent("click",!1,!1),T.dispatchEvent(O)},p,v,S)},e.prototype.downloadImage=function(t,n,i){var a=this,o=this;o.stopAnimate();var s=o.get("canvas"),u=s.getRenderer();n||(n="image/png");var f=(t||"graph")+(u==="svg"?".svg":".".concat(n.split("/")[1])),l=document.createElement("a");o.asyncToDataUrl(n,i,function(c){a.dataURLToImage(c,u,l,f);var h=document.createEvent("MouseEvents");h.initEvent("click",!1,!1),l.dispatchEvent(h)})},e.prototype.dataURLToImage=function(t,n,i,a){if(!t||t==="data:"){console.error("Download image failed. The graph is too large or there is invalid attribute values in graph items");return}if(typeof window<"u")if(window.Blob&&window.URL&&n!=="svg"){var o=t.split(","),s="";if(o&&o.length>0){var u=o[0].match(/:(.*?);/);u&&u.length>=2&&(s=u[1])}for(var f=atob(o[1]),l=f.length,c=new Uint8Array(l);l--;)c[l]=f.charCodeAt(l);var h=new Blob([c],{type:s});window.navigator.msSaveBlob?window.navigator.msSaveBlob(h,a):i.addEventListener("click",function(){i.download=a,i.href=window.URL.createObjectURL(h)})}else i.addEventListener("click",function(){i.download=a,i.href=t})},e.prototype.addPlugin=function(t){var n=this;t.destroyed||(n.get("plugins").push(t),t.initPlugin(n))},e.prototype.removePlugin=function(t){var n=this.get("plugins"),i=n.indexOf(t);i>=0&&(t.destroyPlugin(),n.splice(i,1))},e.prototype.setImageWaterMarker=function(t,n){t===void 0&&(t=bs.waterMarkerImage);var i=this.get("container");Pe(i)&&(i=document.getElementById(i)),i.style.position||(i.style.position="relative");var a=this.get("graphWaterMarker"),o=yr({},bs.imageWaterMarkerConfig,n),s=o.width,u=o.height,f=o.compatible,l=o.image;if(!t){var c=f?i:document.querySelector(".g6-graph-watermarker");c&&(c.style.cssText=void 0),a&&a.clear();return}if(a)a.clear();else{var h={container:i,width:s,height:u,capture:!1},d=this.get("pixelRatio");d&&(h.pixelRatio=d,window.devicePixelRatio=d),a=new Ra(h),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var v=a.get("context"),p=l.rotate,g=l.x,y=l.y;v.rotate(-p*Math.PI/180);var m=new Image;m.crossOrigin="anonymous",m.src=t,m.onload=function(){if(v.drawImage(m,g,y,l.width,l.height),v.rotate(p*Math.PI/180),f)i.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var b=document.querySelector(".g6-graph-watermarker");b||(b=document.createElement("div"),b.className="g6-graph-watermarker"),b.className="g6-graph-watermarker",a.destroyed||(b.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;"),i.appendChild(b))}}},e.prototype.setTextWaterMarker=function(t,n){var i=this.get("container");Pe(i)&&(i=document.getElementById(i)),i.style.position||(i.style.position="relative");var a=this.get("graphWaterMarker"),o=yr({},bs.textWaterMarkerConfig,n),s=o.width,u=o.height,f=o.compatible,l=o.text;if(!(t!=null&&t.length)){var c=f?i:document.querySelector(".g6-graph-watermarker");c&&(c.style.cssText=void 0),a&&a.clear();return}if(a)a.clear();else{var h={container:i,width:s,height:u,capture:!1},d=this.get("pixelRatio");d&&(h.pixelRatio=d,window.devicePixelRatio=d),a=new Ra(h),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var v=a.get("context"),p=l.rotate,g=l.fill,y=l.fontFamily,m=l.fontSize,b=l.baseline,x=l.x,w=l.y,E=l.lineHeight;v.rotate(-p*Math.PI/180),v.font="".concat(m,"px ").concat(y),v.fillStyle=g,v.textBaseline=b;for(var _=Pe(t)?[t]:t,M=_.length-1;M>=0;M--)v.fillText(_[M],x,w+M*E);if(v.rotate(p*Math.PI/180),f)i.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var C=document.querySelector(".g6-graph-watermarker");C||(C=document.createElement("div"),C.className="g6-graph-watermarker"),C.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:99;"),i.appendChild(C)}},e.prototype.destroy=function(){var t,n,i,a;me(this.get("plugins"),function(l){l.destroyPlugin()});var o=this.get("tooltips");if(o)for(var s=0;s<o.length;s++){var u=o[s];if(u){var f=u.parentElement;f&&f.removeChild(u)}}(t=this.get("eventController"))===null||t===void 0||t.destroy(),(n=this.get("layoutController"))===null||n===void 0||n.destroy(),(i=this.get("graphWaterMarker"))===null||i===void 0||i.destroy(),(a=document.querySelector(".g6-graph-watermarker"))===null||a===void 0||a.remove(),r.prototype.destroy.call(this)},e}(BI);function Qy(r){"@babel/helpers - typeof";return Qy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qy(r)}function uD(r,e){if(e===void 0&&(e=new WeakMap),r===null)return r;if(r instanceof Date)return new Date(r);if(r instanceof RegExp)return new RegExp(r);if(Qy(r)!=="object")return r;if(e.get(r))return e.get(r);var t=Array.isArray(r)?[]:{};e.set(r,t);for(var n in r)r.hasOwnProperty(n)&&r[n]!==void 0&&(t[n]=uD(r[n],e));return t}function Mce(r){try{return structuredClone(r)}catch{return uD(r)}}var Cce=Za.radialLayout,m0=Za.traverseTree,Ace=function(r){kt(e,r);function e(t){var n=r.call(this,t)||this;return n.layoutAnimating=!1,n.set("removeList",[]),n.set("layoutMethod",n.getLayout()),n}return e.prototype.getLayout=function(){var t=this.get("layout");return t?typeof t=="function"?t:(t.type||(t.type="dendrogram"),t.direction||(t.direction=t.type==="indented"?"LR":"TB"),t.radial?function(n){var i=sv[t.type](n,t);return Cce(i),i}:function(n){return sv[t.type](n,t)}):null},e.indexOfChild=function(t,n){var i=-1;return me(t,function(a,o){if(n===a.id)return i=o,!1}),i},e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.animate=!0,t},e.prototype.innerAddChild=function(t,n,i){var a=this,o=t.data;o&&(o.x=t.x,o.y=t.y,o.depth=t.depth);var s=a.addItem("node",o,!1);if(n){if(s.set("parent",n),i){var u=n.get("originAttrs");if(u)s.set("originAttrs",u);else{var f=n.getModel();s.set("originAttrs",{x:f.x,y:f.y})}}var l=n.get("children");l?l.push(s):n.set("children",[s]),a.addItem("edge",{source:n.get("id"),target:s.get("id"),id:"".concat(n.get("id"),":").concat(s.get("id"))},!1)}return me(t.children||[],function(c){a.innerAddChild(c,s,i)}),a.emit("afteraddchild",{item:s,parent:n}),s},e.prototype.innerUpdateChild=function(t,n,i){var a=this,o=a.findById(t.id);if(!o){a.innerAddChild(t,n,i);return}me(t.children||[],function(v){a.innerUpdateChild(v,o,i)});var s=o.get("children");if(s){var u=s.length;if(u>0)for(var f=s.length-1;f>=0;f--){var l=s[f].getModel();e.indexOfChild(t.children||[],l.id)===-1&&(a.innerRemoveChild(l.id,{x:t.x,y:t.y},i),s.splice(f,1))}}var c,h;o.get("originAttrs")&&(c=o.get("originAttrs").x,h=o.get("originAttrs").y);var d=o.getModel();i&&o.set("originAttrs",{x:d.x,y:d.y}),o.set("model",Object.assign(d,t.data)),(c!==t.x||h!==t.y)&&o.updatePosition({x:t.x,y:t.y})},e.prototype.innerRemoveChild=function(t,n,i){var a=this,o=a.findById(t);if(o)if(me(o.get("children"),function(u){a.innerRemoveChild(u.getModel().id,n,i)}),i){var s=o.getModel();o.set("to",n),o.set("originAttrs",{x:s.x,y:s.y}),a.get("removeList").push(o)}else a.removeItem(o,!1)},e.prototype.changeData=function(t,n){n===void 0&&(n=!0);var i=this;this.getNodes().map(function(a){return i.clearItemStates(a)}),this.getEdges().map(function(a){return i.clearItemStates(a)}),n&&this.get("enabledStack")&&this.pushStack("changedata",{before:i.get("originData"),after:t||i.get("data")}),t?(i.data(t),i.render(!1)):i.layout(this.get("fitView"))},e.prototype.changeLayout=function(t){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");var n=this;n.updateLayout(t)},e.prototype.updateLayout=function(t,n,i,a){a===void 0&&(a=!0);var o=this;if(!t){console.warn("layout cannot be null");return}if(a&&this.get("enabledStack")&&this.pushStack("layout",{before:o.get("layout"),after:t}),o.set("layout",t),o.set("layoutMethod",o.getLayout()),o.layout(),n){var s=i;s||(n==="begin"?s={x:0,y:0}:s={x:this.getWidth()/2,y:this.getHeight()/2}),s=this.getPointByCanvas(s.x,s.y);var u=this.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];s.x=s.x*u[0]+u[6],s.y=s.y*u[0]+u[7];var f=this.getGroup().getCanvasBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY,v={x:(l+c)/2,y:(h+d)/2};n==="begin"&&(v.x=l,v.y=h),this.translate(s.x-v.x,s.y-v.y)}},e.prototype.refreshLayout=function(t){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");var n=this;n.layout(t)},e.prototype.layout=function(t){var n=this,i=this,a=i.get("data"),o=i.get("layoutMethod"),s=i.get("layout"),u=a;if(s!=null&&s.excludeInvisibles){a=Vt(i.get("data"));var f={};m0(a,function(h){var d=h.children;if(!(d!=null&&d.length))return!0;for(var v=d.length-1;v>=0;v--){var p=n.findById(d[v].id),g=p?!p.isVisible():d[v].visible===!1;g&&(f[h.id]=f[h.id]||[],f[h.id].push({idx:v,child:d.splice(v,1)[0]}))}}),u=o?o(a,i.get("layout")):a,m0(u,function(h){var d=f[h.id];if(d!=null&&d.length)for(var v=d.length-1;v>=0;v--){var p=d[v],g=p.idx,y=p.child;h.children.splice(g,0,y)}})}else u=o?o(a,i.get("layout")):a;var l=i.get("animate");if(i.emit("beforerefreshlayout",{data:a,layoutData:u}),i.emit("beforelayout"),i.innerUpdateChild(u,void 0,l),t){var c=i.get("viewController");c.fitView()}l?i.layoutAnimate(u):(i.refresh(),i.paint()),i.emit("afterrefreshlayout",{data:a,layoutData:u}),i.emit("afterlayout")},e.prototype.addChild=function(t,n,i){i===void 0&&(i=!0);var a=this;a.emit("beforeaddchild",{model:t,parent:n}),Pe(n)||(n=n.get("id"));var o=a.findDataById(n);if(o){o.children||(o.children=[]),o.children.push(t);var s=a.findById(n);s.refresh(),a.changeData(void 0,i)}},e.prototype.updateChildren=function(t,n,i){i===void 0&&(i=!0);var a=this,o=a.findById(n);if(!n||!o){console.warn("Update children failed! There is no node with id '".concat(n,"'"));return}var s=a.findDataById(n);s.children=t,o.refresh(),a.changeData(void 0,i)},e.prototype.updateChild=function(t,n,i){i===void 0&&(i=!0);var a=this;if(!n||!a.findById(n)){a.changeData(t,i);return}var o=a.findDataById(n),s=a.findById(t.id);if(o.children||(o.children=[]),!s)o.children.push(t);else{var u=e.indexOfChild(o.children,t.id);u>-1&&(o.children[u]=t)}var f=a.findById(n);f==null||f.refresh(),a.changeData(void 0,i)},e.prototype.removeChild=function(t,n){n===void 0&&(n=!0);var i=this,a=i.findById(t),o;if(a?o=a==null?void 0:a.get("parent"):o=i.getNodes().find(function(c){var h=c.getModel().children||[];return!!h.find(function(d){return d.id===t})}),o&&!o.destroyed){var s=o.get("id"),u=i.findDataById(s),f=u&&u.children||[],l=e.indexOfChild(f,t);f.splice(l,1),o.refresh()}i.changeData(void 0,n)},e.prototype.findDataById=function(t,n){var i=this;if(n||(n=i.get("data")),t===n.id)return n;var a=null;return me(n.children||[],function(o){if(o.id===t)return a=o,!1;if(a=i.findDataById(t,o),a)return!1}),a},e.prototype.layoutAnimate=function(t,n){var i=this,a=this.get("animateCfg");i.emit("beforeanimate",{data:t}),i.getEdges().forEach(function(o){var s=o.get("model");s.sourceAnchor||(s.sourceAnchor=o.get("sourceAnchorIndex"))}),this.get("canvas").animate(function(o){m0(t,function(s){var u=i.findById(s.id);if(u){var f=u.get("originAttrs"),l=u.get("model");if(f||(f={x:l.x,y:l.y},u.set("originAttrs",f)),n){var c=n(u,o,f,t);u.set("model",Object.assign(l,c))}else l.x=f.x+(s.x-f.x)*o,l.y=f.y+(s.y-f.y)*o}return!0}),me(i.get("removeList"),function(s){var u=s.getModel(),f=s.get("originAttrs"),l=s.get("to");u.x=f.x+(l.x-f.x)*o,u.y=f.y+(l.y-f.y)*o}),i.refreshPositions()},{duration:a.duration,easing:a.ease,callback:function(){me(i.getNodes(),function(s){s.set("originAttrs",null)}),me(i.get("removeList"),function(s){i.removeItem(s,!1)}),i.set("removeList",[]),a.callback&&a.callback(),i.emit("afteranimate",{data:t})},delay:a.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){t===void 0&&(t=!0);var n=this,i=n.get("data");if(!i||!yn(i)||!Object.keys(i).length)throw new Error("data must be defined first");n.clear(),t&&this.get("enabledStack")&&this.clearStack(),n.emit("beforerender"),n.layout(this.get("fitView")),n.emit("afterrender")},e.prototype.save=function(){return this.get("data")},e.prototype.data=function(t){r.prototype.data.call(this,t),this.set("originData",Mce(t))},e}(sD),jn=function(){function r(e){this._cfgs=yr(this.getDefaultCfgs(),e),this._events={},this.destroyed=!1}return r.prototype.getDefaultCfgs=function(){return{}},r.prototype.initPlugin=function(e){var t=this;t.set("graph",e);var n=t.getEvents(),i={};me(n,function(a,o){var s=cs(t,a);i[o]=s,e.on(o,s)}),this._events=i,this.init()},r.prototype.getEvents=function(){return{}},r.prototype.get=function(e){var t;return(t=this._cfgs)===null||t===void 0?void 0:t[e]},r.prototype.set=function(e,t){this._cfgs[e]=t},r.prototype.destroy=function(){},r.prototype.destroyPlugin=function(){this.destroy();var e=this.get("graph"),t=this._events;me(t,function(n,i){e.off(i,n)}),this._events=null,this._cfgs=null,this.destroyed=!0},r}(),Tce=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),uM="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",Ice=function(r){Tce(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{img:uM,follow:!0}},e.prototype.init=function(){var t=this.get("graph"),n=t.get("container"),i=t.get("canvas").get("el"),a=this.get("img")||uM;a.includes("url(")||(a='url("'.concat(a,'")'));var o=Er(`<div class='g6-grid-container' style="position:absolute;overflow:hidden;z-index: -1;"></div>`),s=Er(`<div
|
|
482
|
-
class='g6-grid'
|
|
483
|
-
style='position:absolute;
|
|
484
|
-
background-image: `.concat(a,`;
|
|
485
|
-
user-select: none
|
|
486
|
-
'></div>`));this.set("container",o),this.set("gridContainer",s),this.positionInit(),o.appendChild(s),n.insertBefore(o,i)},e.prototype.positionInit=function(){var t=this.get("graph"),n=t.get("minZoom"),i=t.get("width"),a=t.get("height");Xt(this.get("container"),{width:"".concat(i,"px"),height:"".concat(a,"px")});var o=i*80/n,s=a*80/n;Xt(this.get("gridContainer"),{width:"".concat(o,"px"),height:"".concat(s,"px"),left:"-".concat(o/2,"px"),top:"-".concat(s/2,"px")})},e.prototype.getEvents=function(){return{viewportchange:"updateGrid"}},e.prototype.updateGrid=function(t){var n=this.get("gridContainer"),i=t.matrix;i||(i=[1,0,0,0,1,0,0,0,1]);var a=this.get("follow"),o="matrix(".concat(i[0],", ").concat(i[1],", ").concat(i[3],", ").concat(i[4],", ").concat(a?i[6]:"0",", ").concat(a?i[7]:"0",")");Xt(n,{transform:o})},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t=this.get("graph"),n=t.get("container"),i=this.get("container");n.removeChild(i)},e}(jn),Sb={exports:{}},fM=[],zf=[],kce="insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";function fD(r,e){if(e=e||{},r===void 0)throw new Error(kce);var t=e.prepend===!0?"prepend":"append",n=e.container!==void 0?e.container:document.querySelector("head"),i=fM.indexOf(n);i===-1&&(i=fM.push(n)-1,zf[i]={});var a;return zf[i]!==void 0&&zf[i][t]!==void 0?a=zf[i][t]:(a=zf[i][t]=Lce(),t==="prepend"?n.insertBefore(a,n.childNodes[0]):n.appendChild(a)),r.charCodeAt(0)===65279&&(r=r.substr(1,r.length)),a.styleSheet?a.styleSheet.cssText+=r:a.textContent+=r,a}function Lce(){var r=document.createElement("style");return r.setAttribute("type","text/css"),r}Sb.exports=fD;Sb.exports.insertCss=fD;var Nce=Sb.exports;const dp=pa(Nce);var Oce=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();typeof document<"u"&&dp(`
|
|
487
|
-
.g6-component-contextmenu {
|
|
488
|
-
border: 1px solid #e2e2e2;
|
|
489
|
-
border-radius: 4px;
|
|
490
|
-
font-size: 12px;
|
|
491
|
-
color: #545454;
|
|
492
|
-
background-color: rgba(255, 255, 255, 0.9);
|
|
493
|
-
padding: 10px 8px;
|
|
494
|
-
box-shadow: rgb(174, 174, 174) 0px 0px 10px;
|
|
495
|
-
}
|
|
496
|
-
.g6-contextmenu-ul {
|
|
497
|
-
padding: 0;
|
|
498
|
-
margin: 0;
|
|
499
|
-
list-style: none;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
`);var Dce=function(r){Oce(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,getContent:function(n){return`
|
|
503
|
-
<ul class='g6-contextmenu-ul'>
|
|
504
|
-
<li>菜单项1</li>
|
|
505
|
-
<li>菜单项2</li>
|
|
506
|
-
</ul>
|
|
507
|
-
`},shouldBegin:function(n){return!0},onHide:function(){return!0},itemTypes:["node","edge","combo"],trigger:"contextmenu"}},e.prototype.getEvents=function(){return this.get("trigger")==="click"?{click:"onMenuShow",touchend:"onMenuShow"}:{contextmenu:"onMenuShow"}},e.prototype.init=function(){var t=this.get("className"),n=Er("<div class=".concat(t||"g6-component-contextmenu","></div>"));Xt(n,{top:"0px",position:"absolute",visibility:"hidden"});var i=this.get("container");i||(i=this.get("graph").get("container")),Pe(i)&&(i=document.getElementById(i)),i.appendChild(n),this.set("menu",n)},e.prototype.onMenuShow=function(t){var n=this;t.preventDefault();var i=this.get("itemTypes");if(t.item){if(t.item&&t.item.getType&&i.indexOf(t.item.getType())===-1){n.onMenuHide();return}}else if(i.indexOf("canvas")===-1){n.onMenuHide();return}var a=this.get("shouldBegin");if(a(t)){var o=this.get("menu"),s=this.get("getContent"),u=this.get("graph"),f=s(t,u);Pe(f)?o.innerHTML=f:o.innerHTML=f.outerHTML,this.removeMenuEventListener();var l=this.get("handleMenuClick");if(l){var c=function(M){l(M.target,t.item,u)};this.set("handleMenuClickWrapper",c),o.addEventListener("click",c)}var h=u.get("width"),d=u.get("height"),v=o.getBoundingClientRect(),p=this.get("offsetX")||0,g=this.get("offsetY")||0,y=u.getContainer().offsetTop,m=u.getContainer().offsetLeft,b=t.canvasX+m+p,x=t.canvasY+y+g;b+v.width>h&&(b=t.canvasX-v.width-p+m),x+v.height>d&&(x=t.canvasY-v.height-g+y),x<0&&(x=0),Xt(o,{top:"".concat(x,"px"),left:"".concat(b,"px"),visibility:"visible"});var w=this.get("trigger")==="click",E=function(M){if(w){w=!1;return}n.onMenuHide()};document.body.addEventListener("click",E),this.set("handler",E)}},e.prototype.removeMenuEventListener=function(){var t=this.get("handleMenuClickWrapper"),n=this.get("handler");if(t){var i=this.get("menu");i.removeEventListener("click",t),this.set("handleMenuClickWrapper",null)}n&&document.body.removeEventListener("click",n)},e.prototype.onMenuHide=function(){var t=this.get("menu");t&&Xt(t,{visibility:"hidden"}),this.removeMenuEventListener()},e.prototype.destroy=function(){var t=this.get("menu");if(this.removeMenuEventListener(),t){var n=this.get("container");n||(n=this.get("graph").get("container")),Pe(n)&&(n=document.getElementById(n)),n.removeChild(t)}},e}(jn),Pce=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Jy=function(){return Jy=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Jy.apply(this,arguments)},lM=Math.max,Rce=yi,Bce="default",Fce="keyShape",Gce="delegate",cM="svg",zce=function(r){Pce(e,r);function e(t){var n=r.call(this,t)||this;return n.handleUpdateCanvas=jl(function(i){var a=n;a.destroyed||a.updateCanvas()},100,!1),n}return e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",type:"default",padding:50,size:[200,120],delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0,hideEdge:!1}},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,n=this._cfgs,i=n.size,a=n.graph;if(!this.destroyed){var o=this.get("canvas"),s=o.get("container"),u=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,f=navigator.userAgent.toLowerCase().indexOf("safari")>-1,l=Er(`
|
|
508
|
-
<div
|
|
509
|
-
class=`.concat(n.viewportClassName,`
|
|
510
|
-
style='position:absolute;
|
|
511
|
-
left:0;
|
|
512
|
-
top:0;
|
|
513
|
-
box-sizing:border-box;
|
|
514
|
-
outline: 2px solid #1980ff;
|
|
515
|
-
cursor:move'
|
|
516
|
-
draggable=`).concat(!(f||u),`
|
|
517
|
-
</div>`)),c=0,h=0,d=!1,v=0,p=0,g=0,y=0,m=0,b=0,x=f||u?"mousedown":"dragstart";l.addEventListener(x,function(M){var C,S;if(M.dataTransfer){var A=new Image;A.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",(S=(C=M.dataTransfer).setDragImage)===null||S===void 0||S.call(C,A,0,0);try{M.dataTransfer.setData("text/html","view-port-minimap")}catch{M.dataTransfer.setData("text","view-port-minimap")}}if(n.refresh=!1,M.target===l){var T=l.style;v=parseInt(T.left,10),p=parseInt(T.top,10),g=parseInt(T.width,10),y=parseInt(T.height,10),!(g>i[0]||y>i[1])&&(b=a.getZoom(),m=t.get("ratio"),d=!0,c=M.clientX,h=M.clientY)}},!1);var w=function(C){if(!(!d||ct(C.clientX)||ct(C.clientY))){var S=c-C.clientX,A=h-C.clientY;(v-S<0||v-S+g>=i[0])&&(S=0),(p-A<0||p-A+y>=i[1])&&(A=0),v-=S,p-=A,Xt(l,{left:"".concat(v,"px"),top:"".concat(p,"px")}),a.translate(S*b/m,A*b/m),c=C.clientX,h=C.clientY}};!f&&!u&&l.addEventListener("drag",w,!1);var E=function(){d=!1,n.refresh=!0},_=f||u?"mouseup":"dragend";l.addEventListener(_,E,!1),s.addEventListener("mouseleave",E),s.addEventListener("mouseup",E),(f||u)&&s.addEventListener("mousemove",w,!1),this.set("viewport",l),s.appendChild(l)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),n=this.get("totaldx"),i=this.get("totaldy"),a=this.get("graph"),o=this.get("size"),s=a.get("canvas").get("el"),u=a.get("width")||s.scrollWidth||500,f=a.get("height")||s.scrollHeight||500,l=a.getPointByCanvas(0,0),c=a.getPointByCanvas(u,f),h=this.get("viewport");h||this.initViewport();var d=(c.x-l.x)*t,v=(c.y-l.y)*t,p=l.x*t+n,g=l.y*t+i,y=p+d,m=g+v;p<0&&(d+=p,p=0),y>o[0]&&(d=d-(y-o[0])),g<0&&(v+=g,g=0),m>o[1]&&(v=v-(m-o[1])),this.set("ratio",t);var b="".concat(p,"px"),x="".concat(g,"px");Xt(h,{left:b,top:x,width:"".concat(d,"px"),height:"".concat(v,"px")})}},e.prototype.updateGraphShapes=function(){var t=this._cfgs.graph,n=this.get("canvas"),i=t.get("group");if(!i.destroyed){n.clear();var a;this.get("hideEdge")?(a=n.addGroup(),i.get("children").forEach(function(s){s.get("id").includes("-edge")||a.add(s.clone())})):(a=i.clone(),a.resetMatrix(),n.add(a));var o=t.get("renderer");o===cM&&this.updateVisible(a)}},e.prototype.updateVisible=function(t){var n=this;if(!t.isGroup()&&!t.get("visible"))t.hide();else{var i=t.get("children");if(!i||!i.length)return;i.forEach(function(a){a.get("visible")||a.hide(),n.updateVisible(a)})}},e.prototype.updateKeyShapes=function(){var t=this,n=this._cfgs.graph,i=this.get("canvas"),a=i.get("children")[0]||i.addGroup();this.get("hideEdge")||me(n.getEdges(),function(u){t.updateOneEdgeKeyShape(u,a)}),me(n.getNodes(),function(u){t.updateOneNodeKeyShape(u,a)});var o=n.getCombos();if(o&&o.length){var s=a.find(function(u){return u.get("name")==="comboGroup"})||a.addGroup({name:"comboGroup"});setTimeout(function(){t.destroyed||(me(o,function(u){t.updateOneComboKeyShape(u,s)}),s==null||s.sort(),s==null||s.toBack(),t.updateCanvas())},250)}this.clearDestroyedShapes()},e.prototype.updateOneComboKeyShape=function(t,n){if(!this.destroyed){var i=this.get("itemMap")||{},a=i[t.get("id")],o=t.getBBox(),s=t.get("keyShape").clone(),u=s.attr(),f={x:o.centerX,y:o.centerY};a?f=Object.assign(u,f):(a=s,n.add(a));var l=a.get("type");(l==="rect"||l==="image")&&(f.x=o.minX,f.y=o.minY),a.attr(f),t.isVisible()?a.show():a.hide(),a.exist=!0;var c=t.getModel().depth;isNaN(c)||a.set("zIndex",c),i[t.get("id")]=a,this.set("itemMap",i)}},e.prototype.updateOneNodeKeyShape=function(t,n){var i=this.get("itemMap")||{},a=i[t.get("id")],o=t.getBBox(),s=t.get("keyShape").clone(),u=s.attr(),f={x:o.centerX,y:o.centerY};a?(f=Object.assign(u,f),a.toFront()):(a=s,n.add(a));var l=a.get("type");(l==="rect"||l==="image")&&(f.x=o.minX,f.y=o.minY),a.attr(f),t.isVisible()?a.show():a.hide(),a.exist=!0;var c=t.getModel().depth;isNaN(c)||a.set("zIndex",c),i[t.get("id")]=a,this.set("itemMap",i)},e.prototype.updateDelegateShapes=function(){var t=this,n=this._cfgs.graph,i=this.get("canvas"),a=i.get("children")[0]||i.addGroup();this.get("hideEdge")||me(n.getEdges(),function(u){t.updateOneEdgeKeyShape(u,a)}),me(n.getNodes(),function(u){t.updateOneNodeDelegateShape(u,a)});var o=n.getCombos();if(o&&o.length){var s=a.find(function(u){return u.get("name")==="comboGroup"})||a.addGroup({name:"comboGroup"});setTimeout(function(){t.destroyed||(me(o,function(u){t.updateOneComboKeyShape(u,s)}),s==null||s.sort(),s==null||s.toBack(),t.updateCanvas())},250)}this.clearDestroyedShapes()},e.prototype.clearDestroyedShapes=function(){var t=this.get("itemMap")||{},n=Object.keys(t);if(!(!n||n.length===0))for(var i=n.length-1;i>=0;i--){var a=t[n[i]],o=a.exist;a.exist=!1,o||(a.remove(),delete t[n[i]])}},e.prototype.updateOneEdgeKeyShape=function(t,n){var i=this.get("itemMap")||{},a=i[t.get("id")];if(a){var o=t.get("keyShape").attr("path");a.attr("path",o)}else a=t.get("keyShape").clone(),n.add(a);t.isVisible()?a.show():a.hide(),a.exist=!0,i[t.get("id")]=a,this.set("itemMap",i)},e.prototype.updateOneNodeDelegateShape=function(t,n){var i=this.get("delegateStyle"),a=this.get("itemMap")||{},o=a[t.get("id")],s=t.getBBox();if(o){var u={x:s.minX,y:s.minY,width:s.width,height:s.height};o.attr(u),o.toFront()}else o=n.addShape("rect",{attrs:Jy({x:s.minX,y:s.minY,width:s.width,height:s.height},i),name:"minimap-node-shape"});t.isVisible()?o.show():o.hide(),o.exist=!0,a[t.get("id")]=o,this.set("itemMap",a)},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,n=t.get("graph"),i=t.get("size"),a=t.get("className"),o=t.get("container"),s=Er("<div class='".concat(a,"' style='width: ").concat(i[0],"px; height: ").concat(i[1],"px; overflow: hidden'></div>"));Pe(o)&&(o=document.getElementById(o)),o?o.appendChild(s):n.get("container").appendChild(s),t.set("container",s);var u=Er('<div class="g6-minimap-container" style="position: relative;"></div>');s.appendChild(u),u.addEventListener("dragenter",function(c){c.preventDefault()}),u.addEventListener("dragover",function(c){c.preventDefault()});var f,l=n.get("renderer");l===cM?f=new al({container:u,width:i[0],height:i[1]}):f=new Ra({container:u,width:i[0],height:i[1]}),t.set("canvas",f),t.updateCanvas()},e.prototype.updateCanvas=function(){if(!this.destroyed){var t=this.get("refresh");if(t){var n=this.get("graph");if(!n.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var i=this.get("size"),a=this.get("canvas"),o=this.get("type"),s=this.get("padding");if(!a.destroyed){switch(o){case Bce:this.updateGraphShapes();break;case Fce:this.updateKeyShapes();break;case Gce:this.updateDelegateShapes();break}var u=a.get("children")[0];if(u){u.resetMatrix();var f=u.getCanvasBBox(),l=n.get("canvas").getCanvasBBox(),c=n.getZoom()||1,h=l.width/c,d=l.height/c;Number.isFinite(f.width)&&(h=lM(f.width,h),d=lM(f.height,d)),h+=2*s,d+=2*s;var v=Math.min(i[0]/h,i[1]/d),p=[1,0,0,0,1,0,0,0,1],g=0,y=0;Number.isFinite(f.minX)&&(g=-f.minX),Number.isFinite(f.minY)&&(y=-f.minY);var m=(i[0]-(h-2*s)*v)/2,b=(i[1]-(d-2*s)*v)/2;p=Rce(p,[["t",g,y],["s",v,v],["t",m,b]]),u.setMatrix(p),this.set("ratio",v),this.set("totaldx",m+g*v),this.set("totaldy",b+y*v),this.set("dx",m),this.set("dy",b),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;(t=this.get("canvas"))===null||t===void 0||t.destroy();var n=this.get("container");n!=null&&n.parentNode&&n.parentNode.removeChild(n)},e}(jn),$ce=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();function qi(r,e,t){var n=r.x-e.x,i=r.y-e.y;return Math.sqrt(n*n+i*i)}function jce(r,e){return r.x*e.x+r.y*e.y}function hM(r,e){var t=(e.source.y-e.target.y)/(e.source.x-e.target.x),n=(t*t*e.source.x+t*(r.y-e.source.y)+r.x)/(t*t+1),i=t*(n-e.source.x)+e.source.y;return{x:n,y:i}}var Uce=function(r){$ce(e,r);function e(t){return r.call(this,t)||this}return 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"),n=this.get("onTick"),i=function(){n&&n(),t.refreshPositions()};this.set("tick",i)},e.prototype.bundling=function(t){var n=this;if(n.set("data",t),!n.isTicking()){var i=t.edges||[],a=t.nodes||[],o={},s=!1;if(a.forEach(function(x){(x.x===null||!x.y===null||x.x===void 0||!x.y===void 0)&&(s=!0),o[x.id]=x}),s)throw new Error("please layout the graph or assign x and y for nodes first");n.set("nodeIdMap",o);var u=n.get("divisions"),f=n.get("divRate"),l=n.divideEdges(u);n.set("edgePoints",l);var c=n.getEdgeBundles();n.set("edgeBundles",c);for(var h=n.get("cycles"),d=n.get("iterations"),v=n.get("iterRate"),p=n.get("lambda"),g=0;g<h;g++){for(var y=function(w){var E=[];i.forEach(function(_,M){if(_.source!==_.target){var C=o[_.source],S=o[_.target];E[M]=n.getEdgeForces({source:C,target:S},M,u,p);for(var A=0;A<u+1;A++)l[M][A].x+=E[M][A].x,l[M][A].y+=E[M][A].y}})},m=0;m<d;m++)y(m);p=p/2,u*=f,d*=v,l=n.divideEdges(u),n.set("edgePoints",l)}i.forEach(function(x,w){x.source!==x.target&&(x.type="polyline",x.controlPoints=l[w].slice(1,l[w].length-1))});var b=n.get("graph");b.refresh()}},e.prototype.updateBundling=function(t){var n=this,i=t.data;if(i&&n.set("data",i),n.get("ticking")&&n.set("ticking",!1),Object.keys(t).forEach(function(o){n.set(o,t[o])}),t.onTick){var a=this.get("graph");n.set("tick",function(){t.onTick(),a.refresh()})}n.bundling(i)},e.prototype.divideEdges=function(t){var n=this,i=n.get("data").edges,a=n.get("nodeIdMap"),o=n.get("edgePoints");return(!o||o===void 0)&&(o=[]),i.forEach(function(s,u){var f;(!o[u]||o[u]===void 0)&&(o[u]=[]);var l=a[s.source],c=a[s.target];if(t===1)o[u].push({x:l.x,y:l.y}),o[u].push({x:.5*(l.x+c.x),y:.5*(l.y+c.y)}),o[u].push({x:c.x,y:c.y});else{var h=0;!((f=o[u])===null||f===void 0)&&f.length?h=n.getEdgeLength(o[u]):h=qi({x:l.x,y:l.y},{x:c.x,y:c.y});var d=h/(t+1),v=d,p=[{x:l.x,y:l.y}];o[u].forEach(function(g,y){if(y!==0){for(var m=qi(g,o[u][y-1]);m>v;){var b=v/m,x={x:o[u][y-1].x,y:o[u][y-1].y};x.x+=b*(g.x-o[u][y-1].x),x.y+=b*(g.y-o[u][y-1].y),p.push(x),m-=v,v=d}v-=m}}),p.push({x:c.x,y:c.y}),o[u]=p}}),o},e.prototype.getEdgeLength=function(t){var n=0;return t.forEach(function(i,a){a!==0&&(n+=qi(i,t[a-1]))}),n},e.prototype.getEdgeBundles=function(){var t=this,n=t.get("data"),i=n.edges||[],a=t.get("bundleThreshold"),o=t.get("nodeIdMap"),s=t.get("edgeBundles");return s||(s=[]),i.forEach(function(u,f){(!s[f]||s[f]===void 0)&&(s[f]=[])}),i.forEach(function(u,f){var l=o[u.source],c=o[u.target];i.forEach(function(h,d){if(!(d<=f)){var v=o[h.source],p=o[h.target],g=t.getBundleScore({source:l,target:c},{source:v,target:p});g>=a&&(s[f].push(d),s[d].push(f))}})}),s},e.prototype.getBundleScore=function(t,n){var i=this;t.vx=t.target.x-t.source.x,t.vy=t.target.y-t.source.y,n.vx=n.target.x-n.source.x,n.vy=n.target.y-n.source.y,t.length=qi({x:t.source.x,y:t.source.y},{x:t.target.x,y:t.target.y}),n.length=qi({x:n.source.x,y:n.source.y},{x:n.target.x,y:n.target.y});var a=i.getAngleScore(t,n),o=i.getScaleScore(t,n),s=i.getPositionScore(t,n),u=i.getVisibilityScore(t,n);return a*o*s*u},e.prototype.getAngleScore=function(t,n){var i=jce({x:t.vx,y:t.vy},{x:n.vx,y:n.vy});return i/(t.length*n.length)},e.prototype.getScaleScore=function(t,n){var i=(t.length+n.length)/2,a=2/(i/Math.min(t.length,n.length)+Math.max(t.length,n.length)/i);return a},e.prototype.getPositionScore=function(t,n){var i=(t.length+n.length)/2,a={x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2},o={x:(n.source.x+n.target.x)/2,y:(n.source.y+n.target.y)/2},s=qi(a,o);return i/(i+s)},e.prototype.getVisibilityScore=function(t,n){var i=this.getEdgeVisibility(t,n),a=this.getEdgeVisibility(n,t);return i<a?i:a},e.prototype.getEdgeVisibility=function(t,n){var i=hM(n.source,t),a=hM(n.target,t),o={x:(i.x+a.x)/2,y:(i.y+a.y)/2},s={x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2};return Math.max(0,1-2*qi(o,s)/qi(i,a))},e.prototype.getEdgeForces=function(t,n,i,a){for(var o=this,s=o.get("edgePoints"),u=o.get("K"),f=u/(qi(t.source,t.target)*(i+1)),l=[{x:0,y:0}],c=1;c<i;c++){var h={x:0,y:0},d=o.getSpringForce({pre:s[n][c-1],cur:s[n][c],next:s[n][c+1]},f),v=o.getElectrostaticForce(c,n);h.x=a*(d.x+v.x),h.y=a*(d.y+v.y),l.push(h)}return l.push({x:0,y:0}),l},e.prototype.getSpringForce=function(t,n){var i=t.pre.x+t.next.x-2*t.cur.x,a=t.pre.y+t.next.y-2*t.cur.y;return i*=n,a*=n,{x:i,y:a}},e.prototype.getElectrostaticForce=function(t,n){var i=this,a=i.get("eps"),o=i.get("edgeBundles"),s=i.get("edgePoints"),u=o[n],f={x:0,y:0};return u.forEach(function(l){var c={x:s[l][t].x-s[n][t].x,y:s[l][t].y-s[n][t].y};if(Math.abs(c.x)>a||Math.abs(c.y)>a){var h=qi(s[l][t],s[n][t]),d=1/h;f.x+=c.x*d,f.y+=c.y*d}}),f},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(),r.prototype.destroy.call(this)},e}(jn),Xce=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),em=function(){return em=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},em.apply(this,arguments)},zh=.05,dM={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:.1,fill:"#ccc"},Yce=function(r){Xce(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{trigger:"mousemove",d:1.5,r:300,delegateStyle:Vt(dM),showLabel:!1,maxD:5,minD:0,scaleRBy:"unset",scaleDBy:"unset",showDPercent:!0}},e.prototype.getEvents=function(){var t;switch(this.get("trigger")){case"click":t={click:"magnify"};break;case"drag":t={click:"createDelegate"};break;default:t={mousemove:"magnify"};break}return t},e.prototype.init=function(){var t=this,n=t.get("r");t.set("cachedMagnifiedModels",[]),t.set("cachedOriginPositions",{}),t.set("r2",n*n);var i=t.get("d");t.set("molecularParam",(i+1)*n)},e.prototype.createDelegate=function(t){var n=this,i=this,a=i.get("delegate");(!a||a.destroyed)&&(i.magnify(t),a=i.get("delegate"),a.on("dragstart",function(o){i.set("delegateCenterDiff",{x:a.attr("x")-o.x,y:a.attr("y")-o.y})}),a.on("drag",function(o){i.magnify(o)}),this.get("scaleDBy")==="wheel"&&a.on("mousewheel",function(o){n.scaleDByWheel(o)}),this.get("scaleRBy")==="wheel"&&a.on("mousewheel",function(o){i.scaleRByWheel(o)}))},e.prototype.scaleRByWheel=function(t){var n=this;if(!(!t||!t.originalEvent)){t.preventDefault&&t.preventDefault();var i=n.get("graph"),a,o=n.get("delegate"),s=o?{x:o.attr("x"),y:o.attr("y")}:void 0,u=s||i.getPointByClient(t.clientX,t.clientY);t.originalEvent.wheelDelta<0?a=1-zh:a=1/(1-zh);var f=n.get("maxR"),l=n.get("minR"),c=n.get("r");(c>(f||i.get("height"))&&a>1||c<(l||i.get("height")*.05)&&a<1)&&(a=1),c*=a,n.set("r",c),n.set("r2",c*c);var h=n.get("d");n.set("molecularParam",(h+1)*c),n.set("delegateCenterDiff",void 0),n.magnify(t,u)}},e.prototype.scaleRByDrag=function(t){var n=this;if(t){var i=n.get("dragPrePos"),a=n.get("graph"),o,s=a.getPointByClient(t.clientX,t.clientY);t.x-i.x<0?o=1-zh:o=1/(1-zh);var u=n.get("maxR"),f=n.get("minR"),l=n.get("r");(l>(u||a.get("height"))&&o>1||l<(f||a.get("height")*.05)&&o<1)&&(o=1),l*=o,n.set("r",l),n.set("r2",l*l);var c=n.get("d");n.set("molecularParam",(c+1)*l),n.magnify(t,s),n.set("dragPrePos",{x:t.x,y:t.y})}},e.prototype.scaleDByWheel=function(t){var n=this;if(!(!t&&!t.originalEvent)){t.preventDefault&&t.preventDefault();var i=0;t.originalEvent.wheelDelta<0?i=-.1:i=.1;var a=n.get("d"),o=a+i,s=n.get("maxD"),u=n.get("minD");if(o<s&&o>u){n.set("d",o);var f=n.get("r");n.set("molecularParam",(o+1)*f);var l=n.get("delegate"),c=l?{x:l.attr("x"),y:l.attr("y")}:void 0;n.set("delegateCenterDiff",void 0),n.magnify(t,c)}}},e.prototype.scaleDByDrag=function(t){var n=this,i=n.get("dragPrePos"),a=t.x-i.x>0?.1:-.1,o=n.get("d"),s=o+a,u=n.get("maxD"),f=n.get("minD");if(s<u&&s>f){n.set("d",s);var l=n.get("r");n.set("molecularParam",(s+1)*l),n.magnify(t)}n.set("dragPrePos",{x:t.x,y:t.y})},e.prototype.magnify=function(t,n){var i=this;i.restoreCache();var a=i.get("graph"),o=i.get("cachedMagnifiedModels"),s=i.get("cachedOriginPositions"),u=i.get("showLabel"),f=i.get("r"),l=i.get("r2"),c=i.get("d"),h=i.get("molecularParam"),d=a.getNodes(),v=d.length,p=n?{x:n.x,y:n.y}:{x:t.x,y:t.y};i.get("dragging")&&(i.get("trigger")==="mousemove"||i.get("trigger")==="click")&&(p=i.get("cacheCenter"));var g=i.get("delegateCenterDiff");g&&(p.x+=g.x,p.y+=g.y),i.updateDelegate(p,f);for(var y=0;y<v;y++){var m=d[y].getModel(),b=m.x,x=m.y;if(!(isNaN(b)||isNaN(x))){var w=(b-p.x)*(b-p.x)+(x-p.y)*(x-p.y);if(!isNaN(w)&&w<l&&w!==0){var E=Math.sqrt(w),_=h*E/(c*E+f),M=(b-p.x)/E,C=(x-p.y)/E;if(m.x=M*_+p.x,m.y=C*_+p.y,s[m.id]||(s[m.id]={x:b,y:x,texts:[]}),o.push(m),u&&2*E<f)for(var S=d[y],A=S.getContainer(),T=A.getChildren(),k=T.length,O=0;O<k;O++){var F=T[O];F.get("type")==="text"&&(s[m.id].texts.push({visible:F.get("visible"),shape:F}),F.set("visible",!0))}}}}a.refreshPositions()},e.prototype.restoreCache=function(){for(var t=this,n=t.get("cachedMagnifiedModels"),i=t.get("cachedOriginPositions"),a=n.length,o=0;o<a;o++){var s=n[o],u=s.id,f=i[u];s.x=f.x,s.y=f.y;for(var l=f.texts.length,c=0;c<l;c++){var h=f.texts[c];h.shape.set("visible",h.visible)}}t.set("cachedMagnifiedModels",[]),t.set("cachedOriginPositions",{})},e.prototype.updateParams=function(t){var n=this,i=t.r,a=t.d,o=t.trigger,s=t.minD,u=t.maxD,f=t.minR,l=t.maxR,c=t.scaleDBy,h=t.scaleRBy;isNaN(t.r)||(n.set("r",i),n.set("r2",i*i)),isNaN(a)||n.set("d",a),isNaN(u)||n.set("maxD",u),isNaN(s)||n.set("minD",s),isNaN(l)||n.set("maxR",l),isNaN(f)||n.set("minR",f);var d=n.get("d"),v=n.get("r");if(n.set("molecularParam",(d+1)*v),(o==="mousemove"||o==="click"||o==="drag")&&n.set("trigger",o),c==="drag"||c==="wheel"||c==="unset"){n.set("scaleDBy",c),n.get("delegate").remove(),n.get("delegate").destroy();var p=n.get("dPercentText");p&&(p.remove(),p.destroy())}if(h==="drag"||h==="wheel"||h==="unset"){n.set("scaleRBy",h),n.get("delegate").remove(),n.get("delegate").destroy();var p=n.get("dPercentText");p&&(p.remove(),p.destroy())}},e.prototype.updateDelegate=function(t,n){var i=this,a=this,o=a.get("graph"),s=a.get("delegate");if(!s||s.destroyed){var u=o.get("group"),f=a.get("delegateStyle")||dM;s=u.addShape("circle",{attrs:em({r:n/1.5,x:t.x,y:t.y},f),name:"lens-shape",draggable:!0}),this.get("trigger")!=="drag"&&(this.get("scaleRBy")==="wheel"?s.on("mousewheel",function(v){a.scaleRByWheel(v)}):this.get("scaleRBy")==="drag"&&(s.on("dragstart",function(v){a.set("dragging",!0),a.set("cacheCenter",{x:v.x,y:v.y}),a.set("dragPrePos",{x:v.x,y:v.y})}),s.on("drag",function(v){a.scaleRByDrag(v)}),s.on("dragend",function(v){a.set("dragging",!1)})),this.get("scaleDBy")==="wheel"?s.on("mousewheel",function(v){i.scaleDByWheel(v)}):this.get("scaleDBy")==="drag"&&(s.on("dragstart",function(v){a.set("dragging",!0),a.set("cacheCenter",{x:v.x,y:v.y}),a.set("dragPrePos",{x:v.x,y:v.y})}),s.on("drag",function(v){i.scaleDByDrag(v)}),s.on("dragend",function(v){a.set("dragging",!1)})))}else s.attr({x:t.x,y:t.y,r:n/1.5});if(a.get("showDPercent")){var l=Math.round((a.get("d")-a.get("minD"))/(a.get("maxD")-a.get("minD"))*100),c=a.get("dPercentText"),h=t.y+n/1.5+16;if(!c||c.destroyed){var d=o.get("group");c=d.addShape("text",{attrs:{text:"".concat(l,"%"),x:t.x,y:h,fill:"#aaa",stroke:"#fff",lineWidth:1,fontSize:12}}),a.set("dPercentText",c)}else c.attr({text:"".concat(l,"%"),x:t.x,y:h})}a.set("delegate",s)},e.prototype.clear=function(){var t=this.get("graph");this.restoreCache(),t.refreshPositions();var n=this.get("delegate");n&&!n.destroyed&&(n.remove(),n.destroy());var i=this.get("dPercentText");i&&!i.destroyed&&(i.remove(),i.destroy())},e.prototype.destroy=function(){this.clear()},e}(jn),Wce=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),vM=.05;typeof document<"u"&&dp(`
|
|
518
|
-
.g6-component-toolbar {
|
|
519
|
-
position: absolute;
|
|
520
|
-
list-style-type: none;
|
|
521
|
-
padding: 6px;
|
|
522
|
-
left: 0px;
|
|
523
|
-
top: 0px;
|
|
524
|
-
background-color: rgba(255, 255, 255, 0.9);
|
|
525
|
-
border: 1px solid #e2e2e2;
|
|
526
|
-
border-radius: 4px;
|
|
527
|
-
font-size: 12px;
|
|
528
|
-
color: #545454;
|
|
529
|
-
margin: 0;
|
|
530
|
-
}
|
|
531
|
-
.g6-component-toolbar li {
|
|
532
|
-
float: left;
|
|
533
|
-
text-align: center;
|
|
534
|
-
width: 35px;
|
|
535
|
-
height: 24px;
|
|
536
|
-
cursor: pointer;
|
|
537
|
-
list-style-type:none;
|
|
538
|
-
list-style: none;
|
|
539
|
-
margin-left: 0px;
|
|
540
|
-
}
|
|
541
|
-
.g6-component-toolbar li .icon {
|
|
542
|
-
opacity: 0.7;
|
|
543
|
-
}
|
|
544
|
-
.g6-component-toolbar li .icon:hover {
|
|
545
|
-
opacity: 1;
|
|
546
|
-
}
|
|
547
|
-
`);var Vce=function(e){if(!e)return[];if(e.composedPath)return e.composedPath();for(var t=[],n=e.target;n;){if(t.push(n),n.tagName==="HTML")return t.push(document,window),t;n=n.parentElement}return t},Hce=function(r){Wce(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{handleClick:void 0,getContent:function(n){return`
|
|
548
|
-
<ul class='g6-component-toolbar'>
|
|
549
|
-
<li code='redo'>
|
|
550
|
-
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
|
551
|
-
<path d="M256 682.666667c0-102.741333 66.730667-213.333333 213.333333-213.333334 107.008 0 190.762667 56.576 230.570667 125.354667L611.968 682.666667H853.333333v-241.365334l-91.562666 91.562667C704.768 448.469333 601.130667 384 469.333333 384c-196.096 0-298.666667 150.229333-298.666666 298.666667h85.333333z" fill="" p-id="2041"></path>
|
|
552
|
-
</svg>
|
|
553
|
-
</li>
|
|
554
|
-
<li code='undo'>
|
|
555
|
-
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
|
556
|
-
<path d="M170.666667 682.666667h241.365333l-87.936-87.978667C363.904 525.909333 447.658667 469.333333 554.666667 469.333333c146.602667 0 213.333333 110.592 213.333333 213.333334h85.333333c0-148.437333-102.570667-298.666667-298.666666-298.666667-131.797333 0-235.392 64.469333-292.48 148.821333L170.666667 441.301333V682.666667z" fill="" p-id="2764"></path>
|
|
557
|
-
</svg>
|
|
558
|
-
</li>
|
|
559
|
-
<li code='zoomOut'>
|
|
560
|
-
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
|
561
|
-
<path d="M658.432 428.736a33.216 33.216 0 0 1-33.152 33.152H525.824v99.456a33.216 33.216 0 0 1-66.304 0V461.888H360.064a33.152 33.152 0 0 1 0-66.304H459.52V296.128a33.152 33.152 0 0 1 66.304 0V395.52H625.28c18.24 0 33.152 14.848 33.152 33.152z m299.776 521.792a43.328 43.328 0 0 1-60.864-6.912l-189.248-220.992a362.368 362.368 0 0 1-215.36 70.848 364.8 364.8 0 1 1 364.8-364.736 363.072 363.072 0 0 1-86.912 235.968l192.384 224.64a43.392 43.392 0 0 1-4.8 61.184z m-465.536-223.36a298.816 298.816 0 0 0 298.432-298.432 298.816 298.816 0 0 0-298.432-298.432A298.816 298.816 0 0 0 194.24 428.8a298.816 298.816 0 0 0 298.432 298.432z"></path>
|
|
562
|
-
</svg>
|
|
563
|
-
</li>
|
|
564
|
-
<li code='zoomIn'>
|
|
565
|
-
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
|
566
|
-
<path d="M639.936 416a32 32 0 0 1-32 32h-256a32 32 0 0 1 0-64h256a32 32 0 0 1 32 32z m289.28 503.552a41.792 41.792 0 0 1-58.752-6.656l-182.656-213.248A349.76 349.76 0 0 1 480 768 352 352 0 1 1 832 416a350.4 350.4 0 0 1-83.84 227.712l185.664 216.768a41.856 41.856 0 0 1-4.608 59.072zM479.936 704c158.784 0 288-129.216 288-288S638.72 128 479.936 128a288.32 288.32 0 0 0-288 288c0 158.784 129.216 288 288 288z" p-id="3853"></path>
|
|
567
|
-
</svg>
|
|
568
|
-
</li>
|
|
569
|
-
<li code='realZoom'>
|
|
570
|
-
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">
|
|
571
|
-
<path d="M384 320v384H320V320h64z m256 0v384H576V320h64zM512 576v64H448V576h64z m0-192v64H448V384h64z m355.968 576H92.032A28.16 28.16 0 0 1 64 931.968V28.032C64 12.608 76.608 0 95.168 0h610.368L896 192v739.968a28.16 28.16 0 0 1-28.032 28.032zM704 64v128h128l-128-128z m128 192h-190.464V64H128v832h704V256z"></path>
|
|
572
|
-
</svg>
|
|
573
|
-
</li>
|
|
574
|
-
<li code='autoZoom'>
|
|
575
|
-
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">
|
|
576
|
-
<path d="M684.288 305.28l0.128-0.64-0.128-0.64V99.712c0-19.84 15.552-35.904 34.496-35.712a35.072 35.072 0 0 1 34.56 35.776v171.008h170.944c19.648 0 35.84 15.488 35.712 34.432a35.072 35.072 0 0 1-35.84 34.496h-204.16l-0.64-0.128a32.768 32.768 0 0 1-20.864-7.552c-1.344-1.024-2.816-1.664-3.968-2.816-0.384-0.32-0.512-0.768-0.832-1.088a33.472 33.472 0 0 1-9.408-22.848zM305.28 64a35.072 35.072 0 0 0-34.56 35.776v171.008H99.776A35.072 35.072 0 0 0 64 305.216c0 18.944 15.872 34.496 35.84 34.496h204.16l0.64-0.128a32.896 32.896 0 0 0 20.864-7.552c1.344-1.024 2.816-1.664 3.904-2.816 0.384-0.32 0.512-0.768 0.768-1.088a33.024 33.024 0 0 0 9.536-22.848l-0.128-0.64 0.128-0.704V99.712A35.008 35.008 0 0 0 305.216 64z m618.944 620.288h-204.16l-0.64 0.128-0.512-0.128c-7.808 0-14.72 3.2-20.48 7.68-1.28 1.024-2.752 1.664-3.84 2.752-0.384 0.32-0.512 0.768-0.832 1.088a33.664 33.664 0 0 0-9.408 22.912l0.128 0.64-0.128 0.704v204.288c0 19.712 15.552 35.904 34.496 35.712a35.072 35.072 0 0 0 34.56-35.776V753.28h170.944c19.648 0 35.84-15.488 35.712-34.432a35.072 35.072 0 0 0-35.84-34.496z m-593.92 11.52c-0.256-0.32-0.384-0.768-0.768-1.088-1.088-1.088-2.56-1.728-3.84-2.688a33.088 33.088 0 0 0-20.48-7.68l-0.512 0.064-0.64-0.128H99.84a35.072 35.072 0 0 0-35.84 34.496 35.072 35.072 0 0 0 35.712 34.432H270.72v171.008c0 19.84 15.552 35.84 34.56 35.776a35.008 35.008 0 0 0 34.432-35.712V720l-0.128-0.64 0.128-0.704a33.344 33.344 0 0 0-9.472-22.848zM512 374.144a137.92 137.92 0 1 0 0.128 275.84A137.92 137.92 0 0 0 512 374.08z"></path>
|
|
577
|
-
</svg>
|
|
578
|
-
</li>
|
|
579
|
-
</ul>
|
|
580
|
-
`},zoomSensitivity:2}},e.prototype.init=function(){var t=this,n=this.get("graph"),i=this.get("getContent"),a=i(n),o=a;Pe(a)&&(o=Er(a));var s=this.get("className");o.setAttribute("class",s||"g6-component-toolbar");var u=this.get("container");u||(u=this.get("graph").get("container")),Pe(u)&&(u=document.getElementById(u)),u.appendChild(o),this.set("toolBar",o);var f=this.get("handleClick");o.addEventListener("click",function(c){var h=Vce(c).filter(function(v){return v.nodeName==="LI"});if(h.length!==0){var d=h[0].getAttribute("code");d&&(f?f(d,n):t.handleDefaultOperator(d))}});var l=this.get("position");l&&Xt(o,{top:"".concat(l.y,"px"),left:"".concat(l.x,"px")}),this.bindUndoRedo()},e.prototype.bindUndoRedo=function(){var t=this.get("graph"),n=document.querySelector('.g6-component-toolbar li[code="undo"]'),i=document.querySelector('.g6-component-toolbar li[code="undo"] svg'),a=document.querySelector('.g6-component-toolbar li[code="redo"]'),o=document.querySelector('.g6-component-toolbar li[code="redo"] svg');!n||!i||!a||!o||(n.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4"),a.setAttribute("style","cursor: not-allowed"),o.setAttribute("style","opacity: 0.4"),t.on("stackchange",function(s){var u=s.undoStack,f=s.redoStack,l=u.length,c=f.length;l===0?(n.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4")):(n.removeAttribute("style"),i.removeAttribute("style")),c===0?(a.setAttribute("style","cursor: not-allowed"),o.setAttribute("style","opacity: 0.4")):(a.removeAttribute("style"),o.removeAttribute("style"))}))},e.prototype.undo=function(){var t=this.get("graph"),n=t.getUndoStack();if(!(!n||n.length===0)){var i=n.pop();if(i){var a=i.action;t.pushStack(a,Vt(i.data),"redo");var o=i.data.before;if(a==="add"&&(o=i.data.after),!o)return;switch(a){case"visible":{Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){var v=t.findById(d.id);d.visible?t.showItem(v,!1):t.hideItem(v,!1)})});break}case"render":case"update":Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){var v=t.findById(d.id);delete d.id,t.updateItem(v,d,!1),v.getType()==="combo"&&t.updateCombo(v)})});break;case"changedata":t.changeData(o,!1);break;case"delete":{Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){var v=d.itemType;delete d.itemType,t.addItem(v,d,!1)})});break}case"add":Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){t.removeItem(d.id,!1)})});break;case"updateComboTree":Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){t.updateComboTree(d.id,d.parentId,!1)})});break;case"createCombo":var s=i.data.after.combos,u=s[s.length-1];Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){t.updateComboTree(d.id,d.parentId,!1)})}),t.removeItem(u.id,!1);break;case"uncombo":var f=o.combos[o.combos.length-1],l=o.nodes.concat(o.combos).map(function(c){return c.id}).filter(function(c){return c!==f.id});t.createCombo(f,l,!1);break;case"layout":t.updateLayout(o,void 0,void 0,!1);break}}}},e.prototype.redo=function(){var t=this.get("graph"),n=t.getRedoStack();if(!(!n||n.length===0)){var i=n.pop();if(i){var a=i.action,o=i.data.after;if(t.pushStack(a,Vt(i.data)),a==="delete"&&(o=i.data.before),!o)return;switch(a){case"visible":{Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){var d=t.findById(h.id);h.visible?t.showItem(d,!1):t.hideItem(d,!1)})});break}case"render":case"update":Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){var d=t.findById(h.id);delete h.id,t.updateItem(d,h,!1),d.getType()==="combo"&&t.updateCombo(d)})});break;case"changedata":t.changeData(o,!1);break;case"delete":o.edges&&o.edges.forEach(function(l){t.removeItem(l.id,!1)}),o.nodes&&o.nodes.forEach(function(l){t.removeItem(l.id,!1)}),o.combos&&o.combos.forEach(function(l){t.removeItem(l.id,!1)});break;case"add":{Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){var d=h.itemType;delete h.itemType,t.addItem(d,h,!1)})});break}case"updateComboTree":Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){t.updateComboTree(h.id,h.parentId,!1)})});break;case"createCombo":var s=o.combos[o.combos.length-1];t.createCombo(s,s.children.map(function(l){return l.id}),!1);break;case"uncombo":var u=i.data.before.combos,f=u[u.length-1];t.uncombo(f.id,!1);break;case"layout":t.updateLayout(o,void 0,void 0,!1);break}}}},e.prototype.zoomOut=function(){var t=this.get("graph"),n=t.getZoom(),i=1/(1-vM*this.get("zoomSensitivity")),a=this.get("maxZoom")||t.get("maxZoom");i*n>a||t.zoomTo(n*i)},e.prototype.zoomIn=function(){var t=this.get("graph"),n=t.getZoom(),i=1-vM*this.get("zoomSensitivity"),a=this.get("minZoom")||t.get("minZoom");i*n<a||t.zoomTo(n*i)},e.prototype.realZoom=function(){var t=this.get("graph");t.zoomTo(1)},e.prototype.autoZoom=function(){var t=this.get("graph");t.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();break}},e.prototype.destroy=function(){var t=this.get("toolBar");if(t){var n=this.get("container");n||(n=this.get("graph").get("container")),Pe(n)&&(n=document.getElementById(n)),n.removeChild(t)}var i=this.get("handleClick");i&&t.removeEventListener("click",i)},e}(jn),qce=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();typeof document<"u"&&dp(`
|
|
581
|
-
.g6-component-tooltip {
|
|
582
|
-
border: 1px solid #e2e2e2;
|
|
583
|
-
border-radius: 4px;
|
|
584
|
-
font-size: 12px;
|
|
585
|
-
color: #545454;
|
|
586
|
-
background-color: rgba(255, 255, 255, 0.9);
|
|
587
|
-
padding: 10px 8px;
|
|
588
|
-
box-shadow: rgb(174, 174, 174) 0px 0px 10px;
|
|
589
|
-
}
|
|
590
|
-
.tooltip-type {
|
|
591
|
-
padding: 0;
|
|
592
|
-
margin: 0;
|
|
593
|
-
}
|
|
594
|
-
.tooltip-id {
|
|
595
|
-
color: #531dab;
|
|
596
|
-
}
|
|
597
|
-
`);var Zce=function(r){qce(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,getContent:function(n){return`
|
|
598
|
-
<h4 class='tooltip-type'>类型:`.concat(n.item.getType(),`</h4>
|
|
599
|
-
<span class='tooltip-id'>ID:`).concat(n.item.getID(),`</span>
|
|
600
|
-
`)},shouldBegin:function(n){return!0},itemTypes:["node","edge","combo"],trigger:"mouseenter",fixToNode:void 0}},e.prototype.getEvents=function(){return this.get("trigger")==="click"?{"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,n=t.get("className")||"g6-component-tooltip",i=Er("<div class='".concat(n,"'></div>")),a=t.get("container");a||(a=t.get("graph").get("container")),Pe(a)&&(a=document.getElementById(a)),Xt(i,{position:"absolute",visibility:"hidden",display:"none"}),a.appendChild(i),t.get("trigger")!=="click"&&(i.addEventListener("mouseenter",function(o){Xt(i,{visibility:"visible",display:"unset"})}),i.addEventListener("mouseleave",function(o){t.hideTooltip()})),t.set("tooltip",i)},e.prototype.onClick=function(t){var n=this.get("itemTypes");if(!(t.item&&t.item.getType&&n.indexOf(t.item.getType())===-1)){var i=t.item,a=this.get("graph");this.currentTarget===i?(this.currentTarget=null,this.hideTooltip(),a.emit("tooltipchange",{item:t.item,action:"hide"})):(this.currentTarget=i,this.showTooltip(t),a.emit("tooltipchange",{item:t.item,action:"show"}))}},e.prototype.onMouseEnter=function(t){var n=this.get("itemTypes");if(!(t.item&&t.item.getType&&n.indexOf(t.item.getType())===-1)){var i=t.item,a=this.get("graph");this.currentTarget=i,this.showTooltip(t),a.emit("tooltipchange",{item:t.item,action:"show"})}},e.prototype.onMouseMove=function(t){var n=this.get("itemTypes");t.item&&t.item.getType&&n.indexOf(t.item.getType())===-1||!this.currentTarget||t.item!==this.currentTarget||this.showTooltip(t)},e.prototype.onMouseLeave=function(){this.hideTooltip();var t=this.get("graph");t.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 n=this.get("itemTypes");if(!(t.item.getType&&n.indexOf(t.item.getType())===-1)){var i=this.get("tooltip"),a=this.get("getContent"),o=a(t);Pe(o)?i.innerHTML=o:(this.clearContainer(),i.appendChild(o)),this.updatePosition(t)}}},e.prototype.hideTooltip=function(){var t=this.get("tooltip");t&&Xt(t,{visibility:"hidden",display:"none"})},e.prototype.updatePosition=function(t){var n=this.get("shouldBegin"),i=this.get("tooltip");if(!n(t)){Xt(i,{visibility:"hidden",display:"none"});return}var a=this.get("graph"),o=a.get("width"),s=a.get("height"),u=this.get("offsetX")||0,f=this.get("offsetY")||0,l=a.getPointByClient(t.clientX,t.clientY),c=this.get("fixToNode"),h=t.item;if(h.getType&&h.getType()==="node"&&c&&pt(c)&&c.length>=2){var d=h.getBBox();l={x:d.minX+d.width*c[0],y:d.minY+d.height*c[1]}}var v=a.getCanvasByPoint(l.x,l.y),p=v.x,g=v.y,y=a.getContainer(),m={x:p+y.offsetLeft+u,y:g+y.offsetTop+f};Xt(i,{visibility:"visible",display:"unset"});var b=i.getBoundingClientRect();p+b.width+u>o&&(m.x-=b.width+u),g+b.height+f>s&&(m.y-=b.height+f,m.y<0&&(m.y=0)),Xt(i,{left:"".concat(m.x,"px"),top:"".concat(m.y,"px")})},e.prototype.hide=function(){this.onMouseLeave()},e.prototype.destroy=function(){var t=this.get("tooltip");if(t){var n=this.get("container");n||(n=this.get("graph").get("container")),Pe(n)&&(n=document.getElementById(n)),n.removeChild(t)}},e}(jn),lD="timebarstartplay",cD="timebarendplay",ea="valuechange",xs="timebarConfigChanged",Eo="playPauseBtn",Fl="nextStepBtn",Gl="preStepBtn",Kce=function(){function r(e){var t=e.x,n=t===void 0?0:t,i=e.y,a=i===void 0?0:i,o=e.container,s=e.text,u=e.padding,f=u===void 0?[4,4,4,4]:u,l=e.className,c=l===void 0?"g6-component-timebar-tooltip":l,h=e.backgroundColor,d=h===void 0?"#000":h,v=e.textColor,p=v===void 0?"#fff":v,g=e.opacity,y=g===void 0?.8:g,m=e.fontSize,b=m===void 0?12:m;this.container=o,this.className=c,this.backgroundColor=d,this.textColor=p,this.x=n,this.y=a,this.text=s,this.padding=f,this.opacity=y,this.fontSize=b,this.render()}return r.prototype.render=function(){var e=this,t=e.className;e.x,e.y;var n=e.backgroundColor,i=e.textColor,a=e.text,o=e.padding,s=e.opacity,u=e.fontSize,f=e.container,l=Er("<div class='".concat(t,`' style="position: absolute; width: fit-content; height: fit-content; opacity: `).concat(s,'"></div>'));Pe(f)&&(f=document.getElementById(f)),f.appendChild(l),e.parentHeight=f.offsetHeight,e.parentWidth=f.offsetWidth,Xt(l,{visibility:"hidden",top:0,left:0});var c=Er(`
|
|
601
|
-
<div style='position: absolute; white-space:nowrap; background-color: `.concat(n,"; font-size: ").concat(u,"px; border-radius: 4px; width: fit-content; height: fit-content; color: ").concat(i,"; padding: ").concat(o[0],"px ").concat(o[1],"px ").concat(o[2],"px ").concat(o[3],"px'></div>"));c.innerHTML=a,l.appendChild(c),e.backgroundDOM=c;var h=Er("<div style='position: absolute; width: 0px; height: 0px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 10px solid ".concat(n,"'></div>"));l.appendChild(h),e.arrowDOM=h,e.container=l},r.prototype.show=function(e){var t=this,n=e.text,i=e.x;e.y,e.clientX,e.clientY,t.backgroundDOM.innerHTML=n;var a=t.backgroundDOM.offsetWidth,o=t.backgroundDOM.offsetHeight,s=t.arrowDOM.offsetWidth,u=t.arrowDOM.offsetHeight;Xt(t.container,{top:"".concat(-o-u,"px"),left:"".concat(i,"px"),visibility:"visible"}),Xt(t.backgroundDOM,{marginLeft:"".concat(-a/2,"px")}),Xt(t.arrowDOM,{marginLeft:"".concat(-s/2,"px"),top:"".concat(o,"px")});var f=i-a/2,l=i+a/2;f<0?Xt(t.backgroundDOM,{marginLeft:"".concat(-a/2-f,"px")}):l>t.parentWidth&&Xt(t.backgroundDOM,{marginLeft:"".concat(-a/2-l+t.parentWidth+12,"px")})},r.prototype.hide=function(){Xt(this.container,{top:0,left:0,visibility:"hidden"})},r}(),tm=function(){return tm=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},tm.apply(this,arguments)},Qce=function(){function r(e){this.config=yr({},e),this.init()}return r.prototype.update=function(e){this.config=yr({},this.config,e),this.updateElement(),this.renderMarker()},r.prototype.init=function(){this.initElement(),this.renderMarker()},r.prototype.initElement=function(){var e=this.config,t=e.group,n=e.style,i=n.scale,a=i===void 0?1:i,o=n.offsetX,s=o===void 0?0:o,u=n.offsetY,f=u===void 0?0:u,l=this.config.x+s,c=this.config.y+f,h=t.addGroup({name:Eo});this.startMarkerGroup=h.addGroup({name:Eo}),this.circle=t.addShape("circle",{attrs:tm({x:l,y:c,r:this.config.r*a},n),name:Eo}),this.startMarker=this.startMarkerGroup.addShape("path",{attrs:{path:this.getStartMarkerPath(l,c,a),fill:n.stroke||"#aaa"},name:"start-marker"}),this.pauseMarkerGroup=h.addGroup({name:Eo});var d=.25*this.config.r*a,v=.5*this.config.r*Math.sqrt(3)*a;this.pauseLeftMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:l-.375*this.config.r*a,y:c-v/2,width:d,height:v,fill:n.stroke||"#aaa",lineWidth:0}}),this.pauseRightMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:l+1/8*this.config.r*a,y:c-v/2,width:d,height:v,fill:n.stroke||"#aaa",lineWidth:0}})},r.prototype.updateElement=function(){var e=this.config.style,t=e.scale,n=t===void 0?1:t,i=e.offsetX,a=i===void 0?0:i,o=e.offsetY,s=o===void 0?0:o,u=this.config.x+a,f=this.config.y+s;this.circle.attr("x",u),this.circle.attr("y",f),this.circle.attr("r",this.config.r*n),this.startMarker.attr("path",this.getStartMarkerPath(u,f,n));var l=.25*this.config.r*n,c=.5*this.config.r*Math.sqrt(3)*n;this.pauseLeftMarker.attr("x",u-(1/4+1/8)*this.config.r*n),this.pauseLeftMarker.attr("y",f-c/2),this.pauseLeftMarker.attr("width",l),this.pauseLeftMarker.attr("height",c),this.pauseRightMarker.attr("x",u+1/8*this.config.r*n),this.pauseRightMarker.attr("y",f-c/2),this.pauseRightMarker.attr("width",l),this.pauseRightMarker.attr("height",c)},r.prototype.renderMarker=function(){this.config.isPlay?(this.startMarkerGroup.hide(),this.pauseMarkerGroup.show()):(this.startMarkerGroup.show(),this.pauseMarkerGroup.hide())},r.prototype.getStartMarkerPath=function(e,t,n){var i=.5*this.config.r*Math.sqrt(3)*n;return[["M",e-i/Math.sqrt(3)/2,t-i/2],["L",e+i/Math.sqrt(3),t],["L",e-i/Math.sqrt(3)/2,t+i/2]]},r}(),Wr=function(){return Wr=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Wr.apply(this,arguments)},$f=yi,Jce="#aaa",ehe="green",the={fill:"#aaa",fillOpacity:.35,stroke:"#aaa"},rhe={fill:"#fff"},nhe={fill:"green"},hD={pointer:{fill:"#aaa",lineWidth:0},scroller:{stroke:"#aaa",fill:"#aaa",lineWidth:1,lineAppendWidth:5,cursor:"pointer"},text:{fill:"#aaa",textBaseline:"top"}},dD={check:{stroke:"green",lineWidth:3},box:{fill:"#fff",stroke:"#aaa",lineWidth:2,radius:3,width:12,height:12},text:{fill:"#aaa",fontSize:12,textBaseline:"top"}},ihe={speed:1,loop:!1,fill:"#fff",stroke:"#fff",hideTimeTypeController:!1,preBtnStyle:{fill:"#aaa",stroke:"#aaa"},nextBtnStyle:{fill:"#aaa",stroke:"#aaa"},playBtnStyle:{fill:"#aaa",stroke:"#aaa",fillOpacity:.05},speedControllerStyle:hD,timeTypeControllerStyle:dD},b0=110,so=50,Qi={SINGLE:"single",RANGE:"range"},vD=function(){function r(e){this.controllerCfg=yr({},ihe,e),this.group=e.group,this.controllerGroup=this.group.addGroup({name:"controller-group"}),this.speedAxisY=[],this.currentSpeed=this.controllerCfg.speed,this.currentType=this.controllerCfg.defaultTimeType||Qi.RANGE,this.fontFamily=e.fontFamily||"Arial, sans-serif",this.init()}return r.prototype.init=function(){this.renderPlayButton()},r.prototype.getNextMarkerPath=function(e,t,n){return[["M",e,t-n],["L",e+n,t],["L",e,t+n],["Z",e,t-n],["M",e,t],["L",e-n,t-n],["L",e-n,t+n],["Z"]]},r.prototype.getPreMarkerPath=function(e,t,n){return[["M",e,t-n],["L",e-n,t],["L",e,t+n],["L",e,t-n],["M",e,t],["L",e+n,t-n],["L",e+n,t+n],["Z"]]},r.prototype.renderPlayButton=function(){var e=this.controllerCfg,t=e.width,n=e.height,i=e.x,a=e.y,o=e.hideTimeTypeController,s=e.fill,u=s===void 0?Jce:s,f=e.stroke,l=f===void 0?ehe:f,c=e.containerStyle,h=c===void 0?{}:c,d=Wr(Wr({},the),e.playBtnStyle||{}),v=Wr(Wr({},rhe),e.preBtnStyle||{}),p=Wr(Wr({},nhe),e.nextBtnStyle||{}),g=n/2-5,y=a+10,m=this.controllerGroup.addShape("rect",{attrs:Wr({x:i,y,width:t,height:n,stroke:l,fill:u},h),name:"container-rect"});this.playButton?this.playButton.update({x:t/2,y,r:g}):this.playButton=new Qce({group:this.controllerGroup,x:t/2,y:y+g+5,r:g,isPlay:this.isPlay,style:d});var b=v.offsetX||0,x=v.offsetY||0,w=(v.scale||1)*g;this.controllerGroup.addShape("path",{attrs:Wr({path:this.getPreMarkerPath(t/2-5*g+b,y+g+5+x,w*.5)},v),name:Gl});var E=p.offsetX||0,_=p.offsetY||0,M=(p.scale||1)*g;this.controllerGroup.addShape("path",{attrs:Wr({path:this.getNextMarkerPath(t/2+5*g+E,y+g+5+_,M*.5)},p),name:Fl}),m.toBack(),this.renderSpeedBtn(),o||this.renderToggleTime(),this.bindEvent();var C=this.controllerCfg.scale,S=C===void 0?1:C,A=this.controllerGroup.getCanvasBBox(),T=(A.maxX+A.minX)/2,k=(A.maxY+A.minY)/2,O=$f([1,0,0,0,1,0,0,0,1],[["t",-T,-k],["s",S,S],["t",T,k]]);this.controllerGroup.setMatrix(O)},r.prototype.renderSpeedBtn=function(){var e=this.controllerCfg,t=e.y,n=e.width,i=e.hideTimeTypeController,a=Wr(Wr({},hD),this.controllerCfg.speedControllerStyle||{}),o=a.scroller,s=o===void 0?{}:o,u=a.text,f=u===void 0?{}:u,l=a.pointer,c=l===void 0?{}:l,h=a.scale,d=h===void 0?1:h,v=a.offsetX,p=v===void 0?0:v,g=a.offsetY,y=g===void 0?0:g,m=this.controllerGroup.addGroup({name:"speed-group"});this.speedGroup=m;var b=5;this.speedAxisY=[19,22,26,32,39];for(var x=0;x<5;x++){var w=t+this.speedAxisY[x],E=n-(i?so:b0);m.addShape("line",{attrs:Wr({x1:E,x2:E+15,y1:w,y2:w},s),speed:b,name:"speed-rect"}),this.speedAxisY[x]=w,b=b-1}this.speedText=m.addShape("text",{attrs:Wr({x:n-(i?so:b0)+20,y:this.speedAxisY[0]+4,text:"1.0X",fontFamily:this.fontFamily||"Arial, sans-serif"},f),name:"speed-text"}),this.speedPoint=m.addShape("path",{attrs:Wr({path:this.getPointerPath(n-(i?so:b0),0),matrix:[1,0,0,0,1,0,0,this.speedAxisY[4],1]},c),name:"speed-pointer"});var _=this.speedGroup.getCanvasBBox(),M=(_.maxX+_.minX)/2,C=(_.maxY+_.minY)/2,S=this.speedGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];S=$f(S,[["t",-M,-C],["s",d,d],["t",M+p*d,C+y*d]]),this.speedGroup.setMatrix(S)},r.prototype.getPointerPath=function(e,t){return[["M",e,t],["L",e-10,t-4],["L",e-10,t+4],["Z"]]},r.prototype.renderToggleTime=function(){var e,t,n=this.controllerCfg,i=n.width,a=n.defaultTimeType,o=Wr(Wr({},dD),this.controllerCfg.timeTypeControllerStyle||{}),s=o.scale,u=s===void 0?1:s,f=o.offsetX,l=f===void 0?0:f,c=o.offsetY,h=c===void 0?0:c,d=o.box,v=d===void 0?{}:d,p=o.check,g=p===void 0?{}:p,y=o.text,m=y===void 0?{}:y;this.toggleGroup=this.controllerGroup.addGroup({name:"toggle-group"});var b=a===Qi.SINGLE;this.toggleGroup.addShape("rect",{attrs:Wr({x:i-so,y:this.speedAxisY[0]+3.5},v),isChecked:b,name:"toggle-model"}),this.checkedIcon=this.toggleGroup.addShape("path",{attrs:Wr({path:[["M",i-so+3,this.speedAxisY[1]+6],["L",i-so+7,this.speedAxisY[1]+10],["L",i-so+12,this.speedAxisY[1]+4]]},g),capture:!1,name:"check-icon"}),b||this.checkedIcon.hide(),this.checkedText=this.toggleGroup.addShape("text",{attrs:Wr({text:b?((e=this.controllerCfg)===null||e===void 0?void 0:e.timeRangeControllerText)||"时间范围":((t=this.controllerCfg)===null||t===void 0?void 0:t.timePointControllerText)||"单一时间",x:i-so+15,y:this.speedAxisY[0]+4,fontFamily:typeof window<"u"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"},m),name:"checked-text"});var x=this.toggleGroup.getCanvasBBox(),w=(x.maxX+x.minX)/2,E=(x.maxY+x.minY)/2,_=this.toggleGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];_=$f(_,[["t",-w,-E],["s",u,u],["t",w+l*u,E+h*u]]),this.toggleGroup.setMatrix(_)},r.prototype.bindEvent=function(){var e=this;this.speedGroup.on("speed-rect:click",function(t){var n=t.target.attr("y1"),i=e.speedPoint.attr("matrix"),a=e.speedAxisY.indexOf(i[7]||0),o=e.speedAxisY.indexOf(n),s=e.speedAxisY[o]-e.speedAxisY[a];i=$f(i,[["t",0,s]]),e.speedPoint.setMatrix(i),e.currentSpeed=e.speedAxisY.length-o,e.speedText.attr("text","".concat(e.currentSpeed,".0X")),e.group.emit(xs,{speed:e.currentSpeed,type:e.currentType})}),this.speedGroup.on("mousewheel",function(t){t.preventDefault();var n=e.speedPoint.attr("matrix")||[1,0,0,0,1,0,0,0,1],i=n[7],a=e.speedAxisY.indexOf(i);if(a===-1){var o=1/0;e.speedAxisY.forEach(function(u,f){var l=Math.abs(u-i);o>l&&(o=l,a=f)})}t.originalEvent.deltaY>0?a=Math.max(0,a-1):a=Math.min(e.speedAxisY.length-1,a+1);var s=e.speedAxisY[a]-i;n=$f(n,[["t",0,s]]),e.speedPoint.setMatrix(n),e.currentSpeed=e.speedAxisY.length-a,e.speedText.attr("text","".concat(e.currentSpeed,".0X")),e.group.emit(xs,{speed:e.currentSpeed,type:e.currentType})}),this.toggleGroup&&this.toggleGroup.on("toggle-model:click",function(t){var n,i,a=t.target.get("isChecked");a?(e.checkedIcon.hide(),e.checkedText.attr("text",((i=e.controllerCfg)===null||i===void 0?void 0:i.timePointControllerText)||"单一时间"),e.currentType=Qi.RANGE):(e.checkedIcon.show(),e.checkedText.attr("text",((n=e.controllerCfg)===null||n===void 0?void 0:n.timeRangeControllerText)||"时间范围"),e.currentType=Qi.SINGLE),t.target.set("isChecked",!a),e.group.emit(xs,{type:e.currentType,speed:e.currentSpeed})})},r.prototype.destroy=function(){this.speedGroup.off("speed-rect:click"),this.toggleGroup&&(this.toggleGroup.off("toggle-model:click"),this.toggleGroup.destroy()),this.speedGroup.destroy()},r}(),cl=function(){return cl=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},cl.apply(this,arguments)},ahe=yi,ohe={fill:"#5B8FF9"},she={fill:"#e6e8e9"},uhe=function(){function r(e){this.frameCount=0,this.fontFamily="Arial, sans-serif";var t=e.graph,n=e.canvas,i=e.group,a=e.width,o=e.height,s=e.padding,u=e.data,f=e.start,l=e.end,c=e.x,h=c===void 0?0:c,d=e.y,v=d===void 0?0:d,p=e.tickLabelFormatter,g=e.selectedTickStyle,y=g===void 0?ohe:g,m=e.unselectedTickStyle,b=m===void 0?she:m,x=e.tooltipBackgroundColor,w=e.tooltipFomatter,E=e.tickLabelStyle,_=e.controllerCfg,M=_===void 0?{speed:1}:_;this.graph=t,this.group=i,this.sliceGroup=i.addGroup({name:"slice-group"}),this.canvas=n,this.width=a,this.height=o,this.padding=s,this.data=u,this.start=f,this.end=l,this.tickLabelFormatter=p,this.tickLabelStyle=E||{},this.selectedTickStyle=y,this.unselectedTickStyle=b,this.controllerCfg=M,this.currentSpeed=M.speed||1,this.x=h,this.y=v,this.tooltipBackgroundColor=x,this.tooltipFomatter=w,this.fontFamily=typeof window<"u"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlices(),this.initEvent()}return r.prototype.renderSlices=function(){var e=this,t=this,n=t.width,i=t.height,a=t.padding,o=t.data,s=t.start,u=t.end,f=t.tickLabelFormatter,l=t.selectedTickStyle,c=t.unselectedTickStyle,h=t.tickLabelStyle,d=n-2*a,v=10,p=4,g=3*a+p+v,y=i-g-2*a,m=2,b=o.length,x=(d-m*(b-1))/b;this.tickWidth=x;var w=this.sliceGroup,E=[],_=[],M=Math.round(b*s),C=Math.round(b*u);this.startTickRectId=M,this.endTickRectId=C;var S=h.rotate;delete h.rotate,o.forEach(function(T,k){var O=k>=M&&k<=C,F=O?l:c,D=w.addShape("rect",{attrs:cl({x:a+k*(x+m),y:a,width:x,height:y},F),draggable:!0,name:"tick-rect-".concat(k)}),$=w.addShape("rect",{attrs:{x:a+k*x+m*(2*k-1)/2,y:a,width:k===0||k===b-1?x+m/2:x+m,height:y,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-".concat(k)});$.toFront();var Y=D.getBBox(),N=(Y.minX+Y.maxX)/2;E.push({rect:D,pickRect:$,value:T.date,x:N,y:Y.minY});var P;if(f?(P=f(T),!Pe(P)&&P&&(P=T.date)):k%Math.round(b/10)===0&&(P=T.date),P){_.push(P);var W=Y.maxY+a*2;w.addShape("line",{attrs:{stroke:"#BFBFBF",x1:N,y1:W,x2:N,y2:W+p},name:"tick-line"});var J=W+p+a,te=w.addShape("text",{attrs:cl({fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:N,y:J,textAlign:"center",text:P,textBaseline:"top",fontSize:10,fontFamily:e.fontFamily||"Arial, sans-serif"},h),capture:!1,name:"tick-label"}),H=te.getBBox();if(H.maxX>n?te.attr("textAlign","right"):H.minX<0&&te.attr("textAlign","left"),ht(S)&&_.length!==10){var pe=ahe([1,0,0,0,1,0,0,0,1],[["t",-N,-J],["r",S],["t",N-5,J+2]]);te.attr({textAlign:"left",matrix:pe})}_.length===1?te.attr({textAlign:"left"}):_.length===10&&te.attr({textAlign:"right"})}}),this.tickRects=E;var A=this.group;this.currentSpeed=1,this.controllerBtnGroup=new vD(cl({group:A,x:this.x,y:this.y+i+5,width:n,height:40,hideTimeTypeController:!0,speed:this.currentSpeed,fontFamily:this.fontFamily||"Arial, sans-serif"},this.controllerCfg))},r.prototype.initEvent=function(){var e=this,t=this.sliceGroup;t.on("click",function(l){var c=l.target;if(!(c.get("type")!=="rect"||!c.get("name"))){var h=parseInt(c.get("name").split("-")[2],10);if(!isNaN(h)){var d=e.tickRects,v=e.unselectedTickStyle;d.forEach(function(m){m.rect.attr(v)});var p=e.selectedTickStyle;d[h].rect.attr(p),e.startTickRectId=h,e.endTickRectId=h;var g=d.length,y=h/g;e.graph.emit(ea,{value:[y,y]})}}}),t.on("dragstart",function(l){var c=e.tickRects,h=e.unselectedTickStyle;c.forEach(function(m){m.rect.attr(h)});var d=l.target,v=parseInt(d.get("name").split("-")[2],10),p=e.selectedTickStyle;c[v].rect.attr(p),e.startTickRectId=v;var g=c.length,y=v/g;e.graph.emit(ea,{value:[y,y]}),e.dragging=!0}),t.on("dragover",function(l){if(e.dragging&&l.target.get("type")==="rect"){for(var c=parseInt(l.target.get("name").split("-")[2],10),h=e.startTickRectId,d=e.tickRects,v=e.selectedTickStyle,p=e.unselectedTickStyle,g=0;g<d.length;g++){var y=g>=h&&g<=c?v:p;d[g].rect.attr(y)}var m=d.length;e.endTickRectId=c;var b=h/m,x=c/m;e.graph.emit(ea,{value:[b,x]})}}),t.on("drop",function(l){if(e.dragging&&(e.dragging=!1,l.target.get("type")==="rect")){var c=e.startTickRectId,h=parseInt(l.target.get("name").split("-")[2],10);if(!(h<c)){var d=e.selectedTickStyle,v=e.tickRects;v[h].rect.attr(d),e.endTickRectId=h;var p=v.length,g=c/p,y=h/p;e.graph.emit(ea,{value:[g,y]})}}});var n=this,i=n.tooltipBackgroundColor,a=n.tooltipFomatter,o=n.canvas,s=new Kce({container:o.get("container"),backgroundColor:i}),u=this.tickRects;u.forEach(function(l){var c=l.pickRect;c.on("mouseenter",function(h){var d=h.target;if(d.get("type")==="rect"){var v=parseInt(d.get("name").split("-")[2],10),p=o.getClientByPoint(u[v].x,u[v].y);s.show({x:u[v].x,y:u[v].y,clientX:p.x,clientY:p.y,text:a?a(u[v].value):u[v].value})}}),c.on("mouseleave",function(h){s.hide()})});var f=this.group;f.on("".concat(Eo,":click"),function(){e.isPlay=!e.isPlay,e.changePlayStatus()}),f.on("".concat(Fl,":click"),function(){e.updateStartEnd(1)}),f.on("".concat(Gl,":click"),function(){e.updateStartEnd(-1)}),f.on(xs,function(l){l.type;var c=l.speed;e.currentSpeed=c})},r.prototype.changePlayStatus=function(e){e===void 0&&(e=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit(lD,null)):this.playHandler&&(typeof window<"u"&&window.cancelAnimationFrame(this.playHandler),e&&this.graph.emit(cD,null))},r.prototype.startPlay=function(){var e=this;return typeof window<"u"?window.requestAnimationFrame(function(){var t=e.currentSpeed;e.frameCount%(60/t)===0&&(e.frameCount=0,e.updateStartEnd(1)),e.frameCount++,e.isPlay&&(e.playHandler=e.startPlay())}):void 0},r.prototype.updateStartEnd=function(e){var t=this,n=this.tickRects,i=n.length,a=this.unselectedTickStyle,o=this.selectedTickStyle,s=t.endTickRectId;if(e>0?t.endTickRectId++:(n[t.endTickRectId].rect.attr(a),t.endTickRectId--),s!==t.startTickRectId)t.endTickRectId<t.startTickRectId&&(t.startTickRectId=t.endTickRectId);else{for(var u=t.startTickRectId;u<=t.endTickRectId-1;u++)n[u].rect.attr(a);t.startTickRectId=t.endTickRectId}if(n[t.endTickRectId]){n[t.endTickRectId].rect.attr(o);var f=t.startTickRectId/i,l=t.endTickRectId/i;this.graph.emit(ea,{value:[f,l]})}},r.prototype.destory=function(){var e=this.sliceGroup;e.off("click"),e.off("dragstart"),e.off("dragover"),e.off("drop"),this.tickRects.forEach(function(t){var n=t.pickRect;n.off("mouseenter"),n.off("mouseleave")}),this.tickRects.length=0,e.off("".concat(Eo,":click")),e.off("".concat(Fl,":click")),e.off("".concat(Gl,":click")),e.off(xs),this.sliceGroup.destroy()},r}(),pD={};function fhe(r){return pD[r]}function xa(r,e){pD[r]=e}var Mb=function(){function r(e){this.type="base",this.isCategory=!1,this.isLinear=!1,this.isContinuous=!1,this.isIdentity=!1,this.values=[],this.range=[0,1],this.ticks=[],this.__cfg__=e,this.initCfg(),this.init()}return r.prototype.translate=function(e){return e},r.prototype.change=function(e){yt(this.__cfg__,e),this.init()},r.prototype.clone=function(){return this.constructor(this.__cfg__)},r.prototype.getTicks=function(){var e=this;return _s(this.ticks,function(t,n){return yn(t)?t:{text:e.getText(t,n),tickValue:t,value:e.scale(t)}})},r.prototype.getText=function(e,t){var n=this.formatter,i=n?n(e,t):e;return ct(i)||!Mr(i.toString)?"":i.toString()},r.prototype.getConfig=function(e){return this.__cfg__[e]},r.prototype.init=function(){yt(this,this.__cfg__),this.setDomain(),LC(this.getConfig("ticks"))&&(this.ticks=this.calculateTicks())},r.prototype.initCfg=function(){},r.prototype.setDomain=function(){},r.prototype.calculateTicks=function(){var e=this.tickMethod,t=[];if(Pe(e)){var n=fhe(e);if(!n)throw new Error("There is no method to to calculate ticks!");t=n(this)}else Mr(e)&&(t=e(this));return t},r.prototype.rangeMin=function(){return this.range[0]},r.prototype.rangeMax=function(){return this.range[1]},r.prototype.calcPercent=function(e,t,n){return ht(e)?(e-t)/(n-t):NaN},r.prototype.calcValue=function(e,t,n){return t+e*(n-t)},r}(),yc=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="cat",t.isCategory=!0,t}return e.prototype.buildIndexMap=function(){if(!this.translateIndexMap){this.translateIndexMap=new Map;for(var t=0;t<this.values.length;t++)this.translateIndexMap.set(this.values[t],t)}},e.prototype.translate=function(t){this.buildIndexMap();var n=this.translateIndexMap.get(t);return n===void 0&&(n=ht(t)?t:NaN),n},e.prototype.scale=function(t){var n=this.translate(t),i=this.calcPercent(n,this.min,this.max);return this.calcValue(i,this.rangeMin(),this.rangeMax())},e.prototype.invert=function(t){var n=this.max-this.min,i=this.calcPercent(t,this.rangeMin(),this.rangeMax()),a=Math.round(n*i)+this.min;return a<this.min||a>this.max?NaN:this.values[a]},e.prototype.getText=function(t){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var a=t;return ht(t)&&!this.values.includes(t)&&(a=this.values[a]),r.prototype.getText.apply(this,vv([a],n))},e.prototype.initCfg=function(){this.tickMethod="cat"},e.prototype.setDomain=function(){if(ct(this.getConfig("min"))&&(this.min=0),ct(this.getConfig("max"))){var t=this.values.length;this.max=t>1?t-1:t}this.translateIndexMap&&(this.translateIndexMap=void 0)},e}(Mb),gD=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,ho="\\d\\d?",uo="\\d\\d",lhe="\\d{3}",che="\\d{4}",hl="[^\\s]+",yD=/\[([^]*?)\]/gm;function mD(r,e){for(var t=[],n=0,i=r.length;n<i;n++)t.push(r[n].substr(0,e));return t}var pM=function(r){return function(e,t){var n=t[r].map(function(a){return a.toLowerCase()}),i=n.indexOf(e.toLowerCase());return i>-1?i:null}};function No(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0,i=e;n<i.length;n++){var a=i[n];for(var o in a)r[o]=a[o]}return r}var bD=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],xD=["January","February","March","April","May","June","July","August","September","October","November","December"],hhe=mD(xD,3),dhe=mD(bD,3),Cb={dayNamesShort:dhe,dayNames:bD,monthNamesShort:hhe,monthNames:xD,amPm:["am","pm"],DoFn:function(r){return r+["th","st","nd","rd"][r%10>3?0:(r-r%10!==10?1:0)*r%10]}},uv=No({},Cb),wD=function(r){return uv=No(uv,r)},gM=function(r){return r.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},Pn=function(r,e){for(e===void 0&&(e=2),r=String(r);r.length<e;)r="0"+r;return r},vhe={D:function(r){return String(r.getDate())},DD:function(r){return Pn(r.getDate())},Do:function(r,e){return e.DoFn(r.getDate())},d:function(r){return String(r.getDay())},dd:function(r){return Pn(r.getDay())},ddd:function(r,e){return e.dayNamesShort[r.getDay()]},dddd:function(r,e){return e.dayNames[r.getDay()]},M:function(r){return String(r.getMonth()+1)},MM:function(r){return Pn(r.getMonth()+1)},MMM:function(r,e){return e.monthNamesShort[r.getMonth()]},MMMM:function(r,e){return e.monthNames[r.getMonth()]},YY:function(r){return Pn(String(r.getFullYear()),4).substr(2)},YYYY:function(r){return Pn(r.getFullYear(),4)},h:function(r){return String(r.getHours()%12||12)},hh:function(r){return Pn(r.getHours()%12||12)},H:function(r){return String(r.getHours())},HH:function(r){return Pn(r.getHours())},m:function(r){return String(r.getMinutes())},mm:function(r){return Pn(r.getMinutes())},s:function(r){return String(r.getSeconds())},ss:function(r){return Pn(r.getSeconds())},S:function(r){return String(Math.round(r.getMilliseconds()/100))},SS:function(r){return Pn(Math.round(r.getMilliseconds()/10),2)},SSS:function(r){return Pn(r.getMilliseconds(),3)},a:function(r,e){return r.getHours()<12?e.amPm[0]:e.amPm[1]},A:function(r,e){return r.getHours()<12?e.amPm[0].toUpperCase():e.amPm[1].toUpperCase()},ZZ:function(r){var e=r.getTimezoneOffset();return(e>0?"-":"+")+Pn(Math.floor(Math.abs(e)/60)*100+Math.abs(e)%60,4)},Z:function(r){var e=r.getTimezoneOffset();return(e>0?"-":"+")+Pn(Math.floor(Math.abs(e)/60),2)+":"+Pn(Math.abs(e)%60,2)}},yM=function(r){return+r-1},mM=[null,ho],bM=[null,hl],xM=["isPm",hl,function(r,e){var t=r.toLowerCase();return t===e.amPm[0]?0:t===e.amPm[1]?1:null}],wM=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(r){var e=(r+"").match(/([+-]|\d\d)/gi);if(e){var t=+e[1]*60+parseInt(e[2],10);return e[0]==="+"?t:-t}return 0}],phe={D:["day",ho],DD:["day",uo],Do:["day",ho+hl,function(r){return parseInt(r,10)}],M:["month",ho,yM],MM:["month",uo,yM],YY:["year",uo,function(r){var e=new Date,t=+(""+e.getFullYear()).substr(0,2);return+(""+(+r>68?t-1:t)+r)}],h:["hour",ho,void 0,"isPm"],hh:["hour",uo,void 0,"isPm"],H:["hour",ho],HH:["hour",uo],m:["minute",ho],mm:["minute",uo],s:["second",ho],ss:["second",uo],YYYY:["year",che],S:["millisecond","\\d",function(r){return+r*100}],SS:["millisecond",uo,function(r){return+r*10}],SSS:["millisecond",lhe],d:mM,dd:mM,ddd:bM,dddd:bM,MMM:["month",hl,pM("monthNamesShort")],MMMM:["month",hl,pM("monthNames")],a:xM,A:xM,ZZ:wM,Z:wM},fv={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"},ED=function(r){return No(fv,r)},_D=function(r,e,t){if(e===void 0&&(e=fv.default),t===void 0&&(t={}),typeof r=="number"&&(r=new Date(r)),Object.prototype.toString.call(r)!=="[object Date]"||isNaN(r.getTime()))throw new Error("Invalid Date pass to format");e=fv[e]||e;var n=[];e=e.replace(yD,function(a,o){return n.push(o),"@@@"});var i=No(No({},uv),t);return e=e.replace(gD,function(a){return vhe[a](r,i)}),e.replace(/@@@/g,function(){return n.shift()})};function SD(r,e,t){if(t===void 0&&(t={}),typeof e!="string")throw new Error("Invalid format in fecha parse");if(e=fv[e]||e,r.length>1e3)return null;var n=new Date,i={year:n.getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},a=[],o=[],s=e.replace(yD,function(x,w){return o.push(gM(w)),"@@@"}),u={},f={};s=gM(s).replace(gD,function(x){var w=phe[x],E=w[0],_=w[1],M=w[3];if(u[E])throw new Error("Invalid format. "+E+" specified twice in format");return u[E]=!0,M&&(f[M]=!0),a.push(w),"("+_+")"}),Object.keys(f).forEach(function(x){if(!u[x])throw new Error("Invalid format. "+x+" is required in specified format")}),s=s.replace(/@@@/g,function(){return o.shift()});var l=r.match(new RegExp(s,"i"));if(!l)return null;for(var c=No(No({},uv),t),h=1;h<l.length;h++){var d=a[h-1],v=d[0],p=d[2],g=p?p(l[h],c):+l[h];if(g==null)return null;i[v]=g}i.isPm===1&&i.hour!=null&&+i.hour!=12?i.hour=+i.hour+12:i.isPm===0&&+i.hour==12&&(i.hour=0);var y;if(i.timezoneOffset==null){y=new Date(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond);for(var m=[["month","getMonth"],["day","getDate"],["hour","getHours"],["minute","getMinutes"],["second","getSeconds"]],h=0,b=m.length;h<b;h++)if(u[m[h][0]]&&i[m[h][0]]!==y[m[h][1]]())return null}else if(y=new Date(Date.UTC(i.year,i.month,i.day,i.hour,i.minute-i.timezoneOffset,i.second,i.millisecond)),i.month>11||i.month<0||i.day>31||i.day<1||i.hour>23||i.hour<0||i.minute>59||i.minute<0||i.second>59||i.second<0)return null;return y}var MD={format:_D,parse:SD,defaultI18n:Cb,setGlobalDateI18n:wD,setGlobalDateMasks:ED};const ghe=Object.freeze(Object.defineProperty({__proto__:null,assign:No,default:MD,defaultI18n:Cb,format:_D,parse:SD,setGlobalDateI18n:wD,setGlobalDateMasks:ED},Symbol.toStringTag,{value:"Module"}));function yhe(r){return function(e,t,n,i){for(var a=ct(n)?0:n,o=ct(i)?e.length:i;a<o;){var s=a+o>>>1;r(e[s])>t?o=s:a=s+1}return a}}var EM="format";function CD(r,e){var t=ghe[EM]||MD[EM];return t(r,e)}function lv(r){return Pe(r)&&(r.indexOf("T")>0?r=new Date(r).getTime():r=new Date(r.replace(/-/gi,"/")).getTime()),vm(r)&&(r=r.getTime()),r}var Ti=1e3,ws=60*Ti,Es=60*ws,Fa=24*Es,dl=Fa*31,_M=Fa*365,jf=[["HH:mm:ss",Ti],["HH:mm:ss",Ti*10],["HH:mm:ss",Ti*30],["HH:mm",ws],["HH:mm",ws*10],["HH:mm",ws*30],["HH",Es],["HH",Es*6],["HH",Es*12],["YYYY-MM-DD",Fa],["YYYY-MM-DD",Fa*4],["YYYY-WW",Fa*7],["YYYY-MM",dl],["YYYY-MM",dl*4],["YYYY-MM",dl*6],["YYYY",Fa*380]];function mhe(r,e,t){var n=(e-r)/t,i=yhe(function(o){return o[1]})(jf,n)-1,a=jf[i];return i<0?a=jf[0]:i>=jf.length&&(a=vi(jf)),a}var bhe=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="timeCat",t}return e.prototype.translate=function(t){t=lv(t);var n=this.values.indexOf(t);return n===-1&&(ht(t)&&t<this.values.length?n=t:n=NaN),n},e.prototype.getText=function(t,n){var i=this.translate(t);if(i>-1){var a=this.values[i],o=this.formatter;return a=o?o(a,n):CD(a,this.mask),a}return t},e.prototype.initCfg=function(){this.tickMethod="time-cat",this.mask="YYYY-MM-DD",this.tickCount=7},e.prototype.setDomain=function(){var t=this.values;me(t,function(n,i){t[i]=lv(n)}),t.sort(function(n,i){return n-i}),r.prototype.setDomain.call(this)},e}(yc),vp=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.isContinuous=!0,t}return e.prototype.scale=function(t){if(ct(t))return NaN;var n=this.rangeMin(),i=this.rangeMax(),a=this.max,o=this.min;if(a===o)return n;var s=this.getScalePercent(t);return n+s*(i-n)},e.prototype.init=function(){r.prototype.init.call(this);var t=this.ticks,n=ua(t),i=vi(t);n<this.min&&(this.min=n),i>this.max&&(this.max=i),ct(this.minLimit)||(this.min=n),ct(this.maxLimit)||(this.max=i)},e.prototype.setDomain=function(){var t=bC(this.values),n=t.min,i=t.max;ct(this.min)&&(this.min=n),ct(this.max)&&(this.max=i),this.min>this.max&&(this.min=n,this.max=i)},e.prototype.calculateTicks=function(){var t=this,n=r.prototype.calculateTicks.call(this);return this.nice||(n=pv(n,function(i){return i>=t.min&&i<=t.max})),n},e.prototype.getScalePercent=function(t){var n=this.max,i=this.min;return(t-i)/(n-i)},e.prototype.getInvertPercent=function(t){return(t-this.rangeMin())/(this.rangeMax()-this.rangeMin())},e}(Mb),mc=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="linear",t.isLinear=!0,t}return e.prototype.invert=function(t){var n=this.getInvertPercent(t);return this.min+n*(this.max-this.min)},e.prototype.initCfg=function(){this.tickMethod="wilkinson-extended",this.nice=!1},e}(vp);function yo(r,e){var t=Math.E,n;return e>=0?n=Math.pow(t,Math.log(e)/r):n=Math.pow(t,Math.log(-e)/r)*-1,n}function hi(r,e){return r===1?1:Math.log(e)/Math.log(r)}function AD(r,e,t){ct(t)&&(t=Math.max.apply(null,r));var n=t;return me(r,function(i){i>0&&i<n&&(n=i)}),n===t&&(n=t/e),n>1&&(n=1),n}var xhe=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="log",t}return e.prototype.invert=function(t){var n=this.base,i=hi(n,this.max),a=this.rangeMin(),o=this.rangeMax()-a,s,u=this.positiveMin;if(u){if(t===0)return 0;s=hi(n,u/n);var f=1/(i-s)*o;if(t<f)return t/f*u}else s=hi(n,this.min);var l=(t-a)/o,c=l*(i-s)+s;return Math.pow(n,c)},e.prototype.initCfg=function(){this.tickMethod="log",this.base=10,this.tickCount=6,this.nice=!0},e.prototype.setDomain=function(){r.prototype.setDomain.call(this);var t=this.min;if(t<0)throw new Error("When you use log scale, the minimum value must be greater than zero!");t===0&&(this.positiveMin=AD(this.values,this.base,this.max))},e.prototype.getScalePercent=function(t){var n=this.max,i=this.min;if(n===i||t<=0)return 0;var a=this.base,o=this.positiveMin;o&&(i=o*1/a);var s;return t<o?s=t/o/(hi(a,n)-hi(a,i)):s=(hi(a,t)-hi(a,i))/(hi(a,n)-hi(a,i)),s},e}(vp),whe=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="pow",t}return e.prototype.invert=function(t){var n=this.getInvertPercent(t),i=this.exponent,a=yo(i,this.max),o=yo(i,this.min),s=n*(a-o)+o,u=s>=0?1:-1;return Math.pow(s,i)*u},e.prototype.initCfg=function(){this.tickMethod="pow",this.exponent=2,this.tickCount=5,this.nice=!0},e.prototype.getScalePercent=function(t){var n=this.max,i=this.min;if(n===i)return 0;var a=this.exponent,o=(yo(a,t)-yo(a,i))/(yo(a,n)-yo(a,i));return o},e}(vp),Ehe=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="time",t}return e.prototype.getText=function(t,n){var i=this.translate(t),a=this.formatter;return a?a(i,n):CD(i,this.mask)},e.prototype.scale=function(t){var n=t;return(Pe(n)||vm(n))&&(n=this.translate(n)),r.prototype.scale.call(this,n)},e.prototype.translate=function(t){return lv(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,n=this.getConfig("min"),i=this.getConfig("max");if((!ct(n)||!ht(n))&&(this.min=this.translate(this.min)),(!ct(i)||!ht(i))&&(this.max=this.translate(this.max)),t&&t.length){var a=[],o=1/0,s=o,u=0;me(t,function(f){var l=lv(f);if(isNaN(l))throw new TypeError("Invalid Time: "+f+" in time scale!");o>l?(s=o,o=l):s>l&&(s=l),u<l&&(u=l),a.push(l)}),t.length>1&&(this.minTickInterval=s-o),ct(n)&&(this.min=o),ct(i)&&(this.max=u)}},e}(mc),TD=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="quantize",t}return e.prototype.invert=function(t){var n=this.ticks,i=n.length,a=this.getInvertPercent(t),o=Math.floor(a*(i-1));if(o>=i-1)return vi(n);if(o<0)return ua(n);var s=n[o],u=n[o+1],f=o/(i-1),l=(o+1)/(i-1);return s+(a-f)/(l-f)*(u-s)},e.prototype.initCfg=function(){this.tickMethod="r-pretty",this.tickCount=5,this.nice=!0},e.prototype.calculateTicks=function(){var t=r.prototype.calculateTicks.call(this);return this.nice||(vi(t)!==this.max&&t.push(this.max),ua(t)!==this.min&&t.unshift(this.min)),t},e.prototype.getScalePercent=function(t){var n=this.ticks;if(t<ua(n))return 0;if(t>vi(n))return 1;var i=0;return me(n,function(a,o){if(t>=a)i=o;else return!1}),i/(n.length-1)},e}(vp),_he=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="quantile",t}return e.prototype.initCfg=function(){this.tickMethod="quantile",this.tickCount=5,this.nice=!0},e}(TD),ID={};function She(r){return ID[r]}function wa(r,e){if(She(r))throw new Error("type '"+r+"' existed.");ID[r]=e}var Mhe=function(r){kt(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="identity",t.isIdentity=!0,t}return e.prototype.calculateTicks=function(){return this.values},e.prototype.scale=function(t){return this.values[0]!==t&&ht(t)?t:this.range[0]},e.prototype.invert=function(t){var n=this.range;return t<n[0]||t>n[1]?NaN:this.values[0]},e}(Mb);function kD(r){var e=r.values,t=r.tickInterval,n=r.tickCount,i=r.showLast;if(ht(t)){var a=pv(e,function(v,p){return p%t===0}),o=vi(e);return i&&vi(a)!==o&&a.push(o),a}var s=e.length,u=r.min,f=r.max;if(ct(u)&&(u=0),ct(f)&&(f=e.length-1),!ht(n)||n>=s)return e.slice(u,f+1);if(n<=0||f<=0)return[];for(var l=n===1?s:Math.floor(s/(n-1)),c=[],h=u,d=0;d<n&&!(h>=f);d++)h=Math.min(u+d*l,f),d===n-1&&i?c.push(e[f]):c.push(e[h]);return c}function Che(r){var e=r.min,t=r.max,n=r.nice,i=r.tickCount,a=new Ahe;return a.domain([e,t]),n&&a.nice(i),a.ticks(i)}var x0=5,SM=Math.sqrt(50),MM=Math.sqrt(10),CM=Math.sqrt(2),Ahe=function(){function r(){this._domain=[0,1]}return r.prototype.domain=function(e){return e?(this._domain=Array.from(e,Number),this):this._domain.slice()},r.prototype.nice=function(e){var t,n;e===void 0&&(e=x0);var i=this._domain.slice(),a=0,o=this._domain.length-1,s=this._domain[a],u=this._domain[o],f;return u<s&&(t=[u,s],s=t[0],u=t[1],n=[o,a],a=n[0],o=n[1]),f=yd(s,u,e),f>0?(s=Math.floor(s/f)*f,u=Math.ceil(u/f)*f,f=yd(s,u,e)):f<0&&(s=Math.ceil(s*f)/f,u=Math.floor(u*f)/f,f=yd(s,u,e)),f>0?(i[a]=Math.floor(s/f)*f,i[o]=Math.ceil(u/f)*f,this.domain(i)):f<0&&(i[a]=Math.ceil(s*f)/f,i[o]=Math.floor(u*f)/f,this.domain(i)),this},r.prototype.ticks=function(e){return e===void 0&&(e=x0),The(this._domain[0],this._domain[this._domain.length-1],e||x0)},r}();function The(r,e,t){var n,i=-1,a,o,s;if(e=+e,r=+r,t=+t,r===e&&t>0)return[r];if((n=e<r)&&(a=r,r=e,e=a),(s=yd(r,e,t))===0||!isFinite(s))return[];if(s>0)for(r=Math.ceil(r/s),e=Math.floor(e/s),o=new Array(a=Math.ceil(e-r+1));++i<a;)o[i]=(r+i)*s;else for(r=Math.floor(r*s),e=Math.ceil(e*s),o=new Array(a=Math.ceil(r-e+1));++i<a;)o[i]=(r-i)/s;return n&&o.reverse(),o}function yd(r,e,t){var n=(e-r)/Math.max(0,t),i=Math.floor(Math.log(n)/Math.LN10),a=n/Math.pow(10,i);return i>=0?(a>=SM?10:a>=MM?5:a>=CM?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=SM?10:a>=MM?5:a>=CM?2:1)}function AM(r,e,t){var n;return t==="ceil"?n=Math.ceil(r/e):t==="floor"?n=Math.floor(r/e):n=Math.round(r/e),n*e}function Ab(r,e,t){var n=AM(r,t,"floor"),i=AM(e,t,"ceil");n=Vh(n,t),i=Vh(i,t);for(var a=[],o=Math.max((i-n)/(Math.pow(2,12)-1),t),s=n;s<=i;s=s+o){var u=Vh(s,o);a.push(u)}return{min:n,max:i,ticks:a}}function Tb(r,e,t){var n,i=r.minLimit,a=r.maxLimit,o=r.min,s=r.max,u=r.tickCount,f=u===void 0?5:u,l=ct(i)?ct(e)?o:e:i,c=ct(a)?ct(t)?s:t:a;if(l>c&&(n=[l,c],c=n[0],l=n[1]),f<=2)return[l,c];for(var h=(c-l)/(f-1),d=[],v=0;v<f;v++)d.push(l+h*v);return d}function Ihe(r){var e=r.min,t=r.max,n=r.tickInterval,i=r.minLimit,a=r.maxLimit,o=Che(r);return!ct(i)||!ct(a)?Tb(r,ua(o),vi(o)):n?Ab(e,t,n).ticks:o}function ls(r){return Math.abs(r)<1e-15?r:parseFloat(r.toFixed(15))}var khe=[1,5,2,2.5,4,3],TM=Number.EPSILON*100;function Lhe(r,e){return(r%e+e)%e}function Nhe(r){return Math.round(r*1e12)/1e12}function Ohe(r,e,t,n,i,a){var o=mv(e),s=pm(e,r),u=0,f=Lhe(n,a);return(f<TM||a-f<TM)&&n<=0&&i>=0&&(u=1),1-s/(o-1)-t+u}function Dhe(r,e,t){var n=mv(e),i=pm(e,r),a=1;return 1-i/(n-1)-t+a}function Phe(r,e,t,n,i,a){var o=(r-1)/(a-i),s=(e-1)/(Math.max(a,n)-Math.min(t,i));return 2-Math.max(o/s,s/o)}function Rhe(r,e){return r>=e?2-(r-1)/(e-1):1}function Bhe(r,e,t,n){var i=e-r;return 1-.5*(Math.pow(e-n,2)+Math.pow(r-t,2))/Math.pow(.1*i,2)}function Fhe(r,e,t){var n=e-r;if(t>n){var i=(t-n)/2;return 1-Math.pow(i,2)/Math.pow(.1*n,2)}return 1}function Ghe(){return 1}function zhe(r,e,t,n,i,a){t===void 0&&(t=5),n===void 0&&(n=!0),i===void 0&&(i=khe),a===void 0&&(a=[.25,.2,.5,.05]);var o=t<0?0:Math.round(t);if(Number.isNaN(r)||Number.isNaN(e)||typeof r!="number"||typeof e!="number"||!o)return{min:0,max:0,ticks:[]};if(e-r<1e-15||o===1)return{min:r,max:e,ticks:[r]};if(e-r>1e148){var s=t||5,u=(e-r)/s;return{min:r,max:e,ticks:Array(s).fill(null).map(function(W,J){return ls(r+u*J)})}}for(var f={score:-2,lmin:0,lmax:0,lstep:0},l=1;l<1/0;){for(var c=0;c<i.length;c+=1){var h=i[c],d=Dhe(h,i,l);if(a[0]*d+a[1]+a[2]+a[3]<f.score){l=1/0;break}for(var v=2;v<1/0;){var p=Rhe(v,o);if(a[0]*d+a[1]+a[2]*p+a[3]<f.score)break;for(var g=(e-r)/(v+1)/l/h,y=Math.ceil(Math.log10(g));y<1/0;){var m=l*h*Math.pow(10,y),b=Fhe(r,e,m*(v-1));if(a[0]*d+a[1]*b+a[2]*p+a[3]<f.score)break;var x=Math.floor(e/m)*l-(v-1)*l,w=Math.ceil(r/m)*l;if(x<=w)for(var s=w-x,E=0;E<=s;E+=1){var _=x+E,M=_*(m/l),C=M+m*(v-1),S=m,A=Ohe(h,i,l,M,C,S),T=Bhe(r,e,M,C),k=Phe(v,o,r,e,M,C),O=Ghe(),F=a[0]*A+a[1]*T+a[2]*k+a[3]*O;F>f.score&&(!n||M<=r&&C>=e)&&(f.lmin=M,f.lmax=C,f.lstep=S,f.score=F)}y+=1}v+=1}}l+=1}var D=ls(f.lmax),$=ls(f.lmin),Y=ls(f.lstep),N=Math.floor(Nhe((D-$)/Y))+1,P=new Array(N);P[0]=ls($);for(var c=1;c<N;c++)P[c]=ls(P[c-1]+Y);return{min:Math.min(r,ua(P)),max:Math.max(e,vi(P)),ticks:P}}function $he(r){var e=r.min,t=r.max,n=r.tickCount,i=r.nice,a=r.tickInterval,o=r.minLimit,s=r.maxLimit,u=zhe(e,t,n,i).ticks;return!ct(o)||!ct(s)?Tb(r,ua(u),vi(u)):a?Ab(e,t,a).ticks:u}function jhe(r){var e=r.base,t=r.tickCount,n=r.min,i=r.max,a=r.values,o,s=hi(e,i);if(n>0)o=Math.floor(hi(e,n));else{var u=AD(a,e,i);o=Math.floor(hi(e,u))}for(var f=s-o,l=Math.ceil(f/t),c=[],h=o;h<s+l;h=h+l)c.push(Math.pow(e,h));return n<=0&&c.unshift(0),c}function LD(r,e,t){if(t===void 0&&(t=5),r===e)return{max:e,min:r,ticks:[r]};var n=t<0?0:Math.round(t);if(n===0)return{max:e,min:r,ticks:[]};var i=1.5,a=.5+1.5*i,o=e-r,s=o/n,u=Math.pow(10,Math.floor(Math.log10(s))),f=u;2*u-s<i*(s-f)&&(f=2*u,5*u-s<a*(s-f)&&(f=5*u,10*u-s<i*(s-f)&&(f=10*u)));for(var l=Math.ceil(e/f),c=Math.floor(r/f),h=Math.max(l*f,e),d=Math.min(c*f,r),v=Math.floor((h-d)/f)+1,p=new Array(v),g=0;g<v;g++)p[g]=ls(d+g*f);return{min:d,max:h,ticks:p}}function Uhe(r){var e=r.exponent,t=r.tickCount,n=Math.ceil(yo(e,r.max)),i=Math.floor(yo(e,r.min)),a=LD(i,n,t).ticks;return a.map(function(o){var s=o>=0?1:-1;return Math.pow(o,e)*s})}function Xhe(r,e){var t=r.length*e;return e===1?r[r.length-1]:e===0?r[0]:t%1!==0?r[Math.ceil(t)-1]:r.length%2===0?(r[t-1]+r[t])/2:r[t]}function Yhe(r){var e=r.tickCount,t=r.values;if(!t||!t.length)return[];for(var n=t.slice().sort(function(s,u){return s-u}),i=[],a=0;a<e;a++){var o=a/(e-1);i.push(Xhe(n,o))}return i}function Whe(r){var e=r.min,t=r.max,n=r.tickCount,i=r.tickInterval,a=r.minLimit,o=r.maxLimit,s=LD(e,t,n).ticks;return!ct(a)||!ct(o)?Tb(r,ua(s),vi(s)):i?Ab(e,t,i).ticks:s}function Vhe(r){var e=r.min,t=r.max,n=r.minTickInterval,i=r.tickInterval,a=r.tickCount;if(i)a=Math.ceil((t-e)/i);else{i=mhe(e,t,a)[1];var o=(t-e)/i,s=o/a;s>1&&(i=i*Math.ceil(s)),n&&i<n&&(i=n)}i=Math.max(Math.floor((t-e)/(Math.pow(2,12)-1)),i);for(var u=[],f=e;f<t+i;f+=i)u.push(f);return u}function Hhe(r){var e=kD(B({showLast:!0},r));return e}function cv(r){return new Date(r).getFullYear()}function qhe(r){return new Date(r,0,1).getTime()}function rm(r){return new Date(r).getMonth()}function Zhe(r,e){var t=cv(r),n=cv(e),i=rm(r),a=rm(e);return(n-t)*12+(a-i)%12}function Khe(r,e){return new Date(r,e,1).getTime()}function Qhe(r,e){return Math.ceil((e-r)/Fa)}function Jhe(r,e){return Math.ceil((e-r)/Es)}function ede(r,e){return Math.ceil((e-r)/(60*1e3))}function tde(r){var e=r.min,t=r.max,n=r.minTickInterval,i=r.tickCount,a=r.tickInterval,o=[];a||(a=(t-e)/i,n&&a<n&&(a=n)),a=Math.max(Math.floor((t-e)/(Math.pow(2,12)-1)),a);var s=cv(e);if(a>_M)for(var u=cv(t),f=Math.ceil(a/_M),l=s;l<=u+f;l=l+f)o.push(qhe(l));else if(a>dl)for(var c=Math.ceil(a/dl),h=rm(e),d=Zhe(e,t),l=0;l<=d+c;l=l+c)o.push(Khe(s,l+h));else if(a>Fa)for(var v=new Date(e),p=v.getFullYear(),g=v.getMonth(),y=v.getDate(),m=Math.ceil(a/Fa),b=Qhe(e,t),l=0;l<b+m;l=l+m)o.push(new Date(p,g,y+l).getTime());else if(a>Es)for(var v=new Date(e),p=v.getFullYear(),g=v.getMonth(),m=v.getDate(),x=v.getHours(),w=Math.ceil(a/Es),E=Jhe(e,t),l=0;l<=E+w;l=l+w)o.push(new Date(p,g,m,x+l).getTime());else if(a>ws)for(var _=ede(e,t),M=Math.ceil(a/ws),l=0;l<=_+M;l=l+M)o.push(e+l*ws);else{var C=a;C<Ti&&(C=Ti);for(var S=Math.floor(e/Ti)*Ti,A=Math.ceil((t-e)/Ti),T=Math.ceil(C/Ti),l=0;l<A+T;l=l+T)o.push(S+l*Ti)}return o.length>=512&&console.warn("Notice: current ticks length("+o.length+') >= 512, may cause performance issues, even out of memory. Because of the configure "tickInterval"(in milliseconds, current is '+a+") is too small, increase the value to solve the problem!"),o}xa("cat",kD);xa("time-cat",Hhe);xa("wilkinson-extended",$he);xa("r-pretty",Whe);xa("time",Vhe);xa("time-pretty",tde);xa("log",jhe);xa("pow",Uhe);xa("quantile",Yhe);xa("d3-linear",Ihe);wa("cat",yc);wa("category",yc);wa("identity",Mhe);wa("linear",mc);wa("log",xhe);wa("pow",whe);wa("time",Ehe);wa("timeCat",bhe);wa("quantize",TD);wa("quantile",_he);var rde=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))};function nde(r){return _s(r,function(e,t){var n=t===0?"M":"L",i=e[0],a=e[1];return[n,i,a]})}function ND(r){return nde(r)}function ide(r){if(r.length<=2)return ND(r);var e=[];me(r,function(o){Mo(o,e.slice(e.length-2))||e.push(o[0],o[1])});var t=bI(e,!1),n=ua(r),i=n[0],a=n[1];return t.unshift(["M",i,a]),t}function ade(r,e,t,n){n===void 0&&(n=!0);var i=new mc({values:r}),a=new yc({values:_s(r,function(s,u){return u})}),o=_s(r,function(s,u){return[a.scale(u)*e,t-i.scale(s)*t]});return n?ide(o):ND(o)}function ode(r,e,t,n){n===void 0&&(n=5);for(var i=new mc({values:r}),a=new yc({values:_s(r,function(h,d){return d})}),o=_s(r,function(h,d){return[a.scale(d)*e,t-i.scale(h)*t]}),s=[],u=0;u<o.length;u++){var f=o[u],l={x:f[0],y:f[1],y0:t,size:n},c=fde(l);s.push.apply(s,c)}return lde(s)}function sde(r,e){var t=new mc({values:r}),n=Math.max(0,t.min);return e-t.scale(n)*e}function ude(r,e,t,n){var i=rde([],r,!0),a=sde(n,t);return i.push(["L",e,a]),i.push(["L",0,a]),i.push(["Z"]),i}function fde(r){var e=r.x,t=r.y,n=r.y0,i=r.size,a,o;pt(t)?(a=t[0],o=t[1]):(a=n,o=t);var s,u;pt(e)?(s=e[0],u=e[1]):(s=e-i/2,u=e+i/2);var f=[{x:s,y:a},{x:s,y:o}];return f.push({x:u,y:o},{x:u,y:a}),f}function lde(r,e){e===void 0&&(e=!0);var t=[],n=r[0];t.push(["M",n.x,n.y]);for(var i=1,a=r.length;i<a;i++)t.push(["L",r[i].x,r[i].y]);return e&&(t.push(["L",n.x,n.y]),t.push(["z"])),t}var vl=function(){return vl=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},vl.apply(this,arguments)},cde={stroke:"#C5C5C5",strokeOpacity:.85},hde={fill:"#CACED4",opacity:.85},dde=function(){function r(e){var t=e.x,n=t===void 0?0:t,i=e.y,a=i===void 0?0:i,o=e.width,s=o===void 0?200:o,u=e.height,f=u===void 0?26:u,l=e.smooth,c=l===void 0?!0:l,h=e.isArea,d=h===void 0?!1:h,v=e.data,p=v===void 0?[]:v,g=e.lineStyle,y=e.areaStyle,m=e.group,b=e.interval,x=b===void 0?null:b;this.group=m,this.x=n,this.y=a,this.width=s,this.height=f,this.data=p,this.smooth=c,this.isArea=d,this.lineStyle=Object.assign({},cde,g),this.areaStyle=Object.assign({},hde,y),this.intervalConfig=x,this.renderLine()}return r.prototype.renderLine=function(){var e=this,t=e.x,n=e.y,i=e.width,a=e.height;e.barWidth;var o=e.data,s=e.smooth,u=e.isArea,f=e.lineStyle,l=e.areaStyle,c=this.group.addGroup({name:"trend-group"});if(o){var h=ade(o,i,a,s);if(c.addShape("path",{attrs:vl({path:h},f),name:"trend-line"}),u){var d=ude(h,i,a,o);c.addShape("path",{attrs:vl({path:d},l),name:"trend-area"})}}this.intervalConfig&&c.addShape("path",{attrs:vl({path:ode(this.intervalConfig.data,i,a,this.intervalConfig.style.barWidth)},this.intervalConfig.style),name:"trend-interval"}),c.move(t,n)},r.prototype.destory=function(){this.group.destroy()},r}(),_u=function(){return _u=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},_u.apply(this,arguments)},vde={fill:"#1890ff",stroke:"#1890ff",type:"trend",radius:2,opacity:1,cursor:"ew-resize",highLightFill:"#0050b3"},pde={fill:"#fff",stroke:"#1890ff",radius:2,opacity:1,cursor:"ew-resize",highLightFill:"#0050b3"},IM=function(){function r(e){var t=e.group,n=e.name,i=e.type,a=e.x,o=a===void 0?0:a,s=e.y,u=s===void 0?0:s,f=e.width,l=f===void 0?2:f,c=e.height,h=c===void 0?24:c,d=e.style,v=d===void 0?{}:d;this.group=t,this.name=n,this.handleType=i,this.x=o,this.y=u,this.width=l,this.height=h,i==="trend"?this.style=_u(_u({},vde),v):i==="simple"&&(this.style=_u(_u({},pde),v)),this.renderHandle()}return r.prototype.setX=function(e){this.setXY(e,void 0)},r.prototype.setY=function(e){this.setXY(void 0,e)},r.prototype.setXY=function(e,t){ht(e)&&(this.x=e),ht(t)&&(this.y=t),this.updateXY()},r.prototype.renderHandle=function(){var e=this,t=e.width,n=e.height,i=e.style,a=e.name,o=i.fill,s=i.stroke,u=i.radius,f=i.opacity,l=i.cursor;this.handleGroup=this.group.addGroup(),this.handleType==="trend"?(this.verticalLine=this.handleGroup.addShape("rect",{attrs:{x:0,y:0,width:t,height:n,fill:o,stroke:s,radius:u,opacity:f,cursor:l},name:"".concat(a,"-handler")}),this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:0,r:2*t,fill:o,stroke:s,radius:u,opacity:f,cursor:l,lineAppendWidth:12},name:"".concat(a,"-handler")}),this.bottomCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:n,r:2*t,fill:o,stroke:s,radius:u,opacity:f,cursor:l},name:"".concat(a,"-handler")})):this.handleType==="simple"&&(this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:t/2,y:n/2,r:2*t,fill:o,stroke:s,radius:u,opacity:f,cursor:l,lineWidth:2},name:"".concat(a,"-handler")})),this.updateXY(),this.handleType==="trend"?this.bindTrendEvents():this.handleType==="simple"&&this.bindSimpleEvents()},r.prototype.bindSimpleEvents=function(){var e=this,t=this.name;this.handleGroup.on("".concat(t,"-handler:mouseenter"),function(){var n=e.style.highLightFill;e.topCircle.attr("fill",n)}),this.handleGroup.on("".concat(t,"-handler:mouseleave"),function(){var n=e.style.fill;e.topCircle.attr("fill",n)})},r.prototype.bindTrendEvents=function(){var e=this,t=this.name;this.handleGroup.on("".concat(t,"-handler:mouseenter"),function(){var n=e.style.highLightFill;e.verticalLine.attr("fill",n),e.topCircle.attr("fill",n),e.bottomCircle.attr("fill",n)}),this.handleGroup.on("".concat(t,"-handler:mouseleave"),function(){var n=e.style.fill;e.verticalLine.attr("fill",n),e.topCircle.attr("fill",n),e.bottomCircle.attr("fill",n)})},r.prototype.show=function(){this.handleGroup.show()},r.prototype.hide=function(){this.handleGroup.hide()},r.prototype.updateXY=function(){this.handleGroup.setMatrix([1,0,0,0,1,0,this.x,this.y,1])},r}(),xr=function(){return xr=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},xr.apply(this,arguments)},gde=yi,yde={fill:"#416180",opacity:.05},mde={fill:"#416180",opacity:.15,radius:5},bde={fill:"#5B8FF9",opacity:.3,cursor:"grab"},nm=2,xde={width:nm,height:24},wde={textBaseline:"middle",fill:"#000",opacity:.45},Ede={textAlign:"center",textBaseline:"top",fill:"#607889",opacity:.35},_de={lineWidth:1,stroke:"#ccc"},Sde=function(){function r(e){var t=this;this.prevX=0,this.onMouseDown=function(W){return function(J){t.currentHandler=W;var te=J.originalEvent;te.stopPropagation(),te.preventDefault(),t.prevX=Oa(te,"touches.0.pageX",te.pageX);var H=t.canvas.get("container");H.addEventListener("mousemove",t.onMouseMove),H.addEventListener("mouseup",t.onMouseUp),H.addEventListener("mouseleave",t.onMouseUp),H.addEventListener("touchmove",t.onMouseMove),H.addEventListener("touchend",t.onMouseUp),H.addEventListener("touchcancel",t.onMouseUp)}},this.onMouseMove=function(W){W.stopPropagation(),W.preventDefault();var J=Oa(W,"touches.0.pageX",W.pageX),te=J-t.prevX,H=t.adjustOffsetRange(te/t.width);t.updateStartEnd(H),t.updateUI(),t.prevX=J},this.onMouseUp=function(){t.currentHandler&&(t.currentHandler=void 0);var W=t.canvas.get("container");W&&(W.removeEventListener("mousemove",t.onMouseMove),W.removeEventListener("mouseup",t.onMouseUp),W.removeEventListener("mouseleave",t.onMouseUp),W.removeEventListener("touchmove",t.onMouseMove),W.removeEventListener("touchend",t.onMouseUp),W.removeEventListener("touchcancel",t.onMouseUp))};var n=e.x,i=n===void 0?0:n,a=e.y,o=a===void 0?0:a,s=e.width,u=s===void 0?100:s,f=e.height,l=e.padding,c=l===void 0?10:l,h=e.trendCfg,d=e.controllerCfg,v=d===void 0?{speed:1}:d,p=e.backgroundStyle,g=p===void 0?{}:p,y=e.foregroundStyle,m=y===void 0?{}:y,b=e.handlerStyle,x=b===void 0?{}:b,w=e.textStyle,E=w===void 0?{}:w,_=e.start,M=_===void 0?0:_,C=e.end,S=C===void 0?1:C,A=e.minText,T=A===void 0?"":A,k=e.maxText,O=k===void 0?"":k,F=e.group,D=e.graph,$=e.canvas,Y=e.tick,N=Y===void 0?{tickLabelStyle:{},tickLineStyle:{},tickLabelFormatter:function(J){return J},ticks:[]}:Y,P=e.type;this.graph=D,this.canvas=$,this.group=F,this.timeBarType=P,this.x=i,this.y=o,this.width=u,this.height=f,this.padding=c,this.ticks=N.ticks,this.trendCfg=h,this.controllerCfg=v,this.currentSpeed=v.speed||1,this.tickLabelFormatter=N.tickLabelFormatter,P==="trend"?this.backgroundStyle=xr(xr({},yde),g):P==="simple"&&(this.backgroundStyle=xr(xr({},mde),g)),this.foregroundStyle=xr(xr({},bde),m),this.handlerStyle=xr(xr({},xde),x),this.textStyle=xr(xr({},wde),E),this.tickLabelStyle=xr(xr({},Ede),N.tickLabelStyle),this.tickLineStyle=xr(xr({},_de),N.tickLineStyle),this.currentMode=v.defaultTimeType||Qi.RANGE,this.start=M,this.end=S,this.minText=T,this.maxText=O,this.fontFamily=typeof window<"u"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlider()}return r.prototype.update=function(e){var t=e.x,n=e.y,i=e.width,a=e.height,o=e.minText,s=e.maxText,u=e.start,f=e.end;this.start=Math.min(1,Math.max(u,0)),this.end=Math.min(1,Math.max(f,0)),yt(this,{x:t,y:n,width:i,height:a,minText:o,maxText:s}),this.updateUI()},r.prototype.setText=function(e,t){this.minTextShape.attr("text",e),this.maxTextShape.attr("text",t)},r.prototype.renderSlider=function(){var e=this,t=this,n=t.width,i=t.height,a=t.timeBarType;if(a==="trend"&&mv(Oa(this.trendCfg,"data"))){var o=new dde(xr(xr({x:this.x,y:this.y,width:n,height:i},this.trendCfg),{group:this.group}));this.trendComponent=o}var s=this.group.addGroup({name:"slider-group"});s.addShape("rect",{attrs:xr({x:0,y:0,width:n,height:i},this.backgroundStyle),name:"background"});var u=this.group.addGroup();a==="trend"?(this.minTextShape=u.addShape("text",{attrs:xr({x:0,y:i/2+this.y,textAlign:"right",text:this.minText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"min-text-shape"}),this.maxTextShape=u.addShape("text",{attrs:xr({y:i/2+this.y,textAlign:"left",text:this.maxText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"max-text-shape"})):(this.minTextShape=u.addShape("text",{attrs:xr({x:0,y:this.y-10,textAlign:"center",text:this.minText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"min-text-shape"}),this.maxTextShape=u.addShape("text",{attrs:xr({y:this.y-10,textAlign:"center",text:this.maxText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"max-text-shape"})),this.foregroundShape=this.group.addGroup().addShape("rect",{attrs:xr({x:0,y:this.y,height:i},this.foregroundStyle),name:"foreground-shape"}),this.foregroundShape.on("mousedown",function(y){y.target.attr("cursor","grabbing")}),this.foregroundShape.on("mouseup",function(y){y.target.attr("cursor",e.foregroundStyle.cursor||"grab")});var f=Oa(this.handlerStyle,"width",2),l=Oa(this.handlerStyle,"height",24),c=this.group.addGroup({name:"minHandlerShape"});this.minHandlerShape=new IM({name:"minHandlerShape",group:c,type:a,x:this.x,y:this.y,width:f,height:l,style:this.handlerStyle});var h=this.group.addGroup({name:"maxHandlerShape"});this.maxHandlerShape=new IM({name:"maxHandlerShape",group:h,type:a,x:this.x,y:this.y,width:f,height:l,style:this.handlerStyle});var d=this.ticks,v=n/(d.length-1);this.tickPosList=[],this.textList&&this.textList.length&&this.textList.forEach(function(y){y.destroy()});var p=-1/0,g=this.tickLabelStyle.rotate;delete this.tickLabelStyle.rotate,this.textList=d.map(function(y,m){e.tickPosList.push(e.x+m*v);var b;e.tickLabelFormatter?(b=e.tickLabelFormatter(y),!Pe(b)&&b&&(b=y.date)):b=y.date;var x=e.x+m*v,w=e.y+i+5,E=e.group.addShape("text",{attrs:xr({x,y:w,text:b,fontFamily:e.fontFamily||"Arial, sans-serif"},e.tickLabelStyle),name:"tick-label"});if(ht(g)&&m!==d.length-1){var _=gde([1,0,0,0,1,0,0,0,1],[["t",-x,-w],["r",g],["t",x-5,w+2]]);E.attr({textAlign:"left",matrix:_})}m===0?E.attr({textAlign:"left"}):m!==d.length-1&&E.attr({textAlign:"right"});var M=e.group.addShape("line",{attrs:xr({x1:e.x+m*v,y1:e.y+i+2,x2:e.x+m*v,y2:e.y+i+6},e.tickLineStyle),name:"tick-line"});M.toBack();var C=E.getBBox();return C.minX>p?(E.show(),M.show(),p=C.minX+C.width+10):(E.hide(),M.hide()),E}),this.controllerBtnGroup=new vD(xr({group:this.group,x:this.x,y:this.y+i+25,width:n,height:35},this.controllerCfg)),this.updateStartEnd(0),this.updateUI(),s.move(this.x,this.y),this.bindEvents(),this.currentMode===Qi.SINGLE&&(this.minHandlerShape.hide(),this.foregroundShape.hide(),this.minTextShape.hide())},r.prototype.bindEvents=function(){var e=this,t=this.group.find(function(i){return i.get("name")==="minHandlerShape"});t&&(t.on("minHandlerShape-handler:mousedown",this.onMouseDown(this.minHandlerShape)),t.on("minHandlerShape-handler:touchstart",this.onMouseDown(this.minHandlerShape)));var n=this.group.find(function(i){return i.get("name")==="maxHandlerShape"});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(Eo,":click"),function(){e.isPlay=!e.isPlay,e.currentHandler=e.maxHandlerShape,e.changePlayStatus()}),this.group.on("".concat(Fl,":click"),function(){e.currentHandler=e.maxHandlerShape,e.updateStartEnd(.01),e.updateUI()}),this.group.on("".concat(Gl,":click"),function(){e.currentHandler=e.maxHandlerShape,e.updateStartEnd(-.01),e.updateUI()}),this.group.on(xs,function(i){var a=i.type,o=i.speed;e.currentSpeed=o,e.currentMode=a,a===Qi.SINGLE?(e.minHandlerShape.hide(),e.foregroundShape.hide(),e.minTextShape.hide()):a===Qi.RANGE&&(e.minHandlerShape.show(),e.foregroundShape.show(),e.minTextShape.show())})},r.prototype.adjustTickIndex=function(e){for(var t=0;t<this.tickPosList.length-1;t++)if(this.tickPosList[t]<=e&&e<=this.tickPosList[t+1])return Math.abs(this.tickPosList[t]-e)<Math.abs(e-this.tickPosList[t+1])?t:t+1;return 0},r.prototype.adjustOffsetRange=function(e){switch(this.currentHandler){case this.minHandlerShape:{var t=0-this.start,n=1-this.start;return Math.min(n,Math.max(t,e))}case this.maxHandlerShape:{var t=0-this.end,n=1-this.end;return Math.min(n,Math.max(t,e))}case this.foregroundShape:{var t=0-this.start,n=1-this.end;return Math.min(n,Math.max(t,e))}default:return 0}},r.prototype.updateStartEnd=function(e){var t=this.ticks[this.adjustTickIndex(this.start*this.width)],n=this.ticks[this.adjustTickIndex(this.end*this.width)];if(!this.currentHandler){this.minText=this.tickLabelFormatter?this.tickLabelFormatter(t):t==null?void 0:t.date,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n==null?void 0:n.date;return}switch(this.currentHandler){case this.minHandlerShape:this.maxText=this.maxTextShape.attr("text"),this.start+=e,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(t):t.date;break;case this.maxHandlerShape:this.minText=this.minTextShape.attr("text"),this.end+=e,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date;break;case this.foregroundShape:this.start+=e,this.end+=e,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(t):t.date,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(n):n.date;break}},r.prototype.updateUI=function(){var e=this;this.start<0&&(this.start=0),this.start>1&&(this.start=1),this.end>1&&(this.end=1),this.end<0&&(this.end=0);var t=this.x+this.start*this.width,n=this.x+this.end*this.width;this.foregroundShape.attr("x",t),this.foregroundShape.attr("width",n-t);var i=Oa(this.handlerStyle,"width",nm);this.setText(this.minText,this.maxText);var a=this.dodgeText([t,n]),o=a[0],s=a[1];this.minHandlerShape.setX(t-i/2),me(o,function(u,f){return e.minTextShape.attr(f,u)}),this.maxHandlerShape.setX(n-i/2),me(s,function(u,f){return e.maxTextShape.attr(f,u)}),this.currentMode===Qi.RANGE?this.graph.emit(ea,{value:[this.start,this.end].sort()}):this.currentMode===Qi.SINGLE&&this.graph.emit(ea,{value:[this.end,this.end]})},r.prototype.dodgeText=function(e){var t,n,i=2,a=Oa(this.handlerStyle,"width",nm),o=this.minTextShape,s=this.maxTextShape,u=e[0],f=e[1],l=!1;u>f&&(t=[f,u],u=t[0],f=t[1],n=[s,o],o=n[0],s=n[1],l=!0);var c=o.getBBox(),h=s.getBBox(),d=null,v=null;return this.timeBarType==="trend"?(d=u-c.width<this.x+i?{x:u+a/2+i,textAlign:"left"}:{x:u-a/2-i,textAlign:"right"},v=f+h.width>this.x+this.width?{x:f-a/2-i,textAlign:"right"}:{x:f+a/2+i,textAlign:"left"}):this.timeBarType==="simple"&&(d=o.attr("x")>c.width?{x:u,textAlign:"center"}:{x:u,textAlign:"left"},v=s.attr("x")>this.width-h.width?{x:f,textAlign:"right"}:{x:f,textAlign:"center"}),l?[v,d]:[d,v]},r.prototype.startPlay=function(){var e=this;return typeof window<"u"?window.requestAnimationFrame(function(){var t=e,n=t.ticks,i=t.width,a=e.currentSpeed,o=i/n.length,s=o/((10-a)*1e3/60),u=e.adjustOffsetRange(s/e.width);e.updateStartEnd(u),e.updateUI(),e.isPlay&&(e.playHandler=e.startPlay())}):void 0},r.prototype.changePlayStatus=function(e){e===void 0&&(e=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit(lD,null)):this.playHandler&&(typeof window<"u"&&window.cancelAnimationFrame(this.playHandler),e&&this.graph.emit(cD,null))},r.prototype.destory=function(){this.graph.off(ea,function(){});var e=this.group,t=e.find(function(i){return i.get("name")==="minHandlerShape"});t&&(t.off("minHandlerShape-handler:mousedown"),t.off("minHandlerShape-handler:touchstart"),t.destroy());var n=e.find(function(i){return i.get("name")==="maxHandlerShape"});n&&(n.off("maxHandlerShape-handler:mousedown"),n.off("maxHandlerShape-handler:touchstart"),n.destroy()),this.foregroundShape.off("mousedown"),this.foregroundShape.off("touchstart"),this.foregroundShape.destroy(),e.off("".concat(Eo,":click")),e.off("".concat(Fl,":click")),e.off("".concat(Gl,":click")),e.off(xs),e.destroy(),this.trendComponent&&this.trendComponent.destory()},r}(),Mde=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Da=function(){return Da=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Da.apply(this,arguments)},Cde=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t},Ade=4,Tde=26,Ide=function(r){Mde(e,r);function e(t){var n=r.call(this,t)||this;return n.afterrenderListener=function(i){return n.filterData({})},n.valueChangeListener=yl(function(i){return n.filterData(i)},200,{trailing:!0,leading:!0}),n.changeData=function(i){var a=n.get("graph");n.cacheGraphData=a.get("data"),n.filterData({})},n}return e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-component-timebar",padding:10,type:"trend",trend:{data:[],isArea:!1,smooth:!0},controllerCfg:{speed:1,loop:!1},slider:{start:.1,end:.9,minText:"min",maxText:"max"},tick:{start:.1,end:.9,data:[]},textStyle:{},filterEdge:!1,filterItemTypes:["node"],containerCSS:{},putInGraphContainer:!0}},e.prototype.initContainer=function(){var t=this.get("graph"),n=this._cfgs,i=n.width,a=n.height,o=n.putInGraphContainer,s=this.get("className")||"g6-component-timebar",u=this.get("container"),f;if(u?(Pe(u)&&(u=document.getElementById(u)),f=u):(f=Er("<div class='".concat(s,"'></div>")),Xt(f,{position:"relative"})),o){var l=this.get("graph").get("container");l.appendChild(f)}this.set("timeBarContainer",f);var c,h=t.get("renderer");h==="SVG"?c=new al({container:f,width:i,height:a}):c=new Ra({container:f,width:i,height:a}),this.get("containerCSS")&&Xt(f,this.get("containerCSS")),this.set("canvas",c)},e.prototype.init=function(){this.initContainer();var t=this.get("canvas"),n=t.addGroup({name:"timebar-group"});this.set("timeBarGroup",n),this.renderTrend(),this.initEvent();var i=typeof window<"u"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif";this.set("fontFamily",i)},e.prototype.play=function(){this.togglePlay(!0)},e.prototype.pause=function(){this.togglePlay(!1)},e.prototype.togglePlay=function(t){var n=this.get("timebar");n&&(n.isPlay=!!t,n.changePlayStatus())},e.prototype.renderTrend=function(){var t=this,n=this._cfgs,i=n.width,a=n.x,o=n.y,s=n.padding,u=n.type,f=n.trend,l=n.slider,c=n.controllerCfg,h=n.textStyle,d=n.tick,v=n.backgroundStyle,p=n.foregroundStyle,g=f.data,y=Cde(f,["data"]),m=i-2*s,b=u==="trend"?Tde:Ade,x=this.get("graph"),w=this.get("timeBarGroup"),E=this.get("canvas"),_=null;if(u==="trend"||u==="simple"){var M=this.get("getValue");_=new Sde(Da(Da({graph:x,canvas:E,group:w,type:u,x:a+s,y:u==="trend"?o+s:o+s+15,width:m,height:b,padding:s,backgroundStyle:v,foregroundStyle:p,trendCfg:Da(Da({},y),{data:g.map(function(S){return(M==null?void 0:M(S))||S.value})})},l),{tick:{ticks:g,tickLabelFormatter:d.tickLabelFormatter,tickLabelStyle:d.tickLabelStyle,tickLineStyle:d.tickLineStyle},handlerStyle:Da(Da({},l.handlerStyle),{height:l.height||b}),controllerCfg:c,textStyle:h}))}else u==="tick"&&(_=new uhe(Da({graph:x,canvas:E,group:w,x:a+s,y:o+s,width:i,height:42,padding:2,controllerCfg:c},d)));var C=function S(){var A=t.get("timebar");A.draggingHandler=!1,A.isPlay&&(A.isPlay=!1,A.currentHandler=A.maxHandlerShape,A.changePlayStatus()),document.removeEventListener("mouseup",S)};E.on("mousedown",function(S){(S.target.get("name")==="maxHandlerShape-handler"||S.target.get("name")==="minHandlerShape-handler"||S.target===_.foregroundShape)&&document.addEventListener("mouseup",C)}),this.set("timebar",_)},e.prototype.filterData=function(t){var n,i=t.value;if(!i){i=[];var a=this._cfgs.type;!a||a==="trend"||a==="simple"?(i[0]=this._cfgs.slider.start,i[1]=this._cfgs.slider.end):a==="tick"&&(i[0]=this._cfgs.tick.start,i[1]=this._cfgs.tick.end)}var o=null,s=this._cfgs.type;if(s==="trend"||s==="simple"?o=this._cfgs.trend.data:s==="tick"&&(o=this._cfgs.tick.data),!o||o.length===0){console.warn("请配置 TimeBar 组件的数据");return}var u=this.get("rangeChange"),f=this.get("graph"),l=Math.round(o.length*i[0]),c=Math.round(o.length*i[1]);c=c>=o.length?o.length-1:c,l=l>=o.length?o.length-1:l;var h=(n=this._cfgs.tick)===null||n===void 0?void 0:n.tickLabelFormatter,d=h?h(o[l]):o[l].date,v=h?h(o[c]):o[c].date;if(s!=="tick"){var p=this.get("timebar");p.setText(d,v)}if(u)u(f,d,v);else{(!this.cacheGraphData||this.cacheGraphData.nodes&&this.cacheGraphData.nodes.length===0)&&(this.cacheGraphData=f.get("data"));var g=this.get("filterItemTypes"),y=this.get("changeData"),m=this.get("getDate"),b=this.get("shouldIgnore"),x=o[l].date,w=o[c].date;if(y||y===void 0){var E=this.cacheGraphData.nodes,_=this.cacheGraphData.edges,M={},C={};f.getNodes().forEach(function(S){return M[S.getID()]=!0}),f.getEdges().forEach(function(S){return C[S.getID()]=!0}),g.includes("node")&&(E==null||E.forEach(function(S){var A=+((m==null?void 0:m(S))||S.date),T=A>=x&&A<=w||(b==null?void 0:b("node",S,{min:x,max:w})),k=M[S.id];k&&!T?(f.removeItem(S.id),M[S.id]=!1):!k&&T&&(f.addItem("node",S),M[S.id]=!0)}),_==null||_.forEach(function(S){var A=M[S.source]&&M[S.target]||(b==null?void 0:b("edge",S,{min:x,max:w})),T=!!f.findById(S.id);T&&!A?(f.removeItem(S.id),C[S.id]=!1):!T&&A?(f.addItem("edge",S),C[S.id]=!0):T||(C[S.id]=!1)})),(this.get("filterEdge")||g.includes("edge"))&&(_==null||_.filter(function(S){var A=+((m==null?void 0:m(S))||S.date),T=A>=x&&A<=w||(b==null?void 0:b("edge",S,{min:x,max:w})),k=M[S.source]&&M[S.target],O=T&&k,F=C[S.id];F&&!O?(C[S.id]=!1,f.removeItem(S.id)):!F&&O&&(C[S.id]=!0,f.addItem("edge",S))}))}else g.includes("node")&&f.getNodes().forEach(function(S){var A=S.getModel();if(!(b!=null&&b("node",A,{min:x,max:w}))){var T=+((m==null?void 0:m(A))||A.date);T<x||T>w?f.hideItem(S):f.showItem(S)}}),(this.get("filterEdge")||g.includes("edge"))&&f.getEdges().forEach(function(S){var A=S.getModel();if(!(b!=null&&b("edge",A,{min:o[l].date,max:o[c].date}))){var T=+((m==null?void 0:m(A))||A.date);if(T<o[l].date||T>o[c].date)f.hideItem(S);else{var k=S.getSource().isVisible(),O=S.getTarget().isVisible();k&&O&&f.showItem(S)}}})}},e.prototype.initEvent=function(){var t=this.get("graph");t.on("afterchangedata",this.changeData),t.on("afterrender",this.afterrenderListener),t.on(ea,this.valueChangeListener)},e.prototype.destroy=function(){var t=this.get("graph");t.off("afterchangedata",this.changeData),t.off("afterrender",this.afterrenderListener),t.off(ea,this.valueChangeListener);var n=this.get("timebar");n&&n.destory&&n.destory(),r.prototype.destroy.call(this);var i=this.get("timeBarContainer");if(i){var a=this.get("container");a||(a=this.get("graph").get("container")),Pe(a)&&(a=document.getElementById(a)),a===i&&(a=a.parentElement),a.removeChild(i)}},e}(jn),kde=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Lde=_n.applyMatrix;function Nde(r,e){var t,n;if(r.naturalWidth)t=r.naturalWidth,n=r.naturalHeight;else{var i=new Image;i.src=r.src,i.onload=function(){}}return[t,n]}var Ode=function(r){kde(e,r);function e(t){return r.call(this,t)||this}return 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,n=this._cfgs,i=n.graph;if(!this.destroyed){var a=this.get("container");Pe(a)&&(a=document.getElementById(a));var o=Er("<div class=".concat(n.viewportClassName,`
|
|
602
|
-
style='position:absolute;
|
|
603
|
-
left:0;
|
|
604
|
-
top:0;
|
|
605
|
-
box-sizing:border-box;
|
|
606
|
-
border: 2px solid #1980ff;
|
|
607
|
-
cursor:move'
|
|
608
|
-
</div>`)),s=0,u=0,f=!1,l=0,c=0,h=0,d=0,v=0,p=0;a.addEventListener("mousedown",function(g){if(n.refresh=!1,g.target===o){var y=o.style;h=parseInt(y.width,10),d=parseInt(y.height,10);var m=t.get("width"),b=t.get("height");h>m||d>b||(p=i.getZoom(),v=t.get("ratio"),f=!0,s=g.clientX,u=g.clientY)}},!1),a.addEventListener("mousemove",function(g){if(!(!f||ct(g.clientX)||ct(g.clientY))){var y=t.get("width"),m=t.get("height"),b=o.style;l=parseInt(b.left,10),c=parseInt(b.top,10),h=parseInt(b.width,10),d=parseInt(b.height,10);var x=s-g.clientX,w=u-g.clientY;l-x<0?x=l:l-x+h>=y&&(x=0),c-w<0?w=c:c-w+d>=m&&(w=0),l-=x,c-=w,Xt(o,{left:"".concat(l,"px"),top:"".concat(c,"px")}),i.translate(x*p/v,w*p/v),s=g.clientX,u=g.clientY}},!1),a.addEventListener("mouseleave",function(){f=!1,n.refresh=!0},!1),a.addEventListener("mouseup",function(){f=!1,n.refresh=!0},!1),this.set("viewport",o),a.appendChild(o)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),n=this.get("width"),i=this.get("height"),a=this.get("graph"),o=a.get("width"),s=a.get("height"),u=o/s,f=a.getGroup(),l=f.getCanvasBBox(),c=[(l.minX+l.maxX)/2,(l.minY+l.maxY)/2],h=[l.maxX-l.minX,l.maxY-l.minY],d={centerX:c[0],centerY:c[1],width:0,height:0,minX:0,minY:0};l[0]/l[1]>u?(d.width=h[0],d.height=d.width/u):(d.height=h[1],d.width=d.height*u),d.minX=c[0]-d.width/2,d.minY=c[1]-d.height/2;var v=f.getMatrix();v||(v=[1,0,0,0,1,0,0,0,1]);var p=ym([1,0,0,0,1,0,0,0,1],v),g=Lde({x:d.minX,y:d.minY},p),y=a.getCanvasByPoint(g.x,g.y),m=this.get("viewport");m||this.initViewport();var b=o/d.width,x=b*n,w=b*i,E=n*-y.x/d.width,_=i*-y.y/d.height,M=E+x,C=_+w;E<0&&(x+=E,E=0),M>n&&(x=x-(M-n)),_<0&&(w+=_,_=0),C>i&&(w=w-(C-i)),this.set("ratio",t);var S="".concat(E,"px"),A="".concat(_,"px");Xt(m,{left:S,top:A,width:"".concat(x,"px"),height:"".concat(w,"px")})}},e.prototype.init=function(){this.initContainer()},e.prototype.initContainer=function(){var t=this,n=t.get("graph"),i=n.get("width"),a=n.get("height"),o=a/i,s=t.get("className"),u=t.get("container"),f=t.get("width"),l=t.get("height");!f&&!l&&(f=200),f?(l=o*f,t.set("height",l)):(f=1/o*l,t.set("width",f));var c=Er("<div class='".concat(s,"' style='width: ").concat(f,"px; height: ").concat(l,"px; overflow: hidden; position: relative;'></div>"));Pe(u)&&(u=document.getElementById(u)),u?u.appendChild(c):n.get("container").appendChild(c),t.set("container",c);var h=Er('<div class="g6-minimap-container" style="position: relative; width: 100%; height: 100%; text-align: center; display: table;"></div>');c.appendChild(h);var d=Er('<span style="display: table-cell; vertical-align: middle; "></span>');h.appendChild(d),t.set("containerDOM",h),t.set("containerSpan",d);var v=Er('<img alt="" src="'.concat(this.get("graphImg"),'" style="display: inline-block; user-select: none;" draggable="false" />'));t.set("imgDOM",v),t.updateImgSize(),d.appendChild(v),t.updateCanvas()},e.prototype.updateImgSize=function(){var t=this,n=t.get("imgDOM"),i=t.get("width"),a=t.get("height");n.onload=function(){var o=Nde(n);o[0]>o[1]?n.width=i:n.height=a}},e.prototype.updateCanvas=function(){var t=this.get("refresh");if(t){var n=this.get("graph");if(!n.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var i=this.get("width"),a=n.get("canvas").getCanvasBBox(),o=a.width,s=i/o;this.set("ratio",s),this.updateViewport()}}},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.updateGraphImg=function(t){var n=this,i=n.get("imgDOM");i.remove(),n.set("graphImg",t);var a=Er('<img alt="" src="'.concat(t,'" style="display: inline-block;" ondragstart="return false;" onselectstart="return false;"/>'));n.set("imgDOM",a),a.src=t,n.updateImgSize();var o=n.get("containerSpan");o.appendChild(a),n.updateCanvas()},e.prototype.destroy=function(){var t=this.get("container");t.parentNode.removeChild(t)},e}(jn),Dde=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),im=function(){return im=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},im.apply(this,arguments)},Pde=_n.distance,kM=.05,LM={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:1,fill:"#fff"},Rde=function(r){Dde(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{type:"both",trigger:"mousemove",r:60,delegateStyle:Vt(LM),showLabel:"edge",scaleRBy:"wheel"}},e.prototype.getEvents=function(){var t;switch(this.get("trigger")){case"click":t={click:"filter"};break;case"drag":t={click:"createDelegate"};break;default:t={mousemove:"filter"};break}return t},e.prototype.init=function(){var t=this,n=t.get("showLabel"),i=n==="node"||n==="both",a=n==="edge"||n==="both";t.set("showNodeLabel",i),t.set("showEdgeLabel",a);var o=t.get("shouldShow");o||t.set("shouldShow",function(){return!0})},e.prototype.createDelegate=function(t){var n=this,i=n.get("delegate");(!i||i.destroyed)&&(n.filter(t),i=n.get("delegate"),i.on("dragstart",function(a){}),i.on("drag",function(a){n.filter(a)}),this.get("scaleRBy")==="wheel"&&i.on("mousewheel",function(a){n.scaleRByWheel(a)}))},e.prototype.scaleRByWheel=function(t){var n=this;if(!(!t||!t.originalEvent)){t.preventDefault&&t.preventDefault();var i=n.get("graph"),a,o=n.get("delegate"),s=o?{x:o.attr("x"),y:o.attr("y")}:void 0;s||i.getPointByClient(t.clientX,t.clientY),t.originalEvent.wheelDelta<0?a=1-kM:a=1/(1-kM);var u=n.get("maxR"),f=n.get("minR"),l=n.get("r");(l>(u||i.get("height"))&&a>1||l<(f||i.get("height")*.05)&&a<1)&&(a=1),l*=a,n.set("r",l),n.filter(t)}},e.prototype.filter=function(t){var n=this,i=n.get("graph"),a=i.getNodes(),o={},s=n.get("r"),u=n.get("type"),f={x:t.x,y:t.y};n.updateDelegate(f,s);var l=n.get("shouldShow"),c=n.get("vShapes");c&&c.forEach(function(y){y.remove(),y.destroy()}),c=[],a.forEach(function(y){var m=y.getModel(),b=m.x,x=m.y;Pde({x:b,y:x},f)<s&&(o[m.id]=y)});var h=i.getEdges(),d=[];h.forEach(function(y){var m=y.getModel(),b=m.source,x=m.target;l(m)&&(u==="only-source"||u==="one"?o[b]&&!o[x]&&d.push(y):u==="only-target"||u==="one"?o[x]&&!o[b]&&d.push(y):u==="both"&&o[b]&&o[x]&&d.push(y))});var v=n.get("showNodeLabel"),p=n.get("showEdgelabel"),g=i.get("group");d.forEach(function(y){var m=y.get("group").get("children");m.forEach(function(b){var x=b.get("type"),w=g.addShape(x,{attrs:b.attr()});c.push(w),v&&x==="text"&&w.set("visible",!0)})}),Object.keys(o).forEach(function(y){var m=o[y],b=m.get("group").clone();if(g.add(b),c.push(b),p)for(var x=b.get("children"),w=0;w<x.length;w++){var E=x[w];E.get("type")==="text"&&E.set("visible",!0)}}),n.set("vShapes",c)},e.prototype.updateParams=function(t){var n=this,i=t.r,a=t.trigger,o=t.minR,s=t.maxR,u=t.scaleRBy,f=t.showLabel,l=t.shouldShow;if(isNaN(t.r)||n.set("r",i),isNaN(s)||n.set("maxR",s),isNaN(o)||n.set("minR",o),(a==="mousemove"||a==="click")&&n.set("trigger",a),u==="wheel"||u==="unset"){n.set("scaleRBy",u),n.get("delegate").remove(),n.get("delegate").destroy();var c=n.get("dPercentText");c&&(c.remove(),c.destroy())}(f==="node"||f==="both")&&n.set("showNodeLabel",!0),(f==="edge"||f==="both")&&n.set("showEdgeLabel",!0),l&&n.set("shouldShow",l)},e.prototype.updateDelegate=function(t,n){var i=this,a=i.get("graph"),o=i.get("delegate");if(!o||o.destroyed){var s=a.get("group"),u=i.get("delegateStyle")||LM;o=s.addShape("circle",{attrs:im({r:n,x:t.x,y:t.y},u),name:"lens-shape",draggable:!0}),this.get("trigger")!=="drag"&&this.get("scaleRBy")==="wheel"&&o.on("mousewheel",function(f){i.scaleRByWheel(f)})}else o.attr({x:t.x,y:t.y,r:n});i.set("delegate",o)},e.prototype.clear=function(){var t=this,n=t.get("vShapes");n&&n.forEach(function(a){a.remove(),a.destroy()}),n=[],t.set("vShapes",n);var i=t.get("delegate");i&&!i.destroyed&&(i.remove(),i.destroy())},e.prototype.destroy=function(){this.clear()},e}(jn),Bde=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Fde=_n.pointLineDistance,Gde={stroke:"#FA8C16",lineWidth:1},zde=function(r){Bde(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{line:Gde,itemAlignType:"center",tolerance:5,horizontalLines:{},verticalLines:{},alignLines:[]}},e.prototype.init=function(){},e.prototype.getEvents=function(){return{"node:dragstart":"onDragStart","node:drag":"onDrag","node:dragend":"onDragEnd"}},e.prototype.onDragStart=function(){this.initBoxLine()},e.prototype.onDrag=function(t){var n=t.item,i=n.get("delegateShape")||n,a=i.getBBox(),o=n.getModel(),s=o.x-a.x,u=o.y-a.y;this.show({x:a.minX+s,y:a.minY+u},{width:a.width,height:a.height})},e.prototype.onDragEnd=function(){this.destory()},e.prototype.initBoxLine=function(){var t=this._cfgs,n=t.horizontalLines,i=t.verticalLines,a=t.itemAlignType,o=this.get("graph"),s=o.getNodes();s.forEach(function(u){var f=u.getBBox(),l=u.get("id");a===!0||a==="horizontal"?(n["".concat(l,"tltr")]=[f.minX,f.minY,f.maxX,f.minY,u],n["".concat(l,"lcrc")]=[f.minX,f.centerY,f.maxX,f.centerY,u],n["".concat(l,"blbr")]=[f.minX,f.maxY,f.maxX,f.maxY,u]):a==="center"&&(n["".concat(l,"lcrc")]=[f.minX,f.centerY,f.maxX,f.centerY,u]),a===!0||a==="vertical"?(i["".concat(l,"tlbl")]=[f.minX,f.minY,f.minX,f.maxY,u],i["".concat(l,"tcbc")]=[f.centerX,f.minY,f.centerX,f.maxY,u],i["".concat(l,"trbr")]=[f.maxX,f.minY,f.maxX,f.maxY,u]):a==="center"&&(i["".concat(l,"tcbc")]=[f.centerX,f.minY,f.centerX,f.maxY,u])})},e.prototype.show=function(t,n){var i=yt({},t);return this.itemAlign(t,n,i),t},e.prototype.itemAlign=function(t,n,i){var a=this,o=this._cfgs,s=o.horizontalLines,u=o.verticalLines,f=o.tolerance,l={x:i.x+n.width/2,y:i.y},c={x:i.x+n.width/2,y:i.y+n.height/2},h={x:i.x+n.width/2,y:i.y+n.height},d={x:i.x,y:i.y+n.height/2},v={x:i.x+n.width,y:i.y+n.height/2},p=[],g=[],y=null;if(this.clearAlignLine(),me(s,function(b){b[4].isVisible&&(p.push(a.getLineDisObject(b,l)),p.push(a.getLineDisObject(b,c)),p.push(a.getLineDisObject(b,h)))}),me(u,function(b){b[4].isVisible&&(g.push(a.getLineDisObject(b,d)),g.push(a.getLineDisObject(b,c)),g.push(a.getLineDisObject(b,v)))}),p.sort(function(b,x){return b.dis-x.dis}),g.sort(function(b,x){return b.dis-x.dis}),p.length!==0&&p[0].dis<f){t.y=p[0].line[1]-p[0].point.y+i.y,y={type:"item",horizontals:[p[0]]};for(var m=1;m<3;m++)p[0].dis===p[m].dis&&y.horizontals.push(p[m])}if(g.length!==0&&g[0].dis<f){t.x=g[0].line[0]-g[0].point.x+i.x,y?y.verticals=[g[0]]:y={type:"item",verticals:[g[0]]};for(var m=1;m<3;m++)g[0].dis===g[m].dis&&y.verticals.push(g[m])}y&&(y.bbox=n,this.addAlignLine(y))},e.prototype.addAlignLine=function(t){var n=t.bbox,i=t.type,a=t.horizontals,o=t.verticals,s=this._cfgs,u=s.line,f=s.alignLines,l=this.get("graph"),c=l.get("group");i==="item"&&(a&&me(a,function(h){var d=h.line,v=h.point,p=(d[0]+d[2])/2,g,y;v.x<p?(g=v.x-n.width/2,y=Math.max(d[0],d[2])):(g=v.x+n.width/2,y=Math.min(d[0],d[2]));var m=yt({x1:g,y1:d[1],x2:y,y2:d[1]},u),b=c.addShape("line",{attrs:m,capture:!1});f.push(b)}),o&&me(o,function(h){var d=h.line,v=h.point,p=(d[1]+d[3])/2,g,y;v.y<p?(g=v.y-n.height/2,y=Math.max(d[1],d[3])):(g=v.y+n.height/2,y=Math.min(d[1],d[3]));var m=yt({x1:d[0],y1:g,x2:d[0],y2:y},u),b=c.addShape("line",{attrs:m,capture:!1});f.push(b)}))},e.prototype.getLineDisObject=function(t,n){return{line:t,point:n,dis:Fde(t,n)}},e.prototype.getContainer=function(){return this.get("container")},e.prototype.clearAlignLine=function(){var t=this._cfgs.alignLines;me(t,function(n){n.remove()}),t.length=0},e.prototype.destory=function(){var t=this._cfgs,n=t.horizontalLines,i=t.verticalLines,a=this.get("graph"),o=a.getNodes();o.forEach(function(s){var u=s.get("id");delete n["".concat(u,"tltr")],delete n["".concat(u,"lcrc")],delete n["".concat(u,"blbr")],delete i["".concat(u,"tlbl")],delete i["".concat(u,"tcbc")],delete i["".concat(u,"trbr")]}),this.clearAlignLine()},e}(jn),$de=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ar=function(){return Ar=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Ar.apply(this,arguments)},jde=["click","mouseenter"],Ude=function(r){$de(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{data:{},position:"top",padding:8,margin:8,offsetX:0,offsetY:0,layout:"horizontal",flipPage:!1,containerStyle:{},align:void 0,horiSep:8,vertiSep:8,filter:{enable:!1,trigger:"click"}}},e.prototype.init=function(){this.formatArray("padding"),this.formatArray("margin");var t=this.get("filter")||{},n=t.multiple;n&&t.trigger==="mouseenter"&&this.set("multiple",!1);var i=this.get("align");if(!i){var a=this.get("position").split("-");a.includes("left")&&(i="left"),a.includes("right")?i="right":i="center",this.set("align",i)}var o=this.get("graph"),s=o.get("container"),u=Er(`<div class='g6-legend-container' style="position: absolute;"></div>`);s.appendChild(u),this.set("container",u);var f=this.render();Xt(u,this.getContainerPos(f)),this.bindEvents()},e.prototype.getContainerPos=function(t){t===void 0&&(t=[0,0]);var n=this,i=n.get("graph"),a=this.get("offsetX"),o=this.get("offsetY"),s=this.get("margin"),u=this.get("position").split("-"),f={top:0,right:1,bottom:2,left:3},l=0,c=0,h={left:(i.getWidth()-t[0])/2+l,top:(i.getHeight()-t[1])/2+c};return u.forEach(function(d){var v=s[f[d]],p=d;switch(d){case"top":v+=c;break;case"left":v+=l;break;case"bottom":v=i.getHeight()-t[1]-v+c,p="top";break;default:v=i.getWidth()-t[0]-v+l,p="left";break}h[p]=v}),h.top+=o+i.getContainer().offsetTop,h.left+=a+i.getContainer().offsetLeft,Object.keys(h).forEach(function(d){h[d]="".concat(h[d],"px")}),h},e.prototype.bindEvents=function(){var t=this,n=t.get("filter");if(!(!n||!n.enable)){var i=n.trigger||"click";jde.includes(i)||(console.warn("Trigger for legend filterling must be 'click' or 'mouseenter', 'click' will take effect by default."),i="click");var a=t.get("legendCanvas");i==="mouseenter"?(a.on("node-container:mouseenter",function(o){return t.filterData(o)}),a.on("node-container:mouseleave",function(o){t.clearFilter(),t.clearActiveLegend()})):(a.on("node-container:click",function(o){return t.filterData(o)}),a.on("click",function(o){o.target&&o.target.isCanvas&&o.target.isCanvas()&&(t.clearFilter(),t.clearActiveLegend())}))}},e.prototype.changeData=function(t){this.set("data",t);var n=this.render();Xt(this.get("container"),this.getContainerPos(n))},e.prototype.activateLegend=function(t){var n=this.get("filter"),i=n==null?void 0:n.multiple;i||this.clearActiveLegend();var a=t.get("parent");a.get("active")?(a.set("active",!1),this.findLegendItemsByState("active").length&&a.set("inactive",!0)):(a.set("inactive",!1),a.set("active",!0)),this.findLegendItemsByState("active").length?this.findLegendItemsByState("active","all",!1).forEach(function(c){c.set("inactive",!0)}):this.clearActiveLegend();var o=(n==null?void 0:n.legendStateStyles)||{},s=(o==null?void 0:o.inactive)||{opacity:.5,"text-shape":{opacity:.5}},u=s["text-shape"]||{};this.findLegendItemsByState("inactive").forEach(function(c){var h=c.get("children"),d=h[0],v=h[1];d.attr(Ar(Ar({},d.get("oriAttrs")),s)),v.attr(Ar(Ar({},v.get("oriAttrs")),u))});var f=(o==null?void 0:o.active)||{stroke:"#000",lineWidth:2,"text-shape":{fontWeight:"bold"}},l=f["text-shape"]||{};this.findLegendItemsByState("active").forEach(function(c){var h=c.get("children"),d=h[0],v=h[1];d.attr(Ar(Ar({},d.get("oriAttrs")),f)),v.attr(Ar(Ar({},v.get("oriAttrs")),l))})},e.prototype.findLegendItemsByState=function(t,n,i){n===void 0&&(n="all"),i===void 0&&(i=!0);var a=this.get("legendCanvas").find(function(u){return u.get("name")==="root"}),o=a.find(function(u){return u.get("name")==="node-group"}),s=a.find(function(u){return u.get("name")==="edge-group"});return n==="node"?o.get("children").filter(function(u){return!!u.get(t)===i}):n==="edge"?s.get("children").filter(function(u){return!!u.get(t)===i}):o.get("children").filter(function(u){return!!u.get(t)===i}).concat(s.get("children").filter(function(u){return!!u.get(t)===i}))},e.prototype.clearActiveLegend=function(){var t=this.get("legendCanvas"),n=t.find(function(a){return a.get("name")==="root"}),i=[n.find(function(a){return a.get("name")==="node-group"}),n.find(function(a){return a.get("name")==="edge-group"})];i.forEach(function(a){a.get("children").forEach(function(o){o.set("active",!1),o.set("inactive",!1);var s=o.get("children"),u=s[0],f=s[1];u.attr(u.get("oriAttrs")),f.attr(f.get("oriAttrs"))})})},e.prototype.filterData=function(t){var n=this.get("filter"),i=n==null?void 0:n.filterFunctions;if(!(!n||!i)){var a=this.get("legendCanvas"),o=this.get("graph"),s=n.graphActiveState||"active",u=n.graphInactiveState||"inactive",f=n.multiple;this.clearFilter(),f||this.clearActiveLegend(),this.activateLegend(t.target);var l=a.find(function(y){return y.get("name")==="root"}),c=l.find(function(y){return y.get("name")==="node-group"}),h=l.find(function(y){return y.get("name")==="edge-group"}),d=c.get("children").filter(function(y){return y.get("active")}),v=h.get("children").filter(function(y){return y.get("active")}),p=0,g=["getNodes","getEdges"];g.forEach(function(y){o[y]().forEach(function(m){var b=!1,x=y==="getNodes"?d:v;x.forEach(function(w){var E=i[w.get("id")];b=b||E(m.getModel())}),b?(o.setItemState(m,u,!1),o.setItemState(m,s,!0),p++):(o.setItemState(m,s,!1),o.setItemState(m,u,!0))})}),p||g.forEach(function(y){o[y]().forEach(function(m){o.clearItemStates(m,[u])})})}},e.prototype.clearFilter=function(){var t=this.get("graph"),n=this.get("filter");if(n){var i=n.graphActiveState||"active",a=n.graphInactiveState||"inactive";t.getNodes().forEach(function(o){t.clearItemStates(o,[i,a])}),t.getEdges().forEach(function(o){t.clearItemStates(o,[i,a])})}},e.prototype.render=function(){var t=this;this.processData();var n=this.get("legendCanvas");n?n.clear():n=new Ra({container:this.get("container"),width:200,height:200});var i=n.addGroup({name:"root"}),a=i.addGroup({name:"node-group"}),o=i.addGroup({name:"edge-group"});this.set("legendCanvas",n);var s=this.get("itemsData"),u=["nodes","edges"],f=[a,o];u.forEach(function(D,$){s[D].forEach(function(Y){var N,P=f[$].addGroup({id:Y.id,name:"node-container"}),W,J=Y.type,te=t.getShapeSize(Y),H=te.width,pe=te.height,Te=te.r,Ne=t.getStyle(D.substr(0,4),Y);switch(Y.type){case"circle":W={r:Te,x:0,y:0};break;case"rect":W={width:H,height:pe,x:-H/2,y:-pe/2};break;case"ellipse":W={rx:H,ry:pe,x:0,y:0},J="ellipse";break;case"line":W={x1:-H/2,y1:0,x2:H/2,y2:0},J="line";break;case"quadratic":W={path:[["M",-H/2,0],["Q",0,H/2,H/2,0]]},J="path";break;case"cubic":W={path:[["M",-H/2,0],["C",-H/6,H/2,H/6,-H/2,H/2,0]]},J="path";break;case"diamond":W={path:[["M",0,-pe],["L",H,0],["L",0,pe],["L",-H,0],["Z"]]},J="path";break;case"triangle":W={path:[["M",-H,pe],["L",0,-pe],["L",H,pe],["Z"]]},J="path";break;case"star":W={path:_n.getStarPath(Te*3,Te*1.2)},J="path";break;default:W={r:Te,x:0,y:0};break}var Ze=P.addShape(J,{attrs:Ar(Ar({},W),Ne),name:"".concat(Y.type,"-node-keyShape"),oriAttrs:Ar({opacity:1},Ne)});if(Y.label){var at=Ze.getBBox(),nt=((N=Y.labelCfg)===null||N===void 0?void 0:N.style)||{},_t=Ar({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},nt);P.addShape("text",{attrs:Ar({x:at.maxX+4,y:0,text:Y.label},_t),className:"legend-label",name:"".concat(Y.type,"-node-text"),oriAttrs:_t})}})});var l=this.get("padding"),c,h=i.find(function(D){return D.get("name")==="title-container"}),d={height:0,maxY:0,width:0};if(this.get("title")){h||(h=i.addGroup({name:"title-container"}));var v={fontSize:20,fontFamily:"Arial",fontWeight:300,textBaseline:"top",textAlign:"center",fill:"#000",x:0,y:l[0]},p=this.get("titleConfig")||{},g=Object.assign(v,p.style||{});c=h.addShape("text",{attrs:Ar({text:this.get("title")},g)}),d=h.getCanvasBBox(),h.setMatrix([1,0,0,0,1,0,p.offsetX,p.offsetY,1])}this.layoutItems();var y=i.getCanvasBBox(),m=a.getCanvasBBox(),b=m.minX<0?Math.abs(m.minX)+l[3]:l[3],x=d.maxY<m.minY?Math.abs(d.maxY-m.minY)+l[0]:d.maxY+l[0],w=[1,0,0,0,1,0,b,x,1];a.setMatrix(w),y=i.getCanvasBBox();var E=[y.minX+y.width+l[1],y.minY+y.height+l[2]];if(c){var p=Ar({position:"center",offsetX:0,offsetY:0},this.get("titleConfig"));d=h.getCanvasBBox();var _=h.getMatrix()||[1,0,0,0,1,0,0,0,1];p.position==="center"?_[6]=E[0]/2+p.offsetX:p.position==="right"?(_[6]=E[0]-l[3]+p.offsetX,c.attr({textAlign:"right"})):(_[6]=l[3]+p.offsetX,c.attr({textAlign:"left"})),h.setMatrix(_),d=h.getCanvasBBox(),b=m.minX<0?Math.abs(m.minX)+l[3]:l[3],x=m.minY<d.maxY?Math.abs(d.maxY-m.minY)+l[0]:d.maxY+l[0],w=[1,0,0,0,1,0,b,x,1],a.setMatrix(w);var M=[1,0,0,0,1,0,b,x,1];this.get("layout")==="vertical"?M[6]+=m.maxX+this.get("horiSep"):M[7]+=m.maxY+this.get("vertiSep"),o.setMatrix(M)}else{m=a.getCanvasBBox();var C=[1,0,0,0,1,0,0,0,1];this.get("layout")==="vertical"?C[6]+=w[6]+m.maxX+this.get("horiSep"):C[7]+=w[7]+m.maxY+this.get("vertiSep"),o.setMatrix(C)}y=i.getCanvasBBox(),m=a.getCanvasBBox(),w=a.getMatrix()||[1,0,0,0,1,0,0,0,1];var S=o.getMatrix()||[1,0,0,0,1,0,0,0,1],A=o.getCanvasBBox();E=[Math.max(m.width+w[6],A.width+S[6])+l[1],Math.max(m.height+w[7],A.height+S[7])+l[2]],n.changeSize(E[0],E[1]);var T=this.get("containerStyle"),k=i.getMatrix()||[1,0,0,0,1,0,0,0,1],O=_n.invertMatrix({x:0,y:0},k),F=i.addShape("rect",{attrs:Ar({x:O.x+(T.lineWidth||1),y:O.y+(T.lineWidth||1),width:E[0]-2*(T.lineWidth||1),height:E[1]-2*(T.lineWidth||1),fill:"#f00",stroke:"#000",lineWidth:1,opacity:.5},T),name:"legend-back-rect",capture:!1});return F.toBack(),E},e.prototype.layoutItems=function(){var t=this.get("legendCanvas"),n=this.get("horiSep"),i=this.get("vertiSep"),a=this.get("layout"),o=this.get("align"),s=[0,0],u=t.find(function(b){return b.get("name")==="root"}),f=u.find(function(b){return b.get("name")==="node-group"}),l=u.find(function(b){return b.get("name")==="edge-group"}),c={min:0,max:-1/0};f.get("children").forEach(function(b,x){x===0&&(c.min=s[0]);var w=b.get("children")[0],E=b.getCanvasBBox(),_=w.getBBox(),M=_.width,C=_.height,S=0,A=0;a==="vertical"?(S=s[1],A=s[0]+M/2,s[0]=A+E.height+i,E.maxX+S+M/2):(S=s[0]+M/2,A=s[1],s[0]=S+E.width+n,E.maxY+A+C/2),s[0]>c.max&&(c.max=s[0]),b.setMatrix([1,0,0,0,1,0,S,A,1])});var h=c.max-c.min,d={min:0,max:-1/0},v=f.getCanvasBBox();s[0]=0,s[1]=a==="vertical"?v.maxX+n:v.maxY+i,l.get("children").forEach(function(b,x){x===0&&(d.min=s[0]);var w=b.get("children")[0],E=b.getCanvasBBox(),_=w.getBBox(),M=_.width,C=_.height,S=0,A=0;a==="vertical"?(S=s[1],A=s[0],s[0]=A+E.height+i,b.setMatrix([1,0,0,0,1,0,0,A+C/2,1])):(S=s[0],A=s[1],s[0]=S+E.width+n,b.setMatrix([1,0,0,0,1,0,S+M/2,0,1])),s[0]>d.max&&(d.max=s[0])});var p=d.max-d.min;if(o&&o!==""&&o!=="left"){var g=h-p,y=o==="center"?Math.abs(g)/2:Math.abs(g),m=g<0?f:l;m.get("children").forEach(function(b){var x=b.getMatrix()||[1,0,0,0,1,0,0,0,1];a==="vertical"?x[7]+=y:x[6]+=y,b.setMatrix(x)})}},e.prototype.processData=function(){var t=this.get("data"),n={nodes:[],edges:[]};t.nodes&&(t.nodes.sort(function(i,a){return i.order-a.order}),t.nodes.forEach(function(i){var a,o,s,u,f,l=i.size||[((a=i.style)===null||a===void 0?void 0:a.width)||((o=i.style)===null||o===void 0?void 0:o.r)||8,((s=i.style)===null||s===void 0?void 0:s.height)||((u=i.style)===null||u===void 0?void 0:u.r)||8],c=((f=i.labelCfg)===null||f===void 0?void 0:f.style)||{};n.nodes.push({id:i.id||da(),type:i.type||"circle",style:Ar({},i.style),order:i.order,label:i.label,itemType:"node",size:l,labelCfg:{position:"right",style:Ar({fontFamily:"Arial"},c)}})})),t.edges&&(t.edges.sort(function(i,a){return i.order-a.order}),t.edges.forEach(function(i){var a,o,s=i.type||"line";i.type==="cubic-horizontal"&&(s="cubic");var u=((a=i.labelCfg)===null||a===void 0?void 0:a.style)||{},f=i.size||[((o=i.style)===null||o===void 0?void 0:o.width)||8,1];n.edges.push({id:i.id||da(),type:s,size:f,style:Ar({lineWidth:pt(f)?f[1]:1},i.style),order:i.order,label:i.label,itemType:"edge",labelCfg:{position:"right",style:Ar({fontFamily:"Arial"},u)}})})),this.set("itemsData",n)},e.prototype.getContainer=function(){return this.get("container")},e.prototype.formatArray=function(t){var n=this.get(t);if(ht(n))this.set(t,[n,n,n,n]);else if(pt(n))switch(n.length){case 0:this.set(t,[0,0,0,0]);break;case 1:this.set(t,[n[0],n[0],n[0],n[0]]);break;case 2:this.set(t,[n[0],n[1],n[0],n[1]]);break;case 3:this.set(t,[n[0],n[1],n[2],n[1]]);break}return this.get(t)},e.prototype.getShapeSize=function(t){var n,i,a;return t.size&&(pt(t.size)?(n=t.size[0],i=t.size[1]||t.size[0],a=t.size[0]/2):ht(t.size)&&(n=t.size,i=t.size,a=t.size/2)),t.style&&(t.style.width&&(n=t.style.width),t.style.height&&(i=t.style.height),t.style.r&&(a=t.style.r)),a||(a=5),n||(n=a),i||(i=a),{width:n,height:i,r:a}},e.prototype.getStyle=function(t,n){var i=t==="node"?{fill:"#ccc",lineWidth:0}:{stroke:"#000",lineWidth:1};return Ar(Ar({},i),n.style||{})},e.prototype.destroy=function(){var t=this.get("legendCanvas");t==null||t.destroy();var n=this.get("graph"),i=n.get("container"),a=this.get("container");i.removeChild(a)},e}(jn),Xde=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),fi=function(){return fi=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},fi.apply(this,arguments)},NM=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};typeof document<"u"&&dp(`
|
|
609
|
-
.g6-annotation-container {
|
|
610
|
-
background-color: rgba(255, 255, 255, 0.3);
|
|
611
|
-
padding: 8px;
|
|
612
|
-
}
|
|
613
|
-
.g6-annotation-wrapper {
|
|
614
|
-
background-color: #fff;
|
|
615
|
-
box-shadow: 0 0 8px rgba(0, 0, 0, 0.85);
|
|
616
|
-
}
|
|
617
|
-
.g6-annotation-header-wapper {
|
|
618
|
-
height: fit-content;
|
|
619
|
-
width: 100%;
|
|
620
|
-
background-color: #5B8FF9;
|
|
621
|
-
display: inline-flex;
|
|
622
|
-
cursor: move;
|
|
623
|
-
}
|
|
624
|
-
.g6-annotation-title {
|
|
625
|
-
margin: 4px 40px 4px 8px;
|
|
626
|
-
cursor: text;
|
|
627
|
-
min-width: 32px;
|
|
628
|
-
}
|
|
629
|
-
.g6-annotation-collapse {
|
|
630
|
-
margin: 4px;
|
|
631
|
-
cursor: pointer;
|
|
632
|
-
}
|
|
633
|
-
.g6-annotation-expand {
|
|
634
|
-
margin: 4px;
|
|
635
|
-
cursor: pointer;
|
|
636
|
-
}
|
|
637
|
-
.g6-annotation-close {
|
|
638
|
-
margin: 4px 8px 4px 0;
|
|
639
|
-
cursor: pointer;
|
|
640
|
-
}
|
|
641
|
-
.g6-annotation-content {
|
|
642
|
-
padding: 8px;
|
|
643
|
-
width: fit-content;
|
|
644
|
-
cursor: text;
|
|
645
|
-
word-break: break-all;
|
|
646
|
-
min-width: 32px;
|
|
647
|
-
}
|
|
648
|
-
.g6-annotation-title-input-wrapper {
|
|
649
|
-
margin: 4px 40px 4px 8px;
|
|
650
|
-
}
|
|
651
|
-
.g6-annotation-content-input {
|
|
652
|
-
height: 100%;
|
|
653
|
-
word-break: break-all;
|
|
654
|
-
}
|
|
655
|
-
.g6-annotation-content-input-wrapper {
|
|
656
|
-
margin: 8px;
|
|
657
|
-
height: 100%;
|
|
658
|
-
}
|
|
659
|
-
`);var OM="canvas-annotation",Yde=function(r){Xde(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{trigger:"click",editable:!0,itemHighlightState:"highlight",linkHighlightStyle:{shadowColor:"#5B8FF9",shadowBlur:10},cardCfg:{minHeight:60,width:"fit-content",height:"fit-content",collapseType:"minimize",closeType:"hide",borderRadius:5,maxTitleLength:20}}},e.prototype.getEvents=function(){var t={viewportchange:"updateLinks",afterlayout:"updateLinks",aftergraphrefreshposition:"updateLinks",afterupdateitem:"updateLink",afterchangedata:"onGraphDataChange",afteritemvisibilitychange:"onGraphItemVisibilityChange"};switch(this.get("trigger")){case"click":t=fi(fi({},t),{"node:click":"showAnnotation","edge:click":"showAnnotation"})}return t},e.prototype.getDOMContent=function(t){if(!this.destroyed){var n=t.collapsed,i=t.maxWidth,a=t.title,o=a===void 0?"":a,s=t.content,u=s===void 0?"":s,f=t.borderRadius,l=f===void 0?5:f,c=n?"<p class='g6-annotation-expand'>+</p>":"<p class='g6-annotation-collapse'>-</p>",h=n?"":" <p class='g6-annotation-content'>".concat(u,"</p>"),d="<p class='g6-annotation-close'>x</p>",v=n?"".concat(l,"px"):"".concat(l,"px ").concat(l,"px 0 0");return'<div class="g6-annotation-wrapper" style="border-radius: '.concat(l,"px; max-width: ").concat(i,`px">
|
|
660
|
-
<div
|
|
661
|
-
class="g6-annotation-header-wapper"
|
|
662
|
-
style="border-radius: `).concat(v,`;"
|
|
663
|
-
>
|
|
664
|
-
<h4 class='g6-annotation-title'>`).concat(o,`</h4>
|
|
665
|
-
`).concat(c,`
|
|
666
|
-
`).concat(d,`
|
|
667
|
-
</div>
|
|
668
|
-
`).concat(h,`
|
|
669
|
-
</div>`)}},e.prototype.init=function(){var t=this;if(!t.destroyed){var n=t.get("graph"),i=n.getContainer(),a=t.get("container"),o=this.get("containerCfg");o?(a=this.createContainer(),i.appendChild(a)):a=i,this.set("container",a);var s=i.getBoundingClientRect(),u=new Ra({container:i,width:s.right-s.left,height:s.bottom-s.top});Xt(u.get("el"),{position:"absolute",top:0,left:0,pointerEvents:"none"}),window.addEventListener("resize",jl(function(){return t.resizeCanvas(t)},100));var f=u.addGroup({id:"annotation-link-group"});t.set("linkGroup",f),t.set("canvas",u),t.get("getTitle")||t.set("getTitle",function(c){var h,d=((h=c==null?void 0:c.getModel)===null||h===void 0?void 0:h.call(c))||{},v=d.label,p=d.id;return v||p||"-"}),t.get("getContent")||t.set("getContent",function(c){var h,d;if(!c)return"-";var v=((h=c.getModel)===null||h===void 0?void 0:h.call(c))||{},p=v.label,g=v.id,y=(d=c.getType)===null||d===void 0?void 0:d.call(c),m=y?"".concat(y,": "):"";return"".concat(m).concat(p||g||"")});var l=t.get("defaultData");l&&this.readData(l)}},e.prototype.createContainer=function(){var t=this;if(!this.destroyed){var n=this.get("containerCfg"),i=this.get("graph"),a=i.getContainer(),o=a.getBoundingClientRect(),s=o.left,u=o.right,f=o.top,l=o.bottom,c=l-f,h=u-s,d=n.position,v=d===void 0?"top":d,p=n.offsetX,g=p===void 0?0:p,y=n.offsetY,m=y===void 0?0:y,b=NM(n,["position","offsetX","offsetY"]),x=n.height,w=x===void 0?"fit-content":x,E=n.width,_=E===void 0?i.getWidth():E;w==="100%"&&(w=c),_==="100%"&&(_=h);var M="unset",C="unset",S={};switch(v){case"right":M="".concat(c,"px"),S={top:0,right:0},S.right+=s+g,S.top+=f+m;break;case"bottom":C="".concat(h,"px"),S={bottom:0,left:0},S.left+=s+g,S.bottom+=f+m;break;case"top":C="".concat(h,"px");case"left":M="".concat(c,"px");default:S={top:0,left:0},S.left+=s+g,S.top+=f+m;break}Object.keys(S).forEach(function(T){S[T]="".concat(S[T],"px")});var A=Er("<div class='".concat(n.className," g6-annotation-container'></div>"));return Xt(A,fi(fi({position:"absolute",display:v==="top"||v==="bottom"?"inline-flex":"unset",width:ht(_)?"".concat(_,"px"):_,height:ht(w)?"".concat(w,"px"):w,maxHeight:M,maxWidth:C,overflow:"scroll"},S),b)),a.appendChild(A),A.addEventListener("scroll",function(T){t.updateLinks()}),A}},e.prototype.resizeCanvas=function(t){clearTimeout(t.resizeTimer),t.resizeTimer=setTimeout(function(){if(!(!t||t.destroyed)){var n=t.get("container").getBoundingClientRect(),i=n.right-n.left,a=n.bottom-n.top;t.get("canvas").changeSize(i,a),t.updateOutsideCards(t)}},250)},e.prototype.updateOutsideCards=function(t){var n=t||this,i=n.get("cardInfoMap")||{},a=n.get("graph"),o=a.getPointByCanvas(0,0),s=a.getPointByCanvas(a.getWidth(),a.getHeight()),u=a.getClientByPoint(o.x,o.y),f=u.x,l=u.y,c=a.getClientByPoint(s.x,s.y),h=c.x,d=c.y;Object.values(i).forEach(function(v){var p=v.card;if(p){var g=p.style,y=as(g.left),m=as(g.top),b=p.getBoundingClientRect(),x=b.width,w=b.height,E=y,_=m;y+x>h-f&&(E=h-f-x),y<0&&(E=0),m+w>d-l&&(_=d-l-w),m<0&&(_=0),Xt(p,{left:"".concat(E,"px"),top:"".concat(_,"px")})}}),n.updateLinks()},e.prototype.showAnnotation=function(t){if(!this.destroyed){var n=t.item;this.toggleAnnotation(n)}},e.prototype.hideCards=function(){var t=this;if(!t.destroyed){var n=t.get("cardInfoMap")||{};Object.keys(n).forEach(function(i){t.hideCard(i)})}},e.prototype.toggleAnnotation=function(t,n){var i,a;n===void 0&&(n={});var o=this;if(!o.destroyed){var s=o.get("cardInfoMap")||{},u=o.get("graph"),f=o.get("container"),l=o.get("containerCfg"),c=Object.assign({},o.get("cardCfg")||{},n),h=c.minHeight,d=c.minWidth,v=c.width,p=c.height,g=c.collapsed,y=g===void 0?!1:g,m=c.x,b=c.y,x=c.title,w=c.content,E=c.maxTitleLength,_=c.defaultBegin,M=NM(c,["minHeight","minWidth","width","height","collapsed","x","y","title","content","maxTitleLength","defaultBegin"]),C=o.get("linkGroup"),S=this.get("rows")||[[]],A=(i=t.isCanvas)===null||i===void 0?void 0:i.call(t),T=A?OM:t.getID(),k=s[T]||{},O=k.card,F=k.link,D=k.x,$=k.y,Y=k.title,N=k.content,P=this.get("getTitle"),W=this.get("getContent"),J=this.get("getContentPlaceholder")||function(){return""},te=this.get("getTitlePlaceHolder")||function(){return""},H=J(t),pe=te(t),Te=Er(this.getDOMContent(fi({itemId:T,collapsed:y,title:((a=Y||x||(P==null?void 0:P(t)))===null||a===void 0?void 0:a.substr(0,E))||pe,content:N||w||(W==null?void 0:W(t))||H},M))),Ne=ht(h)?"".concat(h,"px"):h;Xt(Te,{minHeight:y?"unset":Ne,minWidth:ht(d)?"".concat(d,"px"):d,height:p,width:v});var Ze=!!O;Ze?(F==null||F.remove(!0),f.replaceChild(Te,O)):f.appendChild(Te);var at;if(!l){if(at=f.getBoundingClientRect()||{},m!==void 0&&b!==void 0)D=m,$=b;else if(!Ze&&!A){var nt=at.top,_t=_||{},St=_t.left,fr=_t.right,Ft=fr===void 0?16:fr,Yt=_t.top,dr=Yt===void 0?8:Yt,lr=_t.bottom,jt=Ft,ir=dr;isNaN(St)||(jt=f.scrollWidth-St),isNaN(lr)||(ir=f.scrollHeight-lr);var Hr=ht(d)?d:100;D=f.scrollWidth-Te.scrollWidth-(S.length-1)*Hr-jt;var tt=S[S.length-1],ae=(tt[tt.length-1]||{}).bbox;$=(ae==null?void 0:ae.bottom)-nt||ir}Xt(Te,{position:"absolute",left:"".concat(D,"px"),top:"".concat($,"px"),cusor:l?"unset":"move"})}this.bindListener(Te,T);var L=Te.getBoundingClientRect();if(!A){var Se=w0(t,L,u,this.get("canvas")),Ge=this.get("linkStyle");F=C.addShape("path",{attrs:fi({lineWidth:1,lineDash:[5,5],stroke:"#ccc",path:Se},Ge)})}if(s[T]=fi(fi({},s[T]||{}),{id:T,collapsed:y,card:Te,link:F,x:D,y:$,cardBBox:L,content:N||w,title:Y||x,contentPlaceholder:H,titlePlaceholder:pe,isCanvas:A}),o.set("cardInfoMap",s),l)this.updateCardPositionsInConatainer(),this.updateLinks();else{var ye=!isNaN(m)&&!isNaN(b);if(!Ze&&!A&&!ye){var Ye=at.bottom,We=Ye===void 0?0:Ye,nt=at.top;S[S.length-1].push({id:T,bbox:L}),L.top>We-nt-L.height-16&&S.push([]),this.set("rows",S)}}this.updateCardSize(T);var qe=this.get("onAnnotationChange");qe==null||qe(s[T],Ze?"update":"create")}},e.prototype.updateCardPositionsInConatainer=function(){if(!this.destroyed){var t=this.get("cardInfoMap");if(t){var n=this.get("container"),i=this.get("containerCfg").position,a=n.getBoundingClientRect().width,o=getComputedStyle(n),s=as(o.paddingLeft)+as(o.paddingRight);a-=s,Object.values(t).forEach(function(u){var f=u.card,l=f.getBoundingClientRect().width;switch(i){case"right":Xt(f,{marginLeft:a?"".concat(a-l,"px"):"0px"});break;case"top":case"bottom":Xt(f,{marginLeft:"8px"})}})}}},e.prototype.handleExpandCollapseCard=function(t){if(!this.destroyed){var n=this.get("graph"),i=this.get("cardInfoMap");if(i){var a=i[t].collapsed,o=n.findById(t);if(o){var s=this.get("cardCfg").collapseType;s==="hide"&&!a?this.hideCard(t):this.toggleAnnotation(o,{collapsed:!a}),i[t]=fi(fi({},i[t]),{collapsed:!a})}}}},e.prototype.hideCard=function(t){if(!this.destroyed){var n=this.get("cardInfoMap");if(!(!n||!n[t])){var i=n[t],a=i.card,o=i.link;Xt(a,{display:"none"}),o==null||o.hide();var s=this.get("onAnnotationChange");s(n[t],"hide")}}},e.prototype.removeCard=function(t){if(!this.destroyed){var n=this.get("cardInfoMap");if(n){var i=n[t],a=i.card,o=i.link,s=this.get("container");s.removeChild(a),o==null||o.remove(!0),delete n[t];var u=this.get("onAnnotationChange");u(i,"remove")}}},e.prototype.bindListener=function(t,n){var i=this;if(!this.destroyed){t.addEventListener("mousemove",function(u){var f;if(u.target.className==="g6-annotation-collapse"?f="collapse":u.target.className==="g6-annotation-expand"?f="expand":u.target.className==="g6-annotation-close"&&(f="close"),f){var l=i.get("cardCfg").onMouseEnterIcon,c=l===void 0?function(){}:l;c(u,n,f)}}),t.addEventListener("mouseout",function(u){var f;if(u.target.className==="g6-annotation-collapse"?f="collapse":u.target.className==="g6-annotation-expand"?f="expand":u.target.className==="g6-annotation-close"&&(f="close"),f){var l=i.get("cardCfg").onMouseLeaveIcon,c=l===void 0?function(){}:l;c(u,n,f)}}),t.addEventListener("mouseenter",function(u){var f=i.get("cardInfoMap");if(f){var l=i.get("graph"),c=l.findById(n);if(c){var h=i.get("itemHighlightState");l.setItemState(c,h,!0)}var d=f[n].link;if(d){var v=i.get("linkHighlightStyle")||{};d.attr(v)}}}),t.addEventListener("mouseleave",function(u){var f=i.get("cardInfoMap");if(f){var l=i.get("graph"),c=l.findById(n);if(c){var h=i.get("itemHighlightState");l.setItemState(c,h,!1)}var d=f[n].link;if(d){var v=i.get("linkHighlightStyle")||{};Object.keys(v).forEach(function(g){d.attr(g,void 0),d.attr(g,void 0)});var p=i.get("linkStyle");d.attr(p)}}}),t.addEventListener("click",function(u){var f=(i.get("cardCfg")||{}).onClickIcon;if(u.target.className==="g6-annotation-collapse"||u.target.className==="g6-annotation-expand"){var l=i.get("cardCfg").collapseType;l==="hide"?i.hideCard(n):i.handleExpandCollapseCard(n),f==null||f(u,n,u.target.className==="g6-annotation-collapse"?"collapse":"expand")}else if(u.target.className==="g6-annotation-close"){var c=i.get("cardCfg").closeType;c==="remove"?i.removeCard(n):i.hideCard(n),f==null||f(u,n,"close")}});var a=this.get("editable");a&&t.addEventListener("dblclick",function(u){var f=i.get("cardInfoMap"),l=(i.get("cardCfg")||{}).maxTitleLength,c=l===void 0?20:l;if(f){var h=u.target,d=h.className;if(!(d!=="g6-annotation-title"&&d!=="g6-annotation-content")){var v=d==="g6-annotation-title"?h.getBoundingClientRect():h.parentNode.getBoundingClientRect(),p=v.width,g=v.height,y=getComputedStyle(h),m=d==="g6-annotation-title"?"input":"textarea",b=Er("<".concat(m,' class="').concat(d,'-input" type="textarea" style="width:').concat(p,"px; height: ").concat(g,'px; min-width: 16px;"/>')),x=Er('<div class="'.concat(d,'-input-wrapper" style="width: ').concat(p,"px; height: ").concat(g,"px; min-width: 16px; margin-right: ").concat(y.marginRight,'" />'));x.appendChild(b),h.parentNode.replaceChild(x,h);var w=f[n],E=w.contentPlaceholder,_=w.titlePlaceholder,M=w.content,C=w.title,S=M;d==="g6-annotation-title"?(b.name="title",b.maxLength=c,S=C):b.name="content",S?(b.innerHTML=h.innerHTML,b.value=h.innerHTML):b.placeholder=d==="g6-annotation-title"?_:E,b.focus(),b.addEventListener("blur",function(A){b.value&&(h.innerHTML=b.value,w[b.name||"title"]=b.value),x.parentNode.replaceChild(h,x),i.updateCardSize(n);var T=i.get("onAnnotationChange");T==null||T(w,"update")})}}});var o=["g6-annotation-title","g6-annotation-content","g6-annotation-title-input","g6-annotation-content-input"];t.draggable=!0,t.addEventListener("dragstart",function(u){var f=u.target.className;if(!o.includes(f)){var l=t.style;i.set("dragging",{card:t,x:u.clientX,y:u.clientY,left:as(l.left),top:as(l.top)})}}),t.addEventListener("drag",function(u){u.preventDefault();var f=i.get("cardInfoMap");if(f){var l=u.clientX,c=u.clientY,h=i.get("dragging");if(!(isNaN(l)||isNaN(c)||!h)){var d=h.x,v=h.y,p=h.left,g=h.top,y=h.card,m=l-d,b=c-v;p+=m,g+=b;var x=i.get("graph"),w=x.getPointByCanvas(0,0),E=x.getPointByCanvas(x.getWidth(),x.getHeight()),_=x.getClientByPoint(w.x,w.y),M=_.x,C=_.y,S=x.getClientByPoint(E.x,E.y),A=S.x,T=S.y,k=y.getBoundingClientRect(),O=k.right-k.left,F=k.bottom-k.top;(p>A-M-O&&m>0||p<0&&m<0)&&(p-=m),(g>T-C-F&&b>0||g<0&&b<0)&&(g-=b),Xt(y,{left:"".concat(p,"px"),top:"".concat(g,"px"),visibility:"hidden"}),d=l,v=c;var D=(f[n]||{}).link;if(D){var $=x.findById(n);D.attr("path",w0($,k,x,i.get("canvas")))}i.set("dragging",{x:d,y:v,left:p,top:g,card:y})}}});var s=function(f){var l=i.get("cardInfoMap");if(l){var c=i.get("dragging");if(c){var h=c.left,d=c.top,v=c.card;l[n].x=h,l[n].y=d,Xt(v,{visibility:"visible"}),i.set("dragging",!1);var p=i.get("rows");p==null||p.forEach(function(y){for(var m=y.length-1;m>=0;m--)y[m].id===n&&y.splice(m,1)});var g=i.get("onAnnotationChange");g==null||g(l[n],"update")}}};t.addEventListener("dragend",s)}},e.prototype.updateCardSize=function(t){var n=this.get("cardInfoMap");if(n){var i=n[t].card,a=i.getBoundingClientRect().width,o=i.getElementsByClassName("g6-annotation-title")[0];if(o){var s=getComputedStyle(o),u=as(s.marginLeft),f=o.getBoundingClientRect().width;Xt(o,{marginRight:"".concat(a-u-24-16-f,"px")})}}},e.prototype.updateLink=function(t){var n=t.item;if(n){var i=this.get("cardInfoMap");if(i){var a=this.get("canvas"),o=this.get("graph"),s=n.getID(),u=i[s]||{},f=u.link,l=u.card;if(f){var c=w0(n,l.getBoundingClientRect(),o,a);f.attr("path",c)}}}},e.prototype.updateLinks=function(){var t=this;if(!this.destroyed){var n=this.get("cardInfoMap");if(n){var i=this.get("graph");Object.values(n).forEach(function(a){var o=a.id,s=i.findById(o);t.updateLink({item:s})})}}},e.prototype.onGraphDataChange=function(){var t=this,n=this.get("cardInfoMap");if(n){var i=this.get("graph");Object.values(n).forEach(function(a){var o=a.id,s=a.card,u=a.isCanvas;if(!(!s||u||s.style.display==="none")){var f=i.findById(o);f&&f.isVisible()?t.toggleAnnotation(f):t.hideCard(o)}})}},e.prototype.onGraphItemVisibilityChange=function(t){var n=t.item,i=t.visible;if(!(!n||n.destroyed)){var a=this.get("cardInfoMap");if(a){var o=n.getID();a[o]&&(i||this.hideCard(o))}}},e.prototype.saveData=function(t){t===void 0&&(t=!1);var n=this.get("cardInfoMap");if(n){var i=this.get("graph"),a=this.get("getTitle"),o=this.get("getContent"),s=[];return Object.values(n).forEach(function(u){var f=u.title,l=u.content,c=u.x,h=u.y,d=u.id,v=u.collapsed,p=u.card;if(!(p&&p.style.display==="none"&&!t)){var g=i.findById(d)||i.get("canvas");s.push({id:d,x:c,y:h,collapsed:v,title:f||(a==null?void 0:a(g)),content:l||(o==null?void 0:o(g)),visible:p&&p.style.display!=="none"})}}),s}},e.prototype.readData=function(t){var n=this,i=this.get("graph");t.forEach(function(a){var o=a.id,s=a.x,u=a.y,f=a.title,l=a.content,c=a.collapsed,h=a.visible,d=i.findById(o);if(!d&&o===OM&&(d=i.get("canvas")),!d){var v=n.get("cardInfoMap")||{};v[o]=a,n.set("cardInfoMap",v);return}n.toggleAnnotation(d,{x:s,y:u,title:f,content:l,collapsed:c}),h||n.hideCard(o)})},e.prototype.clear=function(){var t=this.get("cardInfoMap");if(t){var n=this.get("container");Object.values(t).forEach(function(i){var a=i.card,o=i.link;n.removeChild(a),o==null||o.remove(!0)}),this.set("cardInfoMap",{})}},e.prototype.destroy=function(){var t;this.clear(),(t=this.get("canvas"))===null||t===void 0||t.destroy();var n=this.get("graph");!n||n.destroyed||(this.get("containerCfg")&&n.getContainer().removeChild(this.get("container")),this.destroyed=!0)},e}(jn),Wde=function(e,t){var n,i,a=1/0;Object.keys(e).forEach(function(u){var f=e[u];Object.keys(t).forEach(function(l){var c=t[l],h=f.x-c.x,d=f.y-c.y,v=h*h+d*d;a>v&&(a=v,n=f,i=c)})});var o=20,s=_n.getControlPoint(n,i,.5,o);return[["M",n.x,n.y],["Q",s.x,s.y,i.x,i.y]]},w0=function(e,t,n,i){var a,o,s=e.getType();if(s==="edge")o=[e.getKeyShape().getPoint(.5)];else{var u=(a=e.getKeyShape)===null||a===void 0?void 0:a.call(e).getBBox(),f=u.minX,l=u.minY,c=u.maxX,h=u.maxY,d=e.getModel(),v=d.x,p=d.y;f+=v,l+=p,c+=v,h+=p,o={left:{x:f,y:(l+h)/2},right:{x:c,y:(l+h)/2},top:{x:(f+c)/2,y:l},bottom:{x:(f+c)/2,y:h}}}Object.keys(o).forEach(function(C){var S=o[C],A=S.x,T=S.y,k=n.getClientByPoint(A,T);o[C]=i.getPointByClient(k.x,k.y)});var g=t.top,y=g===void 0?0:g,m=t.left,b=m===void 0?0:m,x=t.right,w=x===void 0?0:x,E=t.bottom,_=E===void 0?0:E,M={left:i.getPointByClient(b,(y+_)/2),right:i.getPointByClient(w,(y+_)/2),top:i.getPointByClient((b+w)/2,y),bottom:i.getPointByClient((b+w)/2,_)};return Wde(o,M)},as=function(e){return Number(e.replace(/\s+|px/gi,""))||0},Hn={PluginBase:jn,Menu:Dce,Grid:Ice,Minimap:zce,Bundling:Uce,ToolBar:Hce,Tooltip:Zce,Fisheye:Yce,TimeBar:Ide,ImageMinimap:Ode,EdgeFilterLens:Rde,SnapLine:zde,Legend:Ude,Annotation:Yde};Xa("circle",{options:{size:Qe.defaultNode.size,style:{x:0,y:0,stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:B({},Qe.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=yr({},i,e.icon),s="".concat(this.type,"-keyShape"),u=t.addShape("circle",{attrs:a,className:s,name:s,draggable:!0});t.shapeMap[s]=u;var f=o.width,l=o.height,c=o.show,h=o.text;if(c){var d="".concat(this.type,"-icon");h?t.shapeMap[d]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:d,name:d,draggable:!0}):t.shapeMap[d]=t.addShape("image",{attrs:B({x:-f/2,y:-l/2},o),className:d,name:d,draggable:!0})}return this.drawLinkPoints(e,t),u},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints;if(n){var i=n||{},a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=nn(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0]/2;if(o){var v="link-point-left";t.shapeMap[v]=t.addShape("circle",{attrs:B(B({},c),{x:-d,y:0,r:f/2||l||5}),className:v,name:v,isAnchorPoint:!0})}if(s){var p="link-point-right";t.shapeMap[p]=t.addShape("circle",{attrs:B(B({},c),{x:d,y:0,r:f/2||l||5}),className:p,name:p,isAnchorPoint:!0})}if(a){var g="link-point-top";t.shapeMap[g]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-d,r:f/2||l||5}),className:g,name:g,isAnchorPoint:!0})}if(u){var y="link-point-bottom";t.shapeMap[y]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:d,r:f/2||l||5}),className:y,name:y,isAnchorPoint:!0})}}},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=yr({},t,n),a=this.getSize(e),o=a[0]/2,s=B({x:0,y:0,r:o},i);return s},update:function(e,t,n){var i=t.getContainer(),a=this.getSize(e),o=B({},e.style);e.style.stroke===void 0&&e.color&&(o.stroke=e.color),e.style.r===void 0&&!isNaN(a[0])&&(o.r=a[0]/2),this.updateShape(e,t,o,!0,n),this.updateLinkPoints(e,i)}},"single-node");Xa("rect",{options:{size:[100,30],style:{radius:0,stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:B({},Qe.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return t.shapeMap["".concat(this.type,"-keyShape")]=i,this.drawLinkPoints(e,t),i},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=nn(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=yt({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=B({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getSize(e),s=t.get("keyShape");e.size||(o[0]=s.attr("width")||a.width,o[1]=s.attr("height")||a.height);var u={stroke:e.color,x:-o[0]/2,y:-o[1]/2,width:o[0],height:o[1]},f=yt({},a,s.attr(),u);f=yt(f,e.style),this.updateShape(e,t,f,!1,n),this.updateLinkPoints(e,i)}},"single-node");Xa("ellipse",{options:{size:[80,40],style:{x:0,y:0,stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:B({},Qe.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=t.addShape("ellipse",{attrs:a,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});t.shapeMap["ellipse-keyShape"]=o;var s=i.width,u=i.height,f=i.show,l=i.text;return f&&(l?t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({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}):t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,t),o},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=nn(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0]/2,v=h[1]/2;o&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},c),{x:-d,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},c),{x:d,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-v,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:v,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=yt({},t,n),a=this.getSize(e),o=a[0]/2,s=a[1]/2,u=B({x:0,y:0,rx:o,ry:s},i);return u},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getSize(e),s={stroke:e.color,rx:o[0]/2,ry:o[1]/2},u=t.get("keyShape"),f=yt({},a,u.attr(),s);f=yt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)}},"single-node");Xa("diamond",{options:{size:[80,80],style:{stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:B({},Qe.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=t.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});t.shapeMap["".concat(this.type,"-keyShape")]=o;var s=i.width,u=i.height,f=i.show,l=i.text;return f&&(l?t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({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}):t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,t),o},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=nn(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getPath:function(e){var t=this.getSize(e),n=t[0],i=t[1],a=[["M",0,-i/2],["L",n/2,0],["L",0,i/2],["L",-n/2,0],["Z"]];return a},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=yt({},t,n),a=this.getPath(e),o=B({path:a},i);return o},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=t.get("keyShape"),f=yt({},a,u.attr(),s);f=yt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)}},"single-node");Xa("triangle",{options:{size:40,direction:"up",style:{stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize},offset:15},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:B({},Qe.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(e,t){var n=this.mergeStyle||this.getOptions(e),i=n.icon,a=i===void 0?{}:i,o=n.direction,s=this.getShapeStyle(e),u=e.direction||o,f=t.addShape("path",{attrs:s,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});t.shapeMap["".concat(this.type,"-keyShape")]=f;var l=a.width,c=a.height,h=a.show,d=a.offset,v=a.text;if(h)if(v)t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0});else{var p=-l/2,g=-c/2;(u==="up"||u==="down")&&(g+=d),(u==="left"||u==="right")&&(p+=d),t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:p,y:g},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(e,t),f},drawLinkPoints:function(e,t){var n=this.mergeStyle||this.getOptions(e),i=n.linkPoints,a=i===void 0?{}:i,o=n.direction,s=e.direction||o,u=a.top,f=a.left,l=a.right,c=a.bottom,h=a.size,d=a.r,v=nn(a,["top","left","right","bottom","size","r"]),p=this.getSize(e),g=p[0];if(f){var y=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?y=[-b,m]:s==="down"?y=[-b,-m]:s==="left"&&(y=[-b,b-m]),y&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},v),{x:y[0],y:y[1],r:h/2||d||5}),className:"link-point-left",name:"link-point-left"}))}if(l){var x=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?x=[b,m]:s==="down"?x=[b,-m]:s==="right"&&(x=[b,b-m]),x&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},v),{x:x[0],y:x[1],r:h/2||d||5}),className:"link-point-right",name:"link-point-right"}))}if(u){var w=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?w=[b-m,-m]:s==="left"?w=[b,-m]:s==="right"&&(w=[-b,-m]),w&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},v),{x:w[0],y:w[1],r:h/2||d||5}),className:"link-point-top",name:"link-point-top"}))}if(c){var E=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="down"?E=[-b+m,m]:s==="left"?E=[b,m]:s==="right"&&(E=[-b,m]),E&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},v),{x:E[0],y:E[1],r:h/2||d||5}),className:"link-point-bottom",name:"link-point-bottom"}))}},getPath:function(e){var t=(this.mergeStyle||this.getOptions(e)).direction,n=e.direction||t,i=this.getSize(e),a=i[0],o=a*Math.sin(1/3*Math.PI),s=a*Math.sin(1/3*Math.PI),u=[["M",-s,o],["L",0,-o],["L",s,o],["Z"]];return n==="down"?u=[["M",-s,-o],["L",s,-o],["L",0,o],["Z"]]:n==="left"?u=[["M",-s,s-o],["L",s,-s],["L",s,s],["Z"]]:n==="right"&&(u=[["M",s,s-o],["L",-s,s],["L",-s,-s],["Z"]]),u},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=yt({},t,n),a=this.getPath(e),o=B({path:a},i);return o},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=t.get("keyShape"),f=yt({},a,u.attr(),s);f=yt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)},updateLinkPoints:function(e,t){var n=this.getOptions({}),i=n.linkPoints,a=n.direction,o=e.direction||a,s=t.shapeMap["link-point-left"]||t.find(function(D){return D.get("className")==="link-point-left"}),u=t.shapeMap["link-point-right"]||t.find(function(D){return D.get("className")==="link-point-right"}),f=t.shapeMap["link-point-top"]||t.find(function(D){return D.get("className")==="link-point-top"}),l=t.shapeMap["link-point-bottom"]||t.find(function(D){return D.get("className")==="link-point-bottom"}),c=i,h=s||u||f||l;h&&(c=h.attr());var d=yt({},c,e.linkPoints),v=d.fill,p=d.stroke,g=d.lineWidth,y=d.size/2;y||(y=d.r);var m=e.linkPoints?e.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},b=m.left,x=m.right,w=m.top,E=m.bottom,_=this.getSize(e),M=_[0],C={r:y,fill:v,stroke:p,lineWidth:g},S=null,A=M*Math.sin(1/3*Math.PI),T=M*Math.sin(1/3*Math.PI);o==="up"?S=[-T,A]:o==="down"?S=[-T,-A]:o==="left"&&(S=[-T,T-A]),S&&(s?!b&&b!==void 0?(s.remove(),delete t.shapeMap["link-point-left"]):s.attr(B(B({},C),{x:S[0],y:S[1]})):b&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},C),{x:S[0],y:S[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var k=null;o==="up"?k=[T,A]:o==="down"?k=[T,-A]:o==="right"&&(k=[T,T-A]),k&&(u?!x&&x!==void 0?(u.remove(),delete t.shapeMap["link-point-right"]):u.attr(B(B({},C),{x:k[0],y:k[1]})):x&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},C),{x:k[0],y:k[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var O=null;o==="up"?O=[T-A,-A]:o==="left"?O=[T,-A]:o==="right"&&(O=[-T,-A]),O&&(f?!w&&w!==void 0?(f.remove(),delete t.shapeMap["link-point-top"]):f.attr(B(B({},C),{x:O[0],y:O[1]})):w&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},C),{x:O[0],y:O[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var F=null;o==="down"?F=[-T+A,A]:o==="left"?F=[T,A]:o==="right"&&(F=[-T,A]),F&&(l?!E&&E!==void 0?(l.remove(),delete t.shapeMap["link-point-bottom"]):l.attr(B(B({},C),{x:F[0],y:F[1]})):E&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},C),{x:F[0],y:F[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node");Xa("modelRect",{options:{size:[185,70],style:{radius:5,stroke:"#69c0ff",fill:"#ffffff",lineWidth:Qe.defaultNode.style.lineWidth,fillOpacity:1},labelCfg:{style:{fill:"#595959",fontSize:14,fontFamily:Qe.windowFontFamily},offset:30},descriptionCfg:{style:{fontSize:12,fill:"#bfbfbf",fontFamily:Qe.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(e,t){var n=(this.mergeStyle||this.getOptions(e)).preRect,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=this.getSize(e),s=o[0],u=o[1],f=t.addShape("rect",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});t.shapeMap["".concat(this.type,"-keyShape")]=f;var l=i.show,c=nn(i,["show"]);return l&&(t.shapeMap["pre-rect"]=t.addShape("rect",{attrs:B({x:-s/2,y:-u/2,height:u},c),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(e,t),this.drawStateIcon(e,t),this.drawLinkPoints(e,t),f},drawLogoIcon:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).logoIcon,i=n===void 0?{}:n,a=this.getSize(e),o=a[0];if(i.show){var s=i.width,u=i.height,f=i.x,l=i.y,c=i.offset,h=i.text,d=nn(i,["width","height","x","y","offset","text"]);h?t.shapeMap["rect-logo-icon"]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},d),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0}):t.shapeMap["rect-logo-icon"]=t.addShape("image",{attrs:B(B({},d),{x:f||-o/2+s+c,y:l||-u/2,width:s,height:u}),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0})}},drawStateIcon:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).stateIcon,i=n===void 0?{}:n,a=this.getSize(e),o=a[0];if(i.show){var s=i.width,u=i.height,f=i.x,l=i.y,c=i.offset,h=i.text,d=nn(i,["width","height","x","y","offset","text"]);h?t.shapeMap["rect-state-icon"]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},d),className:"rect-state-icon",name:"rect-state-icon",draggable:!0}):t.shapeMap["rect-state-icon"]=t.addShape("image",{attrs:B(B({},d),{x:f||o/2-s+c,y:l||-u/2,width:s,height:u}),className:"rect-state-icon",name:"rect-state-icon",draggable:!0})}},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=nn(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(e,t){var n=this.getOptions(e),i=n.labelCfg,a=i===void 0?{}:i,o=n.logoIcon,s=o===void 0?{}:o,u=n.descriptionCfg,f=u===void 0?{}:u,l=this.getSize(e),c=l[0],h=null,d=s.show,v=s.width,p=-c/2+a.offset;d&&(p=-c/2+v+a.offset);var g=a.style,y=f.style,m=f.paddingTop;return Pe(e.description)?(h=t.addShape("text",{attrs:B(B({},g),{x:p,y:-5,text:e.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),t.shapeMap["text-shape"]=h,t.shapeMap["rect-description"]=t.addShape("text",{attrs:B(B({},y),{x:p,y:17+(m||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(h=t.addShape("text",{attrs:B(B({},g),{x:p,y:7,text:e.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),t.shapeMap["text-shape"]=h),h},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=yt({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=B({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(e,t){var n=this.mergeStyle||this.getOptions(e),i=n.style,a=i===void 0?{}:i,o=n.labelCfg,s=o===void 0?{}:o,u=n.descriptionCfg,f=u===void 0?{}:u,l=this.getSize(e),c=l[0],h=l[1],d=t.get("keyShape");d.attr(B(B({},a),{x:-c/2,y:-h/2,width:c,height:h}));var v=t.getContainer(),p=v.shapeMap["rect-logo-icon"]||v.find(function(Te){return Te.get("className")==="rect-logo-icon"}),g=p?p.attr():{},y=yt({},g,e.logoIcon),m=y.width;m===void 0&&(m=this.options.logoIcon.width);var b=e.logoIcon?e.logoIcon.show:void 0,x=s.offset,w=-c/2+m+x;!b&&b!==void 0&&(w=-c/2+x);var E=v.shapeMap["node-label"]||v.find(function(Te){return Te.get("className")==="node-label"}),_=v.shapeMap["rect-description"]||v.find(function(Te){return Te.get("className")==="rect-description"});if(e.label)if(!E)v.shapeMap["node-label"]=v.addShape("text",{attrs:B(B({},s.style),{x:w,y:e.description?-5:7,text:e.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});else{var M=e.labelCfg?e.labelCfg.style:{},C=yt({},E.attr(),M);e.label&&(C.text=e.label),C.x=w,Pe(e.description)&&(C.y=-5),_&&(_.resetMatrix(),_.attr({x:w})),E.resetMatrix(),E.attr(C)}if(Pe(e.description)){var S=f.paddingTop;if(!_)v.shapeMap["rect-description"]=v.addShape("text",{attrs:B(B({},f.style),{x:w,y:17+(S||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0});else{var M=e.descriptionCfg?e.descriptionCfg.style:{},A=yt({},_.attr(),M);Pe(e.description)&&(A.text=e.description),A.x=w,_.resetMatrix(),_.attr(B(B({},A),{y:17+(S||0)}))}}var T=v.shapeMap["pre-rect"]||v.find(function(Te){return Te.get("className")==="pre-rect"});if(T&&!T.destroyed){var k=yt({},T.attr(),e.preRect);T.attr(B(B({},k),{x:-c/2,y:-h/2,height:h}))}if(p&&!p.destroyed)if(!b&&b!==void 0)p.remove(),delete v.shapeMap["pre-rect"];else{var O=y.width,F=y.height,D=y.x,$=y.y,Y=y.offset,N=nn(y,["width","height","x","y","offset"]);p.attr(B(B({},N),{x:D||-c/2+O+Y,y:$||-F/2,width:O,height:F}))}else b&&this.drawLogoIcon(e,v);var P=v.shapeMap["rect-state-icon"]||v.find(function(Te){return Te.get("className")==="rect-state-icon"}),W=P?P.attr():{},J=yt({},W,e.stateIcon);if(P){!J.show&&J.show!==void 0&&(P.remove(),delete v.shapeMap["rect-state-icon"]);var te=J.width,F=J.height,D=J.x,$=J.y,H=J.offset,pe=nn(J,["width","height","x","y","offset"]);P.attr(B(B({},pe),{x:D||c/2-te+H,y:$||-F/2,width:te,height:F}))}else J.show&&this.drawStateIcon(e,v);this.updateLinkPoints(e,v)},getOptions:function(e,t){return t==="move"?e:yr({},this.options,this.getCustomConfig(e)||{},e)}},"single-node");Xa("star",{options:{size:60,style:{stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:B({},Qe.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=t.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});t.shapeMap["".concat(this.type,"-keyShape")]=o;var s=i.width,u=i.height,f=i.show,l=i.text;return f&&(l?t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({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}):t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,t),o},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.leftBottom,f=i.rightBottom,l=i.size,c=i.r,h=nn(i,["top","left","right","leftBottom","rightBottom","size","r"]),d=this.getSize(e),v=d[0];if(s){var p=Math.cos(.1*Math.PI)*v,g=Math.sin((18+72*0)/180*Math.PI)*v;t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-right",name:"link-point-right"})}if(a){var p=Math.cos(.5*Math.PI)*v,g=Math.sin((18+72*1)/180*Math.PI)*v;t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-top",name:"link-point-top"})}if(o){var p=Math.cos(.9*Math.PI)*v,g=Math.sin((18+72*2)/180*Math.PI)*v;t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-left",name:"link-point-left"})}if(u){var p=Math.cos(1.3*Math.PI)*v,g=Math.sin((18+72*3)/180*Math.PI)*v;t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-left-bottom",name:"link-point-left-bottom"})}if(f){var p=Math.cos(1.7*Math.PI)*v,g=Math.sin((18+72*4)/180*Math.PI)*v;t.shapeMap["link-point-right-bottom"]=t.addShape("circle",{attrs:B(B({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(e){var t=this.getSize(e),n=t[0],i=n*3/8,a=e.innerR||i;return _n.getStarPath(n,a)},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=yt({},t,n),a=this.getPath(e),o=B({path:a},i);return o},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=t.get("keyShape"),f=yt({},a,u.attr(),s);f=yt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)},updateLinkPoints:function(e,t){var n=this.getOptions({}).linkPoints,i=t.shapeMap["link-point-left"]||t.find(function(A){return A.get("className")==="link-point-left"}),a=t.shapeMap["link-point-right"]||t.find(function(A){return A.get("className")==="link-point-right"}),o=t.shapeMap["link-point-top"]||t.find(function(A){return A.get("className")==="link-point-top"}),s=t.shapeMap["link-point-left-bottom"]||t.find(function(A){return A.get("className")==="link-point-left-bottom"}),u=t.shapeMap["link-point-left-bottom"]||t.find(function(A){return A.get("className")==="link-point-right-bottom"}),f=n,l=i||a||o||s||u;l&&(f=l.attr());var c=yt({},f,e.linkPoints),h=c.fill,d=c.stroke,v=c.lineWidth,p=c.size/2;p||(p=c.r);var g=e.linkPoints?e.linkPoints:{left:void 0,right:void 0,top:void 0,leftBottom:void 0,rightBottom:void 0},y=g.left,m=g.right,b=g.top,x=g.leftBottom,w=g.rightBottom,E=this.getSize(e),_=E[0],M={r:p,fill:h,stroke:d,lineWidth:v},C=Math.cos((18+72*0)/180*Math.PI)*_,S=Math.sin((18+72*0)/180*Math.PI)*_;a?!m&&m!==void 0?(a.remove(),delete t.shapeMap["link-point-right"]):a.attr(B(B({},M),{x:C,y:-S})):m&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),C=Math.cos((18+72*1)/180*Math.PI)*_,S=Math.sin((18+72*1)/180*Math.PI)*_,o?!b&&b!==void 0?(o.remove(),delete t.shapeMap["link-point-top"]):o.attr(B(B({},M),{x:C,y:-S})):b&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),C=Math.cos((18+72*2)/180*Math.PI)*_,S=Math.sin((18+72*2)/180*Math.PI)*_,i?!y&&y!==void 0?(i.remove(),delete t.shapeMap["link-point-left"]):i.attr(B(B({},M),{x:C,y:-S})):y&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),C=Math.cos((18+72*3)/180*Math.PI)*_,S=Math.sin((18+72*3)/180*Math.PI)*_,s?!x&&x!==void 0?(s.remove(),delete t.shapeMap["link-point-left-bottom"]):s.attr(B(B({},M),{x:C,y:-S})):x&&(t.shapeMap["link-point-left-bottom"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),C=Math.cos((18+72*4)/180*Math.PI)*_,S=Math.sin((18+72*4)/180*Math.PI)*_,u?!w&&w!==void 0?(u.remove(),delete t.shapeMap["link-point-right-bottom"]):u.attr(B(B({},M),{x:C,y:-S})):w&&(t.shapeMap["link-point-right-bottom"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var DM=_n.defaultSubjectColors,pl="fan-shape-";Xa("donut",{options:{size:Qe.defaultNode.size,style:{x:0,y:0,stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:B({},Qe.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=yr({},i,e.icon),s=t.addShape("circle",{attrs:a,className:"".concat(this.type,"-keyShape"),draggable:!0,name:"".concat(this.type,"-keyShape")});t.shapeMap["".concat(this.type,"-keyShape")]=s;var u=o.width,f=o.height,l=o.show,c=o.text;return l&&(c?t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({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}):t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:-u/2,y:-f/2},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),Vde(e,t,s),this.drawLinkPoints(e,t),s},updateShape:function(e,t,n,i,a){var o=t.get("keyShape");o.attr(B({},n)),Hde(e,t,o),this.updateLabel(e,t,a),i&&this.updateIcon(e,t)}},"circle");var Vde=function(e,t,n){var i=e.donutAttrs,a=i===void 0?{}:i,o=e.donutColorMap,s=o===void 0?{}:o,u=Object.keys(a).length;if(a&&u>1){var f=OD(a,s),l=f.configs,c=f.totalValue;if(c){var h=DD(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0;if(u===1){am(t,{arcR:v,arcBegin:p,beginAngle:g,config:l[0],fanIndex:0,lineWidth:d,totalValue:c,drawWhole:!0});return}for(var y=0;y<l.length;y++){var m=am(t,{arcR:v,arcBegin:p,beginAngle:g,config:l[y],fanIndex:y,lineWidth:d,totalValue:c});if(m.shouldEnd)return;p=m.arcBegin,g=m.beginAngle}}}},am=function(e,t){var n=t.arcR,i=t.arcBegin,a=t.beginAngle,o=t.config,s=t.fanIndex,u=t.lineWidth,f=t.totalValue,l=t.drawWhole,c=l===void 0?!1:l,h=t.updateShape,d=h===void 0?void 0:h,v=o.value/f;if(v<.001)return{beginAngle:a,arcBegin:i,shape:void 0,shouldEnd:!1};var p,g,y;if(c||v>.999)p=[n,1e-4],y=1;else{var m=v*Math.PI*2;g=a+m,p=[n*Math.cos(g),-n*Math.sin(g)],y=m>Math.PI?1:0}var b={path:[["M",i[0],i[1]],["A",n,n,0,y,0,p[0],p[1]]],stroke:o.color||(d==null?void 0:d.attr("stroke"))||DM[s%DM.length],lineWidth:u};return d?d.attr(b):e.shapeMap["".concat(pl).concat(s)]=e.addShape("path",{attrs:b,name:"".concat(pl).concat(s),draggable:!0}),{beginAngle:g,arcBegin:p,shape:e.shapeMap["".concat(pl).concat(s)],shouldEnd:c||v>.999}},Hde=function(e,t,n){var i=e.donutAttrs,a=e.donutColorMap,o=a===void 0?{}:a,s={},u=t.getContainer();if(i){var f=OD(i,o),l=f.configs,c=f.totalValue;if(c)for(var h=DD(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0,y=0;y<l.length;y++){var m="".concat(pl).concat(y),b=am(u,{arcR:v,arcBegin:p,beginAngle:g,config:l[y],fanIndex:y,lineWidth:d,totalValue:c,drawWhole:l.length===1,updateShape:u.shapeMap[m]});if(b.shape&&(s[m]=!0),b.shouldEnd)break;p=b.arcBegin,g=b.beginAngle}}var x=Object.keys(u.shapeMap).filter(function(w){return w.includes(pl)});x.forEach(function(w){s[w]||(u.shapeMap[w].remove(!0),delete u.shapeMap[w])})},OD=function(e,t){var n=0,i=[];return Object.keys(e).forEach(function(a){var o=+e[a];isNaN(o)||(i.push({key:a,value:o,color:t[a]}),n+=o)}),{totalValue:n,configs:i}},DD=function(e){var t=e.attr("r"),n=.6*t,i=(t+n)/2,a=t-n;return{lineWidth:a,arcR:i}},$h=function(e){var t=e.x,n=e.y;return{x:t,y:n,centerX:t,centerY:n,minX:t,minY:n,maxX:t,maxY:n,height:0,width:0}},qde=function(e){e===void 0&&(e=[]);var t=[],n=[];e.forEach(function(u){t.push(u.x),n.push(u.y)});var i=Math.min.apply(Math,t),a=Math.max.apply(Math,t),o=Math.min.apply(Math,n),s=Math.max.apply(Math,n);return{centerX:(i+a)/2,centerY:(o+s)/2,maxX:a,maxY:s,minX:i,minY:o,height:s-o,width:a-i}},Ib=function(e){for(var t=[],n={},i=e.length,a=i-1;a>=0;a--){var o=e[a];o.id="".concat(o.x,"|||").concat(o.y),n[o.id]||(n[o.id]=o,t.push(o))}return t},PD=function(e){return Ib(e)},hv=function(e,t){return e.width||e.height?{centerX:e.centerX,centerY:e.centerY,minX:e.minX-t,minY:e.minY-t,maxX:e.maxX+t,maxY:e.maxY+t,height:e.height+2*t,width:e.width+2*t}:e},Zde=function(e,t){var n=Math.abs(e.x-t.centerX),i=Math.abs(e.y-t.centerY);return n===0&&i===0?0:n/t.width>i/t.height},om=function(e,t,n){var i=Zde(t,e);if(i===0){var a=e.centerX,o=e.centerY;return n.y<t.y?o=e.minY:n.x>t.x?a=e.maxX:n.x<t.x?a=e.minX:n.x===t.x&&(o=e.maxY),{x:a,y:o}}return i?{x:t.x>e.centerX?e.maxX:e.minX,y:t.y}:{x:t.x,y:t.y>e.centerY?e.maxY:e.minY}},PM=function(e,t){var n=Math.min(e.minX,t.minX),i=Math.min(e.minY,t.minY),a=Math.max(e.maxX,t.maxX),o=Math.max(e.maxY,t.maxY);return{centerX:(n+a)/2,centerY:(i+o)/2,minX:n,minY:i,maxX:a,maxY:o,height:o-i,width:a-n}},sm=function(e){return[{x:e.minX,y:e.minY},{x:e.maxX,y:e.minY},{x:e.maxX,y:e.maxY},{x:e.minX,y:e.maxY}]},jh=function(e,t){var n=e.x,i=e.y;return n<t.minX||n>t.maxX||i<t.minY||i>t.maxY},Kde=function(e,t){return t<e.minX||t>e.maxX?[]:[{x:t,y:e.minY},{x:t,y:e.maxY}]},Qde=function(e,t){return t<e.minY||t>e.maxY?[]:[{x:e.minX,y:t},{x:e.maxX,y:t}]},Jde=function(e,t){return Kde(e,t.x).concat(Qde(e,t.y))},zl=function(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},eve=function(e,t){var n=-2,i=0;return t.forEach(function(a){a&&(e.x===a.x&&(i+=n),e.y===a.y&&(i+=n))}),i},RM=function(e,t,n,i,a){return zl(e,t)+zl(e,n)+eve(e,[t,n,i,a])},tve=function r(e,t,n,i,a){a===void 0&&(a=0),e.unshift(t[i]),n[i]&&n[i]!==i&&a<=100&&r(e,t,n,n[i],a+1)},Uh=function(e,t,n,i){var a=n.x-e.x,o=n.y-e.y,s=i.x-e.x,u=i.y-e.y,f=n.x-t.x,l=n.y-t.y,c=i.x-t.x,h=i.y-t.y,d=a*u-o*s,v=f*h-l*c,p=a*l-o*f,g=s*h-u*c;return d*v<=0&&p*g<=0},um=function(e,t,n){if(n.width||n.height){var i=sm(n),a=i[0],o=i[1],s=i[2],u=i[3];return Uh(e,t,a,o)||Uh(e,t,a,u)||Uh(e,t,o,s)||Uh(e,t,s,u)}return!1},rve=function(e,t,n,i){var a=[];return e.forEach(function(o){if(o!==t&&(o.x===t.x||o.y===t.y)){if(um(o,t,n)||um(o,t,i))return;a.push(o)}}),Ib(a)},nve=function(e,t,n,i,a,o,s){var u,f=[],l=(u={},u[t.id]=t,u),c={},h={},d={};h[t.id]=0,d[t.id]=RM(t,n,t);var v=new BD;v.add({id:t.id,value:d[t.id]});var p={};e.forEach(function(w){p[w.id]=w});for(var g;Object.keys(l).length;){var y=v.minId(!1);if(y)g=l[y];else break;if(g===n){var m=[];return tve(m,p,c,n.id),m}delete l[g.id],v.remove(g.id),f.push(g);var b=rve(e,g,i,a),x=function(E){E.forEach(function(_){if(f.indexOf(_)===-1){var M=_.id;l[M]||(l[M]=_);var C=d[g.id]+zl(g,_);if(h[M]&&C>=h[M]){v.add({id:M,value:d[M]});return}c[M]=g.id,h[M]=C,d[M]=h[M]+RM(_,n,t,o,s),v.add({id:M,value:d[M]})}})};x(b)}return[t,n]},ive=function(e,t,n){return!(e.x===t.x&&t.x===n.x||e.y===t.y&&t.y===n.y)},ave=function(e,t,n,i){var a=zl(e,t),o=zl(n,t);a<i&&(i=a),o<i&&(i=o);var s={x:t.x-i/a*(t.x-e.x),y:t.y-i/a*(t.y-e.y)},u={x:t.x-i/o*(t.x-n.x),y:t.y-i/o*(t.y-n.y)};return[s,u]},BM=function(e,t){var n=[],i=e[0];return n.push("M".concat(i.x," ").concat(i.y)),e.forEach(function(a,o){var s=e[o+1],u=e[o+2];if(s&&u)if(ive(a,s,u)){var f=ave(a,s,u,t),l=f[0],c=f[1];n.push("L".concat(l.x," ").concat(l.y)),n.push("Q".concat(s.x," ").concat(s.y," ").concat(c.x," ").concat(c.y)),n.push("L".concat(c.x," ").concat(c.y))}else n.push("L".concat(s.x," ").concat(s.y));else s&&n.push("L".concat(s.x," ").concat(s.y))}),n.join("")},RD=function(e,t,n,i,a){var o,s;if(!n||!n.getType())o=$h(e);else if(n.getType()==="combo"){var u=n.getKeyShape().getBBox();if(u){var f=n.getModel(),l=f.x,c=f.y;o={x:l,y:c,width:u.width,height:u.height,minX:u.minX+l,maxX:u.maxX+l,minY:u.minY+c,maxY:u.maxY+c},o.centerX=(o.minX+o.maxX)/2,o.centerY=(o.minY+o.maxY)/2}else o=$h(e)}else o=n&&n.getBBox();if(!i||!i.getType())s=$h(t);else if(i.getType()==="combo"){var h=i.getKeyShape().getBBox();if(h){var d=i.getModel(),v=d.x,p=d.y;s={x:v,y:p,width:h.width,height:h.height,minX:h.minX+v,maxX:h.maxX+v,minY:h.minY+p,maxY:h.maxY+p},s.centerX=(s.minX+s.maxX)/2,s.centerY=(s.minY+s.maxY)/2}else s=$h(t)}else s=i&&i.getBBox();var g=hv(o,a),y=hv(s,a),m=om(g,e,t),b=om(y,t,e),x=qde([m,b]),w=PM(g,x),E=PM(y,x),_=[];_=_.concat(sm(w)).concat(sm(E));var M={x:(e.x+t.x)/2,y:(e.y+t.y)/2};[x,w,E].forEach(function(S){_=_.concat(Jde(S,M).filter(function(A){return jh(A,g)&&jh(A,y)}))}),[{x:m.x,y:b.y},{x:b.x,y:m.y}].forEach(function(S){jh(S,g)&&jh(S,y)&&_.push(S)}),_.unshift(m),_.push(b),_=Ib(_);var C=nve(_,m,b,o,s,e,t);return C.unshift(e),C.push(t),PD(C)},ove=function(e){if(!(e!=null&&e.length))return e;for(var t=e[e.length-1],n={x:t.x,y:t.y},i=[t],a=[t],o=e.length-2;o>=0;o--){var s=e[o];if(s.x===n.x?i.push(s):(i=[s],n.x=s.x),s.y===n.y?a.push(s):(a=[s],n.y=s.y),i.length>2){var u=e.indexOf(i[1]);u>-1&&e.splice(u,1);continue}if(a.length>2){var u=e.indexOf(a[1]);u>-1&&e.splice(u,1)}}return e},BD=function(){function r(){this.arr=[],this.map={},this.arr=[],this.map={}}return r.prototype._innerAdd=function(e,t){for(var n=[0,t-1];n[1]-n[0]>1;){var i=Math.floor((n[0]+n[1])/2);if(this.arr[i].value>e.value)n[1]=i;else if(this.arr[i].value<e.value)n[0]=i;else{this.arr.splice(i,0,e),this.map[e.id]=!0;return}}this.arr.splice(n[1],0,e),this.map[e.id]=!0},r.prototype.add=function(e){delete this.map[e.id];var t=this.arr.length;if(!t){this.arr.push(e),this.map[e.id]=!0;return}if(this.arr[t-1].value<e.value){this.arr.push(e),this.map[e.id]=!0;return}this._innerAdd(e,t)},r.prototype.remove=function(e){this.map[e]&&delete this.map[e]},r.prototype._clearAndGetMinId=function(){for(var e,t=this.arr.length-1;t>=0;t--)this.map[this.arr[t].id]?e=this.arr[t].id:this.arr.splice(t,1);return e},r.prototype._findFirstId=function(){for(;this.arr.length;){var e=this.arr.shift();if(this.map[e.id])return e.id}},r.prototype.minId=function(e){return e?this._clearAndGetMinId():this._findFirstId()},r}(),sve=function(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},uve=function(e,t,n,i,a){return PD(RD(e,t,n,i,a.offset))},fve={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:sve,fallbackRoute:uve},Ga=function(e,t){var n=Math.round(Math.abs(e/t)),i=e<0?-1:1;return n<0?0:i*n},lve=function(e,t,n){var i={};return e.forEach(function(a){if(a)for(var o=hv(a.getBBox(),n),s=Ga(o.minX,t);s<=Ga(o.maxX,t);s+=1)for(var u=Ga(o.minY,t);u<=Ga(o.maxY,t);u+=1)i["".concat(s,"|||").concat(u)]=!0}),i},E0=function(e,t){var n=t.x-e.x,i=t.y-e.y;return n||i?Math.atan2(i,n):0},FM=function(e,t){var n=Math.abs(e-t);return n>Math.PI?2*Math.PI-n:n},GM=function(e,t,n){for(var i=1/0,a=0,o=t.length;a<o;a++){var s=n(e,t[a]);s<i&&(i=s)}return i},zM=function(e,t,n,i,a){var o=[];if(!n)return[e];var s=a.directions,u=a.offset,f=n.getBBox(),l=t.x>f.minX&&t.x<f.maxX&&t.y>f.minY&&t.y<f.maxY,c=hv(f,u);for(var h in c)c[h]=Ga(c[h],a.gridSize);if(l){for(var d=0,v=s;d<v.length;d++)for(var p=v[d],g=[[{x:c.minX,y:c.minY},{x:c.maxX,y:c.minY}],[{x:c.minX,y:c.minY},{x:c.minX,y:c.maxY}],[{x:c.maxX,y:c.minY},{x:c.maxX,y:c.maxY}],[{x:c.minX,y:c.maxY},{x:c.maxX,y:c.maxY}]],h=0;h<4;h++){var y=g[h],m=_n.getLineIntersect(e,{x:e.x+p.stepX*c.width,y:e.y+p.stepY*c.height},y[0],y[1]);m&&!um(e,m,f)&&(m.id="".concat(m.x,"|||").concat(m.y),o.push(m))}return o}var b=om(c,e,i);return b.id="".concat(b.x,"|||").concat(b.y),[b]},fm=function(e,t,n,i){var a=E0(e,t),o=n[e.id];if(!o){var s=E0(i,e);return FM(s,a)}var u=E0({x:o.x,y:o.y},e);return FM(u,a)},cve=function(e,t,n,i,a,o,s){var u=[i],f=i,l=e.id,c=e.x,h=e.y,d={x:c,y:h,id:l};fm(d,o,t,n)&&(f={x:o.x===i.x?i.x:d.x*s,y:o.y===i.y?i.y:d.y*s},u.unshift(f));for(var v=t[l];v&&v.id!==l;){var p={x:c,y:h,id:l},g={x:v.x,y:v.y,id:v.id},y=fm(g,p,t,n);y&&(f={x:g.x===p.x?f.x:g.x*s,y:g.y===p.y?f.y:g.y*s},u.unshift(f)),l=g.id,c=g.x,h=g.y,v=t[l]}return u[0].x=c===n.x?a.x:f.x,u[0].y=h===n.y?a.y:f.y,u.unshift(a),u},hve=function(e,t,n,i,a){if(isNaN(e.x)||isNaN(t.x))return[];var o=yr(fve,a);o.obstacles=o.obstacles||[];var s=o.penalties,u=o.gridSize,f=lve(o.obstacles.concat([n,i]),u,o.offset),l={x:Ga(e.x,u),y:Ga(e.y,u)},c={x:Ga(t.x,u),y:Ga(t.y,u)};e.id="".concat(l.x,"|||").concat(l.y),t.id="".concat(c.x,"|||").concat(c.y);var h=zM(l,e,n,c,o),d=zM(c,t,i,l,o);h.forEach(function(N){delete f[N.id]}),d.forEach(function(N){delete f[N.id]});for(var v={},p={},g={},y={},m={},b=new BD,x=0;x<h.length;x++){var w=h[x];v[w.id]=w,y[w.id]=0,m[w.id]=GM(w,d,o.distFunc),b.add({id:w.id,value:m[w.id]})}var E=o.maximumLoops,_,M,C,S,A,T,k=1/0,O={};for(d.forEach(function(N){O["".concat(N.x,"|||").concat(N.y)]=!0}),Object.keys(v).forEach(function(N){var P=v[N].id;m[P]<=k&&(k=m[P],_=v[P])});Object.keys(v).length>0&&E>0;){var F=b.minId((E+1)%30===0);if(F)_=v[F];else break;if(O["".concat(_.x,"|||").concat(_.y)])return cve(_,g,l,t,e,c,u);delete v[_.id],b.remove(_.id),p[_.id]=!0;for(var x=0;x<o.directions.length;x++){M=o.directions[x];var D="".concat(Math.round(_.x)+M.stepX,"|||").concat(Math.round(_.y)+M.stepY);if(C={x:_.x+M.stepX,y:_.y+M.stepY,id:D},!p[D]&&(T=fm(_,C,g,l),!(T>o.maxAllowedDirectionChange)&&!f[D])){v[D]||(v[D]=C);var $=s[T];S=o.distFunc(_,C)+(isNaN($)?u:$),A=y[_.id]+S;var Y=y[D];Y&&A>=Y||(g[D]=_,y[D]=A,m[D]=A+GM(C,d,o.distFunc),b.add({id:D,value:m[D]}))}}E-=1}return o.fallbackRoute(e,t,n,i,o)};UI("polyline",{options:{color:Qe.defaultEdge.color,size:Qe.defaultEdge.size,style:{radius:0,offset:15,x:0,y:0,stroke:Qe.defaultEdge.style.stroke,lineAppendWidth:Qe.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:Qe.edgeLabel.style.fill,fontSize:Qe.edgeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},routeCfg:{obstacles:[],maxAllowedDirectionChange:Math.PI,maximumLoops:500,gridSize:10},stateStyles:B({},Qe.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(e,t){var n=this.getShapeStyle(e);n.radius===0&&delete n.radius;var i=t.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return t.shapeMap["edge-shape"]=i,i},getShapeStyle:function(e){var t=this.options.style,n={stroke:e.color},i=yt({},t,n,e.style);e=this.getPathPoints(e),this.radius=i.radius,this.offset=i.offset;var a=e.startPoint,o=e.endPoint,s=this.getControlPoints(e),u=[a];s&&(u=u.concat(s)),u.push(o);var f=e.sourceNode,l=e.targetNode,c=i.radius,h=this.options.routeCfg,d=yt({},h,e.routeCfg);d.offset=i.offset;var v=this.getPath(u,f,l,c,d,!s);(pt(v)&&v.length<=1||Pe(v)&&v.indexOf("L")===-1)&&(v="M0 0, L0 0"),(isNaN(a.x)||isNaN(a.y)||isNaN(o.x)||isNaN(o.y))&&(v="M0 0, L0 0");var p=yt({},Qe.defaultEdge.style,i,{lineWidth:e.size,path:v});return p},updateShapeStyle:function(e,t){var n=t.getContainer();if(t.isVisible()){var i={stroke:e.color},a=n.shapeMap["edge-shape"]||n.find(function(x){return x.get("className")==="edge-shape"})||t.getKeyShape(),o=e.size;e=this.getPathPoints(e);var s=e.startPoint,u=e.endPoint,f=this.getControlPoints(e),l=[s];f&&(l=l.concat(f)),l.push(u);var c=a.attr(),h=yt({},i,c,e.style),d=e.sourceNode,v=e.targetNode,p=h.radius,g=this.options.routeCfg,y=yt({},g,e.routeCfg);y.offset=h.offset;var m=this.getPath(l,d,v,p,y,!f);(pt(m)&&m.length<=1||Pe(m)&&m.indexOf("L")===-1)&&(m="M0 0, L0 0"),(isNaN(s.x)||isNaN(s.y)||isNaN(u.x)||isNaN(u.y))&&(m="M0 0, L0 0"),c.endArrow&&h.endArrow===!1&&(e.style.endArrow={path:""}),c.startArrow&&h.startArrow===!1&&(e.style.startArrow={path:""});var b=yt(i,a.attr(),{lineWidth:o,path:m},e.style);a&&a.attr(b)}},getPath:function(e,t,n,i,a,o){var s=a.offset,u=a.obstacles,f=a.simple;if(!s||e.length>2||o===!1){if(i)return BM(e,i);var l=[];return me(e,function(v,p){p===0?l.push(["M",v.x,v.y]):l.push(["L",v.x,v.y])}),l}f!==!1&&!(u!=null&&u.length)&&(f=!0);var c=f?RD(e[e.length-1],e[0],n,t,s):hve(e[0],e[e.length-1],t,n,a);if(!c||!c.length)return"M0 0, L0 0";if(i){var h=BM(c,i);return h}c=ove(c);var d=_n.pointsToPolygon(c);return d}},"single-edge");var $M=Za.cloneEvent,jM=Za.isNaN,UM=Math.abs,dve=10,vve=["shift","ctrl","alt","control"];const pve={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(e){var t=this.origin,n=+e.clientX,i=+e.clientY;if(!(jM(n)||jM(i))){var a=n-t.x,o=i-t.y;this.get("direction")==="x"?o=0:this.get("direction")==="y"&&(a=0),this.origin={x:n,y:i};var s=this.graph.get("width"),u=this.graph.get("height"),f=this.graph.get("canvas").getCanvasBBox(),l=this.scalableRange,c=this.scalableRange;l<1&&l>-1&&(l=s*l,c=u*c),(f.minX<=s+l&&f.minX+a>s+l||f.maxX+l>=0&&f.maxX+l+a<0)&&(a=0),(f.minY<=u+c&&f.minY+o>u+c||f.maxY+c>=0&&f.maxY+c+o<0)&&(o=0),this.graph.translate(a,o)}},onTouchStart:function(e){var t=this,n=e.originalEvent.touches,i=n[0],a=n[1];i&&a||(e.preventDefault(),this.mousedown=!0,t.onDragStart(e))},onMouseDown:function(e){this.mousedown=!0},onDragMove:function(e){this.mousedown&&(this.dragstart?this.onDrag(e):(this.dragstart=!0,this.onDragStart(e)))},onDragStart:function(e){var t=this,n=e.originalEvent;if(!(n&&e.name!=="touchstart"&&n.button!==0)&&!(e.name!=="touchstart"&&typeof window<"u"&&window.event&&!window.event.buttons&&!window.event.button)&&this.shouldBegin(e,this)&&!t.keydown&&this.allowDrag(e)){if(t.origin={x:e.clientX,y:e.clientY},t.dragging=!1,this.enableOptimize){for(var i=this.graph,a=i.getEdges(),o=0,s=a.length;o<s;o++){var u=a[o].get("group").get("children");u&&u.forEach(function(b){b.set("ori-visibility",b.get("ori-visibility")||b.get("visible")),b.hide()})}for(var f=i.getNodes(),l=0,c=f.length;l<c;l++)for(var h=f[l].getContainer(),d=h.get("children"),v=0,p=d;v<p.length;v++){var g=p[v],y=g.get("isKeyShape");y||(g.set("ori-visibility",g.get("ori-visibility")||g.get("visible")),g.hide())}}if(typeof window<"u"){var m=this;this.handleDOMContextMenu=function(b){return m.onMouseUp(b)},document.body.addEventListener("contextmenu",this.handleDOMContextMenu)}}},onTouchMove:function(e){var t=this,n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a){this.onMouseUp(e);return}e.preventDefault(),t.onDrag(e)},onDrag:function(e){if(this.mousedown){var t=this.graph;if(!this.keydown&&this.allowDrag(e)&&(e=$M(e),!!this.origin)){if(this.dragging)e.type="drag",t.emit("canvas:drag",e);else{if(UM(this.origin.x-e.clientX)+UM(this.origin.y-e.clientY)<dve)return;this.shouldBegin(e,this)&&(e.type="dragstart",t.emit("canvas:dragstart",e),this.originPosition={x:e.clientX,y:e.clientY},this.dragging=!0)}this.shouldUpdate(e,this)&&this.updateViewport(e)}}},onMouseUp:function(e){var t,n;this.mousedown=!1,this.dragstart=!1;var i=this.graph;if(!this.keydown){var a=i.getZoom(),o=i.get("modeController"),s=(n=(t=o==null?void 0:o.modes[o.mode])===null||t===void 0?void 0:t.filter(function(_){return _.type==="zoom-canvas"}))===null||n===void 0?void 0:n[0],u=s?s.optimizeZoom||.1:0;if(this.enableOptimize){for(var f=i.getEdges(),l=0,c=f.length;l<c;l++){var h=f[l].get("group").get("children");h&&h.forEach(function(_){var M=_.get("ori-visibility");_.set("ori-visibility",void 0),M&&_.show()})}if(a>u)for(var d=i.getNodes(),v=0,p=d.length;v<p;v++)for(var g=d[v].getContainer(),y=g.get("children"),m=0,b=y;m<b.length;m++){var x=b[m],w=x.get("isKeyShape");if(!w){var E=x.get("ori-visibility");x.set("ori-visibility",void 0),E&&x.show()}}}if(!this.dragging){this.origin=null;return}e=$M(e),this.shouldEnd(e,this)&&this.updateViewport(e),e.type="dragend",e.dx=e.clientX-this.originPosition.x,e.dy=e.clientY-this.originPosition.y,i.emit("canvas:dragend",e),this.endDrag(),typeof window<"u"&&document.body.removeEventListener("contextmenu",this.handleDOMContextMenu)}},endDrag:function(){this.origin=null,this.dragging=!1,this.dragbegin=!1,this.mousedown=!1,this.dragstart=!1},onKeyDown:function(e){var t=this,n=e.key;n&&(vve.indexOf(n.toLowerCase())>-1?t.keydown=!0:t.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1},allowDrag:function(e){var t,n,i=e.target,a=i&&i.isCanvas&&i.isCanvas();if($l(this.allowDragOnItem)&&!this.allowDragOnItem&&!a)return!1;if(yn(this.allowDragOnItem)){var o=this.allowDragOnItem,s=o.node,u=o.edge,f=o.combo,l=(n=(t=e.item)===null||t===void 0?void 0:t.getType)===null||n===void 0?void 0:n.call(t);if(!s&&l==="node"||!u&&l==="edge"||!f&&l==="combo")return!1}return!0}},gve={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(e){if(!this.origin||!e||e.destroyed)return!1;var t=e.getType();return t==="combo"},onTouchStart:function(e){if(e.item){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}this.mousedown={item:e.item,target:e.target,origin:{x:e.x,y:e.y}},this.dragstart=!0,t.onDragStart(e)}},onTouchMove:function(e){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a){t.onDragEnd(e);return}e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.onDrag(e)},onMouseDown:function(e){this.mousedown={item:e.item,target:e.target,origin:{x:e.x,y:e.y}},typeof window<"u"&&!this.windowEventBinded&&(this.windowEventBinded=!0,document.body.addEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.addEventListener("mouseup",this.onDragEnd.bind(this)))},onDragMove:function(e){var t,n;if(((n=(t=e.item)===null||t===void 0?void 0:t.getType)===null||n===void 0?void 0:n.call(t))!=="node"){this.onDragEnd();return}this.mousedown&&(this.dragstart?this.onDrag(B(B({},e),this.mousedown)):(this.dragstart=!0,this.onDragStart(e)))},onDragStart:function(e){var t=this;if(this.currentShouldEnd=!0,!!this.shouldBegin(B(B({},e),this.mousedown),this)){var n=this.mousedown,i=n.item,a=n.target;if(!(!i||i.destroyed||i.hasLocked())){var o=i.getContainer();if(o.set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(i),a){var s=a.get("isAnchorPoint");if(s)return}var u=this.graph;this.targets=[],this.targetCombo=null;var f=u.findAllByState("node",this.selectedState),l=i.get("id"),c=f.filter(function(d){var v=d.get("id");return l===v});if(c.length===0?this.targets.push(i):f.length>1?f.forEach(function(d){var v=d.hasLocked();v||t.targets.push(d)}):this.targets.push(i),this.graph.get("enabledStack")&&this.enableStack){var h=[];this.targets.forEach(function(d){var v=d.getModel(),p=v.x,g=v.y,y=v.id;h.push({x:p,y:g,id:y})}),this.set("beforeDragNodes",h)}this.hidenEdge={},this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(d){var v=d.getEdges();v.forEach(function(p){p.isVisible()&&(t.hidenEdge[p.getID()]=!0,p.hide())})}),this.origin=this.mousedown.origin,this.point={},this.originPoint={}}}},onDrag:function(e){var t=this;if(!(!this.mousedown||!this.origin)&&this.shouldUpdate(e,this))if(this.get("enableDelegate"))this.updateDelegate(e);else if(this.enableDebounce)this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:e,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos});else{var n={};this.targets.map(function(i){t.update(i,e);var a=i.getModel().comboId;a&&(n[a]=t.graph.findById(a))}),this.onlyChangeComboSize&&this.updateParentCombos()}},onDragEnd:function(e){var t=this,n;if(this.mousedown=!1,this.dragstart=!1,typeof window<"u"&&this.windowEventBinded&&(this.windowEventBinded=!1,document.body.removeEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.removeEventListener("mouseup",this.onDragEnd.bind(this))),!!this.origin){(n=this.cachedCaptureItems)===null||n===void 0||n.forEach(function(o){var s=o.getContainer();s.set("capture",!0)}),this.cachedCaptureItems=[],this.delegateRect&&(this.delegateRect.remove(),this.delegateRect=null),this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(o){var s=o.getEdges();s.forEach(function(u){t.hidenEdge[u.getID()]&&u.show(),u.refresh()})}),this.hidenEdge={};var i=this.graph;if(i.get("enabledStack")&&this.enableStack){var a={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach(function(o){a.before.nodes.push(o)}),this.targets.forEach(function(o){var s=o.getModel(),u=s.x,f=s.y,l=s.id;a.after.nodes.push({x:u,y:f,id:l})}),i.pushStack("update",Vt(a))}i.emit("dragnodeend",{items:this.targets,targetItem:null}),this.point={},this.origin=null,this.originPoint={},this.targets.length=0,this.targetCombo=null}},onDropCombo:function(e){var t=e.item;if(this.currentShouldEnd=this.shouldEnd(e,t,this),this.updatePositions(e,!this.currentShouldEnd),!(!this.currentShouldEnd||!this.validationCombo(t))){var n=this.graph;if(this.comboActiveState&&n.setItemState(t,this.comboActiveState,!1),this.targetCombo=t,this.onlyChangeComboSize)n.updateCombos();else{var i=t.getModel();this.targets.map(function(a){var o=a.getModel();o.comboId!==i.id&&n.updateComboTree(a,i.id)}),n.updateCombo(t)}n.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(e){var t=this.graph;this.currentShouldEnd=this.shouldEnd(e,void 0,this),this.updatePositions(e,!this.currentShouldEnd),!(!this.targets||this.targets.length===0||!this.currentShouldEnd)&&(this.onlyChangeComboSize?this.updateParentCombos():this.targets.map(function(n){var i=n.getModel();i.comboId&&t.updateComboTree(n)}))},onDropNode:function(e){if(!(!this.targets||this.targets.length===0)){var t=this,n=e.item,i=t.graph,a=n.getModel().comboId,o=a?i.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd(e,o,this),this.updatePositions(e,!this.currentShouldEnd),!!this.currentShouldEnd){if(this.onlyChangeComboSize)this.updateParentCombos();else if(a){var s=i.findById(a);t.comboActiveState&&i.setItemState(s,t.comboActiveState,!1),this.targets.map(function(u){var f=u.getModel();a!==f.comboId&&i.updateComboTree(u,a)}),i.updateCombo(s)}else this.targets.map(function(u){var f=u.getModel();f.comboId&&i.updateComboTree(u)});i.emit("dragnodeend",{items:this.targets,targetItem:n})}}},onDragEnter:function(e){var t=e.item;if(this.validationCombo(t)){var n=this.graph;this.comboActiveState&&n.setItemState(t,this.comboActiveState,!0)}},onDragLeave:function(e){var t=e.item;if(this.validationCombo(t)){var n=this.graph;this.comboActiveState&&n.setItemState(t,this.comboActiveState,!1)}},updatePositions:function(e,t){var n=this;!this.targets||this.targets.length===0||(this.get("enableDelegate")?this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:e,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos}):t||this.targets.map(function(i){return n.update(i,e)}):this.targets.map(function(i){return n.update(i,e,t)}))},update:function(e,t,n){var i=this.origin,a=e.get("model"),o=e.get("id");this.point[o]||(this.point[o]={x:a.x||0,y:a.y||0});var s=t.x-i.x+this.point[o].x,u=t.y-i.y+this.point[o].y;n&&(s+=i.x-t.x,u+=i.y-t.y);var f={x:s,y:u};this.get("updateEdge")?this.graph.updateItem(e,f,!1):e.updatePosition(f)},debounceUpdate:jl(function(r){var e=r.targets,t=r.graph,n=r.point,i=r.origin,a=r.evt,o=r.updateEdge,s=r.onlyChangeComboSize,u=r.updateParentCombos;e.map(function(f){var l=f.get("model"),c=f.get("id");n[c]||(n[c]={x:l.x||0,y:l.y||0});var h=a.x-i.x+n[c].x,d=a.y-i.y+n[c].y,v={x:h,y:d};o?t.updateItem(f,v,!1):f.updatePosition(v)}),s&&u(t,e)},50,!0),updateDelegate:function(e){var t=this.graph;if(this.delegateRect){var h=e.x-this.origin.x+this.originPoint.minX,d=e.y-this.origin.y+this.originPoint.minY;this.delegateRect.attr({x:h,y:d})}else{var n=t.get("group"),i=yr({},bs.delegateStyle,this.delegateStyle),a=this.calculationGroupPosition(e),o=a.x,s=a.y,u=a.width,f=a.height,l=a.minX,c=a.minY;this.originPoint={x:o,y:s,width:u,height:f,minX:l,minY:c},this.delegateRect=n.addShape("rect",{attrs:B({width:u,height:f,x:o,y:s},i),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(e){var t=this.targets;t.length===0&&t.push(e.item);for(var n=1/0,i=-1/0,a=1/0,o=-1/0,s=0;s<t.length;s++){var u=t[s],f=u.getBBox(),l=f.minX,c=f.minY,h=f.maxX,d=f.maxY;l<n&&(n=l),c<a&&(a=c),h>i&&(i=h),d>o&&(o=d)}var v=Math.floor(n),p=Math.floor(a),g=Math.ceil(i)-Math.floor(n),y=Math.ceil(o)-Math.floor(a);return{x:v,y:p,width:g,height:y,minX:n,minY:a}},updateParentCombos:function(e,t){var n=e||this.graph,i=t||this.targets,a={};i==null||i.forEach(function(o){var s=o.getModel().comboId;s&&(a[s]=n.findById(s))}),Object.values(a).forEach(function(o){o&&n.updateCombo(o)})}};var Xh=null;const yve={getDefaultCfg:function(){return{trigger:"mouseenter",activeState:"active",inactiveState:"inactive",resetSelected:!1,shouldClearStatusOnSecond:!1,shouldUpdate:function(){return!0}}},getEvents:function(){return this.get("trigger")==="mouseenter"?{"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(e){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.setAllItemStates(e)},clearOnTouchStart:function(e){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.clearActiveState(e)},setAllItemStates:function(e){clearTimeout(this.timer),this.throttleSetAllItemStates(e,this)},clearActiveState:function(e){var t=this,n=this.shouldClearStatusOnSecond;n&&(Xh=null),this.timer=setTimeout(function(){t.throttleClearActiveState(e,t)},50)},throttleSetAllItemStates:yl(function(r,e){var t=r.item,n=e.graph;if(!(!n||n.destroyed)&&(e.item=t,!!e.shouldUpdate(r.item,{event:r,action:"activate"},e))){var i=e.shouldClearStatusOnSecond,a=t.getModel().id;if(Xh===a&&i){e.throttleClearActiveState(r,e),Xh=null;return}for(var o=e.activeState,s=e.inactiveState,u=n.getNodes(),f=n.getCombos(),l=n.getEdges(),c=n.get("vedges"),h=u.length,d=f.length,v=l.length,p=c.length,g=e.inactiveItems||{},y=e.activeItems||{},m=0;m<h;m++){var b=u[m],x=b.getID(),w=b.hasState("selected");e.resetSelected&&w&&n.setItemState(b,"selected",!1),y[x]&&(n.setItemState(b,o,!1),delete y[x]),s&&!g[x]&&(n.setItemState(b,s,!0),g[x]=b)}for(var m=0;m<d;m++){var E=f[m],_=E.getID(),w=E.hasState("selected");e.resetSelected&&w&&n.setItemState(E,"selected",!1),y[_]&&(n.setItemState(E,o,!1),delete y[_]),s&&!g[_]&&(n.setItemState(E,s,!0),g[_]=E)}for(var m=0;m<v;m++){var M=l[m],C=M.getID();y[C]&&(n.setItemState(M,o,!1),delete y[C]),s&&!g[C]&&(n.setItemState(M,s,!0),g[C]=M)}for(var m=0;m<p;m++){var S=c[m],A=S.getID();y[A]&&(n.setItemState(S,o,!1),delete y[A]),s&&!g[A]&&(n.setItemState(S,s,!0),g[A]=S)}if(t&&!t.destroyed){s&&(n.setItemState(t,s,!1),delete g[t.getID()]),y[t.getID()]||(n.setItemState(t,o,!0),y[t.getID()]=t);for(var T=t.getEdges(),k=T.length,m=0;m<k;m++){var M=T[m],C=M.getID(),O=void 0;M.getSource()===t?O=M.getTarget():O=M.getSource();var F=O.getID();s&&g[F]&&(n.setItemState(O,s,!1),delete g[F]),y[F]||(n.setItemState(O,o,!0),y[F]=O),g[C]&&(n.setItemState(M,s,!1),delete g[C]),y[C]||(n.setItemState(M,o,!0),y[C]=M),M.toFront()}}e.activeItems=y,e.inactiveItems=g,i&&(Xh=t.getModel().id),n.emit("afteractivaterelations",{item:r.item,action:"activate"})}},50,{trailing:!0,leading:!0}),throttleClearActiveState:yl(function(r,e){var t=e.get("graph");if(!(!t||t.destroyed)&&e.shouldUpdate(r.item,{event:r,action:"deactivate"},e)){var n=e.activeState,i=e.inactiveState,a=e.activeItems||{},o=e.inactiveItems||{};Object.values(a).filter(function(s){return!s.destroyed}).forEach(function(s){t.clearItemStates(s,n)}),Object.values(o).filter(function(s){return!s.destroyed}).forEach(function(s){t.clearItemStates(s,i)}),e.activeItems={},e.inactiveItems={},t.emit("afteractivaterelations",{item:r.item||e.get("item"),action:"deactivate"})}},50,{trailing:!0,leading:!0})};var Yh=Math.min,XM=Math.max,YM=Math.abs,WM="shift",mve=["drag","shift","ctrl","alt","control"];const bve={getDefaultCfg:function(){return{brushStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},selectedState:"selected",trigger:WM,includeEdges:!0,includeCombos:!1,selectOnCombo:!1,selectedEdges:[],selectedNodes:[],selectedCombos:[]}},getEvents:function(){return mve.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=WM,console.warn("Behavior brush-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),this.trigger==="drag"?{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates"}:{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates",keyup:"onKeyUp",keydown:"onKeyDown"}},onMouseDown:function(e){var t=e.item,n=this.brush,i=this.selectOnCombo,a=(t==null?void 0:t.getType())==="combo";a&&!i||!a&&t||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates(),n||(n=this.createBrush()),this.originPoint={x:e.canvasX,y:e.canvasY},n.attr({width:0,height:0}),n.show(),this.dragging=!0)},onMouseMove:function(e){this.dragging&&(this.trigger!=="drag"&&!this.keydown||this.updateBrush(e))},onMouseUp:function(e){this.graph,!(!this.brush&&!this.dragging)&&(this.trigger!=="drag"&&!this.keydown||(this.brush.remove(!0),this.brush=null,this.getSelectedNodes(e),this.dragging=!1))},clearStates:function(){var e=this,t=e.graph,n=e.selectedState,i=t.findAllByState("node",n),a=t.findAllByState("edge",n),o=t.findAllByState("combo",n);i.forEach(function(s){return t.setItemState(s,n,!1)}),a.forEach(function(s){return t.setItemState(s,n,!1)}),o.forEach(function(s){return t.setItemState(s,n,!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(e,t,n,i,a){var o=e.getBBox();return o.centerX>=t&&o.centerX<=n&&o.centerY>=i&&o.centerY<=a},getSelectedNodes:function(e){var t=this,n=this,i=n.graph,a=n.originPoint,o=n.shouldUpdate,s=n.isBBoxCenterInRect,u=this.selectedState,f={x:e.x,y:e.y},l=i.getPointByCanvas(a.x,a.y),c=Yh(f.x,l.x),h=XM(f.x,l.x),d=Yh(f.y,l.y),v=XM(f.y,l.y),p=[],g=[];i.getNodes().forEach(function(b){if(b.isVisible()&&s(b,c,h,d,v)&&o(b,"select",t)){p.push(b);var x=b.getModel();g.push(x.id),i.setItemState(b,u,!0)}});var y=[];this.includeEdges&&p.forEach(function(b){var x=b.getOutEdges();x.forEach(function(w){if(w.isVisible()){var E=w.getModel(),_=E.source,M=E.target;g.includes(_)&&g.includes(M)&&o(w,"select",t)&&(y.push(w),i.setItemState(w,t.selectedState,!0))}})});var m=[];this.includeCombos&&i.getCombos().forEach(function(b){if(b.isVisible()&&s(b,c,h,d,v)&&o(b,"select",t)){m.push(b);var x=b.getModel();g.push(x.id),i.setItemState(b,u,!0)}}),this.selectedEdges=y,this.selectedNodes=p,this.selectedCombos=m,this.onSelect&&this.onSelect(p,y,m),i.emit("nodeselectchange",{selectedItems:{nodes:p,edges:y,combos:m},select:!0})},createBrush:function(){var e=this,t=e.graph.get("canvas").addShape("rect",{attrs:e.brushStyle,capture:!1,name:"brush-shape"});return this.brush=t,this.delegate=t,t},updateBrush:function(e){var t=this.originPoint;this.brush.attr({width:YM(e.canvasX-t.x),height:YM(e.canvasY-t.y),x:Yh(e.canvasX,t.x),y:Yh(e.canvasY,t.y)})},onKeyDown:function(e){var t=e.key;if(t){var n=this.trigger.toLowerCase(),i=t.toLowerCase();i===n||i==="control"&&n==="ctrl"||i==="ctrl"&&n==="control"?this.keydown=!0:this.keydown=!1}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.keydown=!1}};var VM="shift",xve=["shift","ctrl","alt","control"];const wve={getDefaultCfg:function(){return{multiple:!0,trigger:VM,selectedState:"selected",selectNode:!0,selectEdge:!1,selectCombo:!0}},getEvents:function(){var e=this;return xve.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=VM,console.warn("Behavior click-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),e.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(e){var t=this,n=e.item;if(!(!n||n.destroyed)){var i=n.getType(),a=t.graph,o=t.keydown,s=t.multiple,u=t.shouldUpdate,f=t.shouldBegin;if(f(e,t)){if(!o||!s){var l=a.findAllByState("node",t.selectedState).concat(a.findAllByState("edge",t.selectedState)).concat(a.findAllByState("combo",t.selectedState));me(l,function(p){p!==n&&a.setItemState(p,t.selectedState,!1)})}var c=function(){switch(i){case"node":return t.selectNode;case"edge":return t.selectEdge;case"combo":return t.selectCombo;default:return!1}}();if(!c){var h=a.findAllByState("node",t.selectedState),d=a.findAllByState("edge",t.selectedState),v=a.findAllByState("combo",t.selectedState);a.emit("nodeselectchange",{selectedItems:{nodes:h,edges:d,combos:v},select:!1});return}if(n.hasState(t.selectedState)){u(e,t)&&a.setItemState(n,t.selectedState,!1);var h=a.findAllByState("node",t.selectedState),d=a.findAllByState("edge",t.selectedState),v=a.findAllByState("combo",t.selectedState);a.emit("nodeselectchange",{target:n,selectedItems:{nodes:h,edges:d,combos:v},select:!1})}else{u(e,t)&&a.setItemState(n,t.selectedState,!0);var h=a.findAllByState("node",t.selectedState),d=a.findAllByState("edge",t.selectedState),v=a.findAllByState("combo",t.selectedState);a.emit("nodeselectchange",{target:n,selectedItems:{nodes:h,edges:d,combos:v},select:!0})}}}},onCanvasClick:function(e){var t=this,n=this,i=n.graph,a=n.shouldBegin;if(a(e,this)){var o=i.findAllByState("node",this.selectedState);me(o,function(f){i.setItemState(f,t.selectedState,!1)});var s=i.findAllByState("edge",this.selectedState);me(s,function(f){i.setItemState(f,t.selectedState,!1)});var u=i.findAllByState("combo",this.selectedState);me(u,function(f){i.setItemState(f,t.selectedState,!1)}),i.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})}},onKeyDown:function(e){var t=this,n=e.key;n&&(n.toLowerCase()===this.trigger.toLowerCase()||n.toLowerCase()==="control"?t.keydown=!0:t.keydown=!1)},onKeyUp:function(){var e=this;e.keydown=!1}};var Eve=yi,Wh=.05;const _ve={getDefaultCfg:function(){return this.isFireFox=aD()==="firefox",{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 e=this.fixSelectedItems;return e.fixState||(e.fixState="selected"),e.fixAll&&(e.fixLineWidth=!0,e.fixLabel=!0),{wheel:"onWheel",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd"}},onTouchStart:function(e){var t=e.originalEvent.touches,n=t[0],i=t[1];e.preventDefault(),i&&(this.shouldBegin&&!this.shouldBegin(e,this)||(this.startPoint={pageX:n.pageX,pageY:n.pageY},this.moveable=!0,i&&(this.endPoint={pageX:i.pageX,pageY:i.pageY}),this.originScale=this.graph.getZoom()||this.currentScale||1))},onTouchMove:function(e){if(this.moveable){e.preventDefault();var t=e.originalEvent.touches,n=t[0],i=t[1];if(i){this.endPoint||(this.endPoint={pageX:i.pageX,pageY:i.pageY});var a=function(p,g){return Math.hypot(g.x-p.x,g.y-p.y)},o=a({x:n.pageX,y:n.pageY},{x:i.pageX,y:i.pageY})/a({x:this.startPoint.pageX,y:this.startPoint.pageY},{x:this.endPoint.pageX,y:this.endPoint.pageY}),s=this.originScale*o;this.currentScale=s;var u=this.get("minZoom")||this.graph.get("minZoom"),f=this.get("maxZoom")||this.graph.get("maxZoom");if(!(s>f||s<u)){var l=this.get("animate"),c=this.get("animateCfg"),h=this.graph.get("canvas"),d=h.getPointByClient(e.clientX,e.clientY);this.graph.zoomTo(s,{x:d.x,y:d.y},l,c),this.graph.emit("wheelzoom",e)}}}},onTouchEnd:function(){this.moveable=!1,this.endPoint=null},onWheel:function(e){var t=this,n=this,i=n.graph,a=n.fixSelectedItems;if(!(this.shouldBegin&&!this.shouldBegin(e,this))&&this.shouldUpdate(e,this)){e.preventDefault();var o=i.get("canvas"),s=o.getPointByClient(e.clientX,e.clientY),u=this.get("sensitivity"),f=i.getZoom(),l=f,c=f;this.isFireFox?e.deltaY>0||e.wheelDelta<0?l=1-Wh*u:l=1/(1-Wh*u):e.wheelDelta<0?l=1-Wh*u:l=1/(1-Wh*u),c=f*l;var h=this.get("minZoom")||i.get("minZoom"),d=this.get("maxZoom")||i.get("maxZoom");c>d?c=d:c<h&&(c=h);var v=this.get("enableOptimize");if(v){var p=this.get("optimizeZoom"),g=this.get("optimized"),y=i.getNodes(),m=i.getEdges(),b=y.length,x=m.length;if(!g){for(var w=0;w<b;w++){var E=y[w];if(!E.destroyed)for(var _=E.get("group").get("children"),M=_.length,C=0;C<M;C++){var S=_[C];!S.destoryed&&!S.get("isKeyShape")&&(S.set("ori-visibility",S.get("ori-visibility")||S.get("visible")),S.hide())}}for(var A=0;A<x;A++)for(var T=m[A],_=T.get("group").get("children"),M=_.length,C=0;C<M;C++){var S=_[C];S.set("ori-visibility",S.get("ori-visibility")||S.get("visible")),S.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var k=setTimeout(function(){var tt=i.getZoom(),ae=t.get("optimized");if(ae){t.set("optimized",!1);for(var L=0;L<b;L++){var Se=y[L],Ge=Se.get("group").get("children"),ye=Ge.length;if(tt<p){var Ye=Se.getKeyShape(),We=Ye.get("ori-visibility");Ye.set("ori-visibility",void 0),We&&Ye.show()}else for(var qe=0;qe<ye;qe++){var et=Ge[qe],We=et.get("ori-visibility");et.set("ori-visibility",void 0),!et.get("visible")&&We&&We&&et.show()}}for(var gt=0;gt<x;gt++){var Pt=m[gt],Ge=Pt.get("group").get("children"),ye=Ge.length;if(tt<p){var Ye=Pt.getKeyShape(),We=Ye.get("ori-visibility");Ye.set("ori-visibility",void 0),We&&Ye.show()}else for(var qe=0;qe<ye;qe++){var et=Ge[qe];if(!et.get("visible")){var We=et.get("ori-visibility");et.set("ori-visibility",void 0),We&&et.show()}}}}},100);this.set("timeout",k)}if(f<=1){var O=void 0,F=void 0;if(a.fixAll||a.fixLineWidth||a.fixLabel){O=i.findAllByState("node",a.fixState),F=i.findAllByState("edge",a.fixState);for(var D=f/c,$=O.length,Y=0;Y<$;Y++){var E=O[Y],N=E.getContainer(),P=E.getModel(),W=E.getOriginStyle(),J=E.getStateStyle(a.fixState),te=E.get("shapeFactory").getShape(P.type).getStateStyle(a.fixState,E)[a.fixState];if(a.fixAll){if(c<=1){var H=Vt(N.getMatrix());H||(H=[1,0,0,0,1,0,0,0,1]);var pe=E.getModel(),Te=pe.x,Ne=pe.y;H=Eve(H,[["t",-Te,-Ne],["s",D,D],["t",Te,Ne]]),N.setMatrix(H)}}else for(var _=N.get("children"),M=_.length,C=0;C<M;C++){var S=_[C],Ze=void 0,at=void 0;if(a.fixLabel){var nt=S.get("type");if(nt==="text"){Ze=S.attr("fontSize")||12;var _t=J[S.get("name")],St=te[S.get("name")],fr=_t?_t.fontSize:12,Ft=St?St.fontSize:12,Yt=fr||Ft||12;if(c<=1&&S.attr("fontSize",Yt/c),at)break}}if(a.fixLineWidth&&S.get("isKeyShape")){at=S.attr("lineWidth")||0;var dr=J.lineWidth||te.lineWidth||W.lineWidth||0;if(c<=1&&S.attr("lineWidth",dr/c),Ze)break}}}for(var lr=F.length,jt=0;jt<lr;jt++)for(var T=F[jt],N=T.getContainer(),_=N.get("children"),P=T.getModel(),J=T.getStateStyle(a.fixState),te=T.get("shapeFactory").getShape(P.type).getStateStyle(a.fixState,T)[a.fixState],M=_.length,C=0;C<M;C++){var S=_[C],Ze=void 0,at=void 0;if(a.fixLabel||a.fixAll){var nt=S.get("type");if(nt==="text"){Ze=S.attr("fontSize")||12;var _t=J[S.get("name")],St=te[S.get("name")],fr=_t?_t.fontSize:12,Ft=St?St.fontSize:12,Yt=fr||Ft||12;if(c<=1&&S.attr("fontSize",Yt/c),at)break}}if((a.fixLineWidth||a.fixAll)&&S.get("isKeyShape")){at=S.attr("lineWidth")||0;var dr=J.lineWidth||te.lineWidth||1;if(c<=1&&S.attr("lineWidth",dr/c),Ze)break}}}}var ir=this.get("animate"),Hr=this.get("animateCfg");i.zoomTo(c,{x:s.x,y:s.y},ir,Hr),i.emit("wheelzoom",e)}}},FD={onMouseEnter:function(e){var t=e.item;this.currentTarget=t,this.showTooltip(e),this.graph.emit("tooltipchange",{item:e.item,action:"show"})},onMouseMove:function(e){if(!this.shouldUpdate(e,this)){this.hideTooltip();return}!this.currentTarget||e.item!==this.currentTarget||this.updatePosition(e)},onMouseLeave:function(e){this.shouldEnd(e,this)&&(this.hideTooltip(),this.graph.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null)},showTooltip:function(e){var t=this.container;if(!(!e.item||e.item.destroyed)){t||(t=this.createTooltip(this.graph.get("canvas")),this.container=t);var n=this.formatText(e.item.get("model"),e);t.innerHTML=n,Xt(this.container,{visibility:"visible"}),this.updatePosition(e)}},hideTooltip:function(){Xt(this.container,{visibility:"hidden"})},updatePosition:function(e){var t=this.get("shouldBegin"),n=this,i=n.width,a=n.height,o=n.container,s=n.graph;if(!t(e,this)){Xt(o,{visibility:"hidden"});return}var u=s.getPointByClient(e.clientX,e.clientY),f=s.getCanvasByPoint(u.x,u.y),l=f.x,c=f.y,h=o.getBoundingClientRect();l>i/2?l-=h.width:l+=this.offset,c>a/2?c-=h.height:c+=this.offset;var d="".concat(l,"px"),v="".concat(c,"px");Xt(this.container,{left:d,top:v,visibility:"visible"})},createTooltip:function(e){var t=e.get("el");t.style.position="relative";var n=Er('<div class="g6-tooltip g6-'.concat(this.item,'-tooltip"></div>'));return t.parentNode.appendChild(n),Xt(n,{position:"absolute",visibility:"visible"}),this.width=e.get("width"),this.height=e.get("height"),this.container=n,this.graph.get("tooltips").push(n),n}},Sve=B({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"}}},FD),Mve=B({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"}}},FD);var HM="click",Cve=["click","dblclick"];const Ave={getDefaultCfg:function(){return{trigger:HM,onChange:function(){}}},getEvents:function(){var e,t;return Cve.includes(this.trigger)?t=this.trigger:(t=HM,console.warn("Behavior collapse-expand 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),e={},e["node:".concat(t)]="onNodeClick",e.touchstart="onNodeClick",e},onNodeClick:function(e){var t=this;if(this.trigger==="click"){if(this.timer){clearTimeout(this.timer),this.timer=0;return}this.timer=setTimeout(function(){t.toggle(e),clearTimeout(t.timer),t.timer=0},200)}else this.toggle(e)},toggle:function(e){var t=e.item;if(t){var n=this.graph.findDataById(t.get("id"));if(n){var i=n.children;if(!(!i||i.length===0)){var a=!n.collapsed;this.shouldBegin(e,a,this)&&(n.collapsed=a,t.getModel().collapsed=a,this.graph.emit("itemcollapsed",{item:e.item,collapsed:a}),this.shouldUpdate(e,a,this)&&(this.onChange(t,a,this),this.graph.layout()))}}}}};var Tve=Za.calculationItemsBBox,Ive=function r(e,t){if(t(e)!==!1&&e){var n=e.get("combos");if(n.length===0)return!1;me(n,function(i){r(i,t)})}};const kve={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(e){var t=e.item;if(!t||t.destroyed||!this.shouldUpdate(e,this))return!1;var n=t.getType();return n==="combo"},onMouseDown:function(e){this.origin={x:e.x,y:e.y}},onDragStart:function(e){var t=this,n=this.graph,i=e.item;if(this.currentShouldEnd=!0,!!this.validationCombo(e)){this.targets=[];var a=n.findAllByState("combo",this.selectedState),o=i.get("id"),s=a.filter(function(f){var l=f.get("id");return o===l});s.length===0?this.targets.push(i):this.targets=a;var u=[];this.targets.forEach(function(f){var l=f.getModel(),c=l.x,h=l.y,d=l.id;u.push({x:c,y:h,id:d})}),this.set("beforeDragItems",u),this.activeState&&this.targets.map(function(f){var l=f.getModel();if(l.parentId){var c=n.findById(l.parentId);c&&n.setItemState(c,t.activeState,!0)}}),this.point={},this.originPoint={},this.currentItemChildCombos=[],Ive(i,function(f){if(f.destroyed)return!1;var l=f.getModel();return t.currentItemChildCombos.push(l.id),!0})}},onDrag:function(e){var t=this;if(this.origin&&this.validationCombo(e))if(this.enableDelegate)this.updateDelegate(e);else{if(this.activeState){var n=this.graph,i=e.item,a=i.getModel(),o=n.getCombos(),s=i.getBBox(),u=s.centerX,f=s.centerY,l=s.width,c=o.filter(function(h){var d=h.getModel();return a.parentId,d.id!==a.id&&!t.currentItemChildCombos.includes(d.id)});c.map(function(h){var d=h.getBBox(),v=d.centerX,p=d.centerY,g=d.width,y=u-v,m=f-p,b=2*Math.sqrt(y*y+m*m);l+g-b>.8*l?n.setItemState(h,t.activeState,!0):n.setItemState(h,t.activeState,!1)})}me(this.targets,function(h){t.updateCombo(h,e)}),this.onlyChangeComboSize&&this.updateParentCombos()}},updatePositions:function(e,t){var n=this;(this.enableDelegate||t)&&me(this.targets,function(i){n.updateCombo(i,e,t)})},onDrop:function(e){var t=this,n=e.item;if(this.currentShouldEnd=this.shouldEnd(e,n,this),this.updatePositions(e,!this.currentShouldEnd),!(!this.currentShouldEnd||!n||!this.targets||n.destroyed)){var i=this.graph,a=n.getModel();this.targets.map(function(o){var s=o.getModel();s.parentId!==a.id?(t.activeState&&i.setItemState(n,t.activeState,!1),t.onlyChangeComboSize?i.updateCombo(o):i.updateComboTree(o,a.id,!1)):i.updateCombo(n)}),this.end(n,e),this.endComparison=!0}},onNodeDrop:function(e){var t=this;if(!(!this.targets||this.targets.length===0)){var n=this.graph,i=e.item,a=i.getModel().comboId,o=a?n.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd(e,o,this),this.updatePositions(e,!this.currentShouldEnd),!!this.currentShouldEnd){var s;if(a){if(this.activeState){var u=n.findById(a);n.setItemState(u,this.activeState,!1)}this.targets.map(function(f){t.onlyChangeComboSize?n.updateCombo(f):a!==f.getID()&&(s=n.findById(a),a!==f.getModel().parentId&&n.updateComboTree(f,a,!1))})}else this.targets.map(function(f){if(t.onlyChangeComboSize)n.updateCombo(f);else{var l=f.getModel();l.comboId&&n.updateComboTree(f,void 0,!1)}});this.endComparison=!0,this.end(s,e)}}},onDragEnter:function(e){if(this.origin&&this.validationCombo(e)){var t=e.item,n=this.graph;this.activeState&&n.setItemState(t,this.activeState,!0)}},onDragLeave:function(e){if(this.origin&&this.validationCombo(e)){var t=e.item,n=this.graph;this.activeState&&n.setItemState(t,this.activeState,!1)}},onDragEnd:function(e){if(!(!this.targets||this.targets.length===0)){var t=e.item;this.currentShouldEnd&&this.updatePositions(e);var n=this.getParentCombo(t.getModel().parentId),i=this.graph;n&&this.activeState&&i.setItemState(n,this.activeState,!1),this.end(void 0,e)}},end:function(e,t){var n=this;if(this.origin){var i=this.graph;if(this.delegateShape){var a=i.get("delegateGroup");a.clear(),this.delegateShape=null}if(e&&this.activeState&&i.setItemState(e,this.activeState,!1),!e){var o=i.get("enabledStack")&&this.enableStack,s={before:{nodes:[],edges:[],combos:[].concat(this.get("beforeDragItems"))},after:{nodes:[],edges:[],combos:[]}};this.targets.map(function(u){if(!n.onlyChangeComboSize)i.updateComboTree(u,void 0,o);else{i.updateCombo(u);var f=u.getModel(),l=f.x,c=f.y,h=f.id;s.after.combos.push({x:l,y:c,id:h}),i.pushStack("update",s)}})}this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(e,t,n){var i=this;if(n===void 0&&(n={}),t(e,n)!==!1&&e){var a=e.get("combos");me(a,function(s){i.traverse(s,t,n)});var o=e.get("nodes");me(o,function(s){i.traverse(s,t,n)})}},updateCombo:function(e,t,n){this.updateSingleItem(e,t,n);var i={};this.traverse(e,function(a,o){return a.destroyed?!1:(a.getEdges().forEach(function(s){return o[s.getID()]=s}),!0)},i),Object.values(i).forEach(function(a){return a.refresh()})},updateSingleItem:function(e,t,n){var i=this.origin,a=this.graph,o=e.getModel(),s=e.get("id");this.point[s]||(this.point[s]={x:o.x,y:o.y});var u=t.x-i.x+this.point[s].x,f=t.y-i.y+this.point[s].y;n&&(u+=i.x-t.x,f+=i.y-t.y),a.updateItem(e,{x:u,y:f},!1)},getParentCombo:function(e){var t=this.graph;if(e){var n=t.findById(e);if(n)return n}},updateDelegate:function(e){var t=this.graph;if(this.delegateShape){var h=e.x-this.origin.x+this.originPoint.minX,d=e.y-this.origin.y+this.originPoint.minY;this.delegateShape.attr({x:h,y:d})}else{var n=t.get("delegateGroup"),i=null;this.targets.length>1?i=Tve(this.targets):i=this.targets[0].getBBox();var a=i.x,o=i.y,s=i.width,u=i.height,f=i.minX,l=i.minY;this.originPoint={x:a,y:o,width:s,height:u,minX:f,minY:l};var c=B(B({},bs.delegateStyle),this.delegateStyle);this.delegateShape=n.addShape("rect",{attrs:B({width:i.width,height:i.height,x:i.x,y:i.y},c),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}},updateParentCombos:function(){var e=this,t=e.graph,n=e.targets,i={};n==null||n.forEach(function(a){var o=a.getModel().parentId;o&&(i[o]=t.findById(o))}),Object.values(i).forEach(function(a){a&&t.updateCombo(a)})}};var qM="dblclick",Lve=["click","dblclick"];const Nve={getDefaultCfg:function(){return{trigger:qM,relayout:!0}},getEvents:function(){var e,t;return Lve.includes(this.trigger)?t=this.trigger:(t=qM,console.warn("Behavior collapse-expand-group 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),e={},e["combo:".concat(t)]="onComboClick",e},onComboClick:function(e){var t=e.item,n=this,i=n.graph,a=n.relayout;if(!(!t||t.destroyed||t.getType()!=="combo")){var o=t.getModel(),s=o.id;s&&(i.collapseExpandCombo(s),a&&i.get("layout")?i.layout():i.refreshPositions())}}};var Ove=Za.isPolygonsIntersect,Dve=Za.pathToPoints,ZM="shift",Pve=["drag","shift","ctrl","alt","control"],Rve=function(e,t){var n,i=e.getKeyShape();if(e.get("type")==="path")n=Dve(i.attr("path"));else{var a=i.getCanvasBBox();n=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]]}return Ove(t,n)};const Bve={getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:ZM,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return Pve.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=ZM,console.warn("Behavior lasso-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),this.trigger==="drag"?{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd","canvas:click":"clearStates"}:{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd",keyup:"onKeyUp",keydown:"onKeyDown","canvas:click":"clearStates"}},onDragStart:function(e){var t=this.lasso,n=e.item;n||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates("dragstart"),t||(t=this.createLasso()),this.dragging=!0,this.originPoint={x:e.x,y:e.y},this.points.push(this.originPoint),t.show())},onDragMove:function(e){this.dragging&&(this.trigger!=="drag"&&!this.keydown||(this.points.push({x:e.x,y:e.y}),this.updateLasso(e)))},onDragEnd:function(e){!this.lasso&&!this.dragging||this.trigger!=="drag"&&!this.keydown||(this.points.push(this.originPoint),this.getSelectedItems(),this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1)},getLassoPath:function(){var e=this.points,t=[];return e.length&&(e.forEach(function(n,i){i===0?t.push(["M",n.x,n.y]):t.push(["L",n.x,n.y])}),t.push(["L",e[0].x,e[0].y])),t},clearStates:function(e){e===void 0&&(e="canvas:click");var t=this,n=t.graph,i=t.selectedState,a=t.shouldDeselect,o=n.findAllByState("node",i),s=n.findAllByState("edge",i);(!a||a({action:e,nodes:o,edges:s}))&&(o.forEach(function(u){return n.setItemState(u,i,!1)}),s.forEach(function(u){return n.setItemState(u,i,!1)})),this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),this.selectedNodes=[],this.selectedEdges=[],n.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedItems:function(){var e=this,t=this,n=t.graph,i=t.shouldUpdate,a=this.points.map(function(l){return[n.getCanvasByPoint(l.x,l.y).x,n.getCanvasByPoint(l.x,l.y).y]}),o=this.selectedState,s=[],u=[];n.getNodes().forEach(function(l){if(l.isVisible()&&Rve(l,a)&&i(l,"select",e)){s.push(l);var c=l.getModel();u.push(c.id),n.setItemState(l,o,!0)}});var f=[];this.includeEdges&&s.forEach(function(l){var c=l.getOutEdges();c.forEach(function(h){if(h.isVisible()){var d=h.getModel(),v=d.source,p=d.target;u.includes(v)&&u.includes(p)&&i(h,"select",e)&&(f.push(h),n.setItemState(h,e.selectedState,!0))}})}),this.selectedEdges=f,this.selectedNodes=s,this.onSelect&&this.onSelect(s,f),n.emit("nodeselectchange",{selectedItems:{nodes:s,edges:f},select:!0})},createLasso:function(){var e=this,t=e.graph.get("delegateGroup").addShape("path",{attrs:B({path:[]},e.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=t,this.delegate=t,this.points=[],t},updateLasso:function(e){var t=this;this.lasso.attr({path:t.getLassoPath()})},onKeyDown:function(e){var t=e.key;t&&(t.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}};var KM="click",Fve=["click","drag"],QM=void 0,Gve=["shift","ctrl","control","alt","meta",void 0];const zve={getDefaultCfg:function(){return{trigger:KM,key:QM,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var e=this;Fve.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=KM,console.warn("Behavior create-edge 的 trigger 参数不合法,请输入 'click','drag'")),e.key&&Gve.indexOf(e.key.toLowerCase())===-1&&(e.trigger=QM,console.warn("Behavior create-edge 的 key 参数不合法,请输入 'shift','ctrl','alt','control',或 undefined"));var t;return e.trigger==="drag"?t={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:e.trigger==="click"&&(t={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),e.key&&(t.keydown="onKeyDown",t.keyup="onKeyUp"),t},onDragEnd:function(e){var t=this;if(!(t.key&&!t.keydown)){var n=e.item;(!n||n.getID()===t.source||n.getType()!=="node")&&t.cancelCreating({item:t.edge,x:e.x,y:e.y})}},onClick:function(e){var t=this;if(!(t.key&&!t.keydown)){var n=e.item,i=t.graph,a=n.getModel(),o=t.getEdgeConfig;if(t.addingEdge&&t.edge){if(!t.shouldEnd(e,t))return;var s=void 0;o&&Mr(o)?s=o({source:t.source,target:a.id},t):s=t.edgeConfig;var u=B({target:a.id},s);if(t.source===a.id&&(u.type="loop"),i.emit("beforecreateedge",{}),i.updateItem(t.edge,u,!1),i.get("enabledStack")){var f=B(B({},t.edge.getModel()),{itemType:"edge"}),l={};l.edges=[f],i.pushStack("add",{before:{},after:l})}i.emit("aftercreateedge",{edge:t.edge}),t.edge.getKeyShape().set("capture",!0),t.edge=null,t.addingEdge=!1}else{if(!t.shouldBegin(e,t))return;var s=void 0;o&&Mr(o)?s=o({source:a.id,target:a.id},t):s=t.edgeConfig,t.edge=i.addItem("edge",B({source:a.id,target:a.id},s),!1),t.source=a.id,t.addingEdge=!0,t.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(e){var t=this;if(!(t.key&&!t.keydown)){t.edge&&t.edge.destroyed&&t.cancelCreating({item:t.edge});var n={x:e.x,y:e.y};if(!t.graph.findById(t.source)){t.addingEdge=!1;return}t.addingEdge&&t.edge&&t.graph.updateItem(t.edge,{target:n},!1)}},cancelCreating:function(e){var t,n,i=this;if(!(i.key&&!i.keydown)){var a=i.graph,o=e.item;if(i.addingEdge&&(i.edge===o||!((n=(t=e.target)===null||t===void 0?void 0:t.isCanvas)===null||n===void 0)&&n.call(t))){i.edge&&!i.edge.destroyed&&a.removeItem(i.edge,!1),i.edge=null,i.addingEdge=!1;return}}},onKeyDown:function(e){var t=this,n=e.key;n&&(n.toLowerCase()===t.key.toLowerCase()?t.keydown=!0:t.keydown=!1)},onKeyUp:function(){var e=this;e.addingEdge&&e.edge&&(e.graph.removeItem(e.edge,!1),e.addingEdge=!1,e.edge=null),this.keydown=!1}};var JM="ctrl",$ve=["shift","ctrl","alt","control"],jve="1";const Uve={getDefaultCfg:function(){return{trigger:JM,combinedKey:jve,functionName:"fitView",functionParams:[]}},getEvents:function(){return $ve.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=JM,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(e){var t=e.key;if(t){var n=this.trigger.toLowerCase(),i=t.toLowerCase();this.triggerKeydown||(i===n||i==="control"&&n==="ctrl"||i==="ctrl"&&n==="control"?this.triggerKeydown=!0:this.triggerKeydown=!1);var a=this.graph;if(!a[this.functionName])return console.warn("Behavior shortcuts-fit-view 的 functionName 参数 '".concat(this.functionName,"' 不合法,它不是 Graph 的一个函数名")),{};if(this.triggerKeydown&&!this.combinedKey){this.functionParams&&this.functionParams.length?a[this.functionName].apply(a,this.functionParams):a[this.functionName]();return}var o=this.combinedKey.toLowerCase();this.triggerKeydown&&(i===o||i==="control"&&o==="ctrl"||i==="ctrl"&&o==="control")&&(this.functionParams&&this.functionParams.length?a[this.functionName].apply(a,this.functionParams):a[this.functionName]())}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.triggerKeydown=!1}};var Xve=["shift","ctrl","alt","control","meta"];const Yve={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0,allowDragOnItem:!0}},getEvents:function(){return(!this.zoomKey||Xve.indexOf(this.zoomKey)===-1)&&(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(e){var t=this;if(this.allowDrag(e)){var n=this.graph,i=Array.isArray(this.zoomKey)?[].concat(this.zoomKey):[this.zoomKey];i.includes("control")&&i.push("ctrl");var a=i.some(function(P){return e["".concat(P,"Key")]});if(a){var o=n.get("canvas"),s=o.getPointByClient(e.clientX,e.clientY),u=n.getZoom();e.wheelDelta>0?u=u+u*.05:u=u-u*.05,n.zoomTo(u,{x:s.x,y:s.y})}else{var f=e.deltaX||e.movementX,l=e.deltaY||e.movementY;!l&&navigator.userAgent.indexOf("Firefox")>-1&&(l=-e.wheelDelta*125/3);var c=this.graph.get("width"),h=this.graph.get("height"),d=this.graph.get("canvas").getCanvasBBox(),v=this.scalableRange,p=this.scalableRange;v<1&&v>-1&&(v=c*v,p=h*p);var g=d.minX,y=d.maxX,m=d.minY,b=d.maxY;f>0?y<-v?f=0:y-f<-v&&(f=y+v):f<0&&(g>c+v?f=0:g-f>c+v&&(f=g-(c+v))),l>0?b<-p?l=0:b-l<-p&&(l=b+p):l<0&&(m>h+p?l=0:m-l>h+p&&(l=m-(h+p))),this.get("direction")==="x"?l=0:this.get("direction")==="y"&&(f=0),n.translate(-f,-l)}e.preventDefault();var x=this.get("enableOptimize");if(x){var w=this.get("optimizeZoom"),E=this.get("optimized"),_=n.getNodes(),M=n.getEdges(),C=_.length,S=M.length;if(!E){for(var A=0;A<C;A++){var T=_[A];if(!T.destroyed)for(var k=T.get("group").get("children"),O=k.length,F=0;F<O;F++){var D=k[F];!D.destoryed&&!D.get("isKeyShape")&&(D.set("ori-visibility",D.get("ori-visibility")||D.get("visible")),D.hide())}}for(var $=0;$<S;$++)for(var Y=M[$],k=Y.get("group").get("children"),O=k.length,F=0;F<O;F++){var D=k[F];D.set("ori-visibility",D.get("ori-visibility")||D.get("visible")),D.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var N=setTimeout(function(){var P=n.getZoom(),W=t.get("optimized");if(W){t.set("optimized",!1);for(var J=0;J<C;J++){var te=_[J],H=te.get("group").get("children"),pe=H.length;if(P<w){var Te=te.getKeyShape(),Ne=Te.get("ori-visibility");Ne&&Te.show()}else for(var Ze=0;Ze<pe;Ze++){var at=H[Ze],Ne=at.get("ori-visibility");!at.get("visible")&&Ne&&Ne&&at.show()}}for(var nt=0;nt<S;nt++){var _t=M[nt],H=_t.get("group").get("children"),pe=H.length;if(P<w){var Te=_t.getKeyShape(),Ne=Te.get("ori-visibility");Ne&&Te.show()}else for(var Ze=0;Ze<pe;Ze++){var at=H[Ze];if(!at.get("visible")){var Ne=at.get("ori-visibility");Ne&&at.show()}}}}},100);this.set("timeout",N)}}},allowDrag:function(e){var t,n,i=e.target,a=i&&i.isCanvas&&i.isCanvas();if($l(this.allowDragOnItem)&&!this.allowDragOnItem&&!a)return!1;if(yn(this.allowDragOnItem)){var o=this.allowDragOnItem,s=o.node,u=o.edge,f=o.combo,l=(n=(t=e.item)===null||t===void 0?void 0:t.getType)===null||n===void 0?void 0:n.call(t);if(!s&&l==="node"||!u&&l==="edge"||!f&&l==="combo")return!1}return!0}};var Wve={"drag-canvas":pve,"zoom-canvas":_ve,"drag-node":gve,"activate-relations":yve,"brush-select":bve,"click-select":wve,"lasso-select":Bve,tooltip:Sve,"edge-tooltip":Mve,"collapse-expand":Ave,"drag-combo":kve,"collapse-expand-combo":Nve,"create-edge":zve,"shortcuts-call":Uve,"scroll-canvas":Yve};me(Wve,function(r,e){XI(e,r)});var Vve=B(B({},Sz),L7),Hve=Hn.Fisheye,qve=Hn.TimeBar,Zve=Hn.ImageMinimap,Kve=Hn.EdgeFilterLens,Qve=Hn.SnapLine,Jve=Hn.Annotation;const pp={version:bs.version,Graph:sD,TreeGraph:Ace,Util:Za,Layout:Ht.Layouts,TreeLayout:vce,registerLayout:pce,Global:bs,registerBehavior:XI,registerCombo:dU,registerEdge:UI,registerNode:Xa,Minimap:Hn.Minimap,Grid:Hn.Grid,Bundling:Hn.Bundling,Menu:Hn.Menu,ToolBar:Hn.ToolBar,Tooltip:Hn.Tooltip,Legend:Hn.Legend,TimeBar:qve,SnapLine:Qve,Fisheye:Hve,ImageMinimap:Zve,EdgeFilterLens:Kve,Annotation:Jve,Algorithm:Vve,Arrow:FI,Marker:GI,Shape:mr};pp.version="4.8.23";pp.registerNode("file-node",{draw(r,e){const t=e.addShape("rect",{name:"rect-shape",attrs:{x:0,y:0,fill:"#fff",stroke:null}});return r.children.length==0||e.addShape("marker",{name:"marker-shape",attrs:{symbol:"triangle-down",x:0,y:0,r:4,fill:"#767c82"}}),e.addShape("text",{name:"text-shape",attrs:{x:6,y:8,fontSize:16,text:r.label,fill:r.tracked?"#00f":"#333639",textAlign:"left",fontFamily:window.getComputedStyle(document.body,null).getPropertyValue("font-family")}}),t}});pp.registerEdge("step-line",{getControlPoints(r){const e=r.startPoint,t=r.endPoint;return[e,{x:e==null?void 0:e.x,y:t==null?void 0:t.y},t]}},"polyline");const rpe=M5({__name:"TrackGraph",props:{track:{}},setup(r){const e=r,t=C5(()=>{var c;const o=Array.from(e.track.nodes).reverse(),s=(c=e.track.nodes[e.track.selector.targetIndex])==null?void 0:c.id,u=(()=>{const h=o.reduce((d,v)=>v.id<d.id?v:d,o[0]);return h.parent&&o.some(d=>d!==h&&d.pid==h.pid)?h.parent:h})(),f=new Set;f.add(u),o.forEach(h=>{f.add(h);let d=h;for(;d&&d!==u;)f.add(d),d=d.parent});const l=Array.from(f).map(h=>({_node:h,children:[],id:h.id.toString(),label:ww(h),tracked:s===h.id}));return l.sort((h,d)=>h._node.id-d._node.id),l.forEach(h=>{const d=l.find(v=>v.id===h._node.pid.toString());d&&d.children.push(h)}),l.forEach(h=>{if(h.children.length<h._node.children.length){const d=[],v=()=>{for(;d.length>0;)d.pop()},p=()=>{if(d.length==0)return;const g=d[0].parent.children,y=d[0];if(g.length>1&&g.indexOf(y)==1&&g.indexOf(d.at(-1))==g.length-1){v();return}h.children.push({_node:y,children:[],id:y.id.toString(),label:d.length==1?ww(y):`[${g.indexOf(y)} ... ${g.indexOf(d.at(-1))}]`,tracked:s===y.id}),v()};h._node.children.forEach(g=>{h.children.find(y=>y.id===g.id.toString())?p():d.push(g)}),d.length>0&&p(),h.children.sort((g,y)=>h._node.children.indexOf(g._node)-h._node.children.indexOf(y._node))}}),l}),n=A5();let i;T5(()=>{if(!n.value)return;i==null||i.destroy();const o=n.value.scrollWidth,s=n.value.scrollHeight||o;i=new pp.TreeGraph({container:n.value,width:o,height:s,modes:{default:["drag-canvas","zoom-canvas"]},layout:{type:"indented",indent:25,getHeight(){return 10}}}),i.node(c=>({type:"file-node"})),i.edge(c=>{if(c.id&&c.id.startsWith("-")){const h=Number.parseInt(c.source)>Number.parseInt(c.target)?-1:1,d=String(c.connect),v=Number(c.count);let p=40;if(d.startsWith("<<")){let y=u.find(b=>b.id.toString()==c.source).parent,m=1;for(;y&&y.id.toString()!=c.target;)y=y.parent,m++;m>1&&(p+=m*20)}return v>1&&(p+=(v-1)*20),p*=h,{type:"quadratic",color:"#ff00ff80",curveOffset:p,style:{startArrow:!0},label:d,labelCfg:{style:{fill:"#f00",fontSize:12,background:{fill:"#ffffff",stroke:"#f0f",lineWidth:1,padding:[2,1,0,1],radius:2}}}}}return{type:"step-line"}}),i.data({...t.value[0]}),i.render();const u=Array.from(e.track.nodes),f=e.track.selector.connectKeys,l={};u.forEach((c,h)=>{const d=u[h+1];if(d&&i){const v=d.id>c.id?`-${c.id}:${d.id}`:`-${d.id}:${c.id}`;l[v]=(l[v]||0)+1;const p=`${v}/${l[v]}`,g=f[f.length-h-1],y={"+":()=>d.parent.children.slice(0,d.parent.children.indexOf(d)).reverse().indexOf(c),"-":()=>d.parent.children.slice(d.parent.children.indexOf(d)+1).indexOf(c),">":()=>{let m=0,b=d.parent;for(;b;){if(b===c)return m;b=b.parent,m++}return m},"<":()=>d.children.indexOf(c),"<<":()=>{let m=0;const b=Array.from(d.children).reverse();for(;b.length>0;){const x=b.pop();if(x===c)return m;b.push(...Array.from(x.children).reverse()),m++}return m}}[g]()+1;i.addItem("edge",{source:c.id.toString(),target:d.id.toString(),id:p,connect:y>1?g+y:g,count:l[v]},!1)}}),i.fitView(30)}),xw(()=>{i==null||i.destroy()});const a=()=>{!i||i.get("destroyed")||!n.value||!n.value||!n.value.scrollWidth||!n.value.scrollHeight||i.changeSize(n.value.scrollWidth,n.value.scrollHeight)};return window.addEventListener("resize",a),xw(()=>{window.removeEventListener("resize",a)}),(o,s)=>(I5(),k5("div",{ref_key:"container",ref:n},null,512))}});export{rpe as default};
|
|
670
|
-
//# sourceMappingURL=TrackGraph-Cb4XqKyq.js.map
|