- services/pve.go: 导入 db 包,DB -> db.DB
- handlers/pve.go: 重写为 Gin 风格(原为标准库 net/http)
- go.mod/go.sum: go mod tidy 更新依赖
- web/dist: 重新构建前端包含 PVEHosts 页面
[金渐层/K2.6-code-preview🐾]
468 lines
1.3 MiB
468 lines
1.3 MiB
import{ak as Ka,al as bi,am as me,k as EP,L as _P,an as SP,a3 as MP,K as AP,o as iw,c as CP,a as rc,e as ow,m as TP,w as IP,M as kP,n as NP,ao as OP,G as LP,d as DP,h as PP}from"./index-BFjouPFU.js";import{_ as RP}from"./_plugin-vue_export-helper-DlAUqK2U.js";function FP(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in t)){const i=Object.getOwnPropertyDescriptor(n,a);i&&Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}const ty=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return Ea},get Circle(){return b9},get Ellipse(){return w9},get Image(){return x9},get Line(){return E9},get Marker(){return S9},get Path(){return Ky},get Polygon(){return N9},get Polyline(){return O9},get Rect(){return P9},get Text(){return R9}},Symbol.toStringTag,{value:"Module"})),ry=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return aa},get Circle(){return z9},get Dom(){return j9},get Ellipse(){return U9},get Image(){return $9},get Line(){return X9},get Marker(){return W9},get Path(){return V9},get Polygon(){return Y9},get Polyline(){return q9},get Rect(){return Z9},get Text(){return e7}},Symbol.toStringTag,{value:"Module"}));var b0=function(t,e){return b0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},b0(t,e)};function jt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");b0(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var P=function(){return P=Object.assign||function(e){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},P.apply(this,arguments)};function Kr(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(t);a<n.length;a++)e.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(t,n[a])&&(r[n[a]]=t[n[a]]);return r}function dS(t,e,r,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(a<3?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i}function vS(t,e){return function(r,n){e(r,n,t)}}function pS(t,e,r,n,a,i){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&&t?n.static?t:t.prototype:null,l=e||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),c,h=!1,d=r.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");i.push(o(y||null))};var g=(0,r[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))&&a.unshift(c)}else(c=o(g))&&(s==="field"?a.unshift(c):l[u]=c)}f&&Object.defineProperty(f,n.name,l),h=!0}function gS(t,e,r){for(var n=arguments.length>2,a=0;a<e.length;a++)r=n?e[a].call(t,r):e[a].call(t);return n?r:void 0}function yS(t){return typeof t=="symbol"?t:"".concat(t)}function mS(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function bS(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Bn(t,e,r,n){function a(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,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?i(l.value):a(l.value).then(s,u)}f((n=n.apply(t,e||[])).next())})}function Gn(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.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]&&(r=0)),r;)try{if(n=1,a&&(i=f[0]&2?a.return:f[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,f[1])).done)return i;switch(a=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,a=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){r.label=f[1];break}if(f[0]===6&&r.label<i[1]){r.label=i[1],i=f;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(f);break}i[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],a=0}finally{n=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}var pd=Object.create?function(t,e,r,n){n===void 0&&(n=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,a)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};function wS(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&pd(e,t,r)}function _h(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ny(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),a,i=[],o;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)i.push(a.value)}catch(s){o={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function xS(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(ny(arguments[e]));return t}function ay(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),a=0,e=0;e<r;e++)for(var i=arguments[e],o=0,s=i.length;o<s;o++,a++)n[a]=i[o];return n}function Xn(t,e,r){if(r||arguments.length===2)for(var n=0,a=e.length,i;n<a;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Hs(t){return this instanceof Hs?(this.v=t,this):new Hs(t)}function ES(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),a,i=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",o),a[Symbol.asyncIterator]=function(){return this},a;function o(d){return function(v){return Promise.resolve(v).then(d,c)}}function s(d,v){n[d]&&(a[d]=function(p){return new Promise(function(g,y){i.push([d,p,g,y])>1||u(d,p)})},v&&(a[d]=v(a[d])))}function u(d,v){try{f(n[d](v))}catch(p){h(i[0][3],p)}}function f(d){d.value instanceof Hs?Promise.resolve(d.value.v).then(l,c):h(i[0][2],d)}function l(d){u("next",d)}function c(d){u("throw",d)}function h(d,v){d(v),i.shift(),i.length&&u(i[0][0],i[0][1])}}function _S(t){var e,r;return e={},n("next"),n("throw",function(a){throw a}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(a,i){e[a]=t[a]?function(o){return(r=!r)?{value:Hs(t[a](o)),done:!1}:i?i(o):o}:i}}function SS(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof _h=="function"?_h(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(s,u){o=t[i](o),a(s,u,o.done,o.value)})}}function a(i,o,s,u){Promise.resolve(u).then(function(f){i({value:f,done:s})},o)}}function MS(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var BP=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},w0=function(t){return w0=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},w0(t)};function AS(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=w0(t),n=0;n<r.length;n++)r[n]!=="default"&&pd(e,t,r[n]);return BP(e,t),e}function CS(t){return t&&t.__esModule?t:{default:t}}function TS(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function IS(t,e,r,n,a){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?a.call(t,r):a?a.value=r:e.set(t,r),r}function kS(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function NS(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,a;if(r){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],r&&(a=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");a&&(n=function(){try{a.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}var GP=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};function OS(t){function e(i){t.error=t.hasError?new GP(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(a,function(o){return e(o),a()})}else n|=1}catch(o){e(o)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}function LS(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,a,i,o){return n?e?".jsx":".js":a&&(!i||!o)?r:a+i+"."+o.toLowerCase()+"js"}):t}const zP={__extends:jt,__assign:P,__rest:Kr,__decorate:dS,__param:vS,__esDecorate:pS,__runInitializers:gS,__propKey:yS,__setFunctionName:mS,__metadata:bS,__awaiter:Bn,__generator:Gn,__createBinding:pd,__exportStar:wS,__values:_h,__read:ny,__spread:xS,__spreadArrays:ay,__spreadArray:Xn,__await:Hs,__asyncGenerator:ES,__asyncDelegator:_S,__asyncValues:SS,__makeTemplateObject:MS,__importStar:AS,__importDefault:CS,__classPrivateFieldGet:TS,__classPrivateFieldSet:IS,__classPrivateFieldIn:kS,__addDisposableResource:NS,__disposeResources:OS,__rewriteRelativeImportExtension:LS},jP=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:NS,get __assign(){return P},__asyncDelegator:_S,__asyncGenerator:ES,__asyncValues:SS,__await:Hs,__awaiter:Bn,__classPrivateFieldGet:TS,__classPrivateFieldIn:kS,__classPrivateFieldSet:IS,__createBinding:pd,__decorate:dS,__disposeResources:OS,__esDecorate:pS,__exportStar:wS,__extends:jt,__generator:Gn,__importDefault:CS,__importStar:AS,__makeTemplateObject:MS,__metadata:bS,__param:vS,__propKey:yS,__read:ny,__rest:Kr,__rewriteRelativeImportExtension:LS,__runInitializers:gS,__setFunctionName:mS,__spread:xS,__spreadArray:Xn,__spreadArrays:ay,__values:_h,default:zP},Symbol.toStringTag,{value:"Module"}));var On=function(t){return t!==null&&typeof t!="function"&&isFinite(t.length)},Sh=function(t,e){return On(t)?t.indexOf(e)>-1:!1},DS=function(t,e){if(!On(t))return t;for(var r=[],n=0;n<t.length;n++){var a=t[n];e(a,n)&&r.push(a)}return r},UP=function(t,e){return e===void 0&&(e=[]),DS(t,function(r){return!Sh(e,r)})},$P={}.toString,xa=function(t,e){return $P.call(t)==="[object "+e+"]"};const Tr=function(t){return xa(t,"Function")};var Zt=function(t){return t==null};const bt=function(t){return Array.isArray?Array.isArray(t):xa(t,"Array")},gn=function(t){var e=typeof t;return t!==null&&e==="object"||e==="function"};function _e(t,e){if(t){var r;if(bt(t))for(var n=0,a=t.length;n<a&&(r=e(t[n],n),r!==!1);n++);else if(gn(t)){for(var i in t)if(t.hasOwnProperty(i)&&(r=e(t[i],i),r===!1))break}}}var PS=Object.keys?function(t){return Object.keys(t)}:function(t){var e=[];return _e(t,function(r,n){Tr(t)&&n==="prototype"||e.push(n)}),e};function RS(t,e){var r=PS(e),n=r.length;if(Zt(t))return!n;for(var a=0;a<n;a+=1){var i=r[a];if(e[i]!==t[i]||!(i in t))return!1}return!0}var Mh=function(t){return typeof t=="object"&&t!==null},ln=function(t){if(!Mh(t)||!xa(t,"Object"))return!1;if(Object.getPrototypeOf(t)===null)return!0;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function XP(t,e){if(!bt(t))return null;var r;if(Tr(e)&&(r=e),ln(e)&&(r=function(a){return RS(a,e)}),r){for(var n=0;n<t.length;n+=1)if(r(t[n]))return t[n]}return null}function WP(t,e,r){r===void 0&&(r=0);for(var n=r;n<t.length;n++)if(e(t[n],n))return n;return-1}var VP=function(t,e){for(var r=null,n=0;n<t.length;n++){var a=t[n],i=a[e];if(!Zt(i)){bt(i)?r=i[0]:r=i;break}}return r},YP=function(t){if(!bt(t))return[];for(var e=[],r=0;r<t.length;r++)e=e.concat(t[r]);return e},FS=function(t,e){if(e===void 0&&(e=[]),!bt(t))e.push(t);else for(var r=0;r<t.length;r+=1)FS(t[r],e);return e};const qa=function(t){if(bt(t))return t.reduce(function(e,r){return Math.max(e,r)},t[0])},Ha=function(t){if(bt(t))return t.reduce(function(e,r){return Math.min(e,r)},t[0])};var qP=function(t){var e=t.filter(function(o){return!isNaN(o)});if(!e.length)return{min:0,max:0};if(bt(t[0])){for(var r=[],n=0;n<t.length;n++)r=r.concat(t[n]);e=r}var a=qa(e),i=Ha(e);return{min:i,max:a}},BS=Array.prototype,HP=BS.splice,ZP=BS.indexOf,KP=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n++)for(var a=e[n],i=-1;(i=ZP.call(t,a))>-1;)HP.call(t,i,1);return t},QP=Array.prototype.splice,GS=function(e,r){if(!On(e))return[];for(var n=e?r.length:0,a=n-1;n--;){var i=void 0,o=r[n];(n===a||o!==i)&&(i=o,QP.call(e,o,1))}return e},zS=function(t,e,r){if(!bt(t)&&!ln(t))return t;var n=r;return _e(t,function(a,i){n=e(n,a,i)}),n},JP=function(t,e){var r=[];if(!On(t))return r;for(var n=-1,a=[],i=t.length;++n<i;){var o=t[n];e(o,n,t)&&(r.push(o),a.push(n))}return GS(t,a),r};const Ye=function(t){return xa(t,"String")};function eR(t,e){var r;if(Tr(e))r=function(a,i){return e(a)-e(i)};else{var n=[];Ye(e)?n.push(e):bt(e)&&(n=e),r=function(a,i){for(var o=0;o<n.length;o+=1){var s=n[o];if(a[s]>i[s])return 1;if(a[s]<i[s])return-1}return 0}}return t.sort(r),t}function kf(t,e){e===void 0&&(e=new Map);var r=[];if(Array.isArray(t))for(var n=0,a=t.length;n<a;n++){var i=t[n];e.has(i)||(r.push(i),e.set(i,!0))}return r}var tR=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return kf([].concat.apply([],t))};const rR=function(t,e){for(var r=[],n={},a=0;a<t.length;a++){var i=t[a],o=i[e];if(!Zt(o)){bt(o)||(o=[o]);for(var s=0;s<o.length;s++){var u=o[s];n[u]||(r.push(u),n[u]=!0)}}}return r};function nR(t){if(On(t))return t[0]}function aR(t){if(On(t)){var e=t;return e[e.length-1]}}function iR(t,e){return bt(t)||Ye(t)?t[0]===e:!1}function oR(t,e){return bt(t)||Ye(t)?t[t.length-1]===e:!1}var sR=function(t,e){for(var r=0;r<t.length;r++)if(!e(t[r],r))return!1;return!0},uR=function(t,e){for(var r=0;r<t.length;r++)if(e(t[r],r))return!0;return!1},fR=Object.prototype.hasOwnProperty;function Ah(t,e){if(!e||!bt(t))return{};for(var r={},n=Tr(e)?e:function(s){return s[e]},a,i=0;i<t.length;i++){var o=t[i];a=n(o),fR.call(r,a)?r[a].push(o):r[a]=[o]}return r}function jS(t,e){if(!e)return{0:t};if(!Tr(e)){var r=bt(e)?e:e.replace(/\s+/g,"").split("*");e=function(n){for(var a="_",i=0,o=r.length;i<o;i++)a+=n[r[i]]&&n[r[i]].toString();return a}}return Ah(t,e)}const lR=function(t,e){if(!e)return[t];var r=jS(t,e),n=[];for(var a in r)n.push(r[a]);return n};function cR(t,e){return t["_wrap_"+e]}function Bs(t,e){if(t["_wrap_"+e])return t["_wrap_"+e];var r=function(n){t[e](n)};return t["_wrap_"+e]=r,r}var sw={};function hR(t){var e=sw[t];if(!e){for(var r=t.toString(16),n=r.length;n<6;n++)r="0"+r;e="#"+r,sw[t]=e}return e}function dR(t){var e=0,r=0,n=0,a=0;return bt(t)?t.length===1?e=r=n=a=t[0]:t.length===2?(e=n=t[0],r=a=t[1]):t.length===3?(e=t[0],r=a=t[1],n=t[2]):(e=t[0],r=t[1],n=t[2],a=t[3]):e=r=n=a=t,{r1:e,r2:r,r3:n,r4:a}}var vR=function(t,e,r){return t<e?e:t>r?r:t},pR=function(t,e){var r=e.toString(),n=r.indexOf(".");if(n===-1)return Math.round(t);var a=r.substr(n+1).length;return a>20&&(a=20),parseFloat(t.toFixed(a))},Ot=function(t){return xa(t,"Number")},gR=function(t){return Ot(t)&&t%1!==0},yR=function(t){return Ot(t)&&t%2===0},mR=Number.isInteger?Number.isInteger:function(t){return Ot(t)&&t%1===0},bR=function(t){return Ot(t)&&t<0},wR=1e-5;function US(t,e,r){return r===void 0&&(r=wR),Math.abs(t-e)<r}var xR=function(t){return Ot(t)&&t%2!==0},ER=function(t){return Ot(t)&&t>0};const _R=function(t,e){if(bt(t)){for(var r,n=-1/0,a=0;a<t.length;a++){var i=t[a],o=Tr(e)?e(i):i[e];o>n&&(r=i,n=o)}return r}},SR=function(t,e){if(bt(t)){for(var r,n=1/0,a=0;a<t.length;a++){var i=t[a],o=Tr(e)?e(i):i[e];o<n&&(r=i,n=o)}return r}};var gd=function(t,e){return(t%e+e)%e},MR=180/Math.PI,AR=function(t){return MR*t};const CR=parseInt;var TR=Math.PI/180,yd=function(t){return TR*t};const uw=function(t,e){return t.hasOwnProperty(e)};var iy=Object.values?function(t){return Object.values(t)}:function(t){var e=[];return _e(t,function(r,n){Tr(t)&&n==="prototype"||e.push(r)}),e};const IR=function(t,e){return Sh(iy(t),e)},vu=function(t){return Zt(t)?"":t.toString()};var kR=function(t){return vu(t).toLowerCase()},NR=function(t){var e=vu(t);return e.charAt(0).toLowerCase()+e.substring(1)};function OR(t,e){return!t||!e?t:t.replace(/\\?\{([^{}]+)\}/g,function(r,n){return r.charAt(0)==="\\"?r.slice(1):e[n]===void 0?"":e[n]})}var LR=function(t){return vu(t).toUpperCase()},Zs=function(t){var e=vu(t);return e.charAt(0).toUpperCase()+e.substring(1)},DR={}.toString,$S=function(t){return DR.call(t).replace(/^\[object /,"").replace(/]$/,"")},PR=function(t){return xa(t,"Arguments")},Qf=function(t){return xa(t,"Boolean")},RR=function(t){return xa(t,"Date")},FR=function(t){return xa(t,"Error")};function BR(t){return Ot(t)&&isFinite(t)}var GR=function(t){return t===null},zR=Object.prototype,XS=function(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||zR;return t===r},jR=function(t){return xa(t,"RegExp")},UR=function(t){return t===void 0},$R=function(t){return t instanceof Element||t instanceof HTMLDocument};function WS(t){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(r){return setTimeout(r,16)};return e(t)}function VS(t){var e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;e(t)}function up(t,e){for(var r in e)e.hasOwnProperty(r)&&r!=="constructor"&&e[r]!==void 0&&(t[r]=e[r])}function Et(t,e,r,n){return e&&up(t,e),r&&up(t,r),n&&up(t,n),t}var XR=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=t[0],n=1;n<t.length;n++){var a=t[n];Tr(a)&&(a=a.prototype),Et(r.prototype,a)}},rr=function(t){if(typeof t!="object"||t===null)return t;var e;if(bt(t)){e=[];for(var r=0,n=t.length;r<n;r++)typeof t[r]=="object"&&t[r]!=null?e[r]=rr(t[r]):e[r]=t[r]}else{e={};for(var a in t)typeof t[a]=="object"&&t[a]!=null?e[a]=rr(t[a]):e[a]=t[a]}return e};function oy(t,e,r){var n;return function(){var a=this,i=arguments,o=function(){n=null,r||t.apply(a,i)},s=r&&!n;clearTimeout(n),n=setTimeout(o,e),s&&t.apply(a,i)}}const YS=function(t,e){if(!Tr(t))throw new TypeError("Expected a function");var r=function(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];var i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return o.set(i,s),s};return r.cache=new Map,r};var WR=5;function qS(t,e,r,n){r=r||0,n=n||WR;for(var a in e)if(e.hasOwnProperty(a)){var i=e[a];i!==null&&ln(i)?(ln(t[a])||(t[a]={}),r<n?qS(t[a],i,r+1,n):t[a]=e[a]):bt(i)?(t[a]=[],t[a]=t[a].concat(i)):i!==void 0&&(t[a]=i)}}var _r=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)qS(t,e[n]);return t},VR=function(t,e,r,n){Tr(e)||(r=e,e=t,t=function(){});var a=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},i=a(e.prototype,t);return t.prototype=Et(i,t.prototype),t.superclass=a(e.prototype,e),Et(i,r),Et(t,n),t},YR=function(t,e){if(!On(t))return-1;var r=Array.prototype.indexOf;if(r)return r.call(t,e);for(var n=-1,a=0;a<t.length;a++)if(t[a]===e){n=a;break}return n},qR=Object.prototype.hasOwnProperty;function HR(t){if(Zt(t))return!0;if(On(t))return!t.length;var e=$S(t);if(e==="Map"||e==="Set")return!t.size;if(XS(t))return!Object.keys(t).length;for(var r in t)if(qR.call(t,r))return!1;return!0}var jo=function(t,e){if(t===e)return!0;if(!t||!e||Ye(t)||Ye(e))return!1;if(On(t)||On(e)){if(t.length!==e.length)return!1;for(var r=!0,n=0;n<t.length&&(r=jo(t[n],e[n]),!!r);n++);return r}if(Mh(t)||Mh(e)){var a=Object.keys(t),i=Object.keys(e);if(a.length!==i.length)return!1;for(var r=!0,n=0;n<a.length&&(r=jo(t[a[n]],e[a[n]]),!!r);n++);return r}return!1};const ZR=function(t,e,r){return Tr(r)?!!r(t,e):jo(t,e)};var KR=function(t,e){if(!On(t))return t;for(var r=[],n=0;n<t.length;n++){var a=t[n];r.push(e(a,n))}return r},QR=function(t){return t};const JR=function(t,e){e===void 0&&(e=QR);var r={};return gn(t)&&!Zt(t)&&Object.keys(t).forEach(function(n){r[n]=e(t[n],n)}),r},HS=function(t,e,r){for(var n=0,a=Ye(e)?e.split("."):e;t&&n<a.length;)t=t[a[n++]];return t===void 0||n<a.length?r:t},e3=function(t,e,r){var n=t,a=Ye(e)?e.split("."):e;return a.forEach(function(i,o){o<a.length-1?(gn(n[i])||(n[i]=Ot(a[o+1])?[]:{}),n=n[i]):n[i]=r}),t};var t3=Object.prototype.hasOwnProperty;const r3=function(t,e){if(t===null||!ln(t))return{};var r={};return _e(e,function(n){t3.call(t,n)&&(r[n]=t[n])}),r},n3=function(t,e){return zS(t,function(r,n,a){return e.includes(a)||(r[a]=n),r},{})},Ch=function(t,e,r){var n,a,i,o,s=0;r||(r={});var u=function(){s=r.leading===!1?0:Date.now(),n=null,o=t.apply(a,i),n||(a=i=null)},f=function(){var l=Date.now();!s&&r.leading===!1&&(s=l);var c=e-(l-s);return a=this,i=arguments,c<=0||c>e?(n&&(clearTimeout(n),n=null),s=l,o=t.apply(a,i),n||(a=i=null)):!n&&r.trailing!==!1&&(n=setTimeout(u,c)),o};return f.cancel=function(){clearTimeout(n),s=0,n=a=i=null},f},ZS=function(t){return On(t)?Array.prototype.slice.call(t):[]};var nc={};const Ji=function(t){return t=t||"g",nc[t]?nc[t]+=1:nc[t]=1,t+nc[t]},sf=function(){},a3=function(t){return t};function i3(t){return Zt(t)?0:On(t)?t.length:Object.keys(t).length}var ac;const uf=YS(function(t,e){e===void 0&&(e={});var r=e.fontSize,n=e.fontFamily,a=e.fontWeight,i=e.fontStyle,o=e.fontVariant;return ac||(ac=document.createElement("canvas").getContext("2d")),ac.font=[i,o,a,r+"px",n].join(" "),ac.measureText(Ye(t)?t:"").width},function(t,e){return e===void 0&&(e={}),ay([t],iy(e)).join("")}),o3=function(t,e,r,n){n===void 0&&(n="...");var a=16,i=uf(n,r),o=Ye(t)?t:vu(t),s=e,u=[],f,l;if(uf(t,r)<=e)return t;for(;f=o.substr(0,a),l=uf(f,r),!(l+i>s&&l>s);)if(u.push(f),s-=l,o=o.substr(a),!o)return u.join("");for(;f=o.substr(0,1),l=uf(f,r),!(l+i>s);)if(u.push(f),s-=l,o=o.substr(1),!o)return u.join("");return""+u.join("")+n};var s3=function(){function t(){this.map={}}return t.prototype.has=function(e){return this.map[e]!==void 0},t.prototype.get=function(e,r){var n=this.map[e];return n===void 0?r:n},t.prototype.set=function(e,r){this.map[e]=r},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(e){delete this.map[e]},t.prototype.size=function(){return Object.keys(this.map).length},t}();const u3=Object.freeze(Object.defineProperty({__proto__:null,Cache:s3,assign:Et,augment:XR,clamp:vR,clearAnimationFrame:VS,clone:rr,contains:Sh,debounce:oy,deepMix:_r,difference:UP,each:_e,endsWith:oR,every:sR,extend:VR,filter:DS,find:XP,findIndex:WP,firstValue:VP,fixedBase:pR,flatten:YP,flattenDeep:FS,forIn:_e,get:HS,getEllipsisText:o3,getRange:qP,getType:$S,getWrapBehavior:cR,group:lR,groupBy:Ah,groupToMap:jS,has:uw,hasKey:uw,hasValue:IR,head:nR,identity:a3,includes:Sh,indexOf:YR,isArguments:PR,isArray:bt,isArrayLike:On,isBoolean:Qf,isDate:RR,isDecimal:gR,isElement:$R,isEmpty:HR,isEqual:jo,isEqualWith:ZR,isError:FR,isEven:yR,isFinite:BR,isFunction:Tr,isInteger:mR,isMatch:RS,isNegative:bR,isNil:Zt,isNull:GR,isNumber:Ot,isNumberEqual:US,isObject:gn,isObjectLike:Mh,isOdd:xR,isPlainObject:ln,isPositive:ER,isPrototype:XS,isRegExp:jR,isString:Ye,isType:xa,isUndefined:UR,keys:PS,last:aR,lowerCase:kR,lowerFirst:NR,map:KR,mapValues:JR,max:qa,maxBy:_R,measureTextWidth:uf,memoize:YS,min:Ha,minBy:SR,mix:Et,mod:gd,noop:sf,number2color:hR,omit:n3,parseRadius:dR,pick:r3,pull:KP,pullAt:GS,reduce:zS,remove:JP,requestAnimationFrame:WS,set:e3,size:i3,some:uR,sortBy:eR,startsWith:iR,substitute:OR,throttle:Ch,toArray:ZS,toDegree:AR,toInteger:CR,toRadian:yd,toString:vu,union:tR,uniq:kf,uniqueId:Ji,upperCase:LR,upperFirst:Zs,values:iy,valuesOfKey:rR,wrapBehavior:Bs},Symbol.toStringTag,{value:"Module"})),f3={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 r=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),_e(n,function(a,i){e.on(i,a)}),document.addEventListener("visibilitychange",function(){r.keydown=!1})},unbind:function(e){var r=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),_e(r,function(a,i){e.off(i,a)}),e.get("canvas").set("draggable",n)},get:function(e){return this[e]},set:function(e,r){return this[e]=r,this}};var sy=function(){function t(){}return t.registerBehavior=function(e,r){if(!r)throw new Error("please specify handler for this behavior: ".concat(e));var n=rr(f3);Object.assign(n,r);var a=function(o){var s=this;Object.assign(this,this.getDefaultCfg(),o);var u=this.getEvents();this.events=null;var f={};u&&(_e(u,function(l,c){f[c]=Bs(s,l)}),this.events=f)};a.prototype=n,t.types[e]=a},t.hasBehavior=function(e){return!!t.types[e]},t.getBehavior=function(e){return t.types[e]},t.types={},t}(),l3="*",KS=function(){function t(){this._events={}}return t.prototype.on=function(e,r,n){return this._events[e]||(this._events[e]=[]),this._events[e].push({callback:r,once:!!n}),this},t.prototype.once=function(e,r){return this.on(e,r,!0)},t.prototype.emit=function(e){for(var r=this,n=[],a=1;a<arguments.length;a++)n[a-1]=arguments[a];var i=this._events[e]||[],o=this._events[l3]||[],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 r._events[e],f--,l--),h.apply(r,n)}};s(i),s(o)},t.prototype.off=function(e,r){if(!e)this._events={};else if(!r)delete this._events[e];else{for(var n=this._events[e]||[],a=n.length,i=0;i<a;i++)n[i].callback===r&&(n.splice(i,1),a--,i--);n.length===0&&delete this._events[e]}return this},t.prototype.getEvents=function(){return this._events},t}(),pt=1e-6,qt=typeof Float32Array<"u"?Float32Array:Array,ya=Math.random,QS="zyx";function Ba(t){return t>=0?Math.round(t):t%.5===0?Math.floor(t):Math.round(t)}function c3(t){qt=t}var h3=Math.PI/180,d3=180/Math.PI;function v3(t){return t*h3}function p3(t){return t*d3}function g3(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:pt;return Math.abs(t-e)<=r*Math.max(1,Math.abs(t),Math.abs(e))}const y3=Object.freeze(Object.defineProperty({__proto__:null,ANGLE_ORDER:QS,get ARRAY_TYPE(){return qt},EPSILON:pt,RANDOM:ya,equals:g3,round:Ba,setMatrixArrayType:c3,toDegree:p3,toRadian:v3},Symbol.toStringTag,{value:"Module"}));function m3(){var t=new qt(4);return qt!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function b3(t){var e=new qt(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function w3(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function x3(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function E3(t,e,r,n){var a=new qt(4);return a[0]=t,a[1]=e,a[2]=r,a[3]=n,a}function _3(t,e,r,n,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t}function S3(t,e){if(t===e){var r=e[1];t[1]=e[2],t[2]=r}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function M3(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=r*i-a*n;return o?(o=1/o,t[0]=i*o,t[1]=-n*o,t[2]=-a*o,t[3]=r*o,t):null}function A3(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t}function C3(t){return t[0]*t[3]-t[2]*t[1]}function JS(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r[0],u=r[1],f=r[2],l=r[3];return t[0]=n*s+i*u,t[1]=a*s+o*u,t[2]=n*f+i*l,t[3]=a*f+o*l,t}function T3(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+i*s,t[1]=a*u+o*s,t[2]=n*-s+i*u,t[3]=a*-s+o*u,t}function I3(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r[0],u=r[1];return t[0]=n*s,t[1]=a*s,t[2]=i*u,t[3]=o*u,t}function k3(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t}function N3(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function O3(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function L3(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3])}function D3(t,e,r,n){return t[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-t[2]*r[1],[t,e,r]}function P3(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function eM(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function R3(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function F3(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=e[0],s=e[1],u=e[2],f=e[3];return Math.abs(r-o)<=pt*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=pt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(a-u)<=pt*Math.max(1,Math.abs(a),Math.abs(u))&&Math.abs(i-f)<=pt*Math.max(1,Math.abs(i),Math.abs(f))}function B3(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function G3(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}var z3=JS,j3=eM;const U3=Object.freeze(Object.defineProperty({__proto__:null,LDU:D3,add:P3,adjoint:A3,clone:b3,copy:w3,create:m3,determinant:C3,equals:F3,exactEquals:R3,frob:L3,fromRotation:k3,fromScaling:N3,fromValues:E3,identity:x3,invert:M3,mul:z3,multiply:JS,multiplyScalar:B3,multiplyScalarAndAdd:G3,rotate:T3,scale:I3,set:_3,str:O3,sub:j3,subtract:eM,transpose:S3},Symbol.toStringTag,{value:"Module"}));function $3(){var t=new qt(6);return qt!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function X3(t){var e=new qt(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function W3(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function V3(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function Y3(t,e,r,n,a,i){var o=new qt(6);return o[0]=t,o[1]=e,o[2]=r,o[3]=n,o[4]=a,o[5]=i,o}function q3(t,e,r,n,a,i,o){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=o,t}function H3(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=r*i-n*a;return u?(u=1/u,t[0]=i*u,t[1]=-n*u,t[2]=-a*u,t[3]=r*u,t[4]=(a*s-i*o)*u,t[5]=(n*o-r*s)*u,t):null}function Z3(t){return t[0]*t[3]-t[1]*t[2]}function tM(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=r[0],l=r[1],c=r[2],h=r[3],d=r[4],v=r[5];return t[0]=n*f+i*l,t[1]=a*f+o*l,t[2]=n*c+i*h,t[3]=a*c+o*h,t[4]=n*d+i*v+s,t[5]=a*d+o*v+u,t}function K3(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*f,t[1]=a*l+o*f,t[2]=n*-f+i*l,t[3]=a*-f+o*l,t[4]=s,t[5]=u,t}function Q3(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=r[0],l=r[1];return t[0]=n*f,t[1]=a*f,t[2]=i*l,t[3]=o*l,t[4]=s,t[5]=u,t}function J3(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=r[0],l=r[1];return t[0]=n,t[1]=a,t[2]=i,t[3]=o,t[4]=n*f+i*l+s,t[5]=a*f+o*l+u,t}function e5(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t[4]=0,t[5]=0,t}function t5(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t}function r5(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t}function n5(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}function a5(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+1)}function i5(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t}function rM(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t}function o5(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t}function s5(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t}function u5(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]}function f5(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=e[0],f=e[1],l=e[2],c=e[3],h=e[4],d=e[5];return Math.abs(r-u)<=pt*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(n-f)<=pt*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(a-l)<=pt*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(i-c)<=pt*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(o-h)<=pt*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-d)<=pt*Math.max(1,Math.abs(s),Math.abs(d))}var l5=tM,c5=rM;const h5=Object.freeze(Object.defineProperty({__proto__:null,add:i5,clone:X3,copy:W3,create:$3,determinant:Z3,equals:f5,exactEquals:u5,frob:a5,fromRotation:e5,fromScaling:t5,fromTranslation:r5,fromValues:Y3,identity:V3,invert:H3,mul:l5,multiply:tM,multiplyScalar:o5,multiplyScalarAndAdd:s5,rotate:K3,scale:Q3,set:q3,str:n5,sub:c5,subtract:rM,translate:J3},Symbol.toStringTag,{value:"Module"}));function nM(){var t=new qt(9);return qt!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function d5(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function v5(t){var e=new qt(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function p5(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function g5(t,e,r,n,a,i,o,s,u){var f=new qt(9);return f[0]=t,f[1]=e,f[2]=r,f[3]=n,f[4]=a,f[5]=i,f[6]=o,f[7]=s,f[8]=u,f}function y5(t,e,r,n,a,i,o,s,u,f){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=o,t[6]=s,t[7]=u,t[8]=f,t}function m5(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function b5(t,e){if(t===e){var r=e[1],n=e[2],a=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=a}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function aM(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=l*o-s*f,h=-l*i+s*u,d=f*i-o*u,v=r*c+n*h+a*d;return v?(v=1/v,t[0]=c*v,t[1]=(-l*n+a*f)*v,t[2]=(s*n-a*o)*v,t[3]=h*v,t[4]=(l*r-a*u)*v,t[5]=(-s*r+a*i)*v,t[6]=d*v,t[7]=(-f*r+n*u)*v,t[8]=(o*r-n*i)*v,t):null}function w5(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8];return t[0]=o*l-s*f,t[1]=a*f-n*l,t[2]=n*s-a*o,t[3]=s*u-i*l,t[4]=r*l-a*u,t[5]=a*i-r*s,t[6]=i*f-o*u,t[7]=n*u-r*f,t[8]=r*o-n*i,t}function x5(t){var e=t[0],r=t[1],n=t[2],a=t[3],i=t[4],o=t[5],s=t[6],u=t[7],f=t[8];return e*(f*i-o*u)+r*(-f*a+o*s)+n*(u*a-i*s)}function Qa(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=r[0],d=r[1],v=r[2],p=r[3],g=r[4],y=r[5],m=r[6],b=r[7],w=r[8];return t[0]=h*n+d*o+v*f,t[1]=h*a+d*s+v*l,t[2]=h*i+d*u+v*c,t[3]=p*n+g*o+y*f,t[4]=p*a+g*s+y*l,t[5]=p*i+g*u+y*c,t[6]=m*n+b*o+w*f,t[7]=m*a+b*s+w*l,t[8]=m*i+b*u+w*c,t}function E5(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=r[0],d=r[1];return t[0]=n,t[1]=a,t[2]=i,t[3]=o,t[4]=s,t[5]=u,t[6]=h*n+d*o+f,t[7]=h*a+d*s+l,t[8]=h*i+d*u+c,t}function _5(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=Math.sin(r),d=Math.cos(r);return t[0]=d*n+h*o,t[1]=d*a+h*s,t[2]=d*i+h*u,t[3]=d*o-h*n,t[4]=d*s-h*a,t[5]=d*u-h*i,t[6]=f,t[7]=l,t[8]=c,t}function S5(t,e,r){var n=r[0],a=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=a*e[3],t[4]=a*e[4],t[5]=a*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function uy(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function fy(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function ly(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function M5(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function A5(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=r+r,s=n+n,u=a+a,f=r*o,l=n*o,c=n*s,h=a*o,d=a*s,v=a*u,p=i*o,g=i*s,y=i*u;return t[0]=1-c-v,t[3]=l-y,t[6]=h+g,t[1]=l+y,t[4]=1-f-v,t[7]=d-p,t[2]=h-g,t[5]=d+p,t[8]=1-f-c,t}function C5(t,e){var r=e[0],n=e[1],a=e[2],i=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=r*s-n*o,b=r*u-a*o,w=r*f-i*o,x=n*u-a*s,E=n*f-i*s,_=a*f-i*u,S=l*p-c*v,A=l*g-h*v,M=l*y-d*v,C=c*g-h*p,I=c*y-d*p,k=h*y-d*g,O=m*k-b*I+w*C+x*M-E*A+_*S;return O?(O=1/O,t[0]=(s*k-u*I+f*C)*O,t[1]=(u*M-o*k-f*A)*O,t[2]=(o*I-s*M+f*S)*O,t[3]=(a*I-n*k-i*C)*O,t[4]=(r*k-a*M+i*A)*O,t[5]=(n*M-r*I-i*S)*O,t[6]=(p*_-g*E+y*x)*O,t[7]=(g*w-v*_-y*b)*O,t[8]=(v*E-p*w+y*m)*O,t):null}function T5(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function I5(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function k5(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8])}function N5(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t}function iM(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t}function O5(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t}function L5(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t}function D5(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]}function P5(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],f=t[7],l=t[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(r-c)<=pt*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(n-h)<=pt*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(a-d)<=pt*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(i-v)<=pt*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(o-p)<=pt*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(s-g)<=pt*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(u-y)<=pt*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(f-m)<=pt*Math.max(1,Math.abs(f),Math.abs(m))&&Math.abs(l-b)<=pt*Math.max(1,Math.abs(l),Math.abs(b))}var R5=Qa,F5=iM;const oM=Object.freeze(Object.defineProperty({__proto__:null,add:N5,adjoint:w5,clone:v5,copy:p5,create:nM,determinant:x5,equals:P5,exactEquals:D5,frob:k5,fromMat2d:M5,fromMat4:d5,fromQuat:A5,fromRotation:fy,fromScaling:ly,fromTranslation:uy,fromValues:g5,identity:m5,invert:aM,mul:R5,multiply:Qa,multiplyScalar:O5,multiplyScalarAndAdd:L5,normalFromMat4:C5,projection:T5,rotate:_5,scale:S5,set:y5,str:I5,sub:F5,subtract:iM,translate:E5,transpose:b5},Symbol.toStringTag,{value:"Module"}));function B5(){var t=new qt(16);return qt!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function G5(t){var e=new qt(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function z5(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function j5(t,e,r,n,a,i,o,s,u,f,l,c,h,d,v,p){var g=new qt(16);return g[0]=t,g[1]=e,g[2]=r,g[3]=n,g[4]=a,g[5]=i,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 U5(t,e,r,n,a,i,o,s,u,f,l,c,h,d,v,p,g){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=o,t[6]=s,t[7]=u,t[8]=f,t[9]=l,t[10]=c,t[11]=h,t[12]=d,t[13]=v,t[14]=p,t[15]=g,t}function sM(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function $5(t,e){if(t===e){var r=e[1],n=e[2],a=e[3],i=e[6],o=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[11]=e[14],t[12]=a,t[13]=o,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function X5(t,e){var r=e[0],n=e[1],a=e[2],i=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=r*s-n*o,b=r*u-a*o,w=r*f-i*o,x=n*u-a*s,E=n*f-i*s,_=a*f-i*u,S=l*p-c*v,A=l*g-h*v,M=l*y-d*v,C=c*g-h*p,I=c*y-d*p,k=h*y-d*g,O=m*k-b*I+w*C+x*M-E*A+_*S;return O?(O=1/O,t[0]=(s*k-u*I+f*C)*O,t[1]=(a*I-n*k-i*C)*O,t[2]=(p*_-g*E+y*x)*O,t[3]=(h*E-c*_-d*x)*O,t[4]=(u*M-o*k-f*A)*O,t[5]=(r*k-a*M+i*A)*O,t[6]=(g*w-v*_-y*b)*O,t[7]=(l*_-h*w+d*b)*O,t[8]=(o*I-s*M+f*S)*O,t[9]=(n*M-r*I-i*S)*O,t[10]=(v*E-p*w+y*m)*O,t[11]=(c*w-l*E-d*m)*O,t[12]=(s*A-o*C-u*S)*O,t[13]=(r*C-n*A+a*S)*O,t[14]=(p*b-v*x-g*m)*O,t[15]=(l*x-c*b+h*m)*O,t):null}function W5(t,e){var r=e[0],n=e[1],a=e[2],i=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=r*s-n*o,b=r*u-a*o,w=r*f-i*o,x=n*u-a*s,E=n*f-i*s,_=a*f-i*u,S=l*p-c*v,A=l*g-h*v,M=l*y-d*v,C=c*g-h*p,I=c*y-d*p,k=h*y-d*g;return t[0]=s*k-u*I+f*C,t[1]=a*I-n*k-i*C,t[2]=p*_-g*E+y*x,t[3]=h*E-c*_-d*x,t[4]=u*M-o*k-f*A,t[5]=r*k-a*M+i*A,t[6]=g*w-v*_-y*b,t[7]=l*_-h*w+d*b,t[8]=o*I-s*M+f*S,t[9]=n*M-r*I-i*S,t[10]=v*E-p*w+y*m,t[11]=c*w-l*E-d*m,t[12]=s*A-o*C-u*S,t[13]=r*C-n*A+a*S,t[14]=p*b-v*x-g*m,t[15]=l*x-c*b+h*m,t}function V5(t){var e=t[0],r=t[1],n=t[2],a=t[3],i=t[4],o=t[5],s=t[6],u=t[7],f=t[8],l=t[9],c=t[10],h=t[11],d=t[12],v=t[13],p=t[14],g=t[15],y=e*o-r*i,m=e*s-n*i,b=r*s-n*o,w=f*v-l*d,x=f*p-c*d,E=l*p-c*v,_=e*E-r*x+n*w,S=i*E-o*x+s*w,A=f*b-l*m+c*y,M=d*b-v*m+p*y;return u*_-a*S+g*A-h*M}function uM(t,e,r){var n=e[0],a=e[1],i=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=r[0],w=r[1],x=r[2],E=r[3];return t[0]=b*n+w*s+x*c+E*p,t[1]=b*a+w*u+x*h+E*g,t[2]=b*i+w*f+x*d+E*y,t[3]=b*o+w*l+x*v+E*m,b=r[4],w=r[5],x=r[6],E=r[7],t[4]=b*n+w*s+x*c+E*p,t[5]=b*a+w*u+x*h+E*g,t[6]=b*i+w*f+x*d+E*y,t[7]=b*o+w*l+x*v+E*m,b=r[8],w=r[9],x=r[10],E=r[11],t[8]=b*n+w*s+x*c+E*p,t[9]=b*a+w*u+x*h+E*g,t[10]=b*i+w*f+x*d+E*y,t[11]=b*o+w*l+x*v+E*m,b=r[12],w=r[13],x=r[14],E=r[15],t[12]=b*n+w*s+x*c+E*p,t[13]=b*a+w*u+x*h+E*g,t[14]=b*i+w*f+x*d+E*y,t[15]=b*o+w*l+x*v+E*m,t}function Y5(t,e,r){var n=r[0],a=r[1],i=r[2],o,s,u,f,l,c,h,d,v,p,g,y;return e===t?(t[12]=e[0]*n+e[4]*a+e[8]*i+e[12],t[13]=e[1]*n+e[5]*a+e[9]*i+e[13],t[14]=e[2]*n+e[6]*a+e[10]*i+e[14],t[15]=e[3]*n+e[7]*a+e[11]*i+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],t[0]=o,t[1]=s,t[2]=u,t[3]=f,t[4]=l,t[5]=c,t[6]=h,t[7]=d,t[8]=v,t[9]=p,t[10]=g,t[11]=y,t[12]=o*n+l*a+v*i+e[12],t[13]=s*n+c*a+p*i+e[13],t[14]=u*n+h*a+g*i+e[14],t[15]=f*n+d*a+y*i+e[15]),t}function q5(t,e,r){var n=r[0],a=r[1],i=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*a,t[5]=e[5]*a,t[6]=e[6]*a,t[7]=e[7]*a,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function H5(t,e,r,n){var a=n[0],i=n[1],o=n[2],s=Math.sqrt(a*a+i*i+o*o),u,f,l,c,h,d,v,p,g,y,m,b,w,x,E,_,S,A,M,C,I,k,O,B;return s<pt?null:(s=1/s,a*=s,i*=s,o*=s,u=Math.sin(r),f=Math.cos(r),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],w=e[9],x=e[10],E=e[11],_=a*a*l+f,S=i*a*l+o*u,A=o*a*l-i*u,M=a*i*l-o*u,C=i*i*l+f,I=o*i*l+a*u,k=a*o*l+i*u,O=i*o*l-a*u,B=o*o*l+f,t[0]=c*_+p*S+b*A,t[1]=h*_+g*S+w*A,t[2]=d*_+y*S+x*A,t[3]=v*_+m*S+E*A,t[4]=c*M+p*C+b*I,t[5]=h*M+g*C+w*I,t[6]=d*M+y*C+x*I,t[7]=v*M+m*C+E*I,t[8]=c*k+p*O+b*B,t[9]=h*k+g*O+w*B,t[10]=d*k+y*O+x*B,t[11]=v*k+m*O+E*B,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function Z5(t,e,r){var n=Math.sin(r),a=Math.cos(r),i=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!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=i*a+f*n,t[5]=o*a+l*n,t[6]=s*a+c*n,t[7]=u*a+h*n,t[8]=f*a-i*n,t[9]=l*a-o*n,t[10]=c*a-s*n,t[11]=h*a-u*n,t}function K5(t,e,r){var n=Math.sin(r),a=Math.cos(r),i=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!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*a-f*n,t[1]=o*a-l*n,t[2]=s*a-c*n,t[3]=u*a-h*n,t[8]=i*n+f*a,t[9]=o*n+l*a,t[10]=s*n+c*a,t[11]=u*n+h*a,t}function Q5(t,e,r){var n=Math.sin(r),a=Math.cos(r),i=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!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*a+f*n,t[1]=o*a+l*n,t[2]=s*a+c*n,t[3]=u*a+h*n,t[4]=f*a-i*n,t[5]=l*a-o*n,t[6]=c*a-s*n,t[7]=h*a-u*n,t}function J5(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function eF(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function tF(t,e,r){var n=r[0],a=r[1],i=r[2],o=Math.sqrt(n*n+a*a+i*i),s,u,f;return o<pt?null:(o=1/o,n*=o,a*=o,i*=o,s=Math.sin(e),u=Math.cos(e),f=1-u,t[0]=n*n*f+u,t[1]=a*n*f+i*s,t[2]=i*n*f-a*s,t[3]=0,t[4]=n*a*f-i*s,t[5]=a*a*f+u,t[6]=i*a*f+n*s,t[7]=0,t[8]=n*i*f+a*s,t[9]=a*i*f-n*s,t[10]=i*i*f+u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function rF(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function nF(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function aF(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function fM(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=n+n,u=a+a,f=i+i,l=n*s,c=n*u,h=n*f,d=a*u,v=a*f,p=i*f,g=o*s,y=o*u,m=o*f;return t[0]=1-(d+p),t[1]=c+m,t[2]=h-y,t[3]=0,t[4]=c-m,t[5]=1-(l+p),t[6]=v+g,t[7]=0,t[8]=h+y,t[9]=v-g,t[10]=1-(l+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function iF(t,e){var r=new qt(3),n=-e[0],a=-e[1],i=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=n*n+a*a+i*i+o*o;return c>0?(r[0]=(s*o+l*n+u*i-f*a)*2/c,r[1]=(u*o+l*a+f*n-s*i)*2/c,r[2]=(f*o+l*i+s*a-u*n)*2/c):(r[0]=(s*o+l*n+u*i-f*a)*2,r[1]=(u*o+l*a+f*n-s*i)*2,r[2]=(f*o+l*i+s*a-u*n)*2),fM(t,e,r),t}function lM(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function cM(t,e){var r=e[0],n=e[1],a=e[2],i=e[4],o=e[5],s=e[6],u=e[8],f=e[9],l=e[10];return t[0]=Math.sqrt(r*r+n*n+a*a),t[1]=Math.sqrt(i*i+o*o+s*s),t[2]=Math.sqrt(u*u+f*f+l*l),t}function hM(t,e){var r=new qt(3);cM(r,e);var n=1/r[0],a=1/r[1],i=1/r[2],o=e[0]*n,s=e[1]*a,u=e[2]*i,f=e[4]*n,l=e[5]*a,c=e[6]*i,h=e[8]*n,d=e[9]*a,v=e[10]*i,p=o+l+v,g=0;return p>0?(g=Math.sqrt(p+1)*2,t[3]=.25*g,t[0]=(c-d)/g,t[1]=(h-u)/g,t[2]=(s-f)/g):o>l&&o>v?(g=Math.sqrt(1+o-l-v)*2,t[3]=(c-d)/g,t[0]=.25*g,t[1]=(s+f)/g,t[2]=(h+u)/g):l>v?(g=Math.sqrt(1+l-o-v)*2,t[3]=(h-u)/g,t[0]=(s+f)/g,t[1]=.25*g,t[2]=(c+d)/g):(g=Math.sqrt(1+v-o-l)*2,t[3]=(s-f)/g,t[0]=(h+u)/g,t[1]=(c+d)/g,t[2]=.25*g),t}function oF(t,e,r,n){e[0]=n[12],e[1]=n[13],e[2]=n[14];var a=n[0],i=n[1],o=n[2],s=n[4],u=n[5],f=n[6],l=n[8],c=n[9],h=n[10];r[0]=Math.sqrt(a*a+i*i+o*o),r[1]=Math.sqrt(s*s+u*u+f*f),r[2]=Math.sqrt(l*l+c*c+h*h);var d=1/r[0],v=1/r[1],p=1/r[2],g=a*d,y=i*v,m=o*p,b=s*d,w=u*v,x=f*p,E=l*d,_=c*v,S=h*p,A=g+w+S,M=0;return A>0?(M=Math.sqrt(A+1)*2,t[3]=.25*M,t[0]=(x-_)/M,t[1]=(E-m)/M,t[2]=(y-b)/M):g>w&&g>S?(M=Math.sqrt(1+g-w-S)*2,t[3]=(x-_)/M,t[0]=.25*M,t[1]=(y+b)/M,t[2]=(E+m)/M):w>S?(M=Math.sqrt(1+w-g-S)*2,t[3]=(E-m)/M,t[0]=(y+b)/M,t[1]=.25*M,t[2]=(x+_)/M):(M=Math.sqrt(1+S-g-w)*2,t[3]=(y-b)/M,t[0]=(E+m)/M,t[1]=(x+_)/M,t[2]=.25*M),t}function sF(t,e,r,n){var a=e[0],i=e[1],o=e[2],s=e[3],u=a+a,f=i+i,l=o+o,c=a*u,h=a*f,d=a*l,v=i*f,p=i*l,g=o*l,y=s*u,m=s*f,b=s*l,w=n[0],x=n[1],E=n[2];return t[0]=(1-(v+g))*w,t[1]=(h+b)*w,t[2]=(d-m)*w,t[3]=0,t[4]=(h-b)*x,t[5]=(1-(c+g))*x,t[6]=(p+y)*x,t[7]=0,t[8]=(d+m)*E,t[9]=(p-y)*E,t[10]=(1-(c+v))*E,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function uF(t,e,r,n,a){var i=e[0],o=e[1],s=e[2],u=e[3],f=i+i,l=o+o,c=s+s,h=i*f,d=i*l,v=i*c,p=o*l,g=o*c,y=s*c,m=u*f,b=u*l,w=u*c,x=n[0],E=n[1],_=n[2],S=a[0],A=a[1],M=a[2],C=(1-(p+y))*x,I=(d+w)*x,k=(v-b)*x,O=(d-w)*E,B=(1-(h+y))*E,L=(g+m)*E,z=(v+b)*_,X=(g-m)*_,R=(1-(h+p))*_;return t[0]=C,t[1]=I,t[2]=k,t[3]=0,t[4]=O,t[5]=B,t[6]=L,t[7]=0,t[8]=z,t[9]=X,t[10]=R,t[11]=0,t[12]=r[0]+S-(C*S+O*A+z*M),t[13]=r[1]+A-(I*S+B*A+X*M),t[14]=r[2]+M-(k*S+L*A+R*M),t[15]=1,t}function fF(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=r+r,s=n+n,u=a+a,f=r*o,l=n*o,c=n*s,h=a*o,d=a*s,v=a*u,p=i*o,g=i*s,y=i*u;return t[0]=1-c-v,t[1]=l+y,t[2]=h-g,t[3]=0,t[4]=l-y,t[5]=1-f-v,t[6]=d+p,t[7]=0,t[8]=h+g,t[9]=d-p,t[10]=1-f-c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function lF(t,e,r,n,a,i,o){var s=1/(r-e),u=1/(a-n),f=1/(i-o);return t[0]=i*2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i*2*u,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(a+n)*u,t[10]=(o+i)*f,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*i*2*f,t[15]=0,t}function dM(t,e,r,n,a){var i=1/Math.tan(e/2);if(t[0]=i/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,a!=null&&a!==1/0){var o=1/(n-a);t[10]=(a+n)*o,t[14]=2*a*n*o}else t[10]=-1,t[14]=-2*n;return t}var cF=dM;function hF(t,e,r,n,a){var i=1/Math.tan(e/2);if(t[0]=i/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,a!=null&&a!==1/0){var o=1/(n-a);t[10]=a*o,t[14]=a*n*o}else t[10]=-1,t[14]=-n;return t}function dF(t,e,r,n){var a=Math.tan(e.upDegrees*Math.PI/180),i=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/(a+i);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=f,t[6]=0,t[7]=0,t[8]=-((o-s)*u*.5),t[9]=(a-i)*f*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function vM(t,e,r,n,a,i,o){var s=1/(e-r),u=1/(n-a),f=1/(i-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*f,t[11]=0,t[12]=(e+r)*s,t[13]=(a+n)*u,t[14]=(o+i)*f,t[15]=1,t}var vF=vM;function pF(t,e,r,n,a,i,o){var s=1/(e-r),u=1/(n-a),f=1/(i-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=f,t[11]=0,t[12]=(e+r)*s,t[13]=(a+n)*u,t[14]=i*f,t[15]=1,t}function gF(t,e,r,n){var a,i,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],w=r[0],x=r[1],E=r[2];return Math.abs(v-w)<pt&&Math.abs(p-x)<pt&&Math.abs(g-E)<pt?sM(t):(l=v-w,c=p-x,h=g-E,d=1/Math.sqrt(l*l+c*c+h*h),l*=d,c*=d,h*=d,a=m*h-b*c,i=b*l-y*h,o=y*c-m*l,d=Math.sqrt(a*a+i*i+o*o),d?(d=1/d,a*=d,i*=d,o*=d):(a=0,i=0,o=0),s=c*o-h*i,u=h*a-l*o,f=l*i-c*a,d=Math.sqrt(s*s+u*u+f*f),d?(d=1/d,s*=d,u*=d,f*=d):(s=0,u=0,f=0),t[0]=a,t[1]=s,t[2]=l,t[3]=0,t[4]=i,t[5]=u,t[6]=c,t[7]=0,t[8]=o,t[9]=f,t[10]=h,t[11]=0,t[12]=-(a*v+i*p+o*g),t[13]=-(s*v+u*p+f*g),t[14]=-(l*v+c*p+h*g),t[15]=1,t)}function yF(t,e,r,n){var a=e[0],i=e[1],o=e[2],s=n[0],u=n[1],f=n[2],l=a-r[0],c=i-r[1],h=o-r[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),t[0]=v,t[1]=p,t[2]=g,t[3]=0,t[4]=c*g-h*p,t[5]=h*v-l*g,t[6]=l*p-c*v,t[7]=0,t[8]=l,t[9]=c,t[10]=h,t[11]=0,t[12]=a,t[13]=i,t[14]=o,t[15]=1,t}function mF(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function bF(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])}function wF(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function pM(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function xF(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function EF(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function _F(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function SF(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],f=t[7],l=t[8],c=t[9],h=t[10],d=t[11],v=t[12],p=t[13],g=t[14],y=t[15],m=e[0],b=e[1],w=e[2],x=e[3],E=e[4],_=e[5],S=e[6],A=e[7],M=e[8],C=e[9],I=e[10],k=e[11],O=e[12],B=e[13],L=e[14],z=e[15];return Math.abs(r-m)<=pt*Math.max(1,Math.abs(r),Math.abs(m))&&Math.abs(n-b)<=pt*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(a-w)<=pt*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(i-x)<=pt*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(o-E)<=pt*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(s-_)<=pt*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(u-S)<=pt*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(f-A)<=pt*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(l-M)<=pt*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(c-C)<=pt*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(h-I)<=pt*Math.max(1,Math.abs(h),Math.abs(I))&&Math.abs(d-k)<=pt*Math.max(1,Math.abs(d),Math.abs(k))&&Math.abs(v-O)<=pt*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(p-B)<=pt*Math.max(1,Math.abs(p),Math.abs(B))&&Math.abs(g-L)<=pt*Math.max(1,Math.abs(g),Math.abs(L))&&Math.abs(y-z)<=pt*Math.max(1,Math.abs(y),Math.abs(z))}var MF=uM,AF=pM;const CF=Object.freeze(Object.defineProperty({__proto__:null,add:wF,adjoint:W5,clone:G5,copy:z5,create:B5,decompose:oF,determinant:V5,equals:SF,exactEquals:_F,frob:bF,fromQuat:fF,fromQuat2:iF,fromRotation:tF,fromRotationTranslation:fM,fromRotationTranslationScale:sF,fromRotationTranslationScaleOrigin:uF,fromScaling:eF,fromTranslation:J5,fromValues:j5,fromXRotation:rF,fromYRotation:nF,fromZRotation:aF,frustum:lF,getRotation:hM,getScaling:cM,getTranslation:lM,identity:sM,invert:X5,lookAt:gF,mul:MF,multiply:uM,multiplyScalar:xF,multiplyScalarAndAdd:EF,ortho:vF,orthoNO:vM,orthoZO:pF,perspective:cF,perspectiveFromFieldOfView:dF,perspectiveNO:dM,perspectiveZO:hF,rotate:H5,rotateX:Z5,rotateY:K5,rotateZ:Q5,scale:q5,set:U5,str:mF,sub:AF,subtract:pM,targetTo:yF,translate:Y5,transpose:$5},Symbol.toStringTag,{value:"Module"}));function cy(){var t=new qt(3);return qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function TF(t){var e=new qt(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function gM(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function x0(t,e,r){var n=new qt(3);return n[0]=t,n[1]=e,n[2]=r,n}function IF(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function kF(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function NF(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function yM(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function mM(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function bM(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function OF(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function LF(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function DF(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function PF(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function RF(t,e){return t[0]=Ba(e[0]),t[1]=Ba(e[1]),t[2]=Ba(e[2]),t}function FF(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function BF(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function wM(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2];return Math.sqrt(r*r+n*n+a*a)}function xM(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2];return r*r+n*n+a*a}function EM(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function GF(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function zF(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function _M(t,e){var r=e[0],n=e[1],a=e[2],i=r*r+n*n+a*a;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function md(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function eh(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[0],s=r[1],u=r[2];return t[0]=a*u-i*s,t[1]=i*o-n*u,t[2]=n*s-a*o,t}function jF(t,e,r,n){var a=e[0],i=e[1],o=e[2];return t[0]=a+n*(r[0]-a),t[1]=i+n*(r[1]-i),t[2]=o+n*(r[2]-o),t}function UF(t,e,r,n){var a=Math.acos(Math.min(Math.max(md(e,r),-1),1)),i=Math.sin(a),o=Math.sin((1-n)*a)/i,s=Math.sin(n*a)/i;return t[0]=o*e[0]+s*r[0],t[1]=o*e[1]+s*r[1],t[2]=o*e[2]+s*r[2],t}function $F(t,e,r,n,a,i){var o=i*i,s=o*(2*i-3)+1,u=o*(i-2)+i,f=o*(i-1),l=o*(3-2*i);return t[0]=e[0]*s+r[0]*u+n[0]*f+a[0]*l,t[1]=e[1]*s+r[1]*u+n[1]*f+a[1]*l,t[2]=e[2]*s+r[2]*u+n[2]*f+a[2]*l,t}function XF(t,e,r,n,a,i){var o=1-i,s=o*o,u=i*i,f=s*o,l=3*i*s,c=3*u*o,h=u*i;return t[0]=e[0]*f+r[0]*l+n[0]*c+a[0]*h,t[1]=e[1]*f+r[1]*l+n[1]*c+a[1]*h,t[2]=e[2]*f+r[2]*l+n[2]*c+a[2]*h,t}function WF(t,e){e=e===void 0?1:e;var r=ya()*2*Math.PI,n=ya()*2-1,a=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=n*e,t}function VF(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[3]*n+r[7]*a+r[11]*i+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*a+r[8]*i+r[12])/o,t[1]=(r[1]*n+r[5]*a+r[9]*i+r[13])/o,t[2]=(r[2]*n+r[6]*a+r[10]*i+r[14])/o,t}function bd(t,e,r){var n=e[0],a=e[1],i=e[2];return t[0]=n*r[0]+a*r[3]+i*r[6],t[1]=n*r[1]+a*r[4]+i*r[7],t[2]=n*r[2]+a*r[5]+i*r[8],t}function YF(t,e,r){var n=r[0],a=r[1],i=r[2],o=r[3],s=e[0],u=e[1],f=e[2],l=a*f-i*u,c=i*s-n*f,h=n*u-a*s;return l=l+l,c=c+c,h=h+h,t[0]=s+o*l+a*h-i*c,t[1]=u+o*c+i*l-n*h,t[2]=f+o*h+n*c-a*l,t}function qF(t,e,r,n){var a=[],i=[];return a[0]=e[0]-r[0],a[1]=e[1]-r[1],a[2]=e[2]-r[2],i[0]=a[0],i[1]=a[1]*Math.cos(n)-a[2]*Math.sin(n),i[2]=a[1]*Math.sin(n)+a[2]*Math.cos(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function HF(t,e,r,n){var a=[],i=[];return a[0]=e[0]-r[0],a[1]=e[1]-r[1],a[2]=e[2]-r[2],i[0]=a[2]*Math.sin(n)+a[0]*Math.cos(n),i[1]=a[1],i[2]=a[2]*Math.cos(n)-a[0]*Math.sin(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function ZF(t,e,r,n){var a=[],i=[];return a[0]=e[0]-r[0],a[1]=e[1]-r[1],a[2]=e[2]-r[2],i[0]=a[0]*Math.cos(n)-a[1]*Math.sin(n),i[1]=a[0]*Math.sin(n)+a[1]*Math.cos(n),i[2]=a[2],t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function KF(t,e){var r=t[0],n=t[1],a=t[2],i=e[0],o=e[1],s=e[2],u=Math.sqrt((r*r+n*n+a*a)*(i*i+o*o+s*s)),f=u&&md(t,e)/u;return Math.acos(Math.min(Math.max(f,-1),1))}function QF(t){return t[0]=0,t[1]=0,t[2]=0,t}function JF(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function eB(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function tB(t,e){var r=t[0],n=t[1],a=t[2],i=e[0],o=e[1],s=e[2];return Math.abs(r-i)<=pt*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-o)<=pt*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(a-s)<=pt*Math.max(1,Math.abs(a),Math.abs(s))}var rB=yM,nB=mM,aB=bM,iB=wM,oB=xM,SM=gM,sB=EM,uB=function(){var t=cy();return function(e,r,n,a,i,o){var s,u;for(r||(r=3),n||(n=0),a?u=Math.min(a*r+n,e.length):u=e.length,s=n;s<u;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],i(t,t,o),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}}();const fB=Object.freeze(Object.defineProperty({__proto__:null,add:NF,angle:KF,bezier:XF,ceil:OF,clone:TF,copy:IF,create:cy,cross:eh,dist:iB,distance:wM,div:aB,divide:bM,dot:md,equals:tB,exactEquals:eB,floor:LF,forEach:uB,fromValues:x0,hermite:$F,inverse:zF,len:SM,length:gM,lerp:jF,max:PF,min:DF,mul:nB,multiply:mM,negate:GF,normalize:_M,random:WF,rotateX:qF,rotateY:HF,rotateZ:ZF,round:RF,scale:FF,scaleAndAdd:BF,set:kF,slerp:UF,sqrDist:oB,sqrLen:sB,squaredDistance:xM,squaredLength:EM,str:JF,sub:rB,subtract:yM,transformMat3:bd,transformMat4:VF,transformQuat:YF,zero:QF},Symbol.toStringTag,{value:"Module"}));function MM(){var t=new qt(4);return qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function AM(t){var e=new qt(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function CM(t,e,r,n){var a=new qt(4);return a[0]=t,a[1]=e,a[2]=r,a[3]=n,a}function TM(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function IM(t,e,r,n,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t}function kM(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function NM(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function OM(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}function LM(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}function lB(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function cB(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function hB(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function dB(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function vB(t,e){return t[0]=Ba(e[0]),t[1]=Ba(e[1]),t[2]=Ba(e[2]),t[3]=Ba(e[3]),t}function DM(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function pB(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}function PM(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2],i=e[3]-t[3];return Math.sqrt(r*r+n*n+a*a+i*i)}function RM(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2],i=e[3]-t[3];return r*r+n*n+a*a+i*i}function hy(t){var e=t[0],r=t[1],n=t[2],a=t[3];return Math.sqrt(e*e+r*r+n*n+a*a)}function dy(t){var e=t[0],r=t[1],n=t[2],a=t[3];return e*e+r*r+n*n+a*a}function gB(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function yB(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function FM(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=r*r+n*n+a*a+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=n*o,t[2]=a*o,t[3]=i*o,t}function vy(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function mB(t,e,r,n){var a=r[0]*n[1]-r[1]*n[0],i=r[0]*n[2]-r[2]*n[0],o=r[0]*n[3]-r[3]*n[0],s=r[1]*n[2]-r[2]*n[1],u=r[1]*n[3]-r[3]*n[1],f=r[2]*n[3]-r[3]*n[2],l=e[0],c=e[1],h=e[2],d=e[3];return t[0]=c*f-h*u+d*s,t[1]=-(l*f)+h*o-d*i,t[2]=l*u-c*o+d*a,t[3]=-(l*s)+c*i-h*a,t}function BM(t,e,r,n){var a=e[0],i=e[1],o=e[2],s=e[3];return t[0]=a+n*(r[0]-a),t[1]=i+n*(r[1]-i),t[2]=o+n*(r[2]-o),t[3]=s+n*(r[3]-s),t}function bB(t,e){e=e===void 0?1:e;var r,n,a,i,o,s,u;u=ya(),r=u*2-1,n=(4*ya()-2)*Math.sqrt(u*-u+u),o=r*r+n*n,u=ya(),a=u*2-1,i=(4*ya()-2)*Math.sqrt(u*-u+u),s=a*a+i*i;var f=Math.sqrt((1-o)/s);return t[0]=e*r,t[1]=e*n,t[2]=e*a*f,t[3]=e*i*f,t}function wB(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3];return t[0]=r[0]*n+r[4]*a+r[8]*i+r[12]*o,t[1]=r[1]*n+r[5]*a+r[9]*i+r[13]*o,t[2]=r[2]*n+r[6]*a+r[10]*i+r[14]*o,t[3]=r[3]*n+r[7]*a+r[11]*i+r[15]*o,t}function xB(t,e,r){var n=r[0],a=r[1],i=r[2],o=r[3],s=e[0],u=e[1],f=e[2],l=a*f-i*u,c=i*s-n*f,h=n*u-a*s;return l=l+l,c=c+c,h=h+h,t[0]=s+o*l+a*h-i*c,t[1]=u+o*c+i*l-n*h,t[2]=f+o*h+n*c-a*l,t[3]=e[3],t}function EB(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function _B(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function GM(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function SB(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=e[0],s=e[1],u=e[2],f=e[3];return Math.abs(r-o)<=pt*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=pt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(a-u)<=pt*Math.max(1,Math.abs(a),Math.abs(u))&&Math.abs(i-f)<=pt*Math.max(1,Math.abs(i),Math.abs(f))}var MB=NM,AB=OM,CB=LM,TB=PM,IB=RM,kB=hy,NB=dy,OB=function(){var t=MM();return function(e,r,n,a,i,o){var s,u;for(r||(r=4),n||(n=0),a?u=Math.min(a*r+n,e.length):u=e.length,s=n;s<u;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],i(t,t,o),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}();const LB=Object.freeze(Object.defineProperty({__proto__:null,add:kM,ceil:lB,clone:AM,copy:TM,create:MM,cross:mB,dist:TB,distance:PM,div:CB,divide:LM,dot:vy,equals:SB,exactEquals:GM,floor:cB,forEach:OB,fromValues:CM,inverse:yB,len:kB,length:hy,lerp:BM,max:dB,min:hB,mul:AB,multiply:OM,negate:gB,normalize:FM,random:bB,round:vB,scale:DM,scaleAndAdd:pB,set:IM,sqrDist:IB,sqrLen:NB,squaredDistance:RM,squaredLength:dy,str:_B,sub:MB,subtract:NM,transformMat4:wB,transformQuat:xB,zero:EB},Symbol.toStringTag,{value:"Module"}));function Th(){var t=new qt(4);return qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function DB(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function zM(t,e,r){r=r*.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function PB(t,e){var r=Math.acos(e[3])*2,n=Math.sin(r/2);return n>pt?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r}function RB(t,e){var r=gy(t,e);return Math.acos(2*r*r-1)}function jM(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r[0],u=r[1],f=r[2],l=r[3];return t[0]=n*l+o*s+a*f-i*u,t[1]=a*l+o*u+i*s-n*f,t[2]=i*l+o*f+n*u-a*s,t[3]=o*l-n*s-a*u-i*f,t}function UM(t,e,r){r*=.5;var n=e[0],a=e[1],i=e[2],o=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+o*s,t[1]=a*u+i*s,t[2]=i*u-a*s,t[3]=o*u-n*s,t}function $M(t,e,r){r*=.5;var n=e[0],a=e[1],i=e[2],o=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u-i*s,t[1]=a*u+o*s,t[2]=i*u+n*s,t[3]=o*u-a*s,t}function XM(t,e,r){r*=.5;var n=e[0],a=e[1],i=e[2],o=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+a*s,t[1]=a*u-n*s,t[2]=i*u+o*s,t[3]=o*u-i*s,t}function FB(t,e){var r=e[0],n=e[1],a=e[2];return t[0]=r,t[1]=n,t[2]=a,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-a*a)),t}function WM(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=Math.sqrt(r*r+n*n+a*a),s=Math.exp(i),u=o>0?s*Math.sin(o)/o:0;return t[0]=r*u,t[1]=n*u,t[2]=a*u,t[3]=s*Math.cos(o),t}function VM(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=Math.sqrt(r*r+n*n+a*a),s=o>0?Math.atan2(o,i)/o:0;return t[0]=r*s,t[1]=n*s,t[2]=a*s,t[3]=.5*Math.log(r*r+n*n+a*a+i*i),t}function BB(t,e,r){return VM(t,e),qM(t,t,r),WM(t,t),t}function th(t,e,r,n){var a=e[0],i=e[1],o=e[2],s=e[3],u=r[0],f=r[1],l=r[2],c=r[3],h,d,v,p,g;return d=a*u+i*f+o*l+s*c,d<0&&(d=-d,u=-u,f=-f,l=-l,c=-c),1-d>pt?(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),t[0]=p*a+g*u,t[1]=p*i+g*f,t[2]=p*o+g*l,t[3]=p*s+g*c,t}function GB(t){var e=ya(),r=ya(),n=ya(),a=Math.sqrt(1-e),i=Math.sqrt(e);return t[0]=a*Math.sin(2*Math.PI*r),t[1]=a*Math.cos(2*Math.PI*r),t[2]=i*Math.sin(2*Math.PI*n),t[3]=i*Math.cos(2*Math.PI*n),t}function zB(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=r*r+n*n+a*a+i*i,s=o?1/o:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-a*s,t[3]=i*s,t}function jB(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function YM(t,e){var r=e[0]+e[4]+e[8],n;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var a=0;e[4]>e[0]&&(a=1),e[8]>e[a*3+a]&&(a=2);var i=(a+1)%3,o=(a+2)%3;n=Math.sqrt(e[a*3+a]-e[i*3+i]-e[o*3+o]+1),t[a]=.5*n,n=.5/n,t[3]=(e[i*3+o]-e[o*3+i])*n,t[i]=(e[i*3+a]+e[a*3+i])*n,t[o]=(e[o*3+a]+e[a*3+o])*n}return t}function UB(t,e,r,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:QS,i=Math.PI/360;e*=i,n*=i,r*=i;var o=Math.sin(e),s=Math.cos(e),u=Math.sin(r),f=Math.cos(r),l=Math.sin(n),c=Math.cos(n);switch(a){case"xyz":t[0]=o*f*c+s*u*l,t[1]=s*u*c-o*f*l,t[2]=s*f*l+o*u*c,t[3]=s*f*c-o*u*l;break;case"xzy":t[0]=o*f*c-s*u*l,t[1]=s*u*c-o*f*l,t[2]=s*f*l+o*u*c,t[3]=s*f*c+o*u*l;break;case"yxz":t[0]=o*f*c+s*u*l,t[1]=s*u*c-o*f*l,t[2]=s*f*l-o*u*c,t[3]=s*f*c+o*u*l;break;case"yzx":t[0]=o*f*c+s*u*l,t[1]=s*u*c+o*f*l,t[2]=s*f*l-o*u*c,t[3]=s*f*c-o*u*l;break;case"zxy":t[0]=o*f*c-s*u*l,t[1]=s*u*c+o*f*l,t[2]=s*f*l+o*u*c,t[3]=s*f*c-o*u*l;break;case"zyx":t[0]=o*f*c-s*u*l,t[1]=s*u*c+o*f*l,t[2]=s*f*l-o*u*c,t[3]=s*f*c+o*u*l;break;default:throw new Error("Unknown angle order "+a)}return t}function $B(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var XB=AM,WB=CM,py=TM,VB=IM,YB=kM,qB=jM,qM=DM,gy=vy,HB=BM,yy=hy,ZB=yy,my=dy,KB=my,by=FM,QB=GM;function JB(t,e){return Math.abs(vy(t,e))>=1-pt}var e4=function(){var t=cy(),e=x0(1,0,0),r=x0(0,1,0);return function(n,a,i){var o=md(a,i);return o<-.999999?(eh(t,e,a),SM(t)<1e-6&&eh(t,r,a),_M(t,t),zM(n,t,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(eh(t,a,i),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+o,by(n,n))}}(),t4=function(){var t=Th(),e=Th();return function(r,n,a,i,o,s){return th(t,n,o,s),th(e,a,i,s),th(r,t,e,2*s*(1-s)),r}}(),r4=function(){var t=nM();return function(e,r,n,a){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=a[0],t[4]=a[1],t[7]=a[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],by(e,YM(e,t))}}();const n4=Object.freeze(Object.defineProperty({__proto__:null,add:YB,calculateW:FB,clone:XB,conjugate:jB,copy:py,create:Th,dot:gy,equals:JB,exactEquals:QB,exp:WM,fromEuler:UB,fromMat3:YM,fromValues:WB,getAngle:RB,getAxisAngle:PB,identity:DB,invert:zB,len:ZB,length:yy,lerp:HB,ln:VM,mul:qB,multiply:jM,normalize:by,pow:BB,random:GB,rotateX:UM,rotateY:$M,rotateZ:XM,rotationTo:e4,scale:qM,set:VB,setAxes:r4,setAxisAngle:zM,slerp:th,sqlerp:t4,sqrLen:KB,squaredLength:my,str:$B},Symbol.toStringTag,{value:"Module"}));function a4(){var t=new qt(8);return qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t}function i4(t){var e=new qt(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function o4(t,e,r,n,a,i,o,s){var u=new qt(8);return u[0]=t,u[1]=e,u[2]=r,u[3]=n,u[4]=a,u[5]=i,u[6]=o,u[7]=s,u}function s4(t,e,r,n,a,i,o){var s=new qt(8);s[0]=t,s[1]=e,s[2]=r,s[3]=n;var u=a*.5,f=i*.5,l=o*.5;return s[4]=u*n+f*r-l*e,s[5]=f*n+l*t-u*r,s[6]=l*n+u*e-f*t,s[7]=-u*t-f*e-l*r,s}function HM(t,e,r){var n=r[0]*.5,a=r[1]*.5,i=r[2]*.5,o=e[0],s=e[1],u=e[2],f=e[3];return t[0]=o,t[1]=s,t[2]=u,t[3]=f,t[4]=n*f+a*u-i*s,t[5]=a*f+i*o-n*u,t[6]=i*f+n*s-a*o,t[7]=-n*o-a*s-i*u,t}function u4(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0]*.5,t[5]=e[1]*.5,t[6]=e[2]*.5,t[7]=0,t}function f4(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function l4(t,e){var r=Th();hM(r,e);var n=new qt(3);return lM(n,e),HM(t,r,n),t}function ZM(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function c4(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function h4(t,e,r,n,a,i,o,s,u){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=o,t[6]=s,t[7]=u,t}var d4=py;function v4(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t}var p4=py;function g4(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t}function y4(t,e){var r=e[4],n=e[5],a=e[6],i=e[7],o=-e[0],s=-e[1],u=-e[2],f=e[3];return t[0]=(r*f+i*o+n*u-a*s)*2,t[1]=(n*f+i*s+a*o-r*u)*2,t[2]=(a*f+i*u+r*s-n*o)*2,t}function m4(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r[0]*.5,u=r[1]*.5,f=r[2]*.5,l=e[4],c=e[5],h=e[6],d=e[7];return t[0]=n,t[1]=a,t[2]=i,t[3]=o,t[4]=o*s+a*f-i*u+l,t[5]=o*u+i*s-n*f+c,t[6]=o*f+n*u-a*s+h,t[7]=-n*s-a*u-i*f+d,t}function b4(t,e,r){var n=-e[0],a=-e[1],i=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*i-f*a,h=u*o+l*a+f*n-s*i,d=f*o+l*i+s*a-u*n,v=l*o-s*n-u*a-f*i;return UM(t,e,r),n=t[0],a=t[1],i=t[2],o=t[3],t[4]=c*o+v*n+h*i-d*a,t[5]=h*o+v*a+d*n-c*i,t[6]=d*o+v*i+c*a-h*n,t[7]=v*o-c*n-h*a-d*i,t}function w4(t,e,r){var n=-e[0],a=-e[1],i=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*i-f*a,h=u*o+l*a+f*n-s*i,d=f*o+l*i+s*a-u*n,v=l*o-s*n-u*a-f*i;return $M(t,e,r),n=t[0],a=t[1],i=t[2],o=t[3],t[4]=c*o+v*n+h*i-d*a,t[5]=h*o+v*a+d*n-c*i,t[6]=d*o+v*i+c*a-h*n,t[7]=v*o-c*n-h*a-d*i,t}function x4(t,e,r){var n=-e[0],a=-e[1],i=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*i-f*a,h=u*o+l*a+f*n-s*i,d=f*o+l*i+s*a-u*n,v=l*o-s*n-u*a-f*i;return XM(t,e,r),n=t[0],a=t[1],i=t[2],o=t[3],t[4]=c*o+v*n+h*i-d*a,t[5]=h*o+v*a+d*n-c*i,t[6]=d*o+v*i+c*a-h*n,t[7]=v*o-c*n-h*a-d*i,t}function E4(t,e,r){var n=r[0],a=r[1],i=r[2],o=r[3],s=e[0],u=e[1],f=e[2],l=e[3];return t[0]=s*o+l*n+u*i-f*a,t[1]=u*o+l*a+f*n-s*i,t[2]=f*o+l*i+s*a-u*n,t[3]=l*o-s*n-u*a-f*i,s=e[4],u=e[5],f=e[6],l=e[7],t[4]=s*o+l*n+u*i-f*a,t[5]=u*o+l*a+f*n-s*i,t[6]=f*o+l*i+s*a-u*n,t[7]=l*o-s*n-u*a-f*i,t}function _4(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r[0],u=r[1],f=r[2],l=r[3];return t[0]=n*l+o*s+a*f-i*u,t[1]=a*l+o*u+i*s-n*f,t[2]=i*l+o*f+n*u-a*s,t[3]=o*l-n*s-a*u-i*f,s=r[4],u=r[5],f=r[6],l=r[7],t[4]=n*l+o*s+a*f-i*u,t[5]=a*l+o*u+i*s-n*f,t[6]=i*l+o*f+n*u-a*s,t[7]=o*l-n*s-a*u-i*f,t}function S4(t,e,r,n){if(Math.abs(n)<pt)return ZM(t,e);var a=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);n=n*.5;var i=Math.sin(n),o=i*r[0]/a,s=i*r[1]/a,u=i*r[2]/a,f=Math.cos(n),l=e[0],c=e[1],h=e[2],d=e[3];t[0]=l*f+d*o+c*u-h*s,t[1]=c*f+d*s+h*o-l*u,t[2]=h*f+d*u+l*s-c*o,t[3]=d*f-l*o-c*s-h*u;var v=e[4],p=e[5],g=e[6],y=e[7];return t[4]=v*f+y*o+p*u-g*s,t[5]=p*f+y*s+g*o-v*u,t[6]=g*f+y*u+v*s-p*o,t[7]=y*f-v*o-p*s-g*u,t}function M4(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t}function KM(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r[4],u=r[5],f=r[6],l=r[7],c=e[4],h=e[5],d=e[6],v=e[7],p=r[0],g=r[1],y=r[2],m=r[3];return t[0]=n*m+o*p+a*y-i*g,t[1]=a*m+o*g+i*p-n*y,t[2]=i*m+o*y+n*g-a*p,t[3]=o*m-n*p-a*g-i*y,t[4]=n*l+o*s+a*f-i*u+c*m+v*p+h*y-d*g,t[5]=a*l+o*u+i*s-n*f+h*m+v*g+d*p-c*y,t[6]=i*l+o*f+n*u-a*s+d*m+v*y+c*g-h*p,t[7]=o*l-n*s-a*u-i*f+v*m-c*p-h*g-d*y,t}var A4=KM;function C4(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t}var QM=gy;function T4(t,e,r,n){var a=1-n;return QM(e,r)<0&&(n=-n),t[0]=e[0]*a+r[0]*n,t[1]=e[1]*a+r[1]*n,t[2]=e[2]*a+r[2]*n,t[3]=e[3]*a+r[3]*n,t[4]=e[4]*a+r[4]*n,t[5]=e[5]*a+r[5]*n,t[6]=e[6]*a+r[6]*n,t[7]=e[7]*a+r[7]*n,t}function I4(t,e){var r=wd(e);return t[0]=-e[0]/r,t[1]=-e[1]/r,t[2]=-e[2]/r,t[3]=e[3]/r,t[4]=-e[4]/r,t[5]=-e[5]/r,t[6]=-e[6]/r,t[7]=e[7]/r,t}function k4(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=e[7],t}var JM=yy,N4=JM,wd=my,O4=wd;function L4(t,e){var r=wd(e);if(r>0){r=Math.sqrt(r);var n=e[0]/r,a=e[1]/r,i=e[2]/r,o=e[3]/r,s=e[4],u=e[5],f=e[6],l=e[7],c=n*s+a*u+i*f+o*l;t[0]=n,t[1]=a,t[2]=i,t[3]=o,t[4]=(s-n*c)/r,t[5]=(u-a*c)/r,t[6]=(f-i*c)/r,t[7]=(l-o*c)/r}return t}function D4(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"}function P4(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]}function R4(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],f=t[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(r-l)<=pt*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(n-c)<=pt*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(a-h)<=pt*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(i-d)<=pt*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(o-v)<=pt*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(s-p)<=pt*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(u-g)<=pt*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(f-y)<=pt*Math.max(1,Math.abs(f),Math.abs(y))}const F4=Object.freeze(Object.defineProperty({__proto__:null,add:M4,clone:i4,conjugate:k4,copy:ZM,create:a4,dot:QM,equals:R4,exactEquals:P4,fromMat4:l4,fromRotation:f4,fromRotationTranslation:HM,fromRotationTranslationValues:s4,fromTranslation:u4,fromValues:o4,getDual:v4,getReal:d4,getTranslation:y4,identity:c4,invert:I4,len:N4,length:JM,lerp:T4,mul:A4,multiply:KM,normalize:L4,rotateAroundAxis:S4,rotateByQuatAppend:E4,rotateByQuatPrepend:_4,rotateX:b4,rotateY:w4,rotateZ:x4,scale:C4,set:h4,setDual:g4,setReal:p4,sqrLen:O4,squaredLength:wd,str:D4,translate:m4},Symbol.toStringTag,{value:"Module"}));function eA(){var t=new qt(2);return qt!=Float32Array&&(t[0]=0,t[1]=0),t}function B4(t){var e=new qt(2);return e[0]=t[0],e[1]=t[1],e}function G4(t,e){var r=new qt(2);return r[0]=t,r[1]=e,r}function z4(t,e){return t[0]=e[0],t[1]=e[1],t}function j4(t,e,r){return t[0]=e,t[1]=r,t}function fn(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function tA(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function rA(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t}function nA(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t}function U4(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function $4(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function Pi(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function Ri(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}function X4(t,e){return t[0]=Ba(e[0]),t[1]=Ba(e[1]),t}function wn(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function W4(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t}function Ih(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(r*r+n*n)}function aA(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n}function iA(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)}function oA(t){var e=t[0],r=t[1];return e*e+r*r}function V4(t,e){return t[0]=-e[0],t[1]=-e[1],t}function Y4(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function Wi(t,e){var r=e[0],n=e[1],a=r*r+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t}function wy(t,e){return t[0]*e[0]+t[1]*e[1]}function q4(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t}function H4(t,e,r,n){var a=e[0],i=e[1];return t[0]=a+n*(r[0]-a),t[1]=i+n*(r[1]-i),t}function Z4(t,e){e=e===void 0?1:e;var r=ya()*2*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t}function K4(t,e,r){var n=e[0],a=e[1];return t[0]=r[0]*n+r[2]*a,t[1]=r[1]*n+r[3]*a,t}function Q4(t,e,r){var n=e[0],a=e[1];return t[0]=r[0]*n+r[2]*a+r[4],t[1]=r[1]*n+r[3]*a+r[5],t}function J4(t,e,r){var n=e[0],a=e[1];return t[0]=r[0]*n+r[3]*a+r[6],t[1]=r[1]*n+r[4]*a+r[7],t}function eG(t,e,r){var n=e[0],a=e[1];return t[0]=r[0]*n+r[4]*a+r[12],t[1]=r[1]*n+r[5]*a+r[13],t}function tG(t,e,r,n){var a=e[0]-r[0],i=e[1]-r[1],o=Math.sin(n),s=Math.cos(n);return t[0]=a*s-i*o+r[0],t[1]=a*o+i*s+r[1],t}function sA(t,e){var r=t[0],n=t[1],a=e[0],i=e[1];return Math.abs(Math.atan2(n*a-r*i,r*a+n*i))}function rG(t,e){var r=t[0],n=t[1],a=e[0],i=e[1];return Math.atan2(r*i-n*a,r*a+n*i)}function nG(t){return t[0]=0,t[1]=0,t}function aG(t){return"vec2("+t[0]+", "+t[1]+")"}function xy(t,e){return t[0]===e[0]&&t[1]===e[1]}function iG(t,e){var r=t[0],n=t[1],a=e[0],i=e[1];return Math.abs(r-a)<=pt*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-i)<=pt*Math.max(1,Math.abs(n),Math.abs(i))}var oG=iA,rh=tA,sG=rA,uG=nA,fG=Ih,lG=aA,cG=oA,hG=function(){var t=eA();return function(e,r,n,a,i,o){var s,u;for(r||(r=2),n||(n=0),a?u=Math.min(a*r+n,e.length):u=e.length,s=n;s<u;s+=r)t[0]=e[s],t[1]=e[s+1],i(t,t,o),e[s]=t[0],e[s+1]=t[1];return e}}();const dG=Object.freeze(Object.defineProperty({__proto__:null,add:fn,angle:sA,ceil:U4,clone:B4,copy:z4,create:eA,cross:q4,dist:fG,distance:Ih,div:uG,divide:nA,dot:wy,equals:iG,exactEquals:xy,floor:$4,forEach:hG,fromValues:G4,inverse:Y4,len:oG,length:iA,lerp:H4,max:Ri,min:Pi,mul:sG,multiply:rA,negate:V4,normalize:Wi,random:Z4,rotate:tG,round:X4,scale:wn,scaleAndAdd:W4,set:j4,signedAngle:rG,sqrDist:lG,sqrLen:cG,squaredDistance:aA,squaredLength:oA,str:aG,sub:rh,subtract:tA,transformMat2:K4,transformMat2d:Q4,transformMat3:J4,transformMat4:eG,zero:nG},Symbol.toStringTag,{value:"Module"})),vG=Object.freeze(Object.defineProperty({__proto__:null,glMatrix:y3,mat2:U3,mat2d:h5,mat3:oM,mat4:CF,quat:n4,quat2:F4,vec2:dG,vec3:fB,vec4:LB},Symbol.toStringTag,{value:"Module"}));function pG(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return uy(n,r),Qa(t,n,e)}function gG(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return fy(n,r),Qa(t,n,e)}function yG(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return ly(n,r),Qa(t,n,e)}function mG(t,e,r){return Qa(t,r,e)}function eo(t,e){for(var r=t?[].concat(t):[1,0,0,0,1,0,0,0,1],n=0,a=e.length;n<a;n++){var i=e[n];switch(i[0]){case"t":pG(r,r,[i[1],i[2]]);break;case"s":yG(r,r,[i[1],i[2]]);break;case"r":gG(r,r,i[1]);break;case"m":mG(r,r,i[1]);break}}return r}var Uo=function(e,r){var n=e.nodes,a=e.edges,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var f=[];i.push(f)}),a&&a.forEach(function(s){var u=s.source,f=s.target,l=o[u],c=o[f];!l&&l!==0||!c&&c!==0||(i[l][c]=1,r||(i[c][l]=1))}),i},bG=function(e,r){return e===r},fw=function(){function t(e,r){r===void 0&&(r=null),this.value=e,this.next=r}return t.prototype.toString=function(e){return e?e(this.value):"".concat(this.value)},t}(),uA=function(){function t(e){e===void 0&&(e=bG),this.head=null,this.tail=null,this.compare=e}return t.prototype.prepend=function(e){var r=new fw(e,this.head);return this.head=r,this.tail||(this.tail=r),this},t.prototype.append=function(e){var r=new fw(e);return this.head?(this.tail.next=r,this.tail=r,this):(this.head=r,this.tail=r,this)},t.prototype.delete=function(e){if(!this.head)return null;for(var r=null;this.head&&this.compare(this.head.value,e);)r=this.head,this.head=this.head.next;var n=this.head;if(n!==null)for(;n.next;)this.compare(n.next.value,e)?(r=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,e)&&(this.tail=n),r},t.prototype.find=function(e){var r=e.value,n=r===void 0?void 0:r,a=e.callback,i=a===void 0?void 0:a;if(!this.head)return null;for(var o=this.head;o;){if(i&&i(o.value)||n!==void 0&&this.compare(o.value,n))return o;o=o.next}return null},t.prototype.deleteTail=function(){var e=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,e;for(var r=this.head;r.next;)r.next.next?r=r.next:r.next=null;return this.tail=r,e},t.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},t.prototype.fromArray=function(e){var r=this;return e.forEach(function(n){return r.append(n)}),this},t.prototype.toArray=function(){for(var e=[],r=this.head;r;)e.push(r),r=r.next;return e},t.prototype.reverse=function(){for(var e=this.head,r=null,n=null;e;)n=e.next,e.next=r,r=e,e=n;this.tail=this.head,this.head=r},t.prototype.toString=function(e){return e===void 0&&(e=void 0),this.toArray().map(function(r){return r.toString(e)}).toString()},t}(),wG=function(){function t(){this.linkedList=new uA}return t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},t.prototype.enqueue=function(e){this.linkedList.append(e)},t.prototype.dequeue=function(){var e=this.linkedList.deleteHead();return e?e.value:null},t.prototype.toString=function(e){return this.linkedList.toString(e)},t}(),Un=function(e,r,n){r===void 0&&(r=[]);var a=r.filter(function(u){return u.source===e||u.target===e});if(n==="target"){var i=function(f){return f.source===e};return a.filter(i).map(function(u){return u.target})}if(n==="source"){var o=function(f){return f.target===e};return a.filter(o).map(function(u){return u.source})}var s=function(f){return f.source===e?f.target:f.source};return a.map(s)},xG=function(e,r){return r.filter(function(n){return n.source===e})},nh=function(e,r){return r.filter(function(n){return n.source===e||n.target===e})},fA=function(e){e===void 0&&(e=0);var r="".concat(Math.random()).split(".")[1].substr(0,5),n="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(e,"-").concat(r).concat(n)};function EG(t){t===void 0&&(t={});var e=t,r=function(){},n=function(){var a={};return function(i){var o=i.next,s=o;return a[s]?!1:(a[s]=!0,!0)}}();return e.allowTraversal=t.allowTraversal||n,e.enter=t.enter||r,e.leave=t.leave||r,e}var lA=function(e,r,n,a){a===void 0&&(a=!0);var i=EG(n),o=new wG,s=e.edges,u=s===void 0?[]:s;o.enqueue(r);for(var f="",l=function(){var h=o.dequeue();i.enter({current:h,previous:f}),Un(h,u,a?"target":void 0).forEach(function(d){i.allowTraversal({previous:f,current:h,next:d})&&o.enqueue(d)}),i.leave({current:h,previous:f}),f=h};!o.isEmpty();)l()},_G=function(e){for(var r=e.nodes,n=r===void 0?[]:r,a=e.edges,i=a===void 0?[]:a,o=[],s={},u=[],f=function d(v){u.push(v),s[v.id]=!0;for(var p=Un(v.id,i),g=function(b){var w=p[b];if(!s[w]){var x=n.filter(function(E){return E.id===w});x.length>0&&d(x[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},cA=function(e){for(var r=e.nodes,n=r===void 0?[]:r,a=e.edges,i=a===void 0?[]:a,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=Un(y.id,i,"target").filter(function(_){return n.map(function(S){return S.id}).indexOf(_)>-1}),b=function(S){var A=m[S];if(!u[A]&&u[A]!==0){var M=n.filter(function(C){return C.id===A});M.length>0&&g(M[0]),f[y.id]=Math.min(f[y.id],f[A])}else s[A]&&(f[y.id]=Math.min(f[y.id],u[A]))},w=0;w<m.length;w++)b(w);if(f[y.id]===u[y.id]){for(var x=[];o.length>0;){var E=o.pop();if(s[E.id]=!1,x.push(E),E===y)break}x.length>0&&l.push(x)}},d=0,v=n;d<v.length;d++){var p=v[d];!u[p.id]&&u[p.id]!==0&&h(p)}return l};function Ey(t,e){return e?cA(t):_G(t)}var yi=function(e){var r={},n=e.nodes,a=n===void 0?[]:n,i=e.edges,o=i===void 0?[]:i;return a.forEach(function(s){r[s.id]={degree:0,inDegree:0,outDegree:0}}),o.forEach(function(s){r[s.source].degree++,r[s.source].outDegree++,r[s.target].degree++,r[s.target].inDegree++}),r},hA=function(e,r){var n=yi(e);return n[r]?yi(e)[r].inDegree:0},dA=function(e,r){var n=yi(e);return n[r]?yi(e)[r].outDegree:0};function SG(t){t===void 0&&(t={});var e=t,r=function(){},n=function(){var a={};return function(i){var o=i.next;return a[o]?!1:(a[o]=!0,!0)}}();return e.allowTraversal=t.allowTraversal||n,e.enter=t.enter||r,e.leave=t.leave||r,e}function vA(t,e,r,n,a){a===void 0&&(a=!0),n.enter({current:e,previous:r});var i=t.edges,o=i===void 0?[]:i;Un(e,o,a?"target":void 0).forEach(function(s){n.allowTraversal({previous:r,current:e,next:s})&&vA(t,s,e,n,a)}),n.leave({current:e,previous:r})}function _y(t,e,r,n){n===void 0&&(n=!0),vA(t,e,"",SG(r),n)}var Sy=function(e){var r=null,n=e.nodes,a=n===void 0?[]:n,i={},o={},s={},u={};a.forEach(function(c){o[c.id]=c});for(var f={enter:function(h){var d=h.current,v=h.previous;if(s[d]){r={};for(var p=d,g=v;g!==d;)r[p]=g,p=g,g=i[g];r[p]=g}else s[d]=d,delete o[d],i[d]=v},leave:function(h){var d=h.current;u[d]=d,delete s[d]},allowTraversal:function(h){var d=h.next;return r?!1:!u[d]}};Object.keys(o).length;){var l=Object.keys(o)[0];_y(e,l,f)}return r},My=function(e,r,n){var a,i;n===void 0&&(n=!0);for(var o=[],s=Ey(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=(a={},a[h]=c,a),p=(i={},i[h]=new Set,i);d.length>0;)for(var g=d.pop(),y=g.id,m=Un(y,e.edges),b=function(E){var _,S=m[E],A=e.nodes.find(function(B){return B.id===S});if(S===y)o.push((_={},_[S]=g,_));else if(!(S in p))v[S]=g,d.push(A),p[S]=new Set([g]);else if(!p[y].has(A)){for(var M=!0,C=[A,g],I=v[y];p[S].size&&!p[S].has(I)&&(C.push(I),I!==v[I.id]);)I=v[I.id];if(C.push(I),r&&n?(M=!1,C.findIndex(function(B){return r.indexOf(B.id)>-1})>-1&&(M=!0)):r&&!n&&C.findIndex(function(B){return r.indexOf(B.id)>-1})>-1&&(M=!1),M){for(var k={},O=1;O<C.length;O+=1)k[C[O-1].id]=C[O];C.length&&(k[C[C.length-1].id]=C[0]),o.push(k)}p[S].add(g)}},w=0;w<m.length;w+=1)b(w)}return o},Ay=function(e,r,n){n===void 0&&(n=!0);for(var a=[],i=new Set,o=[],s=[],u={},f={},l=function(I){for(var k=[I];k.length>0;){var O=k.pop();i.has(O)&&(i.delete(O),o[O.id].forEach(function(B){k.push(B)}),o[O.id].clear())}},c=function C(I,k,O){var B=!1;if(r&&n===!1&&r.indexOf(I.id)>-1)return B;a.push(I),i.add(I);for(var L=O[I.id],z=0;z<L.length;z+=1){var X=u[L[z]];if(X===k){for(var R={},V=1;V<a.length;V+=1)R[a[V-1].id]=a[V];a.length&&(R[a[a.length-1].id]=a[0]),s.push(R),B=!0}else i.has(X)||C(X,k,O)&&(B=!0)}if(B)l(I);else for(var z=0;z<L.length;z+=1){var X=u[L[z]];o[X.id].has(I)||o[X.id].add(I)}return a.pop(),B},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(r&&n)for(var y=function(I){var k=r[I];f[d[I].id]=f[k],f[k]=0,u[0]=d.find(function(O){return O.id===k}),u[f[d[I].id]]=d[I]},v=0;v<r.length;v++)y(v);for(var m=function(I){for(var k,O,B=1/0,L=0;L<I.length;L+=1)for(var z=I[L],X=0;X<z.length;X++){var R=f[z[X].id];R<B&&(B=R,O=L)}for(var V=I[O],he=[],L=0;L<V.length;L+=1){var ce=V[L];he[ce.id]=[];for(var le=0,ie=Un(ce.id,e.edges,"target").filter(function(Ve){return V.map(function(it){return it.id}).indexOf(Ve)>-1});le<ie.length;le++){var Ie=ie[le];Ie===ce.id&&!(n===!1&&r.indexOf(ce.id)>-1)?s.push((k={},k[ce.id]=ce,k)):he[ce.id].push(f[Ie])}}return{component:V,adjList:he,minIdx:B}},b=0;b<d.length;){var w=d.filter(function(C){return f[C.id]>=b}),x=cA({nodes:w,edges:e.edges}).filter(function(C){return C.length>1});if(x.length===0)break;var E=m(x),_=E.minIdx,S=E.adjList,A=E.component;if(A.length>1){A.forEach(function(C){o[C.id]=new Set});var M=u[_];if(r&&n&&r.indexOf(M.id)===-1)return s;c(M,M,S),b=_+1}else break}return s},pA=function(e,r,n,a){return a===void 0&&(a=!0),r?Ay(e,n,a):My(e,n,a)},MG=function(e,r,n){for(var a=1/0,i,o=0;o<r.length;o++){var s=r[o].id;!n[s]&&e[s]<=a&&(a=e[s],i=r[o])}return i},Nf=function(e,r,n,a){var i=e.nodes,o=i===void 0?[]:i,s=e.edges,u=s===void 0?[]:s,f={},l={},c={};o.forEach(function(m,b){var w=m.id;l[w]=1/0,w===r&&(l[w]=0)});for(var h=o.length,d=function(b){var w=MG(l,o,f),x=w.id;if(f[x]=!0,l[x]===1/0)return"continue";var E=[];n?E=xG(x,u):E=nh(x,u),E.forEach(function(_){var S=_.target,A=_.source,M=S===x?A:S,C=a&&_[a]?_[a]:1;l[M]>l[w.id]+C?(l[M]=l[w.id]+C,c[M]=[w.id]):l[M]===l[w.id]+C&&c[M].push(w.id)})},v=0;v<h;v++)d();c[r]=[r];var p={};for(var g in l)l[g]!==1/0&&gA(r,g,c,p);var y={};for(var g in p)y[g]=p[g][0];return{length:l,path:y,allPath:p}};function gA(t,e,r,n){if(t===e)return[t];if(n[e])return n[e];for(var a=[],i=0,o=r[e];i<o.length;i++){var s=o[i],u=gA(t,s,r,n);if(!u)return;for(var f=0,l=u;f<l.length;f++){var c=l[f];bt(c)?a.push(Xn(Xn([],c,!0),[e],!1)):a.push([c,e])}}return n[e]=a,n[e]}var yA=function(e,r,n,a,i){var o=Nf(e,r,a,i),s=o.length,u=o.path,f=o.allPath;return{length:s[n],path:u[n],allPath:f[n]}},mA=function(e,r,n,a){var i;if(r===n)return[[r]];var o=e.edges,s=o===void 0?[]:o,u=[r],f=(i={},i[r]=!0,i),l=[],c=[],h=a?Un(r,s,"target"):Un(r,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=a?Un(v,s,"target"):Un(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},Of=function(e,r){for(var n=Uo(e,r),a=[],i=n.length,o=0;o<i;o+=1){a[o]=[];for(var s=0;s<i;s+=1)o===s?a[o][s]=0:n[o][s]===0||!n[o][s]?a[o][s]=1/0:a[o][s]=n[o][s]}for(var u=0;u<i;u+=1)for(var o=0;o<i;o+=1)for(var s=0;s<i;s+=1)a[o][s]>a[o][u]+a[u][s]&&(a[o][s]=a[o][u]+a[u][s]);return a},bA=function(e,r,n,a){r===void 0&&(r=!1),n===void 0&&(n="weight"),a===void 0&&(a=1e3);var i=e.nodes,o=i===void 0?[]:i,s=e.edges,u=s===void 0?[]:s,f={},l={};o.forEach(function(b,w){var x=fA();b.clusterId=x,f[x]={id:x,nodes:[b]},l[b.id]={node:b,idx:w}});var c=Uo(e,r),h={};c.forEach(function(b,w){var x=o[w].id;h[x]={},b.forEach(function(E,_){if(E){var S=o[_].id;h[x][S]=E}})});for(var d=0,v=function(){var w=!1;if(o.forEach(function(x){var E={};Object.keys(h[x.id]).forEach(function(O){var B=h[x.id][O],L=l[O].node,z=L.clusterId;E[z]||(E[z]=0),E[z]+=B});var _=-1/0,S=[];if(Object.keys(E).forEach(function(O){_<E[O]?(_=E[O],S=[O]):_===E[O]&&S.push(O)}),!(S.length===1&&S[0]===x.clusterId)){var A=S.indexOf(x.clusterId);if(A>=0&&S.splice(A,1),S&&S.length){w=!0;var M=f[x.clusterId],C=M.nodes.indexOf(x);M.nodes.splice(C,1);var I=Math.floor(Math.random()*S.length),k=f[S[I]];k.nodes.push(x),x.clusterId=k.id}}}),!w)return"break";d++};d<a;){var p=v();if(p==="break")break}Object.keys(f).forEach(function(b){var w=f[b];(!w.nodes||!w.nodes.length)&&delete f[b]});var g=[],y={};u.forEach(function(b){var w=b.source,x=b.target,E=b[n]||1,_=l[w].node.clusterId,S=l[x].node.clusterId,A="".concat(_,"---").concat(S);if(y[A])y[A].weight+=E,y[A].count++;else{var M={source:_,target:S,weight:E,count:1};y[A]=M,g.push(M)}});var m=[];return Object.keys(f).forEach(function(b){m.push(f[b])}),{clusters:m,clusterEdges:g}},ta=function(){function t(e){this.arr=e}return t.prototype.getArr=function(){return this.arr||[]},t.prototype.add=function(e){var r,n=e.arr;if(!(!((r=this.arr)===null||r===void 0)&&r.length))return new t(n);if(!(n!=null&&n.length))return new t(this.arr);if(this.arr.length===n.length){var a=[];for(var i in this.arr)a[i]=this.arr[i]+n[i];return new t(a)}},t.prototype.subtract=function(e){var r,n=e.arr;if(!(!((r=this.arr)===null||r===void 0)&&r.length))return new t(n);if(!(n!=null&&n.length))return new t(this.arr);if(this.arr.length===n.length){var a=[];for(var i in this.arr)a[i]=this.arr[i]-n[i];return new t(a)}},t.prototype.avg=function(e){var r=[];if(e!==0)for(var n in this.arr)r[n]=this.arr[n]/e;return new t(r)},t.prototype.negate=function(){var e=[];for(var r in this.arr)e[r]=-this.arr[r];return new t(e)},t.prototype.squareEuclideanDistance=function(e){var r,n=e.arr;if(!(!((r=this.arr)===null||r===void 0)&&r.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var a=0;for(var i in this.arr)a+=Math.pow(this.arr[i]-e.arr[i],2);return a}},t.prototype.euclideanDistance=function(e){var r,n=e.arr;if(!(!((r=this.arr)===null||r===void 0)&&r.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var a=0;for(var i in this.arr)a+=Math.pow(this.arr[i]-e.arr[i],2);return Math.sqrt(a)}else console.error("The two vectors are unequal in length.")},t.prototype.normalize=function(){var e=[],r=rr(this.arr);r.sort(function(o,s){return o-s});var n=r[r.length-1],a=r[0];for(var i in this.arr)e[i]=(this.arr[i]-a)/(n-a);return new t(e)},t.prototype.norm2=function(){var e;if(!(!((e=this.arr)===null||e===void 0)&&e.length))return 0;var r=0;for(var n in this.arr)r+=Math.pow(this.arr[n],2);return Math.sqrt(r)},t.prototype.dot=function(e){var r,n=e.arr;if(!(!((r=this.arr)===null||r===void 0)&&r.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var a=0;for(var i in this.arr)a+=this.arr[i]*e.arr[i];return a}else console.error("The two vectors are unequal in length.")},t.prototype.equal=function(e){var r,n=e.arr;if(((r=this.arr)===null||r===void 0?void 0:r.length)!==(n==null?void 0:n.length))return!1;for(var a in this.arr)if(this.arr[a]!==n[a])return!1;return!0},t}(),Cy=function(e,r){r===void 0&&(r=void 0);var n=[];return e.forEach(function(a){r===void 0&&n.push(a),a[r]!==void 0&&n.push(a[r])}),n},pa;(function(t){t.EuclideanDistance="euclideanDistance"})(pa||(pa={}));var AG=function(e,r,n){var a=[];r!=null&&r.length?a=r:(e.forEach(function(o){a=a.concat(Object.keys(o))}),a=kf(a));var i={};return a.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))&&(i[o]=kf(s))}),i},Ty=function(e,r,n){var a=AG(e,r,n),i=[];if(!Object.keys(a).length)return i;var o=Object.values(a),s=o.every(function(u){return u.every(function(f){return typeof f=="number"})});return e.forEach(function(u,f){var l=[];Object.keys(a).forEach(function(c){var h=u[c],d=a[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)}),i[f]=l}),i},lw=function(e,r,n,a){n===void 0&&(n=pa.EuclideanDistance);var i=0;switch(n){case pa.EuclideanDistance:i=new ta(e).euclideanDistance(new ta(r));break}return i},cw=function(e,r,n,a){for(var i=r.length,o=2*a,s=0,u=0;u<i;u++)for(var f=e[u].clusterId,l=0;l<i;l++){var c=e[l].clusterId;if(f===c){var h=r[u][l]||0,d=n[u]||0,v=n[l]||0;s+=h-d*v/o}}return s*=1/o,s},fp=function(e,r){e===void 0&&(e=[]);for(var n=e.length,a=new ta([]),i=0;i<n;i++)a=a.add(new ta(r[i]));var o=a.avg(n);o.normalize();for(var s=0,i=0;i<n;i++){var u=new ta(r[i]),f=u.squareEuclideanDistance(o);s+=f}var l=[];e.forEach(function(){l.push([])});for(var i=0;i<n;i++){var u=new ta(r[i]);e[i].clusterInertial=0;for(var c=0;c<n;c++){if(i===c){l[i][c]=0;continue}var h=new ta(r[c]);l[i][c]=u.squareEuclideanDistance(h),e[i].clusterInertial+=l[i][c]}}for(var d=0,v=2*n*s,i=0;i<n;i++)for(var p=e[i].clusterId,c=0;c<n;c++){var g=e[c].clusterId;if(!(i===c||p!==g)){var y=e[i].clusterInertial*e[c].clusterInertial/Math.pow(v,2)-l[i][c]/v;d+=y}}return Number(d.toFixed(4))},Iy=function(e,r,n,a,i,o,s,u,f){r===void 0&&(r=!1),n===void 0&&(n="weight"),a===void 0&&(a=1e-4),i===void 0&&(i=!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(i){c.forEach(function(R,V){R.properties=R.properties||{},R.originIndex=V});var p=[];c.every(function(R){return R.hasOwnProperty("nodeType")})&&(p=Array.from(new Set(c.map(function(R){return R.nodeType}))),c.forEach(function(R){R.properties.nodeType=p.findIndex(function(V){return V===R.nodeType})}));var g=Cy(c,o);v=Ty(g,s,u)}var y=1,m={},b={};c.forEach(function(R,V){var he=String(y++);R.clusterId=he,m[he]={id:he,nodes:[R]},b[R.id]={node:R,idx:V}});var w=Uo(e,r),x=[],E={},_=0;w.forEach(function(R,V){var he=0,ce=c[V].id;E[ce]={},R.forEach(function(le,ie){if(le){he+=le;var Ie=c[ie].id;E[ce][Ie]=le,_+=le}}),x.push(he)}),_/=2;for(var S=1/0,A=1/0,M=0,C=[],I={};;){i&&c.every(function(R){return R.hasOwnProperty("properties")})?S=cw(c,w,x,_)+fp(c,v)*f:S=cw(c,w,x,_),M===0&&(A=S,C=c,I=m);var k=S>0&&S>A&&S-A<a;if(S>A&&(C=c.map(function(R){return{node:R,clusterId:R.clusterId}}),I=rr(m),A=S),k||M>100)break;M++,Object.keys(m).forEach(function(R){var V=0;d.forEach(function(he){var ce=he.source,le=he.target,ie=b[ce].node.clusterId,Ie=b[le].node.clusterId;(ie===R&&Ie!==R||Ie===R&&ie!==R)&&(V=V+(he[n]||1))}),m[R].sumTot=V}),c.forEach(function(R,V){var he=m[R.clusterId],ce=0,le,ie=x[V]/(2*_),Ie=0,qe=he.nodes;qe.forEach(function(Wt){var vr=b[Wt.id].idx;Ie+=w[V][vr]||0});var Ve=Ie-he.sumTot*ie,it=qe.filter(function(Wt){return Wt.id!==R.id});it.forEach(function(Wt,vr){v[Wt.originIndex]});var dt=fp(it,v)*f,st=E[R.id];if(Object.keys(st).forEach(function(Wt){var vr=b[Wt].node,cr=vr.clusterId;if(cr!==R.clusterId){var $t=m[cr],sr=$t.nodes;if(!(!sr||!sr.length)){var tn=0;sr.forEach(function(Fe){var ge=b[Fe.id].idx;tn+=w[V][ge]||0});var tt=tn-$t.sumTot*ie,te=sr.concat([R]);te.forEach(function(Fe,ge){v[Fe.originIndex]});var N=fp(te,v)*f,Se=tt-Ve;i&&(Se=tt+N-(Ve+dt)),Se>ce&&(ce=Se,le=$t)}}}),ce>0){le.nodes.push(R);var Tt=R.clusterId;R.clusterId=le.id;var _t=he.nodes.indexOf(R);he.nodes.splice(_t,1);var lr=0,Bt=0;d.forEach(function(Wt){var vr=Wt.source,cr=Wt.target,$t=b[vr].node.clusterId,sr=b[cr].node.clusterId;($t===le.id&&sr!==le.id||sr===le.id&&$t!==le.id)&&(lr=lr+(Wt[n]||1)),($t===Tt&&sr!==Tt||sr===Tt&&$t!==Tt)&&(Bt=Bt+(Wt[n]||1))}),le.sumTot=lr,he.sumTot=Bt}})}var O={},B=0;Object.keys(I).forEach(function(R){var V=I[R];if(!V.nodes||!V.nodes.length){delete I[R];return}var he=String(B+1);he!==R&&(V.id=he,V.nodes=V.nodes.map(function(ce){return{id:ce.id,clusterId:he}}),I[he]=V,O[R]=he,delete I[R],B++)}),C.forEach(function(R){var V=R.node,he=R.clusterId;V&&(V.clusterId=he,V.clusterId&&O[V.clusterId]&&(V.clusterId=O[V.clusterId]))});var L=[],z={};d.forEach(function(R){var V=R.source,he=R.target,ce=R[n]||1,le=b[V].node.clusterId,ie=b[he].node.clusterId;if(!(!le||!ie)){var Ie="".concat(le,"---").concat(ie);if(z[Ie])z[Ie].weight+=ce,z[Ie].count++;else{var qe={source:le,target:ie,weight:ce,count:1};z[Ie]=qe,L.push(qe)}}});var X=[];return Object.keys(I).forEach(function(R){X.push(I[R])}),{clusters:X,clusterEdges:L}},wA=function(e,r,n,a,i,o,s,u){return r===void 0&&(r=!1),n===void 0&&(n="weight"),a===void 0&&(a=1e-4),i===void 0&&(i=void 0),o===void 0&&(o=[]),s===void 0&&(s=["id"]),u===void 0&&(u=1),Iy(e,r,n,a,!0,i,o,s,u)},xA=function(e,r){var n;r===void 0&&(r=1);for(var a=rr(e),i=a.nodes,o=i===void 0?[]:i,s=a.edges,u=s===void 0?[]:s,f=function(){var h=yi({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)>=r)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}},hw=function(e,r,n){var a=[];switch(e){case pa.EuclideanDistance:a=r[n];break;default:a=[];break}return a},EA=function(e,r,n,a,i,o){r===void 0&&(r=3),n===void 0&&(n=void 0),a===void 0&&(a=[]),i===void 0&&(i=["id"]),o===void 0&&(o=pa.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===pa.EuclideanDistance&&!u.every(function(he){return he.hasOwnProperty(n)}))return c;var h=[],d=[];if(o===pa.EuclideanDistance&&(h=Cy(u,n),d=Ty(h,a,i)),!d.length)return c;for(var v=kf(d.map(function(he){return he.join("")})),p=Math.min(r,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 w=Math.floor(Math.random()*u.length);switch(o){case pa.EuclideanDistance:y[g]=d[w];break;default:y[g]=[];break}m.push(w),b[g]=[u[w]],u[w].clusterId=String(g)}else{for(var x=-1/0,E=0,_=function(le){if(!m.includes(le)){for(var ie=0,Ie=0;Ie<y.length;Ie++){var qe=0;switch(o){case pa.EuclideanDistance:qe=lw(d[u[le].originIndex],y[Ie],o);break}ie+=qe}var Ve=ie/y.length;Ve>x&&!y.find(function(it){return jo(it,hw(o,d,u[le].originIndex))})&&(x=Ve,E=le)}},S=0;S<u.length;S++)_(S);y[g]=hw(o,d,E),m.push(E),b[g]=[u[E]],u[E].clusterId=String(g)}for(var A=0;;){for(var g=0;g<u.length;g++){var M=0,C=1/0;if(!(A===0&&m.includes(g))){for(var I=0;I<y.length;I++){var k=0;switch(o){case pa.EuclideanDistance:k=lw(d[g],y[I],o);break}k<C&&(C=k,M=I)}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(M),b[M].push(u[g])}}for(var B=!1,g=0;g<b.length;g++){for(var L=b[g],z=new ta([]),I=0;I<L.length;I++)z=z.add(new ta(d[L[I].originIndex]));var X=z.avg(L.length);X.equal(new ta(y[g]))||(B=!0,y[g]=X.getArr())}if(A++,u.every(function(he){return he.clusterId!==void 0})&&B||A>=1e3)break}var R=[],V={};return l.forEach(function(he){var ce,le,ie=he.source,Ie=he.target,qe=(ce=u.find(function(st){return st.id===ie}))===null||ce===void 0?void 0:ce.clusterId,Ve=(le=u.find(function(st){return st.id===Ie}))===null||le===void 0?void 0:le.clusterId,it="".concat(qe,"---").concat(Ve);if(V[it])V[it].count++;else{var dt={source:qe,target:Ve,count:1};V[it]=dt,R.push(dt)}}),{clusters:b,clusterEdges:R}},ky=function(e,r){var n=new ta(r),a=n.norm2(),i=new ta(e),o=i.norm2(),s=n.dot(i),u=a*o,f=u?s/u:0;return f},_A=function(e,r,n,a,i){e===void 0&&(e=[]),n===void 0&&(n=void 0),a===void 0&&(a=[]),i===void 0&&(i=[]);var o=rr(e.filter(function(h){return h.id!==r.id})),s=e.findIndex(function(h){return h.id===r.id}),u=Cy(e,n),f=Ty(u,a,i),l=f[s],c=[];return o.forEach(function(h,d){if(h.id!==r.id){var v=f[d],p=ky(v,l);c.push(p),h.cosineSimilarity=p}}),o.sort(function(h,d){return d.cosineSimilarity-h.cosineSimilarity}),{allCosineSimilarity:c,similarNodes:o}},CG=function(){function t(e){this.count=e.length,this.parent={};for(var r=0,n=e;r<n.length;r++){var a=n[r];this.parent[a]=a}}return t.prototype.find=function(e){for(;this.parent[e]!==e;)e=this.parent[e];return e},t.prototype.union=function(e,r){var n=this.find(e),a=this.find(r);n!==a&&(n<a?(this.parent[r]!==r&&this.union(this.parent[r],e),this.parent[r]=this.parent[e]):(this.parent[e]!==e&&this.union(this.parent[e],r),this.parent[e]=this.parent[r]))},t.prototype.connected=function(e,r){return this.find(e)===this.find(r)},t}(),TG=function(e,r){return e-r},IG=function(){function t(e){e===void 0&&(e=TG),this.compareFn=e,this.list=[]}return t.prototype.getLeft=function(e){return 2*e+1},t.prototype.getRight=function(e){return 2*e+2},t.prototype.getParent=function(e){return e===0?null:Math.floor((e-1)/2)},t.prototype.isEmpty=function(){return this.list.length<=0},t.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},t.prototype.delMin=function(){var e=this.top(),r=this.list.pop();return this.list.length>0&&(this.list[0]=r,this.moveDown(0)),e},t.prototype.insert=function(e){if(e!==null){this.list.push(e);var r=this.list.length-1;return this.moveUp(r),!0}return!1},t.prototype.moveUp=function(e){for(var r=this.getParent(e);e&&e>0&&this.compareFn(this.list[r],this.list[e])>0;){var n=this.list[r];this.list[r]=this.list[e],this.list[e]=n,e=r,r=this.getParent(e)}},t.prototype.moveDown=function(e){var r,n=e,a=this.getLeft(e),i=this.getRight(e),o=this.list.length;a!==null&&a<o&&this.compareFn(this.list[n],this.list[a])>0?n=a:i!==null&&i<o&&this.compareFn(this.list[n],this.list[i])>0&&(n=i),e!==n&&(r=[this.list[n],this.list[e]],this.list[e]=r[0],this.list[n]=r[1],this.moveDown(n))},t}(),kG=function(e,r){var n=[],a=e.nodes,i=a===void 0?[]:a,o=e.edges,s=o===void 0?[]:o;if(i.length===0)return n;var u=i[0],f=new Set;f.add(u);var l=function(g,y){return r?g.weight-y.weight:0},c=new IG(l);for(nh(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),nh(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),nh(v,s).forEach(function(p){c.insert(p)})))}return n},dw=function(e,r){var n=[],a=e.nodes,i=a===void 0?[]:a,o=e.edges,s=o===void 0?[]:o;if(i.length===0)return n;var u=s.map(function(d){return d});r&&u.sort(function(d,v){return d.weight-v.weight});for(var f=new CG(i.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},SA=function(e,r,n){var a={prim:kG,kruskal:dw};return n?a[n](e,r):dw(e,r)},MA=function(e,r,n){typeof r!="number"&&(r=1e-6),typeof n!="number"&&(n=.85);for(var a=1,i=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=yi(e);o>0&&a>r;){i=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=Un(y,l,"source"),w=0;w<b.length;++w){var x=b[w],E=m[x].outDegree;E>0&&(h+=v[x]/E)}d[y]=n*h,i+=d[y]}}i=(1-i)/c,a=0;for(var p=0;p<c;++p){var g=u[p],y=g.id;h=d[y]+i,a+=Math.abs(h-v[y]),v[y]=h}o-=1}return v},NG=-1,kh=-1,AA="-1",Ga="-1",CA=-1,vw=function(){function t(e,r,n,a){e===void 0&&(e=NG),r===void 0&&(r=kh),n===void 0&&(n=kh),a===void 0&&(a=AA),this.id=e,this.from=r,this.to=n,this.label=a}return t}(),OG=function(){function t(e,r){e===void 0&&(e=kh),r===void 0&&(r=Ga),this.id=e,this.label=r,this.edges=[],this.edgeMap={}}return t.prototype.addEdge=function(e){this.edges.push(e),this.edgeMap[e.id]=e},t}(),TA=function(){function t(e,r,n){e===void 0&&(e=kh),r===void 0&&(r=!0),n===void 0&&(n=!1),this.id=e,this.edgeIdAutoIncrease=r,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=n}return t.prototype.getNodeNum=function(){return this.nodes.length},t.prototype.addNode=function(e,r){if(!this.nodeMap[e]){var n=new OG(e,r);this.nodes.push(n),this.nodeMap[e]=n,this.nodeLabelMap[r]||(this.nodeLabelMap[r]=[]),this.nodeLabelMap[r].push(e)}},t.prototype.addEdge=function(e,r,n,a){if((this.edgeIdAutoIncrease||e===void 0)&&(e=this.counter++),!(this.nodeMap[r]&&this.nodeMap[n]&&this.nodeMap[n].edgeMap[e])){var i=new vw(e,r,n,a);if(this.edges.push(i),this.edgeMap[e]=i,this.nodeMap[r].addEdge(i),this.edgeLabelMap[a]||(this.edgeLabelMap[a]=[]),this.edgeLabelMap[a].push(i),!this.directed){var o=new vw(e,n,r,a);this.nodeMap[n].addEdge(o),this.edgeLabelMap[a].push(o)}}},t}(),ko=function(){function t(e,r,n,a,i){this.fromNode=e,this.toNode=r,this.nodeEdgeNodeLabel={nodeLabel1:n||Ga,edgeLabel:a||AA,nodeLabel2:i||Ga}}return t.prototype.equalTo=function(e){return this.fromNode===e.formNode&&this.toNode===e.toNode&&this.nodeEdgeNodeLabel===e.nodeEdgeNodeLabel},t.prototype.notEqualTo=function(e){return!this.equalTo(e)},t}(),pw=function(){function t(){this.rmpath=[],this.dfsEdgeList=[]}return t.prototype.equalTo=function(e){var r=this.dfsEdgeList.length,n=e.length;if(r!==n)return!1;for(var a=0;a<r;a++)if(this.dfsEdgeList[a]!==e[a])return!1;return!0},t.prototype.notEqualTo=function(e){return!this.equalTo(e)},t.prototype.pushBack=function(e,r,n,a,i){return this.dfsEdgeList.push(new ko(e,r,n,a,i)),this.dfsEdgeList},t.prototype.toGraph=function(e,r){e===void 0&&(e=CA),r===void 0&&(r=!1);var n=new TA(e,!0,r);return this.dfsEdgeList.forEach(function(a){var i=a.fromNode,o=a.toNode,s=a.nodeEdgeNodeLabel,u=s.nodeLabel1,f=s.edgeLabel,l=s.nodeLabel2;u!==Ga&&n.addNode(i,u),l!==Ga&&n.addNode(o,l),u!==Ga&&l!==u&&n.addEdge(void 0,i,o,f)}),n},t.prototype.buildRmpath=function(){this.rmpath=[];for(var e=void 0,r=this.dfsEdgeList.length,n=r-1;n>=0;n--){var a=this.dfsEdgeList[n],i=a.fromNode,o=a.toNode;i<o&&(e===void 0||o===e)&&(this.rmpath.push(n),e=i)}return this.rmpath},t.prototype.getNodeNum=function(){var e={};return this.dfsEdgeList.forEach(function(r){e[r.fromNode]||(e[r.fromNode]=!0),e[r.toNode]||(e[r.toNode]=!0)}),Object.keys(e).length},t}(),ic=function(){function t(e){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!e){for(;e;){var r=e.edge;this.edges.push(r),this.nodesUsed[r.from]=1,this.nodesUsed[r.to]=1,this.edgesUsed[r.id]=1,e=e.preNode}this.edges=this.edges.reverse()}}return t.prototype.hasNode=function(e){return this.nodesUsed[e.id]===1},t.prototype.hasEdge=function(e){return this.edgesUsed[e.id]===1},t}(),LG=function(){function t(e){var r=e.graphs,n=e.minSupport,a=n===void 0?2:n,i=e.minNodeNum,o=i===void 0?1:i,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=r,this.dfsCode=new pw,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=a,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 t.prototype.findForwardRootEdges=function(e,r){var n=this,a=[],i=e.nodeMap;return r.edges.forEach(function(o){(n.directed||r.label<=i[o.to].label)&&a.push(o)}),a},t.prototype.findBackwardEdge=function(e,r,n,a){if(!this.directed&&r===n)return null;for(var i=e.nodeMap,o=i[n.to],s=o.edges,u=s.length,f=0;f<u;f++){var l=s[f];if(!(a.hasEdge(l)||l.to!==r.from)){if(this.directed){if(i[r.from].label<i[n.to].label||i[r.from].label===i[n.to].label&&r.label<=l.label)return l}else if(r.label<l.label||r.label===l.label&&i[r.to].label<=i[n.to].label)return l}}return null},t.prototype.findForwardPureEdges=function(e,r,n,a){for(var i=[],o=r.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&&!a.hasNode(c)&&i.push(l)}return i},t.prototype.findForwardRmpathEdges=function(e,r,n,a){for(var i=[],o=e.nodeMap,s=o[r.to].label,u=o[r.from],f=u.edges,l=f.length,c=0;c<l;c++){var h=f[c],d=o[h.to].label;r.to===h.to||n>d||a.hasNode(o[h.to])||(r.label<h.label||r.label===h.label&&s<=d)&&i.push(h)}return i},t.prototype.getSupport=function(e){var r={};return e.forEach(function(n){r[n.graphId]||(r[n.graphId]=!0)}),Object.keys(r).length},t.prototype.findMinLabel=function(e){var r=void 0;return Object.keys(e).forEach(function(n){var a=e[n],i=a.nodeLabel1,o=a.edgeLabel,s=a.nodeLabel2;if(!r){r={nodeLabel1:i,edgeLabel:o,nodeLabel2:s};return}(i<r.nodeLabel1||i===r.nodeLabel1&&o<r.edgeLabel||i===r.nodeLabel1&&o===r.edgeLabel&&s<r.nodeLabel2)&&(r={nodeLabel1:i,edgeLabel:o,nodeLabel2:s})}),r},t.prototype.isMin=function(){var e=this,r=this.dfsCode;if(this.verbose&&console.log("isMin checking",r),r.dfsEdgeList.length===1)return!0;var n=this.directed,a=r.toGraph(CA,n),i=a.nodeMap,o=new pw,s={};a.nodes.forEach(function(c){var h=e.findForwardRootEdges(a,c);h.forEach(function(d){var v=i[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:a.id,edge:d,preNode:null};s[p].projected.push(g)})});var u=this.findMinLabel(s);if(u){o.dfsEdgeList.push(new ko(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,w=function(z){if(y)return"break";h.forEach(function(X){var R=new ic(X),V=e.findBackwardEdge(a,R.edges[d[z]],R.edges[d[0]],R);V&&(g[V.label]||(g[V.label]={projected:[],edgeLabel:V.label}),g[V.label].projected.push({graphId:a.id,edge:g,preNode:X}),m=o.dfsEdgeList[d[z]].fromNode,y=!0)})},x=d.length-1;x>b;x--){var E=w(x);if(E==="break")break}if(y){var _=e.findMinLabel(g);o.dfsEdgeList.push(new ko(p,m,Ga,_.edgeLabel,Ga));var S=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[S]!==o.dfsEdgeList[S]?!1:c(g[_.edgeLabel].projected)}var A={};y=!1;var M=0;h.forEach(function(L){var z=new ic(L),X=e.findForwardPureEdges(a,z.edges[d[0]],v,z);X.length>0&&(y=!0,M=p,X.forEach(function(R){var V="".concat(R.label,"-").concat(i[R.to].label);A[V]||(A[V]={projected:[],edgeLabel:R.label,nodeLabel2:i[R.to].label}),A[V].projected.push({graphId:a.id,edge:R,preNode:L})}))});for(var C=d.length,I=function(z){if(y)return"break";var X=d[z];h.forEach(function(R){var V=new ic(R),he=e.findForwardRmpathEdges(a,V.edges[X],v,V);he.length>0&&(y=!0,M=o.dfsEdgeList[X].fromNode,he.forEach(function(ce){var le="".concat(ce.label,"-").concat(i[ce.to].label);A[le]||(A[le]={projected:[],edgeLabel:ce.label,nodeLabel2:i[ce.to].label}),A[le].projected.push({graphId:a.id,edge:ce,preNode:R})}))})},x=0;x<C;x++){var k=I(x);if(k==="break")break}if(!y)return!0;var O=e.findMinLabel(A);o.dfsEdgeList.push(new ko(M,p+1,Ga,O.edgeLabel,O.nodeLabel2));var B=o.dfsEdgeList.length-1;return r.dfsEdgeList[B]!==o.dfsEdgeList[B]?!1:c(A["".concat(O.edgeLabel,"-").concat(O.nodeLabel2)].projected)},l="".concat(u.nodeLabel1,"-").concat(u.edgeLabel,"-").concat(u.nodeLabel2);return f(s[l].projected)}},t.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var e=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push(rr(e))}},t.prototype.subGraphMining=function(e){var r=this,n=this.getSupport(e);if(!(n<this.minSupport)&&this.isMin()){this.report();var a=this.dfsCode.getNodeNum(),i=this.dfsCode.buildRmpath(),o=this.dfsCode.dfsEdgeList[i[0]].toNode,s=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,u={},f={};e.forEach(function(l){for(var c=r.graphs[l.graphId],h=c.nodeMap,d=new ic(l),v=i.length-1;v>=0;v--){var p=r.findBackwardEdge(c,d.edges[i[v]],d.edges[i[0]],d);if(p){var g="".concat(r.dfsCode.dfsEdgeList[i[v]].fromNode,"-").concat(p.label);f[g]||(f[g]={projected:[],toNodeId:r.dfsCode.dfsEdgeList[i[v]].fromNode,edgeLabel:p.label}),f[g].projected.push({graphId:l.graphId,edge:p,preNode:l})}}if(!(a>=r.maxNodeNum)){var y=r.findForwardPureEdges(c,d.edges[i[0]],s,d);y.forEach(function(b){var w="".concat(o,"-").concat(b.label,"-").concat(h[b.to].label);u[w]||(u[w]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:h[b.to].label}),u[w].projected.push({graphId:l.graphId,edge:b,preNode:l})});for(var m=function(w){var x=r.findForwardRmpathEdges(c,d.edges[i[w]],s,d);x.forEach(function(E){var _="".concat(r.dfsCode.dfsEdgeList[i[w]].fromNode,"-").concat(E.label,"-").concat(h[E.to].label);u[_]||(u[_]={projected:[],fromNodeId:r.dfsCode.dfsEdgeList[i[w]].fromNode,edgeLabel:E.label,nodeLabel2:h[E.to].label}),u[_].projected.push({graphId:l.graphId,edge:E,preNode:l})})},v=0;v<i.length;v++)m(v)}}),Object.keys(f).forEach(function(l){var c=f[l],h=c.toNodeId,d=c.edgeLabel;r.dfsCode.dfsEdgeList.push(new ko(o,h,"-1",d,"-1")),r.subGraphMining(f[l].projected),r.dfsCode.dfsEdgeList.pop()}),Object.keys(u).forEach(function(l){var c=u[l],h=c.fromNodeId,d=c.edgeLabel,v=c.nodeLabel2;r.dfsCode.dfsEdgeList.push(new ko(h,o+1,Ga,d,v)),r.subGraphMining(u[l].projected),r.dfsCode.dfsEdgeList.pop()})}},t.prototype.generate1EdgeFrequentSubGraphs=function(){var e=this.graphs,r=this.directed,n=this.minSupport,a=this.frequentSize1Subgraphs,i={},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=i[d]||0;p++,i[d]=p}s[v]={graphKey:u,label:d},c.edges.forEach(function(g){var y=d,m=l[g.to].label;if(!r&&y>m){var b=m;m=y,y=b}var w=g.label,x="".concat(y,"-").concat(w,"-").concat(m);if(!o[x]){var E=o[x]||0;E++,o[x]=E}})})}),Object.keys(i).forEach(function(u){var f=i[u];if(!(f<n)){var l={nodes:[],edges:[]};l.nodes.push({id:"0",label:u}),a.push(l)}}),a},t.prototype.run=function(){var e=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var r=this.graphs;this.directed;var n={};Object.keys(r).forEach(function(a){var i=r[a],o=i.nodeMap;i.nodes.forEach(function(s){var u=e.findForwardRootEdges(i,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:a,edge:f,preNode:null};n[c].projected.push(h)})})}),Object.keys(n).forEach(function(a){var i=n[a],o=i.projected,s=i.nodeLabel1,u=i.edgeLabel,f=i.nodeLabel2;e.dfsCode.dfsEdgeList.push(new ko(0,1,s,u,f)),e.subGraphMining(o),e.dfsCode.dfsEdgeList.pop()})}},t}(),DG=function(e,r,n,a){var i={};return Object.keys(e).forEach(function(o,s){var u=e[o],f=new TA(s,!0,r),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[a])}),f&&f.getNodeNum()&&(i[f.id]=f)}),i},PG=function(e,r,n){var a=[];return e.forEach(function(i){var o={nodes:[],edges:[]};i.nodes.forEach(function(s){var u;o.nodes.push((u={id:"".concat(s.id)},u[r]=s.label,u))}),i.edges.forEach(function(s){var u;o.edges.push((u={source:"".concat(s.from),target:"".concat(s.to)},u[n]=s.label,u))}),a.push(o)}),a},gw="cluster",RG=function(e){var r=e.graphs,n=e.directed,a=n===void 0?!1:n,i=e.nodeLabelProp,o=i===void 0?gw:i,s=e.edgeLabelProp,u=s===void 0?gw:s,f=DG(r,a,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:a},g=new LG(p);g.run();var y=PG(g.frequentSubgraphs,o,u);return y},yw=function(e,r,n,a){n===void 0&&(n="cluster"),a===void 0&&(a=2);var i=[],o=e.nodes;return r.forEach(function(s,u){i.push(IA(o,s,u,n,a))}),i},IA=function(e,r,n,a,i){var o=[n],s=[],u={};return r.forEach(function(f,l){if(f<=i&&n!==l){o.push(l),s.push(e[l]);var c=e[l][a];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}},FG=function(e,r,n,a,i){var o=Math.ceil(n/r),s={},u=0;return a.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()*r),g++,!(g>2*r)););if(g<2*r&&(s["".concat(l,"-").concat(p)]={start:l,end:p,distance:i[l][p]},c++,u++,u>=n))return s;if(h++,h>2*r)break}if(c<o){var y=o-c;o=(o+y)/(r-l-1)}}),s},ah=function(e,r,n,a){var i=n.nodes;return a||(a={}),Object.keys(e).forEach(function(o){var s,u;if(!(a&&a[o])){a[o]={nodes:[],edges:[]};var f=e[o],l=(s=r[f.start])===null||s===void 0?void 0:s.nodeIdxs,c=(u=r[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=i[d[g]];a[o].nodes.push(y),v[y.id]=!0}n.edges.forEach(function(m){v[m.source]&&v[m.target]&&a[o].edges.push(m)})}}}}),a},ih=function(e,r,n,a){var i,o,s={};e.nodes.forEach(function(f){s[f.id]=f});var u=0;return!(!((i=r==null?void 0:r.edges)===null||i===void 0)&&i.length)||((o=r==null?void 0:r.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=r==null?void 0:r.nodes[0][n],d=r==null?void 0:r.nodes[1][n],v=r==null?void 0:r.edges[0][a];f[a]===v&&(l===h&&c===d||l===d&&c===h)&&u++}),u)},BG=function(e,r,n){for(var a=1/0,i=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 w=0,x=m.length;m.graphs.forEach(function(E,_){var S=l[E];m.graphs.forEach(function(A,M){_!==M&&(w+=Math.abs(S-l[A]))})}),w/=x*(x-1)/2,v+=w}),v/=d.length;var g=0;p.forEach(function(m,b){p.forEach(function(w,x){b!==x&&(g+=Math.abs(m-w))}),g/=p.length*(p.length-1)/2});var y=g-v;a<y&&(a=y,i=f)},s=0;s<r;s++)o(s);return{structure:n[i],structureCountMap:e[i]}},mw=function(e,r){var n={},a={};return e.forEach(function(i,o){n[i.id]={idx:o,node:i,degree:0,inDegree:0,outDegree:0};var s=i[r];a[s]||(a[s]=[]),a[s].push(i)}),{nodeMap:n,nodeLabelMap:a}},bw=function(e,r,n){var a={},i={};return e.forEach(function(o,s){a["".concat(fA)]={idx:s,edge:o};var u=o[r];i[u]||(i[u]=[]),i[u].push(o);var f=n[o.source];f&&(f.degree++,f.outDegree++);var l=n[o.target];l&&(l.degree++,l.inDegree++)}),{edgeMap:a,edgeLabelMap:i}},ww=function(e,r,n){var a=r.length,i={};return r.forEach(function(o,s){for(var u=n?0:s+1,f=e[s].id,l=u;l<a;l++)if(s!==l){var c=e[l].id,h=o[l];i["".concat(f,"-").concat(c)]=h,n||(i["".concat(c,"-").concat(f)]=h)}}),i},GG=function(e,r,n,a,i,o,s,u,f,l,c){var h,d="".concat(r.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:a[r.id].idx,end:a[n.id].idx,distance:i},h);c=ah(p,o,e,c),v=c[d]}return ih(v,s,u,f)},xw=function(e,r,n,a){var i,o,s,u=(i=e[r])===null||i===void 0?void 0:i.degree,f=(o=e[r])===null||o===void 0?void 0:o.inDegree,l=(s=e[r])===null||s===void 0?void 0:s.outDegree;return e[r]===void 0&&(u=1/0,f=1/0,l=1/0,a[r].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[r]={degree:u,inDegree:f,outDegree:l}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:f,minPatternNodeLabelOutDegree:l}},kA=function(e,r,n,a,i,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=Of(e,n),c=Of(r,n),h=ww(e.nodes,l,n),d=ww(r.nodes,c,n),v=mw(e.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=mw(r.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;bw(e.edges,s,p);var w=bw(r.edges,s,m).edgeLabelMap,x=[];c==null||c.forEach(function(tt){x=x.concat(tt)}),i||(i=Math.max.apply(Math,Xn(Xn([],x,!1),[2],!1))),a||(a=i);var E=yw(e,l,o,a),_=yw(r,c,o,a),S=Math.min(100,f*(f-1)/2),A=FG(a,f,S,E,l),M=ah(A,E,e),C=10,I=1,k=1,O=4,B={graphs:M,nodeLabelProp:o,edgeLabelProp:s,minSupport:I,minNodeNum:k,maxNodeNum:O,directed:n},L=RG(B).slice(0,C),z=L.length,X=[];L.forEach(function(tt,te){X[te]={},Object.keys(M).forEach(function(N){var Se=M[N],Fe=ih(Se,tt,o,s);X[te][N]=Fe})});var R=BG(X,z,L),V=R.structure,he=R.structureCountMap,ce=r.nodes[0],le=[],ie=(u=r.nodes[0])===null||u===void 0?void 0:u[o],Ie=-1/0;r.nodes.forEach(function(tt){var te=tt[o],N=g[te];(N==null?void 0:N.length)>Ie&&(Ie=N.length,le=N,ie=te,ce=tt)});var qe={},Ve={},it={},dt={},st={},Tt={};Object.keys(b).forEach(function(tt,te){st[tt]=[],n&&(Tt[tt]=[]);var N=b[tt],Se={};N.forEach(function(Ze){var Je=d["".concat(ce.id,"-").concat(Ze.id)];if(Je&&st[tt].push(Je),Se["".concat(ce.id,"-").concat(Ze.id)]={start:0,end:m[Ze.id].idx,distance:Je},n){var ht=d["".concat(Ze.id,"-").concat(ce.id)];ht&&Tt[tt].push(ht)}}),st[tt]=st[tt].sort(function(Ze,Je){return Ze-Je}),n&&(Tt[tt]=Tt[tt].sort(function(Ze,Je){return Ze-Je})),Ve=ah(Se,_,r,Ve);var Fe=[];if(Object.keys(Se).forEach(function(Ze){if(it[Ze]){Fe.push(it[Ze]);return}var Je=Ve[Ze];it[Ze]=ih(Je,V,o,s),Fe.push(it[Ze])}),Fe=Fe.sort(function(Ze,Je){return Je-Ze}),dt["".concat(ce.id,"-").concat(tt)]=Fe,tt!==ie)for(var ge=(le==null?void 0:le.length)||0,Ue=function(Je){var ht=le[Je],Lt=E[p[ht.id].idx],ur=Lt.nodeLabelCountMap[tt],Dt=b[tt].length;if(!ur||ur.count<Dt)return le.splice(Je,1),"continue";for(var fr=!1,or=0;or<Dt;or++)if(ur.dists[or]>st[tt][or]){fr=!0;break}if(fr)return le.splice(Je,1),"continue";var gr={};Lt.neighbors.forEach(function(nr){var Fr=h["".concat(ht.id,"-").concat(nr.id)];gr["".concat(ht.id,"-").concat(nr.id)]={start:p[ht.id].idx,end:p[nr.id].idx,distance:Fr}}),M=ah(gr,E,e,M);var hr=[];Object.keys(gr).forEach(function(nr){if(he[nr]){hr.push(he[nr]);return}var Fr=M[nr];he[nr]=ih(Fr,V,o,s),hr.push(he[nr])}),hr=hr.sort(function(nr,Fr){return Fr-nr});for(var hn=!1,or=0;or<Dt;or++)if(hr[or]<Fe[or]){hn=!0;break}if(hn)return le.splice(Je,1),"continue"},$e=ge-1;$e>=0;$e--)Ue($e)});var _t=[];le==null||le.forEach(function(tt){for(var te=p[tt.id].idx,N=IA(e.nodes,l[te],te,o,i),Se=N.neighbors,Fe=Se.length,ge=!1,Ue=Fe-1;Ue>=0;Ue--){if(Se.length+1<r.nodes.length){ge=!0;return}var $e=Se[Ue],Ze=$e[o];if(!b[Ze]||!b[Ze].length){Se.splice(Ue,1);continue}if(!st[Ze]||!st[Ze].length){Se.splice(Ue,1);continue}var Je="".concat(tt.id,"-").concat($e.id),ht=h[Je],Lt=st[Ze].length-1,ur=st[Ze][Lt];if(ht>ur){Se.splice(Ue,1);continue}if(n){var Dt="".concat($e.id,"-").concat(tt.id),fr=h[Dt];Lt=Tt[Ze].length-1;var or=Tt[Ze][Lt];if(fr>or){Se.splice(Ue,1);continue}}var gr=he[Je]?he[Je]:GG(e,tt,$e,p,ht,E,V,o,s,he,M),hr="".concat(ce.id,"-").concat(Ze),hn=dt[hr][dt[hr].length-1];if(gr<hn){Se.splice(Ue,1);continue}var nr=xw(qe,Ze,m,b),Fr=nr.minPatternNodeLabelDegree;if(nr.minPatternNodeLabelInDegree,nr.minPatternNodeLabelOutDegree,p[$e.id].degree<Fr){Se.splice(Ue,1);continue}}ge||_t.push({nodes:[tt].concat(Se)})});var lr=Nf(r,ce.id,!1).length,Bt={};n?(Object.keys(lr).forEach(function(tt){var te=m[tt].node[o];Bt[te]?Bt[te].push(lr[tt]):Bt[te]=[lr[tt]]}),Object.keys(Bt).forEach(function(tt){Bt[tt].sort(function(te,N){return te-N})})):Bt=st;for(var Wt=_t.length,vr=function(te){var N=_t[te],Se=N.nodes[0],Fe={},ge={};N.nodes.forEach(function(St,dr){ge[St.id]={idx:dr,node:St,degree:0,inDegree:0,outDegree:0};var gt=St[o];Fe[gt]?Fe[gt]++:Fe[gt]=1});var Ue=[],$e={};e.edges.forEach(function(St){ge[St.source]&&ge[St.target]&&(Ue.push(St),$e[St[s]]?$e[St[s]]++:$e[St[s]]=1,ge[St.source].degree++,ge[St.target].degree++,ge[St.source].outDegree++,ge[St.target].inDegree++)});for(var Ze=Object.keys(w).length,Je=!1,ht=0;ht<Ze;ht++){var Lt=Object.keys(w)[ht];if(!$e[Lt]||$e[Lt]<w[Lt].length){Je=!0;break}}if(Je)return _t.splice(te,1),"continue";var ur=Ue.length;if(ur<r.edges.length)return _t.splice(te,1),"break";for(var Dt=!1,fr=function(dr){var gt=Ue[dr],Sr=gt[s],dn=w[Sr];if(!dn||!dn.length)return $e[Sr]--,dn&&$e[Sr]<dn.length?(Dt=!0,"break"):(Ue.splice(dr,1),ge[gt.source].degree--,ge[gt.target].degree--,ge[gt.source].outDegree--,ge[gt.target].inDegree--,"continue");var fo=ge[gt.source].node[o],lo=ge[gt.target].node[o],ri=!1;if(dn.forEach(function(co){var ho=m[co.source].node,vo=m[co.target].node;ho[o]===fo&&vo[o]===lo&&(ri=!0),!n&&ho[o]===lo&&vo[o]===fo&&(ri=!0)}),!ri)return $e[Sr]--,dn&&$e[Sr]<dn.length?(Dt=!0,"break"):(Ue.splice(dr,1),ge[gt.source].degree--,ge[gt.target].degree--,ge[gt.source].outDegree--,ge[gt.target].inDegree--,"continue")},ht=ur-1;ht>=0;ht--){var or=fr(ht);if(or==="break")break}if(Dt)return _t.splice(te,1),"continue";N.edges=Ue;var gr=Nf(N,N.nodes[0].id,!1).length;if(Object.keys(gr).reverse().forEach(function(St){if(!(St===N.nodes[0].id||Dt)){if(gr[St]===1/0){var dr=ge[St].node[o];if(Fe[dr]--,Fe[dr]<b[dr].length){Dt=!0;return}var gt=N.nodes.indexOf(ge[St].node);N.nodes.splice(gt,1),ge[St]=void 0;return}var Sr=p[St].node[o];if(!Bt[Sr]||!Bt[Sr].length||gr[St]>Bt[Sr][Bt[Sr].length-1]){var dr=ge[St].node[o];if(Fe[dr]--,Fe[dr]<b[dr].length){Dt=!0;return}var gt=N.nodes.indexOf(ge[St].node);N.nodes.splice(gt,1),ge[St]=void 0}}}),Dt)return _t.splice(te,1),"continue";for(var hr=!0,hn=0;hr&&!Dt;){hr=!1;var nr=n?ge[Se.id].degree<m[ce.id].degree||ge[Se.id].inDegree<m[ce.id].inDegree||ge[Se.id].outDegree<m[ce.id].outDegree:ge[Se.id].degree<m[ce.id].degree;if(nr){Dt=!0;break}if(Fe[Se[o]]<b[Se[o]].length){Dt=!0;break}for(var Fr=N.nodes.length,oa=Fr-1;oa>=0;oa--){var Ur=N.nodes[oa],Mi=ge[Ur.id].degree,xu=ge[Ur.id].inDegree,Eu=ge[Ur.id].outDegree,rn=Ur[o],ti=xw(qe,rn,m,b),uo=ti.minPatternNodeLabelDegree,_u=ti.minPatternNodeLabelInDegree,Su=ti.minPatternNodeLabelOutDegree,Mu=n?Mi<uo||xu<_u||Eu<Su:Mi<uo;if(Mu){if(Fe[Ur[o]]--,Fe[Ur[o]]<b[Ur[o]].length){Dt=!0;break}N.nodes.splice(oa,1),ge[Ur.id]=void 0,hr=!0}}if(Dt||!hr&&hn!==0)break;ur=Ue.length;for(var sa=ur-1;sa>=0;sa--){var Br=Ue[sa];if(!ge[Br.source]||!ge[Br.target]){Ue.splice(sa,1);var ua=Br[s];if($e[ua]--,ge[Br.source]&&(ge[Br.source].degree--,ge[Br.source].outDegree--),ge[Br.target]&&(ge[Br.target].degree--,ge[Br.target].inDegree--),w[ua]&&$e[ua]<w[ua].length){Dt=!0;break}hr=!0}}hn++}if(Dt||Dt||N.nodes.length<r.nodes.length||Ue.length<r.edges.length)return _t.splice(te,1),"continue"},cr=Wt-1;cr>=0;cr--){var $t=vr(cr);if($t==="break")break}for(var sr=_t.length,tn=function(te){var N=_t[te],Se={};N.edges.forEach(function(Ue){var $e="".concat(Ue.source,"-").concat(Ue.target,"-").concat(Ue.label);Se[$e]?Se[$e]++:Se[$e]=1});for(var Fe=function($e){var Ze=_t[$e],Je={};Ze.edges.forEach(function(Lt){var ur="".concat(Lt.source,"-").concat(Lt.target,"-").concat(Lt.label);Je[ur]?Je[ur]++:Je[ur]=1});var ht=!0;Object.keys(Je).length!==Object.keys(Se).length?ht=!1:Object.keys(Se).forEach(function(Lt){Je[Lt]!==Se[Lt]&&(ht=!1)}),ht&&_t.splice($e,1)},ge=sr-1;ge>te;ge--)Fe(ge);sr=_t.length},cr=0;cr<=sr-1;cr++)tn(cr);return _t}}},Gs=function(){function t(e){e===void 0&&(e=10),this.linkedList=new uA,this.maxStep=e}return Object.defineProperty(t.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},t.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},t.prototype.push=function(e){this.linkedList.prepend(e),this.length>this.maxStep&&this.linkedList.deleteTail()},t.prototype.pop=function(){var e=this.linkedList.deleteHead();return e?e.value:null},t.prototype.toArray=function(){return this.linkedList.toArray().map(function(e){return e.value})},t.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},t}(),NA=Sy;const zG={getAdjMatrix:Uo,breadthFirstSearch:lA,connectedComponent:Ey,getDegree:yi,getInDegree:hA,getOutDegree:dA,detectCycle:Sy,detectDirectedCycle:NA,detectAllCycles:pA,detectAllDirectedCycle:Ay,detectAllUndirectedCycle:My,depthFirstSearch:_y,dijkstra:Nf,findAllPath:mA,findShortestPath:yA,floydWarshall:Of,labelPropagation:bA,louvain:Iy,iLouvain:wA,kCore:xA,kMeans:EA,cosineSimilarity:ky,nodesCosineSimilarity:_A,minimumSpanningTree:SA,pageRank:MA,getNeighbors:Un,Stack:Gs,GADDI:kA},jG=Object.freeze(Object.defineProperty({__proto__:null,GADDI:kA,Stack:Gs,breadthFirstSearch:lA,connectedComponent:Ey,cosineSimilarity:ky,default:zG,depthFirstSearch:_y,detectAllCycles:pA,detectAllDirectedCycle:Ay,detectAllUndirectedCycle:My,detectCycle:Sy,detectDirectedCycle:NA,dijkstra:Nf,findAllPath:mA,findShortestPath:yA,floydWarshall:Of,getAdjMatrix:Uo,getDegree:yi,getInDegree:hA,getNeighbors:Un,getOutDegree:dA,iLouvain:wA,kCore:xA,kMeans:EA,labelPropagation:bA,louvain:Iy,minimumSpanningTree:SA,nodesCosineSimilarity:_A,pageRank:MA},Symbol.toStringTag,{value:"Module"}));var Nh=eo,UG=function(e){return function(r,n){return r[e]-n[e]}},Ew=function(e,r,n){return e>=r&&e<=n},xd=function(e,r,n,a){var i=1e-4,o={x:n.x-e.x,y:n.y-e.y},s={x:r.x-e.x,y:r.y-e.y},u={x:a.x-n.x,y:a.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>i*h*d){var v=(o.x*u.y-o.y*u.x)*c,p=(o.x*s.y-o.y*s.x)*c;return!Ew(v,0,1)||!Ew(p,0,1)?null:{x:e.x+v*s.x,y:e.y+v*s.y}}return null},OA=function(e,r){var n=e.x,a=e.y,i=e.width,o=e.height,s=n+i/2,u=a+o/2,f=[],l={x:s,y:u};f.push({x:n,y:a}),f.push({x:n+i,y:a}),f.push({x:n+i,y:a+o}),f.push({x:n,y:a+o}),f.push({x:n,y:a});for(var c=null,h=1;h<f.length&&(c=xd(f[h-1],f[h],l,r),!c);h++);return c},LA=function(e,r){var n=e.x,a=e.y,i=e.r,o=r.x,s=r.y,u=o-n,f=s-a;if(u*u+f*f<i*i)return null;var l=Math.atan(f/u);return{x:n+Math.abs(i*Math.cos(l))*Math.sign(u),y:a+Math.abs(i*Math.sin(l))*Math.sign(f)}},DA=function(e,r){var n=e.rx,a=e.ry,i=e.x,o=e.y,s=r.x-i,u=r.y-o,f=Math.atan2(u/a,s/n);return f<0&&(f+=2*Math.PI),{x:i+n*Math.cos(f),y:o+a*Math.sin(f)}},Us=function(e,r,n){n===void 0&&(n=1);var a=[e.x,e.y,n];return(!r||isNaN(r[0]))&&(r=[1,0,0,0,1,0,0,0,1]),bd(a,a,r),{x:a[0],y:a[1]}},PA=function(e,r,n){n===void 0&&(n=1),(!r||isNaN(r[0]))&&(r=[1,0,0,0,1,0,0,0,1]);var a=aM([1,0,0,0,1,0,0,0,1],r);a||(a=[1,0,0,0,1,0,0,0,1]);var i=[e.x,e.y,n];return bd(i,i,a),{x:i[0],y:i[1]}},E0=function(e,r,n){var a=e.x-r.x,i=e.y-r.y,o=e.x-n.x,s=e.y-n.y,u=(e.x*e.x-r.x*r.x-r.y*r.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=i*o-a*s;return{x:-(s*u-i*f)/l,y:-(a*f-o*u)/l}},Oh=function(e,r){var n=e.x-r.x,a=e.y-r.y;return Math.sqrt(n*n+a*a)},$G=function(e,r){var n=[];return e.forEach(function(a){var i=[];a.forEach(function(o){i.push(o*r)}),n.push(i)}),n},XG=function(e){for(var r=[],n=e.length,a=0;a<n;a+=1){r[a]=[];for(var i=0;i<n;i+=1)a===i?r[a][i]=0:e[a][i]===0||!e[a][i]?r[a][i]=1/0:r[a][i]=e[a][i]}for(var o=0;o<n;o+=1)for(var a=0;a<n;a+=1)for(var i=0;i<n;i+=1)r[a][i]>r[a][o]+r[o][i]&&(r[a][i]=r[a][o]+r[o][i]);return r},WG=function(e,r){var n=e.nodes,a=e.edges,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var f=[];i.push(f)}),a&&a.forEach(function(s){var u=s.source,f=s.target,l=o[u],c=o[f];i[l][c]=1,r||(i[c][l]=1)}),i},RA=function(e,r){e.translate(r.x,r.y)},_0=function(e,r,n,a){a===void 0&&(a={duration:500});var i=e.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]);var o=e.getCanvasBBox(),s=r.x-o.minX,u=r.y-o.minY;if(n){var f=s*i[0],l=u*i[4],c=0,h=0,d=0,v=0;e.animate(function(g){return d=f*g,v=l*g,i=Nh(i,[["t",d-c,v-h]]),c=d,h=v,{matrix:i}},a)}else{var p=Nh(i,[["t",s,u]]);e.setMatrix(p)}},VG=function(e,r){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var a=r;bt(r)||(a=[r,r]),bt(r)&&r.length===1&&(a=[r[0],r[0]]),n=Nh(n,[["s",a[0],a[1]]]),e.setMatrix(n)},YG=function(e,r){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]),n=Nh(n,[["r",r]]),e.setMatrix(n)},qG=function(e,r,n){for(var a=[],i=0;i<e;i++)a[i]=0;return n.forEach(function(o){o.source&&(a[r[o.source]]+=1),o.target&&(a[r[o.target]]+=1)}),a};function HG(t,e,r){return(r[0]-t[0])*(e[1]-t[1])===(e[0]-t[0])*(r[1]-t[1])&&Math.min(t[0],e[0])<=r[0]&&r[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=r[1]&&r[1]<=Math.max(t[1],e[1])}var Lf=function(e,r,n){var a=!1,i=e.length,o=1e-6;function s(c){return Math.abs(c)<o?0:c<0?-1:1}if(i<=2)return!1;for(var u=0;u<i;u++){var f=e[u],l=e[(u+1)%i];if(HG(f,l,[r,n]))return!0;s(f[1]-n)>0!=s(l[1]-n)>0&&s(r-(n-f[1])*(f[0]-l[0])/(f[1]-l[1])-f[0])<0&&(a=!a)}return a},FA=function(e,r){return!(r.minX>e.maxX||r.maxX<e.minX||r.minY>e.maxY||r.maxY<e.minY)},ZG=function(e,r){var n=!1;return _e(e,function(a){if(xd(a.from,a.to,r.from,r.to))return n=!0,!1}),n},BA=function(e,r){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)}},a=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||r.length<2)return!1;var i=n(e),o=n(r);if(!FA(i,o))return!1;var s=!1;if(_e(r,function(c){if(Lf(e,c[0],c[1]))return s=!0,!1}),s||(_e(e,function(c){if(Lf(r,c[0],c[1]))return s=!0,!1}),s))return!0;var u=a(e),f=a(r),l=!1;return _e(f,function(c){if(ZG(u,c))return l=!0,!1}),l},$o=function(){function t(e,r,n,a){this.x1=e,this.y1=r,this.x2=n,this.y2=a}return t.prototype.getBBox=function(){var e=Math.min(this.x1,this.x2),r=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),a=Math.max(this.y1,this.y2),i={x:e,y:r,minX:e,minY:r,maxX:n,maxY:a,width:n-e,height:a-r};return i},t}(),Ny=function(e,r){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[r]},KG=function(e,r){var n=(r.x2-r.x1)*(e.y1-r.y1)-(r.y2-r.y1)*(e.x1-r.x1),a=(e.x2-e.x1)*(e.y1-r.y1)-(e.y2-e.y1)*(e.x1-r.x1),i=(r.y2-r.y1)*(e.x2-e.x1)-(r.x2-r.x1)*(e.y2-e.y1);if(i){var o=n/i,s=a/i;if(o>=0&&o<=1&&s>=0&&s<=1)return o}return Number.POSITIVE_INFINITY},GA=function(e,r){for(var n=["top","left","bottom","right"],a=e.getBBox(),i=0,o=[],s=0;s<4;s++){var u=Ny(a,n[s]),f=u[0],l=u[1],c=u[2],h=u[3];o[s]=xd({x:r.x1,y:r.y1},{x:r.x2,y:r.y2},{x:f,y:l},{x:c,y:h}),o[s]&&(i+=1)}return[o,i]},Oy=function(e,r){for(var n=["top","left","bottom","right"],a=e.getBBox(),i=Number.POSITIVE_INFINITY,o=0,s=0;s<4;s++){var u=Ny(a,n[s]),f=u[0],l=u[1],c=u[2],h=u[3],d=KG(r,new $o(f,l,c,h));d=Math.abs(d-.5),d>=0&&d<=1&&(o+=1,i=d<i?d:i)}return o===0?-1:i},zA=function(e){var r=0,n=0;if(e.length>0){for(var a=0,i=e;a<i.length;a++){var o=i[a];r+=o.x,n+=o.y}r/=e.length,n/=e.length}return{x:r,y:n}},Lh=function(e,r){return Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2)},jA=function(e,r){var n=r.x1,a=r.y1,i=r.x2-n,o=r.y2-a,s=e.x-n,u=e.y-a,f=s*i+u*o,l;f<=0?l=0:(s=i-s,u=o-u,f=s*i+u*o,f<=0?l=0:l=f*f/(i*i+o*o));var c=s*s+u*u-l;return c<0&&(c=0),c},S0=function(e,r,n){return n===void 0&&(n=.001),Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2)<Math.pow(n,2)},UA=function(e,r){var n=e.x<r.x,a=e.x>r.x+r.width,i=e.y>r.y+r.height,o=e.y<r.y,s=n||a||i||o;if(!s)return 0;if(i&&!n&&!a)return Math.pow(r.y+r.height-e.y,2);if(o&&!n&&!a)return Math.pow(e.y-r.y,2);if(n&&!i&&!o)return Math.pow(r.x-e.x,2);if(a&&!i&&!o)return Math.pow(r.x+r.width-e.x,2);var u=Math.min(Math.abs(r.x-e.x),Math.abs(r.x+r.width-e.x)),f=Math.min(Math.abs(r.y-e.y),Math.abs(r.y+r.height-e.y));return u*u+f*f},QG=function(e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r.x,u=r.y,f=[i-n,o-a];if(xy(f,[0,0]))return NaN;var l=[-f[1],f[0]];Wi(l,l);var c=[s-n,u-a];return Math.abs(wy(c,l))},Ly=function(e,r,n){return e+(r-e)*n},M0=function(e,r,n){for(var a=Math.min(e.length,r.length),i=new Array(a),o=0;o<a;o++)i[o]=Ly(e[o],r[o],n);return i};const JG=Object.freeze(Object.defineProperty({__proto__:null,Line:$o,applyMatrix:Us,compare:UG,distance:Oh,floydWarshall:XG,fractionToLine:Oy,getAdjMatrix:WG,getBBoxBoundLine:Ny,getCircleCenterByPoints:E0,getCircleIntersectByPoint:LA,getDegree:qG,getEllipseIntersectByPoint:DA,getLineIntersect:xd,getPointsCenter:zA,getRectIntersectByPoint:OA,intersectBBox:FA,invertMatrix:PA,isPointInPolygon:Lf,isPointsOverlap:S0,isPolygonsIntersect:BA,itemIntersectByLine:GA,lerp:Ly,lerpArray:M0,move:_0,pointLineDistance:QG,pointLineSquareDist:jA,pointRectSquareDist:UA,rotate:YG,scale:VG,scaleMatrix:$G,squareDist:Lh,translate:RA},Symbol.toStringTag,{value:"Module"}));var Ni="rgb(95, 149, 255)",ez="rgb(255, 255, 255)",_w="rgb(0, 0, 0)",lp="rgb(247, 250, 255)",tz="rgb(239, 244, 255)",oc="rgb(253, 253, 253)",Sw="rgb(250, 250, 250)",sc="rgb(224, 224, 224)",Mw="rgb(234, 234, 234)",rz="rgb(245, 245, 245)",nz="rgb(191, 213, 255)",Aw="#4572d9",az="rgb(223, 234, 255)",er={mainStroke:Ni,activeStroke:Ni,activeFill:lp,inactiveStroke:nz,inactiveFill:lp,selectedStroke:Ni,selectedFill:ez,highlightStroke:Aw,highlightFill:az,disableStroke:sc,disableFill:Sw,edgeMainStroke:sc,edgeActiveStroke:Ni,edgeInactiveStroke:Mw,edgeSelectedStroke:Ni,edgeHighlightStroke:Ni,edgeDisableStroke:rz,comboMainStroke:sc,comboMainFill:oc,comboActiveStroke:Ni,comboActiveFill:lp,comboInactiveStroke:sc,comboInactiveFill:oc,comboSelectedStroke:Ni,comboSelectedFill:oc,comboHighlightStroke:Aw,comboHighlightFill:oc,comboDisableStroke:Mw,comboDisableFill:Sw};const ft={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:er.mainStroke,fill:tz},size:20,color:er.mainStroke,linkPoints:{size:8,lineWidth:1,fill:er.activeFill,stroke:er.activeStroke}},nodeStateStyles:{active:{fill:er.activeFill,stroke:er.activeStroke,lineWidth:2,shadowColor:er.mainStroke,shadowBlur:10},selected:{fill:er.selectedFill,stroke:er.selectedStroke,lineWidth:4,shadowColor:er.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:er.highlightFill,stroke:er.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:er.inactiveFill,stroke:er.inactiveStroke,lineWidth:1},disable:{fill:er.disableFill,stroke:er.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:_w,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:er.edgeMainStroke,lineAppendWidth:2},color:er.edgeMainStroke},edgeStateStyles:{active:{stroke:er.edgeActiveStroke,lineWidth:1},selected:{stroke:er.edgeSelectedStroke,lineWidth:2,shadowColor:er.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:er.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:er.edgeInactiveStroke,lineWidth:1},disable:{stroke:er.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:_w,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:er.comboMainFill,lineWidth:1,stroke:er.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:er.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:er.comboActiveStroke,lineWidth:1,fill:er.comboActiveFill},selected:{stroke:er.comboSelectedStroke,lineWidth:2,fill:er.comboSelectedFill,shadowColor:er.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:er.comboHighlightStroke,lineWidth:2,fill:er.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:er.comboInactiveStroke,fill:er.comboInactiveFill,lineWidth:1},disable:{stroke:er.comboDisableStroke,fill:er.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"},iz={" ":.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 Pa=Math.PI,A0=Math.sin,C0=Math.cos,sn=A0(Pa/8),un=C0(Pa/8),Dh=function(e,r){var n=e.getBBox(),a={x:n.minX,y:n.minY},i={x:n.maxX,y:n.maxY};if(r){var o=r.getMatrix();o||(o=[1,0,0,0,1,0,0,0,1]),a=Us(a,o),i=Us(i,o)}var s=a.x,u=a.y,f=i.x,l=i.y;return{x:s,y:u,minX:s,minY:u,maxX:f,maxY:l,width:f-s,height:l-u}},$A=function(e){var r=e.sourceNode||e.targetNode,n=r.get("group"),a=n.getMatrix();a||(a=[1,0,0,0,1,0,0,0,1]);var i=r.getKeyShape(),o=i.getBBox(),s=e.loopCfg||{},u=s.dist||Math.max(o.width,o.height)*2,f=s.position||ft.defaultLoopPosition,l=[(o.minX+o.maxX)/2+a[6],(o.minY+o.maxY)/2+a[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*sn,m=p*un,b=g*sn,w=g*un,x=i.get("type"),E=Math.min(d/2,v/2),_=Math.min(d,v),S=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":x==="circle"?(c=[l[0]-y,l[1]-m],h=[l[0]+b,l[1]-w]):(c=[l[0]-S,l[1]-d],h=[l[0]+S,l[1]-d]);break;case"top-right":p=d,g=v,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]+y,l[1]-m],h=[l[0]+w,l[1]-b]):(c=[l[0]+v-S,l[1]-d],h=[l[0]+v,l[1]-d+S]);break;case"right":p=v,g=v,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]+m,l[1]-y],h=[l[0]+w,l[1]+b]):(c=[l[0]+v,l[1]-S],h=[l[0]+v,l[1]+S]);break;case"bottom-right":p=v,g=d,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]+m,l[1]+y],h=[l[0]+b,l[1]+w]):(c=[l[0]+v,l[1]+d-S],h=[l[0]+v-S,l[1]+d]);break;case"bottom":p=d,g=d,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]+y,l[1]+m],h=[l[0]-b,l[1]+w]):(c=[l[0]-S,l[1]+d],h=[l[0]+S,l[1]+d]);break;case"bottom-left":p=d,g=v,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]-y,l[1]+m],h=[l[0]-w,l[1]+b]):(c=[l[0]-v,l[1]+d-S],h=[l[0]-v+S,l[1]+d]);break;case"left":p=v,g=v,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]-m,l[1]+y],h=[l[0]-w,l[1]-b]):(c=[l[0]-v,l[1]-S],h=[l[0]-v,l[1]+S]);break;case"top-left":p=v,g=d,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]-m,l[1]-y],h=[l[0]-b,l[1]-w]):(c=[l[0]-v+S,l[1]-d],h=[l[0]-v,l[1]-d+S]);break;default:p=v,g=v,y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]-y,l[1]-m],h=[l[0]+b,l[1]-w]}if(s.clockwise===!1){var A=[c[0],c[1]];c=[h[0],h[1]],h=[A[0],A[1]]}}var M=[c[0]-l[0],c[1]-l[1]],C=(p+u)/p,I=(g+u)/g;s.clockwise===!1&&(C=(g+u)/g,I=(p+u)/p);var k=wn([0,0],M,C),O=[l[0]+k[0],l[1]+k[1]],B=[h[0]-l[0],h[1]-l[1]],L=wn([0,0],B,I),z=[l[0]+L[0],l[1]+L[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:z[0],y:z[1]}],e},XA=function(e,r,n,a,i){var o=1e-4,s=[],u=e==null?void 0:e.getPoint(r);if(!u)return{x:0,y:0,angle:0};if(r<o)s=e.getStartTangent().reverse();else if(r>1-o)s=e.getEndTangent();else{var f=e==null?void 0:e.getPoint(r+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+=Pa*2),n&&(u.x+=C0(l)*n,u.y+=A0(l)*n),a){var c=l-Pa/2;l>1/2*Pa&&l<3*1/2*Pa&&(c-=Pa),u.x+=C0(c)*a,u.y+=A0(c)*a}var h={x:u.x,y:u.y,angle:l};return i?(l>.5*Pa&&l<1.5*Pa&&(l-=Pa),P({rotate:l},h)):h},oz=function t(e,r,n,a){if(a(e,r,n)===!1)return!1;if(e&&e.children){for(var i=e.children.length-1;i>=0;i--)if(!t(e.children[i],e,i,a))return!1}return!0},sz=function t(e,r,n,a){if(e&&e.children){for(var i=e.children.length-1;i>=0;i--)if(!t(e.children[i],e,i,a))return}return a(e,r,n)!==!1},bn=function(e,r){typeof r=="function"&&oz(e,null,-1,r)},Ra=function(e,r){typeof r=="function"&&sz(e,null,-1,r)},WA=function(e,r){return r*(iz[e]||1)},VA=function(e,r){var n=0,a=new RegExp("[一-龥]+");return e.split("").forEach(function(i){a.test(i)?n+=r:n+=WA(i,r)}),[n,r]},YA=function(e,r){return typeof r!="number"||r<=0||r>=e.length?e:e.substring(0,r)+"..."},T0=function(e,r){var n=[],a={},i={};e.forEach(function(u){i[u.id]=u}),e.forEach(function(u,f){var l=rr(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&&!i[l.parentId]&&(console.warn("The parent combo for combo ".concat(l.id," does not exist!")),delete l.parentId);var c=a[l.id];if(c){if(l.children=c.children,a[l.id]=l,c=l,!c.parentId){n.push(c);return}var h=a[c.parentId];if(h)h.children?h.children.push(l):h.children=[l];else{var d={id:c.parentId,children:[c]};a[c.parentId]=d,a[l.id]=l}return}if(Ye(u.parentId)){var v=a[u.parentId];if(v)v.children?v.children.push(l):v.children=[l],a[l.id]=l;else{var p={id:u.parentId,children:[l]};a[p.id]=p,a[l.id]=l}}else n.push(l),a[l.id]=l});var o={};(r||[]).forEach(function(u){o[u.id]=u;var f=a[u.comboId];if(f){var l={id:u.id,comboId:u.comboId};f.children?f.children.push(l):f.children=[l],l.itemType="node",a[u.id]=l}});var s=0;return n.forEach(function(u){u.depth=s+10,bn(u,function(f){var l,c=a[f.id].itemType;c==="node"?l=a[f.comboId]:l=a[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},I0=function(e,r,n){var a,i=e,o,s={root:{children:e}},u=!1,f="root";(e||[]).forEach(function(v){if(!u){if(v.id===r){o=v,v.itemType==="combo"?o.parentId=n:o.comboId=n,u=!0;return}bn(v,function(p){var g;return s[p.id]={children:(p==null?void 0:p.children)||[]},i=(g=s[p.parentId||p.comboId||"root"])===null||g===void 0?void 0:g.children,p&&(p.removed||r===p.id)&&i?(f=p.parentId||p.comboId||"root",o=p,p.itemType==="combo"?o.parentId=n:o.comboId=n,u=!0,!1):!0})}}),i=(a=s[f])===null||a===void 0?void 0:a.children;var l=i?i.indexOf(o):-1;if(l>-1&&i.splice(l,1),u||(o={id:r,itemType:"node",comboId:n},s[r]={children:void 0}),r){var c=!1;if(n){var h=0;(e||[]).forEach(function(v){c||bn(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;bn(o,function(v){return v.itemType==="node"?d+=2:d+=1,v.depth=d,!0})}return e},oh=function(e,r,n){var a={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 i=n==null?void 0:n.getModel(),o=i||{},s=o.x,u=o.y,f=o.fixSize,l=o.collapsed,c=o.fixCollapseSize,h=l?c:f,d=bt(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=r.findById(y.id);if(!(!m||!m.isVisible())){m.set("bboxCanvasCache",void 0);var b=m.getCanvasBBox();b.x&&a.minX>b.minX&&(a.minX=b.minX),b.y&&a.minY>b.minY&&(a.minY=b.minY),b.x&&a.maxX<b.maxX&&(a.maxX=b.maxX),b.y&&a.maxY<b.maxY&&(a.maxY=b.maxY)}}),a.x=(a.minX+a.maxX)/2,a.y=(a.minY+a.maxY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY,a.centerX=(a.minX+a.maxX)/2,a.centerY=(a.minY+a.maxY)/2,(n==null?void 0:n.getKeyShape().get("type"))==="circle"&&(a.width=Math.hypot(a.height,a.width),a.height=a.width),Object.keys(a).forEach(function(y){(a[y]===1/0||a[y]===-1/0)&&(a[y]=void 0)}),a},uz=function(e){var r=Ot(e.x)||Ot(e.y)||e.type||e.anchorPoints||e.size;return e.style&&(r=r||Ot(e.style.r)||Ot(e.style.width)||Ot(e.style.height)||Ot(e.style.rx)||Ot(e.style.ry)),r},sh=function(e){var r={};return Object.keys(e).forEach(function(n){var a=e[n];if(!(n==="img"&&!Ye(a)))if(gn(a)&&!bt(a)){var i={};Object.keys(a).forEach(function(o){var s=a[o];o==="img"&&!Ye(s)||(i[o]=rr(s))}),r[n]=i}else r[n]=rr(a)}),r},Df=function(e){var r=e.animateCfg,n=e.callback,a;if(!r)a={duration:500,callback:n};else if(a=rr(r),r.callback){var i=r.callback;a.callback=function(){n(),i()}}else a.callback=n;return a};const fz=Object.freeze(Object.defineProperty({__proto__:null,cloneBesidesImg:sh,getAnimateCfgWithCallback:Df,getBBox:Dh,getComboBBox:oh,getLabelPosition:XA,getLetterWidth:WA,getLoopCfgs:$A,getTextSize:VA,plainCombosToTrees:T0,reconstructTree:I0,shouldRefreshEdge:uz,traverseTree:bn,traverseTreeUp:Ra,truncateLabelByLength:YA},Symbol.toStringTag,{value:"Module"}));var Cw=function(e){if(!e)return console.error("G6 Error Tips: the data must be defined"),!1;var r=e.nodes,n=e.edges,a=e.combos,i=a===void 0?[]:a;if(!r&&!n){var o=!0;return bn(e,function(h){return Ye(h.id)?!0:(o=!1,!1)}),o}var s=(r||[]).find(function(h){return!Ye(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=(r||[]).map(function(h){return h.id}),f=i==null?void 0:i.map(function(h){return h.id}),l=Xn(Xn([],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},lz=function(e,r){if(e==="node"||e==="combo"){if(r.id&&!Ye(r.id))return console.warn("G6 Warning Tips: missing 'id' property, or the 'id' %c".concat(r.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1}else if(e==="edge"&&(!r.source||!r.target))return console.warn("G6 Warning Tips: missing 'source' or 'target' for the edge."),!1;return!0},cz=function(){function t(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 t.prototype.formatModes=function(){var e=this.modes;_e(e,function(r){_e(r,function(n,a){Ye(n)&&(r[a]={type:n})})})},t.prototype.setBehaviors=function(e){var r=this.graph,n=this.modes[e],a=[],i;_e(n||[],function(o){var s=sy.getBehavior(o.type||o);s&&(i=new s(o),i&&(i.bind(r),a.push(i)))}),this.currentBehaves=a},t.mergeBehaviors=function(e,r){return _e(r,function(n){e.indexOf(n)<0&&(Ye(n)&&(n={type:n}),e.push(n))}),e},t.filterBehaviors=function(e,r){var n=[];return e.forEach(function(a){var i="";Ye(a)?i=a:i=a.type,r.indexOf(i)<0&&n.push(a)}),n},t.prototype.setMode=function(e){var r=this,n=r.modes,a=r.graph,i=e,o=n[i];o&&(a.emit("beforemodechange",{mode:e}),_e(this.currentBehaves,function(s){s.delegate&&s.delegate.remove(),s.unbind(a)}),this.setBehaviors(i),a.emit("aftermodechange",{mode:e}),this.mode=e)},t.prototype.getMode=function(){return this.mode},t.prototype.manipulateBehaviors=function(e,r,n){var a=this,i;if(bt(e)?i=e:i=[e],bt(r))return _e(r,function(s){a.modes[s]?n?a.modes[s]=t.mergeBehaviors(a.modes[s]||[],i):a.modes[s]=t.filterBehaviors(a.modes[s]||[],i):n&&(a.modes[s]=i)}),this;var o=r;return r||(o=this.mode),this.modes[o]||n&&(this.modes[o]=i),n?this.modes[o]=t.mergeBehaviors(this.modes[o]||[],i):this.modes[o]=t.filterBehaviors(this.modes[o]||[],i),this.formatModes(),this.setMode(this.mode),this},t.prototype.updateBehavior=function(e,r,n){Ye(e)&&(e={type:e});var a=[];if(!n||n===this.mode||n==="default"){if(a=this.currentBehaves,!a||!a.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;for(var i=a.length,o=0;o<i;o++){var s=a[o];if(s.type===e.type)return s.updateCfg(r),this;o===i-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}else{if(a=this.modes[n],!a||!a.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;for(var u=a.length,o=0;o<u;o++){var s=a[o];if(s.type===e.type||s===e.type)return s===e.type&&(s={type:s}),Object.assign(s,r),a[o]=s,this;o===u-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}return this},t.prototype.destroy=function(){this.graph=null,this.modes=null,this.currentBehaves=null,this.destroyed=!0},t}(),wf=`
|
||
\v\f\r \u2028\u2029`,hz=new RegExp("([a-z])["+wf+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+wf+"]*,?["+wf+"]*)+)","ig"),dz=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+wf+"]*,?["+wf+"]*","ig"),zs=function(t){if(!t)return null;if(bt(t))return t;var e={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},r=[];return String(t).replace(hz,function(n,a,i){var o=[],s=a.toLowerCase();if(i.replace(dz,function(u,f){f&&o.push(+f)}),s==="m"&&o.length>2&&(r.push([a].concat(o.splice(0,2))),s="l",a=a==="m"?"l":"L"),s==="o"&&o.length===1&&r.push([a,o[0]]),s==="r")r.push([a].concat(o));else for(;o.length>=e[s]&&(r.push([a].concat(o.splice(0,e[s]))),!!e[s]););return t}),r},k0=function(t,e){for(var r=[],n=0,a=t.length;a-2*!e>n;n+=2){var i=[{x:+t[n-2],y:+t[n-1]},{x:+t[n],y:+t[n+1]},{x:+t[n+2],y:+t[n+3]},{x:+t[n+4],y:+t[n+5]}];e?n?a-4===n?i[3]={x:+t[0],y:+t[1]}:a-2===n&&(i[2]={x:+t[0],y:+t[1]},i[3]={x:+t[2],y:+t[3]}):i[0]={x:+t[a-2],y:+t[a-1]}:a-4===n?i[3]=i[2]:n||(i[0]={x:+t[n],y:+t[n+1]}),r.push(["C",(-i[0].x+6*i[1].x+i[2].x)/6,(-i[0].y+6*i[1].y+i[2].y)/6,(i[1].x+6*i[2].x-i[3].x)/6,(i[1].y+6*i[2].y-i[3].y)/6,i[2].x,i[2].y])}return r},uc=function(t,e,r,n,a){var i=[];if(a===null&&n===null&&(n=r),t=+t,e=+e,r=+r,n=+n,a!==null){var o=Math.PI/180,s=t+r*Math.cos(-n*o),u=t+r*Math.cos(-a*o),f=e+r*Math.sin(-n*o),l=e+r*Math.sin(-a*o);i=[["M",s,f],["A",r,r,0,+(a-n>180),0,u,l]]}else i=[["M",t,e],["m",0,-n],["a",r,n,0,1,1,0,2*n],["a",r,n,0,1,1,0,-2*n],["z"]];return i},N0=function(t){if(t=zs(t),!t||!t.length)return[["M",0,0]];var e=[],r=0,n=0,a=0,i=0,o=0,s,u;t[0][0]==="M"&&(r=+t[0][1],n=+t[0][2],a=r,i=n,o++,e[0]=["M",r,n]);for(var f=t.length===3&&t[0][0]==="M"&&t[1][0].toUpperCase()==="R"&&t[2][0].toUpperCase()==="Z",l=void 0,c=void 0,h=o,d=t.length;h<d;h++){if(e.push(l=[]),c=t[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]+r,l[7]=+c[7]+n;break;case"V":l[1]=+c[1]+n;break;case"H":l[1]=+c[1]+r;break;case"R":u=[r,n].concat(c.slice(1));for(var v=2,p=u.length;v<p;v++)u[v]=+u[v]+r,u[++v]=+u[v]+n;e.pop(),e=e.concat(k0(u,f));break;case"O":e.pop(),u=uc(r,n,c[1],c[2]),u.push(u[0]),e=e.concat(u);break;case"U":e.pop(),e=e.concat(uc(r,n,c[1],c[2],c[3])),l=["U"].concat(e[e.length-1].slice(-2));break;case"M":a=+c[1]+r,i=+c[2]+n;break;default:for(var v=1,p=c.length;v<p;v++)l[v]=+c[v]+(v%2?r:n)}else if(s==="R")u=[r,n].concat(c.slice(1)),e.pop(),e=e.concat(k0(u,f)),l=["R"].concat(c.slice(-2));else if(s==="O")e.pop(),u=uc(r,n,c[1],c[2]),u.push(u[0]),e=e.concat(u);else if(s==="U")e.pop(),e=e.concat(uc(r,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":r=+a,n=+i;break;case"H":r=l[1];break;case"V":n=l[1];break;case"M":a=l[l.length-2],i=l[l.length-1];break;default:r=l[l.length-2],n=l[l.length-1]}}return e},fc=function(t,e,r,n){return[t,e,r,n,r,n]},Tw=function(t,e,r,n,a,i){var o=.3333333333333333,s=2/3;return[o*t+s*r,o*e+s*n,o*a+s*r,o*i+s*n,a,i]},qA=function(t,e,r,n,a,i,o,s,u,f){r===n&&(r+=1);var l=Math.PI*120/180,c=Math.PI/180*(+a||0),h=[],d,v,p,g,y,m=function(Ve,it,dt){var st=Ve*Math.cos(dt)-it*Math.sin(dt),Tt=Ve*Math.sin(dt)+it*Math.cos(dt);return{x:st,y:Tt}};if(f)v=f[0],p=f[1],g=f[2],y=f[3];else{d=m(t,e,-c),t=d.x,e=d.y,d=m(s,u,-c),s=d.x,u=d.y,t===s&&e===u&&(s+=1,u+=1);var b=(t-s)/2,w=(e-u)/2,x=b*b/(r*r)+w*w/(n*n);x>1&&(x=Math.sqrt(x),r=x*r,n=x*n);var E=r*r,_=n*n,S=(i===o?-1:1)*Math.sqrt(Math.abs((E*_-E*w*w-_*b*b)/(E*w*w+_*b*b)));g=S*r*w/n+(t+s)/2,y=S*-n*b/r+(e+u)/2,v=Math.asin(((e-y)/n).toFixed(9)),p=Math.asin(((u-y)/n).toFixed(9)),v=t<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 A=p-v;if(Math.abs(A)>l){var M=p,C=s,I=u;p=v+l*(o&&p>v?1:-1),s=g+r*Math.cos(p),u=y+n*Math.sin(p),h=qA(s,u,r,n,a,0,o,C,I,[p,M,g,y])}A=p-v;var k=Math.cos(v),O=Math.sin(v),B=Math.cos(p),L=Math.sin(p),z=Math.tan(A/4),X=4/3*r*z,R=4/3*n*z,V=[t,e],he=[t+X*O,e-R*k],ce=[s+X*L,u-R*B],le=[s,u];if(he[0]=2*V[0]-he[0],he[1]=2*V[1]-he[1],f)return[he,ce,le].concat(h);h=[he,ce,le].concat(h).join().split(",");for(var ie=[],Ie=0,qe=h.length;Ie<qe;Ie++)ie[Ie]=Ie%2?m(h[Ie-1],h[Ie],c).y:m(h[Ie],h[Ie+1],c).x;return ie},O0=function(t,e){var r=N0(t),n=e&&N0(e),a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=[],s=[],u="",f="",l,c=function(b,w,x){var E,_;if(!b)return["C",w.x,w.y,w.x,w.y,w.x,w.y];switch(!(b[0]in{T:1,Q:1})&&(w.qx=w.qy=null),b[0]){case"M":w.X=b[1],w.Y=b[2];break;case"A":b=["C"].concat(qA.apply(0,[w.x,w.y].concat(b.slice(1))));break;case"S":x==="C"||x==="S"?(E=w.x*2-w.bx,_=w.y*2-w.by):(E=w.x,_=w.y),b=["C",E,_].concat(b.slice(1));break;case"T":x==="Q"||x==="T"?(w.qx=w.x*2-w.qx,w.qy=w.y*2-w.qy):(w.qx=w.x,w.qy=w.y),b=["C"].concat(Tw(w.x,w.y,w.qx,w.qy,b[1],b[2]));break;case"Q":w.qx=b[1],w.qy=b[2],b=["C"].concat(Tw(w.x,w.y,b[1],b[2],b[3],b[4]));break;case"L":b=["C"].concat(fc(w.x,w.y,b[1],b[2]));break;case"H":b=["C"].concat(fc(w.x,w.y,b[1],w.y));break;case"V":b=["C"].concat(fc(w.x,w.y,w.x,b[1]));break;case"Z":b=["C"].concat(fc(w.x,w.y,w.X,w.Y));break}return b},h=function(b,w){if(b[w].length>7){b[w].shift();for(var x=b[w];x.length;)o[w]="A",n&&(s[w]="A"),b.splice(w++,0,["C"].concat(x.splice(0,6)));b.splice(w,1),l=Math.max(r.length,n&&n.length||0)}},d=function(b,w,x,E,_){b&&w&&b[_][0]==="M"&&w[_][0]!=="M"&&(w.splice(_,0,["M",E.x,E.y]),x.bx=0,x.by=0,x.x=b[_][1],x.y=b[_][2],l=Math.max(r.length,n&&n.length||0))};l=Math.max(r.length,n&&n.length||0);for(var v=0;v<l;v++){r[v]&&(u=r[v][0]),u!=="C"&&(o[v]=u,v&&(f=o[v-1])),r[v]=c(r[v],a,f),o[v]!=="A"&&u==="C"&&(o[v]="C"),h(r,v),n&&(n[v]&&(u=n[v][0]),u!=="C"&&(s[v]=u,v&&(f=s[v-1])),n[v]=c(n[v],i,f),s[v]!=="A"&&u==="C"&&(s[v]="C"),h(n,v)),d(r,n,a,i,v),d(n,r,i,a,v);var p=r[v],g=n&&n[v],y=p.length,m=n&&g.length;a.x=p[y-2],a.y=p[y-1],a.bx=parseFloat(p[y-4])||a.x,a.by=parseFloat(p[y-3])||a.y,i.bx=n&&(parseFloat(g[m-4])||i.x),i.by=n&&(parseFloat(g[m-3])||i.y),i.x=n&&g[m-2],i.y=n&&g[m-1]}return n?[r,n]:r},vz=/,?([a-z]),?/gi,HA=function(t){return t.join(",").replace(vz,"$1")},Iw=function(t,e,r,n,a){var i=-3*e+9*r-9*n+3*a,o=t*i+6*e-12*r+6*n;return t*o-3*e+3*r},kw=function(t,e,r,n,a,i,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=Iw(p,t,r,a,o),y=Iw(p,e,n,i,s),m=g*g+y*y;d+=h[v]*Math.sqrt(m)}return f*d},pz=function(t,e,r,n,a,i,o,s){for(var u=[],f=[[],[]],l,c,h,d,v=0;v<2;++v){if(v===0?(c=6*t-12*r+6*a,l=-3*t+9*r-9*a+3*o,h=3*r-3*t):(c=6*e-12*n+6*i,l=-3*e+9*n-9*i+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,w=b,x;b--;)d=u[b],x=1-d,f[0][b]=x*x*x*t+3*x*x*d*r+3*x*d*d*a+d*d*d*o,f[1][b]=x*x*x*e+3*x*x*d*n+3*x*d*d*i+d*d*d*s;return f[0][w]=t,f[1][w]=e,f[0][w+1]=o,f[1][w+1]=s,f[0].length=f[1].length=w+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])}}},gz=function(t,e,r,n,a,i,o,s){if(!(Math.max(t,r)<Math.min(a,o)||Math.min(t,r)>Math.max(a,o)||Math.max(e,n)<Math.min(i,s)||Math.min(e,n)>Math.max(i,s))){var u=(t*n-e*r)*(a-o)-(t-r)*(a*s-i*o),f=(t*n-e*r)*(i-s)-(e-n)*(a*s-i*o),l=(t-r)*(i-s)-(e-n)*(a-o);if(l){var c=u/l,h=f/l,d=+c.toFixed(2),v=+h.toFixed(2);if(!(d<+Math.min(t,r).toFixed(2)||d>+Math.max(t,r).toFixed(2)||d<+Math.min(a,o).toFixed(2)||d>+Math.max(a,o).toFixed(2)||v<+Math.min(e,n).toFixed(2)||v>+Math.max(e,n).toFixed(2)||v<+Math.min(i,s).toFixed(2)||v>+Math.max(i,s).toFixed(2)))return{x:c,y:h}}}},Oi=function(t,e,r){return e>=t.x&&e<=t.x+t.width&&r>=t.y&&r<=t.y+t.height},ZA=function(t,e,r,n,a){if(a)return[["M",+t+ +a,e],["l",r-a*2,0],["a",a,a,0,0,1,a,a],["l",0,n-a*2],["a",a,a,0,0,1,-a,a],["l",a*2-r,0],["a",a,a,0,0,1,-a,-a],["l",0,a*2-n],["a",a,a,0,0,1,a,-a],["z"]];var i=[["M",t,e],["l",r,0],["l",0,n],["l",-r,0],["z"]];return i.parsePathArray=HA,i},L0=function(t,e,r,n){return t===null&&(t=e=r=n=0),e===null&&(e=t.y,r=t.width,n=t.height,t=t.x),{x:t,y:e,width:r,w:r,height:n,h:n,x2:t+r,y2:e+n,cx:t+r/2,cy:e+n/2,r1:Math.min(r,n)/2,r2:Math.max(r,n)/2,r0:Math.sqrt(r*r+n*n)/2,path:ZA(t,e,r,n),vb:[t,e,r,n].join(" ")}},yz=function(t,e){return t=L0(t),e=L0(e),Oi(e,t.x,t.y)||Oi(e,t.x2,t.y)||Oi(e,t.x,t.y2)||Oi(e,t.x2,t.y2)||Oi(t,e.x,e.y)||Oi(t,e.x2,e.y)||Oi(t,e.x,e.y2)||Oi(t,e.x2,e.y2)||(t.x<e.x2&&t.x>e.x||e.x<t.x2&&e.x>t.x)&&(t.y<e.y2&&t.y>e.y||e.y<t.y2&&e.y>t.y)},Nw=function(t,e,r,n,a,i,o,s){bt(t)||(t=[t,e,r,n,a,i,o,s]);var u=pz.apply(null,t);return L0(u.min.x,u.min.y,u.max.x-u.min.x,u.max.y-u.min.y)},Ow=function(t,e,r,n,a,i,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*t+c*3*u*r+f*3*u*u*a+d*o,p=l*e+c*3*u*n+f*3*u*u*i+d*s,g=t+2*u*(r-t)+h*(a-2*r+t),y=e+2*u*(n-e)+h*(i-2*n+e),m=r+2*u*(a-r)+h*(o-2*a+r),b=n+2*u*(i-n)+h*(s-2*i+n),w=f*t+u*r,x=f*e+u*n,E=f*a+u*o,_=f*i+u*s,S=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:w,y:x},end:{x:E,y:_},alpha:S}},mz=function(t,e,r){var n=Nw(t),a=Nw(e);if(!yz(n,a))return[];for(var i=kw.apply(0,t),o=kw.apply(0,e),s=~~(i/8),u=~~(o/8),f=[],l=[],c={},h=[],d=0;d<s+1;d++){var v=Ow.apply(0,t.concat(d/s));f.push({x:v.x,y:v.y,t:d/s})}for(var d=0;d<u+1;d++){var v=Ow.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],w=Math.abs(y.x-g.x)<.001?"y":"x",x=Math.abs(b.x-m.x)<.001?"y":"x",E=gz(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[w]-g[w])/(y[w]-g[w]))*(y.t-g.t),S=m.t+Math.abs((E[x]-m[x])/(b[x]-m[x]))*(b.t-m.t);_>=0&&_<=1&&S>=0&&S<=1&&h.push({x:E.x,y:E.y,t1:_,t2:S})}}return h},bz=function(t,e,r){t=O0(t),e=O0(e);for(var n,a,i,o,s,u,f,l,c,h,d=r?0:[],v=0,p=t.length;v<p;v++){var g=t[v];if(g[0]==="M")n=s=g[1],a=u=g[2];else{g[0]==="C"?(c=[n,a].concat(g.slice(1)),n=c[6],a=c[7]):(c=[n,a,n,a,s,u,s,u],n=s,a=u);for(var y=0,m=e.length;y<m;y++){var b=e[y];if(b[0]==="M")i=f=b[1],o=l=b[2];else{b[0]==="C"?(h=[i,o].concat(b.slice(1)),i=h[6],o=h[7]):(h=[i,o,i,o,f,l,f,l],i=f,o=l);var w=mz(c,h);{for(var x=0,E=w.length;x<E;x++)w[x].segment1=v,w[x].segment2=y,w[x].bez1=c,w[x].bez2=h;d=d.concat(w)}}}}}return d},wz=function(t,e){return bz(t,e)};function xz(t,e){var r=[],n=[];function a(i,o){if(i.length===1)r.push(i[0]),n.push(i[0]);else{for(var s=[],u=0;u<i.length-1;u++)u===0&&r.push(i[0]),u===i.length-2&&n.push(i[u+1]),s[u]=[(1-o)*i[u][0]+o*i[u+1][0],(1-o)*i[u][1]+o*i[u+1][1]];a(s,o)}}return t.length&&a(t,e),{left:r,right:n.reverse()}}function Ez(t,e,r){var n=[[t[1],t[2]]];r=r||2;var a=[];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 i=n,o=1/r,s=0;s<r-1;s++){var u=o/(1-o*s),f=xz(i,u);a.push(f.left),i=f.right}a.push(i);var l=a.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 _z=function(t,e,r){if(r===1)return[[].concat(t)];var n=[];if(e[0]==="L"||e[0]==="C"||e[0]==="Q")n=n.concat(Ez(t,e,r));else{var a=[].concat(t);a[0]==="M"&&(a[0]="L");for(var i=0;i<=r-1;i++)n.push(a)}return n},Sz=function(t,e){if(t.length===1)return t;var r=t.length-1,n=e.length-1,a=r/n,i=[];if(t.length===1&&t[0][0]==="M"){for(var o=0;o<n-r;o++)t.push(t[0]);return t}for(var o=0;o<n;o++){var s=Math.floor(a*o);i[s]=(i[s]||0)+1}var u=i.reduce(function(f,l,c){return c===r?f.concat(t[r]):f.concat(_z(t[c],t[c+1],l))},[]);return u.unshift(t[0]),(e[n]==="Z"||e[n]==="z")&&u.push("Z"),u},Mz=function(t,e){if(t.length!==e.length)return!1;var r=!0;return _e(t,function(n,a){if(n!==e[a])return r=!1,!1}),r};function Az(t,e,r){var n=null,a=r;return e<a&&(a=e,n="add"),t<a&&(a=t,n="del"),{type:n,min:a}}var Cz=function(t,e){var r=t.length,n=e.length,a,i,o=0;if(r===0||n===0)return null;for(var s=[],u=0;u<=r;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<=r;u++){a=t[u-1];for(var f=1;f<=n;f++){i=e[f-1],Mz(a,i)?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]=Az(l,c,h)}}return s},KA=function(t,e){var r=Cz(t,e),n=t.length,a=e.length,i=[],o=1,s=1;if(r[n][a].min!==n){for(var u=1;u<=n;u++){var f=r[u][u].min;s=u;for(var l=o;l<=a;l++)r[u][l].min<f&&(f=r[u][l].min,s=l);o=s,r[u][o].type&&i.push({index:u-1,type:r[u][o].type})}for(var u=i.length-1;u>=0;u--)o=i[u].index,i[u].type==="add"?t.splice(o,0,[].concat(t[o])):t.splice(o,1)}n=t.length;var c=a-n;if(n<a)for(var u=0;u<c;u++)t[n-1][0]==="z"||t[n-1][0]==="Z"?t.splice(n-2,0,t[n-2]):t.push(t[n-1]),n+=1;return t};function cp(t,e,r){for(var n=[].concat(t),a,i=1/(r+1),o=QA(e)[0],s=1;s<=r;s++)i*=s,a=Math.floor(t.length*i),a===0?n.unshift([o[0]*i+t[a][0]*(1-i),o[1]*i+t[a][1]*(1-i)]):n.splice(a,0,[o[0]*i+t[a][0]*(1-i),o[1]*i+t[a][1]*(1-i)]);return n}function QA(t){var e=[];switch(t[0]){case"M":e.push([t[1],t[2]]);break;case"L":e.push([t[1],t[2]]);break;case"A":e.push([t[6],t[7]]);break;case"Q":e.push([t[3],t[4]]),e.push([t[1],t[2]]);break;case"T":e.push([t[1],t[2]]);break;case"C":e.push([t[5],t[6]]),e.push([t[1],t[2]]),e.push([t[3],t[4]]);break;case"S":e.push([t[3],t[4]]),e.push([t[1],t[2]]);break;case"H":e.push([t[1],t[1]]);break;case"V":e.push([t[1],t[1]]);break}return e}var D0=function(t,e){if(t.length<=1)return t;for(var r,n=0;n<e.length;n++)if(t[n][0]!==e[n][0])switch(r=QA(t[n]),e[n][0]){case"M":t[n]=["M"].concat(r[0]);break;case"L":t[n]=["L"].concat(r[0]);break;case"A":t[n]=[].concat(e[n]),t[n][6]=r[0][0],t[n][7]=r[0][1];break;case"Q":if(r.length<2)if(n>0)r=cp(r,t[n-1],1);else{t[n]=e[n];break}t[n]=["Q"].concat(r.reduce(function(a,i){return a.concat(i)},[]));break;case"T":t[n]=["T"].concat(r[0]);break;case"C":if(r.length<3)if(n>0)r=cp(r,t[n-1],2);else{t[n]=e[n];break}t[n]=["C"].concat(r.reduce(function(a,i){return a.concat(i)},[]));break;case"S":if(r.length<2)if(n>0)r=cp(r,t[n-1],1);else{t[n]=e[n];break}t[n]=["S"].concat(r.reduce(function(a,i){return a.concat(i)},[]));break;default:t[n]=e[n]}return t};const Tz=Object.freeze(Object.defineProperty({__proto__:null,catmullRomToBezier:k0,fillPath:Sz,fillPathByDiff:KA,formatPath:D0,intersection:wz,parsePathArray:HA,parsePathString:zs,pathToAbsolute:N0,pathToCurve:O0,rectPath:ZA},Symbol.toStringTag,{value:"Module"}));var JA=function(){function t(e,r){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=r,this.timeStamp=r.timeStamp}return t.prototype.preventDefault=function(){this.defaultPrevented=!0,this.originalEvent.preventDefault&&this.originalEvent.preventDefault()},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t.prototype.toString=function(){var e=this.type;return"[Event (type="+e+")]"},t.prototype.save=function(){},t.prototype.restore=function(){},t}();function eC(t,e){var r=t.indexOf(e);r!==-1&&t.splice(r,1)}var Lw=typeof window<"u"&&typeof window.document<"u";function tC(t,e){if(t.isCanvas())return!0;for(var r=e.getParent(),n=!1;r;){if(r===t){n=!0;break}r=r.getParent()}return n}function P0(t){return t.cfg.visible&&t.cfg.capture}var Iz=function(t){jt(e,t);function e(r){var n=t.call(this)||this;n.destroyed=!1;var a=n.getDefaultCfg();return n.cfg=Et(a,r),n}return e.prototype.getDefaultCfg=function(){return{}},e.prototype.get=function(r){return this.cfg[r]},e.prototype.set=function(r,n){this.cfg[r]=n},e.prototype.destroy=function(){this.cfg={destroyed:!0},this.off(),this.destroyed=!0},e}(KS),Dw=function(t,e,r){if(r||arguments.length===2)for(var n=0,a=e.length,i;n<a;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},kz=function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t}(),Nz=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),Oz=function(){function t(e,r,n,a){this.name=e,this.version=r,this.os=n,this.bot=a,this.type="bot-device"}return t}(),Lz=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Dz=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),Pz=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Rz=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Pw=3,Fz=[["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",Pz]],Rw=[["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 rC(t){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Dz:typeof navigator<"u"?Gz(navigator.userAgent):jz()}function Bz(t){return t!==""&&Fz.reduce(function(e,r){var n=r[0],a=r[1];if(e)return e;var i=a.exec(t);return!!i&&[n,i]},!1)}function Gz(t){var e=Bz(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new Lz;var a=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);a?a.length<Pw&&(a=Dw(Dw([],a,!0),Uz(Pw-a.length),!0)):a=[];var i=a.join("."),o=zz(t),s=Rz.exec(t);return s&&s[1]?new Oz(r,i,o,s[1]):new kz(r,i,o)}function zz(t){for(var e=0,r=Rw.length;e<r;e++){var n=Rw[e],a=n[0],i=n[1],o=i.exec(t);if(o)return a}return null}function jz(){var t=typeof process<"u"&&process.version;return t?new Nz(process.version.slice(1)):null}function Uz(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}function Fw(t,e){var r=[],n=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],f=t[6],l=t[7],c=t[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],w=e[8];return r[0]=h*n+d*o+v*f,r[1]=h*a+d*s+v*l,r[2]=h*i+d*u+v*c,r[3]=p*n+g*o+y*f,r[4]=p*a+g*s+y*l,r[5]=p*i+g*u+y*c,r[6]=m*n+b*o+w*f,r[7]=m*a+b*s+w*l,r[8]=m*i+b*u+w*c,r}function Do(t,e){var r=[],n=e[0],a=e[1];return r[0]=t[0]*n+t[3]*a+t[6],r[1]=t[1]*n+t[4]*a+t[7],r}function nC(t){var e=[],r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],f=t[7],l=t[8],c=l*o-s*f,h=-l*i+s*u,d=f*i-o*u,v=r*c+n*h+a*d;return v?(v=1/v,e[0]=c*v,e[1]=(-l*n+a*f)*v,e[2]=(s*n-a*o)*v,e[3]=h*v,e[4]=(l*r-a*u)*v,e[5]=(-s*r+a*i)*v,e[6]=d*v,e[7]=(-f*r+n*u)*v,e[8]=(o*r-n*i)*v,e):null}var $u=eo,hp="matrix",$z=["zIndex","capture","visible","type"],Xz=["repeat"],Wz=":",Vz="*";function Yz(t){for(var e=[],r=0;r<t.length;r++)bt(t[r])?e.push([].concat(t[r])):e.push(t[r]);return e}function qz(t,e){var r={},n=e.attrs;for(var a in t)r[a]=n[a];return r}function Hz(t,e){var r={},n=e.attr();return _e(t,function(a,i){Xz.indexOf(i)===-1&&!jo(n[i],a)&&(r[i]=a)}),r}function Zz(t,e){if(e.onFrame)return t;var r=e.startTime,n=e.delay,a=e.duration,i=Object.prototype.hasOwnProperty;return _e(t,function(o){r+n<o.startTime+o.delay+o.duration&&a>o.delay&&_e(e.toAttrs,function(s,u){i.call(o.toAttrs,u)&&(delete o.toAttrs[u],delete o.fromAttrs[u])})}),t}var aC=function(t){jt(e,t);function e(r){var n=t.call(this,r)||this;n.attrs={};var a=n.getDefaultAttrs();return Et(a,r.attrs),n.attrs=a,n.initAttrs(a),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(r){},e.prototype.initAttrs=function(r){},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 r,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];var i=n[0],o=n[1];if(!i)return this.attrs;if(gn(i)){for(var s in i)this.setAttr(s,i[s]);return this.afterAttrsChange(i),this}return n.length===2?(this.setAttr(i,o),this.afterAttrsChange((r={},r[i]=o,r)),this):this.attrs[i]},e.prototype.isClipped=function(r,n){var a=this.getClip();return a&&!a.isHit(r,n)},e.prototype.setAttr=function(r,n){var a=this.attrs[r];a!==n&&(this.attrs[r]=n,this.onAttrChange(r,n,a))},e.prototype.onAttrChange=function(r,n,a){r==="matrix"&&this.set("totalMatrix",null)},e.prototype.afterAttrsChange=function(r){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(r){this.set("zIndex",r);var n=this.getParent();return n&&n.sort(),this},e.prototype.toFront=function(){var r=this.getParent();if(r){var n=r.getChildren();this.get("el");var a=n.indexOf(this);n.splice(a,1),n.push(this),this.onCanvasChange("zIndex")}},e.prototype.toBack=function(){var r=this.getParent();if(r){var n=r.getChildren();this.get("el");var a=n.indexOf(this);n.splice(a,1),n.unshift(this),this.onCanvasChange("zIndex")}},e.prototype.remove=function(r){r===void 0&&(r=!0);var n=this.getParent();n?(eC(n.getChildren(),this),n.get("clearing")||this.onCanvasChange("remove")):this.onCanvasChange("remove"),r&&this.destroy()},e.prototype.resetMatrix=function(){this.attr(hp,this.getDefaultMatrix()),this.onCanvasChange("matrix")},e.prototype.getMatrix=function(){return this.attr(hp)},e.prototype.setMatrix=function(r){this.attr(hp,r),this.onCanvasChange("matrix")},e.prototype.getTotalMatrix=function(){var r=this.cfg.totalMatrix;if(!r){var n=this.attr("matrix"),a=this.cfg.parentMatrix;a&&n?r=Fw(a,n):r=n||a,this.set("totalMatrix",r)}return r},e.prototype.applyMatrix=function(r){var n=this.attr("matrix"),a=null;r&&n?a=Fw(r,n):a=n||r,this.set("totalMatrix",a),this.set("parentMatrix",r)},e.prototype.getDefaultMatrix=function(){return null},e.prototype.applyToMatrix=function(r){var n=this.attr("matrix");return n?Do(n,r):r},e.prototype.invertFromMatrix=function(r){var n=this.attr("matrix");if(n){var a=nC(n);if(a)return Do(a,r)}return r},e.prototype.setClip=function(r){var n=this.getCanvas(),a=null;if(r){var i=this.getShapeBase(),o=Zs(r.type),s=i[o];s&&(a=new s({type:r.type,isClipShape:!0,applyTo:this,attrs:r.attrs,canvas:n}))}return this.set("clipShape",a),this.onCanvasChange("clip"),a},e.prototype.getClip=function(){var r=this.cfg.clipShape;return r||null},e.prototype.clone=function(){var r=this,n=this.attrs,a={};_e(n,function(s,u){bt(n[u])?a[u]=Yz(n[u]):a[u]=n[u]});var i=this.constructor,o=new i({attrs:a});return _e($z,function(s){o.set(s,r.get(s))}),o},e.prototype.destroy=function(){var r=this.destroyed;r||(this.attrs={},t.prototype.destroy.call(this))},e.prototype.isAnimatePaused=function(){return this.get("_pause").isPaused},e.prototype.animate=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(!(!this.get("timeline")&&!this.get("canvas"))){this.set("animating",!0);var a=this.get("timeline");a||(a=this.get("canvas").get("timeline"),this.set("timeline",a));var i=this.get("animations")||[];a.timer||a.initTimer();var o=r[0],s=r[1],u=r[2],f=u===void 0?"easeLinear":u,l=r[3],c=l===void 0?sf:l,h=r[4],d=h===void 0?0:h,v,p,g,y,m;Tr(o)?(v=o,o={}):gn(o)&&o.onFrame&&(v=o.onFrame,p=o.repeat),gn(s)?(m=s,s=m.duration,f=m.easing||"easeLinear",d=m.delay||0,p=m.repeat||p||!1,c=m.callback||sf,g=m.pauseCallback||sf,y=m.resumeCallback||sf):(Ot(c)&&(d=c,c=null),Tr(f)?(c=f,f="easeLinear"):f=f||"easeLinear");var b=Hz(o,this),w={fromAttrs:qz(b,this),toAttrs:b,duration:s,easing:f,repeat:p,callback:c,pauseCallback:g,resumeCallback:y,delay:d,startTime:a.getTime(),id:Ji(),onFrame:v,pathFormatted:!1};i.length>0?i=Zz(i,w):a.addAnimator(this),i.push(w),this.set("animations",i),this.set("_pause",{isPaused:!1})}},e.prototype.stopAnimate=function(r){var n=this;r===void 0&&(r=!0);var a=this.get("animations");_e(a,function(i){r&&(i.onFrame?n.attr(i.onFrame(1)):n.attr(i.toAttrs)),i.callback&&i.callback()}),this.set("animating",!1),this.set("animations",[])},e.prototype.pauseAnimate=function(){var r=this.get("timeline"),n=this.get("animations"),a=r.getTime();return _e(n,function(i){i._paused=!0,i._pauseTime=a,i.pauseCallback&&i.pauseCallback()}),this.set("_pause",{isPaused:!0,pauseTime:a}),this},e.prototype.resumeAnimate=function(){var r=this.get("timeline"),n=r.getTime(),a=this.get("animations"),i=this.get("_pause").pauseTime;return _e(a,function(o){o.startTime=o.startTime+(n-i),o._paused=!1,o._pauseTime=null,o.resumeCallback&&o.resumeCallback()}),this.set("_pause",{isPaused:!1}),this.set("animations",a),this},e.prototype.emitDelegation=function(r,n){var a=this,i=n.propagationPath;this.getEvents();var o;r==="mouseenter"?o=n.fromShape:r==="mouseleave"&&(o=n.toShape);for(var s=function(c){var h=i[c],d=h.get("name");if(d){if((h.isGroup()||h.isCanvas&&h.isCanvas())&&o&&tC(h,o))return"break";bt(d)?_e(d,function(v){a.emitDelegateEvent(h,v,n)}):u.emitDelegateEvent(h,d,n)}},u=this,f=0;f<i.length;f++){var l=s(f);if(l==="break")break}},e.prototype.emitDelegateEvent=function(r,n,a){var i=this.getEvents(),o=n+Wz+a.type;(i[o]||i[Vz])&&(a.name=o,a.currentTarget=r,a.delegateTarget=this,a.delegateObject=r.get("delegateObject"),this.emit(o,a))},e.prototype.translate=function(r,n){r===void 0&&(r=0),n===void 0&&(n=0);var a=this.getMatrix(),i=$u(a,[["t",r,n]]);return this.setMatrix(i),this},e.prototype.move=function(r,n){var a=this.attr("x")||0,i=this.attr("y")||0;return this.translate(r-a,n-i),this},e.prototype.moveTo=function(r,n){return this.move(r,n)},e.prototype.scale=function(r,n){var a=this.getMatrix(),i=$u(a,[["s",r,n||r]]);return this.setMatrix(i),this},e.prototype.rotate=function(r){var n=this.getMatrix(),a=$u(n,[["r",r]]);return this.setMatrix(a),this},e.prototype.rotateAtStart=function(r){var n=this.attr(),a=n.x,i=n.y,o=this.getMatrix(),s=$u(o,[["t",-a,-i],["r",r],["t",a,i]]);return this.setMatrix(s),this},e.prototype.rotateAtPoint=function(r,n,a){var i=this.getMatrix(),o=$u(i,[["t",-r,-n],["r",a],["t",r,n]]);return this.setMatrix(o),this},e}(Iz),Bw={},R0="_INDEX";function iC(t,e){if(t.set("canvas",e),t.isGroup()){var r=t.get("children");r.length&&r.forEach(function(n){iC(n,e)})}}function oC(t,e){if(t.set("timeline",e),t.isGroup()){var r=t.get("children");r.length&&r.forEach(function(n){oC(n,e)})}}function Kz(t,e,r){e.set("parent",null),e.set("canvas",null),eC(t.getChildren(),e)}function Qz(t){return function(e,r){var n=t(e,r);return n===0?e[R0]-r[R0]:n}}var sC=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.isCanvas=function(){return!1},e.prototype.getBBox=function(){var r=1/0,n=-1/0,a=1/0,i=-1/0,o=this.getChildren().filter(function(u){return u.get("visible")&&(!u.isGroup()||u.isGroup()&&u.getChildren().length>0)});o.length>0?_e(o,function(u){var f=u.getBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY;l<r&&(r=l),c>n&&(n=c),h<a&&(a=h),d>i&&(i=d)}):(r=0,n=0,a=0,i=0);var s={x:r,y:a,minX:r,minY:a,maxX:n,maxY:i,width:n-r,height:i-a};return s},e.prototype.getCanvasBBox=function(){var r=1/0,n=-1/0,a=1/0,i=-1/0,o=this.getChildren().filter(function(u){return u.get("visible")&&(!u.isGroup()||u.isGroup()&&u.getChildren().length>0)});o.length>0?_e(o,function(u){var f=u.getCanvasBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY;l<r&&(r=l),c>n&&(n=c),h<a&&(a=h),d>i&&(i=d)}):(r=0,n=0,a=0,i=0);var s={x:r,y:a,minX:r,minY:a,maxX:n,maxY:i,width:n-r,height:i-a};return s},e.prototype.getDefaultCfg=function(){var r=t.prototype.getDefaultCfg.call(this);return r.children=[],r},e.prototype.onAttrChange=function(r,n,a){if(t.prototype.onAttrChange.call(this,r,n,a),r==="matrix"){var i=this.getTotalMatrix();this._applyChildrenMarix(i)}},e.prototype.applyMatrix=function(r){var n=this.getTotalMatrix();t.prototype.applyMatrix.call(this,r);var a=this.getTotalMatrix();a!==n&&this._applyChildrenMarix(a)},e.prototype._applyChildrenMarix=function(r){var n=this.getChildren();_e(n,function(a){a.applyMatrix(r)})},e.prototype.addShape=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var a=r[0],i=r[1];gn(a)?i=a:i.type=a;var o=Bw[i.type];o||(o=Zs(i.type),Bw[i.type]=o);var s=this.getShapeBase(),u=new s[o](i);return this.add(u),u},e.prototype.addGroup=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var a=r[0],i=r[1],o;if(Tr(a))i?o=new a(i):o=new a({parent:this});else{var s=a||{},u=this.getGroupBase();o=new u(s)}return this.add(o),o},e.prototype.getCanvas=function(){var r;return this.isCanvas()?r=this:r=this.get("canvas"),r},e.prototype.getShape=function(r,n,a){if(!P0(this))return null;var i=this.getChildren(),o;if(this.isCanvas())o=this._findShape(i,r,n,a);else{var s=[r,n,1];s=this.invertFromMatrix(s),this.isClipped(s[0],s[1])||(o=this._findShape(i,s[0],s[1],a))}return o},e.prototype._findShape=function(r,n,a,i){for(var o=null,s=r.length-1;s>=0;s--){var u=r[s];if(P0(u)&&(u.isGroup()?o=u.getShape(n,a,i):u.isHit(n,a)&&(o=u)),o)break}return o},e.prototype.add=function(r){var n=this.getCanvas(),a=this.getChildren(),i=this.get("timeline"),o=r.getParent();o&&Kz(o,r),r.set("parent",this),n&&iC(r,n),i&&oC(r,i),a.push(r),r.onCanvasChange("add"),this._applyElementMatrix(r)},e.prototype._applyElementMatrix=function(r){var n=this.getTotalMatrix();n&&r.applyMatrix(n)},e.prototype.getChildren=function(){return this.get("children")||[]},e.prototype.sort=function(){var r=this.getChildren();_e(r,function(n,a){return n[R0]=a,n}),r.sort(Qz(function(n,a){return n.get("zIndex")-a.get("zIndex")})),this.onCanvasChange("sort")},e.prototype.clear=function(){if(this.set("clearing",!0),!this.destroyed){for(var r=this.getChildren(),n=r.length-1;n>=0;n--)r[n].destroy();this.set("children",[]),this.onCanvasChange("clear"),this.set("clearing",!1)}},e.prototype.destroy=function(){this.get("destroyed")||(this.clear(),t.prototype.destroy.call(this))},e.prototype.getFirst=function(){return this.getChildByIndex(0)},e.prototype.getLast=function(){var r=this.getChildren();return this.getChildByIndex(r.length-1)},e.prototype.getChildByIndex=function(r){var n=this.getChildren();return n[r]},e.prototype.getCount=function(){var r=this.getChildren();return r.length},e.prototype.contain=function(r){var n=this.getChildren();return n.indexOf(r)>-1},e.prototype.removeChild=function(r,n){n===void 0&&(n=!0),this.contain(r)&&r.remove(n)},e.prototype.findAll=function(r){var n=[],a=this.getChildren();return _e(a,function(i){r(i)&&n.push(i),i.isGroup()&&(n=n.concat(i.findAll(r)))}),n},e.prototype.find=function(r){var n=null,a=this.getChildren();return _e(a,function(i){if(r(i)?n=i:i.isGroup()&&(n=i.find(r)),n)return!1}),n},e.prototype.findById=function(r){return this.find(function(n){return n.get("id")===r})},e.prototype.findByClassName=function(r){return this.find(function(n){return n.get("className")===r})},e.prototype.findAllByName=function(r){return this.findAll(function(n){return n.get("name")===r})},e}(aC),Ks=0,ff=0,Xu=0,uC=1e3,Ph,lf,Rh=0,Xo=0,Ed=0,Pf=typeof performance=="object"&&performance.now?performance:Date,fC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function lC(){return Xo||(fC(Jz),Xo=Pf.now()+Ed)}function Jz(){Xo=0}function F0(){this._call=this._time=this._next=null}F0.prototype=cC.prototype={constructor:F0,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?lC():+r)+(e==null?0:+e),!this._next&&lf!==this&&(lf?lf._next=this:Ph=this,lf=this),this._call=t,this._time=r,B0()},stop:function(){this._call&&(this._call=null,this._time=1/0,B0())}};function cC(t,e,r){var n=new F0;return n.restart(t,e,r),n}function e6(){lC(),++Ks;for(var t=Ph,e;t;)(e=Xo-t._time)>=0&&t._call.call(null,e),t=t._next;--Ks}function Gw(){Xo=(Rh=Pf.now())+Ed,Ks=ff=0;try{e6()}finally{Ks=0,r6(),Xo=0}}function t6(){var t=Pf.now(),e=t-Rh;e>uC&&(Ed-=e,Rh=t)}function r6(){for(var t,e=Ph,r,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:Ph=r);lf=t,B0(n)}function B0(t){if(!Ks){ff&&(ff=clearTimeout(ff));var e=t-Xo;e>24?(t<1/0&&(ff=setTimeout(Gw,t-Pf.now()-Ed)),Xu&&(Xu=clearInterval(Xu))):(Xu||(Rh=Pf.now(),Xu=setInterval(t6,uC)),Ks=1,fC(Gw))}}function Dy(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function hC(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function Jf(){}var Rf=.7,Fh=1/Rf,$s="\\s*([+-]?\\d+)\\s*",Ff="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Va="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",n6=/^#([0-9a-f]{3,8})$/,a6=new RegExp(`^rgb\\(${$s},${$s},${$s}\\)$`),i6=new RegExp(`^rgb\\(${Va},${Va},${Va}\\)$`),o6=new RegExp(`^rgba\\(${$s},${$s},${$s},${Ff}\\)$`),s6=new RegExp(`^rgba\\(${Va},${Va},${Va},${Ff}\\)$`),u6=new RegExp(`^hsl\\(${Ff},${Va},${Va}\\)$`),f6=new RegExp(`^hsla\\(${Ff},${Va},${Va},${Ff}\\)$`),zw={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};Dy(Jf,Bf,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:jw,formatHex:jw,formatHex8:l6,formatHsl:c6,formatRgb:Uw,toString:Uw});function jw(){return this.rgb().formatHex()}function l6(){return this.rgb().formatHex8()}function c6(){return dC(this).formatHsl()}function Uw(){return this.rgb().formatRgb()}function Bf(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=n6.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?$w(e):r===3?new Nn(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?lc(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?lc(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=a6.exec(t))?new Nn(e[1],e[2],e[3],1):(e=i6.exec(t))?new Nn(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=o6.exec(t))?lc(e[1],e[2],e[3],e[4]):(e=s6.exec(t))?lc(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=u6.exec(t))?Vw(e[1],e[2]/100,e[3]/100,1):(e=f6.exec(t))?Vw(e[1],e[2]/100,e[3]/100,e[4]):zw.hasOwnProperty(t)?$w(zw[t]):t==="transparent"?new Nn(NaN,NaN,NaN,0):null}function $w(t){return new Nn(t>>16&255,t>>8&255,t&255,1)}function lc(t,e,r,n){return n<=0&&(t=e=r=NaN),new Nn(t,e,r,n)}function h6(t){return t instanceof Jf||(t=Bf(t)),t?(t=t.rgb(),new Nn(t.r,t.g,t.b,t.opacity)):new Nn}function G0(t,e,r,n){return arguments.length===1?h6(t):new Nn(t,e,r,n??1)}function Nn(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}Dy(Nn,G0,hC(Jf,{brighter(t){return t=t==null?Fh:Math.pow(Fh,t),new Nn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Rf:Math.pow(Rf,t),new Nn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Nn(Bo(this.r),Bo(this.g),Bo(this.b),Bh(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:Xw,formatHex:Xw,formatHex8:d6,formatRgb:Ww,toString:Ww}));function Xw(){return`#${Po(this.r)}${Po(this.g)}${Po(this.b)}`}function d6(){return`#${Po(this.r)}${Po(this.g)}${Po(this.b)}${Po((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ww(){const t=Bh(this.opacity);return`${t===1?"rgb(":"rgba("}${Bo(this.r)}, ${Bo(this.g)}, ${Bo(this.b)}${t===1?")":`, ${t})`}`}function Bh(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Bo(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Po(t){return t=Bo(t),(t<16?"0":"")+t.toString(16)}function Vw(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new ga(t,e,r,n)}function dC(t){if(t instanceof ga)return new ga(t.h,t.s,t.l,t.opacity);if(t instanceof Jf||(t=Bf(t)),!t)return new ga;if(t instanceof ga)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,a=Math.min(e,r,n),i=Math.max(e,r,n),o=NaN,s=i-a,u=(i+a)/2;return s?(e===i?o=(r-n)/s+(r<n)*6:r===i?o=(n-e)/s+2:o=(e-r)/s+4,s/=u<.5?i+a:2-i-a,o*=60):s=u>0&&u<1?0:o,new ga(o,s,u,t.opacity)}function v6(t,e,r,n){return arguments.length===1?dC(t):new ga(t,e,r,n??1)}function ga(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}Dy(ga,v6,hC(Jf,{brighter(t){return t=t==null?Fh:Math.pow(Fh,t),new ga(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Rf:Math.pow(Rf,t),new ga(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,a=2*r-n;return new Nn(dp(t>=240?t-240:t+120,a,n),dp(t,a,n),dp(t<120?t+240:t-120,a,n),this.opacity)},clamp(){return new ga(Yw(this.h),cc(this.s),cc(this.l),Bh(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 t=Bh(this.opacity);return`${t===1?"hsl(":"hsla("}${Yw(this.h)}, ${cc(this.s)*100}%, ${cc(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Yw(t){return t=(t||0)%360,t<0?t+360:t}function cc(t){return Math.max(0,Math.min(1,t||0))}function dp(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const Py=t=>()=>t;function p6(t,e){return function(r){return t+r*e}}function g6(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function y6(t){return(t=+t)==1?vC:function(e,r){return r-e?g6(e,r,t):Py(isNaN(e)?r:e)}}function vC(t,e){var r=e-t;return r?p6(t,r):Py(isNaN(t)?e:t)}const qw=function t(e){var r=y6(e);function n(a,i){var o=r((a=G0(a)).r,(i=G0(i)).r),s=r(a.g,i.g),u=r(a.b,i.b),f=vC(a.opacity,i.opacity);return function(l){return a.r=o(l),a.g=s(l),a.b=u(l),a.opacity=f(l),a+""}}return n.gamma=t,n}(1);function pC(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),a;return function(i){for(a=0;a<r;++a)n[a]=t[a]*(1-i)+e[a]*i;return n}}function gC(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function m6(t,e){return(gC(e)?pC:yC)(t,e)}function yC(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,a=new Array(n),i=new Array(r),o;for(o=0;o<n;++o)a[o]=Gh(t[o],e[o]);for(;o<r;++o)i[o]=e[o];return function(s){for(o=0;o<n;++o)i[o]=a[o](s);return i}}function b6(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function z0(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function w6(t,e){var r={},n={},a;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(a in e)a in t?r[a]=Gh(t[a],e[a]):n[a]=e[a];return function(i){for(a in r)n[a]=r[a](i);return n}}var j0=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vp=new RegExp(j0.source,"g");function x6(t){return function(){return t}}function E6(t){return function(e){return t(e)+""}}function _6(t,e){var r=j0.lastIndex=vp.lastIndex=0,n,a,i,o=-1,s=[],u=[];for(t=t+"",e=e+"";(n=j0.exec(t))&&(a=vp.exec(e));)(i=a.index)>r&&(i=e.slice(r,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(a=a[0])?s[o]?s[o]+=a:s[++o]=a:(s[++o]=null,u.push({i:o,x:z0(n,a)})),r=vp.lastIndex;return r<e.length&&(i=e.slice(r),s[o]?s[o]+=i:s[++o]=i),s.length<2?u[0]?E6(u[0].x):x6(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 Gh(t,e){var r=typeof e,n;return e==null||r==="boolean"?Py(e):(r==="number"?z0:r==="string"?(n=Bf(e))?(e=n,qw):_6:e instanceof Bf?qw:e instanceof Date?b6:gC(e)?pC:Array.isArray(e)?yC:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?w6:z0)(t,e)}function S6(t){return+t}function M6(t){return t*t}function A6(t){return t*(2-t)}function Hw(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function C6(t){return t*t*t}function T6(t){return--t*t*t+1}function Zw(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Ry=3,I6=function t(e){e=+e;function r(n){return Math.pow(n,e)}return r.exponent=t,r}(Ry),k6=function t(e){e=+e;function r(n){return 1-Math.pow(1-n,e)}return r.exponent=t,r}(Ry),Kw=function t(e){e=+e;function r(n){return((n*=2)<=1?Math.pow(n,e):2-Math.pow(2-n,e))/2}return r.exponent=t,r}(Ry),mC=Math.PI,bC=mC/2;function N6(t){return+t==1?1:1-Math.cos(t*bC)}function O6(t){return Math.sin(t*bC)}function Qw(t){return(1-Math.cos(mC*t))/2}function Yi(t){return(Math.pow(2,-10*t)-.0009765625)*1.0009775171065494}function L6(t){return Yi(1-+t)}function D6(t){return 1-Yi(t)}function Jw(t){return((t*=2)<=1?Yi(1-t):2-Yi(t-1))/2}function P6(t){return 1-Math.sqrt(1-t*t)}function R6(t){return Math.sqrt(1- --t*t)}function ex(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var U0=4/11,F6=6/11,B6=8/11,G6=3/4,z6=9/11,j6=10/11,U6=15/16,$6=21/22,X6=63/64,hc=1/U0/U0;function W6(t){return 1-Gf(1-t)}function Gf(t){return(t=+t)<U0?hc*t*t:t<B6?hc*(t-=F6)*t+G6:t<j6?hc*(t-=z6)*t+U6:hc*(t-=$6)*t+X6}function V6(t){return((t*=2)<=1?1-Gf(1-t):Gf(t-1)+1)/2}var Fy=1.70158,Y6=function t(e){e=+e;function r(n){return(n=+n)*n*(e*(n-1)+n)}return r.overshoot=t,r}(Fy),q6=function t(e){e=+e;function r(n){return--n*n*((n+1)*e+n)+1}return r.overshoot=t,r}(Fy),tx=function t(e){e=+e;function r(n){return((n*=2)<1?n*n*((e+1)*n-e):(n-=2)*n*((e+1)*n+e)+2)/2}return r.overshoot=t,r}(Fy),Qs=2*Math.PI,By=1,Gy=.3,H6=function t(e,r){var n=Math.asin(1/(e=Math.max(1,e)))*(r/=Qs);function a(i){return e*Yi(- --i)*Math.sin((n-i)/r)}return a.amplitude=function(i){return t(i,r*Qs)},a.period=function(i){return t(e,i)},a}(By,Gy),rx=function t(e,r){var n=Math.asin(1/(e=Math.max(1,e)))*(r/=Qs);function a(i){return 1-e*Yi(i=+i)*Math.sin((i+n)/r)}return a.amplitude=function(i){return t(i,r*Qs)},a.period=function(i){return t(e,i)},a}(By,Gy),Z6=function t(e,r){var n=Math.asin(1/(e=Math.max(1,e)))*(r/=Qs);function a(i){return((i=i*2-1)<0?e*Yi(-i)*Math.sin((n-i)/r):2-e*Yi(i)*Math.sin((n+i)/r))/2}return a.amplitude=function(i){return t(i,r*Qs)},a.period=function(i){return t(e,i)},a}(By,Gy);const K6=Object.freeze(Object.defineProperty({__proto__:null,easeBack:tx,easeBackIn:Y6,easeBackInOut:tx,easeBackOut:q6,easeBounce:Gf,easeBounceIn:W6,easeBounceInOut:V6,easeBounceOut:Gf,easeCircle:ex,easeCircleIn:P6,easeCircleInOut:ex,easeCircleOut:R6,easeCubic:Zw,easeCubicIn:C6,easeCubicInOut:Zw,easeCubicOut:T6,easeElastic:rx,easeElasticIn:H6,easeElasticInOut:Z6,easeElasticOut:rx,easeExp:Jw,easeExpIn:L6,easeExpInOut:Jw,easeExpOut:D6,easeLinear:S6,easePoly:Kw,easePolyIn:I6,easePolyInOut:Kw,easePolyOut:k6,easeQuad:Hw,easeQuadIn:M6,easeQuadInOut:Hw,easeQuadOut:A6,easeSin:Qw,easeSinIn:N6,easeSinInOut:Qw,easeSinOut:O6},Symbol.toStringTag,{value:"Module"}));var Q6={};function J6(t){return Q6[t.toLowerCase()]||K6[t]}var ej=function(t){return["fill","stroke","fillStyle","strokeStyle"].includes(t)},tj=function(t){return/^[r,R,L,l]{1}[\s]*\(/.test(t)},nx=[1,0,0,0,1,0,0,0,1];function rj(t,e,r){var n={},a=e.fromAttrs,i=e.toAttrs;if(!t.destroyed){var o;for(var s in i)if(!jo(a[s],i[s]))if(s==="path"){var u=i[s],f=a[s];u.length>f.length?(u=zs(i[s]),f=zs(a[s]),f=KA(f,u),f=D0(f,u),e.fromAttrs.path=f,e.toAttrs.path=u):e.pathFormatted||(u=zs(i[s]),f=zs(a[s]),f=D0(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++)Ot(c[v])&&h&&Ot(h[v])?(o=Gh(h[v],c[v]),d.push(o(r))):d.push(c[v]);n[s].push(d)}}else if(s==="matrix"){var p=m6(a[s]||nx,i[s]||nx),g=p(r);n[s]=g}else ej(s)&&tj(i[s])?n[s]=i[s]:Tr(i[s])||(o=Gh(a[s],i[s]),n[s]=o(r));t.attr(n)}}function nj(t,e,r){var n=e.startTime,a=e.delay;if(r<n+a||e._paused)return!1;var i,o=e.duration,s=e.easing,u=J6(s);if(r=r-n-e.delay,e.repeat)i=r%o/o,i=u(i);else if(i=r/o,i<1)i=u(i);else return e.onFrame?t.attr(e.onFrame(1)):t.attr(e.toAttrs),!0;if(e.onFrame){var f=e.onFrame(i);t.attr(f)}else rj(t,e,i);return!1}var aj=function(){function t(e){this.animators=[],this.current=0,this.timer=null,this.canvas=e}return t.prototype.initTimer=function(){var e=this,r=!1,n,a,i;this.timer=cC(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()){a=n.get("animations");for(var u=a.length-1;u>=0;u--)i=a[u],r=nj(n,i,o),r&&(a.splice(u,1),r=!1,i.callback&&i.callback())}a.length===0&&e.removeAnimator(s)}var f=e.canvas.get("autoDraw");f||e.canvas.draw()}})},t.prototype.addAnimator=function(e){this.animators.push(e)},t.prototype.removeAnimator=function(e){this.animators.splice(e,1)},t.prototype.isAnimating=function(){return!!this.animators.length},t.prototype.stop=function(){this.timer&&this.timer.stop()},t.prototype.stopAllAnimations=function(e){e===void 0&&(e=!0),this.animators.forEach(function(r){r.stopAnimate(e)}),this.animators=[],this.canvas.draw()},t.prototype.getTime=function(){return this.current},t}(),ij=40,ax=0,ix=["mousedown","mouseup","dblclick","mouseout","mouseover","mousemove","mouseleave","mouseenter","touchstart","touchmove","touchend","dragenter","dragover","dragleave","drop","contextmenu","mousewheel"];function ox(t,e,r){r.name=e,r.target=t,r.currentTarget=t,r.delegateTarget=t,t.emit(e,r)}function oj(t,e,r){if(r.bubbles){var n=void 0,a=!1;if(e==="mouseenter"?(n=r.fromShape,a=!0):e==="mouseleave"&&(a=!0,n=r.toShape),t.isCanvas()&&a)return;if(n&&tC(t,n)){r.bubbles=!1;return}r.name=e,r.currentTarget=t,r.delegateTarget=t,t.emit(e,r)}}var sj=function(){function t(e){var r=this;this.draggingShape=null,this.dragging=!1,this.currentShape=null,this.mousedownShape=null,this.mousedownPoint=null,this._eventCallback=function(n){var a=n.type;r._triggerEvent(a,n)},this._onDocumentMove=function(n){var a=r.canvas,i=a.get("el");if(i!==n.target&&(r.dragging||r.currentShape)){var o=r._getPointInfo(n);r.dragging&&r._emitEvent("drag",n,o,r.draggingShape)}},this._onDocumentMouseUp=function(n){var a=r.canvas,i=a.get("el");if(i!==n.target&&r.dragging){var o=r._getPointInfo(n);r.draggingShape&&r._emitEvent("drop",n,o,null),r._emitEvent("dragend",n,o,r.draggingShape),r._afterDrag(r.draggingShape,o,n)}},this.canvas=e.canvas}return t.prototype.init=function(){this._bindEvents()},t.prototype._bindEvents=function(){var e=this,r=this.canvas.get("el");_e(ix,function(n){r.addEventListener(n,e._eventCallback)}),document&&(document.addEventListener("mousemove",this._onDocumentMove),document.addEventListener("mouseup",this._onDocumentMouseUp))},t.prototype._clearEvents=function(){var e=this,r=this.canvas.get("el");_e(ix,function(n){r.removeEventListener(n,e._eventCallback)}),document&&(document.removeEventListener("mousemove",this._onDocumentMove),document.removeEventListener("mouseup",this._onDocumentMouseUp))},t.prototype._getEventObj=function(e,r,n,a,i,o){var s=new JA(e,r);return s.fromShape=i,s.toShape=o,s.x=n.x,s.y=n.y,s.clientX=n.clientX,s.clientY=n.clientY,s.propagationPath.push(a),s},t.prototype._getShape=function(e,r){return this.canvas.getShape(e.x,e.y,r)},t.prototype._getPointInfo=function(e){var r=this.canvas,n=r.getClientByEvent(e),a=r.getPointByEvent(e);return{x:a.x,y:a.y,clientX:n.x,clientY:n.y}},t.prototype._triggerEvent=function(e,r){var n=this._getPointInfo(r),a=this._getShape(n,r),i=this["_on"+e],o=!1;if(i)i.call(this,n,a,r);else{var s=this.currentShape;e==="mouseenter"||e==="dragenter"||e==="mouseover"?(this._emitEvent(e,r,n,null,null,a),a&&this._emitEvent(e,r,n,a,null,a),e==="mouseenter"&&this.draggingShape&&this._emitEvent("dragenter",r,n,null)):e==="mouseleave"||e==="dragleave"||e==="mouseout"?(o=!0,s&&this._emitEvent(e,r,n,s,s,null),this._emitEvent(e,r,n,null,s,null),e==="mouseleave"&&this.draggingShape&&this._emitEvent("dragleave",r,n,null)):this._emitEvent(e,r,n,a,null,null)}if(o||(this.currentShape=a),a&&!a.get("destroyed")){var u=this.canvas,f=u.get("el");f.style.cursor=a.attr("cursor")||u.get("cursor")}},t.prototype._onmousedown=function(e,r,n){n.button===ax&&(this.mousedownShape=r,this.mousedownPoint=e,this.mousedownTimeStamp=n.timeStamp),this._emitEvent("mousedown",n,e,r,null,null)},t.prototype._emitMouseoverEvents=function(e,r,n,a){var i=this.canvas.get("el");n!==a&&(n&&(this._emitEvent("mouseout",e,r,n,n,a),this._emitEvent("mouseleave",e,r,n,n,a),(!a||a.get("destroyed"))&&(i.style.cursor=this.canvas.get("cursor"))),a&&(this._emitEvent("mouseover",e,r,a,n,a),this._emitEvent("mouseenter",e,r,a,n,a)))},t.prototype._emitDragoverEvents=function(e,r,n,a,i){a?(a!==n&&(n&&this._emitEvent("dragleave",e,r,n,n,a),this._emitEvent("dragenter",e,r,a,n,a)),i||this._emitEvent("dragover",e,r,a)):n&&this._emitEvent("dragleave",e,r,n,n,a),i&&this._emitEvent("dragover",e,r,a)},t.prototype._afterDrag=function(e,r,n){e&&(e.set("capture",!0),this.draggingShape=null),this.dragging=!1;var a=this._getShape(r,n);a!==e&&this._emitMouseoverEvents(n,r,e,a),this.currentShape=a},t.prototype._onmouseup=function(e,r,n){if(n.button===ax){var a=this.draggingShape;this.dragging?(a&&this._emitEvent("drop",n,e,r),this._emitEvent("dragend",n,e,a),this._afterDrag(a,e,n)):(this._emitEvent("mouseup",n,e,r),r===this.mousedownShape&&this._emitEvent("click",n,e,r),this.mousedownShape=null,this.mousedownPoint=null)}},t.prototype._ondragover=function(e,r,n){n.preventDefault();var a=this.currentShape;this._emitDragoverEvents(n,e,a,r,!0)},t.prototype._onmousemove=function(e,r,n){var a=this.canvas,i=this.currentShape,o=this.draggingShape;if(this.dragging)o&&this._emitDragoverEvents(n,e,i,r,!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>ij?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&&a.get("draggable")?(this.dragging=!0,this._emitEvent("dragstart",n,e,null),this.mousedownShape=null,this.mousedownPoint=null):(this._emitMouseoverEvents(n,e,i,r),this._emitEvent("mousemove",n,e,r)):(this._emitMouseoverEvents(n,e,i,r),this._emitEvent("mousemove",n,e,r))}else this._emitMouseoverEvents(n,e,i,r),this._emitEvent("mousemove",n,e,r)}},t.prototype._emitEvent=function(e,r,n,a,i,o){var s=this._getEventObj(e,r,n,a,i,o);if(a){s.shape=a,ox(a,e,s);for(var u=a.getParent();u;)u.emitDelegation(e,s),s.propagationStopped||oj(u,e,s),s.propagationPath.push(u),u=u.getParent()}else{var f=this.canvas;ox(f,e,s)}},t.prototype.destroy=function(){this._clearEvents(),this.canvas=null,this.currentShape=null,this.draggingShape=null,this.mousedownPoint=null,this.mousedownShape=null,this.mousedownTimeStamp=null},t}(),sx="px",ux=rC(),uj=ux&&ux.name==="firefox",wC=function(t){jt(e,t);function e(r){var n=t.call(this,r)||this;return n.initContainer(),n.initDom(),n.initEvents(),n.initTimeline(),n}return e.prototype.getDefaultCfg=function(){var r=t.prototype.getDefaultCfg.call(this);return r.cursor="default",r.supportCSSTransform=!1,r},e.prototype.initContainer=function(){var r=this.get("container");Ye(r)&&(r=document.getElementById(r),this.set("container",r))},e.prototype.initDom=function(){var r=this.createDom();this.set("el",r);var n=this.get("container");n.appendChild(r),this.setDOMSize(this.get("width"),this.get("height"))},e.prototype.initEvents=function(){var r=new sj({canvas:this});r.init(),this.set("eventController",r)},e.prototype.initTimeline=function(){var r=new aj(this);this.set("timeline",r)},e.prototype.setDOMSize=function(r,n){var a=this.get("el");Lw&&(a.style.width=r+sx,a.style.height=n+sx)},e.prototype.changeSize=function(r,n){this.setDOMSize(r,n),this.set("width",r),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(r){this.set("cursor",r);var n=this.get("el");Lw&&n&&(n.style.cursor=r)},e.prototype.getPointByEvent=function(r){var n=this.get("supportCSSTransform");if(n){if(uj&&!Zt(r.layerX)&&r.layerX!==r.offsetX)return{x:r.layerX,y:r.layerY};if(!Zt(r.offsetX))return{x:r.offsetX,y:r.offsetY}}var a=this.getClientByEvent(r),i=a.x,o=a.y;return this.getPointByClient(i,o)},e.prototype.getClientByEvent=function(r){var n=r;return r.touches&&(r.type==="touchend"?n=r.changedTouches[0]:n=r.touches[0]),{x:n.clientX,y:n.clientY}},e.prototype.getPointByClient=function(r,n){var a=this.get("el"),i=a.getBoundingClientRect();return{x:r-i.left,y:n-i.top}},e.prototype.getClientByPoint=function(r,n){var a=this.get("el"),i=a.getBoundingClientRect();return{x:r+i.left,y:n+i.top}},e.prototype.draw=function(){},e.prototype.removeDom=function(){var r=this.get("el");r.parentNode.removeChild(r)},e.prototype.clearEvents=function(){var r=this.get("eventController");r.destroy()},e.prototype.isCanvas=function(){return!0},e.prototype.getParent=function(){return null},e.prototype.destroy=function(){var r=this.get("timeline");this.get("destroyed")||(this.clear(),r&&r.stop(),this.clearEvents(),this.removeDom(),t.prototype.destroy.call(this))},e}(sC),xC=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.isGroup=function(){return!0},e.prototype.isEntityGroup=function(){return!1},e.prototype.clone=function(){for(var r=t.prototype.clone.call(this),n=this.getChildren(),a=0;a<n.length;a++){var i=n[a];r.add(i.clone())}return r},e}(sC),EC=function(t){jt(e,t);function e(r){return t.call(this,r)||this}return e.prototype._isInBBox=function(r,n){var a=this.getBBox();return a.minX<=r&&a.maxX>=r&&a.minY<=n&&a.maxY>=n},e.prototype.afterAttrsChange=function(r){t.prototype.afterAttrsChange.call(this,r),this.clearCacheBBox()},e.prototype.getBBox=function(){var r=this.cfg.bbox;return r||(r=this.calculateBBox(),this.set("bbox",r)),r},e.prototype.getCanvasBBox=function(){var r=this.cfg.canvasBBox;return r||(r=this.calculateCanvasBBox(),this.set("canvasBBox",r)),r},e.prototype.applyMatrix=function(r){t.prototype.applyMatrix.call(this,r),this.set("canvasBBox",null)},e.prototype.calculateCanvasBBox=function(){var r=this.getBBox(),n=this.getTotalMatrix(),a=r.minX,i=r.minY,o=r.maxX,s=r.maxY;if(n){var u=Do(n,[r.minX,r.minY]),f=Do(n,[r.maxX,r.minY]),l=Do(n,[r.minX,r.maxY]),c=Do(n,[r.maxX,r.maxY]);a=Math.min(u[0],f[0],l[0],c[0]),o=Math.max(u[0],f[0],l[0],c[0]),i=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=a-v+g,w=o+v+g,x=i-v+m,E=s+v+m;a=Math.min(a,b),o=Math.max(o,w),i=Math.min(i,x),s=Math.max(s,E)}return{x:a,y:i,minX:a,minY:i,maxX:o,maxY:s,width:o-a,height:s-i}},e.prototype.clearCacheBBox=function(){this.set("bbox",null),this.set("canvasBBox",null)},e.prototype.isClipShape=function(){return this.get("isClipShape")},e.prototype.isInShape=function(r,n){return!1},e.prototype.isOnlyHitBox=function(){return!1},e.prototype.isHit=function(r,n){var a=this.get("startArrowShape"),i=this.get("endArrowShape"),o=[r,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)||a&&a.isHit(s,u)||i&&i.isHit(s,u)))},e}(aC),_C=new Map;function Ja(t,e){_C.set(t,e)}function SC(t){return _C.get(t)}function MC(t){var e=t.attr(),r=e.x,n=e.y,a=e.width,i=e.height;return{x:r,y:n,width:a,height:i}}function AC(t){var e=t.attr(),r=e.x,n=e.y,a=e.r;return{x:r-a,y:n-a,width:a*2,height:a*2}}function xn(t,e,r,n){var a=t-r,i=e-n;return Math.sqrt(a*a+i*i)}function uh(t,e){return Math.abs(t-e)<.001}function pu(t,e){var r=Ha(t),n=Ha(e),a=qa(t),i=qa(e);return{x:r,y:n,width:a-r,height:i-n}}function _d(t){return(t+Math.PI*2)%(Math.PI*2)}const cn={box:function(t,e,r,n){return pu([t,r],[e,n])},length:function(t,e,r,n){return xn(t,e,r,n)},pointAt:function(t,e,r,n,a){return{x:(1-a)*t+a*r,y:(1-a)*e+a*n}},pointDistance:function(t,e,r,n,a,i){var o=(r-t)*(a-t)+(n-e)*(i-e);if(o<0)return xn(t,e,a,i);var s=(r-t)*(r-t)+(n-e)*(n-e);return o>s?xn(r,n,a,i):this.pointToLine(t,e,r,n,a,i)},pointToLine:function(t,e,r,n,a,i){var o=[r-t,n-e];if(xy(o,[0,0]))return Math.sqrt((a-t)*(a-t)+(i-e)*(i-e));var s=[-o[1],o[0]];Wi(s,s);var u=[a-t,i-e];return Math.abs(wy(u,s))},tangentAngle:function(t,e,r,n){return Math.atan2(n-e,r-t)}};var fj=1e-4;function CC(t,e,r,n,a,i){var o,s=1/0,u=[r,n],f=20;i&&i>200&&(f=i/10);for(var l=1/f,c=l/10,h=0;h<=f;h++){var d=h*l,v=[a.apply(null,t.concat([d])),a.apply(null,e.concat([d]))],p=xn(u[0],u[1],v[0],v[1]);p<s&&(o=d,s=p)}if(o===0)return{x:t[0],y:e[0]};if(o===1){var g=t.length;return{x:t[g-1],y:e[g-1]}}s=1/0;for(var h=0;h<32&&!(c<fj);h++){var y=o-c,m=o+c,v=[a.apply(null,t.concat([y])),a.apply(null,e.concat([y]))],p=xn(u[0],u[1],v[0],v[1]);if(y>=0&&p<s)o=y,s=p;else{var b=[a.apply(null,t.concat([m])),a.apply(null,e.concat([m]))],w=xn(u[0],u[1],b[0],b[1]);m<=1&&w<s?(o=m,s=w):c*=.5}}return{x:a.apply(null,t.concat([o])),y:a.apply(null,e.concat([o]))}}function lj(t,e){for(var r=0,n=t.length,a=0;a<n;a++){var i=t[a],o=e[a],s=t[(a+1)%n],u=e[(a+1)%n];r+=xn(i,o,s,u)}return r/2}function Bi(t,e,r,n){var a=1-n;return a*a*t+2*n*a*e+n*n*r}function fx(t,e,r){var n=t+r-2*e;if(uh(n,0))return[.5];var a=(t-e)/n;return a<=1&&a>=0?[a]:[]}function lx(t,e,r,n){return 2*(1-n)*(e-t)+2*n*(r-e)}function TC(t,e,r,n,a,i,o){var s=Bi(t,r,a,o),u=Bi(e,n,i,o),f=cn.pointAt(t,e,r,n,o),l=cn.pointAt(r,n,a,i,o);return[[t,e,f.x,f.y,s,u],[s,u,l.x,l.y,a,i]]}function $0(t,e,r,n,a,i,o){if(o===0)return(xn(t,e,r,n)+xn(r,n,a,i)+xn(t,e,a,i))/2;var s=TC(t,e,r,n,a,i,.5),u=s[0],f=s[1];return u.push(o-1),f.push(o-1),$0.apply(null,u)+$0.apply(null,f)}const IC={box:function(t,e,r,n,a,i){var o=fx(t,r,a)[0],s=fx(e,n,i)[0],u=[t,a],f=[e,i];return o!==void 0&&u.push(Bi(t,r,a,o)),s!==void 0&&f.push(Bi(e,n,i,s)),pu(u,f)},length:function(t,e,r,n,a,i){return $0(t,e,r,n,a,i,3)},nearestPoint:function(t,e,r,n,a,i,o,s){return CC([t,r,a],[e,n,i],o,s,Bi)},pointDistance:function(t,e,r,n,a,i,o,s){var u=this.nearestPoint(t,e,r,n,a,i,o,s);return xn(u.x,u.y,o,s)},interpolationAt:Bi,pointAt:function(t,e,r,n,a,i,o){return{x:Bi(t,r,a,o),y:Bi(e,n,i,o)}},divide:function(t,e,r,n,a,i,o){return TC(t,e,r,n,a,i,o)},tangentAngle:function(t,e,r,n,a,i,o){var s=lx(t,r,a,o),u=lx(e,n,i,o),f=Math.atan2(u,s);return _d(f)}};function Gi(t,e,r,n,a){var i=1-a;return i*i*i*t+3*e*a*i*i+3*r*a*a*i+n*a*a*a}function cx(t,e,r,n,a){var i=1-a;return 3*(i*i*(e-t)+2*i*a*(r-e)+a*a*(n-r))}function pp(t,e,r,n){var a=-3*t+9*e-9*r+3*n,i=6*t-12*e+6*r,o=3*e-3*t,s=[],u,f,l;if(uh(a,0))uh(i,0)||(u=-o/i,u>=0&&u<=1&&s.push(u));else{var c=i*i-4*a*o;uh(c,0)?s.push(-i/(2*a)):c>0&&(l=Math.sqrt(c),u=(-i+l)/(2*a),f=(-i-l)/(2*a),u>=0&&u<=1&&s.push(u),f>=0&&f<=1&&s.push(f))}return s}function kC(t,e,r,n,a,i,o,s,u){var f=Gi(t,r,a,o,u),l=Gi(e,n,i,s,u),c=cn.pointAt(t,e,r,n,u),h=cn.pointAt(r,n,a,i,u),d=cn.pointAt(a,i,o,s,u),v=cn.pointAt(c.x,c.y,h.x,h.y,u),p=cn.pointAt(h.x,h.y,d.x,d.y,u);return[[t,e,c.x,c.y,v.x,v.y,f,l],[f,l,p.x,p.y,d.x,d.y,o,s]]}function X0(t,e,r,n,a,i,o,s,u){if(u===0)return lj([t,r,a,o],[e,n,i,s]);var f=kC(t,e,r,n,a,i,o,s,.5),l=f[0],c=f[1];return l.push(u-1),c.push(u-1),X0.apply(null,l)+X0.apply(null,c)}const xf={extrema:pp,box:function(t,e,r,n,a,i,o,s){for(var u=[t,o],f=[e,s],l=pp(t,r,a,o),c=pp(e,n,i,s),h=0;h<l.length;h++)u.push(Gi(t,r,a,o,l[h]));for(var h=0;h<c.length;h++)f.push(Gi(e,n,i,s,c[h]));return pu(u,f)},length:function(t,e,r,n,a,i,o,s){return X0(t,e,r,n,a,i,o,s,3)},nearestPoint:function(t,e,r,n,a,i,o,s,u,f,l){return CC([t,r,a,o],[e,n,i,s],u,f,Gi,l)},pointDistance:function(t,e,r,n,a,i,o,s,u,f,l){var c=this.nearestPoint(t,e,r,n,a,i,o,s,u,f,l);return xn(c.x,c.y,u,f)},interpolationAt:Gi,pointAt:function(t,e,r,n,a,i,o,s,u){return{x:Gi(t,r,a,o,u),y:Gi(e,n,i,s,u)}},divide:function(t,e,r,n,a,i,o,s,u){return kC(t,e,r,n,a,i,o,s,u)},tangentAngle:function(t,e,r,n,a,i,o,s,u){var f=cx(t,r,a,o,u),l=cx(e,n,i,s,u);return _d(Math.atan2(l,f))}};function hx(t,e){var r=Math.abs(t);return e>0?r:r*-1}const cj={box:function(t,e,r,n){return{x:t-r,y:e-n,width:r*2,height:n*2}},length:function(t,e,r,n){return Math.PI*(3*(r+n)-Math.sqrt((3*r+n)*(r+3*n)))},nearestPoint:function(t,e,r,n,a,i){var o=r,s=n;if(o===0||s===0)return{x:t,y:e};for(var u=a-t,f=i-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,w=p-m,x=g-b,E=l-m,_=c-b,S=Math.hypot(x,w),A=Math.hypot(_,E),M=S*Math.asin((w*_-x*E)/(S*A)),C=M/Math.sqrt(h+d-p*p-g*g);v+=C,v=Math.min(Math.PI/2,Math.max(0,v))}return{x:t+hx(p,u),y:e+hx(g,f)}},pointDistance:function(t,e,r,n,a,i){var o=this.nearestPoint(t,e,r,n,a,i);return xn(o.x,o.y,a,i)},pointAt:function(t,e,r,n,a){var i=2*Math.PI*a;return{x:t+r*Math.cos(i),y:e+n*Math.sin(i)}},tangentAngle:function(t,e,r,n,a){var i=2*Math.PI*a,o=Math.atan2(n*Math.cos(i),-r*Math.sin(i));return _d(o)}};function hj(t,e,r,n,a,i,o,s){return-1*r*Math.cos(a)*Math.sin(s)-n*Math.sin(a)*Math.cos(s)}function dj(t,e,r,n,a,i,o,s){return-1*r*Math.sin(a)*Math.sin(s)+n*Math.cos(a)*Math.cos(s)}function vj(t,e,r){return Math.atan(-e/t*Math.tan(r))}function pj(t,e,r){return Math.atan(e/(t*Math.tan(r)))}function dx(t,e,r,n,a,i){return r*Math.cos(a)*Math.cos(i)-n*Math.sin(a)*Math.sin(i)+t}function vx(t,e,r,n,a,i){return r*Math.sin(a)*Math.cos(i)+n*Math.cos(a)*Math.sin(i)+e}function gj(t,e,r,n){var a=Math.atan2(n*t,r*e);return(a+Math.PI*2)%(Math.PI*2)}function px(t,e,r){return{x:t*Math.cos(r),y:e*Math.sin(r)}}function gx(t,e,r){var n=Math.cos(r),a=Math.sin(r);return[t*n-e*a,t*a+e*n]}const yj={box:function(t,e,r,n,a,i,o){for(var s=vj(r,n,a),u=1/0,f=-1/0,l=[i,o],c=-Math.PI*2;c<=Math.PI*2;c+=Math.PI){var h=s+c;i<o?i<h&&h<o&&l.push(h):o<h&&h<i&&l.push(h)}for(var c=0;c<l.length;c++){var d=dx(t,e,r,n,a,l[c]);d<u&&(u=d),d>f&&(f=d)}for(var v=pj(r,n,a),p=1/0,g=-1/0,y=[i,o],c=-Math.PI*2;c<=Math.PI*2;c+=Math.PI){var m=v+c;i<o?i<m&&m<o&&y.push(m):o<m&&m<i&&y.push(m)}for(var c=0;c<y.length;c++){var b=vx(t,e,r,n,a,y[c]);b<p&&(p=b),b>g&&(g=b)}return{x:u,y:p,width:f-u,height:g-p}},length:function(t,e,r,n,a,i,o){},nearestPoint:function(t,e,r,n,a,i,o,s,u){var f=gx(s-t,u-e,-a),l=f[0],c=f[1],h=cj.nearestPoint(0,0,r,n,l,c),d=gj(r,n,h.x,h.y);d<i?h=px(r,n,i):d>o&&(h=px(r,n,o));var v=gx(h.x,h.y,a);return{x:v[0]+t,y:v[1]+e}},pointDistance:function(t,e,r,n,a,i,o,s,u){var f=this.nearestPoint(t,e,r,n,s,u);return xn(f.x,f.y,s,u)},pointAt:function(t,e,r,n,a,i,o,s){var u=(o-i)*s+i;return{x:dx(t,e,r,n,a,u),y:vx(t,e,r,n,a,u)}},tangentAngle:function(t,e,r,n,a,i,o,s){var u=(o-i)*s+i,f=hj(t,e,r,n,a,i,o,u),l=dj(t,e,r,n,a,i,o,u);return _d(Math.atan2(l,f))}};function NC(t){for(var e=0,r=[],n=0;n<t.length-1;n++){var a=t[n],i=t[n+1],o=xn(a[0],a[1],i[0],i[1]),s={from:a,to:i,length:o};r.push(s),e+=o}return{segments:r,totalLength:e}}function mj(t){if(t.length<2)return 0;for(var e=0,r=0;r<t.length-1;r++){var n=t[r],a=t[r+1];e+=xn(n[0],n[1],a[0],a[1])}return e}function bj(t,e){if(e>1||e<0||t.length<2)return null;var r=NC(t),n=r.segments,a=r.totalLength;if(a===0)return{x:t[0][0],y:t[0][1]};for(var i=0,o=null,s=0;s<n.length;s++){var u=n[s],f=u.from,l=u.to,c=u.length/a;if(e>=i&&e<=i+c){var h=(e-i)/c;o=cn.pointAt(f[0],f[1],l[0],l[1],h);break}i+=c}return o}function wj(t,e){if(e>1||e<0||t.length<2)return 0;for(var r=NC(t),n=r.segments,a=r.totalLength,i=0,o=0,s=0;s<n.length;s++){var u=n[s],f=u.from,l=u.to,c=u.length/a;if(e>=i&&e<=i+c){o=Math.atan2(l[1]-f[1],l[0]-f[0]);break}i+=c}return o}function xj(t,e,r){for(var n=1/0,a=0;a<t.length-1;a++){var i=t[a],o=t[a+1],s=cn.pointDistance(i[0],i[1],o[0],o[1],e,r);s<n&&(n=s)}return n}const OC={box:function(t){for(var e=[],r=[],n=0;n<t.length;n++){var a=t[n];e.push(a[0]),r.push(a[1])}return pu(e,r)},length:function(t){return mj(t)},pointAt:function(t,e){return bj(t,e)},pointDistance:function(t,e,r){return xj(t,e,r)},tangentAngle:function(t,e){return wj(t,e)}};function yx(t,e){return!t||!e?t||e:{minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}}function zy(t,e){var r=t.get("startArrowShape"),n=t.get("endArrowShape"),a=null,i=null;return r&&(a=r.getCanvasBBox(),e=yx(e,a)),n&&(i=n.getCanvasBBox(),e=yx(e,i)),e}function Ej(t){for(var e=t.attr(),r=e.points,n=[],a=[],i=0;i<r.length;i++){var o=r[i];n.push(o[0]),a.push(o[1])}var s=pu(n,a),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=zy(t,h),{x:h.minX,y:h.minY,width:h.maxX-h.minX,height:h.maxY-h.minY}}function _j(t){for(var e=t.attr(),r=e.points,n=[],a=[],i=0;i<r.length;i++){var o=r[i];n.push(o[0]),a.push(o[1])}return pu(n,a)}var gp=null;function LC(){if(!gp){var t=document.createElement("canvas");t.width=1,t.height=1,gp=t.getContext("2d")}return gp}function DC(t,e,r){var n=1;if(Ye(t)&&(n=t.split(`
|
||
`).length),n>1){var a=Sj(e,r);return e*n+a*(n-1)}return e}function Sj(t,e){return e?e-t:t*.14}function Mj(t,e){var r=LC(),n=0;if(Zt(t)||t==="")return n;if(r.save(),r.font=e,Ye(t)&&t.includes(`
|
||
`)){var a=t.split(`
|
||
`);_e(a,function(i){var o=r.measureText(i).width;n<o&&(n=o)})}else n=r.measureText(t).width;return r.restore(),n}function PC(t){var e=t.fontSize,r=t.fontFamily,n=t.fontWeight,a=t.fontStyle,i=t.fontVariant;return[a,i,n,e+"px",r].join(" ").trim()}function Aj(t){var e=t.attr(),r=e.x,n=e.y,a=e.text,i=e.fontSize,o=e.lineHeight,s=e.font;s||(s=PC(e));var u=Mj(a,s),f;if(!u)f={x:r,y:n,width:0,height:0};else{var l=e.textAlign,c=e.textBaseline,h=DC(a,i,o),d={x:r,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 Cj=/[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/ig,Tj=/[^\s\,]+/ig;function Ij(t){var e=t||[];if(bt(e))return e;if(Ye(e))return e=e.match(Cj),_e(e,function(r,n){if(r=r.match(Tj),r[0].length>1){var a=r[0].charAt(0);r.splice(1,0,r[0].substr(1)),r[0]=a}_e(r,function(i,o){isNaN(i)||(r[o]=+i)}),e[n]=r}),e}function kj(t,e,r,n){var a=[],i=!!n,o,s,u,f,l,c,h;if(i){u=n[0],f=n[1];for(var d=0,v=t.length;d<v;d+=1){var p=t[d];u=Pi([0,0],u,p),f=Ri([0,0],f,p)}}for(var d=0,g=t.length;d<g;d+=1){var p=t[d];if(d===0&&!r)h=p;else if(d===g-1&&!r)c=p,a.push(h),a.push(c);else{var y=[d?d-1:g-1,d-1][r?0:1];o=t[y],s=t[r?(d+1)%g:d+1];var m=[0,0];m=rh(m,s,o),m=wn(m,m,e);var b=Ih(p,o),w=Ih(p,s),x=b+w;x!==0&&(b/=x,w/=x);var E=wn([0,0],m,-b),_=wn([0,0],m,w);c=fn([0,0],p,E),l=fn([0,0],p,_),l=Pi([0,0],l,Ri([0,0],s,p)),l=Ri([0,0],l,Pi([0,0],s,p)),E=rh([0,0],l,p),E=wn([0,0],E,-b/w),c=fn([0,0],p,E),c=Pi([0,0],c,Ri([0,0],o,p)),c=Ri([0,0],c,Pi([0,0],o,p)),_=rh([0,0],p,c),_=wn([0,0],_,w/b),l=fn([0,0],p,_),i&&(c=Ri([0,0],c,u),c=Pi([0,0],c,f),l=Ri([0,0],l,u),l=Pi([0,0],l,f)),a.push(h),a.push(c),h=l}}return r&&a.push(a.shift()),a}function Nj(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=[[0,0],[1,1]]);for(var n=!!e,a=[],i=0,o=t.length;i<o;i+=2)a.push([t[i],t[i+1]]);for(var s=kj(a,.4,n,r),u=a.length,f=[],l,c,h,i=0;i<u-1;i+=1)l=s[i*2],c=s[i*2+1],h=a[i+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=a[0],f.push(["C",l[0],l[1],c[0],c[1],h[0],h[1]])),f}var Ef=`
|
||
\v\f\r \u2028\u2029`,Oj=new RegExp("([a-z])["+Ef+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+Ef+"]*,?["+Ef+"]*)+)","ig"),Lj=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+Ef+"]*,?["+Ef+"]*","ig");function W0(t){if(!t)return null;if(bt(t))return t;var e={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},r=[];return String(t).replace(Oj,function(n,a,i){var o=[],s=a.toLowerCase();if(i.replace(Lj,function(u,f){f&&o.push(+f)}),s==="m"&&o.length>2&&(r.push([a].concat(o.splice(0,2))),s="l",a=a==="m"?"l":"L"),s==="o"&&o.length===1&&r.push([a,o[0]]),s==="r")r.push([a].concat(o));else for(;o.length>=e[s]&&(r.push([a].concat(o.splice(0,e[s]))),!!e[s]););return""}),r}var Dj=/[a-z]/;function mx(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}function RC(t){var e=W0(t);if(!e||!e.length)return[["M",0,0]];for(var r=!1,n=0;n<e.length;n++){var a=e[n][0];if(Dj.test(a)||["V","H","T","S"].indexOf(a)>=0){r=!0;break}}if(!r)return e;var i=[],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++,i[0]=["M",o,s]);for(var n=l,h=e.length;n<h;n++){var d=e[n],v=i[n-1],p=[],a=d[0],g=a.toUpperCase();if(a!==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=mx([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 w=v.length,x=mx([v[w-4],v[w-3]],[v[w-2],v[w-1]]);p=["C",x[0],x[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]}i.push(p)}return i}function dc(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function V0(t,e){return dc(t)*dc(e)?(t[0]*e[0]+t[1]*e[1])/(dc(t)*dc(e)):1}function bx(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(V0(t,e))}function Y0(t,e){return t[0]===e[0]&&t[1]===e[1]}function Pj(t,e){var r=e[1],n=e[2],a=gd(yd(e[3]),Math.PI*2),i=e[4],o=e[5],s=t[0],u=t[1],f=e[6],l=e[7],c=Math.cos(a)*(s-f)/2+Math.sin(a)*(u-l)/2,h=-1*Math.sin(a)*(s-f)/2+Math.cos(a)*(u-l)/2,d=c*c/(r*r)+h*h/(n*n);d>1&&(r*=Math.sqrt(d),n*=Math.sqrt(d));var v=r*r*(h*h)+n*n*(c*c),p=v?Math.sqrt((r*r*(n*n)-v)/v):1;i===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*r*h/n:0,y=r?p*-n*c/r:0,m=(s+f)/2+Math.cos(a)*g-Math.sin(a)*y,b=(u+l)/2+Math.sin(a)*g+Math.cos(a)*y,w=[(c-g)/r,(h-y)/n],x=[(-1*c-g)/r,(-1*h-y)/n],E=bx([1,0],w),_=bx(w,x);return V0(w,x)<=-1&&(_=Math.PI),V0(w,x)>=1&&(_=0),o===0&&_>0&&(_=_-2*Math.PI),o===1&&_<0&&(_=_+2*Math.PI),{cx:m,cy:b,rx:Y0(t,[f,l])?0:r,ry:Y0(t,[f,l])?0:n,startAngle:E,endAngle:E+_,xRotation:a,arcFlag:i,sweepFlag:o}}function wx(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}function FC(t){t=Ij(t);for(var e=[],r=null,n=null,a=null,i=0,o=t.length,s=0;s<o;s++){var u=t[s];n=t[s+1];var f=u[0],l={command:f,prePoint:r,params:u,startTangent:null,endTangent:null};switch(f){case"M":a=[u[1],u[2]],i=s;break;case"A":var c=Pj(r,u);l.arcParams=c;break}if(f==="Z")r=a,n=t[i+1];else{var h=u.length;r=[u[h-2],u[h-1]]}n&&n[0]==="Z"&&(n=t[i],e[i]&&(e[i].prePoint=r)),l.currentPoint=r,e[i]&&Y0(r,e[i].currentPoint)&&(e[i].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]-r[0],v[1]-r[1]],l.endTangent=[r[0]-v[0],r[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=[r[0]-p[0],r[1]-p[1]]}else if(f==="T"){var g=e[s-1],p=wx(g.currentPoint,v);g.command==="Q"?(l.command="Q",l.startTangent=[v[0]-p[0],v[1]-p[1]],l.endTangent=[r[0]-p[0],r[1]-p[1]]):(l.command="TL",l.startTangent=[v[0]-r[0],v[1]-r[1]],l.endTangent=[r[0]-v[0],r[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=[r[0]-m[0],r[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=wx(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=[r[0]-m[0],r[1]-m[1]]):(l.command="SQ",l.startTangent=[v[0]-m[0],v[1]-m[1]],l.endTangent=[r[0]-m[0],r[1]-m[1]])}else if(f==="A"){var b=.001,w=l.arcParams||{},x=w.cx,E=x===void 0?0:x,_=w.cy,S=_===void 0?0:_,A=w.rx,M=A===void 0?0:A,C=w.ry,I=C===void 0?0:C,k=w.sweepFlag,O=k===void 0?0:k,B=w.startAngle,L=B===void 0?0:B,z=w.endAngle,X=z===void 0?0:z;O===0&&(b*=-1);var R=M*Math.cos(L-b)+E,V=I*Math.sin(L-b)+S;l.startTangent=[R-a[0],V-a[1]];var he=M*Math.cos(L+X+b)+E,ce=I*Math.sin(L+X-b)+S;l.endTangent=[v[0]-he,v[1]-ce]}e.push(l)}return e}function Rj(t,e){for(var r=[],n=[],a=[],i=0;i<t.length;i++){var o=t[i],s=o.currentPoint,u=o.params,f=o.prePoint,l=void 0;switch(o.command){case"Q":l=IC.box(f[0],f[1],u[1],u[2],u[3],u[4]);break;case"C":l=xf.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=yj.box(c.cx,c.cy,c.rx,c.ry,c.xRotation,c.startAngle,c.endAngle);break;default:r.push(s[0]),n.push(s[1]);break}l&&(o.box=l,r.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&&a.push(o)}r=r.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(r),d=Ha(n),v=qa(r),p=qa(n);if(a.length===0)return{x:h,y:d,width:v-h,height:p-d};for(var i=0;i<a.length;i++){var o=a[i],s=o.currentPoint,g=void 0;s[0]===h?(g=vc(o,e),h=h-g.xExtra):s[0]===v&&(g=vc(o,e),v=v+g.xExtra),s[1]===d?(g=vc(o,e),d=d-g.yExtra):s[1]===p&&(g=vc(o,e),p=p+g.yExtra)}return{x:h,y:d,width:v-h,height:p-d}}function vc(t,e){var r=t.prePoint,n=t.currentPoint,a=t.nextPoint,i=Math.pow(n[0]-r[0],2)+Math.pow(n[1]-r[1],2),o=Math.pow(n[0]-a[0],2)+Math.pow(n[1]-a[1],2),s=Math.pow(r[0]-a[0],2)+Math.pow(r[1]-a[1],2),u=Math.acos((i+o-s)/(2*Math.sqrt(i)*Math.sqrt(o)));if(!u||Math.sin(u)===0||US(u,0))return{xExtra:0,yExtra:0};var f=Math.abs(Math.atan2(a[1]-n[1],a[0]-n[0])),l=Math.abs(Math.atan2(a[0]-n[0],a[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 Fj(t){var e=t.attr(),r=e.path,n=e.stroke,a=n?e.lineWidth:0,i=t.get("segments")||FC(r),o=Rj(i,a),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=zy(t,c),{x:c.minX,y:c.minY,width:c.maxX-c.minX,height:c.maxY-c.minY}}function Bj(t){var e=t.attr(),r=e.x1,n=e.y1,a=e.x2,i=e.y2,o=Math.min(r,a),s=Math.max(r,a),u=Math.min(n,i),f=Math.max(n,i),l={minX:o,maxX:s,minY:u,maxY:f};return l=zy(t,l),{x:l.minX,y:l.minY,width:l.maxX-l.minX,height:l.maxY-l.minY}}function Gj(t){var e=t.attr(),r=e.x,n=e.y,a=e.rx,i=e.ry;return{x:r-a,y:n-i,width:a*2,height:i*2}}Ja("rect",MC);Ja("image",MC);Ja("circle",AC);Ja("marker",AC);Ja("polyline",Ej);Ja("polygon",_j);Ja("text",Aj);Ja("path",Fj);Ja("line",Bj);Ja("ellipse",Gj);var zj=function(t){jt(e,t);function e(r,n){var a=t.call(this,r,n)||this;return a.item=n.item,a.canvasX=n.canvasX,a.canvasY=n.canvasY,a.wheelDelta=n.wheelDelta,a.detail=n.detail,a}return e}(JA),q0=function(e){return"".concat(e,"-").concat(Math.random()).concat(Date.now())},jy=function(e){if(bt(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(Ot(e))return[e,e,e,e];if(Ye(e)){var r=parseInt(e,10);return[r,r,r,r]}return[0,0,0,0]},jj=function(e){var r=new zj(e.type,e);return r.clientX=e.clientX,r.clientY=e.clientY,r.x=e.x,r.y=e.y,r.target=e.target,r.currentTarget=e.currentTarget,r.bubbles=!0,r.item=e.item,r},Uj=function(e){if(!e)return!1;for(var r=9,n=[1,0,0,0,1,0,0,0,1],a=0;a<r;a++)if(e[a]!==n[a])return!0;return!1},Fa=function(e){return Number.isNaN(Number(e))},BC=function(e){for(var r=1/0,n=-1/0,a=1/0,i=-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<r&&(r=f),l<a&&(a=l),c>n&&(n=c),h>i&&(i=h)}var d=Math.floor(r),v=Math.floor(a),p=Math.ceil(n)-Math.floor(r),g=Math.ceil(i)-Math.floor(a);return{x:d,y:v,width:p,height:g,minX:r,minY:a,maxX:n,maxY:i}},$j=function(e,r,n,a,i){r===void 0&&(r=15),n===void 0&&(n="quadratic"),a===void 0&&(a=void 0),i===void 0&&(i=void 0);for(var o=e.length,s=r*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,w=m.target;l[y]||(v===w&&p===b?(f[g].push(m),l[y]=!0,c["".concat(b,"|").concat(w,"|").concat(f[g].length-1)]=!0):v===b&&p===w&&(f[g].push(m),l[y]=!0))}}}for(var x in f)for(var E=f[x],_=E.length,S=0;S<_;S++){var A=E[S];if(A.source===A.target){i&&(A.type=i),A.loopCfg={position:u[S%8],dist:Math.floor(S/8)*20+50};continue}if(_===1&&a&&A.source!==A.target){A.type=a;continue}A.type=n;var M=(S%2===0?1:-1)*(c["".concat(A.source,"|").concat(A.target,"|").concat(S)]?-1:1);_%2===1?A.curveOffset=M*Math.ceil(S/2)*s:A.curveOffset=M*(Math.floor(S/2)*s+r)}return e};const Xj=Object.freeze(Object.defineProperty({__proto__:null,calculationItemsBBox:BC,cloneEvent:jj,formatPadding:jy,isNaN:Fa,isViewportChanged:Uj,processParallelEdges:$j,uniqueId:q0},Symbol.toStringTag,{value:"Module"}));var to={};const Wj=Ka(vG);Object.defineProperty(to,"__esModule",{value:!0});var qi=Wj;function GC(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return qi.mat3.fromTranslation(n,r),qi.mat3.multiply(t,n,e)}to.leftTranslate=GC;function zC(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return qi.mat3.fromRotation(n,r),qi.mat3.multiply(t,n,e)}to.leftRotate=zC;function jC(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return qi.mat3.fromScaling(n,r),qi.mat3.multiply(t,n,e)}to.leftScale=jC;function Vj(t,e,r){return qi.mat3.multiply(t,r,e)}function Yj(t,e){for(var r=t?[].concat(t):[1,0,0,0,1,0,0,0,1],n=0,a=e.length;n<a;n++){var i=e[n];switch(i[0]){case"t":GC(r,r,[i[1],i[2]]);break;case"s":jC(r,r,[i[1],i[2]]);break;case"r":zC(r,r,i[1]);break;case"m":Vj(r,r,i[1]);break}}return r}var xx=to.transform=Yj;function UC(t,e){return t[0]*e[1]-e[0]*t[1]}to.direction=UC;function qj(t,e,r){var n=qi.vec2.angle(t,e),a=UC(t,e)>=0;return r?a?Math.PI*2-n:n:a?n:Math.PI*2-n}to.angleTo=qj;function Hj(t,e,r){return r?(t[0]=e[1],t[1]=-1*e[0]):(t[0]=-1*e[1],t[1]=e[0]),t}to.vertical=Hj;var Zj=function(){function t(e){this.destroyed=!1,this.graph=e,this.destroyed=!1}return t.prototype.getViewCenter=function(){var e=this.getFormatPadding(),r=this.graph,n=this.graph.get("width"),a=r.get("height");return{x:(n-e[1]-e[3])/2+e[3],y:(a-e[0]-e[2])/2+e[0]}},t.prototype.fitCenter=function(e,r){var n=this.graph,a=n.get("group"),i,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(w){var x=w.getModel(),E=x.x,_=x.y;s>E&&(s=E),u>_&&(u=_),f<E&&(f=E),l<_&&(l=_)});var c=a.getMatrix()||[1,0,0,0,1,0,0,0,1],h=Us({x:s,y:u},c),d=h.x,v=h.y,p=Us({x:f,y:l},c),g=p.x,y=p.y;i={minX:d,maxX:g,minY:v,maxY:y,width:g-d,height:y-v,x:d,y:v}}else i=a.getCanvasBBox();if(!(i.width===0||i.height===0)){var m=this.getViewCenter(),b={x:i.x+i.width/2,y:i.y+i.height/2};n.translate(m.x-b.x,m.y-b.y,e,r)}},t.prototype.animatedFitView=function(e,r,n,a,i,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=a.x+i.x-o.x-a.minX,h=a.y+i.y-o.y-a.minY;if(!(Fa(c)||Fa(h))){var d=xx(l,[["t",c,h]]);if(!u){var v=Df({animateCfg:n,callback:function(){f.emit("viewportchange",{action:"translate",matrix:d})}});e.animate(function(w){return{matrix:M0(r,d,w)}},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=xx(d,[["t",-i.x,-i.y],["s",y,y],["t",i.x,i.y]]),b=Df({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(r),e.animate(function(w){return{matrix:M0(r,m,w)}},b)}},t.prototype.fitView=function(e,r){var n=this.graph,a=this.getFormatPadding(),i=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(),S=_.x,A=_.y;c>S&&(c=S),h>A&&(h=A),d<S&&(d=S),v<A&&(v=A)}),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=(i-a[1]-a[3])/f.width,m=(o-a[0]-a[2])/f.height,b=y;if(y>m&&(b=m),e)this.animatedFitView(s,u,r,f,p,g,b,!0);else{var w=p.x-g.x,x=p.y-g.y;if(Fa(w)||Fa(x))return;n.translate(w,x),n.zoom(b,p)||console.warn("zoom failed, ratio out of range, ratio: %f",b)}}},t.prototype.fitViewByRules=function(e,r,n){var a=e.onlyOutOfViewPort,i=a===void 0?!1:a,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,w=-1/0,x=-1/0;y.forEach(function(O){var B=O.getModel(),L=B.x,z=B.y;m>L&&(m=L),b>z&&(b=z),w<L&&(w=L),x<z&&(x=z)}),g={minX:m,maxX:w,minY:b,maxY:x,width:w-m,height:x-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},S=(h-c[1]-c[3])/g.width,A=(d-c[0]-c[2])/g.height,M;if(s==="x"?M=S:s==="y"?M=A:M=f==="max"?Math.max(S,A):Math.min(S,A),i&&(M=M<1?M:1),r)this.animatedFitView(v,p,n,g,E,_,M,!0);else{var C=l.getZoom(),I=C*M,k=l.get("minZoom");I<k&&(I=k,console.warn("fitview failed, ratio out of range, ratio: %f",M,"graph minzoom has been used instead")),l.translate(E.x-_.x,E.y-_.y),l.zoomTo(I,E)}}},t.prototype.getFormatPadding=function(){var e=this.graph.get("fitViewPadding");return jy(e)},t.prototype.focusPoint=function(e,r,n){var a=this,i=this.getViewCenter(),o=this.getPointByCanvas(i.x,i.y),s=this.graph.get("group").getMatrix();if(s||(s=[1,0,0,0,1,0,0,0,1]),r){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,a.graph.translate(h-l,d-c),l=h,c=d},P({},n))}else this.graph.translate((o.x-e.x)*s[0],(o.y-e.y)*s[4])},t.prototype.getPointByCanvas=function(e,r){var n=this.graph.get("group").getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var a=PA({x:e,y:r},n);return a},t.prototype.getPointByClient=function(e,r){var n=this.graph.get("canvas"),a=n.getPointByClient(e,r);return this.getPointByCanvas(a.x,a.y)},t.prototype.getClientByPoint=function(e,r){var n=this.graph.get("canvas"),a=this.getCanvasByPoint(e,r),i=n.getClientByPoint(a.x,a.y);return{x:i.x,y:i.y}},t.prototype.getCanvasByPoint=function(e,r){var n=this.graph.get("group").getMatrix();return n||(n=[1,0,0,0,1,0,0,0,1]),Us({x:e,y:r},n)},t.prototype.focus=function(e,r,n){if(Ye(e)&&(e=this.graph.findById(e)),e){var a=0,i=0;if(e.getType&&e.getType()==="edge"){var o=e.getSource().get("group").getMatrix(),s=e.getTarget().get("group").getMatrix();o&&s?(a=(o[6]+s[6])/2,i=(o[7]+s[7])/2):(o||s)&&(a=o?o[6]:s[6],i=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]),a=f[6],i=f[7]}this.focusPoint({x:a,y:i},r,n)}},t.prototype.focusItems=function(e,r,n,a){if(e.length){var i=this.graph,o=this.getFormatPadding(),s=i.get("width"),u=i.get("height"),f=i.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,w=m;m>b&&(w=b),n?this.animatedFitView(f,l,a,c,g,y,w,r):(i.translate(g.x-y.x,g.y-y.y),r&&!i.zoom(w,g)&&console.warn("zoom failed, ratio out of range, ratio: %f",w))}}},t.prototype.changeSize=function(e,r){var n=this.graph;if(!Ot(e)||!Ot(r))throw Error("invalid canvas width & height, please make sure width & height type is number");n.set({width:e,height:r});var a=n.get("canvas");a.changeSize(e,r);var i=n.get("plugins");i.forEach(function(o){o.get("gridContainer")&&o.positionInit()})},t.prototype.destroy=function(){this.graph=null,this.destroyed=!1},t}();function H0(t){"@babel/helpers - typeof";return H0=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},H0(t)}function Ex(t){if(typeof t!="string")return t;var e=function(_){if(typeof _!="string")return _;try{return JSON.parse(_.trim())}catch{return _.trim()}},r=e(t);if(typeof r!="string")return r;for(var n=function(_){return _[_.length-1]},a=t.trim(),i=[],o=[],s=function(){for(var _=[],S=0;S<arguments.length;S++)_[S]=arguments[S];return _.some(function(A){return n(o)===A})},u=function(){return n(i)},f=null,l=0,c="";l<a.length;){var h=a[l],d=s('"',"'");if(!d&&!h.trim()){l+=1;continue}var v=a[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 w={},x=1;x<m.length;x+=2)w[m[x-1]]=m[x];i.pop(),i.length&&n(i).push(w),o.pop(),f=w}else h==="]"&&g?(c&&(m.push(e(c)),c=""),i.pop(),i.length&&n(i).push(m),o.pop(),f=m):h==="{"?(i.push([]),o.push("}")):h==="["?(i.push([]),o.push("]")):h==='"'?o.push('"'):h==="'"?o.push("'"):c+=h;l+=1}return f||c}var Kj=function(e){return e.split("-").reduce(function(r,n){return r+n.charAt(0).toUpperCase()+n.slice(1)})},Qj=function(e){return function(r){for(var n=e.length,a=[],i=0,o="";i<n;)if(e[i]==="{"&&e[i+1]==="{")a.push(o),o="",i+=2;else if(e[i]==="}"&&e[i+1]==="}"){if(a.length){var s=a.pop();o=HS(r,o,s.endsWith("=")?'"{'.concat(o,'}"'):o),a.push(s+o)}i+=2,o=""}else o+=e[i],i+=1;return a.push(o),a.map(function(u,f){return a[f-1]&&a[f-1].endsWith("=")?'"{'.concat(u,'}"'):u}).join("")}};function $C(t,e){var r={},n=t.getAttributeNames&&t.getAttributeNames()||[],a=t.children&&Array.from(t.children).map(function(s){return $C(s,e)}),i={},o=t.tagName?t.tagName.toLowerCase():"group";return o==="text"&&(r.text=t.innerText),i.type=o,o==="img"&&(i.type="image"),Array.from(n).forEach(function(s){var u=Kj(s),f=t.getAttribute(s);try{if(u==="style"||u==="attrs"){var l=Ex(f);r=P(P({},r),l)}else i[u]=Ex(f)}catch(c){if(u==="style")throw c;i[u]=f}}),i.attrs=r,e&&e.style&&i.name&&H0(e.style[i.name])==="object"&&(i.attrs=P(P({},i.attrs),e.style[i.name])),e&&e.style&&i.keyshape&&(i.attrs=P(P({},i.attrs),e.style)),a.length&&(i.children=a),i}function Jj(t,e,r){var n=t.attrs,a=n===void 0?{}:n,i={x:e.x||0,y:e.y||0,width:r.width||0,height:r.height||0},o,s;switch(t.type){case"maker":case"circle":a.r&&(s=2*a.r,o=2*a.r);break;case"text":a.text&&(s=VA(a.text,a.fontSize||12)[0],o=16,i.y+=o,i.height=o,i.width=s,t.attrs=P({fontSize:12,fill:"#000"},a));break;default:a.width&&(s=a.width),a.height&&(o=a.height)}return o>=0&&(i.height=o),s>=0&&(i.width=s),a.marginTop&&(i.y+=a.marginTop),a.marginLeft&&(i.x+=a.marginLeft),i}function XC(t,e){var r;e===void 0&&(e={x:0,y:0});var n=P({x:0,y:0,width:0,height:0},e);if(!((r=t.children)===null||r===void 0)&&r.length){var a=t.attrs,i=a===void 0?{}:a,o=i.marginTop,s=P({},e);o&&(s.y+=o);for(var u=0;u<t.children.length;u++){t.children[u].attrs.key="".concat(i.key||"root"," -").concat(u," ");var f=XC(t.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 t.bbox=Jj(t,e,n),t.attrs=P(P({},t.attrs),t.bbox),t}function WC(t,e){var r,n,a,i,o=(t||{}).type,s=((e==null?void 0:e.attrs)||{}).key;if(s&&t&&(t.attrs.key=s),!t&&e)return{action:"delete",val:e,type:o,key:s};if(t&&!e)return{action:"add",val:t,type:o};if(!t&&!e)return{action:"same",type:o};var u=[];if(((r=t.children)===null||r===void 0?void 0:r.length)>0||((n=e.children)===null||n===void 0?void 0:n.length)>0)for(var f=Math.max((a=t.children)===null||a===void 0?void 0:a.length,(i=e.children)===null||i===void 0?void 0:i.length),l=e.children||[],c=t.children||[],h=0;h<f;h+=1)u.push(WC(c[h],l[h]));var d=Object.keys(e.attrs),v=Object.keys(t.attrs);return e.type!==t.type?{action:"restructure",nowTarget:t,formerTarget:e,key:s,children:u}:d.filter(function(p){return p!=="children"}).some(function(p){return t.attrs[p]!==e.attrs[p]||!v.includes(p)})?{action:"change",val:t,children:u,type:o,key:s}:{action:"same",children:u,type:o,key:s}}function _x(t){var e={},r=function(a){var i=typeof t=="function"?t(a):t,o=Qj(i)(a),s=document.createElement("div");s.innerHTML=o;var u=s.children[0],f=XC($C(u,a));return s.remove(),f};return{draw:function(a,i){var o=r(a),s=i,u=function f(l){var c=l.attrs,h=c===void 0?{}:c,d=l.bbox,v=l.type,p=l.children,g=Kr(l,["attrs","bbox","type","children"]);if(l.type!=="group"){var y=i.addShape(l.type,P({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[a.id]=[o],s},update:function(a,i){e[a.id]||(e[a.id]=[]);var o=i.getContainer(),s=o.get("children"),u=r(a),f=e[a.id].pop(),l=WC(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?i.getOriginStyle():{};y.attr(P(P({},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[a.id].push(u)},getAnchorPoints:function(){return[[0,.5],[1,.5],[.5,1],[.5,0]]}}}var yp={};function Sx(t){return yp[t]||(yp[t]=Zs(t)),yp[t]}var e8={defaultShapeType:"defaultType",className:null,getShape:function(e){var r=this,n=r[e]||r[r.defaultShapeType]||r["simple-circle"];return n},draw:function(e,r,n){var a=this.getShape(e);n.shapeMap={};var i=a.draw(r,n);return a.afterDraw&&a.afterDraw(r,n,i),i},baseUpdate:function(e,r,n,a){var i,o,s=this.getShape(e);s.update&&(s.mergeStyle=(i=s.getOptions)===null||i===void 0?void 0:i.call(s,r,a),(o=s.update)===null||o===void 0||o.call(s,r,n,a)),s.afterUpdate&&s.afterUpdate(r,n)},setState:function(e,r,n,a){var i=this.getShape(e);i.setState(r,n,a)},shouldUpdate:function(e){var r=this.getShape(e);return!!r.update},getControlPoints:function(e,r){var n=this.getShape(e);return n.getControlPoints(r)},getAnchorPoints:function(e,r){var n=this.getShape(e);return n.getAnchorPoints(r)}},mp={options:{},draw:function(e,r){return this.drawShape(e,r)},drawShape:function(){},afterDraw:function(){},afterUpdate:function(){},setState:function(){},getControlPoints:function(e){return e.controlPoints},getAnchorPoints:function(e){var r=this.options.anchorPoints,n=e.anchorPoints||r;return n}},mr=function(){function t(){}return t.registerFactory=function(e,r){var n=Sx(e),a=e8,i=P(P({},a),r);return t[n]=i,i.className=n,i},t.getFactory=function(e){var r=Sx(e);return t[r]},t.registerNode=function(e,r,n){var a=t.Node,i;if(typeof r=="string"||typeof r=="function"){var o=_x(r);i=P(P({},a.getShape("single-node")),o)}else if(r.jsx){var s=r.jsx,o=_x(s);i=P(P(P({},a.getShape("single-node")),o),r)}else{a.getShape(n);var u=n?a.getShape(n):mp;i=P(P({},u),r)}return i.type=e,i.itemType="node",a[e]=i,i},t.registerEdge=function(e,r,n){var a=t.Edge,i=n?a.getShape(n):mp,o=P(P({},i),r);return o.type=e,o.itemType="edge",a[e]=o,o},t.registerCombo=function(e,r,n){var a=t.Combo,i=n?a.getShape(n):mp,o=P(P({},i),r);return o.type=e,o.itemType="combo",a[e]=o,o},t}();mr.registerFactory("node",{defaultShapeType:"circle"});mr.registerFactory("edge",{defaultShapeType:"line"});mr.registerFactory("combo",{defaultShapeType:"circle"});var bp="bboxCache",wp="bboxCanvasCache",VC=function(){function t(e){this._cfg={},this.destroyed=!1,this.optimize=!1;var r={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(r,this.getDefaultCfg(),e);var n=this.get("model"),a=n.id,i=this.get("type");typeof a>"u"?a=q0(i):typeof a!="string"&&(a=String(a)),this.get("model").id=a,this.set("id",a);var o=e.group;o&&(o.set("item",this),o.set("id",a)),this.init(),this.draw();var s=n.shape||n.type||(i==="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=_r({},f.stateStyles,l),this.set("styles",l)}}}return t.prototype.calculateBBox=function(){var e=this.get("keyShape"),r=this.get("group"),n=Dh(e,r);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},t.prototype.calculateCanvasBBox=function(){var e=this.get("keyShape"),r=this.get("group"),n=Dh(e,r);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},t.prototype.drawInner=function(){var e=this,r=e.get("shapeFactory"),n=e.get("group"),a=e.get("model");n.clear();var i=a.visible;if(i!==void 0&&!i&&e.changeVisibility(i),!!r){e.updatePosition(a);var o=e.getShapeCfg(a),s=o.type,u=r.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(r,s)}},t.prototype.setOriginStyle=function(){var e=this.get("group"),r=e.get("children"),n=this.getKeyShape(),a=this,i=n.get("name");if(this.get("originStyle")){var d=this.get("originStyle");i&&!d[i]&&(d[i]={});for(var v=this.getCurrentStatesStyle(),p=function(y){var m=r[y],b=m.get("name"),w=m.attr();if(b&&b!==i){var x=v[b];d[b]||(d[b]={}),x?Object.keys(w).forEach(function(S){var A=w[S];A!==x[S]&&(d[b][S]=A)}):d[b]=m.get("type")!=="image"?rr(w):a.getShapeStyleByName(b)}else{var E=m.attr(),_={};Object.keys(v).forEach(function(S){var A=v[S];(S===i||!ln(A))&&(_[S]=A)}),Object.keys(E).forEach(function(S){var A=E[S];_[S]!==A&&(i?d[i][S]=A:d[S]=A)})}},s=0;s<r.length;s++)p(s);delete d.path,delete d.matrix,delete d.x,delete d.y,d[i]&&(delete d[i].x,delete d[i].y,delete d[i].matrix,delete d[i].path),a.set("originStyle",d)}else{for(var o={},s=0;s<r.length;s++){var u=r[s],f=u.get("type"),l=u.get("name");if(l&&l!==i)o[l]=f!=="image"?rr(u.attr()):a.getShapeStyleByName(l),f==="text"&&o[l]&&(delete o[l].x,delete o[l].y,delete o[l].matrix);else{var c=a.getShapeStyleByName();if(delete c.path,delete c.matrix,!i)Object.assign(o,c);else if(l)o[i]=c;else{var h=q0("shape");u.set("name",h),e.shapeMap[h]=u,o[h]=f!=="image"?rr(u.attr()):a.getShapeStyleByName(l)}}}a.set("originStyle",o)}},t.prototype.restoreStates=function(e,r){var n=this,a=n.get("states");_e(a,function(i){e.setState(r,i,!0,n)})},t.prototype.init=function(){var e=mr.getFactory(this.get("type"));this.set("shapeFactory",e)},t.prototype.get=function(e){return this._cfg[e]},t.prototype.set=function(e,r){ln(e)?this._cfg=P(P({},this._cfg),e):this._cfg[e]=r},t.prototype.getDefaultCfg=function(){return{}},t.prototype.clearCache=function(){this.set(bp,null),this.set(wp,null)},t.prototype.beforeDraw=function(){},t.prototype.afterDraw=function(){},t.prototype.afterUpdate=function(){},t.prototype.draw=function(){this.beforeDraw(),this.drawInner(),this.afterDraw()},t.prototype.getShapeStyleByName=function(e){var r=this.get("group"),n;if(e?n=r.shapeMap[e]||r.find(function(i){return i.get("name")===e}):n=this.getKeyShape(),n){var a={};return _e(n.attr(),function(i,o){(o!=="img"||Ye(i))&&(a[o]=i)}),a}return{}},t.prototype.getShapeCfg=function(e,r){var n=this.get("styles");if(n){var a=e;return a.style=P(P({},n),e.style),a}return e},t.prototype.getStateStyle=function(e){var r=this.get("styles"),n=r&&r[e];return n},t.prototype.getOriginStyle=function(){return this.get("originStyle")},t.prototype.getCurrentStatesStyle=function(){var e=this,r={},n=e.getStates();return!n||!n.length?this.get("originStyle"):(_e(e.getStates(),function(a){r=Object.assign(r,e.getStateStyle(a))}),r)},t.prototype.setState=function(e,r){var n=this.get("states"),a=this.get("shapeFactory"),i=e,o=e;Ye(r)&&(i="".concat(e,":").concat(r),o="".concat(e,":"));var s=n;if(Qf(r)){var u=n.indexOf(o);if(r){if(u>-1)return;n.push(i)}else u>-1&&n.splice(u,1)}else if(Ye(r)){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(i),this.set("states",s)}if(a){var l=this.get("model"),c=l.type;a.setState(c,e,r,this)}},t.prototype.clearStates=function(e){var r=this,n=r.getStates(),a=r.get("shapeFactory"),i=r.get("model"),o=i.type;e||(e=n),Ye(e)&&(e=[e]);var s=n.filter(function(u){return e.indexOf(u)===-1});r.set("states",s),e.forEach(function(u){a.setState(o,u,!1,r)})},t.prototype.setOptimize=function(e){this.optimize=e},t.prototype.getContainer=function(){return this.get("group")},t.prototype.getKeyShape=function(){return this.get("keyShape")},t.prototype.getModel=function(){return this.get("model")},t.prototype.getType=function(){return this.get("type")},t.prototype.getID=function(){return this.get("id")},t.prototype.isItem=function(){return!0},t.prototype.getStates=function(){return this.get("states")},t.prototype.hasState=function(e){var r=this.getStates();return r.indexOf(e)>=0},t.prototype.refresh=function(e){var r=this.get("model");this.updatePosition(r),this.updateShape(e),this.afterUpdate(),this.clearCache()},t.prototype.getUpdateType=function(e){},t.prototype.update=function(e,r){r===void 0&&(r=void 0);var n=this.get("model");if(r==="move")this.updatePosition(e);else{var a=n.visible,i=e.visible;a!==i&&i!==void 0&&this.changeVisibility(i);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;Et(s,u),delete e.stateStyles}Object.assign(n,e),(o.x!==e.x||o.y!==e.y)&&this.updatePosition(e),this.updateShape(r)}this.afterUpdate(),this.clearCache()},t.prototype.updateShape=function(e){var r=this.get("shapeFactory"),n=this.get("model"),a=n.type;if(r.shouldUpdate(a)&&a===this.get("currentShape")){var i=this.getShapeCfg(n,e);r.baseUpdate(a,i,this,e),e!=="move"&&this.setOriginStyle()}else this.draw();this.restoreStates(r,a)},t.prototype.updatePosition=function(e){var r=this.get("model"),n=isNaN(+e.x)?+r.x:+e.x,a=isNaN(+e.y)?+r.y:+e.y,i=this.get("group");if(isNaN(n)||isNaN(a))return!1;r.x=n,r.y=a;var o=i.getMatrix();return o&&o[6]===n&&o[7]===a?!1:(i.resetMatrix(),RA(i,{x:n,y:a}),this.clearCache(),!0)},t.prototype.getBBox=function(){var e=this.get(bp);return e||(e=this.calculateBBox(),this.set(bp,e)),e},t.prototype.getCanvasBBox=function(){var e=this.get(wp);return e||(e=this.calculateCanvasBBox(),this.set(wp,e)),e},t.prototype.toFront=function(){var e=this.get("group");e.toFront()},t.prototype.toBack=function(){var e=this.get("group");e.toBack()},t.prototype.show=function(){this.changeVisibility(!0)},t.prototype.hide=function(){this.changeVisibility(!1)},t.prototype.changeVisibility=function(e){var r=this.get("group");e?r.show():r.hide(),this.set("visible",e)},t.prototype.isVisible=function(){return this.get("visible")},t.prototype.enableCapture=function(e){var r=this.get("group");r&&r.set("capture",e)},t.prototype.destroy=function(){if(!this.destroyed){var e=this.get("animate"),r=this.get("group");e&&r.stopAnimate(),r.shapeMap={},this.clearCache(),r.remove(),this._cfg=null,this.destroyed=!0}},t}(),pc={source:"start",target:"end"},ka="Node",bs="Point",t8="Anchor",r8=function(t){jt(e,t);function e(){return t!==null&&t.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(r,n){var a=pc[r]+bs,i=r+ka,o=this.get(i);o&&!o.destroyed&&o.removeEdge(this),ln(n)?(this.set(a,n),this.set(i,null)):n&&(n.addEdge(this),this.set(i,n),this.set(a,null))},e.prototype.getLinkPoint=function(r,n,a){var i=pc[r]+bs,o=r+ka,s=this.get(i);if(!s){var u=this.get(o),f=r+t8,l=this.getPrePoint(r,a),c=n[f];Zt(c)||(s=u.getLinkPointByAnchor(c)),s=s||u.getLinkPoint(l),Zt(s.index)||this.set("".concat(r,"AnchorIndex"),s.index)}return s},e.prototype.getPrePoint=function(r,n){if(n&&n.length){var a=r==="source"?0:n.length-1;return n[a]}var i=r==="source"?"target":"source";return this.getEndPoint(i)},e.prototype.getEndPoint=function(r){var n=r+ka,a=pc[r]+bs,i=this.get(n);return i&&!i.destroyed?i.get("model"):this.get(a)},e.prototype.getControlPointsByCenter=function(r){var n=this.getEndPoint("source"),a=this.getEndPoint("target"),i=this.get("shapeFactory"),o=r.type;return i.getControlPoints(o,{startPoint:n,endPoint:a})},e.prototype.getEndCenter=function(r){var n=r+ka,a=pc[r]+bs,i=this.get(n);if(i){var o=i.getBBox();return{x:o.centerX,y:o.centerY}}return this.get(a)},e.prototype.init=function(){t.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},e.prototype.getShapeCfg=function(r,n){var a=this,i=a.get("linkCenter"),o=n!=null&&n.includes("move")?r:t.prototype.getShapeCfg.call(this,r);if(i)o.startPoint=a.getEndCenter("source"),o.endPoint=a.getEndCenter("target");else{var s=o.controlPoints||a.getControlPointsByCenter(o);o.startPoint=a.getLinkPoint("source",r,s),o.endPoint=a.getLinkPoint("target",r,s)}return o.sourceNode=a.get("sourceNode"),o.targetNode=a.get("targetNode"),o},e.prototype.getModel=function(){var r=this.get("model"),n=this.get("source".concat(ka)),a=this.get("target".concat(ka));return n?delete r["source".concat(ka)]:r.source=this.get("start".concat(bs)),a?delete r["target".concat(ka)]:r.target=this.get("end".concat(bs)),!Ye(r.source)&&!ln(r.source)&&(r.source=r.source.getID()),!Ye(r.target)&&!ln(r.target)&&(r.target=r.target.getID()),r},e.prototype.setSource=function(r){this.setEnd("source",r),this.set("source",r)},e.prototype.setTarget=function(r){this.setEnd("target",r),this.set("target",r)},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(r,n){n===void 0&&(n=void 0);var a=this.get("model"),i=a.visible,o=r.visible;i!==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(r.stateStyles){var l=r.stateStyles;Et(f,l),delete r.stateStyles}Object.assign(a,r),this.updateShape(n),this.afterUpdate(),this.clearCache()}},e.prototype.destroy=function(){var r=this.get("source".concat(ka)),n=this.get("target".concat(ka));r&&!r.destroyed&&r.removeEdge(this),n&&!n.destroyed&&n.removeEdge(this),t.prototype.destroy.call(this)},e}(VC),xp="anchorPointsCache",n8="bboxCache",YC=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getNearestPoint=function(r,n){for(var a=0,i=r[0],o=Oh(r[0],n),s=0;s<r.length;s++){var u=r[s],f=Oh(u,n);f<o&&(i=u,o=f,a=s)}return i.anchorIndex=a,i},e.prototype.getDefaultCfg=function(){return{type:"node",edges:[]}},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getInEdges=function(){var r=this;return this.get("edges").filter(function(n){return n.get("target")===r})},e.prototype.getOutEdges=function(){var r=this;return this.get("edges").filter(function(n){return n.get("source")===r})},e.prototype.getNeighbors=function(r){var n=this,a=this.get("edges");if(r==="target"){var i=function(f){return f.getSource()===n};return a.filter(i).map(function(u){return u.getTarget()})}if(r==="source"){var o=function(f){return f.getTarget()===n};return a.filter(o).map(function(u){return u.getSource()})}var s=function(f){return f.getSource()===n?f.getTarget():f.getSource()};return a.map(s)},e.prototype.getLinkPointByAnchor=function(r){var n=this.getAnchorPoints();return n[r]},e.prototype.getLinkPoint=function(r){var n=this.get("keyShape"),a=n.get("type"),i=this.get("type"),o,s,u=this.getBBox();i==="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(a){case"circle":l=LA({x:o,y:s,r:u.width/2},r);break;case"ellipse":l=DA({x:o,y:s,rx:u.width/2,ry:u.height/2},r);break;default:l=OA(u,r)}var c=l;return f.length&&(c||(c=r),c=this.getNearestPoint(f,c)),c||(c={x:o,y:s}),c},e.prototype.getAnchorPoints=function(){var r=this.get(xp);if(!r){r=[];var n=this.get("shapeFactory"),a=this.getBBox(),i=this.get("model"),o=this.getShapeCfg(i),s=i.type,u=n.getAnchorPoints(s,o)||[];_e(u,function(f,l){var c={x:a.minX+f[0]*a.width,y:a.minY+f[1]*a.height,anchorIndex:l};r.push(c)}),this.set(xp,r)}return r},e.prototype.addEdge=function(r){this.get("edges").push(r)},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(r){var n=this.getEdges(),a=n.indexOf(r);a>-1&&n.splice(a,1)},e.prototype.clearCache=function(){this.set(n8,null),this.set(xp,null)},e.prototype.getUpdateType=function(r){var n,a,i,o,s;if(r){var u=!Zt(r.x),f=!Zt(r.y),l=Object.keys(r);if(l.length===1&&(u||f)||l.length===2&&u&&f)return"move";if(Ot(r.x)||Ot(r.y)||r.type||r.anchorPoints||r.size||r!=null&&r.style&&(!((n=r==null?void 0:r.style)===null||n===void 0)&&n.r||!((a=r==null?void 0:r.style)===null||a===void 0)&&a.width||!((i=r==null?void 0:r.style)===null||i===void 0)&&i.height||!((o=r==null?void 0:r.style)===null||o===void 0)&&o.rx||!((s=r==null?void 0:r.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(r,n){var a=this;if(this.optimize){t.prototype.setState.call(this,r,n);return}this.runWithBBoxAffected(function(){return t.prototype.setState.call(a,r,n)})},e.prototype.clearStates=function(r){var n=this;if(this.optimize){t.prototype.clearStates.call(this,r);return}this.runWithBBoxAffected(function(){return t.prototype.clearStates.call(n,r)})},e.prototype.runWithBBoxAffected=function(r){var n=["r","width","height","rx","ry","lineWidth"],a=this.getKeyShape().attr(),i={};Object.keys(this.getKeyShape().attr()).forEach(function(f){n.includes(f)&&(i[f]=a[f])}),r();for(var o=this.getKeyShape().attr(),s=0;s<n.length;s++){var u=n[s];if(o[u]!==i[u]){this.clearCache(),this.getEdges().forEach(function(f){return f.refresh()});break}}},e}(VC),Mx="bboxCache",Ax="bboxCanvasCache",gc="sizeCache",Cx="anchorPointsCache",a8=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){return{type:"combo",nodes:[],edges:[],combos:[]}},e.prototype.getShapeCfg=function(r){var n=this.get("styles"),a=this.get("bbox");if(n&&a){var i=r,o=Ot(r.size)?[r.size,r.size]:r.size,s=Ot(r.fixSize)?[r.fixSize,r.fixSize]:r.fixSize,u=o||s||ft.defaultCombo.size,f={r:(Math.max(a.width,a.height)||Math.max(u[0],u[1]))/2,width:a.width||u[0],height:a.height||u[1]};i.style=P(P(P({},n),r.style),f);var l=r.padding||ft.defaultCombo.padding;return Ot(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(gc,f),i}return r},e.prototype.calculateCanvasBBox=function(){if(!this.destroyed){var r=this.get("keyShape"),n=this.get("group"),a=this.get(Mx)||{},i=a.x,o=a.x,s=this.get(gc),u=Dh(r,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(gc,s);var f=r.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!==i||u.y!==o)&&this.set(Cx,null),u}},e.prototype.getChildren=function(){var r=this;return{nodes:r.getNodes(),combos:r.getCombos()}},e.prototype.getNodes=function(){var r=this;return r.get("nodes")},e.prototype.getCombos=function(){var r=this;return r.get("combos")},e.prototype.addChild=function(r){var n=this,a=r.getType();switch(a){case"node":n.addNode(r);break;case"combo":n.addCombo(r);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(r){var n=this;return n.get("combos").push(r),!0},e.prototype.addNode=function(r){var n=this;return n.get("nodes").push(r),!0},e.prototype.removeChild=function(r){var n=this,a=r.getType();switch(a){case"node":n.removeNode(r);break;case"combo":n.removeCombo(r);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(r){if(r){var n=this.getCombos(),a=n.indexOf(r);return a>-1?(n.splice(a,1),!0):!1}},e.prototype.removeNode=function(r){if(r){var n=this.getNodes(),a=n.indexOf(r);return a>-1?(n.splice(a,1),!0):!1}},e.prototype.getUpdateType=function(r){},e.prototype.getBBox=function(){this.set(Ax,null);var r=this.calculateCanvasBBox();return r},e.prototype.clearCache=function(){this.set(Mx,null),this.set(Ax,null),this.set(Cx,null)},e.prototype.destroy=function(){if(!this.destroyed){var r=this.get("animate"),n=this.get("group");r&&n.stopAnimate(),n.shapeMap={},this.clearCache(),this.set(gc,null),this.set("bbox",null),n.remove(),this._cfg=null,this.destroyed=!0}},e}(YC),yc="node",mc="edge",Tx="vedge",Wu="combo",i8="default",Ix="Mapper",ii="stateStyles",o8=function(){function t(e){var r=this;this.edgeToBeUpdateMap={},this.throttleRefresh=Ch(function(n){var a=r.graph;if(!(!a||a.get("destroyed"))){var i=r.edgeToBeUpdateMap;if(i){var o=Object.values(i);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)}}),r.edgeToBeUpdateMap={})}}},16,{trailing:!0,leading:!0}),this.graph=e,this.destroyed=!1}return t.prototype.addItem=function(e,r){var n=this.graph,a=e===Tx?mc:e,i=n.get("".concat(a,"Group"))||n.get("group"),o=Zs(a),s=null,u=n.get(a+Zs(ii))||{},f=n.get(i8+o);r[ii]&&(u=r[ii]),f&&_e(f,function(E,_){gn(E)&&!bt(E)?r[_]=_r({},E,r[_]):bt(E)?r[_]=r[_]||rr(f[_]):r[_]=r[_]||f[_]});var l=n.get(a+Ix);if(l){var c=l(r);c[ii]&&(u=c[ii],delete c[ii]),_e(c,function(E,_){gn(E)&&!bt(E)?r[_]=_r({},r[_],E):r[_]=c[_]||r[_]})}if(n.emit("beforeadditem",{type:e,model:r}),e===mc||e===Tx){var h=void 0,d=void 0;if(h=r.source,d=r.target,h&&Ye(h)&&(h=n.findById(h)),d&&Ye(d)&&(d=n.findById(d)),!h||!d){console.warn("The source or target node of edge ".concat(r.id," does not exist!"));return}h.getType&&h.getType()==="combo"&&(r.isComboEdge=!0),d.getType&&d.getType()==="combo"&&(r.isComboEdge=!0),s=new r8({model:r,source:h,target:d,styles:u,linkCenter:n.get("linkCenter"),group:i.addGroup()})}else if(e===yc)s=new YC({model:r,styles:u,group:i.addGroup()});else if(e===Wu){var v=r.children,p=oh(v,n),g=void 0,y=void 0;if(isNaN(p.x)?isNaN(r.x)&&(g=Math.random()*100):g=p.x,isNaN(p.y)?isNaN(r.y)&&(y=Math.random()*100):y=p.y,isNaN(r.x)||isNaN(r.y))r.x=g,r.y=y;else{var m=r.x-g,b=r.y-y;this.updateComboSucceeds(r.id,m,b,v)}var w=i.addGroup();w.setZIndex(r.depth),s=new a8({model:r,styles:u,animate:n.get("animate"),bbox:r.collapsed?oh([],n):p,group:w}),!r.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 x=s.getModel();(v||[]).forEach(function(E){var _=n.findById(E.id);s.addChild(_),E.depth=x.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:r}),s},t.prototype.updateItem=function(e,r){var n=this,a,i,o=this.graph;if(Ye(e)&&(e=o.findById(e)),!(!e||e.destroyed)){var s="";e.getType&&(s=e.getType());var u=o.get(s+Ix),f=e.getModel(),l=f.x,c=f.y,h=e.getUpdateType(r);if(u){var d=_r({},f,r),v=u(d),p=_r({},f,v,r);v[ii]&&(e.set("styles",p[ii]),delete p[ii]),_e(p,function(M,C){r[C]=M})}else _e(r,function(M,C){f[C]&&gn(M)&&!bt(M)&&(r[C]=P(P({},f[C]),r[C]))});if(o.emit("beforeupdateitem",{item:e,cfg:r}),s===mc){if(r.source){var g=r.source;Ye(g)&&(g=o.findById(g)),e.setSource(g)}if(r.target){var y=r.target;Ye(y)&&(y=o.findById(y)),e.setTarget(y)}e.update(r)}else if(s===yc){e.update(r,h);var m=e.getEdges();h==="move"?_e(m,function(M){n.edgeToBeUpdateMap[M.getID()]={edge:M,updateType:h},n.throttleRefresh()}):h!=null&&h.includes("bbox")&&_e(m,function(M){M.refresh(h)})}else if(s===Wu){if(e.update(r,h),!isNaN(r.x)||!isNaN(r.y)){var b=r.x-l||0,w=r.y-c||0;this.updateComboSucceeds(f.id,b,w)}var x=e.getEdges(),E=(h==null?void 0:h.includes("bbox"))||h==="move";if(E&&s===Wu){var _=e.get("shapeFactory"),S=f.type||"circle",A=f.animate===void 0||r.animate===void 0?(i=(a=_[S])===null||a===void 0?void 0:a.options)===null||i===void 0?void 0:i.animate:f.animate||r.animate;A?setTimeout(function(){if(!(!e||e.destroyed)){var M=e.getKeyShape();!M||M.destroyed||_e(x,function(C){C&&!C.destroyed&&C.refresh()})}},201):_e(x,function(M){M.refresh()})}}e.setOptimize(o.getNodes().length>o.get("optimizeThreshold")),o.emit("afterupdateitem",{item:e,cfg:r})}},t.prototype.updateCombo=function(e,r,n){var a=this,i,o,s=this.graph;if(Ye(e)&&(e=s.findById(e)),!(!e||e.destroyed)){var u=e.getModel(),f=oh(r,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=(i=v[p])===null||i===void 0?void 0:i.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),a.updateComboEdges(e))}},201):this.updateComboEdges(e)}},t.prototype.updateComboEdges=function(e){for(var r,n,a=e.getEdges()||[],i=0;i<a.length;i++){var o=a[i];!(o!=null&&o.destroyed)&&!(!((r=o==null?void 0:o.getSource())===null||r===void 0)&&r.destroyed)&&!(!((n=o==null?void 0:o.getTarget())===null||n===void 0)&&n.destroyed)&&o.refresh()}},t.prototype.collapseCombo=function(e,r){r===void 0&&(r=!0);var n=this.graph;Ye(e)&&(e=n.findById(e));var a=e.getChildren();a.nodes.forEach(function(i){n.hideItem(i,r)}),a.combos.forEach(function(i){n.hideItem(i,r)})},t.prototype.updateComboSucceeds=function(e,r,n,a){var i=this;a===void 0&&(a=[]);var o=this.graph;if(!(!r&&!n)){var s=a;if(!(s!=null&&s.length)){var u=o.get("comboTrees");u==null||u.forEach(function(f){bn(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();i.updateItem(f.id,{x:(c.x||0)+r,y:(c.y||0)+n})}})}},t.prototype.expandCombo=function(e,r){r===void 0&&(r=!0);var n=this.graph;Ye(e)&&(e=n.findById(e));var a=e.getChildren(),i=new Set;a.nodes.forEach(function(o){n.showItem(o,r),o.getEdges().forEach(function(s){return i.add(s)})}),a.combos.forEach(function(o){o.getModel().collapsed?o.show():n.showItem(o,r),o.getEdges().forEach(function(s){return i.add(s)})}),i.forEach(function(o){return o.refresh()})},t.prototype.removeItem=function(e){var r=this,n=this.graph;if(Ye(e)&&(e=n.findById(e)),!(!e||e.destroyed)){var a=rr(e.getModel()),i="";e.getType&&(i=e.getType()),n.emit("beforeremoveitem",{item:a,type:i});var o=n.get("".concat(i,"s")),s=o.indexOf(e);if(s>-1&&o.splice(s,1),i===mc){var u=n.get("v".concat(i,"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(i===yc){var v=e.getModel().comboId;if(h&&v){var p=h,g=!1;h.forEach(function(E){g||bn(E,function(_){if(_.id===d&&p){var S=p.indexOf(_);return p.splice(S,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(i===Wu){var b=e.getModel().parentId,w,x=!1;(h||[]).forEach(function(_){x||bn(_,function(S){return S.id===d?(w=S,x=!0,!1):!0})}),w.removed=!0,w&&w.children&&w.children.forEach(function(_){r.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:a,type:i})}},t.prototype.setItemState=function(e,r,n){var a=this.graph,i=r;Ye(n)&&(i="".concat(r,":").concat(n)),!(e.hasState(i)===n&&n||Ye(n)&&e.hasState(i))&&(a.emit("beforeitemstatechange",{item:e,state:i,enabled:n}),e.setState(r,n),a.autoPaint(),a.emit("afteritemstatechange",{item:e,state:i,enabled:n}))},t.prototype.priorityState=function(e,r){var n=this.graph,a=e;Ye(e)&&(a=n.findById(e)),this.setItemState(a,r,!1),this.setItemState(a,r,!0)},t.prototype.clearItemStates=function(e,r){var n=this.graph;Ye(e)&&(e=n.findById(e)),n.emit("beforeitemstatesclear",{item:e,states:r}),e.clearStates(r),n.emit("afteritemstatesclear",{item:e,states:r})},t.prototype.refreshItem=function(e){var r=this.graph;Ye(e)&&(e=r.findById(e)),r.emit("beforeitemrefresh",{item:e}),e.refresh(),r.emit("afteritemrefresh",{item:e})},t.prototype.addCombos=function(e,r){var n=this,a=this.graph;(e||[]).forEach(function(o){Ra(o,function(s){var u;return r.forEach(function(f){f.id===s.id&&(f.children=s.children,f.depth=s.depth,u=f)}),u&&n.addItem("combo",u),!0})});var i=a.get("comboGroup");i&&i.sort()},t.prototype.changeItemVisibility=function(e,r){var n=this,a=this.graph;if(Ye(e)&&(e=a.findById(e)),!e){console.warn("The item to be shown or hidden does not exist!");return}if(a.emit("beforeitemvisibilitychange",{item:e,visible:r}),e.changeVisibility(r),e.getType&&e.getType()===yc){var i=e.getEdges();_e(i,function(l){r&&!(l.get("source").isVisible()&&l.get("target").isVisible())||n.changeItemVisibility(l,r)})}else if(e.getType&&e.getType()===Wu){var o=a.get("comboTrees"),s=e.get("id"),u=[],f=!1;(o||[]).forEach(function(c){f||!c.children||c.children.length===0||bn(c,function(h){return h.id===s?(u=h.children,f=!0,!1):!0})}),u&&(!r||r&&!e.getModel().collapsed)&&u.forEach(function(c){var h=a.findById(c.id);n.changeItemVisibility(h,r)});var i=e.getEdges();_e(i,function(c){r&&!(c.get("source").isVisible()&&c.get("target").isVisible())||n.changeItemVisibility(c,r)})}return a.emit("afteritemvisibilitychange",{item:e,visible:r}),e},t.prototype.destroy=function(){this.graph=null,this.destroyed=!0},t}(),s8=function(){function t(e){this.graph=e,this.destroyed=!1}return t.prototype.updateState=function(e,r,n){var a=this.graph.get("states"),i=r;Ye(n)&&(i="".concat(r,":").concat(n)),a[i]||(a[i]=[]),n?a[i].push(e):a[i]=a[i].filter(function(o){return o!==e}),this.graph.set("states",a),this.graph.emit("graphstatechange",{states:a})},t.prototype.updateStates=function(e,r,n){var a=this.graph.get("states"),i=Ye(r)?[r]:r;i.forEach(function(o){var s=o;a[s]||(a[s]=[]),Ye(n)&&(s="".concat(o,":").concat(n)),n?a[s].push(e):a[s]=a[s].filter(function(u){return u!==e})}),this.graph.set("states",a),this.graph.emit("graphstatechange",{states:r})},t.prototype.destroy=function(){this.graph=null,this.destroyed=!0},t}(),u8=function(e,r){return!e||!r?e:e.replace(/\\?\{([^{}]+)\}/g,function(n,a){if(n.charAt(0)==="\\")return n.slice(1);var i=r[a];return i===0&&(i="0"),i||""})},qC=function(e){var r=[];if(e.length<2)throw new Error("point length must largn than 2, now it's ".concat(e.length));for(var n=0,a=e;n<a.length;n++){var i=a[n],o=i.x,s=i.y;r.push(o),r.push(s)}var u=Nj(r);return u.unshift(["M",e[0].x,e[0].y]),u},zh=function(e,r,n,a){n===void 0&&(n=0),a===void 0&&(a=0);var i={x:(1-n)*e.x+n*r.x,y:(1-n)*e.y+n*r.y},o=[0,0];Wi(o,[r.x-e.x,r.y-e.y]),(!o||!o[0]&&!o[1])&&(o=[0,0]);var s=[-o[1]*a,o[0]*a];return i.x+=s[0],i.y+=s[1],i},f8=function(e,r){var n=e.length;if(!n)return"";for(var a="",i="",o=0;o<n;o++){var s=e[o];o===0?i="M{x} {y}":i="L{x} {y}",a+=u8(i,s)}return r&&(a+="Z"),a},Z0=function(e){var r=[];return e.forEach(function(n){var a=n[0];if(a!=="A")for(var i=1;i<n.length;i=i+2)r.push([n[i],n[i+1]]);else{var o=n.length;r.push([n[o-2],n[o-1]])}}),r},K0=function(e){if(e.length<2)throw new Error("point length must larger than 2, now it's ".concat(e.length));var r=e[0],n=e[1],a=e[e.length-1],i=e[e.length-2];e.unshift(a),e.unshift(i),e.push(r),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",a.x,a.y]),o},kx=function(e,r){return wn([0,0],Wi([0,0],e),r)},Nx=function(e,r){var n=[e[1]-r[1],r[0]-e[0]],a=Math.sqrt(n[0]*n[0]+n[1]*n[1]);if(a===0)throw new Error("p0 should not be equal to p1");return[n[0]/a,n[1]/a]},Ox=function(e,r){return[r[0]-e[0],r[1]-e[1]]};function Q0(t,e){var r=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=wn([0,0],Nx(c[0],c[1]),e),d=wn([0,0],h,-1),v=fn([0,0],c[0],h),p=fn([0,0],c[1],h),g=fn([0,0],c[1],d),y=fn([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(!t||t.length<1)return"";if(t.length===1)return r(t);if(t.length===2)return n(t);for(var a=new Array(t.length),i=0;i<a.length;++i){var o=i===0?t[t.length-1]:t[i-1],s=t[i],u=wn([0,0],Nx(o,s),e);a[i]=[fn([0,0],o,u),fn([0,0],s,u)]}var f="A ".concat([e,e,"0,0,0,"].join(","));return a=a.map(function(l,c){var h="";return c===0&&(h="M ".concat(a[a.length-1][1]," ")),h+="".concat(f+l[0]," L ").concat(l[1]),h}),a.join(" ")}function HC(t,e){var r=t.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(","))},a=function(l){var c=Ox(l[0],l[1]),h=kx(c,e),d=fn([0,0],l[0],wn([0,0],h,-1)),v=fn([0,0],l[1],h),p=1.2*e,g=kx(Wi([0,0],c),p),y=wn([0,0],g,-1),m=fn([0,0],d,y),b=fn([0,0],v,y),w=fn([0,0],d,g);return"M ".concat(d," C ").concat([m,b,v].join(",")," S ").concat([w,d].join(",")," Z")};if(!t||r<1)return"";if(r===1)return n(t);if(r===2)return a(t);for(var i=t.map(function(f,l){var c=t[(l+1)%r];return{p:f,v:Wi([0,0],Ox(f,c))}}),o=0;o<i.length;++o){var s=o>0?o-1:r-1,u=Wi([0,0],fn([0,0],i[s].v,wn([0,0],i[o].v,-1)));i[o].p=fn([0,0],i[o].p,wn([0,0],u,e))}return i.map(function(f){var l=f.p;return{x:l[0],y:l[1]}})}var l8=function(e,r){for(var n=[],a=0;a<5;a++){var i=Math.cos((18+72*a)/180*Math.PI)*e,o=Math.sin((18+72*a)/180*Math.PI)*e,s=Math.cos((54+72*a)/180*Math.PI)*r,u=Math.sin((54+72*a)/180*Math.PI)*r;a===0?n.push(["M",i,-o]):n.push(["L",i,-o]),n.push(["L",s,-u])}return n.push(["Z"]),n};const c8=Object.freeze(Object.defineProperty({__proto__:null,getClosedSpline:K0,getControlPoint:zh,getSpline:qC,getStarPath:l8,paddedHull:HC,pathToPoints:Z0,pointsToPolygon:f8,roundedHull:Q0},Symbol.toStringTag,{value:"Module"}));var Lx=function(e,r,n){return(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y)},Dx=function(e){var r=e.map(function(c){return{x:c.getModel().x,y:c.getModel().y}});r.sort(function(c,h){return c.x===h.x?c.y-h.y:c.x-h.x});for(var n={},a=r.length-1;a>=0;a--){var i=r[a],o=i.x,s=i.y;n["".concat(o,"-").concat(s)]&&r.splice(a,1),n["".concat(o,"-").concat(s)]=!0}if(r.length===1)return r;for(var u=[],a=0;a<r.length;a++){for(;u.length>=2&&Lx(u[u.length-2],u[u.length-1],r[a])<=0;)u.pop();u.push(r[a])}for(var f=[],a=r.length-1;a>=0;a--){for(;f.length>=2&&Lx(f[f.length-2],f[f.length-1],r[a])<=0;)f.pop();f.push(r[a])}f.pop(),u.pop();var l=u.concat(f);return l},h8={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 d8(t,e,r){var n=!1,a=function(u,f){return e.cells[u+f*e.width]},i=function(u,f){var l=0;return a(u-1,f-1)>=r&&(l+=1),a(u,f-1)>r&&(l+=2),a(u-1,f)>r&&(l+=4),a(u,f)>r&&(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,t.findIndex(function(g){return g.x===l&&g.y===c})>-1){if(!(t[0].x!==l||t[0].y!==c))return!0}else t.push({x:l,y:c});var p=i(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)a(s,u)>r&&i(s,u)!==15&&(n=o(s,u));return n}}var v8=function(e,r,n){var a=Math.ceil(e/n),i=Math.ceil(r/n),o=new Float32Array(Math.max(0,a*i)).fill(0);return{cells:o,width:a,height:i}},p8=function(e,r,n){var a=null,i=Number.POSITIVE_INFINITY;return r.forEach(function(o){var s={x:e.getModel().x,y:e.getModel().y},u={x:o.getModel().x,y:o.getModel().y},f=Lh(s,u),l=new $o(s.x,s.y,u.x,u.y),c=n.reduce(function(h,d){return Oy(d,l)>0?h+1:h},0);f*Math.pow(c+1,2)<i&&(a=o,i=f*Math.pow(c+1,2))}),a},ZC=function(e,r){var n=Number.POSITIVE_INFINITY,a=null;return e.forEach(function(i){var o=Oy(i,r);o>=0&&o<n&&(a=i,n=o)}),a},g8=function(e,r,n,a){var i=[],o=[];o.push(e);for(var s=!0,u=0,f=function(d,v){var p=!1;return v.forEach(function(g){p||(S0(d,{x:g.x1,y:g.y1})||S0(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(Lf(b,d.x,d.y))return!0}return!1};s&&u<n;){s=!1;for(var c=function(){var d=o.pop(),v=ZC(r,d);if(v){var p=GA(v,d),g=p[0],y=p[1];if(y===2){var m=function(w){for(var x=a,E=Px(v,x,g,w),_=f(E,o)||f(E,i),S=l(E,r);!_&&S&&x>=1;)x/=1.5,E=Px(v,x,g,w),_=f(E,o)||f(E,i),S=l(E,r);E&&!_&&(!w||!S)&&(o.push(new $o(d.x1,d.y1,E.x,E.y)),o.push(new $o(E.x,E.y,d.x2,d.y2)),s=!0)};m(!0),s||m(!1)}}s||i.push(d),u+=1};!s&&o.length;)c()}for(;o.length;)i.push(o.pop());return i};function y8(t,e,r,n,a){var i=p8(t,r,e);if(i===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 $o(d.x1,d.y1,v.x2,v.y2),g=ZC(e,p);g?(h.push(d),c.push(v)):c.push(p)}return h},s=new $o(t.getModel().x,t.getModel().y,i.getModel().x,i.getModel().y),u=g8(s,e,n,a),f=o(u);return f}var m8=function(e,r,n){var a=Object.assign(h8,n),i=zA(e.map(function(m){return{x:m.getModel().x,y:m.getModel().y}}));e=e.sort(function(m,b){return Lh({x:m.getModel().x,y:m.getModel().y},i)-Lh({x:b.getModel().x,y:b.getModel().y},i)});var o=[],s=[];e.forEach(function(m){var b=y8(m,r,o,a.maxRoutingIterations,a.morphBuffer);b.forEach(function(w){s.push(w)}),o.push(m)});for(var u=b8(e,s,a.nodeR0),f=v8(u.width,u.height,a.pixelGroupSize),l=[],c=[],h=0;h<a.maxMarchingIterations;h++)if(w8(e,r,s,u,f,a),l=[],c=[],!!new d8(l,f,a.threshold).march()){var d=l.map(function(m){return{x:Math.round(m.x*a.pixelGroupSize+u.minX),y:Math.round(m.y*a.pixelGroupSize+u.minY)}});if(d){var v=d.length;if(a.skip>1)for(v=Math.floor(d.length/a.skip);v<3&&a.skip>1;)a.skip-=1,v=Math.floor(d.length/a.skip);for(var p=0,g=0;g<v;g+=1,p+=a.skip)c.push({x:d[p].x,y:d[p].y})}var y=function(){for(var b=0,w=e;b<w.length;b++){var x=w[b],E=c.map(function(_){return[_.x,_.y]});if(!Lf(E,x.getBBox().centerX,x.getBBox().centerY))return!1}return!0};if(c&&y())return c;if(a.threshold*=.9,h<=a.maxMarchingIterations*.5)a.memberInfluenceFactor*=1.2,a.edgeInfluenceFactor*=1.2;else if(a.nonMemberInfluenceFactor!==0&&r.length>0)a.nonMemberInfluenceFactor*=.8;else break}return c};function b8(t,e,r){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},a=[];t.forEach(function(u){a.push(u.getBBox())}),e.forEach(function(u){a.push(u.getBBox())});for(var i=0,o=a;i<o.length;i++){var s=o[i];n.minX=(s.minX<n.minX?s.minX:n.minX)-r,n.minY=(s.minY<n.minY?s.minY:n.minY)-r,n.maxX=(s.maxX>n.maxX?s.maxX:n.maxX)+r,n.maxY=(s.maxY>n.maxY?s.maxY:n.maxY)+r}return n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.x=n.minX,n.y=n.minY,n}function w8(t,e,r,n,a,i){function o(d,v){var p=Math.floor((d-v)/i.pixelGroupSize);return p<0?0:p}function s(d,v){return d*i.pixelGroupSize+v}var u=(i.nodeR0-i.nodeR1)*(i.nodeR0-i.nodeR1),f=(i.edgeR0-i.edgeR1)*(i.edgeR0-i.edgeR1),l=function(v,p){var g=Math.min(o(v.minX,p+n.minX),a.width),y=Math.min(o(v.minY,p+n.minY),a.height),m=Math.min(o(v.maxX,-p+n.minX),a.width),b=Math.min(o(v.maxY,-p+n.minY),a.height);return[g,y,m,b]},c=function(v,p){for(var g=v.getBBox(),y=l(g,i.nodeR1),m=y[0],b=y[1],w=y[2],x=y[3],E=b;E<x;E+=1)for(var _=m;_<w;_+=1)if(!(p<0&&a[_+E*a.width]<=0)){var S=s(_,n.minX),A=s(E,n.minY),M=UA({x:S,y:A},{x:g.minX,y:g.minY,width:g.width,height:g.height});if(M<Math.pow(i.nodeR1,2)){var C=Math.sqrt(M)-i.nodeR1;a.cells[_+E*a.width]+=p*C*C}}},h=function(v,p){for(var g=v.getBBox(),y=l(g,i.edgeR1),m=y[0],b=y[1],w=y[2],x=y[3],E=b;E<x;E+=1)for(var _=m;_<w;_+=1)if(!(p<0&&a.cells[_+E*a.width]<=0)){var S=s(_,n.minX),A=s(E,n.minY),M=jA({x:S,y:A},v);if(M<Math.pow(i.edgeR1,2)){var C=Math.sqrt(M)-i.edgeR1;a.cells[_+E*a.width]+=p*C*C}}};i.nodeInfluenceFactor&&t.forEach(function(d){c(d,i.nodeInfluenceFactor/u)}),i.edgeInfluenceFactor&&r.forEach(function(d){h(d,i.edgeInfluenceFactor/f)}),i.negativeNodeInfluenceFactor&&e.forEach(function(d){c(d,i.negativeNodeInfluenceFactor/u)})}function Px(t,e,r,n){var a=t.getBBox(),i=r[0],o=r[1],s=r[2],u=r[3],f={topLeft:{x:a.minX-e,y:a.minY-e},topRight:{x:a.maxX+e,y:a.minY-e},bottomLeft:{x:a.minX-e,y:a.maxY+e},bottomRight:{x:a.maxX+e,y:a.maxY+e}},l=a.height*a.width;function c(v,p){return a.width*((v.y-a.minY+(p.y-a.minY))*.5)}if(o){if(i)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(i)return n?f.topRight:f.bottomLeft;if(s)return n?f.bottomRight:f.topLeft}var d=c(i,s);return d<l*.5?i.x>s.x?n?f.topLeft:f.bottomRight:n?f.bottomLeft:f.topRight:i.x<s.x?n?f.topRight:f.bottomLeft:n?f.bottomRight:f.topLeft}var x8=function(){function t(e,r){this.cfg=_r(this.getDefaultCfg(),r),this.graph=e,this.id=this.cfg.id,this.group=this.cfg.group,this.members=this.cfg.members.map(function(n){return Ye(n)?e.findById(n):n}),this.nonMembers=this.cfg.nonMembers.map(function(n){return Ye(n)?e.findById(n):n}),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()}return t.prototype.getDefaultCfg=function(){return{id:"g6-hull",type:"round-convex",members:[],nonMembers:[],style:{fill:"lightblue",stroke:"blue",opacity:.2},padding:10}},t.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}},t.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")},t.prototype.calcPath=function(e,r){var n,a,i;switch(this.type){case"round-convex":n=Dx(e),i=Q0(n.map(function(o){return[o.x,o.y]}),this.padding),a=W0(i);break;case"smooth-convex":n=Dx(e),n.length===2?(i=Q0(n.map(function(o){return[o.x,o.y]}),this.padding),a=W0(i)):n.length>2&&(i=HC(n.map(function(o){return[o.x,o.y]}),this.padding),a=K0(i));break;case"bubble":n=m8(e,r,this.cfg.bubbleCfg),a=n.length>=2&&K0(n);break}return a},t.prototype.render=function(){this.group.addShape("path",{attrs:P({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},t.prototype.addMember=function(e){if(e){Ye(e)&&(e=this.graph.findById(e)),this.members.push(e);var r=this.nonMembers.indexOf(e);return r>-1&&this.nonMembers.splice(r,1),this.updateData(this.members,this.nonMembers),!0}},t.prototype.addNonMember=function(e){if(e){Ye(e)&&(e=this.graph.findById(e)),this.nonMembers.push(e);var r=this.members.indexOf(e);return r>-1&&this.members.splice(r,1),this.updateData(this.members,this.nonMembers),!0}},t.prototype.removeMember=function(e){if(e){Ye(e)&&(e=this.graph.findById(e));var r=this.members.indexOf(e);return r>-1?(this.members.splice(r,1),this.updateData(this.members,this.nonMembers),!0):!1}},t.prototype.removeNonMember=function(e){if(e){Ye(e)&&(e=this.graph.findById(e));var r=this.nonMembers.indexOf(e);return r>-1?(this.nonMembers.splice(r,1),this.updateData(this.members,this.nonMembers),!0):!1}},t.prototype.updateData=function(e,r){var n=this;this.group.findById(this.id).remove(),e&&(this.members=e.map(function(a){return Ye(a)?n.graph.findById(a):a})),r&&(this.nonMembers=r.map(function(a){return Ye(a)?n.graph.findById(a):a})),this.path=this.calcPath(this.members,this.nonMembers),this.render()},t.prototype.updateStyle=function(e){var r=this.group.findById(this.id);r.attr(P({},e))},t.prototype.updateCfg=function(e){var r=this;this.cfg=_r(this.cfg,e),this.id=this.cfg.id,this.group=this.cfg.group,e.members&&(this.members=this.cfg.members.map(function(n){return Ye(n)?r.graph.findById(n):n})),e.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map(function(n){return Ye(n)?r.graph.findById(n):n})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},t.prototype.contain=function(e){var r=this,n;Ye(e)?n=this.graph.findById(e):n=e;var a,i=n.getKeyShape();if(n.get("type")==="path")a=Z0(i.attr("path"));else{var o=i.getCanvasBBox();a=[[o.minX,o.minY],[o.maxX,o.minY],[o.maxX,o.maxY],[o.minX,o.maxY]]}return a=a.map(function(s){var u=r.graph.getPointByCanvas(s[0],s[1]);return[u.x,u.y]}),BA(a,Z0(this.path))},t.prototype.destroy=function(){this.group.remove(),this.cfg=null},t}(),Vu=eo,E8="node",_8=function(t){jt(e,t);function e(r){var n=t.call(this)||this;return n.sortCombos=oy(function(){var a=n.get("comboSorted");if(!(!n||n.destroyed||a)){n.set("comboSorted",!0);var i=[],o={},s=n.get("comboTrees");(s||[]).forEach(function(f){bn(f,function(l){return i[l.depth]?i[l.depth].push(l.id):i[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);i[d]?i[d].push(l.id):i[d]=[l.id]}),i.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=_r(n.getDefaultCfg(),r),n.init(),n.animating=!1,n.destroyed=!1,n.cfg.enabledStack&&(n.undoStack=new Gs(n.cfg.maxStep),n.redoStack=new Gs(n.cfg.maxStep)),n}return e.prototype.init=function(){this.initCanvas();var r=new Zj(this),n=new cz(this),a=new o8(this),i=new s8(this);this.set({viewController:r,modeController:n,itemController:a,stateController:i}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},e.prototype.initGroups=function(){var r=this.get("canvas");if(r){var n=r.get("el"),a=(n||{}).id,i=a===void 0?"g6":a,o=r.addGroup({id:"".concat(i,"-root"),className:ft.rootContainerClassName});if(this.get("groupByTypes")){var s=o.addGroup({id:"".concat(i,"-edge"),className:ft.edgeContainerClassName}),u=o.addGroup({id:"".concat(i,"-node"),className:ft.nodeContainerClassName}),f=o.addGroup({id:"".concat(i,"-combo"),className:ft.comboContainerClassName});f.toBack(),this.set({nodeGroup:u,edgeGroup:s,comboGroup:f})}var l=o.addGroup({id:"".concat(i,"-delegate"),className:ft.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(r,n){return ln(r)?this.cfg=P(P({},this.cfg),r):this.cfg[r]=n,r==="enabledStack"&&n&&!this.undoStack&&!this.redoStack&&(this.undoStack=new Gs(this.cfg.maxStep),this.redoStack=new Gs(this.cfg.maxStep)),this},e.prototype.get=function(r){var n;return(n=this.cfg)===null||n===void 0?void 0:n[r]},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(r){return this.set("minZoom",r)},e.prototype.getMaxZoom=function(){return this.get("maxZoom")},e.prototype.setMaxZoom=function(r){return this.set("maxZoom",r)},e.prototype.getWidth=function(){return this.get("width")},e.prototype.getHeight=function(){return this.get("height")},e.prototype.clearItemStates=function(r,n){Ye(r)&&(r=this.findById(r));var a=this.get("itemController");n||(n=r.get("states")),a.clearItemStates(r,n);var i=this.get("stateController");i.updateStates(r,n,!1)},e.prototype.node=function(r){typeof r=="function"&&this.set("nodeMapper",r)},e.prototype.edge=function(r){typeof r=="function"&&this.set("edgeMapper",r)},e.prototype.combo=function(r){typeof r=="function"&&this.set("comboMapper",r)},e.prototype.findById=function(r){return this.get("itemMap")[r]},e.prototype.find=function(r,n){var a,i=this.get("".concat(r,"s"));return _e(i,function(o,s){if(n(o,s))return a=o,a}),a},e.prototype.findAll=function(r,n){var a=[];return _e(this.get("".concat(r,"s")),function(i,o){n(i,o)&&a.push(i)}),a},e.prototype.findAllByState=function(r,n,a){return a?this.findAll(r,function(i){return i.hasState(n)&&a(i)}):this.findAll(r,function(i){return i.hasState(n)})},e.prototype.translate=function(r,n,a,i){var o=this,s=this.get("group"),u=rr(s.getMatrix());if(u||(u=[1,0,0,0,1,0,0,0,1]),a){var f=Df({animateCfg:i,callback:function(){return o.emit("viewportchange",{action:"translate",matrix:s.getMatrix()})}});_0(s,{x:s.getCanvasBBox().x+r,y:s.getCanvasBBox().y+n},a,f||{duration:500,easing:"easeCubic"})}else u=Vu(u,[["t",r,n]]),s.setMatrix(u),this.emit("viewportchange",{action:"translate",matrix:u}),this.autoPaint()},e.prototype.moveTo=function(r,n,a,i){var o=this.get("group");_0(o,{x:r,y:n},a,i||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:o.getMatrix()})},e.prototype.fitView=function(r,n,a,i){r&&this.set("fitViewPadding",r);var o=this.get("viewController");n?o.fitViewByRules(n,a,i):o.fitView(a,i),this.autoPaint()},e.prototype.fitCenter=function(r,n){var a=this.get("viewController");a.fitCenter(r,n),this.autoPaint()},e.prototype.addBehaviors=function(r,n){var a=this.get("modeController");return a.manipulateBehaviors(r,n,!0),this},e.prototype.removeBehaviors=function(r,n){var a=this.get("modeController");return a.manipulateBehaviors(r,n,!1),this},e.prototype.updateBehavior=function(r,n,a){var i=this.get("modeController");return i.updateBehavior(r,n,a),this},e.prototype.zoom=function(r,n,a,i){var o=this,s=this.get("group"),u=rr(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*r,d=r,v=!1;if(f&&h<f?(d=f/c,v=!0):l&&h>l&&(d=l/c,v=!0),n?u=Vu(u,[["t",-n.x,-n.y],["s",d,d],["t",n.x,n.y]]):u=Vu(u,[["s",d,d]]),a){var p=rr(s.getMatrix());p||(p=[1,0,0,0,1,0,0,0,1]);var g=p[0],y=g*d,m=Df({animateCfg:i,callback:function(){return o.emit("viewportchange",{action:"zoom",matrix:s.getMatrix()})}});s.animate(function(b){if(b===1)p=u;else{var w=Ly(g,y,b)/p[0];n?p=Vu(p,[["t",-n.x,-n.y],["s",w,w],["t",n.x,n.y]]):p=Vu(p,[["s",w,w]])}return{matrix:p}},m)}else s.setMatrix(u),this.emit("viewportchange",{action:"zoom",matrix:u}),this.autoPaint();return!v},e.prototype.zoomTo=function(r,n,a,i){var o=r/this.getZoom();return this.zoom(o,n,a,i)},e.prototype.focusItem=function(r,n,a){var i=this.get("viewController"),o=!1;n?o=!0:n===void 0&&(o=this.get("animate"));var s={};a?s=a:a===void 0&&(s=this.get("animateCfg")),i.focus(r,o,s),this.autoPaint()},e.prototype.focusItems=function(r,n,a,i){var o=this.get("viewController");o.focusItems(r,n,a,i)},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(r,n){var a=this.get("viewController");return a.getPointByClient(r,n)},e.prototype.getClientByPoint=function(r,n){var a=this.get("viewController");return a.getClientByPoint(r,n)},e.prototype.getPointByCanvas=function(r,n){var a=this.get("viewController");return a.getPointByCanvas(r,n)},e.prototype.getCanvasByPoint=function(r,n){var a=this.get("viewController");return a.getCanvasByPoint(r,n)},e.prototype.getGraphCenterPoint=function(){var r=this.get("group").getCanvasBBox();return{x:(r.minX+r.maxX)/2,y:(r.minY+r.maxY)/2}},e.prototype.getViewPortCenterPoint=function(){return this.getPointByCanvas(this.get("width")/2,this.get("height")/2)},e.prototype.showItem=function(r,n){n===void 0&&(n=!0);var a=this.get("itemController"),i=a.changeItemVisibility(r,!0);if(n&&this.get("enabledStack")){var o=i.getID(),s=i.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(r,n){n===void 0&&(n=!0);var a=this.get("itemController"),i=a.changeItemVisibility(r,!1);if(n&&this.get("enabledStack")){var o=i.getID(),s=i.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(r){var n=this.get("itemController");n.refreshItem(r)},e.prototype.setAutoPaint=function(r){var n=this;n.set("autoPaint",r);var a=n.get("canvas");a.set("autoDraw",r)},e.prototype.remove=function(r,n){n===void 0&&(n=!0),this.removeItem(r,n)},e.prototype.removeItem=function(r,n){n===void 0&&(n=!0);var a=r;if(Ye(r)&&(a=this.findById(r)),!a&&Ye(r))console.warn("The item ".concat(r," to be removed does not exist!"));else if(a){var i="";if(a.getType&&(i=a.getType()),n&&this.get("enabledStack")){var o=P(P({},a.getModel()),{itemType:i}),s={};switch(i){case"node":{s.nodes=[o],s.edges=[];for(var u=a.getEdges(),f=u.length-1;f>=0;f--)s.edges.push(P(P({},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(i==="node"){var l=a.getModel();l.comboId&&this.updateComboTree(a,void 0,!1)}var c=this.get("itemController");if(c.removeItem(a),i==="combo"){var h=I0(this.get("comboTrees"));this.set("comboTrees",h)}}},e.prototype.innerAddItem=function(r,n,a){if(!lz(r,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 i,o=this.get("comboTrees")||[];if(r==="combo"){var s=this.get("itemMap"),u=!1;if(o.forEach(function(v){u||Ra(v,function(p){if(n.parentId===p.id){u=!0;var g=P({id:n.id,depth:p.depth+2},n);p.children?p.children.push(g):p.children=[g],n.depth=g.depth,i=a.addItem(r,n)}var y=s[p.id];return u&&y&&y.getType&&y.getType()==="combo"&&a.updateCombo(y,p.children),!0})}),!u){var f=P({id:n.id,depth:0},n);n.depth=f.depth,o.push(f),i=a.addItem(r,n)}this.set("comboTrees",o),n.collapsed&&(this.collapseCombo(i,!1),this.updateCombo(i))}else if(r==="node"&&Ye(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.")),i=a.addItem(r,n);var c=this.get("itemMap"),h=!1,d=!1;o.forEach(function(v){d||h||Ra(v,function(p){if(p.id===n.id)return d=!0,!1;if(n.comboId===p.id&&!d){h=!0;var g=rr(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"&&a.updateCombo(c[p.id],p.children),!0})})}else i=a.addItem(r,n);if(r==="node"&&n.comboId||r==="combo"&&n.parentId){var l=this.findById(n.comboId||n.parentId);l&&l.getType&&l.getType()==="combo"&&l.addChild(i)}return i},e.prototype.addItem=function(r,n,a,i){a===void 0&&(a=!0),i===void 0&&(i=!0);var o=this.get("comboSorted");this.set("comboSorted",o&&!i);var s=this.get("itemController"),u=this.innerAddItem(r,n,s);if(u===!1||u===!0)return u;var f=this.get("combos");if(f&&f.length>0&&this.sortCombos(),this.autoPaint(),a&&this.get("enabledStack")){var l=P(P({},u.getModel()),{itemType:r}),c={};switch(r){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(r,n,a){r===void 0&&(r=[]),n===void 0&&(n=!0),a===void 0&&(a=!0);var i=this.get("comboSorted");this.set("comboSorted",i&&!a);for(var o=this.get("itemController"),s=[],u=0;u<r.length;u++){var f=r[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<r.length;u++){var f=r[u];(f.type==="edge"||f.type==="vedge")&&(s[u]=this.innerAddItem(f.type,f.model,o))}if(a){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<r.length;u++){var h=r[u].type,d=s[u];if(d&&d!==!0){var v=P(P({},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(r,n,a,i){return a===void 0&&(a=!0),i===void 0&&(i=!0),this.addItem(r,n,a,i)},e.prototype.updateItem=function(r,n,a){var i=this;a===void 0&&(a=!0);var o=this.get("itemController"),s;Ye(r)?s=this.findById(r):s=r;var u=a&&this.get("enabledStack"),f;u&&(f=rr(s.getModel()));var l="";s.getType&&(l=s.getType());var c=Xn([],s.getStates(),!0);if(l==="combo"&&_e(c,function(p){return i.setItemState(s,p,!1)}),o.updateItem(s,n),l==="combo"&&_e(c,function(p){return i.setItemState(s,p,!0)}),u){var h={nodes:[],edges:[],combos:[]},d={nodes:[],edges:[],combos:[]},v=P({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(r,n,a){a===void 0&&(a=!0),this.updateItem(r,n,a)},e.prototype.setItemState=function(r,n,a){Ye(r)&&(r=this.findById(r));var i=this.get("itemController");i.setItemState(r,n,a);var o=this.get("stateController");o.updateState(r,n,a)},e.prototype.priorityState=function(r,n){var a=this.get("itemController");a.priorityState(r,n)},e.prototype.data=function(r){Cw(r),this.set("data",r)},e.prototype.render=function(){var r=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 a=n.nodes,i=a===void 0?[]:a,o=n.edges,s=o===void 0?[]:o,u=n.combos,f=u===void 0?[]:u;if(this.clear(!0),this.emit("beforerender"),r.addItems(i.map(function(g){return{type:"node",model:g}}),!1,!1),(f==null?void 0:f.length)!==0){var l=T0(f,i);this.set("comboTrees",l),r.addCombos(f)}r.addItems(s.map(function(g){return{type:"edge",model:g}}),!1,!1);var c=r.get("animate");(r.get("fitView")||r.get("fitCenter"))&&r.set("animate",!1);var h=r.get("layoutController");if(h){if(h.layout(d),this.destroyed)return}else d();function d(){(r.get("comboTrees")||[]).forEach(function(g){Ra(g,function(y){var m=r.findById(y.id);return m.getType()==="combo"&&y.collapsed&&(r.collapseCombo(y.id,!1),r.updateCombo(m)),!0})}),r.get("fitView")?r.fitView():r.get("fitCenter")&&r.fitCenter(),r.autoPaint(),r.emit("afterrender"),(r.get("fitView")||r.get("fitCenter"))&&r.set("animate",c),setTimeout(function(){var g;(g=r.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(r){this.data(r),this.render()},e.prototype.diffItems=function(r,n,a){var i=this,o,s=this.get("itemMap");_e(a,function(u){if(o=s[u.id],o){if(i.get("animate")&&r===E8){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]})}i.updateItem(o,u,!1)}else o=i.addItem(r,u,!1);o&&n["".concat(r,"s")].push(o)})},e.prototype.changeData=function(r,n){var a=this,i;n===void 0&&(n=!0);var o=this,s=r||o.get("data");if(!Cw(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(w){return o.clearItemStates(w)}),this.getEdges().map(function(w){return o.clearItemStates(w)});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=T0(h,s.nodes);this.set("comboTrees",d)}else this.set("comboTrees",[]);this.diffItems("node",c,s.nodes),_e(l,function(w,x){l[x].getModel().depth=0,!(w.getType&&w.getType()==="edge")&&(w.getType&&w.getType()==="combo"?(delete l[x],w.destroy()):c.nodes.indexOf(w)<0&&(delete l[x],o.remove(w,!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),_e(l,function(w,x){w.getType&&(w.getType()==="node"||w.getType()==="combo")||c.edges.indexOf(w)<0&&(delete l[x],o.remove(w,!1))}),(this.get("comboTrees")||[]).forEach(function(w){Ra(w,function(x){var E=a.findById(x.id);return E.getType()==="combo"&&x.collapsed&&a.collapseCombo(x.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 w;(w=o.getCombos())===null||w===void 0||w.forEach(function(x){x.set("animate",!0)})},0)}),o.get("animate")&&!b.getLayoutType()?(o.positionsAnimate(),(i=o.getCombos())===null||i===void 0||i.forEach(function(w){return w.set("animate",!0)})):o.autoPaint()),setTimeout(function(){u.set("localRefresh",f)},16),this.set("data",s),this.emit("afterchangedata"),this},e.prototype.addCombos=function(r){var n=this,a=n.get("comboTrees"),i=this.get("itemController");i.addCombos(a,r)},e.prototype.createCombo=function(r,n,a){var i=this;a===void 0&&(a=!0);var o=this.get("itemController");this.set("comboSorted",!1);var s="",u;if(r){if(Ye(r))s=r,u={id:r};else{if(s=r.id,!s){console.warn("Create combo failed. Please assign a unique string id for the adding combo.");return}u=r}var f=a&&this.get("enabledStack"),l={nodes:[],combos:[]};f&&n.forEach(function(y){var m=i.findById(y),b=m.getType();if(!(b!=="node"&&b!=="combo")){var w=m.getModel();l["".concat(b,"s")].push({id:y,parentId:b==="node"?w.comboId:w.parentId})}});var c=this.get("comboTrees"),h=new Set(n),d=new Map;c&&(c.forEach(function(y){Ra(y,function(m,b,w){if(h.has(m.id)){if(b){var x=i.findById(b.id),E=i.findById(m.id);b.children.splice(w,1),x.removeChild(E),o.updateCombo(x,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=i.findById(y),b=m.getModel(),w="";m.getType&&(w=m.getType());var x=d.get(y)||{id:m.getID(),itemType:w};return w==="combo"?(x.parentId=s,b.parentId=s):w==="node"&&(x.comboId=s,b.comboId=s),f&&v["".concat(w,"s")].push({id:b.id,parentId:s}),x});u.children=p,this.addItem("combo",u,!1),this.set("comboSorted",!1),c&&(c.forEach(function(y){bn(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(r,n){var a=this,i,o;n===void 0&&(n=!0);var s=this,u=r;if(Ye(r)&&(u=this.findById(r)),!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=rr(f),b.children=[]),c.forEach(function(_){v||Ra(_,function(S){var A;if(S.id===d){v=S;var M=u.getEdges().map(function(k){return k.getID()});M.forEach(function(k){a.removeItem(k,!1)});var C=g.indexOf(u);g.splice(C,1),delete h[d];var I=rr(u.getModel());u.destroy(),a.emit("afterremoveitem",{item:I,type:"combo"})}if(l&&v&&S.id===l){y.removeCombo(u),p=S.children;var C=p.indexOf(v);return C!==-1&&p.splice(C,1),(A=v.children)===null||A===void 0||A.forEach(function(O){var B=a.findById(O.id),L=B.getModel();B.getType&&B.getType()==="combo"?(O.parentId=l,delete O.comboId,L.parentId=l,delete L.comboId):B.getType&&B.getType()==="node"&&(O.comboId=l,L.comboId=l),y.addChild(B),p.push(O)}),a.updateCombo(y),!1}return!0})}),!l&&v){var w=c.indexOf(v);c.splice(w,1),(i=v.children)===null||i===void 0||i.forEach(function(_){_.parentId=void 0;var S=a.findById(_.id).getModel();delete S.parentId,delete S.comboId,_.itemType!=="node"&&c.push(_)})}if(m){var x={nodes:[],combos:[]},E={nodes:[],combos:[]};(o=v.children)===null||o===void 0||o.forEach(function(_){var S=a.findById(_.id),A=S.getType();A!=="node"&&A!=="combo"||(x["".concat(A,"s")].push({id:_.id,parentId:d}),E["".concat(A,"s")].push({id:_.id,parentId:l}))}),x.combos.push(b),this.pushStack("uncombo",{before:x,after:E})}},e.prototype.updateCombos=function(r){var n=this;r===void 0&&(r=!1);var a=this,i=this.get("comboTrees"),o=a.get("itemController"),s=a.get("itemMap");(i||[]).forEach(function(u){Ra(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=Xn([],c.getStates(),!0);_e(h,function(d){return n.setItemState(c,d,!1)}),o.updateCombo(c,f.children,r),_e(h,function(d){return n.setItemState(c,d,!0)})}return!0})}),a.sortCombos()},e.prototype.updateCombo=function(r){var n=this,a=this,i=r,o;if(Ye(r)&&(i=this.findById(r)),!i||i.getType&&i.getType()!=="combo"){console.warn("The item to be updated is not a combo!");return}o=i.get("id");var s=this.get("comboTrees"),u=a.get("itemController"),f=a.get("itemMap");(s||[]).forEach(function(l){Ra(l,function(c){if(!c)return!0;var h=f[c.id];if(o===c.id&&h&&h.getType&&h.getType()==="combo"){var d=Xn([],h.getStates(),!0);_e(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!1)}),u.updateCombo(h,c.children),_e(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!0)}),o&&(o=c.parentId)}return!0})})},e.prototype.updateComboTree=function(r,n,a){a===void 0&&(a=!0);var i=this;this.set("comboSorted",!1);var o;Ye(r)?o=i.findById(r):o=r;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||bn(m,function(b){if(!h)return b.id===o.getID()&&(h=b),!0})}),bn(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(a&&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=I0(this.get("comboTrees"),s.id,n);this.set("comboTrees",y),this.updateCombos()},e.prototype.save=function(){var r=[],n=[],a=[];return _e(this.get("nodes"),function(i){r.push(i.getModel())}),_e(this.get("edges"),function(i){n.push(i.getModel())}),_e(this.get("combos"),function(i){a.push(i.getModel())}),{nodes:r,edges:n,combos:a}},e.prototype.changeSize=function(r,n){var a=this.get("viewController");return a.changeSize(r,n),this},e.prototype.refresh=function(){var r=this;if(r.emit("beforegraphrefresh"),r.get("animate"))r.positionsAnimate();else{var n=r.get("nodes"),a=r.get("edges"),i=r.get("edges");_e(n,function(o){o.refresh()}),_e(a,function(o){o.refresh()}),_e(i,function(o){o.refresh()})}r.emit("aftergraphrefresh"),r.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(r){if(Ye(r)&&(r=this.findById(r)),!r||r.getType&&r.getType()!=="combo"){console.warn("The combo does not exist!");return}return r.getChildren()},e.prototype.positionsAnimate=function(r){var n=this;n.emit("beforeanimate");var a=n.get("animateCfg"),i=a.onFrame,o=r?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){_e(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)),i){var p=i(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(r)},{duration:a.duration,easing:a.easing,callback:function(){_e(o,function(l){l.set("originAttrs",null)}),a.callback&&a.callback(),n.emit("afteranimate"),n.animating=!1}})},0)},e.prototype.refreshPositions=function(r){var n=this;n.emit("beforegraphrefreshposition");var a=n.get("nodes"),i=n.get("edges"),o=n.get("vedges"),s=n.get("combos"),u,f={},l=function(h){_e(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(a),s&&s.length!==0&&(r&&l(s),n.updateCombos()),_e(i,function(c){var h=c.getSource().getModel(),d=c.getTarget();if(!ln(d)){var v=d.getModel();(f[h.id]||f[v.id]||c.getModel().isComboEdge)&&c.refresh()}}),_e(o,function(c){c.refresh()}),n.emit("aftergraphrefreshposition"),n.autoPaint()},e.prototype.stopAnimate=function(){var r=this.get("canvas"),n=r.cfg.timeline;n&&n.stopAllAnimations()},e.prototype.isAnimating=function(){return this.animating},e.prototype.getZoom=function(){var r=this.get("group").getMatrix();return r?r[0]:1},e.prototype.getCurrentMode=function(){var r=this.get("modeController");return r.getMode()},e.prototype.setMode=function(r){var n=this.get("modeController");return n.setMode(r),this},e.prototype.clear=function(r){var n;return r===void 0&&(r=!1),(n=this.get("canvas"))===null||n===void 0||n.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],vedges:[],groups:[],combos:[],comboTrees:[]}),r||this.emit("afterrender"),this},e.prototype.updateLayout=function(r,n,a,i){var o=this;r===void 0&&(r={}),i===void 0&&(i=!0);var s=this.get("layoutController");if(Ye(r)&&(r={type:r}),n){var u=a;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(r.type)||!r.type&&f.includes(s==null?void 0:s.layoutType)?r.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=P({},this.get("layout")),c={};Object.assign(c,l,r),r.pipes&&!r.type?delete c.type:!r.pipes&&c.type&&delete c.pipes,this.set("layout",c),s&&(s.isLayoutTypeSame(c)&&c.gpuEnabled===l.gpuEnabled?s.updateLayoutCfg(c):s.changeLayout(c),i&&this.get("enabledStack")&&this.pushStack("layout",{before:l,after:c}))},e.prototype.destroyLayout=function(){var r=this.get("layoutController");r==null||r.destroyLayout()},e.prototype.layout=function(){var r,n=this.get("layoutController"),a=this.get("layout");if(!(!a||!n)){if(a.workerEnabled){n.layout();return}!((r=n.layoutMethods)===null||r===void 0)&&r.length?n.relayout(!0):n.layout()}},e.prototype.collapseCombo=function(r,n){var a=this;if(n===void 0&&(n=!0),!this.destroyed){if(Ye(r)&&(r=this.findById(r)),!r){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"collapse",item:r});var i=r.getModel(),o=this.get("itemController");o.collapseCombo(r,n),i.collapsed=!0;var s=this.getEdges().concat(this.get("vedges")),u=[],f=this.get("comboTrees"),l=!1;(f||[]).forEach(function(h){l||bn(h,function(d){if(l&&d.depth<=i.depth)return!1;if(i.id===d.id&&(l=!0),l){var v=a.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,w;if(y.getModel().id===i.id||u.includes(y)&&!u.includes(m)?(b=m,w=!1):(m.getModel().id===i.id||!u.includes(y)&&u.includes(m))&&(b=y,w=!0),b){if(v){a.removeItem(h,!1);return}for(var x=b.getModel();!b.isVisible();){var E=x.parentId,_=x.comboId,S=E||_;if(b=a.findById(S),!b||!S)return;x=b.getModel()}var A=x.id,M=w?{source:A,target:i.id,size:g,isVEdge:!0}:{source:i.id,target:A,size:g,isVEdge:!0},C="".concat(M.source,"-").concat(M.target);if(c[C]){c[C].size+=g;return}c[C]=M}}}),this.addItems(Object.values(c).map(function(h){return{type:"vedge",model:h}}),!1),this.emit("aftercollapseexpandcombo",{action:"collapse",item:r})}},e.prototype.expandCombo=function(r,n){var a=this;if(n===void 0&&(n=!0),Ye(r)&&(r=this.findById(r)),!r||r.getType&&r.getType()!=="combo"){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"expand",item:r});var i=r.getModel(),o=this.get("itemController");o.expandCombo(r,n),i.collapsed=!1;var s=this.getEdges().concat(this.get("vedges")),u=[],f=this.get("comboTrees"),l=!1;(f||[]).forEach(function(h){l||bn(h,function(d){if(l&&d.depth<=i.depth)return!1;if(i.id===d.id&&(l=!0),l){var v=a.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===i.id||u.includes(d)&&!u.includes(v)?(y=v,m=!1):g===i.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(),w=b.isVEdge,x=b.size,E=x===void 0?1:x;if(w){a.removeItem(h,!1);return}for(var _=y.getModel();!y.isVisible();){var S=_.parentId,A=_.comboId,M=S||A;if(y=a.findById(M),!y||!M)return;_=y.getModel()}for(var C=_.id,I=m?v:d,k=I.getModel();!I.isVisible();){var O=k.parentId,B=k.comboId,L=O||B;if(I=a.findById(L),!I||!L)return;if(k.comboId===i.id||k.parentId===i.id)break;k=I.getModel()}var z=k.id;if(C){var X=m?{source:C,target:z,isVEdge:!0,size:E}:{source:z,target:C,isVEdge:!0,size:E},R="".concat(X.source,"-").concat(X.target);if(c[R]){c[R].size+=E;return}c[R]=X}}}}),this.addItems(Object.values(c).map(function(h){return{type:"vedge",model:h}}),!1),this.emit("aftercollapseexpandcombo",{action:"expand",item:r})},e.prototype.collapseExpandCombo=function(r,n){if(n===void 0&&(n=!0),Ye(r)&&(r=this.findById(r)),!(!r||r.getType&&r.getType()!=="combo")){for(var a=r.getModel(),i=this.findById(a.parentId);i;){var o=i.getModel();if(o.collapsed){console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),i=void 0;return}i=this.findById(o.parentId)}var s=a.collapsed;s?this.expandCombo(r,n):this.collapseCombo(r,n),this.updateCombo(r)}},e.prototype.getNeighbors=function(r,n){var a=r;return Ye(r)&&(a=this.findById(r)),a.getNeighbors(n)},e.prototype.getNodeDegree=function(r,n,a){n===void 0&&(n=void 0),a===void 0&&(a=!1);var i=r;Ye(r)&&(i=this.findById(r));var o=this.get("degrees");(!o||a)&&(o=yi(this.save()),this.set("degrees",o));var s=o[i.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(r,n,a){if(r===void 0&&(r="update"),a===void 0&&(a="undo"),!this.get("enabledStack")){console.warn("请先启用 undo & redo 功能,在实例化 Graph 时候配置 enabledStack: true !");return}var i=n?rr(n):{before:{},after:rr(this.save())};a==="redo"?this.redoStack.push({action:r,data:i}):this.undoStack.push({action:r,data:i}),this.emit("stackchange",{action:r,stackType:a,undoStack:this.undoStack,redoStack:this.redoStack})},e.prototype.getAdjMatrix=function(r,n){r===void 0&&(r=!0),n===void 0&&(n=this.get("directed"));var a=this.get("adjMatrix");return(!a||!r)&&(a=Uo(this.save(),n),this.set("adjMatrix",a)),a},e.prototype.getShortestPathMatrix=function(r,n){r===void 0&&(r=!0),n===void 0&&(n=this.get("directed"));var a=this.get("adjMatrix"),i=this.get("shortestPathMatrix");return(!a||!r)&&(a=Uo(this.save(),n),this.set("adjMatrix",a)),(!i||!r)&&(i=Of(this.save(),n),this.set("shortestPathMatrix",i)),i},e.prototype.on=function(r,n,a){return t.prototype.on.call(this,r,n,a)},e.prototype.destroy=function(){var r,n,a,i,o;this.emit("beforedestroy"),this.clear(),this.clearStack(),(r=this.get("itemController"))===null||r===void 0||r.destroy(),(n=this.get("modeController"))===null||n===void 0||n.destroy(),(a=this.get("viewController"))===null||a===void 0||a.destroy(),(i=this.get("stateController"))===null||i===void 0||i.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(r){if(!r.members||r.members.length<1){console.warn("Create hull failed! The members is empty.");return}var n=this.get("hullGroup"),a=this.get("hullMap");if(a||(a={},this.set("hullMap",a)),(!n||n.get("destroyed"))&&(n=this.get("group").addGroup({id:"hullGroup"}),n.toBack(),this.set("hullGroup",n)),a[r.id])return console.warn("Existed hull id."),a[r.id];var i=n.addGroup({id:"".concat(r.id,"-container")}),o=new x8(this,P(P({},r),{group:i})),s=o.id;return a[s]=o,o},e.prototype.getHulls=function(){return this.get("hullMap")},e.prototype.getHullById=function(r){return this.get("hullMap")[r]},e.prototype.removeHull=function(r){var n,a;Ye(r)?a=this.getHullById(r):a=r,(n=this.get("hullMap"))===null||n===void 0||delete n[a.id],a.destroy()},e.prototype.removeHulls=function(){var r=this.getHulls();!r||!Object.keys(r).length||(Object.keys(r).forEach(function(n){var a=r[n];a.destroy()}),this.set("hullMap",{}))},e}(KS);function J0(t){"@babel/helpers - typeof";return J0=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},J0(t)}var ws=eo,Rx="-shape",Ep="-label",bc=["startArrow","endArrow"],Fx={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},S8={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},wc={edge:S8,node:Fx,combo:Fx},eg="-label-bg",Uy={options:{labelCfg:{style:{fontFamily:ft.windowFontFamily}},descriptionCfg:{style:{fontFamily:ft.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(e){return{}},getOptions:function(e,r){return r==="move"||r!=null&&r.includes("bbox")?e:_r({},this.options,this.getCustomConfig(e)||{},e)},draw:function(e,r){r.shapeMap={},this.mergeStyle=this.getOptions(e);var n=this.drawShape(e,r);if(n.set("className",this.itemType+Rx),r.shapeMap[this.itemType+Rx]=n,e.label){var a=this.drawLabel(e,r);a.set("className",this.itemType+Ep),r.shapeMap[this.itemType+Ep]=a}return n},afterDraw:function(e,r,n){},drawShape:function(e,r){return null},drawLabel:function(e,r){var n=(this.mergeStyle||this.getOptions(e)||{}).labelCfg,a=n||{},i=this.getLabelStyle(e,a,r),o=i.rotate;delete i.rotate;var s=r.addShape("text",{attrs:i,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(r.shapeMap["text-shape"]=s,!isNaN(o)&&o!==""){var u=s.getBBox(),f=[1,0,0,0,1,0,0,0,1];if(i.rotateCenter)switch(i.rotateCenter){case"center":f=ws(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break;case"lefttop":f=ws(f,[["t",-i.x,-i.y],["r",o],["t",i.x,i.y]]);break;case"leftcenter":f=ws(f,[["t",-i.x,-i.y-u.height/2],["r",o],["t",i.x,i.y+u.height/2]]);break;default:f=ws(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break}else f=ws(f,[["t",-i.x,-i.y-u.height/2],["r",o],["t",i.x,i.y+u.height/2]]);s.setMatrix(f)}if(i.background){var l=this.drawLabelBg(e,r,s),c=this.itemType+eg;l.set("classname",c),r.shapeMap[c]=l,s.toFront()}return s},drawLabelBg:function(e,r,n){var a=this.options.labelCfg,i=Et({},a,e.labelCfg),o=this.getLabelBgStyleByPosition(n,i),s=r.addShape("rect",{name:"text-bg-shape",attrs:o,labelRelated:!0});return r.shapeMap["text-bg-shape"]=s,s},getLabelStyleByPosition:function(e,r,n){return{text:e.label}},getLabelBgStyleByPosition:function(e,r){return{}},getLabelStyle:function(e,r,n){var a=this.getLabelStyleByPosition(e,r,n),i="".concat(this.itemType,"Label"),o=ft[i]?ft[i].style:null;return P(P(P({},o),a),r.style)},getShapeStyle:function(e){return e.style},update:function(e,r,n){this.updateShapeStyle(e,r,n),this.updateLabel(e,r,n)},updateShapeStyle:function(e,r,n){var a,i=r.getContainer(),o=r.getKeyShape(),s=Et({},o.attr(),e.style),u=function(c){var h,d=s[c];if(ln(d)){var v=((a=i.shapeMap)===null||a===void 0?void 0:a[c])||i.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,r,n){var a,i,o=r.getContainer(),s=(this.mergeStyle||this.getOptions({},n)||{}).labelCfg,u=s===void 0?{}:s,f=this.itemType+Ep,l=o.shapeMap[f]||o.find(function(w){return w.get("className")===f}),c=this.itemType+eg,h=o.shapeMap[c]||o.find(function(w){return w.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=_r(u,e.labelCfg));var v=this.getLabelStyleByPosition(e,u,o),p=(a=e.labelCfg)===null||a===void 0?void 0:a.style,g=P(P({},v),p),y=g.rotate;if(delete g.rotate,!isNaN(y)&&y!==""){var m=[1,0,0,0,1,0,0,0,1];m=ws(m,[["t",-g.x,-g.y],["r",y],["t",g.x,g.y]]),g.matrix=m,l.attr(g)}else((i=l.getMatrix())===null||i===void 0?void 0:i[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,r){},setState:function(e,r,n){var a,i,o,s=n.get("keyShape");if(!(!s||s.destroyed)){var u=n.getType(),f=Qf(r)?e:"".concat(e,":").concat(r),l=this.getStateStyle(f,n),c=n.getStateStyle(f);if(!(!c&&!l)){var h=Et({},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),r){var p=function(L){var z,X=h[L];if(ln(X)&&!bc.includes(L)){var R=((o=d.shapeMap)===null||o===void 0?void 0:o[L])||d.find(function(V){return V.get("name")===L});R==null||R.attr(X)}else s.attr((z={},z[L]=X,z))};for(var g in h)p(g)}else{var y=sh(n.getCurrentStatesStyle()),m=n.getModel(),b=Et({},m.style,sh(n.getOriginStyle())),w=s.get("name"),x=s.attr(),E={};Object.keys(x).forEach(function(B){if(B!=="img"){var L=x[B];L&&J0(L)==="object"?E[B]=rr(L):E[B]=L}});var _={},S=function(L){var z=h[L];if(ln(z)&&!bc.includes(L)){var X=d.shapeMap[L]||d.find(function(he){return he.get("name")===L});if(X){var R=sh(X.attr());_e(z,function(he,ce){if(L===w&&E[ce]&&!v[ce]){delete E[ce];var le=b[L][ce]||wc[u][ce];s.attr(ce,le)}else if(R[ce]||R[ce]===0){delete R[ce];var ie=b[L][ce]||wc[u][ce];X.attr(ce,ie)}}),_[L]=R}}else if(E[L]&&!v[L]){delete E[L];var V=b[L]||(b[w]?b[w][L]:void 0)||wc[u][L];s.attr(L,V)}};for(var A in h)S(A);w?_[w]=E:Et(_,E);for(var g in y)if(!v[g]){var M=y[g];(!ln(M)||bc.includes(g))&&(w?(Et(b[w],(i={},i[g]=M,i)),delete b[g]):Et(b,(a={},a[g]=M,a)),delete y[g])}var C={};_r(C,b,_,y);var I=!1,k=function(L){var z,X,R=C[L];if(ln(R)&&!bc.includes(L)){var V=d.shapeMap[L]||d.find(function(ce){return ce.get("name")===L});V&&((V.get("type")==="text"||V.get("labelRelated"))&&(delete R.x,delete R.y,delete R.matrix),L===w&&(u==="combo"&&(delete R.r,delete R.width,delete R.height),I=!0),V.attr(R))}else if(!I){var he=R||wc[u][L];u==="combo"?w||s.attr((z={},z[L]=he,z)):s.attr((X={},X[L]=he,X))}};for(var O in C)k(O)}}}},getStateStyle:function(e,r){var n=r.getModel(),a=r.getType(),i=this.getOptions(n),o=i.stateStyles,s=i.style,u=s===void 0?{}:s,f=n.stateStyles?n.stateStyles[e]:o&&o[e];return a==="combo"?rr(f):Et({},u,f)},getControlPoints:function(e){return e.controlPoints},getAnchorPoints:function(e){var r,n,a=(e==null?void 0:e.anchorPoints)||((r=this.getCustomConfig(e))===null||r===void 0?void 0:r.anchorPoints)||((n=this.options)===null||n===void 0?void 0:n.anchorPoints);return a}},M8={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:ft.nodeLabel.offset,getSize:function(e){var r,n=((r=this.mergeStyle)===null||r===void 0?void 0:r.size)||e.size||this.getOptions({}).size||ft.defaultNode.size;return bt(n)&&n.length===1&&(n=[n[0],n[0]]),bt(n)||(n=[n,n]),n},getLabelStyleByPosition:function(e,r){var n=r.maxLength,a=e.label;n&&(a=YA(a,n));var i=r.position||this.labelPosition;if(i==="center")return{x:0,y:0,text:a,textBaseline:"middle",textAlign:"center"};var o=r.offset;Zt(o)&&(o=this.offset);var s=this.getSize(e),u;switch(i){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=a,u},getLabelBgStyleByPosition:function(e,r){var n;if(!e)return{};var a=(n=r.style)===null||n===void 0?void 0:n.background;if(!a)return{};var i=e.getBBox(),o=jy(a.padding),s=i.width+o[1]+o[3],u=i.height+o[0]+o[2];return P(P({x:i.minX-o[3],y:i.minY-o[0]},a),{width:s,height:u})},drawShape:function(e,r){var n=this.shapeType,a=this.getShapeStyle(e),i=r.addShape(n,{attrs:a,draggable:!0,name:"node-shape"});return r.shapeMap["node-shape"]=i,i},updateLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,a=r.shapeMap["link-point-left"]||r.find(function(C){return C.get("className")==="link-point-left"}),i=r.shapeMap["link-point-right"]||r.find(function(C){return C.get("className")==="link-point-right"}),o=r.shapeMap["link-point-top"]||r.find(function(C){return C.get("className")==="link-point-top"}),s=r.shapeMap["link-point-bottom"]||r.find(function(C){return C.get("className")==="link-point-bottom"}),u;a&&(u=a.attr()),i&&!u&&(u=i.attr()),o&&!u&&(u=o.attr()),s&&!u&&(u=s.attr()),u||(u=n);var f=Et({},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),w=b[0],x=b[1],E={r:d,fill:l,stroke:c,lineWidth:h};if(a)!p&&p!==void 0?(a.remove(),delete r.shapeMap["link-point-left"]):a.attr(P(P({},E),{x:-w/2,y:0}));else if(p){var _="link-point-left";r.shapeMap[_]=r.addShape("circle",{attrs:P(P({},E),{x:-w/2,y:0}),className:_,name:_,isAnchorPoint:!0})}if(i)!g&&g!==void 0&&(i.remove(),delete r.shapeMap["link-point-right"]),i.attr(P(P({},E),{x:w/2,y:0}));else if(g){var S="link-point-right";r.shapeMap[S]=r.addShape("circle",{attrs:P(P({},E),{x:w/2,y:0}),className:S,name:S,isAnchorPoint:!0})}if(o)!y&&y!==void 0&&(o.remove(),delete r.shapeMap["link-point-top"]),o.attr(P(P({},E),{x:0,y:-x/2}));else if(y){var A="link-point-top";r.shapeMap[A]=r.addShape("circle",{attrs:P(P({},E),{x:0,y:-x/2}),className:A,name:A,isAnchorPoint:!0})}if(s)!m&&m!==void 0?(s.remove(),delete r.shapeMap["link-point-bottom"]):s.attr(P(P({},E),{x:0,y:x/2}));else if(m){var M="link-point-bottom";r.shapeMap[M]=r.addShape("circle",{attrs:P(P({},E),{x:0,y:x/2}),className:M,name:M,isAnchorPoint:!0})}},updateShape:function(e,r,n,a,i){var o=r.get("keyShape");o.attr(P({},n)),this.updateLabel(e,r,i),a&&this.updateIcon(e,r)},updateIcon:function(e,r){var n=this,a=r.getContainer(),i=(this.mergeStyle||this.getOptions(e)).icon,o=e.icon?e.icon:{show:void 0,text:void 0},s=o.show,u=o.text,f=a.shapeMap["".concat(this.type,"-icon")]||a.find(function(y){return y.get("name")==="".concat(n.type,"-icon")});if(f)if(s||s===void 0){var l=Et({},f.attr(),i),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(P(P({},l),{x:-h/2,y:-v/2}))}else f.remove(),delete a.shapeMap["".concat(this.type,"-icon")];else if(s){var p="".concat(this.type,"-icon");if(u)a.shapeMap[p]=a.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:p,name:p});else{var h=i.width,v=i.height;a.shapeMap[p]=a.addShape("image",{attrs:P(P({},i),{x:-h/2,y:-v/2}),className:p,name:p})}var g=a.shapeMap["node-label"]||a.find(function(y){return y.get("name")==="node-label"});g&&g.toFront()}}},A8=P(P({},Uy),M8);mr.registerNode("single-node",A8);var xc="edge-shape";function C8(t){var e=t;return t==="start"?e="end":t==="end"&&(e="start"),e}var T8={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:ft.defaultEdge.size,style:{x:0,y:0,stroke:ft.defaultEdge.style.stroke,lineAppendWidth:ft.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:ft.edgeLabel.style.fill,fontSize:ft.edgeLabel.style.fontSize,fontFamily:ft.windowFontFamily}},stateStyles:P({},ft.edgeStateStyles)},getPath:function(e){var r=[];return _e(e,function(n,a){a===0?r.push(["M",n.x,n.y]):r.push(["L",n.x,n.y])}),r},getShapeStyle:function(e){var r=this.options.style,n={stroke:e.color},a=Et({},r,n,e.style),i=e.size||ft.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=Et({},ft.defaultEdge.style,{stroke:ft.defaultEdge.color,lineWidth:i,path:l},a);return c},updateShapeStyle:function(e,r,n){var a,i=r.getContainer(),o=((a=r.getKeyShape)===null||a===void 0?void 0:a.call(r))||i.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=P({},e.style),m.lineWidth===void 0&&(m.lineWidth=(Ot(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,r,n){var a=r.position||this.labelPosition,i={},o=n==null?void 0:n.shapeMap[xc],s;a==="start"?s=0:a==="end"?s=1:s=.5;var u=r.refX||this.refX,f=r.refY||this.refY;if(e.startPoint.x===e.endPoint.x&&e.startPoint.y===e.endPoint.y)return i.x=e.startPoint.x+u,i.y=e.startPoint.y+f,i.text=e.label,i;var l;Zt(r.autoRotate)?l=this.labelAutoRotate:l=r.autoRotate;var c=XA(o,s,u,f,l);return i.x=c.x,i.y=c.y,i.rotate=c.rotate,i.textAlign=this._getTextAlign(a,c.angle),i.text=e.label,i},getLabelBgStyleByPosition:function(e,r){if(!e)return{};var n=e.getBBox(),a=r.style&&r.style.background;if(!a)return{};var i=a.padding,o=n.width+i[1]+i[3],s=n.height+i[0]+i[2],u=P(P({},a),{width:o,height:s,x:n.minX-i[3],y:n.minY-i[0],matrix:[1,0,0,0,1,0,0,0,1]}),f;return Zt(r.autoRotate)?f=this.labelAutoRotate:f=r.autoRotate,f&&(u.matrix=e.attr("matrix")||[1,0,0,0,1,0,0,0,1]),u},_getTextAlign:function(e,r){var n="center";return r?(r=r%(Math.PI*2),e!=="center"&&(r>=0&&r<=Math.PI/2||r>=3/2*Math.PI&&r<2*Math.PI?n=e:n=C8(e)),n):e},getControlPoints:function(e){return e.controlPoints},getPathPoints:function(e){return e},drawShape:function(e,r){var n=this.getShapeStyle(e),a=r.addShape("path",{className:xc,name:xc,attrs:n});return r.shapeMap[xc]=a,a},drawLabel:function(e,r){var n=this.options.labelCfg,a=_r({},n,e.labelCfg),i=this.getLabelStyle(e,a,r),o=i.rotate;delete i.rotate;var s=r.addShape("text",{attrs:i,name:"text-shape",labelRelated:!0,draggable:!0});if(r.shapeMap["text-shape"]=s,!isNaN(o)&&o!==""&&s.rotateAtStart(o),i.background){var u=this.drawLabelBg(e,r,s,i,o),f=this.itemType+eg;u.set("classname",f),r.shapeMap[f]=u,s.toFront()}return s},drawLabelBg:function(e,r,n,a,i){var o=this.options.labelCfg,s=_r({},o,e.labelCfg),u=this.getLabelBgStyleByPosition(n,s),f=r.addShape("rect",{name:"text-bg-shape",attrs:u,labelRelated:!0});return r.shapeMap["text-bg-shape"]=f,f}},I8=P(P({},Uy),T8);mr.registerEdge("single-edge",I8);mr.registerEdge("line",{getControlPoints:function(){}},"single-edge");mr.registerEdge("spline",{getPath:function(e){var r=qC(e);return r}},"single-edge");mr.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(e){var r=e.startPoint,n=e.endPoint,a={x:(r.x+n.x)/2,y:(r.y+n.y)/2},i,o;if(e.controlPoints!==void 0){if(o=e.controlPoints[0],i=E0(r,o,n),r.x<=n.x&&r.y>n.y?this.clockwise=i.x>o.x?0:1:r.x<=n.x&&r.y<n.y?this.clockwise=i.x>o.x?1:0:r.x>n.x&&r.y<=n.y?this.clockwise=i.y<o.y?0:1:this.clockwise=i.y<o.y?1:0,(o.x-r.x)/(o.y-r.y)===(n.x-r.x)/(n.y-r.y))return[]}else{e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),bt(e.curveOffset)&&(e.curveOffset=e.curveOffset[0]),e.curveOffset<0?this.clockwise=0:this.clockwise=1;var s={x:n.x-r.x,y:n.y-r.y},u=Math.atan2(s.y,s.x);o={x:e.curveOffset*Math.cos(-Math.PI/2+u)+a.x,y:e.curveOffset*Math.sin(-Math.PI/2+u)+a.y},i=E0(r,o,n)}var f=Oh(r,i),l=[{x:f,y:f}];return l},getPath:function(e){var r=[];return r.push(["M",e[0].x,e[0].y]),e.length===2?r.push(["L",e[1].x,e[1].y]):r.push(["A",e[1].x,e[1].y,0,0,this.clockwise,e[2].x,e[2].y]),r}},"single-edge");mr.registerEdge("quadratic",{curvePosition:.5,curveOffset:-20,getControlPoints:function(e){var r=e.controlPoints;if(!r||!r.length){var n=e.startPoint,a=e.endPoint;e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),bt(e.curveOffset)&&(e.curveOffset=e.curveOffset[0]),bt(e.curvePosition)&&(e.curvePosition=e.curveOffset[0]);var i=zh(n,a,e.curvePosition,e.curveOffset);r=[i]}return r},getPath:function(e){var r=[];return r.push(["M",e[0].x,e[0].y]),r.push(["Q",e[1].x,e[1].y,e[2].x,e[2].y]),r}},"single-edge");mr.registerEdge("cubic",{curvePosition:[1/2,1/2],curveOffset:[-20,20],getControlPoints:function(e){var r=e.controlPoints;if(e.curveOffset===void 0&&(e.curveOffset=this.curveOffset),e.curvePosition===void 0&&(e.curvePosition=this.curvePosition),Ot(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),Ot(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]),!r||!r.length||r.length<2){var n=e.startPoint,a=e.endPoint,i=zh(n,a,e.curvePosition[0],e.curveOffset[0]),o=zh(n,a,e.curvePosition[1],e.curveOffset[1]);r=[i,o]}return r},getPath:function(e){var r=[];return r.push(["M",e[0].x,e[0].y]),r.push(["C",e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y]),r}},"single-edge");mr.registerEdge("cubic-vertical",{curvePosition:[1/2,1/2],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(e){var r=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),Ot(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),Ot(e.minCurveOffset)&&(e.minCurveOffset=[e.minCurveOffset,-e.minCurveOffset]),Ot(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]);var a=n.y-r.y,i=[0,0];e.curveOffset?i=e.curveOffset:Math.abs(a)<Math.abs(e.minCurveOffset[0])&&(i=e.minCurveOffset);var o={x:r.x,y:r.y+a*this.curvePosition[0]+i[0]},s={x:n.x,y:n.y-a*this.curvePosition[1]+i[1]};return[o,s]}},"cubic");mr.registerEdge("cubic-horizontal",{curvePosition:[1/2,1/2],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(e){var r=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),Ot(e.curveOffset)&&(e.curveOffset=[e.curveOffset,-e.curveOffset]),Ot(e.minCurveOffset)&&(e.minCurveOffset=[e.minCurveOffset,-e.minCurveOffset]),Ot(e.curvePosition)&&(e.curvePosition=[e.curvePosition,1-e.curvePosition]);var a=n.x-r.x,i=[0,0];e.curveOffset?i=e.curveOffset:Math.abs(a)<Math.abs(e.minCurveOffset[0])&&(i=e.minCurveOffset);var o={x:r.x+a*this.curvePosition[0]+i[0],y:r.y},s={x:n.x-a*this.curvePosition[1]+i[1],y:n.y},u=[o,s];return u}},"cubic");mr.registerEdge("loop",{getPathPoints:function(e){return $A(e)},getControlPoints:function(e){return e.controlPoints},afterDraw:function(e){e.controlPoints=void 0},afterUpdate:function(e){e.controlPoints=void 0}},"cubic");var k8={itemType:"combo",shapeType:"single-combo",labelPosition:"top",refX:ft.comboLabel.refX,refY:ft.comboLabel.refY,options:{style:{stroke:ft.defaultCombo.style.stroke,fill:ft.defaultCombo.style.fill,lineWidth:ft.defaultCombo.style.lineWidth},labelCfg:{style:{fill:ft.comboLabel.style.fill,fontSize:ft.comboLabel.style.fontSize,fontFamily:ft.windowFontFamily}},stateStyles:P({},ft.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},getSize:function(e){var r=rr(e.size||this.options.size||ft.defaultCombo.size);return bt(r)&&r.length===1&&(r=[r[0],r[0]]),bt(r)||(r=[r,r]),r},getLabelStyleByPosition:function(e,r){var n=r.position||this.labelPosition,a=e.style,i=e.padding||this.options.padding;bt(i)&&(i=Math.max.apply(Math,i));var o=r.refX,s=r.refY;Zt(o)&&(o=this.refX),Zt(s)&&(s=this.refY);var u=this.getSize(e),f=Math.max(a.r,u[0]/2)||u[0]/2,l=f+i,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,r){var n=this.shapeType,a=this.getShapeStyle(e),i=r.addShape(n,{attrs:a,draggable:!0,name:"combo-shape"});return i},updateCollapsedIcon:function(e,r,n){var a=e.collapsed,i=e.collapsedSubstituteIcon,o=i===void 0?{}:i,s=Object.assign({},this.options.collapsedSubstituteIcon,o),u=s.show,f=s.img,l=s.width,c=s.height,h=r.getContainer(),d=h.find(function(y){return y.get("name")==="combo-collapsed-substitute-icon"}),v=d&&!d.destroyed,p=r.get("keyShape");if(a&&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:P({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,r,n){var a=this,i=r.get("keyShape"),o=r.get("animate"),s=o&&(e.animate===void 0?this.options.animate:e.animate);s&&i.animate?(e.collapsed||this.updateCollapsedIcon(e,r,n),i.animate(n,{duration:200,easing:"easeLinear",callback:function(){e.collapsed&&a.updateCollapsedIcon(e,r,n)}})):(i.attr(P({},n)),this.updateCollapsedIcon(e,r,n)),this.updateLabel(e,r)}},N8=P(P({},Uy),k8);mr.registerCombo("single-combo",N8);mr.registerCombo("circle",{options:{size:[ft.defaultCombo.size[0],ft.defaultCombo.size[0]],padding:Math.max.apply(Math,ft.defaultCombo.padding),animate:!0,style:{stroke:ft.defaultCombo.style.stroke,fill:ft.defaultCombo.style.fill,lineWidth:ft.defaultCombo.style.lineWidth},labelCfg:{style:{fill:ft.comboLabel.style.fill,fontSize:ft.comboLabel.style.fontSize},refX:0,refY:0},stateStyles:P({},ft.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},shapeType:"circle",labelPosition:"top",drawShape:function(e,r){var n=this.getShapeStyle(e);delete n.height,delete n.width;var a=r.addShape("circle",{attrs:n,className:"circle-combo",name:"circle-combo",draggable:!0});return a},getShapeStyle:function(e){var r=this.options.style,n=e.padding||this.options.padding;bt(n)&&(n=Math.max.apply(Math,n));var a={stroke:e.color},i=Et({},r,a,e.style),o=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize,s;if(o)s=Ot(o)?o/2:o[0]/2;else{var u=this.getSize(e);!Ot(i.r)||isNaN(i.r)?s=u[0]/2||ft.defaultCombo.style.r:s=Math.max(i.r,u[0]/2)||u[0]/2}i.r=s+n;var f=P({x:0,y:0},i);return e.style?e.style.r=s:e.style={r:s},f},update:function(e,r){var n=this.getSize(e),a=e.padding||this.options.padding;bt(a)&&(a=Math.max.apply(Math,a));var i=rr(e.style),o=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize,s;o?s=Ot(o)?o/2:o[0]/2:s=Math.max(i.r,n[0]/2)||n[0]/2,i.r=s+a;var u=r.get("sizeCache");u&&(u.r=i.r);var f={stroke:e.color},l=r.get("keyShape"),c=Et({},l.attr(),f,i);e.style?e.style.r=s:e.style={r:s},this.updateShape(e,r,c,!0)}},"single-combo");mr.registerCombo("rect",{options:{size:[40,5],padding:[25,20,15,20],animate:!0,style:{radius:0,stroke:ft.defaultCombo.style.stroke,fill:ft.defaultCombo.style.fill,lineWidth:ft.defaultCombo.style.lineWidth},labelCfg:{style:{fill:ft.comboLabel.style.fill,fontSize:ft.comboLabel.style.fontSize,fontFamily:ft.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:P({},ft.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},shapeType:"rect",labelPosition:"top",drawShape:function(e,r){var n=this.getShapeStyle(e),a=r.addShape("rect",{attrs:n,className:"rect-combo",name:"rect-combo",draggable:!0});return a},getLabelStyleByPosition:function(e,r){var n=r.position||this.labelPosition,a=e.style,i=e.padding||this.options.padding;Ot(i)&&(i=[i,i,i,i]);var o=r.refX,s=r.refY;Zt(o)&&(o=this.refX),Zt(s)&&(s=this.refY);var u=-a.width/2-i[3],f=a.width/2+i[1],l=-a.height/2-i[0],c=a.height/2+i[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 r=this.options.style,n=e.padding||this.options.padding;Ot(n)&&(n=[n,n,n,n]);var a={stroke:e.color},i=Et({},r,a,e.style),o=this.getSize(e),s,u,f=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize;f?Ot(f)?(s=f,u=f):(s=f[0],u=f[1]):(!Ot(i.width)||isNaN(i.width)?s=o[0]||ft.defaultCombo.style.width:s=Math.max(i.width,o[0])||o[0],!Ot(i.height)||isNaN(i.height)?u=o[1]||ft.defaultCombo.style.height:u=Math.max(i.height,o[1])||o[1]);var l=-s/2-n[3],c=-u/2-n[0];i.width=s+n[1]+n[3],i.height=u+n[0]+n[2];var h=P({x:l,y:c},i);return e.style?(e.style.width=s,e.style.height=u):e.style={width:s,height:u},h},update:function(e,r){var n=this.getSize(e),a=e.padding||this.options.padding;Ot(a)&&(a=[a,a,a,a]);var i=rr(e.style),o,s,u=e.collapsed&&e.fixCollapseSize?e.fixCollapseSize:e.fixSize;u?Ot(u)?(o=u,s=u):(o=u[0],s=u[1]):(o=Math.max(i.width,n[0])||n[0],s=Math.max(i.height,n[1])||n[1]),i.width=o+a[1]+a[3],i.height=s+a[0]+a[2];var f=r.get("sizeCache");f&&(f.width=i.width,f.height=i.height),i.x=-o/2-a[3],i.y=-s/2-a[0];var l={stroke:e.color},c=r.get("keyShape"),h=Et({},c.attr(),l,i);e.style?(e.style.width=o,e.style.height=s):e.style={width:o,height:s},this.updateShape(e,r,h,!1)}},"single-combo");mr.registerNode("simple-circle",{options:{size:ft.defaultNode.size,style:{x:0,y:0,stroke:ft.defaultNode.style.stroke,fill:ft.defaultNode.style.fill,lineWidth:ft.defaultNode.style.lineWidth},labelCfg:{style:{fill:ft.nodeLabel.style.fill,fontSize:ft.nodeLabel.style.fontSize,fontFamily:ft.windowFontFamily}},stateStyles:P({},ft.nodeStateStyles)},shapeType:"simple-circle",labelPosition:"center",shapeMap:{},drawShape:function(e,r){var n=this.getShapeStyle(e),a="".concat(this.type,"-keyShape"),i=r.addShape("circle",{attrs:n,className:"".concat(this.type,"-keyShape"),name:a,draggable:!0});return r.shapeMap[a]=i,i},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=_r({},r,n),i=this.getSize(e),o=i[0]/2,s=P({x:0,y:0,r:o},a);return s},update:function(e,r,n){var a=this.getSize(e),i={stroke:e.color,r:a[0]/2},o=r.get("keyShape"),s=_r({},o.attr(),i,e.style);this.updateShape(e,r,s,!0,n)}},"single-node");mr.registerNode("simple-rect",{options:{size:[100,30],style:{radius:0,stroke:ft.defaultNode.style.stroke,fill:ft.defaultNode.style.fill,lineWidth:ft.defaultNode.style.lineWidth},labelCfg:{style:{fill:ft.nodeLabel.style.fill,fontSize:ft.nodeLabel.style.fontSize,fontFamily:ft.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:P({},ft.nodeStateStyles)},shapeType:"simple-rect",labelPosition:"center",drawShape:function(e,r){var n=this.getShapeStyle(e),a=r.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return a},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getSize(e),o=a.width||i[0],s=a.height||i[1],u=P({x:-o/2,y:-s/2,width:o,height:s},a);return u},update:function(e,r,n){r.getContainer();var a=(this.mergeStyle||this.getOptions(e)).style,i=this.getSize(e),o=r.get("keyShape");e.size||(i[0]=o.attr("width")||a.width,i[1]=o.attr("height")||a.height);var s={stroke:e.color,x:-i[0]/2,y:-i[1]/2,width:i[0],height:i[1]},u=Et({},a,o.attr(),s);u=Et(u,e.style),this.updateShape(e,r,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:ft.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,r){var n=this.shapeType,a=this.getShapeStyle(e);delete a.fill;var i=r.addShape(n,{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return this.drawClip(e,i),i},drawClip:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).clipCfg;if(n.show){var a=n.type,i=n.x,o=n.y,s=n.style;if(a==="circle"){var u=n.r;r.setClip({type:"circle",attrs:P({r:u,x:i,y:o},s)})}else if(a==="rect"){var f=n.width,l=n.height,c=i-f/2,h=o-l/2;r.setClip({type:"rect",attrs:P({x:c,y:h,width:f,height:l},s)})}else if(a==="ellipse"){var d=n.rx,v=n.ry;r.setClip({type:"ellipse",attrs:P({x:i,y:o,rx:d,ry:v},s)})}else if(a==="polygon"){var p=n.points;r.setClip({type:"polygon",attrs:P({points:p},s)})}else if(a==="path"){var g=n.path;r.setClip({type:"path",attrs:P({path:g},s)})}}},getShapeStyle:function(e){var r=this.mergeStyle||this.getOptions(e),n=r.style,a=r.img,i=this.getSize(e),o=i[0],s=i[1];n&&(o=n.width||i[0],s=n.height||i[1]);var u=P({x:-o/2,y:-s/2,width:o,height:s,img:a},n);return u},updateShapeStyle:function(e,r){var n=r.getContainer(),a="".concat(this.itemType,"-shape"),i=n.shapeMap[a]||n.find(function(s){return s.get("className")===a})||r.getKeyShape(),o=this.getShapeStyle(e);i&&!i.destroyed&&i.attr(o)}},"single-node");var O8=["#5F95FF","#61DDAA","#65789B","#F6BD16","#7262FD","#78D3F8","#9661BC","#F6903D","#008685","#F08BB4"];const L8=Object.freeze(Object.defineProperty({__proto__:null,defaultSubjectColors:O8},Symbol.toStringTag,{value:"Module"}));var KC=function(e){return e==="force"||e==="g6force"||e==="gForce"||e==="force2"};const D8=Object.freeze(Object.defineProperty({__proto__:null,isForce:KC},Symbol.toStringTag,{value:"Module"}));var P8=eo,Za=P(P(P(P(P(P(P({},Xj),fz),c8),JG),L8),D8),{transform:P8,mat3:oM}),R8=function(){function t(e){this.graph=e,this.layoutCfg=e.get("layout")||{},this.layoutType=this.getLayoutType(),this.layoutMethods=[],this.initLayout()}return t.prototype.initLayout=function(){},t.prototype.getLayoutType=function(){return this.getLayoutCfgType(this.layoutCfg)},t.prototype.getLayoutCfgType=function(e){var r=e.type;if(r)return r;var n=e.pipes;return Array.isArray(n)?n.map(function(a){return(a==null?void 0:a.type)||""}):null},t.prototype.isLayoutTypeSame=function(e){var r=this.getLayoutCfgType(e),n=Array.isArray(this.layoutType),a=Array.isArray(r);return n&&a?this.layoutType.every(function(i,o){return i===r[o]}):Array.isArray(r)||Array.isArray(this.layoutType)?!1:(e==null?void 0:e.type)===this.layoutType},t.prototype.refreshLayout=function(){var e=this,r=e.graph,n=e.layoutType,a=e.layoutCfg,i=a===void 0?{}:a;if(r){var o=i.animate,s=o===void 0&&(n==="force"||n==="force2"),u=KC(n)&&(o||s);r.get("animate")&&!u?r.positionsAnimate(n==="comboCombined"):r.refreshPositions(n==="comboCombined")}},t.prototype.changeLayout=function(e){var r=e.disableTriggerLayout,n=Kr(e,["disableTriggerLayout"]);this.layoutCfg=n,this.layoutType=n.type||this.layoutType,!r&&this.layout()},t.prototype.changeData=function(e){this.layout(e)},t.prototype.destoryLayoutMethods=function(){var e=this.layoutMethods,r=[];return e==null||e.forEach(function(n){var a,i=(a=n.getType)===null||a===void 0?void 0:a.call(n);i&&r.push(i),n.destroy()}),this.layoutMethods=[],r},t.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},t.prototype.setDataFromGraph=function(){for(var e,r=[],n=[],a=[],i=[],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}r.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()){i.push(p);continue}p.isComboEdge?o.push(p):a.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:r,hiddenNodes:n,edges:a,hiddenEdges:i,combos:s,hiddenCombos:u,comboEdges:o,vedges:(e=this.graph.get("vedges"))===null||e===void 0?void 0:e.map(function(w){return w.getModel()})}},t.prototype.relayout=function(e){var r=this,n=this,a=n.graph,i=n.layoutMethods,o=n.layoutCfg;if(!(!a||a.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)}a.emit("beforelayout"),i==null||i.forEach(function(f,l){var c=o[l]||o;s=s.then(function(){var h,d=r.execLayoutMethod(c,l);return l===i.length-1&&((h=o.onAllLayoutEnd)===null||h===void 0||h.call(o)),d})})}},t.prototype.filterLayoutData=function(e,r){var n=e.nodes,a=e.edges,i=Kr(e,["nodes","edges"]);if(!n)return e;var o,s;Tr(r==null?void 0:r.nodesFilter)?o=r.nodesFilter:o=function(){return!0};var u=n.filter(o);if(Tr(r==null?void 0:r.edgesFilter))s=r.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 P({nodes:u,edges:a.filter(s)},i)},t.prototype.getLayoutBBox=function(e){var r=this.graph,n=Ah(r.getNodes(),function(o){return o.getModel().layoutOrder}),a=Object.values(n).map(function(o){var s=BC(o);return s.size=[s.width,s.height],s}),i=Object.values(Ah(e,"layoutOrder"));return{groupNodes:i,layoutNodes:a}},t.prototype.layoutAnimate=function(){},t.prototype.moveToZero=function(){var e=this.graph,r=e.get("data"),n=r.nodes;if(!(n[0].x===void 0||n[0].x===null||Fa(n[0].x))){for(var a=[0,0],i=n.length,o=0;o<i;o++){var s=n[o];a[0]+=s.x,a[1]+=s.y}a[0]/=n.length,a[1]/=n.length;for(var o=0;o<i;o++){var s=n[o];s.x-=a[0],s.y-=a[1]}}},t.prototype.initPositions=function(e,r){var n;return Bn(this,void 0,void 0,function(){var a,i,o;return Gn(this,function(s){return a=this.graph,r!=null&&r.length?(i=r.filter(function(u){return Fa(u.x)||Fa(u.y)}),o=i?i.length:0,o?[2,(n=this.initWithPreset)===null||n===void 0?void 0:n.call(this,function(){},function(){var u=a.get("width")*.85,f=a.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=i[g];Fa(+y.x)&&(y.x=g%l*h+v),Fa(+y.y)&&(y.y=Math.floor(g/l)*d+p)}})]:[2]):[2,Promise.resolve()]})})},t.prototype.destroy=function(){this.graph=null,this.destoryLayoutMethods(),this.destroyed=!0},t}(),F8=function(){function t(e){this.graph=e,this.destroyed=!1,this.initEvents()}return t}(),ro=mr.registerNode,B8=mr.registerEdge;mr.registerCombo;var G8=sy.registerBehavior,Qe=ft;mr.registerNode,mr.registerEdge,mr.registerCombo,sy.registerBehavior;var $y={},Yt={},Sd={},Hi={};Object.defineProperty(Hi,"__esModule",{value:!0});Hi.MESSAGE=Hi.ALGORITHM=void 0;var z8={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"};Hi.ALGORITHM=z8;var j8={SUCCESS:"SUCCESS",FAILURE:"FAILURE"};Hi.MESSAGE=j8;var Md={},QC={},Ko={};Object.defineProperty(Ko,"__esModule",{value:!0});Ko.default=void 0;var U8=function(e,r){var n=e.nodes,a=e.edges,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var f=[];i.push(f)}),a&&a.forEach(function(s){var u=s.source,f=s.target,l=o[u],c=o[f];!l&&l!==0||!c&&c!==0||(i[l][c]=1,r||(i[c][l]=1))}),i},$8=U8;Ko.default=$8;var Ad={},Cd={},Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.default=Js.LinkedListNode=void 0;var X8=function(e,r){return e===r},tg=function(){function t(e,r){r===void 0&&(r=null),this.value=e,this.next=r}return t.prototype.toString=function(e){return e?e(this.value):"".concat(this.value)},t}();Js.LinkedListNode=tg;var W8=function(){function t(e){e===void 0&&(e=X8),this.head=null,this.tail=null,this.compare=e}return t.prototype.prepend=function(e){var r=new tg(e,this.head);return this.head=r,this.tail||(this.tail=r),this},t.prototype.append=function(e){var r=new tg(e);return this.head?(this.tail.next=r,this.tail=r,this):(this.head=r,this.tail=r,this)},t.prototype.delete=function(e){if(!this.head)return null;for(var r=null;this.head&&this.compare(this.head.value,e);)r=this.head,this.head=this.head.next;var n=this.head;if(n!==null)for(;n.next;)this.compare(n.next.value,e)?(r=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,e)&&(this.tail=n),r},t.prototype.find=function(e){var r=e.value,n=r===void 0?void 0:r,a=e.callback,i=a===void 0?void 0:a;if(!this.head)return null;for(var o=this.head;o;){if(i&&i(o.value)||n!==void 0&&this.compare(o.value,n))return o;o=o.next}return null},t.prototype.deleteTail=function(){var e=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,e;for(var r=this.head;r.next;)r.next.next?r=r.next:r.next=null;return this.tail=r,e},t.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},t.prototype.fromArray=function(e){var r=this;return e.forEach(function(n){return r.append(n)}),this},t.prototype.toArray=function(){for(var e=[],r=this.head;r;)e.push(r),r=r.next;return e},t.prototype.reverse=function(){for(var e=this.head,r=null,n=null;e;)n=e.next,e.next=r,r=e,e=n;this.tail=this.head,this.head=r},t.prototype.toString=function(e){return e===void 0&&(e=void 0),this.toArray().map(function(r){return r.toString(e)}).toString()},t}(),V8=W8;Js.default=V8;Object.defineProperty(Cd,"__esModule",{value:!0});Cd.default=void 0;var Y8=q8(Js);function q8(t){return t&&t.__esModule?t:{default:t}}var H8=function(){function t(){this.linkedList=new Y8.default}return t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},t.prototype.enqueue=function(e){this.linkedList.append(e)},t.prototype.dequeue=function(){var e=this.linkedList.deleteHead();return e?e.value:null},t.prototype.toString=function(e){return this.linkedList.toString(e)},t}(),Z8=H8;Cd.default=Z8;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.uniqueId=Wr.getOutEdgesNodeId=Wr.getNeighbors=Wr.getEdgesByNodeId=void 0;var K8=function(e,r,n){r===void 0&&(r=[]);var a=r.filter(function(u){return u.source===e||u.target===e});if(n==="target"){var i=function(f){return f.source===e};return a.filter(i).map(function(u){return u.target})}if(n==="source"){var o=function(f){return f.target===e};return a.filter(o).map(function(u){return u.source})}var s=function(f){return f.source===e?f.target:f.source};return a.map(s)};Wr.getNeighbors=K8;var Q8=function(e,r){return r.filter(function(n){return n.source===e})};Wr.getOutEdgesNodeId=Q8;var J8=function(e,r){return r.filter(function(n){return n.source===e||n.target===e})};Wr.getEdgesByNodeId=J8;var eU=function(e){e===void 0&&(e=0);var r="".concat(Math.random()).split(".")[1].substr(0,5),n="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(e,"-").concat(r).concat(n)};Wr.uniqueId=eU;Object.defineProperty(Ad,"__esModule",{value:!0});Ad.default=void 0;var tU=nU(Cd),rU=Wr;function nU(t){return t&&t.__esModule?t:{default:t}}function aU(t){t===void 0&&(t={});var e=t,r=function(){},n=function(){var a={};return function(i){var o=i.next,s=o;return a[s]?!1:(a[s]=!0,!0)}}();return e.allowTraversal=t.allowTraversal||n,e.enter=t.enter||r,e.leave=t.leave||r,e}var iU=function(e,r,n,a){a===void 0&&(a=!0);var i=aU(n),o=new tU.default,s=e.edges,u=s===void 0?[]:s;o.enqueue(r);for(var f="",l=function(){var h=o.dequeue();i.enter({current:h,previous:f}),(0,rU.getNeighbors)(h,u,a?"target":void 0).forEach(function(d){i.allowTraversal({previous:f,current:h,next:d})&&o.enqueue(d)}),i.leave({current:h,previous:f}),f=h};!o.isEmpty();)l()},oU=iU;Ad.default=oU;var Zi={};Object.defineProperty(Zi,"__esModule",{value:!0});Zi.default=sU;Zi.detectStrongConnectComponents=Zi.detectConnectedComponents=void 0;var JC=Wr,eT=function(e){for(var r=e.nodes,n=r===void 0?[]:r,a=e.edges,i=a===void 0?[]:a,o=[],s={},u=[],f=function d(v){u.push(v),s[v.id]=!0;for(var p=(0,JC.getNeighbors)(v.id,i),g=function(b){var w=p[b];if(!s[w]){var x=n.filter(function(E){return E.id===w});x.length>0&&d(x[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};Zi.detectConnectedComponents=eT;var tT=function(e){for(var r=e.nodes,n=r===void 0?[]:r,a=e.edges,i=a===void 0?[]:a,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,JC.getNeighbors)(y.id,i,"target").filter(function(_){return n.map(function(S){return S.id}).indexOf(_)>-1}),b=function(S){var A=m[S];if(!u[A]&&u[A]!==0){var M=n.filter(function(C){return C.id===A});M.length>0&&g(M[0]),f[y.id]=Math.min(f[y.id],f[A])}else s[A]&&(f[y.id]=Math.min(f[y.id],u[A]))},w=0;w<m.length;w++)b(w);if(f[y.id]===u[y.id]){for(var x=[];o.length>0;){var E=o.pop();if(s[E.id]=!1,x.push(E),E===y)break}x.length>0&&l.push(x)}},d=0,v=n;d<v.length;d++){var p=v[d];!u[p.id]&&u[p.id]!==0&&h(p)}return l};Zi.detectStrongConnectComponents=tT;function sU(t,e){return e?tT(t):eT(t)}var pi={};Object.defineProperty(pi,"__esModule",{value:!0});pi.getOutDegree=pi.getInDegree=pi.default=void 0;var zf=function(e){var r={},n=e.nodes,a=n===void 0?[]:n,i=e.edges,o=i===void 0?[]:i;return a.forEach(function(s){r[s.id]={degree:0,inDegree:0,outDegree:0}}),o.forEach(function(s){r[s.source].degree++,r[s.source].outDegree++,r[s.target].degree++,r[s.target].inDegree++}),r},uU=zf;pi.default=uU;var fU=function(e,r){var n=zf(e);return n[r]?zf(e)[r].inDegree:0};pi.getInDegree=fU;var lU=function(e,r){var n=zf(e);return n[r]?zf(e)[r].outDegree:0};pi.getOutDegree=lU;var za={},Td={};Object.defineProperty(Td,"__esModule",{value:!0});Td.default=dU;var cU=Wr;function hU(t){t===void 0&&(t={});var e=t,r=function(){},n=function(){var a={};return function(i){var o=i.next;return a[o]?!1:(a[o]=!0,!0)}}();return e.allowTraversal=t.allowTraversal||n,e.enter=t.enter||r,e.leave=t.leave||r,e}function rT(t,e,r,n,a){a===void 0&&(a=!0),n.enter({current:e,previous:r});var i=t.edges,o=i===void 0?[]:i;(0,cU.getNeighbors)(e,o,a?"target":void 0).forEach(function(s){n.allowTraversal({previous:r,current:e,next:s})&&rT(t,s,e,n,a)}),n.leave({current:e,previous:r})}function dU(t,e,r,n){n===void 0&&(n=!0),rT(t,e,"",hU(r),n)}function rg(t){"@babel/helpers - typeof";return rg=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},rg(t)}Object.defineProperty(za,"__esModule",{value:!0});za.detectAllUndirectedCycle=za.detectAllDirectedCycle=za.detectAllCycles=za.default=void 0;var vU=gU(Td),nT=pU(Zi),aT=Wr;function iT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(iT=function(a){return a?r:e})(t)}function pU(t,e){if(t&&t.__esModule)return t;if(t===null||rg(t)!=="object"&&typeof t!="function")return{default:t};var r=iT(e);if(r&&r.has(t))return r.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var o=a?Object.getOwnPropertyDescriptor(t,i):null;o&&(o.get||o.set)?Object.defineProperty(n,i,o):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function gU(t){return t&&t.__esModule?t:{default:t}}var yU=function(e){var r=null,n=e.nodes,a=n===void 0?[]:n,i={},o={},s={},u={};a.forEach(function(c){o[c.id]=c});for(var f={enter:function(h){var d=h.current,v=h.previous;if(s[d]){r={};for(var p=d,g=v;g!==d;)r[p]=g,p=g,g=i[g];r[p]=g}else s[d]=d,delete o[d],i[d]=v},leave:function(h){var d=h.current;u[d]=d,delete s[d]},allowTraversal:function(h){var d=h.next;return r?!1:!u[d]}};Object.keys(o).length;){var l=Object.keys(o)[0];(0,vU.default)(e,l,f)}return r},oT=function(e,r,n){var a,i;n===void 0&&(n=!0);for(var o=[],s=(0,nT.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=(a={},a[h]=c,a),p=(i={},i[h]=new Set,i);d.length>0;)for(var g=d.pop(),y=g.id,m=(0,aT.getNeighbors)(y,e.edges),b=function(E){var _,S=m[E],A=e.nodes.find(function(B){return B.id===S});if(S===y)o.push((_={},_[S]=g,_));else if(!(S in p))v[S]=g,d.push(A),p[S]=new Set([g]);else if(!p[y].has(A)){for(var M=!0,C=[A,g],I=v[y];p[S].size&&!p[S].has(I)&&(C.push(I),I!==v[I.id]);)I=v[I.id];if(C.push(I),r&&n?(M=!1,C.findIndex(function(B){return r.indexOf(B.id)>-1})>-1&&(M=!0)):r&&!n&&C.findIndex(function(B){return r.indexOf(B.id)>-1})>-1&&(M=!1),M){for(var k={},O=1;O<C.length;O+=1)k[C[O-1].id]=C[O];C.length&&(k[C[C.length-1].id]=C[0]),o.push(k)}p[S].add(g)}},w=0;w<m.length;w+=1)b(w)}return o};za.detectAllUndirectedCycle=oT;var sT=function(e,r,n){n===void 0&&(n=!0);for(var a=[],i=new Set,o=[],s=[],u={},f={},l=function(I){for(var k=[I];k.length>0;){var O=k.pop();i.has(O)&&(i.delete(O),o[O.id].forEach(function(B){k.push(B)}),o[O.id].clear())}},c=function C(I,k,O){var B=!1;if(r&&n===!1&&r.indexOf(I.id)>-1)return B;a.push(I),i.add(I);for(var L=O[I.id],z=0;z<L.length;z+=1){var X=u[L[z]];if(X===k){for(var R={},V=1;V<a.length;V+=1)R[a[V-1].id]=a[V];a.length&&(R[a[a.length-1].id]=a[0]),s.push(R),B=!0}else i.has(X)||C(X,k,O)&&(B=!0)}if(B)l(I);else for(var z=0;z<L.length;z+=1){var X=u[L[z]];o[X.id].has(I)||o[X.id].add(I)}return a.pop(),B},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(r&&n)for(var y=function(I){var k=r[I];f[d[I].id]=f[k],f[k]=0,u[0]=d.find(function(O){return O.id===k}),u[f[d[I].id]]=d[I]},v=0;v<r.length;v++)y(v);for(var m=function(I){for(var k,O,B=1/0,L=0;L<I.length;L+=1)for(var z=I[L],X=0;X<z.length;X++){var R=f[z[X].id];R<B&&(B=R,O=L)}for(var V=I[O],he=[],L=0;L<V.length;L+=1){var ce=V[L];he[ce.id]=[];for(var le=0,ie=(0,aT.getNeighbors)(ce.id,e.edges,"target").filter(function(Ve){return V.map(function(it){return it.id}).indexOf(Ve)>-1});le<ie.length;le++){var Ie=ie[le];Ie===ce.id&&!(n===!1&&r.indexOf(ce.id)>-1)?s.push((k={},k[ce.id]=ce,k)):he[ce.id].push(f[Ie])}}return{component:V,adjList:he,minIdx:B}},b=0;b<d.length;){var w=d.filter(function(C){return f[C.id]>=b}),x=(0,nT.detectStrongConnectComponents)({nodes:w,edges:e.edges}).filter(function(C){return C.length>1});if(x.length===0)break;var E=m(x),_=E.minIdx,S=E.adjList,A=E.component;if(A.length>1){A.forEach(function(C){o[C.id]=new Set});var M=u[_];if(r&&n&&r.indexOf(M.id)===-1)return s;c(M,M,S),b=_+1}else break}return s};za.detectAllDirectedCycle=sT;var mU=function(e,r,n,a){return a===void 0&&(a=!0),r?sT(e,n,a):oT(e,n,a)};za.detectAllCycles=mU;var bU=yU;za.default=bU;var gu={};const uT=Ka(jP),el=Ka(u3);Object.defineProperty(gu,"__esModule",{value:!0});gu.default=void 0;var Bx=uT,wU=el,Gx=Wr,xU=function(e,r,n){for(var a=1/0,i,o=0;o<r.length;o++){var s=r[o].id;!n[s]&&e[s]<=a&&(a=e[s],i=r[o])}return i},EU=function(e,r,n,a){var i=e.nodes,o=i===void 0?[]:i,s=e.edges,u=s===void 0?[]:s,f={},l={},c={};o.forEach(function(m,b){var w=m.id;l[w]=1/0,w===r&&(l[w]=0)});for(var h=o.length,d=function(b){var w=xU(l,o,f),x=w.id;if(f[x]=!0,l[x]===1/0)return"continue";var E=[];n?E=(0,Gx.getOutEdgesNodeId)(x,u):E=(0,Gx.getEdgesByNodeId)(x,u),E.forEach(function(_){var S=_.target,A=_.source,M=S===x?A:S,C=a&&_[a]?_[a]:1;l[M]>l[w.id]+C?(l[M]=l[w.id]+C,c[M]=[w.id]):l[M]===l[w.id]+C&&c[M].push(w.id)})},v=0;v<h;v++)d();c[r]=[r];var p={};for(var g in l)l[g]!==1/0&&fT(r,g,c,p);var y={};for(var g in p)y[g]=p[g][0];return{length:l,path:y,allPath:p}},_U=EU;gu.default=_U;function fT(t,e,r,n){if(t===e)return[t];if(n[e])return n[e];for(var a=[],i=0,o=r[e];i<o.length;i++){var s=o[i],u=fT(t,s,r,n);if(!u)return;for(var f=0,l=u;f<l.length;f++){var c=l[f];(0,wU.isArray)(c)?a.push((0,Bx.__spreadArray)((0,Bx.__spreadArray)([],c,!0),[e],!1)):a.push([c,e])}}return n[e]=a,n[e]}var eu={};Object.defineProperty(eu,"__esModule",{value:!0});eu.findShortestPath=eu.findAllPath=void 0;var SU=MU(gu),Ec=Wr;function MU(t){return t&&t.__esModule?t:{default:t}}var AU=function(e,r,n,a,i){var o=(0,SU.default)(e,r,a,i),s=o.length,u=o.path,f=o.allPath;return{length:s[n],path:u[n],allPath:f[n]}};eu.findShortestPath=AU;var CU=function(e,r,n,a){var i;if(r===n)return[[r]];var o=e.edges,s=o===void 0?[]:o,u=[r],f=(i={},i[r]=!0,i),l=[],c=[],h=a?(0,Ec.getNeighbors)(r,s,"target"):(0,Ec.getNeighbors)(r,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=a?(0,Ec.getNeighbors)(v,s,"target"):(0,Ec.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};eu.findAllPath=CU;var tl={};Object.defineProperty(tl,"__esModule",{value:!0});tl.default=void 0;var TU=IU(Ko);function IU(t){return t&&t.__esModule?t:{default:t}}var kU=function(e,r){for(var n=(0,TU.default)(e,r),a=[],i=n.length,o=0;o<i;o+=1){a[o]=[];for(var s=0;s<i;s+=1)o===s?a[o][s]=0:n[o][s]===0||!n[o][s]?a[o][s]=1/0:a[o][s]=n[o][s]}for(var u=0;u<i;u+=1)for(var o=0;o<i;o+=1)for(var s=0;s<i;s+=1)a[o][s]>a[o][u]+a[u][s]&&(a[o][s]=a[o][u]+a[u][s]);return a},NU=kU;tl.default=NU;var Id={};Object.defineProperty(Id,"__esModule",{value:!0});Id.default=void 0;var OU=DU(Ko),LU=Wr;function DU(t){return t&&t.__esModule?t:{default:t}}var PU=function(e,r,n,a){r===void 0&&(r=!1),n===void 0&&(n="weight"),a===void 0&&(a=1e3);var i=e.nodes,o=i===void 0?[]:i,s=e.edges,u=s===void 0?[]:s,f={},l={};o.forEach(function(b,w){var x=(0,LU.uniqueId)();b.clusterId=x,f[x]={id:x,nodes:[b]},l[b.id]={node:b,idx:w}});var c=(0,OU.default)(e,r),h={};c.forEach(function(b,w){var x=o[w].id;h[x]={},b.forEach(function(E,_){if(E){var S=o[_].id;h[x][S]=E}})});for(var d=0,v=function(){var w=!1;if(o.forEach(function(x){var E={};Object.keys(h[x.id]).forEach(function(O){var B=h[x.id][O],L=l[O].node,z=L.clusterId;E[z]||(E[z]=0),E[z]+=B});var _=-1/0,S=[];if(Object.keys(E).forEach(function(O){_<E[O]?(_=E[O],S=[O]):_===E[O]&&S.push(O)}),!(S.length===1&&S[0]===x.clusterId)){var A=S.indexOf(x.clusterId);if(A>=0&&S.splice(A,1),S&&S.length){w=!0;var M=f[x.clusterId],C=M.nodes.indexOf(x);M.nodes.splice(C,1);var I=Math.floor(Math.random()*S.length),k=f[S[I]];k.nodes.push(x),x.clusterId=k.id}}}),!w)return"break";d++};d<a;){var p=v();if(p==="break")break}Object.keys(f).forEach(function(b){var w=f[b];(!w.nodes||!w.nodes.length)&&delete f[b]});var g=[],y={};u.forEach(function(b){var w=b.source,x=b.target,E=b[n]||1,_=l[w].node.clusterId,S=l[x].node.clusterId,A="".concat(_,"---").concat(S);if(y[A])y[A].weight+=E,y[A].count++;else{var M={source:_,target:S,weight:E,count:1};y[A]=M,g.push(M)}});var m=[];return Object.keys(f).forEach(function(b){m.push(f[b])}),{clusters:m,clusterEdges:g}},RU=PU;Id.default=RU;var kd={},rl={};Object.defineProperty(rl,"__esModule",{value:!0});rl.default=void 0;var FU=el,BU=function(){function t(e){this.arr=e}return t.prototype.getArr=function(){return this.arr||[]},t.prototype.add=function(e){var r,n=e.arr;if(!(!((r=this.arr)===null||r===void 0)&&r.length))return new t(n);if(!(n!=null&&n.length))return new t(this.arr);if(this.arr.length===n.length){var a=[];for(var i in this.arr)a[i]=this.arr[i]+n[i];return new t(a)}},t.prototype.subtract=function(e){var r,n=e.arr;if(!(!((r=this.arr)===null||r===void 0)&&r.length))return new t(n);if(!(n!=null&&n.length))return new t(this.arr);if(this.arr.length===n.length){var a=[];for(var i in this.arr)a[i]=this.arr[i]-n[i];return new t(a)}},t.prototype.avg=function(e){var r=[];if(e!==0)for(var n in this.arr)r[n]=this.arr[n]/e;return new t(r)},t.prototype.negate=function(){var e=[];for(var r in this.arr)e[r]=-this.arr[r];return new t(e)},t.prototype.squareEuclideanDistance=function(e){var r,n=e.arr;if(!(!((r=this.arr)===null||r===void 0)&&r.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var a=0;for(var i in this.arr)a+=Math.pow(this.arr[i]-e.arr[i],2);return a}},t.prototype.euclideanDistance=function(e){var r,n=e.arr;if(!(!((r=this.arr)===null||r===void 0)&&r.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var a=0;for(var i in this.arr)a+=Math.pow(this.arr[i]-e.arr[i],2);return Math.sqrt(a)}else console.error("The two vectors are unequal in length.")},t.prototype.normalize=function(){var e=[],r=(0,FU.clone)(this.arr);r.sort(function(o,s){return o-s});var n=r[r.length-1],a=r[0];for(var i in this.arr)e[i]=(this.arr[i]-a)/(n-a);return new t(e)},t.prototype.norm2=function(){var e;if(!(!((e=this.arr)===null||e===void 0)&&e.length))return 0;var r=0;for(var n in this.arr)r+=Math.pow(this.arr[n],2);return Math.sqrt(r)},t.prototype.dot=function(e){var r,n=e.arr;if(!(!((r=this.arr)===null||r===void 0)&&r.length)||!(n!=null&&n.length))return 0;if(this.arr.length===n.length){var a=0;for(var i in this.arr)a+=this.arr[i]*e.arr[i];return a}else console.error("The two vectors are unequal in length.")},t.prototype.equal=function(e){var r,n=e.arr;if(((r=this.arr)===null||r===void 0?void 0:r.length)!==(n==null?void 0:n.length))return!1;for(var a in this.arr)if(this.arr[a]!==n[a])return!1;return!0},t}(),GU=BU;rl.default=GU;var ja={},tu={};Object.defineProperty(tu,"__esModule",{value:!0});tu.secondReg=tu.dateReg=void 0;var zU=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/;tu.secondReg=zU;var jU=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;tu.dateReg=jU;Object.defineProperty(ja,"__esModule",{value:!0});ja.getPropertyWeight=ja.getAllSortProperties=ja.getAllProperties=ja.default=void 0;var zx=tu,Xy=function(e,r){e===void 0&&(e=[]),r===void 0&&(r=100);var n={};e.forEach(function(i){i.properties&&Object.keys(i.properties).forEach(function(o){if(o==="id"||!"".concat(i.properties[o]).match(zx.secondReg)&&!"".concat(i.properties[o]).match(zx.dateReg)&&isNaN(Number(i.properties[o]))){n.hasOwnProperty(o)&&delete n[o];return}n.hasOwnProperty(o)?n[o]+=1:n[o]=1})});var a=Object.keys(n).sort(function(i,o){return n[o]-n[i]});return a.length<r?a:a.slice(0,r)};ja.getAllSortProperties=Xy;var UU=function(e,r){return r.map(function(n){return e.hasOwnProperty(n)?e[n]:0})},lT=function(e){for(var r=Xy(e),n=[],a=0;a<e.length;a++)n[a]=UU(e[a].properties,r);return n};ja.getPropertyWeight=lT;var cT=function(e,r){r===void 0&&(r=void 0);var n=[];return e.forEach(function(a){r===void 0&&n.push(a),a[r]!==void 0&&n.push(a[r])}),n};ja.getAllProperties=cT;var $U={getAllSortProperties:Xy,getPropertyWeight:lT,getAllProperties:cT};ja.default=$U;var Ua={},nl={};Object.defineProperty(nl,"__esModule",{value:!0});nl.DistanceType=void 0;var ng;nl.DistanceType=ng;(function(t){t.EuclideanDistance="euclideanDistance"})(ng||(nl.DistanceType=ng={}));Object.defineProperty(Ua,"__esModule",{value:!0});Ua.oneHot=Ua.getDistance=Ua.getAllKeyValueMap=Ua.default=void 0;var jx=el,Ux=nl,$x=XU(rl);function XU(t){return t&&t.__esModule?t:{default:t}}var Wy=function(e,r,n){var a=[];r!=null&&r.length?a=r:(e.forEach(function(o){a=a.concat(Object.keys(o))}),a=(0,jx.uniq)(a));var i={};return a.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))&&(i[o]=(0,jx.uniq)(s))}),i};Ua.getAllKeyValueMap=Wy;var hT=function(e,r,n){var a=Wy(e,r,n),i=[];if(!Object.keys(a).length)return i;var o=Object.values(a),s=o.every(function(u){return u.every(function(f){return typeof f=="number"})});return e.forEach(function(u,f){var l=[];Object.keys(a).forEach(function(c){var h=u[c],d=a[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)}),i[f]=l}),i};Ua.oneHot=hT;var dT=function(e,r,n,a){n===void 0&&(n=Ux.DistanceType.EuclideanDistance);var i=0;switch(n){case Ux.DistanceType.EuclideanDistance:i=new $x.default(e).euclideanDistance(new $x.default(r));break}return i};Ua.getDistance=dT;var WU={getAllKeyValueMap:Wy,oneHot:hT,getDistance:dT};Ua.default=WU;Object.defineProperty(kd,"__esModule",{value:!0});kd.default=void 0;var VU=el,YU=vT(Ko),Yu=vT(rl),qU=ja,HU=Ua;function vT(t){return t&&t.__esModule?t:{default:t}}var Xx=function(e,r,n,a){for(var i=r.length,o=2*a,s=0,u=0;u<i;u++)for(var f=e[u].clusterId,l=0;l<i;l++){var c=e[l].clusterId;if(f===c){var h=r[u][l]||0,d=n[u]||0,v=n[l]||0;s+=h-d*v/o}}return s*=1/o,s},_p=function(e,r){e===void 0&&(e=[]);for(var n=e.length,a=new Yu.default([]),i=0;i<n;i++)a=a.add(new Yu.default(r[i]));var o=a.avg(n);o.normalize();for(var s=0,i=0;i<n;i++){var u=new Yu.default(r[i]),f=u.squareEuclideanDistance(o);s+=f}var l=[];e.forEach(function(){l.push([])});for(var i=0;i<n;i++){var u=new Yu.default(r[i]);e[i].clusterInertial=0;for(var c=0;c<n;c++){if(i===c){l[i][c]=0;continue}var h=new Yu.default(r[c]);l[i][c]=u.squareEuclideanDistance(h),e[i].clusterInertial+=l[i][c]}}for(var d=0,v=2*n*s,i=0;i<n;i++)for(var p=e[i].clusterId,c=0;c<n;c++){var g=e[c].clusterId;if(!(i===c||p!==g)){var y=e[i].clusterInertial*e[c].clusterInertial/Math.pow(v,2)-l[i][c]/v;d+=y}}return Number(d.toFixed(4))},ZU=function(e,r,n,a,i,o,s,u,f){r===void 0&&(r=!1),n===void 0&&(n="weight"),a===void 0&&(a=1e-4),i===void 0&&(i=!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(i){c.forEach(function(R,V){R.properties=R.properties||{},R.originIndex=V});var p=[];c.every(function(R){return R.hasOwnProperty("nodeType")})&&(p=Array.from(new Set(c.map(function(R){return R.nodeType}))),c.forEach(function(R){R.properties.nodeType=p.findIndex(function(V){return V===R.nodeType})}));var g=(0,qU.getAllProperties)(c,o);v=(0,HU.oneHot)(g,s,u)}var y=1,m={},b={};c.forEach(function(R,V){var he=String(y++);R.clusterId=he,m[he]={id:he,nodes:[R]},b[R.id]={node:R,idx:V}});var w=(0,YU.default)(e,r),x=[],E={},_=0;w.forEach(function(R,V){var he=0,ce=c[V].id;E[ce]={},R.forEach(function(le,ie){if(le){he+=le;var Ie=c[ie].id;E[ce][Ie]=le,_+=le}}),x.push(he)}),_/=2;for(var S=1/0,A=1/0,M=0,C=[],I={};;){i&&c.every(function(R){return R.hasOwnProperty("properties")})?S=Xx(c,w,x,_)+_p(c,v)*f:S=Xx(c,w,x,_),M===0&&(A=S,C=c,I=m);var k=S>0&&S>A&&S-A<a;if(S>A&&(C=c.map(function(R){return{node:R,clusterId:R.clusterId}}),I=(0,VU.clone)(m),A=S),k||M>100)break;M++,Object.keys(m).forEach(function(R){var V=0;d.forEach(function(he){var ce=he.source,le=he.target,ie=b[ce].node.clusterId,Ie=b[le].node.clusterId;(ie===R&&Ie!==R||Ie===R&&ie!==R)&&(V=V+(he[n]||1))}),m[R].sumTot=V}),c.forEach(function(R,V){var he=m[R.clusterId],ce=0,le,ie=x[V]/(2*_),Ie=0,qe=he.nodes;qe.forEach(function(Wt){var vr=b[Wt.id].idx;Ie+=w[V][vr]||0});var Ve=Ie-he.sumTot*ie,it=qe.filter(function(Wt){return Wt.id!==R.id});it.forEach(function(Wt,vr){v[Wt.originIndex]});var dt=_p(it,v)*f,st=E[R.id];if(Object.keys(st).forEach(function(Wt){var vr=b[Wt].node,cr=vr.clusterId;if(cr!==R.clusterId){var $t=m[cr],sr=$t.nodes;if(!(!sr||!sr.length)){var tn=0;sr.forEach(function(Fe){var ge=b[Fe.id].idx;tn+=w[V][ge]||0});var tt=tn-$t.sumTot*ie,te=sr.concat([R]);te.forEach(function(Fe,ge){v[Fe.originIndex]});var N=_p(te,v)*f,Se=tt-Ve;i&&(Se=tt+N-(Ve+dt)),Se>ce&&(ce=Se,le=$t)}}}),ce>0){le.nodes.push(R);var Tt=R.clusterId;R.clusterId=le.id;var _t=he.nodes.indexOf(R);he.nodes.splice(_t,1);var lr=0,Bt=0;d.forEach(function(Wt){var vr=Wt.source,cr=Wt.target,$t=b[vr].node.clusterId,sr=b[cr].node.clusterId;($t===le.id&&sr!==le.id||sr===le.id&&$t!==le.id)&&(lr=lr+(Wt[n]||1)),($t===Tt&&sr!==Tt||sr===Tt&&$t!==Tt)&&(Bt=Bt+(Wt[n]||1))}),le.sumTot=lr,he.sumTot=Bt}})}var O={},B=0;Object.keys(I).forEach(function(R){var V=I[R];if(!V.nodes||!V.nodes.length){delete I[R];return}var he=String(B+1);he!==R&&(V.id=he,V.nodes=V.nodes.map(function(ce){return{id:ce.id,clusterId:he}}),I[he]=V,O[R]=he,delete I[R],B++)}),C.forEach(function(R){var V=R.node,he=R.clusterId;V&&(V.clusterId=he,V.clusterId&&O[V.clusterId]&&(V.clusterId=O[V.clusterId]))});var L=[],z={};d.forEach(function(R){var V=R.source,he=R.target,ce=R[n]||1,le=b[V].node.clusterId,ie=b[he].node.clusterId;if(!(!le||!ie)){var Ie="".concat(le,"---").concat(ie);if(z[Ie])z[Ie].weight+=ce,z[Ie].count++;else{var qe={source:le,target:ie,weight:ce,count:1};z[Ie]=qe,L.push(qe)}}});var X=[];return Object.keys(I).forEach(function(R){X.push(I[R])}),{clusters:X,clusterEdges:L}},KU=ZU;kd.default=KU;var Nd={},Od={};Object.defineProperty(Od,"__esModule",{value:!0});Od.default=void 0;var QU=function(){function t(e){this.count=e.length,this.parent={};for(var r=0,n=e;r<n.length;r++){var a=n[r];this.parent[a]=a}}return t.prototype.find=function(e){for(;this.parent[e]!==e;)e=this.parent[e];return e},t.prototype.union=function(e,r){var n=this.find(e),a=this.find(r);n!==a&&(n<a?(this.parent[r]!==r&&this.union(this.parent[r],e),this.parent[r]=this.parent[e]):(this.parent[e]!==e&&this.union(this.parent[e],r),this.parent[e]=this.parent[r]))},t.prototype.connected=function(e,r){return this.find(e)===this.find(r)},t}(),JU=QU;Od.default=JU;var Ld={};Object.defineProperty(Ld,"__esModule",{value:!0});Ld.default=void 0;var e$=function(e,r){return e-r},t$=function(){function t(e){e===void 0&&(e=e$),this.compareFn=e,this.list=[]}return t.prototype.getLeft=function(e){return 2*e+1},t.prototype.getRight=function(e){return 2*e+2},t.prototype.getParent=function(e){return e===0?null:Math.floor((e-1)/2)},t.prototype.isEmpty=function(){return this.list.length<=0},t.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},t.prototype.delMin=function(){var e=this.top(),r=this.list.pop();return this.list.length>0&&(this.list[0]=r,this.moveDown(0)),e},t.prototype.insert=function(e){if(e!==null){this.list.push(e);var r=this.list.length-1;return this.moveUp(r),!0}return!1},t.prototype.moveUp=function(e){for(var r=this.getParent(e);e&&e>0&&this.compareFn(this.list[r],this.list[e])>0;){var n=this.list[r];this.list[r]=this.list[e],this.list[e]=n,e=r,r=this.getParent(e)}},t.prototype.moveDown=function(e){var r,n=e,a=this.getLeft(e),i=this.getRight(e),o=this.list.length;a!==null&&a<o&&this.compareFn(this.list[n],this.list[a])>0?n=a:i!==null&&i<o&&this.compareFn(this.list[n],this.list[i])>0&&(n=i),e!==n&&(r=[this.list[n],this.list[e]],this.list[e]=r[0],this.list[n]=r[1],this.moveDown(n))},t}(),r$=t$;Ld.default=r$;Object.defineProperty(Nd,"__esModule",{value:!0});Nd.default=void 0;var n$=pT(Od),a$=pT(Ld),Sp=Wr;function pT(t){return t&&t.__esModule?t:{default:t}}var i$=function(e,r){var n=[],a=e.nodes,i=a===void 0?[]:a,o=e.edges,s=o===void 0?[]:o;if(i.length===0)return n;var u=i[0],f=new Set;f.add(u);var l=function(g,y){return r?g.weight-y.weight:0},c=new a$.default(l);for((0,Sp.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,Sp.getEdgesByNodeId)(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),(0,Sp.getEdgesByNodeId)(v,s).forEach(function(p){c.insert(p)})))}return n},Wx=function(e,r){var n=[],a=e.nodes,i=a===void 0?[]:a,o=e.edges,s=o===void 0?[]:o;if(i.length===0)return n;var u=s.map(function(d){return d});r&&u.sort(function(d,v){return d.weight-v.weight});for(var f=new n$.default(i.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},o$=function(e,r,n){var a={prim:i$,kruskal:Wx};return n?a[n](e,r):Wx(e,r)},s$=o$;Nd.default=s$;var Dd={};Object.defineProperty(Dd,"__esModule",{value:!0});Dd.default=void 0;var u$=l$(pi),f$=Wr;function l$(t){return t&&t.__esModule?t:{default:t}}var c$=function(e,r,n){typeof r!="number"&&(r=1e-6),typeof n!="number"&&(n=.85);for(var a=1,i=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,u$.default)(e);o>0&&a>r;){i=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,f$.getNeighbors)(y,l,"source"),w=0;w<b.length;++w){var x=b[w],E=m[x].outDegree;E>0&&(h+=v[x]/E)}d[y]=n*h,i+=d[y]}}i=(1-i)/c,a=0;for(var p=0;p<c;++p){var g=u[p],y=g.id;h=d[y]+i,a+=Math.abs(h-v[y]),v[y]=h}o-=1}return v},h$=c$;Dd.default=h$;var Pd={},Rd={},Xr={};Object.defineProperty(Xr,"__esModule",{value:!0});Xr.VACANT_NODE_LABEL=Xr.VACANT_NODE_ID=Xr.VACANT_GRAPH_ID=Xr.VACANT_EDGE_LABEL=Xr.VACANT_EDGE_ID=Xr.Node=Xr.Graph=Xr.Edge=Xr.AUTO_EDGE_ID=void 0;var gT=-1;Xr.VACANT_EDGE_ID=gT;var jf=-1;Xr.VACANT_NODE_ID=jf;var yT="-1";Xr.VACANT_EDGE_LABEL=yT;var mT="-1";Xr.VACANT_NODE_LABEL=mT;var d$=-1;Xr.VACANT_GRAPH_ID=d$;var v$="-1";Xr.AUTO_EDGE_ID=v$;var ag=function(){function t(e,r,n,a){e===void 0&&(e=gT),r===void 0&&(r=jf),n===void 0&&(n=jf),a===void 0&&(a=yT),this.id=e,this.from=r,this.to=n,this.label=a}return t}();Xr.Edge=ag;var bT=function(){function t(e,r){e===void 0&&(e=jf),r===void 0&&(r=mT),this.id=e,this.label=r,this.edges=[],this.edgeMap={}}return t.prototype.addEdge=function(e){this.edges.push(e),this.edgeMap[e.id]=e},t}();Xr.Node=bT;var p$=function(){function t(e,r,n){e===void 0&&(e=jf),r===void 0&&(r=!0),n===void 0&&(n=!1),this.id=e,this.edgeIdAutoIncrease=r,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=n}return t.prototype.getNodeNum=function(){return this.nodes.length},t.prototype.addNode=function(e,r){if(!this.nodeMap[e]){var n=new bT(e,r);this.nodes.push(n),this.nodeMap[e]=n,this.nodeLabelMap[r]||(this.nodeLabelMap[r]=[]),this.nodeLabelMap[r].push(e)}},t.prototype.addEdge=function(e,r,n,a){if((this.edgeIdAutoIncrease||e===void 0)&&(e=this.counter++),!(this.nodeMap[r]&&this.nodeMap[n]&&this.nodeMap[n].edgeMap[e])){var i=new ag(e,r,n,a);if(this.edges.push(i),this.edgeMap[e]=i,this.nodeMap[r].addEdge(i),this.edgeLabelMap[a]||(this.edgeLabelMap[a]=[]),this.edgeLabelMap[a].push(i),!this.directed){var o=new ag(e,n,r,a);this.nodeMap[n].addEdge(o),this.edgeLabelMap[a].push(o)}}},t}();Xr.Graph=p$;Object.defineProperty(Rd,"__esModule",{value:!0});Rd.default=void 0;var g$=el,In=Xr,No=function(){function t(e,r,n,a,i){this.fromNode=e,this.toNode=r,this.nodeEdgeNodeLabel={nodeLabel1:n||In.VACANT_NODE_LABEL,edgeLabel:a||In.VACANT_EDGE_LABEL,nodeLabel2:i||In.VACANT_NODE_LABEL}}return t.prototype.equalTo=function(e){return this.fromNode===e.formNode&&this.toNode===e.toNode&&this.nodeEdgeNodeLabel===e.nodeEdgeNodeLabel},t.prototype.notEqualTo=function(e){return!this.equalTo(e)},t}(),Vx=function(){function t(){this.rmpath=[],this.dfsEdgeList=[]}return t.prototype.equalTo=function(e){var r=this.dfsEdgeList.length,n=e.length;if(r!==n)return!1;for(var a=0;a<r;a++)if(this.dfsEdgeList[a]!==e[a])return!1;return!0},t.prototype.notEqualTo=function(e){return!this.equalTo(e)},t.prototype.pushBack=function(e,r,n,a,i){return this.dfsEdgeList.push(new No(e,r,n,a,i)),this.dfsEdgeList},t.prototype.toGraph=function(e,r){e===void 0&&(e=In.VACANT_GRAPH_ID),r===void 0&&(r=!1);var n=new In.Graph(e,!0,r);return this.dfsEdgeList.forEach(function(a){var i=a.fromNode,o=a.toNode,s=a.nodeEdgeNodeLabel,u=s.nodeLabel1,f=s.edgeLabel,l=s.nodeLabel2;u!==In.VACANT_NODE_LABEL&&n.addNode(i,u),l!==In.VACANT_NODE_LABEL&&n.addNode(o,l),u!==In.VACANT_NODE_LABEL&&l!==u&&n.addEdge(void 0,i,o,f)}),n},t.prototype.buildRmpath=function(){this.rmpath=[];for(var e=void 0,r=this.dfsEdgeList.length,n=r-1;n>=0;n--){var a=this.dfsEdgeList[n],i=a.fromNode,o=a.toNode;i<o&&(e===void 0||o===e)&&(this.rmpath.push(n),e=i)}return this.rmpath},t.prototype.getNodeNum=function(){var e={};return this.dfsEdgeList.forEach(function(r){e[r.fromNode]||(e[r.fromNode]=!0),e[r.toNode]||(e[r.toNode]=!0)}),Object.keys(e).length},t}(),_c=function(){function t(e){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!e){for(;e;){var r=e.edge;this.edges.push(r),this.nodesUsed[r.from]=1,this.nodesUsed[r.to]=1,this.edgesUsed[r.id]=1,e=e.preNode}this.edges=this.edges.reverse()}}return t.prototype.hasNode=function(e){return this.nodesUsed[e.id]===1},t.prototype.hasEdge=function(e){return this.edgesUsed[e.id]===1},t}(),y$=function(){function t(e){var r=e.graphs,n=e.minSupport,a=n===void 0?2:n,i=e.minNodeNum,o=i===void 0?1:i,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=r,this.dfsCode=new Vx,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=a,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 t.prototype.findForwardRootEdges=function(e,r){var n=this,a=[],i=e.nodeMap;return r.edges.forEach(function(o){(n.directed||r.label<=i[o.to].label)&&a.push(o)}),a},t.prototype.findBackwardEdge=function(e,r,n,a){if(!this.directed&&r===n)return null;for(var i=e.nodeMap,o=i[n.to],s=o.edges,u=s.length,f=0;f<u;f++){var l=s[f];if(!(a.hasEdge(l)||l.to!==r.from)){if(this.directed){if(i[r.from].label<i[n.to].label||i[r.from].label===i[n.to].label&&r.label<=l.label)return l}else if(r.label<l.label||r.label===l.label&&i[r.to].label<=i[n.to].label)return l}}return null},t.prototype.findForwardPureEdges=function(e,r,n,a){for(var i=[],o=r.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&&!a.hasNode(c)&&i.push(l)}return i},t.prototype.findForwardRmpathEdges=function(e,r,n,a){for(var i=[],o=e.nodeMap,s=o[r.to].label,u=o[r.from],f=u.edges,l=f.length,c=0;c<l;c++){var h=f[c],d=o[h.to].label;r.to===h.to||n>d||a.hasNode(o[h.to])||(r.label<h.label||r.label===h.label&&s<=d)&&i.push(h)}return i},t.prototype.getSupport=function(e){var r={};return e.forEach(function(n){r[n.graphId]||(r[n.graphId]=!0)}),Object.keys(r).length},t.prototype.findMinLabel=function(e){var r=void 0;return Object.keys(e).forEach(function(n){var a=e[n],i=a.nodeLabel1,o=a.edgeLabel,s=a.nodeLabel2;if(!r){r={nodeLabel1:i,edgeLabel:o,nodeLabel2:s};return}(i<r.nodeLabel1||i===r.nodeLabel1&&o<r.edgeLabel||i===r.nodeLabel1&&o===r.edgeLabel&&s<r.nodeLabel2)&&(r={nodeLabel1:i,edgeLabel:o,nodeLabel2:s})}),r},t.prototype.isMin=function(){var e=this,r=this.dfsCode;if(this.verbose&&console.log("isMin checking",r),r.dfsEdgeList.length===1)return!0;var n=this.directed,a=r.toGraph(In.VACANT_GRAPH_ID,n),i=a.nodeMap,o=new Vx,s={};a.nodes.forEach(function(c){var h=e.findForwardRootEdges(a,c);h.forEach(function(d){var v=i[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:a.id,edge:d,preNode:null};s[p].projected.push(g)})});var u=this.findMinLabel(s);if(u){o.dfsEdgeList.push(new No(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,w=function(z){if(y)return"break";h.forEach(function(X){var R=new _c(X),V=e.findBackwardEdge(a,R.edges[d[z]],R.edges[d[0]],R);V&&(g[V.label]||(g[V.label]={projected:[],edgeLabel:V.label}),g[V.label].projected.push({graphId:a.id,edge:g,preNode:X}),m=o.dfsEdgeList[d[z]].fromNode,y=!0)})},x=d.length-1;x>b;x--){var E=w(x);if(E==="break")break}if(y){var _=e.findMinLabel(g);o.dfsEdgeList.push(new No(p,m,In.VACANT_NODE_LABEL,_.edgeLabel,In.VACANT_NODE_LABEL));var S=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[S]!==o.dfsEdgeList[S]?!1:c(g[_.edgeLabel].projected)}var A={};y=!1;var M=0;h.forEach(function(L){var z=new _c(L),X=e.findForwardPureEdges(a,z.edges[d[0]],v,z);X.length>0&&(y=!0,M=p,X.forEach(function(R){var V="".concat(R.label,"-").concat(i[R.to].label);A[V]||(A[V]={projected:[],edgeLabel:R.label,nodeLabel2:i[R.to].label}),A[V].projected.push({graphId:a.id,edge:R,preNode:L})}))});for(var C=d.length,I=function(z){if(y)return"break";var X=d[z];h.forEach(function(R){var V=new _c(R),he=e.findForwardRmpathEdges(a,V.edges[X],v,V);he.length>0&&(y=!0,M=o.dfsEdgeList[X].fromNode,he.forEach(function(ce){var le="".concat(ce.label,"-").concat(i[ce.to].label);A[le]||(A[le]={projected:[],edgeLabel:ce.label,nodeLabel2:i[ce.to].label}),A[le].projected.push({graphId:a.id,edge:ce,preNode:R})}))})},x=0;x<C;x++){var k=I(x);if(k==="break")break}if(!y)return!0;var O=e.findMinLabel(A);o.dfsEdgeList.push(new No(M,p+1,In.VACANT_NODE_LABEL,O.edgeLabel,O.nodeLabel2));var B=o.dfsEdgeList.length-1;return r.dfsEdgeList[B]!==o.dfsEdgeList[B]?!1:c(A["".concat(O.edgeLabel,"-").concat(O.nodeLabel2)].projected)},l="".concat(u.nodeLabel1,"-").concat(u.edgeLabel,"-").concat(u.nodeLabel2);return f(s[l].projected)}},t.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var e=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push((0,g$.clone)(e))}},t.prototype.subGraphMining=function(e){var r=this,n=this.getSupport(e);if(!(n<this.minSupport)&&this.isMin()){this.report();var a=this.dfsCode.getNodeNum(),i=this.dfsCode.buildRmpath(),o=this.dfsCode.dfsEdgeList[i[0]].toNode,s=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,u={},f={};e.forEach(function(l){for(var c=r.graphs[l.graphId],h=c.nodeMap,d=new _c(l),v=i.length-1;v>=0;v--){var p=r.findBackwardEdge(c,d.edges[i[v]],d.edges[i[0]],d);if(p){var g="".concat(r.dfsCode.dfsEdgeList[i[v]].fromNode,"-").concat(p.label);f[g]||(f[g]={projected:[],toNodeId:r.dfsCode.dfsEdgeList[i[v]].fromNode,edgeLabel:p.label}),f[g].projected.push({graphId:l.graphId,edge:p,preNode:l})}}if(!(a>=r.maxNodeNum)){var y=r.findForwardPureEdges(c,d.edges[i[0]],s,d);y.forEach(function(b){var w="".concat(o,"-").concat(b.label,"-").concat(h[b.to].label);u[w]||(u[w]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:h[b.to].label}),u[w].projected.push({graphId:l.graphId,edge:b,preNode:l})});for(var m=function(w){var x=r.findForwardRmpathEdges(c,d.edges[i[w]],s,d);x.forEach(function(E){var _="".concat(r.dfsCode.dfsEdgeList[i[w]].fromNode,"-").concat(E.label,"-").concat(h[E.to].label);u[_]||(u[_]={projected:[],fromNodeId:r.dfsCode.dfsEdgeList[i[w]].fromNode,edgeLabel:E.label,nodeLabel2:h[E.to].label}),u[_].projected.push({graphId:l.graphId,edge:E,preNode:l})})},v=0;v<i.length;v++)m(v)}}),Object.keys(f).forEach(function(l){var c=f[l],h=c.toNodeId,d=c.edgeLabel;r.dfsCode.dfsEdgeList.push(new No(o,h,"-1",d,"-1")),r.subGraphMining(f[l].projected),r.dfsCode.dfsEdgeList.pop()}),Object.keys(u).forEach(function(l){var c=u[l],h=c.fromNodeId,d=c.edgeLabel,v=c.nodeLabel2;r.dfsCode.dfsEdgeList.push(new No(h,o+1,In.VACANT_NODE_LABEL,d,v)),r.subGraphMining(u[l].projected),r.dfsCode.dfsEdgeList.pop()})}},t.prototype.generate1EdgeFrequentSubGraphs=function(){var e=this.graphs,r=this.directed,n=this.minSupport,a=this.frequentSize1Subgraphs,i={},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=i[d]||0;p++,i[d]=p}s[v]={graphKey:u,label:d},c.edges.forEach(function(g){var y=d,m=l[g.to].label;if(!r&&y>m){var b=m;m=y,y=b}var w=g.label,x="".concat(y,"-").concat(w,"-").concat(m);if(!o[x]){var E=o[x]||0;E++,o[x]=E}})})}),Object.keys(i).forEach(function(u){var f=i[u];if(!(f<n)){var l={nodes:[],edges:[]};l.nodes.push({id:"0",label:u}),a.push(l)}}),a},t.prototype.run=function(){var e=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var r=this.graphs;this.directed;var n={};Object.keys(r).forEach(function(a){var i=r[a],o=i.nodeMap;i.nodes.forEach(function(s){var u=e.findForwardRootEdges(i,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:a,edge:f,preNode:null};n[c].projected.push(h)})})}),Object.keys(n).forEach(function(a){var i=n[a],o=i.projected,s=i.nodeLabel1,u=i.edgeLabel,f=i.nodeLabel2;e.dfsCode.dfsEdgeList.push(new No(0,1,s,u,f)),e.subGraphMining(o),e.dfsCode.dfsEdgeList.pop()})}},t}(),m$=function(e,r,n,a){var i={};return Object.keys(e).forEach(function(o,s){var u=e[o],f=new In.Graph(s,!0,r),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[a])}),f&&f.getNodeNum()&&(i[f.id]=f)}),i},b$=function(e,r,n){var a=[];return e.forEach(function(i){var o={nodes:[],edges:[]};i.nodes.forEach(function(s){var u;o.nodes.push((u={id:"".concat(s.id)},u[r]=s.label,u))}),i.edges.forEach(function(s){var u;o.edges.push((u={source:"".concat(s.from),target:"".concat(s.to)},u[n]=s.label,u))}),a.push(o)}),a},Yx="cluster",w$=function(e){var r=e.graphs,n=e.directed,a=n===void 0?!1:n,i=e.nodeLabelProp,o=i===void 0?Yx:i,s=e.edgeLabelProp,u=s===void 0?Yx:s,f=m$(r,a,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:a},g=new y$(p);g.run();var y=b$(g.frequentSubgraphs,o,u);return y},x$=w$;Rd.default=x$;Object.defineProperty(Pd,"__esModule",{value:!0});Pd.default=void 0;var qx=uT,Hx=Vy(tl),E$=Vy(Rd),Zx=Vy(gu),_$=Wr;function Vy(t){return t&&t.__esModule?t:{default:t}}var Kx=function(e,r,n,a){n===void 0&&(n="cluster"),a===void 0&&(a=2);var i=[],o=e.nodes;return r.forEach(function(s,u){i.push(wT(o,s,u,n,a))}),i},wT=function(e,r,n,a,i){var o=[n],s=[],u={};return r.forEach(function(f,l){if(f<=i&&n!==l){o.push(l),s.push(e[l]);var c=e[l][a];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}},S$=function(e,r,n,a,i){var o=Math.ceil(n/r),s={},u=0;return a.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()*r),g++,!(g>2*r)););if(g<2*r&&(s["".concat(l,"-").concat(p)]={start:l,end:p,distance:i[l][p]},c++,u++,u>=n))return s;if(h++,h>2*r)break}if(c<o){var y=o-c;o=(o+y)/(r-l-1)}}),s},fh=function(e,r,n,a){var i=n.nodes;return a||(a={}),Object.keys(e).forEach(function(o){var s,u;if(!(a&&a[o])){a[o]={nodes:[],edges:[]};var f=e[o],l=(s=r[f.start])===null||s===void 0?void 0:s.nodeIdxs,c=(u=r[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=i[d[g]];a[o].nodes.push(y),v[y.id]=!0}n.edges.forEach(function(m){v[m.source]&&v[m.target]&&a[o].edges.push(m)})}}}}),a},lh=function(e,r,n,a){var i,o,s={};e.nodes.forEach(function(f){s[f.id]=f});var u=0;return!(!((i=r==null?void 0:r.edges)===null||i===void 0)&&i.length)||((o=r==null?void 0:r.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=r==null?void 0:r.nodes[0][n],d=r==null?void 0:r.nodes[1][n],v=r==null?void 0:r.edges[0][a];f[a]===v&&(l===h&&c===d||l===d&&c===h)&&u++}),u)},M$=function(e,r,n){for(var a=1/0,i=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 w=0,x=m.length;m.graphs.forEach(function(E,_){var S=l[E];m.graphs.forEach(function(A,M){_!==M&&(w+=Math.abs(S-l[A]))})}),w/=x*(x-1)/2,v+=w}),v/=d.length;var g=0;p.forEach(function(m,b){p.forEach(function(w,x){b!==x&&(g+=Math.abs(m-w))}),g/=p.length*(p.length-1)/2});var y=g-v;a<y&&(a=y,i=f)},s=0;s<r;s++)o(s);return{structure:n[i],structureCountMap:e[i]}},Qx=function(e,r){var n={},a={};return e.forEach(function(i,o){n[i.id]={idx:o,node:i,degree:0,inDegree:0,outDegree:0};var s=i[r];a[s]||(a[s]=[]),a[s].push(i)}),{nodeMap:n,nodeLabelMap:a}},Jx=function(e,r,n){var a={},i={};return e.forEach(function(o,s){a["".concat(_$.uniqueId)]={idx:s,edge:o};var u=o[r];i[u]||(i[u]=[]),i[u].push(o);var f=n[o.source];f&&(f.degree++,f.outDegree++);var l=n[o.target];l&&(l.degree++,l.inDegree++)}),{edgeMap:a,edgeLabelMap:i}},eE=function(e,r,n){var a=r.length,i={};return r.forEach(function(o,s){for(var u=n?0:s+1,f=e[s].id,l=u;l<a;l++)if(s!==l){var c=e[l].id,h=o[l];i["".concat(f,"-").concat(c)]=h,n||(i["".concat(c,"-").concat(f)]=h)}}),i},A$=function(e,r,n,a,i,o,s,u,f,l,c){var h,d="".concat(r.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:a[r.id].idx,end:a[n.id].idx,distance:i},h);c=fh(p,o,e,c),v=c[d]}return lh(v,s,u,f)},tE=function(e,r,n,a){var i,o,s,u=(i=e[r])===null||i===void 0?void 0:i.degree,f=(o=e[r])===null||o===void 0?void 0:o.inDegree,l=(s=e[r])===null||s===void 0?void 0:s.outDegree;return e[r]===void 0&&(u=1/0,f=1/0,l=1/0,a[r].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[r]={degree:u,inDegree:f,outDegree:l}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:f,minPatternNodeLabelOutDegree:l}},C$=function(e,r,n,a,i,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,Hx.default)(e,n),c=(0,Hx.default)(r,n),h=eE(e.nodes,l,n),d=eE(r.nodes,c,n),v=Qx(e.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=Qx(r.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;Jx(e.edges,s,p);var w=Jx(r.edges,s,m).edgeLabelMap,x=[];c==null||c.forEach(function(tt){x=x.concat(tt)}),i||(i=Math.max.apply(Math,(0,qx.__spreadArray)((0,qx.__spreadArray)([],x,!1),[2],!1))),a||(a=i);var E=Kx(e,l,o,a),_=Kx(r,c,o,a),S=Math.min(100,f*(f-1)/2),A=S$(a,f,S,E,l),M=fh(A,E,e),C=10,I=1,k=1,O=4,B={graphs:M,nodeLabelProp:o,edgeLabelProp:s,minSupport:I,minNodeNum:k,maxNodeNum:O,directed:n},L=(0,E$.default)(B).slice(0,C),z=L.length,X=[];L.forEach(function(tt,te){X[te]={},Object.keys(M).forEach(function(N){var Se=M[N],Fe=lh(Se,tt,o,s);X[te][N]=Fe})});var R=M$(X,z,L),V=R.structure,he=R.structureCountMap,ce=r.nodes[0],le=[],ie=(u=r.nodes[0])===null||u===void 0?void 0:u[o],Ie=-1/0;r.nodes.forEach(function(tt){var te=tt[o],N=g[te];(N==null?void 0:N.length)>Ie&&(Ie=N.length,le=N,ie=te,ce=tt)});var qe={},Ve={},it={},dt={},st={},Tt={};Object.keys(b).forEach(function(tt,te){st[tt]=[],n&&(Tt[tt]=[]);var N=b[tt],Se={};N.forEach(function(Ze){var Je=d["".concat(ce.id,"-").concat(Ze.id)];if(Je&&st[tt].push(Je),Se["".concat(ce.id,"-").concat(Ze.id)]={start:0,end:m[Ze.id].idx,distance:Je},n){var ht=d["".concat(Ze.id,"-").concat(ce.id)];ht&&Tt[tt].push(ht)}}),st[tt]=st[tt].sort(function(Ze,Je){return Ze-Je}),n&&(Tt[tt]=Tt[tt].sort(function(Ze,Je){return Ze-Je})),Ve=fh(Se,_,r,Ve);var Fe=[];if(Object.keys(Se).forEach(function(Ze){if(it[Ze]){Fe.push(it[Ze]);return}var Je=Ve[Ze];it[Ze]=lh(Je,V,o,s),Fe.push(it[Ze])}),Fe=Fe.sort(function(Ze,Je){return Je-Ze}),dt["".concat(ce.id,"-").concat(tt)]=Fe,tt!==ie)for(var ge=(le==null?void 0:le.length)||0,Ue=function(Je){var ht=le[Je],Lt=E[p[ht.id].idx],ur=Lt.nodeLabelCountMap[tt],Dt=b[tt].length;if(!ur||ur.count<Dt)return le.splice(Je,1),"continue";for(var fr=!1,or=0;or<Dt;or++)if(ur.dists[or]>st[tt][or]){fr=!0;break}if(fr)return le.splice(Je,1),"continue";var gr={};Lt.neighbors.forEach(function(nr){var Fr=h["".concat(ht.id,"-").concat(nr.id)];gr["".concat(ht.id,"-").concat(nr.id)]={start:p[ht.id].idx,end:p[nr.id].idx,distance:Fr}}),M=fh(gr,E,e,M);var hr=[];Object.keys(gr).forEach(function(nr){if(he[nr]){hr.push(he[nr]);return}var Fr=M[nr];he[nr]=lh(Fr,V,o,s),hr.push(he[nr])}),hr=hr.sort(function(nr,Fr){return Fr-nr});for(var hn=!1,or=0;or<Dt;or++)if(hr[or]<Fe[or]){hn=!0;break}if(hn)return le.splice(Je,1),"continue"},$e=ge-1;$e>=0;$e--)Ue($e)});var _t=[];le==null||le.forEach(function(tt){for(var te=p[tt.id].idx,N=wT(e.nodes,l[te],te,o,i),Se=N.neighbors,Fe=Se.length,ge=!1,Ue=Fe-1;Ue>=0;Ue--){if(Se.length+1<r.nodes.length){ge=!0;return}var $e=Se[Ue],Ze=$e[o];if(!b[Ze]||!b[Ze].length){Se.splice(Ue,1);continue}if(!st[Ze]||!st[Ze].length){Se.splice(Ue,1);continue}var Je="".concat(tt.id,"-").concat($e.id),ht=h[Je],Lt=st[Ze].length-1,ur=st[Ze][Lt];if(ht>ur){Se.splice(Ue,1);continue}if(n){var Dt="".concat($e.id,"-").concat(tt.id),fr=h[Dt];Lt=Tt[Ze].length-1;var or=Tt[Ze][Lt];if(fr>or){Se.splice(Ue,1);continue}}var gr=he[Je]?he[Je]:A$(e,tt,$e,p,ht,E,V,o,s,he,M),hr="".concat(ce.id,"-").concat(Ze),hn=dt[hr][dt[hr].length-1];if(gr<hn){Se.splice(Ue,1);continue}var nr=tE(qe,Ze,m,b),Fr=nr.minPatternNodeLabelDegree;if(nr.minPatternNodeLabelInDegree,nr.minPatternNodeLabelOutDegree,p[$e.id].degree<Fr){Se.splice(Ue,1);continue}}ge||_t.push({nodes:[tt].concat(Se)})});var lr=(0,Zx.default)(r,ce.id,!1).length,Bt={};n?(Object.keys(lr).forEach(function(tt){var te=m[tt].node[o];Bt[te]?Bt[te].push(lr[tt]):Bt[te]=[lr[tt]]}),Object.keys(Bt).forEach(function(tt){Bt[tt].sort(function(te,N){return te-N})})):Bt=st;for(var Wt=_t.length,vr=function(te){var N=_t[te],Se=N.nodes[0],Fe={},ge={};N.nodes.forEach(function(St,dr){ge[St.id]={idx:dr,node:St,degree:0,inDegree:0,outDegree:0};var gt=St[o];Fe[gt]?Fe[gt]++:Fe[gt]=1});var Ue=[],$e={};e.edges.forEach(function(St){ge[St.source]&&ge[St.target]&&(Ue.push(St),$e[St[s]]?$e[St[s]]++:$e[St[s]]=1,ge[St.source].degree++,ge[St.target].degree++,ge[St.source].outDegree++,ge[St.target].inDegree++)});for(var Ze=Object.keys(w).length,Je=!1,ht=0;ht<Ze;ht++){var Lt=Object.keys(w)[ht];if(!$e[Lt]||$e[Lt]<w[Lt].length){Je=!0;break}}if(Je)return _t.splice(te,1),"continue";var ur=Ue.length;if(ur<r.edges.length)return _t.splice(te,1),"break";for(var Dt=!1,fr=function(dr){var gt=Ue[dr],Sr=gt[s],dn=w[Sr];if(!dn||!dn.length)return $e[Sr]--,dn&&$e[Sr]<dn.length?(Dt=!0,"break"):(Ue.splice(dr,1),ge[gt.source].degree--,ge[gt.target].degree--,ge[gt.source].outDegree--,ge[gt.target].inDegree--,"continue");var fo=ge[gt.source].node[o],lo=ge[gt.target].node[o],ri=!1;if(dn.forEach(function(co){var ho=m[co.source].node,vo=m[co.target].node;ho[o]===fo&&vo[o]===lo&&(ri=!0),!n&&ho[o]===lo&&vo[o]===fo&&(ri=!0)}),!ri)return $e[Sr]--,dn&&$e[Sr]<dn.length?(Dt=!0,"break"):(Ue.splice(dr,1),ge[gt.source].degree--,ge[gt.target].degree--,ge[gt.source].outDegree--,ge[gt.target].inDegree--,"continue")},ht=ur-1;ht>=0;ht--){var or=fr(ht);if(or==="break")break}if(Dt)return _t.splice(te,1),"continue";N.edges=Ue;var gr=(0,Zx.default)(N,N.nodes[0].id,!1).length;if(Object.keys(gr).reverse().forEach(function(St){if(!(St===N.nodes[0].id||Dt)){if(gr[St]===1/0){var dr=ge[St].node[o];if(Fe[dr]--,Fe[dr]<b[dr].length){Dt=!0;return}var gt=N.nodes.indexOf(ge[St].node);N.nodes.splice(gt,1),ge[St]=void 0;return}var Sr=p[St].node[o];if(!Bt[Sr]||!Bt[Sr].length||gr[St]>Bt[Sr][Bt[Sr].length-1]){var dr=ge[St].node[o];if(Fe[dr]--,Fe[dr]<b[dr].length){Dt=!0;return}var gt=N.nodes.indexOf(ge[St].node);N.nodes.splice(gt,1),ge[St]=void 0}}}),Dt)return _t.splice(te,1),"continue";for(var hr=!0,hn=0;hr&&!Dt;){hr=!1;var nr=n?ge[Se.id].degree<m[ce.id].degree||ge[Se.id].inDegree<m[ce.id].inDegree||ge[Se.id].outDegree<m[ce.id].outDegree:ge[Se.id].degree<m[ce.id].degree;if(nr){Dt=!0;break}if(Fe[Se[o]]<b[Se[o]].length){Dt=!0;break}for(var Fr=N.nodes.length,oa=Fr-1;oa>=0;oa--){var Ur=N.nodes[oa],Mi=ge[Ur.id].degree,xu=ge[Ur.id].inDegree,Eu=ge[Ur.id].outDegree,rn=Ur[o],ti=tE(qe,rn,m,b),uo=ti.minPatternNodeLabelDegree,_u=ti.minPatternNodeLabelInDegree,Su=ti.minPatternNodeLabelOutDegree,Mu=n?Mi<uo||xu<_u||Eu<Su:Mi<uo;if(Mu){if(Fe[Ur[o]]--,Fe[Ur[o]]<b[Ur[o]].length){Dt=!0;break}N.nodes.splice(oa,1),ge[Ur.id]=void 0,hr=!0}}if(Dt||!hr&&hn!==0)break;ur=Ue.length;for(var sa=ur-1;sa>=0;sa--){var Br=Ue[sa];if(!ge[Br.source]||!ge[Br.target]){Ue.splice(sa,1);var ua=Br[s];if($e[ua]--,ge[Br.source]&&(ge[Br.source].degree--,ge[Br.source].outDegree--),ge[Br.target]&&(ge[Br.target].degree--,ge[Br.target].inDegree--),w[ua]&&$e[ua]<w[ua].length){Dt=!0;break}hr=!0}}hn++}if(Dt||Dt||N.nodes.length<r.nodes.length||Ue.length<r.edges.length)return _t.splice(te,1),"continue"},cr=Wt-1;cr>=0;cr--){var $t=vr(cr);if($t==="break")break}for(var sr=_t.length,tn=function(te){var N=_t[te],Se={};N.edges.forEach(function(Ue){var $e="".concat(Ue.source,"-").concat(Ue.target,"-").concat(Ue.label);Se[$e]?Se[$e]++:Se[$e]=1});for(var Fe=function($e){var Ze=_t[$e],Je={};Ze.edges.forEach(function(Lt){var ur="".concat(Lt.source,"-").concat(Lt.target,"-").concat(Lt.label);Je[ur]?Je[ur]++:Je[ur]=1});var ht=!0;Object.keys(Je).length!==Object.keys(Se).length?ht=!1:Object.keys(Se).forEach(function(Lt){Je[Lt]!==Se[Lt]&&(ht=!1)}),ht&&_t.splice($e,1)},ge=sr-1;ge>te;ge--)Fe(ge);sr=_t.length},cr=0;cr<=sr-1;cr++)tn(cr);return _t}}},T$=C$;Pd.default=T$;(function(t){function e(w){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(x){return typeof x}:function(x){return x&&typeof Symbol=="function"&&x.constructor===Symbol&&x!==Symbol.prototype?"symbol":typeof x},e(w)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"GADDI",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(t,"breadthFirstSearch",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"connectedComponent",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"depthFirstSearch",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"detectCycle",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"dijkstra",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"findAllPath",{enumerable:!0,get:function(){return f.findAllPath}}),Object.defineProperty(t,"findShortestPath",{enumerable:!0,get:function(){return f.findShortestPath}}),Object.defineProperty(t,"floydWarshall",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"getAdjMatrix",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"getDegree",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"getInDegree",{enumerable:!0,get:function(){return i.getInDegree}}),Object.defineProperty(t,"getNeighbors",{enumerable:!0,get:function(){return g.getNeighbors}}),Object.defineProperty(t,"getOutDegree",{enumerable:!0,get:function(){return i.getOutDegree}}),Object.defineProperty(t,"labelPropagation",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(t,"louvain",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(t,"minimumSpanningTree",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(t,"pageRank",{enumerable:!0,get:function(){return v.default}});var r=b(Ko),n=b(Ad),a=b(Zi),i=m(pi),o=b(za),s=b(Td),u=b(gu),f=eu,l=b(tl),c=b(Id),h=b(kd),d=b(Nd),v=b(Dd),p=b(Pd),g=Wr;function y(w){if(typeof WeakMap!="function")return null;var x=new WeakMap,E=new WeakMap;return(y=function(S){return S?E:x})(w)}function m(w,x){if(w&&w.__esModule)return w;if(w===null||e(w)!=="object"&&typeof w!="function")return{default:w};var E=y(x);if(E&&E.has(w))return E.get(w);var _={},S=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var A in w)if(A!=="default"&&Object.prototype.hasOwnProperty.call(w,A)){var M=S?Object.getOwnPropertyDescriptor(w,A):null;M&&(M.get||M.set)?Object.defineProperty(_,A,M):_[A]=w[A]}return _.default=w,E&&E.set(w,_),_}function b(w){return w&&w.__esModule?w:{default:w}}})(QC);function ig(t){"@babel/helpers - typeof";return ig=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},ig(t)}Object.defineProperty(Md,"__esModule",{value:!0});Md.default=void 0;var Mp=I$(QC),rE=Hi;function xT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(xT=function(a){return a?r:e})(t)}function I$(t,e){if(t&&t.__esModule)return t;if(t===null||ig(t)!=="object"&&typeof t!="function")return{default:t};var r=xT(e);if(r&&r.has(t))return r.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var o=a?Object.getOwnPropertyDescriptor(t,i):null;o&&(o.get||o.set)?Object.defineProperty(n,i,o):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}var Ap=typeof self<"u"?self:{};Ap.onmessage=function(t){var e=t.data,r=e._algorithmType,n=e.data;if(r){if(typeof Mp[r]=="function"){var a=Mp[r].apply(Mp,n);Ap.postMessage({_algorithmType:rE.MESSAGE.SUCCESS,data:a});return}Ap.postMessage({_algorithmType:rE.MESSAGE.FAILURE})}};var k$=null;Md.default=k$;Object.defineProperty(Sd,"__esModule",{value:!0});Sd.default=void 0;var N$=Hi,O$=L$(Md);function L$(t){return t&&t.__esModule?t:{default:t}}var D$=function(e){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return new Promise(function(a,i){var o=new O$.default;o.postMessage({_algorithmType:e,data:r}),o.onmessage=function(s){var u=s.data,f=u.data,l=u._algorithmType;N$.MESSAGE.SUCCESS===l?a(f):i(),o.terminate()}})}},P$=D$;Sd.default=P$;Object.defineProperty(Yt,"__esModule",{value:!0});Yt.pageRankAsync=Yt.minimumSpanningTreeAsync=Yt.louvainAsync=Yt.labelPropagationAsync=Yt.getOutDegreeAsync=Yt.getNeighborsAsync=Yt.getInDegreeAsync=Yt.getDegreeAsync=Yt.getAdjMatrixAsync=Yt.floydWarshallAsync=Yt.findShortestPathAsync=Yt.findAllPathAsync=Yt.dijkstraAsync=Yt.detectCycleAsync=Yt.detectAllUndirectedCycleAsync=Yt.detectAllDirectedCycleAsync=Yt.detectAllCyclesAsync=Yt.connectedComponentAsync=Yt.GADDIAsync=void 0;var Jr=R$(Sd),en=Hi;function R$(t){return t&&t.__esModule?t:{default:t}}var F$=function(e,r){return(0,Jr.default)(en.ALGORITHM.getAdjMatrix).apply(void 0,[e,r])};Yt.getAdjMatrixAsync=F$;var B$=function(e,r){return(0,Jr.default)(en.ALGORITHM.connectedComponent).apply(void 0,[e,r])};Yt.connectedComponentAsync=B$;var G$=function(e){return(0,Jr.default)(en.ALGORITHM.getDegree)(e)};Yt.getDegreeAsync=G$;var z$=function(e,r){return(0,Jr.default)(en.ALGORITHM.getInDegree)(e,r)};Yt.getInDegreeAsync=z$;var j$=function(e,r){return(0,Jr.default)(en.ALGORITHM.getOutDegree)(e,r)};Yt.getOutDegreeAsync=j$;var U$=function(e){return(0,Jr.default)(en.ALGORITHM.detectCycle)(e)};Yt.detectCycleAsync=U$;var $$=function(e){return(0,Jr.default)(en.ALGORITHM.detectAllCycles)(e)};Yt.detectAllCyclesAsync=$$;var X$=function(e){return(0,Jr.default)(en.ALGORITHM.detectAllDirectedCycle)(e)};Yt.detectAllDirectedCycleAsync=X$;var W$=function(e){return(0,Jr.default)(en.ALGORITHM.detectAllUndirectedCycle)(e)};Yt.detectAllUndirectedCycleAsync=W$;var V$=function(e,r,n,a){return(0,Jr.default)(en.ALGORITHM.dijkstra).apply(void 0,[e,r,n,a])};Yt.dijkstraAsync=V$;var Y$=function(e,r,n,a){return(0,Jr.default)(en.ALGORITHM.findAllPath).apply(void 0,[e,r,n,a])};Yt.findAllPathAsync=Y$;var q$=function(e,r,n,a,i){return(0,Jr.default)(en.ALGORITHM.findShortestPath).apply(void 0,[e,r,n,a,i])};Yt.findShortestPathAsync=q$;var H$=function(e,r){return(0,Jr.default)(en.ALGORITHM.floydWarshall).apply(void 0,[e,r])};Yt.floydWarshallAsync=H$;var Z$=function(e,r,n,a){return a===void 0&&(a=1e3),(0,Jr.default)(en.ALGORITHM.labelPropagation)(e,r,n,a)};Yt.labelPropagationAsync=Z$;var K$=function(e,r,n,a){return(0,Jr.default)(en.ALGORITHM.louvain)(e,r,n,a)};Yt.louvainAsync=K$;var Q$=function(e,r,n){return(0,Jr.default)(en.ALGORITHM.minimumSpanningTree).apply(void 0,[e,r,n])};Yt.minimumSpanningTreeAsync=Q$;var J$=function(e,r,n){return(0,Jr.default)(en.ALGORITHM.pageRank).apply(void 0,[e,r,n])};Yt.pageRankAsync=J$;var e9=function(e,r,n){return(0,Jr.default)(en.ALGORITHM.getNeighbors).apply(void 0,[e,r,n])};Yt.getNeighborsAsync=e9;var t9=function(e,r,n,a,i,o,s){return n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),(0,Jr.default)(en.ALGORITHM.GADDI).apply(void 0,[e,r,n,a,i,o,s])};Yt.GADDIAsync=t9;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"GADDIAsync",{enumerable:!0,get:function(){return e.GADDIAsync}}),Object.defineProperty(t,"connectedComponentAsync",{enumerable:!0,get:function(){return e.connectedComponentAsync}}),t.default=void 0,Object.defineProperty(t,"detectAllCyclesAsync",{enumerable:!0,get:function(){return e.detectAllCyclesAsync}}),Object.defineProperty(t,"detectAllDirectedCycleAsync",{enumerable:!0,get:function(){return e.detectAllDirectedCycleAsync}}),Object.defineProperty(t,"detectAllUndirectedCycleAsync",{enumerable:!0,get:function(){return e.detectAllUndirectedCycleAsync}}),Object.defineProperty(t,"detectCycleAsync",{enumerable:!0,get:function(){return e.detectCycleAsync}}),t.detectDirectedCycleAsync=void 0,Object.defineProperty(t,"dijkstraAsync",{enumerable:!0,get:function(){return e.dijkstraAsync}}),Object.defineProperty(t,"findAllPathAsync",{enumerable:!0,get:function(){return e.findAllPathAsync}}),Object.defineProperty(t,"findShortestPathAsync",{enumerable:!0,get:function(){return e.findShortestPathAsync}}),Object.defineProperty(t,"floydWarshallAsync",{enumerable:!0,get:function(){return e.floydWarshallAsync}}),Object.defineProperty(t,"getAdjMatrixAsync",{enumerable:!0,get:function(){return e.getAdjMatrixAsync}}),Object.defineProperty(t,"getDegreeAsync",{enumerable:!0,get:function(){return e.getDegreeAsync}}),Object.defineProperty(t,"getInDegreeAsync",{enumerable:!0,get:function(){return e.getInDegreeAsync}}),Object.defineProperty(t,"getNeighborsAsync",{enumerable:!0,get:function(){return e.getNeighborsAsync}}),Object.defineProperty(t,"getOutDegreeAsync",{enumerable:!0,get:function(){return e.getOutDegreeAsync}}),Object.defineProperty(t,"labelPropagationAsync",{enumerable:!0,get:function(){return e.labelPropagationAsync}}),Object.defineProperty(t,"louvainAsync",{enumerable:!0,get:function(){return e.louvainAsync}}),Object.defineProperty(t,"minimumSpanningTreeAsync",{enumerable:!0,get:function(){return e.minimumSpanningTreeAsync}}),Object.defineProperty(t,"pageRankAsync",{enumerable:!0,get:function(){return e.pageRankAsync}});var e=Yt,r=e.detectCycleAsync;t.detectDirectedCycleAsync=r;var n={getAdjMatrixAsync:e.getAdjMatrixAsync,connectedComponentAsync:e.connectedComponentAsync,getDegreeAsync:e.getDegreeAsync,getInDegreeAsync:e.getInDegreeAsync,getOutDegreeAsync:e.getOutDegreeAsync,detectCycleAsync:e.detectCycleAsync,detectDirectedCycleAsync:r,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};t.default=n})($y);const r9=bi($y),n9=FP({__proto__:null,default:r9},[$y]);function a9(){return window?window.devicePixelRatio:1}function ET(t,e,r,n){var a=t-r,i=e-n;return Math.sqrt(a*a+i*i)}function Ro(t,e,r,n,a,i){return a>=t&&a<=t+r&&i>=e&&i<=e+n}function Uf(t,e){return!(e.minX>t.maxX||e.maxX<t.minX||e.minY>t.maxY||e.maxY<t.minY)}function i9(t,e){return!t||!e?t||e:{minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}}function nE(t,e){return t[0]===e[0]&&t[1]===e[1]}var o9=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,s9=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,u9=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,_T=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function ST(t,e){var r=t.match(_T);_e(r,function(n){var a=n.split(":");e.addColorStop(a[0],a[1])})}function f9(t,e,r){var n=o9.exec(r),a=parseFloat(n[1])%360*(Math.PI/180),i=n[2],o=e.getBBox(),s,u;a>=0&&a<1/2*Math.PI?(s={x:o.minX,y:o.minY},u={x:o.maxX,y:o.maxY}):1/2*Math.PI<=a&&a<Math.PI?(s={x:o.maxX,y:o.minY},u={x:o.minX,y:o.maxY}):Math.PI<=a&&a<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(a),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=t.createLinearGradient(s.x,s.y,c,h);return ST(i,d),d}function l9(t,e,r){var n=s9.exec(r),a=parseFloat(n[1]),i=parseFloat(n[2]),o=parseFloat(n[3]),s=n[4];if(o===0){var u=s.match(_T);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=t.createRadialGradient(f.minX+l*a,f.minY+c*i,0,f.minX+l/2,f.minY+c/2,o*h);return ST(s,d),d}function c9(t,e,r){if(e.get("patternSource")&&e.get("patternSource")===r)return e.get("pattern");var n,a,i=u9.exec(r),o=i[1],s=i[2];function u(){n=t.createPattern(a,o),e.set("pattern",n),e.set("patternSource",r)}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 a=new Image,s.match(/^data:/i)||(a.crossOrigin="Anonymous"),a.src=s,a.complete?u():(a.onload=u,a.src=a.src),n}function h9(t,e,r){var n=e.getBBox();if(isNaN(n.x)||isNaN(n.y)||isNaN(n.width)||isNaN(n.height))return r;if(Ye(r)){if(r[1]==="("||r[2]==="("){if(r[0]==="l")return f9(t,e,r);if(r[0]==="r")return l9(t,e,r);if(r[0]==="p")return c9(t,e,r)}return r}if(r instanceof CanvasPattern)return r}function d9(t){var e=0,r=0,n=0,a=0;return bt(t)?t.length===1?e=r=n=a=t[0]:t.length===2?(e=n=t[0],r=a=t[1]):t.length===3?(e=t[0],r=a=t[1],n=t[2]):(e=t[0],r=t[1],n=t[2],a=t[3]):e=r=n=a=t,[e,r,n,a]}function Sc(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function og(t,e){return Sc(t)*Sc(e)?(t[0]*e[0]+t[1]*e[1])/(Sc(t)*Sc(e)):1}function aE(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(og(t,e))}function iE(t,e){var r=e[1],n=e[2],a=gd(yd(e[3]),Math.PI*2),i=e[4],o=e[5],s=t[0],u=t[1],f=e[6],l=e[7],c=Math.cos(a)*(s-f)/2+Math.sin(a)*(u-l)/2,h=-1*Math.sin(a)*(s-f)/2+Math.cos(a)*(u-l)/2,d=c*c/(r*r)+h*h/(n*n);d>1&&(r*=Math.sqrt(d),n*=Math.sqrt(d));var v=r*r*(h*h)+n*n*(c*c),p=v?Math.sqrt((r*r*(n*n)-v)/v):1;i===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*r*h/n:0,y=r?p*-n*c/r:0,m=(s+f)/2+Math.cos(a)*g-Math.sin(a)*y,b=(u+l)/2+Math.sin(a)*g+Math.cos(a)*y,w=[(c-g)/r,(h-y)/n],x=[(-1*c-g)/r,(-1*h-y)/n],E=aE([1,0],w),_=aE(w,x);return og(w,x)<=-1&&(_=Math.PI),og(w,x)>=1&&(_=0),o===0&&_>0&&(_=_-2*Math.PI),o===1&&_<0&&(_=_+2*Math.PI),{cx:m,cy:b,rx:nE(t,[f,l])?0:r,ry:nE(t,[f,l])?0:n,startAngle:E,endAngle:E+_,xRotation:a,arcFlag:i,sweepFlag:o}}var jh=Math.sin,Uh=Math.cos,Yy=Math.atan2,Mc=Math.PI;function MT(t,e,r,n,a,i,o){var s=e.stroke,u=e.lineWidth,f=r-a,l=n-i,c=Yy(l,f),h=new Ky({type:"path",canvas:t.get("canvas"),isArrowShape:!0,attrs:{path:"M"+10*Uh(Mc/6)+","+10*jh(Mc/6)+" L0,0 L"+10*Uh(Mc/6)+",-"+10*jh(Mc/6),stroke:s,lineWidth:u}});h.translate(a,i),h.rotateAtPoint(a,i,c),t.set(o?"startArrowShape":"endArrowShape",h)}function AT(t,e,r,n,a,i,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=Kr(c,["d","fill","stroke","lineWidth"]),y=r-a,m=n-i,b=Yy(m,y);h&&(a=a-Uh(b)*h,i=i-jh(b)*h);var w=new Ky({type:"path",canvas:t.get("canvas"),isArrowShape:!0,attrs:P(P({},g),{stroke:v||f,lineWidth:p||l,fill:d})});w.translate(a,i),w.rotateAtPoint(a,i,b),t.set(o?"startArrowShape":"endArrowShape",w)}function Go(t,e,r,n,a){var i=Yy(n-e,r-t);return{dx:Uh(i)*a,dy:jh(i)*a}}function qy(t,e,r,n,a,i){typeof e.startArrow=="object"?AT(t,e,r,n,a,i,!0):e.startArrow?MT(t,e,r,n,a,i,!0):t.set("startArrowShape",null)}function Hy(t,e,r,n,a,i){typeof e.endArrow=="object"?AT(t,e,r,n,a,i,!1):e.endArrow?MT(t,e,r,n,a,i,!1):t.set("startArrowShape",null)}var oE={fill:"fillStyle",stroke:"strokeStyle",opacity:"globalAlpha"};function ru(t,e){var r=e.attr();for(var n in r){var a=r[n],i=oE[n]?oE[n]:n;i==="matrix"&&a?t.transform(a[0],a[1],a[3],a[4],a[6],a[7]):i==="lineDash"&&t.setLineDash?bt(a)&&t.setLineDash(a):(i==="strokeStyle"||i==="fillStyle"?a=h9(t,e,a):i==="globalAlpha"&&(a=a*t.globalAlpha),t[i]=a)}}function sg(t,e,r){for(var n=0;n<e.length;n++){var a=e[n];a.cfg.visible?a.draw(t,r):a.skipDraw()}}function v9(t,e,r){var n=t.get("refreshElements");_e(n,function(a){if(a!==t)for(var i=a.cfg.parent;i&&i!==t&&!i.cfg.refresh;)i.cfg.refresh=!0,i=i.cfg.parent}),n[0]===t?Zy(e):ug(e,r)}function ug(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(n.cfg.visible)if(n.cfg.hasChanged)n.cfg.refresh=!0,n.isGroup()&&Zy(n.cfg.children);else if(n.cfg.refresh)n.isGroup()&&ug(n.cfg.children,e);else{var a=p9(n,e);n.cfg.refresh=a,a&&n.isGroup()&&ug(n.cfg.children,e)}}}function CT(t){for(var e=0;e<t.length;e++){var r=t[e];r.cfg.hasChanged=!1,r.isGroup()&&!r.destroyed&&CT(r.cfg.children)}}function Zy(t,e){for(var r=0;r<t.length;r++){var n=t[r];n.cfg.visible&&(n.cfg.refresh=!0,n.isGroup()&&Zy(n.get("children")))}}function p9(t,e){var r=t.cfg.cacheCanvasBBox,n=t.cfg.isInView&&r&&Uf(r,e);return n}function TT(t,e,r,n){var a=r.path,i=r.startArrow,o=r.endArrow;if(a){var s=[0,0],u=[0,0],f={dx:0,dy:0};e.beginPath();for(var l=0;l<a.length;l++){var c=a[l],h=c[0];if(l===0&&i&&i.d){var d=t.getStartTangent();f=Go(d[0][0],d[0][1],d[1][0],d[1][1],i.d)}else if(l===a.length-2&&a[l+1][0]==="Z"&&o&&o.d){var v=a[l+1];if(v[0]==="Z"){var d=t.getEndTangent();f=Go(d[0][0],d[0][1],d[1][0],d[1][1],o.d)}}else if(l===a.length-1&&o&&o.d&&a[0]!=="Z"){var d=t.getEndTangent();f=Go(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=iE(s,c),n[l]=y)):y=iE(s,c);var m=y.cx,b=y.cy,w=y.rx,x=y.ry,E=y.startAngle,_=y.endAngle,S=y.xRotation,A=y.sweepFlag;if(e.ellipse)e.ellipse(m,b,w,x,S,E,_,1-A);else{var M=w>x?w:x,C=w>x?1:w/x,I=w>x?x/w:1;e.translate(m,b),e.rotate(S),e.scale(C,I),e.arc(0,0,M,E,_,1-A),e.scale(1/C,1/I),e.rotate(-S),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 IT(t,e){var r=t.get("canvas");r&&(e==="remove"&&(t._cacheCanvasBBox=t.get("cacheCanvasBBox")),t.get("hasChanged")||(t.set("hasChanged",!0),t.cfg.parent&&t.cfg.parent.get("hasChanged")||(r.refreshElement(t,e,r),r.get("autoDraw")&&r.draw())))}function g9(t){var e;if(t.destroyed)e=t._cacheCanvasBBox;else{var r=t.get("cacheCanvasBBox"),n=r&&!!(r.width&&r.height),a=t.getCanvasBBox(),i=a&&!!(a.width&&a.height);n&&i?e=i9(r,a):n?e=r:i&&(e=a)}return e}function y9(t){if(!t.length)return null;var e=[],r=[],n=[],a=[];return _e(t,function(i){var o=g9(i);o&&(e.push(o.minX),r.push(o.minY),n.push(o.maxX),a.push(o.maxY))}),{minX:Ha(e),minY:Ha(r),maxX:qa(n),maxY:qa(a)}}function m9(t,e){return!t||!e||!Uf(t,e)?null:{minX:Math.max(t.minX,e.minX),minY:Math.max(t.minY,e.minY),maxX:Math.min(t.maxX,e.maxX),maxY:Math.min(t.maxY,e.maxY)}}var kT=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.onCanvasChange=function(r){IT(this,r)},e.prototype.getShapeBase=function(){return ty},e.prototype.getGroupBase=function(){return e},e.prototype._applyClip=function(r,n){n&&(r.save(),ru(r,n),n.createPath(r),r.restore(),r.clip(),n._afterDraw())},e.prototype.cacheCanvasBBox=function(){var r=this.cfg.children,n=[],a=[];_e(r,function(h){var d=h.cfg.cacheCanvasBBox;d&&h.cfg.isInView&&(n.push(d.minX,d.maxX),a.push(d.minY,d.maxY))});var i=null;if(n.length){var o=Ha(n),s=qa(n),u=Ha(a),f=qa(a);i={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",Uf(i,c))}}else this.set("isInView",!1);this.set("cacheCanvasBBox",i)},e.prototype.draw=function(r,n){var a=this.cfg.children,i=n?this.cfg.refresh:!0;a.length&&i&&(r.save(),ru(r,this),this._applyClip(r,this.getClip()),sg(r,a,n),r.restore(),this.cacheCanvasBBox()),this.cfg.refresh=null,this.set("hasChanged",!1)},e.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("hasChanged",!1)},e}(xC),Ea=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.getShapeBase=function(){return ty},e.prototype.getGroupBase=function(){return kT},e.prototype.onCanvasChange=function(r){IT(this,r)},e.prototype.calculateBBox=function(){var r=this.get("type"),n=this.getHitLineWidth(),a=SC(r),i=a(this),o=n/2,s=i.x-o,u=i.y-o,f=i.x+i.width+o,l=i.y+i.height+o;return{x:s,minX:s,y:u,minY:u,width:i.width+n,height:i.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(r,n){n&&(r.save(),ru(r,n),n.createPath(r),r.restore(),r.clip(),n._afterDraw())},e.prototype.draw=function(r,n){var a=this.cfg.clipShape;if(n){if(this.cfg.refresh===!1){this.set("hasChanged",!1);return}var i=this.getCanvasBBox();if(!Uf(n,i)){this.set("hasChanged",!1),this.cfg.isInView&&this._afterDraw();return}}r.save(),ru(r,this),this._applyClip(r,a),this.drawPath(r),r.restore(),this._afterDraw()},e.prototype.getCanvasViewBox=function(){var r=this.cfg.canvas;return r?r.getViewRange():null},e.prototype.cacheCanvasBBox=function(){var r=this.getCanvasViewBox();if(r){var n=this.getCanvasBBox(),a=Uf(n,r);this.set("isInView",a),a?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(r){this.createPath(r),this.strokeAndFill(r),this.afterDrawPath(r)},e.prototype.fill=function(r){r.fill()},e.prototype.stroke=function(r){r.stroke()},e.prototype.strokeAndFill=function(r){var n=this.attrs,a=n.lineWidth,i=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isFill()&&(!Zt(s)&&s!==1?(r.globalAlpha=s,this.fill(r),r.globalAlpha=i):this.fill(r)),this.isStroke()&&a>0&&(!Zt(o)&&o!==1&&(r.globalAlpha=o),this.stroke(r)),this.afterDrawPath(r)},e.prototype.createPath=function(r){},e.prototype.afterDrawPath=function(r){},e.prototype.isInShape=function(r,n){var a=this.isStroke(),i=this.isFill(),o=this.getHitLineWidth();return this.isInStrokeOrPath(r,n,a,i,o)},e.prototype.isInStrokeOrPath=function(r,n,a,i,o){return!1},e.prototype.getHitLineWidth=function(){if(!this.isStroke())return 0;var r=this.attrs;return r.lineWidth+r.lineAppendWidth},e}(EC),b9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,r:0})},e.prototype.isInStrokeOrPath=function(r,n,a,i,o){var s=this.attr(),u=s.x,f=s.y,l=s.r,c=o/2,h=ET(u,f,r,n);return i&&a?h<=l+c:i?h<=l:a?h>=l-c&&h<=l+c:!1},e.prototype.createPath=function(r){var n=this.attr(),a=n.x,i=n.y,o=n.r;r.beginPath(),r.arc(a,i,o,0,Math.PI*2,!1),r.closePath()},e}(Ea);function Ac(t,e,r,n){return t/(r*r)+e/(n*n)}var w9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,rx:0,ry:0})},e.prototype.isInStrokeOrPath=function(r,n,a,i,o){var s=this.attr(),u=o/2,f=s.x,l=s.y,c=s.rx,h=s.ry,d=(r-f)*(r-f),v=(n-l)*(n-l);return i&&a?Ac(d,v,c+u,h+u)<=1:i?Ac(d,v,c,h)<=1:a?Ac(d,v,c-u,h-u)>=1&&Ac(d,v,c+u,h+u)<=1:!1},e.prototype.createPath=function(r){var n=this.attr(),a=n.x,i=n.y,o=n.rx,s=n.ry;if(r.beginPath(),r.ellipse)r.ellipse(a,i,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;r.save(),r.translate(a,i),r.scale(f,l),r.arc(0,0,u,0,Math.PI*2),r.restore(),r.closePath()}},e}(Ea);function sE(t){return t instanceof HTMLElement&&Ye(t.nodeName)&&t.nodeName.toUpperCase()==="CANVAS"}var x9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,width:0,height:0})},e.prototype.initAttrs=function(r){this._setImage(r.img)},e.prototype.isStroke=function(){return!1},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._afterLoading=function(){if(this.get("toDraw")===!0){var r=this.get("canvas");r?r.draw():this.createPath(this.get("context"))}},e.prototype._setImage=function(r){var n=this,a=this.attrs;if(Ye(r)){var i=new Image;i.onload=function(){if(n.destroyed)return!1;n.attr("img",i),n.set("loading",!1),n._afterLoading();var o=n.get("callback");o&&o.call(n)},i.crossOrigin="Anonymous",i.src=r,this.set("loading",!0)}else r instanceof Image?(a.width||(a.width=r.width),a.height||(a.height=r.height)):sE(r)&&(a.width||(a.width=Number(r.getAttribute("width"))),a.height||(a.height,Number(r.getAttribute("height"))))},e.prototype.onAttrChange=function(r,n,a){t.prototype.onAttrChange.call(this,r,n,a),r==="img"&&this._setImage(n)},e.prototype.createPath=function(r){if(this.get("loading")){this.set("toDraw",!0),this.set("context",r);return}var n=this.attr(),a=n.x,i=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||sE(h))&&(!Zt(u)&&!Zt(f)&&!Zt(l)&&!Zt(c)?r.drawImage(h,u,f,l,c,a,i,o,s):r.drawImage(h,a,i,o,s))},e}(Ea);function ji(t,e,r,n,a,i,o){var s=Math.min(t,r),u=Math.max(t,r),f=Math.min(e,n),l=Math.max(e,n),c=a/2;return i>=s-c&&i<=u+c&&o>=f-c&&o<=l+c?cn.pointToLine(t,e,r,n,i,o)<=a/2:!1}var E9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(r){this.setArrow()},e.prototype.onAttrChange=function(r,n,a){t.prototype.onAttrChange.call(this,r,n,a),this.setArrow()},e.prototype.setArrow=function(){var r=this.attr(),n=r.x1,a=r.y1,i=r.x2,o=r.y2,s=r.startArrow,u=r.endArrow;s&&qy(this,r,i,o,n,a),u&&Hy(this,r,n,a,i,o)},e.prototype.isInStrokeOrPath=function(r,n,a,i,o){if(!a||!o)return!1;var s=this.attr(),u=s.x1,f=s.y1,l=s.x2,c=s.y2;return ji(u,f,l,c,o,r,n)},e.prototype.createPath=function(r){var n=this.attr(),a=n.x1,i=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=Go(a,i,o,s,n.startArrow.d)),f&&f.d&&(c=Go(a,i,o,s,n.endArrow.d)),r.beginPath(),r.moveTo(a+l.dx,i+l.dy),r.lineTo(o-c.dx,s-c.dy)},e.prototype.afterDrawPath=function(r){var n=this.get("startArrowShape"),a=this.get("endArrowShape");n&&n.draw(r),a&&a.draw(r)},e.prototype.getTotalLength=function(){var r=this.attr(),n=r.x1,a=r.y1,i=r.x2,o=r.y2;return cn.length(n,a,i,o)},e.prototype.getPoint=function(r){var n=this.attr(),a=n.x1,i=n.y1,o=n.x2,s=n.y2;return cn.pointAt(a,i,o,s,r)},e}(Ea),_9={circle:function(t,e,r){return[["M",t-r,e],["A",r,r,0,1,0,t+r,e],["A",r,r,0,1,0,t-r,e]]},square:function(t,e,r){return[["M",t-r,e-r],["L",t+r,e-r],["L",t+r,e+r],["L",t-r,e+r],["Z"]]},diamond:function(t,e,r){return[["M",t-r,e],["L",t,e-r],["L",t+r,e],["L",t,e+r],["Z"]]},triangle:function(t,e,r){var n=r*Math.sin(.3333333333333333*Math.PI);return[["M",t-r,e+n],["L",t,e-n],["L",t+r,e+n],["Z"]]},"triangle-down":function(t,e,r){var n=r*Math.sin(.3333333333333333*Math.PI);return[["M",t-r,e-n],["L",t+r,e-n],["L",t,e+n],["Z"]]}},S9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.initAttrs=function(r){this._resetParamsCache()},e.prototype._resetParamsCache=function(){this.set("paramsCache",{})},e.prototype.onAttrChange=function(r,n,a){t.prototype.onAttrChange.call(this,r,n,a),["symbol","x","y","r","radius"].indexOf(r)!==-1&&this._resetParamsCache()},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._getR=function(r){return Zt(r.r)?r.radius:r.r},e.prototype._getPath=function(){var r=this.attr(),n=r.x,a=r.y,i=r.symbol||"circle",o=this._getR(r),s,u;if(Tr(i))s=i,u=s(n,a,o),u=RC(u);else{if(s=e.Symbols[i],!s)return console.warn(i+" marker is not supported."),null;u=s(n,a,o)}return u},e.prototype.createPath=function(r){var n=this._getPath(),a=this.get("paramsCache");TT(this,r,{path:n},a)},e.Symbols=_9,e}(Ea);function NT(t,e,r){var n=LC();return t.createPath(n),n.isPointInPath(e,r)}var M9=1e-6;function Cp(t){return Math.abs(t)<M9?0:t<0?-1:1}function A9(t,e,r){return(r[0]-t[0])*(e[1]-t[1])===(e[0]-t[0])*(r[1]-t[1])&&Math.min(t[0],e[0])<=r[0]&&r[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=r[1]&&r[1]<=Math.max(t[1],e[1])}function OT(t,e,r){var n=!1,a=t.length;if(a<=2)return!1;for(var i=0;i<a;i++){var o=t[i],s=t[(i+1)%a];if(A9(o,s,[e,r]))return!0;Cp(o[1]-r)>0!=Cp(s[1]-r)>0&&Cp(e-(r-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}function cf(t,e,r,n,a,i,o,s){var u=(Math.atan2(s-e,o-t)+Math.PI*2)%(Math.PI*2);if(u<n||u>a)return!1;var f={x:t+r*Math.cos(u),y:e+r*Math.sin(u)};return ET(f.x,f.y,o,s)<=i/2}var C9=eo;function T9(t){for(var e=!1,r=t.length,n=0;n<r;n++){var a=t[n],i=a[0];if(i==="C"||i==="A"||i==="Q"){e=!0;break}}return e}function I9(t,e,r,n,a){for(var i=!1,o=e/2,s=0;s<t.length;s++){var u=t[s],f=u.currentPoint,l=u.params,c=u.prePoint,h=u.box;if(!(h&&!Ro(h.x-o,h.y-o,h.width+e,h.height+e,r,n))){switch(u.command){case"L":case"Z":i=ji(c[0],c[1],f[0],f[1],e,r,n);break;case"Q":var d=IC.pointDistance(c[0],c[1],l[1],l[2],l[3],l[4],r,n);i=d<=e/2;break;case"C":var v=xf.pointDistance(c[0],c[1],l[1],l[2],l[3],l[4],l[5],l[6],r,n,a);i=v<=e/2;break;case"A":var p=u.arcParams,g=p.cx,y=p.cy,m=p.rx,b=p.ry,w=p.startAngle,x=p.endAngle,E=p.xRotation,_=[r,n,1],S=m>b?m:b,A=m>b?1:m/b,M=m>b?b/m:1,C=C9(null,[["t",-g,-y],["r",-E],["s",1/A,1/M]]);bd(_,_,C),i=cf(0,0,S,w,x,e,_[0],_[1]);break}if(i)break}}return i}function k9(t){for(var e=t.length,r=[],n=[],a=[],i=0;i<e;i++){var o=t[i],s=o[0];s==="M"?(a.length&&(n.push(a),a=[]),a.push([o[1],o[2]])):s==="Z"?a.length&&(r.push(a),a=[]):a.push([o[1],o[2]])}return a.length>0&&n.push(a),{polygons:r,polylines:n}}const Cc=P({hasArc:T9,extractPolygons:k9,isPointInStroke:I9},Tz);function uE(t,e,r){for(var n=!1,a=0;a<t.length;a++){var i=t[a];if(n=OT(i,e,r),n)break}return n}var Ky=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(r){this._setPathArr(r.path),this.setArrow()},e.prototype.onAttrChange=function(r,n,a){t.prototype.onAttrChange.call(this,r,n,a),r==="path"&&this._setPathArr(n),this.setArrow()},e.prototype._setPathArr=function(r){this.attrs.path=RC(r);var n=Cc.hasArc(r);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 r=this.get("segements");return r||(r=FC(this.attr("path")),this.set("segments",r)),r},e.prototype.setArrow=function(){var r=this.attr(),n=r.startArrow,a=r.endArrow;if(n){var i=this.getStartTangent();qy(this,r,i[0][0],i[0][1],i[1][0],i[1][1])}if(a){var i=this.getEndTangent();Hy(this,r,i[0][0],i[0][1],i[1][0],i[1][1])}},e.prototype.isInStrokeOrPath=function(r,n,a,i,o){var s=this.getSegments(),u=this.get("hasArc"),f=!1;if(a){var l=this.getTotalLength();f=Cc.isPointInStroke(s,o,r,n,l)}if(!f&&i)if(u)f=NT(this,r,n);else{var c=this.attr("path"),h=Cc.extractPolygons(c);f=uE(h.polygons,r,n)||uE(h.polylines,r,n)}return f},e.prototype.createPath=function(r){var n=this.attr(),a=this.get("paramsCache");TT(this,r,n,a)},e.prototype.afterDrawPath=function(r){var n=this.get("startArrowShape"),a=this.get("endArrowShape");n&&n.draw(r),a&&a.draw(r)},e.prototype.getTotalLength=function(){var r=this.get("totalLength");return Zt(r)?(this._calculateCurve(),this._setTcache(),this.get("totalLength")):r},e.prototype.getPoint=function(r){var n=this.get("tCache");n||(this._calculateCurve(),this._setTcache(),n=this.get("tCache"));var a,i,o=this.get("curve");if(!n||n.length===0)return o?{x:o[0][1],y:o[0][2]}:null;_e(n,function(l,c){r>=l[0]&&r<=l[1]&&(a=(r-l[0])/(l[1]-l[0]),i=c)});var s=o[i];if(Zt(s)||Zt(i))return null;var u=s.length,f=o[i+1];return xf.pointAt(s[u-2],s[u-1],f[1],f[2],f[3],f[4],f[5],f[6],a)},e.prototype._calculateCurve=function(){var r=this.attr().path;this.set("curve",Cc.pathToCurve(r))},e.prototype._setTcache=function(){var r=0,n=0,a=[],i,o,s,u,f=this.get("curve");if(f){if(_e(f,function(l,c){s=f[c+1],u=l.length,s&&(r+=xf.length(l[u-2],l[u-1],s[1],s[2],s[3],s[4],s[5],s[6])||0)}),this.set("totalLength",r),r===0){this.set("tCache",[]);return}_e(f,function(l,c){s=f[c+1],u=l.length,s&&(i=[],i[0]=n/r,o=xf.length(l[u-2],l[u-1],s[1],s[2],s[3],s[4],s[5],s[6]),n+=o||0,i[1]=n/r,a.push(i))}),this.set("tCache",a)}},e.prototype.getStartTangent=function(){var r=this.getSegments(),n;if(r.length>1){var a=r[0].currentPoint,i=r[1].currentPoint,o=r[1].startTangent;n=[],o?(n.push([a[0]-o[0],a[1]-o[1]]),n.push([a[0],a[1]])):(n.push([i[0],i[1]]),n.push([a[0],a[1]]))}return n},e.prototype.getEndTangent=function(){var r=this.getSegments(),n=r.length,a;if(n>1){var i=r[n-2].currentPoint,o=r[n-1].currentPoint,s=r[n-1].endTangent;a=[],s?(a.push([o[0]-s[0],o[1]-s[1]]),a.push([o[0],o[1]])):(a.push([i[0],i[1]]),a.push([o[0],o[1]]))}return a},e}(Ea);function LT(t,e,r,n,a){var i=t.length;if(i<2)return!1;for(var o=0;o<i-1;o++){var s=t[o][0],u=t[o][1],f=t[o+1][0],l=t[o+1][1];if(ji(s,u,f,l,e,r,n))return!0}if(a){var c=t[0],h=t[i-1];if(ji(c[0],c[1],h[0],h[1],e,r,n))return!0}return!1}var N9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.isInStrokeOrPath=function(r,n,a,i,o){var s=this.attr().points,u=!1;return a&&(u=LT(s,o,r,n,!0)),!u&&i&&(u=OT(s,r,n)),u},e.prototype.createPath=function(r){var n=this.attr(),a=n.points;if(!(a.length<2)){r.beginPath();for(var i=0;i<a.length;i++){var o=a[i];i===0?r.moveTo(o[0],o[1]):r.lineTo(o[0],o[1])}r.closePath()}},e}(Ea),O9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(r){this.setArrow()},e.prototype.onAttrChange=function(r,n,a){t.prototype.onAttrChange.call(this,r,n,a),this.setArrow(),["points"].indexOf(r)!==-1&&this._resetCache()},e.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},e.prototype.setArrow=function(){var r=this.attr(),n=this.attrs,a=n.points,i=n.startArrow,o=n.endArrow,s=a.length,u=a[0][0],f=a[0][1],l=a[s-1][0],c=a[s-1][1];i&&qy(this,r,a[1][0],a[1][1],u,f),o&&Hy(this,r,a[s-2][0],a[s-2][1],l,c)},e.prototype.isFill=function(){return!1},e.prototype.isInStrokeOrPath=function(r,n,a,i,o){if(!a||!o)return!1;var s=this.attr().points;return LT(s,o,r,n,!1)},e.prototype.isStroke=function(){return!0},e.prototype.createPath=function(r){var n=this.attr(),a=n.points,i=n.startArrow,o=n.endArrow,s=a.length;if(!(a.length<2)){var u=a[0][0],f=a[0][1],l=a[s-1][0],c=a[s-1][1];if(i&&i.d){var h=Go(u,f,a[1][0],a[1][1],i.d);u+=h.dx,f+=h.dy}if(o&&o.d){var h=Go(a[s-2][0],a[s-2][1],l,c,o.d);l-=h.dx,c-=h.dy}r.beginPath(),r.moveTo(u,f);for(var d=0;d<s-1;d++){var v=a[d];r.lineTo(v[0],v[1])}r.lineTo(l,c)}},e.prototype.afterDrawPath=function(r){var n=this.get("startArrowShape"),a=this.get("endArrowShape");n&&n.draw(r),a&&a.draw(r)},e.prototype.getTotalLength=function(){var r=this.attr().points,n=this.get("totalLength");return Zt(n)?(this.set("totalLength",OC.length(r)),this.get("totalLength")):n},e.prototype.getPoint=function(r){var n=this.attr().points,a=this.get("tCache");a||(this._setTcache(),a=this.get("tCache"));var i,o;return _e(a,function(s,u){r>=s[0]&&r<=s[1]&&(i=(r-s[0])/(s[1]-s[0]),o=u)}),cn.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],i)},e.prototype._setTcache=function(){var r=this.attr().points;if(!(!r||r.length===0)){var n=this.getTotalLength();if(!(n<=0)){var a=0,i=[],o,s;_e(r,function(u,f){r[f+1]&&(o=[],o[0]=a/n,s=cn.length(u[0],u[1],r[f+1][0],r[f+1][1]),a+=s,o[1]=a/n,i.push(o))}),this.set("tCache",i)}}},e.prototype.getStartTangent=function(){var r=this.attr().points,n=[];return n.push([r[1][0],r[1][1]]),n.push([r[0][0],r[0][1]]),n},e.prototype.getEndTangent=function(){var r=this.attr().points,n=r.length-1,a=[];return a.push([r[n-1][0],r[n-1][1]]),a.push([r[n][0],r[n][1]]),a},e}(Ea);function L9(t,e,r,n,a,i,o){var s=a/2;return Ro(t-s,e-s,r,a,i,o)||Ro(t+r-s,e-s,a,n,i,o)||Ro(t+s,e+n-s,r,a,i,o)||Ro(t-s,e+s,a,n,i,o)}function D9(t,e,r,n,a,i,o,s){return ji(t+a,e,t+r-a,e,i,o,s)||ji(t+r,e+a,t+r,e+n-a,i,o,s)||ji(t+r-a,e+n,t+a,e+n,i,o,s)||ji(t,e+n-a,t,e+a,i,o,s)||cf(t+r-a,e+a,a,1.5*Math.PI,2*Math.PI,i,o,s)||cf(t+r-a,e+n-a,a,0,.5*Math.PI,i,o,s)||cf(t+a,e+n-a,a,.5*Math.PI,Math.PI,i,o,s)||cf(t+a,e+a,a,Math.PI,1.5*Math.PI,i,o,s)}var P9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.isInStrokeOrPath=function(r,n,a,i,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 a&&(v=D9(u,f,l,c,h,o,r,n)),!v&&i&&(v=NT(this,r,n)),v}else{var d=o/2;if(i&&a)return Ro(u-d,f-d,l+d,c+d,r,n);if(i)return Ro(u,f,l,c,r,n);if(a)return L9(u,f,l,c,o,r,n)}},e.prototype.createPath=function(r){var n=this.attr(),a=n.x,i=n.y,o=n.width,s=n.height,u=n.radius;if(r.beginPath(),u===0)r.rect(a,i,o,s);else{var f=d9(u),l=f[0],c=f[1],h=f[2],d=f[3];r.moveTo(a+l,i),r.lineTo(a+o-c,i),c!==0&&r.arc(a+o-c,i+c,c,-Math.PI/2,0),r.lineTo(a+o,i+s-h),h!==0&&r.arc(a+o-h,i+s-h,h,0,Math.PI/2),r.lineTo(a+d,i+s),d!==0&&r.arc(a+d,i+s-d,d,Math.PI/2,Math.PI),r.lineTo(a,i+l),l!==0&&r.arc(a+l,i+l,l,Math.PI,Math.PI*1.5),r.closePath()}},e}(Ea),R9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{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(r){this._assembleFont(),r.text&&this._setText(r.text)},e.prototype._assembleFont=function(){var r=this.attrs;r.font=PC(r)},e.prototype._setText=function(r){var n=null;Ye(r)&&r.indexOf(`
|
||
`)!==-1&&(n=r.split(`
|
||
`)),this.set("textArr",n)},e.prototype.onAttrChange=function(r,n,a){t.prototype.onAttrChange.call(this,r,n,a),r.startsWith("font")&&this._assembleFont(),r==="text"&&this._setText(n)},e.prototype._getSpaceingY=function(){var r=this.attrs,n=r.lineHeight,a=r.fontSize*1;return n?n-a:a*.14},e.prototype._drawTextArr=function(r,n,a){var i=this.attrs,o=i.textBaseline,s=i.x,u=i.y,f=i.fontSize*1,l=this._getSpaceingY(),c=DC(i.text,i.fontSize,i.lineHeight),h;_e(n,function(d,v){h=u+v*(l+f)-c+f,o==="middle"&&(h+=c-f-(c-f)/2),o==="top"&&(h+=c-f),Zt(d)||(a?r.fillText(d,s,h):r.strokeText(d,s,h))})},e.prototype._drawText=function(r,n){var a=this.attr(),i=a.x,o=a.y,s=this.get("textArr");if(s)this._drawTextArr(r,s,n);else{var u=a.text;Zt(u)||(n?r.fillText(u,i,o):r.strokeText(u,i,o))}},e.prototype.strokeAndFill=function(r){var n=this.attrs,a=n.lineWidth,i=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isStroke()&&a>0&&(!Zt(o)&&o!==1&&(r.globalAlpha=i),this.stroke(r)),this.isFill()&&(!Zt(s)&&s!==1?(r.globalAlpha=s,this.fill(r),r.globalAlpha=i):this.fill(r)),this.afterDrawPath(r)},e.prototype.fill=function(r){this._drawText(r,!0)},e.prototype.stroke=function(r){this._drawText(r,!1)},e}(Ea);function F9(t,e){if(e){var r=nC(e);return Do(r,t)}return t}function DT(t,e,r){var n=t.getTotalMatrix();if(n){var a=F9([e,r,1],n),i=a[0],o=a[1];return[i,o]}return[e,r]}function fE(t,e,r){if(t.isCanvas&&t.isCanvas())return!0;if(!P0(t)||t.cfg.isInView===!1)return!1;if(t.cfg.clipShape){var n=DT(t,e,r),a=n[0],i=n[1];if(t.isClipped(a,i))return!1}var o=t.cfg.cacheCanvasBBox||t.getCanvasBBox();return e>=o.minX&&e<=o.maxX&&r>=o.minY&&r<=o.maxY}function PT(t,e,r){if(!fE(t,e,r))return null;for(var n=null,a=t.getChildren(),i=a.length,o=i-1;o>=0;o--){var s=a[o];if(s.isGroup())n=PT(s,e,r);else if(fE(s,e,r)){var u=s,f=DT(s,e,r),l=f[0],c=f[1];u.isInShape(l,c)&&(n=s)}if(n)break}return n}var qu=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){var r=t.prototype.getDefaultCfg.call(this);return r.renderer="canvas",r.autoDraw=!0,r.localRefresh=!0,r.refreshElements=[],r.clipView=!0,r.quickHit=!1,r},e.prototype.onCanvasChange=function(r){(r==="attr"||r==="sort"||r==="changeSize")&&(this.set("refreshElements",[this]),this.draw())},e.prototype.getShapeBase=function(){return ty},e.prototype.getGroupBase=function(){return kT},e.prototype.getPixelRatio=function(){var r=this.get("pixelRatio")||a9();return r>=1?Math.ceil(r):1},e.prototype.getViewRange=function(){return{minX:0,minY:0,maxX:this.cfg.width,maxY:this.cfg.height}},e.prototype.createDom=function(){var r=document.createElement("canvas"),n=r.getContext("2d");return this.set("context",n),r},e.prototype.setDOMSize=function(r,n){t.prototype.setDOMSize.call(this,r,n);var a=this.get("context"),i=this.get("el"),o=this.getPixelRatio();i.width=o*r,i.height=o*n,o>1&&a.scale(o,o)},e.prototype.clear=function(){t.prototype.clear.call(this),this._clearFrame();var r=this.get("context"),n=this.get("el");r.clearRect(0,0,n.width,n.height)},e.prototype.getShape=function(r,n){var a;return this.get("quickHit")?a=PT(this,r,n):a=t.prototype.getShape.call(this,r,n,null),a},e.prototype._getRefreshRegion=function(){var r=this.get("refreshElements"),n=this.getViewRange(),a;if(r.length&&r[0]===this)a=n;else if(a=y9(r),a){a.minX=Math.floor(a.minX),a.minY=Math.floor(a.minY),a.maxX=Math.ceil(a.maxX),a.maxY=Math.ceil(a.maxY),a.maxY+=1;var i=this.get("clipView");i&&(a=m9(a,n))}return a},e.prototype.refreshElement=function(r){var n=this.get("refreshElements");n.push(r)},e.prototype._clearFrame=function(){var r=this.get("drawFrame");r&&(VS(r),this.set("drawFrame",null),this.set("refreshElements",[]))},e.prototype.draw=function(){var r=this.get("drawFrame");this.get("autoDraw")&&r||this._startDraw()},e.prototype._drawAll=function(){var r=this.get("context"),n=this.get("el"),a=this.getChildren();r.clearRect(0,0,n.width,n.height),ru(r,this),sg(r,a),this.set("refreshElements",[])},e.prototype._drawRegion=function(){var r=this.get("context"),n=this.get("refreshElements"),a=this.getChildren(),i=this._getRefreshRegion();i?(r.clearRect(i.minX,i.minY,i.maxX-i.minX,i.maxY-i.minY),r.save(),r.beginPath(),r.rect(i.minX,i.minY,i.maxX-i.minX,i.maxY-i.minY),r.clip(),ru(r,this),v9(this,a,i),sg(r,a,i),r.restore()):n.length&&CT(n),_e(n,function(o){o.get("hasChanged")&&o.set("hasChanged",!1)}),this.set("refreshElements",[])},e.prototype._startDraw=function(){var r=this,n=this.get("drawFrame"),a=this.get("drawFrameCallback");n||(n=WS(function(){r.get("localRefresh")?r._drawRegion():r._drawAll(),r.set("drawFrame",null),a&&a()}),this.set("drawFrame",n))},e.prototype.skipDraw=function(){},e.prototype.removeDom=function(){var r=this.get("el");r.width=0,r.height=0,r.parentNode.removeChild(r)},e}(wC),fg={rect:"path",circle:"circle",line:"line",path:"path",marker:"path",text:"text",polyline:"polyline",polygon:"polygon",image:"image",ellipse:"ellipse",dom:"foreignObject"},ar={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 ra(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function RT(t){var e=fg[t.type],r=t.getParent();if(!e)throw new Error("the type "+t.type+" is not supported by svg");var n=ra(e);if(t.get("id")&&(n.id=t.get("id")),t.set("el",n),t.set("attrs",{}),r){var a=r.get("el");a||(a=r.createDom(),r.set("el",a)),a.appendChild(n)}return n}function FT(t,e){var r=t.get("el"),n=ZS(r.children).sort(e),a=document.createDocumentFragment();n.forEach(function(i){a.appendChild(i)}),r.appendChild(a)}function B9(t,e){var r=t.parentNode,n=Array.from(r.childNodes).filter(function(s){return s.nodeType===1&&s.nodeName.toLowerCase()!=="defs"}),a=n[e],i=n.indexOf(t);if(a){if(i>e)r.insertBefore(t,a);else if(i<e){var o=n[e+1];o?r.insertBefore(t,o):r.appendChild(t)}}else r.appendChild(t)}function G9(t,e){var r=t.cfg.el,n=t.attr(),a={dx:n.shadowOffsetX,dy:n.shadowOffsetY,blur:n.shadowBlur,color:n.shadowColor};if(!a.dx&&!a.dy&&!a.blur&&!a.color)r.removeAttribute("filter");else{var i=e.find("filter",a);i||(i=e.addShadow(a)),r.setAttribute("filter","url(#"+i+")")}}function al(t){var e=t.attr().matrix;if(e){for(var r=t.cfg.el,n=[],a=0;a<9;a+=3)n.push(e[a]+","+e[a+1]);n=n.join(","),n.indexOf("NaN")===-1?r.setAttribute("transform","matrix("+n+")"):console.warn("invalid matrix:",e)}}function $f(t,e){var r=t.getClip(),n=t.get("el");if(!r)n.removeAttribute("clip-path");else if(r&&!n.hasAttribute("clip-path")){RT(r),r.createPath(e);var a=e.addClip(r);n.setAttribute("clip-path","url(#"+a+")")}}function BT(t,e){e.forEach(function(r){r.draw(t)})}function GT(t,e){var r=t.get("canvas");if(r&&r.get("autoDraw")){var n=r.get("context"),a=t.getParent(),i=a?a.getChildren():[r],o=t.get("el");if(e==="remove"){var s=t.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")B9(o,i.indexOf(t));else if(e==="sort"){var l=t.get("children");l&&l.length&&FT(t,function(c,h){return l.indexOf(c)-l.indexOf(h)?1:0})}else e==="clear"?o&&(o.innerHTML=""):e==="matrix"?al(t):e==="clip"?$f(t,n):e==="attr"||e==="add"&&t.draw(n)}}var zT=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.isEntityGroup=function(){return!0},e.prototype.createDom=function(){var r=ra("g");this.set("el",r);var n=this.getParent();if(n){var a=n.get("el");a||(a=n.createDom(),n.set("el",a)),a.appendChild(r)}return r},e.prototype.afterAttrsChange=function(r){t.prototype.afterAttrsChange.call(this,r);var n=this.get("canvas");if(n&&n.get("autoDraw")){var a=n.get("context");this.createPath(a,r)}},e.prototype.onCanvasChange=function(r){GT(this,r)},e.prototype.getShapeBase=function(){return ry},e.prototype.getGroupBase=function(){return e},e.prototype.draw=function(r){var n=this.getChildren(),a=this.get("el");this.get("destroyed")?a&&a.parentNode.removeChild(a):(a||this.createDom(),$f(this,r),this.createPath(r),n.length&&BT(r,n))},e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");_e(n||a,function(o,s){ar[s]&&i.setAttribute(ar[s],o)}),al(this)},e}(xC),aa=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="svg",r.canFill=!1,r.canStroke=!1,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.afterAttrsChange=function(r){t.prototype.afterAttrsChange.call(this,r);var n=this.get("canvas");if(n&&n.get("autoDraw")){var a=n.get("context");this.draw(a,r)}},e.prototype.getShapeBase=function(){return ry},e.prototype.getGroupBase=function(){return zT},e.prototype.onCanvasChange=function(r){GT(this,r)},e.prototype.calculateBBox=function(){var r=this.get("el"),n=null;if(r)n=r.getBBox();else{var a=SC(this.get("type"));a&&(n=a(this))}if(n){var i=n.x,o=n.y,s=n.width,u=n.height,f=this.getHitLineWidth(),l=f/2,c=i-l,h=o-l,d=i+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 r=this.attr(),n=r.fill,a=r.fillStyle;return(n||a||this.isClipShape())&&this.canFill},e.prototype.isStroke=function(){var r=this.attr(),n=r.stroke,a=r.strokeStyle;return(n||a)&&this.canStroke},e.prototype.draw=function(r,n){var a=this.get("el");this.get("destroyed")?a&&a.parentNode.removeChild(a):(a||RT(this),$f(this,r),this.createPath(r,n),this.shadow(r,n),this.strokeAndFill(r,n),this.transform(n))},e.prototype.createPath=function(r,n){},e.prototype.strokeAndFill=function(r,n){var a=n||this.attr(),i=a.fill,o=a.fillStyle,s=a.stroke,u=a.strokeStyle,f=a.fillOpacity,l=a.strokeOpacity,c=a.lineWidth,h=this.get("el");this.canFill&&(n?"fill"in a?this._setColor(r,"fill",i):"fillStyle"in a&&this._setColor(r,"fill",o):this._setColor(r,"fill",i||o),f&&h.setAttribute(ar.fillOpacity,f)),this.canStroke&&c>0&&(n?"stroke"in a?this._setColor(r,"stroke",s):"strokeStyle"in a&&this._setColor(r,"stroke",u):this._setColor(r,"stroke",s||u),l&&h.setAttribute(ar.strokeOpacity,l),c&&h.setAttribute(ar.lineWidth,c))},e.prototype._setColor=function(r,n,a){var i=this.get("el");if(!a){i.setAttribute(ar[n],"none");return}if(a=a.trim(),/^[r,R,L,l]{1}[\s]*\(/.test(a)){var o=r.find("gradient",a);o||(o=r.addGradient(a)),i.setAttribute(ar[n],"url(#"+o+")")}else if(/^[p,P]{1}[\s]*\(/.test(a)){var o=r.find("pattern",a);o||(o=r.addPattern(a)),i.setAttribute(ar[n],"url(#"+o+")")}else i.setAttribute(ar[n],a)},e.prototype.shadow=function(r,n){var a=this.attr(),i=n||a,o=i.shadowOffsetX,s=i.shadowOffsetY,u=i.shadowBlur,f=i.shadowColor;(o||s||u||f)&&G9(this,r)},e.prototype.transform=function(r){var n=this.attr(),a=(r||n).matrix;a&&al(this)},e.prototype.isInShape=function(r,n){return this.isPointInPath(r,n)},e.prototype.isPointInPath=function(r,n){var a=this.get("el"),i=this.get("canvas"),o=i.get("el").getBoundingClientRect(),s=r+o.left,u=n+o.top,f=document.elementFromPoint(s,u);return!!(f&&f.isEqualNode(a))},e.prototype.getHitLineWidth=function(){var r=this.attrs,n=r.lineWidth,a=r.lineAppendWidth;return this.isStroke()?n+a:0},e}(EC),z9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="circle",r.canFill=!0,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,r:0})},e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");_e(n||a,function(o,s){s==="x"||s==="y"?i.setAttribute("c"+s,o):ar[s]&&i.setAttribute(ar[s],o)})},e}(aa),j9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="dom",r.canFill=!1,r.canStroke=!1,r}return e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");if(_e(n||a,function(f,l){ar[l]&&i.setAttribute(ar[l],f)}),typeof a.html=="function"){var o=a.html.call(this,a);if(o instanceof Element||o instanceof HTMLDocument){for(var s=i.childNodes,u=s.length-1;u>=0;u--)i.removeChild(s[u]);i.appendChild(o)}else i.innerHTML=o}else i.innerHTML=a.html},e}(aa),U9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="ellipse",r.canFill=!0,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,rx:0,ry:0})},e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");_e(n||a,function(o,s){s==="x"||s==="y"?i.setAttribute("c"+s,o):ar[s]&&i.setAttribute(ar[s],o)})},e}(aa),$9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="image",r.canFill=!1,r.canStroke=!1,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,width:0,height:0})},e.prototype.createPath=function(r,n){var a=this,i=this.attr(),o=this.get("el");_e(n||i,function(s,u){u==="img"?a._setImage(i.img):ar[u]&&o.setAttribute(ar[u],s)})},e.prototype.setAttr=function(r,n){this.attrs[r]=n,r==="img"&&this._setImage(n)},e.prototype._setImage=function(r){var n=this.attr(),a=this.get("el");if(Ye(r))a.setAttribute("href",r);else if(r instanceof window.Image)n.width||(a.setAttribute("width",r.width),this.attr("width",r.width)),n.height||(a.setAttribute("height",r.height),this.attr("height",r.height)),a.setAttribute("href",r.src);else if(r instanceof HTMLElement&&Ye(r.nodeName)&&r.nodeName.toUpperCase()==="CANVAS")a.setAttribute("href",r.toDataURL());else if(r instanceof ImageData){var i=document.createElement("canvas");i.setAttribute("width",""+r.width),i.setAttribute("height",""+r.height),i.getContext("2d").putImageData(r,0,0),n.width||(a.setAttribute("width",""+r.width),this.attr("width",r.width)),n.height||(a.setAttribute("height",""+r.height),this.attr("height",r.height)),a.setAttribute("href",i.toDataURL())}},e}(aa),X9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="line",r.canFill=!1,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");_e(n||a,function(o,s){if(s==="startArrow"||s==="endArrow")if(o){var u=gn(o)?r.addArrow(a,ar[s]):r.getDefaultArrow(a,ar[s]);i.setAttribute(ar[s],"url(#"+u+")")}else i.removeAttribute(ar[s]);else ar[s]&&i.setAttribute(ar[s],o)})},e.prototype.getTotalLength=function(){var r=this.attr(),n=r.x1,a=r.y1,i=r.x2,o=r.y2;return cn.length(n,a,i,o)},e.prototype.getPoint=function(r){var n=this.attr(),a=n.x1,i=n.y1,o=n.x2,s=n.y2;return cn.pointAt(a,i,o,s,r)},e}(aa),Tc={circle:function(t,e,r){return[["M",t,e],["m",-r,0],["a",r,r,0,1,0,r*2,0],["a",r,r,0,1,0,-r*2,0]]},square:function(t,e,r){return[["M",t-r,e-r],["L",t+r,e-r],["L",t+r,e+r],["L",t-r,e+r],["Z"]]},diamond:function(t,e,r){return[["M",t-r,e],["L",t,e-r],["L",t+r,e],["L",t,e+r],["Z"]]},triangle:function(t,e,r){var n=r*Math.sin(.3333333333333333*Math.PI);return[["M",t-r,e+n],["L",t,e-n],["L",t+r,e+n],["z"]]},triangleDown:function(t,e,r){var n=r*Math.sin(.3333333333333333*Math.PI);return[["M",t-r,e-n],["L",t+r,e-n],["L",t,e+n],["Z"]]}};const lE={get:function(t){return Tc[t]},register:function(t,e){Tc[t]=e},remove:function(t){delete Tc[t]},getAll:function(){return Tc}};var W9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="marker",r.canFill=!0,r.canStroke=!0,r}return e.prototype.createPath=function(r){var n=this.get("el");n.setAttribute("d",this._assembleMarker())},e.prototype._assembleMarker=function(){var r=this._getPath();return bt(r)?r.map(function(n){return n.join(" ")}).join(""):r},e.prototype._getPath=function(){var r=this.attr(),n=r.x,a=r.y,i=r.r||r.radius,o=r.symbol||"circle",s;return Tr(o)?s=o:s=lE.get(o),s?s(n,a,i):(console.warn(s+" symbol is not exist."),null)},e.symbolsFactory=lE,e}(aa),V9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="path",r.canFill=!0,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{startArrow:!1,endArrow:!1})},e.prototype.createPath=function(r,n){var a=this,i=this.attr(),o=this.get("el");_e(n||i,function(s,u){if(u==="path"&&bt(s))o.setAttribute("d",a._formatPath(s));else if(u==="startArrow"||u==="endArrow")if(s){var f=gn(s)?r.addArrow(i,ar[u]):r.getDefaultArrow(i,ar[u]);o.setAttribute(ar[u],"url(#"+f+")")}else o.removeAttribute(ar[u]);else ar[u]&&o.setAttribute(ar[u],s)})},e.prototype._formatPath=function(r){var n=r.map(function(a){return a.join(" ")}).join("");return~n.indexOf("NaN")?"":n},e.prototype.getTotalLength=function(){var r=this.get("el");return r?r.getTotalLength():null},e.prototype.getPoint=function(r){var n=this.get("el"),a=this.getTotalLength();if(a===0)return null;var i=n?n.getPointAtLength(r*a):null;return i?{x:i.x,y:i.y}:null},e}(aa),Y9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="polygon",r.canFill=!0,r.canStroke=!0,r}return e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");_e(n||a,function(o,s){s==="points"&&bt(o)&&o.length>=2?i.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):ar[s]&&i.setAttribute(ar[s],o)})},e}(aa),q9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="polyline",r.canFill=!0,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{startArrow:!1,endArrow:!1})},e.prototype.onAttrChange=function(r,n,a){t.prototype.onAttrChange.call(this,r,n,a),["points"].indexOf(r)!==-1&&this._resetCache()},e.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");_e(n||a,function(o,s){s==="points"&&bt(o)&&o.length>=2?i.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):ar[s]&&i.setAttribute(ar[s],o)})},e.prototype.getTotalLength=function(){var r=this.attr().points,n=this.get("totalLength");return Zt(n)?(this.set("totalLength",OC.length(r)),this.get("totalLength")):n},e.prototype.getPoint=function(r){var n=this.attr().points,a=this.get("tCache");a||(this._setTcache(),a=this.get("tCache"));var i,o;return _e(a,function(s,u){r>=s[0]&&r<=s[1]&&(i=(r-s[0])/(s[1]-s[0]),o=u)}),cn.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],i)},e.prototype._setTcache=function(){var r=this.attr().points;if(!(!r||r.length===0)){var n=this.getTotalLength();if(!(n<=0)){var a=0,i=[],o,s;_e(r,function(u,f){r[f+1]&&(o=[],o[0]=a/n,s=cn.length(u[0],u[1],r[f+1][0],r[f+1][1]),a+=s,o[1]=a/n,i.push(o))}),this.set("tCache",i)}}},e.prototype.getStartTangent=function(){var r=this.attr().points,n=[];return n.push([r[1][0],r[1][1]]),n.push([r[0][0],r[0][1]]),n},e.prototype.getEndTangent=function(){var r=this.attr().points,n=r.length-1,a=[];return a.push([r[n-1][0],r[n-1][1]]),a.push([r[n][0],r[n][1]]),a},e}(aa);function H9(t){var e=0,r=0,n=0,a=0;return bt(t)?t.length===1?e=r=n=a=t[0]:t.length===2?(e=n=t[0],r=a=t[1]):t.length===3?(e=t[0],r=a=t[1],n=t[2]):(e=t[0],r=t[1],n=t[2],a=t[3]):e=r=n=a=t,{r1:e,r2:r,r3:n,r4:a}}var Z9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="rect",r.canFill=!0,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.createPath=function(r,n){var a=this,i=this.attr(),o=this.get("el"),s=!1,u=["x","y","width","height","radius"];_e(n||i,function(f,l){u.indexOf(l)!==-1&&!s?(o.setAttribute("d",a._assembleRect(i)),s=!0):u.indexOf(l)===-1&&ar[l]&&o.setAttribute(ar[l],f)})},e.prototype._assembleRect=function(r){var n=r.x,a=r.y,i=r.width,o=r.height,s=r.radius;if(!s)return"M "+n+","+a+" l "+i+",0 l 0,"+o+" l"+-i+" 0 z";var u=H9(s);bt(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)+","+a],["l "+(i-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-i)+",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}(aa),cE=.3,K9={top:"before-edge",middle:"central",bottom:"after-edge",alphabetic:"baseline",hanging:"hanging"},Q9={top:"text-before-edge",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",hanging:"hanging"},J9={left:"left",start:"left",center:"middle",right:"end",end:"end"},e7=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="text",r.canFill=!0,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{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(r,n){var a=this,i=this.attr(),o=this.get("el");this._setFont(),_e(n||i,function(s,u){u==="text"?a._setText(""+s):u==="matrix"&&s?al(a):ar[u]&&o.setAttribute(ar[u],s)}),o.setAttribute("paint-order","stroke"),o.setAttribute("style","stroke-linecap:butt; stroke-linejoin:miter;")},e.prototype._setFont=function(){var r=this.get("el"),n=this.attr(),a=n.textBaseline,i=n.textAlign,o=rC();o&&o.name==="firefox"?r.setAttribute("dominant-baseline",Q9[a]||"alphabetic"):r.setAttribute("alignment-baseline",K9[a]||"baseline"),r.setAttribute("text-anchor",J9[i]||"left")},e.prototype._setText=function(r){var n=this.get("el"),a=this.attr(),i=a.x,o=a.textBaseline,s=o===void 0?"bottom":o;if(!r)n.innerHTML="";else if(~r.indexOf(`
|
||
`)){var u=r.split(`
|
||
`),f=u.length-1,l="";_e(u,function(c,h){h===0?s==="alphabetic"?l+='<tspan x="'+i+'" dy="'+-f+'em">'+c+"</tspan>":s==="top"?l+='<tspan x="'+i+'" dy="0.9em">'+c+"</tspan>":s==="middle"?l+='<tspan x="'+i+'" dy="'+-(f-1)/2+'em">'+c+"</tspan>":s==="bottom"?l+='<tspan x="'+i+'" dy="-'+(f+cE)+'em">'+c+"</tspan>":s==="hanging"&&(l+='<tspan x="'+i+'" dy="'+(-(f-1)-cE)+'em">'+c+"</tspan>"):l+='<tspan x="'+i+'" dy="1em">'+c+"</tspan>"}),n.innerHTML=l}else n.innerHTML=r},e}(aa),t7=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,r7=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,n7=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function jT(t){var e=t.match(n7);if(!e)return"";var r="";return e.sort(function(n,a){return n=n.split(":"),a=a.split(":"),Number(n[0])-Number(a[0])}),_e(e,function(n){n=n.split(":"),r+='<stop offset="'+n[0]+'" stop-color="'+n[1]+'"></stop>'}),r}function a7(t,e){var r=t7.exec(t),n=gd(yd(parseFloat(r[1])),Math.PI*2),a=r[2],i,o;n>=0&&n<.5*Math.PI?(i={x:0,y:0},o={x:1,y:1}):.5*Math.PI<=n&&n<Math.PI?(i={x:1,y:0},o={x:0,y:1}):Math.PI<=n&&n<1.5*Math.PI?(i={x:1,y:1},o={x:0,y:0}):(i={x:0,y:1},o={x:1,y:0});var s=Math.tan(n),u=s*s,f=(o.x-i.x+s*(o.y-i.y))/(u+1)+i.x,l=s*(o.x-i.x+s*(o.y-i.y))/(u+1)+i.y;e.setAttribute("x1",i.x),e.setAttribute("y1",i.y),e.setAttribute("x2",f),e.setAttribute("y2",l),e.innerHTML=jT(a)}function i7(t,e){var r=r7.exec(t),n=parseFloat(r[1]),a=parseFloat(r[2]),i=parseFloat(r[3]),o=r[4];e.setAttribute("cx",n),e.setAttribute("cy",a),e.setAttribute("r",i),e.innerHTML=jT(o)}var o7=function(){function t(e){this.cfg={};var r=null,n=Ji("gradient_");return e.toLowerCase()[0]==="l"?(r=ra("linearGradient"),a7(e,r)):(r=ra("radialGradient"),i7(e,r)),r.setAttribute("id",n),this.el=r,this.id=n,this.cfg=e,this}return t.prototype.match=function(e,r){return this.cfg===r},t}(),s7={shadowColor:"color",shadowOpacity:"opacity",shadowBlur:"blur",shadowOffsetX:"dx",shadowOffsetY:"dy"},u7={x:"-40%",y:"-40%",width:"200%",height:"200%"},f7=function(){function t(e){this.type="filter",this.cfg={},this.type="filter";var r=ra("filter");return _e(u7,function(n,a){r.setAttribute(a,n)}),this.el=r,this.id=Ji("filter_"),this.el.id=this.id,this.cfg=e,this._parseShadow(e,r),this}return t.prototype.match=function(e,r){if(this.type!==e)return!1;var n=!0,a=this.cfg;return _e(Object.keys(a),function(i){if(a[i]!==r[i])return n=!1,!1}),n},t.prototype.update=function(e,r){var n=this.cfg;return n[s7[e]]=r,this._parseShadow(n,this.el),this},t.prototype._parseShadow=function(e,r){var n=`<feDropShadow
|
||
dx="`+(e.dx||0)+`"
|
||
dy="`+(e.dy||0)+`"
|
||
stdDeviation="`+(e.blur?e.blur/10:0)+`"
|
||
flood-color="`+(e.color?e.color:"#000")+`"
|
||
flood-opacity="`+(e.opacity?e.opacity:1)+`"
|
||
/>`;r.innerHTML=n},t}(),hE=function(){function t(e,r){this.cfg={};var n=ra("marker"),a=Ji("marker_");n.setAttribute("id",a);var i=ra("path");i.setAttribute("stroke",e.stroke||"none"),i.setAttribute("fill",e.fill||"none"),n.appendChild(i),n.setAttribute("overflow","visible"),n.setAttribute("orient","auto-start-reverse"),this.el=n,this.child=i,this.id=a;var o=e[r==="marker-start"?"startArrow":"endArrow"];return this.stroke=e.stroke||"#000",o===!0?this._setDefaultPath(r,i):(this.cfg=o,this._setMarker(e.lineWidth,i)),this}return t.prototype.match=function(){return!1},t.prototype._setDefaultPath=function(e,r){var n=this.el;r.setAttribute("d","M0,0 L"+10*Math.cos(Math.PI/6)+",5 L0,10"),n.setAttribute("refX",""+10*Math.cos(Math.PI/6)),n.setAttribute("refY","5")},t.prototype._setMarker=function(e,r){var n=this.el,a=this.cfg.path,i=this.cfg.d;bt(a)&&(a=a.map(function(o){return o.join(" ")}).join("")),r.setAttribute("d",a),n.appendChild(r),i&&n.setAttribute("refX",""+i/e)},t.prototype.update=function(e){var r=this.child;r.attr?r.attr("fill",e):r.setAttribute("fill",e)},t}(),l7=function(){function t(e){this.type="clip",this.cfg={};var r=ra("clipPath");this.el=r,this.id=Ji("clip_"),r.id=this.id;var n=e.cfg.el;return r.appendChild(n),this.cfg=e,this}return t.prototype.match=function(){return!1},t.prototype.remove=function(){var e=this.el;e.parentNode.removeChild(e)},t}(),c7=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,h7=function(){function t(e){this.cfg={};var r=ra("pattern");r.setAttribute("patternUnits","userSpaceOnUse");var n=ra("image");r.appendChild(n);var a=Ji("pattern_");r.id=a,this.el=r,this.id=a,this.cfg=e;var i=c7.exec(e),o=i[2];n.setAttribute("href",o);var s=new Image;o.match(/^data:/i)||(s.crossOrigin="Anonymous"),s.src=o;function u(){r.setAttribute("width",""+s.width),r.setAttribute("height",""+s.height)}return s.complete?u():(s.onload=u,s.src=s.src),this}return t.prototype.match=function(e,r){return this.cfg===r},t}(),d7=function(){function t(e){var r=ra("defs"),n=Ji("defs_");r.id=n,e.appendChild(r),this.children=[],this.defaultArrow={},this.el=r,this.canvas=e}return t.prototype.find=function(e,r){for(var n=this.children,a=null,i=0;i<n.length;i++)if(n[i].match(e,r)){a=n[i].id;break}return a},t.prototype.findById=function(e){for(var r=this.children,n=null,a=0;a<r.length;a++)if(r[a].id===e){n=r[a];break}return n},t.prototype.add=function(e){this.children.push(e),e.canvas=this.canvas,e.parent=this},t.prototype.getDefaultArrow=function(e,r){var n=e.stroke||e.strokeStyle;if(this.defaultArrow[n])return this.defaultArrow[n].id;var a=new hE(e,r);return this.defaultArrow[n]=a,this.el.appendChild(a.el),this.add(a),a.id},t.prototype.addGradient=function(e){var r=new o7(e);return this.el.appendChild(r.el),this.add(r),r.id},t.prototype.addArrow=function(e,r){var n=new hE(e,r);return this.el.appendChild(n.el),this.add(n),n.id},t.prototype.addShadow=function(e){var r=new f7(e);return this.el.appendChild(r.el),this.add(r),r.id},t.prototype.addPattern=function(e){var r=new h7(e);return this.el.appendChild(r.el),this.add(r),r.id},t.prototype.addClip=function(e){var r=new l7(e);return this.el.appendChild(r.el),this.add(r),r.id},t}(),Tp=function(t){jt(e,t);function e(r){return t.call(this,P(P({},r),{autoDraw:!0,renderer:"svg"}))||this}return e.prototype.getShapeBase=function(){return ry},e.prototype.getGroupBase=function(){return zT},e.prototype.getShape=function(r,n,a){var i=a.target||a.srcElement;if(!fg[i.tagName]){for(var o=i.parentNode;o&&!fg[o.tagName];)o=o.parentNode;i=o}return this.find(function(s){return s.get("el")===i})},e.prototype.createDom=function(){var r=ra("svg"),n=new d7(r);return r.setAttribute("width",""+this.get("width")),r.setAttribute("height",""+this.get("height")),this.set("context",n),r},e.prototype.onCanvasChange=function(r){var n=this.get("context"),a=this.get("el");if(r==="sort"){var i=this.get("children");i&&i.length&&FT(this,function(s,u){return i.indexOf(s)-i.indexOf(u)?1:0})}else if(r==="clear"){if(a){a.innerHTML="";var o=n.el;o.innerHTML="",a.appendChild(o)}}else r==="matrix"?al(this):r==="clip"?$f(this,n):r==="changeSize"&&(a.setAttribute("width",""+this.get("width")),a.setAttribute("height",""+this.get("height")))},e.prototype.draw=function(){var r=this.get("context"),n=this.getChildren();$f(this,r),n.length&&BT(r,n)},e}(wC);function Ic(t,e,r){if(t){if(typeof t.addEventListener=="function")return t.addEventListener(e,r,!1),{remove:function(){t.removeEventListener(e,r,!1)}};if(typeof t.attachEvent=="function")return t.attachEvent("on"+e,r),{remove:function(){t.detachEvent("on"+e,r)}}}}var hf,Ip,UT,lg;function v7(){hf=document.createElement("table"),Ip=document.createElement("tr"),UT=/^\s*<(\w+|!)[^>]*>/,lg={tr:document.createElement("tbody"),tbody:hf,thead:hf,tfoot:hf,td:Ip,th:Ip,"*":document.createElement("div")}}function cg(t){hf||v7();var e=UT.test(t)&&RegExp.$1;(!e||!(e in lg))&&(e="*");var r=lg[e];t=typeof t=="string"?t.replace(/(^\s*)|(\s*$)/g,""):t,r.innerHTML=""+t;var n=r.childNodes[0];return n&&r.contains(n)&&r.removeChild(n),n}function Hu(t,e){if(t)for(var r in e)e.hasOwnProperty(r)&&(t.style[r]=e[r]);return t}var $T={exports:{}},p7={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]},XT={exports:{}},g7=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")},y7=g7,m7=Array.prototype.concat,b7=Array.prototype.slice,dE=XT.exports=function(e){for(var r=[],n=0,a=e.length;n<a;n++){var i=e[n];y7(i)?r=m7.call(r,b7.call(i)):r.push(i)}return r};dE.wrap=function(t){return function(){return t(dE(arguments))}};var w7=XT.exports,_f=p7,il=w7,WT=Object.hasOwnProperty,VT=Object.create(null);for(var kp in _f)WT.call(_f,kp)&&(VT[_f[kp]]=kp);var $n=$T.exports={to:{},get:{}};$n.get=function(t){var e=t.substring(0,3).toLowerCase(),r,n;switch(e){case"hsl":r=$n.get.hsl(t),n="hsl";break;case"hwb":r=$n.get.hwb(t),n="hwb";break;default:r=$n.get.rgb(t),n="rgb";break}return r?{model:n,value:r}:null};$n.get.rgb=function(t){if(!t)return null;var e=/^#([a-f0-9]{3,4})$/i,r=/^#([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*)?\)$/,a=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^(\w+)$/,o=[0,0,0,1],s,u,f;if(s=t.match(r)){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=t.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=t.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=t.match(a)){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=t.match(i))?s[1]==="transparent"?[0,0,0,0]:WT.call(_f,s[1])?(o=_f[s[1]],o[3]=1,o):null:null;for(u=0;u<3;u++)o[u]=Vi(o[u],0,255);return o[3]=Vi(o[3],0,1),o};$n.get.hsl=function(t){if(!t)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*)?\)$/,r=t.match(e);if(r){var n=parseFloat(r[4]),a=(parseFloat(r[1])%360+360)%360,i=Vi(parseFloat(r[2]),0,100),o=Vi(parseFloat(r[3]),0,100),s=Vi(isNaN(n)?1:n,0,1);return[a,i,o,s]}return null};$n.get.hwb=function(t){if(!t)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*)?\)$/,r=t.match(e);if(r){var n=parseFloat(r[4]),a=(parseFloat(r[1])%360+360)%360,i=Vi(parseFloat(r[2]),0,100),o=Vi(parseFloat(r[3]),0,100),s=Vi(isNaN(n)?1:n,0,1);return[a,i,o,s]}return null};$n.to.hex=function(){var t=il(arguments);return"#"+kc(t[0])+kc(t[1])+kc(t[2])+(t[3]<1?kc(Math.round(t[3]*255)):"")};$n.to.rgb=function(){var t=il(arguments);return t.length<4||t[3]===1?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"};$n.to.rgb.percent=function(){var t=il(arguments),e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||t[3]===1?"rgb("+e+"%, "+r+"%, "+n+"%)":"rgba("+e+"%, "+r+"%, "+n+"%, "+t[3]+")"};$n.to.hsl=function(){var t=il(arguments);return t.length<4||t[3]===1?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"};$n.to.hwb=function(){var t=il(arguments),e="";return t.length>=4&&t[3]!==1&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"};$n.to.keyword=function(t){return VT[t.slice(0,3)]};function Vi(t,e,r){return Math.min(Math.max(e,t),r)}function kc(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}var x7=$T.exports,YT={exports:{}},E7={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]},zo=E7,qT={};for(var Np in zo)zo.hasOwnProperty(Np)&&(qT[zo[Np]]=Np);var mt=YT.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 Tn in mt)if(mt.hasOwnProperty(Tn)){if(!("channels"in mt[Tn]))throw new Error("missing channels property: "+Tn);if(!("labels"in mt[Tn]))throw new Error("missing channel labels property: "+Tn);if(mt[Tn].labels.length!==mt[Tn].channels)throw new Error("channel and label counts mismatch: "+Tn);var _7=mt[Tn].channels,S7=mt[Tn].labels;delete mt[Tn].channels,delete mt[Tn].labels,Object.defineProperty(mt[Tn],"channels",{value:_7}),Object.defineProperty(mt[Tn],"labels",{value:S7})}mt.rgb.hsl=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,a=Math.min(e,r,n),i=Math.max(e,r,n),o=i-a,s,u,f;return i===a?s=0:e===i?s=(r-n)/o:r===i?s=2+(n-e)/o:n===i&&(s=4+(e-r)/o),s=Math.min(s*60,360),s<0&&(s+=360),f=(a+i)/2,i===a?u=0:f<=.5?u=o/(i+a):u=o/(2-i-a),[s,u*100,f*100]};mt.rgb.hsv=function(t){var e,r,n,a,i,o=t[0]/255,s=t[1]/255,u=t[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?a=i=0:(i=l/f,e=c(o),r=c(s),n=c(u),o===f?a=n-r:s===f?a=1/3+e-n:u===f&&(a=2/3+r-e),a<0?a+=1:a>1&&(a-=1)),[a*360,i*100,f*100]};mt.rgb.hwb=function(t){var e=t[0],r=t[1],n=t[2],a=mt.rgb.hsl(t)[0],i=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[a,i*100,n*100]};mt.rgb.cmyk=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,a,i,o,s;return s=Math.min(1-e,1-r,1-n),a=(1-e-s)/(1-s)||0,i=(1-r-s)/(1-s)||0,o=(1-n-s)/(1-s)||0,[a*100,i*100,o*100,s*100]};function M7(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}mt.rgb.keyword=function(t){var e=qT[t];if(e)return e;var r=1/0,n;for(var a in zo)if(zo.hasOwnProperty(a)){var i=zo[a],o=M7(t,i);o<r&&(r=o,n=a)}return n};mt.keyword.rgb=function(t){return zo[t]};mt.rgb.xyz=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var a=e*.4124+r*.3576+n*.1805,i=e*.2126+r*.7152+n*.0722,o=e*.0193+r*.1192+n*.9505;return[a*100,i*100,o*100]};mt.rgb.lab=function(t){var e=mt.rgb.xyz(t),r=e[0],n=e[1],a=e[2],i,o,s;return r/=95.047,n/=100,a/=108.883,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,i=116*n-16,o=500*(r-n),s=200*(n-a),[i,o,s]};mt.hsl.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,a,i,o,s,u;if(r===0)return u=n*255,[u,u,u];n<.5?i=n*(1+r):i=n+r-n*r,a=2*n-i,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=a+(i-a)*6*o:2*o<1?u=i:3*o<2?u=a+(i-a)*(2/3-o)*6:u=a,s[f]=u*255;return s};mt.hsl.hsv=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,a=r,i=Math.max(n,.01),o,s;return n*=2,r*=n<=1?n:2-n,a*=i<=1?i:2-i,s=(n+r)/2,o=n===0?2*a/(i+a):2*r/(n+r),[e,o*100,s*100]};mt.hsv.rgb=function(t){var e=t[0]/60,r=t[1]/100,n=t[2]/100,a=Math.floor(e)%6,i=e-Math.floor(e),o=255*n*(1-r),s=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,a){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]}};mt.hsv.hsl=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,a=Math.max(n,.01),i,o,s;return s=(2-r)*n,i=(2-r)*a,o=r*a,o/=i<=1?i:2-i,o=o||0,s/=2,[e,o*100,s*100]};mt.hwb.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,a=r+n,i,o,s,u;a>1&&(r/=a,n/=a),i=Math.floor(6*e),o=1-n,s=6*e-i,i&1&&(s=1-s),u=r+s*(o-r);var f,l,c;switch(i){default:case 6:case 0:f=o,l=u,c=r;break;case 1:f=u,l=o,c=r;break;case 2:f=r,l=o,c=u;break;case 3:f=r,l=u,c=o;break;case 4:f=u,l=r,c=o;break;case 5:f=o,l=r,c=u;break}return[f*255,l*255,c*255]};mt.cmyk.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,a=t[3]/100,i,o,s;return i=1-Math.min(1,e*(1-a)+a),o=1-Math.min(1,r*(1-a)+a),s=1-Math.min(1,n*(1-a)+a),[i*255,o*255,s*255]};mt.xyz.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,a,i,o;return a=e*3.2406+r*-1.5372+n*-.4986,i=e*-.9689+r*1.8758+n*.0415,o=e*.0557+r*-.204+n*1.057,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a*12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92,a=Math.min(Math.max(0,a),1),i=Math.min(Math.max(0,i),1),o=Math.min(Math.max(0,o),1),[a*255,i*255,o*255]};mt.xyz.lab=function(t){var e=t[0],r=t[1],n=t[2],a,i,o;return e/=95.047,r/=100,n/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,a=116*r-16,i=500*(e-r),o=200*(r-n),[a,i,o]};mt.lab.xyz=function(t){var e=t[0],r=t[1],n=t[2],a,i,o;i=(e+16)/116,a=r/500+i,o=i-n/200;var s=Math.pow(i,3),u=Math.pow(a,3),f=Math.pow(o,3);return i=s>.008856?s:(i-16/116)/7.787,a=u>.008856?u:(a-16/116)/7.787,o=f>.008856?f:(o-16/116)/7.787,a*=95.047,i*=100,o*=108.883,[a,i,o]};mt.lab.lch=function(t){var e=t[0],r=t[1],n=t[2],a,i,o;return a=Math.atan2(n,r),i=a*360/2/Math.PI,i<0&&(i+=360),o=Math.sqrt(r*r+n*n),[e,o,i]};mt.lch.lab=function(t){var e=t[0],r=t[1],n=t[2],a,i,o;return o=n/360*2*Math.PI,a=r*Math.cos(o),i=r*Math.sin(o),[e,a,i]};mt.rgb.ansi16=function(t){var e=t[0],r=t[1],n=t[2],a=1 in arguments?arguments[1]:mt.rgb.hsv(t)[2];if(a=Math.round(a/50),a===0)return 30;var i=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(e/255));return a===2&&(i+=60),i};mt.hsv.ansi16=function(t){return mt.rgb.ansi16(mt.hsv.rgb(t),t[2])};mt.rgb.ansi256=function(t){var e=t[0],r=t[1],n=t[2];if(e===r&&r===n)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;var a=16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5);return a};mt.ansi16.rgb=function(t){var e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var r=(~~(t>50)+1)*.5,n=(e&1)*r*255,a=(e>>1&1)*r*255,i=(e>>2&1)*r*255;return[n,a,i]};mt.ansi256.rgb=function(t){if(t>=232){var e=(t-232)*10+8;return[e,e,e]}t-=16;var r,n=Math.floor(t/36)/5*255,a=Math.floor((r=t%36)/6)/5*255,i=r%6/5*255;return[n,a,i]};mt.rgb.hex=function(t){var e=((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255),r=e.toString(16).toUpperCase();return"000000".substring(r.length)+r};mt.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var r=e[0];e[0].length===3&&(r=r.split("").map(function(s){return s+s}).join(""));var n=parseInt(r,16),a=n>>16&255,i=n>>8&255,o=n&255;return[a,i,o]};mt.rgb.hcg=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,a=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),o=a-i,s,u;return o<1?s=i/(1-o):s=0,o<=0?u=0:a===e?u=(r-n)/o%6:a===r?u=2+(n-e)/o:u=4+(e-r)/o+4,u/=6,u%=1,[u*360,o*100,s*100]};mt.hsl.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1,a=0;return r<.5?n=2*e*r:n=2*e*(1-r),n<1&&(a=(r-.5*n)/(1-n)),[t[0],n*100,a*100]};mt.hsv.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=e*r,a=0;return n<1&&(a=(r-n)/(1-n)),[t[0],n*100,a*100]};mt.hcg.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];var a=[0,0,0],i=e%1*6,o=i%1,s=1-o,u=0;switch(Math.floor(i)){case 0:a[0]=1,a[1]=o,a[2]=0;break;case 1:a[0]=s,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=o;break;case 3:a[0]=0,a[1]=s,a[2]=1;break;case 4:a[0]=o,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=s}return u=(1-r)*n,[(r*a[0]+u)*255,(r*a[1]+u)*255,(r*a[2]+u)*255]};mt.hcg.hsv=function(t){var e=t[1]/100,r=t[2]/100,n=e+r*(1-e),a=0;return n>0&&(a=e/n),[t[0],a*100,n*100]};mt.hcg.hsl=function(t){var e=t[1]/100,r=t[2]/100,n=r*(1-e)+.5*e,a=0;return n>0&&n<.5?a=e/(2*n):n>=.5&&n<1&&(a=e/(2*(1-n))),[t[0],a*100,n*100]};mt.hcg.hwb=function(t){var e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};mt.hwb.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1-r,a=n-e,i=0;return a<1&&(i=(n-a)/(1-a)),[t[0],a*100,i*100]};mt.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};mt.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};mt.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};mt.gray.hsl=mt.gray.hsv=function(t){return[0,0,t[0]]};mt.gray.hwb=function(t){return[0,100,t[0]]};mt.gray.cmyk=function(t){return[0,0,0,t[0]]};mt.gray.lab=function(t){return[t[0],0,0]};mt.gray.hex=function(t){var e=Math.round(t[0]/100*255)&255,r=(e<<16)+(e<<8)+e,n=r.toString(16).toUpperCase();return"000000".substring(n.length)+n};mt.rgb.gray=function(t){var e=(t[0]+t[1]+t[2])/3;return[e/255*100]};var HT=YT.exports,$h=HT;function A7(){for(var t={},e=Object.keys($h),r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function C7(t){var e=A7(),r=[t];for(e[t].distance=0;r.length;)for(var n=r.pop(),a=Object.keys($h[n]),i=a.length,o=0;o<i;o++){var s=a[o],u=e[s];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,r.unshift(s))}return e}function T7(t,e){return function(r){return e(t(r))}}function I7(t,e){for(var r=[e[t].parent,t],n=$h[e[t].parent][t],a=e[t].parent;e[a].parent;)r.unshift(e[a].parent),n=T7($h[e[a].parent][a],n),a=e[a].parent;return n.conversion=r,n}var k7=function(t){for(var e=C7(t),r={},n=Object.keys(e),a=n.length,i=0;i<a;i++){var o=n[i],s=e[o];s.parent!==null&&(r[o]=I7(o,e))}return r},hg=HT,N7=k7,Ns={},O7=Object.keys(hg);function L7(t){var e=function(r){return r==null?r:(arguments.length>1&&(r=Array.prototype.slice.call(arguments)),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function D7(t){var e=function(r){if(r==null)return r;arguments.length>1&&(r=Array.prototype.slice.call(arguments));var n=t(r);if(typeof n=="object")for(var a=n.length,i=0;i<a;i++)n[i]=Math.round(n[i]);return n};return"conversion"in t&&(e.conversion=t.conversion),e}O7.forEach(function(t){Ns[t]={},Object.defineProperty(Ns[t],"channels",{value:hg[t].channels}),Object.defineProperty(Ns[t],"labels",{value:hg[t].labels});var e=N7(t),r=Object.keys(e);r.forEach(function(n){var a=e[n];Ns[t][n]=D7(a),Ns[t][n].raw=L7(a)})});var P7=Ns,df=x7,zn=P7,Qy=[].slice,ZT=["keyword","gray","hex"],dg={};Object.keys(zn).forEach(function(t){dg[Qy.call(zn[t].labels).sort().join("")]=t});var Xh={};function pn(t,e){if(!(this instanceof pn))return new pn(t,e);if(e&&e in ZT&&(e=null),e&&!(e in zn))throw new Error("Unknown model: "+e);var r,n;if(t==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof pn)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if(typeof t=="string"){var a=df.get(t);if(a===null)throw new Error("Unable to parse color from string: "+t);this.model=a.model,n=zn[this.model].channels,this.color=a.value.slice(0,n),this.valpha=typeof a.value[n]=="number"?a.value[n]:1}else if(t.length){this.model=e||"rgb",n=zn[this.model].channels;var i=Qy.call(t,0,n);this.color=vg(i,n),this.valpha=typeof t[n]=="number"?t[n]:1}else if(typeof t=="number")t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,t&255],this.valpha=1;else{this.valpha=1;var o=Object.keys(t);"alpha"in t&&(o.splice(o.indexOf("alpha"),1),this.valpha=typeof t.alpha=="number"?t.alpha:0);var s=o.sort().join("");if(!(s in dg))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=dg[s];var u=zn[this.model].labels,f=[];for(r=0;r<u.length;r++)f.push(t[u[r]]);this.color=vg(f)}if(Xh[this.model])for(n=zn[this.model].channels,r=0;r<n;r++){var l=Xh[this.model][r];l&&(this.color[r]=l(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}pn.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var e=this.model in df.to?this:this.rgb();e=e.round(typeof t=="number"?t:1);var r=e.valpha===1?e.color:e.color.concat(this.valpha);return df.to[e.model](r)},percentString:function(t){var e=this.rgb().round(typeof t=="number"?t:1),r=e.valpha===1?e.color:e.color.concat(this.valpha);return df.to.rgb.percent(r)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},e=zn[this.model].channels,r=zn[this.model].labels,n=0;n<e;n++)t[r[n]]=this.color[n];return this.valpha!==1&&(t.alpha=this.valpha),t},unitArray:function(){var t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,this.valpha!==1&&t.push(this.valpha),t},unitObject:function(){var t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,this.valpha!==1&&(t.alpha=this.valpha),t},round:function(t){return t=Math.max(t||0,0),new pn(this.color.map(F7(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new pn(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:Lr("rgb",0,qr(255)),green:Lr("rgb",1,qr(255)),blue:Lr("rgb",2,qr(255)),hue:Lr(["hsl","hsv","hsl","hwb","hcg"],0,function(t){return(t%360+360)%360}),saturationl:Lr("hsl",1,qr(100)),lightness:Lr("hsl",2,qr(100)),saturationv:Lr("hsv",1,qr(100)),value:Lr("hsv",2,qr(100)),chroma:Lr("hcg",1,qr(100)),gray:Lr("hcg",2,qr(100)),white:Lr("hwb",1,qr(100)),wblack:Lr("hwb",2,qr(100)),cyan:Lr("cmyk",0,qr(100)),magenta:Lr("cmyk",1,qr(100)),yellow:Lr("cmyk",2,qr(100)),black:Lr("cmyk",3,qr(100)),x:Lr("xyz",0,qr(100)),y:Lr("xyz",1,qr(100)),z:Lr("xyz",2,qr(100)),l:Lr("lab",0,qr(100)),a:Lr("lab",1),b:Lr("lab",2),keyword:function(t){return arguments.length?new pn(t):zn[this.model].keyword(this.color)},hex:function(t){return arguments.length?new pn(t):df.to.hex(this.rgb().round().color)},rgbNumber:function(){var t=this.rgb().color;return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255},luminosity:function(){for(var t=this.rgb().color,e=[],r=0;r<t.length;r++){var n=t[r]/255;e[r]=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(t){var e=this.luminosity(),r=t.luminosity();return e>r?(e+.05)/(r+.05):(r+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var t=this.rgb().color,e=(t[0]*299+t[1]*587+t[2]*114)/1e3;return e<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten:function(t){var e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken:function(t){var e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate:function(t){var e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate:function(t){var e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten:function(t){var e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken:function(t){var e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale:function(){var t=this.rgb().color,e=t[0]*.3+t[1]*.59+t[2]*.11;return pn.rgb(e,e,e)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var e=this.hsl(),r=e.color[0];return r=(r+t)%360,r=r<0?360+r:r,e.color[0]=r,e},mix:function(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);var r=t.rgb(),n=this.rgb(),a=e===void 0?.5:e,i=2*a-1,o=r.alpha()-n.alpha(),s=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,u=1-s;return pn.rgb(s*r.red()+u*n.red(),s*r.green()+u*n.green(),s*r.blue()+u*n.blue(),r.alpha()*a+n.alpha()*(1-a))}};Object.keys(zn).forEach(function(t){if(ZT.indexOf(t)===-1){var e=zn[t].channels;pn.prototype[t]=function(){if(this.model===t)return new pn(this);if(arguments.length)return new pn(arguments,t);var r=typeof arguments[e]=="number"?e:this.valpha;return new pn(B7(zn[this.model][t].raw(this.color)).concat(r),t)},pn[t]=function(r){return typeof r=="number"&&(r=vg(Qy.call(arguments),e)),new pn(r,t)}}});function R7(t,e){return Number(t.toFixed(e))}function F7(t){return function(e){return R7(e,t)}}function Lr(t,e,r){return t=Array.isArray(t)?t:[t],t.forEach(function(n){(Xh[n]||(Xh[n]=[]))[e]=r}),t=t[0],function(n){var a;return arguments.length?(r&&(n=r(n)),a=this[t](),a.color[e]=n,a):(a=this[t]().color[e],r&&(a=r(a)),a)}}function qr(t){return function(e){return Math.max(0,Math.min(t,e))}}function B7(t){return Array.isArray(t)?t:[t]}function vg(t,e){for(var r=0;r<e;r++)typeof t[r]!="number"&&(t[r]=0);return t}var G7=pn;const Sf=bi(G7);function Wh(t){"@babel/helpers - typeof";return Wh=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},Wh(t)}var z7=/^\s+/,j7=/\s+$/;function wt(t,e){if(t=t||"",e=e||{},t instanceof wt)return t;if(!(this instanceof wt))return new wt(t,e);var r=U7(t);this._originalInput=t,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||r.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=r.ok}wt.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(),r,n,a,i,o,s;return r=e.r/255,n=e.g/255,a=e.b/255,r<=.03928?i=r/12.92:i=Math.pow((r+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),a<=.03928?s=a/12.92:s=Math.pow((a+.055)/1.055,2.4),.2126*i+.7152*o+.0722*s},setAlpha:function(e){return this._a=KT(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=pE(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=pE(this._r,this._g,this._b),r=Math.round(e.h*360),n=Math.round(e.s*100),a=Math.round(e.v*100);return this._a==1?"hsv("+r+", "+n+"%, "+a+"%)":"hsva("+r+", "+n+"%, "+a+"%, "+this._roundA+")"},toHsl:function(){var e=vE(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=vE(this._r,this._g,this._b),r=Math.round(e.h*360),n=Math.round(e.s*100),a=Math.round(e.l*100);return this._a==1?"hsl("+r+", "+n+"%, "+a+"%)":"hsla("+r+", "+n+"%, "+a+"%, "+this._roundA+")"},toHex:function(e){return gE(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return V7(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(Er(this._r,255)*100)+"%",g:Math.round(Er(this._g,255)*100)+"%",b:Math.round(Er(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Er(this._r,255)*100)+"%, "+Math.round(Er(this._g,255)*100)+"%, "+Math.round(Er(this._b,255)*100)+"%)":"rgba("+Math.round(Er(this._r,255)*100)+"%, "+Math.round(Er(this._g,255)*100)+"%, "+Math.round(Er(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:aX[gE(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var r="#"+yE(this._r,this._g,this._b,this._a),n=r,a=this._gradientType?"GradientType = 1, ":"";if(e){var i=wt(e);n="#"+yE(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+r+",endColorstr="+n+")"},toString:function(e){var r=!!e;e=e||this._format;var n=!1,a=this._a<1&&this._a>=0,i=!r&&a&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return i?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 wt(this.toString())},_applyModification:function(e,r){var n=e.apply(null,[this].concat([].slice.call(r)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(Z7,arguments)},brighten:function(){return this._applyModification(K7,arguments)},darken:function(){return this._applyModification(Q7,arguments)},desaturate:function(){return this._applyModification(Y7,arguments)},saturate:function(){return this._applyModification(q7,arguments)},greyscale:function(){return this._applyModification(H7,arguments)},spin:function(){return this._applyModification(J7,arguments)},_applyCombination:function(e,r){return e.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(rX,arguments)},complement:function(){return this._applyCombination(eX,arguments)},monochromatic:function(){return this._applyCombination(nX,arguments)},splitcomplement:function(){return this._applyCombination(tX,arguments)},triad:function(){return this._applyCombination(mE,[3])},tetrad:function(){return this._applyCombination(mE,[4])}};wt.fromRatio=function(t,e){if(Wh(t)=="object"){var r={};for(var n in t)t.hasOwnProperty(n)&&(n==="a"?r[n]=t[n]:r[n]=vf(t[n]));t=r}return wt(t,e)};function U7(t){var e={r:0,g:0,b:0},r=1,n=null,a=null,i=null,o=!1,s=!1;return typeof t=="string"&&(t=uX(t)),Wh(t)=="object"&&(oi(t.r)&&oi(t.g)&&oi(t.b)?(e=$7(t.r,t.g,t.b),o=!0,s=String(t.r).substr(-1)==="%"?"prgb":"rgb"):oi(t.h)&&oi(t.s)&&oi(t.v)?(n=vf(t.s),a=vf(t.v),e=W7(t.h,n,a),o=!0,s="hsv"):oi(t.h)&&oi(t.s)&&oi(t.l)&&(n=vf(t.s),i=vf(t.l),e=X7(t.h,n,i),o=!0,s="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=KT(r),{ok:o,format:t.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:r}}function $7(t,e,r){return{r:Er(t,255)*255,g:Er(e,255)*255,b:Er(r,255)*255}}function vE(t,e,r){t=Er(t,255),e=Er(e,255),r=Er(r,255);var n=Math.max(t,e,r),a=Math.min(t,e,r),i,o,s=(n+a)/2;if(n==a)i=o=0;else{var u=n-a;switch(o=s>.5?u/(2-n-a):u/(n+a),n){case t:i=(e-r)/u+(e<r?6:0);break;case e:i=(r-t)/u+2;break;case r:i=(t-e)/u+4;break}i/=6}return{h:i,s:o,l:s}}function X7(t,e,r){var n,a,i;t=Er(t,360),e=Er(e,100),r=Er(r,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=a=i=r;else{var s=r<.5?r*(1+e):r+e-r*e,u=2*r-s;n=o(u,s,t+1/3),a=o(u,s,t),i=o(u,s,t-1/3)}return{r:n*255,g:a*255,b:i*255}}function pE(t,e,r){t=Er(t,255),e=Er(e,255),r=Er(r,255);var n=Math.max(t,e,r),a=Math.min(t,e,r),i,o,s=n,u=n-a;if(o=n===0?0:u/n,n==a)i=0;else{switch(n){case t:i=(e-r)/u+(e<r?6:0);break;case e:i=(r-t)/u+2;break;case r:i=(t-e)/u+4;break}i/=6}return{h:i,s:o,v:s}}function W7(t,e,r){t=Er(t,360)*6,e=Er(e,100),r=Er(r,100);var n=Math.floor(t),a=t-n,i=r*(1-e),o=r*(1-a*e),s=r*(1-(1-a)*e),u=n%6,f=[r,o,i,i,s,r][u],l=[s,r,r,o,i,i][u],c=[i,i,s,r,r,o][u];return{r:f*255,g:l*255,b:c*255}}function gE(t,e,r,n){var a=[ma(Math.round(t).toString(16)),ma(Math.round(e).toString(16)),ma(Math.round(r).toString(16))];return n&&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[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function V7(t,e,r,n,a){var i=[ma(Math.round(t).toString(16)),ma(Math.round(e).toString(16)),ma(Math.round(r).toString(16)),ma(QT(n))];return a&&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[3].charAt(0)==i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}function yE(t,e,r,n){var a=[ma(QT(n)),ma(Math.round(t).toString(16)),ma(Math.round(e).toString(16)),ma(Math.round(r).toString(16))];return a.join("")}wt.equals=function(t,e){return!t||!e?!1:wt(t).toRgbString()==wt(e).toRgbString()};wt.random=function(){return wt.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Y7(t,e){e=e===0?0:e||10;var r=wt(t).toHsl();return r.s-=e/100,r.s=Fd(r.s),wt(r)}function q7(t,e){e=e===0?0:e||10;var r=wt(t).toHsl();return r.s+=e/100,r.s=Fd(r.s),wt(r)}function H7(t){return wt(t).desaturate(100)}function Z7(t,e){e=e===0?0:e||10;var r=wt(t).toHsl();return r.l+=e/100,r.l=Fd(r.l),wt(r)}function K7(t,e){e=e===0?0:e||10;var r=wt(t).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(e/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(e/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(e/100)))),wt(r)}function Q7(t,e){e=e===0?0:e||10;var r=wt(t).toHsl();return r.l-=e/100,r.l=Fd(r.l),wt(r)}function J7(t,e){var r=wt(t).toHsl(),n=(r.h+e)%360;return r.h=n<0?360+n:n,wt(r)}function eX(t){var e=wt(t).toHsl();return e.h=(e.h+180)%360,wt(e)}function mE(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var r=wt(t).toHsl(),n=[wt(t)],a=360/e,i=1;i<e;i++)n.push(wt({h:(r.h+i*a)%360,s:r.s,l:r.l}));return n}function tX(t){var e=wt(t).toHsl(),r=e.h;return[wt(t),wt({h:(r+72)%360,s:e.s,l:e.l}),wt({h:(r+216)%360,s:e.s,l:e.l})]}function rX(t,e,r){e=e||6,r=r||30;var n=wt(t).toHsl(),a=360/r,i=[wt(t)];for(n.h=(n.h-(a*e>>1)+720)%360;--e;)n.h=(n.h+a)%360,i.push(wt(n));return i}function nX(t,e){e=e||6;for(var r=wt(t).toHsv(),n=r.h,a=r.s,i=r.v,o=[],s=1/e;e--;)o.push(wt({h:n,s:a,v:i})),i=(i+s)%1;return o}wt.mix=function(t,e,r){r=r===0?0:r||50;var n=wt(t).toRgb(),a=wt(e).toRgb(),i=r/100,o={r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a};return wt(o)};wt.readability=function(t,e){var r=wt(t),n=wt(e);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)};wt.isReadable=function(t,e,r){var n=wt.readability(t,e),a,i;switch(i=!1,a=fX(r),a.level+a.size){case"AAsmall":case"AAAlarge":i=n>=4.5;break;case"AAlarge":i=n>=3;break;case"AAAsmall":i=n>=7;break}return i};wt.mostReadable=function(t,e,r){var n=null,a=0,i,o,s,u;r=r||{},o=r.includeFallbackColors,s=r.level,u=r.size;for(var f=0;f<e.length;f++)i=wt.readability(t,e[f]),i>a&&(a=i,n=wt(e[f]));return wt.isReadable(t,n,{level:s,size:u})||!o?n:(r.includeFallbackColors=!1,wt.mostReadable(t,["#fff","#000"],r))};var pg=wt.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"},aX=wt.hexNames=iX(pg);function iX(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function KT(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Er(t,e){oX(t)&&(t="100%");var r=sX(t);return t=Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function Fd(t){return Math.min(1,Math.max(0,t))}function Fn(t){return parseInt(t,16)}function oX(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function sX(t){return typeof t=="string"&&t.indexOf("%")!=-1}function ma(t){return t.length==1?"0"+t:""+t}function vf(t){return t<=1&&(t=t*100+"%"),t}function QT(t){return Math.round(parseFloat(t)*255).toString(16)}function bE(t){return Fn(t)/255}var ha=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",a="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+a),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 oi(t){return!!ha.CSS_UNIT.exec(t)}function uX(t){t=t.replace(z7,"").replace(j7,"").toLowerCase();var e=!1;if(pg[t])t=pg[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=ha.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=ha.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=ha.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=ha.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=ha.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=ha.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=ha.hex8.exec(t))?{r:Fn(r[1]),g:Fn(r[2]),b:Fn(r[3]),a:bE(r[4]),format:e?"name":"hex8"}:(r=ha.hex6.exec(t))?{r:Fn(r[1]),g:Fn(r[2]),b:Fn(r[3]),format:e?"name":"hex"}:(r=ha.hex4.exec(t))?{r:Fn(r[1]+""+r[1]),g:Fn(r[2]+""+r[2]),b:Fn(r[3]+""+r[3]),a:bE(r[4]+""+r[4]),format:e?"name":"hex8"}:(r=ha.hex3.exec(t))?{r:Fn(r[1]+""+r[1]),g:Fn(r[2]+""+r[2]),b:Fn(r[3]+""+r[3]),format:e?"name":"hex"}:!1}function fX(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:e,size:r}}var Nc=2,wE=.16,lX=.05,cX=.05,hX=.15,JT=5,eI=4,dX=[{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 xE(t,e,r){var n;return Math.round(t.h)>=60&&Math.round(t.h)<=240?n=r?Math.round(t.h)-Nc*e:Math.round(t.h)+Nc*e:n=r?Math.round(t.h)+Nc*e:Math.round(t.h)-Nc*e,n<0?n+=360:n>=360&&(n-=360),n}function EE(t,e,r){if(t.h===0&&t.s===0)return t.s;var n;return r?n=t.s-wE*e:e===eI?n=t.s+wE:n=t.s+lX*e,n>1&&(n=1),r&&e===JT&&n>.1&&(n=.1),n<.06&&(n=.06),Number(n.toFixed(2))}function _E(t,e,r){var n;return r?n=t.v+cX*e:n=t.v-hX*e,n>1&&(n=1),Number(n.toFixed(2))}function Vh(t){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=[],n=wt(t),a=JT;a>0;a-=1){var i=n.toHsv(),o=wt({h:xE(i,a,!0),s:EE(i,a,!0),v:_E(i,a,!0)}).toHexString();r.push(o)}r.push(n.toHexString());for(var s=1;s<=eI;s+=1){var u=n.toHsv(),f=wt({h:xE(u,s),s:EE(u,s),v:_E(u,s)}).toHexString();r.push(f)}return e.theme==="dark"?dX.map(function(l){var c=l.index,h=l.opacity,d=wt.mix(e.backgroundColor||"#141414",r[c],h*100).toHexString();return d}):r}var Op={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"},Lp={},Dp={};Object.keys(Op).forEach(function(t){Lp[t]=Vh(Op[t]),Lp[t].primary=Lp[t][5],Dp[t]=Vh(Op[t],{theme:"dark",backgroundColor:"#141414"}),Dp[t].primary=Dp[t][5]});var Zr=function(e,r,n){var a=Sf(e),i=Sf(r);return Sf([(1-n)*a.red()+n*i.red(),(1-n)*a.green()+n*i.green(),(1-n)*a.blue()+n*i.blue()]).rgb()},vX=function(e,r,n){r===void 0&&(r="#fff");var a=Zr(r,e,.05).rgb().toString(),i=Zr(r,e,.1).rgb().toString(),o=Zr(r,e,.2).rgb().toString(),s=Zr(r,e,.4).rgb().toString(),u=Zr(r,n,.02).rgb().toString(),f=Zr(r,n,.05).rgb().toString(),l=Zr(r,n,.1).rgb().toString(),c=Zr(r,n,.2).rgb().toString(),h=Zr(r,n,.3).rgb().toString(),d=Vh(e,{theme:"default",backgroundColor:r}),v=Sf(e).hex().toLowerCase(),p=d.indexOf(v),g=e;return p!==-1&&(g=d[p+1]),{mainStroke:e,mainFill:i,activeStroke:e,activeFill:a,inactiveStroke:s,inactiveFill:a,selectedStroke:e,selectedFill:r,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:a,comboInactiveStroke:h,comboInactiveFill:u,comboSelectedStroke:e,comboSelectedFill:u,comboHighlightStroke:g,comboHighlightFill:u,comboDisableStroke:c,comboDisableFill:f}},pX=function(e,r,n){r===void 0&&(r="#fff");var a=Zr(r,e,.2).rgb().toString(),i=Zr(r,e,.3).rgb().toString(),o=Zr(r,e,.6).rgb().toString(),s=Zr(r,e,.8).rgb().toString(),u=Zr(r,n,.2).rgb().toString(),f=Zr(r,n,.25).rgb().toString(),l=Zr(r,n,.3).rgb().toString(),c=Zr(r,n,.4).rgb().toString(),h=Zr(r,n,.5).rgb().toString(),d=Vh(e,{theme:"dark",backgroundColor:r}),v=Sf(e).hex().toLowerCase(),p=d.indexOf(v),g=e;return p!==-1&&(g=d[p+1]),{mainStroke:s,mainFill:a,activeStroke:e,activeFill:i,inactiveStroke:s,inactiveFill:a,selectedStroke:e,selectedFill:a,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}},Jy=function(e,r,n,a){return r===void 0&&(r="#fff"),n===void 0&&(n="default"),n==="default"?vX(e,r,"rgb(150, 150, 150)"):pX(e,r,"#777")},gX=function(e,r,n,a){r===void 0&&(r="#fff"),n===void 0&&(n="default");var i=[];return e.forEach(function(o){i.push(Jy(o,r,n))}),i};const yX=Object.freeze(Object.defineProperty({__proto__:null,getColorSetsBySubjectColors:gX,getColorsWithSubjectColor:Jy,mixColor:Zr},Symbol.toStringTag,{value:"Module"}));var mX="rgb(95, 149, 255)",bX="rgb(255, 255, 255)",Ht=Jy(mX,bX);const Mf={defaultNode:{style:{stroke:Ht.mainStroke,fill:Ht.mainFill},color:Ht.mainStroke,linkPoints:{fill:Ht.activeFill,stroke:Ht.activeStroke}},nodeStateStyles:{active:{fill:Ht.activeFill,stroke:Ht.activeStroke,shadowColor:Ht.mainStroke},selected:{fill:Ht.selectedFill,stroke:Ht.selectedStroke,shadowColor:Ht.selectedStroke},highlight:{fill:Ht.highlightFill,stroke:Ht.highlightStroke},inactive:{fill:Ht.inactiveFill,stroke:Ht.inactiveStroke},disable:{fill:Ht.disableFill,stroke:Ht.disableStroke}},defaultEdge:{style:{stroke:Ht.edgeMainStroke},color:Ht.edgeMainStroke},edgeStateStyles:{active:{stroke:Ht.edgeActiveStroke},selected:{stroke:Ht.edgeSelectedStroke,shadowColor:Ht.edgeSelectedStroke},highlight:{stroke:Ht.edgeHighlightStroke},inactive:{stroke:Ht.edgeInactiveStroke},disable:{stroke:Ht.edgeDisableStroke}},defaultCombo:{style:{fill:Ht.comboMainFill,stroke:Ht.comboMainStroke},color:Ht.comboMainStroke},comboStateStyles:{active:{stroke:Ht.comboActiveStroke,fill:Ht.comboActiveFill},selected:{stroke:Ht.comboSelectedStroke,fill:Ht.comboSelectedFill,shadowColor:Ht.comboSelectedStroke},highlight:{stroke:Ht.comboHighlightStroke,fill:Ht.comboHighlightFill},inactive:{stroke:Ht.comboInactiveStroke,fill:Ht.comboInactiveFill},disable:{stroke:Ht.comboDisableStroke,fill:Ht.comboDisableFill}},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 wX=function(e){var r=e.clone();return tI(e,r),r},tI=function(e,r){var n;e.isGroup()&&r.isGroup()&&((n=e.get("children"))===null||n===void 0||n.forEach(function(s,u){var f=r.get("children")[u];tI(s,f)}));var a=e.get("type"),i=r.get("type");if(!(a!=="image"||i!=="image")){var o=e.get("clipShape");o&&r.setClip({type:o.get("type"),attrs:o.attr()})}},xX=Za.cloneEvent,EX=Za.isViewportChanged,_X=function(t){jt(e,t);function e(r){var n=t.call(this,r)||this;return n.extendEvents=[],n.dragging=!1,n.mousedown=!1,n.preItem=null,n.destroy(),n.graph=r,n.destroyed=!1,n.initEvents(),n}return e.prototype.initEvents=function(){var r=this,n=r.graph,a=r.extendEvents,i=a===void 0?[]:a,o=n.get("canvas"),s=o.get("el"),u=Bs(this,"onCanvasEvents"),f=Bs(this,"onExtendEvents"),l=Bs(this,"onWheelEvent");o.off("*").on("*",u),this.canvasHandler=u,i.push(Ic(s,"wheel",l)),typeof window<"u"&&(i.push(Ic(window,"keydown",f)),i.push(Ic(window,"keyup",f)),i.push(Ic(window,"focus",f))),this.resetHandler&&n.off("afterchangedata",this.resetHandler),this.resetHandler=Bs(this,"resetStatus"),n.on("afterchangedata",this.resetHandler)},e.getItemRoot=function(r){for(;r&&!r.get("item");)r=r.get("parent");return r},e.prototype.onCanvasEvents=function(r){var n=this,a=this.graph,i=a.get("canvas"),o=r.target,s=r.type;switch(s){case"drag":this.onCanvasEvents(Object.assign({},r,{type:"mousemove"}));break;case"dragend":this.onCanvasEvents(Object.assign({},r,{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}r.canvasX=r.x,r.canvasY=r.y;var u={x:r.canvasX,y:r.canvasY},f=a.get("group"),l=f.getMatrix();if(l||(l=[1,0,0,0,1,0,0,0,1]),EX(l)&&(u=a.getPointByClient(r.clientX,r.clientY)),r.x=u.x,r.y=u.y,r.currentTarget=a,o===i){(s==="mousemove"||s==="mouseleave")&&this.handleMouseMove(r,"canvas"),r.target=i,r.item=null,a.emit(s,r),a.emit("canvas:".concat(s),r);return}var c=e.getItemRoot(o);if(!c){a.emit(s,r);return}var h=c.get("item");if(!h.destroyed){var d=h.getType();if(r.target=o,r.item=h,r.canvasX===r.x&&r.canvasY===r.y){var v=a.getCanvasByPoint(r.x,r.y);r.canvasX=v.x,r.canvasY=v.y}r.name&&!r.name.includes(":")?(a.emit("".concat(d,":").concat(s),r),a.emit(s,r)):r.name&&a.emit(r.name,r),s==="dragstart"&&(this.dragging=!0),s==="dragend"&&(this.dragging=!1),s==="mousemove"&&this.handleMouseMove(r,d)}},e.prototype.onExtendEvents=function(r){this.graph.emit(r.type,r)},e.prototype.onWheelEvent=function(r){Zt(r.wheelDelta)&&(r.wheelDelta=-r.detail),this.graph.emit("wheel",r)},e.prototype.handleMouseMove=function(r,n){var a=this,i=a.graph,o=a.preItem,s=i.get("canvas"),u=r.target===s?null:r.item;r=xX(r),o&&o!==u&&!o.destroyed&&(r.item=o,this.emitCustomEvent(o.getType(),"mouseleave",r),this.dragging&&this.emitCustomEvent(o.getType(),"dragleave",r)),u&&o!==u&&(r.item=u,this.emitCustomEvent(n,"mouseenter",r),this.dragging&&this.emitCustomEvent(n,"dragenter",r)),this.preItem=u},e.prototype.emitCustomEvent=function(r,n,a){a.type=n,this.graph.emit("".concat(r,":").concat(n),a)},e.prototype.resetStatus=function(){this.mousedown=!1,this.dragging=!1,this.preItem=null},e.prototype.destroy=function(){var r=this,n=r.graph,a=r.canvasHandler,i=r.extendEvents,o=n.get("canvas");o.off("*",a),_e(i,function(s){s.remove()}),this.resetStatus(),this.extendEvents.length=0,this.canvasHandler=null,this.resetHandler=null,this.destroyed=!0},e}(F8),Kt={},gi={},Rr={};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.Base=void 0;var SX=function(){function t(){this.nodes=[],this.edges=[],this.combos=[],this.comboEdges=[],this.hiddenNodes=[],this.hiddenEdges=[],this.hiddenCombos=[],this.vedges=[],this.positions=[],this.destroyed=!1,this.onLayoutEnd=function(){}}return t.prototype.layout=function(e){return this.init(e),this.execute(!0)},t.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||[]},t.prototype.execute=function(e){},t.prototype.executeWithWorker=function(){},t.prototype.getDefaultCfg=function(){return{}},t.prototype.updateCfg=function(e){e&&Object.assign(this,e)},t.prototype.getType=function(){return"base"},t.prototype.destroy=function(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0},t}();Rr.Base=SX;var Pp={},nu={};Object.defineProperty(nu,"__esModule",{value:!0});nu.camelize=nu.isString=void 0;var MX=function(t){return typeof t=="string"};nu.isString=MX;var AX=function(t){var e=Object.create(null);return function(r){var n=e[r];return n||(e[r]=t(r))}},CX=/-(\w)/g;nu.camelize=AX(function(t){return t.replace(CX,function(e,r){return r?r.toUpperCase():""})});var ol={};Object.defineProperty(ol,"__esModule",{value:!0});ol.isArray=void 0;ol.isArray=Array.isArray;var Bd={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.toNumber=t.isNaN=t.isNumber=void 0;var e=function(a){return typeof a=="number"};t.isNumber=e;var r=function(a){return Number.isNaN(Number(a))};t.isNaN=r;var n=function(a){var i=parseFloat(a);return(0,t.isNaN)(i)?a:i};t.toNumber=n})(Bd);var Gd={},em={};(function(t){var e=me&&me.__assign||function(){return e=Object.assign||function(a){for(var i,o=1,s=arguments.length;o<s;o++){i=arguments[o];for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(a[u]=i[u])}return a},e.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.clone=t.isObject=void 0;var r=function(a){return a!==null&&typeof a=="object"};t.isObject=r;var n=function(a){if(a===null)return a;if(a instanceof Date)return new Date(a.getTime());if(a instanceof Array){var i=[];return a.forEach(function(s){i.push(s)}),i.map(function(s){return(0,t.clone)(s)})}if(typeof a=="object"&&Object.keys(a).length){var o=e({},a);return Object.keys(o).forEach(function(s){o[s]=(0,t.clone)(o[s])}),o}return a};t.clone=n})(em);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCoreNodeAndRelativeLeafNodes=t.getAvgNodePosition=t.getLayoutBBox=t.traverseTreeUp=t.scaleMatrix=t.getAdjMatrix=t.floydWarshall=t.getDegreeMap=t.getDegree=t.getEdgeTerminal=void 0;var e=ol,r=Bd,n=em,a=function(m,b){var w=m[b];return(0,n.isObject)(w)?w.cell:w};t.getEdgeTerminal=a;var i=function(m,b,w){for(var x=[],E=0;E<m;E++)x[E]={in:0,out:0,all:0};return w&&w.forEach(function(_){var S=(0,t.getEdgeTerminal)(_,"source"),A=(0,t.getEdgeTerminal)(_,"target");S&&x[b[S]]&&(x[b[S]].out+=1,x[b[S]].all+=1),A&&x[b[A]]&&(x[b[A]].in+=1,x[b[A]].all+=1)}),x};t.getDegree=i;var o=function(m,b){var w={};return m.forEach(function(x){w[x.id]={in:0,out:0,all:0}}),b&&b.forEach(function(x){var E=(0,t.getEdgeTerminal)(x,"source"),_=(0,t.getEdgeTerminal)(x,"target");E&&(w[E].out+=1,w[E].all+=1),_&&(w[_].in+=1,w[_].all+=1)}),w};t.getDegreeMap=o;var s=function(m){for(var b=[],w=m.length,x=0;x<w;x+=1){b[x]=[];for(var E=0;E<w;E+=1)x===E?b[x][E]=0:m[x][E]===0||!m[x][E]?b[x][E]=1/0:b[x][E]=m[x][E]}for(var _=0;_<w;_+=1)for(var x=0;x<w;x+=1)for(var E=0;E<w;E+=1)b[x][E]>b[x][_]+b[_][E]&&(b[x][E]=b[x][_]+b[_][E]);return b};t.floydWarshall=s;var u=function(m,b){var w=m.nodes,x=m.edges,E=[],_={};if(!w)throw new Error("invalid nodes data!");return w&&w.forEach(function(S,A){_[S.id]=A;var M=[];E.push(M)}),x==null||x.forEach(function(S){var A=(0,t.getEdgeTerminal)(S,"source"),M=(0,t.getEdgeTerminal)(S,"target"),C=_[A],I=_[M];C===void 0||I===void 0||(E[C][I]=1,b||(E[I][C]=1))}),E};t.getAdjMatrix=u;var f=function(m,b){var w=[];return m.forEach(function(x){var E=[];x.forEach(function(_){E.push(_*b)}),w.push(E)}),w};t.scaleMatrix=f;var l=function(m,b){if(m&&m.children){for(var w=m.children.length-1;w>=0;w--)if(!l(m.children[w],b))return}return!!b(m)},c=function(m,b){typeof b=="function"&&l(m,b)};t.traverseTreeUp=c;var h=function(m){var b=1/0,w=1/0,x=-1/0,E=-1/0;return m.forEach(function(_){var S=_.size;(0,e.isArray)(S)?S.length===1&&(S=[S[0],S[0]]):(0,r.isNumber)(S)?S=[S,S]:(S===void 0||isNaN(S))&&(S=[30,30]);var A=[S[0]/2,S[1]/2],M=_.x-A[0],C=_.x+A[0],I=_.y-A[1],k=_.y+A[1];b>M&&(b=M),w>I&&(w=I),x<C&&(x=C),E<k&&(E=k)}),{minX:b,minY:w,maxX:x,maxY:E}};t.getLayoutBBox=h;var d=function(m){var b={x:0,y:0};m.forEach(function(x){b.x+=x.x||0,b.y+=x.y||0});var w=m.length||1;return{x:b.x/w,y:b.y/w}};t.getAvgNodePosition=d;var v=function(m,b,w){var x,E;return m==="source"?((x=w==null?void 0:w.find(function(_){return _.target===b.id}))===null||x===void 0?void 0:x.source)||{}:((E=w==null?void 0:w.find(function(_){return _.source===b.id}))===null||E===void 0?void 0:E.target)||{}},p=function(m,b,w){var x=[];switch(m){case"source":x=w==null?void 0:w.filter(function(_){return _.source===b.id}).map(function(_){return _.target});break;case"target":x=w==null?void 0:w.filter(function(_){return _.target===b.id}).map(function(_){return _.source});break;case"both":x=w==null?void 0:w.filter(function(_){return _.source===b.id}).map(function(_){return _.target}).concat(w==null?void 0:w.filter(function(_){return _.target===b.id}).map(function(_){return _.source}));break}var E=new Set(x);return Array.from(E)},g=function(m,b,w,x,E){var _=w[b]||"",S=(x==null?void 0:x.filter(function(A){return A[b]===_}))||[];return m==="leaf"&&(S=S.filter(function(A){var M,C;return((M=E[A.id])===null||M===void 0?void 0:M.in)===0||((C=E[A.id])===null||C===void 0?void 0:C.out)===0})),S},y=function(m,b,w,x,E,_){var S=E[b.id],A=S.in,M=S.out,C=b,I=[];A===0?(C=v("source",b,w),I=p("both",C,w).map(function(O){return _[O]})):M===0&&(C=v("target",b,w),I=p("both",C,w).map(function(O){return _[O]})),I=I.filter(function(O){return E[O.id]&&(E[O.id].in===0||E[O.id].out===0)});var k=g(m,x,b,I,E);return{coreNode:C,relativeLeafNodes:I,sameTypeLeafNodes:k}};t.getCoreNodeAndRelativeLeafNodes=y})(Gd);var Rp={},SE;function TX(){return SE||(SE=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getFuncByUnknownType=t.getFunc=t.isFunction=void 0;var e=Ir(),r=Bd,n=function(o){return typeof o=="function"};t.isFunction=n;var a=function(o,s,u){var f;return u?f=u:(0,r.isNumber)(o)?f=function(){return o}:f=function(){return s},f};t.getFunc=a;var i=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,t.isFunction)(s)?s:(0,r.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}};t.getFuncByUnknownType=i}(Rp)),Rp}var ME;function Ir(){return ME||(ME=1,function(t){var e=me&&me.__createBinding||(Object.create?function(n,a,i,o){o===void 0&&(o=i);var s=Object.getOwnPropertyDescriptor(a,i);(!s||("get"in s?!a.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(n,o,s)}:function(n,a,i,o){o===void 0&&(o=i),n[o]=a[i]}),r=me&&me.__exportStar||function(n,a){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&e(a,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(nu,t),r(ol,t),r(Bd,t),r(Gd,t),r(em,t),r(TX(),t)}(Pp)),Pp}var IX=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(gi,"__esModule",{value:!0});gi.getLayoutByName=gi.unRegisterLayout=gi.registerLayout=void 0;var kX=Rr,NX=Ir(),Ui=new Map,OX=function(t,e){if(Ui.get(t)&&console.warn("The layout with the name ".concat(t," exists already, it will be overridden")),(0,NX.isObject)(e)){var r=function(n){IX(a,n);function a(i){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,i),Object.keys(f).forEach(function(c){var h=f[c];u[c]=h}),o}return a}(kX.Base);Ui.set(t,r)}else Ui.set(t,e);return Ui.get(t)};gi.registerLayout=OX;var LX=function(t){Ui.has(t)&&Ui.delete(t)};gi.unRegisterLayout=LX;var DX=function(t){return Ui.has(t)?Ui.get(t):null};gi.getLayoutByName=DX;var Fp={},sl={},PX=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(sl,"__esModule",{value:!0});sl.GridLayout=void 0;var xs=Ir(),RX=Rr,FX=function(t){PX(e,t);function e(r){var n=t.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(r),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 r=this,n=r.nodes,a=r.edges,i=r.begin,o=n.length;if(o===0)return r.onLayoutEnd&&r.onLayoutEnd(),{nodes:n,edges:a};if(o===1)return n[0].x=i[0],n[0].y=i[1],r.onLayoutEnd&&r.onLayoutEnd(),{nodes:n,edges:a};var s=r.sortBy,u=r.width,f=r.height,l=r.condense,c=r.preventOverlapPadding,h=r.preventOverlap,d=r.nodeSpacing,v=r.nodeSize,p=[];n.forEach(function(I){p.push(I)});var g={};if(p.forEach(function(I,k){g[I.id]=k}),(s==="degree"||!(0,xs.isString)(s)||p[0][s]===void 0)&&(s="degree",(0,xs.isNaN)(n[0].degree))){var y=(0,xs.getDegree)(p.length,g,a);p.forEach(function(I,k){I.degree=y[k].all})}p.sort(function(I,k){return k[s]-I[s]}),!u&&typeof window<"u"&&(u=window.innerWidth),!f&&typeof window<"u"&&(f=window.innerHeight);var m=r.rows,b=r.cols!=null?r.cols:r.columns;if(r.cells=o,m!=null&&b!=null?(r.rows=m,r.cols=b):m!=null&&b==null?(r.rows=m,r.cols=Math.ceil(r.cells/r.rows)):m==null&&b!=null?(r.cols=b,r.rows=Math.ceil(r.cells/r.cols)):(r.splits=Math.sqrt(r.cells*r.height/r.width),r.rows=Math.round(r.splits),r.cols=Math.round(r.width/r.height*r.splits)),r.rows=Math.max(r.rows,1),r.cols=Math.max(r.cols,1),r.cols*r.rows>r.cells){var w=r.small(),x=r.large();(w-1)*x>=r.cells?r.small(w-1):(x-1)*w>=r.cells&&r.large(x-1)}else for(;r.cols*r.rows<r.cells;){var w=r.small(),x=r.large();(x+1)*w>=r.cells?r.large(x+1):r.small(w+1)}if(r.cellWidth=u/r.cols,r.cellHeight=f/r.rows,l&&(r.cellWidth=0,r.cellHeight=0),h||d){var E=(0,xs.getFuncByUnknownType)(10,d),_=(0,xs.getFuncByUnknownType)(30,v,!1);p.forEach(function(I){(!I.x||!I.y)&&(I.x=0,I.y=0);var k=_(I)||30,O,B;(0,xs.isArray)(k)?(O=k[0],B=k[1]):(O=k,B=k);var L=E!==void 0?E(I):c,z=O+L,X=B+L;r.cellWidth=Math.max(r.cellWidth,z),r.cellHeight=Math.max(r.cellHeight,X)})}r.cellUsed={},r.row=0,r.col=0,r.id2manPos={};for(var S=0;S<p.length;S++){var A=p[S],M=void 0;if(r.position&&(M=r.position(A)),M&&(M.row!==void 0||M.col!==void 0)){var C={row:M.row,col:M.col};if(C.col===void 0)for(C.col=0;r.used(C.row,C.col);)C.col++;else if(C.row===void 0)for(C.row=0;r.used(C.row,C.col);)C.row++;r.id2manPos[A.id]=C,r.use(C.row,C.col)}r.getPos(A)}return r.onLayoutEnd&&r.onLayoutEnd(),{edges:a,nodes:p}},e.prototype.small=function(r){var n=this,a,i=n.rows||5,o=n.cols||5;if(r==null)a=Math.min(i,o);else{var s=Math.min(i,o);s===n.rows?n.rows=r:n.cols=r}return a},e.prototype.large=function(r){var n=this,a,i=n.rows||5,o=n.cols||5;if(r==null)a=Math.max(i,o);else{var s=Math.max(i,o);s===n.rows?n.rows=r:n.cols=r}return a},e.prototype.used=function(r,n){var a=this;return a.cellUsed["c-".concat(r,"-").concat(n)]||!1},e.prototype.use=function(r,n){var a=this;a.cellUsed["c-".concat(r,"-").concat(n)]=!0},e.prototype.moveToNextCell=function(){var r=this,n=r.cols||5;r.col++,r.col>=n&&(r.col=0,r.row++)},e.prototype.getPos=function(r){var n=this,a=n.begin,i=n.cellWidth,o=n.cellHeight,s,u,f=n.id2manPos[r.id];if(f)s=f.col*i+i/2+a[0],u=f.row*o+o/2+a[1];else{for(;n.used(n.row,n.col);)n.moveToNextCell();s=n.col*i+i/2+a[0],u=n.row*o+o/2+a[1],n.use(n.row,n.col),n.moveToNextCell()}r.x=s,r.y=u},e.prototype.getType=function(){return"grid"},e}(RX.Base);sl.GridLayout=FX;var ul={},BX=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(ul,"__esModule",{value:!0});ul.RandomLayout=void 0;var GX=Rr,zX=function(t){BX(e,t);function e(r){var n=t.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(r),n}return e.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},e.prototype.execute=function(){var r=this,n=r.nodes,a=.9,i=r.center;return!r.width&&typeof window<"u"&&(r.width=window.innerWidth),!r.height&&typeof window<"u"&&(r.height=window.innerHeight),n&&n.forEach(function(o){o.x=(Math.random()-.5)*a*r.width+i[0],o.y=(Math.random()-.5)*a*r.height+i[1]}),r.onLayoutEnd&&r.onLayoutEnd(),{nodes:n,edges:this.edges}},e.prototype.getType=function(){return"random"},e}(GX.Base);ul.RandomLayout=zX;var fl={},jX=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(fl,"__esModule",{value:!0});fl.GForceLayout=void 0;var UX=Rr,yn=Ir(),Bp=function(t,e){var r;return t?(0,yn.isNumber)(t)?r=function(n){return t}:r=t:r=function(n){return e},r},$X=function(t){jX(e,t);function e(r){var n=t.call(this)||this;return n.maxIteration=500,n.workerEnabled=!1,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=1e3,n.minMovement=.5,n.interval=.02,n.factor=1,n.linkDistance=1,n.gravity=10,n.preventOverlap=!0,n.collideStrength=1,n.tick=function(){},n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.animate=!0,n.updateCfg(r),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var r,n,a=this,i=a.nodes;if(a.timeInterval!==void 0&&typeof window<"u"&&window.clearInterval(a.timeInterval),!i||i.length===0){(r=a.onLayoutEnd)===null||r===void 0||r.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 o=a.center;if(i.length===1){i[0].x=o[0],i[0].y=o[1],(n=a.onLayoutEnd)===null||n===void 0||n.call(a);return}var s={},u={};i.forEach(function(v,p){(0,yn.isNumber)(v.x)||(v.x=Math.random()*a.width),(0,yn.isNumber)(v.y)||(v.y=Math.random()*a.height),s[v.id]=v,u[v.id]=p}),a.nodeMap=s,a.nodeIdxMap=u,a.linkDistance=Bp(a.linkDistance,1),a.nodeStrength=Bp(a.nodeStrength,1),a.edgeStrength=Bp(a.edgeStrength,1);var f=a.nodeSize,l;if(a.preventOverlap){var c=a.nodeSpacing,h;(0,yn.isNumber)(c)?h=function(){return c}:(0,yn.isFunction)(c)?h=c:h=function(){return 0},f?(0,yn.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,yn.isArray)(v.size)?Math.max(v.size[0],v.size[1])+h(v):(0,yn.isObject)(v.size)?Math.max(v.size.width,v.size.height)+h(v):v.size+h(v):10+h(v)}}a.nodeSize=l;var d=a.edges;a.degrees=(0,yn.getDegree)(i.length,a.nodeIdxMap,d),a.getMass||(a.getMass=function(v){var p=v.mass||a.degrees[a.nodeIdxMap[v.id]].all||1;return p}),a.run()},e.prototype.run=function(){var r,n=this,a=n.maxIteration,i=n.nodes,o=n.workerEnabled,s=n.minMovement,u=n.animate;if(i)if(o||!u){for(var f=0;f<a;f++){var l=n.runOneStep(f);if(n.reachMoveThreshold(i,l,s))break}(r=n.onLayoutEnd)===null||r===void 0||r.call(n)}else{if(typeof window>"u")return;var c=0;this.timeInterval=window.setInterval(function(){var h,d;if(i){var v=n.runOneStep(c)||[];n.reachMoveThreshold(i,v,s)&&((h=n.onLayoutEnd)===null||h===void 0||h.call(n),window.clearInterval(n.timeInterval)),c++,c>=a&&((d=n.onLayoutEnd)===null||d===void 0||d.call(n),window.clearInterval(n.timeInterval))}},0)}},e.prototype.reachMoveThreshold=function(r,n,a){var i=0;return r.forEach(function(o,s){var u=o.x-n[s].x,f=o.y-n[s].y;i+=Math.sqrt(u*u+f*f)}),i/=r.length,i<a},e.prototype.runOneStep=function(r){var n,a=this,i=a.nodes,o=a.edges,s=[],u=[];if(i){i.forEach(function(c,h){s[2*h]=0,s[2*h+1]=0,u[2*h]=0,u[2*h+1]=0}),a.calRepulsive(s,i),o&&a.calAttractive(s,o),a.calGravity(s,i);var f=Math.max(.02,a.interval-r*.002);a.updateVelocity(s,u,f,i);var l=[];return i.forEach(function(c){l.push({x:c.x,y:c.y})}),a.updatePosition(u,f,i),(n=a.tick)===null||n===void 0||n.call(a),l}},e.prototype.calRepulsive=function(r,n){var a=this,i=a.getMass,o=a.factor,s=a.coulombDisScale,u=a.preventOverlap,f=a.collideStrength,l=f===void 0?1:f,c=a.nodeStrength,h=a.nodeSize;n.forEach(function(d,v){var p=i?i(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 w=m*m+b*b,x=Math.sqrt(w),E=(x+.1)*s,_=m/x,S=b/x,A=(c(d)+c(g))*.5*o/(E*E),M=i?i(g):1;if(r[2*v]+=_*A,r[2*v+1]+=S*A,r[2*y]-=_*A,r[2*y+1]-=S*A,u&&(h(d)+h(g))/2>x){var C=l*(c(d)+c(g))*.5/w;r[2*v]+=_*C/p,r[2*v+1]+=S*C/p,r[2*y]-=_*C/M,r[2*y+1]-=S*C/M}}})})},e.prototype.calAttractive=function(r,n){var a=this,i=a.nodeMap,o=a.nodeIdxMap,s=a.linkDistance,u=a.edgeStrength,f=a.nodeSize,l=a.getMass;n.forEach(function(c,h){var d=(0,yn.getEdgeTerminal)(c,"source"),v=(0,yn.getEdgeTerminal)(c,"target"),p=i[d],g=i[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),w=y/b,x=m/b,E=s(c,p,g)||1+(f(p)+f(g)||0)/2,_=E-b,S=_*u(c),A=o[d],M=o[v],C=l?l(p):1,I=l?l(g):1;r[2*A]-=w*S/C,r[2*A+1]-=x*S/C,r[2*M]+=w*S/I,r[2*M+1]+=x*S/I})},e.prototype.calGravity=function(r,n){for(var a=this,i=a.center,o=a.gravity,s=a.degrees,u=n.length,f=0;f<u;f++){var l=n[f],c=l.x-i[0],h=l.y-i[1],d=o;if(a.getCenter){var v=a.getCenter(l,s[f].all);v&&(0,yn.isNumber)(v[0])&&(0,yn.isNumber)(v[1])&&(0,yn.isNumber)(v[2])&&(c=l.x-v[0],h=l.y-v[1],d=v[2])}d&&(r[2*f]-=d*c,r[2*f+1]-=d*h)}},e.prototype.updateVelocity=function(r,n,a,i){var o=this,s=a*o.damping;i.forEach(function(u,f){var l=r[2*f]*s||.01,c=r[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(r,n,a){a.forEach(function(i,o){if((0,yn.isNumber)(i.fx)&&(0,yn.isNumber)(i.fy)){i.x=i.fx,i.y=i.fy;return}var s=r[2*o]*n,u=r[2*o+1]*n;i.x+=s,i.y+=u})},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var r=this;r.stop(),r.tick=null,r.nodes=null,r.edges=null,r.destroyed=!0},e.prototype.getType=function(){return"gForce"},e}(UX.Base);fl.GForceLayout=$X;var ll={},zd={};function XX(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return rI(this.cover(e,r),e,r,t)}function rI(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var a,i=t._root,o={data:n},s=t._x0,u=t._y0,f=t._x1,l=t._y1,c,h,d,v,p,g,y,m;if(!i)return t._root=o,t;for(;i.length;)if((p=e>=(c=(s+f)/2))?s=c:f=c,(g=r>=(h=(u+l)/2))?u=h:l=h,a=i,!(i=i[y=g<<1|p]))return a[y]=o,t;if(d=+t._x.call(null,i.data),v=+t._y.call(null,i.data),e===d&&r===v)return o.next=i,a?a[y]=o:t._root=o,t;do a=a?a[y]=new Array(4):t._root=new Array(4),(p=e>=(c=(s+f)/2))?s=c:f=c,(g=r>=(h=(u+l)/2))?u=h:l=h;while((y=g<<1|p)===(m=(v>=h)<<1|d>=c));return a[m]=i,a[y]=o,t}function WX(t){var e,r,n=t.length,a,i,o=new Array(n),s=new Array(n),u=1/0,f=1/0,l=-1/0,c=-1/0;for(r=0;r<n;++r)isNaN(a=+this._x.call(null,e=t[r]))||isNaN(i=+this._y.call(null,e))||(o[r]=a,s[r]=i,a<u&&(u=a),a>l&&(l=a),i<f&&(f=i),i>c&&(c=i));if(u>l||f>c)return this;for(this.cover(u,f).cover(l,c),r=0;r<n;++r)rI(this,o[r],s[r],t[r]);return this}function VX(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,a=this._x1,i=this._y1;if(isNaN(r))a=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var o=a-r||1,s=this._root,u,f;r>t||t>=a||n>e||e>=i;)switch(f=(e<n)<<1|t<r,u=new Array(4),u[f]=s,s=u,o*=2,f){case 0:a=r+o,i=n+o;break;case 1:r=a-o,i=n+o;break;case 2:a=r+o,n=i-o;break;case 3:r=a-o,n=i-o;break}this._root&&this._root.length&&(this._root=s)}return this._x0=r,this._y0=n,this._x1=a,this._y1=i,this}function YX(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function qX(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Sn(t,e,r,n,a){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=a}function HX(t,e,r){var n,a=this._x0,i=this._y0,o,s,u,f,l=this._x1,c=this._y1,h=[],d=this._root,v,p;for(d&&h.push(new Sn(d,a,i,l,c)),r==null?r=1/0:(a=t-r,i=e-r,l=t+r,c=e+r,r*=r);v=h.pop();)if(!(!(d=v.node)||(o=v.x0)>l||(s=v.y0)>c||(u=v.x1)<a||(f=v.y1)<i))if(d.length){var g=(o+u)/2,y=(s+f)/2;h.push(new Sn(d[3],g,y,u,f),new Sn(d[2],o,y,g,f),new Sn(d[1],g,s,u,y),new Sn(d[0],o,s,g,y)),(p=(e>=y)<<1|t>=g)&&(v=h[h.length-1],h[h.length-1]=h[h.length-1-p],h[h.length-1-p]=v)}else{var m=t-+this._x.call(null,d.data),b=e-+this._y.call(null,d.data),w=m*m+b*b;if(w<r){var x=Math.sqrt(r=w);a=t-x,i=e-x,l=t+x,c=e+x,n=d.data}}return n}function ZX(t){if(isNaN(l=+this._x.call(null,t))||isNaN(c=+this._y.call(null,t)))return this;var e,r=this._root,n,a,i,o=this._x0,s=this._y0,u=this._x1,f=this._y1,l,c,h,d,v,p,g,y;if(!r)return this;if(r.length)for(;;){if((v=l>=(h=(o+u)/2))?o=h:u=h,(p=c>=(d=(s+f)/2))?s=d:f=d,e=r,!(r=r[g=p<<1|v]))return this;if(!r.length)break;(e[g+1&3]||e[g+2&3]||e[g+3&3])&&(n=e,y=g)}for(;r.data!==t;)if(a=r,!(r=r.next))return this;return(i=r.next)&&delete r.next,a?(i?a.next=i:delete a.next,this):e?(i?e[g]=i:delete e[g],(r=e[0]||e[1]||e[2]||e[3])&&r===(e[3]||e[2]||e[1]||e[0])&&!r.length&&(n?n[y]=r:this._root=r),this):(this._root=i,this)}function KX(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this}function QX(){return this._root}function JX(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function eW(t){var e=[],r,n=this._root,a,i,o,s,u;for(n&&e.push(new Sn(n,this._x0,this._y0,this._x1,this._y1));r=e.pop();)if(!t(n=r.node,i=r.x0,o=r.y0,s=r.x1,u=r.y1)&&n.length){var f=(i+s)/2,l=(o+u)/2;(a=n[3])&&e.push(new Sn(a,f,l,s,u)),(a=n[2])&&e.push(new Sn(a,i,l,f,u)),(a=n[1])&&e.push(new Sn(a,f,o,s,l)),(a=n[0])&&e.push(new Sn(a,i,o,f,l))}return this}function tW(t){var e=[],r=[],n;for(this._root&&e.push(new Sn(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var a=n.node;if(a.length){var i,o=n.x0,s=n.y0,u=n.x1,f=n.y1,l=(o+u)/2,c=(s+f)/2;(i=a[0])&&e.push(new Sn(i,o,s,l,c)),(i=a[1])&&e.push(new Sn(i,l,s,u,c)),(i=a[2])&&e.push(new Sn(i,o,c,l,f)),(i=a[3])&&e.push(new Sn(i,l,c,u,f))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this}function rW(t){return t[0]}function nW(t){return arguments.length?(this._x=t,this):this._x}function aW(t){return t[1]}function iW(t){return arguments.length?(this._y=t,this):this._y}function jd(t,e,r){var n=new tm(e??rW,r??aW,NaN,NaN,NaN,NaN);return t==null?n:n.addAll(t)}function tm(t,e,r,n,a,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=a,this._y1=i,this._root=void 0}function AE(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var An=jd.prototype=tm.prototype;An.copy=function(){var t=new tm(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,r,n;if(!e)return t;if(!e.length)return t._root=AE(e),t;for(r=[{source:e,target:t._root=new Array(4)}];e=r.pop();)for(var a=0;a<4;++a)(n=e.source[a])&&(n.length?r.push({source:n,target:e.target[a]=new Array(4)}):e.target[a]=AE(n));return t};An.add=XX;An.addAll=WX;An.cover=VX;An.data=YX;An.extent=qX;An.find=HX;An.remove=ZX;An.removeAll=KX;An.root=QX;An.size=JX;An.visit=eW;An.visitAfter=tW;An.x=nW;An.y=iW;const oW=Object.freeze(Object.defineProperty({__proto__:null,quadtree:jd},Symbol.toStringTag,{value:"Module"})),sW=Ka(oW);Object.defineProperty(zd,"__esModule",{value:!0});zd.forceNBody=void 0;var uW=sW,fW=.81,CE=.1;function lW(t,e,r,n,a){var i=r/n,o=t.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:i*p}}),s=(0,uW.quadtree)(o,function(u){return u.x},function(u){return u.y}).visitAfter(cW);return o.forEach(function(u){dW(u,s)}),o.map(function(u,f){var l=e[t[f].id],c=l.data.layout.force.mass,h=c===void 0?1:c;a[2*f]=u.vx/h,a[2*f+1]=u.vy/h}),a}zd.forceNBody=lW;function cW(t){var e=0,r=0,n=0;if(t.length){for(var a=0;a<4;a++){var i=t[a];i&&i.weight&&(e+=i.weight,r+=i.x*i.weight,n+=i.y*i.weight)}t.x=r/e,t.y=n/e,t.weight=e}else{var i=t;t.x=i.data.x,t.y=i.data.y,t.weight=i.data.weight}}var hW=function(t,e,r,n,a,i){var o=i.x-t.x||CE,s=i.y-t.y||CE,u=n-e,f=o*o+s*s,l=Math.sqrt(f)*f;if(u*u*fW<f){var c=t.weight/l;return i.vx+=o*c,i.vy+=s*c,!0}if(t.length)return!1;if(t.data!==i){var c=t.data.weight/l;i.vx+=o*c,i.vy+=s*c}};function dW(t,e){e.visit(function(r,n,a,i,o){return hW(r,n,a,i,o,t)})}var vW=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),da=me&&me.__assign||function(){return da=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},da.apply(this,arguments)};Object.defineProperty(ll,"__esModule",{value:!0});ll.Force2Layout=void 0;var pW=Rr,Hr=Ir(),gW=zd,Gp=function(t,e){var r;return t?(0,Hr.isNumber)(t)?r=function(n){return t}:r=t:r=function(n){return e},r},yW=function(t){vW(e,t);function e(r){var n=t.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(i){return{x:n.width/2,y:n.height/2}}};var a=r.getMass;return n.propsGetMass=a,n.updateCfg(r),n}return e.prototype.getCentripetalOptions=function(){var r=this,n=r.leafCluster,a=r.clustering,i=r.nodeClusterBy,o=r.nodes,s=r.nodeMap,u=r.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[i]})))||[];l={single:100,leaf:function(b,w,x){var E=c[b.id]||{},_=E.relativeLeafNodes,S=E.sameTypeLeafNodes;return(S==null?void 0:S.length)===(_==null?void 0:_.length)||(h==null?void 0:h.length)===1?1:f(b)},others:1,center:function(b,w,x){var E,_=(((E=b.data)===null||E===void 0?void 0:E.layout)||{}).degree;if(!_)return{x:100,y:100};var S;if(_===1){var A=(c[b.id]||{}).sameTypeLeafNodes,M=A===void 0?[]:A;M.length===1?S=void 0:M.length>1&&(S=(0,Hr.getAvgNodePosition)(M))}else S=void 0;return{x:S==null?void 0:S.x,y:S==null?void 0:S.y}}}}if(a){c||(c=this.getSameTypeLeafMap());var d=Array.from(new Set(o.map(function(b,w){return b[i]}))).filter(function(b){return b!==void 0}),v={};d.forEach(function(b){var w=o.filter(function(x){return x[i]===b}).map(function(x){return s[x.id]});v[b]=(0,Hr.getAvgNodePosition)(w)}),l={single:function(b){return f(b)},leaf:function(b){return f(b)},others:function(b){return f(b)},center:function(b,w,x){var E=v[b[i]];return{x:E==null?void 0:E.x,y:E==null?void 0:E.y}}}}this.centripetalOptions=da(da({},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(r){r&&Object.assign(this,r)},e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var r=this;r.stop();var n=r.nodes,a=r.edges,i=r.defSpringLen;if(r.judgingDistance=0,!n||n.length===0){r.onLayoutEnd([]);return}!r.width&&typeof window<"u"&&(r.width=window.innerWidth),!r.height&&typeof window<"u"&&(r.height=window.innerHeight),r.center||(r.center=[r.width/2,r.height/2]);var o=r.center;if(n.length===1){n[0].x=o[0],n[0].y=o[1],r.onLayoutEnd([da({},n[0])]);return}r.degreesMap=(0,Hr.getDegreeMap)(n,a),r.propsGetMass?r.getMass=r.propsGetMass:r.getMass=function(d){var v=1;(0,Hr.isNumber)(d.mass)&&(v=d.mass);var p=r.degreesMap[d.id].all;return!p||p<5?v:p*5*v};var s=r.nodeSize,u;if(r.preventOverlap){var f=r.nodeSpacing,l;(0,Hr.isNumber)(f)?l=function(){return f}:(0,Hr.isFunction)(f)?l=f:l=function(){return 0},s?(0,Hr.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,Hr.isArray)(d.size)?Math.max(d.size[0],d.size[1])+l(d):(0,Hr.isObject)(d.size)?Math.max(d.size.width,d.size.height)+l(d):d.size+l(d):10+l(d)}}r.nodeSize=u,r.linkDistance=Gp(r.linkDistance,1),r.nodeStrength=Gp(r.nodeStrength,1),r.edgeStrength=Gp(r.edgeStrength,1);var c={},h={};n.forEach(function(d,v){(0,Hr.isNumber)(d.x)||(d.x=Math.random()*r.width),(0,Hr.isNumber)(d.y)||(d.y=Math.random()*r.height);var p=r.degreesMap[d.id];c[d.id]=da(da({},d),{data:da(da({},d.data),{size:r.nodeSize(d)||30,layout:{inDegree:p.in,outDegree:p.out,degree:p.all,tDegree:p.in,sDegree:p.out,force:{mass:r.getMass(d),nodeStrength:r.nodeStrength(d,a)}}})}),h[d.id]=v}),r.nodeMap=c,r.nodeIdxMap=h,r.edgeInfos=[],a==null||a.forEach(function(d){var v=c[d.source],p=c[d.target];!v||!p?elf.edgeInfos.push({}):r.edgeInfos.push({edgeStrength:r.edgeStrength(d),linkDistance:i?i(da(da({},d),{source:v,target:p}),v,p):r.linkDistance(d,v,p)||1+(s(v)+s(v)||0)/2})}),this.getCentripetalOptions(),r.onLayoutEnd=r.onLayoutEnd||function(){},r.run()},e.prototype.run=function(){var r=this,n=r.maxIteration,a=r.nodes,i=r.edges,o=r.workerEnabled,s=r.minMovement,u=r.animate,f=r.nodeMap,l=r.height;if(r.currentMinY=0,r.currentMaxY=l,!!a){var c=[];if(a.forEach(function(y,m){c[2*m]=0,c[2*m+1]=0}),this.defSideCoe&&typeof this.defSideCoe=="function"){var h={};i.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;(r.judgingDistance>s||p<1)&&p<d;p++)r.runOneStep(p,c);r.onLayoutEnd(Object.values(f))}else{if(typeof window>"u")return;var g=0;this.timeInterval=window.setInterval(function(){a&&(r.runOneStep(g,c),g++,(g>=d||r.judgingDistance<s)&&(r.onLayoutEnd(Object.values(f)),window.clearInterval(r.timeInterval)))},0)}}},e.prototype.runOneStep=function(r,n){var a,i=this,o=i.nodes,s=i.edges;i.nodeMap;var u=i.monitor,f=[];if(o!=null&&o.length){i.calRepulsive(f),s&&i.calAttractive(f),i.calGravity(f),i.attractToSide(f);var l=i.interval;if(i.updateVelocity(f,n,l),i.updatePosition(n,l),(a=i.tick)===null||a===void 0||a.call(i),u){var c=this.calTotalEnergy(f);u({energy:c,nodes:o,edges:s,iterations:r})}}},e.prototype.calTotalEnergy=function(r){var n=this,a=n.nodes,i=n.nodeMap;if(!(a!=null&&a.length))return 0;var o=0;return a.forEach(function(s,u){var f=r[2*u],l=r[2*u+1],c=f*f+l*l,h=i[s.id].data.layout.force.mass,d=h===void 0?1:h;o+=d*c*.5}),o},e.prototype.calRepulsive=function(r){var n=this,a=n.nodes,i=n.nodeMap,o=n.factor,s=n.coulombDisScale;n.nodeSize,(0,gW.forceNBody)(a,i,o,s*s,r)},e.prototype.calAttractive=function(r){var n=this,a=n.edges,i=n.nodeMap,o=n.nodeIdxMap,s=n.edgeInfos;n.nodeSize,a.forEach(function(u,f){var l=(0,Hr.getEdgeTerminal)(u,"source"),c=(0,Hr.getEdgeTerminal)(u,"target"),h=i[l],d=i[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]||{},w=b.linkDistance,x=w===void 0?200:w,E=b.edgeStrength,_=E===void 0?200:E,S=x-g,A=S*_,M=h.data.layout.force.mass||1,C=d.data.layout.force.mass||1,I=1/M,k=1/C,O=y*A,B=m*A,L=2*o[l],z=2*o[c];r[L]-=O*I,r[L+1]-=B*I,r[z]+=O*k,r[z+1]+=B*k}})},e.prototype.calGravity=function(r){var n,a=this,i=a.nodes,o=a.edges,s=o===void 0?[]:o,u=a.nodeMap,f=a.width,l=a.height,c=a.center,h=a.gravity,d=a.degreesMap,v=a.centripetalOptions;if(i)for(var p=i.length,g=0;g<p;g++){var y=2*g,m=u[i[g].id],b=m.data.layout.force.mass,w=b===void 0?1:b,x=0,E=0,_=h,S=d[m.id],A=S.in,M=S.out,C=S.all,I=(n=a.getCenter)===null||n===void 0?void 0:n.call(a,m,C);if(I){var k=I[0],O=I[1],B=I[2];x=m.x-k,E=m.y-O,_=B}else x=m.x-c[0],E=m.y-c[1];if(_&&(r[y]-=_*x/w,r[y+1]-=_*E/w),v){var L=v.leaf,z=v.single,X=v.others,R=v.center,V=(R==null?void 0:R(m,i,s,f,l))||{x:0,y:0,centerStrength:0},he=V.x,ce=V.y,le=V.centerStrength;if(!(0,Hr.isNumber)(he)||!(0,Hr.isNumber)(ce))continue;var ie=(m.x-he)/w,Ie=(m.y-ce)/w;if(le&&(r[y]-=le*ie,r[y+1]-=le*Ie),C===0){var qe=z(m);if(!qe)continue;r[y]-=qe*ie,r[y+1]-=qe*Ie;continue}if(A===0||M===0){var Ve=L(m,i,s);if(!Ve)continue;r[y]-=Ve*ie,r[y+1]-=Ve*Ie;continue}var it=X(m);if(!it)continue;r[y]-=it*ie,r[y+1]-=it*Ie}}},e.prototype.attractToSide=function(r){var n=this,a=n.defSideCoe;n.height;var i=n.nodes,o=n.relatedEdges,s=n.currentMinY,u=s===void 0?0:s,f=n.currentMaxY,l=f===void 0?this.height:f;!a||typeof a!="function"||!(i!=null&&i.length)||i.forEach(function(c,h){var d=a(c,o[c.id]||[]);if(d!==0){var v=d<0?u:l,p=Math.abs(d);r[2*h+1]-=p*(c.y-v)}})},e.prototype.updateVelocity=function(r,n,a){var i=this,o=i.nodes,s=i.damping,u=i.maxSpeed;o!=null&&o.length&&o.forEach(function(f,l){var c=(n[2*l]+r[2*l]*a)*s||.01,h=(n[2*l+1]+r[2*l+1]*a)*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(r,n){var a=this,i=a.nodes,o=a.distanceThresholdMode,s=a.nodeMap;if(!(i!=null&&i.length)){this.judgingDistance=0;return}var u=0;o==="max"?a.judgingDistance=-1/0:o==="min"&&(a.judgingDistance=1/0);var f=1/0,l=-1/0;i.forEach(function(c,h){var d=s[c.id];if((0,Hr.isNumber)(c.fx)&&(0,Hr.isNumber)(c.fy)){c.x=c.fx,c.y=c.fy,d.x=c.x,d.y=c.y;return}var v=r[2*h]*n,p=r[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":a.judgingDistance<g&&(a.judgingDistance=g);break;case"min":a.judgingDistance>g&&(a.judgingDistance=g);break;default:u=u+g;break}}),this.currentMinY=f,this.currentMaxY=l,(!o||o==="mean")&&(a.judgingDistance=u/i.length)},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var r=this;r.stop(),r.tick=null,r.nodes=null,r.edges=null,r.destroyed=!0},e.prototype.getType=function(){return"force2"},e.prototype.getSameTypeLeafMap=function(){var r=this,n=r.nodeClusterBy,a=r.nodes,i=r.edges,o=r.nodeMap,s=r.degreesMap;if(a!=null&&a.length){var u={};return a.forEach(function(f,l){var c=s[f.id].all;c===1&&(u[f.id]=(0,Hr.getCoreNodeAndRelativeLeafNodes)("leaf",f,i,n,s,o))}),u}},e}(pW.Base);ll.Force2Layout=yW;var rm={},Ud={};function mW(t,e){var r,n=1;t==null&&(t=0),e==null&&(e=0);function a(){var i,o=r.length,s,u=0,f=0;for(i=0;i<o;++i)s=r[i],u+=s.x,f+=s.y;for(u=(u/o-t)*n,f=(f/o-e)*n,i=0;i<o;++i)s=r[i],s.x-=u,s.y-=f}return a.initialize=function(i){r=i},a.x=function(i){return arguments.length?(t=+i,a):t},a.y=function(i){return arguments.length?(e=+i,a):e},a.strength=function(i){return arguments.length?(n=+i,a):n},a}function Qr(t){return function(){return t}}function $i(t){return(t()-.5)*1e-6}function bW(t){return t.x+t.vx}function wW(t){return t.y+t.vy}function xW(t){var e,r,n,a=1,i=1;typeof t!="function"&&(t=Qr(t==null?1:+t));function o(){for(var f,l=e.length,c,h,d,v,p,g,y=0;y<i;++y)for(c=jd(e,bW,wW).visitAfter(s),f=0;f<l;++f)h=e[f],p=r[h.index],g=p*p,d=h.x+h.vx,v=h.y+h.vy,c.visit(m);function m(b,w,x,E,_){var S=b.data,A=b.r,M=p+A;if(S){if(S.index>h.index){var C=d-S.x-S.vx,I=v-S.y-S.vy,k=C*C+I*I;k<M*M&&(C===0&&(C=$i(n),k+=C*C),I===0&&(I=$i(n),k+=I*I),k=(M-(k=Math.sqrt(k)))/k*a,h.vx+=(C*=k)*(M=(A*=A)/(g+A)),h.vy+=(I*=k)*M,S.vx-=C*(M=1-M),S.vy-=I*M)}return}return w>d+M||E<d-M||x>v+M||_<v-M}}function s(f){if(f.data)return f.r=r[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(r=new Array(l),f=0;f<l;++f)c=e[f],r[c.index]=+t(c,f,e)}}return o.initialize=function(f,l){e=f,n=l,u()},o.iterations=function(f){return arguments.length?(i=+f,o):i},o.strength=function(f){return arguments.length?(a=+f,o):a},o.radius=function(f){return arguments.length?(t=typeof f=="function"?f:Qr(+f),u(),o):t},o}function EW(t){return t.index}function TE(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function _W(t){var e=EW,r=c,n,a=Qr(30),i,o,s,u,f,l=1;t==null&&(t=[]);function c(g){return 1/Math.min(s[g.source.index],s[g.target.index])}function h(g){for(var y=0,m=t.length;y<l;++y)for(var b=0,w,x,E,_,S,A,M;b<m;++b)w=t[b],x=w.source,E=w.target,_=E.x+E.vx-x.x-x.vx||$i(f),S=E.y+E.vy-x.y-x.vy||$i(f),A=Math.sqrt(_*_+S*S),A=(A-i[b])/A*g*n[b],_*=A,S*=A,E.vx-=_*(M=u[b]),E.vy-=S*M,x.vx+=_*(M=1-M),x.vy+=S*M}function d(){if(o){var g,y=o.length,m=t.length,b=new Map(o.map((x,E)=>[e(x,E,o),x])),w;for(g=0,s=new Array(y);g<m;++g)w=t[g],w.index=g,typeof w.source!="object"&&(w.source=TE(b,w.source)),typeof w.target!="object"&&(w.target=TE(b,w.target)),s[w.source.index]=(s[w.source.index]||0)+1,s[w.target.index]=(s[w.target.index]||0)+1;for(g=0,u=new Array(m);g<m;++g)w=t[g],u[g]=s[w.source.index]/(s[w.source.index]+s[w.target.index]);n=new Array(m),v(),i=new Array(m),p()}}function v(){if(o)for(var g=0,y=t.length;g<y;++g)n[g]=+r(t[g],g,t)}function p(){if(o)for(var g=0,y=t.length;g<y;++g)i[g]=+a(t[g],g,t)}return h.initialize=function(g,y){o=g,f=y,d()},h.links=function(g){return arguments.length?(t=g,d(),h):t},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?(r=typeof g=="function"?g:Qr(+g),v(),h):r},h.distance=function(g){return arguments.length?(a=typeof g=="function"?g:Qr(+g),p(),h):a},h}var SW={value:()=>{}};function nI(){for(var t=0,e=arguments.length,r={},n;t<e;++t){if(!(n=arguments[t]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new ch(r)}function ch(t){this._=t}function MW(t,e){return t.trim().split(/^|\s+/).map(function(r){var n="",a=r.indexOf(".");if(a>=0&&(n=r.slice(a+1),r=r.slice(0,a)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}ch.prototype=nI.prototype={constructor:ch,on:function(t,e){var r=this._,n=MW(t+"",r),a,i=-1,o=n.length;if(arguments.length<2){for(;++i<o;)if((a=(t=n[i]).type)&&(a=AW(r[a],t.name)))return a;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<o;)if(a=(t=n[i]).type)r[a]=IE(r[a],t.name,e);else if(e==null)for(a in r)r[a]=IE(r[a],t.name,null);return this},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new ch(t)},call:function(t,e){if((a=arguments.length-2)>0)for(var r=new Array(a),n=0,a,i;n<a;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],n=0,a=i.length;n<a;++n)i[n].value.apply(e,r)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],a=0,i=n.length;a<i;++a)n[a].value.apply(e,r)}};function AW(t,e){for(var r=0,n=t.length,a;r<n;++r)if((a=t[r]).name===e)return a.value}function IE(t,e,r){for(var n=0,a=t.length;n<a;++n)if(t[n].name===e){t[n]=SW,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var au=0,pf=0,Zu=0,aI=1e3,Yh,gf,qh=0,Wo=0,$d=0,Xf=typeof performance=="object"&&performance.now?performance:Date,iI=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function oI(){return Wo||(iI(CW),Wo=Xf.now()+$d)}function CW(){Wo=0}function gg(){this._call=this._time=this._next=null}gg.prototype=sI.prototype={constructor:gg,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?oI():+r)+(e==null?0:+e),!this._next&&gf!==this&&(gf?gf._next=this:Yh=this,gf=this),this._call=t,this._time=r,yg()},stop:function(){this._call&&(this._call=null,this._time=1/0,yg())}};function sI(t,e,r){var n=new gg;return n.restart(t,e,r),n}function TW(){oI(),++au;for(var t=Yh,e;t;)(e=Wo-t._time)>=0&&t._call.call(null,e),t=t._next;--au}function kE(){Wo=(qh=Xf.now())+$d,au=pf=0;try{TW()}finally{au=0,kW(),Wo=0}}function IW(){var t=Xf.now(),e=t-qh;e>aI&&($d-=e,qh=t)}function kW(){for(var t,e=Yh,r,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:Yh=r);gf=t,yg(n)}function yg(t){if(!au){pf&&(pf=clearTimeout(pf));var e=t-Wo;e>24?(t<1/0&&(pf=setTimeout(kE,t-Xf.now()-$d)),Zu&&(Zu=clearInterval(Zu))):(Zu||(qh=Xf.now(),Zu=setInterval(IW,aI)),au=1,iI(kE))}}const NW=1664525,OW=1013904223,NE=4294967296;function LW(){let t=1;return()=>(t=(NW*t+OW)%NE)/NE}function DW(t){return t.x}function PW(t){return t.y}var RW=10,FW=Math.PI*(3-Math.sqrt(5));function BW(t){var e,r=1,n=.001,a=1-Math.pow(n,1/300),i=0,o=.6,s=new Map,u=sI(c),f=nI("tick","end"),l=LW();t==null&&(t=[]);function c(){h(),f.call("tick",e),r<n&&(u.stop(),f.call("end",e))}function h(p){var g,y=t.length,m;p===void 0&&(p=1);for(var b=0;b<p;++b)for(r+=(i-r)*a,s.forEach(function(w){w(r)}),g=0;g<y;++g)m=t[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=t.length,y;p<g;++p){if(y=t[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=RW*Math.sqrt(.5+p),b=p*FW;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(t,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?(t=p,d(),s.forEach(v),e):t},alpha:function(p){return arguments.length?(r=+p,e):r},alphaMin:function(p){return arguments.length?(n=+p,e):n},alphaDecay:function(p){return arguments.length?(a=+p,e):+a},alphaTarget:function(p){return arguments.length?(i=+p,e):i},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=t.length,w,x,E,_,S;for(y==null?y=1/0:y*=y,m=0;m<b;++m)_=t[m],w=p-_.x,x=g-_.y,E=w*w+x*x,E<y&&(S=_,y=E);return S},on:function(p,g){return arguments.length>1?(f.on(p,g),e):f.on(p)}}}function GW(){var t,e,r,n,a=Qr(-30),i,o=1,s=1/0,u=.81;function f(d){var v,p=t.length,g=jd(t,DW,PW).visitAfter(c);for(n=d,v=0;v<p;++v)e=t[v],g.visit(h)}function l(){if(t){var d,v=t.length,p;for(i=new Array(v),d=0;d<v;++d)p=t[d],i[p.index]=+a(p,d,t)}}function c(d){var v=0,p,g,y=0,m,b,w;if(d.length){for(m=b=w=0;w<4;++w)(p=d[w])&&(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+=i[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,w=y*y+m*m;if(b*b/u<w)return w<s&&(y===0&&(y=$i(r),w+=y*y),m===0&&(m=$i(r),w+=m*m),w<o&&(w=Math.sqrt(o*w)),e.vx+=y*d.value*n/w,e.vy+=m*d.value*n/w),!0;if(d.length||w>=s)return;(d.data!==e||d.next)&&(y===0&&(y=$i(r),w+=y*y),m===0&&(m=$i(r),w+=m*m),w<o&&(w=Math.sqrt(o*w)));do d.data!==e&&(b=i[d.data.index]*n/w,e.vx+=y*b,e.vy+=m*b);while(d=d.next)}return f.initialize=function(d,v){t=d,r=v,l()},f.strength=function(d){return arguments.length?(a=typeof d=="function"?d:Qr(+d),l(),f):a},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 zW(t,e,r){var n,a=Qr(.1),i,o;typeof t!="function"&&(t=Qr(+t)),e==null&&(e=0),r==null&&(r=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-r||1e-6,p=Math.sqrt(d*d+v*v),g=(o[l]-p)*i[l]*f/p;h.vx+=d*g,h.vy+=v*g}}function u(){if(n){var f,l=n.length;for(i=new Array(l),o=new Array(l),f=0;f<l;++f)o[f]=+t(n[f],f,n),i[f]=isNaN(o[f])?0:+a(n[f],f,n)}}return s.initialize=function(f){n=f,u()},s.strength=function(f){return arguments.length?(a=typeof f=="function"?f:Qr(+f),u(),s):a},s.radius=function(f){return arguments.length?(t=typeof f=="function"?f:Qr(+f),u(),s):t},s.x=function(f){return arguments.length?(e=+f,s):e},s.y=function(f){return arguments.length?(r=+f,s):r},s}function jW(t){var e=Qr(.1),r,n,a;typeof t!="function"&&(t=Qr(t==null?0:+t));function i(s){for(var u=0,f=r.length,l;u<f;++u)l=r[u],l.vx+=(a[u]-l.x)*n[u]*s}function o(){if(r){var s,u=r.length;for(n=new Array(u),a=new Array(u),s=0;s<u;++s)n[s]=isNaN(a[s]=+t(r[s],s,r))?0:+e(r[s],s,r)}}return i.initialize=function(s){r=s,o()},i.strength=function(s){return arguments.length?(e=typeof s=="function"?s:Qr(+s),o(),i):e},i.x=function(s){return arguments.length?(t=typeof s=="function"?s:Qr(+s),o(),i):t},i}function UW(t){var e=Qr(.1),r,n,a;typeof t!="function"&&(t=Qr(t==null?0:+t));function i(s){for(var u=0,f=r.length,l;u<f;++u)l=r[u],l.vy+=(a[u]-l.y)*n[u]*s}function o(){if(r){var s,u=r.length;for(n=new Array(u),a=new Array(u),s=0;s<u;++s)n[s]=isNaN(a[s]=+t(r[s],s,r))?0:+e(r[s],s,r)}}return i.initialize=function(s){r=s,o()},i.strength=function(s){return arguments.length?(e=typeof s=="function"?s:Qr(+s),o(),i):e},i.y=function(s){return arguments.length?(t=typeof s=="function"?s:Qr(+s),o(),i):t},i}const $W=Object.freeze(Object.defineProperty({__proto__:null,forceCenter:mW,forceCollide:xW,forceLink:_W,forceManyBody:GW,forceRadial:zW,forceSimulation:BW,forceX:jW,forceY:UW},Symbol.toStringTag,{value:"Module"})),nm=Ka($W);var am={},XW=me&&me.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,a)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WW=me&&me.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VW=me&&me.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XW(e,t,r);return WW(e,t),e};Object.defineProperty(am,"__esModule",{value:!0});var Es=VW(nm),Oc=Ir();function YW(){function t(ie){return function(){return ie}}var e=function(ie){return ie.cluster},r=t(1),n=t(-1),a=t(100),i=t(.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(ie){if(!g)return m;v.tick(),S();for(var Ie=0,qe=s.length,Ve=void 0,it=ie*y;Ie<qe;++Ie)Ve=s[Ie],Ve.vx+=(h[e(Ve)].x-Ve.x)*it,Ve.vy+=(h[e(Ve)].y-Ve.y)*it}function b(){s&&w()}function w(){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 ie=x();v=Es.forceSimulation(ie.nodes).force("x",Es.forceX(l).strength(.1)).force("y",Es.forceY(c).strength(.1)).force("collide",Es.forceCollide(function(Ie){return Ie.r}).iterations(4)).force("charge",Es.forceManyBody().strength(n)).force("links",Es.forceLink(ie.nodes.length?ie.links:[]).distance(a).strength(i)),d=v.nodes(),S()}}function x(){var ie=[],Ie=[],qe={},Ve=[],it={},dt=[];return it=E(s),dt=_(f),Ve=Object.keys(it),Ve.forEach(function(st,Tt){var _t=it[st];ie.push({id:st,size:_t.count,r:Math.sqrt(_t.sumforceNodeSize/Math.PI)}),qe[st]=Tt}),dt.forEach(function(st){var Tt=(0,Oc.getEdgeTerminal)(st,"source"),_t=(0,Oc.getEdgeTerminal)(st,"target"),lr=qe[Tt],Bt=qe[_t];lr!==void 0&&Bt!==void 0&&Ie.push({source:lr,target:Bt,count:st.count})}),{nodes:ie,links:Ie}}function E(ie){var Ie={};return ie.forEach(function(qe){var Ve=e(qe);Ie[Ve]||(Ie[Ve]={count:0,sumforceNodeSize:0})}),ie.forEach(function(qe){var Ve=e(qe),it=r(qe),dt=Ie[Ve];dt.count=dt.count+1,dt.sumforceNodeSize=dt.sumforceNodeSize+Math.PI*(it*it)*1.3,Ie[Ve]=dt}),Ie}function _(ie){var Ie={},qe=[];ie.forEach(function(it){var dt=A(it),st=0;Ie[dt]!==void 0&&(st=Ie[dt]),st+=1,Ie[dt]=st});var Ve=Object.entries(Ie);return Ve.forEach(function(it){var dt=it[0],st=it[1],Tt=dt.split("~")[0],_t=dt.split("~")[1];Tt!==void 0&&_t!==void 0&&qe.push({source:Tt,target:_t,count:st})}),qe}function S(){return h={none:{x:0,y:0}},d.forEach(function(ie){h[ie.id]={x:ie.x-o[0],y:ie.y-o[1]}}),h}function A(ie){var Ie=(0,Oc.getEdgeTerminal)(ie,"source"),qe=(0,Oc.getEdgeTerminal)(ie,"target"),Ve=e(u[Ie]),it=e(u[qe]);return Ve<=it?"".concat(Ve,"~").concat(it):"".concat(it,"~").concat(Ve)}function M(ie){u={},ie.forEach(function(Ie){u[Ie.id]=Ie})}function C(ie){return arguments.length?(p=ie,b(),m):p}function I(ie){return arguments.length?typeof ie=="string"?(e=function(Ie){return Ie[ie]},m):(e=ie,m):e}function k(ie){return arguments.length?(g=ie,m):g}function O(ie){return arguments.length?(y=ie,m):y}function B(ie){return arguments.length?(l=ie,m):l}function L(ie){return arguments.length?(c=ie,m):c}function z(ie){return arguments.length?(M(ie||[]),s=ie||[],m):s}function X(ie){return arguments.length?(f=ie||[],b(),m):f}function R(ie){return arguments.length?(typeof ie=="function"?r=ie:r=t(+ie),b(),m):r}function V(ie){return arguments.length?(typeof ie=="function"?n=ie:n=t(+ie),b(),m):n}function he(ie){return arguments.length?(typeof ie=="function"?a=ie:a=t(+ie),b(),m):a}function ce(ie){return arguments.length?(typeof ie=="function"?i=ie:i=t(+ie),b(),m):i}function le(ie){return arguments.length?(o=ie,m):o}return m.initialize=function(ie){s=ie,b()},m.template=C,m.groupBy=I,m.enableGrouping=k,m.strength=O,m.centerX=B,m.centerY=L,m.nodes=z,m.links=X,m.forceNodeSize=R,m.nodeSize=m.forceNodeSize,m.forceCharge=V,m.forceLinkDistance=he,m.forceLinkStrength=ce,m.offset=le,m.getFocis=S,m}am.default=YW;var mi={};Object.defineProperty(mi,"__esModule",{value:!0});mi.FORCE_LAYOUT_TYPE_MAP=mi.LAYOUT_MESSAGE=void 0;mi.LAYOUT_MESSAGE={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};mi.FORCE_LAYOUT_TYPE_MAP={gForce:!0,force2:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0};var qW=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),HW=me&&me.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,a)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZW=me&&me.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KW=me&&me.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HW(e,t,r);return ZW(e,t),e},QW=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ud,"__esModule",{value:!0});Ud.ForceLayout=void 0;var _s=KW(nm),JW=QW(am),Ao=Ir(),eV=Rr,tV=mi,rV=function(t){qW(e,t);function e(r){var n=t.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,r&&n.updateCfg(r),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(r){var n=this;n.nodes=r.nodes||[];var a=r.edges||[];n.edges=a.map(function(i){var o={},s=["targetNode","sourceNode","startPoint","endPoint"];return Object.keys(i).forEach(function(u){s.indexOf(u)>-1||(o[u]=i[u])}),o}),n.ticking=!1},e.prototype.execute=function(r){var n=this,a=n.nodes,i=n.edges;if(!n.ticking){var o=n.forceSimulation,s=n.alphaMin,u=n.alphaDecay,f=n.alpha;if(o){if(r){if(n.clustering&&n.clusterForce&&(n.clusterForce.nodes(a),n.clusterForce.links(i)),o.nodes(a),i&&n.edgeForce)n.edgeForce.links(i);else if(i&&!n.edgeForce){var h=_s.forceLink().id(function(g){return g.id}).links(i);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=_s.forceManyBody();if(n.nodeStrength&&l.strength(n.nodeStrength),o=_s.forceSimulation().nodes(a),n.clustering){var c=(0,JW.default)();c.centerX(n.center[0]).centerY(n.center[1]).template("force").strength(n.clusterFociStrength),i&&c.links(i),a&&c.nodes(a),c.forceLinkDistance(n.clusterEdgeDistance).forceLinkStrength(n.clusterEdgeStrength).forceCharge(n.clusterNodeStrength).forceNodeSize(n.clusterNodeSize),n.clusterForce=c,o.force("group",c)}if(o.force("center",_s.forceCenter(n.center[0],n.center[1])).force("charge",l).alpha(f).alphaDecay(u).alphaMin(s),n.preventOverlap&&n.overlapProcess(o),i){var h=_s.forceLink().id(function(p){return p.id}).links(i);n.edgeStrength&&h.strength(n.edgeStrength),n.linkDistance&&h.distance(n.linkDistance),n.edgeForce=h,o.force("link",h)}if(n.workerEnabled&&!aV()&&(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:a,currentTick:v,totalTicks:d,type:tV.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(r){var n=this,a=n.nodeSize,i=n.nodeSpacing,o,s,u=n.collideStrength;if((0,Ao.isNumber)(i)?s=function(){return i}:(0,Ao.isFunction)(i)?s=i:s=function(){return 0},!a)o=function(h){if(h.size){if((0,Ao.isArray)(h.size)){var d=h.size[0]>h.size[1]?h.size[0]:h.size[1];return d/2+s(h)}if((0,Ao.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,Ao.isFunction)(a))o=function(h){var d=a(h);return d+s(h)};else if((0,Ao.isArray)(a)){var f=a[0]>a[1]?a[0]:a[1],l=f/2;o=function(h){return l+s(h)}}else if((0,Ao.isNumber)(a)){var c=a/2;o=function(h){return c+s(h)}}else o=function(){return 10};r.force("collisionForce",_s.forceCollide(o).strength(u))},e.prototype.updateCfg=function(r){var n=this;n.ticking&&(n.forceSimulation.stop(),n.ticking=!1),n.forceSimulation=null,Object.assign(n,r)},e.prototype.destroy=function(){var r=this;r.ticking&&(r.forceSimulation.stop(),r.ticking=!1),r.nodes=null,r.edges=null,r.destroyed=!0},e}(eV.Base);Ud.ForceLayout=rV;function nV(t){var e=t.alphaMin(),r=t.alphaTarget(),n=t.alpha(),a=Math.log((e-r)/(n-r))/Math.log(1-t.alphaDecay()),i=Math.ceil(a);return i}function aV(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}(function(t){var e=me&&me.__createBinding||(Object.create?function(n,a,i,o){o===void 0&&(o=i);var s=Object.getOwnPropertyDescriptor(a,i);(!s||("get"in s?!a.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(n,o,s)}:function(n,a,i,o){o===void 0&&(o=i),n[o]=a[i]}),r=me&&me.__exportStar||function(n,a){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&e(a,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(Ud,t)})(rm);var cl={},iV=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(cl,"__esModule",{value:!0});cl.CircularLayout=void 0;var oV=Rr,$a=Ir();function sV(t,e,r,n){t.forEach(function(a,i){t[i].children=[],t[i].parent=[]}),n?e.forEach(function(a){var i=(0,$a.getEdgeTerminal)(a,"source"),o=(0,$a.getEdgeTerminal)(a,"target"),s=0;i&&(s=r[i]);var u=0;o&&(u=r[o]);var f=t[s].children,l=t[u].parent;f.push(t[u].id),l.push(t[s].id)}):e.forEach(function(a){var i=(0,$a.getEdgeTerminal)(a,"source"),o=(0,$a.getEdgeTerminal)(a,"target"),s=0;i&&(s=r[i]);var u=0;o&&(u=r[o]);var f=t[s].children,l=t[u].children;f.push(t[u].id),l.push(t[s].id)})}function uV(t,e,r){for(var n=r.length,a=0;a<n;a++){var i=(0,$a.getEdgeTerminal)(r[a],"source"),o=(0,$a.getEdgeTerminal)(r[a],"target");if(t.id===i&&e.id===o||e.id===i&&t.id===o)return!0}return!1}function fV(t,e){var r=t.degree,n=e.degree;return r<n?-1:r>n?1:0}var lV=function(t){iV(e,t);function e(r){var n=t.call(this)||this;return n.radius=null,n.nodeSize=void 0,n.startRadius=null,n.endRadius=null,n.startAngle=0,n.endAngle=2*Math.PI,n.clockwise=!0,n.divisions=1,n.ordering=null,n.angleRatio=1,n.nodes=[],n.edges=[],n.nodeMap={},n.degrees=[],n.width=300,n.height=300,n.updateCfg(r),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 r,n=this,a=n.nodes,i=n.edges,o=a.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){a[0].x=s[0],a[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,w={};a.forEach(function(L,z){w[L.id]=z}),n.nodeMap=w;var x=(0,$a.getDegree)(a.length,w,i);if(n.degrees=x,y){var E=(0,$a.getFuncByUnknownType)(10,y),_=(0,$a.getFuncByUnknownType)(10,m),S=-1/0;a.forEach(function(L){var z=_(L);S<z&&(S=z)});var A=0;a.forEach(function(L,z){z===0?A+=S||10:A+=(E(L)||0)+(S||10)}),u=A/(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 M=b*v,C=[];p==="topology"?C=n.topologyOrdering():p==="topology-directed"?C=n.topologyOrdering(!0):p==="degree"?C=n.degreeOrdering():C=a;for(var I=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 B=h+k%I*M+2*Math.PI/c*Math.floor(k/I);g||(B=d-k%I*M-2*Math.PI/c*Math.floor(k/I)),C[k].x=s[0]+Math.cos(B)*O,C[k].y=s[1]+Math.sin(B)*O,C[k].weight=x[k].all}return(r=n.onLayoutEnd)===null||r===void 0||r.call(n),{nodes:C,edges:this.edges}},e.prototype.topologyOrdering=function(r){r===void 0&&(r=!1);var n=this,a=n.degrees,i=n.edges,o=n.nodes,s=(0,$a.clone)(o),u=n.nodeMap,f=[s[0]],l=[o[0]],c=[],h=o.length;c[0]=!0,sV(s,i,u,r);var d=0;return s.forEach(function(v,p){if(p!==0)if((p===h-1||a[p].all!==a[p+1].all||uV(f[d],v,i))&&!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(a[b].all===a[p].all&&!c[b]){f.push(s[b]),l.push(o[u[s[b].id]]),c[b]=!0,y=!0;break}}for(var w=0;!y&&(c[w]||(f.push(s[w]),l.push(o[u[s[w].id]]),c[w]=!0,y=!0),w++,w!==h););}}),l},e.prototype.degreeOrdering=function(){var r=this,n=r.nodes,a=[],i=r.degrees;return n.forEach(function(o,s){o.degree=i[s].all,a.push(o)}),a.sort(fV),a},e.prototype.getType=function(){return"circular"},e}(oV.Base);cl.CircularLayout=lV;var yu={},im={},om={},sm={},um={},fm={};Object.defineProperty(fm,"__esModule",{value:!0});var cV=function(t,e){if(t!=="next"&&t!=="prev")return e},OE=function(t){t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev},hV=function(){function t(){var e={};e.prev=e,e.next=e.prev,this.shortcut=e}return t.prototype.dequeue=function(){var e=this.shortcut,r=e.prev;if(r&&r!==e)return OE(r),r},t.prototype.enqueue=function(e){var r=this.shortcut;e.prev&&e.next&&OE(e),e.next=r.next,r.next.prev=e,r.next=e,e.prev=r},t.prototype.toString=function(){for(var e=[],r=this.shortcut,n=r.prev;n!==r;)e.push(JSON.stringify(n,cV)),n=n==null?void 0:n.prev;return"[".concat(e.join(", "),"]")},t}();fm.default=hV;var Xs;(function(t){t.DEFAULT_EDGE_NAME="\0",t.GRAPH_NODE="\0",t.EDGE_KEY_DELIM=""})(Xs||(Xs={}));function LE(t,e){var r=t.get(e)||0;t.set(e,r+1)}function DE(t,e){var r=t.get(e);r!==void 0&&(r=r-1,r>0?t.set(e,r):t.delete(e))}function uI(t,e,r,n){var a=String(e),i=String(r);if(!t&&a>i){var o=a;a=i,i=o}return a+Xs.EDGE_KEY_DELIM+i+Xs.EDGE_KEY_DELIM+(n===void 0?Xs.DEFAULT_EDGE_NAME:n)}function PE(t,e,r,n){var a=String(e),i=String(r),o={v:e,w:r};if(!t&&a>i){var s=o.v;o.v=o.w,o.w=s}return n!==void 0&&(o.name=n),o}function zp(t,e){return uI(t,e.v,e.w,e.name)}function RE(t){return typeof t=="function"}var dV=function(e){return e.nodes().map(function(r){var n=e.node(r),a=e.parent(r),i={id:r,value:n,parent:a};return i.value===void 0&&delete i.value,i.parent===void 0&&delete i.parent,i})},vV=function(e){return e.edges().map(function(r){var n=e.edge(r),a={v:r.v,w:r.w,value:n,name:r.name};return a.name===void 0&&delete a.name,a.value===void 0&&delete a.value,a})},pV=function(e){var r={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:dV(e),edges:vV(e),value:e.graph()};return r.value===void 0&&delete r.value,r},gV=function(e){var r=new Qo(e.options);return e.value!==void 0&&r.setGraph(e.value),e.nodes.forEach(function(n){r.setNode(n.id,n.value),n.parent&&r.setParent(n.id,n.parent)}),e.edges.forEach(function(n){r.setEdge(n.v,n.w,n.value,n.name)}),r};function FE(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function BE(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?FE(Object(r),!0).forEach(function(n){yV(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):FE(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function yV(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bV(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function wV(t,e,r){return e&&bV(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var xV={compound:!1,multigraph:!1,directed:!0},Qo=function(){function t(){var e=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};mV(this,t),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=Xs.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(a){return e.label=a,e},this.graph=function(){return e.label},this.setDefaultNodeLabel=function(a){return RE(a)?e.defaultNodeLabelFn=a:e.defaultNodeLabelFn=function(){return a},e},this.nodeCount=function(){return e.nodeCountNum},this.node=function(a){return e.nodesLabelMap.get(a)},this.nodes=function(){return Array.from(e.nodesLabelMap.keys())},this.sources=function(){return e.nodes().filter(function(a){var i;return!(!((i=e.inEdgesMap.get(a))===null||i===void 0)&&i.size)})},this.sinks=function(){return e.nodes().filter(function(a){var i;return!(!((i=e.outEdgesMap.get(a))===null||i===void 0)&&i.size)})},this.setNodes=function(a,i){return a.map(function(o){return e.setNode(o,i)}),e},this.hasNode=function(a){return e.nodesLabelMap.has(a)},this.checkCompound=function(){if(!e.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(a){if(e.isCompound()){var i,o=(i=e.parentMap)===null||i===void 0?void 0:i.get(a);if(o!==e.GRAPH_NODE)return o}},this.removeFromParentsChildList=function(a){var i=e.parentMap.get(a);e.childrenMap.get(i).delete(a)},this.setParent=function(a,i){var o,s;e.checkCompound();for(var u=i===void 0?e.GRAPH_NODE:i,f=e.parent(u);f;){if(a===f)throw new Error("Setting "+i+" as parent of "+a+" would create a cycle");f=e.parent(f)}i&&e.setNode(i),e.setNode(a),e.removeFromParentsChildList(a),(o=e.parentMap)===null||o===void 0||o.set(a,u);var l=e.childrenMap.get(u);return l.set(a,!0),(s=e.childrenMap)===null||s===void 0||s.set(u,l),e},this.children=function(a){var i=a===void 0?e.GRAPH_NODE:a;if(e.isCompound()){var o,s=(o=e.childrenMap)===null||o===void 0?void 0:o.get(i);return s?Array.from(s.keys()):void 0}if(i===e.GRAPH_NODE)return e.nodes();if(a&&e.hasNode(a))return[]},this.predecessors=function(a){var i=e.predecessorsMap.get(a);return i?Array.from(i.keys()):void 0},this.successors=function(a){var i=e.successorsMap.get(a);return i?Array.from(i.keys()):void 0},this.neighbors=function(a){var i;if(e.hasNode(a))return Array.from(new Set((i=e.predecessors(a))===null||i===void 0?void 0:i.concat(e.successors(a))))},this.isLeaf=function(a){var i;if(e.isDirected()){var o;return!(!((o=e.successors(a))===null||o===void 0)&&o.length)}return!(!((i=e.neighbors(a))===null||i===void 0)&&i.length)},this.filterNodes=function(a){var i=e.directed,o=e.multigraph,s=e.compound,u=new t({directed:i,multigraph:o,compound:s});if(u.setGraph(e.graph()),e.nodes().forEach(function(l){a(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(a){return RE(a)?e.defaultEdgeLabelFn=a:e.defaultEdgeLabelFn=function(){return a},e},this.edgeCount=function(){return e.edgeCountNum},this.setEdgeObj=function(a,i){return e.setEdge(a.v,a.w,i,a.name)},this.setPath=function(a,i){return a.reduce(function(o,s){return e.setEdge(o,s,i),s}),e},this.edgeFromArgs=function(a,i,o){return e.edge({v:a,w:i,name:o})},this.edge=function(a){return e.edgesLabelsMap.get(zp(e.isDirected(),a))},this.hasEdge=function(a,i,o){return e.edgesLabelsMap.has(zp(e.isDirected(),{v:a,w:i,name:o}))},this.removeEdgeObj=function(a){var i=a.v,o=a.w,s=a.name;return e.removeEdge(i,o,s)},this.edges=function(){return Array.from(e.edgesMap.values())},this.inEdges=function(a,i){var o=e.inEdgesMap.get(a);if(o)return Array.from(o.values()).filter(function(s){return!i||s.v===i})},this.outEdges=function(a,i){var o=e.outEdgesMap.get(a);if(o)return Array.from(o.values()).filter(function(s){return!i||s.w===i})},this.nodeEdges=function(a,i){var o;if(e.hasNode(a))return(o=e.inEdges(a,i))===null||o===void 0?void 0:o.concat(e.outEdges(a,i))},this.toJSON=function(){return pV(e)},this.nodeInDegree=function(a){var i=e.inEdgesMap.get(a);return i?i.size:0},this.nodeOutDegree=function(a){var i=e.outEdgesMap.get(a);return i?i.size:0},this.nodeDegree=function(a){return e.nodeInDegree(a)+e.nodeOutDegree(a)},this.source=function(a){return a.v},this.target=function(a){return a.w};var n=BE(BE({},xV),r);this.compound=n.compound,this.directed=n.directed,this.multigraph=n.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}return wV(t,[{key:"setNode",value:function(r,n){var a=this.nodesLabelMap,i=this.defaultNodeLabelFn,o=this.isCompound,s=this.parentMap,u=this.childrenMap,f=this.inEdgesMap,l=this.outEdgesMap,c=this.predecessorsMap,h=this.successorsMap;if(a.has(r))return n!==void 0&&a.set(r,n),this;if(a.set(r,n||i(r)),o()){var d;s==null||s.set(r,this.GRAPH_NODE),u==null||u.set(r,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(r,!0)}return[f,l,c,h].forEach(function(v){return v.set(r,new Map)}),this.nodeCountNum+=1,this}},{key:"removeNode",value:function(r){var n=this;if(this.hasNode(r)){var a=function(g){n.removeEdge(g.v,g.w,g.name)},i=this.inEdgesMap,o=this.outEdgesMap,s=this.predecessorsMap,u=this.successorsMap,f=this.nodesLabelMap;if(this.isCompound()){var l,c,h;this.removeFromParentsChildList(r),(l=this.parentMap)===null||l===void 0||l.delete(r),(c=this.children(r))===null||c===void 0||c.forEach(function(p){return n.setParent(p)}),(h=this.childrenMap)===null||h===void 0||h.delete(r)}var d=i.get(r),v=o.get(r);Array.from(d.values()).forEach(function(p){return a(p)}),Array.from(v.values()).forEach(function(p){return a(p)}),f.delete(r),i.delete(r),o.delete(r),s.delete(r),u.delete(r),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(r,n,a,i){var o,s,u=PE(this.isDirected(),r,n,i),f=zp(this.isDirected(),u),l=u.v,c=u.w;if(this.edgesLabelsMap.has(f))return this.edgesLabelsMap.set(f,a),this;if(i!==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,a||this.defaultEdgeLabelFn(l,c,i)),Object.freeze(u),this.edgesMap.set(f,u);var h=this.predecessorsMap.get(c),d=this.successorsMap.get(l);return LE(h,l),LE(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(r,n,a){var i=uI(this.isDirected(),r,n,a),o=this.edgesMap.get(i);if(o){var s=PE(this.isDirected(),r,n,a),u=s.v,f=s.w;this.edgesLabelsMap.delete(i),this.edgesMap.delete(i);var l=this.predecessorsMap.get(f),c=this.successorsMap.get(u);DE(l,u),DE(c,f),this.inEdgesMap.get(f).delete(i),this.outEdgesMap.get(u).delete(i),this.edgeCountNum-=1}return this}}]),t}();Qo.fromJSON=gV;function mg(t){"@babel/helpers - typeof";return mg=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},mg(t)}function EV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _V(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function SV(t,e,r){return e&&_V(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Fo(){return typeof Reflect<"u"&&Reflect.get?Fo=Reflect.get:Fo=function(e,r,n){var a=MV(e,r);if(a){var i=Object.getOwnPropertyDescriptor(a,r);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Fo.apply(this,arguments)}function MV(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=di(t),t!==null););return t}function AV(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&bg(t,e)}function bg(t,e){return bg=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},bg(t,e)}function CV(t){var e=kV();return function(){var n=di(t),a;if(e){var i=di(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return TV(this,a)}}function TV(t,e){if(e&&(mg(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return IV(t)}function IV(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function kV(){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 di(t){return di=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},di(t)}var NV=function(t){AV(r,t);var e=CV(r);function r(){var n;EV(this,r);for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return n=e.call.apply(e,[this].concat(i)),n.eventPool={},n}return SV(r,[{key:"appendEvent",value:function(a,i){this.eventPool[a]||(this.eventPool[a]=[]),this.eventPool[a].push(i)}},{key:"removeEvent",value:function(a,i){if(this.eventPool[a]){var o=this.eventPool[a].indexOf(i);o>-1&&this.eventPool[a].splice(o,1)}}},{key:"emitEvent",value:function(a){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];this.eventPool[a]&&this.eventPool[a].forEach(function(u){u.apply(void 0,o)})}},{key:"setNode",value:function(a,i){return Fo(di(r.prototype),"setNode",this).call(this,a,i),this.emitEvent("nodeAdd",a,i),this}},{key:"removeNode",value:function(a){return Fo(di(r.prototype),"removeNode",this).call(this,a),this.emitEvent("nodeRemove",a),this}},{key:"setEdge",value:function(a,i,o,s){return Fo(di(r.prototype),"setEdge",this).call(this,a,i,o,s),this.emitEvent("edgeAdd",a,i,o,s),this}},{key:"removeEdge",value:function(a,i,o){return Fo(di(r.prototype),"removeEdge",this).call(this,a,i,o),this.emitEvent("edgeRemove",a,i,o),this}}]),r}(Qo);function OV(t,e,r){return Object.defineProperty(t,"prototype",{writable:!1}),t}function LV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var fI=OV(function t(){var e=this;LV(this,t),this.arr=[],this.keyIndice=new Map,this.size=function(){return e.arr.length},this.keys=function(){return e.arr.map(function(r){return r.key})},this.has=function(r){return e.keyIndice.has(r)},this.priority=function(r){var n=e.keyIndice.get(r);if(n!==void 0)return e.arr[n].priority},this.swap=function(r,n){var a=e.arr,i=e.keyIndice,o=[a[r],a[n]],s=o[0],u=o[1];a[r]=u,a[n]=s,i.set(s.key,n),i.set(u.key,r)},this.innerDecrease=function(r){for(var n=e.arr,a=n[r].priority,i,o=r;o!==0;){var s;if(i=o>>1,((s=n[i])===null||s===void 0?void 0:s.priority)<a)break;e.swap(o,i),o=i}},this.heapify=function(r){var n=e.arr,a=r<<1,i=a+1,o=r;a<n.length&&(o=n[a].priority<n[o].priority?a:o,i<n.length&&(o=n[i].priority<n[o].priority?i:o),o!==r&&(e.swap(r,o),e.heapify(o)))},this.min=function(){if(e.size()===0)throw new Error("Queue underflow");return e.arr[0].key},this.add=function(r,n){var a=e.keyIndice,i=e.arr;if(!a.has(r)){var o=i.length;return a.set(r,o),i.push({key:r,priority:n}),e.innerDecrease(o),!0}return!1},this.removeMin=function(){e.swap(0,e.arr.length-1);var r=e.arr.pop();return e.keyIndice.delete(r.key),e.heapify(0),r.key},this.decrease=function(r,n){if(!e.has(r))throw new Error("There's no key named ".concat(r));var a=e.keyIndice.get(r);if(n>e.arr[a].priority)throw new Error("New priority is greater than current priority.Key: ".concat(r," Old: + ").concat(e.arr[a].priority," New: ").concat(n));e.arr[a].priority=n,e.innerDecrease(a)}}),DV=function(e,r){var n=new Qo,a=new Map,i=new fI,o;function s(l){var c=l.v===o?l.w:l.v,h=i.priority(c);if(h!==void 0){var d=r(l);d<h&&(a.set(c,o),i.decrease(c,d))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(l){i.add(l,Number.POSITIVE_INFINITY),n.setNode(l)}),i.decrease(e.nodes()[0],0);for(var u=!1;i.size()>0;){var f;if(o=i.removeMin(),a.has(o))n.setEdge(o,a.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},PV=function(e){var r=new Set,n=[],a=e.nodes();return a.forEach(function(i){for(var o=[],s=[i];s.length>0;){var u=s.pop();if(!r.has(u)){var f,l;r.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},RV=function t(e,r,n,a,i,o){a.includes(r)||(a.push(r),n||o.push(r),i(r).forEach(function(s){return t(e,s,n,a,i,o)}),n&&o.push(r))},lm=function(e,r,n){var a=Array.isArray(r)?r:[r],i=function(f){return e.isDirected()?e.successors(f):e.neighbors(f)},o=[],s=[];return a.forEach(function(u){if(e.hasNode(u))RV(e,u,n==="post",s,i,o);else throw new Error("Graph does not have node: "+u)}),o};function FV(t,e){return jV(t)||zV(t,e)||GV(t,e)||BV()}function BV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GV(t,e){if(t){if(typeof t=="string")return GE(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return GE(t,e)}}function GE(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function zV(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],a=!0,i=!1,o,s;try{for(r=r.call(t);!(a=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));a=!0);}catch(u){i=!0,s=u}finally{try{!a&&r.return!=null&&r.return()}finally{if(i)throw s}}return n}}function jV(t){if(Array.isArray(t))return t}var UV=function(){return 1},lI=function(e,r,n,a){return $V(e,r,n||UV,a||function(i){return e.outEdges(i)})},$V=function(e,r,n,a){var i=new Map,o=new fI,s,u,f=function(h){var d=h.v!==s?h.v:h.w,v=i.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===r?0:Number.POSITIVE_INFINITY;i.set(c,{distance:h}),o.add(c,h)});o.size()>0&&(s=o.removeMin(),u=i.get(s),!(u&&u.distance===Number.POSITIVE_INFINITY));)a(s).forEach(f);var l={};return Array.from(i.entries()).forEach(function(c){var h=FV(c,2),d=h[0],v=h[1];return l[String(d)]=v,l}),l},XV=function(e,r,n){var a={};return e.nodes().forEach(function(i){return a[String(i)]=lI(e,i,r,n),a}),a},cI=function(e){var r=0,n=[],a=new Map,i=[];function o(s){var u,f={onStack:!0,lowlink:r,index:r};if(a.set(s,f),r+=1,n.push(s),(u=e.successors(s))===null||u===void 0||u.forEach(function(d){var v;if(a.has(d)){if(!((v=a.get(d))===null||v===void 0)&&v.onStack){var g=a.get(d);f.lowlink=Math.min(f.lowlink,g.index)}}else{o(d);var p=a.get(d);f.lowlink=Math.min(f.lowlink,p.lowlink)}}),f.lowlink===f.index){var l=[],c;do{c=n.pop();var h=a.get(c);h.onStack=!1,l.push(c)}while(s!==c);i.push(l)}}return e.nodes().forEach(function(s){a.has(s)||o(s)}),i},WV=function(e){return cI(e).filter(function(r){return r.length>1||r.length===1&&e.hasEdge(r[0],r[0])})};function wg(t){"@babel/helpers - typeof";return wg=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},wg(t)}function VV(t,e,r){return Object.defineProperty(t,"prototype",{writable:!1}),t}function YV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qV(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wf(t,e)}function HV(t){var e=hI();return function(){var n=Vf(t),a;if(e){var i=Vf(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return ZV(this,a)}}function ZV(t,e){if(e&&(wg(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return KV(t)}function KV(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function xg(t){var e=typeof Map=="function"?new Map:void 0;return xg=function(n){if(n===null||!QV(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,a)}function a(){return hh(n,arguments,Vf(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),Wf(a,n)},xg(t)}function hh(t,e,r){return hI()?hh=Reflect.construct:hh=function(a,i,o){var s=[null];s.push.apply(s,i);var u=Function.bind.apply(a,s),f=new u;return o&&Wf(f,o.prototype),f},hh.apply(null,arguments)}function hI(){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 QV(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Wf(t,e){return Wf=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},Wf(t,e)}function Vf(t){return Vf=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Vf(t)}var Eg=function(t){qV(r,t);var e=HV(r);function r(){return YV(this,r),e.apply(this,arguments)}return VV(r)}(xg(Error));function dI(t){var e=new Set,r=new Set,n=[];function a(i){if(r.has(i))throw new Eg;if(!e.has(i)){var o;r.add(i),e.add(i),(o=t.predecessors(i))===null||o===void 0||o.forEach(a),r.delete(i),n.push(i)}}if(t.sinks().forEach(a),e.size!==t.nodeCount())throw new Eg;return n}var JV=function(e){try{dI(e)}catch(r){if(r instanceof Eg)return!1;throw r}return!0},eY=function(e,r){return lm(e,r,"post")},tY=function(e,r){return lm(e,r,"pre")},rY=function(){return 1};function nY(t,e,r){return aY(t,e||rY,r||function(n){return t.outEdges(n)})}function aY(t,e,r){var n={},a=t.nodes();return a.forEach(function(i){var o=String(i);n[o]={},n[o][o]={distance:0},a.forEach(function(s){i!==s&&(n[o][String(s)]={distance:Number.POSITIVE_INFINITY})}),r(i).forEach(function(s){var u=s.v===i?s.w:s.v,f=e(s);n[o][String(u)]={distance:f,predecessor:i}})}),a.forEach(function(i){var o=String(i),s=n[o];a.forEach(function(u){var f=String(u),l=n[f];a.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 iY=Object.freeze(Object.defineProperty({__proto__:null,components:PV,dfs:lm,dijkstra:lI,dijkstraAll:XV,findCycles:WV,floydWarshall:nY,isAcyclic:JV,postorder:eY,preorder:tY,prim:DV,tarjan:cI,topsort:dI},Symbol.toStringTag,{value:"Module"}));var oY=function(e,r){for(var n=e.nodes(),a=0;a<n.length;a++){var i=n[a];if(r.hasNode(i))return!0}return!1},vI=function(e,r){for(var n=e.edges(),a=0;a<n.length;a++){var i=n[a];if(r.hasEdge(i.v,i.w,i.name))return!0}return!1},pI=function(e,r){var n=e.nodes(),a=n.filter(function(i){return r.hasNode(i)});return a},gI=function(e,r){var n=e.edges(),a=n.filter(function(i){return r.hasEdge(i.v,i.w,i.name)});return a},yI=function(e,r){return e.isCompound()===r.isCompound()&&e.isDirected()===r.isDirected()&&e.isMultigraph()===r.isMultigraph()},Xd=function(e,r){var n=pI(e,r);return n.length===e.nodes().length},cm=function(e,r){var n=gI(e,r);return n.length===e.edges().length},sY=function(e,r){return yI(e,r)&&e.nodeCount()===r.nodeCount()&&Xd(e,r)&&e.edgeCount()===r.edgeCount()&&cm(e,r)},uY=function(e,r){return Xd(e,r)&&cm(e,r)};function fY(t,e){return dY(t)||hY(t,e)||cY(t,e)||lY()}function lY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cY(t,e){if(t){if(typeof t=="string")return zE(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zE(t,e)}}function zE(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function hY(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],a=!0,i=!1,o,s;try{for(r=r.call(t);!(a=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));a=!0);}catch(u){i=!0,s=u}finally{try{!a&&r.return!=null&&r.return()}finally{if(i)throw s}}return n}}function dY(t){if(Array.isArray(t))return t}function vY(t){return t instanceof Qo}function Hh(t){if(t.isMultigraph())return!1;for(var e=t.edges(),r=new Map,n=0;n<e.length;n++){var a=e[n];if(a.v===a.w)return!1;var i=[a.v,a.w].sort(),o=fY(i,2),s=o[0],u=o[1],f="".concat(s,"-").concat(u);if(r.has(f))return!1;r.set(f,!0)}return!0}function pY(t){return t.nodes().length===0}function gY(t){for(var e=t.edges(),r=0;r<e.length;r++){var n=e[r];if(n.v===n.w)return!0}return!1}const yY=Object.freeze(Object.defineProperty({__proto__:null,hasSelfLoop:gY,isGraph:vY,isNullGraph:pY,isSimpleGraph:Hh},Symbol.toStringTag,{value:"Module"}));var mY=function(e,r){if(!Hh(e)||!Hh(r)||!Xd(e,r)||vI(e,r))return!1;var n=e.nodeCount();return e.edgeCount()+r.edgeCount()===n*(n-1)/2};const bY=Object.freeze(Object.defineProperty({__proto__:null,containAllSameEdges:cm,containAllSameNodes:Xd,containSameEdges:vI,containSameNodes:oY,getSameEdges:gI,getSameNodes:pI,isGraphComplement:mY,isGraphContainsAnother:uY,isGraphOptionSame:yI,isGraphSame:sY},Symbol.toStringTag,{value:"Module"}));var wY=function(e){if(!Hh(e))return null;for(var r=e.nodeCount(),n=new Qo({compound:e.isCompound(),directed:e.isDirected(),multigraph:e.isMultigraph()}),a=e.nodes(),i=0;i<r;i++){var o=a[i];n.setNode(o,e.node(o));for(var s=i+1;s<r;s++){var u=a[s];e.hasEdge(o,u)||n.setEdge(o,u)}}return n};const xY=Object.freeze(Object.defineProperty({__proto__:null,getGraphComplement:wY},Symbol.toStringTag,{value:"Module"})),EY=Object.freeze(Object.defineProperty({__proto__:null,Graph:Qo,GraphWithEvent:NV,algorithm:iY,comparision:bY,essence:yY,generate:xY},Symbol.toStringTag,{value:"Module"})),Wd=Ka(EY);var mI=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),_Y=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(um,"__esModule",{value:!0});var SY=_Y(fm),MY=Wd,AY=function(t){mI(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(SY.default),CY=function(t){mI(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(MY.Graph),TY=function(){return 1},IY=function(t,e){var r;if(t.nodeCount()<=1)return[];var n=NY(t,e||TY),a=kY(n.graph,n.buckets,n.zeroIdx);return(r=a.map(function(i){return t.outEdges(i.v,i.w)}))===null||r===void 0?void 0:r.flat()},kY=function(t,e,r){for(var n=[],a=e[e.length-1],i=e[0],o;t.nodeCount();){for(;o=i.dequeue();)jp(t,e,r,o);for(;o=a.dequeue();)jp(t,e,r,o);if(t.nodeCount()){for(var s=e.length-2;s>0;--s)if(o=e[s].dequeue(),o){n=n.concat(jp(t,e,r,o,!0));break}}}return n},jp=function(t,e,r,n,a){var i,o,s=[];return(i=t.inEdges(n.v))===null||i===void 0||i.forEach(function(u){var f=t.edge(u),l=t.node(u.v);a&&s.push({v:u.v,w:u.w,in:0,out:0}),l.out===void 0&&(l.out=0),l.out-=f,_g(e,r,l)}),(o=t.outEdges(n.v))===null||o===void 0||o.forEach(function(u){var f=t.edge(u),l=u.w,c=t.node(l);c.in===void 0&&(c.in=0),c.in-=f,_g(e,r,c)}),t.removeNode(n.v),a?s:void 0},NY=function(t,e){var r=new CY,n=0,a=0;t.nodes().forEach(function(f){r.setNode(f,{v:f,in:0,out:0})}),t.edges().forEach(function(f){var l=r.edge(f)||0,c=(e==null?void 0:e(f))||1,h=l+c;r.setEdge(f.v,f.w,h),a=Math.max(a,r.node(f.v).out+=c),n=Math.max(n,r.node(f.w).in+=c)});for(var i=[],o=a+n+3,s=0;s<o;s++)i.push(new AY);var u=n+1;return r.nodes().forEach(function(f){_g(i,u,r.node(f))}),{buckets:i,zeroIdx:u,graph:r}},_g=function(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)};um.default=IY;var OY=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(sm,"__esModule",{value:!0});var LY=OY(um),DY=function(t){var e=function(n){return function(a){var i;return((i=n.edge(a))===null||i===void 0?void 0:i.weight)||1}},r=t.graph().acyclicer==="greedy"?(0,LY.default)(t,e(t)):PY(t);r==null||r.forEach(function(n){var a=t.edge(n);t.removeEdgeObj(n),a.forwardName=n.name,a.reversed=!0,t.setEdge(n.w,n.v,a,"rev-".concat(Math.random()))})},PY=function(t){var e=[],r={},n={},a=function(i){var o;n[i]||(n[i]=!0,r[i]=!0,(o=t.outEdges(i))===null||o===void 0||o.forEach(function(s){r[s.w]?e.push(s):a(s.w)}),delete r[i])};return t.nodes().forEach(a),e},RY=function(t){t.edges().forEach(function(e){var r=t.edge(e);if(r.reversed){t.removeEdgeObj(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}})};sm.default={run:DY,undo:RY};var hm={},Vn={},wi={},FY=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(wi,"__esModule",{value:!0});wi.Graph=void 0;var BY=Wd,GY=function(t){FY(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(BY.Graph);wi.Graph=GY;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.minBy=t.notime=t.time=t.partition=t.maxRank=t.addBorderNode=t.removeEmptyRanks=t.normalizeRanks=t.buildLayerMatrix=t.intersectRect=t.predecessorWeights=t.successorWeights=t.zipObject=t.asNonCompoundGraph=t.simplify=t.addDummyNode=void 0;var e=Ir(),r=wi,n=function(w,x){return Number(w)-Number(x)},a=function(w,x,E,_){var S;do S="".concat(_).concat(Math.random());while(w.hasNode(S));return E.dummy=x,w.setNode(S,E),S};t.addDummyNode=a;var i=function(w){var x=new r.Graph().setGraph(w.graph());return w.nodes().forEach(function(E){x.setNode(E,w.node(E))}),w.edges().forEach(function(E){var _=x.edgeFromArgs(E.v,E.w)||{weight:0,minlen:1},S=w.edge(E);x.setEdge(E.v,E.w,{weight:_.weight+S.weight,minlen:Math.max(_.minlen,S.minlen)})}),x};t.simplify=i;var o=function(w){var x=new r.Graph({multigraph:w.isMultigraph()}).setGraph(w.graph());return w.nodes().forEach(function(E){var _;!((_=w.children(E))===null||_===void 0)&&_.length||x.setNode(E,w.node(E))}),w.edges().forEach(function(E){x.setEdgeObj(E,w.edge(E))}),x};t.asNonCompoundGraph=o;var s=function(w,x){return w==null?void 0:w.reduce(function(E,_,S){return E[_]=x[S],E},{})};t.zipObject=s;var u=function(w){var x={};return w.nodes().forEach(function(E){var _,S={};(_=w.outEdges(E))===null||_===void 0||_.forEach(function(A){var M;S[A.w]=(S[A.w]||0)+(((M=w.edge(A))===null||M===void 0?void 0:M.weight)||0)}),x[E]=S}),x};t.successorWeights=u;var f=function(w){var x=w.nodes(),E=x.map(function(_){var S,A={};return(S=w.inEdges(_))===null||S===void 0||S.forEach(function(M){A[M.v]=(A[M.v]||0)+w.edge(M).weight}),A});return(0,t.zipObject)(x,E)};t.predecessorWeights=f;var l=function(w,x){var E=Number(w.x),_=Number(w.y),S=Number(x.x)-E,A=Number(x.y)-_,M=Number(w.width)/2,C=Number(w.height)/2;if(!S&&!A)return{x:0,y:0};var I,k;return Math.abs(A)*M>Math.abs(S)*C?(A<0&&(C=-C),I=C*S/A,k=C):(S<0&&(M=-M),I=M,k=M*A/S),{x:E+I,y:_+k}};t.intersectRect=l;var c=function(w){for(var x=[],E=(0,t.maxRank)(w)+1,_=0;_<E;_++)x.push([]);w.nodes().forEach(function(S){var A=w.node(S);if(A){var M=A.rank;M!==void 0&&x[M]&&x[M].push(S)}});for(var _=0;_<E;_++)x[_]=x[_].sort(function(A,M){var C,I;return n((C=w.node(A))===null||C===void 0?void 0:C.order,(I=w.node(M))===null||I===void 0?void 0:I.order)});return x};t.buildLayerMatrix=c;var h=function(w){var x=w.nodes().filter(function(_){var S;return((S=w.node(_))===null||S===void 0?void 0:S.rank)!==void 0}).map(function(_){return w.node(_).rank}),E=Math.min.apply(Math,x);w.nodes().forEach(function(_){var S=w.node(_);S.hasOwnProperty("rank")&&E!==1/0&&(S.rank-=E)})};t.normalizeRanks=h;var d=function(w){var x=w.nodes(),E=x.filter(function(k){var O;return((O=w.node(k))===null||O===void 0?void 0:O.rank)!==void 0}).map(function(k){return w.node(k).rank}),_=Math.min.apply(Math,E),S=[];x.forEach(function(k){var O,B=(((O=w.node(k))===null||O===void 0?void 0:O.rank)||0)-_;S[B]||(S[B]=[]),S[B].push(k)});for(var A=0,M=w.graph().nodeRankFactor||0,C=0;C<S.length;C++){var I=S[C];I===void 0?C%M!==0&&(A-=1):A&&(I==null||I.forEach(function(k){var O=w.node(k);O&&(O.rank=O.rank||0,O.rank+=A)}))}};t.removeEmptyRanks=d;var v=function(w,x,E,_){var S={width:0,height:0};return(0,e.isNumber)(E)&&(0,e.isNumber)(_)&&(S.rank=E,S.order=_),(0,t.addDummyNode)(w,"border",S,x)};t.addBorderNode=v;var p=function(w){var x;return w.nodes().forEach(function(E){var _,S=(_=w.node(E))===null||_===void 0?void 0:_.rank;S!==void 0&&(x===void 0||S>x)&&(x=S)}),x||(x=0),x};t.maxRank=p;var g=function(w,x){var E={lhs:[],rhs:[]};return w==null||w.forEach(function(_){x(_)?E.lhs.push(_):E.rhs.push(_)}),E};t.partition=g;var y=function(w,x){var E=Date.now();try{return x()}finally{console.log("".concat(w," time: ").concat(Date.now()-E,"ms"))}};t.time=y;var m=function(w,x){return x()};t.notime=m;var b=function(w,x){return w.reduce(function(E,_){var S=x(E),A=x(_);return S>A?_:E})};t.minBy=b})(Vn);Object.defineProperty(hm,"__esModule",{value:!0});var zY=Vn,jY=function(t){t.graph().dummyChains=[],t.edges().forEach(function(e){return UY(t,e)})},UY=function(t,e){var r=e.v,n=t.node(r).rank,a=e.w,i=t.node(a).rank,o=e.name,s=t.edge(e),u=s.labelRank;if(i!==n+1){t.removeEdgeObj(e);var f=t.graph(),l,c,h;for(h=0,++n;n<i;++h,++n)s.points=[],c={edgeLabel:s,width:0,height:0,edgeObj:e,rank:n},l=(0,zY.addDummyNode)(t,"edge",c,"_d"),n===u&&(c.width=s.width,c.height=s.height,c.dummy="edge-label",c.labelpos=s.labelpos),t.setEdge(r,l,{weight:s.weight},o),h===0&&(f.dummyChains||(f.dummyChains=[]),f.dummyChains.push(l)),r=l;t.setEdge(r,a,{weight:s.weight},o)}},$Y=function(t){var e;(e=t.graph().dummyChains)===null||e===void 0||e.forEach(function(r){var n=t.node(r),a=n.edgeLabel,i;n.edgeObj&&t.setEdgeObj(n.edgeObj,a);for(var o=r;n.dummy;)i=t.successors(o)[0],t.removeNode(o),a.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(a.x=n.x,a.y=n.y,a.width=n.width,a.height=n.height),o=i,n=t.node(o)})};hm.default={run:jY,undo:$Y};var dm={},ba={};Object.defineProperty(ba,"__esModule",{value:!0});ba.slack=ba.longestPathWithLayer=ba.longestPath=void 0;var bI=function(t){var e,r={},n=function(a){var i,o=t.node(a);if(!o)return 0;if(r[a])return o.rank;r[a]=!0;var s;return(i=t.outEdges(a))===null||i===void 0||i.forEach(function(u){var f=n(u.w),l=t.edge(u).minlen,c=f-l;c&&(s===void 0||c<s)&&(s=c)}),s||(s=0),o.rank=s,s};(e=t.sources())===null||e===void 0||e.forEach(function(a){return n(a)})};ba.longestPath=bI;var wI=function(t){var e,r={},n,a=function(s){var u,f=t.node(s);if(!f)return 0;if(r[s])return f.rank;r[s]=!0;var l;return(u=t.outEdges(s))===null||u===void 0||u.forEach(function(c){var h=a(c.w),d=t.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=t.sources())===null||e===void 0||e.forEach(function(s){t.node(s)&&a(s)}),n===void 0&&(n=0);var i={},o=function(s,u){var f,l=t.node(s),c=isNaN(l.layer)?u:l.layer;(l.rank===void 0||l.rank<c)&&(l.rank=c),!i[s]&&(i[s]=!0,(f=t.outEdges(s))===null||f===void 0||f.map(function(h){o(h.w,c+t.edge(h).minlen)}))};t.nodes().forEach(function(s){var u=t.node(s);u&&(isNaN(u.layer)?u.rank-=n:o(s,u.layer))})};ba.longestPathWithLayer=wI;var xI=function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen};ba.slack=xI;ba.default={longestPath:bI,longestPathWithLayer:wI,slack:xI};var Ki={};Object.defineProperty(Ki,"__esModule",{value:!0});Ki.feasibleTreeWithLayer=Ki.feasibleTree=void 0;var Vo=ba,XY=Vn,EI=wi,_I=function(t){var e=new EI.Graph({directed:!1}),r=t.nodes()[0],n=t.nodeCount();e.setNode(r,{});for(var a,i;WY(e,t)<n;)a=MI(e,t),i=e.hasNode(a.v)?(0,Vo.slack)(t,a):-(0,Vo.slack)(t,a),AI(e,t,i);return e};Ki.feasibleTree=_I;var WY=function(t,e){var r=function(n){e.nodeEdges(n).forEach(function(a){var i=a.v,o=n===i?a.w:i;!t.hasNode(o)&&!(0,Vo.slack)(e,a)&&(t.setNode(o,{}),t.setEdge(n,o,{}),r(o))})};return t.nodes().forEach(r),t.nodeCount()},SI=function(t){var e=new EI.Graph({directed:!1}),r=t.nodes()[0],n=t.nodes().filter(function(o){return!!t.node(o)}).length;e.setNode(r,{});for(var a,i;VY(e,t)<n;)a=MI(e,t),i=e.hasNode(a.v)?(0,Vo.slack)(t,a):-(0,Vo.slack)(t,a),AI(e,t,i);return e};Ki.feasibleTreeWithLayer=SI;var VY=function(t,e){var r=function(n){var a;(a=e.nodeEdges(n))===null||a===void 0||a.forEach(function(i){var o=i.v,s=n===o?i.w:o;!t.hasNode(s)&&(e.node(s).layer!==void 0||!(0,Vo.slack)(e,i))&&(t.setNode(s,{}),t.setEdge(n,s,{}),r(s))})};return t.nodes().forEach(r),t.nodeCount()},MI=function(t,e){return(0,XY.minBy)(e.edges(),function(r){return t.hasNode(r.v)!==t.hasNode(r.w)?(0,Vo.slack)(e,r):1/0})},AI=function(t,e,r){t.nodes().forEach(function(n){e.node(n).rank||(e.node(n).rank=0),e.node(n).rank+=r})};Ki.default={feasibleTree:_I,feasibleTreeWithLayer:SI};var CI={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.exchangeEdges=t.enterEdge=t.leaveEdge=t.initLowLimValues=t.calcCutValue=t.initCutValues=void 0;var e=Ki,r=ba,n=Vn,a=Wd,i=a.algorithm.preorder,o=a.algorithm.postorder,s=function(b){var w=(0,n.simplify)(b);(0,r.longestPath)(w);var x=(0,e.feasibleTree)(w);(0,t.initLowLimValues)(x),(0,t.initCutValues)(x,w);for(var E,_;E=(0,t.leaveEdge)(x);)_=(0,t.enterEdge)(x,w,E),(0,t.exchangeEdges)(x,w,E,_)},u=function(b,w){var x=o(b,b.nodes());x=x==null?void 0:x.slice(0,(x==null?void 0:x.length)-1),x==null||x.forEach(function(E){f(b,w,E)})};t.initCutValues=u;var f=function(b,w,x){var E=b.node(x),_=E.parent;b.edgeFromArgs(x,_).cutvalue=(0,t.calcCutValue)(b,w,x)},l=function(b,w,x){var E,_=b.node(x),S=_.parent,A=!0,M=w.edgeFromArgs(x,S),C=0;return M||(A=!1,M=w.edgeFromArgs(S,x)),C=M.weight,(E=w.nodeEdges(x))===null||E===void 0||E.forEach(function(I){var k=I.v===x,O=k?I.w:I.v;if(O!==S){var B=k===A,L=w.edge(I).weight;if(C+=B?L:-L,y(b,x,O)){var z=b.edgeFromArgs(x,O).cutvalue;C+=B?-z:z}}}),C};t.calcCutValue=l;var c=function(b,w){w===void 0&&(w=b.nodes()[0]),h(b,{},1,w)};t.initLowLimValues=c;var h=function(b,w,x,E,_){var S,A=x,M=x,C=b.node(E);return w[E]=!0,(S=b.neighbors(E))===null||S===void 0||S.forEach(function(I){w[I]||(M=h(b,w,M,I,E))}),C.low=A,C.lim=M++,_?C.parent=_:delete C.parent,M},d=function(b){return b.edges().find(function(w){return b.edge(w).cutvalue<0})};t.leaveEdge=d;var v=function(b,w,x){var E=x.v,_=x.w;w.hasEdge(E,_)||(E=x.w,_=x.v);var S=b.node(E),A=b.node(_),M=S,C=!1;S.lim>A.lim&&(M=A,C=!0);var I=w.edges().filter(function(k){return C===m(b,b.node(k.v),M)&&C!==m(b,b.node(k.w),M)});return(0,n.minBy)(I,function(k){return(0,r.slack)(w,k)})};t.enterEdge=v;var p=function(b,w,x,E){var _=x.v,S=x.w;b.removeEdge(_,S),b.setEdge(E.v,E.w,{}),(0,t.initLowLimValues)(b),(0,t.initCutValues)(b,w),g(b,w)};t.exchangeEdges=p;var g=function(b,w){var x=b.nodes().find(function(_){var S;return!(!((S=w.node(_))===null||S===void 0)&&S.parent)}),E=i(b,x);E=E==null?void 0:E.slice(1),E==null||E.forEach(function(_){var S=b.node(_).parent,A=w.edgeFromArgs(_,S),M=!1;A||(A=w.edgeFromArgs(S,_),M=!0),w.node(_).rank=w.node(S).rank+(M?A.minlen:-A.minlen)})},y=function(b,w,x){return b.hasEdge(w,x)},m=function(b,w,x){return x.low<=w.lim&&w.lim<=x.lim};t.default=s})(CI);var YY=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(dm,"__esModule",{value:!0});var TI=ba,qY=Ki,HY=YY(CI),ZY=function(t){switch(t.graph().ranker){case"network-simplex":QY(t);break;case"tight-tree":jE(t);break;case"longest-path":KY(t);break;default:jE(t)}},KY=TI.longestPath,jE=function(t){(0,TI.longestPathWithLayer)(t),(0,qY.feasibleTreeWithLayer)(t)},QY=function(t){(0,HY.default)(t)};dm.default=ZY;var vm={};Object.defineProperty(vm,"__esModule",{value:!0});var JY=function(t){var e,r={},n=0,a=function(i){var o,s=n;(o=t.children(i))===null||o===void 0||o.forEach(a),r[i]={low:s,lim:n++}};return(e=t.children())===null||e===void 0||e.forEach(a),r},eq=function(t,e,r,n){var a=[],i=[],o=Math.min(e[r].low,e[n].low),s=Math.max(e[r].lim,e[n].lim),u,f;u=r;do u=t.parent(u),a.push(u);while(u&&(e[u].low>o||s>e[u].lim));for(f=u,u=n;u&&u!==f;)i.push(u),u=t.parent(u);return{lca:f,path:a.concat(i.reverse())}},tq=function(t){var e,r=JY(t);(e=t.graph().dummyChains)===null||e===void 0||e.forEach(function(n){var a,i,o=n,s=t.node(o),u=s.edgeObj;if(u)for(var f=eq(t,r,u.v,u.w),l=f.path,c=f.lca,h=0,d=l[h],v=!0;o!==u.w;){if(s=t.node(o),v){for(;d!==c&&((a=t.node(d))===null||a===void 0?void 0:a.maxRank)<s.rank;)h++,d=l[h];d===c&&(v=!1)}if(!v){for(;h<l.length-1&&((i=t.node(l[h+1]))===null||i===void 0?void 0:i.minRank)<=s.rank;)h++;d=l[h]}t.setParent(o,d),o=t.successors(o)[0]}})};vm.default=tq;var pm={};Object.defineProperty(pm,"__esModule",{value:!0});var Sg=Vn,rq=function(t){var e,r=(0,Sg.addDummyNode)(t,"root",{},"_root"),n=nq(t),a=Math.max.apply(Math,Object.values(n));Math.abs(a)===1/0&&(a=1);var i=a-1,o=2*i+1;t.graph().nestingRoot=r,t.edges().forEach(function(u){t.edge(u).minlen*=o});var s=aq(t)+1;(e=t.children())===null||e===void 0||e.forEach(function(u){II(t,r,o,s,i,n,u)}),t.graph().nodeRankFactor=o},II=function(t,e,r,n,a,i,o){var s=t.children(o);if(!(s!=null&&s.length)){o!==e&&t.setEdge(e,o,{weight:0,minlen:r});return}var u=(0,Sg.addBorderNode)(t,"_bt"),f=(0,Sg.addBorderNode)(t,"_bb"),l=t.node(o);t.setParent(u,o),l.borderTop=u,t.setParent(f,o),l.borderBottom=f,s==null||s.forEach(function(c){II(t,e,r,n,a,i,c);var h=t.node(c),d=h.borderTop?h.borderTop:c,v=h.borderBottom?h.borderBottom:c,p=h.borderTop?n:2*n,g=d!==v?1:a-i[o]+1;t.setEdge(u,d,{minlen:g,weight:p,nestingEdge:!0}),t.setEdge(v,f,{minlen:g,weight:p,nestingEdge:!0})}),t.parent(o)||t.setEdge(e,u,{weight:0,minlen:a+i[o]})},nq=function(t){var e,r={},n=function(a,i){var o=t.children(a);o==null||o.forEach(function(s){return n(s,i+1)}),r[a]=i};return(e=t.children())===null||e===void 0||e.forEach(function(a){return n(a,1)}),r},aq=function(t){var e=0;return t.edges().forEach(function(r){e+=t.edge(r).weight}),e},iq=function(t){var e=t.graph();e.nestingRoot&&t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(function(r){var n=t.edge(r);n.nestingEdge&&t.removeEdgeObj(r)})};pm.default={run:rq,cleanup:iq};var gm={};Object.defineProperty(gm,"__esModule",{value:!0});var oq=Vn,sq=function(t){var e,r=function(n){var a=t.children(n),i=t.node(n);if(a!=null&&a.length&&a.forEach(function(u){return r(u)}),i.hasOwnProperty("minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,s=i.maxRank+1;o<s;o+=1)UE(t,"borderLeft","_bl",n,i,o),UE(t,"borderRight","_br",n,i,o)}};(e=t.children())===null||e===void 0||e.forEach(function(n){return r(n)})},UE=function(t,e,r,n,a,i){var o={rank:i,borderType:e,width:0,height:0},s=a[e][i-1],u=(0,oq.addDummyNode)(t,"border",o,r);a[e][i]=u,t.setParent(u,n),s&&t.setEdge(s,u,{weight:1})};gm.default=sq;var ym={};Object.defineProperty(ym,"__esModule",{value:!0});var uq=function(t){var e,r=(e=t.graph().rankdir)===null||e===void 0?void 0:e.toLowerCase();(r==="lr"||r==="rl")&&kI(t)},fq=function(t){var e,r=(e=t.graph().rankdir)===null||e===void 0?void 0:e.toLowerCase();(r==="bt"||r==="rl")&&lq(t),(r==="lr"||r==="rl")&&(cq(t),kI(t))},kI=function(t){t.nodes().forEach(function(e){$E(t.node(e))}),t.edges().forEach(function(e){$E(t.edge(e))})},$E=function(t){var e=t.width;t.width=t.height,t.height=e},lq=function(t){t.nodes().forEach(function(e){Up(t.node(e))}),t.edges().forEach(function(e){var r,n=t.edge(e);(r=n.points)===null||r===void 0||r.forEach(function(a){return Up(a)}),n.hasOwnProperty("y")&&Up(n)})},Up=function(t){t!=null&&t.y&&(t.y=-t.y)},cq=function(t){t.nodes().forEach(function(e){$p(t.node(e))}),t.edges().forEach(function(e){var r,n=t.edge(e);(r=n.points)===null||r===void 0||r.forEach(function(a){return $p(a)}),n.hasOwnProperty("x")&&$p(n)})},$p=function(t){var e=t.x;t.x=t.y,t.y=e};ym.default={adjust:uq,undo:fq};var mm={},bm={};function NI(t){return[parseInt(t.substr(1,2),16),parseInt(t.substr(3,2),16),parseInt(t.substr(5,2),16)]}function Xp(t){var e=Math.round(t).toString(16);return e.length===1?"0".concat(e):e}function OI(t){return"#".concat(Xp(t[0])).concat(Xp(t[1])).concat(Xp(t[2]))}var Ln=function(t){return t!==null&&typeof t!="function"&&isFinite(t.length)},Zh=function(t,e){return Ln(t)?t.indexOf(e)>-1:!1},LI=function(t,e){if(!Ln(t))return t;for(var r=[],n=0;n<t.length;n++){var a=t[n];e(a,n)&&r.push(a)}return r},hq=function(t,e){return e===void 0&&(e=[]),LI(t,function(r){return!Zh(e,r)})};function ia(t){return typeof t=="function"}function no(t){return t==null}function Vr(t){return Array.isArray(t)}const Vd=function(t){var e=typeof t;return t!==null&&e==="object"||e==="function"};function iu(t,e){if(t){var r;if(Vr(t))for(var n=0,a=t.length;n<a&&(r=e(t[n],n),r!==!1);n++);else if(Vd(t)){for(var i in t)if(t.hasOwnProperty(i)&&(r=e(t[i],i),r===!1))break}}}var DI=Object.keys?function(t){return Object.keys(t)}:function(t){var e=[];return iu(t,function(r,n){ia(t)&&n==="prototype"||e.push(n)}),e};function PI(t,e){var r=DI(e),n=r.length;if(no(t))return!n;for(var a=0;a<n;a+=1){var i=r[a];if(e[i]!==t[i]||!(i in t))return!1}return!0}var Kh=function(t){return typeof t=="object"&&t!==null},dq={}.toString,mu=function(t,e){return dq.call(t)==="[object "+e+"]"},ou=function(t){if(!Kh(t)||!mu(t,"Object"))return!1;if(Object.getPrototypeOf(t)===null)return!0;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function vq(t,e){if(!Vr(t))return null;var r;if(ia(e)&&(r=e),ou(e)&&(r=function(a){return PI(a,e)}),r){for(var n=0;n<t.length;n+=1)if(r(t[n]))return t[n]}return null}function pq(t,e,r){r===void 0&&(r=0);for(var n=r;n<t.length;n++)if(e(t[n],n))return n;return-1}var gq=function(t,e){for(var r=null,n=0;n<t.length;n++){var a=t[n],i=a[e];if(!no(i)){Vr(i)?r=i[0]:r=i;break}}return r},yq=function(t){if(!Vr(t))return[];for(var e=[],r=0;r<t.length;r++)e=e.concat(t[r]);return e},RI=function(t,e){if(e===void 0&&(e=[]),!Vr(t))e.push(t);else for(var r=0;r<t.length;r+=1)RI(t[r],e);return e};function FI(t){if(!Array.isArray(t))return-1/0;var e=t.length;if(!e)return-1/0;for(var r=t[0],n=1;n<e;n++)r=Math.max(r,t[n]);return r}const BI=function(t){if(Vr(t))return t.reduce(function(e,r){return Math.min(e,r)},t[0])};var mq=function(t){var e=t.filter(function(o){return!isNaN(o)});if(!e.length)return{min:0,max:0};if(Vr(t[0])){for(var r=[],n=0;n<t.length;n++)r=r.concat(t[n]);e=r}var a=FI(e),i=BI(e);return{min:i,max:a}},GI=Array.prototype,bq=GI.splice,wq=GI.indexOf,xq=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n++)for(var a=e[n],i=-1;(i=wq.call(t,a))>-1;)bq.call(t,i,1);return t},Eq=Array.prototype.splice,zI=function(e,r){if(!Ln(e))return[];for(var n=e?r.length:0,a=n-1;n--;){var i=void 0,o=r[n];(n===a||o!==i)&&(i=o,Eq.call(e,o,1))}return e},jI=function(t,e,r){if(!Vr(t)&&!ou(t))return t;var n=r;return iu(t,function(a,i){n=e(n,a,i)}),n},_q=function(t,e){var r=[];if(!Ln(t))return r;for(var n=-1,a=[],i=t.length;++n<i;){var o=t[n];e(o,n,t)&&(r.push(o),a.push(n))}return zI(t,a),r};function Qi(t){return typeof t=="string"}function Sq(t,e){var r;if(ia(e))r=function(a,i){return e(a)-e(i)};else{var n=[];Qi(e)?n.push(e):Vr(e)&&(n=e),r=function(a,i){for(var o=0;o<n.length;o+=1){var s=n[o];if(a[s]>i[s])return 1;if(a[s]<i[s])return-1}return 0}}return t.sort(r),t}function UI(t,e){e===void 0&&(e=new Map);var r=[];if(Array.isArray(t))for(var n=0,a=t.length;n<a;n++){var i=t[n];e.has(i)||(r.push(i),e.set(i,!0))}return r}var Mq=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return UI([].concat.apply([],t))};const Aq=function(t,e){for(var r=[],n={},a=0;a<t.length;a++){var i=t[a],o=i[e];if(!no(o)){Vr(o)||(o=[o]);for(var s=0;s<o.length;s++){var u=o[s];n[u]||(r.push(u),n[u]=!0)}}}return r};function Cq(t){if(Ln(t))return t[0]}function Tq(t){if(Ln(t)){var e=t;return e[e.length-1]}}function Iq(t,e){return Vr(t)||Qi(t)?t[0]===e:!1}function kq(t,e){return Vr(t)||Qi(t)?t[t.length-1]===e:!1}var Nq=function(t,e){for(var r=0;r<t.length;r++)if(!e(t[r],r))return!1;return!0},Oq=function(t,e){for(var r=0;r<t.length;r++)if(e(t[r],r))return!0;return!1},Lq=Object.prototype.hasOwnProperty;function $I(t,e){if(!e||!Vr(t))return{};for(var r={},n=ia(e)?e:function(s){return s[e]},a,i=0;i<t.length;i++){var o=t[i];a=n(o),Lq.call(r,a)?r[a].push(o):r[a]=[o]}return r}function XI(t,e){if(!e)return{0:t};if(!ia(e)){var r=Vr(e)?e:e.replace(/\s+/g,"").split("*");e=function(n){for(var a="_",i=0,o=r.length;i<o;i++)a+=n[r[i]]&&n[r[i]].toString();return a}}return $I(t,e)}const Dq=function(t,e){if(!e)return[t];var r=XI(t,e),n=[];for(var a in r)n.push(r[a]);return n};function Pq(t,e){return t["_wrap_"+e]}function Rq(t,e){if(t["_wrap_"+e])return t["_wrap_"+e];var r=function(n){t[e](n)};return t["_wrap_"+e]=r,r}var XE={};function Fq(t){var e=XE[t];if(!e){for(var r=t.toString(16),n=r.length;n<6;n++)r="0"+r;e="#"+r,XE[t]=e}return e}function Bq(t){var e=0,r=0,n=0,a=0;return Vr(t)?t.length===1?e=r=n=a=t[0]:t.length===2?(e=n=t[0],r=a=t[1]):t.length===3?(e=t[0],r=a=t[1],n=t[2]):(e=t[0],r=t[1],n=t[2],a=t[3]):e=r=n=a=t,{r1:e,r2:r,r3:n,r4:a}}var Gq=function(t,e,r){return t<e?e:t>r?r:t},zq=function(t,e){var r=e.toString(),n=r.indexOf(".");if(n===-1)return Math.round(t);var a=r.substr(n+1).length;return a>20&&(a=20),parseFloat(t.toFixed(a))};function xi(t){return typeof t=="number"}function jq(t){return xi(t)&&t%1!==0}function Uq(t){return xi(t)&&t%2===0}function $q(t){return xi(t)&&t%1===0}function Xq(t){return xi(t)&&t<0}var Wq=1e-5;function Vq(t,e,r){return r===void 0&&(r=Wq),t===e||Math.abs(t-e)<r}function Yq(t){return xi(t)&&t%2!==0}var qq=function(t){return xi(t)&&t>0};const Hq=function(t,e){if(Vr(t)){for(var r,n=-1/0,a=0;a<t.length;a++){var i=t[a],o=ia(e)?e(i):i[e];o>n&&(r=i,n=o)}return r}},Zq=function(t,e){if(Vr(t)){for(var r,n=1/0,a=0;a<t.length;a++){var i=t[a],o=ia(e)?e(i):i[e];o<n&&(r=i,n=o)}return r}};var Kq=function(t,e){return(t%e+e)%e},Qq=180/Math.PI,Jq=function(t){return Qq*t};const eH=parseInt;var tH=Math.PI/180,rH=function(t){return tH*t};const WE=function(t,e){return t.hasOwnProperty(e)};var WI=Object.values?function(t){return Object.values(t)}:function(t){var e=[];return iu(t,function(r,n){ia(t)&&n==="prototype"||e.push(r)}),e};const nH=function(t,e){return Zh(WI(t),e)},hl=function(t){return no(t)?"":t.toString()};var aH=function(t){return hl(t).toLowerCase()},iH=function(t){var e=hl(t);return e.charAt(0).toLowerCase()+e.substring(1)};function oH(t,e){return!t||!e?t:t.replace(/\\?\{([^{}]+)\}/g,function(r,n){return r.charAt(0)==="\\"?r.slice(1):e[n]===void 0?"":e[n]})}var sH=function(t){return hl(t).toUpperCase()},uH=function(t){var e=hl(t);return e.charAt(0).toUpperCase()+e.substring(1)},fH={}.toString,VI=function(t){return fH.call(t).replace(/^\[object /,"").replace(/]$/,"")},lH=function(t){return mu(t,"Arguments")},cH=function(t){return mu(t,"Boolean")};function hH(t){return t instanceof Date}var dH=function(t){return mu(t,"Error")};function vH(t){return xi(t)&&isFinite(t)}function pH(t){return t===null}var gH=Object.prototype,YI=function(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||gH;return t===r},yH=function(t){return mu(t,"RegExp")},mH=function(t){return t===void 0};function bH(t){return t instanceof Element||t instanceof Document}function wH(t){var e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(r){return setTimeout(r,16)};return e(t)}function xH(t){var e=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;e(t)}function Wp(t,e){for(var r in e)e.hasOwnProperty(r)&&r!=="constructor"&&e[r]!==void 0&&(t[r]=e[r])}function Ws(t,e,r,n){return e&&Wp(t,e),r&&Wp(t,r),n&&Wp(t,n),t}var EH=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=t[0],n=1;n<t.length;n++){var a=t[n];ia(a)&&(a=a.prototype),Ws(r.prototype,a)}},Mg=function(t){if(typeof t!="object"||t===null)return t;var e;if(Vr(t)){e=[];for(var r=0,n=t.length;r<n;r++)typeof t[r]=="object"&&t[r]!=null?e[r]=Mg(t[r]):e[r]=t[r]}else{e={};for(var a in t)typeof t[a]=="object"&&t[a]!=null?e[a]=Mg(t[a]):e[a]=t[a]}return e};function _H(t,e,r){var n;return function(){var a=this,i=arguments,o=function(){n=null,r||t.apply(a,i)},s=r&&!n;clearTimeout(n),n=setTimeout(o,e),s&&t.apply(a,i)}}function SH(t){var e,r,n,a=t||1;function i(s,u){++e>a&&(n=r,o(1),++e),r[s]=u}function o(s){e=0,r=Object.create(null),s||(n=Object.create(null))}return o(),{clear:o,has:function(s){return r[s]!==void 0||n[s]!==void 0},get:function(s){var u=r[s];if(u!==void 0)return u;if((u=n[s])!==void 0)return i(s,u),u},set:function(s,u){r[s]!==void 0?r[s]=u:i(s,u)}}}var Vp=new Map;function qI(t,e,r){r===void 0&&(r=128);var n=function(){for(var a=[],i=0;i<arguments.length;i++)a[i]=arguments[i];var o=e?e.apply(this,a):a[0];Vp.has(t)||Vp.set(t,SH(r));var s=Vp.get(t);if(s.has(o))return s.get(o);var u=t.apply(this,a);return s.set(o,u),u};return n}var MH=5;function AH(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(t==null)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function HI(t,e,r,n){r=r||0,n=n||MH;for(var a in e)if(AH(e,a)){var i=e[a];i!==null&&ou(i)?(ou(t[a])||(t[a]={}),r<n?HI(t[a],i,r+1,n):t[a]=e[a]):Vr(i)?(t[a]=[],t[a]=t[a].concat(i)):i!==void 0&&(t[a]=i)}}var CH=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)HI(t,e[n]);return t},TH=function(t,e,r,n){ia(e)||(r=e,e=t,t=function(){});var a=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},i=a(e.prototype,t);return t.prototype=Ws(i,t.prototype),t.superclass=a(e.prototype,e),Ws(i,r),Ws(t,n),t},IH=function(t,e){if(!Ln(t))return-1;var r=Array.prototype.indexOf;if(r)return r.call(t,e);for(var n=-1,a=0;a<t.length;a++)if(t[a]===e){n=a;break}return n},kH=Object.prototype.hasOwnProperty;function NH(t){if(no(t))return!0;if(Ln(t))return!t.length;var e=VI(t);if(e==="Map"||e==="Set")return!t.size;if(YI(t))return!Object.keys(t).length;for(var r in t)if(kH.call(t,r))return!1;return!0}var Qh=function(t,e){if(t===e)return!0;if(!t||!e||Qi(t)||Qi(e))return!1;if(Ln(t)||Ln(e)){if(t.length!==e.length)return!1;for(var r=!0,n=0;n<t.length&&(r=Qh(t[n],e[n]),!!r);n++);return r}if(Kh(t)||Kh(e)){var a=Object.keys(t),i=Object.keys(e);if(a.length!==i.length)return!1;for(var r=!0,n=0;n<a.length&&(r=Qh(t[a[n]],e[a[n]]),!!r);n++);return r}return!1};const OH=function(t,e,r){return ia(r)?!!r(t,e):Qh(t,e)};var LH=function(t,e){if(!Ln(t))return t;for(var r=[],n=0;n<t.length;n++){var a=t[n];r.push(e(a,n))}return r},DH=function(t){return t};const PH=function(t,e){e===void 0&&(e=DH);var r={};return Vd(t)&&!no(t)&&Object.keys(t).forEach(function(n){r[n]=e(t[n],n)}),r},RH=function(t,e,r){for(var n=0,a=Qi(e)?e.split("."):e;t&&n<a.length;)t=t[a[n++]];return t===void 0||n<a.length?r:t},FH=function(t,e,r){var n=t,a=Qi(e)?e.split("."):e;return a.forEach(function(i,o){o<a.length-1?(Vd(n[i])||(n[i]=xi(a[o+1])?[]:{}),n=n[i]):n[i]=r}),t};var BH=Object.prototype.hasOwnProperty;const GH=function(t,e){if(t===null||!ou(t))return{};var r={};return iu(e,function(n){BH.call(t,n)&&(r[n]=t[n])}),r},zH=function(t,e){return jI(t,function(r,n,a){return e.includes(a)||(r[a]=n),r},{})},jH=function(t,e,r){var n,a,i,o,s=0;r||(r={});var u=function(){s=r.leading===!1?0:Date.now(),n=null,o=t.apply(a,i),n||(a=i=null)},f=function(){var l=Date.now();!s&&r.leading===!1&&(s=l);var c=e-(l-s);return a=this,i=arguments,c<=0||c>e?(n&&(clearTimeout(n),n=null),s=l,o=t.apply(a,i),n||(a=i=null)):!n&&r.trailing!==!1&&(n=setTimeout(u,c)),o};return f.cancel=function(){clearTimeout(n),s=0,n=a=i=null},f},UH=function(t){return Ln(t)?Array.prototype.slice.call(t):[]};var Lc={};const $H=function(t){return t=t||"g",Lc[t]?Lc[t]+=1:Lc[t]=1,t+Lc[t]},XH=function(){},WH=function(t){return t};function VH(t){return no(t)?0:Ln(t)?t.length:Object.keys(t).length}var YH=function(){function t(){this.map={}}return t.prototype.has=function(e){return this.map[e]!==void 0},t.prototype.get=function(e,r){var n=this.map[e];return n===void 0?r:n},t.prototype.set=function(e,r){this.map[e]=r},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(e){delete this.map[e]},t.prototype.size=function(){return Object.keys(this.map).length},t}(),qH=/rgba?\(([\s.,0-9]+)\)/;function HH(){var t=document.getElementById("antv-web-colour-picker");return t||(t=document.createElement("i"),t.id="antv-web-colour-picker",t.title="Web Colour Picker",t.style.display="none",document.body.appendChild(t),t)}function ZH(t){if(t[0]==="#"&&t.length===7)return t;var e=HH();e.style.color=t;var r=document.defaultView.getComputedStyle(e,"").getPropertyValue("color"),n=qH.exec(r),a=n[1].split(/\s*,\s*/).map(function(i){return Number(i)});return r=OI(a),r}var ZI=qI(ZH,function(t){return t},256);function Yp(t,e,r,n){return t[n]+(e[n]-t[n])*r}function KH(t,e){var r=isNaN(Number(e))||e<0?0:e>1?1:Number(e),n=t.length-1,a=Math.floor(n*r),i=n*r-a,o=t[a],s=a===n?o:t[a+1];return OI([Yp(o,s,i,0),Yp(o,s,i,1),Yp(o,s,i,2)])}function QH(t){var e=typeof t=="string"?t.split("-"):t,r=e.map(function(n){return NI(n.indexOf("#")===-1?ZI(n):n)});return function(n){return KH(r,n)}}var JH=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,eZ=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,tZ=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function rZ(t){return/^[r,R,L,l]{1}[\s]*\(/.test(t)}function nZ(t){if(rZ(t)){var e,r=void 0;if(t[0]==="l"){var n=JH.exec(t),a=+n[1]+90;r=n[2],e="linear-gradient(".concat(a,"deg, ")}else if(t[0]==="r"){e="radial-gradient(";var n=eZ.exec(t);r=n[4]}var i=r.match(tZ);return i.forEach(function(o,s){var u=o.split(":");e+="".concat(u[1]," ").concat(Number(u[0])*100,"%"),s!==i.length-1&&(e+=", ")}),e+=")",e}return t}function aZ(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return uy(n,r),Qa(t,n,e)}function iZ(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return fy(n,r),Qa(t,n,e)}function oZ(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return ly(n,r),Qa(t,n,e)}function sZ(t,e,r){return Qa(t,r,e)}function uZ(t,e){for(var r=t?[].concat(t):[1,0,0,0,1,0,0,0,1],n=0,a=e.length;n<a;n++){var i=e[n];switch(i[0]){case"t":aZ(r,r,[i[1],i[2]]);break;case"s":oZ(r,r,[i[1],i[2]]);break;case"r":iZ(r,r,i[1]);break;case"m":sZ(r,r,i[1]);break}}return r}function KI(t,e){return t[0]*e[1]-e[0]*t[1]}function fZ(t,e,r){var n=sA(t,e),a=KI(t,e)>=0;return r?a?Math.PI*2-n:n:a?n:Math.PI*2-n}function lZ(t,e,r){return r?(t[0]=e[1],t[1]=-1*e[0]):(t[0]=-1*e[1],t[1]=e[0]),t}function cZ(t,e){if(e==="off")return[].concat(t);var r=typeof e=="number"&&e>=1?Math.pow(10,e):1;return t.map(function(n){var a=n.slice(1).map(Number).map(function(i){return e?Math.round(i*r)/r:Math.round(i)});return[n[0]].concat(a)})}function hZ(t,e){return e===void 0&&(e="off"),cZ(t,e).map(function(r){return r[0]+r.slice(1).join(" ")}).join("")}var QI={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function dZ(t,e,r){if(t[r].length>7){t[r].shift();for(var n=t[r],a=r;n.length;)e[r]="A",t.splice(a+=1,0,["C"].concat(n.splice(0,6)));t.splice(r,1)}}var Af={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function JI(t){return Array.isArray(t)&&t.every(function(e){var r=e[0].toLowerCase();return Af[r]===e.length-1&&"achlmqstvz".includes(r)})}function ek(t){return JI(t)&&t.every(function(e){var r=e[0];return r===r.toUpperCase()})}function tk(t){return ek(t)&&t.every(function(e){var r=e[0];return"ACLMQZ".includes(r)})}function VE(t){for(var e=t.pathValue[t.segmentStart],r=e.toLowerCase(),n=t.data;n.length>=Af[r]&&(r==="m"&&n.length>2?(t.segments.push([e].concat(n.splice(0,2))),r="l",e=e==="m"?"l":"L"):t.segments.push([e].concat(n.splice(0,Af[r]))),!!Af[r]););}function vZ(t){var e=t.index,r=t.pathValue,n=r.charCodeAt(e);if(n===48){t.param=0,t.index+=1;return}if(n===49){t.param=1,t.index+=1;return}t.err='[path-util]: invalid Arc flag "'.concat(r[e],'", expecting 0 or 1 at index ').concat(e)}function pZ(t){return t>=48&&t<=57||t===43||t===45||t===46}function Ss(t){return t>=48&&t<=57}function gZ(t){var e=t.max,r=t.pathValue,n=t.index,a=n,i=!1,o=!1,s=!1,u=!1,f;if(a>=e){t.err="[path-util]: Invalid path value at index ".concat(a,', "pathValue" is missing param');return}if(f=r.charCodeAt(a),(f===43||f===45)&&(a+=1,f=r.charCodeAt(a)),!Ss(f)&&f!==46){t.err="[path-util]: Invalid path value at index ".concat(a,', "').concat(r[a],'" is not a number');return}if(f!==46){if(i=f===48,a+=1,f=r.charCodeAt(a),i&&a<e&&f&&Ss(f)){t.err="[path-util]: Invalid path value at index ".concat(n,', "').concat(r[n],'" illegal number');return}for(;a<e&&Ss(r.charCodeAt(a));)a+=1,o=!0;f=r.charCodeAt(a)}if(f===46){for(u=!0,a+=1;Ss(r.charCodeAt(a));)a+=1,s=!0;f=r.charCodeAt(a)}if(f===101||f===69){if(u&&!o&&!s){t.err="[path-util]: Invalid path value at index ".concat(a,', "').concat(r[a],'" invalid float exponent');return}if(a+=1,f=r.charCodeAt(a),(f===43||f===45)&&(a+=1),a<e&&Ss(r.charCodeAt(a)))for(;a<e&&Ss(r.charCodeAt(a));)a+=1;else{t.err="[path-util]: Invalid path value at index ".concat(a,', "').concat(r[a],'" invalid integer exponent');return}}t.index=a,t.param=+t.pathValue.slice(n,a)}function yZ(t){var e=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];return t===10||t===13||t===8232||t===8233||t===32||t===9||t===11||t===12||t===160||t>=5760&&e.includes(t)}function dh(t){for(var e=t.pathValue,r=t.max;t.index<r&&yZ(e.charCodeAt(t.index));)t.index+=1}function mZ(t){switch(t|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 bZ(t){return(t|32)===97}function wZ(t){var e=t.max,r=t.pathValue,n=t.index,a=r.charCodeAt(n),i=Af[r[n].toLowerCase()];if(t.segmentStart=n,!mZ(a)){t.err='[path-util]: Invalid path value "'.concat(r[n],'" is not a path command');return}if(t.index+=1,dh(t),t.data=[],!i){VE(t);return}for(;;){for(var o=i;o>0;o-=1){if(bZ(a)&&(o===3||o===4)?vZ(t):gZ(t),t.err.length)return;t.data.push(t.param),dh(t),t.index<e&&r.charCodeAt(t.index)===44&&(t.index+=1,dh(t))}if(t.index>=t.max||!pZ(r.charCodeAt(t.index)))break}VE(t)}var xZ=function(){function t(e){this.pathValue=e,this.segments=[],this.max=e.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return t}();function Yd(t){if(JI(t))return[].concat(t);var e=new xZ(t);for(dh(e);e.index<e.max&&!e.err.length;)wZ(e);return e.err?e.err:e.segments}function rk(t){if(ek(t))return[].concat(t);var e=Yd(t),r=0,n=0,a=0,i=0;return e.map(function(o){var s=o.slice(1).map(Number),u=o[0],f=u.toUpperCase();if(u==="M")return r=s[0],n=s[1],a=r,i=n,["M",r,n];var l;if(u!==f)switch(f){case"A":l=[f,s[0],s[1],s[2],s[3],s[4],s[5]+r,s[6]+n];break;case"V":l=[f,s[0]+n];break;case"H":l=[f,s[0]+r];break;default:{var c=s.map(function(d,v){return d+(v%2?n:r)});l=[f].concat(c)}}else l=[f].concat(s);var h=l.length;switch(f){case"Z":r=a,n=i;break;case"H":r=l[1];break;case"V":n=l[1];break;default:r=l[h-2],n=l[h-1],f==="M"&&(a=r,i=n)}return l})}function EZ(t,e){var r=t[0],n=e.x1,a=e.y1,i=e.x2,o=e.y2,s=t.slice(1).map(Number),u=t;if("TQ".includes(r)||(e.qx=null,e.qy=null),r==="H")u=["L",t[1],a];else if(r==="V")u=["L",n,t[1]];else if(r==="S"){var f=n*2-i,l=a*2-o;e.x1=f,e.y1=l,u=["C",f,l].concat(s)}else if(r==="T"){var c=n*2-e.qx,h=a*2-e.qy;e.qx=c,e.qy=h,u=["Q",c,h].concat(s)}else if(r==="Q"){var d=s[0],v=s[1];e.qx=d,e.qy=v}return u}function qd(t){if(tk(t))return[].concat(t);for(var e=rk(t),r=P({},QI),n=0;n<e.length;n+=1){e[n]=EZ(e[n],r);var a=e[n],i=a.length;r.x1=+a[i-2],r.y1=+a[i-1],r.x2=+a[i-4]||r.x1,r.y2=+a[i-3]||r.y1}return e}function _Z(t){return tk(t)&&t.every(function(e){var r=e[0];return"MC".includes(r)})}function Dc(t,e,r){var n=t*Math.cos(r)-e*Math.sin(r),a=t*Math.sin(r)+e*Math.cos(r);return{x:n,y:a}}function wm(t,e,r,n,a,i,o,s,u,f){var l=t,c=e,h=r,d=n,v=s,p=u,g=Math.PI*120/180,y=Math.PI/180*(+a||0),m=[],b,w,x,E,_;if(f)w=f[0],x=f[1],E=f[2],_=f[3];else{b=Dc(l,c,-y),l=b.x,c=b.y,b=Dc(v,p,-y),v=b.x,p=b.y;var S=(l-v)/2,A=(c-p)/2,M=S*S/(h*h)+A*A/(d*d);M>1&&(M=Math.sqrt(M),h*=M,d*=M);var C=h*h,I=d*d,k=(i===o?-1:1)*Math.sqrt(Math.abs((C*I-C*A*A-I*S*S)/(C*A*A+I*S*S)));E=k*h*A/d+(l+v)/2,_=k*-d*S/h+(c+p)/2,w=Math.asin(((c-_)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),x=Math.asin(((p-_)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),w=l<E?Math.PI-w:w,x=v<E?Math.PI-x:x,w<0&&(w=Math.PI*2+w),x<0&&(x=Math.PI*2+x),o&&w>x&&(w-=Math.PI*2),!o&&x>w&&(x-=Math.PI*2)}var O=x-w;if(Math.abs(O)>g){var B=x,L=v,z=p;x=w+g*(o&&x>w?1:-1),v=E+h*Math.cos(x),p=_+d*Math.sin(x),m=wm(v,p,h,d,a,0,o,L,z,[x,B,E,_])}O=x-w;var X=Math.cos(w),R=Math.sin(w),V=Math.cos(x),he=Math.sin(x),ce=Math.tan(O/4),le=4/3*h*ce,ie=4/3*d*ce,Ie=[l,c],qe=[l+le*R,c-ie*X],Ve=[v+le*he,p-ie*V],it=[v,p];if(qe[0]=2*Ie[0]-qe[0],qe[1]=2*Ie[1]-qe[1],f)return qe.concat(Ve,it,m);m=qe.concat(Ve,it,m);for(var dt=[],st=0,Tt=m.length;st<Tt;st+=1)dt[st]=st%2?Dc(m[st-1],m[st],y).y:Dc(m[st],m[st+1],y).x;return dt}function SZ(t,e,r,n,a,i){var o=.3333333333333333,s=2/3;return[o*t+s*r,o*e+s*n,o*a+s*r,o*i+s*n,a,i]}function zi(t,e,r){var n=t[0],a=t[1],i=e[0],o=e[1];return[n+(i-n)*r,a+(o-a)*r]}var YE=function(t,e,r,n){var a=.5,i=zi([t,e],[r,n],a);return Xn(Xn([],i,!0),[r,n,r,n],!1)};function MZ(t,e){var r=t[0],n=t.slice(1).map(Number),a=n[0],i=n[1],o,s=e.x1,u=e.y1,f=e.x,l=e.y;switch("TQ".includes(r)||(e.qx=null,e.qy=null),r){case"M":return e.x=a,e.y=i,t;case"A":return o=[s,u].concat(n),["C"].concat(wm(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=a,e.qy=i,o=[s,u].concat(n),["C"].concat(SZ(o[0],o[1],o[2],o[3],o[4],o[5]));case"L":return["C"].concat(YE(s,u,a,i));case"Z":return s===f&&u===l?["C",s,u,f,l,f,l]:["C"].concat(YE(s,u,f,l))}return t}function nk(t,e){if(e===void 0&&(e=!1),_Z(t)){var r=[].concat(t);return e?[r,[]]:r}for(var n=qd(t),a=P({},QI),i=[],o="",s=n.length,u,f,l=[],c=0;c<s;c+=1){n[c]&&(o=n[c][0]),i[c]=o;var h=MZ(n[c],a);n[c]=h,dZ(n,i,c),s=n.length,o==="Z"&&l.push(c),u=n[c],f=u.length,a.x1=+u[f-2],a.y1=+u[f-1],a.x2=+u[f-4]||a.x1,a.y2=+u[f-3]||a.y1}return e?[n,l]:n}function AZ(t){return Yd(t)}function CZ(t){return t.map(function(e){return Array.isArray(e)?[].concat(e):e})}function TZ(t){var e=t.slice(1).map(function(r,n,a){return n?a[n-1].slice(-2).concat(r.slice(1)):t[0].slice(1).concat(r.slice(1))}).map(function(r){return r.map(function(n,a){return r[r.length-a-2*(1-a%2)]})}).reverse();return[["M"].concat(e[0].slice(0,2))].concat(e.map(function(r){return["C"].concat(r.slice(2))}))}function bu(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function Ag(t,e,r,n,a){var i=bu([t,e],[r,n]),o={x:0,y:0};if(typeof a=="number")if(a<=0)o={x:t,y:e};else if(a>=i)o={x:r,y:n};else{var s=zi([t,e],[r,n],a/i),u=s[0],f=s[1];o={x:u,y:f}}return{length:i,point:o,min:{x:Math.min(t,r),y:Math.min(e,n)},max:{x:Math.max(t,r),y:Math.max(e,n)}}}function qE(t,e){var r=t.x,n=t.y,a=e.x,i=e.y,o=r*a+n*i,s=Math.sqrt((Math.pow(r,2)+Math.pow(n,2))*(Math.pow(a,2)+Math.pow(i,2))),u=r*i-n*a<0?-1:1,f=u*Math.acos(o/s);return f}function IZ(t,e,r,n,a,i,o,s,u,f){var l=Math.abs,c=Math.sin,h=Math.cos,d=Math.sqrt,v=Math.PI,p=l(r),g=l(n),y=(a%360+360)%360,m=y*(v/180);if(t===s&&e===u)return{x:t,y:e};if(p===0||g===0)return Ag(t,e,s,u,f).point;var b=(t-s)/2,w=(e-u)/2,x={x:h(m)*b+c(m)*w,y:-c(m)*b+h(m)*w},E=Math.pow(x.x,2)/Math.pow(p,2)+Math.pow(x.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(x.y,2)-Math.pow(g,2)*Math.pow(x.x,2),S=Math.pow(p,2)*Math.pow(x.y,2)+Math.pow(g,2)*Math.pow(x.x,2),A=_/S;A=A<0?0:A;var M=(i!==o?1:-1)*d(A),C={x:M*(p*x.y/g),y:M*(-(g*x.x)/p)},I={x:h(m)*C.x-c(m)*C.y+(t+s)/2,y:c(m)*C.x+h(m)*C.y+(e+u)/2},k={x:(x.x-C.x)/p,y:(x.y-C.y)/g},O=qE({x:1,y:0},k),B={x:(-x.x-C.x)/p,y:(-x.y-C.y)/g},L=qE(k,B);!o&&L>0?L-=2*v:o&&L<0&&(L+=2*v),L%=2*v;var z=O+L*f,X=p*h(z),R=g*c(z),V={x:h(m)*X-c(m)*R+I.x,y:c(m)*X+h(m)*R+I.y};return V}function kZ(t,e,r,n,a,i,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=t,w=e,x=0,E=[b,w,x],_=[b,w],S=0,A={x:0,y:0},M=[{x:b,y:w}];m&&f<=0&&(A={x:b,y:w});for(var C=0;C<=y;C+=1){if(S=C/y,c=IZ(t,e,r,n,a,i,o,s,u,S),b=c.x,w=c.y,d&&M.push({x:b,y:w}),p&&(x+=bu(_,[b,w])),_=[b,w],m&&x>=f&&f>E[2]){var I=(x-f)/(x-E[2]);A={x:_[0]*(1-I)+E[0]*I,y:_[1]*(1-I)+E[1]*I}}E=[b,w,x]}return m&&f>=x&&(A={x:s,y:u}),{length:x,point:A,min:{x:Math.min.apply(null,M.map(function(k){return k.x})),y:Math.min.apply(null,M.map(function(k){return k.y}))},max:{x:Math.max.apply(null,M.map(function(k){return k.x})),y:Math.max.apply(null,M.map(function(k){return k.y}))}}}function NZ(t,e,r,n,a,i,o,s,u){var f=1-u;return{x:Math.pow(f,3)*t+3*Math.pow(f,2)*u*r+3*f*Math.pow(u,2)*a+Math.pow(u,3)*o,y:Math.pow(f,3)*e+3*Math.pow(f,2)*u*n+3*f*Math.pow(u,2)*i+Math.pow(u,3)*s}}function ak(t,e,r,n,a,i,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=t,b=e,w=0,x=[m,b,w],E=[m,b],_=0,S={x:0,y:0},A=[{x:m,y:b}];y&&u<=0&&(S={x:m,y:b});for(var M=0;M<=g;M+=1){if(_=M/g,l=NZ(t,e,r,n,a,i,o,s,_),m=l.x,b=l.y,h&&A.push({x:m,y:b}),v&&(w+=bu(E,[m,b])),E=[m,b],y&&w>=u&&u>x[2]){var C=(w-u)/(w-x[2]);S={x:E[0]*(1-C)+x[0]*C,y:E[1]*(1-C)+x[1]*C}}x=[m,b,w]}return y&&u>=w&&(S={x:o,y:s}),{length:w,point:S,min:{x:Math.min.apply(null,A.map(function(I){return I.x})),y:Math.min.apply(null,A.map(function(I){return I.y}))},max:{x:Math.max.apply(null,A.map(function(I){return I.x})),y:Math.max.apply(null,A.map(function(I){return I.y}))}}}function OZ(t,e,r,n,a,i,o){var s=1-o;return{x:Math.pow(s,2)*t+2*s*o*r+Math.pow(o,2)*a,y:Math.pow(s,2)*e+2*s*o*n+Math.pow(o,2)*i}}function LZ(t,e,r,n,a,i,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=t,y=e,m=0,b=[g,y,m],w=[g,y],x=0,E={x:0,y:0},_=[{x:g,y}];p&&o<=0&&(E={x:g,y});for(var S=0;S<=v;S+=1){if(x=S/v,u=OZ(t,e,r,n,a,i,x),g=u.x,y=u.y,l&&_.push({x:g,y}),h&&(m+=bu(w,[g,y])),w=[g,y],p&&m>=o&&o>b[2]){var A=(m-o)/(m-b[2]);E={x:w[0]*(1-A)+b[0]*A,y:w[1]*(1-A)+b[1]*A}}b=[g,y,m]}return p&&o>=m&&(E={x:a,y:i}),{length:m,point:E,min:{x:Math.min.apply(null,_.map(function(M){return M.x})),y:Math.min.apply(null,_.map(function(M){return M.y}))},max:{x:Math.max.apply(null,_.map(function(M){return M.x})),y:Math.max.apply(null,_.map(function(M){return M.y}))}}}function Hd(t,e,r){for(var n,a,i,o,s,u,f=qd(t),l=typeof e=="number",c,h=[],d,v=0,p=0,g=0,y=0,m,b=[],w=[],x=0,E={x:0,y:0},_=E,S=E,A=E,M=0,C=0,I=f.length;C<I;C+=1)m=f[C],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,x=0,l&&e<.001&&(A=E)):d==="L"?(n=Ag(h[0],h[1],h[2],h[3],(e||0)-M),x=n.length,E=n.min,_=n.max,S=n.point):d==="A"?(a=kZ(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],(e||0)-M,r||{}),x=a.length,E=a.min,_=a.max,S=a.point):d==="C"?(i=ak(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],(e||0)-M,r||{}),x=i.length,E=i.min,_=i.max,S=i.point):d==="Q"?(o=LZ(h[0],h[1],h[2],h[3],h[4],h[5],(e||0)-M,r||{}),x=o.length,E=o.min,_=o.max,S=o.point):d==="Z"&&(h=[v,p,g,y],s=Ag(h[0],h[1],h[2],h[3],(e||0)-M),x=s.length,E=s.min,_=s.max,S=s.point),l&&M<e&&M+x>=e&&(A=S),w.push(_),b.push(E),M+=x,u=d!=="Z"?m.slice(-2):[g,y],v=u[0],p=u[1];return l&&e>=M&&(A={x:v,y:p}),{length:M,point:A,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,w.map(function(k){return k.x})),y:Math.max.apply(null,w.map(function(k){return k.y}))}}}function DZ(t,e){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var r=Hd(t,void 0,P(P({},e),{length:!1})),n=r.min,a=n.x,i=n.y,o=r.max,s=o.x,u=o.y,f=s-a,l=u-i;return{width:f,height:l,x:a,y:i,x2:s,y2:u,cx:a+f/2,cy:i+l/2,cz:Math.max(f,l)+Math.min(f,l)/2}}function Cf(t,e){return Hd(t,void 0,P(P({},e),{bbox:!1,length:!0})).length}function PZ(t,e){if(!t)return{length:0,x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var r=Hd(t,void 0,P(P({},e),{bbox:!0,length:!0})),n=r.length,a=r.min,i=a.x,o=a.y,s=r.max,u=s.x,f=s.y,l=u-i,c=f-o;return{length:n,width:l,height:c,x:i,y:o,x2:u,y2:f,cx:i+l/2,cy:o+c/2,cz:Math.max(l,c)+Math.min(l,c)/2}}function RZ(t){var e=t.length,r=e-1;return t.map(function(n,a){return t.map(function(i,o){var s=a+o,u;return o===0||t[s]&&t[s][0]==="M"?(u=t[s],["M"].concat(u.slice(-2))):(s>=e&&(s-=r),t[s])})})}function FZ(t,e){var r=t.length-1,n=[],a=0,i=0,o=RZ(t);return o.forEach(function(s,u){t.slice(1).forEach(function(f,l){i+=bu(t[(u+l)%r].slice(-2),e[l%r].slice(-2))}),n[u]=i,i=0}),a=n.indexOf(Math.min.apply(null,n)),o[a]}function BZ(t,e,r,n,a,i,o,s){return 3*((s-e)*(r+a)-(o-t)*(n+i)+n*(t-a)-r*(e-i)+s*(a+t/3)-o*(i+e/3))/20}function ik(t){var e=0,r=0,n=0;return nk(t).map(function(a){var i;switch(a[0]){case"M":return e=a[1],r=a[2],0;default:var o=a.slice(1),s=o[0],u=o[1],f=o[2],l=o[3],c=o[4],h=o[5];return n=BZ(e,r,s,u,f,l,c,h),i=a.slice(-2),e=i[0],r=i[1],n}}).reduce(function(a,i){return a+i},0)}function GZ(t){return ik(t)>=0}function vh(t,e,r){return Hd(t,e,P(P({},r),{bbox:!1,length:!0})).point}function zZ(t,e){var r=Yd(t);if(typeof r=="string")throw TypeError(r);var n=r.slice(),a=Cf(n),i=n.length-1,o=0,s=0,u=r[0],f=u.slice(-2),l=f[0],c=f[1],h={x:l,y:c};if(i<=0||!e||!Number.isFinite(e))return{segment:u,index:0,length:s,point:h,lengthAtSegment:o};if(e>=a)return n=r.slice(0,-1),o=Cf(n),s=a-o,{segment:r[i],index:i,length:s,lengthAtSegment:o};for(var d=[];i>0;)u=n[i],n=n.slice(0,-1),o=Cf(n),s=a-o,a=o,d.push({segment:u,index:i,length:s,lengthAtSegment:o}),i-=1;return d.find(function(v){var p=v.lengthAtSegment;return p<=e})}function jZ(t,e){for(var r=Yd(t),n=qd(r),a=Cf(r),i=function(x){var E=x.x-e.x,_=x.y-e.y;return E*E+_*_},o=8,s,u=0,f,l=0,c=1/0,h=0;h<=a;h+=o)s=vh(n,h),u=i(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=vh(n,p),y=i(d),g=l+o,v=vh(n,g),m=i(v),p>=0&&y<c?(f=d,l=p,c=y):g<=a&&m<c?(f=v,l=g,c=m):o/=2;var b=zZ(r,l),w=Math.sqrt(c);return{closest:f,distance:w,segment:b}}function UZ(t,e){var r=jZ(t,e).distance;return Math.abs(r)<.001}var $Z=50;function XZ(t,e){e===void 0&&(e=.5);var r=t.slice(0,2),n=t.slice(2,4),a=t.slice(4,6),i=t.slice(6,8),o=zi(r,n,e),s=zi(n,a,e),u=zi(a,i,e),f=zi(o,s,e),l=zi(s,u,e),c=zi(f,l,e);return[["C"].concat(o,f,c),["C"].concat(l,u,i)]}function HE(t){return t.map(function(e,r,n){var a=r&&n[r-1].slice(-2).concat(e.slice(1)),i=r?ak(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],{bbox:!1}).length:0,o;return r?o=i?XZ(a):[e,e]:o=[e],{s:e,ss:o,l:i}})}function ok(t,e,r,n){if(n===void 0&&(n=0),n>$Z)return console.warn("Maximum recursion depth reached in equalizeSegments"),[t,e];var a=HE(t),i=HE(e),o=a.length,s=i.length,u=a.filter(function(y){return y.l}).length,f=i.filter(function(y){return y.l}).length,l=a.filter(function(y){return y.l}).reduce(function(y,m){var b=m.l;return y+b},0)/u||0,c=i.filter(function(y){return y.l}).reduce(function(y,m){var b=m.l;return y+b},0)/f||0,h=r||Math.max(o,s),d=[l,c],v=[h-o,h-s],p=0,g=[a,i].map(function(y,m){return y.l===h?y.map(function(b){return b.s}):y.map(function(b,w){return p=w&&v[m]&&b.l>=d[m],v[m]-=p?1:0,p?b.ss:[b.s]}).flat()});return g[0].length===g[1].length?g:ok(g[0],g[1],h,n+1)}var WZ=1e-6;function qp(t){return Math.abs(t)<WZ?0:t<0?-1:1}function VZ(t,e,r){return(r[0]-t[0])*(e[1]-t[1])===(e[0]-t[0])*(r[1]-t[1])&&Math.min(t[0],e[0])<=r[0]&&r[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=r[1]&&r[1]<=Math.max(t[1],e[1])}function Cg(t,e,r){var n=!1,a=t.length;if(a<=2)return!1;for(var i=0;i<a;i++){var o=t[i],s=t[(i+1)%a];if(VZ(o,s,[e,r]))return!0;qp(o[1]-r)>0!=qp(s[1]-r)>0&&qp(e-(r-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}var ZE=function(t,e,r){return t>=e&&t<=r};function YZ(t,e,r,n){var a=.001,i={x:r.x-t.x,y:r.y-t.y},o={x:e.x-t.x,y:e.y-t.y},s={x:n.x-r.x,y:n.y-r.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>a*l*c){var d=(i.x*s.y-i.y*s.x)/u,v=(i.x*o.y-i.y*o.x)/u;ZE(d,0,1)&&ZE(v,0,1)&&(h={x:t.x+d*o.x,y:t.y+d*o.y})}return h}function KE(t){for(var e=[],r=t.length,n=0;n<r-1;n++){var a=t[n],i=t[n+1];e.push({from:{x:a[0],y:a[1]},to:{x:i[0],y:i[1]}})}if(e.length>1){var o=t[0],s=t[r-1];e.push({from:{x:s[0],y:s[1]},to:{x:o[0],y:o[1]}})}return e}function qZ(t,e){var r=!1;return t.forEach(function(n){if(YZ(n.from,n.to,e.from,e.to))return r=!0,!1}),r}function QE(t){var e=t.map(function(n){return n[0]}),r=t.map(function(n){return n[1]});return{minX:Math.min.apply(null,e),maxX:Math.max.apply(null,e),minY:Math.min.apply(null,r),maxY:Math.max.apply(null,r)}}function HZ(t,e){return!(e.minX>t.maxX||e.maxX<t.minX||e.minY>t.maxY||e.maxY<t.minY)}function ZZ(t,e){if(t.length<2||e.length<2)return!1;var r=QE(t),n=QE(e);if(!HZ(r,n))return!1;var a=!1;if(e.forEach(function(u){if(Cg(t,u[0],u[1]))return a=!0,!1}),a||(t.forEach(function(u){if(Cg(e,u[0],u[1]))return a=!0,!1}),a))return!0;var i=KE(t),o=KE(e),s=!1;return o.forEach(function(u){if(qZ(i,u))return s=!0,!1}),s}function KZ(t){var e=document.createElement("div");e.innerHTML=t;var r=e.childNodes[0];return r&&e.contains(r)&&e.removeChild(r),r}function QZ(t,e){if(t)return Object.keys(e).forEach(function(r){t.style[r]=e[r]}),t}const JZ=Object.freeze(Object.defineProperty({__proto__:null,Cache:YH,angleTo:fZ,arcToCubic:wm,assign:Ws,augment:EH,clamp:Gq,clearAnimationFrame:xH,clone:Mg,clonePath:CZ,contains:Zh,createDOM:KZ,debounce:_H,deepMix:CH,difference:hq,direction:KI,distanceSquareRoot:bu,each:iu,endsWith:kq,equalizeSegments:ok,every:Nq,extend:TH,filter:LI,find:vq,findIndex:pq,firstValue:gq,fixedBase:zq,flatten:yq,flattenDeep:RI,forIn:iu,get:RH,getDrawDirection:GZ,getPathArea:ik,getPathBBox:DZ,getPathBBoxTotalLength:PZ,getPointAtLength:vh,getRange:mq,getRotatedCurve:FZ,getTotalLength:Cf,getType:VI,getWrapBehavior:Pq,gradient:QH,group:Dq,groupBy:$I,groupToMap:XI,has:WE,hasKey:WE,hasValue:nH,head:Cq,identity:WH,includes:Zh,indexOf:IH,isArguments:lH,isArray:Vr,isArrayLike:Ln,isBoolean:cH,isDate:hH,isDecimal:jq,isElement:bH,isEmpty:NH,isEqual:Qh,isEqualWith:OH,isError:dH,isEven:Uq,isFinite:vH,isFunction:ia,isInteger:$q,isMatch:PI,isNegative:Xq,isNil:no,isNull:pH,isNumber:xi,isNumberEqual:Vq,isObject:Vd,isObjectLike:Kh,isOdd:Yq,isPlainObject:ou,isPointInPolygon:Cg,isPointInStroke:UZ,isPolygonsIntersect:ZZ,isPositive:qq,isPrototype:YI,isRegExp:yH,isString:Qi,isType:mu,isUndefined:mH,keys:DI,last:Tq,lowerCase:aH,lowerFirst:iH,map:LH,mapValues:PH,max:FI,maxBy:Hq,memoize:qI,min:BI,minBy:Zq,mix:Ws,mod:Kq,modifyCSS:QZ,noop:XH,normalizePath:qd,number2color:Fq,omit:zH,parseRadius:Bq,path2Absolute:rk,path2Array:AZ,path2Curve:nk,path2String:hZ,pick:GH,pull:xq,pullAt:zI,reduce:jI,remove:_q,requestAnimationFrame:wH,reverseCurve:TZ,rgb2arr:NI,set:FH,size:VH,some:Oq,sortBy:Sq,startsWith:Iq,substitute:oH,throttle:jH,toArray:UH,toCSSGradient:nZ,toDegree:Jq,toInteger:eH,toRGB:ZI,toRadian:rH,toString:hl,transform:uZ,union:Mq,uniq:UI,uniqueId:$H,upperCase:sH,upperFirst:uH,values:WI,valuesOfKey:Aq,vertical:lZ,wrapBehavior:Rq},Symbol.toStringTag,{value:"Module"})),sk=Ka(JZ);Object.defineProperty(bm,"__esModule",{value:!0});var eK=sk,tK=function(t){for(var e={},r=t.nodes().filter(function(c){var h;return!(!((h=t.children(c))===null||h===void 0)&&h.length)}),n=r.map(function(c){return t.node(c).rank}),a=(0,eK.max)(n),i=[],o=0;o<a+1;o++)i.push([]);var s=function(c){var h;if(!e.hasOwnProperty(c)){e[c]=!0;var d=t.node(c);isNaN(d.rank)||i[d.rank].push(c),(h=t.successors(c))===null||h===void 0||h.forEach(function(v){return s(v)})}},u=r.sort(function(c,h){return t.node(c).rank-t.node(h).rank}),f=u.filter(function(c){return t.node(c).fixorder!==void 0}),l=f.sort(function(c,h){return t.node(c).fixorder-t.node(h).fixorder});return l==null||l.forEach(function(c){isNaN(t.node(c).rank)||i[t.node(c).rank].push(c),e[c]=!0}),u==null||u.forEach(s),i};bm.default=tK;var xm={};Object.defineProperty(xm,"__esModule",{value:!0});var rK=Vn,nK=function(t,e,r){for(var n=(0,rK.zipObject)(r,r.map(function(l,c){return c})),a=e.map(function(l){var c,h=(c=t.outEdges(l))===null||c===void 0?void 0:c.map(function(d){return{pos:n[d.w]||0,weight:t.edge(d).weight}});return h==null?void 0:h.sort(function(d,v){return d.pos-v.pos})}),i=a.flat().filter(function(l){return l!==void 0}),o=1;o<r.length;)o<<=1;var s=2*o-1;o-=1;var u=Array(s).fill(0,0,s),f=0;return i==null||i.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},aK=function(t,e){for(var r=0,n=1;n<(e==null?void 0:e.length);n+=1)r+=nK(t,e[n-1],e[n]);return r};xm.default=aK;var Em={};Object.defineProperty(Em,"__esModule",{value:!0});var iK=wi,oK=function(t,e,r){var n=sK(t),a=new iK.Graph({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(i){return t.node(i)});return t.nodes().forEach(function(i){var o,s=t.node(i),u=t.parent(i);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(a.setNode(i),a.setParent(i,u||n),(o=t[r](i))===null||o===void 0||o.forEach(function(f){var l=f.v===i?f.w:f.v,c=a.edgeFromArgs(l,i),h=c!==void 0?c.weight:0;a.setEdge(l,i,{weight:t.edge(f).weight+h})}),s.hasOwnProperty("minRank")&&a.setNode(i,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))}),a},sK=function(t){for(var e;t.hasNode(e="_root".concat(Math.random())););return e};Em.default=oK;var _m={};Object.defineProperty(_m,"__esModule",{value:!0});var uK=function(t,e,r){var n={},a;r==null||r.forEach(function(i){for(var o=t.parent(i),s,u;o;){if(s=t.parent(o),s?(u=n[s],n[s]=o):(u=a,a=o),u&&u!==o){e.setEdge(u,o);return}o=s}})};_m.default=uK;var Sm={},Mm={};Object.defineProperty(Mm,"__esModule",{value:!0});var fK=function(t,e){return e.map(function(r){var n=t.inEdges(r);if(!(n!=null&&n.length))return{v:r};{var a={sum:0,weight:0};return n==null||n.forEach(function(i){var o=t.edge(i),s=t.node(i.v);a.sum+=o.weight*s.order,a.weight+=o.weight}),{v:r,barycenter:a.sum/a.weight,weight:a.weight}}})};Mm.default=fK;var Am={};Object.defineProperty(Am,"__esModule",{value:!0});var lK=function(t,e){var r,n,a,i={};t==null||t.forEach(function(s,u){i[s.v]={i:u,indegree:0,in:[],out:[],vs:[s.v]};var f=i[s.v];s.barycenter!==void 0&&(f.barycenter=s.barycenter,f.weight=s.weight)}),(r=e.edges())===null||r===void 0||r.forEach(function(s){var u=i[s.v],f=i[s.w];u!==void 0&&f!==void 0&&(f.indegree++,u.out.push(i[s.w]))});var o=(a=(n=Object.values(i)).filter)===null||a===void 0?void 0:a.call(n,function(s){return!s.indegree});return cK(o)},cK=function(t){for(var e,r,n=[],a=function(f){return function(l){l.merged||(l.barycenter===void 0||f.barycenter===void 0||l.barycenter>=f.barycenter)&&hK(f,l)}},i=function(f){return function(l){l.in.push(f),--l.indegree===0&&t.push(l)}},o=function(){var f=t.pop();n.push(f),(e=f.in.reverse())===null||e===void 0||e.forEach(function(l){return a(f)(l)}),(r=f.out)===null||r===void 0||r.forEach(function(l){return i(f)(l)})};t!=null&&t.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})},hK=function(t,e){var r,n=0,a=0;t.weight&&(n+=t.barycenter*t.weight,a+=t.weight),e.weight&&(n+=e.barycenter*e.weight,a+=e.weight),t.vs=(r=e.vs)===null||r===void 0?void 0:r.concat(t.vs),t.barycenter=n/a,t.weight=a,t.i=Math.min(e.i,t.i),e.merged=!0};Am.default=lK;var Cm={};Object.defineProperty(Cm,"__esModule",{value:!0});var dK=Vn,vK=function(t,e,r,n){var a=(0,dK.partition)(t,function(h){var d=h.hasOwnProperty("fixorder")&&!isNaN(h.fixorder);return n?!d&&h.hasOwnProperty("barycenter"):d||h.hasOwnProperty("barycenter")}),i=a.lhs,o=a.rhs.sort(function(h,d){return-h.i- -d.i}),s=[],u=0,f=0,l=0;i==null||i.sort(pK(!!e,!!r)),l=JE(s,o,l),i==null||i.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=JE(s,o,l)});var c={vs:s.flat()};return f&&(c.barycenter=u/f,c.weight=f),c},JE=function(t,e,r){for(var n=r,a;e.length&&(a=e[e.length-1]).i<=n;)e.pop(),t==null||t.push(a.vs),n++;return n},pK=function(t,e){return function(r,n){if(r.fixorder!==void 0&&n.fixorder!==void 0)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&r.order!==void 0&&n.order!==void 0){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i}};Cm.default=vK;var Tm=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Sm,"__esModule",{value:!0});var gK=Tm(Mm),yK=Tm(Am),mK=Tm(Cm),uk=function(t,e,r,n,a,i){var o,s,u,f,l=t.children(e),c=t.node(e),h=c?c.borderLeft:void 0,d=c?c.borderRight:void 0,v={};h&&(l=l==null?void 0:l.filter(function(w){return w!==h&&w!==d}));var p=(0,gK.default)(t,l||[]);p==null||p.forEach(function(w){var x;if(!((x=t.children(w.v))===null||x===void 0)&&x.length){var E=uk(t,w.v,r,n,i);v[w.v]=E,E.hasOwnProperty("barycenter")&&wK(w,E)}});var g=(0,yK.default)(p,r);bK(g,v),(o=g.filter(function(w){return w.vs.length>0}))===null||o===void 0||o.forEach(function(w){var x=t.node(w.vs[0]);x&&(w.fixorder=x.fixorder,w.order=x.order)});var y=(0,mK.default)(g,n,a,i);if(h&&(y.vs=[h,y.vs,d].flat(),!((s=t.predecessors(h))===null||s===void 0)&&s.length)){var m=t.node(((u=t.predecessors(h))===null||u===void 0?void 0:u[0])||""),b=t.node(((f=t.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},bK=function(t,e){t==null||t.forEach(function(r){var n,a=(n=r.vs)===null||n===void 0?void 0:n.map(function(i){return e[i]?e[i].vs:i});r.vs=a.flat()})},wK=function(t,e){t.barycenter!==void 0?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)};Sm.default=uk;var dl=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mm,"__esModule",{value:!0});var e_=dl(bm),t_=dl(xm),xK=dl(Em),EK=dl(_m),_K=dl(Sm),r_=Ir(),SK=wi,Hp=Vn,MK=function(t,e){for(var r=(0,Hp.maxRank)(t),n=[],a=[],i=1;i<r+1;i++)n.push(i);for(var i=r-1;i>-1;i--)a.push(i);var o=n_(t,n,"inEdges"),s=n_(t,a,"outEdges"),u=(0,e_.default)(t);Zp(t,u);for(var f=Number.POSITIVE_INFINITY,l,i=0,c=0;c<4;++i,++c){a_(i%2?o:s,i%4>=2,!1,e),u=(0,Hp.buildLayerMatrix)(t);var h=(0,t_.default)(t,u);h<f&&(c=0,l=(0,r_.clone)(u),f=h)}u=(0,e_.default)(t),Zp(t,u);for(var i=0,c=0;c<4;++i,++c){a_(i%2?o:s,i%4>=2,!0,e),u=(0,Hp.buildLayerMatrix)(t);var h=(0,t_.default)(t,u);h<f&&(c=0,l=(0,r_.clone)(u),f=h)}Zp(t,l)},n_=function(t,e,r){return e.map(function(n){return(0,xK.default)(t,n,r)})},a_=function(t,e,r,n){var a=new SK.Graph;t==null||t.forEach(function(i){for(var o,s=i.graph().root,u=(0,_K.default)(i,s,a,e,r,n),f=0;f<((o=u.vs)===null||o===void 0?void 0:o.length);f++){var l=i.node(u.vs[f]);l&&(l.order=f)}(0,EK.default)(i,a,u.vs)})},Zp=function(t,e){e==null||e.forEach(function(r){r==null||r.forEach(function(n,a){t.node(n).order=a})})};mm.default=MK;var Im={},fk={};(function(t){var e=me&&me.__extends||function(){var w=function(x,E){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,S){_.__proto__=S}||function(_,S){for(var A in S)Object.prototype.hasOwnProperty.call(S,A)&&(_[A]=S[A])},w(x,E)};return function(x,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");w(x,E);function _(){this.constructor=x}x.prototype=E===null?Object.create(E):(_.prototype=E.prototype,new _)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.width=t.sep=t.positionX=t.balance=t.alignCoordinates=t.findSmallestWidthAlignment=t.buildBlockGraph=t.horizontalCompaction=t.verticalAlignment=t.hasConflict=t.addConflict=t.findOtherInnerSegmentNode=t.findType2Conflicts=t.findType1Conflicts=void 0;var r=Wd,n=sk,a=Vn,i=function(w){e(x,w);function x(){return w!==null&&w.apply(this,arguments)||this}return x}(r.Graph),o=function(w,x){var E={},_=function(S,A){var M=0,C=0,I=S.length,k=A==null?void 0:A[(A==null?void 0:A.length)-1];return A==null||A.forEach(function(O,B){var L,z=(0,t.findOtherInnerSegmentNode)(w,O),X=z?w.node(z).order:I;(z||O===k)&&((L=A.slice(C,B+1))===null||L===void 0||L.forEach(function(R){var V;(V=w.predecessors(R))===null||V===void 0||V.forEach(function(he){var ce,le=w.node(he),ie=le.order;(ie<M||X<ie)&&!(le.dummy&&(!((ce=w.node(R))===null||ce===void 0)&&ce.dummy))&&(0,t.addConflict)(E,he,R)})}),C=B+1,M=X)}),A};return x!=null&&x.length&&x.reduce(_),E};t.findType1Conflicts=o;var s=function(w,x){var E={};function _(C,I,k,O,B){for(var L,z,X,R=I;R<k;R++)X=C[R],!((L=w.node(X))===null||L===void 0)&&L.dummy&&((z=w.predecessors(X))===null||z===void 0||z.forEach(function(V){var he=w.node(V);he.dummy&&(he.order<O||he.order>B)&&(0,t.addConflict)(E,V,X)}))}function S(C){return JSON.stringify(C.slice(1))}function A(C,I){var k=S(C);I.get(k)||(_.apply(void 0,C),I.set(k,!0))}var M=function(C,I){var k=-1,O,B=0,L=new Map;return I==null||I.forEach(function(z,X){var R;if(((R=w.node(z))===null||R===void 0?void 0:R.dummy)==="border"){var V=w.predecessors(z)||[];V.length&&(O=w.node(V[0]).order,A([I,B,X,k,O],L),B=X,k=O)}A([I,B,I.length,O,C.length],L)}),I};return x!=null&&x.length&&x.reduce(M),E};t.findType2Conflicts=s;var u=function(w,x){var E,_;if(!((E=w.node(x))===null||E===void 0)&&E.dummy)return(_=w.predecessors(x))===null||_===void 0?void 0:_.find(function(S){return w.node(S).dummy})};t.findOtherInnerSegmentNode=u;var f=function(w,x,E){var _=x,S=E;if(_>S){var A=_;_=S,S=A}var M=w[_];M||(w[_]=M={}),M[S]=!0};t.addConflict=f;var l=function(w,x,E){var _=x,S=E;if(_>S){var A=x;_=S,S=A}return!!w[_]};t.hasConflict=l;var c=function(w,x,E,_){var S={},A={},M={};return x==null||x.forEach(function(C){C==null||C.forEach(function(I,k){S[I]=I,A[I]=I,M[I]=k})}),x==null||x.forEach(function(C){var I=-1;C==null||C.forEach(function(k){var O=_(k);if(O.length){O=O.sort(function(R,V){return M[R]-M[V]});for(var B=(O.length-1)/2,L=Math.floor(B),z=Math.ceil(B);L<=z;++L){var X=O[L];A[k]===k&&I<M[X]&&!(0,t.hasConflict)(E,k,X)&&(A[X]=k,A[k]=S[k]=S[X],I=M[X])}}})}),{root:S,align:A}};t.verticalAlignment=c;var h=function(w,x,E,_,S){var A,M={},C=(0,t.buildBlockGraph)(w,x,E,S),I=S?"borderLeft":"borderRight",k=function(L,z){for(var X=C.nodes(),R=X.pop(),V={};R;)V[R]?L(R):(V[R]=!0,X.push(R),X=X.concat(z(R))),R=X.pop()},O=function(L){M[L]=(C.inEdges(L)||[]).reduce(function(z,X){return Math.max(z,(M[X.v]||0)+C.edge(X))},0)},B=function(L){var z=(C.outEdges(L)||[]).reduce(function(R,V){return Math.min(R,(M[V.w]||0)-C.edge(V))},Number.POSITIVE_INFINITY),X=w.node(L);z!==Number.POSITIVE_INFINITY&&X.borderType!==I&&(M[L]=Math.max(M[L],z))};return k(O,C.predecessors.bind(C)),k(B,C.successors.bind(C)),(A=Object.values(_))===null||A===void 0||A.forEach(function(L){M[L]=M[E[L]]}),M};t.horizontalCompaction=h;var d=function(w,x,E,_){var S=new i,A=w.graph(),M=(0,t.sep)(A.nodesep,A.edgesep,_);return x==null||x.forEach(function(C){var I;C==null||C.forEach(function(k){var O=E[k];if(S.setNode(O),I){var B=E[I],L=S.edgeFromArgs(B,O);S.setEdge(B,O,Math.max(M(w,k,I),L||0))}I=k})}),S};t.buildBlockGraph=d;var v=function(w,x){return(0,a.minBy)(Object.values(x),function(E){var _,S=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY;return(_=Object.keys(E))===null||_===void 0||_.forEach(function(M){var C=E[M],I=(0,t.width)(w,M)/2;S=Math.max(C+I,S),A=Math.min(C-I,A)}),S-A})};t.findSmallestWidthAlignment=v;function p(w,x){var E=Object.values(x),_=(0,n.min)(E),S=(0,n.max)(E);["u","d"].forEach(function(A){["l","r"].forEach(function(M){var C=A+M,I=w[C],k;if(I!==x){var O=Object.values(I);k=M==="l"?_-(0,n.min)(O):S-(0,n.max)(O),k&&(w[C]={},Object.keys(I).forEach(function(B){w[C][B]=I[B]+k}))}})})}t.alignCoordinates=p;var g=function(w,x){var E={};return Object.keys(w.ul).forEach(function(_){if(x)E[_]=w[x.toLowerCase()][_];else{var S=Object.values(w).map(function(A){return A[_]});E[_]=(S[0]+S[1])/2}}),E};t.balance=g;var y=function(w){var x=(0,a.buildLayerMatrix)(w),E=Object.assign((0,t.findType1Conflicts)(w,x),(0,t.findType2Conflicts)(w,x)),_={},S;["u","d"].forEach(function(M){S=M==="u"?x:Object.values(x).reverse(),["l","r"].forEach(function(C){C==="r"&&(S=S.map(function(B){return Object.values(B).reverse()}));var I=(M==="u"?w.predecessors:w.successors).bind(w),k=(0,t.verticalAlignment)(w,S,E,I),O=(0,t.horizontalCompaction)(w,S,k.root,k.align,C==="r");C==="r"&&Object.keys(O).forEach(function(B){O[B]=-O[B]}),_[M+C]=O})});var A=(0,t.findSmallestWidthAlignment)(w,_);return p(_,A),(0,t.balance)(_,w.graph().align)};t.positionX=y;var m=function(w,x,E){return function(_,S,A){var M=_.node(S),C=_.node(A),I=0,k;if(I+=M.width/2,M.hasOwnProperty("labelpos"))switch((M.labelpos||"").toLowerCase()){case"l":k=-M.width/2;break;case"r":k=M.width/2;break}if(k&&(I+=E?k:-k),k=0,I+=(M.dummy?x:w)/2,I+=(C.dummy?x:w)/2,I+=C.width/2,C.labelpos)switch((C.labelpos||"").toLowerCase()){case"l":k=C.width/2;break;case"r":k=-C.width/2;break}return k&&(I+=E?k:-k),k=0,I}};t.sep=m;var b=function(w,x){return w.node(x).width||0};t.width=b})(fk);var i_=me&&me.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,a=e.length,i;n<a;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(Im,"__esModule",{value:!0});var km=Vn,Co=fk,AK=function(t){var e=(0,km.buildLayerMatrix)(t),r=t.graph().ranksep,n=0;e==null||e.forEach(function(a){var i=a.map(function(s){return t.node(s).height}),o=Math.max.apply(Math,i_(i_([],i,!1),[0],!1));a==null||a.forEach(function(s){t.node(s).y=n+o/2}),n+=o+r})},CK=function(t){var e=(0,km.buildLayerMatrix)(t),r=Object.assign((0,Co.findType1Conflicts)(t,e),(0,Co.findType2Conflicts)(t,e)),n={},a=[];["u","d"].forEach(function(o){a=o==="u"?e:Object.values(e).reverse(),["l","r"].forEach(function(s){s==="r"&&(a=a.map(function(c){return Object.values(c).reverse()}));var u=(o==="u"?t.predecessors:t.successors).bind(t),f=(0,Co.verticalAlignment)(t,a,r,u),l=(0,Co.horizontalCompaction)(t,a,f.root,f.align,s==="r");s==="r"&&Object.keys(l).forEach(function(c){return l[c]=-l[c]}),n[o+s]=l})});var i=(0,Co.findSmallestWidthAlignment)(t,n);return i&&(0,Co.alignCoordinates)(n,i),(0,Co.balance)(n,t.graph().align)},TK=function(t){var e,r=(0,km.asNonCompoundGraph)(t);AK(r);var n=CK(r);(e=Object.keys(n))===null||e===void 0||e.forEach(function(a){r.node(a).x=n[a]})};Im.default=TK;var Nm={};Object.defineProperty(Nm,"__esModule",{value:!0});var IK=function(t,e){for(var r=t.nodes().filter(function(s){var u;return!(!((u=t.children(s))===null||u===void 0)&&u.length)}),n=r.map(function(s){return t.node(s).rank}),a=Math.max.apply(Math,n),i=[],o=0;o<a+1;o++)i[o]=[];e==null||e.forEach(function(s){var u=t.node(s);!u||u!=null&&u.dummy||isNaN(u.rank)||(u.fixorder=i[u.rank].length,i[u.rank].push(s))})};Nm.default=IK;var Jh=me&&me.__assign||function(){return Jh=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},Jh.apply(this,arguments)},ei=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(om,"__esModule",{value:!0});var o_=ei(sm),s_=ei(hm),kK=ei(dm),Ya=Vn,NK=ei(vm),u_=ei(pm),OK=ei(gm),f_=ei(ym),LK=ei(mm),DK=ei(Im),PK=ei(Nm),RK=wi,FK=function(t,e){var r=e&&e.debugTiming?Ya.time:Ya.notime;r("layout",function(){e&&!e.keepNodeOrder&&e.prevGraph&&r(" inheritOrder",function(){GK(t,e.prevGraph)});var n=r(" buildLayoutGraph",function(){return YK(t)});e&&e.edgeLabelSpace===!1||r(" makeSpaceForEdgeLabels",function(){qK(n)});try{r(" runLayout",function(){BK(n,r,e)})}catch(a){if(a.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:
|
||
`,a);return}throw a}r(" updateInputGraph",function(){zK(t,n)})})},BK=function(t,e,r){e(" removeSelfEdges",function(){nQ(t)}),e(" acyclic",function(){o_.default.run(t)}),e(" nestingGraph.run",function(){u_.default.run(t)}),e(" rank",function(){(0,kK.default)((0,Ya.asNonCompoundGraph)(t))}),e(" injectEdgeLabelProxies",function(){HK(t)}),e(" removeEmptyRanks",function(){(0,Ya.removeEmptyRanks)(t)}),e(" nestingGraph.cleanup",function(){u_.default.cleanup(t)}),e(" normalizeRanks",function(){(0,Ya.normalizeRanks)(t)}),e(" assignRankMinMax",function(){ZK(t)}),e(" removeEdgeLabelProxies",function(){KK(t)}),e(" normalize.run",function(){s_.default.run(t)}),e(" parentDummyChains",function(){(0,NK.default)(t)}),e(" addBorderSegments",function(){(0,OK.default)(t)}),r&&r.keepNodeOrder&&e(" initDataOrder",function(){(0,PK.default)(t,r.nodeOrder)}),e(" order",function(){(0,LK.default)(t,r==null?void 0:r.keepNodeOrder)}),e(" insertSelfEdges",function(){aQ(t)}),e(" adjustCoordinateSystem",function(){f_.default.adjust(t)}),e(" position",function(){(0,DK.default)(t)}),e(" positionSelfEdges",function(){iQ(t)}),e(" removeBorderNodes",function(){rQ(t)}),e(" normalize.undo",function(){s_.default.undo(t)}),e(" fixupEdgeLabelCoords",function(){eQ(t)}),e(" undoCoordinateSystem",function(){f_.default.undo(t)}),e(" translateGraph",function(){QK(t)}),e(" assignNodeIntersects",function(){JK(t)}),e(" reversePoints",function(){tQ(t)}),e(" acyclic.undo",function(){o_.default.undo(t)})},GK=function(t,e){t.nodes().forEach(function(r){var n=t.node(r),a=e.node(r);a!==void 0?(n.fixorder=a._order,delete a._order):delete n.fixorder})},zK=function(t,e){t.nodes().forEach(function(r){var n,a=t.node(r);if(a){var i=e.node(r);a.x=i.x,a.y=i.y,a._order=i.order,a._rank=i.rank,!((n=e.children(r))===null||n===void 0)&&n.length&&(a.width=i.width,a.height=i.height)}}),t.edges().forEach(function(r){var n=t.edge(r),a=e.edge(r);n.points=a?a.points:[],a&&a.hasOwnProperty("x")&&(n.x=a.x,n.y=a.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height},jK=["nodesep","edgesep","ranksep","marginx","marginy"],UK={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Kp=["acyclicer","ranker","rankdir","align"],$K=["width","height","layer","fixorder"],XK={width:0,height:0},WK=["minlen","weight","width","height","labeloffset"],VK={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Qp=["labelpos"],YK=function(t){var e=new RK.Graph({multigraph:!0,compound:!0}),r=e0(t.graph()),n={};return Kp==null||Kp.forEach(function(a){r[a]!==void 0&&(n[a]=r[a])}),e.setGraph(Object.assign({},UK,Jp(r,jK),n)),t.nodes().forEach(function(a){var i=e0(t.node(a)),o=Jh(Jh({},XK),i),s=Jp(o,$K);e.setNode(a,s),e.setParent(a,t.parent(a))}),t.edges().forEach(function(a){var i=e0(t.edge(a)),o={};Qp==null||Qp.forEach(function(s){i[s]!==void 0&&(o[s]=i[s])}),e.setEdgeObj(a,Object.assign({},VK,Jp(i,WK),o))}),e},qK=function(t){var e=t.graph();e.ranksep||(e.ranksep=0),e.ranksep/=2,t.nodes().forEach(function(r){var n=t.node(r);isNaN(n.layer)||n.layer||(n.layer=0)}),t.edges().forEach(function(r){var n,a=t.edge(r);a.minlen*=2,((n=a.labelpos)===null||n===void 0?void 0:n.toLowerCase())!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?a.width+=a.labeloffset:a.height+=a.labeloffset)})},HK=function(t){t.edges().forEach(function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),a=t.node(e.w),i={e,rank:(a.rank-n.rank)/2+n.rank};(0,Ya.addDummyNode)(t,"edge-proxy",i,"_ep")}})},ZK=function(t){var e=0;t.nodes().forEach(function(r){var n,a,i=t.node(r);i.borderTop&&(i.minRank=(n=t.node(i.borderTop))===null||n===void 0?void 0:n.rank,i.maxRank=(a=t.node(i.borderBottom))===null||a===void 0?void 0:a.rank,e=Math.max(e,i.maxRank||-1/0))}),t.graph().maxRank=e},KK=function(t){t.nodes().forEach(function(e){var r=t.node(e);r.dummy==="edge-proxy"&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})},QK=function(t){var e,r=0,n,a=0,i=t.graph(),o=i.marginx||0,s=i.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),r=Math.max(r,l+h/2)),!isNaN(c)&&!isNaN(d)&&(n===void 0&&(n=c-d/2),n=Math.min(n,c-d/2),a=Math.max(a,c+d/2))}};t.nodes().forEach(function(f){u(t.node(f))}),t.edges().forEach(function(f){var l=t.edge(f);l!=null&&l.hasOwnProperty("x")&&u(l)}),e-=o,n-=s,t.nodes().forEach(function(f){var l=t.node(f);l&&(l.x-=e,l.y-=n)}),t.edges().forEach(function(f){var l,c=t.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)}),i.width=r-e+o,i.height=a-n+s},JK=function(t){t.edges().forEach(function(e){var r=t.edge(e),n=t.node(e.v),a=t.node(e.w),i,o;r.points?(i=r.points[0],o=r.points[r.points.length-1]):(r.points=[],i=a,o=n),r.points.unshift((0,Ya.intersectRect)(n,i)),r.points.push((0,Ya.intersectRect)(a,o))})},eQ=function(t){t.edges().forEach(function(e){var r=t.edge(e);if(r!=null&&r.hasOwnProperty("x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})},tQ=function(t){t.edges().forEach(function(e){var r,n=t.edge(e);n.reversed&&((r=n.points)===null||r===void 0||r.reverse())})},rQ=function(t){t.nodes().forEach(function(e){var r,n,a;if(!((r=t.children(e))===null||r===void 0)&&r.length){var i=t.node(e),o=t.node(i.borderTop),s=t.node(i.borderBottom),u=t.node(i.borderLeft[((n=i.borderLeft)===null||n===void 0?void 0:n.length)-1]),f=t.node(i.borderRight[((a=i.borderRight)===null||a===void 0?void 0:a.length)-1]);i.width=Math.abs((f==null?void 0:f.x)-(u==null?void 0:u.x))||10,i.height=Math.abs((s==null?void 0:s.y)-(o==null?void 0:o.y))||10,i.x=((u==null?void 0:u.x)||0)+i.width/2,i.y=((o==null?void 0:o.y)||0)+i.height/2}}),t.nodes().forEach(function(e){var r;((r=t.node(e))===null||r===void 0?void 0:r.dummy)==="border"&&t.removeNode(e)})},nQ=function(t){t.edges().forEach(function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdgeObj(e)}})},aQ=function(t){var e=(0,Ya.buildLayerMatrix)(t);e==null||e.forEach(function(r){var n=0;r==null||r.forEach(function(a,i){var o,s=t.node(a);s.order=i+n,(o=s.selfEdges)===null||o===void 0||o.forEach(function(u){(0,Ya.addDummyNode)(t,"selfedge",{width:u.label.width,height:u.label.height,rank:s.rank,order:i+ ++n,e:u.e,label:u.label},"_se")}),delete s.selfEdges})})},iQ=function(t){t.nodes().forEach(function(e){var r=t.node(e);if(r.dummy==="selfedge"){var n=t.node(r.e.v),a=n.x+n.width/2,i=n.y,o=r.x-a,s=n.height/2;t.setEdgeObj(r.e,r.label),t.removeNode(e),r.label.points=[{x:a+2*o/3,y:i-s},{x:a+5*o/6,y:i-s},{y:i,x:a+o},{x:a+5*o/6,y:i+s},{x:a+2*o/3,y:i+s}],r.label.x=r.x,r.label.y=r.y}})},Jp=function(t,e){var r={};return e==null||e.forEach(function(n){t[n]!==void 0&&(r[n]=+t[n])}),r},e0=function(t){t===void 0&&(t={});var e={};return Object.keys(t).forEach(function(r){e[r.toLowerCase()]=t[r]}),e};om.default=FK;var oQ=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(im,"__esModule",{value:!0});var sQ=oQ(om),l_=Vn;im.default={layout:sQ.default,util:{time:l_.time,notime:l_.notime}};var uQ=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),fQ=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yu,"__esModule",{value:!0});yu.DagreLayout=void 0;var lQ=fQ(im),Rn=Ir(),cQ=Rr,c_=wi,hQ=function(t){uQ(e,t);function e(r){var n=t.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(a){var i=n,o=i.nodes,s=o.find(function(f){return f.id===a});if(s){var u=s.layout!==!1;return u}return!0},n.updateCfg(r),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 r=this,n,a,i,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 c_.Graph({multigraph:!0,compound:!0});s.nodeMap={};var w={};u.forEach(function(te){s.nodeMap[te.id]=te,te.comboId&&(w[te.comboId]=w[te.comboId]||[],w[te.comboId].push(te.id))});var x=[],E={};!((n=s.nodeOrder)===null||n===void 0)&&n.length?(s.nodeOrder.forEach(function(te){E[te]=!0,x.push(s.nodeMap[te])}),u.forEach(function(te){E[te.id]||x.push(te)})):x=u;var _;f?(0,Rn.isArray)(f)?_=function(){return f}:_=function(){return[f,f]}:_=function(te){return te.size?(0,Rn.isArray)(te.size)?te.size:(0,Rn.isObject)(te.size)?[te.size.width||40,te.size.height||40]:[te.size,te.size]:[40,40]};var S=(0,Rn.getFunc)(s.ranksep,50,s.ranksepFunc),A=(0,Rn.getFunc)(s.nodesep,50,s.nodesepFunc),M=A,C=S;(l==="LR"||l==="RL")&&(M=S,C=A),b.setDefaultEdgeLabel(function(){return{}}),b.setGraph(s);var I={};this.sortByCombo&&c&&c.forEach(function(te){if(I[te.id]=te,te.collapsed){var N=_(te),Se=C(te),Fe=M(te),ge=N[0]+2*Fe,Ue=N[1]+2*Se;b.setNode(te.id,{width:ge,height:Ue})}te.parentId&&(I[te.parentId]||b.setNode(te.parentId,{}),b.setParent(te.id,te.parentId))}),x.filter(function(te){return te.layout!==!1}).forEach(function(te){var N=_(te),Se=C(te),Fe=M(te),ge=N[0]+2*Fe,Ue=N[1]+2*Se,$e=te.layer;(0,Rn.isNumber)($e)?b.setNode(te.id,{width:ge,height:Ue,layer:$e}):b.setNode(te.id,{width:ge,height:Ue}),r.sortByCombo&&te.comboId&&(I[te.comboId]||(I[te.comboId]={id:te.comboId},b.setNode(te.comboId,{})),b.setParent(te.id,te.comboId))}),m.forEach(function(te){var N=(0,Rn.getEdgeTerminal)(te,"source"),Se=(0,Rn.getEdgeTerminal)(te,"target");r.layoutNode(N)&&r.layoutNode(Se)&&b.setEdge(N,Se,{weight:te.weight||1})}),(a=p==null?void 0:p.concat(y||[]))===null||a===void 0||a.forEach(function(te){var N,Se,Fe=te.source,ge=te.target,Ue=!((N=I[Fe])===null||N===void 0)&&N.collapsed?[Fe]:w[Fe]||[Fe],$e=!((Se=I[ge])===null||Se===void 0)&&Se.collapsed?[ge]:w[ge]||[ge];Ue.forEach(function(Ze){$e.forEach(function(Je){b.setEdge(Ze,Je,{weight:te.weight||1})})})});var k=void 0;!((i=s.preset)===null||i===void 0)&&i.nodes&&(k=new c_.Graph({multigraph:!0,compound:!0}),s.preset.nodes.forEach(function(te){k==null||k.setNode(te.id,te)})),lQ.default.layout(b,{prevGraph:k,edgeLabelSpace:s.edgeLabelSpace,keepNodeOrder:!!s.nodeOrder,nodeOrder:s.nodeOrder});var O=[0,0];if(h){var B=1/0,L=1/0;b.nodes().forEach(function(te){var N=b.node(te);B>N.x&&(B=N.x),L>N.y&&(L=N.y)}),b.edges().forEach(function(te){var N,Se=b.edge(te);(N=Se.points)===null||N===void 0||N.forEach(function(Fe){B>Fe.x&&(B=Fe.x),L>Fe.y&&(L=Fe.y)})}),O[0]=h[0]-B,O[1]=h[1]-L}var z=l==="LR"||l==="RL";if(d){var X=this,R=X.focusNode,V=X.ranksep,he=X.getRadialPos,ce=(0,Rn.isString)(R)?R:R==null?void 0:R.id,le=ce?(o=b.node(ce))===null||o===void 0?void 0:o._rank:0,ie=[],Ie=z?"y":"x",qe=z?"height":"width",Ve=1/0,it=-1/0;b.nodes().forEach(function(te){var N=b.node(te);if(s.nodeMap[te]){var Se=A(s.nodeMap[te]);if(le===0)ie[N._rank]||(ie[N._rank]={nodes:[],totalWidth:0,maxSize:-1/0}),ie[N._rank].nodes.push(te),ie[N._rank].totalWidth+=Se*2+N[qe],ie[N._rank].maxSize<Math.max(N.width,N.height)&&(ie[N._rank].maxSize=Math.max(N.width,N.height));else{var Fe=N._rank-le;if(Fe===0)ie[Fe]||(ie[Fe]={nodes:[],totalWidth:0,maxSize:-1/0}),ie[Fe].nodes.push(te),ie[Fe].totalWidth+=Se*2+N[qe],ie[Fe].maxSize<Math.max(N.width,N.height)&&(ie[Fe].maxSize=Math.max(N.width,N.height));else{var ge=Math.abs(Fe);ie[ge]||(ie[ge]={left:[],right:[],totalWidth:0,maxSize:-1/0}),ie[ge].totalWidth+=Se*2+N[qe],ie[ge].maxSize<Math.max(N.width,N.height)&&(ie[ge].maxSize=Math.max(N.width,N.height)),Fe<0?ie[ge].left.push(te):ie[ge].right.push(te)}}var Ue=N[Ie]-N[qe]/2-Se,$e=N[Ie]+N[qe]/2+Se;Ue<Ve&&(Ve=Ue),$e>it&&(it=$e)}});var dt=V||50,st={},Tt=(it-Ve)/.9,_t=[(Ve+it-Tt)*.5,(Ve+it+Tt)*.5],lr=function(te,N,Se,Fe){Se===void 0&&(Se=-1/0),Fe===void 0&&(Fe=[0,1]);var ge=Se;return te.forEach(function(Ue){var $e=b.node(Ue);st[Ue]=N;var Ze=he($e[Ie],_t,Tt,N,Fe),Je=Ze.x,ht=Ze.y;if(s.nodeMap[Ue]){s.nodeMap[Ue].x=Je+O[0],s.nodeMap[Ue].y=ht+O[1],s.nodeMap[Ue]._order=$e._order;var Lt=S(s.nodeMap[Ue]);ge<Lt&&(ge=Lt)}}),ge},Bt=!0,Wt=0;ie.forEach(function(te){var N,Se,Fe,ge,Ue,$e,Ze;if(!(!(!((N=te==null?void 0:te.nodes)===null||N===void 0)&&N.length)&&!(!((Se=te==null?void 0:te.left)===null||Se===void 0)&&Se.length)&&!(!((Fe=te==null?void 0:te.right)===null||Fe===void 0)&&Fe.length))){if(Bt&&te.nodes.length===1){var Je=te.nodes[0];if(!s.nodeMap[Je])return;s.nodeMap[Je].x=O[0],s.nodeMap[Je].y=O[1],st[te.nodes[0]]=0,dt=S(s.nodeMap[Je]),Bt=!1;return}dt=Math.max(dt,te.totalWidth/(2*Math.PI));var ht=-1/0;if(le===0||!((ge=te.nodes)===null||ge===void 0)&&ge.length)ht=lr(te.nodes,dt,ht,[0,1]);else{var Lt=((Ue=te.left)===null||Ue===void 0?void 0:Ue.length)/((($e=te.left)===null||$e===void 0?void 0:$e.length)+((Ze=te.right)===null||Ze===void 0?void 0:Ze.length));ht=lr(te.left,dt,ht,[0,Lt]),ht=lr(te.right,dt,ht,[Lt+.05,1])}dt+=ht,Bt=!1,Wt-te.maxSize}}),b.edges().forEach(function(te){var N,Se,Fe,ge=b.edge(te),Ue=m.findIndex(function(fr){var or=(0,Rn.getEdgeTerminal)(fr,"source"),gr=(0,Rn.getEdgeTerminal)(fr,"target");return or===te.v&&gr===te.w});if(!(Ue<=-1)&&s.edgeLabelSpace&&s.controlPoints&&m[Ue].type!=="loop"){var $e=Ie==="x"?"y":"x",Ze=(N=ge==null?void 0:ge.points)===null||N===void 0?void 0:N.slice(1,ge.points.length-1),Je=[],ht=(Se=b.node(te.v))===null||Se===void 0?void 0:Se[$e],Lt=ht-((Fe=b.node(te.w))===null||Fe===void 0?void 0:Fe[$e]),ur=st[te.v],Dt=ur-st[te.w];Ze==null||Ze.forEach(function(fr){var or=(fr[$e]-ht)/Lt*Dt+ur,gr=he(fr[Ie],_t,Tt,or);Je.push({x:gr.x+O[0],y:gr.y+O[1]})}),m[Ue].controlPoints=Je}})}else{var vr=new Set,cr=l==="BT"||l==="RL",$t=cr?function(te,N){return N-te}:function(te,N){return te-N};b.nodes().forEach(function(te){var N=b.node(te);if(N){var Se=r.nodeMap[te];Se||(Se=c==null?void 0:c.find(function(Fe){return Fe.id===te})),Se&&(Se.x=N.x+O[0],Se.y=N.y+O[1],Se._order=N._order,vr.add(z?Se.x:Se.y))}});var sr=Array.from(vr).sort($t),tn=z?function(te,N){return te.x!==N.x}:function(te,N){return te.y!==N.y},tt=z?function(te,N,Se){var Fe=Math.max(N.y,Se.y),ge=Math.min(N.y,Se.y);return te.filter(function(Ue){return Ue.y<=Fe&&Ue.y>=ge})}:function(te,N,Se){var Fe=Math.max(N.x,Se.x),ge=Math.min(N.x,Se.x);return te.filter(function(Ue){return Ue.x<=Fe&&Ue.x>=ge})};b.edges().forEach(function(te){var N,Se=b.edge(te),Fe=m.findIndex(function($e){var Ze=(0,Rn.getEdgeTerminal)($e,"source"),Je=(0,Rn.getEdgeTerminal)($e,"target");return Ze===te.v&&Je===te.w});if(!(Fe<=-1)&&s.edgeLabelSpace&&s.controlPoints&&m[Fe].type!=="loop"){(N=Se==null?void 0:Se.points)===null||N===void 0||N.forEach(function($e){$e.x+=O[0],$e.y+=O[1]});var ge=s.nodeMap[te.v],Ue=s.nodeMap[te.w];m[Fe].controlPoints=dQ(Se==null?void 0:Se.points,ge,Ue,sr,z,tn,tt)}})}return s.onLayoutEnd&&s.onLayoutEnd(),{nodes:u,edges:m}}},e.prototype.getRadialPos=function(r,n,a,i,o){o===void 0&&(o=[0,1]);var s=(r-n[0])/a;s=s*(o[1]-o[0])+o[0];var u=s*2*Math.PI;return{x:Math.cos(u)*i,y:Math.sin(u)*i}},e.prototype.getType=function(){return"dagre"},e}(cQ.Base);yu.DagreLayout=hQ;var dQ=function(t,e,r,n,a,i,o){var s=(t==null?void 0:t.slice(1,t.length-1))||[];if(e&&r){var u=e.x,f=e.y,l=r.x,c=r.y;if(a&&(u=e.y,f=e.x,l=r.y,c=r.x),c!==f&&u!==l){var h=n.indexOf(f),d=n[h+1];if(d){var v=s[0],p=a?{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||i(v,p))&&s.unshift(p)}var g=n.indexOf(c),y=Math.abs(g-h);if(y===1)s=o(s,e,r),s.length||s.push(a?{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],w=a?{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||i(b,w))&&s.push(w)}}}}return s},vl={};const ed={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 Tg(t={},e=ed){var r,n,a,i;const o=JSON.parse(JSON.stringify(e)),s=((r=t==null?void 0:t.graph)===null||r===void 0?void 0:r.meta)||{},u=((n=t==null?void 0:t.subScene)===null||n===void 0?void 0:n.meta)||{},f=((a=t==null?void 0:t.nodeSize)===null||a===void 0?void 0:a.meta)||{},l=((i=t==null?void 0:t.nodeSize)===null||i===void 0?void 0:i.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 lk(t){return`◬${t}◬`}const su=lk("ROOT"),ck=lk("BRIDGE_GRAPH");var kn,Yo,uu,Ig;(function(t){t[t.META=0]="META",t[t.NODE=1]="NODE",t[t.BRIDGE=2]="BRIDGE"})(kn||(kn={})),function(t){t[t.INCLUDE=0]="INCLUDE",t[t.EXCLUDE=1]="EXCLUDE",t[t.UNSPECIFIED=2]="UNSPECIFIED"}(Yo||(Yo={})),function(t){t[t.META=0]="META",t[t.CORE=1]="CORE",t[t.BRIDGE=2]="BRIDGE"}(uu||(uu={})),function(t){t[t.META=0]="META",t[t.OP=1]="OP",t[t.SERIES=2]="SERIES"}(Ig||(Ig={}));var Pc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Om(t,e){return t(e={exports:{}},e.exports),e.exports}var vQ=function(){this.__data__=[],this.size=0},wu=function(t,e){return t===e||t!=t&&e!=e},Zd=function(t,e){for(var r=t.length;r--;)if(wu(t[r][0],e))return r;return-1},pQ=Array.prototype.splice,gQ=function(t){var e=this.__data__,r=Zd(e,t);return!(r<0)&&(r==e.length-1?e.pop():pQ.call(e,r,1),--this.size,!0)},yQ=function(t){var e=this.__data__,r=Zd(e,t);return r<0?void 0:e[r][1]},mQ=function(t){return Zd(this.__data__,t)>-1},bQ=function(t,e){var r=this.__data__,n=Zd(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Os(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Os.prototype.clear=vQ,Os.prototype.delete=gQ,Os.prototype.get=yQ,Os.prototype.has=mQ,Os.prototype.set=bQ;var Kd=Os,wQ=function(){this.__data__=new Kd,this.size=0},xQ=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},EQ=function(t){return this.__data__.get(t)},_Q=function(t){return this.__data__.has(t)},hk=typeof Pc=="object"&&Pc&&Pc.Object===Object&&Pc,SQ=typeof self=="object"&&self&&self.Object===Object&&self,_a=hk||SQ||Function("return this")(),na=_a.Symbol,dk=Object.prototype,MQ=dk.hasOwnProperty,AQ=dk.toString,Ku=na?na.toStringTag:void 0,CQ=function(t){var e=MQ.call(t,Ku),r=t[Ku];try{t[Ku]=void 0;var n=!0}catch{}var a=AQ.call(t);return n&&(e?t[Ku]=r:delete t[Ku]),a},TQ=Object.prototype.toString,IQ=function(t){return TQ.call(t)},h_=na?na.toStringTag:void 0,ao=function(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":h_&&h_ in Object(t)?CQ(t):IQ(t)},Dn=function(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")},d_,pl=function(t){if(!Dn(t))return!1;var e=ao(t);return e=="[object Function]"||e=="[object GeneratorFunction]"||e=="[object AsyncFunction]"||e=="[object Proxy]"},t0=_a["__core-js_shared__"],v_=(d_=/[^.]+$/.exec(t0&&t0.keys&&t0.keys.IE_PROTO||""))?"Symbol(src)_1."+d_:"",kQ=function(t){return!!v_&&v_ in t},NQ=Function.prototype.toString,Jo=function(t){if(t!=null){try{return NQ.call(t)}catch{}try{return t+""}catch{}}return""},OQ=/^\[object .+?Constructor\]$/,LQ=Function.prototype,DQ=Object.prototype,PQ=LQ.toString,RQ=DQ.hasOwnProperty,FQ=RegExp("^"+PQ.call(RQ).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),BQ=function(t){return!(!Dn(t)||kQ(t))&&(pl(t)?FQ:OQ).test(Jo(t))},GQ=function(t,e){return t==null?void 0:t[e]},es=function(t,e){var r=GQ(t,e);return BQ(r)?r:void 0},Yf=es(_a,"Map"),qf=es(Object,"create"),zQ=function(){this.__data__=qf?qf(null):{},this.size=0},jQ=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},UQ=Object.prototype.hasOwnProperty,$Q=function(t){var e=this.__data__;if(qf){var r=e[t];return r==="__lodash_hash_undefined__"?void 0:r}return UQ.call(e,t)?e[t]:void 0},XQ=Object.prototype.hasOwnProperty,WQ=function(t){var e=this.__data__;return qf?e[t]!==void 0:XQ.call(e,t)},VQ=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=qf&&e===void 0?"__lodash_hash_undefined__":e,this};function Ls(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ls.prototype.clear=zQ,Ls.prototype.delete=jQ,Ls.prototype.get=$Q,Ls.prototype.has=WQ,Ls.prototype.set=VQ;var p_=Ls,YQ=function(){this.size=0,this.__data__={hash:new p_,map:new(Yf||Kd),string:new p_}},qQ=function(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null},Qd=function(t,e){var r=t.__data__;return qQ(e)?r[typeof e=="string"?"string":"hash"]:r.map},HQ=function(t){var e=Qd(this,t).delete(t);return this.size-=e?1:0,e},ZQ=function(t){return Qd(this,t).get(t)},KQ=function(t){return Qd(this,t).has(t)},QQ=function(t,e){var r=Qd(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function Ds(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ds.prototype.clear=YQ,Ds.prototype.delete=HQ,Ds.prototype.get=ZQ,Ds.prototype.has=KQ,Ds.prototype.set=QQ;var Jd=Ds,JQ=function(t,e){var r=this.__data__;if(r instanceof Kd){var n=r.__data__;if(!Yf||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Jd(n)}return r.set(t,e),this.size=r.size,this};function Ps(t){var e=this.__data__=new Kd(t);this.size=e.size}Ps.prototype.clear=wQ,Ps.prototype.delete=xQ,Ps.prototype.get=EQ,Ps.prototype.has=_Q,Ps.prototype.set=JQ;var Vs=Ps,Lm=function(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t},td=function(){try{var t=es(Object,"defineProperty");return t({},"",{}),t}catch{}}(),ev=function(t,e,r){e=="__proto__"&&td?td(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r},eJ=Object.prototype.hasOwnProperty,tv=function(t,e,r){var n=t[e];eJ.call(t,e)&&wu(n,r)&&(r!==void 0||e in t)||ev(t,e,r)},gl=function(t,e,r,n){var a=!r;r||(r={});for(var i=-1,o=e.length;++i<o;){var s=e[i],u=void 0;u===void 0&&(u=t[s]),a?ev(r,s,u):tv(r,s,u)}return r},tJ=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n},wa=function(t){return t!=null&&typeof t=="object"},g_=function(t){return wa(t)&&ao(t)=="[object Arguments]"},vk=Object.prototype,rJ=vk.hasOwnProperty,nJ=vk.propertyIsEnumerable,fu=g_(function(){return arguments}())?g_:function(t){return wa(t)&&rJ.call(t,"callee")&&!nJ.call(t,"callee")},Pr=Array.isArray,aJ=function(){return!1},qo=Om(function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,a=n&&n.exports===r?_a.Buffer:void 0,i=(a?a.isBuffer:void 0)||aJ;t.exports=i}),iJ=/^(?:0|[1-9]\d*)$/,rv=function(t,e){var r=typeof t;return!!(e=e??9007199254740991)&&(r=="number"||r!="symbol"&&iJ.test(t))&&t>-1&&t%1==0&&t<e},Dm=function(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=9007199254740991},br={};br["[object Float32Array]"]=br["[object Float64Array]"]=br["[object Int8Array]"]=br["[object Int16Array]"]=br["[object Int32Array]"]=br["[object Uint8Array]"]=br["[object Uint8ClampedArray]"]=br["[object Uint16Array]"]=br["[object Uint32Array]"]=!0,br["[object Arguments]"]=br["[object Array]"]=br["[object ArrayBuffer]"]=br["[object Boolean]"]=br["[object DataView]"]=br["[object Date]"]=br["[object Error]"]=br["[object Function]"]=br["[object Map]"]=br["[object Number]"]=br["[object Object]"]=br["[object RegExp]"]=br["[object Set]"]=br["[object String]"]=br["[object WeakMap]"]=!1;var oJ=function(t){return wa(t)&&Dm(t.length)&&!!br[ao(t)]},nv=function(t){return function(e){return t(e)}},lu=Om(function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,a=n&&n.exports===r&&hk.process,i=function(){try{var o=n&&n.require&&n.require("util").types;return o||a&&a.binding&&a.binding("util")}catch{}}();t.exports=i}),y_=lu&&lu.isTypedArray,yl=y_?nv(y_):oJ,sJ=Object.prototype.hasOwnProperty,pk=function(t,e){var r=Pr(t),n=!r&&fu(t),a=!r&&!n&&qo(t),i=!r&&!n&&!a&&yl(t),o=r||n||a||i,s=o?tJ(t.length,String):[],u=s.length;for(var f in t)!e&&!sJ.call(t,f)||o&&(f=="length"||a&&(f=="offset"||f=="parent")||i&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||rv(f,u))||s.push(f);return s},uJ=Object.prototype,av=function(t){var e=t&&t.constructor;return t===(typeof e=="function"&&e.prototype||uJ)},gk=function(t,e){return function(r){return t(e(r))}},fJ=gk(Object.keys,Object),lJ=Object.prototype.hasOwnProperty,Pm=function(t){if(!av(t))return fJ(t);var e=[];for(var r in Object(t))lJ.call(t,r)&&r!="constructor"&&e.push(r);return e},Ei=function(t){return t!=null&&Dm(t.length)&&!pl(t)},io=function(t){return Ei(t)?pk(t):Pm(t)},cJ=function(t,e){return t&&gl(e,io(e),t)},hJ=function(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e},dJ=Object.prototype.hasOwnProperty,vJ=function(t){if(!Dn(t))return hJ(t);var e=av(t),r=[];for(var n in t)(n!="constructor"||!e&&dJ.call(t,n))&&r.push(n);return r},ts=function(t){return Ei(t)?pk(t,!0):vJ(t)},pJ=function(t,e){return t&&gl(e,ts(e),t)},yk=Om(function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,a=n&&n.exports===r?_a.Buffer:void 0,i=a?a.allocUnsafe:void 0;t.exports=function(o,s){if(s)return o.slice();var u=o.length,f=i?i(u):new o.constructor(u);return o.copy(f),f}}),mk=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e},bk=function(t,e){for(var r=-1,n=t==null?0:t.length,a=0,i=[];++r<n;){var o=t[r];e(o,r,t)&&(i[a++]=o)}return i},wk=function(){return[]},gJ=Object.prototype.propertyIsEnumerable,m_=Object.getOwnPropertySymbols,Rm=m_?function(t){return t==null?[]:(t=Object(t),bk(m_(t),function(e){return gJ.call(t,e)}))}:wk,yJ=function(t,e){return gl(t,Rm(t),e)},Fm=function(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t},iv=gk(Object.getPrototypeOf,Object),xk=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Fm(e,Rm(t)),t=iv(t);return e}:wk,mJ=function(t,e){return gl(t,xk(t),e)},Ek=function(t,e,r){var n=e(t);return Pr(t)?n:Fm(n,r(t))},kg=function(t){return Ek(t,io,Rm)},bJ=function(t){return Ek(t,ts,xk)},Ng=es(_a,"DataView"),Og=es(_a,"Promise"),Ys=es(_a,"Set"),Lg=es(_a,"WeakMap"),wJ=Jo(Ng),xJ=Jo(Yf),EJ=Jo(Og),_J=Jo(Ys),SJ=Jo(Lg),Oo=ao;(Ng&&Oo(new Ng(new ArrayBuffer(1)))!="[object DataView]"||Yf&&Oo(new Yf)!="[object Map]"||Og&&Oo(Og.resolve())!="[object Promise]"||Ys&&Oo(new Ys)!="[object Set]"||Lg&&Oo(new Lg)!="[object WeakMap]")&&(Oo=function(t){var e=ao(t),r=e=="[object Object]"?t.constructor:void 0,n=r?Jo(r):"";if(n)switch(n){case wJ:return"[object DataView]";case xJ:return"[object Map]";case EJ:return"[object Promise]";case _J:return"[object Set]";case SJ:return"[object WeakMap]"}return e});var Ho=Oo,MJ=Object.prototype.hasOwnProperty,AJ=function(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&MJ.call(t,"index")&&(r.index=t.index,r.input=t.input),r},rd=_a.Uint8Array,Bm=function(t){var e=new t.constructor(t.byteLength);return new rd(e).set(new rd(t)),e},CJ=function(t,e){var r=e?Bm(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)},TJ=/\w*$/,IJ=function(t){var e=new t.constructor(t.source,TJ.exec(t));return e.lastIndex=t.lastIndex,e},b_=na?na.prototype:void 0,w_=b_?b_.valueOf:void 0,kJ=function(t){return w_?Object(w_.call(t)):{}},_k=function(t,e){var r=e?Bm(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)},NJ=function(t,e,r){var n=t.constructor;switch(e){case"[object ArrayBuffer]":return Bm(t);case"[object Boolean]":case"[object Date]":return new n(+t);case"[object DataView]":return CJ(t,r);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 _k(t,r);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(t);case"[object RegExp]":return IJ(t);case"[object Set]":return new n;case"[object Symbol]":return kJ(t)}},x_=Object.create,Sk=function(){function t(){}return function(e){if(!Dn(e))return{};if(x_)return x_(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Mk=function(t){return typeof t.constructor!="function"||av(t)?{}:Sk(iv(t))},OJ=function(t){return wa(t)&&Ho(t)=="[object Map]"},E_=lu&&lu.isMap,LJ=E_?nv(E_):OJ,DJ=function(t){return wa(t)&&Ho(t)=="[object Set]"},__=lu&&lu.isSet,PJ=__?nv(__):DJ,yr={};yr["[object Arguments]"]=yr["[object Array]"]=yr["[object ArrayBuffer]"]=yr["[object DataView]"]=yr["[object Boolean]"]=yr["[object Date]"]=yr["[object Float32Array]"]=yr["[object Float64Array]"]=yr["[object Int8Array]"]=yr["[object Int16Array]"]=yr["[object Int32Array]"]=yr["[object Map]"]=yr["[object Number]"]=yr["[object Object]"]=yr["[object RegExp]"]=yr["[object Set]"]=yr["[object String]"]=yr["[object Symbol]"]=yr["[object Uint8Array]"]=yr["[object Uint8ClampedArray]"]=yr["[object Uint16Array]"]=yr["[object Uint32Array]"]=!0,yr["[object Error]"]=yr["[object Function]"]=yr["[object WeakMap]"]=!1;var Ak=function t(e,r,n,a,i,o){var s,u=1&r,f=2&r,l=4&r;if(s!==void 0)return s;if(!Dn(e))return e;var c=Pr(e);if(c){if(s=AJ(e),!u)return mk(e,s)}else{var h=Ho(e),d=h=="[object Function]"||h=="[object GeneratorFunction]";if(qo(e))return yk(e,u);if(h=="[object Object]"||h=="[object Arguments]"||d&&!i){if(s=f||d?{}:Mk(e),!u)return f?mJ(e,pJ(s,e)):yJ(e,cJ(s,e))}else{if(!yr[h])return i?e:{};s=NJ(e,h,u)}}o||(o=new Vs);var v=o.get(e);if(v)return v;o.set(e,s),PJ(e)?e.forEach(function(g){s.add(t(g,r,n,g,e,o))}):LJ(e)&&e.forEach(function(g,y){s.set(y,t(g,r,n,y,e,o))});var p=c?void 0:(l?f?bJ:kg:f?ts:io)(e);return Lm(p||e,function(g,y){p&&(g=e[y=g]),tv(s,y,t(g,r,n,y,e,o))}),s},RJ=function(t){return Ak(t,4)},Gm=function(t){return function(){return t}},zm=function(t){return function(e,r,n){for(var a=-1,i=Object(e),o=n(e),s=o.length;s--;){var u=o[++a];if(r(i[u],u,i)===!1)break}return e}}(),jm=function(t,e){return t&&zm(t,e,io)},ov=function(t,e){return function(r,n){if(r==null)return r;if(!Ei(r))return t(r,n);for(var a=r.length,i=-1,o=Object(r);++i<a&&n(o[i],i,o)!==!1;);return r}}(jm),rs=function(t){return t},Ck=function(t){return typeof t=="function"?t:rs},Tk=function(t,e){return(Pr(t)?Lm:ov)(t,Ck(e))},Ik=Tk,FJ=function(t,e){var r=[];return ov(t,function(n,a,i){e(n,a,i)&&r.push(n)}),r},BJ=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},GJ=function(t){return this.__data__.has(t)};function ph(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Jd;++e<r;)this.add(t[e])}ph.prototype.add=ph.prototype.push=BJ,ph.prototype.has=GJ;var kk=ph,zJ=function(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1},Nk=function(t,e){return t.has(e)},Ok=function(t,e,r,n,a,i){var o=1&r,s=t.length,u=e.length;if(s!=u&&!(o&&u>s))return!1;var f=i.get(t),l=i.get(e);if(f&&l)return f==e&&l==t;var c=-1,h=!0,d=2&r?new kk:void 0;for(i.set(t,e),i.set(e,t);++c<s;){var v=t[c],p=e[c];if(n)var g=o?n(p,v,c,e,t,i):n(v,p,c,t,e,i);if(g!==void 0){if(g)continue;h=!1;break}if(d){if(!zJ(e,function(y,m){if(!Nk(d,m)&&(v===y||a(v,y,r,n,i)))return d.push(m)})){h=!1;break}}else if(v!==p&&!a(v,p,r,n,i)){h=!1;break}}return i.delete(t),i.delete(e),h},jJ=function(t){var e=-1,r=Array(t.size);return t.forEach(function(n,a){r[++e]=[a,n]}),r},Um=function(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r},S_=na?na.prototype:void 0,r0=S_?S_.valueOf:void 0,UJ=function(t,e,r,n,a,i,o){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new rd(t),new rd(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return wu(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var s=jJ;case"[object Set]":var u=1&n;if(s||(s=Um),t.size!=e.size&&!u)return!1;var f=o.get(t);if(f)return f==e;n|=2,o.set(t,e);var l=Ok(s(t),s(e),n,a,i,o);return o.delete(t),l;case"[object Symbol]":if(r0)return r0.call(t)==r0.call(e)}return!1},$J=Object.prototype.hasOwnProperty,XJ=function(t,e,r,n,a,i){var o=1&r,s=kg(t),u=s.length;if(u!=kg(e).length&&!o)return!1;for(var f=u;f--;){var l=s[f];if(!(o?l in e:$J.call(e,l)))return!1}var c=i.get(t),h=i.get(e);if(c&&h)return c==e&&h==t;var d=!0;i.set(t,e),i.set(e,t);for(var v=o;++f<u;){var p=t[l=s[f]],g=e[l];if(n)var y=o?n(g,p,l,e,t,i):n(p,g,l,t,e,i);if(!(y===void 0?p===g||a(p,g,r,n,i):y)){d=!1;break}v||(v=l=="constructor")}if(d&&!v){var m=t.constructor,b=e.constructor;m==b||!("constructor"in t)||!("constructor"in e)||typeof m=="function"&&m instanceof m&&typeof b=="function"&&b instanceof b||(d=!1)}return i.delete(t),i.delete(e),d},M_=Object.prototype.hasOwnProperty,WJ=function(t,e,r,n,a,i){var o=Pr(t),s=Pr(e),u=o?"[object Array]":Ho(t),f=s?"[object Array]":Ho(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&&qo(t)){if(!qo(e))return!1;o=!0,l=!1}if(h&&!l)return i||(i=new Vs),o||yl(t)?Ok(t,e,r,n,a,i):UJ(t,e,u,r,n,a,i);if(!(1&r)){var d=l&&M_.call(t,"__wrapped__"),v=c&&M_.call(e,"__wrapped__");if(d||v){var p=d?t.value():t,g=v?e.value():e;return i||(i=new Vs),a(p,g,r,n,i)}}return!!h&&(i||(i=new Vs),XJ(t,e,r,n,a,i))},Lk=function t(e,r,n,a,i){return e===r||(e==null||r==null||!wa(e)&&!wa(r)?e!=e&&r!=r:WJ(e,r,n,a,t,i))},VJ=function(t,e,r,n){var a=r.length,i=a;if(t==null)return!i;for(t=Object(t);a--;){var o=r[a];if(o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++a<i;){var s=(o=r[a])[0],u=t[s],f=o[1];if(o[2]){if(u===void 0&&!(s in t))return!1}else{var l=new Vs,c;if(!(c===void 0?Lk(f,u,3,n,l):c))return!1}}return!0},Dk=function(t){return t==t&&!Dn(t)},YJ=function(t){for(var e=io(t),r=e.length;r--;){var n=e[r],a=t[n];e[r]=[n,a,Dk(a)]}return e},Pk=function(t,e){return function(r){return r!=null&&r[t]===e&&(e!==void 0||t in Object(r))}},qJ=function(t){var e=YJ(t);return e.length==1&&e[0][2]?Pk(e[0][0],e[0][1]):function(r){return r===t||VJ(r,t,e)}},Zo=function(t){return typeof t=="symbol"||wa(t)&&ao(t)=="[object Symbol]"},HJ=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ZJ=/^\w*$/,$m=function(t,e){if(Pr(t))return!1;var r=typeof t;return!(r!="number"&&r!="symbol"&&r!="boolean"&&t!=null&&!Zo(t))||ZJ.test(t)||!HJ.test(t)||e!=null&&t in Object(e)};function Xm(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");var r=function(){var n=arguments,a=e?e.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var o=t.apply(this,n);return r.cache=i.set(a,o)||i,o};return r.cache=new(Xm.Cache||Jd),r}Xm.Cache=Jd;var KJ=Xm,QJ=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,JJ=/\\(\\)?/g,eee=function(t){var e=KJ(t,function(n){return r.size===500&&r.clear(),n}),r=e.cache;return e}(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(QJ,function(r,n,a,i){e.push(a?i.replace(JJ,"$1"):n||r)}),e}),qs=function(t,e){for(var r=-1,n=t==null?0:t.length,a=Array(n);++r<n;)a[r]=e(t[r],r,t);return a},A_=na?na.prototype:void 0,C_=A_?A_.toString:void 0,tee=function t(e){if(typeof e=="string")return e;if(Pr(e))return qs(e,t)+"";if(Zo(e))return C_?C_.call(e):"";var r=e+"";return r=="0"&&1/e==-1/0?"-0":r},Rk=function(t){return t==null?"":tee(t)},sv=function(t,e){return Pr(t)?t:$m(t,e)?[t]:eee(Rk(t))},ml=function(t){if(typeof t=="string"||Zo(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e},uv=function(t,e){for(var r=0,n=(e=sv(e,t)).length;t!=null&&r<n;)t=t[ml(e[r++])];return r&&r==n?t:void 0},ree=function(t,e,r){var n=t==null?void 0:uv(t,e);return n===void 0?r:n},nee=function(t,e){return t!=null&&e in Object(t)},Fk=function(t,e,r){for(var n=-1,a=(e=sv(e,t)).length,i=!1;++n<a;){var o=ml(e[n]);if(!(i=t!=null&&r(t,o)))break;t=t[o]}return i||++n!=a?i:!!(a=t==null?0:t.length)&&Dm(a)&&rv(o,a)&&(Pr(t)||fu(t))},Bk=function(t,e){return t!=null&&Fk(t,e,nee)},aee=function(t,e){return $m(t)&&Dk(e)?Pk(ml(t),e):function(r){var n=ree(r,t);return n===void 0&&n===e?Bk(r,t):Lk(e,n,3)}},Gk=function(t){return function(e){return e==null?void 0:e[t]}},iee=function(t){return function(e){return uv(e,t)}},oee=function(t){return $m(t)?Gk(ml(t)):iee(t)},_i=function(t){return typeof t=="function"?t:t==null?rs:typeof t=="object"?Pr(t)?aee(t[0],t[1]):qJ(t):oee(t)},zk=function(t,e){return(Pr(t)?bk:FJ)(t,_i(e))},see=Object.prototype.hasOwnProperty,uee=function(t,e){return t!=null&&see.call(t,e)},jk=function(t,e){return t!=null&&Fk(t,e,uee)},fee=Object.prototype.hasOwnProperty,lee=function(t){if(t==null)return!0;if(Ei(t)&&(Pr(t)||typeof t=="string"||typeof t.splice=="function"||qo(t)||yl(t)||fu(t)))return!t.length;var e=Ho(t);if(e=="[object Map]"||e=="[object Set]")return!t.size;if(av(t))return!Pm(t).length;for(var r in t)if(fee.call(t,r))return!1;return!0},Uk=function(t){return t===void 0},$k=function(t,e){var r=-1,n=Ei(t)?Array(t.length):[];return ov(t,function(a,i,o){n[++r]=e(a,i,o)}),n},Xk=function(t,e){return(Pr(t)?qs:$k)(t,_i(e))},cee=function(t,e,r,n){var a=-1,i=t==null?0:t.length;for(n&&i&&(r=t[++a]);++a<i;)r=e(r,t[a],a,t);return r},hee=function(t,e,r,n,a){return a(t,function(i,o,s){r=n?(n=!1,i):e(r,i,o,s)}),r},Wk=function(t,e,r){var n=Pr(t)?cee:hee,a=arguments.length<3;return n(t,_i(e),r,a,ov)},dee=function(t){return typeof t=="string"||!Pr(t)&&wa(t)&&ao(t)=="[object String]"},vee=Gk("length"),pee=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),gee=function(t){return pee.test(t)},yee="[\\ud800-\\udfff]",Dg="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Pg="\\ud83c[\\udffb-\\udfff]",Vk="[^\\ud800-\\udfff]",Yk="(?:\\ud83c[\\udde6-\\uddff]){2}",qk="[\\ud800-\\udbff][\\udc00-\\udfff]",T_="(?:"+Dg+"|"+Pg+")?",mee="[\\ufe0e\\ufe0f]?"+T_+("(?:\\u200d(?:"+[Vk,Yk,qk].join("|")+")[\\ufe0e\\ufe0f]?"+T_+")*"),bee="(?:"+[Vk+Dg+"?",Dg,Yk,qk,yee].join("|")+")",I_=RegExp(Pg+"(?="+Pg+")|"+bee+mee,"g"),wee=function(t){for(var e=I_.lastIndex=0;I_.test(t);)++e;return e},xee=function(t){return gee(t)?wee(t):vee(t)},Eee=function(t){if(t==null)return 0;if(Ei(t))return dee(t)?xee(t):t.length;var e=Ho(t);return e=="[object Map]"||e=="[object Set]"?t.size:Pm(t).length},_ee=function(t,e,r){var n=Pr(t),a=n||qo(t)||yl(t);if(e=_i(e),r==null){var i=t&&t.constructor;r=a?n?new i:[]:Dn(t)&&pl(i)?Sk(iv(t)):{}}return(a?Lm:jm)(t,function(o,s,u){return e(r,o,s,u)}),r},k_=na?na.isConcatSpreadable:void 0,See=function(t){return Pr(t)||fu(t)||!!(k_&&t&&t[k_])},Wm=function(e,r,n,a,i){var o=-1,s=e.length;for(n||(n=See),i||(i=[]);++o<s;){var u=e[o];n(u)?Fm(i,u):a||(i[i.length]=u)}return i},Mee=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)},N_=Math.max,Hk=function(t,e,r){return e=N_(e===void 0?t.length-1:e,0),function(){for(var n=arguments,a=-1,i=N_(n.length-e,0),o=Array(i);++a<i;)o[a]=n[e+a];a=-1;for(var s=Array(e+1);++a<e;)s[a]=n[a];return s[e]=r(o),Mee(t,this,s)}},Aee=td?function(t,e){return td(t,"toString",{configurable:!0,enumerable:!1,value:Gm(e),writable:!0})}:rs,Cee=Date.now,Zk=function(t){var e=0,r=0;return function(){var n=Cee(),a=16-(n-r);if(r=n,a>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Aee),fv=function(t,e){return Zk(Hk(t,e,rs),t+"")},Kk=function(t,e,r,n){for(var a=t.length,i=r+-1;++i<a;)if(e(t[i],i,t))return i;return-1},Tee=function(t){return t!=t},Iee=function(t,e,r){for(var n=r-1,a=t.length;++n<a;)if(t[n]===e)return n;return-1},kee=function(t,e,r){return e==e?Iee(t,e,r):Kk(t,Tee,r)},Nee=function(t,e){return!!(t!=null&&t.length)&&kee(t,e,0)>-1},Oee=function(){},Lee=Ys&&1/Um(new Ys([,-0]))[1]==1/0?function(t){return new Ys(t)}:Oee,Dee=function(t,e,r){var n=-1,a=Nee,i=t.length,o=!0,s=[],u=s;if(i>=200){var f=Lee(t);if(f)return Um(f);o=!1,a=Nk,u=new kk}else u=s;e:for(;++n<i;){var l=t[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 a(u,c,r)||(u!==s&&u.push(c),s.push(l))}return s},Qk=function(t){return wa(t)&&Ei(t)},Pee=fv(function(t){return Dee(Wm(t,1,Qk,!0))}),Ree=function(t,e){return qs(e,function(r){return t[r]})},nd,Jk=function(t){return t==null?[]:Ree(t,io(t))};try{nd={clone:RJ,constant:Gm,each:Ik,filter:zk,has:jk,isArray:Pr,isEmpty:lee,isFunction:pl,isUndefined:Uk,keys:io,map:Xk,reduce:Wk,size:Eee,transform:_ee,union:Pee,values:Jk}}catch{}nd||(nd=window._);var ot=nd,Vm=tr;function tr(t){this._isDirected=!ot.has(t,"directed")||t.directed,this._isMultigraph=!!ot.has(t,"multigraph")&&t.multigraph,this._isCompound=!!ot.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=ot.constant(void 0),this._defaultEdgeLabelFn=ot.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 O_(t,e){t[e]?t[e]++:t[e]=1}function L_(t,e){--t[e]||delete t[e]}function yf(t,e,r,n){var a=""+e,i=""+r;if(!t&&a>i){var o=a;a=i,i=o}return a+""+i+""+(ot.isUndefined(n)?"\0":n)}function Fee(t,e,r,n){var a=""+e,i=""+r;if(!t&&a>i){var o=a;a=i,i=o}var s={v:a,w:i};return n&&(s.name=n),s}function n0(t,e){return yf(t,e.v,e.w,e.name)}tr.prototype._nodeCount=0,tr.prototype._edgeCount=0,tr.prototype.isDirected=function(){return this._isDirected},tr.prototype.isMultigraph=function(){return this._isMultigraph},tr.prototype.isCompound=function(){return this._isCompound},tr.prototype.setGraph=function(t){return this._label=t,this},tr.prototype.graph=function(){return this._label},tr.prototype.setDefaultNodeLabel=function(t){return ot.isFunction(t)||(t=ot.constant(t)),this._defaultNodeLabelFn=t,this},tr.prototype.nodeCount=function(){return this._nodeCount},tr.prototype.nodes=function(){return ot.keys(this._nodes)},tr.prototype.sources=function(){var t=this;return ot.filter(this.nodes(),function(e){return ot.isEmpty(t._in[e])})},tr.prototype.sinks=function(){var t=this;return ot.filter(this.nodes(),function(e){return ot.isEmpty(t._out[e])})},tr.prototype.setNodes=function(t,e){var r=arguments,n=this;return ot.each(t,function(a){r.length>1?n.setNode(a,e):n.setNode(a)}),this},tr.prototype.setNode=function(t,e){return ot.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},tr.prototype.node=function(t){return this._nodes[t]},tr.prototype.hasNode=function(t){return ot.has(this._nodes,t)},tr.prototype.removeNode=function(t){var e=this;if(ot.has(this._nodes,t)){var r=function(n){e.removeEdge(e._edgeObjs[n])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],ot.each(this.children(t),function(n){e.setParent(n)}),delete this._children[t]),ot.each(ot.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],ot.each(ot.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},tr.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ot.isUndefined(e))e="\0";else{for(var r=e+="";!ot.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},tr.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},tr.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!=="\0")return e}},tr.prototype.children=function(t){if(ot.isUndefined(t)&&(t="\0"),this._isCompound){var e=this._children[t];if(e)return ot.keys(e)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}},tr.prototype.predecessors=function(t){var e=this._preds[t];if(e)return ot.keys(e)},tr.prototype.successors=function(t){var e=this._sucs[t];if(e)return ot.keys(e)},tr.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return ot.union(e,this.successors(t))},tr.prototype.isLeaf=function(t){return(this.isDirected()?this.successors(t):this.neighbors(t)).length===0},tr.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;ot.each(this._nodes,function(i,o){t(o)&&e.setNode(o,i)}),ot.each(this._edgeObjs,function(i){e.hasNode(i.v)&&e.hasNode(i.w)&&e.setEdge(i,r.edge(i))});var n={};function a(i){var o=r.parent(i);return o===void 0||e.hasNode(o)?(n[i]=o,o):o in n?n[o]:a(o)}return this._isCompound&&ot.each(e.nodes(),function(i){e.setParent(i,a(i))}),e},tr.prototype.setDefaultEdgeLabel=function(t){return ot.isFunction(t)||(t=ot.constant(t)),this._defaultEdgeLabelFn=t,this},tr.prototype.edgeCount=function(){return this._edgeCount},tr.prototype.edges=function(){return ot.values(this._edgeObjs)},tr.prototype.setPath=function(t,e){var r=this,n=arguments;return ot.reduce(t,function(a,i){return n.length>1?r.setEdge(a,i,e):r.setEdge(a,i),i}),this},tr.prototype.setEdge=function(){var t,e,r,n,a=!1,i=arguments[0];typeof i=="object"&&i!==null&&"v"in i?(t=i.v,e=i.w,r=i.name,arguments.length===2&&(n=arguments[1],a=!0)):(t=i,e=arguments[1],r=arguments[3],arguments.length>2&&(n=arguments[2],a=!0)),t=""+t,e=""+e,ot.isUndefined(r)||(r=""+r);var o=yf(this._isDirected,t,e,r);if(ot.has(this._edgeLabels,o))return a&&(this._edgeLabels[o]=n),this;if(!ot.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[o]=a?n:this._defaultEdgeLabelFn(t,e,r);var s=Fee(this._isDirected,t,e,r);return t=s.v,e=s.w,Object.freeze(s),this._edgeObjs[o]=s,O_(this._preds[e],t),O_(this._sucs[t],e),this._in[e][o]=s,this._out[t][o]=s,this._edgeCount++,this},tr.prototype.edge=function(t,e,r){var n=arguments.length===1?n0(this._isDirected,arguments[0]):yf(this._isDirected,t,e,r);return this._edgeLabels[n]},tr.prototype.hasEdge=function(t,e,r){var n=arguments.length===1?n0(this._isDirected,arguments[0]):yf(this._isDirected,t,e,r);return ot.has(this._edgeLabels,n)},tr.prototype.removeEdge=function(t,e,r){var n=arguments.length===1?n0(this._isDirected,arguments[0]):yf(this._isDirected,t,e,r),a=this._edgeObjs[n];return a&&(t=a.v,e=a.w,delete this._edgeLabels[n],delete this._edgeObjs[n],L_(this._preds[e],t),L_(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},tr.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var n=ot.values(r);return e?ot.filter(n,function(a){return a.v===e}):n}},tr.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var n=ot.values(r);return e?ot.filter(n,function(a){return a.w===e}):n}},tr.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))};var D_={Graph:Vm,version:"2.1.8"},Bee={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:Gee(t),edges:zee(t)};return ot.isUndefined(t.graph())||(e.value=ot.clone(t.graph())),e},read:function(t){var e=new Vm(t.options).setGraph(t.value);return ot.each(t.nodes,function(r){e.setNode(r.v,r.value),r.parent&&e.setParent(r.v,r.parent)}),ot.each(t.edges,function(r){e.setEdge({v:r.v,w:r.w,name:r.name},r.value)}),e}};function Gee(t){return ot.map(t.nodes(),function(e){var r=t.node(e),n=t.parent(e),a={v:e};return ot.isUndefined(r)||(a.value=r),ot.isUndefined(n)||(a.parent=n),a})}function zee(t){return ot.map(t.edges(),function(e){var r=t.edge(e),n={v:e.v,w:e.w};return ot.isUndefined(e.name)||(n.name=e.name),ot.isUndefined(r)||(n.value=r),n})}var jee=function(t){var e,r={},n=[];function a(i){ot.has(r,i)||(r[i]=!0,e.push(i),ot.each(t.successors(i),a),ot.each(t.predecessors(i),a))}return ot.each(t.nodes(),function(i){e=[],a(i),e.length&&n.push(e)}),n},eN=Qn;function Qn(){this._arr=[],this._keyIndices={}}Qn.prototype.size=function(){return this._arr.length},Qn.prototype.keys=function(){return this._arr.map(function(t){return t.key})},Qn.prototype.has=function(t){return ot.has(this._keyIndices,t)},Qn.prototype.priority=function(t){var e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority},Qn.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},Qn.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!ot.has(r,t)){var n=this._arr,a=n.length;return r[t]=a,n.push({key:t,priority:e}),this._decrease(a),!0}return!1},Qn.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},Qn.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},Qn.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,a=t;r<e.length&&(a=e[r].priority<e[a].priority?r:a,n<e.length&&(a=e[n].priority<e[a].priority?n:a),a!==t&&(this._swap(t,a),this._heapify(a)))},Qn.prototype._decrease=function(t){for(var e,r=this._arr,n=r[t].priority;t!==0&&!(r[e=t>>1].priority<n);)this._swap(t,e),t=e},Qn.prototype._swap=function(t,e){var r=this._arr,n=this._keyIndices,a=r[t],i=r[e];r[t]=i,r[e]=a,n[i.key]=t,n[a.key]=e};var tN=function(t,e,r,n){return function(a,i,o,s){var u,f,l={},c=new eN,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(a.nodes().forEach(function(d){var v=d===i?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}(t,String(e),r||Uee,n||function(a){return t.outEdges(a)})},Uee=ot.constant(1),$ee=function(t,e,r){return ot.transform(t.nodes(),function(n,a){n[a]=tN(t,a,e,r)},{})},rN=function(t){var e=0,r=[],n={},a=[];function i(o){var s=n[o]={onStack:!0,lowlink:e,index:e++};if(r.push(o),t.successors(o).forEach(function(l){ot.has(n,l)?n[l].onStack&&(s.lowlink=Math.min(s.lowlink,n[l].index)):(i(l),s.lowlink=Math.min(s.lowlink,n[l].lowlink))}),s.lowlink===s.index){var u,f=[];do u=r.pop(),n[u].onStack=!1,f.push(u);while(o!==u);a.push(f)}}return t.nodes().forEach(function(o){ot.has(n,o)||i(o)}),a},Xee=function(t){return ot.filter(rN(t),function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})},Wee=function(t,e,r){return function(n,a,i){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})}),i(u).forEach(function(f){var l=f.v===u?f.w:f.v,c=a(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}(t,e||Vee,r||function(n){return t.outEdges(n)})},Vee=ot.constant(1),a0=nN;function nN(t){var e={},r={},n=[];if(ot.each(t.sinks(),function a(i){if(ot.has(r,i))throw new ad;ot.has(e,i)||(r[i]=!0,e[i]=!0,ot.each(t.predecessors(i),a),delete r[i],n.push(i))}),ot.size(e)!==t.nodeCount())throw new ad;return n}function ad(){}nN.CycleException=ad,ad.prototype=new Error;var P_=function(t,e,r){ot.isArray(e)||(e=[e]);var n=(t.isDirected()?t.successors:t.neighbors).bind(t),a=[],i={};return ot.each(e,function(o){if(!t.hasNode(o))throw new Error("Graph does not have node: "+o);aN(t,o,r==="post",i,n,a)}),a};function aN(t,e,r,n,a,i){ot.has(n,e)||(n[e]=!0,r||i.push(e),ot.each(a(e),function(o){aN(t,o,r,n,a,i)}),r&&i.push(e))}var id,Yee={Graph:D_.Graph,json:Bee,alg:{components:jee,dijkstra:tN,dijkstraAll:$ee,findCycles:Xee,floydWarshall:Wee,isAcyclic:function(t){try{a0(t)}catch(e){if(e instanceof a0.CycleException)return!1;throw e}return!0},postorder:function(t,e){return P_(t,e,"post")},preorder:function(t,e){return P_(t,e,"pre")},prim:function(t,e){var r,n=new Vm,a={},i=new eN;function o(u){var f=u.v===r?u.w:u.v,l=i.priority(f);if(l!==void 0){var c=e(u);c<l&&(a[f]=r,i.decrease(f,c))}}if(t.nodeCount()===0)return n;ot.each(t.nodes(),function(u){i.add(u,Number.POSITIVE_INFINITY),n.setNode(u)}),i.decrease(t.nodes()[0],0);for(var s=!1;i.size()>0;){if(r=i.removeMin(),ot.has(a,r))n.setEdge(r,a[r]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(r).forEach(o)}return n},tarjan:rN,topsort:a0},version:D_.version};try{id=Yee}catch{}id||(id=window.graphlib);var Sa=id,qee=function(t){return Ak(t,5)},Hf=function(t,e,r){if(!Dn(r))return!1;var n=typeof e;return!!(n=="number"?Ei(r)&&rv(e,r.length):n=="string"&&e in r)&&wu(r[e],t)},iN=Object.prototype,Hee=iN.hasOwnProperty,Zee=fv(function(t,e){t=Object(t);var r=-1,n=e.length,a=n>2?e[2]:void 0;for(a&&Hf(e[0],e[1],a)&&(n=1);++r<n;)for(var i=e[r],o=ts(i),s=-1,u=o.length;++s<u;){var f=o[s],l=t[f];(l===void 0||wu(l,iN[f])&&!Hee.call(t,f))&&(t[f]=i[f])}return t}),Kee=function(t){return function(e,r,n){var a=Object(e);if(!Ei(e)){var i=_i(r);e=io(e),r=function(s){return i(a[s],s,a)}}var o=t(e,r,n);return o>-1?a[i?e[o]:o]:void 0}},Qee=/^\s+|\s+$/g,Jee=/^[-+]0x[0-9a-f]+$/i,ete=/^0b[01]+$/i,tte=/^0o[0-7]+$/i,rte=parseInt,nte=function(t){if(typeof t=="number")return t;if(Zo(t))return NaN;if(Dn(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Dn(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(Qee,"");var r=ete.test(t);return r||tte.test(t)?rte(t.slice(2),r?2:8):Jee.test(t)?NaN:+t},gh=function(t){return t?(t=nte(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:t===0?t:0},ate=function(t){var e=gh(t),r=e%1;return e==e?r?e-r:e:0},ite=Math.max,ote=Kee(function(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var a=r==null?0:ate(r);return a<0&&(a=ite(n+a,0)),Kk(t,_i(e),a)}),oN=function(t){return t!=null&&t.length?Wm(t):[]},ste=function(t,e){return t==null?t:zm(t,Ck(e),ts)},ute=function(t){var e=t==null?0:t.length;return e?t[e-1]:void 0},fte=function(t,e){var r={};return e=_i(e),jm(t,function(n,a,i){ev(r,a,e(n,a,i))}),r},Ym=function(t,e,r){for(var n=-1,a=t.length;++n<a;){var i=t[n],o=e(i);if(o!=null&&(s===void 0?o==o&&!Zo(o):r(o,s)))var s=o,u=i}return u},lte=function(t,e){return t>e},cte=function(t){return t&&t.length?Ym(t,rs,lte):void 0},Rg=function(t,e,r){(r!==void 0&&!wu(t[e],r)||r===void 0&&!(e in t))&&ev(t,e,r)},hte=Function.prototype,dte=Object.prototype,sN=hte.toString,vte=dte.hasOwnProperty,pte=sN.call(Object),gte=function(t){if(!wa(t)||ao(t)!="[object Object]")return!1;var e=iv(t);if(e===null)return!0;var r=vte.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&sN.call(r)==pte},R_=function(t,e){if((e!=="constructor"||typeof t[e]!="function")&&e!="__proto__")return t[e]},yte=function(t){return gl(t,ts(t))},mte=function(t,e,r,n,a,i,o){var s=R_(t,r),u=R_(e,r),f=o.get(u);if(f)Rg(t,r,f);else{var l=void 0,c=l===void 0;if(c){var h=Pr(u),d=!h&&qo(u),v=!h&&!d&&yl(u);l=u,h||d||v?Pr(s)?l=s:Qk(s)?l=mk(s):d?(c=!1,l=yk(u,!0)):v?(c=!1,l=_k(u,!0)):l=[]:gte(u)||fu(u)?(l=s,fu(s)?l=yte(s):Dn(s)&&!pl(s)||(l=Mk(u))):c=!1}c&&(o.set(u,l),a(l,u,n,i,o),o.delete(u)),Rg(t,r,l)}},bte=function t(e,r,n,a,i){e!==r&&zm(r,function(o,s){if(i||(i=new Vs),Dn(o))mte(e,r,s,n,t,a,i);else{var u=void 0;u===void 0&&(u=o),Rg(e,s,u)}},ts)},wte=function(t){return fv(function(e,r){var n=-1,a=r.length,i=a>1?r[a-1]:void 0,o=a>2?r[2]:void 0;for(i=t.length>3&&typeof i=="function"?(a--,i):void 0,o&&Hf(r[0],r[1],o)&&(i=a<3?void 0:i,a=1),e=Object(e);++n<a;){var s=r[n];s&&t(e,s,n,i)}return e})}(function(t,e,r){bte(t,e,r)}),uN=function(t,e){return t<e},xte=function(t){return t&&t.length?Ym(t,rs,uN):void 0},Ete=function(t,e){return t&&t.length?Ym(t,_i(e),uN):void 0},_te=function(){return _a.Date.now()},Ste=function(t,e,r,n){if(!Dn(t))return t;for(var a=-1,i=(e=sv(e,t)).length,o=i-1,s=t;s!=null&&++a<i;){var u=ml(e[a]),f=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(a!=o){var l=s[u];(f=void 0)==void 0&&(f=Dn(l)?l:rv(e[a+1])?[]:{})}tv(s,u,f),s=s[u]}return t},Mte=function(t,e,r){for(var n=-1,a=e.length,i={};++n<a;){var o=e[n],s=uv(t,o);r(s,o)&&Ste(i,sv(o,t),s)}return i},Ate=function(t,e){return Mte(t,e,function(r,n){return Bk(t,n)})},Cte=function(t){return Zk(Hk(t,void 0,oN),t+"")}(function(t,e){return t==null?{}:Ate(t,e)}),Tte=Math.ceil,Ite=Math.max,kte=function(t,e,r,n){for(var a=-1,i=Ite(Tte((e-t)/(r||1)),0),o=Array(i);i--;)o[++a]=t,t+=r;return o},Nte=function(t){return function(e,r,n){return n&&typeof n!="number"&&Hf(e,r,n)&&(r=n=void 0),e=gh(e),r===void 0?(r=e,e=0):r=gh(r),n=n===void 0?e<r?1:-1:gh(n),kte(e,r,n)}}(),Ote=function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t},Lte=function(t,e){if(t!==e){var r=t!==void 0,n=t===null,a=t==t,i=Zo(t),o=e!==void 0,s=e===null,u=e==e,f=Zo(e);if(!s&&!f&&!i&&t>e||i&&o&&u&&!s&&!f||n&&o&&u||!r&&u||!a)return 1;if(!n&&!i&&!f&&t<e||f&&r&&a&&!n&&!i||s&&r&&a||!o&&a||!u)return-1}return 0},Dte=function(t,e,r){for(var n=-1,a=t.criteria,i=e.criteria,o=a.length,s=r.length;++n<o;){var u=Lte(a[n],i[n]);if(u)return n>=s?u:u*(r[n]=="desc"?-1:1)}return t.index-e.index},Pte=function(t,e,r){e=e.length?qs(e,function(i){return Pr(i)?function(o){return uv(o,i.length===1?i[0]:i)}:i}):[rs];var n=-1;e=qs(e,nv(_i));var a=$k(t,function(i,o,s){return{criteria:qs(e,function(u){return u(i)}),index:++n,value:i}});return Ote(a,function(i,o){return Dte(i,o,r)})},Rte=fv(function(t,e){if(t==null)return[];var r=e.length;return r>1&&Hf(t,e[0],e[1])?e=[]:r>2&&Hf(e[0],e[1],e[2])&&(e=[e[0]]),Pte(t,Wm(e),[])}),Fte=0,Bte=function(t){var e=++Fte;return Rk(t)+e},Gte=function(t,e,r){for(var n=-1,a=t.length,i=e.length,o={};++n<a;){var s=n<i?e[n]:void 0;r(o,t[n],s)}return o},od,zte=function(t,e){return Gte(t||[],e||[],tv)};try{od={cloneDeep:qee,constant:Gm,defaults:Zee,each:Ik,filter:zk,find:ote,flatten:oN,forEach:Tk,forIn:ste,has:jk,isUndefined:Uk,last:ute,map:Xk,mapValues:fte,max:cte,merge:wte,min:xte,minBy:Ete,now:_te,pick:Cte,range:Nte,reduce:Wk,sortBy:Rte,uniqueId:Bte,values:Jk,zipObject:zte}}catch{}od||(od=window._);var Z=od,jte=yh;function yh(){var t={};t._next=t._prev=t,this._sentinel=t}function F_(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function Ute(t,e){if(t!=="_next"&&t!=="_prev")return e}yh.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return F_(e),e},yh.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&F_(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},yh.prototype.toString=function(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,Ute)),r=r._prev;return"["+t.join(", ")+"]"};var $te=Sa.Graph,Xte=function(t,e){if(t.nodeCount()<=1)return[];var r=function(a,i){var o=new $te,s=0,u=0;Z.forEach(a.nodes(),function(c){o.setNode(c,{v:c,in:0,out:0})}),Z.forEach(a.edges(),function(c){var h=o.edge(c.v,c.w)||0,d=i(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=Z.range(u+s+3).map(function(){return new jte}),l=s+1;return Z.forEach(o.nodes(),function(c){Fg(f,l,o.node(c))}),{graph:o,buckets:f,zeroIdx:l}}(t,e||Wte),n=function(a,i,o){for(var s,u=[],f=i[i.length-1],l=i[0];a.nodeCount();){for(;s=l.dequeue();)i0(a,i,o,s);for(;s=f.dequeue();)i0(a,i,o,s);if(a.nodeCount()){for(var c=i.length-2;c>0;--c)if(s=i[c].dequeue()){u=u.concat(i0(a,i,o,s,!0));break}}}return u}(r.graph,r.buckets,r.zeroIdx);return Z.flatten(Z.map(n,function(a){return t.outEdges(a.v,a.w)}),!0)},Wte=Z.constant(1);function i0(t,e,r,n,a){var i=a?[]:void 0;return Z.forEach(t.inEdges(n.v),function(o){var s=t.edge(o),u=t.node(o.v);a&&i.push({v:o.v,w:o.w}),u.out-=s,Fg(e,r,u)}),Z.forEach(t.outEdges(n.v),function(o){var s=t.edge(o),u=o.w,f=t.node(u);f.in-=s,Fg(e,r,f)}),t.removeNode(n.v),i}function Fg(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}var B_={run:function(t){var e=t.graph().acyclicer==="greedy"?Xte(t,function(r){return function(n){return r.edge(n).weight}}(t)):function(r){var n=[],a={},i={};function o(s){Z.has(i,s)||(i[s]=!0,a[s]=!0,Z.forEach(r.outEdges(s),function(u){Z.has(a,u.w)?n.push(u):o(u.w)}),delete a[s])}return Z.forEach(r.nodes(),o),n}(t);Z.forEach(e,function(r){var n=t.edge(r);t.removeEdge(r),n.forwardName=r.name,n.reversed=!0,t.setEdge(r.w,r.v,n,Z.uniqueId("rev"))})},undo:function(t){Z.forEach(t.edges(),function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}})}},G_=Sa.Graph,Mn={addDummyNode:z_,simplify:function(t){var e=new G_().setGraph(t.graph());return Z.forEach(t.nodes(),function(r){e.setNode(r,t.node(r))}),Z.forEach(t.edges(),function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},a=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+a.weight,minlen:Math.max(n.minlen,a.minlen)})}),e},asNonCompoundGraph:function(t){var e=new G_({multigraph:t.isMultigraph()}).setGraph(t.graph());return Z.forEach(t.nodes(),function(r){t.children(r).length||e.setNode(r,t.node(r))}),Z.forEach(t.edges(),function(r){e.setEdge(r,t.edge(r))}),e},successorWeights:function(t){var e=Z.map(t.nodes(),function(r){var n={};return Z.forEach(t.outEdges(r),function(a){n[a.w]=(n[a.w]||0)+t.edge(a).weight}),n});return Z.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=Z.map(t.nodes(),function(r){var n={};return Z.forEach(t.inEdges(r),function(a){n[a.v]=(n[a.v]||0)+t.edge(a).weight}),n});return Z.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,a=t.x,i=t.y,o=e.x-a,s=e.y-i,u=t.width/2,f=t.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),r=f*o/s,n=f):(o<0&&(u=-u),r=u,n=u*s/o),{x:a+r,y:i+n}},buildLayerMatrix:function(t){var e=Z.map(Z.range(j_(t)+1),function(){return[]});return Z.forEach(t.nodes(),function(r){var n=t.node(r),a=n.rank;Z.isUndefined(a)||(e[a][n.order]=r)}),e},normalizeRanks:function(t){var e=Z.min(Z.map(t.nodes(),function(r){return t.node(r).rank}));Z.forEach(t.nodes(),function(r){var n=t.node(r);Z.has(n,"rank")&&(n.rank-=e)})},removeEmptyRanks:function(t){var e=Z.min(Z.map(t.nodes(),function(i){return t.node(i).rank})),r=[];Z.forEach(t.nodes(),function(i){var o=t.node(i).rank-e;r[o]||(r[o]=[]),r[o].push(i)});var n=0,a=t.graph().nodeRankFactor;Z.forEach(r,function(i,o){Z.isUndefined(i)&&o%a!=0?--n:n&&Z.forEach(i,function(s){t.node(s).rank+=n})})},addBorderNode:function(t,e,r,n){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=n),z_(t,"border",a,e)},maxRank:j_,partition:function(t,e){var r={lhs:[],rhs:[]};return Z.forEach(t,function(n){e(n)?r.lhs.push(n):r.rhs.push(n)}),r},time:function(t,e){var r=Z.now();try{return e()}finally{console.log(t+" time: "+(Z.now()-r)+"ms")}},notime:function(t,e){return e()}};function z_(t,e,r,n){var a;do a=Z.uniqueId(n);while(t.hasNode(a));return r.dummy=e,t.setNode(a,r),a}function j_(t){return Z.max(Z.map(t.nodes(),function(e){var r=t.node(e).rank;if(!Z.isUndefined(r))return r}))}var U_={run:function(t){t.graph().dummyChains=[],Z.forEach(t.edges(),function(e){(function(r,n){var a,i,o,s=n.v,u=r.node(s).rank,f=n.w,l=r.node(f).rank,c=n.name,h=r.edge(n),d=h.labelRank;if(l!==u+1){for(r.removeEdge(n),o=0,++u;u<l;++o,++u)h.points=[],i={width:0,height:0,edgeLabel:h,edgeObj:n,rank:u},a=Mn.addDummyNode(r,"edge",i,"_d"),u===d&&(i.width=h.width,i.height=h.height,i.dummy="edge-label",i.labelpos=h.labelpos),r.setEdge(s,a,{weight:h.weight},c),o===0&&r.graph().dummyChains.push(a),s=a;r.setEdge(s,f,{weight:h.weight},c)}})(t,e)})},undo:function(t){Z.forEach(t.graph().dummyChains,function(e){var r,n=t.node(e),a=n.edgeLabel;for(t.setEdge(n.edgeObj,a);n.dummy;)r=t.successors(e)[0],t.removeNode(e),a.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(a.x=n.x,a.y=n.y,a.width=n.width,a.height=n.height),e=r,n=t.node(e)})}},fN=function(t){var e={};Z.forEach(t.sources(),function r(n){var a=t.node(n);if(Z.has(e,n))return a.rank;e[n]=!0;var i=Z.min(Z.map(t.outEdges(n),function(o){return r(o.w)-t.edge(o).minlen}));return i!==Number.POSITIVE_INFINITY&&i!=null||(i=0),a.rank=i})},lN=function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen},Vte=Sa.Graph,sd=lN,cN=function(t){var e,r,n=new Vte({directed:!1}),a=t.nodes()[0],i=t.nodeCount();for(n.setNode(a,{});Yte(n,t)<i;)e=qte(n,t),r=n.hasNode(e.v)?sd(t,e):-sd(t,e),Hte(n,t,r);return n};function Yte(t,e){return Z.forEach(t.nodes(),function r(n){Z.forEach(e.nodeEdges(n),function(a){var i=a.v,o=n===i?a.w:i;t.hasNode(o)||sd(e,a)||(t.setNode(o,{}),t.setEdge(n,o,{}),r(o))})}),t.nodeCount()}function qte(t,e){return Z.minBy(e.edges(),function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return sd(e,r)})}function Hte(t,e,r){Z.forEach(t.nodes(),function(n){e.node(n).rank+=r})}var Zte=lN,Kte=fN,Qte=Sa.alg.preorder,Jte=Sa.alg.postorder,ere=Mn.simplify,tre=Lo;function Lo(t){t=ere(t),Kte(t);var e,r=cN(t);for(Hm(r),qm(r,t);e=vN(r);)gN(r,t,e,pN(r,t,e))}function qm(t,e){var r=Jte(t,t.nodes());r=r.slice(0,r.length-1),Z.forEach(r,function(n){(function(a,i,o){var s=a.node(o).parent;a.edge(o,s).cutvalue=hN(a,i,o)})(t,e,n)})}function hN(t,e,r){var n=t.node(r).parent,a=!0,i=e.edge(r,n),o=0;return i||(a=!1,i=e.edge(n,r)),o=i.weight,Z.forEach(e.nodeEdges(r),function(s){var u,f,l=s.v===r,c=l?s.w:s.v;if(c!==n){var h=l===a,d=e.edge(s).weight;if(o+=h?d:-d,u=r,f=c,t.hasEdge(u,f)){var v=t.edge(r,c).cutvalue;o+=h?-v:v}}}),o}function Hm(t,e){arguments.length<2&&(e=t.nodes()[0]),dN(t,{},1,e)}function dN(t,e,r,n,a){var i=r,o=t.node(n);return e[n]=!0,Z.forEach(t.neighbors(n),function(s){Z.has(e,s)||(r=dN(t,e,r,s,n))}),o.low=i,o.lim=r++,a?o.parent=a:delete o.parent,r}function vN(t){return Z.find(t.edges(),function(e){return t.edge(e).cutvalue<0})}function pN(t,e,r){var n=r.v,a=r.w;e.hasEdge(n,a)||(n=r.w,a=r.v);var i=t.node(n),o=t.node(a),s=i,u=!1;i.lim>o.lim&&(s=o,u=!0);var f=Z.filter(e.edges(),function(l){return u===$_(t,t.node(l.v),s)&&u!==$_(t,t.node(l.w),s)});return Z.minBy(f,function(l){return Zte(e,l)})}function gN(t,e,r,n){var a=r.v,i=r.w;t.removeEdge(a,i),t.setEdge(n.v,n.w,{}),Hm(t),qm(t,e),function(o,s){var u=Z.find(o.nodes(),function(l){return!s.node(l).parent}),f=Qte(o,u);f=f.slice(1),Z.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)})}(t,e)}function $_(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}Lo.initLowLimValues=Hm,Lo.initCutValues=qm,Lo.calcCutValue=hN,Lo.leaveEdge=vN,Lo.enterEdge=pN,Lo.exchangeEdges=gN;var yN=fN,rre=function(t){switch(t.graph().ranker){case"network-simplex":X_(t);break;case"tight-tree":(function(e){yN(e),cN(e)})(t);break;case"longest-path":nre(t);break;default:X_(t)}},nre=yN;function X_(t){tre(t)}var are=function(t){var e=function(r){var n={},a=0;function i(o){var s=a;Z.forEach(r.children(o),i),n[o]={low:s,lim:a++}}return Z.forEach(r.children(),i),n}(t);Z.forEach(t.graph().dummyChains,function(r){for(var n=t.node(r),a=n.edgeObj,i=function(c,h,d,v){var p,g,y=[],m=[],b=Math.min(h[d].low,h[v].low),w=Math.max(h[d].lim,h[v].lim);p=d;do p=c.parent(p),y.push(p);while(p&&(h[p].low>b||w>h[p].lim));for(g=p,p=v;(p=c.parent(p))!==g;)m.push(p);return{path:y.concat(m.reverse()),lca:g}}(t,e,a.v,a.w),o=i.path,s=i.lca,u=0,f=o[u],l=!0;r!==a.w;){if(n=t.node(r),l){for(;(f=o[u])!==s&&t.node(f).maxRank<n.rank;)u++;f===s&&(l=!1)}if(!l){for(;u<o.length-1&&t.node(f=o[u+1]).minRank<=n.rank;)u++;f=o[u]}t.setParent(r,f),r=t.successors(r)[0]}})},W_={run:function(t){var e=Mn.addDummyNode(t,"root",{},"_root"),r=function(o){var s={};function u(f,l){var c=o.children(f);c&&c.length&&Z.forEach(c,function(h){u(h,l+1)}),s[f]=l}return Z.forEach(o.children(),function(f){u(f,1)}),s}(t),n=Z.max(Z.values(r))-1,a=2*n+1;t.graph().nestingRoot=e,Z.forEach(t.edges(),function(o){t.edge(o).minlen*=a});var i=function(o){return Z.reduce(o.edges(),function(s,u){return s+o.edge(u).weight},0)}(t)+1;Z.forEach(t.children(),function(o){mN(t,e,a,i,n,r,o)}),t.graph().nodeRankFactor=a},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,Z.forEach(t.edges(),function(r){t.edge(r).nestingEdge&&t.removeEdge(r)})}};function mN(t,e,r,n,a,i,o){var s=t.children(o);if(s.length){var u=Mn.addBorderNode(t,"_bt"),f=Mn.addBorderNode(t,"_bb"),l=t.node(o);t.setParent(u,o),l.borderTop=u,t.setParent(f,o),l.borderBottom=f,Z.forEach(s,function(c){mN(t,e,r,n,a,i,c);var h=t.node(c),d=h.borderTop?h.borderTop:c,v=h.borderBottom?h.borderBottom:c,p=h.borderTop?n:2*n,g=d!==v?1:a-i[o]+1;t.setEdge(u,d,{weight:p,minlen:g,nestingEdge:!0}),t.setEdge(v,f,{weight:p,minlen:g,nestingEdge:!0})}),t.parent(o)||t.setEdge(e,u,{weight:0,minlen:a+i[o]})}else o!==e&&t.setEdge(e,o,{weight:0,minlen:r})}var ire=function(t){Z.forEach(t.children(),function e(r){var n=t.children(r),a=t.node(r);if(n.length&&Z.forEach(n,e),Z.has(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var i=a.minRank,o=a.maxRank+1;i<o;++i)V_(t,"borderLeft","_bl",r,a,i),V_(t,"borderRight","_br",r,a,i)}})};function V_(t,e,r,n,a,i){var o={width:0,height:0,rank:i,borderType:e},s=a[e][i-1],u=Mn.addDummyNode(t,"border",o,r);a[e][i]=u,t.setParent(u,n),s&&t.setEdge(s,u,{weight:1})}var Y_={adjust:function(t){var e=t.graph().rankdir.toLowerCase();e!=="lr"&&e!=="rl"||q_(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();e!=="bt"&&e!=="rl"||function(r){Z.forEach(r.nodes(),function(n){o0(r.node(n))}),Z.forEach(r.edges(),function(n){var a=r.edge(n);Z.forEach(a.points,o0),Z.has(a,"y")&&o0(a)})}(t),e!=="lr"&&e!=="rl"||(function(r){Z.forEach(r.nodes(),function(n){s0(r.node(n))}),Z.forEach(r.edges(),function(n){var a=r.edge(n);Z.forEach(a.points,s0),Z.has(a,"x")&&s0(a)})}(t),q_(t))}};function q_(t){Z.forEach(t.nodes(),function(e){H_(t.node(e))}),Z.forEach(t.edges(),function(e){H_(t.edge(e))})}function H_(t){var e=t.width;t.width=t.height,t.height=e}function o0(t){t.y=-t.y}function s0(t){var e=t.x;t.x=t.y,t.y=e}var ore=function(t){var e={},r=Z.filter(t.nodes(),function(s){return!t.children(s).length}),n=Z.max(Z.map(r,function(s){return t.node(s).rank})),a=Z.map(Z.range(n+1),function(){return[]});function i(s){if(!Z.has(e,s)){e[s]=!0;var u=t.node(s);a[u.rank].push(s),Z.forEach(t.successors(s),i)}}var o=Z.sortBy(r,function(s){return t.node(s).rank});return Z.forEach(o,i),a},sre=function(t,e){for(var r=0,n=1;n<e.length;++n)r+=ure(t,e[n-1],e[n]);return r};function ure(t,e,r){for(var n=Z.zipObject(r,Z.map(r,function(f,l){return l})),a=Z.flatten(Z.map(e,function(f){return Z.sortBy(Z.map(t.outEdges(f),function(l){return{pos:n[l.w],weight:t.edge(l).weight}}),"pos")}),!0),i=1;i<r.length;)i<<=1;var o=2*i-1;i-=1;var s=Z.map(new Array(o),function(){return 0}),u=0;return Z.forEach(a.forEach(function(f){var l=f.pos+i;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 fre=function(t,e){return Z.map(e,function(r){var n=t.inEdges(r);if(n.length){var a=Z.reduce(n,function(i,o){var s=t.edge(o),u=t.node(o.v);return{sum:i.sum+s.weight*u.order,weight:i.weight+s.weight}},{sum:0,weight:0});return{v:r,barycenter:a.sum/a.weight,weight:a.weight}}return{v:r}})},lre=function(t,e){var r={};return Z.forEach(t,function(n,a){var i=r[n.v]={indegree:0,in:[],out:[],vs:[n.v],i:a};Z.isUndefined(n.barycenter)||(i.barycenter=n.barycenter,i.weight=n.weight)}),Z.forEach(e.edges(),function(n){var a=r[n.v],i=r[n.w];Z.isUndefined(a)||Z.isUndefined(i)||(i.indegree++,a.out.push(r[n.w]))}),function(n){var a=[];function i(u){return function(f){f.merged||(Z.isUndefined(f.barycenter)||Z.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();a.push(s),Z.forEach(s.in.reverse(),i(s)),Z.forEach(s.out,o(s))}return Z.map(Z.filter(a,function(u){return!u.merged}),function(u){return Z.pick(u,["vs","i","barycenter","weight"])})}(Z.filter(r,function(n){return!n.indegree}))},cre=function(t,e){var r=Mn.partition(t,function(c){return Z.has(c,"barycenter")}),n=r.lhs,a=Z.sortBy(r.rhs,function(c){return-c.i}),i=[],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=Z_(i,a,u),Z.forEach(n,function(c){u+=c.vs.length,i.push(c.vs),o+=c.barycenter*c.weight,s+=c.weight,u=Z_(i,a,u)});var f,l={vs:Z.flatten(i,!0)};return s&&(l.barycenter=o/s,l.weight=s),l};function Z_(t,e,r){for(var n;e.length&&(n=Z.last(e)).i<=r;)e.pop(),t.push(n.vs),r++;return r}var hre=function t(e,r,n,a){var i=e.children(r),o=e.node(r),s=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,f={};s&&(i=Z.filter(i,function(p){return p!==s&&p!==u}));var l=fre(e,i);Z.forEach(l,function(p){if(e.children(p.v).length){var g=t(e,p.v,n,a);f[p.v]=g,Z.has(g,"barycenter")&&(y=p,m=g,Z.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=lre(l,n);(function(p,g){Z.forEach(p,function(y){y.vs=Z.flatten(y.vs.map(function(m){return g[m]?g[m].vs:m}),!0)})})(c,f);var h=cre(c,a);if(s&&(h.vs=Z.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]);Z.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},dre=Sa.Graph,vre=function(t,e,r){var n=function(i){for(var o;i.hasNode(o=Z.uniqueId("_root")););return o}(t),a=new dre({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(i){return t.node(i)});return Z.forEach(t.nodes(),function(i){var o=t.node(i),s=t.parent(i);(o.rank===e||o.minRank<=e&&e<=o.maxRank)&&(a.setNode(i),a.setParent(i,s||n),Z.forEach(t[r](i),function(u){var f=u.v===i?u.w:u.v,l=a.edge(f,i),c=Z.isUndefined(l)?0:l.weight;a.setEdge(f,i,{weight:t.edge(u).weight+c})}),Z.has(o,"minRank")&&a.setNode(i,{borderLeft:o.borderLeft[e],borderRight:o.borderRight[e]}))}),a},pre=function(t,e,r){var n,a={};Z.forEach(r,function(i){for(var o,s,u=t.parent(i);u;){if((o=t.parent(u))?(s=a[o],a[o]=u):(s=n,n=u),s&&s!==u)return void e.setEdge(s,u);u=o}})},gre=Sa.Graph,yre=function(t){var e=Mn.maxRank(t),r=K_(t,Z.range(1,e+1),"inEdges"),n=K_(t,Z.range(e-1,-1,-1),"outEdges"),a=ore(t);Q_(t,a);for(var i,o=Number.POSITIVE_INFINITY,s=0,u=0;u<4;++s,++u){mre(s%2?r:n,s%4>=2),a=Mn.buildLayerMatrix(t);var f=sre(t,a);f<o&&(u=0,i=Z.cloneDeep(a),o=f)}Q_(t,i)};function K_(t,e,r){return Z.map(e,function(n){return vre(t,n,r)})}function mre(t,e){var r=new gre;Z.forEach(t,function(n){var a=n.graph().root,i=hre(n,a,r,e);Z.forEach(i.vs,function(o,s){n.node(o).order=s}),pre(n,r,i.vs)})}function Q_(t,e){Z.forEach(e,function(r){Z.forEach(r,function(n,a){t.node(n).order=a})})}var bre=Sa.Graph,wre=function(t){var e,r=Mn.buildLayerMatrix(t),n=Z.merge(xre(t,r),Ere(t,r)),a={};Z.forEach(["u","d"],function(o){e=o==="u"?r:Z.values(r).reverse(),Z.forEach(["l","r"],function(s){s==="r"&&(e=Z.map(e,function(c){return Z.values(c).reverse()}));var u=(o==="u"?t.predecessors:t.successors).bind(t),f=Sre(t,e,n,u),l=Mre(t,e,f.root,f.align,s==="r");s==="r"&&(l=Z.mapValues(l,function(c){return-c})),a[o+s]=l})});var i=Are(t,a);return Cre(a,i),Tre(a,t.graph().align)};function xre(t,e){var r={};return Z.reduce(e,function(n,a){var i=0,o=0,s=n.length,u=Z.last(a);return Z.forEach(a,function(f,l){var c=function(d,v){if(d.node(v).dummy)return Z.find(d.predecessors(v),function(p){return d.node(p).dummy})}(t,f),h=c?t.node(c).order:s;(c||f===u)&&(Z.forEach(a.slice(o,l+1),function(d){Z.forEach(t.predecessors(d),function(v){var p=t.node(v),g=p.order;!(g<i||h<g)||p.dummy&&t.node(d).dummy||bN(r,v,d)})}),o=l+1,i=h)}),a}),r}function Ere(t,e){var r={};function n(a,i,o,s,u){var f;Z.forEach(Z.range(i,o),function(l){f=a[l],t.node(f).dummy&&Z.forEach(t.predecessors(f),function(c){var h=t.node(c);h.dummy&&(h.order<s||h.order>u)&&bN(r,c,f)})})}return Z.reduce(e,function(a,i){var o,s=-1,u=0;return Z.forEach(i,function(f,l){if(t.node(f).dummy==="border"){var c=t.predecessors(f);c.length&&(o=t.node(c[0]).order,n(i,u,l,s,o),u=l,s=o)}n(i,u,i.length,o,a.length)}),i}),r}function bN(t,e,r){if(e>r){var n=e;e=r,r=n}var a=t[e];a||(t[e]=a={}),a[r]=!0}function _re(t,e,r){if(e>r){var n=e;e=r,r=n}return Z.has(t[e],r)}function Sre(t,e,r,n){var a={},i={},o={};return Z.forEach(e,function(s){Z.forEach(s,function(u,f){a[u]=u,i[u]=u,o[u]=f})}),Z.forEach(e,function(s){var u=-1;Z.forEach(s,function(f){var l=n(f);if(l.length)for(var c=((l=Z.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];i[f]===f&&u<o[v]&&!_re(r,f,v)&&(i[v]=f,i[f]=a[f]=a[v],u=o[v])}})}),{root:a,align:i}}function Mre(t,e,r,n,a){var i={},o=function(f,l,c,h){var d=new bre,v=f.graph(),p=function(g,y,m){return function(b,w,x){var E,_=b.node(w),S=b.node(x),A=0;if(A+=_.width/2,Z.has(_,"labelpos"))switch(_.labelpos.toLowerCase()){case"l":E=-_.width/2;break;case"r":E=_.width/2}if(E&&(A+=m?E:-E),E=0,A+=(_.dummy?y:g)/2,A+=(S.dummy?y:g)/2,A+=S.width/2,Z.has(S,"labelpos"))switch(S.labelpos.toLowerCase()){case"l":E=S.width/2;break;case"r":E=-S.width/2}return E&&(A+=m?E:-E),E=0,A}}(v.nodesep,v.edgesep,h);return Z.forEach(l,function(g){var y;Z.forEach(g,function(m){var b=c[m];if(d.setNode(b),y){var w=c[y],x=d.edge(w,b);d.setEdge(w,b,Math.max(p(f,m,y),x||0))}y=m})}),d}(t,e,r,a),s=a?"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){i[f]=o.inEdges(f).reduce(function(l,c){return Math.max(l,i[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,i[d.w]-o.edge(d))},Number.POSITIVE_INFINITY),c=t.node(f);l!==Number.POSITIVE_INFINITY&&c.borderType!==s&&(i[f]=Math.max(i[f],l))},o.successors.bind(o)),Z.forEach(n,function(f){i[f]=i[r[f]]}),i}function Are(t,e){return Z.minBy(Z.values(e),function(r){var n=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return Z.forIn(r,function(i,o){var s=function(u,f){return u.node(f).width}(t,o)/2;n=Math.max(i+s,n),a=Math.min(i-s,a)}),n-a})}function Cre(t,e){var r=Z.values(e),n=Z.min(r),a=Z.max(r);Z.forEach(["u","d"],function(i){Z.forEach(["l","r"],function(o){var s,u=i+o,f=t[u];if(f!==e){var l=Z.values(f);(s=o==="l"?n-Z.min(l):a-Z.max(l))&&(t[u]=Z.mapValues(f,function(c){return c+s}))}})})}function Tre(t,e){return Z.mapValues(t.ul,function(r,n){if(e)return t[e.toLowerCase()][n];var a=Z.sortBy(Z.map(t,n));return(a[1]+a[2])/2})}var Ire=wre,kre=function(t){(function(e){var r=Mn.buildLayerMatrix(e),n=e.graph().ranksep,a=0;Z.forEach(r,function(i){var o=Z.max(Z.map(i,function(s){return e.node(s).height}));Z.forEach(i,function(s){e.node(s).y=a+o/2}),a+=o+n})})(t=Mn.asNonCompoundGraph(t)),Z.forEach(Ire(t),function(e,r){t.node(r).x=e})},Nre=Mn.normalizeRanks,Ore=Mn.removeEmptyRanks,Li=Mn,Lre=Sa.Graph,Dre=function(t,e){var r=e&&e.debugTiming?Li.time:Li.notime;r("layout",function(){var n=r(" buildLayoutGraph",function(){return function(a){var i=new Lre({multigraph:!0,compound:!0}),o=f0(a.graph());return i.setGraph(Z.merge({},Rre,u0(o,Pre),Z.pick(o,Fre))),Z.forEach(a.nodes(),function(s){var u=f0(a.node(s));i.setNode(s,Z.defaults(u0(u,Bre),Gre)),i.setParent(s,a.parent(s))}),Z.forEach(a.edges(),function(s){var u=f0(a.edge(s));i.setEdge(s,Z.merge({},jre,u0(u,zre),Z.pick(u,Ure)))}),i}(t)});r(" runLayout",function(){(function(a,i){i(" makeSpaceForEdgeLabels",function(){(function(o){var s=o.graph();s.ranksep/=2,Z.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)})})(a)}),i(" removeSelfEdges",function(){(function(o){Z.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)}})})(a)}),i(" acyclic",function(){B_.run(a)}),i(" nestingGraph.run",function(){W_.run(a)}),i(" rank",function(){rre(Li.asNonCompoundGraph(a))}),i(" injectEdgeLabelProxies",function(){(function(o){Z.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};Li.addDummyNode(o,"edge-proxy",l,"_ep")}})})(a)}),i(" removeEmptyRanks",function(){Ore(a)}),i(" nestingGraph.cleanup",function(){W_.cleanup(a)}),i(" normalizeRanks",function(){Nre(a)}),i(" assignRankMinMax",function(){(function(o){var s=0;Z.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=Z.max(s,f.maxRank))}),o.graph().maxRank=s})(a)}),i(" removeEdgeLabelProxies",function(){(function(o){Z.forEach(o.nodes(),function(s){var u=o.node(s);u.dummy==="edge-proxy"&&(o.edge(u.e).labelRank=u.rank,o.removeNode(s))})})(a)}),i(" normalize.run",function(){U_.run(a)}),i(" parentDummyChains",function(){are(a)}),i(" addBorderSegments",function(){ire(a)}),i(" order",function(){yre(a)}),i(" insertSelfEdges",function(){(function(o){var s=Li.buildLayerMatrix(o);Z.forEach(s,function(u){var f=0;Z.forEach(u,function(l,c){var h=o.node(l);h.order=c+f,Z.forEach(h.selfEdges,function(d){Li.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})})})(a)}),i(" adjustCoordinateSystem",function(){Y_.adjust(a)}),i(" position",function(){kre(a)}),i(" positionSelfEdges",function(){(function(o){Z.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}})})(a)}),i(" removeBorderNodes",function(){(function(o){Z.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(Z.last(u.borderLeft)),h=o.node(Z.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}}),Z.forEach(o.nodes(),function(s){o.node(s).dummy==="border"&&o.removeNode(s)})})(a)}),i(" normalize.undo",function(){U_.undo(a)}),i(" fixupEdgeLabelCoords",function(){(function(o){Z.forEach(o.edges(),function(s){var u=o.edge(s);if(Z.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}})})(a)}),i(" undoCoordinateSystem",function(){Y_.undo(a)}),i(" 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)}Z.forEach(o.nodes(),function(p){v(o.node(p))}),Z.forEach(o.edges(),function(p){var g=o.edge(p);Z.has(g,"x")&&v(g)}),s-=h,f-=d,Z.forEach(o.nodes(),function(p){var g=o.node(p);g.x-=s,g.y-=f}),Z.forEach(o.edges(),function(p){var g=o.edge(p);Z.forEach(g.points,function(y){y.x-=s,y.y-=f}),Z.has(g,"x")&&(g.x-=s),Z.has(g,"y")&&(g.y-=f)}),c.width=u-s+h,c.height=l-f+d})(a)}),i(" assignNodeIntersects",function(){(function(o){Z.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(Li.intersectRect(c,u)),l.points.push(Li.intersectRect(h,f))})})(a)}),i(" reversePoints",function(){(function(o){Z.forEach(o.edges(),function(s){var u=o.edge(s);u.reversed&&u.points.reverse()})})(a)}),i(" acyclic.undo",function(){B_.undo(a)})})(n,r)}),r(" updateInputGraph",function(){(function(a,i){Z.forEach(a.nodes(),function(o){var s=a.node(o),u=i.node(o);s&&(s.x=u.x,s.y=u.y,i.children(o).length&&(s.width=u.width,s.height=u.height))}),Z.forEach(a.edges(),function(o){var s=a.edge(o),u=i.edge(o);s.points=u.points,Z.has(u,"x")&&(s.x=u.x,s.y=u.y)}),a.graph().width=i.graph().width,a.graph().height=i.graph().height})(t,n)})})},Pre=["nodesep","edgesep","ranksep","marginx","marginy"],Rre={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Fre=["acyclicer","ranker","rankdir","align"],Bre=["width","height"],Gre={width:0,height:0},zre=["minlen","weight","width","height","labeloffset"],jre={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ure=["labelpos"];function u0(t,e){return Z.mapValues(Z.pick(t,e),Number)}function f0(t){var e={};return Z.forEach(t,function(r,n){e[n.toLowerCase()]=r}),e}Sa.Graph;var wN={graphlib:Sa,layout:Dre},$re=wN.graphlib,Xre=wN.layout;class Wre{constructor(e){this.cardinality=1,this.include=Yo.UNSPECIFIED,this.isGroupNode=!1,this.parentNode=null,this.type=kn.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 Vre{constructor(){this.nodes={},this.edges=[],this.nodes={},this.edges=[]}}function Yre(t){const e=new Vre;return t.nodes.map(r=>new Wre(r)).forEach(r=>{e.nodes[r.name]=r,r.inputs.forEach(n=>{(function(a,i,o){o.name!==i.name&&a.edges.push(Object.assign(Object.assign({},o.attr),{v:o.name,w:i.name}))})(e,r,n)})}),e}class qre{constructor(e,r={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=Yo.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=kn.META,this.path=[],this.name=e,this.metaGraph=Zm(e,uu.META,r)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map(e=>this.metaGraph.node(e))}leaves(){let e,r=[],n=[this];for(;n.length;){let a=n.shift();a.isGroupNode?(e=a.metaGraph,e.nodes().forEach(i=>n.push(e.node(i)))):r.push(a.name)}return r}}class Hre{constructor(e,r){this.v=e,this.w=r,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(e,r){this.baseEdgeList.push(e)}}function xN(t,e={}){return new qre(t,e)}function EN(t,e){return new Hre(t,e)}function Zm(t,e,r){const n=r||{},a=new $re.Graph(n);return a.setGraph({name:t,rankdir:n.rankdir,type:e,align:n.align}),a}class Zre{constructor(e={}){this.graphOptions=e,this.index={},this.graphOptions.compound=!0,this.root=xN(su,this.graphOptions),this.index[su]=this.root}getNodeMap(){return this.index}node(e){return this.index[e]}setNode(e,r){this.index[e]=r}getBridgeGraph(e){const r=this.index[e];if(!r)throw Error("Could not find node in hierarchy: "+e);if(!("metaGraph"in r))return null;const n=r;if(n.bridgeGraph)return n.bridgeGraph;const a=Zm(ck,uu.BRIDGE,this.graphOptions);if(n.bridgeGraph=a,!r.parentNode||!("metaGraph"in r.parentNode))return a;const i=r.parentNode;return[i.metaGraph,this.getBridgeGraph(i.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=a.edge(d);v||(v=EN(d.v,d.w),v.inbound=u,a.setEdge(d.v,d.w,v)),v.addBaseEdge(f,this)})})}),a}getChildName(e,r){let n=this.index[r];for(;n;){if(n.parentNode&&n.parentNode.name===e)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+r)}getPredecessors(e){const r=this.index[e];if(!r)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(r,!0)}getSuccessors(e){const r=this.index[e];if(!r)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(r,!1)}getOneWayEdges(e,r){const n=[];if(!e.parentNode||!e.parentNode.isGroupNode)return n;const a=e.parentNode,i=a.metaGraph,o=this.getBridgeGraph(a.name);return J_(i,e,r,n),J_(o,e,r,n),n}}function Kre(t,e){const{rankDirection:r,align:n}=e,a=new Zre({rankdir:r,align:n});return function(i,o){Object.keys(o.nodes).forEach(s=>{const u=o.nodes[s],f=u.path;let l=i.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=i.node(h);d||(d=xN(h,i.graphOptions),d.path=u.path.slice(0,c+1),d.parentNode=l,i.setNode(h,d),l.metaGraph.setNode(h,d)),l=d}i.setNode(u.name,u),u.parentNode=l,l.metaGraph.setNode(u.name,u)})}(a,t),function(i,o){const s=i.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=EN(p,g),v.metaGraph.setEdge(p,g,y)),y.addBaseEdge(c,i)})}(a,t),a}function J_(t,e,r,n){(r?t.inEdges(e.name):t.outEdges(e.name)).forEach(a=>{const i=t.edge(a);n.push(i)})}class Qre{constructor(e){this.hierarchy=e,this.index={},this.hasSubHierarchy={},this.root=new t2(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 r=this.index[e];if(r.node.type!==kn.META)return;const n=r,a=n.node.metaGraph,i=n.coreGraph;a.nodes().forEach(l=>{const c=this.getOrCreateRenderNodeByName(l);i.setNode(l,c)}),a.edges().forEach(l=>{const c=a.edge(l),h=new e2(c);i.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=!!a.node(l.w),[d,v]=h?[l.w,l.v]:[l.v,l.w],p=x=>{const E=h?{v:x,w:e}:{v:e,w:x};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=i.node(m);if(!b){let x=i.node(y);if(!x){const _={name:y,type:kn.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:Yo.UNSPECIFIED,inbound:h,attr:{}};x=new mh(_),this.index[y]=x,i.setNode(y,x)}const E={name:m,type:kn.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:Yo.UNSPECIFIED,inbound:h,attr:{}};b=new mh(E),this.index[m]=b,i.setNode(m,b),i.setParent(m,y),x.node.cardinality++}const w=new e2(c);w.adjoiningMetaEdge=g,h?i.setEdge(m,d,w):i.setEdge(d,m,w)})}getOrCreateRenderNodeByName(e){if(!e)return null;if(e in this.index)return this.index[e];const r=this.getNodeByName(e);return r?(this.index[e]=r.isGroupNode?new t2(r,this.hierarchy.graphOptions):new mh(r),this.index[e]):null}getRenderNodeByName(e){return this.index[e]}getNodeByName(e){return this.hierarchy.node(e)}}class mh{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 e2{constructor(e){this.metaEdge=e,this.adjoiningMetaEdge=null,this.weight=1,this.points=[]}}class t2 extends mh{constructor(e,r){super(e);const n=e.metaGraph.graph();r.compound=!0,this.coreGraph=Zm(n.name,uu.CORE,r)}}function _N(t,e){t.node.isGroupNode&&function(r,n){const a=Tg(n);r.coreGraph.nodes().map(i=>r.coreGraph.node(i)).forEach(i=>{var o,s,u,f,l,c;const{height:h,width:d}=i;switch(i.node.type){case kn.NODE:Object.assign(i,a.nodeSize.node),i.height=h||a.nodeSize.node.height,i.width=d||a.nodeSize.node.width;break;case kn.BRIDGE:Object.assign(i,a.nodeSize.bridge);break;case kn.META:i.expanded?_N(i,n):(Object.assign(i,a.nodeSize.meta),i.height=a.nodeSize.meta.height,i.width=a.nodeSize.meta.width);break;default:throw Error("Unrecognized node type: "+i.node.type)}if(!i.expanded){const v=i.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)}})(i,n&&(i.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)||i.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)||i.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)))}})}(t,e),t.node.type===kn.META&&function(r,n){const a=Tg(n),i=a.subScene.meta;Object.assign(r,i);const{nodeSep:o,rankSep:s,edgeSep:u,align:f}=a.graph.meta,l={nodesep:o,ranksep:s,edgesep:u,align:f};Object.assign(r.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(S=>{d.node(S).node.type!==kn.BRIDGE&&b.push(S)}),!b.length)return{width:0,height:0};Xre(d);let w=1/0,x=1/0,E=-1/0,_=-1/0;return b.forEach(S=>{const A=d.node(S),M=.5*A.width,C=A.x-M,I=A.x+M;w=C<w?C:w,E=I>E?I:E;const k=.5*A.height,O=A.y-k,B=A.y+k;x=O<x?O:x,_=B>_?B:_}),d.edges().forEach(S=>{const A=d.edge(S),M=d.node(A.metaEdge.v),C=d.node(A.metaEdge.w);if(A.points.length===3&&function(O){let B=r2(O[0],O[1]);for(let L=1;L<O.length-1;L++){const z=r2(O[L],O[L+1]);if(Math.abs(z-B)>1)return!1;B=z}return!0}(A.points)){if(M!=null){const O=M.expanded?M.x:Bg(M);A.points[0].x=O}if(C!=null){const O=C.expanded?C.x:Bg(C);A.points[2].x=O}A.points=[A.points[0],A.points[1]]}const I=A.points[A.points.length-2];C!=null&&(A.points[A.points.length-1]=n2(I,C));const k=A.points[1];M!=null&&(A.points[0]=n2(k,M)),A.points.forEach(O=>{w=O.x<w?O.x:w,E=O.x>E?O.x:E,x=O.y<x?O.y:x,_=O.y>_?O.y:_})}),d.nodes().forEach(S=>{const A=d.node(S);A.x-=w,A.y-=x}),d.edges().forEach(S=>{d.edge(S).points.forEach(A=>{A.x-=w,A.y-=x})}),{width:E-w,height:_-x}}(r.coreGraph,l));let c=0;r.coreGraph.nodeCount()>0&&c++;const h=c<=1?0:c;r.coreBox.width+=h+h,r.coreBox.height=i.labelHeight+r.coreBox.height,r.width=r.coreBox.width+i.paddingLeft+i.paddingRight,r.height=r.paddingTop+r.coreBox.height+r.paddingBottom}(t,e)}function r2(t,e){const r=e.x-t.x,n=e.y-t.y;return 180*Math.atan(n/r)/Math.PI}function Bg(t){return t.expanded?t.x:t.x-t.width/2+0+t.coreBox.width/2}function n2(t,e){const r=e.expanded?e.x:Bg(e),n=e.y,a=t.x-r,i=t.y-n;let o,s,u=e.expanded?e.width:e.coreBox.width,f=e.expanded?e.height:e.coreBox.height;return Math.abs(i)*u/2>Math.abs(a)*f/2?(i<0&&(f=-f),o=i===0?0:f/2*a/i,s=f/2):(a<0&&(u=-u),o=u/2,s=a===0?0:u/2*i/a),{x:r+o,y:n+s}}function Jre(t,e,r){var n,a,i,o;const s=t.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 w=0;w<v.length;w++){let x=v[w];if(d&&d[x].indexOf(m)!==-1)return b.unshift(x),g(x,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,w=[...g(b),b];let x=y(b);h.nodes.push({name:b,path:w,inputs:x,width:m.width,height:m.height,attr:Object.assign({},m)})}),h}(t),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,w]of y)d(b,y)?m[b]=w:g=g.concat(b,w);return v(m,g)};return v(c).filter(p=>h.includes(p))}(t.compound||{},(e==null?void 0:e.expanded)||[]),l=function(c,h){return function(d){return new Qre(d)}(Kre(Yre(c),h))}(u,{rankDirection:((a=(n=r==null?void 0:r.graph)===null||n===void 0?void 0:n.meta)===null||a===void 0?void 0:a.rankDir)||(e==null?void 0:e.rankDirection)||ed.graph.meta.rankDir,align:((o=(i=r==null?void 0:r.graph)===null||i===void 0?void 0:i.meta)===null||o===void 0?void 0:o.align)||ed.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),_N(l.root,r),SN(l.root)}function ene(t,e=!1){const r=JSON.parse(JSON.stringify(t)),n={nodes:[r],edges:[...r.edges]};return r.nodes.forEach(function a(i){(i.type===0||i.type===1)&&n.nodes.push(i),i.type===0&&(n.edges=n.edges.concat(i.edges)),Array.isArray(i.nodes)&&i.nodes.forEach(a)}),e&&n.nodes.forEach(a=>{const i=n.nodes.find(o=>o.id===a.parentNodeName);if(i){const o=i.x-i.width/2+i.paddingLeft,s=i.y-i.height/2+i.labelHeight+i.paddingTop;i.id!==su&&(a.x+=o,a.y+=s),a.type===0&&a.edges.forEach(u=>{u.points.forEach(f=>{f.x+=a.x-a.width/2+a.paddingLeft,f.y+=a.y-a.height/2+a.labelHeight+a.paddingTop})})}}),n}function tne(t,e,r,n){var a,i;let o=[];const s=((a=r.find(c=>c.id===t))===null||a===void 0?void 0:a.path)||[],u=((i=r.find(c=>c.id===e))===null||i===void 0?void 0:i.path)||[],f=[su,...s].slice(0,s.length).reverse(),l=[su,...u].slice(0,u.length);return f.forEach(c=>{const h=r.find(d=>d.id===c);o=o.concat(h.edges.filter(d=>d.baseEdgeList.some(v=>v.v===((n==null?void 0:n.v)||t)&&v.w===((n==null?void 0:n.w)||e))))}),l.filter(c=>!f.includes(c)).forEach(c=>{const h=r.find(d=>d.id===c);o=o.concat(h.edges.filter(d=>d.baseEdgeList.some(v=>v.v===((n==null?void 0:n.v)||t)&&v.w===((n==null?void 0:n.w)||e))))}),o}function SN(t){const e=t.coreGraph.nodes().map(n=>t.coreGraph.node(n));return Object.assign(Object.assign({},a2(t)),{expanded:t.expanded,nodes:t.expanded?(r=e,r.map(n=>n.node.type===kn.META?SN(n):a2(n))):[],edges:t.expanded?rne(t):[]});var r}function a2(t){return{id:t.node.name,name:t.node.name,type:t.node.type,cardinality:t.node.cardinality,attr:t.attr,parentNodeName:t.node.parentNode?t.node.parentNode.name:null,coreBox:Object.assign({},t.coreBox),x:t.x,y:t.y,width:t.width,height:t.height,radius:t.radius,labelHeight:t.labelHeight,labelOffset:t.labelOffset,outboxWidth:t.outboxWidth,paddingLeft:t.paddingLeft,paddingTop:t.paddingTop,paddingRight:t.paddingRight,paddingBottom:t.paddingBottom,path:t.node.path}}function rne(t){return t.coreGraph.edges().map(e=>({renderInfoEdge:t.coreGraph.edge(e),edge:e})).filter(({renderInfoEdge:e})=>e.metaEdge).map(({edge:e,renderInfoEdge:r})=>{const n=function(a,i){const o=i.points.map(s=>Object.assign({},s));if(i.adjoiningMetaEdge){const s=i.adjoiningMetaEdge.points,u=i.metaEdge.inbound,f=u?s[s.length-1]:s[0],l=o[u?0:o.length-1],c=a.x-a.width/2,h=a.y-a.height/2,d=f.x-c,v=f.y-h,p=-a.paddingLeft,g=-(a.paddingTop+a.labelHeight);l.x=d+p,l.y=v+g}return o}(t,r);return{adjoiningEdge:r.adjoiningMetaEdge?{w:r.adjoiningMetaEdge.metaEdge.w,v:r.adjoiningMetaEdge.metaEdge.v}:null,inbound:r.metaEdge.inbound,w:e.w,v:e.v,points:n,weight:r.weight,baseEdgeList:r.metaEdge.baseEdgeList,parentNodeName:t.node.name}})}const nne=Object.freeze(Object.defineProperty({__proto__:null,BRIDGE_GRAPH_NAME:ck,get GraphType(){return uu},get HierarchyNodeType(){return Ig},get InclusionType(){return Yo},LAYOUT_CONFIG:ed,get NodeType(){return kn},ROOT_NAME:su,buildGraph:Jre,flatGraph:ene,getEdges:tne,mergeConfig:Tg},Symbol.toStringTag,{value:"Module"})),ane=Ka(nne);var ine=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),va=me&&me.__assign||function(){return va=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},va.apply(this,arguments)},Ms=me&&me.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,a=e.length,i;n<a;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(vl,"__esModule",{value:!0});vl.DagreCompoundLayout=void 0;var one=Rr,Hn=ane,Rc=Ir(),sne=function(t){ine(e,t);function e(r){var n=t.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(r),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(r){var n=r.hiddenNodes||[],a=r.hiddenEdges||[],i=r.hiddenCombos||[];this.nodes=this.getDataByOrder((r.nodes||[]).concat(n)),this.edges=this.getDataByOrder((r.edges||[]).concat(a)),this.combos=(r.combos||[]).concat(i.map(function(o){return va(va({},o),{collapsed:!0})}))},e.prototype.execute=function(){var r=this,n=r.nodes,a=r.edges;if(n){var i=r.getLayoutConfig(),o=i.graphDef,s=i.graphOption,u=i.graphSettings,f=(0,Hn.buildGraph)(o,s,u),l=(0,Hn.flatGraph)(f,!0);return this.updatePosition(l),r.onLayoutEnd&&r.onLayoutEnd(),{nodes:n,edges:a}}},e.prototype.getNodePath=function(r){var n=this,a=n.nodes,i=n.combos,o=a.find(function(u){return u.id===r}),s=function(u,f){f===void 0&&(f=[]);var l=i.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,[r]):[r]},e.prototype.getLayoutConfig=function(){var r,n,a,i=this,o=i.nodes,s=i.edges,u=i.combos,f=i.nodeSize,l=i.rankdir,c=i.align,h=i.edgesep,d=i.nodesep,v=i.ranksep,p=i.settings,g=(u||[]).reduce(function(L,z){var X=o.filter(function(V){return V.comboId===z.id}).map(function(V){return V.id}),R=(u||[]).filter(function(V){return V.parentId===z.id}).map(function(V){return V.id});return(X.length||R.length)&&(L[z.id]=Ms(Ms([],X,!0),R,!0)),L},{}),y;f?(0,Rc.isArray)(f)?y=function(){return f}:y=function(){return[f,f]}:y=function(L){return L&&L.size?(0,Rc.isArray)(L.size)?L.size:(0,Rc.isObject)(L.size)?[L.size.width||40,L.size.height||40]:[L.size,L.size]:[40,40]};var m=function(L){return L&&L.size?(0,Rc.isArray)(L.size)?L.size:[L.size,L.size]:[80,40]},b=m(u==null?void 0:u[0]),w=b[0],x=b[1],E=(n=(r=i.graphSettings)===null||r===void 0?void 0:r.subScene)===null||n===void 0?void 0:n.meta,_=((a=u.find(function(L){return!L.collapsed}))===null||a===void 0?void 0:a.padding)||[20,20,20,20],S=_[0],A=_[1],M=_[2],C=_[3],I={compound:g,nodes:Ms([],(o||[]).map(function(L){var z=y(L),X=z[0],R=z[1];return va(va({},L),{width:X,height:R})}),!0),edges:Ms([],(s||[]).map(function(L){return va(va({},L),{v:L.source,w:L.target})}),!0)},k={expanded:(u||[]).filter(function(L){return!L.collapsed}).map(function(L){return L.id})},O={graph:{meta:{align:c,rankDir:l,nodeSep:d,edgeSep:h,rankSep:v}},subScene:{meta:{paddingTop:S||(E==null?void 0:E.paddingTop)||20,paddingRight:A||(E==null?void 0:E.paddingRight)||20,paddingBottom:M||(E==null?void 0:E.paddingBottom)||20,paddingLeft:C||(E==null?void 0:E.paddingLeft)||20,labelHeight:0}},nodeSize:{meta:{width:w,height:x}}},B=(0,Hn.mergeConfig)(p,va({},(0,Hn.mergeConfig)(O,Hn.LAYOUT_CONFIG)));return i.graphSettings=B,{graphDef:I,graphOption:k,graphSettings:B}},e.prototype.updatePosition=function(r){var n=r.nodes,a=r.edges;this.updateNodePosition(n,a),this.updateEdgePosition(n,a)},e.prototype.getBegin=function(r,n){var a=this,i=a.begin,o=[0,0];if(i){var s=1/0,u=1/0;r.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]=i[0]-s,o[1]=i[1]-u}return o},e.prototype.updateNodePosition=function(r,n){var a=this,i=a.combos,o=a.nodes,s=a.edges,u=a.anchorPoint,f=a.graphSettings,l=this.getBegin(r,n);r.forEach(function(c){var h,d=c.x,v=c.y,p=c.id,g=c.type,y=c.coreBox;if(g===Hn.HierarchyNodeType.META&&p!==Hn.ROOT_NAME){var m=i.findIndex(function(_){return _.id===p}),b=(h=f==null?void 0:f.subScene)===null||h===void 0?void 0:h.meta;i[m].offsetX=d+l[0],i[m].offsetY=v+l[1],i[m].fixSize=[y.width,y.height],i[m].fixCollapseSize=[y.width,y.height],c.expanded?i[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]:i[m].padding=[0,0,0,0]}else if(g===Hn.HierarchyNodeType.OP){var m=o.findIndex(function(S){return S.id===p});if(o[m].x=d+l[0],o[m].y=v+l[1],u){var w=[],x=n.filter(function(S){return S.v===p}),E=n.filter(function(S){return S.w===p});x.length>0&&x.forEach(function(S){var A=S.points[0],M=(A.x-d)/c.width+.5,C=(A.y-v)/c.height+.5;w.push([M,C]),S.baseEdgeList.forEach(function(I){var k=s.find(function(O){return O.source===I.v&&O.target===I.w});k&&(k.sourceAnchor=w.length-1)})}),E.length>0&&E.forEach(function(S){var A=S.points[S.points.length-1],M=(A.x-d)/c.width+.5,C=(A.y-v)/c.height+.5;w.push([M,C]),S.baseEdgeList.forEach(function(I){var k=s.find(function(O){return O.source===I.v&&O.target===I.w});k&&(k.targetAnchor=w.length-1)})}),o[m].anchorPoints=w.length>0?w:o[m].anchorPoints||[]}}})},e.prototype.updateEdgePosition=function(r,n){var a=this,i=a.combos,o=a.edges,s=a.controlPoints,u=this.getBegin(r,n);s&&(i.forEach(function(f){f.inEdges=[],f.outEdges=[]}),o.forEach(function(f){var l,c,h,d,v=r.find(function(_){return _.id===f.source}),p=r.find(function(_){return _.id===f.target}),g=[],y=[];if(v&&p)y=(0,Hn.getEdges)(v==null?void 0:v.id,p==null?void 0:p.id,r);else if(!v||!p){var m=a.getNodePath(f.source),b=a.getNodePath(f.target),w=m.reverse().slice(v?0:1).find(function(_){return r.find(function(S){return S.id===_})}),x=b.reverse().slice(p?0:1).find(function(_){return r.find(function(S){return S.id===_})});v=r.find(function(_){return _.id===w}),p=r.find(function(_){return _.id===x}),y=(0,Hn.getEdges)(v==null?void 0:v.id,p==null?void 0:p.id,r,{v:f.source,w:f.target})}if(g=y.reduce(function(_,S){return Ms(Ms([],_,!0),S.points.map(function(A){return va(va({},A),{x:A.x+u[0],y:A.y+u[1]})}),!0)},[]),g=g.slice(1,-1),f.controlPoints=g,(p==null?void 0:p.type)===Hn.NodeType.META){var E=i.findIndex(function(_){return _.id===(p==null?void 0:p.id)});if(!i[E]||!((l=i[E].inEdges)===null||l===void 0)&&l.some(function(_){return _.source===v.id&&_.target===p.id}))return;(c=i[E].inEdges)===null||c===void 0||c.push({source:v.id,target:p.id,controlPoints:g})}if((v==null?void 0:v.type)===Hn.NodeType.META){var E=i.findIndex(function(S){return S.id===(v==null?void 0:v.id)});if(!i[E]||!((h=i[E].outEdges)===null||h===void 0)&&h.some(function(S){return S.source===v.id&&S.target===p.id}))return;(d=i[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(r){return r.every(function(n){return n.layoutOrder!==void 0})||r.forEach(function(n,a){n.layoutOrder=a}),r.sort(function(n,a){return n.layoutOrder-a.layoutOrder})},e}(one.Base);vl.DagreCompoundLayout=sne;var Km={},lv={},Qm={};const une=Object.prototype.toString;function ud(t){const e=une.call(t);return e.endsWith("Array]")&&!e.includes("Big")}function fne(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!ud(t))throw new TypeError("input must be an array");if(t.length===0)throw new TypeError("input must not be empty");var r=e.fromIndex,n=r===void 0?0:r,a=e.toIndex,i=a===void 0?t.length:a;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var o=t[n],s=n+1;s<i;s++)t[s]>o&&(o=t[s]);return o}function lne(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!ud(t))throw new TypeError("input must be an array");if(t.length===0)throw new TypeError("input must not be empty");var r=e.fromIndex,n=r===void 0?0:r,a=e.toIndex,i=a===void 0?t.length:a;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var o=t[n],s=n+1;s<i;s++)t[s]<o&&(o=t[s]);return o}function i2(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ud(t)){if(t.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var r;if(e.output!==void 0){if(!ud(e.output))throw new TypeError("output option must be an array if specified");r=e.output}else r=new Array(t.length);var n=lne(t),a=fne(t);if(n===a)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var i=e.min,o=i===void 0?e.autoMinMax?n:0:i,s=e.max,u=s===void 0?e.autoMinMax?a:1:s;if(o>=u)throw new RangeError("min option must be smaller than max option");for(var f=(u-o)/(a-n),l=0;l<t.length;l++)r[l]=(t[l]-n)*f+o;return r}const Fc=" ".repeat(2),MN=" ".repeat(4);function cne(){return AN(this)}function AN(t,e={}){const{maxRows:r=15,maxColumns:n=10,maxNumSize:a=8}=e;return`${t.constructor.name} {
|
||
${Fc}[
|
||
${MN}${hne(t,r,n,a)}
|
||
${Fc}]
|
||
${Fc}rows: ${t.rows}
|
||
${Fc}columns: ${t.columns}
|
||
}`}function hne(t,e,r,n){const{rows:a,columns:i}=t,o=Math.min(a,e),s=Math.min(i,r),u=[];for(let f=0;f<o;f++){let l=[];for(let c=0;c<s;c++)l.push(dne(t.get(f,c),n));u.push(`${l.join(" ")}`)}return s!==i&&(u[u.length-1]+=` ... ${i-r} more columns`),o!==a&&u.push(`... ${a-e} more rows`),u.join(`
|
||
${MN}`)}function dne(t,e){const r=String(t);if(r.length<=e)return r.padEnd(e," ");const n=t.toPrecision(e-2);if(n.length<=e)return n;const a=t.toExponential(e-2),i=a.indexOf("e"),o=a.slice(i);return a.slice(0,e-o.length)+o}function vne(t,e){t.prototype.add=function(n){return typeof n=="number"?this.addS(n):this.addM(n)},t.prototype.addS=function(n){for(let a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)+n);return this},t.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 a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)+n.get(a,i));return this},t.add=function(n,a){return new e(n).add(a)},t.prototype.sub=function(n){return typeof n=="number"?this.subS(n):this.subM(n)},t.prototype.subS=function(n){for(let a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)-n);return this},t.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 a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)-n.get(a,i));return this},t.sub=function(n,a){return new e(n).sub(a)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(n){return typeof n=="number"?this.mulS(n):this.mulM(n)},t.prototype.mulS=function(n){for(let a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)*n);return this},t.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 a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)*n.get(a,i));return this},t.mul=function(n,a){return new e(n).mul(a)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(n){return typeof n=="number"?this.divS(n):this.divM(n)},t.prototype.divS=function(n){for(let a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)/n);return this},t.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 a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)/n.get(a,i));return this},t.div=function(n,a){return new e(n).div(a)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(n){return typeof n=="number"?this.modS(n):this.modM(n)},t.prototype.modS=function(n){for(let a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)%n);return this},t.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 a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)%n.get(a,i));return this},t.mod=function(n,a){return new e(n).mod(a)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(n){return typeof n=="number"?this.andS(n):this.andM(n)},t.prototype.andS=function(n){for(let a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)&n);return this},t.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 a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)&n.get(a,i));return this},t.and=function(n,a){return new e(n).and(a)},t.prototype.or=function(n){return typeof n=="number"?this.orS(n):this.orM(n)},t.prototype.orS=function(n){for(let a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)|n);return this},t.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 a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)|n.get(a,i));return this},t.or=function(n,a){return new e(n).or(a)},t.prototype.xor=function(n){return typeof n=="number"?this.xorS(n):this.xorM(n)},t.prototype.xorS=function(n){for(let a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)^n);return this},t.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 a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)^n.get(a,i));return this},t.xor=function(n,a){return new e(n).xor(a)},t.prototype.leftShift=function(n){return typeof n=="number"?this.leftShiftS(n):this.leftShiftM(n)},t.prototype.leftShiftS=function(n){for(let a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)<<n);return this},t.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 a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)<<n.get(a,i));return this},t.leftShift=function(n,a){return new e(n).leftShift(a)},t.prototype.signPropagatingRightShift=function(n){return typeof n=="number"?this.signPropagatingRightShiftS(n):this.signPropagatingRightShiftM(n)},t.prototype.signPropagatingRightShiftS=function(n){for(let a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)>>n);return this},t.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 a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)>>n.get(a,i));return this},t.signPropagatingRightShift=function(n,a){return new e(n).signPropagatingRightShift(a)},t.prototype.rightShift=function(n){return typeof n=="number"?this.rightShiftS(n):this.rightShiftM(n)},t.prototype.rightShiftS=function(n){for(let a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)>>>n);return this},t.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 a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,this.get(a,i)>>>n.get(a,i));return this},t.rightShift=function(n,a){return new e(n).rightShift(a)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,~this.get(n,a));return this},t.not=function(n){return new e(n).not()},t.prototype.abs=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.abs(this.get(n,a)));return this},t.abs=function(n){return new e(n).abs()},t.prototype.acos=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.acos(this.get(n,a)));return this},t.acos=function(n){return new e(n).acos()},t.prototype.acosh=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.acosh(this.get(n,a)));return this},t.acosh=function(n){return new e(n).acosh()},t.prototype.asin=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.asin(this.get(n,a)));return this},t.asin=function(n){return new e(n).asin()},t.prototype.asinh=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.asinh(this.get(n,a)));return this},t.asinh=function(n){return new e(n).asinh()},t.prototype.atan=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.atan(this.get(n,a)));return this},t.atan=function(n){return new e(n).atan()},t.prototype.atanh=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.atanh(this.get(n,a)));return this},t.atanh=function(n){return new e(n).atanh()},t.prototype.cbrt=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.cbrt(this.get(n,a)));return this},t.cbrt=function(n){return new e(n).cbrt()},t.prototype.ceil=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.ceil(this.get(n,a)));return this},t.ceil=function(n){return new e(n).ceil()},t.prototype.clz32=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.clz32(this.get(n,a)));return this},t.clz32=function(n){return new e(n).clz32()},t.prototype.cos=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.cos(this.get(n,a)));return this},t.cos=function(n){return new e(n).cos()},t.prototype.cosh=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.cosh(this.get(n,a)));return this},t.cosh=function(n){return new e(n).cosh()},t.prototype.exp=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.exp(this.get(n,a)));return this},t.exp=function(n){return new e(n).exp()},t.prototype.expm1=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.expm1(this.get(n,a)));return this},t.expm1=function(n){return new e(n).expm1()},t.prototype.floor=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.floor(this.get(n,a)));return this},t.floor=function(n){return new e(n).floor()},t.prototype.fround=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.fround(this.get(n,a)));return this},t.fround=function(n){return new e(n).fround()},t.prototype.log=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.log(this.get(n,a)));return this},t.log=function(n){return new e(n).log()},t.prototype.log1p=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.log1p(this.get(n,a)));return this},t.log1p=function(n){return new e(n).log1p()},t.prototype.log10=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.log10(this.get(n,a)));return this},t.log10=function(n){return new e(n).log10()},t.prototype.log2=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.log2(this.get(n,a)));return this},t.log2=function(n){return new e(n).log2()},t.prototype.round=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.round(this.get(n,a)));return this},t.round=function(n){return new e(n).round()},t.prototype.sign=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.sign(this.get(n,a)));return this},t.sign=function(n){return new e(n).sign()},t.prototype.sin=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.sin(this.get(n,a)));return this},t.sin=function(n){return new e(n).sin()},t.prototype.sinh=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.sinh(this.get(n,a)));return this},t.sinh=function(n){return new e(n).sinh()},t.prototype.sqrt=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.sqrt(this.get(n,a)));return this},t.sqrt=function(n){return new e(n).sqrt()},t.prototype.tan=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.tan(this.get(n,a)));return this},t.tan=function(n){return new e(n).tan()},t.prototype.tanh=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.tanh(this.get(n,a)));return this},t.tanh=function(n){return new e(n).tanh()},t.prototype.trunc=function(){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.set(n,a,Math.trunc(this.get(n,a)));return this},t.trunc=function(n){return new e(n).trunc()},t.pow=function(n,a){return new e(n).pow(a)},t.prototype.pow=function(n){return typeof n=="number"?this.powS(n):this.powM(n)},t.prototype.powS=function(n){for(let a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,Math.pow(this.get(a,i),n));return this},t.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 a=0;a<this.rows;a++)for(let i=0;i<this.columns;i++)this.set(a,i,Math.pow(this.get(a,i),n.get(a,i)));return this}}function Jn(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function ea(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function Rs(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Fs(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function CN(t,e,r){return{row:TN(t,e),column:IN(t,r)}}function TN(t,e){if(typeof e!="object")throw new TypeError("unexpected type for row indices");if(e.some(n=>n<0||n>=t.rows))throw new RangeError("row indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function IN(t,e){if(typeof e!="object")throw new TypeError("unexpected type for column indices");if(e.some(n=>n<0||n>=t.columns))throw new RangeError("column indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function Gg(t,e,r,n,a){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(Bc("startRow",e),Bc("endRow",r),Bc("startColumn",n),Bc("endColumn",a),e>r||n>a||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||a<0||a>=t.columns)throw new RangeError("Submatrix indices are out of range")}function cv(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function Bc(t,e){if(typeof e!="number")throw new TypeError(`${t} must be a number`)}function pne(t){let e=cv(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}function gne(t){let e=cv(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}function yne(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}function mne(t){let e=cv(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}function bne(t){let e=cv(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}function wne(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}function xne(t,e,r){const n=t.rows,a=t.columns,i=[];for(let o=0;o<n;o++){let s=0,u=0,f=0;for(let l=0;l<a;l++)f=t.get(o,l)-r[o],s+=f,u+=f*f;e?i.push((u-s*s/a)/(a-1)):i.push((u-s*s/a)/a)}return i}function Ene(t,e,r){const n=t.rows,a=t.columns,i=[];for(let o=0;o<a;o++){let s=0,u=0,f=0;for(let l=0;l<n;l++)f=t.get(l,o)-r[o],s+=f,u+=f*f;e?i.push((u-s*s/n)/(n-1)):i.push((u-s*s/n)/n)}return i}function _ne(t,e,r){const n=t.rows,a=t.columns,i=n*a;let o=0,s=0,u=0;for(let f=0;f<n;f++)for(let l=0;l<a;l++)u=t.get(f,l)-r,o+=u,s+=u*u;return e?(s-o*o/i)/(i-1):(s-o*o/i)/i}function Sne(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}function Mne(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}function Ane(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}function Cne(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let a=0;a<t.columns;a++)n+=Math.pow(t.get(r,a),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}function Tne(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}function Ine(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let a=0;a<t.rows;a++)n+=Math.pow(t.get(a,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}function kne(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}function Nne(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let a=0;a<t.rows;a++)r+=Math.pow(t.get(a,n),2)/e;return Math.sqrt(r)}function One(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}class Xt{static from1DArray(e,r,n){if(e*r!==n.length)throw new RangeError("data length does not match given dimensions");let i=new lt(e,r);for(let o=0;o<e;o++)for(let s=0;s<r;s++)i.set(o,s,n[o*r+s]);return i}static rowVector(e){let r=new lt(1,e.length);for(let n=0;n<e.length;n++)r.set(0,n,e[n]);return r}static columnVector(e){let r=new lt(e.length,1);for(let n=0;n<e.length;n++)r.set(n,0,e[n]);return r}static zeros(e,r){return new lt(e,r)}static ones(e,r){return new lt(e,r).fill(1)}static rand(e,r,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{random:a=Math.random}=n;let i=new lt(e,r);for(let o=0;o<e;o++)for(let s=0;s<r;s++)i.set(o,s,a());return i}static randInt(e,r,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{min:a=0,max:i=1e3,random:o=Math.random}=n;if(!Number.isInteger(a))throw new TypeError("min must be an integer");if(!Number.isInteger(i))throw new TypeError("max must be an integer");if(a>=i)throw new RangeError("min must be smaller than max");let s=i-a,u=new lt(e,r);for(let f=0;f<e;f++)for(let l=0;l<r;l++){let c=a+Math.round(o()*s);u.set(f,l,c)}return u}static eye(e,r,n){r===void 0&&(r=e),n===void 0&&(n=1);let a=Math.min(e,r),i=this.zeros(e,r);for(let o=0;o<a;o++)i.set(o,o,n);return i}static diag(e,r,n){let a=e.length;r===void 0&&(r=a),n===void 0&&(n=r);let i=Math.min(a,r,n),o=this.zeros(r,n);for(let s=0;s<i;s++)o.set(s,s,e[s]);return o}static min(e,r){e=this.checkMatrix(e),r=this.checkMatrix(r);let n=e.rows,a=e.columns,i=new lt(n,a);for(let o=0;o<n;o++)for(let s=0;s<a;s++)i.set(o,s,Math.min(e.get(o,s),r.get(o,s)));return i}static max(e,r){e=this.checkMatrix(e),r=this.checkMatrix(r);let n=e.rows,a=e.columns,i=new this(n,a);for(let o=0;o<n;o++)for(let s=0;s<a;s++)i.set(o,s,Math.max(e.get(o,s),r.get(o,s)));return i}static checkMatrix(e){return Xt.isMatrix(e)?e:new lt(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 r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)e.call(this,r,n);return this}to1DArray(){let e=[];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)e.push(this.get(r,n));return e}to2DArray(){let e=[];for(let r=0;r<this.rows;r++){e.push([]);for(let n=0;n<this.columns;n++)e[r].push(this.get(r,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 r=0;r<=e;r++)if(this.get(e,r)!==this.get(r,e))return!1;return!0}return!1}isEchelonForm(){let e=0,r=0,n=-1,a=!0,i=!1;for(;e<this.rows&&a;){for(r=0,i=!1;r<this.columns&&i===!1;)this.get(e,r)===0?r++:this.get(e,r)===1&&r>n?(i=!0,n=r):(a=!1,i=!0);e++}return a}isReducedEchelonForm(){let e=0,r=0,n=-1,a=!0,i=!1;for(;e<this.rows&&a;){for(r=0,i=!1;r<this.columns&&i===!1;)this.get(e,r)===0?r++:this.get(e,r)===1&&r>n?(i=!0,n=r):(a=!1,i=!0);for(let o=r+1;o<this.rows;o++)this.get(e,o)!==0&&(a=!1);e++}return a}echelonForm(){let e=this.clone(),r=0,n=0;for(;r<e.rows&&n<e.columns;){let a=r;for(let i=r;i<e.rows;i++)e.get(i,n)>e.get(a,n)&&(a=i);if(e.get(a,n)===0)n++;else{e.swapRows(r,a);let i=e.get(r,n);for(let o=n;o<e.columns;o++)e.set(r,o,e.get(r,o)/i);for(let o=r+1;o<e.rows;o++){let s=e.get(o,n)/e.get(r,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(r,u)*s)}r++,n++}}return e}reducedEchelonForm(){let e=this.echelonForm(),r=e.columns,n=e.rows,a=n-1;for(;a>=0;)if(e.maxRow(a)===0)a--;else{let i=0,o=!1;for(;i<n&&o===!1;)e.get(a,i)===1?o=!0:i++;for(let s=0;s<a;s++){let u=e.get(s,i);for(let f=i;f<r;f++){let l=e.get(s,f)-u*e.get(a,f);e.set(s,f,l)}}a--}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:r=1,columns:n=1}=e;if(!Number.isInteger(r)||r<=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 a=new lt(this.rows*r,this.columns*n);for(let i=0;i<r;i++)for(let o=0;o<n;o++)a.setSubMatrix(this,this.rows*i,this.columns*o);return a}fill(e){for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,e);return this}neg(){return this.mulS(-1)}getRow(e){Jn(this,e);let r=[];for(let n=0;n<this.columns;n++)r.push(this.get(e,n));return r}getRowVector(e){return lt.rowVector(this.getRow(e))}setRow(e,r){Jn(this,e),r=Rs(this,r);for(let n=0;n<this.columns;n++)this.set(e,n,r[n]);return this}swapRows(e,r){Jn(this,e),Jn(this,r);for(let n=0;n<this.columns;n++){let a=this.get(e,n);this.set(e,n,this.get(r,n)),this.set(r,n,a)}return this}getColumn(e){ea(this,e);let r=[];for(let n=0;n<this.rows;n++)r.push(this.get(n,e));return r}getColumnVector(e){return lt.columnVector(this.getColumn(e))}setColumn(e,r){ea(this,e),r=Fs(this,r);for(let n=0;n<this.rows;n++)this.set(n,e,r[n]);return this}swapColumns(e,r){ea(this,e),ea(this,r);for(let n=0;n<this.rows;n++){let a=this.get(n,e);this.set(n,e,this.get(n,r)),this.set(n,r,a)}return this}addRowVector(e){e=Rs(this,e);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)+e[n]);return this}subRowVector(e){e=Rs(this,e);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)-e[n]);return this}mulRowVector(e){e=Rs(this,e);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)*e[n]);return this}divRowVector(e){e=Rs(this,e);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)/e[n]);return this}addColumnVector(e){e=Fs(this,e);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)+e[r]);return this}subColumnVector(e){e=Fs(this,e);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)-e[r]);return this}mulColumnVector(e){e=Fs(this,e);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)*e[r]);return this}divColumnVector(e){e=Fs(this,e);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)/e[r]);return this}mulRow(e,r){Jn(this,e);for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*r);return this}mulColumn(e,r){ea(this,e);for(let n=0;n<this.rows;n++)this.set(n,e,this.get(n,e)*r);return this}max(){let e=this.get(0,0);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>e&&(e=this.get(r,n));return e}maxIndex(){let e=this.get(0,0),r=[0,0];for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.get(n,a)>e&&(e=this.get(n,a),r[0]=n,r[1]=a);return r}min(){let e=this.get(0,0);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<e&&(e=this.get(r,n));return e}minIndex(){let e=this.get(0,0),r=[0,0];for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)this.get(n,a)<e&&(e=this.get(n,a),r[0]=n,r[1]=a);return r}maxRow(e){Jn(this,e);let r=this.get(e,0);for(let n=1;n<this.columns;n++)this.get(e,n)>r&&(r=this.get(e,n));return r}maxRowIndex(e){Jn(this,e);let r=this.get(e,0),n=[e,0];for(let a=1;a<this.columns;a++)this.get(e,a)>r&&(r=this.get(e,a),n[1]=a);return n}minRow(e){Jn(this,e);let r=this.get(e,0);for(let n=1;n<this.columns;n++)this.get(e,n)<r&&(r=this.get(e,n));return r}minRowIndex(e){Jn(this,e);let r=this.get(e,0),n=[e,0];for(let a=1;a<this.columns;a++)this.get(e,a)<r&&(r=this.get(e,a),n[1]=a);return n}maxColumn(e){ea(this,e);let r=this.get(0,e);for(let n=1;n<this.rows;n++)this.get(n,e)>r&&(r=this.get(n,e));return r}maxColumnIndex(e){ea(this,e);let r=this.get(0,e),n=[0,e];for(let a=1;a<this.rows;a++)this.get(a,e)>r&&(r=this.get(a,e),n[0]=a);return n}minColumn(e){ea(this,e);let r=this.get(0,e);for(let n=1;n<this.rows;n++)this.get(n,e)<r&&(r=this.get(n,e));return r}minColumnIndex(e){ea(this,e);let r=this.get(0,e),n=[0,e];for(let a=1;a<this.rows;a++)this.get(a,e)<r&&(r=this.get(a,e),n[0]=a);return n}diag(){let e=Math.min(this.rows,this.columns),r=[];for(let n=0;n<e;n++)r.push(this.get(n,n));return r}norm(e="frobenius"){let r=0;if(e==="max")return this.max();if(e==="frobenius"){for(let n=0;n<this.rows;n++)for(let a=0;a<this.columns;a++)r=r+this.get(n,a)*this.get(n,a);return Math.sqrt(r)}else throw new RangeError(`unknown norm type: ${e}`)}cumulativeSum(){let e=0;for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)e+=this.get(r,n),this.set(r,n,e);return this}dot(e){Xt.isMatrix(e)&&(e=e.to1DArray());let r=this.to1DArray();if(r.length!==e.length)throw new RangeError("vectors do not have the same size");let n=0;for(let a=0;a<r.length;a++)n+=r[a]*e[a];return n}mmul(e){e=lt.checkMatrix(e);let r=this.rows,n=this.columns,a=e.columns,i=new lt(r,a),o=new Float64Array(n);for(let s=0;s<a;s++){for(let u=0;u<n;u++)o[u]=e.get(u,s);for(let u=0;u<r;u++){let f=0;for(let l=0;l<n;l++)f+=this.get(u,l)*o[l];i.set(u,s,f)}}return i}strassen2x2(e){e=lt.checkMatrix(e);let r=new lt(2,2);const n=this.get(0,0),a=e.get(0,0),i=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)*(a+l),h=(s+f)*a,d=n*(o-l),v=f*(u-a),p=(n+i)*l,g=(s-n)*(a+o),y=(i-f)*(u+l),m=c+v-p+y,b=d+p,w=h+v,x=c-h+d+g;return r.set(0,0,m),r.set(0,1,b),r.set(1,0,w),r.set(1,1,x),r}strassen3x3(e){e=lt.checkMatrix(e);let r=new lt(3,3);const n=this.get(0,0),a=this.get(0,1),i=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),w=e.get(2,2),x=(n+a+i-o-s-l-c)*g,E=(n-o)*(-d+g),_=s*(-h+d+p-g-y-m+w),S=(-n+o+s)*(h-d+g),A=(o+s)*(-h+d),M=n*h,C=(-n+f+l)*(h-v+y),I=(-n+f)*(v-y),k=(f+l)*(-h+v),O=(n+a+i-s-u-f-l)*y,B=l*(-h+v+p-g-y-m+b),L=(-i+l+c)*(g+m-b),z=(i-c)*(g-b),X=i*m,R=(l+c)*(-m+b),V=(-i+s+u)*(y+m-w),he=(i-u)*(y-w),ce=(s+u)*(-m+w),le=a*p,ie=u*b,Ie=o*v,qe=f*d,Ve=c*w,it=M+X+le,dt=x+S+A+M+L+X+R,st=M+C+k+O+X+V+ce,Tt=E+_+S+M+X+V+he,_t=E+S+A+M+ie,lr=X+V+he+ce+Ie,Bt=M+C+I+B+L+z+X,Wt=L+z+X+R+qe,vr=M+C+I+k+Ve;return r.set(0,0,it),r.set(0,1,dt),r.set(0,2,st),r.set(1,0,Tt),r.set(1,1,_t),r.set(1,2,lr),r.set(2,0,Bt),r.set(2,1,Wt),r.set(2,2,vr),r}mmulStrassen(e){e=lt.checkMatrix(e);let r=this.clone(),n=r.rows,a=r.columns,i=e.rows,o=e.columns;a!==i&&console.warn(`Multiplying ${n} x ${a} and ${i} 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=Xt.zeros(h,d);return g=g.setSubMatrix(c,0,0),g}}let u=Math.max(n,i),f=Math.max(a,o);r=s(r,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),w=h.subMatrix(0,p-1,g,h.columns-1),x=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),S=h.subMatrix(p,h.rows-1,g,h.columns-1),A=l(Xt.add(y,_),Xt.add(m,S),p,g),M=l(Xt.add(x,_),m,p,g),C=l(y,Xt.sub(w,S),p,g),I=l(_,Xt.sub(E,m),p,g),k=l(Xt.add(y,b),S,p,g),O=l(Xt.sub(x,y),Xt.add(m,w),p,g),B=l(Xt.sub(b,_),Xt.add(E,S),p,g),L=Xt.add(A,I);L.sub(k),L.add(B);let z=Xt.add(C,k),X=Xt.add(M,I),R=Xt.sub(A,M);R.add(C),R.add(O);let V=Xt.zeros(2*L.rows,2*L.columns);return V=V.setSubMatrix(L,0,0),V=V.setSubMatrix(z,L.rows,0),V=V.setSubMatrix(X,0,L.columns),V=V.setSubMatrix(R,L.rows,L.columns),V.subMatrix(0,d-1,0,v-1)}return l(r,e,u,f)}scaleRows(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:r=0,max:n=1}=e;if(!Number.isFinite(r))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(r>=n)throw new RangeError("min must be smaller than max");let a=new lt(this.rows,this.columns);for(let i=0;i<this.rows;i++){const o=this.getRow(i);i2(o,{min:r,max:n,output:o}),a.setRow(i,o)}return a}scaleColumns(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:r=0,max:n=1}=e;if(!Number.isFinite(r))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(r>=n)throw new RangeError("min must be smaller than max");let a=new lt(this.rows,this.columns);for(let i=0;i<this.columns;i++){const o=this.getColumn(i);i2(o,{min:r,max:n,output:o}),a.setColumn(i,o)}return a}flipRows(){const e=Math.ceil(this.columns/2);for(let r=0;r<this.rows;r++)for(let n=0;n<e;n++){let a=this.get(r,n),i=this.get(r,this.columns-1-n);this.set(r,n,i),this.set(r,this.columns-1-n,a)}return this}flipColumns(){const e=Math.ceil(this.rows/2);for(let r=0;r<this.columns;r++)for(let n=0;n<e;n++){let a=this.get(n,r),i=this.get(this.rows-1-n,r);this.set(n,r,i),this.set(this.rows-1-n,r,a)}return this}kroneckerProduct(e){e=lt.checkMatrix(e);let r=this.rows,n=this.columns,a=e.rows,i=e.columns,o=new lt(r*a,n*i);for(let s=0;s<r;s++)for(let u=0;u<n;u++)for(let f=0;f<a;f++)for(let l=0;l<i;l++)o.set(a*s+f,i*u+l,this.get(s,u)*e.get(f,l));return o}transpose(){let e=new lt(this.columns,this.rows);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)e.set(n,r,this.get(r,n));return e}sortRows(e=o2){for(let r=0;r<this.rows;r++)this.setRow(r,this.getRow(r).sort(e));return this}sortColumns(e=o2){for(let r=0;r<this.columns;r++)this.setColumn(r,this.getColumn(r).sort(e));return this}subMatrix(e,r,n,a){Gg(this,e,r,n,a);let i=new lt(r-e+1,a-n+1);for(let o=e;o<=r;o++)for(let s=n;s<=a;s++)i.set(o-e,s-n,this.get(o,s));return i}subMatrixRow(e,r,n){if(r===void 0&&(r=0),n===void 0&&(n=this.columns-1),r>n||r<0||r>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let a=new lt(e.length,n-r+1);for(let i=0;i<e.length;i++)for(let o=r;o<=n;o++){if(e[i]<0||e[i]>=this.rows)throw new RangeError(`Row index out of range: ${e[i]}`);a.set(i,o-r,this.get(e[i],o))}return a}subMatrixColumn(e,r,n){if(r===void 0&&(r=0),n===void 0&&(n=this.rows-1),r>n||r<0||r>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let a=new lt(n-r+1,e.length);for(let i=0;i<e.length;i++)for(let o=r;o<=n;o++){if(e[i]<0||e[i]>=this.columns)throw new RangeError(`Column index out of range: ${e[i]}`);a.set(o-r,i,this.get(o,e[i]))}return a}setSubMatrix(e,r,n){e=lt.checkMatrix(e);let a=r+e.rows-1,i=n+e.columns-1;Gg(this,r,a,n,i);for(let o=0;o<e.rows;o++)for(let s=0;s<e.columns;s++)this.set(r+o,n+s,e.get(o,s));return this}selection(e,r){let n=CN(this,e,r),a=new lt(e.length,r.length);for(let i=0;i<n.row.length;i++){let o=n.row[i];for(let s=0;s<n.column.length;s++){let u=n.column[s];a.set(i,s,this.get(o,u))}}return a}trace(){let e=Math.min(this.rows,this.columns),r=0;for(let n=0;n<e;n++)r+=this.get(n,n);return r}clone(){let e=new lt(this.rows,this.columns);for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)e.set(r,n,this.get(r,n));return e}sum(e){switch(e){case"row":return pne(this);case"column":return gne(this);case void 0:return yne(this);default:throw new Error(`invalid option: ${e}`)}}product(e){switch(e){case"row":return mne(this);case"column":return bne(this);case void 0:return wne(this);default:throw new Error(`invalid option: ${e}`)}}mean(e){const r=this.sum(e);switch(e){case"row":{for(let n=0;n<this.rows;n++)r[n]/=this.columns;return r}case"column":{for(let n=0;n<this.columns;n++)r[n]/=this.rows;return r}case void 0:return r/this.size;default:throw new Error(`invalid option: ${e}`)}}variance(e,r={}){if(typeof e=="object"&&(r=e,e=void 0),typeof r!="object")throw new TypeError("options must be an object");const{unbiased:n=!0,mean:a=this.mean(e)}=r;if(typeof n!="boolean")throw new TypeError("unbiased must be a boolean");switch(e){case"row":{if(!Array.isArray(a))throw new TypeError("mean must be an array");return xne(this,n,a)}case"column":{if(!Array.isArray(a))throw new TypeError("mean must be an array");return Ene(this,n,a)}case void 0:{if(typeof a!="number")throw new TypeError("mean must be a number");return _ne(this,n,a)}default:throw new Error(`invalid option: ${e}`)}}standardDeviation(e,r){typeof e=="object"&&(r=e,e=void 0);const n=this.variance(e,r);if(e===void 0)return Math.sqrt(n);for(let a=0;a<n.length;a++)n[a]=Math.sqrt(n[a]);return n}center(e,r={}){if(typeof e=="object"&&(r=e,e=void 0),typeof r!="object")throw new TypeError("options must be an object");const{center:n=this.mean(e)}=r;switch(e){case"row":{if(!Array.isArray(n))throw new TypeError("center must be an array");return Sne(this,n),this}case"column":{if(!Array.isArray(n))throw new TypeError("center must be an array");return Mne(this,n),this}case void 0:{if(typeof n!="number")throw new TypeError("center must be a number");return Ane(this,n),this}default:throw new Error(`invalid option: ${e}`)}}scale(e,r={}){if(typeof e=="object"&&(r=e,e=void 0),typeof r!="object")throw new TypeError("options must be an object");let n=r.scale;switch(e){case"row":{if(n===void 0)n=Cne(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return Tne(this,n),this}case"column":{if(n===void 0)n=Ine(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return kne(this,n),this}case void 0:{if(n===void 0)n=Nne(this);else if(typeof n!="number")throw new TypeError("scale must be a number");return One(this,n),this}default:throw new Error(`invalid option: ${e}`)}}toString(e){return AN(this,e)}}Xt.prototype.klass="Matrix";typeof Symbol<"u"&&(Xt.prototype[Symbol.for("nodejs.util.inspect.custom")]=cne);function o2(t,e){return t-e}Xt.random=Xt.rand;Xt.randomInt=Xt.randInt;Xt.diagonal=Xt.diag;Xt.prototype.diagonal=Xt.prototype.diag;Xt.identity=Xt.eye;Xt.prototype.negate=Xt.prototype.neg;Xt.prototype.tensorProduct=Xt.prototype.kroneckerProduct;class lt extends Xt{constructor(e,r){if(super(),lt.isMatrix(e))return e.clone();if(Number.isInteger(e)&&e>0)if(this.data=[],Number.isInteger(r)&&r>0)for(let n=0;n<e;n++)this.data.push(new Float64Array(r));else throw new TypeError("nColumns must be a positive integer");else if(Array.isArray(e)){const n=e;if(e=n.length,r=n[0].length,typeof r!="number"||r===0)throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let a=0;a<e;a++){if(n[a].length!==r)throw new RangeError("Inconsistent array dimensions");this.data.push(Float64Array.from(n[a]))}}else throw new TypeError("First argument must be a positive number or an array");return this.rows=e,this.columns=r,this}set(e,r,n){return this.data[e][r]=n,this}get(e,r){return this.data[e][r]}removeRow(e){if(Jn(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,r){return r===void 0&&(r=e,e=this.rows),Jn(this,e,!0),r=Float64Array.from(Rs(this,r)),this.data.splice(e,0,r),this.rows+=1,this}removeColumn(e){if(ea(this,e),this.columns===1)throw new RangeError("A matrix cannot have less than one column");for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns-1);for(let a=0;a<e;a++)n[a]=this.data[r][a];for(let a=e+1;a<this.columns;a++)n[a-1]=this.data[r][a];this.data[r]=n}return this.columns-=1,this}addColumn(e,r){typeof r>"u"&&(r=e,e=this.columns),ea(this,e,!0),r=Fs(this,r);for(let n=0;n<this.rows;n++){const a=new Float64Array(this.columns+1);let i=0;for(;i<e;i++)a[i]=this.data[n][i];for(a[i++]=r[n];i<this.columns+1;i++)a[i]=this.data[n][i-1];this.data[n]=a}return this.columns+=1,this}}vne(Xt,lt);class Si extends Xt{constructor(e,r,n){super(),this.matrix=e,this.rows=r,this.columns=n}}class Lne extends Si{constructor(e,r){ea(e,r),super(e,e.rows,1),this.column=r}set(e,r,n){return this.matrix.set(e,this.column,n),this}get(e){return this.matrix.get(e,this.column)}}class Dne extends Si{constructor(e,r){r=IN(e,r),super(e,e.rows,r.length),this.columnIndices=r}set(e,r,n){return this.matrix.set(e,this.columnIndices[r],n),this}get(e,r){return this.matrix.get(e,this.columnIndices[r])}}class Pne extends Si{constructor(e){super(e,e.rows,e.columns)}set(e,r,n){return this.matrix.set(e,this.columns-r-1,n),this}get(e,r){return this.matrix.get(e,this.columns-r-1)}}class Rne extends Si{constructor(e){super(e,e.rows,e.columns)}set(e,r,n){return this.matrix.set(this.rows-e-1,r,n),this}get(e,r){return this.matrix.get(this.rows-e-1,r)}}class Fne extends Si{constructor(e,r){Jn(e,r),super(e,1,e.columns),this.row=r}set(e,r,n){return this.matrix.set(this.row,r,n),this}get(e,r){return this.matrix.get(this.row,r)}}class Bne extends Si{constructor(e,r){r=TN(e,r),super(e,r.length,e.columns),this.rowIndices=r}set(e,r,n){return this.matrix.set(this.rowIndices[e],r,n),this}get(e,r){return this.matrix.get(this.rowIndices[e],r)}}class bh extends Si{constructor(e,r,n){let a=CN(e,r,n);super(e,a.row.length,a.column.length),this.rowIndices=a.row,this.columnIndices=a.column}set(e,r,n){return this.matrix.set(this.rowIndices[e],this.columnIndices[r],n),this}get(e,r){return this.matrix.get(this.rowIndices[e],this.columnIndices[r])}}class Gne extends Si{constructor(e,r,n,a,i){Gg(e,r,n,a,i),super(e,n-r+1,i-a+1),this.startRow=r,this.startColumn=a}set(e,r,n){return this.matrix.set(this.startRow+e,this.startColumn+r,n),this}get(e,r){return this.matrix.get(this.startRow+e,this.startColumn+r)}}class zne extends Si{constructor(e){super(e,e.columns,e.rows)}set(e,r,n){return this.matrix.set(r,e,n),this}get(e,r){return this.matrix.get(r,e)}}class kN extends Xt{constructor(e,r={}){const{rows:n=1}=r;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,r,n){let a=this._calculateIndex(e,r);return this.data[a]=n,this}get(e,r){let n=this._calculateIndex(e,r);return this.data[n]}_calculateIndex(e,r){return e*this.columns+r}}class Wn extends Xt{constructor(e){super(),this.data=e,this.rows=e.length,this.columns=e[0].length}set(e,r,n){return this.data[e][r]=n,this}get(e,r){return this.data[e][r]}}function jne(t,e){if(Array.isArray(t))return t[0]&&Array.isArray(t[0])?new Wn(t):new kN(t,e);throw new Error("the argument is not an array")}class fd{constructor(e){e=Wn.checkMatrix(e);let r=e.clone(),n=r.rows,a=r.columns,i=new Float64Array(n),o=1,s,u,f,l,c,h,d,v,p;for(s=0;s<n;s++)i[s]=s;for(v=new Float64Array(n),u=0;u<a;u++){for(s=0;s<n;s++)v[s]=r.get(s,u);for(s=0;s<n;s++){for(p=Math.min(s,u),c=0,f=0;f<p;f++)c+=r.get(s,f)*v[f];v[s]-=c,r.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<a;f++)h=r.get(l,f),r.set(l,f,r.get(u,f)),r.set(u,f,h);d=i[l],i[l]=i[u],i[u]=d,o=-o}if(u<n&&r.get(u,u)!==0)for(s=u+1;s<n;s++)r.set(s,u,r.get(s,u)/r.get(u,u))}this.LU=r,this.pivotVector=i,this.pivotSign=o}isSingular(){let e=this.LU,r=e.columns;for(let n=0;n<r;n++)if(e.get(n,n)===0)return!0;return!1}solve(e){e=lt.checkMatrix(e);let r=this.LU;if(r.rows!==e.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let a=e.columns,i=e.subMatrixRow(this.pivotVector,0,a-1),o=r.columns,s,u,f;for(f=0;f<o;f++)for(s=f+1;s<o;s++)for(u=0;u<a;u++)i.set(s,u,i.get(s,u)-i.get(f,u)*r.get(s,f));for(f=o-1;f>=0;f--){for(u=0;u<a;u++)i.set(f,u,i.get(f,u)/r.get(f,f));for(s=0;s<f;s++)for(u=0;u<a;u++)i.set(s,u,i.get(s,u)-i.get(f,u)*r.get(s,f))}return i}get determinant(){let e=this.LU;if(!e.isSquare())throw new Error("Matrix must be square");let r=this.pivotSign,n=e.columns;for(let a=0;a<n;a++)r*=e.get(a,a);return r}get lowerTriangularMatrix(){let e=this.LU,r=e.rows,n=e.columns,a=new lt(r,n);for(let i=0;i<r;i++)for(let o=0;o<n;o++)i>o?a.set(i,o,e.get(i,o)):i===o?a.set(i,o,1):a.set(i,o,0);return a}get upperTriangularMatrix(){let e=this.LU,r=e.rows,n=e.columns,a=new lt(r,n);for(let i=0;i<r;i++)for(let o=0;o<n;o++)i<=o?a.set(i,o,e.get(i,o)):a.set(i,o,0);return a}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function hi(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):e!==0?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class zg{constructor(e){e=Wn.checkMatrix(e);let r=e.clone(),n=e.rows,a=e.columns,i=new Float64Array(a),o,s,u,f;for(u=0;u<a;u++){let l=0;for(o=u;o<n;o++)l=hi(l,r.get(o,u));if(l!==0){for(r.get(u,u)<0&&(l=-l),o=u;o<n;o++)r.set(o,u,r.get(o,u)/l);for(r.set(u,u,r.get(u,u)+1),s=u+1;s<a;s++){for(f=0,o=u;o<n;o++)f+=r.get(o,u)*r.get(o,s);for(f=-f/r.get(u,u),o=u;o<n;o++)r.set(o,s,r.get(o,s)+f*r.get(o,u))}}i[u]=-l}this.QR=r,this.Rdiag=i}solve(e){e=lt.checkMatrix(e);let r=this.QR,n=r.rows;if(e.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let a=e.columns,i=e.clone(),o=r.columns,s,u,f,l;for(f=0;f<o;f++)for(u=0;u<a;u++){for(l=0,s=f;s<n;s++)l+=r.get(s,f)*i.get(s,u);for(l=-l/r.get(f,f),s=f;s<n;s++)i.set(s,u,i.get(s,u)+l*r.get(s,f))}for(f=o-1;f>=0;f--){for(u=0;u<a;u++)i.set(f,u,i.get(f,u)/this.Rdiag[f]);for(s=0;s<f;s++)for(u=0;u<a;u++)i.set(s,u,i.get(s,u)-i.get(f,u)*r.get(s,f))}return i.subMatrix(0,o-1,0,a-1)}isFullRank(){let e=this.QR.columns;for(let r=0;r<e;r++)if(this.Rdiag[r]===0)return!1;return!0}get upperTriangularMatrix(){let e=this.QR,r=e.columns,n=new lt(r,r),a,i;for(a=0;a<r;a++)for(i=0;i<r;i++)a<i?n.set(a,i,e.get(a,i)):a===i?n.set(a,i,this.Rdiag[a]):n.set(a,i,0);return n}get orthogonalMatrix(){let e=this.QR,r=e.rows,n=e.columns,a=new lt(r,n),i,o,s,u;for(s=n-1;s>=0;s--){for(i=0;i<r;i++)a.set(i,s,0);for(a.set(s,s,1),o=s;o<n;o++)if(e.get(s,s)!==0){for(u=0,i=s;i<r;i++)u+=e.get(i,s)*a.get(i,o);for(u=-u/e.get(s,s),i=s;i<r;i++)a.set(i,o,a.get(i,o)+u*e.get(i,s))}}return a}}class cu{constructor(e,r={}){e=Wn.checkMatrix(e);let n=e.rows,a=e.columns;const{computeLeftSingularVectors:i=!0,computeRightSingularVectors:o=!0,autoTranspose:s=!1}=r;let u=!!i,f=!!o,l=!1,c;if(n<a)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,a=c.columns,l=!0;let M=u;u=f,f=M}else c=e.clone();let h=Math.min(n,a),d=Math.min(n+1,a),v=new Float64Array(d),p=new lt(n,h),g=new lt(a,a),y=new Float64Array(a),m=new Float64Array(n),b=new Float64Array(d);for(let M=0;M<d;M++)b[M]=M;let w=Math.min(n-1,a),x=Math.max(0,Math.min(a-2,n)),E=Math.max(w,x);for(let M=0;M<E;M++){if(M<w){v[M]=0;for(let C=M;C<n;C++)v[M]=hi(v[M],c.get(C,M));if(v[M]!==0){c.get(M,M)<0&&(v[M]=-v[M]);for(let C=M;C<n;C++)c.set(C,M,c.get(C,M)/v[M]);c.set(M,M,c.get(M,M)+1)}v[M]=-v[M]}for(let C=M+1;C<a;C++){if(M<w&&v[M]!==0){let I=0;for(let k=M;k<n;k++)I+=c.get(k,M)*c.get(k,C);I=-I/c.get(M,M);for(let k=M;k<n;k++)c.set(k,C,c.get(k,C)+I*c.get(k,M))}y[C]=c.get(M,C)}if(u&&M<w)for(let C=M;C<n;C++)p.set(C,M,c.get(C,M));if(M<x){y[M]=0;for(let C=M+1;C<a;C++)y[M]=hi(y[M],y[C]);if(y[M]!==0){y[M+1]<0&&(y[M]=0-y[M]);for(let C=M+1;C<a;C++)y[C]/=y[M];y[M+1]+=1}if(y[M]=-y[M],M+1<n&&y[M]!==0){for(let C=M+1;C<n;C++)m[C]=0;for(let C=M+1;C<n;C++)for(let I=M+1;I<a;I++)m[C]+=y[I]*c.get(C,I);for(let C=M+1;C<a;C++){let I=-y[C]/y[M+1];for(let k=M+1;k<n;k++)c.set(k,C,c.get(k,C)+I*m[k])}}if(f)for(let C=M+1;C<a;C++)g.set(C,M,y[C])}}let _=Math.min(a,n+1);if(w<a&&(v[w]=c.get(w,w)),n<_&&(v[_-1]=0),x+1<_&&(y[x]=c.get(x,_-1)),y[_-1]=0,u){for(let M=w;M<h;M++){for(let C=0;C<n;C++)p.set(C,M,0);p.set(M,M,1)}for(let M=w-1;M>=0;M--)if(v[M]!==0){for(let C=M+1;C<h;C++){let I=0;for(let k=M;k<n;k++)I+=p.get(k,M)*p.get(k,C);I=-I/p.get(M,M);for(let k=M;k<n;k++)p.set(k,C,p.get(k,C)+I*p.get(k,M))}for(let C=M;C<n;C++)p.set(C,M,-p.get(C,M));p.set(M,M,1+p.get(M,M));for(let C=0;C<M-1;C++)p.set(C,M,0)}else{for(let C=0;C<n;C++)p.set(C,M,0);p.set(M,M,1)}}if(f)for(let M=a-1;M>=0;M--){if(M<x&&y[M]!==0)for(let C=M+1;C<a;C++){let I=0;for(let k=M+1;k<a;k++)I+=g.get(k,M)*g.get(k,C);I=-I/g.get(M+1,M);for(let k=M+1;k<a;k++)g.set(k,C,g.get(k,C)+I*g.get(k,M))}for(let C=0;C<a;C++)g.set(C,M,0);g.set(M,M,1)}let S=_-1,A=Number.EPSILON;for(;_>0;){let M,C;for(M=_-2;M>=-1&&M!==-1;M--){const I=Number.MIN_VALUE+A*Math.abs(v[M]+Math.abs(v[M+1]));if(Math.abs(y[M])<=I||Number.isNaN(y[M])){y[M]=0;break}}if(M===_-2)C=4;else{let I;for(I=_-1;I>=M&&I!==M;I--){let k=(I!==_?Math.abs(y[I]):0)+(I!==M+1?Math.abs(y[I-1]):0);if(Math.abs(v[I])<=A*k){v[I]=0;break}}I===M?C=3:I===_-1?C=1:(C=2,M=I)}switch(M++,C){case 1:{let I=y[_-2];y[_-2]=0;for(let k=_-2;k>=M;k--){let O=hi(v[k],I),B=v[k]/O,L=I/O;if(v[k]=O,k!==M&&(I=-L*y[k-1],y[k-1]=B*y[k-1]),f)for(let z=0;z<a;z++)O=B*g.get(z,k)+L*g.get(z,_-1),g.set(z,_-1,-L*g.get(z,k)+B*g.get(z,_-1)),g.set(z,k,O)}break}case 2:{let I=y[M-1];y[M-1]=0;for(let k=M;k<_;k++){let O=hi(v[k],I),B=v[k]/O,L=I/O;if(v[k]=O,I=-L*y[k],y[k]=B*y[k],u)for(let z=0;z<n;z++)O=B*p.get(z,k)+L*p.get(z,M-1),p.set(z,M-1,-L*p.get(z,k)+B*p.get(z,M-1)),p.set(z,k,O)}break}case 3:{const I=Math.max(Math.abs(v[_-1]),Math.abs(v[_-2]),Math.abs(y[_-2]),Math.abs(v[M]),Math.abs(y[M])),k=v[_-1]/I,O=v[_-2]/I,B=y[_-2]/I,L=v[M]/I,z=y[M]/I,X=((O+k)*(O-k)+B*B)/2,R=k*B*(k*B);let V=0;(X!==0||R!==0)&&(X<0?V=0-Math.sqrt(X*X+R):V=Math.sqrt(X*X+R),V=R/(X+V));let he=(L+k)*(L-k)+V,ce=L*z;for(let le=M;le<_-1;le++){let ie=hi(he,ce);ie===0&&(ie=Number.MIN_VALUE);let Ie=he/ie,qe=ce/ie;if(le!==M&&(y[le-1]=ie),he=Ie*v[le]+qe*y[le],y[le]=Ie*y[le]-qe*v[le],ce=qe*v[le+1],v[le+1]=Ie*v[le+1],f)for(let Ve=0;Ve<a;Ve++)ie=Ie*g.get(Ve,le)+qe*g.get(Ve,le+1),g.set(Ve,le+1,-qe*g.get(Ve,le)+Ie*g.get(Ve,le+1)),g.set(Ve,le,ie);if(ie=hi(he,ce),ie===0&&(ie=Number.MIN_VALUE),Ie=he/ie,qe=ce/ie,v[le]=ie,he=Ie*y[le]+qe*v[le+1],v[le+1]=-qe*y[le]+Ie*v[le+1],ce=qe*y[le+1],y[le+1]=Ie*y[le+1],u&&le<n-1)for(let Ve=0;Ve<n;Ve++)ie=Ie*p.get(Ve,le)+qe*p.get(Ve,le+1),p.set(Ve,le+1,-qe*p.get(Ve,le)+Ie*p.get(Ve,le+1)),p.set(Ve,le,ie)}y[_-2]=he;break}case 4:{if(v[M]<=0&&(v[M]=v[M]<0?-v[M]:0,f))for(let I=0;I<=S;I++)g.set(I,M,-g.get(I,M));for(;M<S&&!(v[M]>=v[M+1]);){let I=v[M];if(v[M]=v[M+1],v[M+1]=I,f&&M<a-1)for(let k=0;k<a;k++)I=g.get(k,M+1),g.set(k,M+1,g.get(k,M)),g.set(k,M,I);if(u&&M<n-1)for(let k=0;k<n;k++)I=p.get(k,M+1),p.set(k,M+1,p.get(k,M)),p.set(k,M,I);M++}_--;break}}}if(l){let M=g;g=p,p=M}this.m=n,this.n=a,this.s=v,this.U=p,this.V=g}solve(e){let r=e,n=this.threshold,a=this.s.length,i=lt.zeros(a,a);for(let h=0;h<a;h++)Math.abs(this.s[h])<=n?i.set(h,h,0):i.set(h,h,1/this.s[h]);let o=this.U,s=this.rightSingularVectors,u=s.mmul(i),f=s.rows,l=o.rows,c=lt.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<a;p++)v+=u.get(h,p)*o.get(d,p);c.set(h,d,v)}return c.mmul(r)}solveForDiagonal(e){return this.solve(lt.diag(e))}inverse(){let e=this.V,r=this.threshold,n=e.rows,a=e.columns,i=new lt(n,this.s.length);for(let l=0;l<n;l++)for(let c=0;c<a;c++)Math.abs(this.s[c])>r&&i.set(l,c,e.get(l,c)/this.s[c]);let o=this.U,s=o.rows,u=o.columns,f=new lt(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+=i.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,r=0,n=this.s;for(let a=0,i=n.length;a<i;a++)n[a]>e&&r++;return r}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 lt.diag(this.s)}}function Une(t,e=!1){return t=Wn.checkMatrix(t),e?new cu(t).inverse():NN(t,lt.eye(t.rows))}function NN(t,e,r=!1){return t=Wn.checkMatrix(t),e=Wn.checkMatrix(e),r?new cu(t).solve(e):t.isSquare()?new fd(t).solve(e):new zg(t).solve(e)}function wh(t){if(t=lt.checkMatrix(t),t.isSquare()){let e,r,n,a;if(t.columns===2)return e=t.get(0,0),r=t.get(0,1),n=t.get(1,0),a=t.get(1,1),e*a-r*n;if(t.columns===3){let i,o,s;return i=new bh(t,[1,2],[1,2]),o=new bh(t,[1,2],[0,2]),s=new bh(t,[1,2],[0,1]),e=t.get(0,0),r=t.get(0,1),n=t.get(0,2),e*wh(i)-r*wh(o)+n*wh(s)}else return new fd(t).determinant}else throw Error("determinant can only be calculated for a square matrix")}function $ne(t,e){let r=[];for(let n=0;n<t;n++)n!==e&&r.push(n);return r}function Xne(t,e,r,n=1e-9,a=1e-9){if(t>a)return new Array(e.rows+1).fill(0);{let i=e.addRow(r,[0]);for(let o=0;o<i.rows;o++)Math.abs(i.get(o,0))<n&&i.set(o,0,0);return i.to1DArray()}}function Wne(t,e={}){const{thresholdValue:r=1e-9,thresholdError:n=1e-9}=e;t=lt.checkMatrix(t);let a=t.rows,i=new lt(a,a);for(let o=0;o<a;o++){let s=lt.columnVector(t.getRow(o)),u=t.subMatrixRow($ne(a,o)).transpose(),l=new cu(u).solve(s),c=lt.sub(s,u.mmul(l)).abs().max();i.setRow(o,Xne(c,l,o,r,n))}return i}function Vne(t,e=Number.EPSILON){t=lt.checkMatrix(t);let r=new cu(t,{autoTranspose:!0}),n=r.leftSingularVectors,a=r.rightSingularVectors,i=r.diagonal;for(let o=0;o<i.length;o++)Math.abs(i[o])>e?i[o]=1/i[o]:i[o]=0;return a.mmul(lt.diag(i).mmul(n.transpose()))}function Yne(t,e=t,r={}){t=new lt(t);let n=!1;if(typeof e=="object"&&!lt.isMatrix(e)&&!Array.isArray(e)?(r=e,e=t,n=!0):e=new lt(e),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:a=!0}=r;a&&(t=t.center("column"),n||(e=e.center("column")));const i=t.transpose().mmul(e);for(let o=0;o<i.rows;o++)for(let s=0;s<i.columns;s++)i.set(o,s,i.get(o,s)*(1/(t.rows-1)));return i}function qne(t,e=t,r={}){t=new lt(t);let n=!1;if(typeof e=="object"&&!lt.isMatrix(e)&&!Array.isArray(e)?(r=e,e=t,n=!0):e=new lt(e),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:a=!0,scale:i=!0}=r;a&&(t.center("column"),n||e.center("column")),i&&(t.scale("column"),n||e.scale("column"));const o=t.standardDeviation("column",{unbiased:!0}),s=n?o:e.standardDeviation("column",{unbiased:!0}),u=t.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/(t.rows-1)));return u}class s2{constructor(e,r={}){const{assumeSymmetric:n=!1}=r;if(e=Wn.checkMatrix(e),!e.isSquare())throw new Error("Matrix is not a square matrix");let a=e.columns,i=new lt(a,a),o=new Float64Array(a),s=new Float64Array(a),u=e,f,l,c=!1;if(n?c=!0:c=e.isSymmetric(),c){for(f=0;f<a;f++)for(l=0;l<a;l++)i.set(f,l,u.get(f,l));Hne(a,s,o,i),Zne(a,s,o,i)}else{let h=new lt(a,a),d=new Float64Array(a);for(l=0;l<a;l++)for(f=0;f<a;f++)h.set(f,l,u.get(f,l));Kne(a,h,d,i),Qne(a,s,o,i,h)}this.n=a,this.e=s,this.d=o,this.V=i}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,r=this.e,n=this.d,a=new lt(e,e),i,o;for(i=0;i<e;i++){for(o=0;o<e;o++)a.set(i,o,0);a.set(i,i,n[i]),r[i]>0?a.set(i,i+1,r[i]):r[i]<0&&a.set(i,i-1,r[i])}return a}}function Hne(t,e,r,n){let a,i,o,s,u,f,l,c;for(u=0;u<t;u++)r[u]=n.get(t-1,u);for(s=t-1;s>0;s--){for(c=0,o=0,f=0;f<s;f++)c=c+Math.abs(r[f]);if(c===0)for(e[s]=r[s-1],u=0;u<s;u++)r[u]=n.get(s-1,u),n.set(s,u,0),n.set(u,s,0);else{for(f=0;f<s;f++)r[f]/=c,o+=r[f]*r[f];for(a=r[s-1],i=Math.sqrt(o),a>0&&(i=-i),e[s]=c*i,o=o-a*i,r[s-1]=a-i,u=0;u<s;u++)e[u]=0;for(u=0;u<s;u++){for(a=r[u],n.set(u,s,a),i=e[u]+n.get(u,u)*a,f=u+1;f<=s-1;f++)i+=n.get(f,u)*r[f],e[f]+=n.get(f,u)*a;e[u]=i}for(a=0,u=0;u<s;u++)e[u]/=o,a+=e[u]*r[u];for(l=a/(o+o),u=0;u<s;u++)e[u]-=l*r[u];for(u=0;u<s;u++){for(a=r[u],i=e[u],f=u;f<=s-1;f++)n.set(f,u,n.get(f,u)-(a*e[f]+i*r[f]));r[u]=n.get(s-1,u),n.set(s,u,0)}}r[s]=o}for(s=0;s<t-1;s++){if(n.set(t-1,s,n.get(s,s)),n.set(s,s,1),o=r[s+1],o!==0){for(f=0;f<=s;f++)r[f]=n.get(f,s+1)/o;for(u=0;u<=s;u++){for(i=0,f=0;f<=s;f++)i+=n.get(f,s+1)*n.get(f,u);for(f=0;f<=s;f++)n.set(f,u,n.get(f,u)-i*r[f])}}for(f=0;f<=s;f++)n.set(f,s+1,0)}for(u=0;u<t;u++)r[u]=n.get(t-1,u),n.set(t-1,u,0);n.set(t-1,t-1,1),e[0]=0}function Zne(t,e,r,n){let a,i,o,s,u,f,l,c,h,d,v,p,g,y,m,b;for(o=1;o<t;o++)e[o-1]=e[o];e[t-1]=0;let w=0,x=0,E=Number.EPSILON;for(f=0;f<t;f++){for(x=Math.max(x,Math.abs(r[f])+Math.abs(e[f])),l=f;l<t&&!(Math.abs(e[l])<=E*x);)l++;if(l>f)do{for(a=r[f],c=(r[f+1]-a)/(2*e[f]),h=hi(c,1),c<0&&(h=-h),r[f]=e[f]/(c+h),r[f+1]=e[f]*(c+h),d=r[f+1],i=a-r[f],o=f+2;o<t;o++)r[o]-=i;for(w=w+i,c=r[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,a=v*e[o],i=v*c,h=hi(c,e[o]),e[o+1]=m*h,m=e[o]/h,v=c/h,c=v*r[o]-m*a,r[o+1]=i+m*(v*a+m*r[o]),u=0;u<t;u++)i=n.get(u,o+1),n.set(u,o+1,m*n.get(u,o)+v*i),n.set(u,o,v*n.get(u,o)-m*i);c=-m*b*g*y*e[f]/d,e[f]=m*c,r[f]=v*c}while(Math.abs(e[f])>E*x);r[f]=r[f]+w,e[f]=0}for(o=0;o<t-1;o++){for(u=o,c=r[o],s=o+1;s<t;s++)r[s]<c&&(u=s,c=r[s]);if(u!==o)for(r[u]=r[o],r[o]=c,s=0;s<t;s++)c=n.get(s,o),n.set(s,o,n.get(s,u)),n.set(s,u,c)}}function Kne(t,e,r,n){let a=0,i=t-1,o,s,u,f,l,c,h;for(c=a+1;c<=i-1;c++){for(h=0,f=c;f<=i;f++)h=h+Math.abs(e.get(f,c-1));if(h!==0){for(u=0,f=i;f>=c;f--)r[f]=e.get(f,c-1)/h,u+=r[f]*r[f];for(s=Math.sqrt(u),r[c]>0&&(s=-s),u=u-r[c]*s,r[c]=r[c]-s,l=c;l<t;l++){for(o=0,f=i;f>=c;f--)o+=r[f]*e.get(f,l);for(o=o/u,f=c;f<=i;f++)e.set(f,l,e.get(f,l)-o*r[f])}for(f=0;f<=i;f++){for(o=0,l=i;l>=c;l--)o+=r[l]*e.get(f,l);for(o=o/u,l=c;l<=i;l++)e.set(f,l,e.get(f,l)-o*r[l])}r[c]=h*r[c],e.set(c,c-1,h*s)}}for(f=0;f<t;f++)for(l=0;l<t;l++)n.set(f,l,f===l?1:0);for(c=i-1;c>=a+1;c--)if(e.get(c,c-1)!==0){for(f=c+1;f<=i;f++)r[f]=e.get(f,c-1);for(l=c;l<=i;l++){for(s=0,f=c;f<=i;f++)s+=r[f]*n.get(f,l);for(s=s/r[c]/e.get(c,c-1),f=c;f<=i;f++)n.set(f,l,n.get(f,l)+s*r[f])}}}function Qne(t,e,r,n,a){let i=t-1,o=0,s=t-1,u=Number.EPSILON,f=0,l=0,c=0,h=0,d=0,v=0,p=0,g=0,y,m,b,w,x,E,_,S,A,M,C,I,k,O,B;for(y=0;y<t;y++)for((y<o||y>s)&&(r[y]=a.get(y,y),e[y]=0),m=Math.max(y-1,0);m<t;m++)l=l+Math.abs(a.get(y,m));for(;i>=o;){for(w=i;w>o&&(v=Math.abs(a.get(w-1,w-1))+Math.abs(a.get(w,w)),v===0&&(v=l),!(Math.abs(a.get(w,w-1))<u*v));)w--;if(w===i)a.set(i,i,a.get(i,i)+f),r[i]=a.get(i,i),e[i]=0,i--,g=0;else if(w===i-1){if(_=a.get(i,i-1)*a.get(i-1,i),c=(a.get(i-1,i-1)-a.get(i,i))/2,h=c*c+_,p=Math.sqrt(Math.abs(h)),a.set(i,i,a.get(i,i)+f),a.set(i-1,i-1,a.get(i-1,i-1)+f),S=a.get(i,i),h>=0){for(p=c>=0?c+p:c-p,r[i-1]=S+p,r[i]=r[i-1],p!==0&&(r[i]=S-_/p),e[i-1]=0,e[i]=0,S=a.get(i,i-1),v=Math.abs(S)+Math.abs(p),c=S/v,h=p/v,d=Math.sqrt(c*c+h*h),c=c/d,h=h/d,m=i-1;m<t;m++)p=a.get(i-1,m),a.set(i-1,m,h*p+c*a.get(i,m)),a.set(i,m,h*a.get(i,m)-c*p);for(y=0;y<=i;y++)p=a.get(y,i-1),a.set(y,i-1,h*p+c*a.get(y,i)),a.set(y,i,h*a.get(y,i)-c*p);for(y=o;y<=s;y++)p=n.get(y,i-1),n.set(y,i-1,h*p+c*n.get(y,i)),n.set(y,i,h*n.get(y,i)-c*p)}else r[i-1]=S+c,r[i]=S+c,e[i-1]=p,e[i]=-p;i=i-2,g=0}else{if(S=a.get(i,i),A=0,_=0,w<i&&(A=a.get(i-1,i-1),_=a.get(i,i-1)*a.get(i-1,i)),g===10){for(f+=S,y=o;y<=i;y++)a.set(y,y,a.get(y,y)-S);v=Math.abs(a.get(i,i-1))+Math.abs(a.get(i-1,i-2)),S=A=.75*v,_=-.4375*v*v}if(g===30&&(v=(A-S)/2,v=v*v+_,v>0)){for(v=Math.sqrt(v),A<S&&(v=-v),v=S-_/((A-S)/2+v),y=o;y<=i;y++)a.set(y,y,a.get(y,y)-v);f+=v,S=A=_=.964}for(g=g+1,x=i-2;x>=w&&(p=a.get(x,x),d=S-p,v=A-p,c=(d*v-_)/a.get(x+1,x)+a.get(x,x+1),h=a.get(x+1,x+1)-p-d-v,d=a.get(x+2,x+1),v=Math.abs(c)+Math.abs(h)+Math.abs(d),c=c/v,h=h/v,d=d/v,!(x===w||Math.abs(a.get(x,x-1))*(Math.abs(h)+Math.abs(d))<u*(Math.abs(c)*(Math.abs(a.get(x-1,x-1))+Math.abs(p)+Math.abs(a.get(x+1,x+1))))));)x--;for(y=x+2;y<=i;y++)a.set(y,y-2,0),y>x+2&&a.set(y,y-3,0);for(b=x;b<=i-1&&(O=b!==i-1,b!==x&&(c=a.get(b,b-1),h=a.get(b+1,b-1),d=O?a.get(b+2,b-1):0,S=Math.abs(c)+Math.abs(h)+Math.abs(d),S!==0&&(c=c/S,h=h/S,d=d/S)),S!==0);b++)if(v=Math.sqrt(c*c+h*h+d*d),c<0&&(v=-v),v!==0){for(b!==x?a.set(b,b-1,-v*S):w!==x&&a.set(b,b-1,-a.get(b,b-1)),c=c+v,S=c/v,A=h/v,p=d/v,h=h/c,d=d/c,m=b;m<t;m++)c=a.get(b,m)+h*a.get(b+1,m),O&&(c=c+d*a.get(b+2,m),a.set(b+2,m,a.get(b+2,m)-c*p)),a.set(b,m,a.get(b,m)-c*S),a.set(b+1,m,a.get(b+1,m)-c*A);for(y=0;y<=Math.min(i,b+3);y++)c=S*a.get(y,b)+A*a.get(y,b+1),O&&(c=c+p*a.get(y,b+2),a.set(y,b+2,a.get(y,b+2)-c*d)),a.set(y,b,a.get(y,b)-c),a.set(y,b+1,a.get(y,b+1)-c*h);for(y=o;y<=s;y++)c=S*n.get(y,b)+A*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(i=t-1;i>=0;i--)if(c=r[i],h=e[i],h===0)for(w=i,a.set(i,i,1),y=i-1;y>=0;y--){for(_=a.get(y,y)-c,d=0,m=w;m<=i;m++)d=d+a.get(y,m)*a.get(m,i);if(e[y]<0)p=_,v=d;else if(w=y,e[y]===0?a.set(y,i,_!==0?-d/_:-d/(u*l)):(S=a.get(y,y+1),A=a.get(y+1,y),h=(r[y]-c)*(r[y]-c)+e[y]*e[y],E=(S*v-p*d)/h,a.set(y,i,E),a.set(y+1,i,Math.abs(S)>Math.abs(p)?(-d-_*E)/S:(-v-A*E)/p)),E=Math.abs(a.get(y,i)),u*E*E>1)for(m=y;m<=i;m++)a.set(m,i,a.get(m,i)/E)}else if(h<0)for(w=i-1,Math.abs(a.get(i,i-1))>Math.abs(a.get(i-1,i))?(a.set(i-1,i-1,h/a.get(i,i-1)),a.set(i-1,i,-(a.get(i,i)-c)/a.get(i,i-1))):(B=Gc(0,-a.get(i-1,i),a.get(i-1,i-1)-c,h),a.set(i-1,i-1,B[0]),a.set(i-1,i,B[1])),a.set(i,i-1,0),a.set(i,i,1),y=i-2;y>=0;y--){for(M=0,C=0,m=w;m<=i;m++)M=M+a.get(y,m)*a.get(m,i-1),C=C+a.get(y,m)*a.get(m,i);if(_=a.get(y,y)-c,e[y]<0)p=_,d=M,v=C;else if(w=y,e[y]===0?(B=Gc(-M,-C,_,h),a.set(y,i-1,B[0]),a.set(y,i,B[1])):(S=a.get(y,y+1),A=a.get(y+1,y),I=(r[y]-c)*(r[y]-c)+e[y]*e[y]-h*h,k=(r[y]-c)*2*h,I===0&&k===0&&(I=u*l*(Math.abs(_)+Math.abs(h)+Math.abs(S)+Math.abs(A)+Math.abs(p))),B=Gc(S*d-p*M+h*C,S*v-p*C-h*M,I,k),a.set(y,i-1,B[0]),a.set(y,i,B[1]),Math.abs(S)>Math.abs(p)+Math.abs(h)?(a.set(y+1,i-1,(-M-_*a.get(y,i-1)+h*a.get(y,i))/S),a.set(y+1,i,(-C-_*a.get(y,i)-h*a.get(y,i-1))/S)):(B=Gc(-d-A*a.get(y,i-1),-v-A*a.get(y,i),p,h),a.set(y+1,i-1,B[0]),a.set(y+1,i,B[1]))),E=Math.max(Math.abs(a.get(y,i-1)),Math.abs(a.get(y,i))),u*E*E>1)for(m=y;m<=i;m++)a.set(m,i-1,a.get(m,i-1)/E),a.set(m,i,a.get(m,i)/E)}for(y=0;y<t;y++)if(y<o||y>s)for(m=y;m<t;m++)n.set(y,m,a.get(y,m));for(m=t-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)*a.get(b,m);n.set(y,m,p)}}}function Gc(t,e,r,n){let a,i;return Math.abs(r)>Math.abs(n)?(a=n/r,i=r+a*n,[(t+a*e)/i,(e-a*t)/i]):(a=r/n,i=n+a*r,[(a*t+e)/i,(a*e-t)/i])}class u2{constructor(e){if(e=Wn.checkMatrix(e),!e.isSymmetric())throw new Error("Matrix is not symmetric");let r=e,n=r.rows,a=new lt(n,n),i=!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+=a.get(u,o)*a.get(s,o);l=(r.get(s,u)-l)/a.get(u,u),a.set(s,u,l),f=f+l*l}for(f=r.get(s,s)-f,i&=f>0,a.set(s,s,Math.sqrt(Math.max(f,0))),u=s+1;u<n;u++)a.set(s,u,0)}this.L=a,this.positiveDefinite=!!i}isPositiveDefinite(){return this.positiveDefinite}solve(e){e=Wn.checkMatrix(e);let r=this.L,n=r.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 a=e.columns,i=e.clone(),o,s,u;for(u=0;u<n;u++)for(s=0;s<a;s++){for(o=0;o<u;o++)i.set(u,s,i.get(u,s)-i.get(o,s)*r.get(u,o));i.set(u,s,i.get(u,s)/r.get(u,u))}for(u=n-1;u>=0;u--)for(s=0;s<a;s++){for(o=u+1;o<n;o++)i.set(u,s,i.get(u,s)-i.get(o,s)*r.get(o,u));i.set(u,s,i.get(u,s)/r.get(u,u))}return i}get lowerTriangularMatrix(){return this.L}}class f2{constructor(e,r={}){e=Wn.checkMatrix(e);let{Y:n}=r;const{scaleScores:a=!1,maxIterations:i=1e3,terminationCriteria:o=1e-10}=r;let s;if(n){if(Array.isArray(n)&&typeof n[0]=="number"?n=lt.columnVector(n):n=Wn.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<i&&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(),a?this.t=f.clone().div(this.s.get(0,0)):this.t=f,this.xResidual=e.sub(f.mmul(c.transpose()))}}const Jne=Object.freeze(Object.defineProperty({__proto__:null,AbstractMatrix:Xt,CHO:u2,CholeskyDecomposition:u2,EVD:s2,EigenvalueDecomposition:s2,LU:fd,LuDecomposition:fd,Matrix:lt,MatrixColumnSelectionView:Dne,MatrixColumnView:Lne,MatrixFlipColumnView:Pne,MatrixFlipRowView:Rne,MatrixRowSelectionView:Bne,MatrixRowView:Fne,MatrixSelectionView:bh,MatrixSubView:Gne,MatrixTransposeView:zne,NIPALS:f2,Nipals:f2,QR:zg,QrDecomposition:zg,SVD:cu,SingularValueDecomposition:cu,WrapperMatrix1D:kN,WrapperMatrix2D:Wn,correlation:qne,covariance:Yne,default:lt,determinant:wh,inverse:Une,linearDependencies:Wne,pseudoInverse:Vne,solve:NN,wrap:jne},Symbol.toStringTag,{value:"Module"})),ON=Ka(Jne);Object.defineProperty(Qm,"__esModule",{value:!0});var Qu=ON,eae=function(){function t(e){this.distances=e.distances,this.dimension=e.dimension||2,this.linkDistance=e.linkDistance}return t.prototype.layout=function(){var e=this,r=e.dimension,n=e.distances,a=e.linkDistance;try{var i=Qu.Matrix.mul(Qu.Matrix.pow(n,2),-.5),o=i.mean("row"),s=i.mean("column"),u=i.mean();i.add(u).subRowVector(o).subColumnVector(s);var f=new Qu.SingularValueDecomposition(i),l=Qu.Matrix.sqrt(f.diagonalMatrix).diagonal();return f.leftSingularVectors.toJSON().map(function(p){return Qu.Matrix.mul([p],[l]).toJSON()[0].splice(0,r)})}catch{for(var c=[],h=0;h<n.length;h++){var d=Math.random()*a,v=Math.random()*a;c.push([d,v])}return c}},t}();Qm.default=eae;var Jm={};Object.defineProperty(Jm,"__esModule",{value:!0});var tae=800,rae=function(){function t(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 t.prototype.layout=function(){var e=this,r=e.positions,n=[],a=e.iterations,i=e.width/10;e.maxDisplace=i,e.disp=n;for(var o=0;o<a;o++)r.forEach(function(s,u){n[u]={x:0,y:0}}),e.getRepulsion(),e.updatePositions();return r},t.prototype.getRepulsion=function(){var e=this,r=e.positions,n=e.nodes,a=e.disp,i=e.k,o=e.radii||[];r.forEach(function(s,u){a[u]={x:0,y:0},r.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=i*i/d;a[u].x+=c/d*p,a[u].y+=h/d*p}}})})},t.prototype.updatePositions=function(){var e=this,r=e.positions,n=e.disp,a=e.speed,i=e.strictRadial,o=e.focusID,s=e.maxDisplace||e.width/10;i&&n.forEach(function(f,l){var c=r[l][0]-r[o][0],h=r[l][1]-r[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;r.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*(a/tae),c);if(f[0]+=n[l].x/c*h,f[1]+=n[l].y/c*h,i){var d=f[0]-r[o][0],v=f[1]-r[o][1],p=Math.sqrt(d*d+v*v);d=d/p*u[l],v=v/p*u[l],f[0]=r[o][0]+d,f[1]=r[o][1]+v}}}})},t}();Jm.default=rae;var nae=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),LN=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lv,"__esModule",{value:!0});lv.RadialLayout=void 0;var Zn=Ir(),aae=Rr,iae=LN(Qm),oae=LN(Jm);function sae(t){for(var e=t.length,r=t[0].length,n=[],a=0;a<e;a++){for(var i=[],o=0;o<r;o++)t[a][o]!==0?i.push(1/(t[a][o]*t[a][o])):i.push(0);n.push(i)}return n}function uae(t,e){var r=-1;return t.forEach(function(n,a){n.id===e&&(r=a)}),r}function l2(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var fae=function(t){nae(e,t);function e(r){var n=t.call(this)||this;return n.maxIteration=1e3,n.focusNode=null,n.unitRadius=null,n.linkDistance=50,n.preventOverlap=!1,n.strictRadial=!0,n.maxPreventOverlapIteration=200,n.sortStrength=10,n.nodes=[],n.edges=[],n.updateCfg(r),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 r=this,n=r.nodes,a=r.edges||[];if(!n||n.length===0){r.onLayoutEnd&&r.onLayoutEnd();return}!r.width&&typeof window<"u"&&(r.width=window.innerWidth),!r.height&&typeof window<"u"&&(r.height=window.innerHeight),r.center||(r.center=[r.width/2,r.height/2]);var i=r.center;if(n.length===1){n[0].x=i[0],n[0].y=i[1],r.onLayoutEnd&&r.onLayoutEnd();return}var o=r.linkDistance,s=null;if((0,Zn.isString)(r.focusNode)){for(var u=!1,f=0;f<n.length;f++)n[f].id===r.focusNode&&(s=n[f],r.focusNode=s,u=!0,f=n.length);u||(s=null)}else s=r.focusNode;s||(s=n[0],r.focusNode=s);var l=uae(n,s.id);l<0&&(l=0),r.focusIndex=l;var c=(0,Zn.getAdjMatrix)({nodes:n,edges:a},!1),h=(0,Zn.floydWarshall)(c),d=r.maxToFocus(h,l);r.handleInfinity(h,l,d+1),r.distances=h;var v=h[l],p=r.width||500,g=r.height||500,y=p-i[0]>i[0]?i[0]:p-i[0],m=g-i[1]>i[1]?i[1]:g-i[1];y===0&&(y=p/2),m===0&&(m=g/2);var b=m>y?y:m,w=Math.max.apply(Math,v),x=[];v.forEach(function(X,R){r.unitRadius||(r.unitRadius=b/w),x[R]=X*r.unitRadius}),r.radii=x;var E=r.eIdealDisMatrix();r.eIdealDistances=E;var _=sae(E);r.weights=_;var S=new iae.default({linkDistance:o,distances:E}),A=S.layout();A.forEach(function(X){(0,Zn.isNaN)(X[0])&&(X[0]=Math.random()*o),(0,Zn.isNaN)(X[1])&&(X[1]=Math.random()*o)}),r.positions=A,A.forEach(function(X,R){n[R].x=X[0]+i[0],n[R].y=X[1]+i[1]}),A.forEach(function(X){X[0]-=A[l][0],X[1]-=A[l][1]}),r.run();var M=r.preventOverlap,C=r.nodeSize,I,k=r.strictRadial;if(M){var O=r.nodeSpacing,B;(0,Zn.isNumber)(O)?B=function(){return O}:(0,Zn.isFunction)(O)?B=O:B=function(){return 0},C?(0,Zn.isArray)(C)?I=function(X){var R=C[0]>C[1]?C[0]:C[1];return R+B(X)}:I=function(X){return C+B(X)}:I=function(X){if(X.size){if((0,Zn.isArray)(X.size)){var R=X.size[0]>X.size[1]?X.size[0]:X.size[1];return R+B(X)}if((0,Zn.isObject)(X.size)){var R=X.size.width>X.size.height?X.size.width:X.size.height;return R+B(X)}return X.size+B(X)}return 10+B(X)};var L={nodes:n,nodeSizeFunc:I,adjMatrix:c,positions:A,radii:x,height:g,width:p,strictRadial:k,focusID:l,iterations:r.maxPreventOverlapIteration||200,k:A.length/4.5},z=new oae.default(L);A=z.layout()}return A.forEach(function(X,R){n[R].x=X[0]+i[0],n[R].y=X[1]+i[1]}),r.onLayoutEnd&&r.onLayoutEnd(),{nodes:n,edges:a}},e.prototype.run=function(){for(var r=this,n=r.maxIteration,a=r.positions||[],i=r.weights||[],o=r.eIdealDistances||[],s=r.radii||[],u=0;u<=n;u++){var f=u/n;r.oneIteration(f,a,s,o,i)}},e.prototype.oneIteration=function(r,n,a,i,o){var s=this,u=1-r,f=s.focusIndex;n.forEach(function(l,c){var h=l2(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 w=l2(l,m),x=w===0?0:1/w,E=i[b][c];g+=o[c][b],v+=o[c][b]*(m[0]+E*(l[0]-m[0])*x),p+=o[c][b]*(m[1]+E*(l[1]-m[1])*x)}});var y=a[c]===0?0:1/a[c];g*=u,g+=r*y*y,v*=u,v+=r*y*l[0]*d,l[0]=v/g,p*=u,p+=r*y*l[1]*d,l[1]=p/g}})},e.prototype.eIdealDisMatrix=function(){var r=this,n=r.nodes;if(!n)return[];var a=r.distances,i=r.linkDistance,o=r.radii||[],s=r.unitRadius||50,u=[];return a&&a.forEach(function(f,l){var c=[];f.forEach(function(h,d){if(l===d)c.push(0);else if(o[l]===o[d])if(r.sortBy==="data")c.push(h*(Math.abs(l-d)*r.sortStrength)/(o[l]/s));else if(r.sortBy){var v=n[l][r.sortBy]||0,p=n[d][r.sortBy]||0;(0,Zn.isString)(v)&&(v=v.charCodeAt(0)),(0,Zn.isString)(p)&&(p=p.charCodeAt(0)),c.push(h*(Math.abs(v-p)*r.sortStrength)/(o[l]/s))}else c.push(h*i/(o[l]/s));else{var g=(i+s)/2;c.push(h*g)}}),u.push(c)}),u},e.prototype.handleInfinity=function(r,n,a){for(var i=r.length,o=0;o<i;o++)if(r[n][o]===1/0){r[n][o]=a,r[o][n]=a;for(var s=0;s<i;s++)r[o][s]!==1/0&&r[n][s]===1/0&&(r[n][s]=a+r[o][s],r[s][n]=a+r[o][s])}for(var o=0;o<i;o++)if(o!==n){for(var s=0;s<i;s++)if(r[o][s]===1/0){var u=Math.abs(r[n][o]-r[n][s]);u=u===0?1:u,r[o][s]=u}}},e.prototype.maxToFocus=function(r,n){for(var a=0,i=0;i<r[n].length;i++)r[n][i]!==1/0&&(a=r[n][i]>a?r[n][i]:a);return a},e.prototype.getType=function(){return"radial"},e}(aae.Base);lv.RadialLayout=fae;(function(t){var e=me&&me.__createBinding||(Object.create?function(n,a,i,o){o===void 0&&(o=i);var s=Object.getOwnPropertyDescriptor(a,i);(!s||("get"in s?!a.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(n,o,s)}:function(n,a,i,o){o===void 0&&(o=i),n[o]=a[i]}),r=me&&me.__exportStar||function(n,a){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&e(a,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(lv,t)})(Km);var bl={},lae=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(bl,"__esModule",{value:!0});bl.ConcentricLayout=void 0;var Na=Ir(),cae=Rr,hae=function(t){lae(e,t);function e(r){var n=t.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(r),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 r,n,a=this,i=a.nodes,o=a.edges,s=i.length;if(s===0){(r=a.onLayoutEnd)===null||r===void 0||r.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 u=a.center;if(s===1){i[0].x=u[0],i[0].y=u[1],(n=a.onLayoutEnd)===null||n===void 0||n.call(a);return}var f=a.nodeSize,l=a.nodeSpacing,c=[],h,d=0;(0,Na.isArray)(f)?h=Math.max(f[0],f[1]):h=f,(0,Na.isArray)(l)?d=Math.max(l[0],l[1]):(0,Na.isNumber)(l)&&(d=l),i.forEach(function(k){c.push(k);var O=h;(0,Na.isArray)(k.size)?O=Math.max(k.size[0],k.size[1]):(0,Na.isNumber)(k.size)?O=k.size:(0,Na.isObject)(k.size)&&(O=Math.max(k.size.width,k.size.height)),h=Math.max(h,O),(0,Na.isFunction)(l)&&(d=Math.max(l(k),d))}),a.clockwise=a.counterclockwise!==void 0?!a.counterclockwise:a.clockwise;var v={},p={};if(c.forEach(function(k,O){v[k.id]=k,p[k.id]=O}),(a.sortBy==="degree"||!(0,Na.isString)(a.sortBy)||c[0][a.sortBy]===void 0)&&(a.sortBy="degree",!(0,Na.isNumber)(i[0].degree))){var g=(0,Na.getDegree)(i.length,p,o);c.forEach(function(k,O){k.degree=g[O].all})}c.sort(function(k,O){return O[a.sortBy]-k[a.sortBy]}),a.maxValueNode=c[0],a.maxLevelDiff=a.maxLevelDiff||a.maxValueNode[a.sortBy]/4;var y=[[]],m=y[0];c.forEach(function(k){if(m.length>0){var O=Math.abs(m[0][a.sortBy]-k[a.sortBy]);a.maxLevelDiff&&O>=a.maxLevelDiff&&(m=[],y.push(m))}m.push(k)});var b=h+(d||a.minNodeSpacing);if(!a.preventOverlap){var w=y.length>0&&y[0].length>1,x=Math.min(a.width,a.height)/2-b,E=x/(y.length+(w?1:0));b=Math.min(b,E)}var _=0;if(y.forEach(function(k){var O=a.sweep;O===void 0&&(O=2*Math.PI-2*Math.PI/k.length);var B=k.dTheta=O/Math.max(1,k.length-1);if(k.length>1&&a.preventOverlap){var L=Math.cos(B)-Math.cos(0),z=Math.sin(B)-Math.sin(0),X=Math.sqrt(b*b/(L*L+z*z));_=Math.max(X,_)}k.r=_,_+=b}),a.equidistant){for(var S=0,A=0,M=0;M<y.length;M++){var C=y[M],I=C.r-A;S=Math.max(S,I)}A=0,y.forEach(function(k,O){O===0&&(A=k.r),k.r=A,A+=S})}return y.forEach(function(k){var O=k.dTheta,B=k.r;k.forEach(function(L,z){var X=a.startAngle+(a.clockwise?1:-1)*O*z;L.x=u[0]+B*Math.cos(X),L.y=u[1]+B*Math.sin(X)})}),a.onLayoutEnd&&a.onLayoutEnd(),{nodes:i,edges:o}},e.prototype.getType=function(){return"concentric"},e}(cae.Base);bl.ConcentricLayout=hae;var wl={},dae=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(wl,"__esModule",{value:!0});wl.MDSLayout=void 0;var Ju=ON,l0=Ir(),vae=Rr,pae=function(t){dae(e,t);function e(r){var n=t.call(this)||this;return n.center=[0,0],n.linkDistance=50,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(r),n}return e.prototype.getDefaultCfg=function(){return{center:[0,0],linkDistance:50}},e.prototype.execute=function(){var r=this,n=r.nodes,a=r.edges,i=a===void 0?[]:a,o=r.center;if(!n||n.length===0){r.onLayoutEnd&&r.onLayoutEnd();return}if(n.length===1){n[0].x=o[0],n[0].y=o[1],r.onLayoutEnd&&r.onLayoutEnd();return}var s=r.linkDistance,u=(0,l0.getAdjMatrix)({nodes:n,edges:i},!1),f=(0,l0.floydWarshall)(u);r.handleInfinity(f);var l=(0,l0.scaleMatrix)(f,s);r.scaledDistances=l;var c=r.runMDS();return r.positions=c,c.forEach(function(h,d){n[d].x=h[0]+o[0],n[d].y=h[1]+o[1]}),r.onLayoutEnd&&r.onLayoutEnd(),{nodes:n,edges:i}},e.prototype.runMDS=function(){var r=this,n=2,a=r.scaledDistances,i=Ju.Matrix.mul(Ju.Matrix.pow(a,2),-.5),o=i.mean("row"),s=i.mean("column"),u=i.mean();i.add(u).subRowVector(o).subColumnVector(s);var f=new Ju.SingularValueDecomposition(i),l=Ju.Matrix.sqrt(f.diagonalMatrix).diagonal();return f.leftSingularVectors.toJSON().map(function(c){return Ju.Matrix.mul([c],[l]).toJSON()[0].splice(0,n)})},e.prototype.handleInfinity=function(r){var n=-999999;r.forEach(function(a){a.forEach(function(i){i!==1/0&&n<i&&(n=i)})}),r.forEach(function(a,i){a.forEach(function(o,s){o===1/0&&(r[i][s]=n)})})},e.prototype.getType=function(){return"mds"},e}(vae.Base);wl.MDSLayout=pae;var xl={},gae=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(xl,"__esModule",{value:!0});xl.FruchtermanLayout=void 0;var yae=Rr,Dr=Ir(),mae=800,bae=function(t){gae(e,t);function e(r){var n=t.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(r),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10,animate:!0}},e.prototype.execute=function(){var r=this,n,a,i=this,o=i.nodes;if(i.timeInterval!==void 0&&typeof window<"u"&&window.clearInterval(i.timeInterval),!o||o.length===0){(n=i.onLayoutEnd)===null||n===void 0||n.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 s=i.center;if(o.length===1){o[0].x=s[0],o[0].y=s[1],(a=i.onLayoutEnd)===null||a===void 0||a.call(i);return}var u={},f={};return o.forEach(function(l,c){(0,Dr.isNumber)(l.x)||(l.x=Math.random()*r.width),(0,Dr.isNumber)(l.y)||(l.y=Math.random()*r.height),u[l.id]=l,f[l.id]=c}),i.nodeMap=u,i.nodeIdxMap=f,i.run()},e.prototype.run=function(){var r,n=this,a=n.nodes;if(a){var i=n.edges,o=n.maxIteration,s=n.workerEnabled,u=n.clustering,f=n.animate,l={};if(u&&a.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);(r=n.onLayoutEnd)===null||r===void 0||r.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:a,edges:i}}},e.prototype.runOneStep=function(r){var n,a=this,i=a.nodes;if(i){var o=a.edges,s=a.center,u=a.gravity,f=a.speed,l=a.clustering,c=a.height*a.width,h=Math.sqrt(c)/10,d=c/(i.length+1),v=Math.sqrt(d),p=[];if(i.forEach(function(m,b){p[b]={x:0,y:0}}),a.applyCalculate(i,o,p,v,d),l){for(var g in r)r[g].cx=0,r[g].cy=0,r[g].count=0;i.forEach(function(m){var b=r[m.cluster];(0,Dr.isNumber)(m.x)&&(b.cx+=m.x),(0,Dr.isNumber)(m.y)&&(b.cy+=m.y),b.count++});for(var g in r)r[g].cx/=r[g].count,r[g].cy/=r[g].count;var y=a.clusterGravity||u;i.forEach(function(m,b){if(!(!(0,Dr.isNumber)(m.x)||!(0,Dr.isNumber)(m.y))){var w=r[m.cluster],x=Math.sqrt((m.x-w.cx)*(m.x-w.cx)+(m.y-w.cy)*(m.y-w.cy)),E=v*y;p[b].x-=E*(m.x-w.cx)/x,p[b].y-=E*(m.y-w.cy)/x}})}i.forEach(function(m,b){if(!(!(0,Dr.isNumber)(m.x)||!(0,Dr.isNumber)(m.y))){var w=.01*v*u;p[b].x-=w*(m.x-s[0]),p[b].y-=w*(m.y-s[1])}}),i.forEach(function(m,b){if((0,Dr.isNumber)(m.fx)&&(0,Dr.isNumber)(m.fy)){m.x=m.fx,m.y=m.fy;return}if(!(!(0,Dr.isNumber)(m.x)||!(0,Dr.isNumber)(m.y))){var w=Math.sqrt(p[b].x*p[b].x+p[b].y*p[b].y);if(w>0){var x=Math.min(h*(f/mae),w);m.x+=p[b].x/w*x,m.y+=p[b].y/w*x}}}),(n=a.tick)===null||n===void 0||n.call(a)}},e.prototype.applyCalculate=function(r,n,a,i,o){var s=this;s.calRepulsive(r,a,o),n&&s.calAttractive(n,a,i)},e.prototype.calRepulsive=function(r,n,a){r.forEach(function(i,o){n[o]={x:0,y:0},r.forEach(function(s,u){if(o!==u&&!(!(0,Dr.isNumber)(i.x)||!(0,Dr.isNumber)(s.x)||!(0,Dr.isNumber)(i.y)||!(0,Dr.isNumber)(s.y))){var f=i.x-s.x,l=i.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=a/c;n[o].x+=f*d,n[o].y+=l*d}})})},e.prototype.calAttractive=function(r,n,a){var i=this;r.forEach(function(o){var s=(0,Dr.getEdgeTerminal)(o,"source"),u=(0,Dr.getEdgeTerminal)(o,"target");if(!(!s||!u)){var f=i.nodeIdxMap[s],l=i.nodeIdxMap[u];if(f!==l){var c=i.nodeMap[s],h=i.nodeMap[u];if(!(!(0,Dr.isNumber)(h.x)||!(0,Dr.isNumber)(c.x)||!(0,Dr.isNumber)(h.y)||!(0,Dr.isNumber)(c.y))){var d=h.x-c.x,v=h.y-c.y,p=Math.sqrt(d*d+v*v),g=p*p/a;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 r=this;r.stop(),r.tick=null,r.nodes=null,r.edges=null,r.destroyed=!0},e.prototype.getType=function(){return"fruchterman"},e}(yae.Base);xl.FruchtermanLayout=bae;var El={};function c2(t,e,r,n,a,i,o){try{var s=t[i](o),u=s.value}catch(f){return void r(f)}s.done?e(u):Promise.resolve(u).then(n,a)}function Xi(t){return function(){var e=this,r=arguments;return new Promise(function(n,a){var i=t.apply(e,r);function o(u){c2(i,n,a,o,s,"next",u)}function s(u){c2(i,n,a,o,s,"throw",u)}o(void 0)})}}function hu(t){"@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(t)}function wae(t,e){if(hu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(hu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function DN(t){var e=wae(t,"string");return hu(e)=="symbol"?e:e+""}function Ke(t,e,r){return(e=DN(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ma(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h2(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,DN(n.key),n)}}function Aa(t,e,r){return e&&h2(t.prototype,e),r&&h2(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var xae=typeof me=="object"&&me&&me.Object===Object&&me,PN=xae,Eae=PN,_ae=typeof self=="object"&&self&&self.Object===Object&&self,Sae=Eae||_ae||Function("return this")(),Mae=Sae,Aae=Mae,Cae=Aae.Symbol,RN=Cae,d2=RN,FN=Object.prototype,Tae=FN.hasOwnProperty,Iae=FN.toString,ef=d2?d2.toStringTag:void 0;function kae(t){var e=Tae.call(t,ef),r=t[ef];try{t[ef]=void 0;var n=!0}catch{}var a=Iae.call(t);return n&&(e?t[ef]=r:delete t[ef]),a}var Nae=kae,Oae=Object.prototype,Lae=Oae.toString;function Dae(t){return Lae.call(t)}var Pae=Dae,v2=RN,Rae=Nae,Fae=Pae,Bae="[object Null]",Gae="[object Undefined]",p2=v2?v2.toStringTag:void 0;function zae(t){return t==null?t===void 0?Gae:Bae:p2&&p2 in Object(t)?Rae(t):Fae(t)}var e1=zae,jae=9007199254740991;function Uae(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=jae}var $ae=Uae;function Xae(t){return t!=null&&typeof t=="object"}var t1=Xae,Wae=e1,Vae=$ae,Yae=t1,qae="[object Arguments]",Hae="[object Array]",Zae="[object Boolean]",Kae="[object Date]",Qae="[object Error]",Jae="[object Function]",eie="[object Map]",tie="[object Number]",rie="[object Object]",nie="[object RegExp]",aie="[object Set]",iie="[object String]",oie="[object WeakMap]",sie="[object ArrayBuffer]",uie="[object DataView]",fie="[object Float32Array]",lie="[object Float64Array]",cie="[object Int8Array]",hie="[object Int16Array]",die="[object Int32Array]",vie="[object Uint8Array]",pie="[object Uint8ClampedArray]",gie="[object Uint16Array]",yie="[object Uint32Array]",wr={};wr[fie]=wr[lie]=wr[cie]=wr[hie]=wr[die]=wr[vie]=wr[pie]=wr[gie]=wr[yie]=!0;wr[qae]=wr[Hae]=wr[sie]=wr[Zae]=wr[uie]=wr[Kae]=wr[Qae]=wr[Jae]=wr[eie]=wr[tie]=wr[rie]=wr[nie]=wr[aie]=wr[iie]=wr[oie]=!1;function mie(t){return Yae(t)&&Vae(t.length)&&!!wr[Wae(t)]}var bie=mie;function wie(t){return function(e){return t(e)}}var xie=wie,ld={exports:{}};ld.exports;(function(t,e){var r=PN,n=e&&!e.nodeType&&e,a=n&&!0&&t&&!t.nodeType&&t,i=a&&a.exports===n,o=i&&r.process,s=function(){try{var u=a&&a.require&&a.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}}();t.exports=s})(ld,ld.exports);var Eie=ld.exports,_ie=bie,Sie=xie,g2=Eie,y2=g2&&g2.isTypedArray,Mie=y2?Sie(y2):_ie,Aie=Mie;const cd=bi(Aie);var Cie=e1,Tie=t1,Iie="[object Number]";function kie(t){return typeof t=="number"||Tie(t)&&Cie(t)==Iie}var Nie=kie;const Oie=bi(Nie);var Lie=Array.isArray,Die=Lie;const Pie=bi(Die);var BN={exports:{}},GN={exports:{}};(function(t){function e(r,n){this.v=r,this.k=n}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})(GN);var zN=GN.exports,jN={exports:{}},UN={exports:{}};(function(t){function e(r,n,a,i){var o=Object.defineProperty;try{o({},"",{})}catch{o=0}t.exports=e=function(u,f,l,c){function h(d,v){e(u,d,function(p){return this._invoke(d,v,p)})}f?o?o(u,f,{value:l,enumerable:!c,configurable:!c,writable:!c}):u[f]=l:(h("next",0),h("throw",1),h("return",2))},t.exports.__esModule=!0,t.exports.default=t.exports,e(r,n,a,i)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})(UN);var $N=UN.exports;(function(t){var e=$N;function r(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var n,a,i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function u(g,y,m,b){var w=y&&y.prototype instanceof l?y:l,x=Object.create(w.prototype);return e(x,"_invoke",function(E,_,S){var A,M,C,I=0,k=S||[],O=!1,B={p:0,n:0,v:n,a:L,f:L.bind(n,4),d:function(X,R){return A=X,M=0,C=n,B.n=R,f}};function L(z,X){for(M=z,C=X,a=0;!O&&I&&!R&&a<k.length;a++){var R,V=k[a],he=B.p,ce=V[2];z>3?(R=ce===X)&&(C=V[(M=V[4])?5:(M=3,3)],V[4]=V[5]=n):V[0]<=he&&((R=z<2&&he<V[1])?(M=0,B.v=X,B.n=V[1]):he<ce&&(R=z<3||V[0]>X||X>ce)&&(V[4]=z,V[5]=X,B.n=ce,M=0))}if(R||z>1)return f;throw O=!0,X}return function(z,X,R){if(I>1)throw TypeError("Generator is already running");for(O&&X===1&&L(X,R),M=X,C=R;(a=M<2?n:C)||!O;){A||(M?M<3?(M>1&&(B.n=-1),L(M,C)):B.n=C:B.v=C);try{if(I=2,A){if(M||(z="next"),a=A[z]){if(!(a=a.call(A,C)))throw TypeError("iterator result is not an object");if(!a.done)return a;C=a.value,M<2&&(M=0)}else M===1&&(a=A.return)&&a.call(A),M<2&&(C=TypeError("The iterator does not provide a '"+z+"' method"),M=1);A=n}else if((a=(O=B.n<0)?C:E.call(_,B))!==f)break}catch(V){A=n,M=1,C=V}finally{I=1}}return{value:a,done:O}}}(g,m,b),!0),x}var f={};function l(){}function c(){}function h(){}a=Object.getPrototypeOf;var d=[][o]?a(a([][o]())):(e(a={},o,function(){return this}),a),v=h.prototype=l.prototype=Object.create(d);function p(g){return Object.setPrototypeOf?Object.setPrototypeOf(g,h):(g.__proto__=h,e(g,s,"GeneratorFunction")),g.prototype=Object.create(v),g}return c.prototype=h,e(v,"constructor",h),e(h,"constructor",c),c.displayName="GeneratorFunction",e(h,s,"GeneratorFunction"),e(v),e(v,s,"Generator"),e(v,o,function(){return this}),e(v,"toString",function(){return"[object Generator]"}),(t.exports=r=function(){return{w:u,m:p}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})(jN);var XN=jN.exports,WN={exports:{}},VN={exports:{}},YN={exports:{}};(function(t){var e=zN,r=$N;function n(a,i){function o(u,f,l,c){try{var h=a[u](f),d=h.value;return d instanceof e?i.resolve(d.v).then(function(v){o("next",v,l,c)},function(v){o("throw",v,l,c)}):i.resolve(d).then(function(v){h.value=v,l(h)},function(v){return o("throw",v,l,c)})}catch(v){c(v)}}var s;this.next||(r(n.prototype),r(n.prototype,typeof Symbol=="function"&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),r(this,"_invoke",function(u,f,l){function c(){return new i(function(h,d){o(u,l,h,d)})}return s=s?s.then(c,c):c()},!0)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})(YN);var qN=YN.exports;(function(t){var e=XN,r=qN;function n(a,i,o,s,u){return new r(e().w(a,i,o,s),u||Promise)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})(VN);var HN=VN.exports;(function(t){var e=HN;function r(n,a,i,o,s){var u=e(n,a,i,o,s);return u.next().then(function(f){return f.done?f.value:u.next()})}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})(WN);var Rie=WN.exports,ZN={exports:{}};(function(t){function e(r){var n=Object(r),a=[];for(var i in n)a.unshift(i);return function o(){for(;a.length;)if((i=a.pop())in n)return o.value=i,o.done=!1,o;return o.done=!0,o}}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})(ZN);var Fie=ZN.exports,KN={exports:{}},QN={exports:{}};(function(t){function e(r){"@babel/helpers - typeof";return t.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},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})(QN);var Bie=QN.exports;(function(t){var e=Bie.default;function r(n){if(n!=null){var a=n[typeof Symbol=="function"&&Symbol.iterator||"@@iterator"],i=0;if(a)return a.call(n);if(typeof n.next=="function")return n;if(!isNaN(n.length))return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}}}throw new TypeError(e(n)+" is not iterable")}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})(KN);var Gie=KN.exports;(function(t){var e=zN,r=XN,n=Rie,a=HN,i=qN,o=Fie,s=Gie;function u(){var f=r(),l=f.m(u),c=(Object.getPrototypeOf?Object.getPrototypeOf(l):l.__proto__).constructor;function h(p){var g=typeof p=="function"&&p.constructor;return!!g&&(g===c||(g.displayName||g.name)==="GeneratorFunction")}var d={throw:1,return:2,break:3,continue:3};function v(p){var g,y;return function(m){g||(g={stop:function(){return y(m.a,2)},catch:function(){return m.v},abrupt:function(w,x){return y(m.a,d[w],x)},delegateYield:function(w,x,E){return g.resultName=x,y(m.d,s(w),E)},finish:function(w){return y(m.f,w)}},y=function(w,x,E){m.p=g.prev,m.n=g.next;try{return w(x,E)}finally{g.next=m.n}}),g.resultName&&(g[g.resultName]=m.v,g.resultName=void 0),g.sent=m.v,g.next=m.n;try{return p.call(this,g)}finally{m.p=g.prev,m.n=g.next}}}return(t.exports=u=function(){return{wrap:function(y,m,b,w){return f.w(v(y),m,b,w&&w.reverse())},isGeneratorFunction:h,mark:f.m,awrap:function(y,m){return new e(y,m)},AsyncIterator:i,async:function(y,m,b,w,x){return(h(m)?a:n)(v(y),m,b,w,x)},keys:o,values:s}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=u,t.exports.__esModule=!0,t.exports.default=t.exports})(BN);var zie=BN.exports,xh=zie(),jie=xh;try{regeneratorRuntime=xh}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=xh:Function("r","regeneratorRuntime = r")(xh)}const mn=bi(jie);var Uie=1;function JN(){return Uie++}var ke;(function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.MAX_EXT=32776]="MAX_EXT",t[t.MIN_EXT=32775]="MIN_EXT",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.CULL_FACE=2884]="CULL_FACE",t[t.BLEND=3042]="BLEND",t[t.DITHER=3024]="DITHER",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.TEXTURE1=33985]="TEXTURE1",t[t.TEXTURE2=33986]="TEXTURE2",t[t.TEXTURE3=33987]="TEXTURE3",t[t.TEXTURE4=33988]="TEXTURE4",t[t.TEXTURE5=33989]="TEXTURE5",t[t.TEXTURE6=33990]="TEXTURE6",t[t.TEXTURE7=33991]="TEXTURE7",t[t.TEXTURE8=33992]="TEXTURE8",t[t.TEXTURE9=33993]="TEXTURE9",t[t.TEXTURE10=33994]="TEXTURE10",t[t.TEXTURE11=33995]="TEXTURE11",t[t.TEXTURE12=33996]="TEXTURE12",t[t.TEXTURE13=33997]="TEXTURE13",t[t.TEXTURE14=33998]="TEXTURE14",t[t.TEXTURE15=33999]="TEXTURE15",t[t.TEXTURE16=34e3]="TEXTURE16",t[t.TEXTURE17=34001]="TEXTURE17",t[t.TEXTURE18=34002]="TEXTURE18",t[t.TEXTURE19=34003]="TEXTURE19",t[t.TEXTURE20=34004]="TEXTURE20",t[t.TEXTURE21=34005]="TEXTURE21",t[t.TEXTURE22=34006]="TEXTURE22",t[t.TEXTURE23=34007]="TEXTURE23",t[t.TEXTURE24=34008]="TEXTURE24",t[t.TEXTURE25=34009]="TEXTURE25",t[t.TEXTURE26=34010]="TEXTURE26",t[t.TEXTURE27=34011]="TEXTURE27",t[t.TEXTURE28=34012]="TEXTURE28",t[t.TEXTURE29=34013]="TEXTURE29",t[t.TEXTURE30=34014]="TEXTURE30",t[t.TEXTURE31=34015]="TEXTURE31",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.COPY_SRC=1]="COPY_SRC",t[t.COPY_DST=2]="COPY_DST",t[t.SAMPLED=4]="SAMPLED",t[t.STORAGE=8]="STORAGE",t[t.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"})(ke||(ke={}));var $ie=function(){function t(){Ma(this,t),this.config=void 0}return Aa(t,[{key:"get",value:function(){return this.config}},{key:"set",value:function(r){this.config=r}}]),t}(),Zf;(function(t){t.Void="Void",t.Boolean="Boolean",t.Float="Float",t.Uint32="Uint32",t.Int32="Int32",t.Vector="Vector",t.Vector2Float="vec2<f32>",t.Vector3Float="vec3<f32>",t.Vector4Float="vec4<f32>",t.Vector2Boolean="vec2<bool>",t.Vector3Boolean="vec3<bool>",t.Vector4Boolean="vec4<bool>",t.Vector2Uint="vec2<u32>",t.Vector3Uint="vec3<u32>",t.Vector4Uint="vec4<u32>",t.Vector2Int="vec2<i32>",t.Vector3Int="vec3<i32>",t.Vector4Int="vec4<i32>",t.Matrix="Matrix",t.Matrix3x3Float="mat3x3<f32>",t.Matrix4x4Float="mat4x4<i32>",t.Struct="Struct",t.FloatArray="Float[]",t.Vector4FloatArray="vec4<f32>[]"})(Zf||(Zf={}));var m2;(function(t){t.Program="Program",t.Identifier="Identifier",t.VariableDeclaration="VariableDeclaration",t.BlockStatement="BlockStatement",t.ReturnStatement="ReturnStatement",t.FunctionDeclaration="FunctionDeclaration",t.VariableDeclarator="VariableDeclarator",t.AssignmentExpression="AssignmentExpression",t.LogicalExpression="LogicalExpression",t.BinaryExpression="BinaryExpression",t.ArrayExpression="ArrayExpression",t.UnaryExpression="UnaryExpression",t.UpdateExpression="UpdateExpression",t.FunctionExpression="FunctionExpression",t.MemberExpression="MemberExpression",t.ConditionalExpression="ConditionalExpression",t.ExpressionStatement="ExpressionStatement",t.CallExpression="CallExpression",t.NumThreadStatement="NumThreadStatement",t.StorageStatement="StorageStatement",t.DoWhileStatement="DoWhileStatement",t.WhileStatement="WhileStatement",t.ForStatement="ForStatement",t.BreakStatement="BreakStatement",t.ContinueStatement="ContinueStatement",t.IfStatement="IfStatement",t.ImportedFunctionStatement="ImportedFunctionStatement"})(m2||(m2={}));var du;(function(t){t.Input="Input",t.Output="Output",t.Uniform="Uniform",t.Workgroup="Workgroup",t.UniformConstant="UniformConstant",t.Image="Image",t.StorageBuffer="StorageBuffer",t.Private="Private",t.Function="Function"})(du||(du={}));var Tf;(function(t){t.GLSL100="GLSL100",t.GLSL450="GLSL450",t.WGSL="WGSL"})(Tf||(Tf={}));var Xie="__DefineValuePlaceholder__";function Wie(){if(typeof document<"u")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function b2(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function w2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?b2(Object(r),!0).forEach(function(n){Ke(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var eO=function(){function t(e,r){Ma(this,t),this.engine=e,this.configService=r,this.model=void 0,this.dirty=!0,this.compiledBundle=void 0,this.initPromise=void 0}return Aa(t,[{key:"init",value:function(){var r=this.configService.get(),n=r.canvas,a=r.engineOptions;this.initPromise=this.engine.init(w2({canvas:n||Wie(),antialiasing:!1},a))}},{key:"setBundle",value:function(r){this.compiledBundle=JSON.parse(JSON.stringify(r))}},{key:"setDispatch",value:function(r){return this.compiledBundle.context&&(this.compiledBundle.context.dispatch=r),this}},{key:"setMaxIteration",value:function(r){return this.compiledBundle.context&&(this.compiledBundle.context.maxIteration=r),this}},{key:"setBinding",value:function(r,n){var a=this;if(typeof r=="string"){var i=Oie(n)||cd(n)||Pie(n);if(this.compiledBundle&&this.compiledBundle.context){var o=this.compiledBundle.context.defines.find(function(u){return u.name===r});if(o)return o.value=n,this;var s=this.compiledBundle.context.uniforms.find(function(u){return u.name===r});s&&(i?(s.data=n,s.isReferer=!1,s.storageClass===du.Uniform?this.model&&this.model.updateUniform(r,n):this.model&&this.model.updateBuffer(r,n)):(s.isReferer=!0,s.data=n))}}else Object.keys(r).forEach(function(u){a.setBinding(u,r[u])});return this}},{key:"execute",value:function(){var e=Xi(mn.mark(function n(){var a=this,i,o,s=arguments;return mn.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(i=s.length>0&&s[0]!==void 0?s[0]:1,!this.dirty){f.next=6;break}return this.compiledBundle.context&&(i>1?this.compiledBundle.context.maxIteration=i: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;a.model.confirmInput(c.model,h)}),o=0;o<i;o++)this.model.run();return this.engine.endFrame(),f.abrupt("return",this);case 12:case"end":return f.stop()}},n,this)}));function r(){return e.apply(this,arguments)}return r}()},{key:"getOutput",value:function(){var e=Xi(mn.mark(function n(){return mn.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",this.model.readData());case 1:case"end":return i.stop()}},n,this)}));function r(){return e.apply(this,arguments)}return r}()},{key:"compile",value:function(){var e=Xi(mn.mark(function n(){var a,i,o;return mn.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.initPromise;case 2:return a=w2({},this.compiledBundle.context),i=this.engine.supportWebGPU?this.engine.useWGSL?Tf.WGSL:Tf.GLSL450:Tf.GLSL100,o=this.compiledBundle.shaders[i],a.defines.filter(function(f){return f.runtime}).forEach(function(f){var l="".concat(Xie).concat(f.name);o=o.replace(l,"".concat(f.value))}),a.shader=o,a.uniforms.forEach(function(f){if(!f.data&&f.storageClass===du.StorageBuffer){var l=1;f.type===Zf.FloatArray?l=1:f.type===Zf.Vector4FloatArray&&(l=4),f.data=new Float32Array(a.output.length*l).fill(0)}}),this.compiledBundle.context=a,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 r(){return e.apply(this,arguments)}return r}()}]),t}(),tO={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(me,function(){var r=function(T){return T instanceof Uint8Array||T instanceof Uint16Array||T instanceof Uint32Array||T instanceof Int8Array||T instanceof Int16Array||T instanceof Int32Array||T instanceof Float32Array||T instanceof Float64Array||T instanceof Uint8ClampedArray},n=function(T,F){for(var W=Object.keys(F),ue=0;ue<W.length;++ue)T[W[ue]]=F[W[ue]];return T},a=`
|
||
`;function i(T){return typeof atob<"u"?atob(T):"base64:"+T}function o(T){var F=new Error("(regl) "+T);throw console.error(F),F}function s(T,F){T||o(F)}function u(T){return T?": "+T:""}function f(T,F,W){T in F||o("unknown parameter ("+T+")"+u(W)+". possible values: "+Object.keys(F).join())}function l(T,F){r(T)||o("invalid parameter type"+u(F)+". must be a typed array")}function c(T,F){switch(F){case"number":return typeof T=="number";case"object":return typeof T=="object";case"string":return typeof T=="string";case"boolean":return typeof T=="boolean";case"function":return typeof T=="function";case"undefined":return typeof T>"u";case"symbol":return typeof T=="symbol"}}function h(T,F,W){c(T,F)||o("invalid parameter type"+u(W)+". expected "+F+", got "+typeof T)}function d(T,F){T>=0&&(T|0)===T||o("invalid parameter type, ("+T+")"+u(F)+". must be a nonnegative integer")}function v(T,F,W){F.indexOf(T)<0&&o("invalid value"+u(W)+". must be one of: "+F)}var p=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function g(T){Object.keys(T).forEach(function(F){p.indexOf(F)<0&&o('invalid regl constructor argument "'+F+'". must be one of '+p)})}function y(T,F){for(T=T+"";T.length<F;)T=" "+T;return T}function m(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function b(T,F){this.number=T,this.line=F,this.errors=[]}function w(T,F,W){this.file=T,this.line=F,this.message=W}function x(){var T=new Error,F=(T.stack||T).toString(),W=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(F);if(W)return W[1];var ue=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(F);return ue?ue[1]:"unknown"}function E(){var T=new Error,F=(T.stack||T).toString(),W=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(F);if(W)return W[1];var ue=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(F);return ue?ue[1]:"unknown"}function _(T,F){var W=T.split(`
|
||
`),ue=1,be=0,se={unknown:new m,0:new m};se.unknown.name=se[0].name=F||x(),se.unknown.lines.push(new b(0,""));for(var de=0;de<W.length;++de){var Ce=W[de],Ne=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(Ce);if(Ne)switch(Ne[1]){case"line":var Pe=/(\d+)(\s+\d+)?/.exec(Ne[2]);Pe&&(ue=Pe[1]|0,Pe[2]&&(be=Pe[2]|0,be in se||(se[be]=new m)));break;case"define":var Oe=/SHADER_NAME(_B64)?\s+(.*)$/.exec(Ne[2]);Oe&&(se[be].name=Oe[1]?i(Oe[2]):Oe[2]);break}se[be].lines.push(new b(ue++,Ce))}return Object.keys(se).forEach(function(Be){var Xe=se[Be];Xe.lines.forEach(function(Te){Xe.index[Te.number]=Te})}),se}function S(T){var F=[];return T.split(`
|
||
`).forEach(function(W){if(!(W.length<5)){var ue=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(W);ue?F.push(new w(ue[1]|0,ue[2]|0,ue[3].trim())):W.length>0&&F.push(new w("unknown",0,W))}}),F}function A(T,F){F.forEach(function(W){var ue=T[W.file];if(ue){var be=ue.index[W.line];if(be){be.errors.push(W),ue.hasErrors=!0;return}}T.unknown.hasErrors=!0,T.unknown.lines[0].errors.push(W)})}function M(T,F,W,ue,be){if(!T.getShaderParameter(F,T.COMPILE_STATUS)){var se=T.getShaderInfoLog(F),de=ue===T.FRAGMENT_SHADER?"fragment":"vertex";z(W,"string",de+" shader source must be a string",be);var Ce=_(W,be),Ne=S(se);A(Ce,Ne),Object.keys(Ce).forEach(function(Pe){var Oe=Ce[Pe];if(!Oe.hasErrors)return;var Be=[""],Xe=[""];function Te(Ge,re){Be.push(Ge),Xe.push(re||"")}Te("file number "+Pe+": "+Oe.name+`
|
||
`,"color:red;text-decoration:underline;font-weight:bold"),Oe.lines.forEach(function(Ge){if(Ge.errors.length>0){Te(y(Ge.number,4)+"| ","background-color:yellow; font-weight:bold"),Te(Ge.line+a,"color:red; background-color:yellow; font-weight:bold");var re=0;Ge.errors.forEach(function(ve){var De=ve.message,He=/^\s*'(.*)'\s*:\s*(.*)$/.exec(De);if(He){var Ee=He[1];switch(De=He[2],Ee){case"assign":Ee="=";break}re=Math.max(Ge.line.indexOf(Ee,re),0)}else re=0;Te(y("| ",6)),Te(y("^^^",re+3)+a,"font-weight:bold"),Te(y("| ",6)),Te(De+a,"font-weight:bold")}),Te(y("| ",6)+a)}else Te(y(Ge.number,4)+"| "),Te(Ge.line+a,"color:red")}),typeof document<"u"&&!window.chrome?(Xe[0]=Be.join("%c"),console.log.apply(console,Xe)):console.log(Be.join(""))}),s.raise("Error compiling "+de+" shader, "+Ce[0].name)}}function C(T,F,W,ue,be){if(!T.getProgramParameter(F,T.LINK_STATUS)){var se=T.getProgramInfoLog(F),de=_(W,be),Ce=_(ue,be),Ne='Error linking program with vertex shader, "'+Ce[0].name+'", and fragment shader "'+de[0].name+'"';typeof document<"u"?console.log("%c"+Ne+a+"%c"+se,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Ne+a+se),s.raise(Ne)}}function I(T){T._commandRef=x()}function k(T,F,W,ue){I(T);function be(Ne){return Ne?ue.id(Ne):0}T._fragId=be(T.static.frag),T._vertId=be(T.static.vert);function se(Ne,Pe){Object.keys(Pe).forEach(function(Oe){Ne[ue.id(Oe)]=!0})}var de=T._uniformSet={};se(de,F.static),se(de,F.dynamic);var Ce=T._attributeSet={};se(Ce,W.static),se(Ce,W.dynamic),T._hasCount="count"in T.static||"count"in T.dynamic||"elements"in T.static||"elements"in T.dynamic}function O(T,F){var W=E();o(T+" in command "+(F||x())+(W==="unknown"?"":" called from "+W))}function B(T,F,W){T||O(F,W||x())}function L(T,F,W,ue){T in F||O("unknown parameter ("+T+")"+u(W)+". possible values: "+Object.keys(F).join(),ue||x())}function z(T,F,W,ue){c(T,F)||O("invalid parameter type"+u(W)+". expected "+F+", got "+typeof T,ue||x())}function X(T){T()}function R(T,F,W){T.texture?v(T.texture._texture.internalformat,F,"unsupported texture format for attachment"):v(T.renderbuffer._renderbuffer.format,W,"unsupported renderbuffer format for attachment")}var V=33071,he=9728,ce=9984,le=9985,ie=9986,Ie=9987,qe=5120,Ve=5121,it=5122,dt=5123,st=5124,Tt=5125,_t=5126,lr=32819,Bt=32820,Wt=33635,vr=34042,cr=36193,$t={};$t[qe]=$t[Ve]=1,$t[it]=$t[dt]=$t[cr]=$t[Wt]=$t[lr]=$t[Bt]=2,$t[st]=$t[Tt]=$t[_t]=$t[vr]=4;function sr(T,F){return T===Bt||T===lr||T===Wt?2:T===vr?4:$t[T]*F}function tn(T){return!(T&T-1)&&!!T}function tt(T,F,W){var ue,be=F.width,se=F.height,de=F.channels;s(be>0&&be<=W.maxTextureSize&&se>0&&se<=W.maxTextureSize,"invalid texture shape"),(T.wrapS!==V||T.wrapT!==V)&&s(tn(be)&&tn(se),"incompatible wrap mode for texture, both width and height must be power of 2"),F.mipmask===1?be!==1&&se!==1&&s(T.minFilter!==ce&&T.minFilter!==ie&&T.minFilter!==le&&T.minFilter!==Ie,"min filter requires mipmap"):(s(tn(be)&&tn(se),"texture must be a square power of 2 to support mipmapping"),s(F.mipmask===(be<<1)-1,"missing or incomplete mipmap data")),F.type===_t&&(W.extensions.indexOf("oes_texture_float_linear")<0&&s(T.minFilter===he&&T.magFilter===he,"filter not supported, must enable oes_texture_float_linear"),s(!T.genMipmaps,"mipmap generation not supported with float textures"));var Ce=F.images;for(ue=0;ue<16;++ue)if(Ce[ue]){var Ne=be>>ue,Pe=se>>ue;s(F.mipmask&1<<ue,"missing mipmap data");var Oe=Ce[ue];if(s(Oe.width===Ne&&Oe.height===Pe,"invalid shape for mip images"),s(Oe.format===F.format&&Oe.internalformat===F.internalformat&&Oe.type===F.type,"incompatible type for mip image"),!Oe.compressed)if(Oe.data){var Be=Math.ceil(sr(Oe.type,de)*Ne/Oe.unpackAlignment)*Oe.unpackAlignment;s(Oe.data.byteLength===Be*Pe,"invalid data for image, buffer size is inconsistent with image format")}else Oe.element||Oe.copy}else T.genMipmaps||s((F.mipmask&1<<ue)===0,"extra mipmap data");F.compressed&&s(!T.genMipmaps,"mipmap generation for compressed images not supported")}function te(T,F,W,ue){var be=T.width,se=T.height,de=T.channels;s(be>0&&be<=ue.maxTextureSize&&se>0&&se<=ue.maxTextureSize,"invalid texture shape"),s(be===se,"cube map must be square"),s(F.wrapS===V&&F.wrapT===V,"wrap mode not supported by cube map");for(var Ce=0;Ce<W.length;++Ce){var Ne=W[Ce];s(Ne.width===be&&Ne.height===se,"inconsistent cube map face shape"),F.genMipmaps&&(s(!Ne.compressed,"can not generate mipmap for compressed textures"),s(Ne.mipmask===1,"can not specify mipmaps and generate mipmaps"));for(var Pe=Ne.images,Oe=0;Oe<16;++Oe){var Be=Pe[Oe];if(Be){var Xe=be>>Oe,Te=se>>Oe;s(Ne.mipmask&1<<Oe,"missing mipmap data"),s(Be.width===Xe&&Be.height===Te,"invalid shape for mip images"),s(Be.format===T.format&&Be.internalformat===T.internalformat&&Be.type===T.type,"incompatible type for mip image"),Be.compressed||(Be.data?s(Be.data.byteLength===Xe*Te*Math.max(sr(Be.type,de),Be.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):Be.element||Be.copy)}}}}var N=n(s,{optional:X,raise:o,commandRaise:O,command:B,parameter:f,commandParameter:L,constructor:g,type:h,commandType:z,isTypedArray:l,nni:d,oneOf:v,shaderError:M,linkError:C,callSite:E,saveCommandRef:I,saveDrawInfo:k,framebufferFormat:R,guessCommand:x,texture2D:tt,textureCube:te}),Se=0,Fe=0,ge=5,Ue=6;function $e(T,F){this.id=Se++,this.type=T,this.data=F}function Ze(T){return T.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Je(T){if(T.length===0)return[];var F=T.charAt(0),W=T.charAt(T.length-1);if(T.length>1&&F===W&&(F==='"'||F==="'"))return['"'+Ze(T.substr(1,T.length-2))+'"'];var ue=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(T);if(ue)return Je(T.substr(0,ue.index)).concat(Je(ue[1])).concat(Je(T.substr(ue.index+ue[0].length)));var be=T.split(".");if(be.length===1)return['"'+Ze(T)+'"'];for(var se=[],de=0;de<be.length;++de)se=se.concat(Je(be[de]));return se}function ht(T){return"["+Je(T).join("][")+"]"}function Lt(T,F){return new $e(T,ht(F+""))}function ur(T){return typeof T=="function"&&!T._reglType||T instanceof $e}function Dt(T,F){if(typeof T=="function")return new $e(Fe,T);if(typeof T=="number"||typeof T=="boolean")return new $e(ge,T);if(Array.isArray(T))return new $e(Ue,T.map((W,ue)=>Dt(W,F+"["+ue+"]")));if(T instanceof $e)return T;N(!1,"invalid option type in uniform "+F)}var fr={DynamicVariable:$e,define:Lt,isDynamic:ur,unbox:Dt,accessor:ht},or={next:typeof requestAnimationFrame=="function"?function(T){return requestAnimationFrame(T)}:function(T){return setTimeout(T,16)},cancel:typeof cancelAnimationFrame=="function"?function(T){return cancelAnimationFrame(T)}:clearTimeout},gr=typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return+new Date};function hr(){var T={"":0},F=[""];return{id:function(W){var ue=T[W];return ue||(ue=T[W]=F.length,F.push(W),ue)},str:function(W){return F[W]}}}function hn(T,F,W){var ue=document.createElement("canvas");n(ue.style,{border:0,margin:0,padding:0,top:0,left:0}),T.appendChild(ue),T===document.body&&(ue.style.position="absolute",n(T.style,{margin:0,padding:0}));function be(){var Ce=window.innerWidth,Ne=window.innerHeight;if(T!==document.body){var Pe=T.getBoundingClientRect();Ce=Pe.right-Pe.left,Ne=Pe.bottom-Pe.top}ue.width=W*Ce,ue.height=W*Ne,n(ue.style,{width:Ce+"px",height:Ne+"px"})}var se;T!==document.body&&typeof ResizeObserver=="function"?(se=new ResizeObserver(function(){setTimeout(be)}),se.observe(T)):window.addEventListener("resize",be,!1);function de(){se?se.disconnect():window.removeEventListener("resize",be),T.removeChild(ue)}return be(),{canvas:ue,onDestroy:de}}function nr(T,F){function W(ue){try{return T.getContext(ue,F)}catch{return null}}return W("webgl")||W("experimental-webgl")||W("webgl-experimental")}function Fr(T){return typeof T.nodeName=="string"&&typeof T.appendChild=="function"&&typeof T.getBoundingClientRect=="function"}function oa(T){return typeof T.drawArrays=="function"||typeof T.drawElements=="function"}function Ur(T){return typeof T=="string"?T.split():(N(Array.isArray(T),"invalid extension array"),T)}function Mi(T){return typeof T=="string"?(N(typeof document<"u","not supported outside of DOM"),document.querySelector(T)):T}function xu(T){var F=T||{},W,ue,be,se,de={},Ce=[],Ne=[],Pe=typeof window>"u"?1:window.devicePixelRatio,Oe=!1,Be=function(Ge){Ge&&N.raise(Ge)},Xe=function(){};if(typeof F=="string"?(N(typeof document<"u","selector queries only supported in DOM enviroments"),W=document.querySelector(F),N(W,"invalid query string for element")):typeof F=="object"?Fr(F)?W=F:oa(F)?(se=F,be=se.canvas):(N.constructor(F),"gl"in F?se=F.gl:"canvas"in F?be=Mi(F.canvas):"container"in F&&(ue=Mi(F.container)),"attributes"in F&&(de=F.attributes,N.type(de,"object","invalid context attributes")),"extensions"in F&&(Ce=Ur(F.extensions)),"optionalExtensions"in F&&(Ne=Ur(F.optionalExtensions)),"onDone"in F&&(N.type(F.onDone,"function","invalid or missing onDone callback"),Be=F.onDone),"profile"in F&&(Oe=!!F.profile),"pixelRatio"in F&&(Pe=+F.pixelRatio,N(Pe>0,"invalid pixel ratio"))):N.raise("invalid arguments to regl"),W&&(W.nodeName.toLowerCase()==="canvas"?be=W:ue=W),!se){if(!be){N(typeof document<"u","must manually specify webgl context outside of DOM environments");var Te=hn(ue||document.body,Be,Pe);if(!Te)return null;be=Te.canvas,Xe=Te.onDestroy}de.premultipliedAlpha===void 0&&(de.premultipliedAlpha=!0),se=nr(be,de)}return se?{gl:se,canvas:be,container:ue,extensions:Ce,optionalExtensions:Ne,pixelRatio:Pe,profile:Oe,onDone:Be,onDestroy:Xe}:(Xe(),Be("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function Eu(T,F){var W={};function ue(de){N.type(de,"string","extension name must be string");var Ce=de.toLowerCase(),Ne;try{Ne=W[Ce]=T.getExtension(Ce)}catch{}return!!Ne}for(var be=0;be<F.extensions.length;++be){var se=F.extensions[be];if(!ue(se))return F.onDestroy(),F.onDone('"'+se+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return F.optionalExtensions.forEach(ue),{extensions:W,restore:function(){Object.keys(W).forEach(function(de){if(W[de]&&!ue(de))throw new Error("(regl): error restoring extension "+de)})}}}function rn(T,F){for(var W=Array(T),ue=0;ue<T;++ue)W[ue]=F(ue);return W}var ti=5120,uo=5121,_u=5122,Su=5123,Mu=5124,sa=5125,Br=5126;function ua(T){for(var F=16;F<=1<<28;F*=16)if(T<=F)return F;return 0}function St(T){var F,W;return F=(T>65535)<<4,T>>>=F,W=(T>255)<<3,T>>>=W,F|=W,W=(T>15)<<2,T>>>=W,F|=W,W=(T>3)<<1,T>>>=W,F|=W,F|T>>1}function dr(){var T=rn(8,function(){return[]});function F(se){var de=ua(se),Ce=T[St(de)>>2];return Ce.length>0?Ce.pop():new ArrayBuffer(de)}function W(se){T[St(se.byteLength)>>2].push(se)}function ue(se,de){var Ce=null;switch(se){case ti:Ce=new Int8Array(F(de),0,de);break;case uo:Ce=new Uint8Array(F(de),0,de);break;case _u:Ce=new Int16Array(F(2*de),0,de);break;case Su:Ce=new Uint16Array(F(2*de),0,de);break;case Mu:Ce=new Int32Array(F(4*de),0,de);break;case sa:Ce=new Uint32Array(F(4*de),0,de);break;case Br:Ce=new Float32Array(F(4*de),0,de);break;default:return null}return Ce.length!==de?Ce.subarray(0,de):Ce}function be(se){W(se.buffer)}return{alloc:F,free:W,allocType:ue,freeType:be}}var gt=dr();gt.zero=dr();var Sr=3408,dn=3410,fo=3411,lo=3412,ri=3413,co=3414,ho=3415,vo=33901,RO=33902,FO=3379,BO=3386,GO=34921,zO=36347,jO=36348,UO=35661,$O=35660,XO=34930,WO=36349,VO=34076,YO=34024,qO=7936,HO=7937,ZO=7938,KO=35724,QO=34047,JO=36063,eL=34852,Cl=3553,p1=34067,tL=34069,rL=33984,Au=6408,dv=5126,g1=5121,vv=36160,nL=36053,aL=36064,iL=16384,oL=function(T,F){var W=1;F.ext_texture_filter_anisotropic&&(W=T.getParameter(QO));var ue=1,be=1;F.webgl_draw_buffers&&(ue=T.getParameter(eL),be=T.getParameter(JO));var se=!!F.oes_texture_float;if(se){var de=T.createTexture();T.bindTexture(Cl,de),T.texImage2D(Cl,0,Au,1,1,0,Au,dv,null);var Ce=T.createFramebuffer();if(T.bindFramebuffer(vv,Ce),T.framebufferTexture2D(vv,aL,Cl,de,0),T.bindTexture(Cl,null),T.checkFramebufferStatus(vv)!==nL)se=!1;else{T.viewport(0,0,1,1),T.clearColor(1,0,0,1),T.clear(iL);var Ne=gt.allocType(dv,4);T.readPixels(0,0,1,1,Au,dv,Ne),T.getError()?se=!1:(T.deleteFramebuffer(Ce),T.deleteTexture(de),se=Ne[0]===1),gt.freeType(Ne)}}var Pe=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),Oe=!0;if(!Pe){var Be=T.createTexture(),Xe=gt.allocType(g1,36);T.activeTexture(rL),T.bindTexture(p1,Be),T.texImage2D(tL,0,Au,3,3,0,Au,g1,Xe),gt.freeType(Xe),T.bindTexture(p1,null),T.deleteTexture(Be),Oe=!T.getError()}return{colorBits:[T.getParameter(dn),T.getParameter(fo),T.getParameter(lo),T.getParameter(ri)],depthBits:T.getParameter(co),stencilBits:T.getParameter(ho),subpixelBits:T.getParameter(Sr),extensions:Object.keys(F).filter(function(Te){return!!F[Te]}),maxAnisotropic:W,maxDrawbuffers:ue,maxColorAttachments:be,pointSizeDims:T.getParameter(vo),lineWidthDims:T.getParameter(RO),maxViewportDims:T.getParameter(BO),maxCombinedTextureUnits:T.getParameter(UO),maxCubeMapSize:T.getParameter(VO),maxRenderbufferSize:T.getParameter(YO),maxTextureUnits:T.getParameter(XO),maxTextureSize:T.getParameter(FO),maxAttributes:T.getParameter(GO),maxVertexUniforms:T.getParameter(zO),maxVertexTextureUnits:T.getParameter($O),maxVaryingVectors:T.getParameter(jO),maxFragmentUniforms:T.getParameter(WO),glsl:T.getParameter(KO),renderer:T.getParameter(HO),vendor:T.getParameter(qO),version:T.getParameter(ZO),readFloat:se,npotTextureCube:Oe}};function fa(T){return!!T&&typeof T=="object"&&Array.isArray(T.shape)&&Array.isArray(T.stride)&&typeof T.offset=="number"&&T.shape.length===T.stride.length&&(Array.isArray(T.data)||r(T.data))}var Pn=function(T){return Object.keys(T).map(function(F){return T[F]})},Tl={shape:lL,flatten:fL};function sL(T,F,W){for(var ue=0;ue<F;++ue)W[ue]=T[ue]}function uL(T,F,W,ue){for(var be=0,se=0;se<F;++se)for(var de=T[se],Ce=0;Ce<W;++Ce)ue[be++]=de[Ce]}function y1(T,F,W,ue,be,se){for(var de=se,Ce=0;Ce<F;++Ce)for(var Ne=T[Ce],Pe=0;Pe<W;++Pe)for(var Oe=Ne[Pe],Be=0;Be<ue;++Be)be[de++]=Oe[Be]}function m1(T,F,W,ue,be){for(var se=1,de=W+1;de<F.length;++de)se*=F[de];var Ce=F[W];if(F.length-W===4){var Ne=F[W+1],Pe=F[W+2],Oe=F[W+3];for(de=0;de<Ce;++de)y1(T[de],Ne,Pe,Oe,ue,be),be+=se}else for(de=0;de<Ce;++de)m1(T[de],F,W+1,ue,be),be+=se}function fL(T,F,W,ue){var be=1;if(F.length)for(var se=0;se<F.length;++se)be*=F[se];else be=0;var de=ue||gt.allocType(W,be);switch(F.length){case 0:break;case 1:sL(T,F[0],de);break;case 2:uL(T,F[0],F[1],de);break;case 3:y1(T,F[0],F[1],F[2],de,0);break;default:m1(T,F,0,de,0)}return de}function lL(T){for(var F=[],W=T;W.length;W=W[0])F.push(W.length);return F}var pv={"[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},cL=5120,hL=5122,dL=5124,vL=5121,pL=5123,gL=5125,yL=5126,mL=5126,po={int8:cL,int16:hL,int32:dL,uint8:vL,uint16:pL,uint32:gL,float:yL,float32:mL},bL=35048,wL=35040,Il={dynamic:bL,stream:wL,static:35044},gv=Tl.flatten,b1=Tl.shape,w1=35044,xL=35040,yv=5121,mv=5126,Ai=[];Ai[5120]=1,Ai[5122]=2,Ai[5124]=4,Ai[5121]=1,Ai[5123]=2,Ai[5125]=4,Ai[5126]=4;function kl(T){return pv[Object.prototype.toString.call(T)]|0}function x1(T,F){for(var W=0;W<F.length;++W)T[W]=F[W]}function E1(T,F,W,ue,be,se,de){for(var Ce=0,Ne=0;Ne<W;++Ne)for(var Pe=0;Pe<ue;++Pe)T[Ce++]=F[be*Ne+se*Pe+de]}function EL(T,F,W,ue){var be=0,se={};function de(re){this.id=be++,this.buffer=T.createBuffer(),this.type=re,this.usage=w1,this.byteLength=0,this.dimension=1,this.dtype=yv,this.persistentData=null,W.profile&&(this.stats={size:0})}de.prototype.bind=function(){T.bindBuffer(this.type,this.buffer)},de.prototype.destroy=function(){Xe(this)};var Ce=[];function Ne(re,ve){var De=Ce.pop();return De||(De=new de(re)),De.bind(),Be(De,ve,xL,0,1,!1),De}function Pe(re){Ce.push(re)}function Oe(re,ve,De){re.byteLength=ve.byteLength,T.bufferData(re.type,ve,De)}function Be(re,ve,De,He,Ee,et){var Ae;if(re.usage=De,Array.isArray(ve)){if(re.dtype=He||mv,ve.length>0){var ze;if(Array.isArray(ve[0])){Ae=b1(ve);for(var Me=1,je=1;je<Ae.length;++je)Me*=Ae[je];re.dimension=Me,ze=gv(ve,Ae,re.dtype),Oe(re,ze,De),et?re.persistentData=ze:gt.freeType(ze)}else if(typeof ve[0]=="number"){re.dimension=Ee;var ct=gt.allocType(re.dtype,ve.length);x1(ct,ve),Oe(re,ct,De),et?re.persistentData=ct:gt.freeType(ct)}else r(ve[0])?(re.dimension=ve[0].length,re.dtype=He||kl(ve[0])||mv,ze=gv(ve,[ve.length,ve[0].length],re.dtype),Oe(re,ze,De),et?re.persistentData=ze:gt.freeType(ze)):N.raise("invalid buffer data")}}else if(r(ve))re.dtype=He||kl(ve),re.dimension=Ee,Oe(re,ve,De),et&&(re.persistentData=new Uint8Array(new Uint8Array(ve.buffer)));else if(fa(ve)){Ae=ve.shape;var Mt=ve.stride,We=ve.offset,Re=0,xe=0,xt=0,It=0;Ae.length===1?(Re=Ae[0],xe=1,xt=Mt[0],It=0):Ae.length===2?(Re=Ae[0],xe=Ae[1],xt=Mt[0],It=Mt[1]):N.raise("invalid shape"),re.dtype=He||kl(ve.data)||mv,re.dimension=xe;var nt=gt.allocType(re.dtype,Re*xe);E1(nt,ve.data,Re,xe,xt,It,We),Oe(re,nt,De),et?re.persistentData=nt:gt.freeType(nt)}else ve instanceof ArrayBuffer?(re.dtype=yv,re.dimension=Ee,Oe(re,ve,De),et&&(re.persistentData=new Uint8Array(new Uint8Array(ve)))):N.raise("invalid buffer data")}function Xe(re){F.bufferCount--,ue(re);var ve=re.buffer;N(ve,"buffer must not be deleted already"),T.deleteBuffer(ve),re.buffer=null,delete se[re.id]}function Te(re,ve,De,He){F.bufferCount++;var Ee=new de(ve);se[Ee.id]=Ee;function et(Me){var je=w1,ct=null,Mt=0,We=0,Re=1;return Array.isArray(Me)||r(Me)||fa(Me)||Me instanceof ArrayBuffer?ct=Me:typeof Me=="number"?Mt=Me|0:Me&&(N.type(Me,"object","buffer arguments must be an object, a number or an array"),"data"in Me&&(N(ct===null||Array.isArray(ct)||r(ct)||fa(ct),"invalid data for buffer"),ct=Me.data),"usage"in Me&&(N.parameter(Me.usage,Il,"invalid buffer usage"),je=Il[Me.usage]),"type"in Me&&(N.parameter(Me.type,po,"invalid buffer type"),We=po[Me.type]),"dimension"in Me&&(N.type(Me.dimension,"number","invalid dimension"),Re=Me.dimension|0),"length"in Me&&(N.nni(Mt,"buffer length must be a nonnegative integer"),Mt=Me.length|0)),Ee.bind(),ct?Be(Ee,ct,je,We,Re,He):(Mt&&T.bufferData(Ee.type,Mt,je),Ee.dtype=We||yv,Ee.usage=je,Ee.dimension=Re,Ee.byteLength=Mt),W.profile&&(Ee.stats.size=Ee.byteLength*Ai[Ee.dtype]),et}function Ae(Me,je){N(je+Me.byteLength<=Ee.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+Me.byteLength+" starting from offset "+je+" to a buffer of size "+Ee.byteLength),T.bufferSubData(Ee.type,je,Me)}function ze(Me,je){var ct=(je||0)|0,Mt;if(Ee.bind(),r(Me)||Me instanceof ArrayBuffer)Ae(Me,ct);else if(Array.isArray(Me)){if(Me.length>0)if(typeof Me[0]=="number"){var We=gt.allocType(Ee.dtype,Me.length);x1(We,Me),Ae(We,ct),gt.freeType(We)}else if(Array.isArray(Me[0])||r(Me[0])){Mt=b1(Me);var Re=gv(Me,Mt,Ee.dtype);Ae(Re,ct),gt.freeType(Re)}else N.raise("invalid buffer data")}else if(fa(Me)){Mt=Me.shape;var xe=Me.stride,xt=0,It=0,nt=0,Rt=0;Mt.length===1?(xt=Mt[0],It=1,nt=xe[0],Rt=0):Mt.length===2?(xt=Mt[0],It=Mt[1],nt=xe[0],Rt=xe[1]):N.raise("invalid shape");var At=Array.isArray(Me.data)?Ee.dtype:kl(Me.data),Pt=gt.allocType(At,xt*It);E1(Pt,Me.data,xt,It,nt,Rt,Me.offset),Ae(Pt,ct),gt.freeType(Pt)}else N.raise("invalid data for buffer subdata");return et}return De||et(re),et._reglType="buffer",et._buffer=Ee,et.subdata=ze,W.profile&&(et.stats=Ee.stats),et.destroy=function(){Xe(Ee)},et}function Ge(){Pn(se).forEach(function(re){re.buffer=T.createBuffer(),T.bindBuffer(re.type,re.buffer),T.bufferData(re.type,re.persistentData||re.byteLength,re.usage)})}return W.profile&&(F.getTotalBufferSize=function(){var re=0;return Object.keys(se).forEach(function(ve){re+=se[ve].stats.size}),re}),{create:Te,createStream:Ne,destroyStream:Pe,clear:function(){Pn(se).forEach(Xe),Ce.forEach(Xe)},getBuffer:function(re){return re&&re._buffer instanceof de?re._buffer:null},restore:Ge,_initBuffer:Be}}var _L=0,SL=0,ML=1,AL=1,CL=4,TL=4,ns={points:_L,point:SL,lines:ML,line:AL,triangles:CL,triangle:TL,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},IL=0,kL=1,Cu=4,NL=5120,as=5121,_1=5122,is=5123,S1=5124,go=5125,bv=34963,OL=35040,LL=35044;function DL(T,F,W,ue){var be={},se=0,de={uint8:as,uint16:is};F.oes_element_index_uint&&(de.uint32=go);function Ce(Ge){this.id=se++,be[this.id]=this,this.buffer=Ge,this.primType=Cu,this.vertCount=0,this.type=0}Ce.prototype.bind=function(){this.buffer.bind()};var Ne=[];function Pe(Ge){var re=Ne.pop();return re||(re=new Ce(W.create(null,bv,!0,!1)._buffer)),Be(re,Ge,OL,-1,-1,0,0),re}function Oe(Ge){Ne.push(Ge)}function Be(Ge,re,ve,De,He,Ee,et){Ge.buffer.bind();var Ae;if(re){var ze=et;!et&&(!r(re)||fa(re)&&!r(re.data))&&(ze=F.oes_element_index_uint?go:is),W._initBuffer(Ge.buffer,re,ve,ze,3)}else T.bufferData(bv,Ee,ve),Ge.buffer.dtype=Ae||as,Ge.buffer.usage=ve,Ge.buffer.dimension=3,Ge.buffer.byteLength=Ee;if(Ae=et,!et){switch(Ge.buffer.dtype){case as:case NL:Ae=as;break;case is:case _1:Ae=is;break;case go:case S1:Ae=go;break;default:N.raise("unsupported type for element array")}Ge.buffer.dtype=Ae}Ge.type=Ae,N(Ae!==go||!!F.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var Me=He;Me<0&&(Me=Ge.buffer.byteLength,Ae===is?Me>>=1:Ae===go&&(Me>>=2)),Ge.vertCount=Me;var je=De;if(De<0){je=Cu;var ct=Ge.buffer.dimension;ct===1&&(je=IL),ct===2&&(je=kL),ct===3&&(je=Cu)}Ge.primType=je}function Xe(Ge){ue.elementsCount--,N(Ge.buffer!==null,"must not double destroy elements"),delete be[Ge.id],Ge.buffer.destroy(),Ge.buffer=null}function Te(Ge,re){var ve=W.create(null,bv,!0),De=new Ce(ve._buffer);ue.elementsCount++;function He(Ee){if(!Ee)ve(),De.primType=Cu,De.vertCount=0,De.type=as;else if(typeof Ee=="number")ve(Ee),De.primType=Cu,De.vertCount=Ee|0,De.type=as;else{var et=null,Ae=LL,ze=-1,Me=-1,je=0,ct=0;Array.isArray(Ee)||r(Ee)||fa(Ee)?et=Ee:(N.type(Ee,"object","invalid arguments for elements"),"data"in Ee&&(et=Ee.data,N(Array.isArray(et)||r(et)||fa(et),"invalid data for element buffer")),"usage"in Ee&&(N.parameter(Ee.usage,Il,"invalid element buffer usage"),Ae=Il[Ee.usage]),"primitive"in Ee&&(N.parameter(Ee.primitive,ns,"invalid element buffer primitive"),ze=ns[Ee.primitive]),"count"in Ee&&(N(typeof Ee.count=="number"&&Ee.count>=0,"invalid vertex count for elements"),Me=Ee.count|0),"type"in Ee&&(N.parameter(Ee.type,de,"invalid buffer type"),ct=de[Ee.type]),"length"in Ee?je=Ee.length|0:(je=Me,ct===is||ct===_1?je*=2:(ct===go||ct===S1)&&(je*=4))),Be(De,et,Ae,ze,Me,je,ct)}return He}return He(Ge),He._reglType="elements",He._elements=De,He.subdata=function(Ee,et){return ve.subdata(Ee,et),He},He.destroy=function(){Xe(De)},He}return{create:Te,createStream:Pe,destroyStream:Oe,getElements:function(Ge){return typeof Ge=="function"&&Ge._elements instanceof Ce?Ge._elements:null},clear:function(){Pn(be).forEach(Xe)}}}var M1=new Float32Array(1),PL=new Uint32Array(M1.buffer),RL=5123;function A1(T){for(var F=gt.allocType(RL,T.length),W=0;W<T.length;++W)if(isNaN(T[W]))F[W]=65535;else if(T[W]===1/0)F[W]=31744;else if(T[W]===-1/0)F[W]=64512;else{M1[0]=T[W];var ue=PL[0],be=ue>>>31<<15,se=(ue<<1>>>24)-127,de=ue>>13&1023;if(se<-24)F[W]=be;else if(se<-14){var Ce=-14-se;F[W]=be+(de+1024>>Ce)}else se>15?F[W]=be+31744:F[W]=be+(se+15<<10)+de}return F}function Mr(T){return Array.isArray(T)||r(T)}var C1=function(T){return!(T&T-1)&&!!T},FL=34467,Ca=3553,wv=34067,Nl=34069,yo=6408,xv=6406,Ol=6407,Tu=6409,Ll=6410,T1=32854,Ev=32855,I1=36194,BL=32819,GL=32820,zL=33635,jL=34042,_v=6402,Dl=34041,Sv=35904,Mv=35906,os=36193,Av=33776,Cv=33777,Tv=33778,Iv=33779,k1=35986,N1=35987,O1=34798,L1=35840,D1=35841,P1=35842,R1=35843,F1=36196,ss=5121,kv=5123,Nv=5125,Iu=5126,UL=10242,$L=10243,XL=10497,Ov=33071,WL=33648,VL=10240,YL=10241,Lv=9728,qL=9729,Dv=9984,B1=9985,G1=9986,Pv=9987,HL=33170,Pl=4352,ZL=4353,KL=4354,QL=34046,JL=3317,eD=37440,tD=37441,rD=37443,z1=37444,ku=33984,nD=[Dv,G1,B1,Pv],Rl=[0,Tu,Ll,Ol,yo],Yn={};Yn[Tu]=Yn[xv]=Yn[_v]=1,Yn[Dl]=Yn[Ll]=2,Yn[Ol]=Yn[Sv]=3,Yn[yo]=Yn[Mv]=4;function us(T){return"[object "+T+"]"}var j1=us("HTMLCanvasElement"),U1=us("OffscreenCanvas"),$1=us("CanvasRenderingContext2D"),X1=us("ImageBitmap"),W1=us("HTMLImageElement"),V1=us("HTMLVideoElement"),aD=Object.keys(pv).concat([j1,U1,$1,X1,W1,V1]),fs=[];fs[ss]=1,fs[Iu]=4,fs[os]=2,fs[kv]=2,fs[Nv]=4;var nn=[];nn[T1]=2,nn[Ev]=2,nn[I1]=2,nn[Dl]=4,nn[Av]=.5,nn[Cv]=.5,nn[Tv]=1,nn[Iv]=1,nn[k1]=.5,nn[N1]=1,nn[O1]=1,nn[L1]=.5,nn[D1]=.25,nn[P1]=.5,nn[R1]=.25,nn[F1]=.5;function Y1(T){return Array.isArray(T)&&(T.length===0||typeof T[0]=="number")}function q1(T){if(!Array.isArray(T))return!1;var F=T.length;return!(F===0||!Mr(T[0]))}function mo(T){return Object.prototype.toString.call(T)}function H1(T){return mo(T)===j1}function Z1(T){return mo(T)===U1}function iD(T){return mo(T)===$1}function oD(T){return mo(T)===X1}function sD(T){return mo(T)===W1}function uD(T){return mo(T)===V1}function Rv(T){if(!T)return!1;var F=mo(T);return aD.indexOf(F)>=0?!0:Y1(T)||q1(T)||fa(T)}function K1(T){return pv[Object.prototype.toString.call(T)]|0}function fD(T,F){var W=F.length;switch(T.type){case ss:case kv:case Nv:case Iu:var ue=gt.allocType(T.type,W);ue.set(F),T.data=ue;break;case os:T.data=A1(F);break;default:N.raise("unsupported texture type, must specify a typed array")}}function Q1(T,F){return gt.allocType(T.type===os?Iu:T.type,F)}function J1(T,F){T.type===os?(T.data=A1(F),gt.freeType(F)):T.data=F}function lD(T,F,W,ue,be,se){for(var de=T.width,Ce=T.height,Ne=T.channels,Pe=de*Ce*Ne,Oe=Q1(T,Pe),Be=0,Xe=0;Xe<Ce;++Xe)for(var Te=0;Te<de;++Te)for(var Ge=0;Ge<Ne;++Ge)Oe[Be++]=F[W*Te+ue*Xe+be*Ge+se];J1(T,Oe)}function Fl(T,F,W,ue,be,se){var de;if(typeof nn[T]<"u"?de=nn[T]:de=Yn[T]*fs[F],se&&(de*=6),be){for(var Ce=0,Ne=W;Ne>=1;)Ce+=de*Ne*Ne,Ne/=2;return Ce}else return de*W*ue}function cD(T,F,W,ue,be,se,de){var Ce={"don't care":Pl,"dont care":Pl,nice:KL,fast:ZL},Ne={repeat:XL,clamp:Ov,mirror:WL},Pe={nearest:Lv,linear:qL},Oe=n({mipmap:Pv,"nearest mipmap nearest":Dv,"linear mipmap nearest":B1,"nearest mipmap linear":G1,"linear mipmap linear":Pv},Pe),Be={none:0,browser:z1},Xe={uint8:ss,rgba4:BL,rgb565:zL,"rgb5 a1":GL},Te={alpha:xv,luminance:Tu,"luminance alpha":Ll,rgb:Ol,rgba:yo,rgba4:T1,"rgb5 a1":Ev,rgb565:I1},Ge={};F.ext_srgb&&(Te.srgb=Sv,Te.srgba=Mv),F.oes_texture_float&&(Xe.float32=Xe.float=Iu),F.oes_texture_half_float&&(Xe.float16=Xe["half float"]=os),F.webgl_depth_texture&&(n(Te,{depth:_v,"depth stencil":Dl}),n(Xe,{uint16:kv,uint32:Nv,"depth stencil":jL})),F.webgl_compressed_texture_s3tc&&n(Ge,{"rgb s3tc dxt1":Av,"rgba s3tc dxt1":Cv,"rgba s3tc dxt3":Tv,"rgba s3tc dxt5":Iv}),F.webgl_compressed_texture_atc&&n(Ge,{"rgb atc":k1,"rgba atc explicit alpha":N1,"rgba atc interpolated alpha":O1}),F.webgl_compressed_texture_pvrtc&&n(Ge,{"rgb pvrtc 4bppv1":L1,"rgb pvrtc 2bppv1":D1,"rgba pvrtc 4bppv1":P1,"rgba pvrtc 2bppv1":R1}),F.webgl_compressed_texture_etc1&&(Ge["rgb etc1"]=F1);var re=Array.prototype.slice.call(T.getParameter(FL));Object.keys(Ge).forEach(function($){var fe=Ge[$];re.indexOf(fe)>=0&&(Te[$]=fe)});var ve=Object.keys(Te);W.textureFormats=ve;var De=[];Object.keys(Te).forEach(function($){var fe=Te[$];De[fe]=$});var He=[];Object.keys(Xe).forEach(function($){var fe=Xe[$];He[fe]=$});var Ee=[];Object.keys(Pe).forEach(function($){var fe=Pe[$];Ee[fe]=$});var et=[];Object.keys(Oe).forEach(function($){var fe=Oe[$];et[fe]=$});var Ae=[];Object.keys(Ne).forEach(function($){var fe=Ne[$];Ae[fe]=$});var ze=ve.reduce(function($,fe){var oe=Te[fe];return oe===Tu||oe===xv||oe===Tu||oe===Ll||oe===_v||oe===Dl||F.ext_srgb&&(oe===Sv||oe===Mv)?$[oe]=oe:oe===Ev||fe.indexOf("rgba")>=0?$[oe]=yo:$[oe]=Ol,$},{});function Me(){this.internalformat=yo,this.format=yo,this.type=ss,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=z1,this.width=0,this.height=0,this.channels=0}function je($,fe){$.internalformat=fe.internalformat,$.format=fe.format,$.type=fe.type,$.compressed=fe.compressed,$.premultiplyAlpha=fe.premultiplyAlpha,$.flipY=fe.flipY,$.unpackAlignment=fe.unpackAlignment,$.colorSpace=fe.colorSpace,$.width=fe.width,$.height=fe.height,$.channels=fe.channels}function ct($,fe){if(!(typeof fe!="object"||!fe)){if("premultiplyAlpha"in fe&&(N.type(fe.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),$.premultiplyAlpha=fe.premultiplyAlpha),"flipY"in fe&&(N.type(fe.flipY,"boolean","invalid texture flip"),$.flipY=fe.flipY),"alignment"in fe&&(N.oneOf(fe.alignment,[1,2,4,8],"invalid texture unpack alignment"),$.unpackAlignment=fe.alignment),"colorSpace"in fe&&(N.parameter(fe.colorSpace,Be,"invalid colorSpace"),$.colorSpace=Be[fe.colorSpace]),"type"in fe){var oe=fe.type;N(F.oes_texture_float||!(oe==="float"||oe==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),N(F.oes_texture_half_float||!(oe==="half float"||oe==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),N(F.webgl_depth_texture||!(oe==="uint16"||oe==="uint32"||oe==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),N.parameter(oe,Xe,"invalid texture type"),$.type=Xe[oe]}var rt=$.width,Ft=$.height,j=$.channels,D=!1;"shape"in fe?(N(Array.isArray(fe.shape)&&fe.shape.length>=2,"shape must be an array"),rt=fe.shape[0],Ft=fe.shape[1],fe.shape.length===3&&(j=fe.shape[2],N(j>0&&j<=4,"invalid number of channels"),D=!0),N(rt>=0&&rt<=W.maxTextureSize,"invalid width"),N(Ft>=0&&Ft<=W.maxTextureSize,"invalid height")):("radius"in fe&&(rt=Ft=fe.radius,N(rt>=0&&rt<=W.maxTextureSize,"invalid radius")),"width"in fe&&(rt=fe.width,N(rt>=0&&rt<=W.maxTextureSize,"invalid width")),"height"in fe&&(Ft=fe.height,N(Ft>=0&&Ft<=W.maxTextureSize,"invalid height")),"channels"in fe&&(j=fe.channels,N(j>0&&j<=4,"invalid number of channels"),D=!0)),$.width=rt|0,$.height=Ft|0,$.channels=j|0;var q=!1;if("format"in fe){var ee=fe.format;N(F.webgl_depth_texture||!(ee==="depth"||ee==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),N.parameter(ee,Te,"invalid texture format");var ne=$.internalformat=Te[ee];$.format=ze[ne],ee in Xe&&("type"in fe||($.type=Xe[ee])),ee in Ge&&($.compressed=!0),q=!0}!D&&q?$.channels=Yn[$.format]:D&&!q?$.channels!==Rl[$.format]&&($.format=$.internalformat=Rl[$.channels]):q&&D&&N($.channels===Yn[$.format],"number of channels inconsistent with specified format")}}function Mt($){T.pixelStorei(eD,$.flipY),T.pixelStorei(tD,$.premultiplyAlpha),T.pixelStorei(rD,$.colorSpace),T.pixelStorei(JL,$.unpackAlignment)}function We(){Me.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function Re($,fe){var oe=null;if(Rv(fe)?oe=fe:fe&&(N.type(fe,"object","invalid pixel data type"),ct($,fe),"x"in fe&&($.xOffset=fe.x|0),"y"in fe&&($.yOffset=fe.y|0),Rv(fe.data)&&(oe=fe.data)),N(!$.compressed||oe instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),fe.copy){N(!oe,"can not specify copy and data field for the same texture");var rt=be.viewportWidth,Ft=be.viewportHeight;$.width=$.width||rt-$.xOffset,$.height=$.height||Ft-$.yOffset,$.needsCopy=!0,N($.xOffset>=0&&$.xOffset<rt&&$.yOffset>=0&&$.yOffset<Ft&&$.width>0&&$.width<=rt&&$.height>0&&$.height<=Ft,"copy texture read out of bounds")}else if(!oe)$.width=$.width||1,$.height=$.height||1,$.channels=$.channels||4;else if(r(oe))$.channels=$.channels||4,$.data=oe,!("type"in fe)&&$.type===ss&&($.type=K1(oe));else if(Y1(oe))$.channels=$.channels||4,fD($,oe),$.alignment=1,$.needsFree=!0;else if(fa(oe)){var j=oe.data;!Array.isArray(j)&&$.type===ss&&($.type=K1(j));var D=oe.shape,q=oe.stride,ee,ne,K,H,Q,U;D.length===3?(K=D[2],U=q[2]):(N(D.length===2,"invalid ndarray pixel data, must be 2 or 3D"),K=1,U=1),ee=D[0],ne=D[1],H=q[0],Q=q[1],$.alignment=1,$.width=ee,$.height=ne,$.channels=K,$.format=$.internalformat=Rl[K],$.needsFree=!0,lD($,j,H,Q,U,oe.offset)}else if(H1(oe)||Z1(oe)||iD(oe))H1(oe)||Z1(oe)?$.element=oe:$.element=oe.canvas,$.width=$.element.width,$.height=$.element.height,$.channels=4;else if(oD(oe))$.element=oe,$.width=oe.width,$.height=oe.height,$.channels=4;else if(sD(oe))$.element=oe,$.width=oe.naturalWidth,$.height=oe.naturalHeight,$.channels=4;else if(uD(oe))$.element=oe,$.width=oe.videoWidth,$.height=oe.videoHeight,$.channels=4;else if(q1(oe)){var Y=$.width||oe[0].length,G=$.height||oe.length,J=$.channels;Mr(oe[0][0])?J=J||oe[0][0].length:J=J||1;for(var ae=Tl.shape(oe),ye=1,we=0;we<ae.length;++we)ye*=ae[we];var pe=Q1($,ye);Tl.flatten(oe,ae,"",pe),J1($,pe),$.alignment=1,$.width=Y,$.height=G,$.channels=J,$.format=$.internalformat=Rl[J],$.needsFree=!0}$.type===Iu?N(W.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):$.type===os&&N(W.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function xe($,fe,oe){var rt=$.element,Ft=$.data,j=$.internalformat,D=$.format,q=$.type,ee=$.width,ne=$.height;Mt($),rt?T.texImage2D(fe,oe,D,D,q,rt):$.compressed?T.compressedTexImage2D(fe,oe,j,ee,ne,0,Ft):$.needsCopy?(ue(),T.copyTexImage2D(fe,oe,D,$.xOffset,$.yOffset,ee,ne,0)):T.texImage2D(fe,oe,D,ee,ne,0,D,q,Ft||null)}function xt($,fe,oe,rt,Ft){var j=$.element,D=$.data,q=$.internalformat,ee=$.format,ne=$.type,K=$.width,H=$.height;Mt($),j?T.texSubImage2D(fe,Ft,oe,rt,ee,ne,j):$.compressed?T.compressedTexSubImage2D(fe,Ft,oe,rt,q,K,H,D):$.needsCopy?(ue(),T.copyTexSubImage2D(fe,Ft,oe,rt,$.xOffset,$.yOffset,K,H)):T.texSubImage2D(fe,Ft,oe,rt,K,H,ee,ne,D)}var It=[];function nt(){return It.pop()||new We}function Rt($){$.needsFree&>.freeType($.data),We.call($),It.push($)}function At(){Me.call(this),this.genMipmaps=!1,this.mipmapHint=Pl,this.mipmask=0,this.images=Array(16)}function Pt($,fe,oe){var rt=$.images[0]=nt();$.mipmask=1,rt.width=$.width=fe,rt.height=$.height=oe,rt.channels=$.channels=4}function Qt($,fe){var oe=null;if(Rv(fe))oe=$.images[0]=nt(),je(oe,$),Re(oe,fe),$.mipmask=1;else if(ct($,fe),Array.isArray(fe.mipmap))for(var rt=fe.mipmap,Ft=0;Ft<rt.length;++Ft)oe=$.images[Ft]=nt(),je(oe,$),oe.width>>=Ft,oe.height>>=Ft,Re(oe,rt[Ft]),$.mipmask|=1<<Ft;else oe=$.images[0]=nt(),je(oe,$),Re(oe,fe),$.mipmask=1;je($,$.images[0]),$.compressed&&($.internalformat===Av||$.internalformat===Cv||$.internalformat===Tv||$.internalformat===Iv)&&N($.width%4===0&&$.height%4===0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function Nr($,fe){for(var oe=$.images,rt=0;rt<oe.length;++rt){if(!oe[rt])return;xe(oe[rt],fe,rt)}}var $r=[];function zt(){var $=$r.pop()||new At;Me.call($),$.mipmask=0;for(var fe=0;fe<16;++fe)$.images[fe]=null;return $}function Gr($){for(var fe=$.images,oe=0;oe<fe.length;++oe)fe[oe]&&Rt(fe[oe]),fe[oe]=null;$r.push($)}function pr(){this.minFilter=Lv,this.magFilter=Lv,this.wrapS=Ov,this.wrapT=Ov,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=Pl}function Or($,fe){if("min"in fe){var oe=fe.min;N.parameter(oe,Oe),$.minFilter=Oe[oe],nD.indexOf($.minFilter)>=0&&!("faces"in fe)&&($.genMipmaps=!0)}if("mag"in fe){var rt=fe.mag;N.parameter(rt,Pe),$.magFilter=Pe[rt]}var Ft=$.wrapS,j=$.wrapT;if("wrap"in fe){var D=fe.wrap;typeof D=="string"?(N.parameter(D,Ne),Ft=j=Ne[D]):Array.isArray(D)&&(N.parameter(D[0],Ne),N.parameter(D[1],Ne),Ft=Ne[D[0]],j=Ne[D[1]])}else{if("wrapS"in fe){var q=fe.wrapS;N.parameter(q,Ne),Ft=Ne[q]}if("wrapT"in fe){var ee=fe.wrapT;N.parameter(ee,Ne),j=Ne[ee]}}if($.wrapS=Ft,$.wrapT=j,"anisotropic"in fe){var ne=fe.anisotropic;N(typeof ne=="number"&&ne>=1&&ne<=W.maxAnisotropic,"aniso samples must be between 1 and "),$.anisotropic=fe.anisotropic}if("mipmap"in fe){var K=!1;switch(typeof fe.mipmap){case"string":N.parameter(fe.mipmap,Ce,"invalid mipmap hint"),$.mipmapHint=Ce[fe.mipmap],$.genMipmaps=!0,K=!0;break;case"boolean":K=$.genMipmaps=fe.mipmap;break;case"object":N(Array.isArray(fe.mipmap),"invalid mipmap type"),$.genMipmaps=!1,K=!0;break;default:N.raise("invalid mipmap type")}K&&!("min"in fe)&&($.minFilter=Dv)}}function zr($,fe){T.texParameteri(fe,YL,$.minFilter),T.texParameteri(fe,VL,$.magFilter),T.texParameteri(fe,UL,$.wrapS),T.texParameteri(fe,$L,$.wrapT),F.ext_texture_filter_anisotropic&&T.texParameteri(fe,QL,$.anisotropic),$.genMipmaps&&(T.hint(HL,$.mipmapHint),T.generateMipmap(fe))}var jr=0,Yr={},an=W.maxTextureUnits,Ar=Array(an).map(function(){return null});function kt($){Me.call(this),this.mipmask=0,this.internalformat=yo,this.id=jr++,this.refCount=1,this.target=$,this.texture=T.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new pr,de.profile&&(this.stats={size:0})}function on($){T.activeTexture(ku),T.bindTexture($.target,$.texture)}function ir(){var $=Ar[0];$?T.bindTexture($.target,$.texture):T.bindTexture(Ca,null)}function vt($){var fe=$.texture;N(fe,"must not double destroy texture");var oe=$.unit,rt=$.target;oe>=0&&(T.activeTexture(ku+oe),T.bindTexture(rt,null),Ar[oe]=null),T.deleteTexture(fe),$.texture=null,$.params=null,$.pixels=null,$.refCount=0,delete Yr[$.id],se.textureCount--}n(kt.prototype,{bind:function(){var $=this;$.bindCount+=1;var fe=$.unit;if(fe<0){for(var oe=0;oe<an;++oe){var rt=Ar[oe];if(rt){if(rt.bindCount>0)continue;rt.unit=-1}Ar[oe]=$,fe=oe;break}fe>=an&&N.raise("insufficient number of texture units"),de.profile&&se.maxTextureUnits<fe+1&&(se.maxTextureUnits=fe+1),$.unit=fe,T.activeTexture(ku+fe),T.bindTexture($.target,$.texture)}return fe},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&vt(this)}});function Gt($,fe){var oe=new kt(Ca);Yr[oe.id]=oe,se.textureCount++;function rt(D,q){var ee=oe.texInfo;pr.call(ee);var ne=zt();return typeof D=="number"?typeof q=="number"?Pt(ne,D|0,q|0):Pt(ne,D|0,D|0):D?(N.type(D,"object","invalid arguments to regl.texture"),Or(ee,D),Qt(ne,D)):Pt(ne,1,1),ee.genMipmaps&&(ne.mipmask=(ne.width<<1)-1),oe.mipmask=ne.mipmask,je(oe,ne),N.texture2D(ee,ne,W),oe.internalformat=ne.internalformat,rt.width=ne.width,rt.height=ne.height,on(oe),Nr(ne,Ca),zr(ee,Ca),ir(),Gr(ne),de.profile&&(oe.stats.size=Fl(oe.internalformat,oe.type,ne.width,ne.height,ee.genMipmaps,!1)),rt.format=De[oe.internalformat],rt.type=He[oe.type],rt.mag=Ee[ee.magFilter],rt.min=et[ee.minFilter],rt.wrapS=Ae[ee.wrapS],rt.wrapT=Ae[ee.wrapT],rt}function Ft(D,q,ee,ne){N(!!D,"must specify image data");var K=q|0,H=ee|0,Q=ne|0,U=nt();return je(U,oe),U.width=0,U.height=0,Re(U,D),U.width=U.width||(oe.width>>Q)-K,U.height=U.height||(oe.height>>Q)-H,N(oe.type===U.type&&oe.format===U.format&&oe.internalformat===U.internalformat,"incompatible format for texture.subimage"),N(K>=0&&H>=0&&K+U.width<=oe.width&&H+U.height<=oe.height,"texture.subimage write out of bounds"),N(oe.mipmask&1<<Q,"missing mipmap data"),N(U.data||U.element||U.needsCopy,"missing image data"),on(oe),xt(U,Ca,K,H,Q),ir(),Rt(U),rt}function j(D,q){var ee=D|0,ne=q|0||ee;if(ee===oe.width&&ne===oe.height)return rt;rt.width=oe.width=ee,rt.height=oe.height=ne,on(oe);for(var K=0;oe.mipmask>>K;++K){var H=ee>>K,Q=ne>>K;if(!H||!Q)break;T.texImage2D(Ca,K,oe.format,H,Q,0,oe.format,oe.type,null)}return ir(),de.profile&&(oe.stats.size=Fl(oe.internalformat,oe.type,ee,ne,!1,!1)),rt}return rt($,fe),rt.subimage=Ft,rt.resize=j,rt._reglType="texture2d",rt._texture=oe,de.profile&&(rt.stats=oe.stats),rt.destroy=function(){oe.decRef()},rt}function Vt($,fe,oe,rt,Ft,j){var D=new kt(wv);Yr[D.id]=D,se.cubeCount++;var q=new Array(6);function ee(H,Q,U,Y,G,J){var ae,ye=D.texInfo;for(pr.call(ye),ae=0;ae<6;++ae)q[ae]=zt();if(typeof H=="number"||!H){var we=H|0||1;for(ae=0;ae<6;++ae)Pt(q[ae],we,we)}else if(typeof H=="object")if(Q)Qt(q[0],H),Qt(q[1],Q),Qt(q[2],U),Qt(q[3],Y),Qt(q[4],G),Qt(q[5],J);else if(Or(ye,H),ct(D,H),"faces"in H){var pe=H.faces;for(N(Array.isArray(pe)&&pe.length===6,"cube faces must be a length 6 array"),ae=0;ae<6;++ae)N(typeof pe[ae]=="object"&&!!pe[ae],"invalid input for cube map face"),je(q[ae],D),Qt(q[ae],pe[ae])}else for(ae=0;ae<6;++ae)Qt(q[ae],H);else N.raise("invalid arguments to cube map");for(je(D,q[0]),W.npotTextureCube||N(C1(D.width)&&C1(D.height),"your browser does not support non power or two texture dimensions"),ye.genMipmaps?D.mipmask=(q[0].width<<1)-1:D.mipmask=q[0].mipmask,N.textureCube(D,ye,q,W),D.internalformat=q[0].internalformat,ee.width=q[0].width,ee.height=q[0].height,on(D),ae=0;ae<6;++ae)Nr(q[ae],Nl+ae);for(zr(ye,wv),ir(),de.profile&&(D.stats.size=Fl(D.internalformat,D.type,ee.width,ee.height,ye.genMipmaps,!0)),ee.format=De[D.internalformat],ee.type=He[D.type],ee.mag=Ee[ye.magFilter],ee.min=et[ye.minFilter],ee.wrapS=Ae[ye.wrapS],ee.wrapT=Ae[ye.wrapT],ae=0;ae<6;++ae)Gr(q[ae]);return ee}function ne(H,Q,U,Y,G){N(!!Q,"must specify image data"),N(typeof H=="number"&&H===(H|0)&&H>=0&&H<6,"invalid face");var J=U|0,ae=Y|0,ye=G|0,we=nt();return je(we,D),we.width=0,we.height=0,Re(we,Q),we.width=we.width||(D.width>>ye)-J,we.height=we.height||(D.height>>ye)-ae,N(D.type===we.type&&D.format===we.format&&D.internalformat===we.internalformat,"incompatible format for texture.subimage"),N(J>=0&&ae>=0&&J+we.width<=D.width&&ae+we.height<=D.height,"texture.subimage write out of bounds"),N(D.mipmask&1<<ye,"missing mipmap data"),N(we.data||we.element||we.needsCopy,"missing image data"),on(D),xt(we,Nl+H,J,ae,ye),ir(),Rt(we),ee}function K(H){var Q=H|0;if(Q!==D.width){ee.width=D.width=Q,ee.height=D.height=Q,on(D);for(var U=0;U<6;++U)for(var Y=0;D.mipmask>>Y;++Y)T.texImage2D(Nl+U,Y,D.format,Q>>Y,Q>>Y,0,D.format,D.type,null);return ir(),de.profile&&(D.stats.size=Fl(D.internalformat,D.type,ee.width,ee.height,!1,!0)),ee}}return ee($,fe,oe,rt,Ft,j),ee.subimage=ne,ee.resize=K,ee._reglType="textureCube",ee._texture=D,de.profile&&(ee.stats=D.stats),ee.destroy=function(){D.decRef()},ee}function Cr(){for(var $=0;$<an;++$)T.activeTexture(ku+$),T.bindTexture(Ca,null),Ar[$]=null;Pn(Yr).forEach(vt),se.cubeCount=0,se.textureCount=0}de.profile&&(se.getTotalTextureSize=function(){var $=0;return Object.keys(Yr).forEach(function(fe){$+=Yr[fe].stats.size}),$});function Ia(){for(var $=0;$<an;++$){var fe=Ar[$];fe&&(fe.bindCount=0,fe.unit=-1,Ar[$]=null)}Pn(Yr).forEach(function(oe){oe.texture=T.createTexture(),T.bindTexture(oe.target,oe.texture);for(var rt=0;rt<32;++rt)if(oe.mipmask&1<<rt)if(oe.target===Ca)T.texImage2D(Ca,rt,oe.internalformat,oe.width>>rt,oe.height>>rt,0,oe.internalformat,oe.type,null);else for(var Ft=0;Ft<6;++Ft)T.texImage2D(Nl+Ft,rt,oe.internalformat,oe.width>>rt,oe.height>>rt,0,oe.internalformat,oe.type,null);zr(oe.texInfo,oe.target)})}function Mo(){for(var $=0;$<an;++$){var fe=Ar[$];fe&&(fe.bindCount=0,fe.unit=-1,Ar[$]=null),T.activeTexture(ku+$),T.bindTexture(Ca,null),T.bindTexture(wv,null)}}return{create2D:Gt,createCube:Vt,clear:Cr,getTexture:function($){return null},restore:Ia,refresh:Mo}}var Ci=36161,Bl=32854,eb=32855,tb=36194,rb=33189,nb=36168,ab=34041,ib=35907,ob=34836,sb=34842,ub=34843,la=[];la[Bl]=2,la[eb]=2,la[tb]=2,la[rb]=2,la[nb]=1,la[ab]=4,la[ib]=4,la[ob]=16,la[sb]=8,la[ub]=6;function fb(T,F,W){return la[T]*F*W}var hD=function(T,F,W,ue,be){var se={rgba4:Bl,rgb565:tb,"rgb5 a1":eb,depth:rb,stencil:nb,"depth stencil":ab};F.ext_srgb&&(se.srgba=ib),F.ext_color_buffer_half_float&&(se.rgba16f=sb,se.rgb16f=ub),F.webgl_color_buffer_float&&(se.rgba32f=ob);var de=[];Object.keys(se).forEach(function(Te){var Ge=se[Te];de[Ge]=Te});var Ce=0,Ne={};function Pe(Te){this.id=Ce++,this.refCount=1,this.renderbuffer=Te,this.format=Bl,this.width=0,this.height=0,be.profile&&(this.stats={size:0})}Pe.prototype.decRef=function(){--this.refCount<=0&&Oe(this)};function Oe(Te){var Ge=Te.renderbuffer;N(Ge,"must not double destroy renderbuffer"),T.bindRenderbuffer(Ci,null),T.deleteRenderbuffer(Ge),Te.renderbuffer=null,Te.refCount=0,delete Ne[Te.id],ue.renderbufferCount--}function Be(Te,Ge){var re=new Pe(T.createRenderbuffer());Ne[re.id]=re,ue.renderbufferCount++;function ve(He,Ee){var et=0,Ae=0,ze=Bl;if(typeof He=="object"&&He){var Me=He;if("shape"in Me){var je=Me.shape;N(Array.isArray(je)&&je.length>=2,"invalid renderbuffer shape"),et=je[0]|0,Ae=je[1]|0}else"radius"in Me&&(et=Ae=Me.radius|0),"width"in Me&&(et=Me.width|0),"height"in Me&&(Ae=Me.height|0);"format"in Me&&(N.parameter(Me.format,se,"invalid renderbuffer format"),ze=se[Me.format])}else typeof He=="number"?(et=He|0,typeof Ee=="number"?Ae=Ee|0:Ae=et):He?N.raise("invalid arguments to renderbuffer constructor"):et=Ae=1;if(N(et>0&&Ae>0&&et<=W.maxRenderbufferSize&&Ae<=W.maxRenderbufferSize,"invalid renderbuffer size"),!(et===re.width&&Ae===re.height&&ze===re.format))return ve.width=re.width=et,ve.height=re.height=Ae,re.format=ze,T.bindRenderbuffer(Ci,re.renderbuffer),T.renderbufferStorage(Ci,ze,et,Ae),N(T.getError()===0,"invalid render buffer format"),be.profile&&(re.stats.size=fb(re.format,re.width,re.height)),ve.format=de[re.format],ve}function De(He,Ee){var et=He|0,Ae=Ee|0||et;return et===re.width&&Ae===re.height||(N(et>0&&Ae>0&&et<=W.maxRenderbufferSize&&Ae<=W.maxRenderbufferSize,"invalid renderbuffer size"),ve.width=re.width=et,ve.height=re.height=Ae,T.bindRenderbuffer(Ci,re.renderbuffer),T.renderbufferStorage(Ci,re.format,et,Ae),N(T.getError()===0,"invalid render buffer format"),be.profile&&(re.stats.size=fb(re.format,re.width,re.height))),ve}return ve(Te,Ge),ve.resize=De,ve._reglType="renderbuffer",ve._renderbuffer=re,be.profile&&(ve.stats=re.stats),ve.destroy=function(){re.decRef()},ve}be.profile&&(ue.getTotalRenderbufferSize=function(){var Te=0;return Object.keys(Ne).forEach(function(Ge){Te+=Ne[Ge].stats.size}),Te});function Xe(){Pn(Ne).forEach(function(Te){Te.renderbuffer=T.createRenderbuffer(),T.bindRenderbuffer(Ci,Te.renderbuffer),T.renderbufferStorage(Ci,Te.format,Te.width,Te.height)}),T.bindRenderbuffer(Ci,null)}return{create:Be,clear:function(){Pn(Ne).forEach(Oe)},restore:Xe}},ni=36160,Fv=36161,bo=3553,Gl=34069,lb=36064,cb=36096,hb=36128,db=33306,vb=36053,dD=36054,vD=36055,pD=36057,gD=36061,yD=36193,mD=5121,bD=5126,pb=6407,gb=6408,wD=6402,xD=[pb,gb],Bv=[];Bv[gb]=4,Bv[pb]=3;var zl=[];zl[mD]=1,zl[bD]=4,zl[yD]=2;var ED=32854,_D=32855,SD=36194,MD=33189,AD=36168,yb=34041,CD=35907,TD=34836,ID=34842,kD=34843,ND=[ED,_D,SD,CD,ID,kD,TD],ls={};ls[vb]="complete",ls[dD]="incomplete attachment",ls[pD]="incomplete dimensions",ls[vD]="incomplete, missing attachment",ls[gD]="unsupported";function OD(T,F,W,ue,be,se){var de={cur:null,next:null,dirty:!1,setFBO:null},Ce=["rgba"],Ne=["rgba4","rgb565","rgb5 a1"];F.ext_srgb&&Ne.push("srgba"),F.ext_color_buffer_half_float&&Ne.push("rgba16f","rgb16f"),F.webgl_color_buffer_float&&Ne.push("rgba32f");var Pe=["uint8"];F.oes_texture_half_float&&Pe.push("half float","float16"),F.oes_texture_float&&Pe.push("float","float32");function Oe(We,Re,xe){this.target=We,this.texture=Re,this.renderbuffer=xe;var xt=0,It=0;Re?(xt=Re.width,It=Re.height):xe&&(xt=xe.width,It=xe.height),this.width=xt,this.height=It}function Be(We){We&&(We.texture&&We.texture._texture.decRef(),We.renderbuffer&&We.renderbuffer._renderbuffer.decRef())}function Xe(We,Re,xe){if(We)if(We.texture){var xt=We.texture._texture,It=Math.max(1,xt.width),nt=Math.max(1,xt.height);N(It===Re&&nt===xe,"inconsistent width/height for supplied texture"),xt.refCount+=1}else{var Rt=We.renderbuffer._renderbuffer;N(Rt.width===Re&&Rt.height===xe,"inconsistent width/height for renderbuffer"),Rt.refCount+=1}}function Te(We,Re){Re&&(Re.texture?T.framebufferTexture2D(ni,We,Re.target,Re.texture._texture.texture,0):T.framebufferRenderbuffer(ni,We,Fv,Re.renderbuffer._renderbuffer.renderbuffer))}function Ge(We){var Re=bo,xe=null,xt=null,It=We;typeof We=="object"&&(It=We.data,"target"in We&&(Re=We.target|0)),N.type(It,"function","invalid attachment data");var nt=It._reglType;return nt==="texture2d"?(xe=It,N(Re===bo)):nt==="textureCube"?(xe=It,N(Re>=Gl&&Re<Gl+6,"invalid cube map target")):nt==="renderbuffer"?(xt=It,Re=Fv):N.raise("invalid regl object for attachment"),new Oe(Re,xe,xt)}function re(We,Re,xe,xt,It){if(xe){var nt=ue.create2D({width:We,height:Re,format:xt,type:It});return nt._texture.refCount=0,new Oe(bo,nt,null)}else{var Rt=be.create({width:We,height:Re,format:xt});return Rt._renderbuffer.refCount=0,new Oe(Fv,null,Rt)}}function ve(We){return We&&(We.texture||We.renderbuffer)}function De(We,Re,xe){We&&(We.texture?We.texture.resize(Re,xe):We.renderbuffer&&We.renderbuffer.resize(Re,xe),We.width=Re,We.height=xe)}var He=0,Ee={};function et(){this.id=He++,Ee[this.id]=this,this.framebuffer=T.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function Ae(We){We.colorAttachments.forEach(Be),Be(We.depthAttachment),Be(We.stencilAttachment),Be(We.depthStencilAttachment)}function ze(We){var Re=We.framebuffer;N(Re,"must not double destroy framebuffer"),T.deleteFramebuffer(Re),We.framebuffer=null,se.framebufferCount--,delete Ee[We.id]}function Me(We){var Re;T.bindFramebuffer(ni,We.framebuffer);var xe=We.colorAttachments;for(Re=0;Re<xe.length;++Re)Te(lb+Re,xe[Re]);for(Re=xe.length;Re<W.maxColorAttachments;++Re)T.framebufferTexture2D(ni,lb+Re,bo,null,0);T.framebufferTexture2D(ni,db,bo,null,0),T.framebufferTexture2D(ni,cb,bo,null,0),T.framebufferTexture2D(ni,hb,bo,null,0),Te(cb,We.depthAttachment),Te(hb,We.stencilAttachment),Te(db,We.depthStencilAttachment);var xt=T.checkFramebufferStatus(ni);!T.isContextLost()&&xt!==vb&&N.raise("framebuffer configuration not supported, status = "+ls[xt]),T.bindFramebuffer(ni,de.next?de.next.framebuffer:null),de.cur=de.next,T.getError()}function je(We,Re){var xe=new et;se.framebufferCount++;function xt(nt,Rt){var At;N(de.next!==xe,"can not update framebuffer which is currently in use");var Pt=0,Qt=0,Nr=!0,$r=!0,zt=null,Gr=!0,pr="rgba",Or="uint8",zr=1,jr=null,Yr=null,an=null,Ar=!1;if(typeof nt=="number")Pt=nt|0,Qt=Rt|0||Pt;else if(!nt)Pt=Qt=1;else{N.type(nt,"object","invalid arguments for framebuffer");var kt=nt;if("shape"in kt){var on=kt.shape;N(Array.isArray(on)&&on.length>=2,"invalid shape for framebuffer"),Pt=on[0],Qt=on[1]}else"radius"in kt&&(Pt=Qt=kt.radius),"width"in kt&&(Pt=kt.width),"height"in kt&&(Qt=kt.height);("color"in kt||"colors"in kt)&&(zt=kt.color||kt.colors,Array.isArray(zt)&&N(zt.length===1||F.webgl_draw_buffers,"multiple render targets not supported")),zt||("colorCount"in kt&&(zr=kt.colorCount|0,N(zr>0,"invalid color buffer count")),"colorTexture"in kt&&(Gr=!!kt.colorTexture,pr="rgba4"),"colorType"in kt&&(Or=kt.colorType,Gr?(N(F.oes_texture_float||!(Or==="float"||Or==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),N(F.oes_texture_half_float||!(Or==="half float"||Or==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):Or==="half float"||Or==="float16"?(N(F.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),pr="rgba16f"):(Or==="float"||Or==="float32")&&(N(F.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),pr="rgba32f"),N.oneOf(Or,Pe,"invalid color type")),"colorFormat"in kt&&(pr=kt.colorFormat,Ce.indexOf(pr)>=0?Gr=!0:Ne.indexOf(pr)>=0?Gr=!1:Gr?N.oneOf(kt.colorFormat,Ce,"invalid color format for texture"):N.oneOf(kt.colorFormat,Ne,"invalid color format for renderbuffer"))),("depthTexture"in kt||"depthStencilTexture"in kt)&&(Ar=!!(kt.depthTexture||kt.depthStencilTexture),N(!Ar||F.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in kt&&(typeof kt.depth=="boolean"?Nr=kt.depth:(jr=kt.depth,$r=!1)),"stencil"in kt&&(typeof kt.stencil=="boolean"?$r=kt.stencil:(Yr=kt.stencil,Nr=!1)),"depthStencil"in kt&&(typeof kt.depthStencil=="boolean"?Nr=$r=kt.depthStencil:(an=kt.depthStencil,Nr=!1,$r=!1))}var ir=null,vt=null,Gt=null,Vt=null;if(Array.isArray(zt))ir=zt.map(Ge);else if(zt)ir=[Ge(zt)];else for(ir=new Array(zr),At=0;At<zr;++At)ir[At]=re(Pt,Qt,Gr,pr,Or);N(F.webgl_draw_buffers||ir.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),N(ir.length<=W.maxColorAttachments,"too many color attachments, not supported"),Pt=Pt||ir[0].width,Qt=Qt||ir[0].height,jr?vt=Ge(jr):Nr&&!$r&&(vt=re(Pt,Qt,Ar,"depth","uint32")),Yr?Gt=Ge(Yr):$r&&!Nr&&(Gt=re(Pt,Qt,!1,"stencil","uint8")),an?Vt=Ge(an):!jr&&!Yr&&$r&&Nr&&(Vt=re(Pt,Qt,Ar,"depth stencil","depth stencil")),N(!!jr+!!Yr+!!an<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var Cr=null;for(At=0;At<ir.length;++At)if(Xe(ir[At],Pt,Qt),N(!ir[At]||ir[At].texture&&xD.indexOf(ir[At].texture._texture.format)>=0||ir[At].renderbuffer&&ND.indexOf(ir[At].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+At+" is invalid"),ir[At]&&ir[At].texture){var Ia=Bv[ir[At].texture._texture.format]*zl[ir[At].texture._texture.type];Cr===null?Cr=Ia:N(Cr===Ia,"all color attachments much have the same number of bits per pixel.")}return Xe(vt,Pt,Qt),N(!vt||vt.texture&&vt.texture._texture.format===wD||vt.renderbuffer&&vt.renderbuffer._renderbuffer.format===MD,"invalid depth attachment for framebuffer object"),Xe(Gt,Pt,Qt),N(!Gt||Gt.renderbuffer&&Gt.renderbuffer._renderbuffer.format===AD,"invalid stencil attachment for framebuffer object"),Xe(Vt,Pt,Qt),N(!Vt||Vt.texture&&Vt.texture._texture.format===yb||Vt.renderbuffer&&Vt.renderbuffer._renderbuffer.format===yb,"invalid depth-stencil attachment for framebuffer object"),Ae(xe),xe.width=Pt,xe.height=Qt,xe.colorAttachments=ir,xe.depthAttachment=vt,xe.stencilAttachment=Gt,xe.depthStencilAttachment=Vt,xt.color=ir.map(ve),xt.depth=ve(vt),xt.stencil=ve(Gt),xt.depthStencil=ve(Vt),xt.width=xe.width,xt.height=xe.height,Me(xe),xt}function It(nt,Rt){N(de.next!==xe,"can not resize a framebuffer which is currently in use");var At=Math.max(nt|0,1),Pt=Math.max(Rt|0||At,1);if(At===xe.width&&Pt===xe.height)return xt;for(var Qt=xe.colorAttachments,Nr=0;Nr<Qt.length;++Nr)De(Qt[Nr],At,Pt);return De(xe.depthAttachment,At,Pt),De(xe.stencilAttachment,At,Pt),De(xe.depthStencilAttachment,At,Pt),xe.width=xt.width=At,xe.height=xt.height=Pt,Me(xe),xt}return xt(We,Re),n(xt,{resize:It,_reglType:"framebuffer",_framebuffer:xe,destroy:function(){ze(xe),Ae(xe)},use:function(nt){de.setFBO({framebuffer:xt},nt)}})}function ct(We){var Re=Array(6);function xe(It){var nt;N(Re.indexOf(de.next)<0,"can not update framebuffer which is currently in use");var Rt={color:null},At=0,Pt=null,Qt="rgba",Nr="uint8",$r=1;if(typeof It=="number")At=It|0;else if(!It)At=1;else{N.type(It,"object","invalid arguments for framebuffer");var zt=It;if("shape"in zt){var Gr=zt.shape;N(Array.isArray(Gr)&&Gr.length>=2,"invalid shape for framebuffer"),N(Gr[0]===Gr[1],"cube framebuffer must be square"),At=Gr[0]}else"radius"in zt&&(At=zt.radius|0),"width"in zt?(At=zt.width|0,"height"in zt&&N(zt.height===At,"must be square")):"height"in zt&&(At=zt.height|0);("color"in zt||"colors"in zt)&&(Pt=zt.color||zt.colors,Array.isArray(Pt)&&N(Pt.length===1||F.webgl_draw_buffers,"multiple render targets not supported")),Pt||("colorCount"in zt&&($r=zt.colorCount|0,N($r>0,"invalid color buffer count")),"colorType"in zt&&(N.oneOf(zt.colorType,Pe,"invalid color type"),Nr=zt.colorType),"colorFormat"in zt&&(Qt=zt.colorFormat,N.oneOf(zt.colorFormat,Ce,"invalid color format for texture"))),"depth"in zt&&(Rt.depth=zt.depth),"stencil"in zt&&(Rt.stencil=zt.stencil),"depthStencil"in zt&&(Rt.depthStencil=zt.depthStencil)}var pr;if(Pt)if(Array.isArray(Pt))for(pr=[],nt=0;nt<Pt.length;++nt)pr[nt]=Pt[nt];else pr=[Pt];else{pr=Array($r);var Or={radius:At,format:Qt,type:Nr};for(nt=0;nt<$r;++nt)pr[nt]=ue.createCube(Or)}for(Rt.color=Array(pr.length),nt=0;nt<pr.length;++nt){var zr=pr[nt];N(typeof zr=="function"&&zr._reglType==="textureCube","invalid cube map"),At=At||zr.width,N(zr.width===At&&zr.height===At,"invalid cube map shape"),Rt.color[nt]={target:Gl,data:pr[nt]}}for(nt=0;nt<6;++nt){for(var jr=0;jr<pr.length;++jr)Rt.color[jr].target=Gl+nt;nt>0&&(Rt.depth=Re[0].depth,Rt.stencil=Re[0].stencil,Rt.depthStencil=Re[0].depthStencil),Re[nt]?Re[nt](Rt):Re[nt]=je(Rt)}return n(xe,{width:At,height:At,color:pr})}function xt(It){var nt,Rt=It|0;if(N(Rt>0&&Rt<=W.maxCubeMapSize,"invalid radius for cube fbo"),Rt===xe.width)return xe;var At=xe.color;for(nt=0;nt<At.length;++nt)At[nt].resize(Rt);for(nt=0;nt<6;++nt)Re[nt].resize(Rt);return xe.width=xe.height=Rt,xe}return xe(We),n(xe,{faces:Re,resize:xt,_reglType:"framebufferCube",destroy:function(){Re.forEach(function(It){It.destroy()})}})}function Mt(){de.cur=null,de.next=null,de.dirty=!0,Pn(Ee).forEach(function(We){We.framebuffer=T.createFramebuffer(),Me(We)})}return n(de,{getFramebuffer:function(We){if(typeof We=="function"&&We._reglType==="framebuffer"){var Re=We._framebuffer;if(Re instanceof et)return Re}return null},create:je,createCube:ct,clear:function(){Pn(Ee).forEach(ze)},restore:Mt})}var LD=5126,mb=34962;function Gv(){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=LD,this.offset=0,this.stride=0,this.divisor=0}function DD(T,F,W,ue,be){for(var se=W.maxAttributes,de=new Array(se),Ce=0;Ce<se;++Ce)de[Ce]=new Gv;var Ne=0,Pe={},Oe={Record:Gv,scope:{},state:de,currentVAO:null,targetVAO:null,restore:Xe()?Ee:function(){},createVAO:et,getVAO:Ge,destroyBuffer:Be,setVAO:Xe()?re:ve,clear:Xe()?De:function(){}};function Be(Ae){for(var ze=0;ze<de.length;++ze){var Me=de[ze];Me.buffer===Ae&&(T.disableVertexAttribArray(ze),Me.buffer=null)}}function Xe(){return F.oes_vertex_array_object}function Te(){return F.angle_instanced_arrays}function Ge(Ae){return typeof Ae=="function"&&Ae._vao?Ae._vao:null}function re(Ae){if(Ae!==Oe.currentVAO){var ze=Xe();Ae?ze.bindVertexArrayOES(Ae.vao):ze.bindVertexArrayOES(null),Oe.currentVAO=Ae}}function ve(Ae){if(Ae!==Oe.currentVAO){if(Ae)Ae.bindAttrs();else for(var ze=Te(),Me=0;Me<de.length;++Me){var je=de[Me];je.buffer?(T.enableVertexAttribArray(Me),T.vertexAttribPointer(Me,je.size,je.type,je.normalized,je.stride,je.offfset),ze&&je.divisor&&ze.vertexAttribDivisorANGLE(Me,je.divisor)):(T.disableVertexAttribArray(Me),T.vertexAttrib4f(Me,je.x,je.y,je.z,je.w))}Oe.currentVAO=Ae}}function De(){Pn(Pe).forEach(function(Ae){Ae.destroy()})}function He(){this.id=++Ne,this.attributes=[];var Ae=Xe();Ae?this.vao=Ae.createVertexArrayOES():this.vao=null,Pe[this.id]=this,this.buffers=[]}He.prototype.bindAttrs=function(){for(var Ae=Te(),ze=this.attributes,Me=0;Me<ze.length;++Me){var je=ze[Me];je.buffer?(T.enableVertexAttribArray(Me),T.bindBuffer(mb,je.buffer.buffer),T.vertexAttribPointer(Me,je.size,je.type,je.normalized,je.stride,je.offset),Ae&&je.divisor&&Ae.vertexAttribDivisorANGLE(Me,je.divisor)):(T.disableVertexAttribArray(Me),T.vertexAttrib4f(Me,je.x,je.y,je.z,je.w))}for(var ct=ze.length;ct<se;++ct)T.disableVertexAttribArray(ct)},He.prototype.refresh=function(){var Ae=Xe();Ae&&(Ae.bindVertexArrayOES(this.vao),this.bindAttrs(),Oe.currentVAO=this)},He.prototype.destroy=function(){if(this.vao){var Ae=Xe();this===Oe.currentVAO&&(Oe.currentVAO=null,Ae.bindVertexArrayOES(null)),Ae.deleteVertexArrayOES(this.vao),this.vao=null}Pe[this.id]&&(delete Pe[this.id],ue.vaoCount-=1)};function Ee(){var Ae=Xe();Ae&&Pn(Pe).forEach(function(ze){ze.refresh()})}function et(Ae){var ze=new He;ue.vaoCount+=1;function Me(je){N(Array.isArray(je),"arguments to vertex array constructor must be an array"),N(je.length<se,"too many attributes"),N(je.length>0,"must specify at least one attribute");var ct={},Mt=ze.attributes;Mt.length=je.length;for(var We=0;We<je.length;++We){var Re=je[We],xe=Mt[We]=new Gv,xt=Re.data||Re;if(Array.isArray(xt)||r(xt)||fa(xt)){var It;ze.buffers[We]&&(It=ze.buffers[We],r(xt)&&It._buffer.byteLength>=xt.byteLength?It.subdata(xt):(It.destroy(),ze.buffers[We]=null)),ze.buffers[We]||(It=ze.buffers[We]=be.create(Re,mb,!1,!0)),xe.buffer=be.getBuffer(It),xe.size=xe.buffer.dimension|0,xe.normalized=!1,xe.type=xe.buffer.dtype,xe.offset=0,xe.stride=0,xe.divisor=0,xe.state=1,ct[We]=1}else be.getBuffer(Re)?(xe.buffer=be.getBuffer(Re),xe.size=xe.buffer.dimension|0,xe.normalized=!1,xe.type=xe.buffer.dtype,xe.offset=0,xe.stride=0,xe.divisor=0,xe.state=1):be.getBuffer(Re.buffer)?(xe.buffer=be.getBuffer(Re.buffer),xe.size=(+Re.size||xe.buffer.dimension)|0,xe.normalized=!!Re.normalized||!1,"type"in Re?(N.parameter(Re.type,po,"invalid buffer type"),xe.type=po[Re.type]):xe.type=xe.buffer.dtype,xe.offset=(Re.offset||0)|0,xe.stride=(Re.stride||0)|0,xe.divisor=(Re.divisor||0)|0,xe.state=1,N(xe.size>=1&&xe.size<=4,"size must be between 1 and 4"),N(xe.offset>=0,"invalid offset"),N(xe.stride>=0&&xe.stride<=255,"stride must be between 0 and 255"),N(xe.divisor>=0,"divisor must be positive"),N(!xe.divisor||!!F.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in Re?(N(We>0,"first attribute must not be a constant"),xe.x=+Re.x||0,xe.y=+Re.y||0,xe.z=+Re.z||0,xe.w=+Re.w||0,xe.state=2):N(!1,"invalid attribute spec for location "+We)}for(var nt=0;nt<ze.buffers.length;++nt)!ct[nt]&&ze.buffers[nt]&&(ze.buffers[nt].destroy(),ze.buffers[nt]=null);return ze.refresh(),Me}return Me.destroy=function(){for(var je=0;je<ze.buffers.length;++je)ze.buffers[je]&&ze.buffers[je].destroy();ze.buffers.length=0,ze.destroy()},Me._vao=ze,Me._reglType="vao",Me(Ae)}return Oe}var bb=35632,PD=35633,RD=35718,FD=35721;function BD(T,F,W,ue){var be={},se={};function de(re,ve,De,He){this.name=re,this.id=ve,this.location=De,this.info=He}function Ce(re,ve){for(var De=0;De<re.length;++De)if(re[De].id===ve.id){re[De].location=ve.location;return}re.push(ve)}function Ne(re,ve,De){var He=re===bb?be:se,Ee=He[ve];if(!Ee){var et=F.str(ve);Ee=T.createShader(re),T.shaderSource(Ee,et),T.compileShader(Ee),N.shaderError(T,Ee,et,re,De),He[ve]=Ee}return Ee}var Pe={},Oe=[],Be=0;function Xe(re,ve){this.id=Be++,this.fragId=re,this.vertId=ve,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,ue.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function Te(re,ve,De){var He,Ee,et=Ne(bb,re.fragId),Ae=Ne(PD,re.vertId),ze=re.program=T.createProgram();if(T.attachShader(ze,et),T.attachShader(ze,Ae),De)for(He=0;He<De.length;++He){var Me=De[He];T.bindAttribLocation(ze,Me[0],Me[1])}T.linkProgram(ze),N.linkError(T,ze,F.str(re.fragId),F.str(re.vertId),ve);var je=T.getProgramParameter(ze,RD);ue.profile&&(re.stats.uniformsCount=je);var ct=re.uniforms;for(He=0;He<je;++He)if(Ee=T.getActiveUniform(ze,He),Ee)if(Ee.size>1)for(var Mt=0;Mt<Ee.size;++Mt){var We=Ee.name.replace("[0]","["+Mt+"]");Ce(ct,new de(We,F.id(We),T.getUniformLocation(ze,We),Ee))}else Ce(ct,new de(Ee.name,F.id(Ee.name),T.getUniformLocation(ze,Ee.name),Ee));var Re=T.getProgramParameter(ze,FD);ue.profile&&(re.stats.attributesCount=Re);var xe=re.attributes;for(He=0;He<Re;++He)Ee=T.getActiveAttrib(ze,He),Ee&&Ce(xe,new de(Ee.name,F.id(Ee.name),T.getAttribLocation(ze,Ee.name),Ee))}ue.profile&&(W.getMaxUniformsCount=function(){var re=0;return Oe.forEach(function(ve){ve.stats.uniformsCount>re&&(re=ve.stats.uniformsCount)}),re},W.getMaxAttributesCount=function(){var re=0;return Oe.forEach(function(ve){ve.stats.attributesCount>re&&(re=ve.stats.attributesCount)}),re});function Ge(){be={},se={};for(var re=0;re<Oe.length;++re)Te(Oe[re],null,Oe[re].attributes.map(function(ve){return[ve.location,ve.name]}))}return{clear:function(){var re=T.deleteShader.bind(T);Pn(be).forEach(re),be={},Pn(se).forEach(re),se={},Oe.forEach(function(ve){T.deleteProgram(ve.program)}),Oe.length=0,Pe={},W.shaderCount=0},program:function(re,ve,De,He){N.command(re>=0,"missing vertex shader",De),N.command(ve>=0,"missing fragment shader",De);var Ee=Pe[ve];Ee||(Ee=Pe[ve]={});var et=Ee[re];if(et&&(et.refCount++,!He))return et;var Ae=new Xe(ve,re);return W.shaderCount++,Te(Ae,De,He),et||(Ee[re]=Ae),Oe.push(Ae),n(Ae,{destroy:function(){if(Ae.refCount--,Ae.refCount<=0){T.deleteProgram(Ae.program);var ze=Oe.indexOf(Ae);Oe.splice(ze,1),W.shaderCount--}Ee[Ae.vertId].refCount<=0&&(T.deleteShader(se[Ae.vertId]),delete se[Ae.vertId],delete Pe[Ae.fragId][Ae.vertId]),Object.keys(Pe[Ae.fragId]).length||(T.deleteShader(be[Ae.fragId]),delete be[Ae.fragId],delete Pe[Ae.fragId])}})},restore:Ge,shader:Ne,frag:-1,vert:-1}}var GD=6408,Nu=5121,zD=3333,jl=5126;function jD(T,F,W,ue,be,se,de){function Ce(Oe){var Be;F.next===null?(N(be.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),Be=Nu):(N(F.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),Be=F.next.colorAttachments[0].texture._texture.type,se.oes_texture_float?(N(Be===Nu||Be===jl,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),Be===jl&&N(de.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):N(Be===Nu,"Reading from a framebuffer is only allowed for the type 'uint8'"));var Xe=0,Te=0,Ge=ue.framebufferWidth,re=ue.framebufferHeight,ve=null;r(Oe)?ve=Oe:Oe&&(N.type(Oe,"object","invalid arguments to regl.read()"),Xe=Oe.x|0,Te=Oe.y|0,N(Xe>=0&&Xe<ue.framebufferWidth,"invalid x offset for regl.read"),N(Te>=0&&Te<ue.framebufferHeight,"invalid y offset for regl.read"),Ge=(Oe.width||ue.framebufferWidth-Xe)|0,re=(Oe.height||ue.framebufferHeight-Te)|0,ve=Oe.data||null),ve&&(Be===Nu?N(ve instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):Be===jl&&N(ve instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),N(Ge>0&&Ge+Xe<=ue.framebufferWidth,"invalid width for read pixels"),N(re>0&&re+Te<=ue.framebufferHeight,"invalid height for read pixels"),W();var De=Ge*re*4;return ve||(Be===Nu?ve=new Uint8Array(De):Be===jl&&(ve=ve||new Float32Array(De))),N.isTypedArray(ve,"data buffer for regl.read() must be a typedarray"),N(ve.byteLength>=De,"data buffer for regl.read() too small"),T.pixelStorei(zD,4),T.readPixels(Xe,Te,Ge,re,GD,Be,ve),ve}function Ne(Oe){var Be;return F.setFBO({framebuffer:Oe.framebuffer},function(){Be=Ce(Oe)}),Be}function Pe(Oe){return!Oe||!("framebuffer"in Oe)?Ce(Oe):Ne(Oe)}return Pe}function cs(T){return Array.prototype.slice.call(T)}function hs(T){return cs(T).join("")}function UD(){var T=0,F=[],W=[];function ue(Be){for(var Xe=0;Xe<W.length;++Xe)if(W[Xe]===Be)return F[Xe];var Te="g"+T++;return F.push(Te),W.push(Be),Te}function be(){var Be=[];function Xe(){Be.push.apply(Be,cs(arguments))}var Te=[];function Ge(){var re="v"+T++;return Te.push(re),arguments.length>0&&(Be.push(re,"="),Be.push.apply(Be,cs(arguments)),Be.push(";")),re}return n(Xe,{def:Ge,toString:function(){return hs([Te.length>0?"var "+Te.join(",")+";":"",hs(Be)])}})}function se(){var Be=be(),Xe=be(),Te=Be.toString,Ge=Xe.toString;function re(ve,De){Xe(ve,De,"=",Be.def(ve,De),";")}return n(function(){Be.apply(Be,cs(arguments))},{def:Be.def,entry:Be,exit:Xe,save:re,set:function(ve,De,He){re(ve,De),Be(ve,De,"=",He,";")},toString:function(){return Te()+Ge()}})}function de(){var Be=hs(arguments),Xe=se(),Te=se(),Ge=Xe.toString,re=Te.toString;return n(Xe,{then:function(){return Xe.apply(Xe,cs(arguments)),this},else:function(){return Te.apply(Te,cs(arguments)),this},toString:function(){var ve=re();return ve&&(ve="else{"+ve+"}"),hs(["if(",Be,"){",Ge(),"}",ve])}})}var Ce=be(),Ne={};function Pe(Be,Xe){var Te=[];function Ge(){var Ee="a"+Te.length;return Te.push(Ee),Ee}Xe=Xe||0;for(var re=0;re<Xe;++re)Ge();var ve=se(),De=ve.toString,He=Ne[Be]=n(ve,{arg:Ge,toString:function(){return hs(["function(",Te.join(),"){",De(),"}"])}});return He}function Oe(){var Be=['"use strict";',Ce,"return {"];Object.keys(Ne).forEach(function(Ge){Be.push('"',Ge,'":',Ne[Ge].toString(),",")}),Be.push("}");var Xe=hs(Be).replace(/;/g,`;
|
||
`).replace(/}/g,`}
|
||
`).replace(/{/g,`{
|
||
`),Te=Function.apply(null,F.concat(Xe));return Te.apply(null,W)}return{global:Ce,link:ue,block:be,proc:Pe,scope:se,cond:de,compile:Oe}}var ds="xyzw".split(""),wb=5121,vs=1,zv=2,jv=0,Uv=1,$v=2,Xv=3,Ul=4,xb=5,Eb=6,_b="dither",Sb="blend.enable",Mb="blend.color",Wv="blend.equation",Vv="blend.func",Ab="depth.enable",Cb="depth.func",Tb="depth.range",Ib="depth.mask",Yv="colorMask",kb="cull.enable",Nb="cull.face",qv="frontFace",Hv="lineWidth",Ob="polygonOffset.enable",Zv="polygonOffset.offset",Lb="sample.alpha",Db="sample.enable",Kv="sample.coverage",Pb="stencil.enable",Rb="stencil.mask",Qv="stencil.func",Jv="stencil.opFront",Ou="stencil.opBack",Fb="scissor.enable",$l="scissor.box",ai="viewport",Lu="profile",wo="framebuffer",Du="vert",Pu="frag",xo="elements",Eo="primitive",_o="count",Xl="offset",Wl="instances",Ru="vao",ep="Width",tp="Height",ps=wo+ep,gs=wo+tp,$D=ai+ep,XD=ai+tp,Bb="drawingBuffer",Gb=Bb+ep,zb=Bb+tp,WD=[Vv,Wv,Qv,Jv,Ou,Kv,ai,$l,Zv],ys=34962,VD=34963,YD=35632,qD=35633,jb=3553,HD=34067,ZD=2884,KD=3042,QD=3024,JD=2960,eP=2929,tP=3089,rP=32823,nP=32926,aP=32928,rp=5126,Vl=35664,Yl=35665,ql=35666,np=5124,Hl=35667,Zl=35668,Kl=35669,ap=35670,Ql=35671,Jl=35672,ec=35673,Fu=35674,Bu=35675,Gu=35676,zu=35678,ju=35680,Ub=4,Uu=1028,So=1029,$b=2304,ip=2305,iP=32775,oP=32776,sP=519,Ti=7680,Xb=0,Wb=1,Vb=32774,uP=513,Yb=36160,fP=36064,Ta={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},qb=["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"],ms={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},Ii={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Hb={frag:YD,vert:qD},op={cw:$b,ccw:ip};function tc(T){return Array.isArray(T)||r(T)||fa(T)}function Zb(T){return T.sort(function(F,W){return F===ai?-1:W===ai?1:F<W?-1:1})}function En(T,F,W,ue){this.thisDep=T,this.contextDep=F,this.propDep=W,this.append=ue}function ki(T){return T&&!(T.thisDep||T.contextDep||T.propDep)}function kr(T){return new En(!1,!1,!1,T)}function Cn(T,F){var W=T.type;if(W===jv){var ue=T.data.length;return new En(!0,ue>=1,ue>=2,F)}else if(W===Ul){var be=T.data;return new En(be.thisDep,be.contextDep,be.propDep,F)}else{if(W===xb)return new En(!1,!1,!1,F);if(W===Eb){for(var se=!1,de=!1,Ce=!1,Ne=0;Ne<T.data.length;++Ne){var Pe=T.data[Ne];if(Pe.type===Uv)Ce=!0;else if(Pe.type===$v)de=!0;else if(Pe.type===Xv)se=!0;else if(Pe.type===jv){se=!0;var Oe=Pe.data;Oe>=1&&(de=!0),Oe>=2&&(Ce=!0)}else Pe.type===Ul&&(se=se||Pe.data.thisDep,de=de||Pe.data.contextDep,Ce=Ce||Pe.data.propDep)}return new En(se,de,Ce,F)}else return new En(W===Xv,W===$v,W===Uv,F)}}var Kb=new En(!1,!1,!1,function(){});function lP(T,F,W,ue,be,se,de,Ce,Ne,Pe,Oe,Be,Xe,Te,Ge){var re=Pe.Record,ve={add:32774,subtract:32778,"reverse subtract":32779};W.ext_blend_minmax&&(ve.min=iP,ve.max=oP);var De=W.angle_instanced_arrays,He=W.webgl_draw_buffers,Ee={dirty:!0,profile:Ge.profile},et={},Ae=[],ze={},Me={};function je(j){return j.replace(".","_")}function ct(j,D,q){var ee=je(j);Ae.push(j),et[ee]=Ee[ee]=!!q,ze[ee]=D}function Mt(j,D,q){var ee=je(j);Ae.push(j),Array.isArray(q)?(Ee[ee]=q.slice(),et[ee]=q.slice()):Ee[ee]=et[ee]=q,Me[ee]=D}ct(_b,QD),ct(Sb,KD),Mt(Mb,"blendColor",[0,0,0,0]),Mt(Wv,"blendEquationSeparate",[Vb,Vb]),Mt(Vv,"blendFuncSeparate",[Wb,Xb,Wb,Xb]),ct(Ab,eP,!0),Mt(Cb,"depthFunc",uP),Mt(Tb,"depthRange",[0,1]),Mt(Ib,"depthMask",!0),Mt(Yv,Yv,[!0,!0,!0,!0]),ct(kb,ZD),Mt(Nb,"cullFace",So),Mt(qv,qv,ip),Mt(Hv,Hv,1),ct(Ob,rP),Mt(Zv,"polygonOffset",[0,0]),ct(Lb,nP),ct(Db,aP),Mt(Kv,"sampleCoverage",[1,!1]),ct(Pb,JD),Mt(Rb,"stencilMask",-1),Mt(Qv,"stencilFunc",[sP,0,-1]),Mt(Jv,"stencilOpSeparate",[Uu,Ti,Ti,Ti]),Mt(Ou,"stencilOpSeparate",[So,Ti,Ti,Ti]),ct(Fb,tP),Mt($l,"scissor",[0,0,T.drawingBufferWidth,T.drawingBufferHeight]),Mt(ai,ai,[0,0,T.drawingBufferWidth,T.drawingBufferHeight]);var We={gl:T,context:Xe,strings:F,next:et,current:Ee,draw:Be,elements:se,buffer:be,shader:Oe,attributes:Pe.state,vao:Pe,uniforms:Ne,framebuffer:Ce,extensions:W,timer:Te,isBufferArgs:tc},Re={primTypes:ns,compareFuncs:ms,blendFuncs:Ta,blendEquations:ve,stencilOps:Ii,glTypes:po,orientationType:op};N.optional(function(){We.isArrayLike=Mr}),He&&(Re.backBuffer=[So],Re.drawBuffer=rn(ue.maxDrawbuffers,function(j){return j===0?[0]:rn(j,function(D){return fP+D})}));var xe=0;function xt(){var j=UD(),D=j.link,q=j.global;j.id=xe++,j.batchId="0";var ee=D(We),ne=j.shared={props:"a0"};Object.keys(We).forEach(function(Y){ne[Y]=q.def(ee,".",Y)}),N.optional(function(){j.CHECK=D(N),j.commandStr=N.guessCommand(),j.command=D(j.commandStr),j.assert=function(Y,G,J){Y("if(!(",G,"))",this.CHECK,".commandRaise(",D(J),",",this.command,");")},Re.invalidBlendCombinations=qb});var K=j.next={},H=j.current={};Object.keys(Me).forEach(function(Y){Array.isArray(Ee[Y])&&(K[Y]=q.def(ne.next,".",Y),H[Y]=q.def(ne.current,".",Y))});var Q=j.constants={};Object.keys(Re).forEach(function(Y){Q[Y]=q.def(JSON.stringify(Re[Y]))}),j.invoke=function(Y,G){switch(G.type){case jv:var J=["this",ne.context,ne.props,j.batchId];return Y.def(D(G.data),".call(",J.slice(0,Math.max(G.data.length+1,4)),")");case Uv:return Y.def(ne.props,G.data);case $v:return Y.def(ne.context,G.data);case Xv:return Y.def("this",G.data);case Ul:return G.data.append(j,Y),G.data.ref;case xb:return G.data.toString();case Eb:return G.data.map(function(ae){return j.invoke(Y,ae)})}},j.attribCache={};var U={};return j.scopeAttrib=function(Y){var G=F.id(Y);if(G in U)return U[G];var J=Pe.scope[G];J||(J=Pe.scope[G]=new re);var ae=U[G]=D(J);return ae},j}function It(j){var D=j.static,q=j.dynamic,ee;if(Lu in D){var ne=!!D[Lu];ee=kr(function(H,Q){return ne}),ee.enable=ne}else if(Lu in q){var K=q[Lu];ee=Cn(K,function(H,Q){return H.invoke(Q,K)})}return ee}function nt(j,D){var q=j.static,ee=j.dynamic;if(wo in q){var ne=q[wo];return ne?(ne=Ce.getFramebuffer(ne),N.command(ne,"invalid framebuffer object"),kr(function(H,Q){var U=H.link(ne),Y=H.shared;Q.set(Y.framebuffer,".next",U);var G=Y.context;return Q.set(G,"."+ps,U+".width"),Q.set(G,"."+gs,U+".height"),U})):kr(function(H,Q){var U=H.shared;Q.set(U.framebuffer,".next","null");var Y=U.context;return Q.set(Y,"."+ps,Y+"."+Gb),Q.set(Y,"."+gs,Y+"."+zb),"null"})}else if(wo in ee){var K=ee[wo];return Cn(K,function(H,Q){var U=H.invoke(Q,K),Y=H.shared,G=Y.framebuffer,J=Q.def(G,".getFramebuffer(",U,")");N.optional(function(){H.assert(Q,"!"+U+"||"+J,"invalid framebuffer object")}),Q.set(G,".next",J);var ae=Y.context;return Q.set(ae,"."+ps,J+"?"+J+".width:"+ae+"."+Gb),Q.set(ae,"."+gs,J+"?"+J+".height:"+ae+"."+zb),J})}else return null}function Rt(j,D,q){var ee=j.static,ne=j.dynamic;function K(U){if(U in ee){var Y=ee[U];N.commandType(Y,"object","invalid "+U,q.commandStr);var G=!0,J=Y.x|0,ae=Y.y|0,ye,we;return"width"in Y?(ye=Y.width|0,N.command(ye>=0,"invalid "+U,q.commandStr)):G=!1,"height"in Y?(we=Y.height|0,N.command(we>=0,"invalid "+U,q.commandStr)):G=!1,new En(!G&&D&&D.thisDep,!G&&D&&D.contextDep,!G&&D&&D.propDep,function(ut,Nt){var at=ut.shared.context,yt=ye;"width"in Y||(yt=Nt.def(at,".",ps,"-",J));var Ct=we;return"height"in Y||(Ct=Nt.def(at,".",gs,"-",ae)),[J,ae,yt,Ct]})}else if(U in ne){var pe=ne[U],Le=Cn(pe,function(ut,Nt){var at=ut.invoke(Nt,pe);N.optional(function(){ut.assert(Nt,at+"&&typeof "+at+'==="object"',"invalid "+U)});var yt=ut.shared.context,Ct=Nt.def(at,".x|0"),Jt=Nt.def(at,".y|0"),xr=Nt.def('"width" in ',at,"?",at,".width|0:","(",yt,".",ps,"-",Ct,")"),_n=Nt.def('"height" in ',at,"?",at,".height|0:","(",yt,".",gs,"-",Jt,")");return N.optional(function(){ut.assert(Nt,xr+">=0&&"+_n+">=0","invalid "+U)}),[Ct,Jt,xr,_n]});return D&&(Le.thisDep=Le.thisDep||D.thisDep,Le.contextDep=Le.contextDep||D.contextDep,Le.propDep=Le.propDep||D.propDep),Le}else return D?new En(D.thisDep,D.contextDep,D.propDep,function(ut,Nt){var at=ut.shared.context;return[0,0,Nt.def(at,".",ps),Nt.def(at,".",gs)]}):null}var H=K(ai);if(H){var Q=H;H=new En(H.thisDep,H.contextDep,H.propDep,function(U,Y){var G=Q.append(U,Y),J=U.shared.context;return Y.set(J,"."+$D,G[2]),Y.set(J,"."+XD,G[3]),G})}return{viewport:H,scissor_box:K($l)}}function At(j,D){var q=j.static,ee=typeof q[Pu]=="string"&&typeof q[Du]=="string";if(ee){if(Object.keys(D.dynamic).length>0)return null;var ne=D.static,K=Object.keys(ne);if(K.length>0&&typeof ne[K[0]]=="number"){for(var H=[],Q=0;Q<K.length;++Q)N(typeof ne[K[Q]]=="number","must specify all vertex attribute locations when using vaos"),H.push([ne[K[Q]]|0,K[Q]]);return H}}return null}function Pt(j,D,q){var ee=j.static,ne=j.dynamic;function K(G){if(G in ee){var J=F.id(ee[G]);N.optional(function(){Oe.shader(Hb[G],J,N.guessCommand())});var ae=kr(function(){return J});return ae.id=J,ae}else if(G in ne){var ye=ne[G];return Cn(ye,function(we,pe){var Le=we.invoke(pe,ye),ut=pe.def(we.shared.strings,".id(",Le,")");return N.optional(function(){pe(we.shared.shader,".shader(",Hb[G],",",ut,",",we.command,");")}),ut})}return null}var H=K(Pu),Q=K(Du),U=null,Y;return ki(H)&&ki(Q)?(U=Oe.program(Q.id,H.id,null,q),Y=kr(function(G,J){return G.link(U)})):Y=new En(H&&H.thisDep||Q&&Q.thisDep,H&&H.contextDep||Q&&Q.contextDep,H&&H.propDep||Q&&Q.propDep,function(G,J){var ae=G.shared.shader,ye;H?ye=H.append(G,J):ye=J.def(ae,".",Pu);var we;Q?we=Q.append(G,J):we=J.def(ae,".",Du);var pe=ae+".program("+we+","+ye;return N.optional(function(){pe+=","+G.command}),J.def(pe+")")}),{frag:H,vert:Q,progVar:Y,program:U}}function Qt(j,D){var q=j.static,ee=j.dynamic;function ne(){if(xo in q){var G=q[xo];tc(G)?G=se.getElements(se.create(G,!0)):G&&(G=se.getElements(G),N.command(G,"invalid elements",D.commandStr));var J=kr(function(ye,we){if(G){var pe=ye.link(G);return ye.ELEMENTS=pe,pe}return ye.ELEMENTS=null,null});return J.value=G,J}else if(xo in ee){var ae=ee[xo];return Cn(ae,function(ye,we){var pe=ye.shared,Le=pe.isBufferArgs,ut=pe.elements,Nt=ye.invoke(we,ae),at=we.def("null"),yt=we.def(Le,"(",Nt,")"),Ct=ye.cond(yt).then(at,"=",ut,".createStream(",Nt,");").else(at,"=",ut,".getElements(",Nt,");");return N.optional(function(){ye.assert(Ct.else,"!"+Nt+"||"+at,"invalid elements")}),we.entry(Ct),we.exit(ye.cond(yt).then(ut,".destroyStream(",at,");")),ye.ELEMENTS=at,at})}return null}var K=ne();function H(){if(Eo in q){var G=q[Eo];return N.commandParameter(G,ns,"invalid primitve",D.commandStr),kr(function(ae,ye){return ns[G]})}else if(Eo in ee){var J=ee[Eo];return Cn(J,function(ae,ye){var we=ae.constants.primTypes,pe=ae.invoke(ye,J);return N.optional(function(){ae.assert(ye,pe+" in "+we,"invalid primitive, must be one of "+Object.keys(ns))}),ye.def(we,"[",pe,"]")})}else if(K)return ki(K)?K.value?kr(function(ae,ye){return ye.def(ae.ELEMENTS,".primType")}):kr(function(){return Ub}):new En(K.thisDep,K.contextDep,K.propDep,function(ae,ye){var we=ae.ELEMENTS;return ye.def(we,"?",we,".primType:",Ub)});return null}function Q(G,J){if(G in q){var ae=q[G]|0;return N.command(!J||ae>=0,"invalid "+G,D.commandStr),kr(function(we,pe){return J&&(we.OFFSET=ae),ae})}else if(G in ee){var ye=ee[G];return Cn(ye,function(we,pe){var Le=we.invoke(pe,ye);return J&&(we.OFFSET=Le,N.optional(function(){we.assert(pe,Le+">=0","invalid "+G)})),Le})}else if(J&&K)return kr(function(we,pe){return we.OFFSET="0",0});return null}var U=Q(Xl,!0);function Y(){if(_o in q){var G=q[_o]|0;return N.command(typeof G=="number"&&G>=0,"invalid vertex count",D.commandStr),kr(function(){return G})}else if(_o in ee){var J=ee[_o];return Cn(J,function(we,pe){var Le=we.invoke(pe,J);return N.optional(function(){we.assert(pe,"typeof "+Le+'==="number"&&'+Le+">=0&&"+Le+"===("+Le+"|0)","invalid vertex count")}),Le})}else if(K)if(ki(K)){if(K)return U?new En(U.thisDep,U.contextDep,U.propDep,function(we,pe){var Le=pe.def(we.ELEMENTS,".vertCount-",we.OFFSET);return N.optional(function(){we.assert(pe,Le+">=0","invalid vertex offset/element buffer too small")}),Le}):kr(function(we,pe){return pe.def(we.ELEMENTS,".vertCount")});var ae=kr(function(){return-1});return N.optional(function(){ae.MISSING=!0}),ae}else{var ye=new En(K.thisDep||U.thisDep,K.contextDep||U.contextDep,K.propDep||U.propDep,function(we,pe){var Le=we.ELEMENTS;return we.OFFSET?pe.def(Le,"?",Le,".vertCount-",we.OFFSET,":-1"):pe.def(Le,"?",Le,".vertCount:-1")});return N.optional(function(){ye.DYNAMIC=!0}),ye}return null}return{elements:K,primitive:H(),count:Y(),instances:Q(Wl,!1),offset:U}}function Nr(j,D){var q=j.static,ee=j.dynamic,ne={};return Ae.forEach(function(K){var H=je(K);function Q(U,Y){if(K in q){var G=U(q[K]);ne[H]=kr(function(){return G})}else if(K in ee){var J=ee[K];ne[H]=Cn(J,function(ae,ye){return Y(ae,ye,ae.invoke(ye,J))})}}switch(K){case kb:case Sb:case _b:case Pb:case Ab:case Fb:case Ob:case Lb:case Db:case Ib:return Q(function(U){return N.commandType(U,"boolean",K,D.commandStr),U},function(U,Y,G){return N.optional(function(){U.assert(Y,"typeof "+G+'==="boolean"',"invalid flag "+K,U.commandStr)}),G});case Cb:return Q(function(U){return N.commandParameter(U,ms,"invalid "+K,D.commandStr),ms[U]},function(U,Y,G){var J=U.constants.compareFuncs;return N.optional(function(){U.assert(Y,G+" in "+J,"invalid "+K+", must be one of "+Object.keys(ms))}),Y.def(J,"[",G,"]")});case Tb:return Q(function(U){return N.command(Mr(U)&&U.length===2&&typeof U[0]=="number"&&typeof U[1]=="number"&&U[0]<=U[1],"depth range is 2d array",D.commandStr),U},function(U,Y,G){N.optional(function(){U.assert(Y,U.shared.isArrayLike+"("+G+")&&"+G+".length===2&&typeof "+G+'[0]==="number"&&typeof '+G+'[1]==="number"&&'+G+"[0]<="+G+"[1]","depth range must be a 2d array")});var J=Y.def("+",G,"[0]"),ae=Y.def("+",G,"[1]");return[J,ae]});case Vv:return Q(function(U){N.commandType(U,"object","blend.func",D.commandStr);var Y="srcRGB"in U?U.srcRGB:U.src,G="srcAlpha"in U?U.srcAlpha:U.src,J="dstRGB"in U?U.dstRGB:U.dst,ae="dstAlpha"in U?U.dstAlpha:U.dst;return N.commandParameter(Y,Ta,H+".srcRGB",D.commandStr),N.commandParameter(G,Ta,H+".srcAlpha",D.commandStr),N.commandParameter(J,Ta,H+".dstRGB",D.commandStr),N.commandParameter(ae,Ta,H+".dstAlpha",D.commandStr),N.command(qb.indexOf(Y+", "+J)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+Y+", "+J+")",D.commandStr),[Ta[Y],Ta[J],Ta[G],Ta[ae]]},function(U,Y,G){var J=U.constants.blendFuncs;N.optional(function(){U.assert(Y,G+"&&typeof "+G+'==="object"',"invalid blend func, must be an object")});function ae(at,yt){var Ct=Y.def('"',at,yt,'" in ',G,"?",G,".",at,yt,":",G,".",at);return N.optional(function(){U.assert(Y,Ct+" in "+J,"invalid "+K+"."+at+yt+", must be one of "+Object.keys(Ta))}),Ct}var ye=ae("src","RGB"),we=ae("dst","RGB");N.optional(function(){var at=U.constants.invalidBlendCombinations;U.assert(Y,at+".indexOf("+ye+'+", "+'+we+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var pe=Y.def(J,"[",ye,"]"),Le=Y.def(J,"[",ae("src","Alpha"),"]"),ut=Y.def(J,"[",we,"]"),Nt=Y.def(J,"[",ae("dst","Alpha"),"]");return[pe,ut,Le,Nt]});case Wv:return Q(function(U){if(typeof U=="string")return N.commandParameter(U,ve,"invalid "+K,D.commandStr),[ve[U],ve[U]];if(typeof U=="object")return N.commandParameter(U.rgb,ve,K+".rgb",D.commandStr),N.commandParameter(U.alpha,ve,K+".alpha",D.commandStr),[ve[U.rgb],ve[U.alpha]];N.commandRaise("invalid blend.equation",D.commandStr)},function(U,Y,G){var J=U.constants.blendEquations,ae=Y.def(),ye=Y.def(),we=U.cond("typeof ",G,'==="string"');return N.optional(function(){function pe(Le,ut,Nt){U.assert(Le,Nt+" in "+J,"invalid "+ut+", must be one of "+Object.keys(ve))}pe(we.then,K,G),U.assert(we.else,G+"&&typeof "+G+'==="object"',"invalid "+K),pe(we.else,K+".rgb",G+".rgb"),pe(we.else,K+".alpha",G+".alpha")}),we.then(ae,"=",ye,"=",J,"[",G,"];"),we.else(ae,"=",J,"[",G,".rgb];",ye,"=",J,"[",G,".alpha];"),Y(we),[ae,ye]});case Mb:return Q(function(U){return N.command(Mr(U)&&U.length===4,"blend.color must be a 4d array",D.commandStr),rn(4,function(Y){return+U[Y]})},function(U,Y,G){return N.optional(function(){U.assert(Y,U.shared.isArrayLike+"("+G+")&&"+G+".length===4","blend.color must be a 4d array")}),rn(4,function(J){return Y.def("+",G,"[",J,"]")})});case Rb:return Q(function(U){return N.commandType(U,"number",H,D.commandStr),U|0},function(U,Y,G){return N.optional(function(){U.assert(Y,"typeof "+G+'==="number"',"invalid stencil.mask")}),Y.def(G,"|0")});case Qv:return Q(function(U){N.commandType(U,"object",H,D.commandStr);var Y=U.cmp||"keep",G=U.ref||0,J="mask"in U?U.mask:-1;return N.commandParameter(Y,ms,K+".cmp",D.commandStr),N.commandType(G,"number",K+".ref",D.commandStr),N.commandType(J,"number",K+".mask",D.commandStr),[ms[Y],G,J]},function(U,Y,G){var J=U.constants.compareFuncs;N.optional(function(){function pe(){U.assert(Y,Array.prototype.join.call(arguments,""),"invalid stencil.func")}pe(G+"&&typeof ",G,'==="object"'),pe('!("cmp" in ',G,")||(",G,".cmp in ",J,")")});var ae=Y.def('"cmp" in ',G,"?",J,"[",G,".cmp]",":",Ti),ye=Y.def(G,".ref|0"),we=Y.def('"mask" in ',G,"?",G,".mask|0:-1");return[ae,ye,we]});case Jv:case Ou:return Q(function(U){N.commandType(U,"object",H,D.commandStr);var Y=U.fail||"keep",G=U.zfail||"keep",J=U.zpass||"keep";return N.commandParameter(Y,Ii,K+".fail",D.commandStr),N.commandParameter(G,Ii,K+".zfail",D.commandStr),N.commandParameter(J,Ii,K+".zpass",D.commandStr),[K===Ou?So:Uu,Ii[Y],Ii[G],Ii[J]]},function(U,Y,G){var J=U.constants.stencilOps;N.optional(function(){U.assert(Y,G+"&&typeof "+G+'==="object"',"invalid "+K)});function ae(ye){return N.optional(function(){U.assert(Y,'!("'+ye+'" in '+G+")||("+G+"."+ye+" in "+J+")","invalid "+K+"."+ye+", must be one of "+Object.keys(Ii))}),Y.def('"',ye,'" in ',G,"?",J,"[",G,".",ye,"]:",Ti)}return[K===Ou?So:Uu,ae("fail"),ae("zfail"),ae("zpass")]});case Zv:return Q(function(U){N.commandType(U,"object",H,D.commandStr);var Y=U.factor|0,G=U.units|0;return N.commandType(Y,"number",H+".factor",D.commandStr),N.commandType(G,"number",H+".units",D.commandStr),[Y,G]},function(U,Y,G){N.optional(function(){U.assert(Y,G+"&&typeof "+G+'==="object"',"invalid "+K)});var J=Y.def(G,".factor|0"),ae=Y.def(G,".units|0");return[J,ae]});case Nb:return Q(function(U){var Y=0;return U==="front"?Y=Uu:U==="back"&&(Y=So),N.command(!!Y,H,D.commandStr),Y},function(U,Y,G){return N.optional(function(){U.assert(Y,G+'==="front"||'+G+'==="back"',"invalid cull.face")}),Y.def(G,'==="front"?',Uu,":",So)});case Hv:return Q(function(U){return N.command(typeof U=="number"&&U>=ue.lineWidthDims[0]&&U<=ue.lineWidthDims[1],"invalid line width, must be a positive number between "+ue.lineWidthDims[0]+" and "+ue.lineWidthDims[1],D.commandStr),U},function(U,Y,G){return N.optional(function(){U.assert(Y,"typeof "+G+'==="number"&&'+G+">="+ue.lineWidthDims[0]+"&&"+G+"<="+ue.lineWidthDims[1],"invalid line width")}),G});case qv:return Q(function(U){return N.commandParameter(U,op,H,D.commandStr),op[U]},function(U,Y,G){return N.optional(function(){U.assert(Y,G+'==="cw"||'+G+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),Y.def(G+'==="cw"?'+$b+":"+ip)});case Yv:return Q(function(U){return N.command(Mr(U)&&U.length===4,"color.mask must be length 4 array",D.commandStr),U.map(function(Y){return!!Y})},function(U,Y,G){return N.optional(function(){U.assert(Y,U.shared.isArrayLike+"("+G+")&&"+G+".length===4","invalid color.mask")}),rn(4,function(J){return"!!"+G+"["+J+"]"})});case Kv:return Q(function(U){N.command(typeof U=="object"&&U,H,D.commandStr);var Y="value"in U?U.value:1,G=!!U.invert;return N.command(typeof Y=="number"&&Y>=0&&Y<=1,"sample.coverage.value must be a number between 0 and 1",D.commandStr),[Y,G]},function(U,Y,G){N.optional(function(){U.assert(Y,G+"&&typeof "+G+'==="object"',"invalid sample.coverage")});var J=Y.def('"value" in ',G,"?+",G,".value:1"),ae=Y.def("!!",G,".invert");return[J,ae]})}}),ne}function $r(j,D){var q=j.static,ee=j.dynamic,ne={};return Object.keys(q).forEach(function(K){var H=q[K],Q;if(typeof H=="number"||typeof H=="boolean")Q=kr(function(){return H});else if(typeof H=="function"){var U=H._reglType;U==="texture2d"||U==="textureCube"?Q=kr(function(Y){return Y.link(H)}):U==="framebuffer"||U==="framebufferCube"?(N.command(H.color.length>0,'missing color attachment for framebuffer sent to uniform "'+K+'"',D.commandStr),Q=kr(function(Y){return Y.link(H.color[0])})):N.commandRaise('invalid data for uniform "'+K+'"',D.commandStr)}else Mr(H)?Q=kr(function(Y){var G=Y.global.def("[",rn(H.length,function(J){return N.command(typeof H[J]=="number"||typeof H[J]=="boolean","invalid uniform "+K,Y.commandStr),H[J]}),"]");return G}):N.commandRaise('invalid or missing data for uniform "'+K+'"',D.commandStr);Q.value=H,ne[K]=Q}),Object.keys(ee).forEach(function(K){var H=ee[K];ne[K]=Cn(H,function(Q,U){return Q.invoke(U,H)})}),ne}function zt(j,D){var q=j.static,ee=j.dynamic,ne={};return Object.keys(q).forEach(function(K){var H=q[K],Q=F.id(K),U=new re;if(tc(H))U.state=vs,U.buffer=be.getBuffer(be.create(H,ys,!1,!0)),U.type=0;else{var Y=be.getBuffer(H);if(Y)U.state=vs,U.buffer=Y,U.type=0;else if(N.command(typeof H=="object"&&H,"invalid data for attribute "+K,D.commandStr),"constant"in H){var G=H.constant;U.buffer="null",U.state=zv,typeof G=="number"?U.x=G:(N.command(Mr(G)&&G.length>0&&G.length<=4,"invalid constant for attribute "+K,D.commandStr),ds.forEach(function(ut,Nt){Nt<G.length&&(U[ut]=G[Nt])}))}else{tc(H.buffer)?Y=be.getBuffer(be.create(H.buffer,ys,!1,!0)):Y=be.getBuffer(H.buffer),N.command(!!Y,'missing buffer for attribute "'+K+'"',D.commandStr);var J=H.offset|0;N.command(J>=0,'invalid offset for attribute "'+K+'"',D.commandStr);var ae=H.stride|0;N.command(ae>=0&&ae<256,'invalid stride for attribute "'+K+'", must be integer betweeen [0, 255]',D.commandStr);var ye=H.size|0;N.command(!("size"in H)||ye>0&&ye<=4,'invalid size for attribute "'+K+'", must be 1,2,3,4',D.commandStr);var we=!!H.normalized,pe=0;"type"in H&&(N.commandParameter(H.type,po,"invalid type for attribute "+K,D.commandStr),pe=po[H.type]);var Le=H.divisor|0;"divisor"in H&&(N.command(Le===0||De,'cannot specify divisor for attribute "'+K+'", instancing not supported',D.commandStr),N.command(Le>=0,'invalid divisor for attribute "'+K+'"',D.commandStr)),N.optional(function(){var ut=D.commandStr,Nt=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(H).forEach(function(at){N.command(Nt.indexOf(at)>=0,'unknown parameter "'+at+'" for attribute pointer "'+K+'" (valid parameters are '+Nt+")",ut)})}),U.buffer=Y,U.state=vs,U.size=ye,U.normalized=we,U.type=pe||Y.dtype,U.offset=J,U.stride=ae,U.divisor=Le}}ne[K]=kr(function(ut,Nt){var at=ut.attribCache;if(Q in at)return at[Q];var yt={isStream:!1};return Object.keys(U).forEach(function(Ct){yt[Ct]=U[Ct]}),U.buffer&&(yt.buffer=ut.link(U.buffer),yt.type=yt.type||yt.buffer+".dtype"),at[Q]=yt,yt})}),Object.keys(ee).forEach(function(K){var H=ee[K];function Q(U,Y){var G=U.invoke(Y,H),J=U.shared,ae=U.constants,ye=J.isBufferArgs,we=J.buffer;N.optional(function(){U.assert(Y,G+"&&(typeof "+G+'==="object"||typeof '+G+'==="function")&&('+ye+"("+G+")||"+we+".getBuffer("+G+")||"+we+".getBuffer("+G+".buffer)||"+ye+"("+G+'.buffer)||("constant" in '+G+"&&(typeof "+G+'.constant==="number"||'+J.isArrayLike+"("+G+".constant))))",'invalid dynamic attribute "'+K+'"')});var pe={isStream:Y.def(!1)},Le=new re;Le.state=vs,Object.keys(Le).forEach(function(yt){pe[yt]=Y.def(""+Le[yt])});var ut=pe.buffer,Nt=pe.type;Y("if(",ye,"(",G,")){",pe.isStream,"=true;",ut,"=",we,".createStream(",ys,",",G,");",Nt,"=",ut,".dtype;","}else{",ut,"=",we,".getBuffer(",G,");","if(",ut,"){",Nt,"=",ut,".dtype;",'}else if("constant" in ',G,"){",pe.state,"=",zv,";","if(typeof "+G+'.constant === "number"){',pe[ds[0]],"=",G,".constant;",ds.slice(1).map(function(yt){return pe[yt]}).join("="),"=0;","}else{",ds.map(function(yt,Ct){return pe[yt]+"="+G+".constant.length>"+Ct+"?"+G+".constant["+Ct+"]:0;"}).join(""),"}}else{","if(",ye,"(",G,".buffer)){",ut,"=",we,".createStream(",ys,",",G,".buffer);","}else{",ut,"=",we,".getBuffer(",G,".buffer);","}",Nt,'="type" in ',G,"?",ae.glTypes,"[",G,".type]:",ut,".dtype;",pe.normalized,"=!!",G,".normalized;");function at(yt){Y(pe[yt],"=",G,".",yt,"|0;")}return at("size"),at("offset"),at("stride"),at("divisor"),Y("}}"),Y.exit("if(",pe.isStream,"){",we,".destroyStream(",ut,");","}"),pe}ne[K]=Cn(H,Q)}),ne}function Gr(j,D){var q=j.static,ee=j.dynamic;if(Ru in q){var ne=q[Ru];return ne!==null&&Pe.getVAO(ne)===null&&(ne=Pe.createVAO(ne)),kr(function(H){return H.link(Pe.getVAO(ne))})}else if(Ru in ee){var K=ee[Ru];return Cn(K,function(H,Q){var U=H.invoke(Q,K);return Q.def(H.shared.vao+".getVAO("+U+")")})}return null}function pr(j){var D=j.static,q=j.dynamic,ee={};return Object.keys(D).forEach(function(ne){var K=D[ne];ee[ne]=kr(function(H,Q){return typeof K=="number"||typeof K=="boolean"?""+K:H.link(K)})}),Object.keys(q).forEach(function(ne){var K=q[ne];ee[ne]=Cn(K,function(H,Q){return H.invoke(Q,K)})}),ee}function Or(j,D,q,ee,ne){var K=j.static,H=j.dynamic;N.optional(function(){var at=[wo,Du,Pu,xo,Eo,Xl,_o,Wl,Lu,Ru].concat(Ae);function yt(Ct){Object.keys(Ct).forEach(function(Jt){N.command(at.indexOf(Jt)>=0,'unknown parameter "'+Jt+'"',ne.commandStr)})}yt(K),yt(H)});var Q=At(j,D),U=nt(j),Y=Rt(j,U,ne),G=Qt(j,ne),J=Nr(j,ne),ae=Pt(j,ne,Q);function ye(at){var yt=Y[at];yt&&(J[at]=yt)}ye(ai),ye(je($l));var we=Object.keys(J).length>0,pe={framebuffer:U,draw:G,shader:ae,state:J,dirty:we,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(pe.profile=It(j),pe.uniforms=$r(q,ne),pe.drawVAO=pe.scopeVAO=Gr(j),!pe.drawVAO&&ae.program&&!Q&&W.angle_instanced_arrays){var Le=!0,ut=ae.program.attributes.map(function(at){var yt=D.static[at];return Le=Le&&!!yt,yt});if(Le&&ut.length>0){var Nt=Pe.getVAO(Pe.createVAO(ut));pe.drawVAO=new En(null,null,null,function(at,yt){return at.link(Nt)}),pe.useVAO=!0}}return Q?pe.useVAO=!0:pe.attributes=zt(D,ne),pe.context=pr(ee),pe}function zr(j,D,q){var ee=j.shared,ne=ee.context,K=j.scope();Object.keys(q).forEach(function(H){D.save(ne,"."+H);var Q=q[H],U=Q.append(j,D);Array.isArray(U)?K(ne,".",H,"=[",U.join(),"];"):K(ne,".",H,"=",U,";")}),D(K)}function jr(j,D,q,ee){var ne=j.shared,K=ne.gl,H=ne.framebuffer,Q;He&&(Q=D.def(ne.extensions,".webgl_draw_buffers"));var U=j.constants,Y=U.drawBuffer,G=U.backBuffer,J;q?J=q.append(j,D):J=D.def(H,".next"),ee||D("if(",J,"!==",H,".cur){"),D("if(",J,"){",K,".bindFramebuffer(",Yb,",",J,".framebuffer);"),He&&D(Q,".drawBuffersWEBGL(",Y,"[",J,".colorAttachments.length]);"),D("}else{",K,".bindFramebuffer(",Yb,",null);"),He&&D(Q,".drawBuffersWEBGL(",G,");"),D("}",H,".cur=",J,";"),ee||D("}")}function Yr(j,D,q){var ee=j.shared,ne=ee.gl,K=j.current,H=j.next,Q=ee.current,U=ee.next,Y=j.cond(Q,".dirty");Ae.forEach(function(G){var J=je(G);if(!(J in q.state)){var ae,ye;if(J in H){ae=H[J],ye=K[J];var we=rn(Ee[J].length,function(Le){return Y.def(ae,"[",Le,"]")});Y(j.cond(we.map(function(Le,ut){return Le+"!=="+ye+"["+ut+"]"}).join("||")).then(ne,".",Me[J],"(",we,");",we.map(function(Le,ut){return ye+"["+ut+"]="+Le}).join(";"),";"))}else{ae=Y.def(U,".",J);var pe=j.cond(ae,"!==",Q,".",J);Y(pe),J in ze?pe(j.cond(ae).then(ne,".enable(",ze[J],");").else(ne,".disable(",ze[J],");"),Q,".",J,"=",ae,";"):pe(ne,".",Me[J],"(",ae,");",Q,".",J,"=",ae,";")}}}),Object.keys(q.state).length===0&&Y(Q,".dirty=false;"),D(Y)}function an(j,D,q,ee){var ne=j.shared,K=j.current,H=ne.current,Q=ne.gl;Zb(Object.keys(q)).forEach(function(U){var Y=q[U];if(!(ee&&!ee(Y))){var G=Y.append(j,D);if(ze[U]){var J=ze[U];ki(Y)?G?D(Q,".enable(",J,");"):D(Q,".disable(",J,");"):D(j.cond(G).then(Q,".enable(",J,");").else(Q,".disable(",J,");")),D(H,".",U,"=",G,";")}else if(Mr(G)){var ae=K[U];D(Q,".",Me[U],"(",G,");",G.map(function(ye,we){return ae+"["+we+"]="+ye}).join(";"),";")}else D(Q,".",Me[U],"(",G,");",H,".",U,"=",G,";")}})}function Ar(j,D){De&&(j.instancing=D.def(j.shared.extensions,".angle_instanced_arrays"))}function kt(j,D,q,ee,ne){var K=j.shared,H=j.stats,Q=K.current,U=K.timer,Y=q.profile;function G(){return typeof performance>"u"?"Date.now()":"performance.now()"}var J,ae;function ye(at){J=D.def(),at(J,"=",G(),";"),typeof ne=="string"?at(H,".count+=",ne,";"):at(H,".count++;"),Te&&(ee?(ae=D.def(),at(ae,"=",U,".getNumPendingQueries();")):at(U,".beginQuery(",H,");"))}function we(at){at(H,".cpuTime+=",G(),"-",J,";"),Te&&(ee?at(U,".pushScopeStats(",ae,",",U,".getNumPendingQueries(),",H,");"):at(U,".endQuery();"))}function pe(at){var yt=D.def(Q,".profile");D(Q,".profile=",at,";"),D.exit(Q,".profile=",yt,";")}var Le;if(Y){if(ki(Y)){Y.enable?(ye(D),we(D.exit),pe("true")):pe("false");return}Le=Y.append(j,D),pe(Le)}else Le=D.def(Q,".profile");var ut=j.block();ye(ut),D("if(",Le,"){",ut,"}");var Nt=j.block();we(Nt),D.exit("if(",Le,"){",Nt,"}")}function on(j,D,q,ee,ne){var K=j.shared;function H(U){switch(U){case Vl:case Hl:case Ql:return 2;case Yl:case Zl:case Jl:return 3;case ql:case Kl:case ec:return 4;default:return 1}}function Q(U,Y,G){var J=K.gl,ae=D.def(U,".location"),ye=D.def(K.attributes,"[",ae,"]"),we=G.state,pe=G.buffer,Le=[G.x,G.y,G.z,G.w],ut=["buffer","normalized","offset","stride"];function Nt(){D("if(!",ye,".buffer){",J,".enableVertexAttribArray(",ae,");}");var yt=G.type,Ct;if(G.size?Ct=D.def(G.size,"||",Y):Ct=Y,D("if(",ye,".type!==",yt,"||",ye,".size!==",Ct,"||",ut.map(function(xr){return ye+"."+xr+"!=="+G[xr]}).join("||"),"){",J,".bindBuffer(",ys,",",pe,".buffer);",J,".vertexAttribPointer(",[ae,Ct,yt,G.normalized,G.stride,G.offset],");",ye,".type=",yt,";",ye,".size=",Ct,";",ut.map(function(xr){return ye+"."+xr+"="+G[xr]+";"}).join(""),"}"),De){var Jt=G.divisor;D("if(",ye,".divisor!==",Jt,"){",j.instancing,".vertexAttribDivisorANGLE(",[ae,Jt],");",ye,".divisor=",Jt,";}")}}function at(){D("if(",ye,".buffer){",J,".disableVertexAttribArray(",ae,");",ye,".buffer=null;","}if(",ds.map(function(yt,Ct){return ye+"."+yt+"!=="+Le[Ct]}).join("||"),"){",J,".vertexAttrib4f(",ae,",",Le,");",ds.map(function(yt,Ct){return ye+"."+yt+"="+Le[Ct]+";"}).join(""),"}")}we===vs?Nt():we===zv?at():(D("if(",we,"===",vs,"){"),Nt(),D("}else{"),at(),D("}"))}ee.forEach(function(U){var Y=U.name,G=q.attributes[Y],J;if(G){if(!ne(G))return;J=G.append(j,D)}else{if(!ne(Kb))return;var ae=j.scopeAttrib(Y);N.optional(function(){j.assert(D,ae+".state","missing attribute "+Y)}),J={},Object.keys(new re).forEach(function(ye){J[ye]=D.def(ae,".",ye)})}Q(j.link(U),H(U.info.type),J)})}function ir(j,D,q,ee,ne){for(var K=j.shared,H=K.gl,Q,U=0;U<ee.length;++U){var Y=ee[U],G=Y.name,J=Y.info.type,ae=q.uniforms[G],ye=j.link(Y),we=ye+".location",pe;if(ae){if(!ne(ae))continue;if(ki(ae)){var Le=ae.value;if(N.command(Le!==null&&typeof Le<"u",'missing uniform "'+G+'"',j.commandStr),J===zu||J===ju){N.command(typeof Le=="function"&&(J===zu&&(Le._reglType==="texture2d"||Le._reglType==="framebuffer")||J===ju&&(Le._reglType==="textureCube"||Le._reglType==="framebufferCube")),"invalid texture for uniform "+G,j.commandStr);var ut=j.link(Le._texture||Le.color[0]._texture);D(H,".uniform1i(",we,",",ut+".bind());"),D.exit(ut,".unbind();")}else if(J===Fu||J===Bu||J===Gu){N.optional(function(){N.command(Mr(Le),"invalid matrix for uniform "+G,j.commandStr),N.command(J===Fu&&Le.length===4||J===Bu&&Le.length===9||J===Gu&&Le.length===16,"invalid length for matrix uniform "+G,j.commandStr)});var Nt=j.global.def("new Float32Array(["+Array.prototype.slice.call(Le)+"])"),at=2;J===Bu?at=3:J===Gu&&(at=4),D(H,".uniformMatrix",at,"fv(",we,",false,",Nt,");")}else{switch(J){case rp:N.commandType(Le,"number","uniform "+G,j.commandStr),Q="1f";break;case Vl:N.command(Mr(Le)&&Le.length===2,"uniform "+G,j.commandStr),Q="2f";break;case Yl:N.command(Mr(Le)&&Le.length===3,"uniform "+G,j.commandStr),Q="3f";break;case ql:N.command(Mr(Le)&&Le.length===4,"uniform "+G,j.commandStr),Q="4f";break;case ap:N.commandType(Le,"boolean","uniform "+G,j.commandStr),Q="1i";break;case np:N.commandType(Le,"number","uniform "+G,j.commandStr),Q="1i";break;case Ql:N.command(Mr(Le)&&Le.length===2,"uniform "+G,j.commandStr),Q="2i";break;case Hl:N.command(Mr(Le)&&Le.length===2,"uniform "+G,j.commandStr),Q="2i";break;case Jl:N.command(Mr(Le)&&Le.length===3,"uniform "+G,j.commandStr),Q="3i";break;case Zl:N.command(Mr(Le)&&Le.length===3,"uniform "+G,j.commandStr),Q="3i";break;case ec:N.command(Mr(Le)&&Le.length===4,"uniform "+G,j.commandStr),Q="4i";break;case Kl:N.command(Mr(Le)&&Le.length===4,"uniform "+G,j.commandStr),Q="4i";break}D(H,".uniform",Q,"(",we,",",Mr(Le)?Array.prototype.slice.call(Le):Le,");")}continue}else pe=ae.append(j,D)}else{if(!ne(Kb))continue;pe=D.def(K.uniforms,"[",F.id(G),"]")}J===zu?(N(!Array.isArray(pe),"must specify a scalar prop for textures"),D("if(",pe,"&&",pe,'._reglType==="framebuffer"){',pe,"=",pe,".color[0];","}")):J===ju&&(N(!Array.isArray(pe),"must specify a scalar prop for cube maps"),D("if(",pe,"&&",pe,'._reglType==="framebufferCube"){',pe,"=",pe,".color[0];","}")),N.optional(function(){function _n(ca,aw){j.assert(D,ca,'bad data or missing for uniform "'+G+'". '+aw)}function sp(ca){N(!Array.isArray(pe),"must not specify an array type for uniform"),_n("typeof "+pe+'==="'+ca+'"',"invalid type, expected "+ca)}function qn(ca,aw){Array.isArray(pe)?N(pe.length===ca,"must have length "+ca):_n(K.isArrayLike+"("+pe+")&&"+pe+".length==="+ca,"invalid vector, should have length "+ca,j.commandStr)}function nw(ca){N(!Array.isArray(pe),"must not specify a value type"),_n("typeof "+pe+'==="function"&&'+pe+'._reglType==="texture'+(ca===jb?"2d":"Cube")+'"',"invalid texture type",j.commandStr)}switch(J){case np:sp("number");break;case Hl:qn(2);break;case Zl:qn(3);break;case Kl:qn(4);break;case rp:sp("number");break;case Vl:qn(2);break;case Yl:qn(3);break;case ql:qn(4);break;case ap:sp("boolean");break;case Ql:qn(2);break;case Jl:qn(3);break;case ec:qn(4);break;case Fu:qn(4);break;case Bu:qn(9);break;case Gu:qn(16);break;case zu:nw(jb);break;case ju:nw(HD);break}});var yt=1;switch(J){case zu:case ju:var Ct=D.def(pe,"._texture");D(H,".uniform1i(",we,",",Ct,".bind());"),D.exit(Ct,".unbind();");continue;case np:case ap:Q="1i";break;case Hl:case Ql:Q="2i",yt=2;break;case Zl:case Jl:Q="3i",yt=3;break;case Kl:case ec:Q="4i",yt=4;break;case rp:Q="1f";break;case Vl:Q="2f",yt=2;break;case Yl:Q="3f",yt=3;break;case ql:Q="4f",yt=4;break;case Fu:Q="Matrix2fv";break;case Bu:Q="Matrix3fv";break;case Gu:Q="Matrix4fv";break}if(D(H,".uniform",Q,"(",we,","),Q.charAt(0)==="M"){var Jt=Math.pow(J-Fu+2,2),xr=j.global.def("new Float32Array(",Jt,")");Array.isArray(pe)?D("false,(",rn(Jt,function(_n){return xr+"["+_n+"]="+pe[_n]}),",",xr,")"):D("false,(Array.isArray(",pe,")||",pe," instanceof Float32Array)?",pe,":(",rn(Jt,function(_n){return xr+"["+_n+"]="+pe+"["+_n+"]"}),",",xr,")")}else yt>1?D(rn(yt,function(_n){return Array.isArray(pe)?pe[_n]:pe+"["+_n+"]"})):(N(!Array.isArray(pe),"uniform value must not be an array"),D(pe));D(");")}}function vt(j,D,q,ee){var ne=j.shared,K=ne.gl,H=ne.draw,Q=ee.draw;function U(){var Ct=Q.elements,Jt,xr=D;return Ct?((Ct.contextDep&&ee.contextDynamic||Ct.propDep)&&(xr=q),Jt=Ct.append(j,xr)):Jt=xr.def(H,".",xo),Jt&&xr("if("+Jt+")"+K+".bindBuffer("+VD+","+Jt+".buffer.buffer);"),Jt}function Y(){var Ct=Q.count,Jt,xr=D;return Ct?((Ct.contextDep&&ee.contextDynamic||Ct.propDep)&&(xr=q),Jt=Ct.append(j,xr),N.optional(function(){Ct.MISSING&&j.assert(D,"false","missing vertex count"),Ct.DYNAMIC&&j.assert(xr,Jt+">=0","missing vertex count")})):(Jt=xr.def(H,".",_o),N.optional(function(){j.assert(xr,Jt+">=0","missing vertex count")})),Jt}var G=U();function J(Ct){var Jt=Q[Ct];return Jt?Jt.contextDep&&ee.contextDynamic||Jt.propDep?Jt.append(j,q):Jt.append(j,D):D.def(H,".",Ct)}var ae=J(Eo),ye=J(Xl),we=Y();if(typeof we=="number"){if(we===0)return}else q("if(",we,"){"),q.exit("}");var pe,Le;De&&(pe=J(Wl),Le=j.instancing);var ut=G+".type",Nt=Q.elements&&ki(Q.elements);function at(){function Ct(){q(Le,".drawElementsInstancedANGLE(",[ae,we,ut,ye+"<<(("+ut+"-"+wb+")>>1)",pe],");")}function Jt(){q(Le,".drawArraysInstancedANGLE(",[ae,ye,we,pe],");")}G?Nt?Ct():(q("if(",G,"){"),Ct(),q("}else{"),Jt(),q("}")):Jt()}function yt(){function Ct(){q(K+".drawElements("+[ae,we,ut,ye+"<<(("+ut+"-"+wb+")>>1)"]+");")}function Jt(){q(K+".drawArrays("+[ae,ye,we]+");")}G?Nt?Ct():(q("if(",G,"){"),Ct(),q("}else{"),Jt(),q("}")):Jt()}De&&(typeof pe!="number"||pe>=0)?typeof pe=="string"?(q("if(",pe,">0){"),at(),q("}else if(",pe,"<0){"),yt(),q("}")):at():yt()}function Gt(j,D,q,ee,ne){var K=xt(),H=K.proc("body",ne);return N.optional(function(){K.commandStr=D.commandStr,K.command=K.link(D.commandStr)}),De&&(K.instancing=H.def(K.shared.extensions,".angle_instanced_arrays")),j(K,H,q,ee),K.compile().body}function Vt(j,D,q,ee){Ar(j,D),q.useVAO?q.drawVAO?D(j.shared.vao,".setVAO(",q.drawVAO.append(j,D),");"):D(j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"):(D(j.shared.vao,".setVAO(null);"),on(j,D,q,ee.attributes,function(){return!0})),ir(j,D,q,ee.uniforms,function(){return!0}),vt(j,D,D,q)}function Cr(j,D){var q=j.proc("draw",1);Ar(j,q),zr(j,q,D.context),jr(j,q,D.framebuffer),Yr(j,q,D),an(j,q,D.state),kt(j,q,D,!1,!0);var ee=D.shader.progVar.append(j,q);if(q(j.shared.gl,".useProgram(",ee,".program);"),D.shader.program)Vt(j,q,D,D.shader.program);else{q(j.shared.vao,".setVAO(null);");var ne=j.global.def("{}"),K=q.def(ee,".id"),H=q.def(ne,"[",K,"]");q(j.cond(H).then(H,".call(this,a0);").else(H,"=",ne,"[",K,"]=",j.link(function(Q){return Gt(Vt,j,D,Q,1)}),"(",ee,");",H,".call(this,a0);"))}Object.keys(D.state).length>0&&q(j.shared.current,".dirty=true;")}function Ia(j,D,q,ee){j.batchId="a1",Ar(j,D);function ne(){return!0}on(j,D,q,ee.attributes,ne),ir(j,D,q,ee.uniforms,ne),vt(j,D,D,q)}function Mo(j,D,q,ee){Ar(j,D);var ne=q.contextDep,K=D.def(),H="a0",Q="a1",U=D.def();j.shared.props=U,j.batchId=K;var Y=j.scope(),G=j.scope();D(Y.entry,"for(",K,"=0;",K,"<",Q,";++",K,"){",U,"=",H,"[",K,"];",G,"}",Y.exit);function J(ut){return ut.contextDep&&ne||ut.propDep}function ae(ut){return!J(ut)}if(q.needsContext&&zr(j,G,q.context),q.needsFramebuffer&&jr(j,G,q.framebuffer),an(j,G,q.state,J),q.profile&&J(q.profile)&&kt(j,G,q,!1,!0),ee)q.useVAO?q.drawVAO?J(q.drawVAO)?G(j.shared.vao,".setVAO(",q.drawVAO.append(j,G),");"):Y(j.shared.vao,".setVAO(",q.drawVAO.append(j,Y),");"):Y(j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"):(Y(j.shared.vao,".setVAO(null);"),on(j,Y,q,ee.attributes,ae),on(j,G,q,ee.attributes,J)),ir(j,Y,q,ee.uniforms,ae),ir(j,G,q,ee.uniforms,J),vt(j,Y,G,q);else{var ye=j.global.def("{}"),we=q.shader.progVar.append(j,G),pe=G.def(we,".id"),Le=G.def(ye,"[",pe,"]");G(j.shared.gl,".useProgram(",we,".program);","if(!",Le,"){",Le,"=",ye,"[",pe,"]=",j.link(function(ut){return Gt(Ia,j,q,ut,2)}),"(",we,");}",Le,".call(this,a0[",K,"],",K,");")}}function $(j,D){var q=j.proc("batch",2);j.batchId="0",Ar(j,q);var ee=!1,ne=!0;Object.keys(D.context).forEach(function(ye){ee=ee||D.context[ye].propDep}),ee||(zr(j,q,D.context),ne=!1);var K=D.framebuffer,H=!1;K?(K.propDep?ee=H=!0:K.contextDep&&ee&&(H=!0),H||jr(j,q,K)):jr(j,q,null),D.state.viewport&&D.state.viewport.propDep&&(ee=!0);function Q(ye){return ye.contextDep&&ee||ye.propDep}Yr(j,q,D),an(j,q,D.state,function(ye){return!Q(ye)}),(!D.profile||!Q(D.profile))&&kt(j,q,D,!1,"a1"),D.contextDep=ee,D.needsContext=ne,D.needsFramebuffer=H;var U=D.shader.progVar;if(U.contextDep&&ee||U.propDep)Mo(j,q,D,null);else{var Y=U.append(j,q);if(q(j.shared.gl,".useProgram(",Y,".program);"),D.shader.program)Mo(j,q,D,D.shader.program);else{q(j.shared.vao,".setVAO(null);");var G=j.global.def("{}"),J=q.def(Y,".id"),ae=q.def(G,"[",J,"]");q(j.cond(ae).then(ae,".call(this,a0,a1);").else(ae,"=",G,"[",J,"]=",j.link(function(ye){return Gt(Mo,j,D,ye,2)}),"(",Y,");",ae,".call(this,a0,a1);"))}}Object.keys(D.state).length>0&&q(j.shared.current,".dirty=true;")}function fe(j,D){var q=j.proc("scope",3);j.batchId="a2";var ee=j.shared,ne=ee.current;zr(j,q,D.context),D.framebuffer&&D.framebuffer.append(j,q),Zb(Object.keys(D.state)).forEach(function(H){var Q=D.state[H],U=Q.append(j,q);Mr(U)?U.forEach(function(Y,G){q.set(j.next[H],"["+G+"]",Y)}):q.set(ee.next,"."+H,U)}),kt(j,q,D,!0,!0),[xo,Xl,_o,Wl,Eo].forEach(function(H){var Q=D.draw[H];Q&&q.set(ee.draw,"."+H,""+Q.append(j,q))}),Object.keys(D.uniforms).forEach(function(H){var Q=D.uniforms[H].append(j,q);Array.isArray(Q)&&(Q="["+Q.join()+"]"),q.set(ee.uniforms,"["+F.id(H)+"]",Q)}),Object.keys(D.attributes).forEach(function(H){var Q=D.attributes[H].append(j,q),U=j.scopeAttrib(H);Object.keys(new re).forEach(function(Y){q.set(U,"."+Y,Q[Y])})}),D.scopeVAO&&q.set(ee.vao,".targetVAO",D.scopeVAO.append(j,q));function K(H){var Q=D.shader[H];Q&&q.set(ee.shader,"."+H,Q.append(j,q))}K(Du),K(Pu),Object.keys(D.state).length>0&&(q(ne,".dirty=true;"),q.exit(ne,".dirty=true;")),q("a1(",j.shared.context,",a0,",j.batchId,");")}function oe(j){if(!(typeof j!="object"||Mr(j))){for(var D=Object.keys(j),q=0;q<D.length;++q)if(fr.isDynamic(j[D[q]]))return!0;return!1}}function rt(j,D,q){var ee=D.static[q];if(!ee||!oe(ee))return;var ne=j.global,K=Object.keys(ee),H=!1,Q=!1,U=!1,Y=j.global.def("{}");K.forEach(function(J){var ae=ee[J];if(fr.isDynamic(ae)){typeof ae=="function"&&(ae=ee[J]=fr.unbox(ae));var ye=Cn(ae,null);H=H||ye.thisDep,U=U||ye.propDep,Q=Q||ye.contextDep}else{switch(ne(Y,".",J,"="),typeof ae){case"number":ne(ae);break;case"string":ne('"',ae,'"');break;case"object":Array.isArray(ae)&&ne("[",ae.join(),"]");break;default:ne(j.link(ae));break}ne(";")}});function G(J,ae){K.forEach(function(ye){var we=ee[ye];if(fr.isDynamic(we)){var pe=J.invoke(ae,we);ae(Y,".",ye,"=",pe,";")}})}D.dynamic[q]=new fr.DynamicVariable(Ul,{thisDep:H,contextDep:Q,propDep:U,ref:Y,append:G}),delete D.static[q]}function Ft(j,D,q,ee,ne){var K=xt();K.stats=K.link(ne),Object.keys(D.static).forEach(function(Q){rt(K,D,Q)}),WD.forEach(function(Q){rt(K,j,Q)});var H=Or(j,D,q,ee,K);return Cr(K,H),fe(K,H),$(K,H),n(K.compile(),{destroy:function(){H.shader.program.destroy()}})}return{next:et,current:Ee,procs:function(){var j=xt(),D=j.proc("poll"),q=j.proc("refresh"),ee=j.block();D(ee),q(ee);var ne=j.shared,K=ne.gl,H=ne.next,Q=ne.current;ee(Q,".dirty=false;"),jr(j,D),jr(j,q,null,!0);var U;De&&(U=j.link(De)),W.oes_vertex_array_object&&q(j.link(W.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var Y=0;Y<ue.maxAttributes;++Y){var G=q.def(ne.attributes,"[",Y,"]"),J=j.cond(G,".buffer");J.then(K,".enableVertexAttribArray(",Y,");",K,".bindBuffer(",ys,",",G,".buffer.buffer);",K,".vertexAttribPointer(",Y,",",G,".size,",G,".type,",G,".normalized,",G,".stride,",G,".offset);").else(K,".disableVertexAttribArray(",Y,");",K,".vertexAttrib4f(",Y,",",G,".x,",G,".y,",G,".z,",G,".w);",G,".buffer=null;"),q(J),De&&q(U,".vertexAttribDivisorANGLE(",Y,",",G,".divisor);")}return q(j.shared.vao,".currentVAO=null;",j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"),Object.keys(ze).forEach(function(ae){var ye=ze[ae],we=ee.def(H,".",ae),pe=j.block();pe("if(",we,"){",K,".enable(",ye,")}else{",K,".disable(",ye,")}",Q,".",ae,"=",we,";"),q(pe),D("if(",we,"!==",Q,".",ae,"){",pe,"}")}),Object.keys(Me).forEach(function(ae){var ye=Me[ae],we=Ee[ae],pe,Le,ut=j.block();if(ut(K,".",ye,"("),Mr(we)){var Nt=we.length;pe=j.global.def(H,".",ae),Le=j.global.def(Q,".",ae),ut(rn(Nt,function(at){return pe+"["+at+"]"}),");",rn(Nt,function(at){return Le+"["+at+"]="+pe+"["+at+"];"}).join("")),D("if(",rn(Nt,function(at){return pe+"["+at+"]!=="+Le+"["+at+"]"}).join("||"),"){",ut,"}")}else pe=ee.def(H,".",ae),Le=ee.def(Q,".",ae),ut(pe,");",Q,".",ae,"=",pe,";"),D("if(",pe,"!==",Le,"){",ut,"}");q(ut)}),j.compile()}(),compile:Ft}}function cP(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var hP=34918,dP=34919,Qb=35007,vP=function(T,F){if(!F.ext_disjoint_timer_query)return null;var W=[];function ue(){return W.pop()||F.ext_disjoint_timer_query.createQueryEXT()}function be(De){W.push(De)}var se=[];function de(De){var He=ue();F.ext_disjoint_timer_query.beginQueryEXT(Qb,He),se.push(He),Te(se.length-1,se.length,De)}function Ce(){F.ext_disjoint_timer_query.endQueryEXT(Qb)}function Ne(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var Pe=[];function Oe(){return Pe.pop()||new Ne}function Be(De){Pe.push(De)}var Xe=[];function Te(De,He,Ee){var et=Oe();et.startQueryIndex=De,et.endQueryIndex=He,et.sum=0,et.stats=Ee,Xe.push(et)}var Ge=[],re=[];function ve(){var De,He,Ee=se.length;if(Ee!==0){re.length=Math.max(re.length,Ee+1),Ge.length=Math.max(Ge.length,Ee+1),Ge[0]=0,re[0]=0;var et=0;for(De=0,He=0;He<se.length;++He){var Ae=se[He];F.ext_disjoint_timer_query.getQueryObjectEXT(Ae,dP)?(et+=F.ext_disjoint_timer_query.getQueryObjectEXT(Ae,hP),be(Ae)):se[De++]=Ae,Ge[He+1]=et,re[He+1]=De}for(se.length=De,De=0,He=0;He<Xe.length;++He){var ze=Xe[He],Me=ze.startQueryIndex,je=ze.endQueryIndex;ze.sum+=Ge[je]-Ge[Me];var ct=re[Me],Mt=re[je];Mt===ct?(ze.stats.gpuTime+=ze.sum/1e6,Be(ze)):(ze.startQueryIndex=ct,ze.endQueryIndex=Mt,Xe[De++]=ze)}Xe.length=De}}return{beginQuery:de,endQuery:Ce,pushScopeStats:Te,update:ve,getNumPendingQueries:function(){return se.length},clear:function(){W.push.apply(W,se);for(var De=0;De<W.length;De++)F.ext_disjoint_timer_query.deleteQueryEXT(W[De]);se.length=0,W.length=0},restore:function(){se.length=0,W.length=0}}},pP=16384,gP=256,yP=1024,mP=34962,Jb="webglcontextlost",ew="webglcontextrestored",tw=1,bP=2,wP=3;function rw(T,F){for(var W=0;W<T.length;++W)if(T[W]===F)return W;return-1}function xP(T){var F=xu(T);if(!F)return null;var W=F.gl,ue=W.getContextAttributes(),be=W.isContextLost(),se=Eu(W,F);if(!se)return null;var de=hr(),Ce=cP(),Ne=se.extensions,Pe=vP(W,Ne),Oe=gr(),Be=W.drawingBufferWidth,Xe=W.drawingBufferHeight,Te={tick:0,time:0,viewportWidth:Be,viewportHeight:Xe,framebufferWidth:Be,framebufferHeight:Xe,drawingBufferWidth:Be,drawingBufferHeight:Xe,pixelRatio:F.pixelRatio},Ge={},re={elements:null,primitive:4,count:-1,offset:0,instances:-1},ve=oL(W,Ne),De=EL(W,Ce,F,Ee),He=DD(W,Ne,ve,Ce,De);function Ee(vt){return He.destroyBuffer(vt)}var et=DL(W,Ne,De,Ce),Ae=BD(W,de,Ce,F),ze=cD(W,Ne,ve,function(){ct.procs.poll()},Te,Ce,F),Me=hD(W,Ne,ve,Ce,F),je=OD(W,Ne,ve,ze,Me,Ce),ct=lP(W,de,Ne,ve,De,et,ze,je,Ge,He,Ae,re,Te,Pe,F),Mt=jD(W,je,ct.procs.poll,Te,ue,Ne,ve),We=ct.next,Re=W.canvas,xe=[],xt=[],It=[],nt=[F.onDestroy],Rt=null;function At(){if(xe.length===0){Pe&&Pe.update(),Rt=null;return}Rt=or.next(At),an();for(var vt=xe.length-1;vt>=0;--vt){var Gt=xe[vt];Gt&&Gt(Te,null,0)}W.flush(),Pe&&Pe.update()}function Pt(){!Rt&&xe.length>0&&(Rt=or.next(At))}function Qt(){Rt&&(or.cancel(At),Rt=null)}function Nr(vt){vt.preventDefault(),be=!0,Qt(),xt.forEach(function(Gt){Gt()})}function $r(vt){W.getError(),be=!1,se.restore(),Ae.restore(),De.restore(),ze.restore(),Me.restore(),je.restore(),He.restore(),Pe&&Pe.restore(),ct.procs.refresh(),Pt(),It.forEach(function(Gt){Gt()})}Re&&(Re.addEventListener(Jb,Nr,!1),Re.addEventListener(ew,$r,!1));function zt(){xe.length=0,Qt(),Re&&(Re.removeEventListener(Jb,Nr),Re.removeEventListener(ew,$r)),Ae.clear(),je.clear(),Me.clear(),ze.clear(),et.clear(),De.clear(),He.clear(),Pe&&Pe.clear(),nt.forEach(function(vt){vt()})}function Gr(vt){N(!!vt,"invalid args to regl({...})"),N.type(vt,"object","invalid args to regl({...})");function Gt(ne){var K=n({},ne);delete K.uniforms,delete K.attributes,delete K.context,delete K.vao,"stencil"in K&&K.stencil.op&&(K.stencil.opBack=K.stencil.opFront=K.stencil.op,delete K.stencil.op);function H(Q){if(Q in K){var U=K[Q];delete K[Q],Object.keys(U).forEach(function(Y){K[Q+"."+Y]=U[Y]})}}return H("blend"),H("depth"),H("cull"),H("stencil"),H("polygonOffset"),H("scissor"),H("sample"),"vao"in ne&&(K.vao=ne.vao),K}function Vt(ne,K){var H={},Q={};return Object.keys(ne).forEach(function(U){var Y=ne[U];if(fr.isDynamic(Y)){Q[U]=fr.unbox(Y,U);return}else if(K&&Array.isArray(Y)){for(var G=0;G<Y.length;++G)if(fr.isDynamic(Y[G])){Q[U]=fr.unbox(Y,U);return}}H[U]=Y}),{dynamic:Q,static:H}}var Cr=Vt(vt.context||{},!0),Ia=Vt(vt.uniforms||{},!0),Mo=Vt(vt.attributes||{},!1),$=Vt(Gt(vt),!1),fe={gpuTime:0,cpuTime:0,count:0},oe=ct.compile($,Mo,Ia,Cr,fe),rt=oe.draw,Ft=oe.batch,j=oe.scope,D=[];function q(ne){for(;D.length<ne;)D.push(null);return D}function ee(ne,K){var H;if(be&&N.raise("context lost"),typeof ne=="function")return j.call(this,null,ne,0);if(typeof K=="function")if(typeof ne=="number")for(H=0;H<ne;++H)j.call(this,null,K,H);else if(Array.isArray(ne))for(H=0;H<ne.length;++H)j.call(this,ne[H],K,H);else return j.call(this,ne,K,0);else if(typeof ne=="number"){if(ne>0)return Ft.call(this,q(ne|0),ne|0)}else if(Array.isArray(ne)){if(ne.length)return Ft.call(this,ne,ne.length)}else return rt.call(this,ne)}return n(ee,{stats:fe,destroy:function(){oe.destroy()}})}var pr=je.setFBO=Gr({framebuffer:fr.define.call(null,tw,"framebuffer")});function Or(vt,Gt){var Vt=0;ct.procs.poll();var Cr=Gt.color;Cr&&(W.clearColor(+Cr[0]||0,+Cr[1]||0,+Cr[2]||0,+Cr[3]||0),Vt|=pP),"depth"in Gt&&(W.clearDepth(+Gt.depth),Vt|=gP),"stencil"in Gt&&(W.clearStencil(Gt.stencil|0),Vt|=yP),N(!!Vt,"called regl.clear with no buffer specified"),W.clear(Vt)}function zr(vt){if(N(typeof vt=="object"&&vt,"regl.clear() takes an object as input"),"framebuffer"in vt)if(vt.framebuffer&&vt.framebuffer_reglType==="framebufferCube")for(var Gt=0;Gt<6;++Gt)pr(n({framebuffer:vt.framebuffer.faces[Gt]},vt),Or);else pr(vt,Or);else Or(null,vt)}function jr(vt){N.type(vt,"function","regl.frame() callback must be a function"),xe.push(vt);function Gt(){var Vt=rw(xe,vt);N(Vt>=0,"cannot cancel a frame twice");function Cr(){var Ia=rw(xe,Cr);xe[Ia]=xe[xe.length-1],xe.length-=1,xe.length<=0&&Qt()}xe[Vt]=Cr}return Pt(),{cancel:Gt}}function Yr(){var vt=We.viewport,Gt=We.scissor_box;vt[0]=vt[1]=Gt[0]=Gt[1]=0,Te.viewportWidth=Te.framebufferWidth=Te.drawingBufferWidth=vt[2]=Gt[2]=W.drawingBufferWidth,Te.viewportHeight=Te.framebufferHeight=Te.drawingBufferHeight=vt[3]=Gt[3]=W.drawingBufferHeight}function an(){Te.tick+=1,Te.time=kt(),Yr(),ct.procs.poll()}function Ar(){ze.refresh(),Yr(),ct.procs.refresh(),Pe&&Pe.update()}function kt(){return(gr()-Oe)/1e3}Ar();function on(vt,Gt){N.type(Gt,"function","listener callback must be a function");var Vt;switch(vt){case"frame":return jr(Gt);case"lost":Vt=xt;break;case"restore":Vt=It;break;case"destroy":Vt=nt;break;default:N.raise("invalid event, must be one of frame,lost,restore,destroy")}return Vt.push(Gt),{cancel:function(){for(var Cr=0;Cr<Vt.length;++Cr)if(Vt[Cr]===Gt){Vt[Cr]=Vt[Vt.length-1],Vt.pop();return}}}}var ir=n(Gr,{clear:zr,prop:fr.define.bind(null,tw),context:fr.define.bind(null,bP),this:fr.define.bind(null,wP),draw:Gr({}),buffer:function(vt){return De.create(vt,mP,!1,!1)},elements:function(vt){return et.create(vt,!1)},texture:ze.create2D,cube:ze.createCube,renderbuffer:Me.create,framebuffer:je.create,framebufferCube:je.createCube,vao:He.createVAO,attributes:ue,frame:jr,on,limits:ve,hasExtension:function(vt){return ve.extensions.indexOf(vt.toLowerCase())>=0},read:Mt,destroy:zt,_gl:W,_refresh:Ar,poll:function(){an(),Pe&&Pe.update()},now:kt,stats:Ce});return F.onDone(null,ir),ir}return xP})})(tO);var Vie=tO.exports;const Yie=bi(Vie);var qie=function(){function t(e,r){Ma(this,t),this.attribute=void 0,this.buffer=void 0;var n=r.buffer,a=r.offset,i=r.stride,o=r.normalized,s=r.size,u=r.divisor;this.buffer=n,this.attribute={buffer:n.get(),offset:a||0,stride:i||0,normalized:o||!1,divisor:u||0},s&&(this.attribute.size=s)}return Aa(t,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(r){this.buffer.subData(r)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),t}(),si,tf,ui,Kn,rf,Di,nf,zc,Oa,To,vn,La,Da,jc,Hie=(si={},Ke(si,ke.POINTS,"points"),Ke(si,ke.LINES,"lines"),Ke(si,ke.LINE_LOOP,"line loop"),Ke(si,ke.LINE_STRIP,"line strip"),Ke(si,ke.TRIANGLES,"triangles"),Ke(si,ke.TRIANGLE_FAN,"triangle fan"),Ke(si,ke.TRIANGLE_STRIP,"triangle strip"),si),rO=(tf={},Ke(tf,ke.STATIC_DRAW,"static"),Ke(tf,ke.DYNAMIC_DRAW,"dynamic"),Ke(tf,ke.STREAM_DRAW,"stream"),tf),r1=(ui={},Ke(ui,ke.BYTE,"int8"),Ke(ui,ke.UNSIGNED_INT,"int16"),Ke(ui,ke.INT,"int32"),Ke(ui,ke.UNSIGNED_BYTE,"uint8"),Ke(ui,ke.UNSIGNED_SHORT,"uint16"),Ke(ui,ke.UNSIGNED_INT,"uint32"),Ke(ui,ke.FLOAT,"float"),ui),Zie=(Kn={},Ke(Kn,ke.ALPHA,"alpha"),Ke(Kn,ke.LUMINANCE,"luminance"),Ke(Kn,ke.LUMINANCE_ALPHA,"luminance alpha"),Ke(Kn,ke.RGB,"rgb"),Ke(Kn,ke.RGBA,"rgba"),Ke(Kn,ke.RGBA4,"rgba4"),Ke(Kn,ke.RGB5_A1,"rgb5 a1"),Ke(Kn,ke.RGB565,"rgb565"),Ke(Kn,ke.DEPTH_COMPONENT,"depth"),Ke(Kn,ke.DEPTH_STENCIL,"depth stencil"),Kn),Kie=(rf={},Ke(rf,ke.DONT_CARE,"dont care"),Ke(rf,ke.NICEST,"nice"),Ke(rf,ke.FASTEST,"fast"),rf),x2=(Di={},Ke(Di,ke.NEAREST,"nearest"),Ke(Di,ke.LINEAR,"linear"),Ke(Di,ke.LINEAR_MIPMAP_LINEAR,"mipmap"),Ke(Di,ke.NEAREST_MIPMAP_LINEAR,"nearest mipmap linear"),Ke(Di,ke.LINEAR_MIPMAP_NEAREST,"linear mipmap nearest"),Ke(Di,ke.NEAREST_MIPMAP_NEAREST,"nearest mipmap nearest"),Di),E2=(nf={},Ke(nf,ke.REPEAT,"repeat"),Ke(nf,ke.CLAMP_TO_EDGE,"clamp"),Ke(nf,ke.MIRRORED_REPEAT,"mirror"),nf),Qie=(zc={},Ke(zc,ke.NONE,"none"),Ke(zc,ke.BROWSER_DEFAULT_WEBGL,"browser"),zc),Jie=(Oa={},Ke(Oa,ke.NEVER,"never"),Ke(Oa,ke.ALWAYS,"always"),Ke(Oa,ke.LESS,"less"),Ke(Oa,ke.LEQUAL,"lequal"),Ke(Oa,ke.GREATER,"greater"),Ke(Oa,ke.GEQUAL,"gequal"),Ke(Oa,ke.EQUAL,"equal"),Ke(Oa,ke.NOTEQUAL,"notequal"),Oa),_2=(To={},Ke(To,ke.FUNC_ADD,"add"),Ke(To,ke.MIN_EXT,"min"),Ke(To,ke.MAX_EXT,"max"),Ke(To,ke.FUNC_SUBTRACT,"subtract"),Ke(To,ke.FUNC_REVERSE_SUBTRACT,"reverse subtract"),To),Uc=(vn={},Ke(vn,ke.ZERO,"zero"),Ke(vn,ke.ONE,"one"),Ke(vn,ke.SRC_COLOR,"src color"),Ke(vn,ke.ONE_MINUS_SRC_COLOR,"one minus src color"),Ke(vn,ke.SRC_ALPHA,"src alpha"),Ke(vn,ke.ONE_MINUS_SRC_ALPHA,"one minus src alpha"),Ke(vn,ke.DST_COLOR,"dst color"),Ke(vn,ke.ONE_MINUS_DST_COLOR,"one minus dst color"),Ke(vn,ke.DST_ALPHA,"dst alpha"),Ke(vn,ke.ONE_MINUS_DST_ALPHA,"one minus dst alpha"),Ke(vn,ke.CONSTANT_COLOR,"constant color"),Ke(vn,ke.ONE_MINUS_CONSTANT_COLOR,"one minus constant color"),Ke(vn,ke.CONSTANT_ALPHA,"constant alpha"),Ke(vn,ke.ONE_MINUS_CONSTANT_ALPHA,"one minus constant alpha"),Ke(vn,ke.SRC_ALPHA_SATURATE,"src alpha saturate"),vn),eoe=(La={},Ke(La,ke.NEVER,"never"),Ke(La,ke.ALWAYS,"always"),Ke(La,ke.LESS,"less"),Ke(La,ke.LEQUAL,"lequal"),Ke(La,ke.GREATER,"greater"),Ke(La,ke.GEQUAL,"gequal"),Ke(La,ke.EQUAL,"equal"),Ke(La,ke.NOTEQUAL,"notequal"),La),As=(Da={},Ke(Da,ke.ZERO,"zero"),Ke(Da,ke.KEEP,"keep"),Ke(Da,ke.REPLACE,"replace"),Ke(Da,ke.INVERT,"invert"),Ke(Da,ke.INCR,"increment"),Ke(Da,ke.DECR,"decrement"),Ke(Da,ke.INCR_WRAP,"increment wrap"),Ke(Da,ke.DECR_WRAP,"decrement wrap"),Da),toe=(jc={},Ke(jc,ke.FRONT,"front"),Ke(jc,ke.BACK,"back"),jc),roe=function(){function t(e,r){Ma(this,t),this.buffer=void 0;var n=r.data,a=r.usage,i=r.type;this.buffer=e.buffer({data:n,usage:rO[a||ke.STATIC_DRAW],type:r1[i||ke.UNSIGNED_BYTE]})}return Aa(t,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){}},{key:"subData",value:function(r){var n=r.data,a=r.offset;this.buffer.subdata(n,a)}}]),t}();function jg(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function noe(t){if(Array.isArray(t))return jg(t)}function aoe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ioe(t,e){if(t){if(typeof t=="string")return jg(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?jg(t,e):void 0}}function ooe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function soe(t){return noe(t)||aoe(t)||ioe(t)||ooe()}function S2(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function M2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?S2(Object(r),!0).forEach(function(n){Ke(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):S2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var uoe=`attribute vec3 a_Position;
|
||
attribute vec2 a_TexCoord;
|
||
|
||
varying vec2 v_TexCoord;
|
||
|
||
void main() {
|
||
gl_Position = vec4(a_Position, 1.0);
|
||
v_TexCoord = a_TexCoord;
|
||
}`,A2=0,foe=function(){function t(e,r){var n=this;Ma(this,t),this.reGl=e,this.context=r,this.entity=JN(),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 a={};this.context.uniforms.forEach(function(f){var l=f.name,c=f.type,h=f.data,d=f.isReferer,v=f.storageClass;if(v===du.StorageBuffer){if(d)n.textureCache[l]={data:void 0},a["".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;a["".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)))}a[l]=function(){return n.textureCache[l].texture}}else if(v===du.Uniform){if(h&&(Array.isArray(h)||cd(h))&&h.length>16)throw new Error("invalid data type ".concat(c));a[l]=function(){return f.data}}});var i=this.getOuputDataTexture(),o=i.textureWidth,s=i.texelCount;a.u_OutputTextureSize=[o,o],a.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
|
||
precision highp float;
|
||
#else
|
||
precision mediump float;
|
||
#endif
|
||
`.concat(this.context.shader),uniforms:a,vert:uoe,primitive:"triangle strip",count:4};this.computeCommand=this.reGl(u)}return Aa(t,[{key:"run",value:function(){var r=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(){r.computeCommand()})}},{key:"readData",value:function(){var e=Xi(mn.mark(function n(){var a=this,i,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(){i=a.reGl.read()}),!i){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<i.length;h+=4)u===1?c.push(i[h]):u===2?c.push(i[h],i[h+1]):c.push(i[h],i[h+1],i[h+2]);else c=i;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 r(){return e.apply(this,arguments)}return r}()},{key:"confirmInput",value:function(r,n){var a;this.entity===r.entity?(this.dynamicPingpong=!0,a=this):a=r,this.textureCache[n].id=a.getOuputDataTexture().id,this.textureCache[n].texture=a.getOuputDataTexture().texture}},{key:"updateUniform",value:function(){}},{key:"updateBuffer",value:function(r,n){var a=this.context.uniforms.find(function(u){var f=u.name;return f===r});if(a){var i=this.calcDataTexture(r,a.type,n),o=i.texture,s=i.data;this.textureCache[r].data=s,this.textureCache[r].texture=o}}},{key:"destroy",value:function(){}},{key:"swap",value:function(){if(this.swapOutputTextureName||this.createSwapOutputDataTexture(),this.compiledPingpong){var r=this.context.output.name;this.textureCache[r].id=this.getOuputDataTexture().id,this.textureCache[r].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 r=this.cloneDataTexture(this.getOuputDataTexture());this.swapOutputTextureName="".concat(this.entity,"-swap"),this.textureCache[this.swapOutputTextureName]=r}},{key:"cloneDataTexture",value:function(r){var n=r.data,a=r.textureWidth;return M2(M2({},r),{},{id:A2++,texture:this.reGl.texture({width:a,height:a,data:n,type:"float"})})}},{key:"calcDataTexture",value:function(r,n,a){var i=1;n===Zf.Vector4FloatArray&&(i=4);for(var o=[],s=0;s<a.length;s+=i)i===1?o.push(a[s],0,0,0):i===2?o.push(a[s],a[s+1],0,0):i===3?o.push(a[s],a[s+1],a[s+2],0):i===4&&o.push(a[s],a[s+1],a[s+2],a[s+3]);var u=a.length,f=Math.ceil(u/i),l=Math.ceil(Math.sqrt(f)),c=l*l;f<c&&o.push.apply(o,soe(new Array((c-f)*4).fill(0)));var h=this.reGl.texture({width:l,height:l,data:o,type:"float"});return{id:A2++,data:o,originalDataLength:u,typedArrayConstructor:cd(a)?a.constructor:void 0,textureWidth:l,texture:h,texelCount:f,elementsPerTexel:i,isOutput:r===this.context.output.name}}}]),t}(),loe=function(){function t(e,r){Ma(this,t),this.elements=void 0;var n=r.data,a=r.usage,i=r.type,o=r.count;this.elements=e.elements({data:n,usage:rO[a||ke.STATIC_DRAW],type:r1[i||ke.UNSIGNED_BYTE],count:o})}return Aa(t,[{key:"get",value:function(){return this.elements}},{key:"subData",value:function(r){var n=r.data;this.elements.subdata(n)}},{key:"destroy",value:function(){this.elements.destroy()}}]),t}(),coe=function(){function t(e,r){Ma(this,t),this.framebuffer=void 0;var n=r.width,a=r.height,i=r.color,o=r.colors;r.depth,r.stencil;var s={width:n,height:a};Array.isArray(o)&&(s.colors=o.map(function(u){return u.get()})),i&&typeof i!="boolean"&&(s.color=i.get()),this.framebuffer=e.framebuffer(s)}return Aa(t,[{key:"get",value:function(){return this.framebuffer}},{key:"destroy",value:function(){this.framebuffer.destroy()}},{key:"resize",value:function(r){var n=r.width,a=r.height;this.framebuffer.resize(n,a)}}]),t}();function hoe(t,e){return function(r){return t(e(r))}}var doe=hoe,voe=doe,poe=voe(Object.getPrototypeOf,Object),goe=poe,yoe=e1,moe=goe,boe=t1,woe="[object Object]",xoe=Function.prototype,Eoe=Object.prototype,nO=xoe.toString,_oe=Eoe.hasOwnProperty,Soe=nO.call(Object);function Moe(t){if(!boe(t)||yoe(t)!=woe)return!1;var e=moe(t);if(e===null)return!0;var r=_oe.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&nO.call(r)==Soe}var Aoe=Moe;const Coe=bi(Aoe);function c0(t){var e={};return Object.keys(t).forEach(function(r){Ug(r,t[r],e,"")}),e}function Ug(t,e,r,n){if(e===null||typeof e=="number"||typeof e=="boolean"||Array.isArray(e)&&typeof e[0]=="number"||cd(e)||e===""||e.resize!==void 0){r["".concat(n&&n+".").concat(t)]=e;return}Coe(e)&&Object.keys(e).forEach(function(a){Ug(a,e[a],r,"".concat(n&&n+".").concat(t))}),Array.isArray(e)&&e.forEach(function(a,i){Object.keys(a).forEach(function(o){Ug(o,a[o],r,"".concat(n&&n+".").concat(t,"[").concat(i,"]"))})})}function C2(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Cs(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?C2(Object(r),!0).forEach(function(n){Ke(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Toe=function(){function t(e,r){Ma(this,t),this.reGl=void 0,this.drawCommand=void 0,this.uniforms={},this.reGl=e;var n=r.vs,a=r.fs,i=r.defines,o=r.attributes,s=r.uniforms,u=r.primitive,f=r.count,l=r.elements,c=r.depth,h=r.blend,d=r.stencil,v=r.cull,p=r.instances,g=r.scissor,y=r.viewport,m={};s&&(this.uniforms=c0(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 w=i&&this.generateDefines(i)||"",x={attributes:b,frag:`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||
precision highp float;
|
||
#else
|
||
precision mediump float;
|
||
#endif
|
||
`.concat(w,`
|
||
`).concat(a),uniforms:m,vert:`
|
||
`.concat(w,`
|
||
`).concat(n),primitive:Hie[u===void 0?ke.TRIANGLES:u]};p&&(x.instances=p),f&&(x.count=f),l&&(x.elements=l.get()),g&&(x.scissor=g),y&&(x.viewport=y),this.initDepthDrawParams({depth:c},x),this.initBlendDrawParams({blend:h},x),this.initStencilDrawParams({stencil:d},x),this.initCullDrawParams({cull:v},x),this.drawCommand=e(x)}return Aa(t,[{key:"addUniforms",value:function(r){this.uniforms=Cs(Cs({},this.uniforms),c0(r))}},{key:"draw",value:function(r){var n=Cs(Cs({},this.uniforms),c0(r.uniforms||{})),a={};Object.keys(n).forEach(function(i){var o=hu(n[i]);o==="boolean"||o==="number"||Array.isArray(n[i])||n[i].BYTES_PER_ELEMENT?a[i]=n[i]:o==="string"||(a[i]=n[i].get())}),this.drawCommand(a)}},{key:"destroy",value:function(){}},{key:"initDepthDrawParams",value:function(r,n){var a=r.depth;a&&(n.depth={enable:a.enable===void 0?!0:!!a.enable,mask:a.mask===void 0?!0:!!a.mask,func:Jie[a.func||ke.LESS],range:a.range||[0,1]})}},{key:"initBlendDrawParams",value:function(r,n){var a=r.blend;if(a){var i=a.enable,o=a.func,s=a.equation,u=a.color,f=u===void 0?[0,0,0,0]:u;n.blend={enable:!!i,func:{srcRGB:Uc[o&&o.srcRGB||ke.SRC_ALPHA],srcAlpha:Uc[o&&o.srcAlpha||ke.SRC_ALPHA],dstRGB:Uc[o&&o.dstRGB||ke.ONE_MINUS_SRC_ALPHA],dstAlpha:Uc[o&&o.dstAlpha||ke.ONE_MINUS_SRC_ALPHA]},equation:{rgb:_2[s&&s.rgb||ke.FUNC_ADD],alpha:_2[s&&s.alpha||ke.FUNC_ADD]},color:f}}}},{key:"initStencilDrawParams",value:function(r,n){var a=r.stencil;if(a){var i=a.enable,o=a.mask,s=o===void 0?-1:o,u=a.func,f=u===void 0?{cmp:ke.ALWAYS,ref:0,mask:-1}:u,l=a.opFront,c=l===void 0?{fail:ke.KEEP,zfail:ke.KEEP,zpass:ke.KEEP}:l,h=a.opBack,d=h===void 0?{fail:ke.KEEP,zfail:ke.KEEP,zpass:ke.KEEP}:h;n.stencil={enable:!!i,mask:s,func:Cs(Cs({},f),{},{cmp:eoe[f.cmp]}),opFront:{fail:As[c.fail],zfail:As[c.zfail],zpass:As[c.zpass]},opBack:{fail:As[d.fail],zfail:As[d.zfail],zpass:As[d.zpass]}}}}},{key:"initCullDrawParams",value:function(r,n){var a=r.cull;if(a){var i=a.enable,o=a.face,s=o===void 0?ke.BACK:o;n.cull={enable:!!i,face:toe[s]}}}},{key:"generateDefines",value:function(r){return Object.keys(r).map(function(n){return"#define ".concat(n," ").concat(Number(r[n]))}).join(`
|
||
`)}}]),t}(),Ioe=function(){function t(e,r){Ma(this,t),this.texture=void 0,this.width=void 0,this.height=void 0;var n=r.data,a=r.type,i=a===void 0?ke.UNSIGNED_BYTE:a,o=r.width,s=r.height,u=r.flipY,f=u===void 0?!1:u,l=r.format,c=l===void 0?ke.RGBA:l,h=r.mipmap,d=h===void 0?!1:h,v=r.wrapS,p=v===void 0?ke.CLAMP_TO_EDGE:v,g=r.wrapT,y=g===void 0?ke.CLAMP_TO_EDGE:g,m=r.aniso,b=m===void 0?0:m,w=r.alignment,x=w===void 0?1:w,E=r.premultiplyAlpha,_=E===void 0?!1:E,S=r.mag,A=S===void 0?ke.NEAREST:S,M=r.min,C=M===void 0?ke.NEAREST:M,I=r.colorSpace,k=I===void 0?ke.BROWSER_DEFAULT_WEBGL:I;this.width=o,this.height=s;var O={width:o,height:s,type:r1[i],format:Zie[c],wrapS:E2[p],wrapT:E2[y],mag:x2[A],min:x2[C],alignment:x,flipY:f,colorSpace:Qie[k],premultiplyAlpha:_,aniso:b};n&&(O.data=n),typeof d=="number"?O.mipmap=Kie[d]:typeof d=="boolean"&&(O.mipmap=d),this.texture=e.texture(O)}return Aa(t,[{key:"get",value:function(){return this.texture}},{key:"update",value:function(){this.texture._texture.bind()}},{key:"resize",value:function(r){var n=r.width,a=r.height;this.texture.resize(n,a),this.width=n,this.height=a}},{key:"destroy",value:function(){this.texture.destroy()}}]),t}(),koe=function(){function t(){var e=this;Ma(this,t),this.supportWebGPU=!1,this.useWGSL=!1,this.$canvas=void 0,this.gl=void 0,this.inited=void 0,this.createModel=function(){var r=Xi(mn.mark(function n(a){return mn.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!a.uniforms){o.next=3;break}return o.next=3,Promise.all(Object.keys(a.uniforms).map(function(){var s=Xi(mn.mark(function u(f){var l;return mn.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(a.uniforms[f]&&a.uniforms[f].load!==void 0)){h.next=5;break}return h.next=3,a.uniforms[f].load();case 3:l=h.sent,a.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 Toe(e.gl,a));case 4:case"end":return o.stop()}},n)}));return function(n){return r.apply(this,arguments)}}(),this.createAttribute=function(r){return new qie(e.gl,r)},this.createBuffer=function(r){return new roe(e.gl,r)},this.createElements=function(r){return new loe(e.gl,r)},this.createTexture2D=function(r){return new Ioe(e.gl,r)},this.createFramebuffer=function(r){return new coe(e.gl,r)},this.useFramebuffer=function(r,n){e.gl({framebuffer:r?r.get():null})(n)},this.createComputeModel=function(){var r=Xi(mn.mark(function n(a){return mn.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new foe(e.gl,a));case 1:case"end":return o.stop()}},n)}));return function(n){return r.apply(this,arguments)}}(),this.clear=function(r){var n=r.color,a=r.depth,i=r.stencil,o=r.framebuffer,s=o===void 0?null:o,u={color:n,depth:a,stencil:i};u.framebuffer=s===null?s:s.get(),e.gl.clear(u)},this.setScissor=function(r){e.gl&&e.gl._gl&&(r.enable&&r.box?(e.gl._gl.enable(ke.SCISSOR_TEST),e.gl._gl.scissor(r.box.x,r.box.y,r.box.width,r.box.height)):e.gl._gl.disable(ke.SCISSOR_TEST),e.gl._refresh())},this.viewport=function(r){var n=r.x,a=r.y,i=r.width,o=r.height;e.gl&&e.gl._gl&&(e.gl._gl.viewport(n,a,i,o),e.gl._refresh())},this.readPixels=function(r){var n=r.framebuffer,a=r.x,i=r.y,o=r.width,s=r.height,u={x:a,y:i,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 Aa(t,[{key:"init",value:function(){var e=Xi(mn.mark(function n(a){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=a.canvas,o.next=5,new Promise(function(s,u){Yie({canvas:a.canvas,attributes:{alpha:!0,antialias:a.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 r(n){return e.apply(this,arguments)}return r}()},{key:"isFloatSupported",value:function(){return this.gl.limits.readFloat}},{key:"beginFrame",value:function(){}},{key:"endFrame",value:function(){}}]),t}(),Noe=function(){function t(){Ma(this,t),this.engine=void 0,this.configService=new $ie}return Aa(t,[{key:"setConfig",value:function(r){this.configService.set(r)}},{key:"setEngine",value:function(r){this.engine=r}},{key:"createEntity",value:function(){return JN()}},{key:"createKernel",value:function(r){var n=new eO(this.engine,this.configService);return typeof r=="string"?n.setBundle(JSON.parse(r)):n.setBundle(r),n.init(),n}},{key:"destroy",value:function(){this.engine.destroy()}}],[{key:"create",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=new t;return n.setConfig(r),n.setEngine(new koe),n}}]),t}();const Ooe=Object.freeze(Object.defineProperty({__proto__:null,Kernel:eO,World:Noe},Symbol.toStringTag,{value:"Module"})),aO=Ka(Ooe);var jn={};Object.defineProperty(jn,"__esModule",{value:!0});jn.arrayToTextureData=jn.attributesToTextureData=jn.buildTextureDataWithTwoEdgeAttr=jn.buildTextureData=jn.proccessToFunc=void 0;var Loe=Ir(),hd=Gd,Doe=function(t,e){var r;return t?(0,Loe.isNumber)(t)?r=function(){return t}:r=t:r=function(){return e||1},r};jn.proccessToFunc=Doe;var Poe=function(t,e){var r=[],n=[],a={},i=0;for(i=0;i<t.length;i++){var o=t[i];a[o.id]=i,r.push(o.x),r.push(o.y),r.push(0),r.push(0),n.push([])}for(i=0;i<e.length;i++){var s=e[i],u=(0,hd.getEdgeTerminal)(s,"source"),f=(0,hd.getEdgeTerminal)(s,"target");!isNaN(a[u])&&!isNaN(a[f])&&(n[a[u]].push(a[f]),n[a[f]].push(a[u]))}var l=0;for(i=0;i<t.length;i++){var c=r.length,h=n[i],d=h.length;r[i*4+2]=c,r[i*4+3]=d,l=Math.max(l,d);for(var v=0;v<d;++v){var p=h[v];r.push(+p)}}for(;r.length%4!==0;)r.push(0);return{maxEdgePerVetex:l,array:new Float32Array(r)}};jn.buildTextureData=Poe;var Roe=function(t,e,r,n){var a=[],i=[],o={},s=0;for(s=0;s<t.length;s++){var u=t[s];o[u.id]=s,a.push(u.x),a.push(u.y),a.push(0),a.push(0),i.push([])}for(s=0;s<e.length;s++){var f=e[s],l=(0,hd.getEdgeTerminal)(f,"source"),c=(0,hd.getEdgeTerminal)(f,"target");i[o[l]].push(o[c]),i[o[l]].push(r(f)),i[o[l]].push(n(f)),i[o[l]].push(0),i[o[c]].push(o[l]),i[o[c]].push(r(f)),i[o[c]].push(n(f)),i[o[c]].push(0)}var h=0;for(s=0;s<t.length;s++){var d=a.length,v=i[s],p=v.length;a[s*4+2]=d+1048576*p/4,a[s*4+3]=0,h=Math.max(h,p/4);for(var g=0;g<p;++g){var y=v[g];a.push(+y)}}for(;a.length%4!==0;)a.push(0);return{maxEdgePerVetex:h,array:new Float32Array(a)}};jn.buildTextureDataWithTwoEdgeAttr=Roe;var Foe=function(t,e){var r=[],n=t.length,a={};return e.forEach(function(i){t.forEach(function(o,s){if(a[i[o]]===void 0&&(a[i[o]]=Object.keys(a).length),r.push(a[i[o]]),s===n-1)for(;r.length%4!==0;)r.push(0)})}),{array:new Float32Array(r),count:Object.keys(a).length}};jn.attributesToTextureData=Foe;var Boe=function(t){for(var e=[],r=t.length,n=t[0].length,a=function(o){t.forEach(function(s,u){if(e.push(s[o]),u===r-1)for(;e.length%4!==0;)e.push(0)})},i=0;i<n;i++)a(i);return new Float32Array(e)};jn.arrayToTextureData=Boe;var Xa={};Object.defineProperty(Xa,"__esModule",{value:!0});Xa.clusterBundle=Xa.clusterCode=Xa.fruchtermanBundle=Xa.fruchtermanCode=void 0;Xa.fruchtermanCode=`
|
||
import { globalInvocationID } from 'g-webgpu';
|
||
const MAX_EDGE_PER_VERTEX;
|
||
const VERTEX_COUNT;
|
||
@numthreads(1, 1, 1)
|
||
class Fruchterman {
|
||
@in @out
|
||
u_Data: vec4[];
|
||
@in
|
||
u_K: float;
|
||
@in
|
||
u_K2: float;
|
||
|
||
@in
|
||
u_Center: vec2;
|
||
@in
|
||
u_Gravity: float;
|
||
@in
|
||
u_ClusterGravity: float;
|
||
@in
|
||
u_Speed: float;
|
||
@in
|
||
u_MaxDisplace: float;
|
||
@in
|
||
u_Clustering: float;
|
||
@in
|
||
u_AttributeArray: vec4[];
|
||
@in
|
||
u_ClusterCenters: vec4[];
|
||
calcRepulsive(i: int, currentNode: vec4): vec2 {
|
||
let dx = 0, dy = 0;
|
||
for (let j = 0; j < VERTEX_COUNT; j++) {
|
||
if (i != j) {
|
||
const nextNode = this.u_Data[j];
|
||
const xDist = currentNode[0] - nextNode[0];
|
||
const yDist = currentNode[1] - nextNode[1];
|
||
const dist = (xDist * xDist + yDist * yDist) + 0.01;
|
||
let param = this.u_K2 / dist;
|
||
|
||
if (dist > 0.0) {
|
||
dx += param * xDist;
|
||
dy += param * yDist;
|
||
if (xDist == 0 && yDist == 0) {
|
||
const sign = i < j ? 1 : -1;
|
||
dx += param * sign;
|
||
dy += param * sign;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return [dx, dy];
|
||
}
|
||
calcGravity(currentNode: vec4, nodeAttributes: vec4): vec2 { //
|
||
let dx = 0, dy = 0;
|
||
const vx = currentNode[0] - this.u_Center[0];
|
||
const vy = currentNode[1] - this.u_Center[1];
|
||
const gf = 0.01 * this.u_K * this.u_Gravity;
|
||
dx = gf * vx;
|
||
dy = gf * vy;
|
||
if (this.u_Clustering == 1) {
|
||
const clusterIdx = int(nodeAttributes[0]);
|
||
const center = this.u_ClusterCenters[clusterIdx];
|
||
const cvx = currentNode[0] - center[0];
|
||
const cvy = currentNode[1] - center[1];
|
||
const dist = sqrt(cvx * cvx + cvy * cvy) + 0.01;
|
||
const parma = this.u_K * this.u_ClusterGravity / dist;
|
||
dx += parma * cvx;
|
||
dy += parma * cvy;
|
||
}
|
||
return [dx, dy];
|
||
}
|
||
calcAttractive(i: int, currentNode: vec4): vec2 {
|
||
let dx = 0, dy = 0;
|
||
const arr_offset = int(floor(currentNode[2] + 0.5));
|
||
const length = int(floor(currentNode[3] + 0.5));
|
||
const node_buffer: vec4;
|
||
for (let p = 0; p < MAX_EDGE_PER_VERTEX; p++) {
|
||
if (p >= length) break;
|
||
const arr_idx = arr_offset + p;
|
||
// when arr_idx % 4 == 0 update currentNodedx_buffer
|
||
const buf_offset = arr_idx - arr_idx / 4 * 4;
|
||
if (p == 0 || buf_offset == 0) {
|
||
node_buffer = this.u_Data[int(arr_idx / 4)];
|
||
}
|
||
const float_j = buf_offset == 0 ? node_buffer[0] :
|
||
buf_offset == 1 ? node_buffer[1] :
|
||
buf_offset == 2 ? node_buffer[2] :
|
||
node_buffer[3];
|
||
const nextNode = this.u_Data[int(float_j)];
|
||
const xDist = currentNode[0] - nextNode[0];
|
||
const yDist = currentNode[1] - nextNode[1];
|
||
const dist = sqrt(xDist * xDist + yDist * yDist) + 0.01;
|
||
let attractiveF = dist / this.u_K;
|
||
|
||
if (dist > 0.0) {
|
||
dx -= xDist * attractiveF;
|
||
dy -= yDist * attractiveF;
|
||
if (xDist == 0 && yDist == 0) {
|
||
const sign = i < int(float_j) ? 1 : -1;
|
||
dx -= sign * attractiveF;
|
||
dy -= sign * attractiveF;
|
||
}
|
||
}
|
||
}
|
||
return [dx, dy];
|
||
}
|
||
@main
|
||
compute() {
|
||
const i = globalInvocationID.x;
|
||
const currentNode = this.u_Data[i];
|
||
let dx = 0, dy = 0;
|
||
if (i >= VERTEX_COUNT) {
|
||
this.u_Data[i] = currentNode;
|
||
return;
|
||
}
|
||
|
||
// [gravity, fx, fy, 0]
|
||
const nodeAttributes = this.u_AttributeArray[i];
|
||
|
||
if (nodeAttributes[1] != 0 && nodeAttributes[2] != 0) {
|
||
// the node is fixed
|
||
this.u_Data[i] = [
|
||
nodeAttributes[1],
|
||
nodeAttributes[2],
|
||
currentNode[2],
|
||
currentNode[3]
|
||
];
|
||
return;
|
||
}
|
||
|
||
// repulsive
|
||
const repulsive = this.calcRepulsive(i, currentNode);
|
||
dx += repulsive[0];
|
||
dy += repulsive[1];
|
||
// attractive
|
||
const attractive = this.calcAttractive(i, currentNode);
|
||
dx += attractive[0];
|
||
dy += attractive[1];
|
||
// gravity
|
||
const gravity = this.calcGravity(currentNode, nodeAttributes);
|
||
dx -= gravity[0];
|
||
dy -= gravity[1];
|
||
// speed
|
||
dx *= this.u_Speed;
|
||
dy *= this.u_Speed;
|
||
|
||
// move
|
||
const distLength = sqrt(dx * dx + dy * dy);
|
||
if (distLength > 0.0) {
|
||
const limitedDist = min(this.u_MaxDisplace * this.u_Speed, distLength);
|
||
this.u_Data[i] = [
|
||
currentNode[0] + dx / distLength * limitedDist,
|
||
currentNode[1] + dy / distLength * limitedDist,
|
||
currentNode[2],
|
||
currentNode[3]
|
||
];
|
||
}
|
||
}
|
||
}
|
||
`;Xa.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}}';Xa.clusterCode=`
|
||
import { globalInvocationID } from 'g-webgpu';
|
||
const VERTEX_COUNT;
|
||
const CLUSTER_COUNT;
|
||
@numthreads(1, 1, 1)
|
||
class CalcCenter {
|
||
@in
|
||
u_Data: vec4[];
|
||
@in
|
||
u_NodeAttributes: vec4[]; // [[clusterIdx, 0, 0, 0], ...]
|
||
@in @out
|
||
u_ClusterCenters: vec4[]; // [[cx, cy, nodeCount, clusterIdx], ...]
|
||
@main
|
||
compute() {
|
||
const i = globalInvocationID.x;
|
||
const center = this.u_ClusterCenters[i];
|
||
let sumx = 0;
|
||
let sumy = 0;
|
||
let count = 0;
|
||
for (let j = 0; j < VERTEX_COUNT; j++) {
|
||
const attributes = this.u_NodeAttributes[j];
|
||
const clusterIdx = int(attributes[0]);
|
||
const vertex = this.u_Data[j];
|
||
if (clusterIdx == i) {
|
||
sumx += vertex.x;
|
||
sumy += vertex.y;
|
||
count += 1;
|
||
}
|
||
}
|
||
this.u_ClusterCenters[i] = [
|
||
sumx / count,
|
||
sumy / count,
|
||
count,
|
||
i
|
||
];
|
||
}
|
||
}
|
||
`;Xa.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 Goe=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),$c=me&&me.__awaiter||function(t,e,r,n){function a(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,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?i(l.value):a(l.value).then(s,u)}f((n=n.apply(t,e||[])).next())})},Xc=me&&me.__generator||function(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,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]&&(r=0)),r;)try{if(n=1,a&&(i=f[0]&2?a.return:f[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,f[1])).done)return i;switch(a=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,a=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){r.label=f[1];break}if(f[0]===6&&r.label<i[1]){r.label=i[1],i=f;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(f);break}i[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],a=0}finally{n=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(El,"__esModule",{value:!0});El.FruchtermanGPULayout=void 0;var zoe=Rr,Ts=Ir(),T2=aO,I2=jn,k2=Xa,joe=mi,Uoe=function(t){Goe(e,t);function e(r){var n=t.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(r),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10}},e.prototype.execute=function(){return $c(this,void 0,void 0,function(){var r,n,a,i,o,s=this;return Xc(this,function(u){switch(u.label){case 0:return r=this,n=r.nodes,!n||n.length===0?(r.onLayoutEnd&&r.onLayoutEnd(),[2]):(!r.width&&typeof window<"u"&&(r.width=window.innerWidth),!r.height&&typeof window<"u"&&(r.height=window.innerHeight),r.center||(r.center=[r.width/2,r.height/2]),a=r.center,n.length===1?(n[0].x=a[0],n[0].y=a[1],r.onLayoutEnd&&r.onLayoutEnd(),[2]):(i={},o={},n.forEach(function(f,l){(0,Ts.isNumber)(f.x)||(f.x=Math.random()*s.width),(0,Ts.isNumber)(f.y)||(f.y=Math.random()*s.height),i[f.id]=f,o[f.id]=l}),r.nodeMap=i,r.nodeIdxMap=o,[4,r.run()]));case 1:return u.sent(),[2]}})})},e.prototype.executeWithWorker=function(r,n){return $c(this,void 0,void 0,function(){var a,i,o,s,u,f=this;return Xc(this,function(l){switch(l.label){case 0:return a=this,i=a.nodes,o=a.center,!i||i.length===0?[2]:i.length===1?(i[0].x=o[0],i[0].y=o[1],[2]):(s={},u={},i.forEach(function(c,h){(0,Ts.isNumber)(c.x)||(c.x=Math.random()*f.width),(0,Ts.isNumber)(c.y)||(c.y=Math.random()*f.height),s[c.id]=c,u[c.id]=h}),a.nodeMap=s,a.nodeIdxMap=u,[4,a.run(r,n)]);case 1:return l.sent(),[2]}})})},e.prototype.run=function(r,n){return $c(this,void 0,void 0,function(){var a,i,o,s,u,f,l,c,h,d,v,p,g,y,m,b,w,x,E,_,S,A,M,C,I,k,O=this;return Xc(this,function(B){switch(B.label){case 0:for(a=this,i=a.nodes,o=a.edges,s=a.maxIteration,u=a.center,f=a.height*a.width,l=Math.sqrt(f)/10,c=f/(i.length+1),h=Math.sqrt(c),d=a.speed,v=a.clustering,p=(0,I2.attributesToTextureData)([a.clusterField],i),g=p.array,y=p.count,i.forEach(function(L,z){var X=0,R=0;(0,Ts.isNumber)(L.fx)&&(0,Ts.isNumber)(L.fy)&&(X=L.fx||.001,R=L.fy||.001),g[4*z+1]=X,g[4*z+2]=R}),m=i.length,b=(0,I2.buildTextureData)(i,o),w=b.maxEdgePerVetex,x=b.array,E=a.workerEnabled,E?_=T2.World.create({canvas:r,engineOptions:{supportCompute:!0}}):_=T2.World.create({engineOptions:{supportCompute:!0}}),S=a.onLayoutEnd,A=[],M=0;M<y;M++)A.push(0,0,0,0);return C=_.createKernel(k2.fruchtermanBundle).setDispatch([m,1,1]).setBinding({u_Data:x,u_K:h,u_K2:c,u_Gravity:a.gravity,u_ClusterGravity:a.clusterGravity||a.gravity||1,u_Speed:d,u_MaxDisplace:l,u_Clustering:v?1:0,u_Center:u,u_AttributeArray:g,u_ClusterCenters:A,MAX_EDGE_PER_VERTEX:w,VERTEX_COUNT:m}),v&&(I=_.createKernel(k2.clusterBundle).setDispatch([y,1,1]).setBinding({u_Data:x,u_NodeAttributes:g,u_ClusterCenters:A,VERTEX_COUNT:m,CLUSTER_COUNT:y})),k=function(){return $c(O,void 0,void 0,function(){var L,z;return Xc(this,function(X){switch(X.label){case 0:L=0,X.label=1;case 1:return L<s?[4,C.execute()]:[3,6];case 2:return X.sent(),v?(I.setBinding({u_Data:C}),[4,I.execute()]):[3,4];case 3:X.sent(),C.setBinding({u_ClusterCenters:I}),X.label=4;case 4:C.setBinding({u_MaxDisplace:l*=.99}),X.label=5;case 5:return L++,[3,1];case 6:return[4,C.getOutput()];case 7:return z=X.sent(),r?n.postMessage({type:joe.LAYOUT_MESSAGE.GPUEND,vertexEdgeData:z}):i.forEach(function(R,V){var he=z[4*V],ce=z[4*V+1];R.x=he,R.y=ce}),S&&S(),[2]}})})},[4,k()];case 1:return B.sent(),[2]}})})},e.prototype.getType=function(){return"fruchterman-gpu"},e}(zoe.Base);El.FruchtermanGPULayout=Uoe;var _l={},Wa={};Object.defineProperty(Wa,"__esModule",{value:!0});Wa.aveMovementBundle=Wa.aveMovementCode=Wa.gForceBundle=Wa.gForceCode=void 0;Wa.gForceCode=`
|
||
import { globalInvocationID } from 'g-webgpu';
|
||
|
||
const MAX_EDGE_PER_VERTEX;
|
||
const VERTEX_COUNT;
|
||
const SHIFT_20 = 1048576;
|
||
|
||
@numthreads(1, 1, 1)
|
||
class GGForce {
|
||
@in @out
|
||
u_Data: vec4[];
|
||
|
||
@in
|
||
u_damping: float;
|
||
|
||
@in
|
||
u_maxSpeed: float;
|
||
|
||
@in
|
||
u_minMovement: float;
|
||
|
||
@in
|
||
u_AveMovement: vec4[];
|
||
|
||
@in
|
||
u_coulombDisScale: float;
|
||
|
||
@in
|
||
u_factor: float;
|
||
|
||
@in
|
||
u_NodeAttributeArray1: vec4[];
|
||
|
||
@in
|
||
u_NodeAttributeArray2: vec4[];
|
||
|
||
@in
|
||
u_interval: float;
|
||
|
||
unpack_float(packedValue: float): ivec2 {
|
||
const packedIntValue = int(packedValue);
|
||
const v0 = packedIntValue / SHIFT_20;
|
||
return [v0, packedIntValue - v0 * SHIFT_20];
|
||
}
|
||
|
||
calcRepulsive(i: int, currentNode: vec4): vec2 {
|
||
let ax = 0, ay = 0;
|
||
for (let j: int = 0; j < VERTEX_COUNT; j++) {
|
||
if (i != j) {
|
||
const nextNode = this.u_Data[j];
|
||
const vx = currentNode[0] - nextNode[0];
|
||
const vy = currentNode[1] - nextNode[1];
|
||
const dist = sqrt(vx * vx + vy * vy) + 0.01;
|
||
const n_dist = (dist + 0.1) * this.u_coulombDisScale;
|
||
const direx = vx / dist;
|
||
const direy = vy / dist;
|
||
const attributesi = this.u_NodeAttributeArray1[i];
|
||
const attributesj = this.u_NodeAttributeArray1[j];
|
||
const massi = attributesi[0];
|
||
const nodeStrengthi = attributesi[2];
|
||
const nodeStrengthj = attributesj[2];
|
||
const nodeStrength = (nodeStrengthi + nodeStrengthj) / 2;
|
||
// const param = nodeStrength * this.u_factor / (n_dist * n_dist * massi);
|
||
const param = nodeStrength * this.u_factor / (n_dist * n_dist);
|
||
ax += direx * param;
|
||
ay += direy * param;
|
||
}
|
||
}
|
||
return [ax, ay];
|
||
}
|
||
|
||
calcGravity(i: int, currentNode: vec4, attributes2: vec4): vec2 {
|
||
// note: attributes2 = [centerX, centerY, gravity, 0]
|
||
|
||
const vx = currentNode[0] - attributes2[0];
|
||
const vy = currentNode[1] - attributes2[1];
|
||
|
||
const ax = vx * attributes2[2];
|
||
const ay = vy * attributes2[2];
|
||
|
||
return [ax, ay];
|
||
}
|
||
|
||
calcAttractive(i: int, currentNode: vec4, attributes1: vec4): vec2 {
|
||
// note: attributes1 = [mass, degree, nodeSterngth, 0]
|
||
|
||
const mass = attributes1[0];
|
||
let ax = 0, ay = 0;
|
||
// const arr_offset = int(floor(currentNode[2] + 0.5));
|
||
// const length = int(floor(currentNode[3] + 0.5));
|
||
|
||
const compressed = this.unpack_float(currentNode[2]);
|
||
const length = compressed[0];
|
||
const arr_offset = compressed[1];
|
||
|
||
const node_buffer: vec4;
|
||
for (let p: int = 0; p < MAX_EDGE_PER_VERTEX; p++) {
|
||
if (p >= length) break;
|
||
const arr_idx = arr_offset + 4 * p; // i 节点的第 p 条边开始的小格子位置
|
||
const buf_offset = arr_idx - arr_idx / 4 * 4;
|
||
if (p == 0 || buf_offset == 0) {
|
||
node_buffer = this.u_Data[int(arr_idx / 4)]; // 大格子,大格子位置=小个子位置 / 4,
|
||
}
|
||
|
||
let float_j: float = node_buffer[0];
|
||
|
||
const nextNode = this.u_Data[int(float_j)];
|
||
const vx = nextNode[0] - currentNode[0];
|
||
const vy = nextNode[1] - currentNode[1];
|
||
const dist = sqrt(vx * vx + vy * vy) + 0.01;
|
||
const direx = vx / dist;
|
||
const direy = vy / dist;
|
||
const edgeLength = node_buffer[1];
|
||
const edgeStrength = node_buffer[2];
|
||
const diff: float = edgeLength - dist;//edgeLength
|
||
// const param = diff * this.u_stiffness / mass; //
|
||
const param = diff * edgeStrength / mass; //
|
||
ax -= direx * param;
|
||
ay -= direy * param;
|
||
}
|
||
return [ax, ay];
|
||
}
|
||
|
||
@main
|
||
compute() {
|
||
const i = globalInvocationID.x;
|
||
const currentNode = this.u_Data[i];
|
||
const movement = u_AveMovement[0];
|
||
let ax = 0, ay = 0;
|
||
|
||
if (i >= VERTEX_COUNT || movement.x < u_minMovement) {
|
||
this.u_Data[i] = currentNode;
|
||
return;
|
||
}
|
||
|
||
// 每个节点属性占两个数组中各一格
|
||
// [mass, degree, nodeStrength, fx]
|
||
const nodeAttributes1 = this.u_NodeAttributeArray1[i];
|
||
// [centerX, centerY, centerGravity, fy]
|
||
const nodeAttributes2 = this.u_NodeAttributeArray2[i];
|
||
|
||
// repulsive
|
||
const repulsive = this.calcRepulsive(i, currentNode);
|
||
ax += repulsive[0];
|
||
ay += repulsive[1];
|
||
|
||
// attractive
|
||
const attractive = this.calcAttractive(i, currentNode, nodeAttributes1);
|
||
ax += attractive[0];
|
||
ay += attractive[1];
|
||
|
||
// gravity
|
||
const gravity = this.calcGravity(i, currentNode, nodeAttributes2);
|
||
ax -= gravity[0];
|
||
ay -= gravity[1];
|
||
|
||
// speed
|
||
const param = this.u_interval * this.u_damping;
|
||
let vx = ax * param;
|
||
let vy = ay * param;
|
||
const vlength = sqrt(vx * vx + vy * vy) + 0.0001;
|
||
if (vlength > this.u_maxSpeed) {
|
||
const param2 = this.u_maxSpeed / vlength;
|
||
vx = param2 * vx;
|
||
vy = param2 * vy;
|
||
}
|
||
|
||
// move
|
||
if (nodeAttributes1[3] != 0 && nodeAttributes2[3] != 0) {
|
||
this.u_Data[i] = [
|
||
nodeAttributes1[3],
|
||
nodeAttributes2[3],
|
||
currentNode[2],
|
||
0
|
||
];
|
||
} else {
|
||
const distx = vx * this.u_interval;
|
||
const disty = vy * this.u_interval;
|
||
const distLength = sqrt(distx * distx + disty * disty);
|
||
this.u_Data[i] = [
|
||
currentNode[0] + distx,
|
||
currentNode[1] + disty,
|
||
currentNode[2],
|
||
distLength
|
||
];
|
||
}
|
||
|
||
// the avarage move distance
|
||
// need to share memory
|
||
|
||
}
|
||
}
|
||
`;Wa.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}}';Wa.aveMovementCode=`
|
||
const VERTEX_COUNT;
|
||
@numthreads(1, 1, 1)
|
||
class CalcAveMovement {
|
||
@in
|
||
u_Data: vec4[];
|
||
@in
|
||
u_iter: float;
|
||
@in @out
|
||
u_AveMovement: vec4[];
|
||
@main
|
||
compute() {
|
||
let movement = 0;
|
||
for (let j: int = 0; j < VERTEX_COUNT; j++) {
|
||
const vertex = this.u_Data[j];
|
||
movement += vertex[3];
|
||
}
|
||
movement = movement / float(VERTEX_COUNT);
|
||
this.u_AveMovement[0] = [movement, 0, 0, 0];
|
||
}
|
||
}
|
||
`;Wa.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 $oe=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),h0=me&&me.__awaiter||function(t,e,r,n){function a(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,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?i(l.value):a(l.value).then(s,u)}f((n=n.apply(t,e||[])).next())})},d0=me&&me.__generator||function(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,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]&&(r=0)),r;)try{if(n=1,a&&(i=f[0]&2?a.return:f[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,f[1])).done)return i;switch(a=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,a=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){r.label=f[1];break}if(f[0]===6&&r.label<i[1]){r.label=i[1],i=f;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(f);break}i[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],a=0}finally{n=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(_l,"__esModule",{value:!0});_l.GForceGPULayout=void 0;var Xoe=Rr,fi=Ir(),N2=aO,li=jn,Woe=Gd,O2=Wa,Voe=mi,Yoe=function(t){$oe(e,t);function e(r){var n=t.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(r),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:2e3,gravity:10,clustering:!1,clusterGravity:10}},e.prototype.execute=function(){return h0(this,void 0,void 0,function(){var r,n,a,i,o;return d0(this,function(s){switch(s.label){case 0:return r=this,n=r.nodes,!n||n.length===0?(r.onLayoutEnd&&r.onLayoutEnd(),[2]):(!r.width&&typeof window<"u"&&(r.width=window.innerWidth),!r.height&&typeof window<"u"&&(r.height=window.innerHeight),r.center||(r.center=[r.width/2,r.height/2]),a=r.center,n.length===1?(n[0].x=a[0],n[0].y=a[1],r.onLayoutEnd&&r.onLayoutEnd(),[2]):(i={},o={},n.forEach(function(u,f){(0,fi.isNumber)(u.x)||(u.x=Math.random()*r.width),(0,fi.isNumber)(u.y)||(u.y=Math.random()*r.height),i[u.id]=u,o[u.id]=f}),r.nodeMap=i,r.nodeIdxMap=o,r.nodeStrength=(0,li.proccessToFunc)(r.nodeStrength,1),r.edgeStrength=(0,li.proccessToFunc)(r.edgeStrength,1),[4,r.run()]));case 1:return s.sent(),[2]}})})},e.prototype.executeWithWorker=function(r,n){var a=this,i=a.nodes,o=a.center;if(!(!i||i.length===0)){if(i.length===1){i[0].x=o[0],i[0].y=o[1];return}var s={},u={};i.forEach(function(f,l){(0,fi.isNumber)(f.x)||(f.x=Math.random()*a.width),(0,fi.isNumber)(f.y)||(f.y=Math.random()*a.height),s[f.id]=f,u[f.id]=l}),a.nodeMap=s,a.nodeIdxMap=u,a.nodeStrength=(0,li.proccessToFunc)(a.nodeStrength,1),a.edgeStrength=(0,li.proccessToFunc)(a.edgeStrength,1),a.run(r,n)}},e.prototype.run=function(r,n){return h0(this,void 0,void 0,function(){var a,i,o,s,u,f,l,c,h,d,v,p,g,y,m,b,w,x,E,_,S,A,M,C,I,k,O,B=this;return d0(this,function(L){switch(L.label){case 0:for(a=this,i=a.nodes,o=a.edges,s=a.maxIteration,!a.width&&typeof window<"u"&&(a.width=window.innerWidth),!a.height&&typeof window<"u"&&(a.height=window.innerHeight),u=i.length,a.linkDistance=(0,li.proccessToFunc)(a.linkDistance),a.edgeStrength=(0,li.proccessToFunc)(a.edgeStrength),f=(0,li.buildTextureDataWithTwoEdgeAttr)(i,o,a.linkDistance,a.edgeStrength),l=f.maxEdgePerVetex,c=f.array,a.degrees=(0,Woe.getDegree)(i.length,a.nodeIdxMap,o).map(function(z){return z.all}),h=[],d=[],v=[],p=[],g=[],y=[],m=[],a.getMass||(a.getMass=function(z){return a.degrees[a.nodeIdxMap[z.id]]||1}),b=a.gravity,w=a.center,i.forEach(function(z,X){h.push(a.getMass(z)),d.push(a.nodeStrength(z)),a.degrees[X]||(a.degrees[X]=0);var R=[w[0],w[1],b];if(a.getCenter){var V=a.getCenter(z,a.degrees[X]);V&&(0,fi.isNumber)(V[0])&&(0,fi.isNumber)(V[1])&&(0,fi.isNumber)(V[2])&&(R=V)}v.push(R[0]),p.push(R[1]),g.push(R[2]),(0,fi.isNumber)(z.fx)&&(0,fi.isNumber)(z.fy)?(y.push(z.fx||.001),m.push(z.fy||.001)):(y.push(0),m.push(0))}),x=(0,li.arrayToTextureData)([h,a.degrees,d,y]),E=(0,li.arrayToTextureData)([v,p,g,m]),_=a.workerEnabled,_?S=N2.World.create({canvas:r,engineOptions:{supportCompute:!0}}):S=N2.World.create({engineOptions:{supportCompute:!0}}),A=a.onLayoutEnd,M=[],c.forEach(function(z){M.push(z)}),C=0;C<4;C++)M.push(0);return I=S.createKernel(O2.gForceBundle).setDispatch([u,1,1]).setBinding({u_Data:c,u_damping:a.damping,u_maxSpeed:a.maxSpeed,u_minMovement:a.minMovement,u_coulombDisScale:a.coulombDisScale,u_factor:a.factor,u_NodeAttributeArray1:x,u_NodeAttributeArray2:E,MAX_EDGE_PER_VERTEX:l,VERTEX_COUNT:u,u_AveMovement:M,u_interval:a.interval}),k=S.createKernel(O2.aveMovementBundle).setDispatch([1,1,1]).setBinding({u_Data:c,VERTEX_COUNT:u,u_AveMovement:[0,0,0,0]}),O=function(){return h0(B,void 0,void 0,function(){var z,X,R;return d0(this,function(V){switch(V.label){case 0:z=0,V.label=1;case 1:return z<s?[4,I.execute()]:[3,5];case 2:return V.sent(),k.setBinding({u_Data:I}),[4,k.execute()];case 3:V.sent(),X=Math.max(.02,a.interval-z*.002),I.setBinding({u_interval:X,u_AveMovement:k}),V.label=4;case 4:return z++,[3,1];case 5:return[4,I.getOutput()];case 6:return R=V.sent(),r?n.postMessage({type:Voe.LAYOUT_MESSAGE.GPUEND,vertexEdgeData:R}):i.forEach(function(he,ce){var le=R[4*ce],ie=R[4*ce+1];he.x=le,he.y=ie}),A&&A(),[2]}})})},[4,O()];case 1:return L.sent(),[2]}})})},e.prototype.getType=function(){return"gForce-gpu"},e}(Xoe.Base);_l.GForceGPULayout=Yoe;var Sl={},qoe=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Sl,"__esModule",{value:!0});Sl.ComboForceLayout=void 0;var Hoe=Rr,Ut=Ir(),Zoe=function(t){qoe(e,t);function e(r){var n=t.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(r),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 r=this,n=r.nodes,a=r.center;if(r.comboTree={id:"comboTreeRoot",depth:-1,children:r.comboTrees},!n||n.length===0){r.onLayoutEnd&&r.onLayoutEnd();return}if(n.length===1){n[0].x=a[0],n[0].y=a[1],r.onLayoutEnd&&r.onLayoutEnd();return}r.initVals(),r.run(),r.onLayoutEnd&&r.onLayoutEnd()},e.prototype.run=function(){var r=this,n=r.nodes,a=r.previousLayouted?r.maxIteration/5:r.maxIteration;!r.width&&typeof window<"u"&&(r.width=window.innerWidth),!r.height&&typeof window<"u"&&(r.height=window.innerHeight);var i=r.center,o=r.velocityDecay,s=r.comboMap;r.previousLayouted||r.initPos(s);for(var u=function(h){var d=[];n.forEach(function(v,p){d[p]={x:0,y:0}}),r.applyCalculate(d),r.applyComboCenterForce(d),n.forEach(function(v,p){!(0,Ut.isNumber)(v.x)||!(0,Ut.isNumber)(v.y)||(v.x+=d[p].x*o,v.y+=d[p].y*o)}),r.alpha+=(r.alphaTarget-r.alpha)*r.alphaDecay,r.onTick()},f=0;f<a;f++)u();var l=[0,0];n.forEach(function(h){!(0,Ut.isNumber)(h.x)||!(0,Ut.isNumber)(h.y)||(l[0]+=h.x,l[1]+=h.y)}),l[0]/=n.length,l[1]/=n.length;var c=[i[0]-l[0],i[1]-l[1]];n.forEach(function(h,d){!(0,Ut.isNumber)(h.x)||!(0,Ut.isNumber)(h.y)||(h.x+=c[0],h.y+=c[1])}),r.combos.forEach(function(h){var d=s[h.id];d&&d.empty&&(h.x=d.cx||h.x,h.y=d.cy||h.y)}),r.previousLayouted=!0},e.prototype.initVals=function(){var r=this,n=r.edges,a=r.nodes,i=r.combos,o={},s={},u={};a.forEach(function(z,X){s[z.id]=z,u[z.id]=X}),r.nodeMap=s,r.indexMap=u;var f={};i.forEach(function(z){f[z.id]=z}),r.oriComboMap=f,r.comboMap=r.getComboMap();var l=r.preventOverlap;r.preventComboOverlap=r.preventComboOverlap||l,r.preventNodeOverlap=r.preventNodeOverlap||l;var c=r.collideStrength;c&&(r.comboCollideStrength=c,r.nodeCollideStrength=c),r.comboCollideStrength=r.comboCollideStrength?r.comboCollideStrength:0,r.nodeCollideStrength=r.nodeCollideStrength?r.nodeCollideStrength:0;for(var h=0;h<n.length;++h){var d=(0,Ut.getEdgeTerminal)(n[h],"source"),v=(0,Ut.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,Ut.getEdgeTerminal)(n[h],"source"),v=(0,Ut.getEdgeTerminal)(n[h],"target");p[h]=o[d]/(o[d]+o[v])}this.bias=p;var g=r.nodeSize,y=r.nodeSpacing,m,b;if((0,Ut.isNumber)(y)?b=function(){return y}:(0,Ut.isFunction)(y)?b=y:b=function(){return 0},this.nodeSpacing=b,!g)m=function(z){if(z.size){if((0,Ut.isArray)(z.size)){var X=z.size[0]>z.size[1]?z.size[0]:z.size[1];return X/2}if((0,Ut.isObject)(z.size)){var X=z.size.width>z.size.height?z.size.width:z.size.height;return X/2}return z.size/2}return 10};else if((0,Ut.isFunction)(g))m=function(z){return g(z)};else if((0,Ut.isArray)(g)){var w=g[0]>g[1]?g[0]:g[1],x=w/2;m=function(z){return x}}else{var E=g/2;m=function(z){return E}}this.nodeSize=m;var _=r.comboSpacing,S;(0,Ut.isNumber)(_)?S=function(){return _}:(0,Ut.isFunction)(_)?S=_:S=function(){return 0},this.comboSpacing=S;var A=r.comboPadding,M;(0,Ut.isNumber)(A)?M=function(){return A}:(0,Ut.isArray)(A)?M=function(){return Math.max.apply(null,A)}:(0,Ut.isFunction)(A)?M=A:M=function(){return 0},this.comboPadding=M;var C=this.linkDistance,I;C||(C=10),(0,Ut.isNumber)(C)?I=function(z){return C}:I=C,this.linkDistance=I;var k=this.edgeStrength,O;k||(k=1),(0,Ut.isNumber)(k)?O=function(z){return k}:O=k,this.edgeStrength=O;var B=this.nodeStrength,L;B||(B=30),(0,Ut.isNumber)(B)?L=function(z){return B}:L=B,this.nodeStrength=L},e.prototype.initPos=function(r){var n=this,a=n.nodes;a.forEach(function(i,o){var s=i.comboId,u=r[s];s&&u?(i.x=u.cx+100/(o+1),i.y=u.cy+100/(o+1)):(i.x=100/(o+1),i.y=100/(o+1))})},e.prototype.getComboMap=function(){var r=this,n=r.nodeMap,a=r.comboTrees,i=r.oriComboMap,o={};return(a||[]).forEach(function(s){var u=[];(0,Ut.traverseTreeUp)(s,function(f){if(f.itemType==="node"||!i[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:r.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=i[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,Ut.isNumber)(p.cx)&&(h.cx+=p.cx),(0,Ut.isNumber)(p.cy)&&(h.cy+=p.cy);return}var g=n[v.id];g&&((0,Ut.isNumber)(g.x)&&(h.cx+=g.x),(0,Ut.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(r){var n=this,a=n.gravity,i=n.comboGravity||a,o=this.alpha,s=n.comboTrees,u=n.indexMap,f=n.nodeMap,l=n.comboMap;(s||[]).forEach(function(c){(0,Ut.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,Ut.isNumber)(b.cx)&&(v.cx+=b.cx),b&&(0,Ut.isNumber)(b.cy)&&(v.cy+=b.cy);return}var w=f[m.id],x=w.x-g||.005,E=w.y-y||.005,_=Math.sqrt(x*x+E*E),S=u[w.id],A=i*o/_*p;r[S].x-=x*A,r[S].y-=E*A,(0,Ut.isNumber)(w.x)&&(v.cx+=w.x),(0,Ut.isNumber)(w.y)&&(v.cy+=w.y)}),v.cx/=v.count||1,v.cy/=v.count||1,!0})})},e.prototype.applyCalculate=function(r){var n=this,a=n.comboMap,i=n.nodes,o={};i.forEach(function(u,f){i.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(a),n.calRepulsive(r,o),n.calAttractive(r,o);var s=n.preventComboOverlap;s&&n.comboNonOverlapping(r,a)},e.prototype.updateComboSizes=function(r){var n=this,a=n.comboTrees,i=n.nodeMap,o=n.nodeSize,s=n.comboSpacing,u=n.comboPadding;(a||[]).forEach(function(f){var l=[];(0,Ut.traverseTreeUp)(f,function(c){if(c.itemType==="node")return!0;var h=r[c.id];if(!h)return!1;var d=c.children;d&&d.forEach(function(g){!r[g.id]&&!i[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=i[g.id];if(!y)return!0;var m=o(y),b=y.x-m,w=y.y-m,x=y.x+m,E=y.y+m;h.minX>b&&(h.minX=b),h.minY>w&&(h.minY=w),h.maxX<x&&(h.maxX=x),h.maxY<E&&(h.maxY=E)});var v=n.oriComboMap[c.id].size||10;(0,Ut.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(r,n){var a=this,i=a.comboTree,o=a.comboCollideStrength,s=a.indexMap,u=a.nodeMap;(0,Ut.traverseTreeUp)(i,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,w=d.r||1,x=g.r||1,E=w+x,_=x*x,S=w*w;if(b<E*E){var A=c.children;if(!A||A.length===0)return!1;var M=v.children;if(!M||M.length===0)return!1;var C=Math.sqrt(b),I=(E-C)/C*o,k=y*I,O=m*I,B=_/(S+_),L=1-B;A.forEach(function(z){if(z.itemType!=="node")return!1;if(u[z.id]){var X=s[z.id];M.forEach(function(R){if(R.itemType!=="node"||!u[R.id])return!1;var V=s[R.id];r[X].x+=k*B,r[X].y+=O*B,r[V].x-=k*L,r[V].y-=O*L})}})}})}),!0})},e.prototype.calRepulsive=function(r,n){var a=this,i=a.nodes,o=a.width*a.optimizeRangeFactor,s=a.nodeStrength,u=a.alpha,f=a.nodeCollideStrength,l=a.preventNodeOverlap,c=a.nodeSize,h=a.nodeSpacing,d=a.depthRepulsiveForceScale,v=a.center;i.forEach(function(p,g){if(!(!p.x||!p.y)){if(v){var y=a.gravity,m=p.x-v[0]||.005,b=p.y-v[1]||.005,w=Math.sqrt(m*m+b*b);r[g].x-=m*y*u/w,r[g].y-=b*y*u/w}i.forEach(function(x,E){if(g!==E&&!(!x.x||!x.y)){var _=n["".concat(p.id,"-").concat(x.id)],S=_.vl2,A=_.vl;if(!(A>o)){var M=n["".concat(p.id,"-").concat(x.id)],C=M.vx,I=M.vy,k=Math.log(Math.abs(x.depth-p.depth)/10)+1||1;k=k<1?1:k,x.comboId!==p.comboId&&(k+=1);var O=k?Math.pow(d,k):1,B=s(x)*u/S*O;if(r[g].x+=C*B,r[g].y+=I*B,g<E&&l){var L=c(p)+h(p)||1,z=c(x)+h(x)||1,X=L+z;if(S<X*X){var R=(X-A)/A*f,V=z*z,he=V/(L*L+V),ce=C*R,le=I*R;r[g].x+=ce*he,r[g].y+=le*he,he=1-he,r[E].x-=ce*he,r[E].y-=le*he}}}}})}})},e.prototype.calAttractive=function(r,n){var a=this,i=a.edges,o=a.linkDistance,s=a.alpha,u=a.edgeStrength,f=a.bias,l=a.depthAttractiveForceScale;i.forEach(function(c,h){var d=(0,Ut.getEdgeTerminal)(c,"source"),v=(0,Ut.getEdgeTerminal)(c,"target");if(!(!d||!v||d===v)){var p=a.indexMap[d],g=a.indexMap[v],y=a.nodeMap[d],m=a.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 w=b?Math.pow(l,b):1;if(y.comboId!==m.comboId&&w===1?w=l/2:y.comboId===m.comboId&&(w=2),!(!(0,Ut.isNumber)(m.x)||!(0,Ut.isNumber)(y.x)||!(0,Ut.isNumber)(m.y)||!(0,Ut.isNumber)(y.y))){var x=n["".concat(v,"-").concat(d)],E=x.vl,_=x.vx,S=x.vy,A=(E-o(c))/E*s*u(c)*w,M=_*A,C=S*A,I=f[h];r[g].x-=M*I,r[g].y-=C*I,r[p].x+=M*(1-I),r[p].y+=C*(1-I)}}}})},e.prototype.getType=function(){return"comboForce"},e}(Hoe.Base);Sl.ComboForceLayout=Zoe;var af={},L2;function iO(){if(L2)return af;L2=1;var t=me&&me.__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=me&&me.__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(af,"__esModule",{value:!0}),af.ComboCombinedLayout=void 0;var r=mi,n=Rr,a=Ir(),i=dO(),o=function(s){t(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(B){g[B.id]=B});var y={};d.forEach(function(B){y[B.id]=B});var m=l.getInnerGraphs(g),b=[],w=[],x={},E=!0;this.comboTrees.forEach(function(B){var L=m[B.id];if(L){var z=e(e({},B),{x:L.x||y[B.id].x,y:L.y||y[B.id].y,fx:L.fx||y[B.id].fx,fy:L.fy||y[B.id].fy,mass:L.mass||y[B.id].mass,size:L.size});w.push(z),!isNaN(z.x)&&z.x!==0&&!isNaN(z.y)&&z.y!==0?E=!1:(z.x=Math.random()*100,z.y=Math.random()*100),b.push(B.id),(0,a.traverseTreeUp)(B,function(X){return X.id!==B.id&&(x[X.id]=B.id),!0})}}),c.forEach(function(B){if(!(B.comboId&&y[B.comboId])){var L=e({},B);w.push(L),!isNaN(L.x)&&L.x!==0&&!isNaN(L.y)&&L.y!==0?E=!1:(L.x=Math.random()*100,L.y=Math.random()*100),b.push(B.id)}});var _=[];if(h.concat(v).forEach(function(B){var L=x[B.source]||B.source,z=x[B.target]||B.target;L!==z&&b.includes(L)&&b.includes(z)&&_.push({source:L,target:z})}),w!=null&&w.length){if(w.length===1)w[0].x=p[0],w[0].y=p[1];else{var S={nodes:w,edges:_},A=this.outerLayout||new i.GForceLayout({gravity:1,factor:4,linkDistance:function(B,L,z){var X,R,V=((((X=L.size)===null||X===void 0?void 0:X[0])||30)+(((R=z.size)===null||R===void 0?void 0:R[0])||30))/2;return Math.min(V*1.5,700)}}),M=(f=A.getType)===null||f===void 0?void 0:f.call(A);if(A.updateCfg({center:p,kg:5,preventOverlap:!0,animate:!1}),E&&r.FORCE_LAYOUT_TYPE_MAP[M]){var C=w.length<100?new i.MDSLayout:new i.GridLayout;C.layout(S)}A.layout(S)}w.forEach(function(B){var L=m[B.id];if(!L){var z=g[B.id];z&&(z.x=B.x,z.y=B.y);return}L.visited=!0,L.x=B.x,L.y=B.y,L.nodes.forEach(function(X){X.x+=B.x,X.y+=B.y})})}for(var I=Object.keys(m),k=function(B){var L=I[B],z=m[L];if(!z)return"continue";z.nodes.forEach(function(X){z.visited||(X.x+=z.x||0,X.y+=z.y||0),g[X.id]&&(g[X.id].x=X.x,g[X.id].y=X.y)}),y[L]&&(y[L].x=z.x,y[L].y=z.y)},O=I.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 i.ConcentricLayout({type:"concentric",sortBy:"id"});return y.center=[0,0],y.preventOverlap=!0,y.nodeSpacing=p,(c||[]).forEach(function(m){(0,a.traverseTreeUp)(m,function(b){var w,x=(v==null?void 0:v(b))||10;if((0,a.isArray)(x)&&(x=Math.max.apply(Math,x)),!((w=b.children)===null||w===void 0)&&w.length){var _=b.children.map(function(R){if(R.itemType==="combo")return g[R.id];var V=f[R.id]||{};return e(e({},V),R)}),S=_.map(function(R){return R.id}),A={nodes:_,edges:d.filter(function(R){return S.includes(R.source)&&S.includes(R.target)})},M=1/0;_.forEach(function(R){var V;R.size||(R.size=((V=g[R.id])===null||V===void 0?void 0:V.size)||(h==null?void 0:h(R))||[30,30]),(0,a.isNumber)(R.size)&&(R.size=[R.size,R.size]),M>R.size[0]&&(M=R.size[0]),M>R.size[1]&&(M=R.size[1])}),y.layout(A);var C=(0,a.getLayoutBBox)(_),I=C.minX,k=C.minY,O=C.maxX,B=C.maxY,L={x:(O+I)/2,y:(B+k)/2};A.nodes.forEach(function(R){R.x-=L.x,R.y-=L.y});var z=Math.max(O-I,M)+x*2,X=Math.max(B-k,M)+x*2;g[b.id]={id:b.id,nodes:_,size:[z,X]}}else if(b.itemType==="combo"){var E=x?[x*2,x*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,a.isNumber)(c)?d=function(){return c}:(0,a.isFunction)(c)?d=c:d=function(){return 0},this.spacing=d,!l)h=function(b){var w=d(b);if(b.size){if((0,a.isArray)(b.size)){var x=b.size[0]>b.size[1]?b.size[0]:b.size[1];return(x+w)/2}if((0,a.isObject)(b.size)){var x=b.size.width>b.size.height?b.size.width:b.size.height;return(x+w)/2}return(b.size+w)/2}return 10+w/2};else if((0,a.isFunction)(l))h=function(b){var w=l(b),x=d(b);if((0,a.isArray)(b.size)){var E=b.size[0]>b.size[1]?b.size[0]:b.size[1];return(E+x)/2}return((w||10)+x)/2};else if((0,a.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,a.isNumber)(y)?m=function(){return y}:(0,a.isArray)(y)?m=function(){return Math.max.apply(null,y)}:(0,a.isFunction)(y)?m=y:m=function(){return 0},this.comboPadding=m},u.prototype.getType=function(){return"comboCombined"},u}(n.Base);return af.ComboCombinedLayout=o,af}var Ml={},n1={};Object.defineProperty(n1,"__esModule",{value:!0});var Koe=function(){function t(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 t.prototype.distanceTo=function(e){var r=this.rx-e.rx,n=this.ry-e.ry;return Math.hypot(r,n)},t.prototype.setPos=function(e,r){this.rx=e,this.ry=r},t.prototype.resetForce=function(){this.fx=0,this.fy=0},t.prototype.addForce=function(e){var r=e.rx-this.rx,n=e.ry-this.ry,a=Math.hypot(r,n);a=a<1e-4?1e-4:a;var i=this.g*(this.degree+1)*(e.degree+1)/a;this.fx+=i*r/a,this.fy+=i*n/a},t.prototype.in=function(e){return e.contains(this.rx,this.ry)},t.prototype.add=function(e){var r=this.mass+e.mass,n=(this.rx*this.mass+e.rx*e.mass)/r,a=(this.ry*this.mass+e.ry*e.mass)/r,i=this.degree+e.degree,o={rx:n,ry:a,mass:r,degree:i};return new t(o)},t}();n1.default=Koe;var a1={};Object.defineProperty(a1,"__esModule",{value:!0});var Qoe=function(){function t(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 t.prototype.getLength=function(){return this.length},t.prototype.contains=function(e,r){var n=this.length/2;return e<=this.xmid+n&&e>=this.xmid-n&&r<=this.ymid+n&&r>=this.ymid-n},t.prototype.NW=function(){var e=this.xmid-this.length/4,r=this.ymid+this.length/4,n=this.length/2,a={xmid:e,ymid:r,length:n},i=new t(a);return i},t.prototype.NE=function(){var e=this.xmid+this.length/4,r=this.ymid+this.length/4,n=this.length/2,a={xmid:e,ymid:r,length:n},i=new t(a);return i},t.prototype.SW=function(){var e=this.xmid-this.length/4,r=this.ymid-this.length/4,n=this.length/2,a={xmid:e,ymid:r,length:n},i=new t(a);return i},t.prototype.SE=function(){var e=this.xmid+this.length/4,r=this.ymid-this.length/4,n=this.length/2,a={xmid:e,ymid:r,length:n},i=new t(a);return i},t}();a1.default=Qoe;var i1={};Object.defineProperty(i1,"__esModule",{value:!0});var Joe=function(){function t(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 t.prototype.insert=function(e){if(this.body==null){this.body=e;return}this._isExternal()?(this.quad&&(this.NW=new t(this.quad.NW()),this.NE=new t(this.quad.NE()),this.SW=new t(this.quad.SW()),this.SE=new t(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e))},t.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))},t.prototype._isExternal=function(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null},t.prototype.updateForce=function(e){if(!(this.body==null||e===this.body))if(this._isExternal())e.addForce(this.body);else{var r=this.quad?this.quad.getLength():0,n=this.body.distanceTo(e);r/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))}},t}();i1.default=Joe;var ese=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),o1=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ml,"__esModule",{value:!0});Ml.ForceAtlas2Layout=void 0;var tse=Rr,ci=Ir(),rse=o1(n1),nse=o1(a1),ase=o1(i1),ise=function(t){ese(e,t);function e(r){var n=t.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.kr=5,n.kg=1,n.mode="normal",n.preventOverlap=!1,n.dissuadeHubs=!1,n.barnesHut=void 0,n.maxIteration=0,n.ks=.1,n.ksmax=10,n.tao=.1,n.onLayoutEnd=function(){},n.prune=void 0,n.updateCfg(r),n}return e.prototype.getDefaultCfg=function(){return{}},e.prototype.execute=function(){var r=this,n=r.nodes,a=r.onLayoutEnd,i=r.prune,o=r.maxIteration;!r.width&&typeof window<"u"&&(r.width=window.innerWidth),!r.height&&typeof window<"u"&&(r.height=window.innerHeight);for(var s=[],u=n.length,f=0;f<u;f+=1){var l=n[f],c=10,h=10;(0,ci.isNumber)(l.size)&&(c=l.size,h=l.size),(0,ci.isArray)(l.size)?(isNaN(l.size[0])||(c=l.size[0]),isNaN(l.size[1])||(h=l.size[1])):(0,ci.isObject)(l.size)&&(c=l.size.width,h=l.size.height),r.getWidth&&!isNaN(r.getWidth(l))&&(h=r.getWidth(l)),r.getHeight&&!isNaN(r.getHeight(l))&&(c=r.getHeight(l));var d=Math.max(c,h);s.push(d)}r.barnesHut===void 0&&u>250&&(r.barnesHut=!0),r.prune===void 0&&u>100&&(r.prune=!0),this.maxIteration===0&&!r.prune?(o=250,u<=200&&u>100?o=1e3:u>200&&(o=1200),this.maxIteration=o):this.maxIteration===0&&i&&(o=100,u<=200&&u>100?o=500:u>200&&(o=950),this.maxIteration=o),r.kr||(r.kr=50,u>100&&u<=500?r.kr=20:u>500&&(r.kr=1)),r.kg||(r.kg=20,u>100&&u<=500?r.kg=10:u>500&&(r.kg=1)),this.nodes=r.updateNodesByForces(s),a()},e.prototype.updateNodesByForces=function(r){for(var n=this,a=n.edges,i=n.maxIteration,o=n.nodes,s=a.filter(function(_){var S=(0,ci.getEdgeTerminal)(_,"source"),A=(0,ci.getEdgeTerminal)(_,"target");return S!==A}),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 w=(0,ci.getEdgeTerminal)(s[v],"source"),x=(0,ci.getEdgeTerminal)(s[v],"target");o[b].id===w?(p=o[b],y=b):o[b].id===x&&(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=i;if(o=this.iterate(E,c,h,f,l,r),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,r)}return o},e.prototype.iterate=function(r,n,a,i,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=r,y=50,m=[],b=[],w=[],x=0;x<d;x+=1)if(m[2*x]=0,m[2*x+1]=0,h){var E={id:x,rx:f[x].x,ry:f[x].y,mass:1,g:l,degree:o[x]};w[x]=new rse.default(E)}for(;g>0;){for(var x=0;x<d;x+=1)b[2*x]=m[2*x],b[2*x+1]=m[2*x+1],m[2*x]=0,m[2*x+1]=0;m=this.getAttrForces(g,y,i,n,a,o,s,m),h&&(c&&g>y||!c)?m=this.getOptRepGraForces(m,w,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(r,n,a,i,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<a;g+=1){var y=c[o[g].sourceIdx],m=o[g].sourceIdx,b=c[o[g].targetIdx],w=o[g].targetIdx;if(!(p&&(s[m]<=1||s[w]<=1))){var x=[b.x-y.x,b.y-y.y],E=Math.hypot(x[0],x[1]);E=E<1e-4?1e-4:E,x[0]=x[0]/E,x[1]=x[1]/E,h&&r<n&&(E=E-u[m]-u[w]);var _=E,S=_;v==="linlog"&&(_=Math.log(1+E),S=_),d&&(_=E/s[m],S=E/s[w]),h&&r<n&&E<=0?(_=0,S=0):h&&r<n&&E>0&&(_=E,S=E),f[2*i[y.id]]+=_*x[0],f[2*i[b.id]]-=S*x[0],f[2*i[y.id]+1]+=_*x[1],f[2*i[b.id]+1]-=S*x[1]}}return f},e.prototype.getRepGraForces=function(r,n,a,i,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&&r<n&&(b=b-o[g]-o[y]);var w=c*(s[g]+1)*(s[y]+1)/b;l&&r<n&&b<0?w=i*(s[g]+1)*(s[y]+1):l&&r<n&&b===0?w=0:l&&r<n&&b>0&&(w=c*(s[g]+1)*(s[y]+1)/b),a[2*g]-=w*m[0],a[2*y]+=w*m[0],a[2*g+1]-=w*m[1],a[2*y+1]+=w*m[1]}var x=[f[g].x-d[0],f[g].y-d[1]],E=Math.hypot(x[0],x[1]);x[0]=x[0]/E,x[1]=x[1]/E;var _=h*(s[g]+1);a[2*g]-=_*x[0],a[2*g+1]-=_*x[1]}return a},e.prototype.getOptRepGraForces=function(r,n,a){for(var i=this,o=i.nodes,s=i.kg,u=i.center,f=i.prune,l=o.length,c=9e10,h=-9e10,d=9e10,v=-9e10,p=0;p<l;p+=1)f&&a[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 nse.default(y),b=new ase.default(m),p=0;p<l;p+=1)f&&a[p]<=1||n[p].in(m)&&b.insert(n[p]);for(var p=0;p<l;p+=1)if(!(f&&a[p]<=1)){n[p].resetForce(),b.updateForce(n[p]),r[2*p]-=n[p].fx,r[2*p+1]-=n[p].fy;var w=[o[p].x-u[0],o[p].y-u[1]],x=Math.hypot(w[0],w[1]);x=x<1e-4?1e-4:x,w[0]=w[0]/x,w[1]=w[1]/x;var E=s*(a[p]+1);r[2*p]-=E*w[0],r[2*p+1]-=E*w[1]}return r},e.prototype.updatePos=function(r,n,a,i){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&&i[y]<=1)){var m=[r[2*y]-n[2*y],r[2*y+1]-n[2*y+1]],b=Math.hypot(m[0],m[1]),w=[r[2*y]+n[2*y],r[2*y+1]+n[2*y+1]],x=Math.hypot(w[0],w[1]);d[y]=b,v[y]=x/2,p+=(i[y]+1)*d[y],g+=(i[y]+1)*v[y]}var E=a;a=f*g/p,E!==0&&(a=a>1.5*E?1.5*E:a);for(var y=0;y<h;y+=1)if(!(l&&i[y]<=1)&&!((0,ci.isNumber)(s[y].fx)&&(0,ci.isNumber)(s[y].fy))){var _=u*a/(1+a*Math.sqrt(d[y])),S=Math.hypot(r[2*y],r[2*y+1]);S=S<1e-4?1e-4:S;var A=c/S;_=_>A?A:_;var M=_*r[2*y],C=_*r[2*y+1];s[y].x+=M,s[y].y+=C}return{nodes:s,sg:a}},e}(tse.Base);Ml.ForceAtlas2Layout=ise;var Al={},s1={},u1={},f1={},js=me&&me.__assign||function(){return js=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},js.apply(this,arguments)};Object.defineProperty(f1,"__esModule",{value:!0});var ose=function(){function t(){this.cells=[],this.columnNum=0,this.rowNum=0,this.additionColumn=[],this.additionRow=[]}return t.prototype.init=function(e,r,n){this.cells=[],this.CELL_W=n.CELL_W||t.DEFAULT_CELL_W,this.CELL_H=n.CELL_H||t.DEFAULT_CELL_H,this.columnNum=Math.ceil(e/this.CELL_W),this.rowNum=Math.ceil(r/this.CELL_H),t.MIN_DIST=Math.pow(e,2)+Math.pow(r,2);for(var a=0;a<this.columnNum;a++){for(var i=[],o=0;o<this.rowNum;o++){var s={dx:a,dy:o,x:a*this.CELL_W,y:o*this.CELL_H,occupied:!1};i.push(s)}this.cells.push(i)}},t.prototype.findGridByNodeId=function(e){for(var r,n,a=0;a<this.columnNum;a++)for(var i=0;i<this.rowNum;i++)if(this.cells[a][i].node&&((n=(r=this.cells[a][i])===null||r===void 0?void 0:r.node)===null||n===void 0?void 0:n.id)===e)return{column:a,row:i};return null},t.prototype.sqdist=function(e,r){return Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2)},t.prototype.occupyNearest=function(e){for(var r=t.MIN_DIST,n,a=null,i=0;i<this.columnNum;i++)for(var o=0;o<this.rowNum;o++)!this.cells[i][o].occupied&&(n=this.sqdist(e,this.cells[i][o]))<r&&(r=n,a=this.cells[i][o]);return a&&(a.occupied=!0),a},t.prototype.insertColumn=function(e,r){if(!(r<=0)){for(var n=0;n<r;n++){this.cells[n+this.columnNum]=[];for(var a=0;a<this.rowNum;a++)this.cells[n+this.columnNum][a]={dx:n,dy:a,x:n*this.CELL_W,y:a*this.CELL_H,occupied:!1,node:null}}for(var n=this.columnNum-1;n>e;n--)for(var a=0;a<this.rowNum;a++)this.cells[n+r][a]=js(js({},this.cells[n][a]),{x:(n+r)*this.CELL_W,y:a*this.CELL_H}),this.cells[n][a]={x:n*this.CELL_W,y:a*this.CELL_H,occupied:!0,node:null};for(var a=0;a<this.additionColumn.length;a++)this.additionColumn[a]>=e&&(this.additionColumn[a]+=r);for(var n=0;n<r;n++)this.additionColumn.push(e+n+1);this.columnNum+=r}},t.prototype.insertRow=function(e,r){if(!(r<=0)){for(var n=0;n<r;n++)for(var a=0;a<this.columnNum;a++)this.cells[a][n+this.rowNum]={dx:a,dy:n,x:a*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(var a=0;a<this.columnNum;a++)for(var n=this.rowNum-1;n>e;n--)this.cells[a][n+r]=js(js({},this.cells[a][n]),{dx:a,dy:n+r,x:a*this.CELL_W,y:(n+r)*this.CELL_H}),this.cells[a][n]={dx:a,dy:n,x:a*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]+=r);for(var a=0;a<r;a++)this.additionRow.push(e+a+1);this.rowNum+=r}},t.prototype.getNodes=function(){for(var e=[],r=0;r<this.columnNum;r++)for(var n=0;n<this.rowNum;n++)this.cells[r][n].node&&e.push(this.cells[r][n]);return e},t.MIN_DIST=50,t.DEFAULT_CELL_W=80,t.DEFAULT_CELL_H=80,t}();f1.default=ose;var sse=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(u1,"__esModule",{value:!0});var use=sse(f1);function fse(t,e){if(!t.nodes||t.nodes.length===0)return t;var r=e.width,n=e.height,a=e.nodeMinGap,i=1e4,o=1e4;t.nodes.forEach(function(m){var b=m.size[0]||50,w=m.size[1]||50;i=Math.min(b,i),o=Math.min(w,o)});var s=new use.default;s.init(r,n,{CELL_H:o,CELL_W:i}),t.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<t.nodes.length;u++){var f=t.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]+a>i){for(var d=Math.ceil((f.size[0]+a)/i)-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]+a>o){for(var d=Math.ceil((f.size[1]+a)/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 w=s.cells[u][b];if(w.node){var x=t.nodes.find(function(E){var _;return E.id===((_=w==null?void 0:w.node)===null||_===void 0?void 0:_.id)});x&&(x.x=w.x+x.size[0]/2,x.y=w.y+x.size[1]/2)}},p=0;p<s.rowNum;p++)y(p)}u1.default=fse;var l1={};Object.defineProperty(l1,"__esModule",{value:!0});var oO=1200,sO=800,Wc=1e7,of=10,uO=3.141592653589793,v0=1.5707963267948966,lse=uO*.375,cse=uO*.625,Eh=new Map,hse=10,dse=10,p0=.8,D2=.1,vse=.5;function pse(t,e,r){var n=t.x-t.size[0]/2,a=t.y-t.size[1]/2,i=t.x+t.size[0]/2,o=t.y+t.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=t.x,h=t.y,d=e.x,v=e.y,p=d-c,g=Math.atan2(p,v-h),y=0,m=0,b=0,w=0;g>v0?(m=a-l,y=s-i,b=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)),w=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):0<g&&g<=v0?(m=u-o,y=s-i,m>y?b=w=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=w=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):g<-v0?(m=a-l,y=-(f-n),m>y?b=w=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=w=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):(m=u-o,Math.abs(p)>(i-n)/2?y=n-f:y=p,m>y?b=w=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=w=parseFloat(y&&g!==0?(y/Math.sin(g)).toFixed(2):m.toFixed(2)));var x=parseFloat(g.toFixed(2)),E=r;return r&&(E=lse<x&&x<cse),{distance:Math.abs(b<w?b:w),isHoriz:E}}function fO(t,e){var r=Eh.get(t.id)||[],n=r.find(function(L){return L.source===e.id||L.target===e.id}),a=t.size[0]*t.size[1],i=e.size[0]*e.size[1],o=a>i?e:t,s=a>i?t: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,w=l>=h&&v>=u&&c>=d&&p>=f,x=0,E=0;if(w){E=Math.sqrt(Math.pow(m-g,2)+Math.pow(b-y,2));var _=u>h?u:h,S=f>d?f:d,A=l<v?l:v,M=c<p?c:p,C=A-_,I=M-S,k=C*I;E===0&&(E=1e-7),x=of*1/E*100+k,x*=Wc}else{var O=!1,B=pse(o,s,O);E=B.distance,O=B.isHoriz,E<=of?E!==0?n?x+=of+Wc*1/E:x+=of+Wc*of/E:x+=Wc:(x+=E,n&&(x+=E*E))}return x}function lO(t){for(var e=0,r=0;r<t.length;r++){var n=t[r];(n.x<0||n.y<0||n.x>oO||n.y>sO)&&(e+=1e12);for(var a=r+1;a<t.length;a++)e+=fO(n,t[a])}return e}function gse(t,e,r,n){var a=new Map;r.forEach(function(g,y){a.set(g.id,g)});var i=n.filter(function(g){return g.source===t.id||g.target===t.id})||[],o=[];i.forEach(function(g){var y=g.source===t.id?g.target:g.source,m=a.get(y);m&&o.push(m)});for(var s=!0,u=0;u<o.length;u++){var f=o[u],l=Math.atan((t.y-f.y)/(f.x-t.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-t.x)*(f.x-e.x)<0){s=!1;break}else if((f.y-t.y)*(f.y-e.y)<0){s=!1;break}}return s}function yse(t,e){for(var r=!1,n=1,a=hse*n,i=dse*n,o=[a,-a,0,0],s=[0,0,i,-i],u=0;u<t.length;++u)for(var f=t[u],l=P2(f,t),c=0;c<o.length;c++){var h=gse(f,{x:f.x+o[c],y:f.y+s[c]},t,e);if(h){f.x+=o[c],f.y+=s[c];var d=P2(f,t),v=Math.random();d<l||v<p0&&v>D2?(l=d,r=!0):(f.x-=o[c],f.y-=s[c])}}return p0>D2&&(p0*=vse),r?lO(t):0}function P2(t,e){var r=0;(t.x<0||t.y<0||t.x+t.size[0]+20>oO||t.y+t.size[1]+20>sO)&&(r+=1e12);for(var n=0;n<e.length;++n)t.id!==e[n].id&&(r+=fO(t,e[n]));return r}function mse(t,e){if(t.length===0)return{nodes:t,edges:e};t.forEach(function(f){var l=e.filter(function(c){return c.source===f.id||c.target===f.id});Eh.set(f,l)}),t.sort(function(f,l){var c,h;return((c=Eh.get(f.id))===null||c===void 0?void 0:c.length)-((h=Eh.get(l.id))===null||h===void 0?void 0:h.length)});for(var r=lO(t),n=20,a=1,i=0,o=50,s=0;n>0&&(s++,!(s>=o));){var u=yse(t,e);u!==0&&(i=u),a=i-r,r=i,a===0?--n:n=20}return t.forEach(function(f){f.x=f.x-f.size[0]/2,f.y=f.y-f.size[1]/2}),{nodes:t,edges:e}}l1.default=mse;var $g=me&&me.__assign||function(){return $g=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},$g.apply(this,arguments)},bse=me&&me.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,a)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wse=me&&me.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xse=me&&me.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bse(e,t,r);return wse(e,t),e},cO=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(s1,"__esModule",{value:!0});var Is=xse(nm),Ese=cO(u1),_se=cO(l1),Sse=yu;function Mse(t,e){var r=t.nodes,n=t.edges,a=e.width,i=e.height;if(!(r!=null&&r.length))return Promise.resolve();var o=[];r.forEach(function(v){var p=n.filter(function(y){return y.source===v.id||y.target===v.id});if(p.length>1){var g=$g({},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 Sse.DagreLayout({type:"dagre",ranksep:e.nodeMinGap,nodesep:e.nodeMinGap}),f=u.layout({nodes:o,edges:s}).nodes;r.forEach(function(v){var p=(f||[]).find(function(g){return g.id===v.id});v.x=(p==null?void 0:p.x)||a/2,v.y=(p==null?void 0:p.y)||i/2});var l=JSON.parse(JSON.stringify(r)),c=JSON.parse(JSON.stringify(n)),h=Is.forceSimulation().nodes(l).force("link",Is.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",Is.forceManyBody()).force("center",Is.forceCenter(a/2,i/2)).force("x",Is.forceX(a/2)).force("y",Is.forceY(i/2)).alpha(.3).alphaDecay(.08).alphaMin(.001),d=new Promise(function(v){h.on("end",function(){r.forEach(function(x){var E=l.find(function(_){return _.id===x.id});E&&(x.x=E.x,x.y=E.y)});var p=Math.min.apply(Math,r.map(function(x){return x.x})),g=Math.max.apply(Math,r.map(function(x){return x.x})),y=Math.min.apply(Math,r.map(function(x){return x.y})),m=Math.max.apply(Math,r.map(function(x){return x.y})),b=a/(g-p),w=i/(m-y);r.forEach(function(x){x.x!==void 0&&b<1&&(x.x=(x.x-p)*b),x.y!==void 0&&w<1&&(x.y=(x.y-y)*w)}),r.forEach(function(x){x.sizeTemp=x.size,x.size=[10,10]}),(0,_se.default)(r,n),r.forEach(function(x){x.size=x.sizeTemp||[],delete x.sizeTemp}),(0,Ese.default)({nodes:r,edges:n},e),v()})});return d}s1.default=Mse;var Ase=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Cse=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Al,"__esModule",{value:!0});Al.ERLayout=void 0;var Tse=Rr,Ise=Cse(s1),kse=function(t){Ase(e,t);function e(r){var n=t.call(this)||this;return n.width=300,n.height=300,n.nodeMinGap=50,n.onLayoutEnd=function(){},r&&n.updateCfg(r),n}return e.prototype.getDefaultCfg=function(){return{width:300,height:300,nodeMinGap:50}},e.prototype.execute=function(){var r=this,n=r.nodes,a=r.edges;return n==null||n.forEach(function(i){i.size||(i.size=[50,50])}),(0,Ise.default)({nodes:n,edges:a},{width:this.width,height:this.height,nodeMinGap:this.nodeMinGap}).then(function(){r.onLayoutEnd&&r.onLayoutEnd()})},e.prototype.getType=function(){return"er"},e}(Tse.Base);Al.ERLayout=kse;var Io={},R2;function Nse(){if(R2)return Io;R2=1,Object.defineProperty(Io,"__esModule",{value:!0}),Io.Layouts=Io.Layout=void 0;var t=gi,e=sl,r=ul,n=ll,a=fl,i=rm,o=cl,s=yu,u=Km,f=bl,l=wl,c=xl,h=El,d=_l,v=Sl,p=iO(),g=Ml,y=Al,m=vl,b=Ir(),w=function(){function x(E){var _=(0,t.getLayoutByName)(E.type);this.layoutInstance=new _(E)}return x.prototype.layout=function(E){return this.layoutInstance.layout(E)},x.prototype.updateCfg=function(E){this.layoutInstance.updateCfg(E)},x.prototype.init=function(E){this.correctLayers(E.nodes),this.layoutInstance.init(E)},x.prototype.correctLayers=function(E){if(E!=null&&E.length){var _=1/0,S=[];if(E.forEach(function(M){(0,b.isString)(M.layer)&&(M.layer=parseInt(M.layer,10)),!(M.layer===void 0||isNaN(M.layer))&&(S.push(M),M.layer<_&&(_=M.layer))}),_<=0){var A=Math.abs(_)+1;S.forEach(function(M){return M.layer+=A})}}},x.prototype.execute=function(){this.layoutInstance.execute()},x.prototype.getDefaultCfg=function(){return this.layoutInstance.getDefaultCfg()},x.prototype.destroy=function(){return this.layoutInstance.destroy()},x}();return Io.Layout=w,Io.Layouts={force:i.ForceLayout,fruchterman:c.FruchtermanLayout,forceAtlas2:g.ForceAtlas2Layout,gForce:a.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:r.RandomLayout,"gForce-gpu":d.GForceGPULayout,"fruchterman-gpu":h.FruchtermanGPULayout,er:y.ERLayout},Io}var hO={};Object.defineProperty(hO,"__esModule",{value:!0});var F2;function dO(){return F2||(F2=1,function(t){var e=me&&me.__createBinding||(Object.create?function(E,_,S,A){A===void 0&&(A=S);var M=Object.getOwnPropertyDescriptor(_,S);(!M||("get"in M?!_.__esModule:M.writable||M.configurable))&&(M={enumerable:!0,get:function(){return _[S]}}),Object.defineProperty(E,A,M)}:function(E,_,S,A){A===void 0&&(A=S),E[A]=_[S]}),r=me&&me.__exportStar||function(E,_){for(var S in E)S!=="default"&&!Object.prototype.hasOwnProperty.call(_,S)&&e(_,E,S)};Object.defineProperty(t,"__esModule",{value:!0}),t.ERLayout=t.ForceAtlas2Layout=t.ComboCombinedLayout=t.ComboForceLayout=t.GForceGPULayout=t.FruchtermanGPULayout=t.FruchtermanLayout=t.MDSLayout=t.ConcentricLayout=t.RadialLayout=t.DagreCompoundLayout=t.DagreLayout=t.CircularLayout=t.ForceLayout=t.Force2Layout=t.GForceLayout=t.RandomLayout=t.GridLayout=t.Layouts=t.Layout=void 0;var n=sl;Object.defineProperty(t,"GridLayout",{enumerable:!0,get:function(){return n.GridLayout}});var a=ul;Object.defineProperty(t,"RandomLayout",{enumerable:!0,get:function(){return a.RandomLayout}});var i=fl;Object.defineProperty(t,"GForceLayout",{enumerable:!0,get:function(){return i.GForceLayout}});var o=ll;Object.defineProperty(t,"Force2Layout",{enumerable:!0,get:function(){return o.Force2Layout}});var s=rm;Object.defineProperty(t,"ForceLayout",{enumerable:!0,get:function(){return s.ForceLayout}});var u=cl;Object.defineProperty(t,"CircularLayout",{enumerable:!0,get:function(){return u.CircularLayout}});var f=yu;Object.defineProperty(t,"DagreLayout",{enumerable:!0,get:function(){return f.DagreLayout}});var l=vl;Object.defineProperty(t,"DagreCompoundLayout",{enumerable:!0,get:function(){return l.DagreCompoundLayout}});var c=Km;Object.defineProperty(t,"RadialLayout",{enumerable:!0,get:function(){return c.RadialLayout}});var h=bl;Object.defineProperty(t,"ConcentricLayout",{enumerable:!0,get:function(){return h.ConcentricLayout}});var d=wl;Object.defineProperty(t,"MDSLayout",{enumerable:!0,get:function(){return d.MDSLayout}});var v=xl;Object.defineProperty(t,"FruchtermanLayout",{enumerable:!0,get:function(){return v.FruchtermanLayout}});var p=El;Object.defineProperty(t,"FruchtermanGPULayout",{enumerable:!0,get:function(){return p.FruchtermanGPULayout}});var g=_l;Object.defineProperty(t,"GForceGPULayout",{enumerable:!0,get:function(){return g.GForceGPULayout}});var y=Sl;Object.defineProperty(t,"ComboForceLayout",{enumerable:!0,get:function(){return y.ComboForceLayout}});var m=iO();Object.defineProperty(t,"ComboCombinedLayout",{enumerable:!0,get:function(){return m.ComboCombinedLayout}});var b=Ml;Object.defineProperty(t,"ForceAtlas2Layout",{enumerable:!0,get:function(){return b.ForceAtlas2Layout}});var w=Al;Object.defineProperty(t,"ERLayout",{enumerable:!0,get:function(){return w.ERLayout}});var x=Nse();Object.defineProperty(t,"Layout",{enumerable:!0,get:function(){return x.Layout}}),Object.defineProperty(t,"Layouts",{enumerable:!0,get:function(){return x.Layouts}}),r(hO,t)}(Fp)),Fp}(function(t){var e=me&&me.__createBinding||(Object.create?function(a,i,o,s){s===void 0&&(s=o);var u=Object.getOwnPropertyDescriptor(i,o);(!u||("get"in u?!i.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(a,s,u)}:function(a,i,o,s){s===void 0&&(s=o),a[s]=i[o]}),r=me&&me.__exportStar||function(a,i){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&e(i,a,o)};Object.defineProperty(t,"__esModule",{value:!0}),t.getLayoutByName=t.unRegisterLayout=t.registerLayout=void 0;var n=gi;Object.defineProperty(t,"registerLayout",{enumerable:!0,get:function(){return n.registerLayout}}),Object.defineProperty(t,"unRegisterLayout",{enumerable:!0,get:function(){return n.unRegisterLayout}}),Object.defineProperty(t,"getLayoutByName",{enumerable:!0,get:function(){return n.getLayoutByName}}),r(dO(),t)})(Kt);function Ose(t,e,r,n){return n===void 0&&(n="height"),r==="center"?(t[n]+e[n])/2:t.height}var oo={assign:Object.assign,getHeight:Ose},vO=oo,c1=18,Lse=c1*2,B2=c1,Dse={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||B2},getVGap:function(e){return e.vgap||B2},getChildren:function(e){return e.children},getHeight:function(e){return e.height||Lse},getWidth:function(e){var r=e.label||" ";return e.width||r.split("").length*c1}};function dd(t,e){var r=this;if(r.vgap=r.hgap=0,t instanceof dd)return t;r.data=t;var n=e.getHGap(t),a=e.getVGap(t);return r.preH=e.getPreH(t),r.preV=e.getPreV(t),r.width=e.getWidth(t),r.height=e.getHeight(t),r.width+=r.preH,r.height+=r.preV,r.id=e.getId(t),r.x=r.y=0,r.depth=0,r.children||(r.children=[]),r.addGap(n,a),r}vO.assign(dd.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(e,r){var n=this;n.hgap+=e,n.vgap+=r,n.width+=2*e,n.height+=2*r},eachNode:function(e){for(var r=this,n=[r],a;a=n.shift();)e(a),n=a.children.concat(n)},DFTraverse:function(e){this.eachNode(e)},BFTraverse:function(e){for(var r=this,n=[r],a;a=n.shift();)e(a),n=n.concat(a.children)},getBoundingBox:function(){var e={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(r){e.left=Math.min(e.left,r.x),e.top=Math.min(e.top,r.y),e.width=Math.max(e.width,r.x+r.width),e.height=Math.max(e.height,r.y+r.height)}),e},translate:function(e,r){e===void 0&&(e=0),r===void 0&&(r=0),this.eachNode(function(n){n.x+=e,n.y+=r,n.x+=n.preH,n.y+=n.preV})},right2left:function(){var e=this,r=e.getBoundingBox();e.eachNode(function(n){n.x=n.x-(n.x-r.left)*2-n.width}),e.translate(r.width,0)},bottom2top:function(){var e=this,r=e.getBoundingBox();e.eachNode(function(n){n.y=n.y-(n.y-r.top)*2-n.height}),e.translate(0,r.height)}});function Pse(t,e,r){e===void 0&&(e={}),e=vO.assign({},Dse,e);var n=new dd(t,e),a=[n],i;if(!r&&!t.collapsed){for(;i=a.shift();)if(!i.data.collapsed){var o=e.getChildren(i.data),s=o?o.length:0;if(i.children=new Array(s),o&&s)for(var u=0;u<s;u++){var f=new dd(o[u],e);i.children[u]=f,a.push(f),f.parent=i,f.depth=i.depth+1}}}return n}var pO=Pse,Rse=pO,Fse=function(){function t(r,n){n===void 0&&(n={});var a=this;a.options=n,a.rootNode=Rse(r,n)}var e=t.prototype;return e.execute=function(){throw new Error("please override this method")},t}(),hv=Fse;function mf(t,e,r,n){n===void 0&&(n=[]);var a=this;a.w=t||0,a.h=e||0,a.y=r||0,a.x=0,a.c=n||[],a.cs=n.length,a.prelim=0,a.mod=0,a.shift=0,a.change=0,a.tl=null,a.tr=null,a.el=null,a.er=null,a.msel=0,a.mser=0}mf.fromNode=function(t,e){if(!t)return null;var r=[];return t.children.forEach(function(n){r.push(mf.fromNode(n,e))}),e?new mf(t.height,t.width,t.x,r):new mf(t.width,t.height,t.y,r)};function gO(t,e,r){r?t.y+=e:t.x+=e,t.children.forEach(function(n){gO(n,e,r)})}function yO(t,e){var r=e?t.y:t.x;return t.children.forEach(function(n){r=Math.min(yO(n,e),r)}),r}function Bse(t,e){var r=yO(t,e);gO(t,-r,e)}function mO(t,e,r){r?e.y=t.x:e.x=t.x,t.c.forEach(function(n,a){mO(n,e.children[a],r)})}function bO(t,e,r){r===void 0&&(r=0),e?(t.x=r,r+=t.width):(t.y=r,r+=t.height),t.children.forEach(function(n){bO(n,e,r)})}var Gse=function(t,e){e===void 0&&(e={});var r=e.isHorizontal;function n(m){if(m.cs===0){a(m);return}n(m.c[0]);for(var b=g(f(m.c[0].el),0,null),w=1;w<m.cs;++w){n(m.c[w]);var x=f(m.c[w].er);i(m,w,b),b=g(x,w,b)}h(m),a(m)}function a(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 i(m,b,w){for(var x=m.c[b-1],E=x.mod,_=m.c[b],S=_.mod;x!==null&&_!==null;){f(x)>w.low&&(w=w.nxt);var A=E+x.prelim+x.w-(S+_.prelim);A>0&&(S+=A,o(m,b,w.index,A));var M=f(x),C=f(_);M<=C&&(x=u(x),x!==null&&(E+=x.mod)),M>=C&&(_=s(_),_!==null&&(S+=_.mod))}!x&&_?l(m,b,_,S):x&&!_&&c(m,b,x,E)}function o(m,b,w,x){m.c[b].mod+=x,m.c[b].msel+=x,m.c[b].mser+=x,v(m,b,w,x)}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,w,x){var E=m.c[0].el;E.tl=w;var _=x-w.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,w,x){var E=m.c[b].er;E.tr=w;var _=x-w.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 w=0;w<m.cs;w++)d(m.c[w],b)}function v(m,b,w,x){if(w!==b-1){var E=b-w;m.c[w+1].shift+=x/E,m.c[b].shift-=x/E,m.c[b].change-=x-x/E}}function p(m){for(var b=0,w=0,x=0;x<m.cs;x++)b+=m.c[x].shift,w+=b+m.c[x].change,m.c[x].mod+=w}function g(m,b,w){for(;w!==null&&m>=w.low;)w=w.nxt;return{low:m,index:b,nxt:w}}bO(t,r);var y=mf.fromNode(t,r);return n(y),d(y,0),mO(y,t,r),Bse(t,r),t},G2=pO,wO=function(t,e){for(var r=G2(t.data,e,!0),n=G2(t.data,e,!0),a=t.children.length,i=Math.round(a/2),o=e.getSide||function(l,c){return c<i?"right":"left"},s=0;s<a;s++){var u=t.children[s],f=o(u,s);f==="right"?n.children.push(u):r.children.push(u)}return r.eachNode(function(l){l.isRoot()||(l.side="left")}),n.eachNode(function(l){l.isRoot()||(l.side="right")}),{left:r,right:n}},zse=wO,Fi=["LR","RL","TB","BT","H","V"],jse=["LR","RL","H"],Use=function(e){return jse.indexOf(e)>-1},$se=Fi[0],h1=function(t,e,r){var n=e.direction||$se;if(e.isHorizontal=Use(n),Fi.indexOf(n)===-1)throw new TypeError("Invalid direction: "+n);if(n===Fi[0])r(t,e);else if(n===Fi[1])r(t,e),t.right2left();else if(n===Fi[2])r(t,e);else if(n===Fi[3])r(t,e),t.bottom2top();else if(n===Fi[4]||n===Fi[5]){var a=zse(t,e),i=a.left,o=a.right;r(i,e),r(o,e),e.isHorizontal?i.right2left():i.bottom2top(),o.translate(i.x-o.x,i.y-o.y),t.x=i.x,t.y=o.y;var s=t.getBoundingBox();e.isHorizontal?s.top<0&&t.translate(0,-s.top):s.left<0&&t.translate(-s.left,0)}var u=e.fixedRoot;return u===void 0&&(u=!0),u&&t.translate(-(t.x+t.width/2+t.hgap),-(t.y+t.height/2+t.vgap)),Xse(t,e),t};function Xse(t,e){if(e.radial){var r=e.isHorizontal?["x","y"]:["y","x"],n=r[0],a=r[1],i={x:1/0,y:1/0},o={x:-1/0,y:-1/0},s=0;t.DFTraverse(function(l){s++;var c=l.x,h=l.y;i.x=Math.min(i.x,c),i.y=Math.min(i.y,h),o.x=Math.max(o.x,c),o.y=Math.max(o.y,h)});var u=o[a]-i[a];if(u===0)return;var f=Math.PI*2/s;t.DFTraverse(function(l){var c=(l[a]-i[a])/u*(Math.PI*2-f)+f,h=l[n]-t[n];l.x=Math.cos(c)*h,l.y=Math.sin(c)*h})}}function Wse(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Xg(t,e)}function Xg(t,e){return Xg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Xg(t,e)}var Vse=hv,Yse=Gse,qse=h1,Hse=oo,Zse=function(t){function e(){return t.apply(this,arguments)||this}Wse(e,t);var r=e.prototype;return r.execute=function(){var a=this;return qse(a.rootNode,a.options,Yse)},e}(Vse),Kse={};function Qse(t,e){return e=Hse.assign({},Kse,e),new Zse(t,e).execute()}var Jse=Qse,eue=oo;function tue(t,e){e===void 0&&(e=[]);var r=this;r.x=r.y=0,r.leftChild=r.rightChild=null,r.height=0,r.children=e}var rue={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function xO(t,e,r){r?(e.x=t.x,e.y=t.y):(e.x=t.y,e.y=t.x),t.children.forEach(function(n,a){xO(n,e.children[a],r)})}var nue=function(t,e){e===void 0&&(e={}),e=eue.assign({},rue,e);var r=0;function n(u){if(!u)return null;u.width=0,u.depth&&u.depth>r&&(r=u.depth);var f=u.children,l=f.length,c=new tue(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 a(u){if(u.isLeaf||u.children.length===0)u.drawingDepth=r;else{var f=u.children.map(function(c){return a(c)}),l=Math.min.apply(null,f);u.drawingDepth=l-1}return u.drawingDepth}var i;function o(u){u.x=u.drawingDepth*e.rankSep,u.isLeaf?(u.y=0,i&&(u.y=i.y+i.height+e.nodeSep,u.originNode.parent!==i.originNode.parent&&(u.y+=e.subTreeSep)),i=u):(u.children.forEach(function(f){o(f)}),u.y=(u.leftChild.y+u.rightChild.y)/2)}var s=n(t);return a(s),o(s),xO(s,t,e.isHorizontal),t};function aue(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Wg(t,e)}function Wg(t,e){return Wg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Wg(t,e)}var iue=hv,oue=nue,sue=h1,uue=oo,fue=function(t){function e(){return t.apply(this,arguments)||this}aue(e,t);var r=e.prototype;return r.execute=function(){var a=this;return a.rootNode.width=0,sue(a.rootNode,a.options,oue)},e}(iue),lue={};function cue(t,e){return e=uue.assign({},lue,e),new fue(t,e).execute()}var hue=cue,z2=oo;function due(t,e,r,n,a){var i=(typeof r=="function"?r(t):r)*t.depth;if(!n)try{if(t.id===t.parent.children[0].id){t.x+=i,t.y=e?e.y:0;return}}catch{}if(t.x+=i,e){if(t.y=e.y+z2.getHeight(e,t,a),e.parent&&t.parent.id!==e.parent.id){var o=e.parent,s=o.y+z2.getHeight(o,t,a);t.y=s>t.y?s:t.y}}else t.y=0}var vue=function(t,e,r,n){var a=null;t.eachNode(function(i){due(i,a,e,r,n),a=i})};function pue(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Vg(t,e)}function Vg(t,e){return Vg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Vg(t,e)}var gue=hv,Vc=vue,yue=wO,mue=oo,bf=["LR","RL","H"],bue=bf[0],wue=function(t){function e(){return t.apply(this,arguments)||this}pue(e,t);var r=e.prototype;return r.execute=function(){var a=this,i=a.options,o=a.rootNode;i.isHorizontal=!0;var s=i.indent,u=s===void 0?20:s,f=i.dropCap,l=f===void 0?!0:f,c=i.direction,h=c===void 0?bue:c,d=i.align;if(h&&bf.indexOf(h)===-1)throw new TypeError("Invalid direction: "+h);if(h===bf[0])Vc(o,u,l,d);else if(h===bf[1])Vc(o,u,l,d),o.right2left();else if(h===bf[2]){var v=yue(o,i),p=v.left,g=v.right;Vc(p,u,l,d),p.right2left(),Vc(g,u,l,d);var y=p.getBoundingBox();g.translate(y.width,0),o.x=g.x-o.width/2}return o},e}(gue),xue={};function Eue(t,e){return e=mue.assign({},xue,e),new wue(t,e).execute()}var _ue=Eue,Sue=oo;function EO(t,e){var r=0;return t.children.length?t.children.forEach(function(n){r+=EO(n,e)}):r=t.height,t._subTreeSep=e.getSubTreeSep(t.data),t.totalHeight=Math.max(t.height,r)+2*t._subTreeSep,t.totalHeight}function _O(t){var e=t.children,r=e.length;if(r){e.forEach(function(u){_O(u)});var n=e[0],a=e[r-1],i=a.y-n.y+a.height,o=0;if(e.forEach(function(u){o+=u.totalHeight}),i>t.height)t.y=n.y+i/2-t.height/2;else if(e.length!==1||t.height>o){var s=t.y+(t.height-i)/2-n.y;e.forEach(function(u){u.translate(0,s)})}else t.y=(n.y+n.height/2+a.y+a.height/2)/2-t.height/2}}var Mue={getSubTreeSep:function(){return 0}},Aue=function(t,e){e===void 0&&(e={}),e=Sue.assign({},Mue,e),t.parent={x:0,width:0,height:0,y:0},t.BFTraverse(function(r){r.x=r.parent.x+r.parent.width}),t.parent=null,EO(t,e),t.startY=0,t.y=t.totalHeight/2-t.height/2,t.eachNode(function(r){var n=r.children,a=n.length;if(a){var i=n[0];if(i.startY=r.startY+r._subTreeSep,a===1)i.y=r.y+r.height/2-i.height/2;else{i.y=i.startY+i.totalHeight/2-i.height/2;for(var o=1;o<a;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}}}}),_O(t)};function Cue(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Yg(t,e)}function Yg(t,e){return Yg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Yg(t,e)}var Tue=hv,Iue=Aue,kue=h1,Nue=oo,Oue=function(t){function e(){return t.apply(this,arguments)||this}Cue(e,t);var r=e.prototype;return r.execute=function(){var a=this;return kue(a.rootNode,a.options,Iue)},e}(Tue),Lue={};function Due(t,e){return e=Nue.assign({},Lue,e),new Oue(t,e).execute()}var Pue=Due,Rue={compactBox:Jse,dendrogram:hue,indented:_ue,mindmap:Pue},Fue=Rue;const j2=bi(Fue);var U2=Za.traverseTree,Bue=function(e,r){var n;return e?Ot(e)?n=function(i){return e}:n=e:n=function(i){return r||1},n},Gue=function(e,r){var n=[],a=[],i={},o=0;for(o=0;o<e.length;o++){var s=e[o];i[s.id]=o,n.push(s.x),n.push(s.y),n.push(0),n.push(0),a.push([])}for(o=0;o<r.length;o++){var u=r[o];a[i[u.source]].push(i[u.target]),a[i[u.target]].push(i[u.source])}var f=0;for(o=0;o<e.length;o++){var l=n.length,c=a[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}},zue=function(e,r,n){var a=[],i=[],o={},s=0;for(s=0;s<e.length;s++){var u=e[s];o[u.id]=s,a.push(u.x),a.push(u.y),a.push(0),a.push(0),i.push([])}for(s=0;s<r.length;s++){var f=r[s];i[o[f.source]].push(o[f.target]),i[o[f.source]].push(n(f)),i[o[f.target]].push(o[f.source]),i[o[f.target]].push(n(f))}var l=0;for(s=0;s<e.length;s++){var c=a.length,h=i[s],d=h.length;a[s*4+2]=c,a[s*4+3]=d/2,l=Math.max(l,d/2);for(var v=0;v<d;++v){var p=h[v];a.push(+p)}}for(;a.length%4!==0;)a.push(0);return{array:new Float32Array(a),maxEdgePerVetex:l}},jue=function(e,r,n,a){var i=[],o=[],s={},u=0;for(u=0;u<e.length;u++){var f=e[u];s[f.id]=u,i.push(f.x),i.push(f.y),i.push(0),i.push(0),o.push([])}for(u=0;u<r.length;u++){var l=r[u];o[s[l.source]].push(s[l.target]),o[s[l.source]].push(n(l)),o[s[l.source]].push(a(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(a(l)),o[s[l.target]].push(0)}var c=0;for(u=0;u<e.length;u++){var h=i.length,d=o[u],v=d.length;i[u*4+2]=h+1048576*v/4,i[u*4+3]=0,c=Math.max(c,v/4);for(var p=0;p<v;++p){var g=d[p];i.push(+g)}}for(;i.length%4!==0;)i.push(0);return{array:new Float32Array(i),maxEdgePerVetex:c}},Uue=function(e,r){var n=[],a=e.length,i={};return r.forEach(function(o){e.forEach(function(s,u){if(i[o[s]]===void 0&&(i[o[s]]=Object.keys(i).length),n.push(i[o[s]]),u===a-1)for(;n.length%4!==0;)n.push(0)})}),{array:new Float32Array(n),count:Object.keys(i).length}},$ue=function(e){for(var r=[],n=e.length,a=e[0].length,i=function(u){e.forEach(function(f,l){if(r.push(f[u]),l===n-1)for(;r.length%4!==0;)r.push(0)})},o=0;o<a;o++)i(o);return new Float32Array(r)},Xue=function(e,r){var n=["V","TB","BT"],a={x:1/0,y:1/0},i={x:-1/0,y:-1/0},o="x",s="y";r&&n.indexOf(r)>=0&&(s="x",o="y");var u=0;U2(e,function(c){return u++,c.x>i.x&&(i.x=c.x),c.x<a.x&&(a.x=c.x),c.y>i.y&&(i.y=c.y),c.y<a.y&&(a.y=c.y),!0});var f=Math.PI*2/u,l=i[s]-a[s];return l===0||U2(e,function(c){var h=(c[s]-a[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 Wue=Object.freeze(Object.defineProperty({__proto__:null,arrayToTextureData:$ue,attributesToTextureData:Uue,buildTextureData:Gue,buildTextureDataWithOneEdgeAttr:zue,buildTextureDataWithTwoEdgeAttr:jue,proccessToFunc:Bue,radialLayout:Xue},Symbol.toStringTag,{value:"Module"}));var d1=function(){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 r=document.createElement("div");return r.id="webgl-error-message",r.style.fontFamily="monospace",r.style.fontSize="13px",r.style.fontWeight="normal",r.style.textAlign="center",r.style.background="#fff",r.style.color="#000",r.style.padding="1.5em",r.style.width="400px",r.style.margin="5em auto 0",this.webgl||(r.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(`
|
||
`):['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(`
|
||
`)),r},addGetWebGLMessage:function(r){r=r||{};var n=r.parent!==void 0?r.parent:document.body,a=r.id!==void 0?r.id:"oldie",i=d1().getWebGLErrorMessage();i.id=a,n.appendChild(i)}}};const Vue=Object.freeze(Object.defineProperty({__proto__:null,gpuDetector:d1},Symbol.toStringTag,{value:"Module"}));var SO=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 Yue=Object.freeze(Object.defineProperty({__proto__:null,getBrowserName:SO},Symbol.toStringTag,{value:"Module"}));var so=P(P(P(P(P({},Za),yX),Wue),Vue),Yue);so.radialLayout;Kt.registerLayout("grid",Kt.GridLayout);Kt.registerLayout("random",Kt.RandomLayout);Kt.registerLayout("force",Kt.ForceLayout);Kt.registerLayout("circular",Kt.CircularLayout);Kt.registerLayout("dagre",Kt.DagreLayout);Kt.registerLayout("dagreCompound",Kt.DagreCompoundLayout);Kt.registerLayout("radial",Kt.RadialLayout);Kt.registerLayout("concentric",Kt.ConcentricLayout);Kt.registerLayout("mds",Kt.MDSLayout);Kt.registerLayout("fruchterman",Kt.FruchtermanLayout);Kt.registerLayout("fruchterman-gpu",Kt.FruchtermanGPULayout);Kt.registerLayout("gForce",Kt.GForceLayout);Kt.registerLayout("force2",Kt.Force2Layout);Kt.registerLayout("gForce-gpu",Kt.GForceGPULayout);Kt.registerLayout("comboForce",Kt.ComboForceLayout);Kt.registerLayout("comboCombined",Kt.ComboCombinedLayout);Kt.registerLayout("forceAtlas2",Kt.ForceAtlas2Layout);var que=function(){function t(e,r){var n=e.toString(),a=new Blob(["importScripts('".concat(r,"');(").concat(n,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(a))}return t}(),Hue=function(e){e===void 0&&(e="https://unpkg.com/@antv/layout@0.3.23/dist/layout.min.js");function r(){var a={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",GPURUN:"GPU_LAYOUT_RUN"};layout.registerLayout("grid",layout.GridLayout),layout.registerLayout("random",layout.RandomLayout),layout.registerLayout("force",layout.ForceLayout),layout.registerLayout("force2",layout.Force2Layout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),layout.registerLayout("dagreCompound",layout.DagreCompoundLayout),layout.registerLayout("radial",layout.RadialLayout),layout.registerLayout("concentric",layout.ConcentricLayout),layout.registerLayout("mds",layout.MDSLayout),layout.registerLayout("fruchterman",layout.FruchtermanLayout),layout.registerLayout("fruchterman-gpu",layout.FruchtermanGPULayout),layout.registerLayout("gForce",layout.GForceLayout),layout.registerLayout("gForce-gpu",layout.GForceGPULayout),layout.registerLayout("comboForce",layout.ComboForceLayout),layout.registerLayout("comboCombined",layout.ComboCombinedLayout),layout.registerLayout("forceAtlas2",layout.ForceAtlas2Layout);function i(s){var u=s.data.type;return u===a.RUN||u===a.GPURUN}function o(s){var u=this,f=s.data.type;switch(f){case a.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:a.ERROR,message:"layout ".concat(p," not found")});break}var y;v.onLayoutEnd=function(){u.postMessage({type:a.END,nodes:c}),y==null||y.destroy()},y=new g(v),y.init({nodes:c,edges:h}),y.execute();break}case a.GPURUN:{var m=s.data,b=m.nodes,h=m.edges,w=m.layoutCfg,v=w===void 0?{}:w,x=m.canvas,p=v.type,g=layout.getLayoutByName(p);if(!g){this.postMessage({type:a.ERROR,message:"layout ".concat(p," not found")});break}if(p.split("-")[1]!=="gpu"){this.postMessage({type:a.ERROR,message:"layout ".concat(p," does not support GPU")});break}var E=new g(v);E.init({nodes:b,edges:h}),E.executeWithWorker(x,this);break}}}onmessage=function(u){i(u)&&o(u)}}var n=new que(r,e);return n},ks={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};function qg(t){"@babel/helpers - typeof";return qg=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},qg(t)}var $2=function(e){return setTimeout(e,16)},X2=function(e){return clearTimeout(e)},Yc={requestAnimationFrame:function(e){var r=typeof window<"u"&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||$2;return r(e)},cancelAnimationFrame:function(e){var r=typeof window<"u"&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||X2;return r(e)}},Zue=["fruchterman","gForce"],Kue=["force","grid","circular"],Que=function(t){jt(e,t);function e(r){var n=t.call(this,r)||this;return n.graph=r,n.layoutCfg=r.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=Hue(this.layoutCfg.workerScriptURL),this.worker)},e.prototype.stopWorker=function(){var r=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,r.requestId&&(Yc.cancelAnimationFrame(r.requestId),r.requestId=null),r.requestId2&&(Yc.cancelAnimationFrame(r.requestId2),r.requestId2=null))},e.prototype.execLayoutMethod=function(r,n){var a=this;return new Promise(function(i,o){return Bn(a,void 0,void 0,function(){var s,u,f,l,c,p,h,d,v,p,g;return Gn(this,function(y){switch(y.label){case 0:if(s=this.graph,!s||s.get("destroyed"))return[2];u=r.type,r.onLayoutEnd=function(){s.emit("aftersublayout",{type:u}),i()},u&&this.isGPU&&(MO(u)?u="".concat(u,"-gpu"):console.warn("The '".concat(u,"' layout does not support GPU calculation for now, it will run in CPU."))),Za.isForce(u)?(f=r.onTick,l=r.animate,c=l===void 0&&(u==="force"||u==="force2"),p=function(){f&&f(),(l||c)&&s.refreshPositions()},r.tick=p):(u==="comboForce"||u==="comboCombined")&&(r.comboTrees=s.get("comboTrees")),h=!1;try{d=new Kt.Layouts[u](r),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=r.onTick,p=function(){v&&v(),s.refreshPositions()},d.tick=p),g=this.filterLayoutData(this.data,r),tfe(g,n),d.init(g),s.emit("beforesublayout",{type:u}),[4,d.execute()];case 1:return y.sent(),d.isCustomLayout&&r.onLayoutEnd&&r.onLayoutEnd(),[2]}})})})},e.prototype.updateLayoutMethod=function(r,n){var a=this;return new Promise(function(i,o){return Bn(a,void 0,void 0,function(){var s,u,f,l,c,h,d;return Gn(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}),i()},Za.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),r.init(d),r.updateCfg(n),s.emit("beforesublayout",{type:u}),[4,r.execute()];case 1:return v.sent(),r.isCustomLayout&&n.onLayoutEnd&&n.onLayoutEnd(),[2]}})})})},e.prototype.layout=function(r){var n=this,a,i=this.graph;if(!(!i||i.get("destroyed"))){this.data=this.setDataFromGraph();var o=this.data,s=o.nodes,u=o.hiddenNodes;if(!s)return!1;var f=i.get("width"),l=i.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;(a=this.layoutMethods)===null||a===void 0||a.forEach(function(x){var E;return d=!!(!((E=x.nodes)===null||E===void 0)&&E.length)||d});var v=this.destoryLayoutMethods();i.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=W2(c,h);var y=c.onLayoutEnd,m=c.layoutEndFormatted,b=c.adjust;if(m||(c.layoutEndFormatted=!0,c.onAllLayoutEnd=function(){return Bn(n,void 0,void 0,function(){return Gn(this,function(x){switch(x.label){case 0:return y&&y(s),this.refreshLayout(),b&&c.pipes?[4,this.adjustPipesBox(this.data,b)]:[3,2];case 1:x.sent(),this.refreshLayout(),x.label=2;case 2:return i.emit("afterlayout"),[2]}})})}),this.stopWorker(),c.workerEnabled&&this.layoutWithWorker(this.data,r))return!0;var w=!1;return c.type?(w=!0,p=p.then(function(){return Bn(n,void 0,void 0,function(){return Gn(this,function(x){switch(x.label){case 0:return[4,this.execLayoutMethod(c,0)];case 1:return[2,x.sent()]}})})})):c.pipes&&(w=!0,c.pipes.forEach(function(x,E){p=p.then(function(){return Bn(n,void 0,void 0,function(){return Gn(this,function(_){switch(_.label){case 0:return[4,this.execLayoutMethod(x,E)];case 1:return[2,_.sent()]}})})})})),w?p.then(function(){c.onAllLayoutEnd&&c.onAllLayoutEnd(),r&&r()}).catch(function(x){console.warn("graph layout failed,",x)}):(i.refreshPositions(),r==null||r()),!1}},e.prototype.tweakInit=function(){var r=this,n=r.data,a=r.graph,i=n.nodes,o=n.edges;if(i!=null&&i.length){var s={};i.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=a.get("width"),f=a.get("height");i.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(r,n){var a=this;return new Promise(function(i,o){return Bn(a,void 0,void 0,function(){var s,u,f,l,c,h,d;return Gn(this,function(v){switch(v.label){case 0:return s=this,u=s.layoutCfg,f=s.data,l=u.preset,!(l!=null&&l.type)||!Kt.Layouts[l==null?void 0:l.type]?(n==null||n(),i(),[2,!1]):(c=W2(l,l.type),h=c?"".concat(l.type,"-gpu"):l.type,d=new Kt.Layouts[h](l),delete u.preset,d.init(f),[4,d.execute()]);case 1:return v.sent(),r==null||r(),i(),[2,!0]}})})})},e.prototype.layoutWithWorker=function(r,n){var a=this,i=this,o=i.layoutCfg,s=i.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 a.runWebworker(u,r,o)});else if(o.pipes){c=!0;for(var h=function(y){l=l.then(function(){return a.runWebworker(u,r,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(r,n,a){var i=this,o=this.isGPU,s=this.filterLayoutData(n,a),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=Jue(a,function(v){return typeof v!="function"});if(!c)r.postMessage({type:ks.RUN,nodes:u,edges:f,layoutCfg:h});else{var d=l.transferControlToOffscreen();h.type="".concat(h.type,"-gpu"),r.postMessage({type:ks.GPURUN,nodes:u,edges:f,layoutCfg:h,canvas:d},[d])}return new Promise(function(v,p){r.onmessage=function(g){i.handleWorkerMessage(v,p,g,s,a)}})},e.prototype.handleWorkerMessage=function(r,n,a,i,o){var s=this,u=s.graph,f=s.workerData,l=a.data,c=l.type,h=function(){o.onTick&&o.onTick()};switch(c){case ks.TICK:f.currentTick=l.currentTick,f.currentTickData=l,f.requestId||(f.requestId=Yc.requestAnimationFrame(function(){g0(i,l),u.refreshPositions(),h(),l.currentTick===l.totalTicks?r():f.currentTick===l.totalTicks&&(f.requestId2=Yc.requestAnimationFrame(function(){g0(i,f.currentTickData),u.refreshPositions(),f.requestId2=null,h(),r()})),f.requestId=null}));break;case ks.END:f.currentTick==null&&(g0(i,l),r());break;case ks.GPUEND:f.currentTick==null&&(efe(i,l),r());break;case ks.ERROR:console.warn("Web-Worker layout error!",l.message),n();break;default:n();break}},e.prototype.updateLayoutCfg=function(r){var n=this,a=this,i=a.graph,o=a.layoutMethods;if(!(!i||i.get("destroyed"))){var s=r.disableTriggerLayout,u=Kr(r,["disableTriggerLayout"]),f=Et({},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))){i.emit("beforelayout");var l=Promise.resolve(),c=!1;(o==null?void 0:o.length)===1?(c=!0,l=l.then(function(){return Bn(n,void 0,void 0,function(){return Gn(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 Bn(n,void 0,void 0,function(){return Gn(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(r,n){var a=this;return new Promise(function(i){var o=r.nodes;o!=null&&o.length||i(),Kue.includes(n)||(console.warn("The adjust type ".concat(n," is not supported yet, please assign it with 'force', 'grid', or 'circular'.")),i());var s={center:a.layoutCfg.center,nodeSize:function(v){return Math.max(v.height,v.width)},preventOverlap:!0,onLayoutEnd:function(){}},u=a.getLayoutBBox(o),f=u.groupNodes,l=u.layoutNodes,c=rr(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(w){w.x+=m,w.y+=b})}),i()};var h=new Kt.Layouts[n](s);h.layout({nodes:l})})},e.prototype.destroy=function(){this.destoryLayoutMethods();var r=this.worker;r&&(r.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}(R8);function g0(t,e){for(var r=t.nodes,n=e.nodes,a=r.length,i=0;i<a;i++){var o=r[i];o.x=n[i].x,o.y=n[i].y}}function Jue(t,e){var r={};return t&&qg(t)==="object"?(Object.keys(t).forEach(function(n){t.hasOwnProperty(n)&&e(t[n])&&(r[n]=t[n])}),r):t}function efe(t,e){for(var r=t.nodes,n=e.vertexEdgeData,a=r.length,i=0;i<a;i++){var o=r[i],s=n[4*i],u=n[4*i+1];o.x=s,o.y=u}}function tfe(t,e){var r;if(!((r=t==null?void 0:t.nodes)===null||r===void 0)&&r.length){var n=t.nodes;n.forEach(function(a){a.layoutOrder=e})}}function MO(t){return Zue.includes(t)}function W2(t,e){var r=e;e&&e.split("-")[1]==="gpu"&&(r=e.split("-")[0],t.gpuEnabled=!0);var n=!1;return t.gpuEnabled&&(n=!0,d1().webgl||(console.warn("Your browser does not support webGL or GPGPU. The layout will run in CPU."),n=!1)),n&&!MO(r)&&(console.warn("The '".concat(r,"' layout does not support GPU calculation for now, it will run in CPU.")),n=!1),n}var V2=eo,rfe="svg",AO=function(t){jt(e,t);function e(r){var n=t.call(this,r)||this,a=n.get("defaultNode");return a||n.set("defaultNode",{type:"circle"}),a.type||(a.type="circle",n.set("defaultNode",a)),n.destroyed=!1,n}return e.prototype.initLayoutController=function(){var r=new Que(this);this.set({layoutController:r})},e.prototype.initEventController=function(){var r=new _X(this);this.set({eventController:r})},e.prototype.initCanvas=function(){var r=this.get("container");if(typeof r=="string"&&(r=document.getElementById(r),this.set("container",r)),!r)throw new Error("invalid container");var n=r.clientWidth,a=r.clientHeight,i=this.get("width")||n,o=this.get("height")||a;!this.get("width")&&!this.get("height")&&(this.set("width",n),this.set("height",a));var s=this.get("renderer"),u;if(s===rfe)u=new Tp({container:r,width:i,height:o});else{var f={container:r,width:i,height:o},l=this.get("pixelRatio");l&&(f.pixelRatio=l,window.devicePixelRatio=l),u=new qu(f)}this.set("canvas",u)},e.prototype.initPlugins=function(){var r=this;_e(r.get("plugins"),function(n){!n.destroyed&&n.initPlugin&&n.initPlugin(r)})},e.prototype.downloadImageWatermark=function(r,n,a,i){return Bn(this,void 0,void 0,function(){var o,s,u;return Gn(this,function(f){switch(f.label){case 0:return o=r.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,a,i),n.fillStyle=c,n.fill(),l("")}})];case 1:return f.sent(),[2]}})})},e.prototype.asyncToDataUrl=function(r,n,a,i,o,s){var u=this,f=document.querySelector(".g6-graph-watermarker"),l=this.get("canvas"),c=l.getRenderer(),h=s||l.get("el"),d="";r||(r="image/png"),setTimeout(function(){return Bn(u,void 0,void 0,function(){var v,p,g,y,m,b,w,x,E,_;return Gn(this,function(S){switch(S.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"),w=i||this.get("width"),x=o||this.get("height"),E=void 0,f?[4,this.downloadImageWatermark(f,b,w,x)]:[3,3];case 2:S.sent(),S.label=3;case 3:if(n){_=typeof window<"u"?window.devicePixelRatio:1;try{m=b.getImageData(0,0,w*_,x*_),E=b.globalCompositeOperation,b.globalCompositeOperation="destination-over",b.fillStyle=n,b.fillRect(0,0,w,x)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}d=h.toDataURL(r),n&&(b.clearRect(0,0,w,x),b.putImageData(m,0,0),b.globalCompositeOperation=E),S.label=4;case 4:return a&&a(d),[2]}})})},16)},e.prototype.toDataURL=function(r,n){var a=this.get("canvas"),i=a.getRenderer(),o=a.get("el");r||(r="image/png");var s="";if(i==="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(r),n&&(d.clearRect(0,0,v,p),d.putImageData(h,0,0),d.globalCompositeOperation=g)}return s},e.prototype.toFullDataURL=function(r,n,a){var i=this.get("group").getCanvasBBox(),o=i.height,s=i.width,u=this.get("renderer"),f=cg('<div id="virtual-image"></div>'),l=a?a.backgroundColor:void 0,c=a?a.padding:void 0;c?Ot(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 Tp(v):new qu(v),g=this.get("group"),y=g.clone(),m=rr(y.getMatrix());m||(m=[1,0,0,0,1,0,0,0,1]);var b=(i.maxX+i.minX)/2,w=(i.maxY+i.minY)/2;m=V2(m,[["t",-b,-w],["t",s/2+c[3],o/2+c[0]]]),y.resetMatrix(),y.setMatrix(m),p.add(y);var x=p.get("el"),E="";n||(n="image/png"),setTimeout(function(){if(u==="svg"){var _=x.cloneNode(!0),S=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),A=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",S);A.replaceChild(_,A.documentElement);var M=new XMLSerializer().serializeToString(A);E="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(M))}else{var C=void 0,I=x.getContext("2d"),k=void 0;if(l){var O=typeof window<"u"?window.devicePixelRatio:1;try{C=I.getImageData(0,0,d*O,h*O),k=I.globalCompositeOperation,I.globalCompositeOperation="destination-over",I.fillStyle=l,I.fillRect(0,0,d,h)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}E=x.toDataURL(n),l&&(I.clearRect(0,0,d,h),I.putImageData(C,0,0),I.globalCompositeOperation=k)}r&&r(E)},16)},e.prototype.downloadFullImage=function(r,n,a){var i=this,o=this.get("group").getCanvasBBox(),s=o.height,u=o.width,f=this.get("renderer"),l=cg('<div id="virtual-image"></div>'),c=document.querySelector(".g6-graph-watermarker"),h=a?a.backgroundColor:void 0,d=a?a.padding:void 0;d?Ot(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},w=f==="svg"?new Tp(b):new qu(b),x=this.get("group"),E=wX(x),_=rr(E.getMatrix());_||(_=[1,0,0,0,1,0,0,0,1]);var S=(o.maxX+o.minX)/2,A=(o.maxY+o.minY)/2;_=V2(_,[["t",-S,-A],["t",u/2+d[3],s/2+d[0]]]),E.resetMatrix(),E.setMatrix(_),w.add(E);var M=w.get("el");n||(n="image/png"),this.asyncToDataUrl(n,h,function(C){var I=document.createElement("a"),k=(r||"graph")+(f==="svg"?".svg":".".concat(n.split("/")[1]));i.dataURLToImage(C,f,I,k);var O=document.createEvent("MouseEvents");O.initEvent("click",!1,!1),I.dispatchEvent(O)},p,v,M)},e.prototype.downloadImage=function(r,n,a){var i=this,o=this;o.stopAnimate();var s=o.get("canvas"),u=s.getRenderer();n||(n="image/png");var f=(r||"graph")+(u==="svg"?".svg":".".concat(n.split("/")[1])),l=document.createElement("a");o.asyncToDataUrl(n,a,function(c){i.dataURLToImage(c,u,l,f);var h=document.createEvent("MouseEvents");h.initEvent("click",!1,!1),l.dispatchEvent(h)})},e.prototype.dataURLToImage=function(r,n,a,i){if(!r||r==="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=r.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,i):a.addEventListener("click",function(){a.download=i,a.href=window.URL.createObjectURL(h)})}else a.addEventListener("click",function(){a.download=i,a.href=r})},e.prototype.addPlugin=function(r){var n=this;r.destroyed||(n.get("plugins").push(r),r.initPlugin(n))},e.prototype.removePlugin=function(r){var n=this.get("plugins"),a=n.indexOf(r);a>=0&&(r.destroyPlugin(),n.splice(a,1))},e.prototype.setImageWaterMarker=function(r,n){r===void 0&&(r=Mf.waterMarkerImage);var a=this.get("container");Ye(a)&&(a=document.getElementById(a)),a.style.position||(a.style.position="relative");var i=this.get("graphWaterMarker"),o=_r({},Mf.imageWaterMarkerConfig,n),s=o.width,u=o.height,f=o.compatible,l=o.image;if(!r){var c=f?a:document.querySelector(".g6-graph-watermarker");c&&(c.style.cssText=void 0),i&&i.clear();return}if(i)i.clear();else{var h={container:a,width:s,height:u,capture:!1},d=this.get("pixelRatio");d&&(h.pixelRatio=d,window.devicePixelRatio=d),i=new qu(h),this.set("graphWaterMarker",i)}i.get("el").style.display="none";var v=i.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=r,m.onload=function(){if(v.drawImage(m,g,y,l.width,l.height),v.rotate(p*Math.PI/180),f)a.style.cssText="background-image: url(".concat(i.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",i.destroyed||(b.style.cssText="background-image: url(".concat(i.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;"),a.appendChild(b))}}},e.prototype.setTextWaterMarker=function(r,n){var a=this.get("container");Ye(a)&&(a=document.getElementById(a)),a.style.position||(a.style.position="relative");var i=this.get("graphWaterMarker"),o=_r({},Mf.textWaterMarkerConfig,n),s=o.width,u=o.height,f=o.compatible,l=o.text;if(!(r!=null&&r.length)){var c=f?a:document.querySelector(".g6-graph-watermarker");c&&(c.style.cssText=void 0),i&&i.clear();return}if(i)i.clear();else{var h={container:a,width:s,height:u,capture:!1},d=this.get("pixelRatio");d&&(h.pixelRatio=d,window.devicePixelRatio=d),i=new qu(h),this.set("graphWaterMarker",i)}i.get("el").style.display="none";var v=i.get("context"),p=l.rotate,g=l.fill,y=l.fontFamily,m=l.fontSize,b=l.baseline,w=l.x,x=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 _=Ye(r)?[r]:r,S=_.length-1;S>=0;S--)v.fillText(_[S],w,x+S*E);if(v.rotate(p*Math.PI/180),f)a.style.cssText="background-image: url(".concat(i.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var A=document.querySelector(".g6-graph-watermarker");A||(A=document.createElement("div"),A.className="g6-graph-watermarker"),A.style.cssText="background-image: url(".concat(i.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:99;"),a.appendChild(A)}},e.prototype.destroy=function(){var r,n,a,i;_e(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)}}(r=this.get("eventController"))===null||r===void 0||r.destroy(),(n=this.get("layoutController"))===null||n===void 0||n.destroy(),(a=this.get("graphWaterMarker"))===null||a===void 0||a.destroy(),(i=document.querySelector(".g6-graph-watermarker"))===null||i===void 0||i.remove(),t.prototype.destroy.call(this)},e}(_8);function Hg(t){"@babel/helpers - typeof";return Hg=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},Hg(t)}function CO(t,e){if(e===void 0&&(e=new WeakMap),t===null)return t;if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Hg(t)!=="object")return t;if(e.get(t))return e.get(t);var r=Array.isArray(t)?[]:{};e.set(t,r);for(var n in t)t.hasOwnProperty(n)&&t[n]!==void 0&&(r[n]=CO(t[n],e));return r}function nfe(t){try{return structuredClone(t)}catch{return CO(t)}}var afe=so.radialLayout,y0=so.traverseTree;(function(t){jt(e,t);function e(r){var n=t.call(this,r)||this;return n.layoutAnimating=!1,n.set("removeList",[]),n.set("layoutMethod",n.getLayout()),n}return e.prototype.getLayout=function(){var r=this.get("layout");return r?typeof r=="function"?r:(r.type||(r.type="dendrogram"),r.direction||(r.direction=r.type==="indented"?"LR":"TB"),r.radial?function(n){var a=j2[r.type](n,r);return afe(a),a}:function(n){return j2[r.type](n,r)}):null},e.indexOfChild=function(r,n){var a=-1;return _e(r,function(i,o){if(n===i.id)return a=o,!1}),a},e.prototype.getDefaultCfg=function(){var r=t.prototype.getDefaultCfg.call(this);return r.animate=!0,r},e.prototype.innerAddChild=function(r,n,a){var i=this,o=r.data;o&&(o.x=r.x,o.y=r.y,o.depth=r.depth);var s=i.addItem("node",o,!1);if(n){if(s.set("parent",n),a){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]),i.addItem("edge",{source:n.get("id"),target:s.get("id"),id:"".concat(n.get("id"),":").concat(s.get("id"))},!1)}return _e(r.children||[],function(c){i.innerAddChild(c,s,a)}),i.emit("afteraddchild",{item:s,parent:n}),s},e.prototype.innerUpdateChild=function(r,n,a){var i=this,o=i.findById(r.id);if(!o){i.innerAddChild(r,n,a);return}_e(r.children||[],function(v){i.innerUpdateChild(v,o,a)});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(r.children||[],l.id)===-1&&(i.innerRemoveChild(l.id,{x:r.x,y:r.y},a),s.splice(f,1))}}var c,h;o.get("originAttrs")&&(c=o.get("originAttrs").x,h=o.get("originAttrs").y);var d=o.getModel();a&&o.set("originAttrs",{x:d.x,y:d.y}),o.set("model",Object.assign(d,r.data)),(c!==r.x||h!==r.y)&&o.updatePosition({x:r.x,y:r.y})},e.prototype.innerRemoveChild=function(r,n,a){var i=this,o=i.findById(r);if(o)if(_e(o.get("children"),function(u){i.innerRemoveChild(u.getModel().id,n,a)}),a){var s=o.getModel();o.set("to",n),o.set("originAttrs",{x:s.x,y:s.y}),i.get("removeList").push(o)}else i.removeItem(o,!1)},e.prototype.changeData=function(r,n){n===void 0&&(n=!0);var a=this;this.getNodes().map(function(i){return a.clearItemStates(i)}),this.getEdges().map(function(i){return a.clearItemStates(i)}),n&&this.get("enabledStack")&&this.pushStack("changedata",{before:a.get("originData"),after:r||a.get("data")}),r?(a.data(r),a.render(!1)):a.layout(this.get("fitView"))},e.prototype.changeLayout=function(r){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");var n=this;n.updateLayout(r)},e.prototype.updateLayout=function(r,n,a,i){i===void 0&&(i=!0);var o=this;if(!r){console.warn("layout cannot be null");return}if(i&&this.get("enabledStack")&&this.pushStack("layout",{before:o.get("layout"),after:r}),o.set("layout",r),o.set("layoutMethod",o.getLayout()),o.layout(),n){var s=a;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(r){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");var n=this;n.layout(r)},e.prototype.layout=function(r){var n=this,a=this,i=a.get("data"),o=a.get("layoutMethod"),s=a.get("layout"),u=i;if(s!=null&&s.excludeInvisibles){i=rr(a.get("data"));var f={};y0(i,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(i,a.get("layout")):i,y0(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(i,a.get("layout")):i;var l=a.get("animate");if(a.emit("beforerefreshlayout",{data:i,layoutData:u}),a.emit("beforelayout"),a.innerUpdateChild(u,void 0,l),r){var c=a.get("viewController");c.fitView()}l?a.layoutAnimate(u):(a.refresh(),a.paint()),a.emit("afterrefreshlayout",{data:i,layoutData:u}),a.emit("afterlayout")},e.prototype.addChild=function(r,n,a){a===void 0&&(a=!0);var i=this;i.emit("beforeaddchild",{model:r,parent:n}),Ye(n)||(n=n.get("id"));var o=i.findDataById(n);if(o){o.children||(o.children=[]),o.children.push(r);var s=i.findById(n);s.refresh(),i.changeData(void 0,a)}},e.prototype.updateChildren=function(r,n,a){a===void 0&&(a=!0);var i=this,o=i.findById(n);if(!n||!o){console.warn("Update children failed! There is no node with id '".concat(n,"'"));return}var s=i.findDataById(n);s.children=r,o.refresh(),i.changeData(void 0,a)},e.prototype.updateChild=function(r,n,a){a===void 0&&(a=!0);var i=this;if(!n||!i.findById(n)){i.changeData(r,a);return}var o=i.findDataById(n),s=i.findById(r.id);if(o.children||(o.children=[]),!s)o.children.push(r);else{var u=e.indexOfChild(o.children,r.id);u>-1&&(o.children[u]=r)}var f=i.findById(n);f==null||f.refresh(),i.changeData(void 0,a)},e.prototype.removeChild=function(r,n){n===void 0&&(n=!0);var a=this,i=a.findById(r),o;if(i?o=i==null?void 0:i.get("parent"):o=a.getNodes().find(function(c){var h=c.getModel().children||[];return!!h.find(function(d){return d.id===r})}),o&&!o.destroyed){var s=o.get("id"),u=a.findDataById(s),f=u&&u.children||[],l=e.indexOfChild(f,r);f.splice(l,1),o.refresh()}a.changeData(void 0,n)},e.prototype.findDataById=function(r,n){var a=this;if(n||(n=a.get("data")),r===n.id)return n;var i=null;return _e(n.children||[],function(o){if(o.id===r)return i=o,!1;if(i=a.findDataById(r,o),i)return!1}),i},e.prototype.layoutAnimate=function(r,n){var a=this,i=this.get("animateCfg");a.emit("beforeanimate",{data:r}),a.getEdges().forEach(function(o){var s=o.get("model");s.sourceAnchor||(s.sourceAnchor=o.get("sourceAnchorIndex"))}),this.get("canvas").animate(function(o){y0(r,function(s){var u=a.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,r);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}),_e(a.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}),a.refreshPositions()},{duration:i.duration,easing:i.ease,callback:function(){_e(a.getNodes(),function(s){s.set("originAttrs",null)}),_e(a.get("removeList"),function(s){a.removeItem(s,!1)}),a.set("removeList",[]),i.callback&&i.callback(),a.emit("afteranimate",{data:r})},delay:i.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(r){r===void 0&&(r=!0);var n=this,a=n.get("data");if(!a||!gn(a)||!Object.keys(a).length)throw new Error("data must be defined first");n.clear(),r&&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(r){t.prototype.data.call(this,r),this.set("originData",nfe(r))},e})(AO);ro("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:P({},Qe.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).icon,a=n===void 0?{}:n,i=this.getShapeStyle(e),o=_r({},a,e.icon),s="".concat(this.type,"-keyShape"),u=r.addShape("circle",{attrs:i,className:s,name:s,draggable:!0});r.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?r.shapeMap[d]=r.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:d,name:d,draggable:!0}):r.shapeMap[d]=r.addShape("image",{attrs:P({x:-f/2,y:-l/2},o),className:d,name:d,draggable:!0})}return this.drawLinkPoints(e,r),u},drawLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints;if(n){var a=n||{},i=a.top,o=a.left,s=a.right,u=a.bottom,f=a.size,l=a.r,c=Kr(a,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0]/2;if(o){var v="link-point-left";r.shapeMap[v]=r.addShape("circle",{attrs:P(P({},c),{x:-d,y:0,r:f/2||l||5}),className:v,name:v,isAnchorPoint:!0})}if(s){var p="link-point-right";r.shapeMap[p]=r.addShape("circle",{attrs:P(P({},c),{x:d,y:0,r:f/2||l||5}),className:p,name:p,isAnchorPoint:!0})}if(i){var g="link-point-top";r.shapeMap[g]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:-d,r:f/2||l||5}),className:g,name:g,isAnchorPoint:!0})}if(u){var y="link-point-bottom";r.shapeMap[y]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:d,r:f/2||l||5}),className:y,name:y,isAnchorPoint:!0})}}},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=_r({},r,n),i=this.getSize(e),o=i[0]/2,s=P({x:0,y:0,r:o},a);return s},update:function(e,r,n){var a=r.getContainer(),i=this.getSize(e),o=P({},e.style);e.style.stroke===void 0&&e.color&&(o.stroke=e.color),e.style.r===void 0&&!isNaN(i[0])&&(o.r=i[0]/2),this.updateShape(e,r,o,!0,n),this.updateLinkPoints(e,a)}},"single-node");ro("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:P({},Qe.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(e,r){var n=this.getShapeStyle(e),a=r.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return r.shapeMap["".concat(this.type,"-keyShape")]=a,this.drawLinkPoints(e,r),a},drawLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,a=n===void 0?{}:n,i=a.top,o=a.left,s=a.right,u=a.bottom,f=a.size,l=a.r,c=Kr(a,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},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 r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getSize(e),o=a.width||i[0],s=a.height||i[1],u=P({x:-o/2,y:-s/2,width:o,height:s},a);return u},update:function(e,r,n){var a=r.getContainer(),i=this.getOptions({}).style,o=this.getSize(e),s=r.get("keyShape");e.size||(o[0]=s.attr("width")||i.width,o[1]=s.attr("height")||i.height);var u={stroke:e.color,x:-o[0]/2,y:-o[1]/2,width:o[0],height:o[1]},f=Et({},i,s.attr(),u);f=Et(f,e.style),this.updateShape(e,r,f,!1,n),this.updateLinkPoints(e,a)}},"single-node");ro("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:P({},Qe.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).icon,a=n===void 0?{}:n,i=this.getShapeStyle(e),o=r.addShape("ellipse",{attrs:i,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});r.shapeMap["ellipse-keyShape"]=o;var s=a.width,u=a.height,f=a.show,l=a.text;return f&&(l?r.shapeMap["".concat(this.type,"-icon")]=r.addShape("text",{attrs:P({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}):r.shapeMap["".concat(this.type,"-icon")]=r.addShape("image",{attrs:P({x:-s/2,y:-u/2},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,r),o},drawLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,a=n===void 0?{}:n,i=a.top,o=a.left,s=a.right,u=a.bottom,f=a.size,l=a.r,c=Kr(a,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0]/2,v=h[1]/2;o&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},c),{x:-d,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},c),{x:d,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:-v,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:v,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getSize(e),o=i[0]/2,s=i[1]/2,u=P({x:0,y:0,rx:o,ry:s},a);return u},update:function(e,r,n){var a=r.getContainer(),i=this.getOptions({}).style,o=this.getSize(e),s={stroke:e.color,rx:o[0]/2,ry:o[1]/2},u=r.get("keyShape"),f=Et({},i,u.attr(),s);f=Et(f,e.style),this.updateShape(e,r,f,!0,n),this.updateLinkPoints(e,a)}},"single-node");ro("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:P({},Qe.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).icon,a=n===void 0?{}:n,i=this.getShapeStyle(e),o=r.addShape("path",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});r.shapeMap["".concat(this.type,"-keyShape")]=o;var s=a.width,u=a.height,f=a.show,l=a.text;return f&&(l?r.shapeMap["".concat(this.type,"-icon")]=r.addShape("text",{attrs:P({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}):r.shapeMap["".concat(this.type,"-icon")]=r.addShape("image",{attrs:P({x:-s/2,y:-u/2},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,r),o},drawLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,a=n===void 0?{}:n,i=a.top,o=a.left,s=a.right,u=a.bottom,f=a.size,l=a.r,c=Kr(a,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},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 r=this.getSize(e),n=r[0],a=r[1],i=[["M",0,-a/2],["L",n/2,0],["L",0,a/2],["L",-n/2,0],["Z"]];return i},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getPath(e),o=P({path:i},a);return o},update:function(e,r,n){var a=r.getContainer(),i=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=r.get("keyShape"),f=Et({},i,u.attr(),s);f=Et(f,e.style),this.updateShape(e,r,f,!0,n),this.updateLinkPoints(e,a)}},"single-node");ro("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:P({},Qe.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(e,r){var n=this.mergeStyle||this.getOptions(e),a=n.icon,i=a===void 0?{}:a,o=n.direction,s=this.getShapeStyle(e),u=e.direction||o,f=r.addShape("path",{attrs:s,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});r.shapeMap["".concat(this.type,"-keyShape")]=f;var l=i.width,c=i.height,h=i.show,d=i.offset,v=i.text;if(h)if(v)r.shapeMap["".concat(this.type,"-icon")]=r.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0});else{var p=-l/2,g=-c/2;(u==="up"||u==="down")&&(g+=d),(u==="left"||u==="right")&&(p+=d),r.shapeMap["".concat(this.type,"-icon")]=r.addShape("image",{attrs:P({x:p,y:g},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(e,r),f},drawLinkPoints:function(e,r){var n=this.mergeStyle||this.getOptions(e),a=n.linkPoints,i=a===void 0?{}:a,o=n.direction,s=e.direction||o,u=i.top,f=i.left,l=i.right,c=i.bottom,h=i.size,d=i.r,v=Kr(i,["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&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},v),{x:y[0],y:y[1],r:h/2||d||5}),className:"link-point-left",name:"link-point-left"}))}if(l){var w=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?w=[b,m]:s==="down"?w=[b,-m]:s==="right"&&(w=[b,b-m]),w&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},v),{x:w[0],y:w[1],r:h/2||d||5}),className:"link-point-right",name:"link-point-right"}))}if(u){var x=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?x=[b-m,-m]:s==="left"?x=[b,-m]:s==="right"&&(x=[-b,-m]),x&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},v),{x:x[0],y:x[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&&(r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},v),{x:E[0],y:E[1],r:h/2||d||5}),className:"link-point-bottom",name:"link-point-bottom"}))}},getPath:function(e){var r=(this.mergeStyle||this.getOptions(e)).direction,n=e.direction||r,a=this.getSize(e),i=a[0],o=i*Math.sin(1/3*Math.PI),s=i*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 r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getPath(e),o=P({path:i},a);return o},update:function(e,r,n){var a=r.getContainer(),i=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=r.get("keyShape"),f=Et({},i,u.attr(),s);f=Et(f,e.style),this.updateShape(e,r,f,!0,n),this.updateLinkPoints(e,a)},updateLinkPoints:function(e,r){var n=this.getOptions({}),a=n.linkPoints,i=n.direction,o=e.direction||i,s=r.shapeMap["link-point-left"]||r.find(function(L){return L.get("className")==="link-point-left"}),u=r.shapeMap["link-point-right"]||r.find(function(L){return L.get("className")==="link-point-right"}),f=r.shapeMap["link-point-top"]||r.find(function(L){return L.get("className")==="link-point-top"}),l=r.shapeMap["link-point-bottom"]||r.find(function(L){return L.get("className")==="link-point-bottom"}),c=a,h=s||u||f||l;h&&(c=h.attr());var d=Et({},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,w=m.right,x=m.top,E=m.bottom,_=this.getSize(e),S=_[0],A={r:y,fill:v,stroke:p,lineWidth:g},M=null,C=S*Math.sin(1/3*Math.PI),I=S*Math.sin(1/3*Math.PI);o==="up"?M=[-I,C]:o==="down"?M=[-I,-C]:o==="left"&&(M=[-I,I-C]),M&&(s?!b&&b!==void 0?(s.remove(),delete r.shapeMap["link-point-left"]):s.attr(P(P({},A),{x:M[0],y:M[1]})):b&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},A),{x:M[0],y:M[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var k=null;o==="up"?k=[I,C]:o==="down"?k=[I,-C]:o==="right"&&(k=[I,I-C]),k&&(u?!w&&w!==void 0?(u.remove(),delete r.shapeMap["link-point-right"]):u.attr(P(P({},A),{x:k[0],y:k[1]})):w&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},A),{x:k[0],y:k[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var O=null;o==="up"?O=[I-C,-C]:o==="left"?O=[I,-C]:o==="right"&&(O=[-I,-C]),O&&(f?!x&&x!==void 0?(f.remove(),delete r.shapeMap["link-point-top"]):f.attr(P(P({},A),{x:O[0],y:O[1]})):x&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},A),{x:O[0],y:O[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var B=null;o==="down"?B=[-I+C,C]:o==="left"?B=[I,C]:o==="right"&&(B=[-I,C]),B&&(l?!E&&E!==void 0?(l.remove(),delete r.shapeMap["link-point-bottom"]):l.attr(P(P({},A),{x:B[0],y:B[1]})):E&&(r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},A),{x:B[0],y:B[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node");ro("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,r){var n=(this.mergeStyle||this.getOptions(e)).preRect,a=n===void 0?{}:n,i=this.getShapeStyle(e),o=this.getSize(e),s=o[0],u=o[1],f=r.addShape("rect",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});r.shapeMap["".concat(this.type,"-keyShape")]=f;var l=a.show,c=Kr(a,["show"]);return l&&(r.shapeMap["pre-rect"]=r.addShape("rect",{attrs:P({x:-s/2,y:-u/2,height:u},c),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(e,r),this.drawStateIcon(e,r),this.drawLinkPoints(e,r),f},drawLogoIcon:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).logoIcon,a=n===void 0?{}:n,i=this.getSize(e),o=i[0];if(a.show){var s=a.width,u=a.height,f=a.x,l=a.y,c=a.offset,h=a.text,d=Kr(a,["width","height","x","y","offset","text"]);h?r.shapeMap["rect-logo-icon"]=r.addShape("text",{attrs:P({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}):r.shapeMap["rect-logo-icon"]=r.addShape("image",{attrs:P(P({},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,r){var n=(this.mergeStyle||this.getOptions(e)).stateIcon,a=n===void 0?{}:n,i=this.getSize(e),o=i[0];if(a.show){var s=a.width,u=a.height,f=a.x,l=a.y,c=a.offset,h=a.text,d=Kr(a,["width","height","x","y","offset","text"]);h?r.shapeMap["rect-state-icon"]=r.addShape("text",{attrs:P({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}):r.shapeMap["rect-state-icon"]=r.addShape("image",{attrs:P(P({},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,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,a=n===void 0?{}:n,i=a.top,o=a.left,s=a.right,u=a.bottom,f=a.size,l=a.r,c=Kr(a,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(e,r){var n=this.getOptions(e),a=n.labelCfg,i=a===void 0?{}:a,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+i.offset;d&&(p=-c/2+v+i.offset);var g=i.style,y=f.style,m=f.paddingTop;return Ye(e.description)?(h=r.addShape("text",{attrs:P(P({},g),{x:p,y:-5,text:e.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),r.shapeMap["text-shape"]=h,r.shapeMap["rect-description"]=r.addShape("text",{attrs:P(P({},y),{x:p,y:17+(m||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(h=r.addShape("text",{attrs:P(P({},g),{x:p,y:7,text:e.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),r.shapeMap["text-shape"]=h),h},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getSize(e),o=a.width||i[0],s=a.height||i[1],u=P({x:-o/2,y:-s/2,width:o,height:s},a);return u},update:function(e,r){var n=this.mergeStyle||this.getOptions(e),a=n.style,i=a===void 0?{}:a,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=r.get("keyShape");d.attr(P(P({},i),{x:-c/2,y:-h/2,width:c,height:h}));var v=r.getContainer(),p=v.shapeMap["rect-logo-icon"]||v.find(function(qe){return qe.get("className")==="rect-logo-icon"}),g=p?p.attr():{},y=Et({},g,e.logoIcon),m=y.width;m===void 0&&(m=this.options.logoIcon.width);var b=e.logoIcon?e.logoIcon.show:void 0,w=s.offset,x=-c/2+m+w;!b&&b!==void 0&&(x=-c/2+w);var E=v.shapeMap["node-label"]||v.find(function(qe){return qe.get("className")==="node-label"}),_=v.shapeMap["rect-description"]||v.find(function(qe){return qe.get("className")==="rect-description"});if(e.label)if(!E)v.shapeMap["node-label"]=v.addShape("text",{attrs:P(P({},s.style),{x,y:e.description?-5:7,text:e.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});else{var S=e.labelCfg?e.labelCfg.style:{},A=Et({},E.attr(),S);e.label&&(A.text=e.label),A.x=x,Ye(e.description)&&(A.y=-5),_&&(_.resetMatrix(),_.attr({x})),E.resetMatrix(),E.attr(A)}if(Ye(e.description)){var M=f.paddingTop;if(!_)v.shapeMap["rect-description"]=v.addShape("text",{attrs:P(P({},f.style),{x,y:17+(M||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0});else{var S=e.descriptionCfg?e.descriptionCfg.style:{},C=Et({},_.attr(),S);Ye(e.description)&&(C.text=e.description),C.x=x,_.resetMatrix(),_.attr(P(P({},C),{y:17+(M||0)}))}}var I=v.shapeMap["pre-rect"]||v.find(function(qe){return qe.get("className")==="pre-rect"});if(I&&!I.destroyed){var k=Et({},I.attr(),e.preRect);I.attr(P(P({},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,B=y.height,L=y.x,z=y.y,X=y.offset,R=Kr(y,["width","height","x","y","offset"]);p.attr(P(P({},R),{x:L||-c/2+O+X,y:z||-B/2,width:O,height:B}))}else b&&this.drawLogoIcon(e,v);var V=v.shapeMap["rect-state-icon"]||v.find(function(qe){return qe.get("className")==="rect-state-icon"}),he=V?V.attr():{},ce=Et({},he,e.stateIcon);if(V){!ce.show&&ce.show!==void 0&&(V.remove(),delete v.shapeMap["rect-state-icon"]);var le=ce.width,B=ce.height,L=ce.x,z=ce.y,ie=ce.offset,Ie=Kr(ce,["width","height","x","y","offset"]);V.attr(P(P({},Ie),{x:L||c/2-le+ie,y:z||-B/2,width:le,height:B}))}else ce.show&&this.drawStateIcon(e,v);this.updateLinkPoints(e,v)},getOptions:function(e,r){return r==="move"?e:_r({},this.options,this.getCustomConfig(e)||{},e)}},"single-node");ro("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:P({},Qe.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).icon,a=n===void 0?{}:n,i=this.getShapeStyle(e),o=r.addShape("path",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});r.shapeMap["".concat(this.type,"-keyShape")]=o;var s=a.width,u=a.height,f=a.show,l=a.text;return f&&(l?r.shapeMap["".concat(this.type,"-icon")]=r.addShape("text",{attrs:P({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}):r.shapeMap["".concat(this.type,"-icon")]=r.addShape("image",{attrs:P({x:-s/2,y:-u/2},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,r),o},drawLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,a=n===void 0?{}:n,i=a.top,o=a.left,s=a.right,u=a.leftBottom,f=a.rightBottom,l=a.size,c=a.r,h=Kr(a,["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;r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-right",name:"link-point-right"})}if(i){var p=Math.cos(.5*Math.PI)*v,g=Math.sin((18+72*1)/180*Math.PI)*v;r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},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;r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},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;r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},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;r.shapeMap["link-point-right-bottom"]=r.addShape("circle",{attrs:P(P({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(e){var r=this.getSize(e),n=r[0],a=n*3/8,i=e.innerR||a;return Za.getStarPath(n,i)},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getPath(e),o=P({path:i},a);return o},update:function(e,r,n){var a=r.getContainer(),i=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=r.get("keyShape"),f=Et({},i,u.attr(),s);f=Et(f,e.style),this.updateShape(e,r,f,!0,n),this.updateLinkPoints(e,a)},updateLinkPoints:function(e,r){var n=this.getOptions({}).linkPoints,a=r.shapeMap["link-point-left"]||r.find(function(C){return C.get("className")==="link-point-left"}),i=r.shapeMap["link-point-right"]||r.find(function(C){return C.get("className")==="link-point-right"}),o=r.shapeMap["link-point-top"]||r.find(function(C){return C.get("className")==="link-point-top"}),s=r.shapeMap["link-point-left-bottom"]||r.find(function(C){return C.get("className")==="link-point-left-bottom"}),u=r.shapeMap["link-point-left-bottom"]||r.find(function(C){return C.get("className")==="link-point-right-bottom"}),f=n,l=a||i||o||s||u;l&&(f=l.attr());var c=Et({},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,w=g.leftBottom,x=g.rightBottom,E=this.getSize(e),_=E[0],S={r:p,fill:h,stroke:d,lineWidth:v},A=Math.cos((18+72*0)/180*Math.PI)*_,M=Math.sin((18+72*0)/180*Math.PI)*_;i?!m&&m!==void 0?(i.remove(),delete r.shapeMap["link-point-right"]):i.attr(P(P({},S),{x:A,y:-M})):m&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},S),{x:A,y:-M}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),A=Math.cos((18+72*1)/180*Math.PI)*_,M=Math.sin((18+72*1)/180*Math.PI)*_,o?!b&&b!==void 0?(o.remove(),delete r.shapeMap["link-point-top"]):o.attr(P(P({},S),{x:A,y:-M})):b&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},S),{x:A,y:-M}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),A=Math.cos((18+72*2)/180*Math.PI)*_,M=Math.sin((18+72*2)/180*Math.PI)*_,a?!y&&y!==void 0?(a.remove(),delete r.shapeMap["link-point-left"]):a.attr(P(P({},S),{x:A,y:-M})):y&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},S),{x:A,y:-M}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),A=Math.cos((18+72*3)/180*Math.PI)*_,M=Math.sin((18+72*3)/180*Math.PI)*_,s?!w&&w!==void 0?(s.remove(),delete r.shapeMap["link-point-left-bottom"]):s.attr(P(P({},S),{x:A,y:-M})):w&&(r.shapeMap["link-point-left-bottom"]=r.addShape("circle",{attrs:P(P({},S),{x:A,y:-M}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),A=Math.cos((18+72*4)/180*Math.PI)*_,M=Math.sin((18+72*4)/180*Math.PI)*_,u?!x&&x!==void 0?(u.remove(),delete r.shapeMap["link-point-right-bottom"]):u.attr(P(P({},S),{x:A,y:-M})):x&&(r.shapeMap["link-point-right-bottom"]=r.addShape("circle",{attrs:P(P({},S),{x:A,y:-M}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var Y2=Za.defaultSubjectColors,If="fan-shape-",TO=function(e,r){var n=0,a=[];return Object.keys(e).forEach(function(i){var o=+e[i];isNaN(o)||(a.push({key:i,value:o,color:r[i]}),n+=o)}),{totalValue:n,configs:a}},IO=function(e){var r=e.attr("r"),n=.6*r,a=(r+n)/2,i=r-n;return{lineWidth:i,arcR:a}},Zg=function(e,r){var n=r.arcR,a=r.arcBegin,i=r.beginAngle,o=r.config,s=r.fanIndex,u=r.lineWidth,f=r.totalValue,l=r.drawWhole,c=l===void 0?!1:l,h=r.updateShape,d=h===void 0?void 0:h,v=o.value/f;if(v<.001)return{beginAngle:i,arcBegin:a,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=i+m,p=[n*Math.cos(g),-n*Math.sin(g)],y=m>Math.PI?1:0}var b={path:[["M",a[0],a[1]],["A",n,n,0,y,0,p[0],p[1]]],stroke:o.color||(d==null?void 0:d.attr("stroke"))||Y2[s%Y2.length],lineWidth:u};return d?d.attr(b):e.shapeMap["".concat(If).concat(s)]=e.addShape("path",{attrs:b,name:"".concat(If).concat(s),draggable:!0}),{beginAngle:g,arcBegin:p,shape:e.shapeMap["".concat(If).concat(s)],shouldEnd:c||v>.999}},ife=function(e,r,n){var a=e.donutAttrs,i=a===void 0?{}:a,o=e.donutColorMap,s=o===void 0?{}:o,u=Object.keys(i).length;if(i&&u>1){var f=TO(i,s),l=f.configs,c=f.totalValue;if(c){var h=IO(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0;if(u===1){Zg(r,{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=Zg(r,{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}}}},ofe=function(e,r,n){var a=e.donutAttrs,i=e.donutColorMap,o=i===void 0?{}:i,s={},u=r.getContainer();if(a){var f=TO(a,o),l=f.configs,c=f.totalValue;if(c)for(var h=IO(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0,y=0;y<l.length;y++){var m="".concat(If).concat(y),b=Zg(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 w=Object.keys(u.shapeMap).filter(function(x){return x.includes(If)});w.forEach(function(x){s[x]||(u.shapeMap[x].remove(!0),delete u.shapeMap[x])})};ro("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:P({},Qe.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).icon,a=n===void 0?{}:n,i=this.getShapeStyle(e),o=_r({},a,e.icon),s=r.addShape("circle",{attrs:i,className:"".concat(this.type,"-keyShape"),draggable:!0,name:"".concat(this.type,"-keyShape")});r.shapeMap["".concat(this.type,"-keyShape")]=s;var u=o.width,f=o.height,l=o.show,c=o.text;return l&&(c?r.shapeMap["".concat(this.type,"-icon")]=r.addShape("text",{attrs:P({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}):r.shapeMap["".concat(this.type,"-icon")]=r.addShape("image",{attrs:P({x:-u/2,y:-f/2},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),ife(e,r,s),this.drawLinkPoints(e,r),s},updateShape:function(e,r,n,a,i){var o=r.get("keyShape");o.attr(P({},n)),ofe(e,r,o),this.updateLabel(e,r,i),a&&this.updateIcon(e,r)}},"circle");var qc=function(e){var r=e.x,n=e.y;return{x:r,y:n,centerX:r,centerY:n,minX:r,minY:n,maxX:r,maxY:n,height:0,width:0}},sfe=function(e){e===void 0&&(e=[]);var r=[],n=[];e.forEach(function(u){r.push(u.x),n.push(u.y)});var a=Math.min.apply(Math,r),i=Math.max.apply(Math,r),o=Math.min.apply(Math,n),s=Math.max.apply(Math,n);return{centerX:(a+i)/2,centerY:(o+s)/2,maxX:i,maxY:s,minX:a,minY:o,height:s-o,width:i-a}},v1=function(e){for(var r=[],n={},a=e.length,i=a-1;i>=0;i--){var o=e[i];o.id="".concat(o.x,"|||").concat(o.y),n[o.id]||(n[o.id]=o,r.push(o))}return r},kO=function(e){return v1(e)},vd=function(e,r){return e.width||e.height?{centerX:e.centerX,centerY:e.centerY,minX:e.minX-r,minY:e.minY-r,maxX:e.maxX+r,maxY:e.maxY+r,height:e.height+2*r,width:e.width+2*r}:e},ufe=function(e,r){var n=Math.abs(e.x-r.centerX),a=Math.abs(e.y-r.centerY);return n===0&&a===0?0:n/r.width>a/r.height},Kg=function(e,r,n){var a=ufe(r,e);if(a===0){var i=e.centerX,o=e.centerY;return n.y<r.y?o=e.minY:n.x>r.x?i=e.maxX:n.x<r.x?i=e.minX:n.x===r.x&&(o=e.maxY),{x:i,y:o}}return a?{x:r.x>e.centerX?e.maxX:e.minX,y:r.y}:{x:r.x,y:r.y>e.centerY?e.maxY:e.minY}},q2=function(e,r){var n=Math.min(e.minX,r.minX),a=Math.min(e.minY,r.minY),i=Math.max(e.maxX,r.maxX),o=Math.max(e.maxY,r.maxY);return{centerX:(n+i)/2,centerY:(a+o)/2,minX:n,minY:a,maxX:i,maxY:o,height:o-a,width:i-n}},Qg=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}]},Hc=function(e,r){var n=e.x,a=e.y;return n<r.minX||n>r.maxX||a<r.minY||a>r.maxY},ffe=function(e,r){return r<e.minX||r>e.maxX?[]:[{x:r,y:e.minY},{x:r,y:e.maxY}]},lfe=function(e,r){return r<e.minY||r>e.maxY?[]:[{x:e.minX,y:r},{x:e.maxX,y:r}]},cfe=function(e,r){return ffe(e,r.x).concat(lfe(e,r.y))},Kf=function(e,r){return Math.abs(e.x-r.x)+Math.abs(e.y-r.y)},hfe=function(e,r){var n=-2,a=0;return r.forEach(function(i){i&&(e.x===i.x&&(a+=n),e.y===i.y&&(a+=n))}),a},H2=function(e,r,n,a,i){return Kf(e,r)+Kf(e,n)+hfe(e,[r,n,a,i])},NO=function(e,r,n,a,i){i===void 0&&(i=0),e.unshift(r[a]),n[a]&&n[a]!==a&&i<=100&&NO(e,r,n,n[a],i+1)},Zc=function(e,r,n,a){var i=n.x-e.x,o=n.y-e.y,s=a.x-e.x,u=a.y-e.y,f=n.x-r.x,l=n.y-r.y,c=a.x-r.x,h=a.y-r.y,d=i*u-o*s,v=f*h-l*c,p=i*l-o*f,g=s*h-u*c;return d*v<=0&&p*g<=0},Jg=function(e,r,n){if(n.width||n.height){var a=Qg(n),i=a[0],o=a[1],s=a[2],u=a[3];return Zc(e,r,i,o)||Zc(e,r,i,u)||Zc(e,r,o,s)||Zc(e,r,s,u)}return!1},dfe=function(e,r,n,a){var i=[];return e.forEach(function(o){if(o!==r&&(o.x===r.x||o.y===r.y)){if(Jg(o,r,n)||Jg(o,r,a))return;i.push(o)}}),v1(i)},OO=function(){function t(){this.arr=[],this.map={},this.arr=[],this.map={}}return t.prototype._innerAdd=function(e,r){for(var n=[0,r-1];n[1]-n[0]>1;){var a=Math.floor((n[0]+n[1])/2);if(this.arr[a].value>e.value)n[1]=a;else if(this.arr[a].value<e.value)n[0]=a;else{this.arr.splice(a,0,e),this.map[e.id]=!0;return}}this.arr.splice(n[1],0,e),this.map[e.id]=!0},t.prototype.add=function(e){delete this.map[e.id];var r=this.arr.length;if(!r){this.arr.push(e),this.map[e.id]=!0;return}if(this.arr[r-1].value<e.value){this.arr.push(e),this.map[e.id]=!0;return}this._innerAdd(e,r)},t.prototype.remove=function(e){this.map[e]&&delete this.map[e]},t.prototype._clearAndGetMinId=function(){for(var e,r=this.arr.length-1;r>=0;r--)this.map[this.arr[r].id]?e=this.arr[r].id:this.arr.splice(r,1);return e},t.prototype._findFirstId=function(){for(;this.arr.length;){var e=this.arr.shift();if(this.map[e.id])return e.id}},t.prototype.minId=function(e){return e?this._clearAndGetMinId():this._findFirstId()},t}(),vfe=function(e,r,n,a,i,o,s){var u,f=[],l=(u={},u[r.id]=r,u),c={},h={},d={};h[r.id]=0,d[r.id]=H2(r,n,r);var v=new OO;v.add({id:r.id,value:d[r.id]});var p={};e.forEach(function(x){p[x.id]=x});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 NO(m,p,c,n.id),m}delete l[g.id],v.remove(g.id),f.push(g);var b=dfe(e,g,a,i),w=function(E){E.forEach(function(_){if(f.indexOf(_)===-1){var S=_.id;l[S]||(l[S]=_);var A=d[g.id]+Kf(g,_);if(h[S]&&A>=h[S]){v.add({id:S,value:d[S]});return}c[S]=g.id,h[S]=A,d[S]=h[S]+H2(_,n,r,o,s),v.add({id:S,value:d[S]})}})};w(b)}return[r,n]},pfe=function(e,r,n){return!(e.x===r.x&&r.x===n.x||e.y===r.y&&r.y===n.y)},gfe=function(e,r,n,a){var i=Kf(e,r),o=Kf(n,r);i<a&&(a=i),o<a&&(a=o);var s={x:r.x-a/i*(r.x-e.x),y:r.y-a/i*(r.y-e.y)},u={x:r.x-a/o*(r.x-n.x),y:r.y-a/o*(r.y-n.y)};return[s,u]},Z2=function(e,r){var n=[],a=e[0];return n.push("M".concat(a.x," ").concat(a.y)),e.forEach(function(i,o){var s=e[o+1],u=e[o+2];if(s&&u)if(pfe(i,s,u)){var f=gfe(i,s,u,r),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("")},LO=function(e,r,n,a,i){var o,s;if(!n||!n.getType())o=qc(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=qc(e)}else o=n&&n.getBBox();if(!a||!a.getType())s=qc(r);else if(a.getType()==="combo"){var h=a.getKeyShape().getBBox();if(h){var d=a.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=qc(r)}else s=a&&a.getBBox();var g=vd(o,i),y=vd(s,i),m=Kg(g,e,r),b=Kg(y,r,e),w=sfe([m,b]),x=q2(g,w),E=q2(y,w),_=[];_=_.concat(Qg(x)).concat(Qg(E));var S={x:(e.x+r.x)/2,y:(e.y+r.y)/2};[w,x,E].forEach(function(M){_=_.concat(cfe(M,S).filter(function(C){return Hc(C,g)&&Hc(C,y)}))}),[{x:m.x,y:b.y},{x:b.x,y:m.y}].forEach(function(M){Hc(M,g)&&Hc(M,y)&&_.push(M)}),_.unshift(m),_.push(b),_=v1(_);var A=vfe(_,m,b,o,s,e,r);return A.unshift(e),A.push(r),kO(A)},yfe=function(e){if(!(e!=null&&e.length))return e;for(var r=e[e.length-1],n={x:r.x,y:r.y},a=[r],i=[r],o=e.length-2;o>=0;o--){var s=e[o];if(s.x===n.x?a.push(s):(a=[s],n.x=s.x),s.y===n.y?i.push(s):(i=[s],n.y=s.y),a.length>2){var u=e.indexOf(a[1]);u>-1&&e.splice(u,1);continue}if(i.length>2){var u=e.indexOf(i[1]);u>-1&&e.splice(u,1)}}return e},mfe=function(e,r){return Math.abs(e.x-r.x)+Math.abs(e.y-r.y)},bfe=function(e,r,n,a,i){return kO(LO(e,r,n,a,i.offset))},wfe={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:mfe,fallbackRoute:bfe},vi=function(e,r){var n=Math.round(Math.abs(e/r)),a=e<0?-1:1;return n<0?0:a*n},xfe=function(e,r,n){var a={};return e.forEach(function(i){if(i)for(var o=vd(i.getBBox(),n),s=vi(o.minX,r);s<=vi(o.maxX,r);s+=1)for(var u=vi(o.minY,r);u<=vi(o.maxY,r);u+=1)a["".concat(s,"|||").concat(u)]=!0}),a},m0=function(e,r){var n=r.x-e.x,a=r.y-e.y;return n||a?Math.atan2(a,n):0},K2=function(e,r){var n=Math.abs(e-r);return n>Math.PI?2*Math.PI-n:n},Q2=function(e,r,n){for(var a=1/0,i=0,o=r.length;i<o;i++){var s=n(e,r[i]);s<a&&(a=s)}return a},J2=function(e,r,n,a,i){var o=[];if(!n)return[e];var s=i.directions,u=i.offset,f=n.getBBox(),l=r.x>f.minX&&r.x<f.maxX&&r.y>f.minY&&r.y<f.maxY,c=vd(f,u);for(var h in c)c[h]=vi(c[h],i.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=Za.getLineIntersect(e,{x:e.x+p.stepX*c.width,y:e.y+p.stepY*c.height},y[0],y[1]);m&&!Jg(e,m,f)&&(m.id="".concat(m.x,"|||").concat(m.y),o.push(m))}return o}var b=Kg(c,e,a);return b.id="".concat(b.x,"|||").concat(b.y),[b]},ey=function(e,r,n,a){var i=m0(e,r),o=n[e.id];if(!o){var s=m0(a,e);return K2(s,i)}var u=m0({x:o.x,y:o.y},e);return K2(u,i)},Efe=function(e,r,n,a,i,o,s){var u=[a],f=a,l=e.id,c=e.x,h=e.y,d={x:c,y:h,id:l};ey(d,o,r,n)&&(f={x:o.x===a.x?a.x:d.x*s,y:o.y===a.y?a.y:d.y*s},u.unshift(f));for(var v=r[l];v&&v.id!==l;){var p={x:c,y:h,id:l},g={x:v.x,y:v.y,id:v.id},y=ey(g,p,r,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=r[l]}return u[0].x=c===n.x?i.x:f.x,u[0].y=h===n.y?i.y:f.y,u.unshift(i),u},_fe=function(e,r,n,a,i){if(isNaN(e.x)||isNaN(r.x))return[];var o=_r(wfe,i);o.obstacles=o.obstacles||[];var s=o.penalties,u=o.gridSize,f=xfe(o.obstacles.concat([n,a]),u,o.offset),l={x:vi(e.x,u),y:vi(e.y,u)},c={x:vi(r.x,u),y:vi(r.y,u)};e.id="".concat(l.x,"|||").concat(l.y),r.id="".concat(c.x,"|||").concat(c.y);var h=J2(l,e,n,c,o),d=J2(c,r,a,l,o);h.forEach(function(R){delete f[R.id]}),d.forEach(function(R){delete f[R.id]});for(var v={},p={},g={},y={},m={},b=new OO,w=0;w<h.length;w++){var x=h[w];v[x.id]=x,y[x.id]=0,m[x.id]=Q2(x,d,o.distFunc),b.add({id:x.id,value:m[x.id]})}var E=o.maximumLoops,_,S,A,M,C,I,k=1/0,O={};for(d.forEach(function(R){O["".concat(R.x,"|||").concat(R.y)]=!0}),Object.keys(v).forEach(function(R){var V=v[R].id;m[V]<=k&&(k=m[V],_=v[V])});Object.keys(v).length>0&&E>0;){var B=b.minId((E+1)%30===0);if(B)_=v[B];else break;if(O["".concat(_.x,"|||").concat(_.y)])return Efe(_,g,l,r,e,c,u);delete v[_.id],b.remove(_.id),p[_.id]=!0;for(var w=0;w<o.directions.length;w++){S=o.directions[w];var L="".concat(Math.round(_.x)+S.stepX,"|||").concat(Math.round(_.y)+S.stepY);if(A={x:_.x+S.stepX,y:_.y+S.stepY,id:L},!p[L]&&(I=ey(_,A,g,l),!(I>o.maxAllowedDirectionChange)&&!f[L])){v[L]||(v[L]=A);var z=s[I];M=o.distFunc(_,A)+(isNaN(z)?u:z),C=y[_.id]+M;var X=y[L];X&&C>=X||(g[L]=_,y[L]=C,m[L]=C+Q2(A,d,o.distFunc),b.add({id:L,value:m[L]}))}}E-=1}return o.fallbackRoute(e,r,n,a,o)};B8("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:P({},Qe.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(e,r){var n=this.getShapeStyle(e);n.radius===0&&delete n.radius;var a=r.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return r.shapeMap["edge-shape"]=a,a},getShapeStyle:function(e){var r=this.options.style,n={stroke:e.color},a=Et({},r,n,e.style);e=this.getPathPoints(e),this.radius=a.radius,this.offset=a.offset;var i=e.startPoint,o=e.endPoint,s=this.getControlPoints(e),u=[i];s&&(u=u.concat(s)),u.push(o);var f=e.sourceNode,l=e.targetNode,c=a.radius,h=this.options.routeCfg,d=Et({},h,e.routeCfg);d.offset=a.offset;var v=this.getPath(u,f,l,c,d,!s);(bt(v)&&v.length<=1||Ye(v)&&v.indexOf("L")===-1)&&(v="M0 0, L0 0"),(isNaN(i.x)||isNaN(i.y)||isNaN(o.x)||isNaN(o.y))&&(v="M0 0, L0 0");var p=Et({},Qe.defaultEdge.style,a,{lineWidth:e.size,path:v});return p},updateShapeStyle:function(e,r){var n=r.getContainer();if(r.isVisible()){var a={stroke:e.color},i=n.shapeMap["edge-shape"]||n.find(function(w){return w.get("className")==="edge-shape"})||r.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=i.attr(),h=Et({},a,c,e.style),d=e.sourceNode,v=e.targetNode,p=h.radius,g=this.options.routeCfg,y=Et({},g,e.routeCfg);y.offset=h.offset;var m=this.getPath(l,d,v,p,y,!f);(bt(m)&&m.length<=1||Ye(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=Et(a,i.attr(),{lineWidth:o,path:m},e.style);i&&i.attr(b)}},getPath:function(e,r,n,a,i,o){var s=i.offset,u=i.obstacles,f=i.simple;if(!s||e.length>2||o===!1){if(a)return Z2(e,a);var l=[];return _e(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?LO(e[e.length-1],e[0],n,r,s):_fe(e[0],e[e.length-1],r,n,i);if(!c||!c.length)return"M0 0, L0 0";if(a){var h=Z2(c,a);return h}c=yfe(c);var d=Za.pointsToPolygon(c);return d}},"single-edge");var eS=so.cloneEvent,tS=so.isNaN,rS=Math.abs,Sfe=10,Mfe=["shift","ctrl","alt","control"];const Afe={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 r=this.origin,n=+e.clientX,a=+e.clientY;if(!(tS(n)||tS(a))){var i=n-r.x,o=a-r.y;this.get("direction")==="x"?o=0:this.get("direction")==="y"&&(i=0),this.origin={x:n,y:a};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+i>s+l||f.maxX+l>=0&&f.maxX+l+i<0)&&(i=0),(f.minY<=u+c&&f.minY+o>u+c||f.maxY+c>=0&&f.maxY+c+o<0)&&(o=0),this.graph.translate(i,o)}},onTouchStart:function(e){var r=this,n=e.originalEvent.touches,a=n[0],i=n[1];a&&i||(e.preventDefault(),this.mousedown=!0,r.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 r=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)&&!r.keydown&&this.allowDrag(e)){if(r.origin={x:e.clientX,y:e.clientY},r.dragging=!1,this.enableOptimize){for(var a=this.graph,i=a.getEdges(),o=0,s=i.length;o<s;o++){var u=i[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=a.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 r=this,n=e.originalEvent.touches,a=n[0],i=n[1];if(a&&i){this.onMouseUp(e);return}e.preventDefault(),r.onDrag(e)},onDrag:function(e){if(this.mousedown){var r=this.graph;if(!this.keydown&&this.allowDrag(e)&&(e=eS(e),!!this.origin)){if(this.dragging)e.type="drag",r.emit("canvas:drag",e);else{if(rS(this.origin.x-e.clientX)+rS(this.origin.y-e.clientY)<Sfe)return;this.shouldBegin(e,this)&&(e.type="dragstart",r.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 r,n;this.mousedown=!1,this.dragstart=!1;var a=this.graph;if(!this.keydown){var i=a.getZoom(),o=a.get("modeController"),s=(n=(r=o==null?void 0:o.modes[o.mode])===null||r===void 0?void 0:r.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=a.getEdges(),l=0,c=f.length;l<c;l++){var h=f[l].get("group").get("children");h&&h.forEach(function(_){var S=_.get("ori-visibility");_.set("ori-visibility",void 0),S&&_.show()})}if(i>u)for(var d=a.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 w=b[m],x=w.get("isKeyShape");if(!x){var E=w.get("ori-visibility");w.set("ori-visibility",void 0),E&&w.show()}}}if(!this.dragging){this.origin=null;return}e=eS(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,a.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 r=this,n=e.key;n&&(Mfe.indexOf(n.toLowerCase())>-1?r.keydown=!0:r.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1},allowDrag:function(e){var r,n,a=e.target,i=a&&a.isCanvas&&a.isCanvas();if(Qf(this.allowDragOnItem)&&!this.allowDragOnItem&&!i)return!1;if(gn(this.allowDragOnItem)){var o=this.allowDragOnItem,s=o.node,u=o.edge,f=o.combo,l=(n=(r=e.item)===null||r===void 0?void 0:r.getType)===null||n===void 0?void 0:n.call(r);if(!s&&l==="node"||!u&&l==="edge"||!f&&l==="combo")return!1}return!0}},Cfe={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 r=e.getType();return r==="combo"},onTouchStart:function(e){if(e.item){var r=this;try{var n=e.originalEvent.touches,a=n[0],i=n[1];if(a&&i)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,r.onDragStart(e)}},onTouchMove:function(e){var r=this;try{var n=e.originalEvent.touches,a=n[0],i=n[1];if(a&&i){r.onDragEnd(e);return}e.preventDefault()}catch{console.warn("Touch original event not exist!")}r.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 r,n;if(((n=(r=e.item)===null||r===void 0?void 0:r.getType)===null||n===void 0?void 0:n.call(r))!=="node"){this.onDragEnd();return}this.mousedown&&(this.dragstart?this.onDrag(P(P({},e),this.mousedown)):(this.dragstart=!0,this.onDragStart(e)))},onDragStart:function(e){var r=this;if(this.currentShouldEnd=!0,!!this.shouldBegin(P(P({},e),this.mousedown),this)){var n=this.mousedown,a=n.item,i=n.target;if(!(!a||a.destroyed||a.hasLocked())){var o=a.getContainer();if(o.set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(a),i){var s=i.get("isAnchorPoint");if(s)return}var u=this.graph;this.targets=[],this.targetCombo=null;var f=u.findAllByState("node",this.selectedState),l=a.get("id"),c=f.filter(function(d){var v=d.get("id");return l===v});if(c.length===0?this.targets.push(a):f.length>1?f.forEach(function(d){var v=d.hasLocked();v||r.targets.push(d)}):this.targets.push(a),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()&&(r.hidenEdge[p.getID()]=!0,p.hide())})}),this.origin=this.mousedown.origin,this.point={},this.originPoint={}}}},onDrag:function(e){var r=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(a){r.update(a,e);var i=a.getModel().comboId;i&&(n[i]=r.graph.findById(i))}),this.onlyChangeComboSize&&this.updateParentCombos()}},onDragEnd:function(e){var r=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){r.hidenEdge[u.getID()]&&u.show(),u.refresh()})}),this.hidenEdge={};var a=this.graph;if(a.get("enabledStack")&&this.enableStack){var i={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach(function(o){i.before.nodes.push(o)}),this.targets.forEach(function(o){var s=o.getModel(),u=s.x,f=s.y,l=s.id;i.after.nodes.push({x:u,y:f,id:l})}),a.pushStack("update",rr(i))}a.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 r=e.item;if(this.currentShouldEnd=this.shouldEnd(e,r,this),this.updatePositions(e,!this.currentShouldEnd),!(!this.currentShouldEnd||!this.validationCombo(r))){var n=this.graph;if(this.comboActiveState&&n.setItemState(r,this.comboActiveState,!1),this.targetCombo=r,this.onlyChangeComboSize)n.updateCombos();else{var a=r.getModel();this.targets.map(function(i){var o=i.getModel();o.comboId!==a.id&&n.updateComboTree(i,a.id)}),n.updateCombo(r)}n.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(e){var r=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 a=n.getModel();a.comboId&&r.updateComboTree(n)}))},onDropNode:function(e){if(!(!this.targets||this.targets.length===0)){var r=this,n=e.item,a=r.graph,i=n.getModel().comboId,o=i?a.findById(i):void 0;if(this.currentShouldEnd=this.shouldEnd(e,o,this),this.updatePositions(e,!this.currentShouldEnd),!!this.currentShouldEnd){if(this.onlyChangeComboSize)this.updateParentCombos();else if(i){var s=a.findById(i);r.comboActiveState&&a.setItemState(s,r.comboActiveState,!1),this.targets.map(function(u){var f=u.getModel();i!==f.comboId&&a.updateComboTree(u,i)}),a.updateCombo(s)}else this.targets.map(function(u){var f=u.getModel();f.comboId&&a.updateComboTree(u)});a.emit("dragnodeend",{items:this.targets,targetItem:n})}}},onDragEnter:function(e){var r=e.item;if(this.validationCombo(r)){var n=this.graph;this.comboActiveState&&n.setItemState(r,this.comboActiveState,!0)}},onDragLeave:function(e){var r=e.item;if(this.validationCombo(r)){var n=this.graph;this.comboActiveState&&n.setItemState(r,this.comboActiveState,!1)}},updatePositions:function(e,r){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}):r||this.targets.map(function(a){return n.update(a,e)}):this.targets.map(function(a){return n.update(a,e,r)}))},update:function(e,r,n){var a=this.origin,i=e.get("model"),o=e.get("id");this.point[o]||(this.point[o]={x:i.x||0,y:i.y||0});var s=r.x-a.x+this.point[o].x,u=r.y-a.y+this.point[o].y;n&&(s+=a.x-r.x,u+=a.y-r.y);var f={x:s,y:u};this.get("updateEdge")?this.graph.updateItem(e,f,!1):e.updatePosition(f)},debounceUpdate:oy(function(t){var e=t.targets,r=t.graph,n=t.point,a=t.origin,i=t.evt,o=t.updateEdge,s=t.onlyChangeComboSize,u=t.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=i.x-a.x+n[c].x,d=i.y-a.y+n[c].y,v={x:h,y:d};o?r.updateItem(f,v,!1):f.updatePosition(v)}),s&&u(r,e)},50,!0),updateDelegate:function(e){var r=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=r.get("group"),a=_r({},Mf.delegateStyle,this.delegateStyle),i=this.calculationGroupPosition(e),o=i.x,s=i.y,u=i.width,f=i.height,l=i.minX,c=i.minY;this.originPoint={x:o,y:s,width:u,height:f,minX:l,minY:c},this.delegateRect=n.addShape("rect",{attrs:P({width:u,height:f,x:o,y:s},a),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(e){var r=this.targets;r.length===0&&r.push(e.item);for(var n=1/0,a=-1/0,i=1/0,o=-1/0,s=0;s<r.length;s++){var u=r[s],f=u.getBBox(),l=f.minX,c=f.minY,h=f.maxX,d=f.maxY;l<n&&(n=l),c<i&&(i=c),h>a&&(a=h),d>o&&(o=d)}var v=Math.floor(n),p=Math.floor(i),g=Math.ceil(a)-Math.floor(n),y=Math.ceil(o)-Math.floor(i);return{x:v,y:p,width:g,height:y,minX:n,minY:i}},updateParentCombos:function(e,r){var n=e||this.graph,a=r||this.targets,i={};a==null||a.forEach(function(o){var s=o.getModel().comboId;s&&(i[s]=n.findById(s))}),Object.values(i).forEach(function(o){o&&n.updateCombo(o)})}};var Kc=null;const Tfe={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 r=this;try{var n=e.originalEvent.touches,a=n[0],i=n[1];if(a&&i)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}r.setAllItemStates(e)},clearOnTouchStart:function(e){var r=this;try{var n=e.originalEvent.touches,a=n[0],i=n[1];if(a&&i)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}r.clearActiveState(e)},setAllItemStates:function(e){clearTimeout(this.timer),this.throttleSetAllItemStates(e,this)},clearActiveState:function(e){var r=this,n=this.shouldClearStatusOnSecond;n&&(Kc=null),this.timer=setTimeout(function(){r.throttleClearActiveState(e,r)},50)},throttleSetAllItemStates:Ch(function(t,e){var r=t.item,n=e.graph;if(!(!n||n.destroyed)&&(e.item=r,!!e.shouldUpdate(t.item,{event:t,action:"activate"},e))){var a=e.shouldClearStatusOnSecond,i=r.getModel().id;if(Kc===i&&a){e.throttleClearActiveState(t,e),Kc=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],w=b.getID(),x=b.hasState("selected");e.resetSelected&&x&&n.setItemState(b,"selected",!1),y[w]&&(n.setItemState(b,o,!1),delete y[w]),s&&!g[w]&&(n.setItemState(b,s,!0),g[w]=b)}for(var m=0;m<d;m++){var E=f[m],_=E.getID(),x=E.hasState("selected");e.resetSelected&&x&&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 S=l[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)}for(var m=0;m<p;m++){var M=c[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)}if(r&&!r.destroyed){s&&(n.setItemState(r,s,!1),delete g[r.getID()]),y[r.getID()]||(n.setItemState(r,o,!0),y[r.getID()]=r);for(var I=r.getEdges(),k=I.length,m=0;m<k;m++){var S=I[m],A=S.getID(),O=void 0;S.getSource()===r?O=S.getTarget():O=S.getSource();var B=O.getID();s&&g[B]&&(n.setItemState(O,s,!1),delete g[B]),y[B]||(n.setItemState(O,o,!0),y[B]=O),g[A]&&(n.setItemState(S,s,!1),delete g[A]),y[A]||(n.setItemState(S,o,!0),y[A]=S),S.toFront()}}e.activeItems=y,e.inactiveItems=g,a&&(Kc=r.getModel().id),n.emit("afteractivaterelations",{item:t.item,action:"activate"})}},50,{trailing:!0,leading:!0}),throttleClearActiveState:Ch(function(t,e){var r=e.get("graph");if(!(!r||r.destroyed)&&e.shouldUpdate(t.item,{event:t,action:"deactivate"},e)){var n=e.activeState,a=e.inactiveState,i=e.activeItems||{},o=e.inactiveItems||{};Object.values(i).filter(function(s){return!s.destroyed}).forEach(function(s){r.clearItemStates(s,n)}),Object.values(o).filter(function(s){return!s.destroyed}).forEach(function(s){r.clearItemStates(s,a)}),e.activeItems={},e.inactiveItems={},r.emit("afteractivaterelations",{item:t.item||e.get("item"),action:"deactivate"})}},50,{trailing:!0,leading:!0})};var Qc=Math.min,nS=Math.max,aS=Math.abs,iS="shift",Ife=["drag","shift","ctrl","alt","control"];const kfe={getDefaultCfg:function(){return{brushStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},selectedState:"selected",trigger:iS,includeEdges:!0,includeCombos:!1,selectOnCombo:!1,selectedEdges:[],selectedNodes:[],selectedCombos:[]}},getEvents:function(){return Ife.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=iS,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 r=e.item,n=this.brush,a=this.selectOnCombo,i=(r==null?void 0:r.getType())==="combo";i&&!a||!i&&r||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,r=e.graph,n=e.selectedState,a=r.findAllByState("node",n),i=r.findAllByState("edge",n),o=r.findAllByState("combo",n);a.forEach(function(s){return r.setItemState(s,n,!1)}),i.forEach(function(s){return r.setItemState(s,n,!1)}),o.forEach(function(s){return r.setItemState(s,n,!1)}),this.selectedNodes=[],this.selectedEdges=[],this.selectedCombos=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges,this.selectedCombos),r.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})},isBBoxCenterInRect:function(e,r,n,a,i){var o=e.getBBox();return o.centerX>=r&&o.centerX<=n&&o.centerY>=a&&o.centerY<=i},getSelectedNodes:function(e){var r=this,n=this,a=n.graph,i=n.originPoint,o=n.shouldUpdate,s=n.isBBoxCenterInRect,u=this.selectedState,f={x:e.x,y:e.y},l=a.getPointByCanvas(i.x,i.y),c=Qc(f.x,l.x),h=nS(f.x,l.x),d=Qc(f.y,l.y),v=nS(f.y,l.y),p=[],g=[];a.getNodes().forEach(function(b){if(b.isVisible()&&s(b,c,h,d,v)&&o(b,"select",r)){p.push(b);var w=b.getModel();g.push(w.id),a.setItemState(b,u,!0)}});var y=[];this.includeEdges&&p.forEach(function(b){var w=b.getOutEdges();w.forEach(function(x){if(x.isVisible()){var E=x.getModel(),_=E.source,S=E.target;g.includes(_)&&g.includes(S)&&o(x,"select",r)&&(y.push(x),a.setItemState(x,r.selectedState,!0))}})});var m=[];this.includeCombos&&a.getCombos().forEach(function(b){if(b.isVisible()&&s(b,c,h,d,v)&&o(b,"select",r)){m.push(b);var w=b.getModel();g.push(w.id),a.setItemState(b,u,!0)}}),this.selectedEdges=y,this.selectedNodes=p,this.selectedCombos=m,this.onSelect&&this.onSelect(p,y,m),a.emit("nodeselectchange",{selectedItems:{nodes:p,edges:y,combos:m},select:!0})},createBrush:function(){var e=this,r=e.graph.get("canvas").addShape("rect",{attrs:e.brushStyle,capture:!1,name:"brush-shape"});return this.brush=r,this.delegate=r,r},updateBrush:function(e){var r=this.originPoint;this.brush.attr({width:aS(e.canvasX-r.x),height:aS(e.canvasY-r.y),x:Qc(e.canvasX,r.x),y:Qc(e.canvasY,r.y)})},onKeyDown:function(e){var r=e.key;if(r){var n=this.trigger.toLowerCase(),a=r.toLowerCase();a===n||a==="control"&&n==="ctrl"||a==="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 oS="shift",Nfe=["shift","ctrl","alt","control"];const Ofe={getDefaultCfg:function(){return{multiple:!0,trigger:oS,selectedState:"selected",selectNode:!0,selectEdge:!1,selectCombo:!0}},getEvents:function(){var e=this;return Nfe.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=oS,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 r=this,n=e.item;if(!(!n||n.destroyed)){var a=n.getType(),i=r.graph,o=r.keydown,s=r.multiple,u=r.shouldUpdate,f=r.shouldBegin;if(f(e,r)){if(!o||!s){var l=i.findAllByState("node",r.selectedState).concat(i.findAllByState("edge",r.selectedState)).concat(i.findAllByState("combo",r.selectedState));_e(l,function(p){p!==n&&i.setItemState(p,r.selectedState,!1)})}var c=function(){switch(a){case"node":return r.selectNode;case"edge":return r.selectEdge;case"combo":return r.selectCombo;default:return!1}}();if(!c){var h=i.findAllByState("node",r.selectedState),d=i.findAllByState("edge",r.selectedState),v=i.findAllByState("combo",r.selectedState);i.emit("nodeselectchange",{selectedItems:{nodes:h,edges:d,combos:v},select:!1});return}if(n.hasState(r.selectedState)){u(e,r)&&i.setItemState(n,r.selectedState,!1);var h=i.findAllByState("node",r.selectedState),d=i.findAllByState("edge",r.selectedState),v=i.findAllByState("combo",r.selectedState);i.emit("nodeselectchange",{target:n,selectedItems:{nodes:h,edges:d,combos:v},select:!1})}else{u(e,r)&&i.setItemState(n,r.selectedState,!0);var h=i.findAllByState("node",r.selectedState),d=i.findAllByState("edge",r.selectedState),v=i.findAllByState("combo",r.selectedState);i.emit("nodeselectchange",{target:n,selectedItems:{nodes:h,edges:d,combos:v},select:!0})}}}},onCanvasClick:function(e){var r=this,n=this,a=n.graph,i=n.shouldBegin;if(i(e,this)){var o=a.findAllByState("node",this.selectedState);_e(o,function(f){a.setItemState(f,r.selectedState,!1)});var s=a.findAllByState("edge",this.selectedState);_e(s,function(f){a.setItemState(f,r.selectedState,!1)});var u=a.findAllByState("combo",this.selectedState);_e(u,function(f){a.setItemState(f,r.selectedState,!1)}),a.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})}},onKeyDown:function(e){var r=this,n=e.key;n&&(n.toLowerCase()===this.trigger.toLowerCase()||n.toLowerCase()==="control"?r.keydown=!0:r.keydown=!1)},onKeyUp:function(){var e=this;e.keydown=!1}};var Lfe=eo,Jc=.05;const Dfe={getDefaultCfg:function(){return this.isFireFox=SO()==="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 r=e.originalEvent.touches,n=r[0],a=r[1];e.preventDefault(),a&&(this.shouldBegin&&!this.shouldBegin(e,this)||(this.startPoint={pageX:n.pageX,pageY:n.pageY},this.moveable=!0,a&&(this.endPoint={pageX:a.pageX,pageY:a.pageY}),this.originScale=this.graph.getZoom()||this.currentScale||1))},onTouchMove:function(e){if(this.moveable){e.preventDefault();var r=e.originalEvent.touches,n=r[0],a=r[1];if(a){this.endPoint||(this.endPoint={pageX:a.pageX,pageY:a.pageY});var i=function(p,g){return Math.hypot(g.x-p.x,g.y-p.y)},o=i({x:n.pageX,y:n.pageY},{x:a.pageX,y:a.pageY})/i({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 r=this,n=this,a=n.graph,i=n.fixSelectedItems;if(!(this.shouldBegin&&!this.shouldBegin(e,this))&&this.shouldUpdate(e,this)){e.preventDefault();var o=a.get("canvas"),s=o.getPointByClient(e.clientX,e.clientY),u=this.get("sensitivity"),f=a.getZoom(),l=f,c=f;this.isFireFox?e.deltaY>0||e.wheelDelta<0?l=1-Jc*u:l=1/(1-Jc*u):e.wheelDelta<0?l=1-Jc*u:l=1/(1-Jc*u),c=f*l;var h=this.get("minZoom")||a.get("minZoom"),d=this.get("maxZoom")||a.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=a.getNodes(),m=a.getEdges(),b=y.length,w=m.length;if(!g){for(var x=0;x<b;x++){var E=y[x];if(!E.destroyed)for(var _=E.get("group").get("children"),S=_.length,A=0;A<S;A++){var M=_[A];!M.destoryed&&!M.get("isKeyShape")&&(M.set("ori-visibility",M.get("ori-visibility")||M.get("visible")),M.hide())}}for(var C=0;C<w;C++)for(var I=m[C],_=I.get("group").get("children"),S=_.length,A=0;A<S;A++){var M=_[A];M.set("ori-visibility",M.get("ori-visibility")||M.get("visible")),M.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var k=setTimeout(function(){var tt=a.getZoom(),te=r.get("optimized");if(te){r.set("optimized",!1);for(var N=0;N<b;N++){var Se=y[N],Fe=Se.get("group").get("children"),ge=Fe.length;if(tt<p){var Ue=Se.getKeyShape(),$e=Ue.get("ori-visibility");Ue.set("ori-visibility",void 0),$e&&Ue.show()}else for(var Ze=0;Ze<ge;Ze++){var Je=Fe[Ze],$e=Je.get("ori-visibility");Je.set("ori-visibility",void 0),!Je.get("visible")&&$e&&$e&&Je.show()}}for(var ht=0;ht<w;ht++){var Lt=m[ht],Fe=Lt.get("group").get("children"),ge=Fe.length;if(tt<p){var Ue=Lt.getKeyShape(),$e=Ue.get("ori-visibility");Ue.set("ori-visibility",void 0),$e&&Ue.show()}else for(var Ze=0;Ze<ge;Ze++){var Je=Fe[Ze];if(!Je.get("visible")){var $e=Je.get("ori-visibility");Je.set("ori-visibility",void 0),$e&&Je.show()}}}}},100);this.set("timeout",k)}if(f<=1){var O=void 0,B=void 0;if(i.fixAll||i.fixLineWidth||i.fixLabel){O=a.findAllByState("node",i.fixState),B=a.findAllByState("edge",i.fixState);for(var L=f/c,z=O.length,X=0;X<z;X++){var E=O[X],R=E.getContainer(),V=E.getModel(),he=E.getOriginStyle(),ce=E.getStateStyle(i.fixState),le=E.get("shapeFactory").getShape(V.type).getStateStyle(i.fixState,E)[i.fixState];if(i.fixAll){if(c<=1){var ie=rr(R.getMatrix());ie||(ie=[1,0,0,0,1,0,0,0,1]);var Ie=E.getModel(),qe=Ie.x,Ve=Ie.y;ie=Lfe(ie,[["t",-qe,-Ve],["s",L,L],["t",qe,Ve]]),R.setMatrix(ie)}}else for(var _=R.get("children"),S=_.length,A=0;A<S;A++){var M=_[A],it=void 0,dt=void 0;if(i.fixLabel){var st=M.get("type");if(st==="text"){it=M.attr("fontSize")||12;var Tt=ce[M.get("name")],_t=le[M.get("name")],lr=Tt?Tt.fontSize:12,Bt=_t?_t.fontSize:12,Wt=lr||Bt||12;if(c<=1&&M.attr("fontSize",Wt/c),dt)break}}if(i.fixLineWidth&&M.get("isKeyShape")){dt=M.attr("lineWidth")||0;var vr=ce.lineWidth||le.lineWidth||he.lineWidth||0;if(c<=1&&M.attr("lineWidth",vr/c),it)break}}}for(var cr=B.length,$t=0;$t<cr;$t++)for(var I=B[$t],R=I.getContainer(),_=R.get("children"),V=I.getModel(),ce=I.getStateStyle(i.fixState),le=I.get("shapeFactory").getShape(V.type).getStateStyle(i.fixState,I)[i.fixState],S=_.length,A=0;A<S;A++){var M=_[A],it=void 0,dt=void 0;if(i.fixLabel||i.fixAll){var st=M.get("type");if(st==="text"){it=M.attr("fontSize")||12;var Tt=ce[M.get("name")],_t=le[M.get("name")],lr=Tt?Tt.fontSize:12,Bt=_t?_t.fontSize:12,Wt=lr||Bt||12;if(c<=1&&M.attr("fontSize",Wt/c),dt)break}}if((i.fixLineWidth||i.fixAll)&&M.get("isKeyShape")){dt=M.attr("lineWidth")||0;var vr=ce.lineWidth||le.lineWidth||1;if(c<=1&&M.attr("lineWidth",vr/c),it)break}}}}var sr=this.get("animate"),tn=this.get("animateCfg");a.zoomTo(c,{x:s.x,y:s.y},sr,tn),a.emit("wheelzoom",e)}}},DO={onMouseEnter:function(e){var r=e.item;this.currentTarget=r,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 r=this.container;if(!(!e.item||e.item.destroyed)){r||(r=this.createTooltip(this.graph.get("canvas")),this.container=r);var n=this.formatText(e.item.get("model"),e);Ye(n)?r.innerHTML=n:r.appendChild(n),Hu(this.container,{visibility:"visible"}),this.updatePosition(e)}},hideTooltip:function(){Hu(this.container,{visibility:"hidden"})},updatePosition:function(e){var r=this.get("shouldBegin"),n=this,a=n.width,i=n.height,o=n.container,s=n.graph;if(!r(e,this)){Hu(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>a/2?l-=h.width:l+=this.offset,c>i/2?c-=h.height:c+=this.offset;var d="".concat(l,"px"),v="".concat(c,"px");Hu(this.container,{left:d,top:v,visibility:"visible"})},createTooltip:function(e){var r=e.get("el");r.style.position="relative";var n=cg('<div class="g6-tooltip g6-'.concat(this.item,'-tooltip"></div>'));return r.parentNode.appendChild(n),Hu(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}},Pfe=P({getDefaultCfg:function(){return{item:"node",offset:12,formatText:function(r){return r.label}}},getEvents:function(){return{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},DO),Rfe=P({getDefaultCfg:function(){return{item:"edge",offset:12,formatText:function(r){return"source: ".concat(r.source," target: ").concat(r.target)}}},getEvents:function(){return{"edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},DO);var sS="click",Ffe=["click","dblclick"];const Bfe={getDefaultCfg:function(){return{trigger:sS,onChange:function(){}}},getEvents:function(){var e,r;return Ffe.includes(this.trigger)?r=this.trigger:(r=sS,console.warn("Behavior collapse-expand 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),e={},e["node:".concat(r)]="onNodeClick",e.touchstart="onNodeClick",e},onNodeClick:function(e){var r=this;if(this.trigger==="click"){if(this.timer){clearTimeout(this.timer),this.timer=0;return}this.timer=setTimeout(function(){r.toggle(e),clearTimeout(r.timer),r.timer=0},200)}else this.toggle(e)},toggle:function(e){var r=e.item;if(r){var n=this.graph.findDataById(r.get("id"));if(n){var a=n.children;if(!(!a||a.length===0)){var i=!n.collapsed;this.shouldBegin(e,i,this)&&(n.collapsed=i,r.getModel().collapsed=i,this.graph.emit("itemcollapsed",{item:e.item,collapsed:i}),this.shouldUpdate(e,i,this)&&(this.onChange(r,i,this),this.graph.layout()))}}}}};var Gfe=so.calculationItemsBBox,PO=function(e,r){if(r(e)!==!1&&e){var n=e.get("combos");if(n.length===0)return!1;_e(n,function(a){PO(a,r)})}};const zfe={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 r=e.item;if(!r||r.destroyed||!this.shouldUpdate(e,this))return!1;var n=r.getType();return n==="combo"},onMouseDown:function(e){this.origin={x:e.x,y:e.y}},onDragStart:function(e){var r=this,n=this.graph,a=e.item;if(this.currentShouldEnd=!0,!!this.validationCombo(e)&&!a.hasLocked()){this.targets=[];var i=n.findAllByState("combo",this.selectedState),o=a.get("id"),s=i.filter(function(f){var l=f.get("id");return o===l});s.length===0?this.targets.push(a):this.targets=i.filter(function(f){return!f.hasLocked()});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,r.activeState,!0)}}),this.point={},this.originPoint={},this.currentItemChildCombos=[],PO(a,function(f){if(f.destroyed)return!1;var l=f.getModel();return r.currentItemChildCombos.push(l.id),!0})}},onDrag:function(e){var r=this;if(this.origin&&this.validationCombo(e))if(this.enableDelegate)this.updateDelegate(e);else{if(this.activeState){var n=this.graph,a=e.item,i=a.getModel(),o=n.getCombos(),s=a.getBBox(),u=s.centerX,f=s.centerY,l=s.width,c=o.filter(function(h){var d=h.getModel();return i.parentId,d.id!==i.id&&!r.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,r.activeState,!0):n.setItemState(h,r.activeState,!1)})}_e(this.targets,function(h){r.updateCombo(h,e)}),this.onlyChangeComboSize&&this.updateParentCombos()}},updatePositions:function(e,r){var n=this;(this.enableDelegate||r)&&_e(this.targets,function(a){n.updateCombo(a,e,r)})},onDrop:function(e){var r=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 a=this.graph,i=n.getModel();this.targets.map(function(o){var s=o.getModel();s.parentId!==i.id?(r.activeState&&a.setItemState(n,r.activeState,!1),r.onlyChangeComboSize?a.updateCombo(o):a.updateComboTree(o,i.id,!1)):a.updateCombo(n)}),this.end(n,e),this.endComparison=!0}},onNodeDrop:function(e){var r=this;if(!(!this.targets||this.targets.length===0)){var n=this.graph,a=e.item,i=a.getModel().comboId,o=i?n.findById(i):void 0;if(this.currentShouldEnd=this.shouldEnd(e,o,this),this.updatePositions(e,!this.currentShouldEnd),!!this.currentShouldEnd){var s;if(i){if(this.activeState){var u=n.findById(i);n.setItemState(u,this.activeState,!1)}this.targets.map(function(f){r.onlyChangeComboSize?n.updateCombo(f):i!==f.getID()&&(s=n.findById(i),i!==f.getModel().parentId&&n.updateComboTree(f,i,!1))})}else this.targets.map(function(f){if(r.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 r=e.item,n=this.graph;this.activeState&&n.setItemState(r,this.activeState,!0)}},onDragLeave:function(e){if(this.origin&&this.validationCombo(e)){var r=e.item,n=this.graph;this.activeState&&n.setItemState(r,this.activeState,!1)}},onDragEnd:function(e){if(!(!this.targets||this.targets.length===0)){var r=e.item;this.currentShouldEnd&&this.updatePositions(e);var n=this.getParentCombo(r.getModel().parentId),a=this.graph;n&&this.activeState&&a.setItemState(n,this.activeState,!1),this.end(void 0,e)}},end:function(e,r){var n=this;if(this.origin){var a=this.graph;if(this.delegateShape){var i=a.get("delegateGroup");i.clear(),this.delegateShape=null}if(e&&this.activeState&&a.setItemState(e,this.activeState,!1),!e){var o=a.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)a.updateComboTree(u,void 0,o);else{a.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}),a.pushStack("update",s)}})}this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(e,r,n){var a=this;if(n===void 0&&(n={}),r(e,n)!==!1&&e){var i=e.get("combos");_e(i,function(s){a.traverse(s,r,n)});var o=e.get("nodes");_e(o,function(s){a.traverse(s,r,n)})}},updateCombo:function(e,r,n){this.updateSingleItem(e,r,n);var a={};this.traverse(e,function(i,o){return i.destroyed?!1:(i.getEdges().forEach(function(s){return o[s.getID()]=s}),!0)},a),Object.values(a).forEach(function(i){return i.refresh()})},updateSingleItem:function(e,r,n){var a=this.origin,i=this.graph,o=e.getModel(),s=e.get("id");this.point[s]||(this.point[s]={x:o.x,y:o.y});var u=r.x-a.x+this.point[s].x,f=r.y-a.y+this.point[s].y;n&&(u+=a.x-r.x,f+=a.y-r.y),i.updateItem(e,{x:u,y:f},!1)},getParentCombo:function(e){var r=this.graph;if(e){var n=r.findById(e);if(n)return n}},updateDelegate:function(e){var r=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=r.get("delegateGroup"),a=null;this.targets.length>1?a=Gfe(this.targets):a=this.targets[0].getBBox();var i=a.x,o=a.y,s=a.width,u=a.height,f=a.minX,l=a.minY;this.originPoint={x:i,y:o,width:s,height:u,minX:f,minY:l};var c=P(P({},Mf.delegateStyle),this.delegateStyle);this.delegateShape=n.addShape("rect",{attrs:P({width:a.width,height:a.height,x:a.x,y:a.y},c),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}},updateParentCombos:function(){var e=this,r=e.graph,n=e.targets,a={};n==null||n.forEach(function(i){var o=i.getModel().parentId;o&&(a[o]=r.findById(o))}),Object.values(a).forEach(function(i){i&&r.updateCombo(i)})}};var uS="dblclick",jfe=["click","dblclick"];const Ufe={getDefaultCfg:function(){return{trigger:uS,relayout:!0}},getEvents:function(){var e,r;return jfe.includes(this.trigger)?r=this.trigger:(r=uS,console.warn("Behavior collapse-expand-group 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),e={},e["combo:".concat(r)]="onComboClick",e},onComboClick:function(e){var r=e.item,n=this,a=n.graph,i=n.relayout;if(!(!r||r.destroyed||r.getType()!=="combo")){var o=r.getModel(),s=o.id;s&&(a.collapseExpandCombo(s),i&&a.get("layout")?a.layout():a.refreshPositions())}}};var $fe=so.isPolygonsIntersect,Xfe=so.pathToPoints,fS="shift",Wfe=["drag","shift","ctrl","alt","control"],Vfe=function(e,r){var n,a=e.getKeyShape();if(e.get("type")==="path")n=Xfe(a.attr("path"));else{var i=a.getCanvasBBox();n=[[i.minX,i.minY],[i.maxX,i.minY],[i.maxX,i.maxY],[i.minX,i.maxY]]}return $fe(r,n)};const Yfe={getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:fS,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return Wfe.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=fS,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 r=this.lasso,n=e.item;n||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates("dragstart"),r||(r=this.createLasso()),this.dragging=!0,this.originPoint={x:e.x,y:e.y},this.points.push(this.originPoint),r.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,r=[];return e.length&&(e.forEach(function(n,a){a===0?r.push(["M",n.x,n.y]):r.push(["L",n.x,n.y])}),r.push(["L",e[0].x,e[0].y])),r},clearStates:function(e){e===void 0&&(e="canvas:click");var r=this,n=r.graph,a=r.selectedState,i=r.shouldDeselect,o=n.findAllByState("node",a),s=n.findAllByState("edge",a);(!i||i({action:e,nodes:o,edges:s}))&&(o.forEach(function(u){return n.setItemState(u,a,!1)}),s.forEach(function(u){return n.setItemState(u,a,!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,r=this,n=r.graph,a=r.shouldUpdate,i=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()&&Vfe(l,i)&&a(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)&&a(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,r=e.graph.get("delegateGroup").addShape("path",{attrs:P({path:[]},e.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=r,this.delegate=r,this.points=[],r},updateLasso:function(e){var r=this;this.lasso.attr({path:r.getLassoPath()})},onKeyDown:function(e){var r=e.key;r&&(r.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 lS="click",qfe=["click","drag"],cS=void 0,Hfe=["shift","ctrl","control","alt","meta",void 0];const Zfe={getDefaultCfg:function(){return{trigger:lS,key:cS,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var e=this;qfe.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=lS,console.warn("Behavior create-edge 的 trigger 参数不合法,请输入 'click','drag'")),e.key&&Hfe.indexOf(e.key.toLowerCase())===-1&&(e.trigger=cS,console.warn("Behavior create-edge 的 key 参数不合法,请输入 'shift','ctrl','alt','control',或 undefined"));var r;return e.trigger==="drag"?r={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:e.trigger==="click"&&(r={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),e.key&&(r.keydown="onKeyDown",r.keyup="onKeyUp"),r},onDragEnd:function(e){var r=this;if(!(r.key&&!r.keydown)){var n=e.item;(!n||n.getID()===r.source||n.getType()!=="node")&&r.cancelCreating({item:r.edge,x:e.x,y:e.y})}},onClick:function(e){var r=this;if(!(r.key&&!r.keydown)){var n=e.item,a=r.graph,i=n.getModel(),o=r.getEdgeConfig;if(r.addingEdge&&r.edge){if(!r.shouldEnd(e,r))return;var s=void 0;o&&Tr(o)?s=o({source:r.source,target:i.id},r):s=r.edgeConfig;var u=P({target:i.id},s);if(r.source===i.id&&(u.type="loop"),a.emit("beforecreateedge",{}),a.updateItem(r.edge,u,!1),a.get("enabledStack")){var f=P(P({},r.edge.getModel()),{itemType:"edge"}),l={};l.edges=[f],a.pushStack("add",{before:{},after:l})}a.emit("aftercreateedge",{edge:r.edge}),r.edge.getKeyShape().set("capture",!0),r.edge=null,r.addingEdge=!1}else{if(!r.shouldBegin(e,r))return;var s=void 0;o&&Tr(o)?s=o({source:i.id,target:i.id},r):s=r.edgeConfig,r.edge=a.addItem("edge",P({source:i.id,target:i.id},s),!1),r.source=i.id,r.addingEdge=!0,r.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(e){var r=this;if(!(r.key&&!r.keydown)){r.edge&&r.edge.destroyed&&r.cancelCreating({item:r.edge});var n={x:e.x,y:e.y};if(!r.graph.findById(r.source)){r.addingEdge=!1;return}r.addingEdge&&r.edge&&r.graph.updateItem(r.edge,{target:n},!1)}},cancelCreating:function(e){var r,n,a=this;if(!(a.key&&!a.keydown)){var i=a.graph,o=e.item;if(a.addingEdge&&(a.edge===o||!((n=(r=e.target)===null||r===void 0?void 0:r.isCanvas)===null||n===void 0)&&n.call(r))){a.edge&&!a.edge.destroyed&&i.removeItem(a.edge,!1),a.edge=null,a.addingEdge=!1;return}}},onKeyDown:function(e){var r=this,n=e.key;n&&(n.toLowerCase()===r.key.toLowerCase()?r.keydown=!0:r.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 hS="ctrl",Kfe=["shift","ctrl","alt","control"],Qfe="1";const Jfe={getDefaultCfg:function(){return{trigger:hS,combinedKey:Qfe,functionName:"fitView",functionParams:[]}},getEvents:function(){return Kfe.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=hS,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 r=e.key;if(r){var n=this.trigger.toLowerCase(),a=r.toLowerCase();this.triggerKeydown||(a===n||a==="control"&&n==="ctrl"||a==="ctrl"&&n==="control"?this.triggerKeydown=!0:this.triggerKeydown=!1);var i=this.graph;if(!i[this.functionName])return console.warn("Behavior shortcuts-fit-view 的 functionName 参数 '".concat(this.functionName,"' 不合法,它不是 Graph 的一个函数名")),{};if(this.triggerKeydown&&!this.combinedKey){this.functionParams&&this.functionParams.length?i[this.functionName].apply(i,this.functionParams):i[this.functionName]();return}var o=this.combinedKey.toLowerCase();this.triggerKeydown&&(a===o||a==="control"&&o==="ctrl"||a==="ctrl"&&o==="control")&&(this.functionParams&&this.functionParams.length?i[this.functionName].apply(i,this.functionParams):i[this.functionName]())}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.triggerKeydown=!1}};var ele=["shift","ctrl","alt","control","meta"];const tle={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0,allowDragOnItem:!0}},getEvents:function(){return(!this.zoomKey||ele.indexOf(this.zoomKey)===-1)&&(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(e){var r=this;if(this.allowDrag(e)){var n=this.graph,a=Array.isArray(this.zoomKey)?[].concat(this.zoomKey):[this.zoomKey];a.includes("control")&&a.push("ctrl");var i=a.some(function(V){return e["".concat(V,"Key")]});if(i){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 w=this.get("enableOptimize");if(w){var x=this.get("optimizeZoom"),E=this.get("optimized"),_=n.getNodes(),S=n.getEdges(),A=_.length,M=S.length;if(!E){for(var C=0;C<A;C++){var I=_[C];if(!I.destroyed)for(var k=I.get("group").get("children"),O=k.length,B=0;B<O;B++){var L=k[B];!L.destoryed&&!L.get("isKeyShape")&&(L.set("ori-visibility",L.get("ori-visibility")||L.get("visible")),L.hide())}}for(var z=0;z<M;z++)for(var X=S[z],k=X.get("group").get("children"),O=k.length,B=0;B<O;B++){var L=k[B];L.set("ori-visibility",L.get("ori-visibility")||L.get("visible")),L.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var R=setTimeout(function(){var V=n.getZoom(),he=r.get("optimized");if(he){r.set("optimized",!1);for(var ce=0;ce<A;ce++){var le=_[ce],ie=le.get("group").get("children"),Ie=ie.length;if(V<x){var qe=le.getKeyShape(),Ve=qe.get("ori-visibility");Ve&&qe.show()}else for(var it=0;it<Ie;it++){var dt=ie[it],Ve=dt.get("ori-visibility");!dt.get("visible")&&Ve&&Ve&&dt.show()}}for(var st=0;st<M;st++){var Tt=S[st],ie=Tt.get("group").get("children"),Ie=ie.length;if(V<x){var qe=Tt.getKeyShape(),Ve=qe.get("ori-visibility");Ve&&qe.show()}else for(var it=0;it<Ie;it++){var dt=ie[it];if(!dt.get("visible")){var Ve=dt.get("ori-visibility");Ve&&dt.show()}}}}},100);this.set("timeout",R)}}},allowDrag:function(e){var r,n,a=e.target,i=a&&a.isCanvas&&a.isCanvas();if(Qf(this.allowDragOnItem)&&!this.allowDragOnItem&&!i)return!1;if(gn(this.allowDragOnItem)){var o=this.allowDragOnItem,s=o.node,u=o.edge,f=o.combo,l=(n=(r=e.item)===null||r===void 0?void 0:r.getType)===null||n===void 0?void 0:n.call(r);if(!s&&l==="node"||!u&&l==="edge"||!f&&l==="combo")return!1}return!0}};var rle={"drag-canvas":Afe,"zoom-canvas":Dfe,"drag-node":Cfe,"activate-relations":Tfe,"brush-select":kfe,"click-select":Ofe,"lasso-select":Yfe,tooltip:Pfe,"edge-tooltip":Rfe,"collapse-expand":Bfe,"drag-combo":zfe,"collapse-expand-combo":Ufe,"create-edge":Zfe,"shortcuts-call":Jfe,"scroll-canvas":tle};_e(rle,function(t,e){G8(e,t)});P(P({},jG),n9);const nle={class:"page"},ale={class:"page-header"},ile={__name:"Topology",setup(t){const e=LP().is_admin;let r=null,n=null;function a(){return document.documentElement.classList.contains("dark")}function i(){return a()?"#0f172a":"#ffffff"}function o(){return a()?"#f8fafc":"#111827"}function s(){return a()?"#020617":"#fafafa"}function u(){const h=document.getElementById("topo");!h||!r||(h.style.background=s(),r.getNodes().forEach(d=>{const v=d.getModel();r.updateItem(d,{style:{fill:i(),stroke:l(v.os),lineWidth:2,radius:8,shadowColor:a()?"rgba(0,0,0,0.5)":"rgba(0,0,0,0.06)",shadowBlur:8,shadowOffsetY:2},labelCfg:{style:{fill:o(),fontSize:13,fontWeight:600}},badgeCfg:{position:"topRight",style:{fill:v.online?"#22c55e":"#ef4444",stroke:i(),lineWidth:2}}})}),r.getEdges().forEach(d=>{const v=d.getModel(),g=String(v.id).startsWith("rel-")?"#f97316":"#3b82f6";r.updateItem(d,{labelCfg:{style:{fill:g,fontSize:11,fontWeight:500,background:{fill:i(),padding:[2,4],radius:4}}}})}),r.paint())}EP(async()=>{const[h,d,v]=await Promise.all([_P(),SP(),MP()]),p=h.data,g=d.data,y=v.data,m={};p.forEach(A=>m[A.id]=A);const b=a(),w=i(),x=o(),E=p.map(A=>({id:String(A.id),label:A.hostname,online:A.is_online,os:A.os_type,style:{fill:w,stroke:l(A.os_type),lineWidth:2,radius:8,shadowColor:b?"rgba(0,0,0,0.5)":"rgba(0,0,0,0.06)",shadowBlur:8,shadowOffsetY:2},labelCfg:{style:{fill:x,fontSize:13,fontWeight:600}},badgeCfg:{position:"topRight",style:{fill:A.is_online?"#22c55e":"#ef4444",stroke:w,lineWidth:2}}})),_=[];y.forEach(A=>{!m[A.source_machine_id]||!m[A.target_machine_id]||_.push({id:`rel-${A.id}`,source:String(A.source_machine_id),target:String(A.target_machine_id),label:c(A),style:{stroke:"#f97316",lineDash:[4,2],lineWidth:1.5,endArrow:{path:"M 0,0 L 8,4 L 8,-4 Z",fill:"#f97316"}},labelCfg:{style:{fill:"#f97316",fontSize:11,fontWeight:500,background:{fill:w,padding:[2,4],radius:4}}}})}),g.forEach(A=>{A.target_machine_id&&m[A.target_machine_id]&&_.push({id:`svc-${A.id}`,source:String(A.machine_id),target:String(A.target_machine_id),label:A.name,style:{stroke:"#3b82f6",lineWidth:2,endArrow:{path:"M 0,0 L 8,4 L 8,-4 Z",fill:"#3b82f6"}},labelCfg:{style:{fill:"#3b82f6",fontSize:11,fontWeight:500,background:{fill:w,padding:[2,4],radius:4}}}})});const S=document.getElementById("topo");S.style.background=s(),r=new AO({container:"topo",width:S.clientWidth,height:S.clientHeight,layout:{type:"force",preventOverlap:!0,linkDistance:140,nodeStrength:-80,edgeStrength:.2},defaultNode:{type:"rect",size:[110,40]},defaultEdge:{type:"line",style:{endArrow:!0}},modes:{default:["drag-node","drag-canvas","zoom-canvas"]},fitView:!0,fitViewPadding:20}),r.data({nodes:E,edges:_}),r.render(),r.on("node:click",A=>{const M=A.item.getModel().id;f(M)}),window.addEventListener("resize",()=>{const A=document.getElementById("topo");A&&r&&(r.changeSize(A.clientWidth,A.clientHeight),r.fitView())}),n=new MutationObserver(()=>{u()}),n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})}),AP(()=>{n&&n.disconnect(),r&&(r.destroy(),r=null)});function f(h){if(!r)return;const d=r.getEdges();d.forEach(v=>{const p=v.getModel();p.source===h||p.target===h?(r.setItemState(v,"active",!0),v.update({style:{opacity:1}})):(r.setItemState(v,"inactive",!0),v.update({style:{opacity:.15}}))}),setTimeout(()=>{d.forEach(v=>{r.clearItemStates(v),v.update({style:{opacity:1}})})},2e3)}function l(h){switch(h){case"Linux":return"#3b82f6";case"Windows":return"#06b6d4";case"macOS":return"#a855f7";default:return"#9ca3af"}}function c(h){const v={port_forward:"端口转发",dependency:"依赖",primary_secondary:"主从",custom:"自定义"}[h.relation_type]||h.relation_type;return h.source_port?`${v} (${h.source_port})`:v}return(h,d)=>{const v=DP("el-button");return iw(),CP("div",nle,[rc("div",ale,[d[2]||(d[2]=rc("div",null,[rc("div",{class:"page-title"},"拓扑图"),rc("div",{class:"page-subtitle"},"展示机器之间的服务指向和关联关系")],-1)),ow(e)?(iw(),TP(v,{key:0,type:"primary",icon:ow(kP),onClick:d[0]||(d[0]=p=>h.$router.push("/machines"))},{default:IP(()=>[...d[1]||(d[1]=[PP("添加机器",-1)])]),_:1},8,["icon"])):NP("",!0)]),d[3]||(d[3]=OP('<div class="topo-card" data-v-1d46321d><div id="topo" class="topo-canvas" data-v-1d46321d></div><div class="legend" data-v-1d46321d><div class="legend-item" data-v-1d46321d><span class="dot online" data-v-1d46321d></span> 在线</div><div class="legend-item" data-v-1d46321d><span class="dot offline" data-v-1d46321d></span> 离线</div><div class="legend-item" data-v-1d46321d><span class="line service" data-v-1d46321d></span> 服务指向</div><div class="legend-item" data-v-1d46321d><span class="line relation" data-v-1d46321d></span> 关联关系</div></div></div>',1))])}}},ule=RP(ile,[["__scopeId","data-v-1d46321d"]]);export{ule as default};
|